@walletconnect/ethereum-provider 2.17.1 → 2.17.2

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(gn,fr){typeof exports=="object"&&typeof module<"u"?fr(exports):typeof define=="function"&&define.amd?define(["exports"],fr):(gn=typeof globalThis<"u"?globalThis:gn||self,fr(gn["@walletconnect/ethereum-provider"]={}))})(this,function(gn){"use strict";var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function z6(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function zu(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var qr={exports:{}},ga=typeof Reflect=="object"?Reflect:null,tg=ga&&typeof ga.apply=="function"?ga.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Xf;ga&&typeof ga.ownKeys=="function"?Xf=ga.ownKeys:Object.getOwnPropertySymbols?Xf=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xf=function(e){return Object.getOwnPropertyNames(e)};function k6(r){console&&console.warn&&console.warn(r)}var rg=Number.isNaN||function(e){return e!==e};function Jt(){Jt.init.call(this)}qr.exports=Jt,qr.exports.once=K6,Jt.EventEmitter=Jt,Jt.prototype._events=void 0,Jt.prototype._eventsCount=0,Jt.prototype._maxListeners=void 0;var ig=10;function el(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(Jt,"defaultMaxListeners",{enumerable:!0,get:function(){return ig},set:function(r){if(typeof r!="number"||r<0||rg(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");ig=r}}),Jt.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},Jt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||rg(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 ng(r){return r._maxListeners===void 0?Jt.defaultMaxListeners:r._maxListeners}Jt.prototype.getMaxListeners=function(){return ng(this)},Jt.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var f=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw f.context=a,f}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")tg(h,this,t);else for(var u=h.length,g=fg(h,u),i=0;i<u;++i)tg(g[i],this,t);return!0};function sg(r,e,t,i){var n,s,a;if(el(t),s=r._events,s===void 0?(s=r._events=Object.create(null),r._eventsCount=0):(s.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),s=r._events),a=s[e]),a===void 0)a=s[e]=t,++r._eventsCount;else if(typeof a=="function"?a=s[e]=i?[t,a]:[a,t]:i?a.unshift(t):a.push(t),n=ng(r),n>0&&a.length>n&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=r,f.type=e,f.count=a.length,k6(f)}return r}Jt.prototype.addListener=function(e,t){return sg(this,e,t,!1)},Jt.prototype.on=Jt.prototype.addListener,Jt.prototype.prependListener=function(e,t){return sg(this,e,t,!0)};function H6(){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 og(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=H6.bind(i);return n.listener=t,i.wrapFn=n,n}Jt.prototype.once=function(e,t){return el(t),this.on(e,og(this,e,t)),this},Jt.prototype.prependOnceListener=function(e,t){return el(t),this.prependListener(e,og(this,e,t)),this},Jt.prototype.removeListener=function(e,t){var i,n,s,a,f;if(el(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){f=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():j6(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,f||t)}return this},Jt.prototype.off=Jt.prototype.removeListener,Jt.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),a;for(n=0;n<s.length;++n)a=s[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this};function ag(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?W6(n):fg(n,n.length)}Jt.prototype.listeners=function(e){return ag(this,e,!0)},Jt.prototype.rawListeners=function(e){return ag(this,e,!1)},Jt.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):cg.call(r,e)},Jt.prototype.listenerCount=cg;function cg(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Jt.prototype.eventNames=function(){return this._eventsCount>0?Xf(this._events):[]};function fg(r,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=r[i];return t}function j6(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function W6(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function K6(r,e){return new Promise(function(t,i){function n(a){r.removeListener(e,s),i(a)}function s(){typeof r.removeListener=="function"&&r.removeListener("error",n),t([].slice.call(arguments))}lg(r,e,s,{once:!0}),e!=="error"&&V6(r,n,{once:!0})})}function V6(r,e,t){typeof r.on=="function"&&lg(r,"error",e,t)}function lg(r,e,t,i){if(typeof r.on=="function")i.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function n(s){i.once&&r.removeEventListener(e,n),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var hg=function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return r.concat(s||Array.prototype.slice.call(e))},G6=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),Y6=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),J6=function(){function r(e,t,i,n){this.name=e,this.version=t,this.os=i,this.bot=n,this.type="bot-device"}return r}(),Q6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),Z6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),X6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,e5=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ug=3,t5=[["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",X6]],dg=[["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 r5(r){return r?pg(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Z6:typeof navigator<"u"?pg(navigator.userAgent):s5()}function i5(r){return r!==""&&t5.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function pg(r){var e=i5(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new Q6;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<ug&&(n=hg(hg([],n,!0),o5(ug-n.length),!0)):n=[];var s=n.join("."),a=n5(r),f=e5.exec(r);return f&&f[1]?new J6(t,s,a,f[1]):new G6(t,s,a)}function n5(r){for(var e=0,t=dg.length;e<t;e++){var i=dg[e],n=i[0],s=i[1],a=s.exec(r);if(a)return n}return null}function s5(){var r=typeof process<"u"&&process.version;return r?new Y6(process.version.slice(1)):null}function o5(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var Ae={};/*! *****************************************************************************
1
+ (function(bn,fr){typeof exports=="object"&&typeof module<"u"?fr(exports):typeof define=="function"&&define.amd?define(["exports"],fr):(bn=typeof globalThis<"u"?globalThis:bn||self,fr(bn["@walletconnect/ethereum-provider"]={}))})(this,function(bn){"use strict";var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function z6(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function zu(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var qr={exports:{}},ga=typeof Reflect=="object"?Reflect:null,tg=ga&&typeof ga.apply=="function"?ga.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Xf;ga&&typeof ga.ownKeys=="function"?Xf=ga.ownKeys:Object.getOwnPropertySymbols?Xf=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xf=function(e){return Object.getOwnPropertyNames(e)};function H6(r){console&&console.warn&&console.warn(r)}var rg=Number.isNaN||function(e){return e!==e};function Jt(){Jt.init.call(this)}qr.exports=Jt,qr.exports.once=K6,Jt.EventEmitter=Jt,Jt.prototype._events=void 0,Jt.prototype._eventsCount=0,Jt.prototype._maxListeners=void 0;var ig=10;function el(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(Jt,"defaultMaxListeners",{enumerable:!0,get:function(){return ig},set:function(r){if(typeof r!="number"||r<0||rg(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");ig=r}}),Jt.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},Jt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||rg(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 ng(r){return r._maxListeners===void 0?Jt.defaultMaxListeners:r._maxListeners}Jt.prototype.getMaxListeners=function(){return ng(this)},Jt.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var f=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw f.context=a,f}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")tg(h,this,t);else for(var u=h.length,g=fg(h,u),i=0;i<u;++i)tg(g[i],this,t);return!0};function sg(r,e,t,i){var n,s,a;if(el(t),s=r._events,s===void 0?(s=r._events=Object.create(null),r._eventsCount=0):(s.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),s=r._events),a=s[e]),a===void 0)a=s[e]=t,++r._eventsCount;else if(typeof a=="function"?a=s[e]=i?[t,a]:[a,t]:i?a.unshift(t):a.push(t),n=ng(r),n>0&&a.length>n&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=r,f.type=e,f.count=a.length,H6(f)}return r}Jt.prototype.addListener=function(e,t){return sg(this,e,t,!1)},Jt.prototype.on=Jt.prototype.addListener,Jt.prototype.prependListener=function(e,t){return sg(this,e,t,!0)};function k6(){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 og(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=k6.bind(i);return n.listener=t,i.wrapFn=n,n}Jt.prototype.once=function(e,t){return el(t),this.on(e,og(this,e,t)),this},Jt.prototype.prependOnceListener=function(e,t){return el(t),this.prependListener(e,og(this,e,t)),this},Jt.prototype.removeListener=function(e,t){var i,n,s,a,f;if(el(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){f=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():j6(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,f||t)}return this},Jt.prototype.off=Jt.prototype.removeListener,Jt.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),a;for(n=0;n<s.length;++n)a=s[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this};function ag(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?W6(n):fg(n,n.length)}Jt.prototype.listeners=function(e){return ag(this,e,!0)},Jt.prototype.rawListeners=function(e){return ag(this,e,!1)},Jt.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):cg.call(r,e)},Jt.prototype.listenerCount=cg;function cg(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Jt.prototype.eventNames=function(){return this._eventsCount>0?Xf(this._events):[]};function fg(r,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=r[i];return t}function j6(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function W6(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function K6(r,e){return new Promise(function(t,i){function n(a){r.removeListener(e,s),i(a)}function s(){typeof r.removeListener=="function"&&r.removeListener("error",n),t([].slice.call(arguments))}lg(r,e,s,{once:!0}),e!=="error"&&V6(r,n,{once:!0})})}function V6(r,e,t){typeof r.on=="function"&&lg(r,"error",e,t)}function lg(r,e,t,i){if(typeof r.on=="function")i.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function n(s){i.once&&r.removeEventListener(e,n),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var hg=function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return r.concat(s||Array.prototype.slice.call(e))},G6=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),Y6=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),J6=function(){function r(e,t,i,n){this.name=e,this.version=t,this.os=i,this.bot=n,this.type="bot-device"}return r}(),Q6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),Z6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),X6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,e5=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ug=3,t5=[["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",X6]],dg=[["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 r5(r){return r?pg(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Z6:typeof navigator<"u"?pg(navigator.userAgent):s5()}function i5(r){return r!==""&&t5.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function pg(r){var e=i5(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new Q6;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<ug&&(n=hg(hg([],n,!0),o5(ug-n.length),!0)):n=[];var s=n.join("."),a=n5(r),f=e5.exec(r);return f&&f[1]?new J6(t,s,a,f[1]):new G6(t,s,a)}function n5(r){for(var e=0,t=dg.length;e<t;e++){var i=dg[e],n=i[0],s=i[1],a=s.exec(r);if(a)return n}return null}function s5(){var r=typeof process<"u"&&process.version;return r?new Y6(process.version.slice(1)):null}function o5(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var Ae={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -11,23 +11,23 @@
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 ku=function(r,e){return ku=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},ku(r,e)};function a5(r,e){ku(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Hu=function(){return Hu=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Hu.apply(this,arguments)};function c5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function f5(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function l5(r,e){return function(t,i){e(t,i,r)}}function h5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function u5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function d5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function p5(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function g5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function ju(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function gg(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function v5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(gg(arguments[e]));return r}function m5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function Mc(r){return this instanceof Mc?(this.v=r,this):new Mc(r)}function b5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(P){i[P]&&(n[P]=function(M){return new Promise(function(O,$){s.push([P,M,O,$])>1||f(P,M)})})}function f(P,M){try{h(i[P](M))}catch(O){w(s[0][3],O)}}function h(P){P.value instanceof Mc?Promise.resolve(P.value.v).then(u,g):w(s[0][2],P)}function u(P){f("next",P)}function g(P){f("throw",P)}function w(P,M){P(M),s.shift(),s.length&&f(s[0][0],s[0][1])}}function w5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:Mc(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function y5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof ju=="function"?ju(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function _5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function x5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function A5(r){return r&&r.__esModule?r:{default:r}}function E5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function S5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var I5=Object.freeze({__proto__:null,__extends:a5,get __assign(){return Hu},__rest:c5,__decorate:f5,__param:l5,__metadata:h5,__awaiter:u5,__generator:d5,__createBinding:p5,__exportStar:g5,__values:ju,__read:gg,__spread:v5,__spreadArrays:m5,__await:Mc,__asyncGenerator:b5,__asyncDelegator:w5,__asyncValues:y5,__makeTemplateObject:_5,__importStar:x5,__importDefault:A5,__classPrivateFieldGet:E5,__classPrivateFieldSet:S5}),tl=zu(I5),Wu={},Cc={},vg;function M5(){if(vg)return Cc;vg=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Cc.delay=r,Cc}var wo={},Ku={},yo={},mg;function C5(){return mg||(mg=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.ONE_THOUSAND=yo.ONE_HUNDRED=void 0,yo.ONE_HUNDRED=100,yo.ONE_THOUSAND=1e3),yo}var Vu={},bg;function P5(){return bg||(bg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Vu)),Vu}var wg;function yg(){return wg||(wg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(C5(),r),e.__exportStar(P5(),r)}(Ku)),Ku}var _g;function D5(){if(_g)return wo;_g=1,Object.defineProperty(wo,"__esModule",{value:!0}),wo.fromMiliseconds=wo.toMiliseconds=void 0;const r=yg();function e(i){return i*r.ONE_THOUSAND}wo.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return wo.fromMiliseconds=t,wo}var xg;function O5(){return xg||(xg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(M5(),r),e.__exportStar(D5(),r)}(Wu)),Wu}var va={},Ag;function R5(){if(Ag)return va;Ag=1,Object.defineProperty(va,"__esModule",{value:!0}),va.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const n=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:n})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return va.Watch=r,va.default=r,va}var Gu={},Pc={},Eg;function T5(){if(Eg)return Pc;Eg=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.IWatch=void 0;class r{}return Pc.IWatch=r,Pc}var Sg;function $5(){return Sg||(Sg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),tl.__exportStar(T5(),r)}(Gu)),Gu}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(O5(),r),e.__exportStar(R5(),r),e.__exportStar($5(),r),e.__exportStar(yg(),r)})(Ae);var rr={};Object.defineProperty(rr,"__esModule",{value:!0}),rr.getLocalStorage=rr.getLocalStorageOrThrow=rr.getCrypto=rr.getCryptoOrThrow=Ig=rr.getLocation=rr.getLocationOrThrow=Yu=rr.getNavigator=rr.getNavigatorOrThrow=Dc=rr.getDocument=rr.getDocumentOrThrow=rr.getFromWindowOrThrow=rr.getFromWindow=void 0;function _o(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}rr.getFromWindow=_o;function ma(r){const e=_o(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}rr.getFromWindowOrThrow=ma;function N5(){return ma("document")}rr.getDocumentOrThrow=N5;function L5(){return _o("document")}var Dc=rr.getDocument=L5;function B5(){return ma("navigator")}rr.getNavigatorOrThrow=B5;function F5(){return _o("navigator")}var Yu=rr.getNavigator=F5;function U5(){return ma("location")}rr.getLocationOrThrow=U5;function q5(){return _o("location")}var Ig=rr.getLocation=q5;function z5(){return ma("crypto")}rr.getCryptoOrThrow=z5;function k5(){return _o("crypto")}rr.getCrypto=k5;function H5(){return ma("localStorage")}rr.getLocalStorageOrThrow=H5;function j5(){return _o("localStorage")}rr.getLocalStorage=j5;var Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});var Mg=Ju.getWindowMetadata=void 0;const Cg=rr;function W5(){let r,e;try{r=Cg.getDocumentOrThrow(),e=Cg.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),P=[];for(let M=0;M<w.length;M++){const O=w[M],$=O.getAttribute("rel");if($&&$.toLowerCase().indexOf("icon")>-1){const W=O.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(W.indexOf("/")===0)k+=W;else{const F=e.pathname.split("/");F.pop();const Y=F.join("/");k+=Y+"/"+W}P.push(k)}else if(W.indexOf("//")===0){const k=e.protocol+W;P.push(k)}else P.push(W)}}return P}function i(...w){const P=r.getElementsByTagName("meta");for(let M=0;M<P.length;M++){const O=P[M],$=["itemprop","property","name"].map(W=>O.getAttribute(W)).filter(W=>W?w.includes(W):!1);if($.length&&$){const W=O.getAttribute("content");if(W)return W}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}const a=n(),f=s(),h=e.origin,u=t();return{description:f,url:h,icons:u,name:a}}Mg=Ju.getWindowMetadata=W5;var Oc={},K5=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Pg="%[a-f0-9]{2}",Dg=new RegExp("("+Pg+")|([^%]+?)","gi"),Og=new RegExp("("+Pg+")+","gi");function Qu(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],Qu(t),Qu(i))}function V5(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Dg)||[],t=1;t<e.length;t++)r=Qu(e,t).join(""),e=r.match(Dg)||[];return r}}function G5(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=Og.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=V5(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Og.exec(r)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var a=n[s];r=r.replace(new RegExp(a,"g"),e[a])}return r}var Y5=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return G5(r)}},J5=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},Q5=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s<i.length;s++){var a=i[s],f=r[a];(n?e.indexOf(a)!==-1:e(a,f,r))&&(t[a]=f)}return t};(function(r){const e=K5,t=Y5,i=J5,n=Q5,s=F=>F==null,a=Symbol("encodeFragmentIdentifier");function f(F){switch(F.arrayFormat){case"index":return Y=>(B,z)=>{const j=B.length;return z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(Y,F),"[",j,"]"].join("")]:[...B,[g(Y,F),"[",g(j,F),"]=",g(z,F)].join("")]};case"bracket":return Y=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(Y,F),"[]"].join("")]:[...B,[g(Y,F),"[]=",g(z,F)].join("")];case"colon-list-separator":return Y=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(Y,F),":list="].join("")]:[...B,[g(Y,F),":list=",g(z,F)].join("")];case"comma":case"separator":case"bracket-separator":{const Y=F.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?z:(j=j===null?"":j,z.length===0?[[g(B,F),Y,g(j,F)].join("")]:[[z,g(j,F)].join(F.arrayFormatSeparator)])}default:return Y=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,g(Y,F)]:[...B,[g(Y,F),"=",g(z,F)].join("")]}}function h(F){let Y;switch(F.arrayFormat){case"index":return(B,z,j)=>{if(Y=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!Y){j[B]=z;return}j[B]===void 0&&(j[B]={}),j[B][Y[1]]=z};case"bracket":return(B,z,j)=>{if(Y=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!Y){j[B]=z;return}if(j[B]===void 0){j[B]=[z];return}j[B]=[].concat(j[B],z)};case"colon-list-separator":return(B,z,j)=>{if(Y=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!Y){j[B]=z;return}if(j[B]===void 0){j[B]=[z];return}j[B]=[].concat(j[B],z)};case"comma":case"separator":return(B,z,j)=>{const _=typeof z=="string"&&z.includes(F.arrayFormatSeparator),U=typeof z=="string"&&!_&&w(z,F).includes(F.arrayFormatSeparator);z=U?w(z,F):z;const ee=_||U?z.split(F.arrayFormatSeparator).map(oe=>w(oe,F)):z===null?z:w(z,F);j[B]=ee};case"bracket-separator":return(B,z,j)=>{const _=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!_){j[B]=z&&w(z,F);return}const U=z===null?[]:z.split(F.arrayFormatSeparator).map(ee=>w(ee,F));if(j[B]===void 0){j[B]=U;return}j[B]=[].concat(j[B],U)};default:return(B,z,j)=>{if(j[B]===void 0){j[B]=z;return}j[B]=[].concat(j[B],z)}}}function u(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(F,Y){return Y.encode?Y.strict?e(F):encodeURIComponent(F):F}function w(F,Y){return Y.decode?t(F):F}function P(F){return Array.isArray(F)?F.sort():typeof F=="object"?P(Object.keys(F)).sort((Y,B)=>Number(Y)-Number(B)).map(Y=>F[Y]):F}function M(F){const Y=F.indexOf("#");return Y!==-1&&(F=F.slice(0,Y)),F}function O(F){let Y="";const B=F.indexOf("#");return B!==-1&&(Y=F.slice(B)),Y}function $(F){F=M(F);const Y=F.indexOf("?");return Y===-1?"":F.slice(Y+1)}function W(F,Y){return Y.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):Y.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function k(F,Y){Y=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},Y),u(Y.arrayFormatSeparator);const B=h(Y),z=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return z;for(const j of F.split("&")){if(j==="")continue;let[_,U]=i(Y.decode?j.replace(/\+/g," "):j,"=");U=U===void 0?null:["comma","separator","bracket-separator"].includes(Y.arrayFormat)?U:w(U,Y),B(w(_,Y),U,z)}for(const j of Object.keys(z)){const _=z[j];if(typeof _=="object"&&_!==null)for(const U of Object.keys(_))_[U]=W(_[U],Y);else z[j]=W(_,Y)}return Y.sort===!1?z:(Y.sort===!0?Object.keys(z).sort():Object.keys(z).sort(Y.sort)).reduce((j,_)=>{const U=z[_];return U&&typeof U=="object"&&!Array.isArray(U)?j[_]=P(U):j[_]=U,j},Object.create(null))}r.extract=$,r.parse=k,r.stringify=(F,Y)=>{if(!F)return"";Y=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},Y),u(Y.arrayFormatSeparator);const B=U=>Y.skipNull&&s(F[U])||Y.skipEmptyString&&F[U]==="",z=f(Y),j={};for(const U of Object.keys(F))B(U)||(j[U]=F[U]);const _=Object.keys(j);return Y.sort!==!1&&_.sort(Y.sort),_.map(U=>{const ee=F[U];return ee===void 0?"":ee===null?g(U,Y):Array.isArray(ee)?ee.length===0&&Y.arrayFormat==="bracket-separator"?g(U,Y)+"[]":ee.reduce(z(U),[]).join("&"):g(U,Y)+"="+g(ee,Y)}).filter(U=>U.length>0).join("&")},r.parseUrl=(F,Y)=>{Y=Object.assign({decode:!0},Y);const[B,z]=i(F,"#");return Object.assign({url:B.split("?")[0]||"",query:k($(F),Y)},Y&&Y.parseFragmentIdentifier&&z?{fragmentIdentifier:w(z,Y)}:{})},r.stringifyUrl=(F,Y)=>{Y=Object.assign({encode:!0,strict:!0,[a]:!0},Y);const B=M(F.url).split("?")[0]||"",z=r.extract(F.url),j=r.parse(z,{sort:!1}),_=Object.assign(j,F.query);let U=r.stringify(_,Y);U&&(U=`?${U}`);let ee=O(F.url);return F.fragmentIdentifier&&(ee=`#${Y[a]?g(F.fragmentIdentifier,Y):F.fragmentIdentifier}`),`${B}${U}${ee}`},r.pick=(F,Y,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[a]:!1},B);const{url:z,query:j,fragmentIdentifier:_}=r.parseUrl(F,B);return r.stringifyUrl({url:z,query:n(j,Y),fragmentIdentifier:_},B)},r.exclude=(F,Y,B)=>{const z=Array.isArray(Y)?j=>!Y.includes(j):(j,_)=>!Y(j,_);return r.pick(F,z,B)}})(Oc);var Rg={exports:{}};/**
14
+ ***************************************************************************** */var Hu=function(r,e){return Hu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Hu(r,e)};function a5(r,e){Hu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ku=function(){return ku=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},ku.apply(this,arguments)};function c5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function f5(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function l5(r,e){return function(t,i){e(t,i,r)}}function h5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function u5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function d5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function p5(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function g5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function ju(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function gg(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function v5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(gg(arguments[e]));return r}function m5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function Mc(r){return this instanceof Mc?(this.v=r,this):new Mc(r)}function b5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(P){i[P]&&(n[P]=function(M){return new Promise(function(O,$){s.push([P,M,O,$])>1||f(P,M)})})}function f(P,M){try{h(i[P](M))}catch(O){w(s[0][3],O)}}function h(P){P.value instanceof Mc?Promise.resolve(P.value.v).then(u,g):w(s[0][2],P)}function u(P){f("next",P)}function g(P){f("throw",P)}function w(P,M){P(M),s.shift(),s.length&&f(s[0][0],s[0][1])}}function w5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:Mc(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function y5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof ju=="function"?ju(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function _5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function x5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function A5(r){return r&&r.__esModule?r:{default:r}}function E5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function S5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var I5=Object.freeze({__proto__:null,__extends:a5,get __assign(){return ku},__rest:c5,__decorate:f5,__param:l5,__metadata:h5,__awaiter:u5,__generator:d5,__createBinding:p5,__exportStar:g5,__values:ju,__read:gg,__spread:v5,__spreadArrays:m5,__await:Mc,__asyncGenerator:b5,__asyncDelegator:w5,__asyncValues:y5,__makeTemplateObject:_5,__importStar:x5,__importDefault:A5,__classPrivateFieldGet:E5,__classPrivateFieldSet:S5}),tl=zu(I5),Wu={},Cc={},vg;function M5(){if(vg)return Cc;vg=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Cc.delay=r,Cc}var yo={},Ku={},_o={},mg;function C5(){return mg||(mg=1,Object.defineProperty(_o,"__esModule",{value:!0}),_o.ONE_THOUSAND=_o.ONE_HUNDRED=void 0,_o.ONE_HUNDRED=100,_o.ONE_THOUSAND=1e3),_o}var Vu={},bg;function P5(){return bg||(bg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Vu)),Vu}var wg;function yg(){return wg||(wg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(C5(),r),e.__exportStar(P5(),r)}(Ku)),Ku}var _g;function D5(){if(_g)return yo;_g=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.fromMiliseconds=yo.toMiliseconds=void 0;const r=yg();function e(i){return i*r.ONE_THOUSAND}yo.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return yo.fromMiliseconds=t,yo}var xg;function O5(){return xg||(xg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(M5(),r),e.__exportStar(D5(),r)}(Wu)),Wu}var va={},Ag;function R5(){if(Ag)return va;Ag=1,Object.defineProperty(va,"__esModule",{value:!0}),va.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const n=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:n})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return va.Watch=r,va.default=r,va}var Gu={},Pc={},Eg;function T5(){if(Eg)return Pc;Eg=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.IWatch=void 0;class r{}return Pc.IWatch=r,Pc}var Sg;function $5(){return Sg||(Sg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),tl.__exportStar(T5(),r)}(Gu)),Gu}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(O5(),r),e.__exportStar(R5(),r),e.__exportStar($5(),r),e.__exportStar(yg(),r)})(Ae);var rr={};Object.defineProperty(rr,"__esModule",{value:!0}),rr.getLocalStorage=rr.getLocalStorageOrThrow=rr.getCrypto=rr.getCryptoOrThrow=Ig=rr.getLocation=rr.getLocationOrThrow=Yu=rr.getNavigator=rr.getNavigatorOrThrow=Dc=rr.getDocument=rr.getDocumentOrThrow=rr.getFromWindowOrThrow=rr.getFromWindow=void 0;function xo(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}rr.getFromWindow=xo;function ma(r){const e=xo(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}rr.getFromWindowOrThrow=ma;function N5(){return ma("document")}rr.getDocumentOrThrow=N5;function L5(){return xo("document")}var Dc=rr.getDocument=L5;function B5(){return ma("navigator")}rr.getNavigatorOrThrow=B5;function F5(){return xo("navigator")}var Yu=rr.getNavigator=F5;function U5(){return ma("location")}rr.getLocationOrThrow=U5;function q5(){return xo("location")}var Ig=rr.getLocation=q5;function z5(){return ma("crypto")}rr.getCryptoOrThrow=z5;function H5(){return xo("crypto")}rr.getCrypto=H5;function k5(){return ma("localStorage")}rr.getLocalStorageOrThrow=k5;function j5(){return xo("localStorage")}rr.getLocalStorage=j5;var Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});var Mg=Ju.getWindowMetadata=void 0;const Cg=rr;function W5(){let r,e;try{r=Cg.getDocumentOrThrow(),e=Cg.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),P=[];for(let M=0;M<w.length;M++){const O=w[M],$=O.getAttribute("rel");if($&&$.toLowerCase().indexOf("icon")>-1){const W=O.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let H=e.protocol+"//"+e.host;if(W.indexOf("/")===0)H+=W;else{const F=e.pathname.split("/");F.pop();const Y=F.join("/");H+=Y+"/"+W}P.push(H)}else if(W.indexOf("//")===0){const H=e.protocol+W;P.push(H)}else P.push(W)}}return P}function i(...w){const P=r.getElementsByTagName("meta");for(let M=0;M<P.length;M++){const O=P[M],$=["itemprop","property","name"].map(W=>O.getAttribute(W)).filter(W=>W?w.includes(W):!1);if($.length&&$){const W=O.getAttribute("content");if(W)return W}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}const a=n(),f=s(),h=e.origin,u=t();return{description:f,url:h,icons:u,name:a}}Mg=Ju.getWindowMetadata=W5;var Oc={},K5=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Pg="%[a-f0-9]{2}",Dg=new RegExp("("+Pg+")|([^%]+?)","gi"),Og=new RegExp("("+Pg+")+","gi");function Qu(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],Qu(t),Qu(i))}function V5(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Dg)||[],t=1;t<e.length;t++)r=Qu(e,t).join(""),e=r.match(Dg)||[];return r}}function G5(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=Og.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=V5(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Og.exec(r)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var a=n[s];r=r.replace(new RegExp(a,"g"),e[a])}return r}var Y5=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return G5(r)}},J5=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},Q5=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s<i.length;s++){var a=i[s],f=r[a];(n?e.indexOf(a)!==-1:e(a,f,r))&&(t[a]=f)}return t};(function(r){const e=K5,t=Y5,i=J5,n=Q5,s=F=>F==null,a=Symbol("encodeFragmentIdentifier");function f(F){switch(F.arrayFormat){case"index":return Y=>(B,z)=>{const j=B.length;return z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(Y,F),"[",j,"]"].join("")]:[...B,[g(Y,F),"[",g(j,F),"]=",g(z,F)].join("")]};case"bracket":return Y=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(Y,F),"[]"].join("")]:[...B,[g(Y,F),"[]=",g(z,F)].join("")];case"colon-list-separator":return Y=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(Y,F),":list="].join("")]:[...B,[g(Y,F),":list=",g(z,F)].join("")];case"comma":case"separator":case"bracket-separator":{const Y=F.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?z:(j=j===null?"":j,z.length===0?[[g(B,F),Y,g(j,F)].join("")]:[[z,g(j,F)].join(F.arrayFormatSeparator)])}default:return Y=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,g(Y,F)]:[...B,[g(Y,F),"=",g(z,F)].join("")]}}function h(F){let Y;switch(F.arrayFormat){case"index":return(B,z,j)=>{if(Y=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!Y){j[B]=z;return}j[B]===void 0&&(j[B]={}),j[B][Y[1]]=z};case"bracket":return(B,z,j)=>{if(Y=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!Y){j[B]=z;return}if(j[B]===void 0){j[B]=[z];return}j[B]=[].concat(j[B],z)};case"colon-list-separator":return(B,z,j)=>{if(Y=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!Y){j[B]=z;return}if(j[B]===void 0){j[B]=[z];return}j[B]=[].concat(j[B],z)};case"comma":case"separator":return(B,z,j)=>{const _=typeof z=="string"&&z.includes(F.arrayFormatSeparator),U=typeof z=="string"&&!_&&w(z,F).includes(F.arrayFormatSeparator);z=U?w(z,F):z;const ee=_||U?z.split(F.arrayFormatSeparator).map(oe=>w(oe,F)):z===null?z:w(z,F);j[B]=ee};case"bracket-separator":return(B,z,j)=>{const _=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!_){j[B]=z&&w(z,F);return}const U=z===null?[]:z.split(F.arrayFormatSeparator).map(ee=>w(ee,F));if(j[B]===void 0){j[B]=U;return}j[B]=[].concat(j[B],U)};default:return(B,z,j)=>{if(j[B]===void 0){j[B]=z;return}j[B]=[].concat(j[B],z)}}}function u(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(F,Y){return Y.encode?Y.strict?e(F):encodeURIComponent(F):F}function w(F,Y){return Y.decode?t(F):F}function P(F){return Array.isArray(F)?F.sort():typeof F=="object"?P(Object.keys(F)).sort((Y,B)=>Number(Y)-Number(B)).map(Y=>F[Y]):F}function M(F){const Y=F.indexOf("#");return Y!==-1&&(F=F.slice(0,Y)),F}function O(F){let Y="";const B=F.indexOf("#");return B!==-1&&(Y=F.slice(B)),Y}function $(F){F=M(F);const Y=F.indexOf("?");return Y===-1?"":F.slice(Y+1)}function W(F,Y){return Y.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):Y.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function H(F,Y){Y=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},Y),u(Y.arrayFormatSeparator);const B=h(Y),z=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return z;for(const j of F.split("&")){if(j==="")continue;let[_,U]=i(Y.decode?j.replace(/\+/g," "):j,"=");U=U===void 0?null:["comma","separator","bracket-separator"].includes(Y.arrayFormat)?U:w(U,Y),B(w(_,Y),U,z)}for(const j of Object.keys(z)){const _=z[j];if(typeof _=="object"&&_!==null)for(const U of Object.keys(_))_[U]=W(_[U],Y);else z[j]=W(_,Y)}return Y.sort===!1?z:(Y.sort===!0?Object.keys(z).sort():Object.keys(z).sort(Y.sort)).reduce((j,_)=>{const U=z[_];return U&&typeof U=="object"&&!Array.isArray(U)?j[_]=P(U):j[_]=U,j},Object.create(null))}r.extract=$,r.parse=H,r.stringify=(F,Y)=>{if(!F)return"";Y=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},Y),u(Y.arrayFormatSeparator);const B=U=>Y.skipNull&&s(F[U])||Y.skipEmptyString&&F[U]==="",z=f(Y),j={};for(const U of Object.keys(F))B(U)||(j[U]=F[U]);const _=Object.keys(j);return Y.sort!==!1&&_.sort(Y.sort),_.map(U=>{const ee=F[U];return ee===void 0?"":ee===null?g(U,Y):Array.isArray(ee)?ee.length===0&&Y.arrayFormat==="bracket-separator"?g(U,Y)+"[]":ee.reduce(z(U),[]).join("&"):g(U,Y)+"="+g(ee,Y)}).filter(U=>U.length>0).join("&")},r.parseUrl=(F,Y)=>{Y=Object.assign({decode:!0},Y);const[B,z]=i(F,"#");return Object.assign({url:B.split("?")[0]||"",query:H($(F),Y)},Y&&Y.parseFragmentIdentifier&&z?{fragmentIdentifier:w(z,Y)}:{})},r.stringifyUrl=(F,Y)=>{Y=Object.assign({encode:!0,strict:!0,[a]:!0},Y);const B=M(F.url).split("?")[0]||"",z=r.extract(F.url),j=r.parse(z,{sort:!1}),_=Object.assign(j,F.query);let U=r.stringify(_,Y);U&&(U=`?${U}`);let ee=O(F.url);return F.fragmentIdentifier&&(ee=`#${Y[a]?g(F.fragmentIdentifier,Y):F.fragmentIdentifier}`),`${B}${U}${ee}`},r.pick=(F,Y,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[a]:!1},B);const{url:z,query:j,fragmentIdentifier:_}=r.parseUrl(F,B);return r.stringifyUrl({url:z,query:n(j,Y),fragmentIdentifier:_},B)},r.exclude=(F,Y,B)=>{const z=Array.isArray(Y)?j=>!Y.includes(j):(j,_)=>!Y(j,_);return r.pick(F,z,B)}})(Oc);var Rg={exports:{}};/**
15
15
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
16
16
  *
17
17
  * @version 0.8.0
18
18
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
19
19
  * @copyright Chen, Yi-Cyuan 2015-2018
20
20
  * @license MIT
21
- */(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",a=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?n=fr:s&&(n=self);var f=!n.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,h=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],P=[1,256,65536,16777216],M=[6,1536,393216,100663296],O=[0,8,16,24],$=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],W=[224,256,384,512],k=[128,256],F=["hex","buffer","arrayBuffer","array","digest"],Y={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),h&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});for(var B=function(R,X,V){return function(J){return new x(R,X,R).update(J)[V]()}},z=function(R,X,V){return function(J,K){return new x(R,X,K).update(J)[V]()}},j=function(R,X,V){return function(J,K,E,G){return l["cshake"+R].update(J,K,E,G)[V]()}},_=function(R,X,V){return function(J,K,E,G){return l["kmac"+R].update(J,K,E,G)[V]()}},U=function(R,X,V,J){for(var K=0;K<F.length;++K){var E=F[K];R[E]=X(V,J,E)}return R},ee=function(R,X){var V=B(R,X,"hex");return V.create=function(){return new x(R,X,R)},V.update=function(J){return V.create().update(J)},U(V,B,R,X)},oe=function(R,X){var V=z(R,X,"hex");return V.create=function(J){return new x(R,X,J)},V.update=function(J,K){return V.create(K).update(J)},U(V,z,R,X)},L=function(R,X){var V=Y[R],J=j(R,X,"hex");return J.create=function(K,E,G){return!E&&!G?l["shake"+R].create(K):new x(R,X,K).bytepad([E,G],V)},J.update=function(K,E,G,re){return J.create(E,G,re).update(K)},U(J,j,R,X)},b=function(R,X){var V=Y[R],J=_(R,X,"hex");return J.create=function(K,E,G){return new N(R,X,E).bytepad(["KMAC",G],V).bytepad([K],V)},J.update=function(K,E,G,re){return J.create(K,G,re).update(E)},U(J,_,R,X)},m=[{name:"keccak",padding:P,bits:W,createMethod:ee},{name:"sha3",padding:M,bits:W,createMethod:ee},{name:"shake",padding:g,bits:k,createMethod:oe},{name:"cshake",padding:w,bits:k,createMethod:L},{name:"kmac",padding:w,bits:k,createMethod:b}],l={},d=[],y=0;y<m.length;++y)for(var C=m[y],D=C.bits,S=0;S<D.length;++S){var v=C.name+"_"+D[S];if(d.push(v),l[v]=C.createMethod(D[S],C.padding),C.name!=="sha3"){var A=C.name+D[S];d.push(A),l[A]=l[v]}}function x(R,X,V){this.blocks=[],this.s=[],this.padding=X,this.outputBits=V,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(R<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=V>>5,this.extraBytes=(V&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}x.prototype.update=function(R){if(this.finalized)throw new Error(t);var X,V=typeof R;if(V!=="string"){if(V==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);X=!0}for(var J=this.blocks,K=this.byteCount,E=R.length,G=this.blockCount,re=0,le=this.s,he,ge;re<E;){if(this.reset)for(this.reset=!1,J[0]=this.block,he=1;he<G+1;++he)J[he]=0;if(X)for(he=this.start;re<E&&he<K;++re)J[he>>2]|=R[re]<<O[he++&3];else for(he=this.start;re<E&&he<K;++re)ge=R.charCodeAt(re),ge<128?J[he>>2]|=ge<<O[he++&3]:ge<2048?(J[he>>2]|=(192|ge>>6)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]):ge<55296||ge>=57344?(J[he>>2]|=(224|ge>>12)<<O[he++&3],J[he>>2]|=(128|ge>>6&63)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]):(ge=65536+((ge&1023)<<10|R.charCodeAt(++re)&1023),J[he>>2]|=(240|ge>>18)<<O[he++&3],J[he>>2]|=(128|ge>>12&63)<<O[he++&3],J[he>>2]|=(128|ge>>6&63)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]);if(this.lastByteIndex=he,he>=K){for(this.start=he-K,this.block=J[G],he=0;he<G;++he)le[he]^=J[he];ae(le),this.reset=!0}else this.start=he}return this},x.prototype.encode=function(R,X){var V=R&255,J=1,K=[V];for(R=R>>8,V=R&255;V>0;)K.unshift(V),R=R>>8,V=R&255,++J;return X?K.push(J):K.unshift(J),this.update(K),K.length},x.prototype.encodeString=function(R){var X,V=typeof R;if(V!=="string"){if(V==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);X=!0}var J=0,K=R.length;if(X)J=K;else for(var E=0;E<R.length;++E){var G=R.charCodeAt(E);G<128?J+=1:G<2048?J+=2:G<55296||G>=57344?J+=3:(G=65536+((G&1023)<<10|R.charCodeAt(++E)&1023),J+=4)}return J+=this.encode(J*8),this.update(R),J},x.prototype.bytepad=function(R,X){for(var V=this.encode(X),J=0;J<R.length;++J)V+=this.encodeString(R[J]);var K=X-V%X,E=[];return E.length=K,this.update(E),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,X=this.lastByteIndex,V=this.blockCount,J=this.s;if(R[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(R[0]=R[V],X=1;X<V+1;++X)R[X]=0;for(R[V-1]|=2147483648,X=0;X<V;++X)J[X]^=R[X];ae(J)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,G="",re;E<V;){for(K=0;K<R&&E<V;++K,++E)re=X[K],G+=u[re>>4&15]+u[re&15]+u[re>>12&15]+u[re>>8&15]+u[re>>20&15]+u[re>>16&15]+u[re>>28&15]+u[re>>24&15];E%R===0&&(ae(X),K=0)}return J&&(re=X[K],G+=u[re>>4&15]+u[re&15],J>1&&(G+=u[re>>12&15]+u[re>>8&15]),J>2&&(G+=u[re>>20&15]+u[re>>16&15])),G},x.prototype.arrayBuffer=function(){this.finalize();var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,G=this.outputBits>>3,re;J?re=new ArrayBuffer(V+1<<2):re=new ArrayBuffer(G);for(var le=new Uint32Array(re);E<V;){for(K=0;K<R&&E<V;++K,++E)le[E]=X[K];E%R===0&&ae(X)}return J&&(le[K]=X[K],re=re.slice(0,G)),re},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,G=[],re,le;E<V;){for(K=0;K<R&&E<V;++K,++E)re=E<<2,le=X[K],G[re]=le&255,G[re+1]=le>>8&255,G[re+2]=le>>16&255,G[re+3]=le>>24&255;E%R===0&&ae(X)}return J&&(re=E<<2,le=X[K],G[re]=le&255,J>1&&(G[re+1]=le>>8&255),J>2&&(G[re+2]=le>>16&255)),G};function N(R,X,V){x.call(this,R,X,V)}N.prototype=new x,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var ae=function(R){var X,V,J,K,E,G,re,le,he,ge,ke,Te,Ce,Xe,$e,be,Pe,De,ye,Ie,Oe,me,Me,Be,we,He,We,xe,Ve,Ke,Ge,mt,It,Ye,Pt,Ot,Ze,rt,et,Ne,it,tt,Re,lt,ht,Le,ut,nt,Fe,st,Qe,qe,dt,zt,at,kt,_t,qt,Qr,Zr,Xr,ei,vr;for(J=0;J<48;J+=2)K=R[0]^R[10]^R[20]^R[30]^R[40],E=R[1]^R[11]^R[21]^R[31]^R[41],G=R[2]^R[12]^R[22]^R[32]^R[42],re=R[3]^R[13]^R[23]^R[33]^R[43],le=R[4]^R[14]^R[24]^R[34]^R[44],he=R[5]^R[15]^R[25]^R[35]^R[45],ge=R[6]^R[16]^R[26]^R[36]^R[46],ke=R[7]^R[17]^R[27]^R[37]^R[47],Te=R[8]^R[18]^R[28]^R[38]^R[48],Ce=R[9]^R[19]^R[29]^R[39]^R[49],X=Te^(G<<1|re>>>31),V=Ce^(re<<1|G>>>31),R[0]^=X,R[1]^=V,R[10]^=X,R[11]^=V,R[20]^=X,R[21]^=V,R[30]^=X,R[31]^=V,R[40]^=X,R[41]^=V,X=K^(le<<1|he>>>31),V=E^(he<<1|le>>>31),R[2]^=X,R[3]^=V,R[12]^=X,R[13]^=V,R[22]^=X,R[23]^=V,R[32]^=X,R[33]^=V,R[42]^=X,R[43]^=V,X=G^(ge<<1|ke>>>31),V=re^(ke<<1|ge>>>31),R[4]^=X,R[5]^=V,R[14]^=X,R[15]^=V,R[24]^=X,R[25]^=V,R[34]^=X,R[35]^=V,R[44]^=X,R[45]^=V,X=le^(Te<<1|Ce>>>31),V=he^(Ce<<1|Te>>>31),R[6]^=X,R[7]^=V,R[16]^=X,R[17]^=V,R[26]^=X,R[27]^=V,R[36]^=X,R[37]^=V,R[46]^=X,R[47]^=V,X=ge^(K<<1|E>>>31),V=ke^(E<<1|K>>>31),R[8]^=X,R[9]^=V,R[18]^=X,R[19]^=V,R[28]^=X,R[29]^=V,R[38]^=X,R[39]^=V,R[48]^=X,R[49]^=V,Xe=R[0],$e=R[1],Le=R[11]<<4|R[10]>>>28,ut=R[10]<<4|R[11]>>>28,xe=R[20]<<3|R[21]>>>29,Ve=R[21]<<3|R[20]>>>29,Zr=R[31]<<9|R[30]>>>23,Xr=R[30]<<9|R[31]>>>23,tt=R[40]<<18|R[41]>>>14,Re=R[41]<<18|R[40]>>>14,Ye=R[2]<<1|R[3]>>>31,Pt=R[3]<<1|R[2]>>>31,be=R[13]<<12|R[12]>>>20,Pe=R[12]<<12|R[13]>>>20,nt=R[22]<<10|R[23]>>>22,Fe=R[23]<<10|R[22]>>>22,Ke=R[33]<<13|R[32]>>>19,Ge=R[32]<<13|R[33]>>>19,ei=R[42]<<2|R[43]>>>30,vr=R[43]<<2|R[42]>>>30,zt=R[5]<<30|R[4]>>>2,at=R[4]<<30|R[5]>>>2,Ot=R[14]<<6|R[15]>>>26,Ze=R[15]<<6|R[14]>>>26,De=R[25]<<11|R[24]>>>21,ye=R[24]<<11|R[25]>>>21,st=R[34]<<15|R[35]>>>17,Qe=R[35]<<15|R[34]>>>17,mt=R[45]<<29|R[44]>>>3,It=R[44]<<29|R[45]>>>3,Be=R[6]<<28|R[7]>>>4,we=R[7]<<28|R[6]>>>4,kt=R[17]<<23|R[16]>>>9,_t=R[16]<<23|R[17]>>>9,rt=R[26]<<25|R[27]>>>7,et=R[27]<<25|R[26]>>>7,Ie=R[36]<<21|R[37]>>>11,Oe=R[37]<<21|R[36]>>>11,qe=R[47]<<24|R[46]>>>8,dt=R[46]<<24|R[47]>>>8,lt=R[8]<<27|R[9]>>>5,ht=R[9]<<27|R[8]>>>5,He=R[18]<<20|R[19]>>>12,We=R[19]<<20|R[18]>>>12,qt=R[29]<<7|R[28]>>>25,Qr=R[28]<<7|R[29]>>>25,Ne=R[38]<<8|R[39]>>>24,it=R[39]<<8|R[38]>>>24,me=R[48]<<14|R[49]>>>18,Me=R[49]<<14|R[48]>>>18,R[0]=Xe^~be&De,R[1]=$e^~Pe&ye,R[10]=Be^~He&xe,R[11]=we^~We&Ve,R[20]=Ye^~Ot&rt,R[21]=Pt^~Ze&et,R[30]=lt^~Le&nt,R[31]=ht^~ut&Fe,R[40]=zt^~kt&qt,R[41]=at^~_t&Qr,R[2]=be^~De&Ie,R[3]=Pe^~ye&Oe,R[12]=He^~xe&Ke,R[13]=We^~Ve&Ge,R[22]=Ot^~rt&Ne,R[23]=Ze^~et&it,R[32]=Le^~nt&st,R[33]=ut^~Fe&Qe,R[42]=kt^~qt&Zr,R[43]=_t^~Qr&Xr,R[4]=De^~Ie&me,R[5]=ye^~Oe&Me,R[14]=xe^~Ke&mt,R[15]=Ve^~Ge&It,R[24]=rt^~Ne&tt,R[25]=et^~it&Re,R[34]=nt^~st&qe,R[35]=Fe^~Qe&dt,R[44]=qt^~Zr&ei,R[45]=Qr^~Xr&vr,R[6]=Ie^~me&Xe,R[7]=Oe^~Me&$e,R[16]=Ke^~mt&Be,R[17]=Ge^~It&we,R[26]=Ne^~tt&Ye,R[27]=it^~Re&Pt,R[36]=st^~qe&lt,R[37]=Qe^~dt&ht,R[46]=Zr^~ei&zt,R[47]=Xr^~vr&at,R[8]=me^~Xe&be,R[9]=Me^~$e&Pe,R[18]=mt^~Be&He,R[19]=It^~we&We,R[28]=tt^~Ye&Ot,R[29]=Re^~Pt&Ze,R[38]=qe^~lt&Le,R[39]=dt^~ht&ut,R[48]=ei^~zt&kt,R[49]=vr^~at&_t,R[0]^=$[J],R[1]^=$[J+1]};if(f)r.exports=l;else for(y=0;y<d.length;++y)n[d[y]]=l[d[y]]})()})(Rg);var Z5=Rg.exports;const X5="logger/5.7.0";let Tg=!1,$g=!1;const rl={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ng=rl.default,Zu=null;function e4(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const Lg=e4();var Xu;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(Xu||(Xu={}));var vn;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(vn||(vn={}));const Bg="0123456789abcdef";class xt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();rl[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ng>rl[i])&&console.log.apply(console,t)}debug(...e){this._log(xt.levels.DEBUG,e)}info(...e){this._log(xt.levels.INFO,e)}warn(...e){this._log(xt.levels.WARNING,e)}makeError(e,t,i){if($g)return this.makeError("censored error",t,{});t||(t=xt.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(h=>{const u=i[h];try{if(u instanceof Uint8Array){let g="";for(let w=0;w<u.length;w++)g+=Bg[u[w]>>4],g+=Bg[u[w]&15];n.push(h+"=Uint8Array(0x"+g+")")}else n.push(h+"="+JSON.stringify(u))}catch{n.push(h+"="+JSON.stringify(i[h].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const s=e;let a="";switch(t){case vn.NUMERIC_FAULT:{a="NUMERIC_FAULT";const h=e;switch(h){case"overflow":case"underflow":case"division-by-zero":a+="-"+h;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case vn.CALL_EXCEPTION:case vn.INSUFFICIENT_FUNDS:case vn.MISSING_NEW:case vn.NONCE_EXPIRED:case vn.REPLACEMENT_UNDERPRICED:case vn.TRANSACTION_REPLACED:case vn.UNPREDICTABLE_GAS_LIMIT:a=t;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const f=new Error(e);return f.reason=s,f.code=t,Object.keys(i).forEach(function(h){f[h]=i[h]}),f}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,xt.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,n){e||this.throwError(t,i,n)}assertArgument(e,t,i,n){e||this.throwArgumentError(t,i,n)}checkNormalize(e){Lg&&this.throwError("platform missing String.prototype.normalize",xt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Lg})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,xt.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,xt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",xt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Zu||(Zu=new xt(X5)),Zu}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Tg){if(!e)return;this.globalLogger().throwError("error censorship permanent",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}$g=!!e,Tg=!!t}static setLogLevel(e){const t=rl[e.toLowerCase()];if(t==null){xt.globalLogger().warn("invalid log level - "+e);return}Ng=t}static from(e){return new xt(e)}}xt.errors=vn,xt.levels=Xu;const t4="bytes/5.7.0",br=new xt(t4);function Fg(r){return!!r.toHexString}function ba(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return ba(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function r4(r){return Oi(r)&&!(r.length%2)||wa(r)}function Ug(r){return typeof r=="number"&&r==r&&r%1===0}function wa(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!Ug(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!Ug(t)||t<0||t>=256)return!1}return!0}function ur(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),ba(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Fg(r)&&(r=r.toHexString()),Oi(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":br.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let n=0;n<t.length;n+=2)i.push(parseInt(t.substring(n,n+2),16));return ba(new Uint8Array(i))}return wa(r)?ba(new Uint8Array(r)):br.throwArgumentError("invalid arrayify value","value",r)}function i4(r){const e=r.map(n=>ur(n)),t=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(t);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),ba(i)}function n4(r,e){r=ur(r),r.length>e&&br.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),ba(t)}function Oi(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const ed="0123456789abcdef";function ii(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=ed[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Fg(r))return r.toHexString();if(Oi(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":br.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(wa(r)){let t="0x";for(let i=0;i<r.length;i++){let n=r[i];t+=ed[(n&240)>>4]+ed[n&15]}return t}return br.throwArgumentError("invalid hexlify value","value",r)}function s4(r){if(typeof r!="string")r=ii(r);else if(!Oi(r)||r.length%2)return null;return(r.length-2)/2}function qg(r,e,t){return typeof r!="string"?r=ii(r):(!Oi(r)||r.length%2)&&br.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function Bn(r,e){for(typeof r!="string"?r=ii(r):Oi(r)||br.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&br.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function zg(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(r4(r)){let t=ur(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=ii(t.slice(0,32)),e.s=ii(t.slice(32,64))):t.length===65?(e.r=ii(t.slice(0,32)),e.s=ii(t.slice(32,64)),e.v=t[64]):br.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:br.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=ii(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const n=n4(ur(e._vs),32);e._vs=ii(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&br.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),n[0]&=127;const a=ii(n);e.s==null?e.s=a:e.s!==a&&br.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?br.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&br.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!Oi(e.r)?br.throwArgumentError("signature missing or invalid r","signature",r):e.r=Bn(e.r,32),e.s==null||!Oi(e.s)?br.throwArgumentError("signature missing or invalid s","signature",r):e.s=Bn(e.s,32);const t=ur(e.s);t[0]>=128&&br.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=ii(t);e._vs&&(Oi(e._vs)||br.throwArgumentError("signature invalid _vs","signature",r),e._vs=Bn(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&br.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function td(r){return"0x"+Z5.keccak_256(ur(r))}var kg={exports:{}},o4={},a4=Object.freeze({__proto__:null,default:o4}),il=zu(a4);(function(r){(function(e,t){function i(m,l){if(!m)throw new Error(l||"Assertion failed")}function n(m,l){m.super_=l;var d=function(){};d.prototype=l.prototype,m.prototype=new d,m.prototype.constructor=m}function s(m,l,d){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((l==="le"||l==="be")&&(d=l,l=10),this._init(m||0,l||10,d||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=il.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,d){return l.cmp(d)>0?l:d},s.min=function(l,d){return l.cmp(d)<0?l:d},s.prototype._init=function(l,d,y){if(typeof l=="number")return this._initNumber(l,d,y);if(typeof l=="object")return this._initArray(l,d,y);d==="hex"&&(d=16),i(d===(d|0)&&d>=2&&d<=36),l=l.toString().replace(/\s+/g,"");var C=0;l[0]==="-"&&(C++,this.negative=1),C<l.length&&(d===16?this._parseHex(l,C,y):(this._parseBase(l,d,C),y==="le"&&this._initArray(this.toArray(),d,y)))},s.prototype._initNumber=function(l,d,y){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(i(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),d,y)},s.prototype._initArray=function(l,d,y){if(i(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var D,S,v=0;if(y==="be")for(C=l.length-1,D=0;C>=0;C-=3)S=l[C]|l[C-1]<<8|l[C-2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);else if(y==="le")for(C=0,D=0;C<l.length;C+=3)S=l[C]|l[C+1]<<8|l[C+2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);return this._strip()};function f(m,l){var d=m.charCodeAt(l);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;i(!1,"Invalid character in "+m)}function h(m,l,d){var y=f(m,d);return d-1>=l&&(y|=f(m,d-1)<<4),y}s.prototype._parseHex=function(l,d,y){this.length=Math.ceil((l.length-d)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var D=0,S=0,v;if(y==="be")for(C=l.length-1;C>=d;C-=2)v=h(l,d,C)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8;else{var A=l.length-d;for(C=A%2===0?d+1:d;C<l.length;C+=2)v=h(l,d,C)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8}this._strip()};function u(m,l,d,y){for(var C=0,D=0,S=Math.min(m.length,d),v=l;v<S;v++){var A=m.charCodeAt(v)-48;C*=y,A>=49?D=A-49+10:A>=17?D=A-17+10:D=A,i(A>=0&&D<y,"Invalid character"),C+=D}return C}s.prototype._parseBase=function(l,d,y){this.words=[0],this.length=1;for(var C=0,D=1;D<=67108863;D*=d)C++;C--,D=D/d|0;for(var S=l.length-y,v=S%C,A=Math.min(S,S-v)+y,x=0,N=y;N<A;N+=C)x=u(l,N,N+C,d),this.imuln(D),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x);if(v!==0){var ae=1;for(x=u(l,N,l.length,d),N=0;N<v;N++)ae*=d;this.imuln(ae),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x)}this._strip()},s.prototype.copy=function(l){l.words=new Array(this.length);for(var d=0;d<this.length;d++)l.words[d]=this.words[d];l.length=this.length,l.negative=this.negative,l.red=this.red};function g(m,l){m.words=l.words,m.length=l.length,m.negative=l.negative,m.red=l.red}if(s.prototype._move=function(l){g(l,this)},s.prototype.clone=function(){var l=new s(null);return this.copy(l),l},s.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{s.prototype.inspect=w}else s.prototype.inspect=w;function w(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var P=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(l,d){l=l||10,d=d|0||1;var y;if(l===16||l==="hex"){y="";for(var C=0,D=0,S=0;S<this.length;S++){var v=this.words[S],A=((v<<C|D)&16777215).toString(16);D=v>>>24-C&16777215,C+=2,C>=26&&(C-=26,S--),D!==0||S!==this.length-1?y=P[6-A.length]+A+y:y=A+y}for(D!==0&&(y=D.toString(16)+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(l===(l|0)&&l>=2&&l<=36){var x=M[l],N=O[l];y="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var R=ae.modrn(N).toString(l);ae=ae.idivn(N),ae.isZero()?y=R+y:y=P[x-R.length]+R+y}for(this.isZero()&&(y="0"+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(l,d){return this.toArrayLike(a,l,d)}),s.prototype.toArray=function(l,d){return this.toArrayLike(Array,l,d)};var $=function(l,d){return l.allocUnsafe?l.allocUnsafe(d):new l(d)};s.prototype.toArrayLike=function(l,d,y){this._strip();var C=this.byteLength(),D=y||Math.max(1,C);i(C<=D,"byte array longer than desired length"),i(D>0,"Requested array length <= 0");var S=$(l,D),v=d==="le"?"LE":"BE";return this["_toArrayLike"+v](S,C),S},s.prototype._toArrayLikeLE=function(l,d){for(var y=0,C=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|C;l[y++]=v&255,y<l.length&&(l[y++]=v>>8&255),y<l.length&&(l[y++]=v>>16&255),S===6?(y<l.length&&(l[y++]=v>>24&255),C=0,S=0):(C=v>>>24,S+=2)}if(y<l.length)for(l[y++]=C;y<l.length;)l[y++]=0},s.prototype._toArrayLikeBE=function(l,d){for(var y=l.length-1,C=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|C;l[y--]=v&255,y>=0&&(l[y--]=v>>8&255),y>=0&&(l[y--]=v>>16&255),S===6?(y>=0&&(l[y--]=v>>24&255),C=0,S=0):(C=v>>>24,S+=2)}if(y>=0)for(l[y--]=C;y>=0;)l[y--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var d=l,y=0;return d>=4096&&(y+=13,d>>>=13),d>=64&&(y+=7,d>>>=7),d>=8&&(y+=4,d>>>=4),d>=2&&(y+=2,d>>>=2),y+d},s.prototype._zeroBits=function(l){if(l===0)return 26;var d=l,y=0;return d&8191||(y+=13,d>>>=13),d&127||(y+=7,d>>>=7),d&15||(y+=4,d>>>=4),d&3||(y+=2,d>>>=2),d&1||y++,y},s.prototype.bitLength=function(){var l=this.words[this.length-1],d=this._countBits(l);return(this.length-1)*26+d};function W(m){for(var l=new Array(m.bitLength()),d=0;d<l.length;d++){var y=d/26|0,C=d%26;l[d]=m.words[y]>>>C&1}return l}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,d=0;d<this.length;d++){var y=this._zeroBits(this.words[d]);if(l+=y,y!==26)break}return l},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},s.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var d=0;d<l.length;d++)this.words[d]=this.words[d]|l.words[d];return this._strip()},s.prototype.ior=function(l){return i((this.negative|l.negative)===0),this.iuor(l)},s.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var d;this.length>l.length?d=l:d=this;for(var y=0;y<d.length;y++)this.words[y]=this.words[y]&l.words[y];return this.length=d.length,this._strip()},s.prototype.iand=function(l){return i((this.negative|l.negative)===0),this.iuand(l)},s.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var d,y;this.length>l.length?(d=this,y=l):(d=l,y=this);for(var C=0;C<y.length;C++)this.words[C]=d.words[C]^y.words[C];if(this!==d)for(;C<d.length;C++)this.words[C]=d.words[C];return this.length=d.length,this._strip()},s.prototype.ixor=function(l){return i((this.negative|l.negative)===0),this.iuxor(l)},s.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){i(typeof l=="number"&&l>=0);var d=Math.ceil(l/26)|0,y=l%26;this._expand(d),y>0&&d--;for(var C=0;C<d;C++)this.words[C]=~this.words[C]&67108863;return y>0&&(this.words[C]=~this.words[C]&67108863>>26-y),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,d){i(typeof l=="number"&&l>=0);var y=l/26|0,C=l%26;return this._expand(y+1),d?this.words[y]=this.words[y]|1<<C:this.words[y]=this.words[y]&~(1<<C),this._strip()},s.prototype.iadd=function(l){var d;if(this.negative!==0&&l.negative===0)return this.negative=0,d=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,d=this.isub(l),l.negative=1,d._normSign();var y,C;this.length>l.length?(y=this,C=l):(y=l,C=this);for(var D=0,S=0;S<C.length;S++)d=(y.words[S]|0)+(C.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;for(;D!==0&&S<y.length;S++)d=(y.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;if(this.length=y.length,D!==0)this.words[this.length]=D,this.length++;else if(y!==this)for(;S<y.length;S++)this.words[S]=y.words[S];return this},s.prototype.add=function(l){var d;return l.negative!==0&&this.negative===0?(l.negative=0,d=this.sub(l),l.negative^=1,d):l.negative===0&&this.negative!==0?(this.negative=0,d=l.sub(this),this.negative=1,d):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var d=this.iadd(l);return l.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var y=this.cmp(l);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var C,D;y>0?(C=this,D=l):(C=l,D=this);for(var S=0,v=0;v<D.length;v++)d=(C.words[v]|0)-(D.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;for(;S!==0&&v<C.length;v++)d=(C.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;if(S===0&&v<C.length&&C!==this)for(;v<C.length;v++)this.words[v]=C.words[v];return this.length=Math.max(this.length,v),C!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(l){return this.clone().isub(l)};function k(m,l,d){d.negative=l.negative^m.negative;var y=m.length+l.length|0;d.length=y,y=y-1|0;var C=m.words[0]|0,D=l.words[0]|0,S=C*D,v=S&67108863,A=S/67108864|0;d.words[0]=v;for(var x=1;x<y;x++){for(var N=A>>>26,ae=A&67108863,R=Math.min(x,l.length-1),X=Math.max(0,x-m.length+1);X<=R;X++){var V=x-X|0;C=m.words[V]|0,D=l.words[X]|0,S=C*D+ae,N+=S/67108864|0,ae=S&67108863}d.words[x]=ae|0,A=N|0}return A!==0?d.words[x]=A|0:d.length--,d._strip()}var F=function(l,d,y){var C=l.words,D=d.words,S=y.words,v=0,A,x,N,ae=C[0]|0,R=ae&8191,X=ae>>>13,V=C[1]|0,J=V&8191,K=V>>>13,E=C[2]|0,G=E&8191,re=E>>>13,le=C[3]|0,he=le&8191,ge=le>>>13,ke=C[4]|0,Te=ke&8191,Ce=ke>>>13,Xe=C[5]|0,$e=Xe&8191,be=Xe>>>13,Pe=C[6]|0,De=Pe&8191,ye=Pe>>>13,Ie=C[7]|0,Oe=Ie&8191,me=Ie>>>13,Me=C[8]|0,Be=Me&8191,we=Me>>>13,He=C[9]|0,We=He&8191,xe=He>>>13,Ve=D[0]|0,Ke=Ve&8191,Ge=Ve>>>13,mt=D[1]|0,It=mt&8191,Ye=mt>>>13,Pt=D[2]|0,Ot=Pt&8191,Ze=Pt>>>13,rt=D[3]|0,et=rt&8191,Ne=rt>>>13,it=D[4]|0,tt=it&8191,Re=it>>>13,lt=D[5]|0,ht=lt&8191,Le=lt>>>13,ut=D[6]|0,nt=ut&8191,Fe=ut>>>13,st=D[7]|0,Qe=st&8191,qe=st>>>13,dt=D[8]|0,zt=dt&8191,at=dt>>>13,kt=D[9]|0,_t=kt&8191,qt=kt>>>13;y.negative=l.negative^d.negative,y.length=19,A=Math.imul(R,Ke),x=Math.imul(R,Ge),x=x+Math.imul(X,Ke)|0,N=Math.imul(X,Ge);var Qr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,A=Math.imul(J,Ke),x=Math.imul(J,Ge),x=x+Math.imul(K,Ke)|0,N=Math.imul(K,Ge),A=A+Math.imul(R,It)|0,x=x+Math.imul(R,Ye)|0,x=x+Math.imul(X,It)|0,N=N+Math.imul(X,Ye)|0;var Zr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,A=Math.imul(G,Ke),x=Math.imul(G,Ge),x=x+Math.imul(re,Ke)|0,N=Math.imul(re,Ge),A=A+Math.imul(J,It)|0,x=x+Math.imul(J,Ye)|0,x=x+Math.imul(K,It)|0,N=N+Math.imul(K,Ye)|0,A=A+Math.imul(R,Ot)|0,x=x+Math.imul(R,Ze)|0,x=x+Math.imul(X,Ot)|0,N=N+Math.imul(X,Ze)|0;var Xr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,A=Math.imul(he,Ke),x=Math.imul(he,Ge),x=x+Math.imul(ge,Ke)|0,N=Math.imul(ge,Ge),A=A+Math.imul(G,It)|0,x=x+Math.imul(G,Ye)|0,x=x+Math.imul(re,It)|0,N=N+Math.imul(re,Ye)|0,A=A+Math.imul(J,Ot)|0,x=x+Math.imul(J,Ze)|0,x=x+Math.imul(K,Ot)|0,N=N+Math.imul(K,Ze)|0,A=A+Math.imul(R,et)|0,x=x+Math.imul(R,Ne)|0,x=x+Math.imul(X,et)|0,N=N+Math.imul(X,Ne)|0;var ei=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(ei>>>26)|0,ei&=67108863,A=Math.imul(Te,Ke),x=Math.imul(Te,Ge),x=x+Math.imul(Ce,Ke)|0,N=Math.imul(Ce,Ge),A=A+Math.imul(he,It)|0,x=x+Math.imul(he,Ye)|0,x=x+Math.imul(ge,It)|0,N=N+Math.imul(ge,Ye)|0,A=A+Math.imul(G,Ot)|0,x=x+Math.imul(G,Ze)|0,x=x+Math.imul(re,Ot)|0,N=N+Math.imul(re,Ze)|0,A=A+Math.imul(J,et)|0,x=x+Math.imul(J,Ne)|0,x=x+Math.imul(K,et)|0,N=N+Math.imul(K,Ne)|0,A=A+Math.imul(R,tt)|0,x=x+Math.imul(R,Re)|0,x=x+Math.imul(X,tt)|0,N=N+Math.imul(X,Re)|0;var vr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(vr>>>26)|0,vr&=67108863,A=Math.imul($e,Ke),x=Math.imul($e,Ge),x=x+Math.imul(be,Ke)|0,N=Math.imul(be,Ge),A=A+Math.imul(Te,It)|0,x=x+Math.imul(Te,Ye)|0,x=x+Math.imul(Ce,It)|0,N=N+Math.imul(Ce,Ye)|0,A=A+Math.imul(he,Ot)|0,x=x+Math.imul(he,Ze)|0,x=x+Math.imul(ge,Ot)|0,N=N+Math.imul(ge,Ze)|0,A=A+Math.imul(G,et)|0,x=x+Math.imul(G,Ne)|0,x=x+Math.imul(re,et)|0,N=N+Math.imul(re,Ne)|0,A=A+Math.imul(J,tt)|0,x=x+Math.imul(J,Re)|0,x=x+Math.imul(K,tt)|0,N=N+Math.imul(K,Re)|0,A=A+Math.imul(R,ht)|0,x=x+Math.imul(R,Le)|0,x=x+Math.imul(X,ht)|0,N=N+Math.imul(X,Le)|0;var Ai=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,A=Math.imul(De,Ke),x=Math.imul(De,Ge),x=x+Math.imul(ye,Ke)|0,N=Math.imul(ye,Ge),A=A+Math.imul($e,It)|0,x=x+Math.imul($e,Ye)|0,x=x+Math.imul(be,It)|0,N=N+Math.imul(be,Ye)|0,A=A+Math.imul(Te,Ot)|0,x=x+Math.imul(Te,Ze)|0,x=x+Math.imul(Ce,Ot)|0,N=N+Math.imul(Ce,Ze)|0,A=A+Math.imul(he,et)|0,x=x+Math.imul(he,Ne)|0,x=x+Math.imul(ge,et)|0,N=N+Math.imul(ge,Ne)|0,A=A+Math.imul(G,tt)|0,x=x+Math.imul(G,Re)|0,x=x+Math.imul(re,tt)|0,N=N+Math.imul(re,Re)|0,A=A+Math.imul(J,ht)|0,x=x+Math.imul(J,Le)|0,x=x+Math.imul(K,ht)|0,N=N+Math.imul(K,Le)|0,A=A+Math.imul(R,nt)|0,x=x+Math.imul(R,Fe)|0,x=x+Math.imul(X,nt)|0,N=N+Math.imul(X,Fe)|0;var In=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(In>>>26)|0,In&=67108863,A=Math.imul(Oe,Ke),x=Math.imul(Oe,Ge),x=x+Math.imul(me,Ke)|0,N=Math.imul(me,Ge),A=A+Math.imul(De,It)|0,x=x+Math.imul(De,Ye)|0,x=x+Math.imul(ye,It)|0,N=N+Math.imul(ye,Ye)|0,A=A+Math.imul($e,Ot)|0,x=x+Math.imul($e,Ze)|0,x=x+Math.imul(be,Ot)|0,N=N+Math.imul(be,Ze)|0,A=A+Math.imul(Te,et)|0,x=x+Math.imul(Te,Ne)|0,x=x+Math.imul(Ce,et)|0,N=N+Math.imul(Ce,Ne)|0,A=A+Math.imul(he,tt)|0,x=x+Math.imul(he,Re)|0,x=x+Math.imul(ge,tt)|0,N=N+Math.imul(ge,Re)|0,A=A+Math.imul(G,ht)|0,x=x+Math.imul(G,Le)|0,x=x+Math.imul(re,ht)|0,N=N+Math.imul(re,Le)|0,A=A+Math.imul(J,nt)|0,x=x+Math.imul(J,Fe)|0,x=x+Math.imul(K,nt)|0,N=N+Math.imul(K,Fe)|0,A=A+Math.imul(R,Qe)|0,x=x+Math.imul(R,qe)|0,x=x+Math.imul(X,Qe)|0,N=N+Math.imul(X,qe)|0;var Ei=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,A=Math.imul(Be,Ke),x=Math.imul(Be,Ge),x=x+Math.imul(we,Ke)|0,N=Math.imul(we,Ge),A=A+Math.imul(Oe,It)|0,x=x+Math.imul(Oe,Ye)|0,x=x+Math.imul(me,It)|0,N=N+Math.imul(me,Ye)|0,A=A+Math.imul(De,Ot)|0,x=x+Math.imul(De,Ze)|0,x=x+Math.imul(ye,Ot)|0,N=N+Math.imul(ye,Ze)|0,A=A+Math.imul($e,et)|0,x=x+Math.imul($e,Ne)|0,x=x+Math.imul(be,et)|0,N=N+Math.imul(be,Ne)|0,A=A+Math.imul(Te,tt)|0,x=x+Math.imul(Te,Re)|0,x=x+Math.imul(Ce,tt)|0,N=N+Math.imul(Ce,Re)|0,A=A+Math.imul(he,ht)|0,x=x+Math.imul(he,Le)|0,x=x+Math.imul(ge,ht)|0,N=N+Math.imul(ge,Le)|0,A=A+Math.imul(G,nt)|0,x=x+Math.imul(G,Fe)|0,x=x+Math.imul(re,nt)|0,N=N+Math.imul(re,Fe)|0,A=A+Math.imul(J,Qe)|0,x=x+Math.imul(J,qe)|0,x=x+Math.imul(K,Qe)|0,N=N+Math.imul(K,qe)|0,A=A+Math.imul(R,zt)|0,x=x+Math.imul(R,at)|0,x=x+Math.imul(X,zt)|0,N=N+Math.imul(X,at)|0;var Mn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Mn>>>26)|0,Mn&=67108863,A=Math.imul(We,Ke),x=Math.imul(We,Ge),x=x+Math.imul(xe,Ke)|0,N=Math.imul(xe,Ge),A=A+Math.imul(Be,It)|0,x=x+Math.imul(Be,Ye)|0,x=x+Math.imul(we,It)|0,N=N+Math.imul(we,Ye)|0,A=A+Math.imul(Oe,Ot)|0,x=x+Math.imul(Oe,Ze)|0,x=x+Math.imul(me,Ot)|0,N=N+Math.imul(me,Ze)|0,A=A+Math.imul(De,et)|0,x=x+Math.imul(De,Ne)|0,x=x+Math.imul(ye,et)|0,N=N+Math.imul(ye,Ne)|0,A=A+Math.imul($e,tt)|0,x=x+Math.imul($e,Re)|0,x=x+Math.imul(be,tt)|0,N=N+Math.imul(be,Re)|0,A=A+Math.imul(Te,ht)|0,x=x+Math.imul(Te,Le)|0,x=x+Math.imul(Ce,ht)|0,N=N+Math.imul(Ce,Le)|0,A=A+Math.imul(he,nt)|0,x=x+Math.imul(he,Fe)|0,x=x+Math.imul(ge,nt)|0,N=N+Math.imul(ge,Fe)|0,A=A+Math.imul(G,Qe)|0,x=x+Math.imul(G,qe)|0,x=x+Math.imul(re,Qe)|0,N=N+Math.imul(re,qe)|0,A=A+Math.imul(J,zt)|0,x=x+Math.imul(J,at)|0,x=x+Math.imul(K,zt)|0,N=N+Math.imul(K,at)|0,A=A+Math.imul(R,_t)|0,x=x+Math.imul(R,qt)|0,x=x+Math.imul(X,_t)|0,N=N+Math.imul(X,qt)|0;var Cn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,A=Math.imul(We,It),x=Math.imul(We,Ye),x=x+Math.imul(xe,It)|0,N=Math.imul(xe,Ye),A=A+Math.imul(Be,Ot)|0,x=x+Math.imul(Be,Ze)|0,x=x+Math.imul(we,Ot)|0,N=N+Math.imul(we,Ze)|0,A=A+Math.imul(Oe,et)|0,x=x+Math.imul(Oe,Ne)|0,x=x+Math.imul(me,et)|0,N=N+Math.imul(me,Ne)|0,A=A+Math.imul(De,tt)|0,x=x+Math.imul(De,Re)|0,x=x+Math.imul(ye,tt)|0,N=N+Math.imul(ye,Re)|0,A=A+Math.imul($e,ht)|0,x=x+Math.imul($e,Le)|0,x=x+Math.imul(be,ht)|0,N=N+Math.imul(be,Le)|0,A=A+Math.imul(Te,nt)|0,x=x+Math.imul(Te,Fe)|0,x=x+Math.imul(Ce,nt)|0,N=N+Math.imul(Ce,Fe)|0,A=A+Math.imul(he,Qe)|0,x=x+Math.imul(he,qe)|0,x=x+Math.imul(ge,Qe)|0,N=N+Math.imul(ge,qe)|0,A=A+Math.imul(G,zt)|0,x=x+Math.imul(G,at)|0,x=x+Math.imul(re,zt)|0,N=N+Math.imul(re,at)|0,A=A+Math.imul(J,_t)|0,x=x+Math.imul(J,qt)|0,x=x+Math.imul(K,_t)|0,N=N+Math.imul(K,qt)|0;var Si=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Si>>>26)|0,Si&=67108863,A=Math.imul(We,Ot),x=Math.imul(We,Ze),x=x+Math.imul(xe,Ot)|0,N=Math.imul(xe,Ze),A=A+Math.imul(Be,et)|0,x=x+Math.imul(Be,Ne)|0,x=x+Math.imul(we,et)|0,N=N+Math.imul(we,Ne)|0,A=A+Math.imul(Oe,tt)|0,x=x+Math.imul(Oe,Re)|0,x=x+Math.imul(me,tt)|0,N=N+Math.imul(me,Re)|0,A=A+Math.imul(De,ht)|0,x=x+Math.imul(De,Le)|0,x=x+Math.imul(ye,ht)|0,N=N+Math.imul(ye,Le)|0,A=A+Math.imul($e,nt)|0,x=x+Math.imul($e,Fe)|0,x=x+Math.imul(be,nt)|0,N=N+Math.imul(be,Fe)|0,A=A+Math.imul(Te,Qe)|0,x=x+Math.imul(Te,qe)|0,x=x+Math.imul(Ce,Qe)|0,N=N+Math.imul(Ce,qe)|0,A=A+Math.imul(he,zt)|0,x=x+Math.imul(he,at)|0,x=x+Math.imul(ge,zt)|0,N=N+Math.imul(ge,at)|0,A=A+Math.imul(G,_t)|0,x=x+Math.imul(G,qt)|0,x=x+Math.imul(re,_t)|0,N=N+Math.imul(re,qt)|0;var sn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(sn>>>26)|0,sn&=67108863,A=Math.imul(We,et),x=Math.imul(We,Ne),x=x+Math.imul(xe,et)|0,N=Math.imul(xe,Ne),A=A+Math.imul(Be,tt)|0,x=x+Math.imul(Be,Re)|0,x=x+Math.imul(we,tt)|0,N=N+Math.imul(we,Re)|0,A=A+Math.imul(Oe,ht)|0,x=x+Math.imul(Oe,Le)|0,x=x+Math.imul(me,ht)|0,N=N+Math.imul(me,Le)|0,A=A+Math.imul(De,nt)|0,x=x+Math.imul(De,Fe)|0,x=x+Math.imul(ye,nt)|0,N=N+Math.imul(ye,Fe)|0,A=A+Math.imul($e,Qe)|0,x=x+Math.imul($e,qe)|0,x=x+Math.imul(be,Qe)|0,N=N+Math.imul(be,qe)|0,A=A+Math.imul(Te,zt)|0,x=x+Math.imul(Te,at)|0,x=x+Math.imul(Ce,zt)|0,N=N+Math.imul(Ce,at)|0,A=A+Math.imul(he,_t)|0,x=x+Math.imul(he,qt)|0,x=x+Math.imul(ge,_t)|0,N=N+Math.imul(ge,qt)|0;var on=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(on>>>26)|0,on&=67108863,A=Math.imul(We,tt),x=Math.imul(We,Re),x=x+Math.imul(xe,tt)|0,N=Math.imul(xe,Re),A=A+Math.imul(Be,ht)|0,x=x+Math.imul(Be,Le)|0,x=x+Math.imul(we,ht)|0,N=N+Math.imul(we,Le)|0,A=A+Math.imul(Oe,nt)|0,x=x+Math.imul(Oe,Fe)|0,x=x+Math.imul(me,nt)|0,N=N+Math.imul(me,Fe)|0,A=A+Math.imul(De,Qe)|0,x=x+Math.imul(De,qe)|0,x=x+Math.imul(ye,Qe)|0,N=N+Math.imul(ye,qe)|0,A=A+Math.imul($e,zt)|0,x=x+Math.imul($e,at)|0,x=x+Math.imul(be,zt)|0,N=N+Math.imul(be,at)|0,A=A+Math.imul(Te,_t)|0,x=x+Math.imul(Te,qt)|0,x=x+Math.imul(Ce,_t)|0,N=N+Math.imul(Ce,qt)|0;var Cr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,A=Math.imul(We,ht),x=Math.imul(We,Le),x=x+Math.imul(xe,ht)|0,N=Math.imul(xe,Le),A=A+Math.imul(Be,nt)|0,x=x+Math.imul(Be,Fe)|0,x=x+Math.imul(we,nt)|0,N=N+Math.imul(we,Fe)|0,A=A+Math.imul(Oe,Qe)|0,x=x+Math.imul(Oe,qe)|0,x=x+Math.imul(me,Qe)|0,N=N+Math.imul(me,qe)|0,A=A+Math.imul(De,zt)|0,x=x+Math.imul(De,at)|0,x=x+Math.imul(ye,zt)|0,N=N+Math.imul(ye,at)|0,A=A+Math.imul($e,_t)|0,x=x+Math.imul($e,qt)|0,x=x+Math.imul(be,_t)|0,N=N+Math.imul(be,qt)|0;var Pn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,A=Math.imul(We,nt),x=Math.imul(We,Fe),x=x+Math.imul(xe,nt)|0,N=Math.imul(xe,Fe),A=A+Math.imul(Be,Qe)|0,x=x+Math.imul(Be,qe)|0,x=x+Math.imul(we,Qe)|0,N=N+Math.imul(we,qe)|0,A=A+Math.imul(Oe,zt)|0,x=x+Math.imul(Oe,at)|0,x=x+Math.imul(me,zt)|0,N=N+Math.imul(me,at)|0,A=A+Math.imul(De,_t)|0,x=x+Math.imul(De,qt)|0,x=x+Math.imul(ye,_t)|0,N=N+Math.imul(ye,qt)|0;var Dn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,A=Math.imul(We,Qe),x=Math.imul(We,qe),x=x+Math.imul(xe,Qe)|0,N=Math.imul(xe,qe),A=A+Math.imul(Be,zt)|0,x=x+Math.imul(Be,at)|0,x=x+Math.imul(we,zt)|0,N=N+Math.imul(we,at)|0,A=A+Math.imul(Oe,_t)|0,x=x+Math.imul(Oe,qt)|0,x=x+Math.imul(me,_t)|0,N=N+Math.imul(me,qt)|0;var On=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(On>>>26)|0,On&=67108863,A=Math.imul(We,zt),x=Math.imul(We,at),x=x+Math.imul(xe,zt)|0,N=Math.imul(xe,at),A=A+Math.imul(Be,_t)|0,x=x+Math.imul(Be,qt)|0,x=x+Math.imul(we,_t)|0,N=N+Math.imul(we,qt)|0;var ta=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(ta>>>26)|0,ta&=67108863,A=Math.imul(We,_t),x=Math.imul(We,qt),x=x+Math.imul(xe,_t)|0,N=Math.imul(xe,qt);var ao=(v+A|0)+((x&8191)<<13)|0;return v=(N+(x>>>13)|0)+(ao>>>26)|0,ao&=67108863,S[0]=Qr,S[1]=Zr,S[2]=Xr,S[3]=ei,S[4]=vr,S[5]=Ai,S[6]=In,S[7]=Ei,S[8]=Mn,S[9]=Cn,S[10]=Si,S[11]=sn,S[12]=on,S[13]=Cr,S[14]=Pn,S[15]=Dn,S[16]=On,S[17]=ta,S[18]=ao,v!==0&&(S[19]=v,y.length++),y};Math.imul||(F=k);function Y(m,l,d){d.negative=l.negative^m.negative,d.length=m.length+l.length;for(var y=0,C=0,D=0;D<d.length-1;D++){var S=C;C=0;for(var v=y&67108863,A=Math.min(D,l.length-1),x=Math.max(0,D-m.length+1);x<=A;x++){var N=D-x,ae=m.words[N]|0,R=l.words[x]|0,X=ae*R,V=X&67108863;S=S+(X/67108864|0)|0,V=V+v|0,v=V&67108863,S=S+(V>>>26)|0,C+=S>>>26,S&=67108863}d.words[D]=v,y=S,S=C}return y!==0?d.words[D]=y:d.length--,d._strip()}function B(m,l,d){return Y(m,l,d)}s.prototype.mulTo=function(l,d){var y,C=this.length+l.length;return this.length===10&&l.length===10?y=F(this,l,d):C<63?y=k(this,l,d):C<1024?y=Y(this,l,d):y=B(this,l,d),y},s.prototype.mul=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),this.mulTo(l,d)},s.prototype.mulf=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),B(this,l,d)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var d=l<0;d&&(l=-l),i(typeof l=="number"),i(l<67108864);for(var y=0,C=0;C<this.length;C++){var D=(this.words[C]|0)*l,S=(D&67108863)+(y&67108863);y>>=26,y+=D/67108864|0,y+=S>>>26,this.words[C]=S&67108863}return y!==0&&(this.words[C]=y,this.length++),d?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var d=W(l);if(d.length===0)return new s(1);for(var y=this,C=0;C<d.length&&d[C]===0;C++,y=y.sqr());if(++C<d.length)for(var D=y.sqr();C<d.length;C++,D=D.sqr())d[C]!==0&&(y=y.mul(D));return y},s.prototype.iushln=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,C=67108863>>>26-d<<26-d,D;if(d!==0){var S=0;for(D=0;D<this.length;D++){var v=this.words[D]&C,A=(this.words[D]|0)-v<<d;this.words[D]=A|S,S=v>>>26-d}S&&(this.words[D]=S,this.length++)}if(y!==0){for(D=this.length-1;D>=0;D--)this.words[D+y]=this.words[D];for(D=0;D<y;D++)this.words[D]=0;this.length+=y}return this._strip()},s.prototype.ishln=function(l){return i(this.negative===0),this.iushln(l)},s.prototype.iushrn=function(l,d,y){i(typeof l=="number"&&l>=0);var C;d?C=(d-d%26)/26:C=0;var D=l%26,S=Math.min((l-D)/26,this.length),v=67108863^67108863>>>D<<D,A=y;if(C-=S,C=Math.max(0,C),A){for(var x=0;x<S;x++)A.words[x]=this.words[x];A.length=S}if(S!==0)if(this.length>S)for(this.length-=S,x=0;x<this.length;x++)this.words[x]=this.words[x+S];else this.words[0]=0,this.length=1;var N=0;for(x=this.length-1;x>=0&&(N!==0||x>=C);x--){var ae=this.words[x]|0;this.words[x]=N<<26-D|ae>>>D,N=ae&v}return A&&N!==0&&(A.words[A.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,d,y){return i(this.negative===0),this.iushrn(l,d,y)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,C=1<<d;if(this.length<=y)return!1;var D=this.words[y];return!!(D&C)},s.prototype.imaskn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(d!==0&&y++,this.length=Math.min(y,this.length),d!==0){var C=67108863^67108863>>>d<<d;this.words[this.length-1]&=C}return this._strip()},s.prototype.maskn=function(l){return this.clone().imaskn(l)},s.prototype.iaddn=function(l){return i(typeof l=="number"),i(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},s.prototype._iaddn=function(l){this.words[0]+=l;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(l){if(i(typeof l=="number"),i(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(l){return this.clone().iaddn(l)},s.prototype.subn=function(l){return this.clone().isubn(l)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(l,d,y){var C=l.length+y,D;this._expand(C);var S,v=0;for(D=0;D<l.length;D++){S=(this.words[D+y]|0)+v;var A=(l.words[D]|0)*d;S-=A&67108863,v=(S>>26)-(A/67108864|0),this.words[D+y]=S&67108863}for(;D<this.length-y;D++)S=(this.words[D+y]|0)+v,v=S>>26,this.words[D+y]=S&67108863;if(v===0)return this._strip();for(i(v===-1),v=0,D=0;D<this.length;D++)S=-(this.words[D]|0)+v,v=S>>26,this.words[D]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,d){var y=this.length-l.length,C=this.clone(),D=l,S=D.words[D.length-1]|0,v=this._countBits(S);y=26-v,y!==0&&(D=D.ushln(y),C.iushln(y),S=D.words[D.length-1]|0);var A=C.length-D.length,x;if(d!=="mod"){x=new s(null),x.length=A+1,x.words=new Array(x.length);for(var N=0;N<x.length;N++)x.words[N]=0}var ae=C.clone()._ishlnsubmul(D,1,A);ae.negative===0&&(C=ae,x&&(x.words[A]=1));for(var R=A-1;R>=0;R--){var X=(C.words[D.length+R]|0)*67108864+(C.words[D.length+R-1]|0);for(X=Math.min(X/S|0,67108863),C._ishlnsubmul(D,X,R);C.negative!==0;)X--,C.negative=0,C._ishlnsubmul(D,1,R),C.isZero()||(C.negative^=1);x&&(x.words[R]=X)}return x&&x._strip(),C._strip(),d!=="div"&&y!==0&&C.iushrn(y),{div:x||null,mod:C}},s.prototype.divmod=function(l,d,y){if(i(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var C,D,S;return this.negative!==0&&l.negative===0?(S=this.neg().divmod(l,d),d!=="mod"&&(C=S.div.neg()),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.iadd(l)),{div:C,mod:D}):this.negative===0&&l.negative!==0?(S=this.divmod(l.neg(),d),d!=="mod"&&(C=S.div.neg()),{div:C,mod:S.mod}):this.negative&l.negative?(S=this.neg().divmod(l.neg(),d),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.isub(l)),{div:S.div,mod:D}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?d==="div"?{div:this.divn(l.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,d)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var d=this.divmod(l);if(d.mod.isZero())return d.div;var y=d.div.negative!==0?d.mod.isub(l):d.mod,C=l.ushrn(1),D=l.andln(1),S=y.cmp(C);return S<0||D===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=(1<<26)%l,C=0,D=this.length-1;D>=0;D--)C=(y*C+(this.words[D]|0))%l;return d?-C:C},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=0,C=this.length-1;C>=0;C--){var D=(this.words[C]|0)+y*67108864;this.words[C]=D/l|0,y=D%l}return this._strip(),d?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var C=new s(1),D=new s(0),S=new s(0),v=new s(1),A=0;d.isEven()&&y.isEven();)d.iushrn(1),y.iushrn(1),++A;for(var x=y.clone(),N=d.clone();!d.isZero();){for(var ae=0,R=1;!(d.words[0]&R)&&ae<26;++ae,R<<=1);if(ae>0)for(d.iushrn(ae);ae-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(x),D.isub(N)),C.iushrn(1),D.iushrn(1);for(var X=0,V=1;!(y.words[0]&V)&&X<26;++X,V<<=1);if(X>0)for(y.iushrn(X);X-- >0;)(S.isOdd()||v.isOdd())&&(S.iadd(x),v.isub(N)),S.iushrn(1),v.iushrn(1);d.cmp(y)>=0?(d.isub(y),C.isub(S),D.isub(v)):(y.isub(d),S.isub(C),v.isub(D))}return{a:S,b:v,gcd:y.iushln(A)}},s.prototype._invmp=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var C=new s(1),D=new s(0),S=y.clone();d.cmpn(1)>0&&y.cmpn(1)>0;){for(var v=0,A=1;!(d.words[0]&A)&&v<26;++v,A<<=1);if(v>0)for(d.iushrn(v);v-- >0;)C.isOdd()&&C.iadd(S),C.iushrn(1);for(var x=0,N=1;!(y.words[0]&N)&&x<26;++x,N<<=1);if(x>0)for(y.iushrn(x);x-- >0;)D.isOdd()&&D.iadd(S),D.iushrn(1);d.cmp(y)>=0?(d.isub(y),C.isub(D)):(y.isub(d),D.isub(C))}var ae;return d.cmpn(1)===0?ae=C:ae=D,ae.cmpn(0)<0&&ae.iadd(l),ae},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var d=this.clone(),y=l.clone();d.negative=0,y.negative=0;for(var C=0;d.isEven()&&y.isEven();C++)d.iushrn(1),y.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;y.isEven();)y.iushrn(1);var D=d.cmp(y);if(D<0){var S=d;d=y,y=S}else if(D===0||y.cmpn(1)===0)break;d.isub(y)}while(!0);return y.iushln(C)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){i(typeof l=="number");var d=l%26,y=(l-d)/26,C=1<<d;if(this.length<=y)return this._expand(y+1),this.words[y]|=C,this;for(var D=C,S=y;D!==0&&S<this.length;S++){var v=this.words[S]|0;v+=D,D=v>>>26,v&=67108863,this.words[S]=v}return D!==0&&(this.words[S]=D,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var d=l<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var y;if(this.length>1)y=1;else{d&&(l=-l),i(l<=67108863,"Number is too big");var C=this.words[0]|0;y=C===l?0:C<l?-1:1}return this.negative!==0?-y|0:y},s.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var d=this.ucmp(l);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var d=0,y=this.length-1;y>=0;y--){var C=this.words[y]|0,D=l.words[y]|0;if(C!==D){C<D?d=-1:C>D&&(d=1);break}}return d},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new L(l)},s.prototype.toRed=function(l){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return i(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return i(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var z={k256:null,p224:null,p192:null,p25519:null};function j(m,l){this.name=m,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},j.prototype.ireduce=function(l){var d=l,y;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),y=d.bitLength();while(y>this.n);var C=y<this.n?-1:d.ucmp(this.p);return C===0?(d.words[0]=0,d.length=1):C>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},j.prototype.split=function(l,d){l.iushrn(this.n,0,d)},j.prototype.imulK=function(l){return l.imul(this.k)};function _(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,j),_.prototype.split=function(l,d){for(var y=4194303,C=Math.min(l.length,9),D=0;D<C;D++)d.words[D]=l.words[D];if(d.length=C,l.length<=9){l.words[0]=0,l.length=1;return}var S=l.words[9];for(d.words[d.length++]=S&y,D=10;D<l.length;D++){var v=l.words[D]|0;l.words[D-10]=(v&y)<<4|S>>>22,S=v}S>>>=22,l.words[D-10]=S,S===0&&l.length>10?l.length-=10:l.length-=9},_.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var d=0,y=0;y<l.length;y++){var C=l.words[y]|0;d+=C*977,l.words[y]=d&67108863,d=C*64+(d/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function U(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(U,j);function ee(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(ee,j);function oe(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(oe,j),oe.prototype.imulK=function(l){for(var d=0,y=0;y<l.length;y++){var C=(l.words[y]|0)*19+d,D=C&67108863;C>>>=26,l.words[y]=D,d=C}return d!==0&&(l.words[l.length++]=d),l},s._prime=function(l){if(z[l])return z[l];var d;if(l==="k256")d=new _;else if(l==="p224")d=new U;else if(l==="p192")d=new ee;else if(l==="p25519")d=new oe;else throw new Error("Unknown prime "+l);return z[l]=d,d};function L(m){if(typeof m=="string"){var l=s._prime(m);this.m=l.p,this.prime=l}else i(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}L.prototype._verify1=function(l){i(l.negative===0,"red works only with positives"),i(l.red,"red works only with red numbers")},L.prototype._verify2=function(l,d){i((l.negative|d.negative)===0,"red works only with positives"),i(l.red&&l.red===d.red,"red works only with red numbers")},L.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(g(l,l.umod(this.m)._forceRed(this)),l)},L.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},L.prototype.add=function(l,d){this._verify2(l,d);var y=l.add(d);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},L.prototype.iadd=function(l,d){this._verify2(l,d);var y=l.iadd(d);return y.cmp(this.m)>=0&&y.isub(this.m),y},L.prototype.sub=function(l,d){this._verify2(l,d);var y=l.sub(d);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},L.prototype.isub=function(l,d){this._verify2(l,d);var y=l.isub(d);return y.cmpn(0)<0&&y.iadd(this.m),y},L.prototype.shl=function(l,d){return this._verify1(l),this.imod(l.ushln(d))},L.prototype.imul=function(l,d){return this._verify2(l,d),this.imod(l.imul(d))},L.prototype.mul=function(l,d){return this._verify2(l,d),this.imod(l.mul(d))},L.prototype.isqr=function(l){return this.imul(l,l.clone())},L.prototype.sqr=function(l){return this.mul(l,l)},L.prototype.sqrt=function(l){if(l.isZero())return l.clone();var d=this.m.andln(3);if(i(d%2===1),d===3){var y=this.m.add(new s(1)).iushrn(2);return this.pow(l,y)}for(var C=this.m.subn(1),D=0;!C.isZero()&&C.andln(1)===0;)D++,C.iushrn(1);i(!C.isZero());var S=new s(1).toRed(this),v=S.redNeg(),A=this.m.subn(1).iushrn(1),x=this.m.bitLength();for(x=new s(2*x*x).toRed(this);this.pow(x,A).cmp(v)!==0;)x.redIAdd(v);for(var N=this.pow(x,C),ae=this.pow(l,C.addn(1).iushrn(1)),R=this.pow(l,C),X=D;R.cmp(S)!==0;){for(var V=R,J=0;V.cmp(S)!==0;J++)V=V.redSqr();i(J<X);var K=this.pow(N,new s(1).iushln(X-J-1));ae=ae.redMul(K),N=K.redSqr(),R=R.redMul(N),X=J}return ae},L.prototype.invm=function(l){var d=l._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},L.prototype.pow=function(l,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return l.clone();var y=4,C=new Array(1<<y);C[0]=new s(1).toRed(this),C[1]=l;for(var D=2;D<C.length;D++)C[D]=this.mul(C[D-1],l);var S=C[0],v=0,A=0,x=d.bitLength()%26;for(x===0&&(x=26),D=d.length-1;D>=0;D--){for(var N=d.words[D],ae=x-1;ae>=0;ae--){var R=N>>ae&1;if(S!==C[0]&&(S=this.sqr(S)),R===0&&v===0){A=0;continue}v<<=1,v|=R,A++,!(A!==y&&(D!==0||ae!==0))&&(S=this.mul(S,C[v]),A=0,v=0)}x=26}return S},L.prototype.convertTo=function(l){var d=l.umod(this.m);return d===l?d.clone():d},L.prototype.convertFrom=function(l){var d=l.clone();return d.red=null,d},s.mont=function(l){return new b(l)};function b(m){L.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(b,L),b.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},b.prototype.convertFrom=function(l){var d=this.imod(l.mul(this.rinv));return d.red=null,d},b.prototype.imul=function(l,d){if(l.isZero()||d.isZero())return l.words[0]=0,l.length=1,l;var y=l.imul(d),C=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(C).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.mul=function(l,d){if(l.isZero()||d.isZero())return new s(0)._forceRed(this);var y=l.mul(d),C=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(C).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.invm=function(l){var d=this.imod(l._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(r,fr)})(kg);var vt=kg.exports;const Hg="bignumber/5.7.0";var nl=vt.BN;const ds=new xt(Hg),rd={},jg=9007199254740991;function c4(r){return r!=null&&(ir.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||Oi(r)||typeof r=="bigint"||wa(r))}let Wg=!1;class ir{constructor(e,t){e!==rd&&ds.throwError("cannot call constructor directly; use BigNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return gi(Tt(this).fromTwos(e))}toTwos(e){return gi(Tt(this).toTwos(e))}abs(){return this._hex[0]==="-"?ir.from(this._hex.substring(1)):this}add(e){return gi(Tt(this).add(Tt(e)))}sub(e){return gi(Tt(this).sub(Tt(e)))}div(e){return ir.from(e).isZero()&&Ki("division-by-zero","div"),gi(Tt(this).div(Tt(e)))}mul(e){return gi(Tt(this).mul(Tt(e)))}mod(e){const t=Tt(e);return t.isNeg()&&Ki("division-by-zero","mod"),gi(Tt(this).umod(t))}pow(e){const t=Tt(e);return t.isNeg()&&Ki("negative-power","pow"),gi(Tt(this).pow(t))}and(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Ki("unbound-bitwise-result","and"),gi(Tt(this).and(t))}or(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Ki("unbound-bitwise-result","or"),gi(Tt(this).or(t))}xor(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Ki("unbound-bitwise-result","xor"),gi(Tt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ki("negative-width","mask"),gi(Tt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ki("negative-width","shl"),gi(Tt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ki("negative-width","shr"),gi(Tt(this).shrn(e))}eq(e){return Tt(this).eq(Tt(e))}lt(e){return Tt(this).lt(Tt(e))}lte(e){return Tt(this).lte(Tt(e))}gt(e){return Tt(this).gt(Tt(e))}gte(e){return Tt(this).gte(Tt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Tt(this).isZero()}toNumber(){try{return Tt(this).toNumber()}catch{Ki("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ds.throwError("this platform does not support BigInt",xt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Wg||(Wg=!0,ds.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ds.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",xt.errors.UNEXPECTED_ARGUMENT,{}):ds.throwError("BigNumber.toString does not accept parameters",xt.errors.UNEXPECTED_ARGUMENT,{})),Tt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ir)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ir(rd,Rc(e)):e.match(/^-?[0-9]+$/)?new ir(rd,Rc(new nl(e))):ds.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ki("underflow","BigNumber.from",e),(e>=jg||e<=-jg)&&Ki("overflow","BigNumber.from",e),ir.from(String(e));const t=e;if(typeof t=="bigint")return ir.from(t.toString());if(wa(t))return ir.from(ii(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return ir.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(Oi(i)||i[0]==="-"&&Oi(i.substring(1))))return ir.from(i)}return ds.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Rc(r){if(typeof r!="string")return Rc(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&ds.throwArgumentError("invalid hex","value",r),r=Rc(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function gi(r){return ir.from(Rc(r))}function Tt(r){const e=ir.from(r).toHexString();return e[0]==="-"?new nl("-"+e.substring(3),16):new nl(e.substring(2),16)}function Ki(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),ds.throwError(r,xt.errors.NUMERIC_FAULT,i)}function f4(r){return new nl(r,36).toString(16)}const ni=new xt(Hg),Tc={},Kg=ir.from(0),Vg=ir.from(-1);function Gg(r,e,t,i){const n={fault:e,operation:t};return i!==void 0&&(n.value=i),ni.throwError(r,xt.errors.NUMERIC_FAULT,n)}let $c="0";for(;$c.length<256;)$c+=$c;function id(r){if(typeof r!="number")try{r=ir.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+$c.substring(0,r):ni.throwArgumentError("invalid decimal size","decimals",r)}function nd(r,e){e==null&&(e=0);const t=id(e);r=ir.from(r);const i=r.lt(Kg);i&&(r=r.mul(Vg));let n=r.mod(t).toString();for(;n.length<t.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=r.div(t).toString();return t.length===1?r=s:r=s+"."+n,i&&(r="-"+r),r}function ps(r,e){e==null&&(e=0);const t=id(e);(typeof r!="string"||!r.match(/^-?[0-9.]+$/))&&ni.throwArgumentError("invalid decimal value","value",r);const i=r.substring(0,1)==="-";i&&(r=r.substring(1)),r==="."&&ni.throwArgumentError("missing value","value",r);const n=r.split(".");n.length>2&&ni.throwArgumentError("too many decimal points","value",r);let s=n[0],a=n[1];for(s||(s="0"),a||(a="0");a[a.length-1]==="0";)a=a.substring(0,a.length-1);for(a.length>t.length-1&&Gg("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.length<t.length-1;)a+="0";const f=ir.from(s),h=ir.from(a);let u=f.mul(t).add(h);return i&&(u=u.mul(Vg)),u}class ya{constructor(e,t,i,n){e!==Tc&&ni.throwError("cannot use FixedFormat constructor; use FixedFormat.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=i,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=id(n),Object.freeze(this)}static from(e){if(e instanceof ya)return e;typeof e=="number"&&(e=`fixed128x${e}`);let t=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")t=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||ni.throwArgumentError("invalid fixed format","format",e),t=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(a,f,h)=>e[a]==null?h:(typeof e[a]!==f&&ni.throwArgumentError("invalid fixed format ("+a+" not "+f+")","format."+a,e[a]),e[a]);t=s("signed","boolean",t),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&ni.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&ni.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new ya(Tc,t,i,n)}}class zr{constructor(e,t,i,n){e!==Tc&&ni.throwError("cannot use FixedNumber constructor; use FixedNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&ni.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(Yg.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(Yg.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&ni.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=zr.from("1"+$c.substring(0,e),this.format),n=l4.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&ni.throwArgumentError("invalid byte width","width",e);const t=ir.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Bn(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return zr.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!c4(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),zr.fromString(nd(e,t),ya.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=ya.from(t),n=ps(e,i.decimals);!i.signed&&n.lt(Kg)&&Gg("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=Bn(s,i.width/8));const a=nd(n,i.decimals);return new zr(Tc,s,a,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=ya.from(t);if(ur(e).length>i.width/8)throw new Error("overflow");let n=ir.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),a=nd(n,i.decimals);return new zr(Tc,s,a,i)}static from(e,t){if(typeof e=="string")return zr.fromString(e,t);if(wa(e))return zr.fromBytes(e,t);try{return zr.fromValue(e,0,t)}catch(i){if(i.code!==xt.errors.INVALID_ARGUMENT)throw i}return ni.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Yg=zr.from(1),l4=zr.from("0.5"),h4="strings/5.7.0",Jg=new xt(h4);var sl;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(sl||(sl={}));var _a;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(_a||(_a={}));function u4(r,e,t,i,n){return Jg.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}function Qg(r,e,t,i,n){if(r===_a.BAD_PREFIX||r===_a.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)s++;return s}return r===_a.OVERRUN?t.length-e-1:0}function d4(r,e,t,i,n){return r===_a.OVERLONG?(i.push(n),0):(i.push(65533),Qg(r,e,t))}Object.freeze({error:u4,ignore:Qg,replace:d4});function sd(r,e=sl.current){e!=sl.current&&(Jg.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const n=r.charCodeAt(i);if(n<128)t.push(n);else if(n<2048)t.push(n>>6|192),t.push(n&63|128);else if((n&64512)==55296){i++;const s=r.charCodeAt(i);if(i>=r.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const a=65536+((n&1023)<<10)+(s&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(n>>12|224),t.push(n>>6&63|128),t.push(n&63|128)}return ur(t)}function p4(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t<r.length;t+=4)e.push(parseInt(r.substring(t,t+4),16));return e}function od(r,e){e||(e=function(n){return[parseInt(n,16)]});let t=0,i={};return r.split(",").forEach(n=>{let s=n.split(":");t+=parseInt(s[0],16),i[t]=e(s[1])}),i}function Zg(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}Zg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),od("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),od("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),od("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",p4),Zg("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Xg="hash/5.7.0";function g4(r){r=atob(r);const e=[];for(let t=0;t<r.length;t++)e.push(r.charCodeAt(t));return ur(e)}function ev(r,e){e==null&&(e=1);const t=[],i=t.forEach,n=function(s,a){i.call(s,function(f){a>0&&Array.isArray(f)?n(f,a-1):t.push(f)})};return n(r,e),t}function v4(r){const e={};for(let t=0;t<r.length;t++){const i=r[t];e[i[0]]=i[1]}return e}function m4(r){let e=0;function t(){return r[e++]<<8|r[e++]}let i=t(),n=1,s=[0,1];for(let z=1;z<i;z++)s.push(n+=t());let a=t(),f=e;e+=a;let h=0,u=0;function g(){return h==0&&(u=u<<8|r[e++],h=8),u>>--h&1}const w=31,P=Math.pow(2,w),M=P>>>1,O=M>>1,$=P-1;let W=0;for(let z=0;z<w;z++)W=W<<1|g();let k=[],F=0,Y=P;for(;;){let z=Math.floor(((W-F+1)*n-1)/Y),j=0,_=i;for(;_-j>1;){let oe=j+_>>>1;z<s[oe]?_=oe:j=oe}if(j==0)break;k.push(j);let U=F+Math.floor(Y*s[j]/n),ee=F+Math.floor(Y*s[j+1]/n)-1;for(;!((U^ee)&M);)W=W<<1&$|g(),U=U<<1&$,ee=ee<<1&$|1;for(;U&~ee&O;)W=W&M|W<<1&$>>>1|g(),U=U<<1^M,ee=(ee^M)<<1|M|1;F=U,Y=1+ee-U}let B=i-4;return k.map(z=>{switch(z-B){case 3:return B+65792+(r[f++]<<16|r[f++]<<8|r[f++]);case 2:return B+256+(r[f++]<<8|r[f++]);case 1:return B+r[f++];default:return z-1}})}function b4(r){let e=0;return()=>r[e++]}function w4(r){return b4(m4(r))}function y4(r){return r&1?~r>>1:r>>1}function _4(r,e){let t=Array(r);for(let i=0;i<r;i++)t[i]=1+e();return t}function tv(r,e){let t=Array(r);for(let i=0,n=-1;i<r;i++)t[i]=n+=1+e();return t}function x4(r,e){let t=Array(r);for(let i=0,n=0;i<r;i++)t[i]=n+=y4(e());return t}function ol(r,e){let t=tv(r(),r),i=r(),n=tv(i,r),s=_4(i,r);for(let a=0;a<i;a++)for(let f=0;f<s[a];f++)t.push(n[a]+f);return e?t.map(a=>e[a]):t}function A4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(S4(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(I4(t,r))}return v4(ev(e))}function E4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function rv(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)x4(r,t).forEach((s,a)=>i[a].push(s));return i}function S4(r,e){let t=1+e(),i=e(),n=E4(e),s=rv(n.length,1+r,e);return ev(s.map((a,f)=>{const h=a[0],u=a.slice(1);return Array(n[f]).fill(void 0).map((g,w)=>{let P=w*i;return[h+w*t,u.map(M=>M+P)]})}))}function I4(r,e){let t=1+e();return rv(t,1+r,e).map(n=>[n[0],n.slice(1)])}function M4(r){let e=ol(r).sort((i,n)=>i-n);return t();function t(){let i=[];for(;;){let u=ol(r,e);if(u.length==0)break;i.push({set:new Set(u),node:t()})}i.sort((u,g)=>g.set.size-u.set.size);let n=r(),s=n%3;n=n/3|0;let a=!!(n&1);n>>=1;let f=n==1,h=n==2;return{branches:i,valid:s,fe0f:a,save:f,check:h}}}function C4(){return w4(g4("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const al=C4();new Set(ol(al)),new Set(ol(al)),A4(al),M4(al),new xt(Xg),new Uint8Array(32).fill(0);const P4=`Ethereum Signed Message:
22
- `;function iv(r){return typeof r=="string"&&(r=sd(r)),td(i4([sd(P4),sd(String(r.length)),r]))}const D4="rlp/5.7.0";new xt(D4);const O4="address/5.7.0",Nc=new xt(O4);function nv(r){Oi(r,20)||Nc.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let n=0;n<40;n++)t[n]=e[n].charCodeAt(0);const i=ur(td(t));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const R4=9007199254740991;function T4(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const ad={};for(let r=0;r<10;r++)ad[String(r)]=String(r);for(let r=0;r<26;r++)ad[String.fromCharCode(65+r)]=String(10+r);const sv=Math.floor(T4(R4));function $4(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>ad[i]).join("");for(;e.length>=sv;){let i=e.substring(0,sv);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function N4(r){let e=null;if(typeof r!="string"&&Nc.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=nv(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&Nc.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==$4(r)&&Nc.throwArgumentError("bad icap checksum","address",r),e=f4(r.substring(4));e.length<40;)e="0"+e;e=nv("0x"+e)}else Nc.throwArgumentError("invalid address","address",r);return e}const L4="properties/5.7.0";new xt(L4);function Lc(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}new xt(Xg),new Uint8Array(32).fill(0),ir.from(-1);const B4=ir.from(0),F4=ir.from(1);ir.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Bn(F4.toHexString(),32),Bn(B4.toHexString(),32);var Ri={},$t={},xo=ov;function ov(r,e){if(!r)throw new Error(e||"Assertion failed")}ov.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var xa={exports:{}};typeof Object.create=="function"?xa.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:xa.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}};var U4=xo,q4=xa.exports;$t.inherits=q4;function z4(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function k4(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var i=0,n=0;n<r.length;n++){var s=r.charCodeAt(n);s<128?t[i++]=s:s<2048?(t[i++]=s>>6|192,t[i++]=s&63|128):z4(r,n)?(s=65536+((s&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128)}else for(n=0;n<r.length;n++)t[n]=r[n]|0;return t}$t.toArray=k4;function H4(r){for(var e="",t=0;t<r.length;t++)e+=cv(r[t].toString(16));return e}$t.toHex=H4;function av(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}$t.htonl=av;function j4(r,e){for(var t="",i=0;i<r.length;i++){var n=r[i];e==="little"&&(n=av(n)),t+=fv(n.toString(16))}return t}$t.toHex32=j4;function cv(r){return r.length===1?"0"+r:r}$t.zero2=cv;function fv(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}$t.zero8=fv;function W4(r,e,t,i){var n=t-e;U4(n%4===0);for(var s=new Array(n/4),a=0,f=e;a<s.length;a++,f+=4){var h;i==="big"?h=r[f]<<24|r[f+1]<<16|r[f+2]<<8|r[f+3]:h=r[f+3]<<24|r[f+2]<<16|r[f+1]<<8|r[f],s[a]=h>>>0}return s}$t.join32=W4;function K4(r,e){for(var t=new Array(r.length*4),i=0,n=0;i<r.length;i++,n+=4){var s=r[i];e==="big"?(t[n]=s>>>24,t[n+1]=s>>>16&255,t[n+2]=s>>>8&255,t[n+3]=s&255):(t[n+3]=s>>>24,t[n+2]=s>>>16&255,t[n+1]=s>>>8&255,t[n]=s&255)}return t}$t.split32=K4;function V4(r,e){return r>>>e|r<<32-e}$t.rotr32=V4;function G4(r,e){return r<<e|r>>>32-e}$t.rotl32=G4;function Y4(r,e){return r+e>>>0}$t.sum32=Y4;function J4(r,e,t){return r+e+t>>>0}$t.sum32_3=J4;function Q4(r,e,t,i){return r+e+t+i>>>0}$t.sum32_4=Q4;function Z4(r,e,t,i,n){return r+e+t+i+n>>>0}$t.sum32_5=Z4;function X4(r,e,t,i){var n=r[e],s=r[e+1],a=i+s>>>0,f=(a<i?1:0)+t+n;r[e]=f>>>0,r[e+1]=a}$t.sum64=X4;function e8(r,e,t,i){var n=e+i>>>0,s=(n<e?1:0)+r+t;return s>>>0}$t.sum64_hi=e8;function t8(r,e,t,i){var n=e+i;return n>>>0}$t.sum64_lo=t8;function r8(r,e,t,i,n,s,a,f){var h=0,u=e;u=u+i>>>0,h+=u<e?1:0,u=u+s>>>0,h+=u<s?1:0,u=u+f>>>0,h+=u<f?1:0;var g=r+t+n+a+h;return g>>>0}$t.sum64_4_hi=r8;function i8(r,e,t,i,n,s,a,f){var h=e+i+s+f;return h>>>0}$t.sum64_4_lo=i8;function n8(r,e,t,i,n,s,a,f,h,u){var g=0,w=e;w=w+i>>>0,g+=w<e?1:0,w=w+s>>>0,g+=w<s?1:0,w=w+f>>>0,g+=w<f?1:0,w=w+u>>>0,g+=w<u?1:0;var P=r+t+n+a+h+g;return P>>>0}$t.sum64_5_hi=n8;function s8(r,e,t,i,n,s,a,f,h,u){var g=e+i+s+f+u;return g>>>0}$t.sum64_5_lo=s8;function o8(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}$t.rotr64_hi=o8;function a8(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}$t.rotr64_lo=a8;function c8(r,e,t){return r>>>t}$t.shr64_hi=c8;function f8(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}$t.shr64_lo=f8;var Aa={},lv=$t,l8=xo;function cl(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Aa.BlockHash=cl,cl.prototype.update=function(e,t){if(e=lv.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=lv.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},cl.prototype.digest=function(e){return this.update(this._pad()),l8(this.pending===null),this._digest(e)},cl.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,i=t-(e+this.padLength)%t,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,a=8;a<this.padLength;a++)n[s++]=0;return n};var Ea={},Fn={},h8=$t,Un=h8.rotr32;function u8(r,e,t,i){if(r===0)return hv(e,t,i);if(r===1||r===3)return dv(e,t,i);if(r===2)return uv(e,t,i)}Fn.ft_1=u8;function hv(r,e,t){return r&e^~r&t}Fn.ch32=hv;function uv(r,e,t){return r&e^r&t^e&t}Fn.maj32=uv;function dv(r,e,t){return r^e^t}Fn.p32=dv;function d8(r){return Un(r,2)^Un(r,13)^Un(r,22)}Fn.s0_256=d8;function p8(r){return Un(r,6)^Un(r,11)^Un(r,25)}Fn.s1_256=p8;function g8(r){return Un(r,7)^Un(r,18)^r>>>3}Fn.g0_256=g8;function v8(r){return Un(r,17)^Un(r,19)^r>>>10}Fn.g1_256=v8;var Sa=$t,m8=Aa,b8=Fn,cd=Sa.rotl32,Bc=Sa.sum32,w8=Sa.sum32_5,y8=b8.ft_1,pv=m8.BlockHash,_8=[1518500249,1859775393,2400959708,3395469782];function qn(){if(!(this instanceof qn))return new qn;pv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Sa.inherits(qn,pv);var x8=qn;qn.blockSize=512,qn.outSize=160,qn.hmacStrength=80,qn.padLength=64,qn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=cd(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4];for(n=0;n<i.length;n++){var g=~~(n/20),w=w8(cd(s,5),y8(g,a,f,h),u,i[n],_8[g]);u=h,h=f,f=cd(a,30),a=s,s=w}this.h[0]=Bc(this.h[0],s),this.h[1]=Bc(this.h[1],a),this.h[2]=Bc(this.h[2],f),this.h[3]=Bc(this.h[3],h),this.h[4]=Bc(this.h[4],u)},qn.prototype._digest=function(e){return e==="hex"?Sa.toHex32(this.h,"big"):Sa.split32(this.h,"big")};var Ia=$t,A8=Aa,Ma=Fn,E8=xo,mn=Ia.sum32,S8=Ia.sum32_4,I8=Ia.sum32_5,M8=Ma.ch32,C8=Ma.maj32,P8=Ma.s0_256,D8=Ma.s1_256,O8=Ma.g0_256,R8=Ma.g1_256,gv=A8.BlockHash,T8=[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 zn(){if(!(this instanceof zn))return new zn;gv.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=T8,this.W=new Array(64)}Ia.inherits(zn,gv);var vv=zn;zn.blockSize=512,zn.outSize=256,zn.hmacStrength=192,zn.padLength=64,zn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=S8(R8(i[n-2]),i[n-7],O8(i[n-15]),i[n-16]);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4],g=this.h[5],w=this.h[6],P=this.h[7];for(E8(this.k.length===i.length),n=0;n<i.length;n++){var M=I8(P,D8(u),M8(u,g,w),this.k[n],i[n]),O=mn(P8(s),C8(s,a,f));P=w,w=g,g=u,u=mn(h,M),h=f,f=a,a=s,s=mn(M,O)}this.h[0]=mn(this.h[0],s),this.h[1]=mn(this.h[1],a),this.h[2]=mn(this.h[2],f),this.h[3]=mn(this.h[3],h),this.h[4]=mn(this.h[4],u),this.h[5]=mn(this.h[5],g),this.h[6]=mn(this.h[6],w),this.h[7]=mn(this.h[7],P)},zn.prototype._digest=function(e){return e==="hex"?Ia.toHex32(this.h,"big"):Ia.split32(this.h,"big")};var fd=$t,mv=vv;function gs(){if(!(this instanceof gs))return new gs;mv.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}fd.inherits(gs,mv);var $8=gs;gs.blockSize=512,gs.outSize=224,gs.hmacStrength=192,gs.padLength=64,gs.prototype._digest=function(e){return e==="hex"?fd.toHex32(this.h.slice(0,7),"big"):fd.split32(this.h.slice(0,7),"big")};var vi=$t,N8=Aa,L8=xo,kn=vi.rotr64_hi,Hn=vi.rotr64_lo,bv=vi.shr64_hi,wv=vi.shr64_lo,Bs=vi.sum64,ld=vi.sum64_hi,hd=vi.sum64_lo,B8=vi.sum64_4_hi,F8=vi.sum64_4_lo,U8=vi.sum64_5_hi,q8=vi.sum64_5_lo,yv=N8.BlockHash,z8=[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 bn(){if(!(this instanceof bn))return new bn;yv.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=z8,this.W=new Array(160)}vi.inherits(bn,yv);var _v=bn;bn.blockSize=1024,bn.outSize=512,bn.hmacStrength=192,bn.padLength=128,bn.prototype._prepareBlock=function(e,t){for(var i=this.W,n=0;n<32;n++)i[n]=e[t+n];for(;n<i.length;n+=2){var s=Z8(i[n-4],i[n-3]),a=X8(i[n-4],i[n-3]),f=i[n-14],h=i[n-13],u=J8(i[n-30],i[n-29]),g=Q8(i[n-30],i[n-29]),w=i[n-32],P=i[n-31];i[n]=B8(s,a,f,h,u,g,w,P),i[n+1]=F8(s,a,f,h,u,g,w,P)}},bn.prototype._update=function(e,t){this._prepareBlock(e,t);var i=this.W,n=this.h[0],s=this.h[1],a=this.h[2],f=this.h[3],h=this.h[4],u=this.h[5],g=this.h[6],w=this.h[7],P=this.h[8],M=this.h[9],O=this.h[10],$=this.h[11],W=this.h[12],k=this.h[13],F=this.h[14],Y=this.h[15];L8(this.k.length===i.length);for(var B=0;B<i.length;B+=2){var z=F,j=Y,_=G8(P,M),U=Y8(P,M),ee=k8(P,M,O,$,W),oe=H8(P,M,O,$,W,k),L=this.k[B],b=this.k[B+1],m=i[B],l=i[B+1],d=U8(z,j,_,U,ee,oe,L,b,m,l),y=q8(z,j,_,U,ee,oe,L,b,m,l);z=K8(n,s),j=V8(n,s),_=j8(n,s,a,f,h),U=W8(n,s,a,f,h,u);var C=ld(z,j,_,U),D=hd(z,j,_,U);F=W,Y=k,W=O,k=$,O=P,$=M,P=ld(g,w,d,y),M=hd(w,w,d,y),g=h,w=u,h=a,u=f,a=n,f=s,n=ld(d,y,C,D),s=hd(d,y,C,D)}Bs(this.h,0,n,s),Bs(this.h,2,a,f),Bs(this.h,4,h,u),Bs(this.h,6,g,w),Bs(this.h,8,P,M),Bs(this.h,10,O,$),Bs(this.h,12,W,k),Bs(this.h,14,F,Y)},bn.prototype._digest=function(e){return e==="hex"?vi.toHex32(this.h,"big"):vi.split32(this.h,"big")};function k8(r,e,t,i,n){var s=r&t^~r&n;return s<0&&(s+=4294967296),s}function H8(r,e,t,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function j8(r,e,t,i,n){var s=r&t^r&n^t&n;return s<0&&(s+=4294967296),s}function W8(r,e,t,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function K8(r,e){var t=kn(r,e,28),i=kn(e,r,2),n=kn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function V8(r,e){var t=Hn(r,e,28),i=Hn(e,r,2),n=Hn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function G8(r,e){var t=kn(r,e,14),i=kn(r,e,18),n=kn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function Y8(r,e){var t=Hn(r,e,14),i=Hn(r,e,18),n=Hn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function J8(r,e){var t=kn(r,e,1),i=kn(r,e,8),n=bv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function Q8(r,e){var t=Hn(r,e,1),i=Hn(r,e,8),n=wv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function Z8(r,e){var t=kn(r,e,19),i=kn(e,r,29),n=bv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}function X8(r,e){var t=Hn(r,e,19),i=Hn(e,r,29),n=wv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}var ud=$t,xv=_v;function vs(){if(!(this instanceof vs))return new vs;xv.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ud.inherits(vs,xv);var e_=vs;vs.blockSize=1024,vs.outSize=384,vs.hmacStrength=192,vs.padLength=128,vs.prototype._digest=function(e){return e==="hex"?ud.toHex32(this.h.slice(0,12),"big"):ud.split32(this.h.slice(0,12),"big")},Ea.sha1=x8,Ea.sha224=$8,Ea.sha256=vv,Ea.sha384=e_,Ea.sha512=_v;var Av={},Ao=$t,t_=Aa,fl=Ao.rotl32,Ev=Ao.sum32,Fc=Ao.sum32_3,Sv=Ao.sum32_4,Iv=t_.BlockHash;function jn(){if(!(this instanceof jn))return new jn;Iv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Ao.inherits(jn,Iv),Av.ripemd160=jn,jn.blockSize=512,jn.outSize=160,jn.hmacStrength=192,jn.padLength=64,jn.prototype._update=function(e,t){for(var i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],f=this.h[4],h=i,u=n,g=s,w=a,P=f,M=0;M<80;M++){var O=Ev(fl(Sv(i,Mv(M,n,s,a),e[n_[M]+t],r_(M)),o_[M]),f);i=f,f=a,a=fl(s,10),s=n,n=O,O=Ev(fl(Sv(h,Mv(79-M,u,g,w),e[s_[M]+t],i_(M)),a_[M]),P),h=P,P=w,w=fl(g,10),g=u,u=O}O=Fc(this.h[1],s,w),this.h[1]=Fc(this.h[2],a,P),this.h[2]=Fc(this.h[3],f,h),this.h[3]=Fc(this.h[4],i,u),this.h[4]=Fc(this.h[0],n,g),this.h[0]=O},jn.prototype._digest=function(e){return e==="hex"?Ao.toHex32(this.h,"little"):Ao.split32(this.h,"little")};function Mv(r,e,t,i){return r<=15?e^t^i:r<=31?e&t|~e&i:r<=47?(e|~t)^i:r<=63?e&i|t&~i:e^(t|~i)}function r_(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function i_(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var n_=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],s_=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],o_=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],a_=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c_=$t,f_=xo;function Ca(r,e,t){if(!(this instanceof Ca))return new Ca(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(c_.toArray(e,t))}var l_=Ca;Ca.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),f_(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Ca.prototype.update=function(e,t){return this.inner.update(e,t),this},Ca.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(r){var e=r;e.utils=$t,e.common=Aa,e.sha=Ea,e.ripemd=Av,e.hmac=l_,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Ri);function Pa(r,e,t){return t={path:e,exports:{},require:function(i,n){return h_(i,n??t.path)}},r(t,t.exports),t.exports}function h_(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var dd=Cv;function Cv(r,e){if(!r)throw new Error(e||"Assertion failed")}Cv.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var wn=Pa(function(r,e){var t=e;function i(a,f){if(Array.isArray(a))return a.slice();if(!a)return[];var h=[];if(typeof a!="string"){for(var u=0;u<a.length;u++)h[u]=a[u]|0;return h}if(f==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var u=0;u<a.length;u+=2)h.push(parseInt(a[u]+a[u+1],16))}else for(var u=0;u<a.length;u++){var g=a.charCodeAt(u),w=g>>8,P=g&255;w?h.push(w,P):h.push(P)}return h}t.toArray=i;function n(a){return a.length===1?"0"+a:a}t.zero2=n;function s(a){for(var f="",h=0;h<a.length;h++)f+=n(a[h].toString(16));return f}t.toHex=s,t.encode=function(f,h){return h==="hex"?s(f):f}}),Ti=Pa(function(r,e){var t=e;t.assert=dd,t.toArray=wn.toArray,t.zero2=wn.zero2,t.toHex=wn.toHex,t.encode=wn.encode;function i(h,u,g){var w=new Array(Math.max(h.bitLength(),g)+1);w.fill(0);for(var P=1<<u+1,M=h.clone(),O=0;O<w.length;O++){var $,W=M.andln(P-1);M.isOdd()?(W>(P>>1)-1?$=(P>>1)-W:$=W,M.isubn($)):$=0,w[O]=$,M.iushrn(1)}return w}t.getNAF=i;function n(h,u){var g=[[],[]];h=h.clone(),u=u.clone();for(var w=0,P=0,M;h.cmpn(-w)>0||u.cmpn(-P)>0;){var O=h.andln(3)+w&3,$=u.andln(3)+P&3;O===3&&(O=-1),$===3&&($=-1);var W;O&1?(M=h.andln(7)+w&7,(M===3||M===5)&&$===2?W=-O:W=O):W=0,g[0].push(W);var k;$&1?(M=u.andln(7)+P&7,(M===3||M===5)&&O===2?k=-$:k=$):k=0,g[1].push(k),2*w===W+1&&(w=1-w),2*P===k+1&&(P=1-P),h.iushrn(1),u.iushrn(1)}return g}t.getJSF=n;function s(h,u,g){var w="_"+u;h.prototype[u]=function(){return this[w]!==void 0?this[w]:this[w]=g.call(this)}}t.cachedProperty=s;function a(h){return typeof h=="string"?t.toArray(h,"hex"):h}t.parseBytes=a;function f(h){return new vt(h,"hex","le")}t.intFromLE=f}),ll=Ti.getNAF,u_=Ti.getJSF,hl=Ti.assert;function Fs(r,e){this.type=r,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Eo=Fs;Fs.prototype.point=function(){throw new Error("Not implemented")},Fs.prototype.validate=function(){throw new Error("Not implemented")},Fs.prototype._fixedNafMul=function(e,t){hl(e.precomputed);var i=e._getDoubles(),n=ll(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),P=s;P>0;P--){for(f=0;f<a.length;f++)h=a[f],h===P?w=w.mixedAdd(i.points[f]):h===-P&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},Fs.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=ll(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];hl(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},Fs.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,P;for(g=0;g<n;g++){P=t[g];var M=P._getNAFPoints(e);a[g]=M.wnd,f[g]=M.points}for(g=n-1;g>=1;g-=2){var O=g-1,$=g;if(a[O]!==1||a[$]!==1){h[O]=ll(i[O],a[O],this._bitLength),h[$]=ll(i[$],a[$],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[$].length,u);continue}var W=[t[O],null,null,t[$]];t[O].y.cmp(t[$].y)===0?(W[1]=t[O].add(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg())):t[O].y.cmp(t[$].y.redNeg())===0?(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].add(t[$].neg())):(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],F=u_(i[O],i[$]);for(u=Math.max(F[0].length,u),h[O]=new Array(u),h[$]=new Array(u),w=0;w<u;w++){var Y=F[0][w]|0,B=F[1][w]|0;h[O][w]=k[(Y+1)*3+(B+1)],h[$][w]=0,f[O]=W}}var z=this.jpoint(null,null,null),j=this._wnafT4;for(g=u;g>=0;g--){for(var _=0;g>=0;){var U=!0;for(w=0;w<n;w++)j[w]=h[w][g]|0,j[w]!==0&&(U=!1);if(!U)break;_++,g--}if(g>=0&&_++,z=z.dblp(_),g<0)break;for(w=0;w<n;w++){var ee=j[w];ee!==0&&(ee>0?P=f[w][ee-1>>1]:ee<0&&(P=f[w][-ee-1>>1].neg()),P.type==="affine"?z=z.mixedAdd(P):z=z.add(P))}}for(g=0;g<n;g++)f[g]=null;return s?z:z.toP()};function Vi(r,e){this.curve=r,this.type=e,this.precomputed=null}Fs.BasePoint=Vi,Vi.prototype.eq=function(){throw new Error("Not implemented")},Vi.prototype.validate=function(){return this.curve.validate(this)},Fs.prototype.decodePoint=function(e,t){e=Ti.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?hl(e[e.length-1]%2===0):e[0]===7&&hl(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Vi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Vi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Vi.prototype.encode=function(e,t){return Ti.encode(this._encode(t),e)},Vi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Vi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Vi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Vi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Vi.prototype._getBeta=function(){return null},Vi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var pd=Pa(function(r){typeof Object.create=="function"?r.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(t,i){if(i){t.super_=i;var n=function(){};n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t}}}),d_=Ti.assert;function Gi(r){Eo.call(this,"short",r),this.a=new vt(r.a,16).toRed(this.red),this.b=new vt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}pd(Gi,Eo);var p_=Gi;Gi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new vt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new vt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],d_(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new vt(f.a,16),b:new vt(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},Gi.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:vt.mont(e),i=new vt(2).toRed(t).redInvm(),n=i.redNeg(),s=new vt(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},Gi.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new vt(1),a=new vt(0),f=new vt(0),h=new vt(1),u,g,w,P,M,O,$,W=0,k,F;i.cmpn(0)!==0;){var Y=n.div(i);k=n.sub(Y.mul(i)),F=f.sub(Y.mul(s));var B=h.sub(Y.mul(a));if(!w&&k.cmp(t)<0)u=$.neg(),g=s,w=k.neg(),P=F;else if(w&&++W===2)break;$=k,n=i,i=k,f=s,s=F,h=a,a=B}M=k.neg(),O=F;var z=w.sqr().add(P.sqr()),j=M.sqr().add(O.sqr());return j.cmp(z)>=0&&(M=u,O=g),w.negative&&(w=w.neg(),P=P.neg()),M.negative&&(M=M.neg(),O=O.neg()),[{a:w,b:P},{a:M,b:O}]},Gi.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),P=u.add(g).neg();return{k1:w,k2:P}},Gi.prototype.pointFromX=function(e,t){e=new vt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Gi.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Gi.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Or(r,e,t,i){Eo.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new vt(e,16),this.y=new vt(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}pd(Or,Eo.BasePoint),Gi.prototype.point=function(e,t,i){return new Or(this,e,t,i)},Gi.prototype.pointFromJSON=function(e,t){return Or.fromJSON(this,e,t)},Or.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Or.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Or.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Or.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Or.prototype.isInfinity=function(){return this.inf},Or.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Or.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Or.prototype.getX=function(){return this.x.fromRed()},Or.prototype.getY=function(){return this.y.fromRed()},Or.prototype.mul=function(e){return e=new vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Or.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Or.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Or.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Or.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Or.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function kr(r,e,t,i){Eo.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}pd(kr,Eo.BasePoint),Gi.prototype.jpoint=function(e,t,i){return new kr(this,e,t,i)},kr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},kr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},kr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),P=n.redMul(g),M=u.redSqr().redIAdd(w).redISub(P).redISub(P),O=u.redMul(P.redISub(M)).redISub(a.redMul(w)),$=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(M,O,$)},kr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),P=h.redSqr().redIAdd(g).redISub(w).redISub(w),M=h.redMul(w.redISub(P)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(P,M,O)},kr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),P=g.redSqr(),M=P.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),$=a.redMul(P),W=O.redSqr().redISub($.redAdd($)),k=$.redISub(W),F=O.redMul(k);F=F.redIAdd(F).redISub(M);var Y=g.redMul(h);t+1<e&&(u=u.redMul(M)),a=W,h=Y,g=F}return this.curve.jpoint(a,g.redMul(s),h)},kr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},kr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),P=this.y.redSqr(),M=P.redSqr(),O=this.x.redAdd(P).redSqr().redISub(w).redISub(M);O=O.redIAdd(O);var $=w.redAdd(w).redIAdd(w),W=$.redSqr(),k=M.redIAdd(M);k=k.redIAdd(k),k=k.redIAdd(k),e=W.redISub(O).redISub(O),t=$.redMul(O.redISub(e)).redISub(k),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},kr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),P=this.y.redSqr(),M=this.x.redMul(P),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var $=M.redIAdd(M);$=$.redIAdd($);var W=$.redAdd($);e=O.redSqr().redISub(W),i=this.y.redAdd(this.z).redSqr().redISub(P).redISub(w);var k=P.redSqr();k=k.redIAdd(k),k=k.redIAdd(k),k=k.redIAdd(k),t=O.redMul($.redISub(e)).redISub(k)}return this.curve.jpoint(e,t,i)},kr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),P=g.redISub(w),M=f.redSqr();M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=h.redMul(P).redISub(M),$=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,$)},kr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var P=this.x.redMul(h).redISub(w);P=P.redIAdd(P),P=P.redIAdd(P);var M=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(P,M,O)},kr.prototype.mul=function(e,t){return e=new vt(e,t),this.curve._wnafMul(this,e)},kr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},kr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},kr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},kr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ul=Pa(function(r,e){var t=e;t.base=Eo,t.short=p_,t.mont=null,t.edwards=null}),dl=Pa(function(r,e){var t=e,i=Ti.assert;function n(f){f.type==="short"?this.curve=new ul.short(f):f.type==="edwards"?this.curve=new ul.edwards(f):this.curve=new ul.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=n;function s(f,h){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var u=new n(h);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ri.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ri.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ri.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ri.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ri.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch{a=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ri.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function Us(r){if(!(this instanceof Us))return new Us(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=wn.toArray(r.entropy,r.entropyEnc||"hex"),t=wn.toArray(r.nonce,r.nonceEnc||"hex"),i=wn.toArray(r.pers,r.persEnc||"hex");dd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var Pv=Us;Us.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Us.prototype._hmac=function(){return new Ri.hmac(this.hash,this.K)},Us.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Us.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=wn.toArray(e,t),i=wn.toArray(i,n),dd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Us.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=wn.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,wn.encode(a,t)};var gd=Ti.assert;function Vr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var vd=Vr;Vr.fromPublic=function(e,t,i){return t instanceof Vr?t:new Vr(e,{pub:t,pubEnc:i})},Vr.fromPrivate=function(e,t,i){return t instanceof Vr?t:new Vr(e,{priv:t,privEnc:i})},Vr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Vr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Vr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Vr.prototype._importPrivate=function(e,t){this.priv=new vt(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Vr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?gd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&gd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Vr.prototype.derive=function(e){return e.validate()||gd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Vr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Vr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Vr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var g_=Ti.assert;function pl(r,e){if(r instanceof pl)return r;this._importDER(r,e)||(g_(r.r&&r.s,"Signature without r or s"),this.r=new vt(r.r,16),this.s=new vt(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var gl=pl;function v_(){this.place=0}function md(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function Dv(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}pl.prototype._importDER=function(e,t){e=Ti.toArray(e,t);var i=new v_;if(e[i.place++]!==48)return!1;var n=md(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=md(e,i);if(s===!1)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=md(e,i);if(f===!1||e.length!==f+i.place)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new vt(a),this.s=new vt(h),this.recoveryParam=null,!0};function bd(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}pl.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=Dv(t),i=Dv(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];bd(n,t.length),n=n.concat(t),n.push(2),bd(n,i.length);var s=n.concat(i),a=[48];return bd(a,s.length),a=a.concat(s),Ti.encode(a,e)};var m_=function(){throw new Error("unsupported")},Ov=Ti.assert;function Yi(r){if(!(this instanceof Yi))return new Yi(r);typeof r=="string"&&(Ov(Object.prototype.hasOwnProperty.call(dl,r),"Unknown curve "+r),r=dl[r]),r instanceof dl.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var b_=Yi;Yi.prototype.keyPair=function(e){return new vd(this,e)},Yi.prototype.keyFromPrivate=function(e,t){return vd.fromPrivate(this,e,t)},Yi.prototype.keyFromPublic=function(e,t){return vd.fromPublic(this,e,t)},Yi.prototype.genKeyPair=function(e){e||(e={});for(var t=new Pv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||m_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new vt(2));;){var s=new vt(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Yi.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Yi.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new vt(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),f=e.toArray("be",s),h=new Pv({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new vt(1)),g=0;;g++){var w=n.k?n.k(g):new vt(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(u)>=0)){var P=this.g.mul(w);if(!P.isInfinity()){var M=P.getX(),O=M.umod(this.n);if(O.cmpn(0)!==0){var $=w.invm(this.n).mul(O.mul(t.getPrivate()).iadd(e));if($=$.umod(this.n),$.cmpn(0)!==0){var W=(P.getY().isOdd()?1:0)|(M.cmp(O)!==0?2:0);return n.canonical&&$.cmp(this.nh)>0&&($=this.n.sub($),W^=1),new gl({r:O,s:$,recoveryParam:W})}}}}}},Yi.prototype.verify=function(e,t,i,n){e=this._truncateToN(new vt(e,16)),i=this.keyFromPublic(i,n),t=new gl(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),h=f.mul(e).umod(this.n),u=f.mul(s).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.eqXToP(s)):(g=this.g.mulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.getX().umod(this.n).cmp(s)===0)},Yi.prototype.recoverPubKey=function(r,e,t,i){Ov((3&t)===t,"The recovery param is more than two bits"),e=new gl(e,i);var n=this.n,s=new vt(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),P=f.mul(g).umod(n);return this.g.mulAdd(w,a,P)},Yi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new gl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var w_=Pa(function(r,e){var t=e;t.version="6.5.4",t.utils=Ti,t.rand=function(){throw new Error("unsupported")},t.curve=ul,t.curves=dl,t.ec=b_,t.eddsa=null}),y_=w_.ec;const __="signing-key/5.7.0",wd=new xt(__);let yd=null;function Wn(){return yd||(yd=new y_("secp256k1")),yd}class x_{constructor(e){Lc(this,"curve","secp256k1"),Lc(this,"privateKey",ii(e)),s4(this.privateKey)!==32&&wd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Wn().keyFromPrivate(ur(this.privateKey));Lc(this,"publicKey","0x"+t.getPublic(!1,"hex")),Lc(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Lc(this,"_isSigningKey",!0)}_addPoint(e){const t=Wn().keyFromPublic(ur(this.publicKey)),i=Wn().keyFromPublic(ur(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=Wn().keyFromPrivate(ur(this.privateKey)),i=ur(e);i.length!==32&&wd.throwArgumentError("bad digest length","digest",e);const n=t.sign(i,{canonical:!0});return zg({recoveryParam:n.recoveryParam,r:Bn("0x"+n.r.toString(16),32),s:Bn("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Wn().keyFromPrivate(ur(this.privateKey)),i=Wn().keyFromPublic(ur(Rv(e)));return Bn("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function A_(r,e){const t=zg(e),i={r:ur(t.r),s:ur(t.s)};return"0x"+Wn().recoverPubKey(ur(r),i,t.recoveryParam).encode("hex",!1)}function Rv(r,e){const t=ur(r);if(t.length===32){const i=new x_(t);return e?"0x"+Wn().keyFromPrivate(t).getPublic(!0,"hex"):i.publicKey}else{if(t.length===33)return e?ii(t):"0x"+Wn().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Wn().keyFromPublic(t).getPublic(!0,"hex"):ii(t)}return wd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const E_="transactions/5.7.0";new xt(E_);var Tv;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(Tv||(Tv={}));function S_(r){const e=Rv(r);return N4(qg(td(qg(e,1)),12))}function I_(r,e){return S_(A_(ur(r),e))}var _d={},vl={},yt={},$v={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,h){var u=f>>>16&65535,g=f&65535,w=h>>>16&65535,P=h&65535;return g*P+(u*P+g*w<<16>>>0)|0}r.mul=Math.imul||e;function t(f,h){return f+h|0}r.add=t;function i(f,h){return f-h|0}r.sub=i;function n(f,h){return f<<h|f>>>32-h}r.rotl=n;function s(f,h){return f<<32-h|f>>>h}r.rotr=s;function a(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||a,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})($v),Object.defineProperty(yt,"__esModule",{value:!0});var Nv=$v;function M_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}yt.readInt16BE=M_;function C_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}yt.readUint16BE=C_;function P_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}yt.readInt16LE=P_;function D_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}yt.readUint16LE=D_;function Lv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}yt.writeUint16BE=Lv,yt.writeInt16BE=Lv;function Bv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}yt.writeUint16LE=Bv,yt.writeInt16LE=Bv;function xd(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}yt.readInt32BE=xd;function Ad(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}yt.readUint32BE=Ad;function Ed(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}yt.readInt32LE=Ed;function Sd(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}yt.readUint32LE=Sd;function ml(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}yt.writeUint32BE=ml,yt.writeInt32BE=ml;function bl(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}yt.writeUint32LE=bl,yt.writeInt32LE=bl;function O_(r,e){e===void 0&&(e=0);var t=xd(r,e),i=xd(r,e+4);return t*4294967296+i-(i>>31)*4294967296}yt.readInt64BE=O_;function R_(r,e){e===void 0&&(e=0);var t=Ad(r,e),i=Ad(r,e+4);return t*4294967296+i}yt.readUint64BE=R_;function T_(r,e){e===void 0&&(e=0);var t=Ed(r,e),i=Ed(r,e+4);return i*4294967296+t-(t>>31)*4294967296}yt.readInt64LE=T_;function $_(r,e){e===void 0&&(e=0);var t=Sd(r,e),i=Sd(r,e+4);return i*4294967296+t}yt.readUint64LE=$_;function Fv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),ml(r/4294967296>>>0,e,t),ml(r>>>0,e,t+4),e}yt.writeUint64BE=Fv,yt.writeInt64BE=Fv;function Uv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),bl(r>>>0,e,t),bl(r/4294967296>>>0,e,t+4),e}yt.writeUint64LE=Uv,yt.writeInt64LE=Uv;function N_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}yt.readUintBE=N_;function L_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s<t+r/8;s++)i+=e[s]*n,n*=256;return i}yt.readUintLE=L_;function B_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Nv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=r/8+i-1;s>=i;s--)t[s]=e/n&255,n*=256;return t}yt.writeUintBE=B_;function F_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Nv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+r/8;s++)t[s]=e/n&255,n*=256;return t}yt.writeUintLE=F_;function U_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}yt.readFloat32BE=U_;function q_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}yt.readFloat32LE=q_;function z_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}yt.readFloat64BE=z_;function k_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}yt.readFloat64LE=k_;function H_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r),e}yt.writeFloat32BE=H_;function j_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r,!0),e}yt.writeFloat32LE=j_;function W_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r),e}yt.writeFloat64BE=W_;function K_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r,!0),e}yt.writeFloat64LE=K_;var $i={};Object.defineProperty($i,"__esModule",{value:!0});function V_(r){for(var e=0;e<r.length;e++)r[e]=0;return r}$i.wipe=V_,Object.defineProperty(vl,"__esModule",{value:!0});var Gr=yt,Id=$i,G_=20;function Y_(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,a=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],h=t[7]<<24|t[6]<<16|t[5]<<8|t[4],u=t[11]<<24|t[10]<<16|t[9]<<8|t[8],g=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],P=t[23]<<24|t[22]<<16|t[21]<<8|t[20],M=t[27]<<24|t[26]<<16|t[25]<<8|t[24],O=t[31]<<24|t[30]<<16|t[29]<<8|t[28],$=e[3]<<24|e[2]<<16|e[1]<<8|e[0],W=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,B=n,z=s,j=a,_=f,U=h,ee=u,oe=g,L=w,b=P,m=M,l=O,d=$,y=W,C=k,D=F,S=0;S<G_;S+=2)Y=Y+_|0,d^=Y,d=d>>>32-16|d<<16,L=L+d|0,_^=L,_=_>>>32-12|_<<12,B=B+U|0,y^=B,y=y>>>32-16|y<<16,b=b+y|0,U^=b,U=U>>>32-12|U<<12,z=z+ee|0,C^=z,C=C>>>32-16|C<<16,m=m+C|0,ee^=m,ee=ee>>>32-12|ee<<12,j=j+oe|0,D^=j,D=D>>>32-16|D<<16,l=l+D|0,oe^=l,oe=oe>>>32-12|oe<<12,z=z+ee|0,C^=z,C=C>>>32-8|C<<8,m=m+C|0,ee^=m,ee=ee>>>32-7|ee<<7,j=j+oe|0,D^=j,D=D>>>32-8|D<<8,l=l+D|0,oe^=l,oe=oe>>>32-7|oe<<7,B=B+U|0,y^=B,y=y>>>32-8|y<<8,b=b+y|0,U^=b,U=U>>>32-7|U<<7,Y=Y+_|0,d^=Y,d=d>>>32-8|d<<8,L=L+d|0,_^=L,_=_>>>32-7|_<<7,Y=Y+U|0,D^=Y,D=D>>>32-16|D<<16,m=m+D|0,U^=m,U=U>>>32-12|U<<12,B=B+ee|0,d^=B,d=d>>>32-16|d<<16,l=l+d|0,ee^=l,ee=ee>>>32-12|ee<<12,z=z+oe|0,y^=z,y=y>>>32-16|y<<16,L=L+y|0,oe^=L,oe=oe>>>32-12|oe<<12,j=j+_|0,C^=j,C=C>>>32-16|C<<16,b=b+C|0,_^=b,_=_>>>32-12|_<<12,z=z+oe|0,y^=z,y=y>>>32-8|y<<8,L=L+y|0,oe^=L,oe=oe>>>32-7|oe<<7,j=j+_|0,C^=j,C=C>>>32-8|C<<8,b=b+C|0,_^=b,_=_>>>32-7|_<<7,B=B+ee|0,d^=B,d=d>>>32-8|d<<8,l=l+d|0,ee^=l,ee=ee>>>32-7|ee<<7,Y=Y+U|0,D^=Y,D=D>>>32-8|D<<8,m=m+D|0,U^=m,U=U>>>32-7|U<<7;Gr.writeUint32LE(Y+i|0,r,0),Gr.writeUint32LE(B+n|0,r,4),Gr.writeUint32LE(z+s|0,r,8),Gr.writeUint32LE(j+a|0,r,12),Gr.writeUint32LE(_+f|0,r,16),Gr.writeUint32LE(U+h|0,r,20),Gr.writeUint32LE(ee+u|0,r,24),Gr.writeUint32LE(oe+g|0,r,28),Gr.writeUint32LE(L+w|0,r,32),Gr.writeUint32LE(b+P|0,r,36),Gr.writeUint32LE(m+M|0,r,40),Gr.writeUint32LE(l+O|0,r,44),Gr.writeUint32LE(d+$|0,r,48),Gr.writeUint32LE(y+W|0,r,52),Gr.writeUint32LE(C+k|0,r,56),Gr.writeUint32LE(D+F|0,r,60)}function qv(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var s,a;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),a=s.length-e.length,s.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,a=n}for(var f=new Uint8Array(64),h=0;h<t.length;h+=64){Y_(f,s,r);for(var u=h;u<h+64&&u<t.length;u++)i[u]=t[u]^f[u-h];Q_(s,0,a)}return Id.wipe(f),n===0&&Id.wipe(s),i}vl.streamXOR=qv;function J_(r,e,t,i){return i===void 0&&(i=0),Id.wipe(t),qv(r,e,t,t,i)}vl.stream=J_;function Q_(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var zv={},qs={};Object.defineProperty(qs,"__esModule",{value:!0});function Z_(r,e,t){return~(r-1)&e|r-1&t}qs.select=Z_;function X_(r,e){return(r|0)-(e|0)-1>>>31&1}qs.lessOrEqual=X_;function kv(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}qs.compare=kv;function e7(r,e){return r.length===0||e.length===0?!1:kv(r,e)!==0}qs.equal=e7,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=qs,t=$i;r.DIGEST_LENGTH=16;var i=function(){function a(f){this.digestLength=r.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=f[0]|f[1]<<8;this._r[0]=h&8191;var u=f[2]|f[3]<<8;this._r[1]=(h>>>13|u<<3)&8191;var g=f[4]|f[5]<<8;this._r[2]=(u>>>10|g<<6)&7939;var w=f[6]|f[7]<<8;this._r[3]=(g>>>7|w<<9)&8191;var P=f[8]|f[9]<<8;this._r[4]=(w>>>4|P<<12)&255,this._r[5]=P>>>1&8190;var M=f[10]|f[11]<<8;this._r[6]=(P>>>14|M<<2)&8191;var O=f[12]|f[13]<<8;this._r[7]=(M>>>11|O<<5)&8065;var $=f[14]|f[15]<<8;this._r[8]=(O>>>8|$<<8)&8191,this._r[9]=$>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return a.prototype._blocks=function(f,h,u){for(var g=this._fin?0:2048,w=this._h[0],P=this._h[1],M=this._h[2],O=this._h[3],$=this._h[4],W=this._h[5],k=this._h[6],F=this._h[7],Y=this._h[8],B=this._h[9],z=this._r[0],j=this._r[1],_=this._r[2],U=this._r[3],ee=this._r[4],oe=this._r[5],L=this._r[6],b=this._r[7],m=this._r[8],l=this._r[9];u>=16;){var d=f[h+0]|f[h+1]<<8;w+=d&8191;var y=f[h+2]|f[h+3]<<8;P+=(d>>>13|y<<3)&8191;var C=f[h+4]|f[h+5]<<8;M+=(y>>>10|C<<6)&8191;var D=f[h+6]|f[h+7]<<8;O+=(C>>>7|D<<9)&8191;var S=f[h+8]|f[h+9]<<8;$+=(D>>>4|S<<12)&8191,W+=S>>>1&8191;var v=f[h+10]|f[h+11]<<8;k+=(S>>>14|v<<2)&8191;var A=f[h+12]|f[h+13]<<8;F+=(v>>>11|A<<5)&8191;var x=f[h+14]|f[h+15]<<8;Y+=(A>>>8|x<<8)&8191,B+=x>>>5|g;var N=0,ae=N;ae+=w*z,ae+=P*(5*l),ae+=M*(5*m),ae+=O*(5*b),ae+=$*(5*L),N=ae>>>13,ae&=8191,ae+=W*(5*oe),ae+=k*(5*ee),ae+=F*(5*U),ae+=Y*(5*_),ae+=B*(5*j),N+=ae>>>13,ae&=8191;var R=N;R+=w*j,R+=P*z,R+=M*(5*l),R+=O*(5*m),R+=$*(5*b),N=R>>>13,R&=8191,R+=W*(5*L),R+=k*(5*oe),R+=F*(5*ee),R+=Y*(5*U),R+=B*(5*_),N+=R>>>13,R&=8191;var X=N;X+=w*_,X+=P*j,X+=M*z,X+=O*(5*l),X+=$*(5*m),N=X>>>13,X&=8191,X+=W*(5*b),X+=k*(5*L),X+=F*(5*oe),X+=Y*(5*ee),X+=B*(5*U),N+=X>>>13,X&=8191;var V=N;V+=w*U,V+=P*_,V+=M*j,V+=O*z,V+=$*(5*l),N=V>>>13,V&=8191,V+=W*(5*m),V+=k*(5*b),V+=F*(5*L),V+=Y*(5*oe),V+=B*(5*ee),N+=V>>>13,V&=8191;var J=N;J+=w*ee,J+=P*U,J+=M*_,J+=O*j,J+=$*z,N=J>>>13,J&=8191,J+=W*(5*l),J+=k*(5*m),J+=F*(5*b),J+=Y*(5*L),J+=B*(5*oe),N+=J>>>13,J&=8191;var K=N;K+=w*oe,K+=P*ee,K+=M*U,K+=O*_,K+=$*j,N=K>>>13,K&=8191,K+=W*z,K+=k*(5*l),K+=F*(5*m),K+=Y*(5*b),K+=B*(5*L),N+=K>>>13,K&=8191;var E=N;E+=w*L,E+=P*oe,E+=M*ee,E+=O*U,E+=$*_,N=E>>>13,E&=8191,E+=W*j,E+=k*z,E+=F*(5*l),E+=Y*(5*m),E+=B*(5*b),N+=E>>>13,E&=8191;var G=N;G+=w*b,G+=P*L,G+=M*oe,G+=O*ee,G+=$*U,N=G>>>13,G&=8191,G+=W*_,G+=k*j,G+=F*z,G+=Y*(5*l),G+=B*(5*m),N+=G>>>13,G&=8191;var re=N;re+=w*m,re+=P*b,re+=M*L,re+=O*oe,re+=$*ee,N=re>>>13,re&=8191,re+=W*U,re+=k*_,re+=F*j,re+=Y*z,re+=B*(5*l),N+=re>>>13,re&=8191;var le=N;le+=w*l,le+=P*m,le+=M*b,le+=O*L,le+=$*oe,N=le>>>13,le&=8191,le+=W*ee,le+=k*U,le+=F*_,le+=Y*j,le+=B*z,N+=le>>>13,le&=8191,N=(N<<2)+N|0,N=N+ae|0,ae=N&8191,N=N>>>13,R+=N,w=ae,P=R,M=X,O=V,$=J,W=K,k=E,F=G,Y=re,B=le,h+=16,u-=16}this._h[0]=w,this._h[1]=P,this._h[2]=M,this._h[3]=O,this._h[4]=$,this._h[5]=W,this._h[6]=k,this._h[7]=F,this._h[8]=Y,this._h[9]=B},a.prototype.finish=function(f,h){h===void 0&&(h=0);var u=new Uint16Array(10),g,w,P,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(g=this._h[1]>>>13,this._h[1]&=8191,M=2;M<10;M++)this._h[M]+=g,g=this._h[M]>>>13,this._h[M]&=8191;for(this._h[0]+=g*5,g=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=g,g=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=g,u[0]=this._h[0]+5,g=u[0]>>>13,u[0]&=8191,M=1;M<10;M++)u[M]=this._h[M]+g,g=u[M]>>>13,u[M]&=8191;for(u[9]-=8192,w=(g^1)-1,M=0;M<10;M++)u[M]&=w;for(w=~w,M=0;M<10;M++)this._h[M]=this._h[M]&w|u[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,P=this._h[0]+this._pad[0],this._h[0]=P&65535,M=1;M<8;M++)P=(this._h[M]+this._pad[M]|0)+(P>>>16)|0,this._h[M]=P&65535;return f[h+0]=this._h[0]>>>0,f[h+1]=this._h[0]>>>8,f[h+2]=this._h[1]>>>0,f[h+3]=this._h[1]>>>8,f[h+4]=this._h[2]>>>0,f[h+5]=this._h[2]>>>8,f[h+6]=this._h[3]>>>0,f[h+7]=this._h[3]>>>8,f[h+8]=this._h[4]>>>0,f[h+9]=this._h[4]>>>8,f[h+10]=this._h[5]>>>0,f[h+11]=this._h[5]>>>8,f[h+12]=this._h[6]>>>0,f[h+13]=this._h[6]>>>8,f[h+14]=this._h[7]>>>0,f[h+15]=this._h[7]>>>8,this._finished=!0,this},a.prototype.update=function(f){var h=0,u=f.length,g;if(this._leftover){g=16-this._leftover,g>u&&(g=u);for(var w=0;w<g;w++)this._buffer[this._leftover+w]=f[h+w];if(u-=g,h+=g,this._leftover+=g,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(u>=16&&(g=u-u%16,this._blocks(f,h,g),h+=g,u-=g),u){for(var w=0;w<u;w++)this._buffer[this._leftover+w]=f[h+w];this._leftover+=u}return this},a.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},a.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},a}();r.Poly1305=i;function n(a,f){var h=new i(a);h.update(f);var u=h.digest();return h.clean(),u}r.oneTimeAuth=n;function s(a,f){return a.length!==r.DIGEST_LENGTH||f.length!==r.DIGEST_LENGTH?!1:e.equal(a,f)}r.equal=s}(zv),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=vl,t=zv,i=$i,n=yt,s=qs;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var a=new Uint8Array(16),f=function(){function h(u){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,u.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(u)}return h.prototype.seal=function(u,g,w,P){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var M=new Uint8Array(16);M.set(u,M.length-u.length);var O=new Uint8Array(32);e.stream(this._key,M,O,4);var $=g.length+this.tagLength,W;if(P){if(P.length!==$)throw new Error("ChaCha20Poly1305: incorrect destination length");W=P}else W=new Uint8Array($);return e.streamXOR(this._key,M,g,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),O,W.subarray(0,W.length-this.tagLength),w),i.wipe(M),W},h.prototype.open=function(u,g,w,P){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(g.length<this.tagLength)return null;var M=new Uint8Array(16);M.set(u,M.length-u.length);var O=new Uint8Array(32);e.stream(this._key,M,O,4);var $=new Uint8Array(this.tagLength);if(this._authenticate($,O,g.subarray(0,g.length-this.tagLength),w),!s.equal($,g.subarray(g.length-this.tagLength,g.length)))return null;var W=g.length-this.tagLength,k;if(P){if(P.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");k=P}else k=new Uint8Array(W);return e.streamXOR(this._key,M,g.subarray(0,g.length-this.tagLength),k,4),i.wipe(M),k},h.prototype.clean=function(){return i.wipe(this._key),this},h.prototype._authenticate=function(u,g,w,P){var M=new t.Poly1305(g);P&&(M.update(P),P.length%16>0&&M.update(a.subarray(P.length%16))),M.update(w),w.length%16>0&&M.update(a.subarray(w.length%16));var O=new Uint8Array(8);P&&n.writeUint64LE(P.length,O),M.update(O),n.writeUint64LE(w.length,O),M.update(O);for(var $=M.digest(),W=0;W<$.length;W++)u[W]=$[W];M.clean(),i.wipe($),i.wipe(O)},h}();r.ChaCha20Poly1305=f}(_d);var Hv={},Uc={},Md={};Object.defineProperty(Md,"__esModule",{value:!0});function t7(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Md.isSerializableHash=t7,Object.defineProperty(Uc,"__esModule",{value:!0});var Kn=Md,r7=qs,i7=$i,jv=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),Kn.isSerializableHash(this._inner)&&Kn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),i7.wipe(i)}return r.prototype.reset=function(){if(!Kn.isSerializableHash(this._inner)||!Kn.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},r.prototype.clean=function(){Kn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Kn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.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)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!Kn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!Kn.isSerializableHash(this._inner)||!Kn.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},r.prototype.cleanSavedState=function(e){if(!Kn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();Uc.HMAC=jv;function n7(r,e,t){var i=new jv(r,e);i.update(t);var n=i.digest();return i.clean(),n}Uc.hmac=n7,Uc.equal=r7.equal,Object.defineProperty(Hv,"__esModule",{value:!0});var Wv=Uc,Kv=$i,s7=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Wv.hmac(this._hash,i,t);this._hmac=new Wv.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),Kv.wipe(this._buffer),Kv.wipe(this._counter),this._bufpos=0},r}(),o7=Hv.HKDF=s7,zs={},wl={},yl={};Object.defineProperty(yl,"__esModule",{value:!0}),yl.BrowserRandomSource=void 0;const Vv=65536;class a7{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 t=new Uint8Array(e);for(let i=0;i<t.length;i+=Vv)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,Vv)));return t}}yl.BrowserRandomSource=a7;function c7(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _l={};Object.defineProperty(_l,"__esModule",{value:!0}),_l.NodeRandomSource=void 0;const f7=$i;class l7{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof c7<"u"){const e=il;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=t[n];return(0,f7.wipe)(t),i}}_l.NodeRandomSource=l7,Object.defineProperty(wl,"__esModule",{value:!0}),wl.SystemRandomSource=void 0;const h7=yl,u7=_l;class d7{constructor(){if(this.isAvailable=!1,this.name="",this._source=new h7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new u7.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)}}wl.SystemRandomSource=d7,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=wl,t=yt,i=$i;r.defaultRandomSource=new e.SystemRandomSource;function n(u,g=r.defaultRandomSource){return g.randomBytes(u)}r.randomBytes=n;function s(u=r.defaultRandomSource){const g=n(4,u),w=(0,t.readUint32LE)(g);return(0,i.wipe)(g),w}r.randomUint32=s;const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(u,g=a,w=r.defaultRandomSource){if(g.length<2)throw new Error("randomString charset is too short");if(g.length>256)throw new Error("randomString charset is too long");let P="";const M=g.length,O=256-256%M;for(;u>0;){const $=n(Math.ceil(u*256/O),w);for(let W=0;W<$.length&&u>0;W++){const k=$[W];k<O&&(P+=g.charAt(k%M),u--)}(0,i.wipe)($)}return P}r.randomString=f;function h(u,g=a,w=r.defaultRandomSource){const P=Math.ceil(u/(Math.log(g.length)/Math.LN2));return f(P,g,w)}r.randomStringForEntropy=h}(zs);var qc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=$i;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.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 f.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},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._temp,this._state,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,P=u<<3,M=u%64<56?64:128;this._buffer[g]=128;for(var O=g+1;O<M-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,M-8),e.writeUint32BE(P,this._buffer,M-4),s(this._temp,this._state,this._buffer,0,M),this._finished=!0}for(var O=0;O<this.digestLength/4;O++)e.writeUint32BE(this._state[O],h,O*4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.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}},f.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},f.prototype.cleanSavedState=function(h){t.wipe(h.state),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA256=i;var n=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(f,h,u,g,w){for(;w>=64;){for(var P=h[0],M=h[1],O=h[2],$=h[3],W=h[4],k=h[5],F=h[6],Y=h[7],B=0;B<16;B++){var z=g+B*4;f[B]=e.readUint32BE(u,z)}for(var B=16;B<64;B++){var j=f[B-2],_=(j>>>17|j<<32-17)^(j>>>19|j<<32-19)^j>>>10;j=f[B-15];var U=(j>>>7|j<<32-7)^(j>>>18|j<<32-18)^j>>>3;f[B]=(_+f[B-7]|0)+(U+f[B-16]|0)}for(var B=0;B<64;B++){var _=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&k^~W&F)|0)+(Y+(n[B]+f[B]|0)|0)|0,U=((P>>>2|P<<32-2)^(P>>>13|P<<32-13)^(P>>>22|P<<32-22))+(P&M^P&O^M&O)|0;Y=F,F=k,k=W,W=$+_|0,$=O,O=M,M=P,P=_+U|0}h[0]+=P,h[1]+=M,h[2]+=O,h[3]+=$,h[4]+=W,h[5]+=k,h[6]+=F,h[7]+=Y,g+=64,w-=64}return g}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(qc);var Cd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=zs,t=$i;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const z=new Float64Array(16);if(B)for(let j=0;j<B.length;j++)z[j]=B[j];return z}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function a(B){let z=1;for(let j=0;j<16;j++){let _=B[j]+z+65535;z=Math.floor(_/65536),B[j]=_-z*65536}B[0]+=z-1+37*(z-1)}function f(B,z,j){const _=~(j-1);for(let U=0;U<16;U++){const ee=_&(B[U]^z[U]);B[U]^=ee,z[U]^=ee}}function h(B,z){const j=i(),_=i();for(let U=0;U<16;U++)_[U]=z[U];a(_),a(_),a(_);for(let U=0;U<2;U++){j[0]=_[0]-65517;for(let oe=1;oe<15;oe++)j[oe]=_[oe]-65535-(j[oe-1]>>16&1),j[oe-1]&=65535;j[15]=_[15]-32767-(j[14]>>16&1);const ee=j[15]>>16&1;j[14]&=65535,f(_,j,1-ee)}for(let U=0;U<16;U++)B[2*U]=_[U]&255,B[2*U+1]=_[U]>>8}function u(B,z){for(let j=0;j<16;j++)B[j]=z[2*j]+(z[2*j+1]<<8);B[15]&=32767}function g(B,z,j){for(let _=0;_<16;_++)B[_]=z[_]+j[_]}function w(B,z,j){for(let _=0;_<16;_++)B[_]=z[_]-j[_]}function P(B,z,j){let _,U,ee=0,oe=0,L=0,b=0,m=0,l=0,d=0,y=0,C=0,D=0,S=0,v=0,A=0,x=0,N=0,ae=0,R=0,X=0,V=0,J=0,K=0,E=0,G=0,re=0,le=0,he=0,ge=0,ke=0,Te=0,Ce=0,Xe=0,$e=j[0],be=j[1],Pe=j[2],De=j[3],ye=j[4],Ie=j[5],Oe=j[6],me=j[7],Me=j[8],Be=j[9],we=j[10],He=j[11],We=j[12],xe=j[13],Ve=j[14],Ke=j[15];_=z[0],ee+=_*$e,oe+=_*be,L+=_*Pe,b+=_*De,m+=_*ye,l+=_*Ie,d+=_*Oe,y+=_*me,C+=_*Me,D+=_*Be,S+=_*we,v+=_*He,A+=_*We,x+=_*xe,N+=_*Ve,ae+=_*Ke,_=z[1],oe+=_*$e,L+=_*be,b+=_*Pe,m+=_*De,l+=_*ye,d+=_*Ie,y+=_*Oe,C+=_*me,D+=_*Me,S+=_*Be,v+=_*we,A+=_*He,x+=_*We,N+=_*xe,ae+=_*Ve,R+=_*Ke,_=z[2],L+=_*$e,b+=_*be,m+=_*Pe,l+=_*De,d+=_*ye,y+=_*Ie,C+=_*Oe,D+=_*me,S+=_*Me,v+=_*Be,A+=_*we,x+=_*He,N+=_*We,ae+=_*xe,R+=_*Ve,X+=_*Ke,_=z[3],b+=_*$e,m+=_*be,l+=_*Pe,d+=_*De,y+=_*ye,C+=_*Ie,D+=_*Oe,S+=_*me,v+=_*Me,A+=_*Be,x+=_*we,N+=_*He,ae+=_*We,R+=_*xe,X+=_*Ve,V+=_*Ke,_=z[4],m+=_*$e,l+=_*be,d+=_*Pe,y+=_*De,C+=_*ye,D+=_*Ie,S+=_*Oe,v+=_*me,A+=_*Me,x+=_*Be,N+=_*we,ae+=_*He,R+=_*We,X+=_*xe,V+=_*Ve,J+=_*Ke,_=z[5],l+=_*$e,d+=_*be,y+=_*Pe,C+=_*De,D+=_*ye,S+=_*Ie,v+=_*Oe,A+=_*me,x+=_*Me,N+=_*Be,ae+=_*we,R+=_*He,X+=_*We,V+=_*xe,J+=_*Ve,K+=_*Ke,_=z[6],d+=_*$e,y+=_*be,C+=_*Pe,D+=_*De,S+=_*ye,v+=_*Ie,A+=_*Oe,x+=_*me,N+=_*Me,ae+=_*Be,R+=_*we,X+=_*He,V+=_*We,J+=_*xe,K+=_*Ve,E+=_*Ke,_=z[7],y+=_*$e,C+=_*be,D+=_*Pe,S+=_*De,v+=_*ye,A+=_*Ie,x+=_*Oe,N+=_*me,ae+=_*Me,R+=_*Be,X+=_*we,V+=_*He,J+=_*We,K+=_*xe,E+=_*Ve,G+=_*Ke,_=z[8],C+=_*$e,D+=_*be,S+=_*Pe,v+=_*De,A+=_*ye,x+=_*Ie,N+=_*Oe,ae+=_*me,R+=_*Me,X+=_*Be,V+=_*we,J+=_*He,K+=_*We,E+=_*xe,G+=_*Ve,re+=_*Ke,_=z[9],D+=_*$e,S+=_*be,v+=_*Pe,A+=_*De,x+=_*ye,N+=_*Ie,ae+=_*Oe,R+=_*me,X+=_*Me,V+=_*Be,J+=_*we,K+=_*He,E+=_*We,G+=_*xe,re+=_*Ve,le+=_*Ke,_=z[10],S+=_*$e,v+=_*be,A+=_*Pe,x+=_*De,N+=_*ye,ae+=_*Ie,R+=_*Oe,X+=_*me,V+=_*Me,J+=_*Be,K+=_*we,E+=_*He,G+=_*We,re+=_*xe,le+=_*Ve,he+=_*Ke,_=z[11],v+=_*$e,A+=_*be,x+=_*Pe,N+=_*De,ae+=_*ye,R+=_*Ie,X+=_*Oe,V+=_*me,J+=_*Me,K+=_*Be,E+=_*we,G+=_*He,re+=_*We,le+=_*xe,he+=_*Ve,ge+=_*Ke,_=z[12],A+=_*$e,x+=_*be,N+=_*Pe,ae+=_*De,R+=_*ye,X+=_*Ie,V+=_*Oe,J+=_*me,K+=_*Me,E+=_*Be,G+=_*we,re+=_*He,le+=_*We,he+=_*xe,ge+=_*Ve,ke+=_*Ke,_=z[13],x+=_*$e,N+=_*be,ae+=_*Pe,R+=_*De,X+=_*ye,V+=_*Ie,J+=_*Oe,K+=_*me,E+=_*Me,G+=_*Be,re+=_*we,le+=_*He,he+=_*We,ge+=_*xe,ke+=_*Ve,Te+=_*Ke,_=z[14],N+=_*$e,ae+=_*be,R+=_*Pe,X+=_*De,V+=_*ye,J+=_*Ie,K+=_*Oe,E+=_*me,G+=_*Me,re+=_*Be,le+=_*we,he+=_*He,ge+=_*We,ke+=_*xe,Te+=_*Ve,Ce+=_*Ke,_=z[15],ae+=_*$e,R+=_*be,X+=_*Pe,V+=_*De,J+=_*ye,K+=_*Ie,E+=_*Oe,G+=_*me,re+=_*Me,le+=_*Be,he+=_*we,ge+=_*He,ke+=_*We,Te+=_*xe,Ce+=_*Ve,Xe+=_*Ke,ee+=38*R,oe+=38*X,L+=38*V,b+=38*J,m+=38*K,l+=38*E,d+=38*G,y+=38*re,C+=38*le,D+=38*he,S+=38*ge,v+=38*ke,A+=38*Te,x+=38*Ce,N+=38*Xe,U=1,_=ee+U+65535,U=Math.floor(_/65536),ee=_-U*65536,_=oe+U+65535,U=Math.floor(_/65536),oe=_-U*65536,_=L+U+65535,U=Math.floor(_/65536),L=_-U*65536,_=b+U+65535,U=Math.floor(_/65536),b=_-U*65536,_=m+U+65535,U=Math.floor(_/65536),m=_-U*65536,_=l+U+65535,U=Math.floor(_/65536),l=_-U*65536,_=d+U+65535,U=Math.floor(_/65536),d=_-U*65536,_=y+U+65535,U=Math.floor(_/65536),y=_-U*65536,_=C+U+65535,U=Math.floor(_/65536),C=_-U*65536,_=D+U+65535,U=Math.floor(_/65536),D=_-U*65536,_=S+U+65535,U=Math.floor(_/65536),S=_-U*65536,_=v+U+65535,U=Math.floor(_/65536),v=_-U*65536,_=A+U+65535,U=Math.floor(_/65536),A=_-U*65536,_=x+U+65535,U=Math.floor(_/65536),x=_-U*65536,_=N+U+65535,U=Math.floor(_/65536),N=_-U*65536,_=ae+U+65535,U=Math.floor(_/65536),ae=_-U*65536,ee+=U-1+37*(U-1),U=1,_=ee+U+65535,U=Math.floor(_/65536),ee=_-U*65536,_=oe+U+65535,U=Math.floor(_/65536),oe=_-U*65536,_=L+U+65535,U=Math.floor(_/65536),L=_-U*65536,_=b+U+65535,U=Math.floor(_/65536),b=_-U*65536,_=m+U+65535,U=Math.floor(_/65536),m=_-U*65536,_=l+U+65535,U=Math.floor(_/65536),l=_-U*65536,_=d+U+65535,U=Math.floor(_/65536),d=_-U*65536,_=y+U+65535,U=Math.floor(_/65536),y=_-U*65536,_=C+U+65535,U=Math.floor(_/65536),C=_-U*65536,_=D+U+65535,U=Math.floor(_/65536),D=_-U*65536,_=S+U+65535,U=Math.floor(_/65536),S=_-U*65536,_=v+U+65535,U=Math.floor(_/65536),v=_-U*65536,_=A+U+65535,U=Math.floor(_/65536),A=_-U*65536,_=x+U+65535,U=Math.floor(_/65536),x=_-U*65536,_=N+U+65535,U=Math.floor(_/65536),N=_-U*65536,_=ae+U+65535,U=Math.floor(_/65536),ae=_-U*65536,ee+=U-1+37*(U-1),B[0]=ee,B[1]=oe,B[2]=L,B[3]=b,B[4]=m,B[5]=l,B[6]=d,B[7]=y,B[8]=C,B[9]=D,B[10]=S,B[11]=v,B[12]=A,B[13]=x,B[14]=N,B[15]=ae}function M(B,z){P(B,z,z)}function O(B,z){const j=i();for(let _=0;_<16;_++)j[_]=z[_];for(let _=253;_>=0;_--)M(j,j),_!==2&&_!==4&&P(j,j,z);for(let _=0;_<16;_++)B[_]=j[_]}function $(B,z){const j=new Uint8Array(32),_=new Float64Array(80),U=i(),ee=i(),oe=i(),L=i(),b=i(),m=i();for(let C=0;C<31;C++)j[C]=B[C];j[31]=B[31]&127|64,j[0]&=248,u(_,z);for(let C=0;C<16;C++)ee[C]=_[C];U[0]=L[0]=1;for(let C=254;C>=0;--C){const D=j[C>>>3]>>>(C&7)&1;f(U,ee,D),f(oe,L,D),g(b,U,oe),w(U,U,oe),g(oe,ee,L),w(ee,ee,L),M(L,b),M(m,U),P(U,oe,U),P(oe,ee,b),g(b,U,oe),w(U,U,oe),M(ee,U),w(oe,L,m),P(U,oe,s),g(U,U,L),P(oe,oe,U),P(U,L,m),P(L,ee,_),M(ee,b),f(U,ee,D),f(oe,L,D)}for(let C=0;C<16;C++)_[C+16]=U[C],_[C+32]=oe[C],_[C+48]=ee[C],_[C+64]=L[C];const l=_.subarray(32),d=_.subarray(16);O(l,l),P(d,d,l);const y=new Uint8Array(32);return h(y,d),y}r.scalarMult=$;function W(B){return $(B,n)}r.scalarMultBase=W;function k(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:W(z),secretKey:z}}r.generateKeyPairFromSeed=k;function F(B){const z=(0,e.randomBytes)(32,B),j=k(z);return(0,t.wipe)(z),j}r.generateKeyPair=F;function Y(B,z,j=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=$(B,z);if(j){let U=0;for(let ee=0;ee<_.length;ee++)U|=_[ee];if(U===0)throw new Error("X25519: invalid shared key")}return _}r.sharedKey=Y})(Cd);function Gv(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Pd(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=Gv(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t}function p7(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var $=0,W=0,k=0,F=O.length;k!==F&&O[k]===0;)k++,$++;for(var Y=(F-k)*g+1>>>0,B=new Uint8Array(Y);k!==F;){for(var z=O[k],j=0,_=Y-1;(z!==0||j<W)&&_!==-1;_--,j++)z+=256*B[_]>>>0,B[_]=z%f>>>0,z=z/f>>>0;if(z!==0)throw new Error("Non-zero carry");W=j,k++}for(var U=Y-W;U!==Y&&B[U]===0;)U++;for(var ee=h.repeat($);U<Y;++U)ee+=r.charAt(B[U]);return ee}function P(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var $=0;if(O[$]!==" "){for(var W=0,k=0;O[$]===h;)W++,$++;for(var F=(O.length-$)*u+1>>>0,Y=new Uint8Array(F);O[$];){var B=t[O.charCodeAt($)];if(B===255)return;for(var z=0,j=F-1;(B!==0||z<k)&&j!==-1;j--,z++)B+=f*Y[j]>>>0,Y[j]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");k=z,$++}if(O[$]!==" "){for(var _=F-k;_!==F&&Y[_]===0;)_++;for(var U=new Uint8Array(W+(F-_)),ee=W;_!==F;)U[ee++]=Y[_++];return U}}}function M(O){var $=P(O);if($)return $;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:M}}var g7=p7,v7=g7;const Yv=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},m7=r=>new TextEncoder().encode(r),b7=r=>new TextDecoder().decode(r);class w7{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class y7{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 Jv(this,e)}}class _7{constructor(e){this.decoders=e}or(e){return Jv(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Jv=(r,e)=>new _7({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class x7{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new w7(e,t,i),this.decoder=new y7(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const xl=({name:r,prefix:e,encode:t,decode:i})=>new x7(r,e,t,i),zc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=v7(t,e);return xl({prefix:r,name:e,encode:i,decode:s=>Yv(n(s))})},A7=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},E7=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},Hr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>xl({prefix:e,name:r,encode(n){return E7(n,i,t)},decode(n){return A7(n,i,t,r)}}),S7=xl({prefix:"\0",name:"identity",encode:r=>b7(r),decode:r=>m7(r)});var I7=Object.freeze({__proto__:null,identity:S7});const M7=Hr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var C7=Object.freeze({__proto__:null,base2:M7});const P7=Hr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var D7=Object.freeze({__proto__:null,base8:P7});const O7=zc({prefix:"9",name:"base10",alphabet:"0123456789"});var R7=Object.freeze({__proto__:null,base10:O7});const T7=Hr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$7=Hr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var N7=Object.freeze({__proto__:null,base16:T7,base16upper:$7});const L7=Hr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),B7=Hr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),F7=Hr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),U7=Hr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q7=Hr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),z7=Hr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),k7=Hr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),H7=Hr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),j7=Hr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var W7=Object.freeze({__proto__:null,base32:L7,base32upper:B7,base32pad:F7,base32padupper:U7,base32hex:q7,base32hexupper:z7,base32hexpad:k7,base32hexpadupper:H7,base32z:j7});const K7=zc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),V7=zc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var G7=Object.freeze({__proto__:null,base36:K7,base36upper:V7});const Y7=zc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),J7=zc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Q7=Object.freeze({__proto__:null,base58btc:Y7,base58flickr:J7});const Z7=Hr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),X7=Hr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),e9=Hr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),t9=Hr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var r9=Object.freeze({__proto__:null,base64:Z7,base64pad:X7,base64url:e9,base64urlpad:t9});const Qv=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}"),i9=Qv.reduce((r,e,t)=>(r[t]=e,r),[]),n9=Qv.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function s9(r){return r.reduce((e,t)=>(e+=i9[t],e),"")}function o9(r){const e=[];for(const t of r){const i=n9[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const a9=xl({prefix:"\u{1F680}",name:"base256emoji",encode:s9,decode:o9});var c9=Object.freeze({__proto__:null,base256emoji:a9}),f9=Xv,Zv=128,l9=127,h9=~l9,u9=Math.pow(2,31);function Xv(r,e,t){e=e||[],t=t||0;for(var i=t;r>=u9;)e[t++]=r&255|Zv,r/=128;for(;r&h9;)e[t++]=r&255|Zv,r>>>=7;return e[t]=r|0,Xv.bytes=t-i+1,e}var d9=Dd,p9=128,em=127;function Dd(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw Dd.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&em)<<n:(a&em)*Math.pow(2,n),n+=7}while(a>=p9);return Dd.bytes=s-i,t}var g9=Math.pow(2,7),v9=Math.pow(2,14),m9=Math.pow(2,21),b9=Math.pow(2,28),w9=Math.pow(2,35),y9=Math.pow(2,42),_9=Math.pow(2,49),x9=Math.pow(2,56),A9=Math.pow(2,63),E9=function(r){return r<g9?1:r<v9?2:r<m9?3:r<b9?4:r<w9?5:r<y9?6:r<_9?7:r<x9?8:r<A9?9:10},S9={encode:f9,decode:d9,encodingLength:E9},tm=S9;const rm=(r,e,t=0)=>(tm.encode(r,e,t),e),im=r=>tm.encodingLength(r),Od=(r,e)=>{const t=e.byteLength,i=im(r),n=i+im(t),s=new Uint8Array(n+t);return rm(r,s,0),rm(t,s,i),s.set(e,n),new I9(r,t,e,s)};class I9{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const nm=({name:r,code:e,encode:t})=>new M9(r,e,t);class M9{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Od(this.code,t):t.then(i=>Od(this.code,i))}else throw Error("Unknown type, must be binary type")}}const sm=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),C9=nm({name:"sha2-256",code:18,encode:sm("SHA-256")}),P9=nm({name:"sha2-512",code:19,encode:sm("SHA-512")});var D9=Object.freeze({__proto__:null,sha256:C9,sha512:P9});const om=0,O9="identity",am=Yv;var R9=Object.freeze({__proto__:null,identity:{code:om,name:O9,encode:am,digest:r=>Od(om,am(r))}});new TextEncoder,new TextDecoder;const Da={...I7,...C7,...D7,...R7,...N7,...W7,...G7,...Q7,...r9,...c9};({...D9,...R9});function cm(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const fm=cm("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Rd=cm("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Gv(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),lm={utf8:fm,"utf-8":fm,hex:Da.base16,latin1:Rd,ascii:Rd,binary:Rd,...Da};function Ji(r,e="utf8"){const t=lm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function Ni(r,e="utf8"){const t=lm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var hm={},T9="elliptic",$9="6.5.7",N9="EC cryptography",L9="lib/elliptic.js",B9=["lib"],F9={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},U9={type:"git",url:"git@github.com:indutny/elliptic"},q9=["EC","Elliptic","curve","Cryptography"],z9="Fedor Indutny <fedor@indutny.com>",k9="MIT",H9={url:"https://github.com/indutny/elliptic/issues"},j9="https://github.com/indutny/elliptic",W9={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},K9={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},V9={name:T9,version:$9,description:N9,main:L9,files:B9,scripts:F9,repository:U9,keywords:q9,author:z9,license:k9,bugs:H9,homepage:j9,devDependencies:W9,dependencies:K9},Li={},Vn={exports:{}};(function(r){(function(e,t){function i(L,b){if(!L)throw new Error(b||"Assertion failed")}function n(L,b){L.super_=b;var m=function(){};m.prototype=b.prototype,L.prototype=new m,L.prototype.constructor=L}function s(L,b,m){if(s.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((b==="le"||b==="be")&&(m=b,b=10),this._init(L||0,b||10,m||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=il.Buffer}catch{}s.isBN=function(b){return b instanceof s?!0:b!==null&&typeof b=="object"&&b.constructor.wordSize===s.wordSize&&Array.isArray(b.words)},s.max=function(b,m){return b.cmp(m)>0?b:m},s.min=function(b,m){return b.cmp(m)<0?b:m},s.prototype._init=function(b,m,l){if(typeof b=="number")return this._initNumber(b,m,l);if(typeof b=="object")return this._initArray(b,m,l);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),b=b.toString().replace(/\s+/g,"");var d=0;b[0]==="-"&&(d++,this.negative=1),d<b.length&&(m===16?this._parseHex(b,d,l):(this._parseBase(b,m,d),l==="le"&&this._initArray(this.toArray(),m,l)))},s.prototype._initNumber=function(b,m,l){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[b&67108863],this.length=1):b<4503599627370496?(this.words=[b&67108863,b/67108864&67108863],this.length=2):(i(b<9007199254740992),this.words=[b&67108863,b/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),m,l)},s.prototype._initArray=function(b,m,l){if(i(typeof b.length=="number"),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y,C,D=0;if(l==="be")for(d=b.length-1,y=0;d>=0;d-=3)C=b[d]|b[d-1]<<8|b[d-2]<<16,this.words[y]|=C<<D&67108863,this.words[y+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);else if(l==="le")for(d=0,y=0;d<b.length;d+=3)C=b[d]|b[d+1]<<8|b[d+2]<<16,this.words[y]|=C<<D&67108863,this.words[y+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);return this.strip()};function f(L,b){var m=L.charCodeAt(b);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function h(L,b,m){var l=f(L,m);return m-1>=b&&(l|=f(L,m-1)<<4),l}s.prototype._parseHex=function(b,m,l){this.length=Math.ceil((b.length-m)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y=0,C=0,D;if(l==="be")for(d=b.length-1;d>=m;d-=2)D=h(b,m,d)<<y,this.words[C]|=D&67108863,y>=18?(y-=18,C+=1,this.words[C]|=D>>>26):y+=8;else{var S=b.length-m;for(d=S%2===0?m+1:m;d<b.length;d+=2)D=h(b,m,d)<<y,this.words[C]|=D&67108863,y>=18?(y-=18,C+=1,this.words[C]|=D>>>26):y+=8}this.strip()};function u(L,b,m,l){for(var d=0,y=Math.min(L.length,m),C=b;C<y;C++){var D=L.charCodeAt(C)-48;d*=l,D>=49?d+=D-49+10:D>=17?d+=D-17+10:d+=D}return d}s.prototype._parseBase=function(b,m,l){this.words=[0],this.length=1;for(var d=0,y=1;y<=67108863;y*=m)d++;d--,y=y/m|0;for(var C=b.length-l,D=C%d,S=Math.min(C,C-D)+l,v=0,A=l;A<S;A+=d)v=u(b,A,A+d,m),this.imuln(y),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(D!==0){var x=1;for(v=u(b,A,b.length,m),A=0;A<D;A++)x*=m;this.imuln(x),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this.strip()},s.prototype.copy=function(b){b.words=new Array(this.length);for(var m=0;m<this.length;m++)b.words[m]=this.words[m];b.length=this.length,b.negative=this.negative,b.red=this.red},s.prototype.clone=function(){var b=new s(null);return this.copy(b),b},s.prototype._expand=function(b){for(;this.length<b;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var g=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(b,m){b=b||10,m=m|0||1;var l;if(b===16||b==="hex"){l="";for(var d=0,y=0,C=0;C<this.length;C++){var D=this.words[C],S=((D<<d|y)&16777215).toString(16);y=D>>>24-d&16777215,y!==0||C!==this.length-1?l=g[6-S.length]+S+l:l=S+l,d+=2,d>=26&&(d-=26,C--)}for(y!==0&&(l=y.toString(16)+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(b===(b|0)&&b>=2&&b<=36){var v=w[b],A=P[b];l="";var x=this.clone();for(x.negative=0;!x.isZero();){var N=x.modn(A).toString(b);x=x.idivn(A),x.isZero()?l=N+l:l=g[v-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var b=this.words[0];return this.length===2?b+=this.words[1]*67108864:this.length===3&&this.words[2]===1?b+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-b:b},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(b,m){return i(typeof a<"u"),this.toArrayLike(a,b,m)},s.prototype.toArray=function(b,m){return this.toArrayLike(Array,b,m)},s.prototype.toArrayLike=function(b,m,l){var d=this.byteLength(),y=l||Math.max(1,d);i(d<=y,"byte array longer than desired length"),i(y>0,"Requested array length <= 0"),this.strip();var C=m==="le",D=new b(y),S,v,A=this.clone();if(C){for(v=0;!A.isZero();v++)S=A.andln(255),A.iushrn(8),D[v]=S;for(;v<y;v++)D[v]=0}else{for(v=0;v<y-d;v++)D[v]=0;for(v=0;!A.isZero();v++)S=A.andln(255),A.iushrn(8),D[y-v-1]=S}return D},Math.clz32?s.prototype._countBits=function(b){return 32-Math.clz32(b)}:s.prototype._countBits=function(b){var m=b,l=0;return m>=4096&&(l+=13,m>>>=13),m>=64&&(l+=7,m>>>=7),m>=8&&(l+=4,m>>>=4),m>=2&&(l+=2,m>>>=2),l+m},s.prototype._zeroBits=function(b){if(b===0)return 26;var m=b,l=0;return m&8191||(l+=13,m>>>=13),m&127||(l+=7,m>>>=7),m&15||(l+=4,m>>>=4),m&3||(l+=2,m>>>=2),m&1||l++,l},s.prototype.bitLength=function(){var b=this.words[this.length-1],m=this._countBits(b);return(this.length-1)*26+m};function M(L){for(var b=new Array(L.bitLength()),m=0;m<b.length;m++){var l=m/26|0,d=m%26;b[m]=(L.words[l]&1<<d)>>>d}return b}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,m=0;m<this.length;m++){var l=this._zeroBits(this.words[m]);if(b+=l,l!==26)break}return b},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(b){return this.negative!==0?this.abs().inotn(b).iaddn(1):this.clone()},s.prototype.fromTwos=function(b){return this.testn(b-1)?this.notn(b).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(b){for(;this.length<b.length;)this.words[this.length++]=0;for(var m=0;m<b.length;m++)this.words[m]=this.words[m]|b.words[m];return this.strip()},s.prototype.ior=function(b){return i((this.negative|b.negative)===0),this.iuor(b)},s.prototype.or=function(b){return this.length>b.length?this.clone().ior(b):b.clone().ior(this)},s.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},s.prototype.iuand=function(b){var m;this.length>b.length?m=b:m=this;for(var l=0;l<m.length;l++)this.words[l]=this.words[l]&b.words[l];return this.length=m.length,this.strip()},s.prototype.iand=function(b){return i((this.negative|b.negative)===0),this.iuand(b)},s.prototype.and=function(b){return this.length>b.length?this.clone().iand(b):b.clone().iand(this)},s.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},s.prototype.iuxor=function(b){var m,l;this.length>b.length?(m=this,l=b):(m=b,l=this);for(var d=0;d<l.length;d++)this.words[d]=m.words[d]^l.words[d];if(this!==m)for(;d<m.length;d++)this.words[d]=m.words[d];return this.length=m.length,this.strip()},s.prototype.ixor=function(b){return i((this.negative|b.negative)===0),this.iuxor(b)},s.prototype.xor=function(b){return this.length>b.length?this.clone().ixor(b):b.clone().ixor(this)},s.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},s.prototype.inotn=function(b){i(typeof b=="number"&&b>=0);var m=Math.ceil(b/26)|0,l=b%26;this._expand(m),l>0&&m--;for(var d=0;d<m;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this.strip()},s.prototype.notn=function(b){return this.clone().inotn(b)},s.prototype.setn=function(b,m){i(typeof b=="number"&&b>=0);var l=b/26|0,d=b%26;return this._expand(l+1),m?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this.strip()},s.prototype.iadd=function(b){var m;if(this.negative!==0&&b.negative===0)return this.negative=0,m=this.isub(b),this.negative^=1,this._normSign();if(this.negative===0&&b.negative!==0)return b.negative=0,m=this.isub(b),b.negative=1,m._normSign();var l,d;this.length>b.length?(l=this,d=b):(l=b,d=this);for(var y=0,C=0;C<d.length;C++)m=(l.words[C]|0)+(d.words[C]|0)+y,this.words[C]=m&67108863,y=m>>>26;for(;y!==0&&C<l.length;C++)m=(l.words[C]|0)+y,this.words[C]=m&67108863,y=m>>>26;if(this.length=l.length,y!==0)this.words[this.length]=y,this.length++;else if(l!==this)for(;C<l.length;C++)this.words[C]=l.words[C];return this},s.prototype.add=function(b){var m;return b.negative!==0&&this.negative===0?(b.negative=0,m=this.sub(b),b.negative^=1,m):b.negative===0&&this.negative!==0?(this.negative=0,m=b.sub(this),this.negative=1,m):this.length>b.length?this.clone().iadd(b):b.clone().iadd(this)},s.prototype.isub=function(b){if(b.negative!==0){b.negative=0;var m=this.iadd(b);return b.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var l=this.cmp(b);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,y;l>0?(d=this,y=b):(d=b,y=this);for(var C=0,D=0;D<y.length;D++)m=(d.words[D]|0)-(y.words[D]|0)+C,C=m>>26,this.words[D]=m&67108863;for(;C!==0&&D<d.length;D++)m=(d.words[D]|0)+C,C=m>>26,this.words[D]=m&67108863;if(C===0&&D<d.length&&d!==this)for(;D<d.length;D++)this.words[D]=d.words[D];return this.length=Math.max(this.length,D),d!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(b){return this.clone().isub(b)};function O(L,b,m){m.negative=b.negative^L.negative;var l=L.length+b.length|0;m.length=l,l=l-1|0;var d=L.words[0]|0,y=b.words[0]|0,C=d*y,D=C&67108863,S=C/67108864|0;m.words[0]=D;for(var v=1;v<l;v++){for(var A=S>>>26,x=S&67108863,N=Math.min(v,b.length-1),ae=Math.max(0,v-L.length+1);ae<=N;ae++){var R=v-ae|0;d=L.words[R]|0,y=b.words[ae]|0,C=d*y+x,A+=C/67108864|0,x=C&67108863}m.words[v]=x|0,S=A|0}return S!==0?m.words[v]=S|0:m.length--,m.strip()}var $=function(b,m,l){var d=b.words,y=m.words,C=l.words,D=0,S,v,A,x=d[0]|0,N=x&8191,ae=x>>>13,R=d[1]|0,X=R&8191,V=R>>>13,J=d[2]|0,K=J&8191,E=J>>>13,G=d[3]|0,re=G&8191,le=G>>>13,he=d[4]|0,ge=he&8191,ke=he>>>13,Te=d[5]|0,Ce=Te&8191,Xe=Te>>>13,$e=d[6]|0,be=$e&8191,Pe=$e>>>13,De=d[7]|0,ye=De&8191,Ie=De>>>13,Oe=d[8]|0,me=Oe&8191,Me=Oe>>>13,Be=d[9]|0,we=Be&8191,He=Be>>>13,We=y[0]|0,xe=We&8191,Ve=We>>>13,Ke=y[1]|0,Ge=Ke&8191,mt=Ke>>>13,It=y[2]|0,Ye=It&8191,Pt=It>>>13,Ot=y[3]|0,Ze=Ot&8191,rt=Ot>>>13,et=y[4]|0,Ne=et&8191,it=et>>>13,tt=y[5]|0,Re=tt&8191,lt=tt>>>13,ht=y[6]|0,Le=ht&8191,ut=ht>>>13,nt=y[7]|0,Fe=nt&8191,st=nt>>>13,Qe=y[8]|0,qe=Qe&8191,dt=Qe>>>13,zt=y[9]|0,at=zt&8191,kt=zt>>>13;l.negative=b.negative^m.negative,l.length=19,S=Math.imul(N,xe),v=Math.imul(N,Ve),v=v+Math.imul(ae,xe)|0,A=Math.imul(ae,Ve);var _t=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(X,xe),v=Math.imul(X,Ve),v=v+Math.imul(V,xe)|0,A=Math.imul(V,Ve),S=S+Math.imul(N,Ge)|0,v=v+Math.imul(N,mt)|0,v=v+Math.imul(ae,Ge)|0,A=A+Math.imul(ae,mt)|0;var qt=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(qt>>>26)|0,qt&=67108863,S=Math.imul(K,xe),v=Math.imul(K,Ve),v=v+Math.imul(E,xe)|0,A=Math.imul(E,Ve),S=S+Math.imul(X,Ge)|0,v=v+Math.imul(X,mt)|0,v=v+Math.imul(V,Ge)|0,A=A+Math.imul(V,mt)|0,S=S+Math.imul(N,Ye)|0,v=v+Math.imul(N,Pt)|0,v=v+Math.imul(ae,Ye)|0,A=A+Math.imul(ae,Pt)|0;var Qr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,S=Math.imul(re,xe),v=Math.imul(re,Ve),v=v+Math.imul(le,xe)|0,A=Math.imul(le,Ve),S=S+Math.imul(K,Ge)|0,v=v+Math.imul(K,mt)|0,v=v+Math.imul(E,Ge)|0,A=A+Math.imul(E,mt)|0,S=S+Math.imul(X,Ye)|0,v=v+Math.imul(X,Pt)|0,v=v+Math.imul(V,Ye)|0,A=A+Math.imul(V,Pt)|0,S=S+Math.imul(N,Ze)|0,v=v+Math.imul(N,rt)|0,v=v+Math.imul(ae,Ze)|0,A=A+Math.imul(ae,rt)|0;var Zr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,S=Math.imul(ge,xe),v=Math.imul(ge,Ve),v=v+Math.imul(ke,xe)|0,A=Math.imul(ke,Ve),S=S+Math.imul(re,Ge)|0,v=v+Math.imul(re,mt)|0,v=v+Math.imul(le,Ge)|0,A=A+Math.imul(le,mt)|0,S=S+Math.imul(K,Ye)|0,v=v+Math.imul(K,Pt)|0,v=v+Math.imul(E,Ye)|0,A=A+Math.imul(E,Pt)|0,S=S+Math.imul(X,Ze)|0,v=v+Math.imul(X,rt)|0,v=v+Math.imul(V,Ze)|0,A=A+Math.imul(V,rt)|0,S=S+Math.imul(N,Ne)|0,v=v+Math.imul(N,it)|0,v=v+Math.imul(ae,Ne)|0,A=A+Math.imul(ae,it)|0;var Xr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,S=Math.imul(Ce,xe),v=Math.imul(Ce,Ve),v=v+Math.imul(Xe,xe)|0,A=Math.imul(Xe,Ve),S=S+Math.imul(ge,Ge)|0,v=v+Math.imul(ge,mt)|0,v=v+Math.imul(ke,Ge)|0,A=A+Math.imul(ke,mt)|0,S=S+Math.imul(re,Ye)|0,v=v+Math.imul(re,Pt)|0,v=v+Math.imul(le,Ye)|0,A=A+Math.imul(le,Pt)|0,S=S+Math.imul(K,Ze)|0,v=v+Math.imul(K,rt)|0,v=v+Math.imul(E,Ze)|0,A=A+Math.imul(E,rt)|0,S=S+Math.imul(X,Ne)|0,v=v+Math.imul(X,it)|0,v=v+Math.imul(V,Ne)|0,A=A+Math.imul(V,it)|0,S=S+Math.imul(N,Re)|0,v=v+Math.imul(N,lt)|0,v=v+Math.imul(ae,Re)|0,A=A+Math.imul(ae,lt)|0;var ei=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(ei>>>26)|0,ei&=67108863,S=Math.imul(be,xe),v=Math.imul(be,Ve),v=v+Math.imul(Pe,xe)|0,A=Math.imul(Pe,Ve),S=S+Math.imul(Ce,Ge)|0,v=v+Math.imul(Ce,mt)|0,v=v+Math.imul(Xe,Ge)|0,A=A+Math.imul(Xe,mt)|0,S=S+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,Pt)|0,v=v+Math.imul(ke,Ye)|0,A=A+Math.imul(ke,Pt)|0,S=S+Math.imul(re,Ze)|0,v=v+Math.imul(re,rt)|0,v=v+Math.imul(le,Ze)|0,A=A+Math.imul(le,rt)|0,S=S+Math.imul(K,Ne)|0,v=v+Math.imul(K,it)|0,v=v+Math.imul(E,Ne)|0,A=A+Math.imul(E,it)|0,S=S+Math.imul(X,Re)|0,v=v+Math.imul(X,lt)|0,v=v+Math.imul(V,Re)|0,A=A+Math.imul(V,lt)|0,S=S+Math.imul(N,Le)|0,v=v+Math.imul(N,ut)|0,v=v+Math.imul(ae,Le)|0,A=A+Math.imul(ae,ut)|0;var vr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(vr>>>26)|0,vr&=67108863,S=Math.imul(ye,xe),v=Math.imul(ye,Ve),v=v+Math.imul(Ie,xe)|0,A=Math.imul(Ie,Ve),S=S+Math.imul(be,Ge)|0,v=v+Math.imul(be,mt)|0,v=v+Math.imul(Pe,Ge)|0,A=A+Math.imul(Pe,mt)|0,S=S+Math.imul(Ce,Ye)|0,v=v+Math.imul(Ce,Pt)|0,v=v+Math.imul(Xe,Ye)|0,A=A+Math.imul(Xe,Pt)|0,S=S+Math.imul(ge,Ze)|0,v=v+Math.imul(ge,rt)|0,v=v+Math.imul(ke,Ze)|0,A=A+Math.imul(ke,rt)|0,S=S+Math.imul(re,Ne)|0,v=v+Math.imul(re,it)|0,v=v+Math.imul(le,Ne)|0,A=A+Math.imul(le,it)|0,S=S+Math.imul(K,Re)|0,v=v+Math.imul(K,lt)|0,v=v+Math.imul(E,Re)|0,A=A+Math.imul(E,lt)|0,S=S+Math.imul(X,Le)|0,v=v+Math.imul(X,ut)|0,v=v+Math.imul(V,Le)|0,A=A+Math.imul(V,ut)|0,S=S+Math.imul(N,Fe)|0,v=v+Math.imul(N,st)|0,v=v+Math.imul(ae,Fe)|0,A=A+Math.imul(ae,st)|0;var Ai=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,S=Math.imul(me,xe),v=Math.imul(me,Ve),v=v+Math.imul(Me,xe)|0,A=Math.imul(Me,Ve),S=S+Math.imul(ye,Ge)|0,v=v+Math.imul(ye,mt)|0,v=v+Math.imul(Ie,Ge)|0,A=A+Math.imul(Ie,mt)|0,S=S+Math.imul(be,Ye)|0,v=v+Math.imul(be,Pt)|0,v=v+Math.imul(Pe,Ye)|0,A=A+Math.imul(Pe,Pt)|0,S=S+Math.imul(Ce,Ze)|0,v=v+Math.imul(Ce,rt)|0,v=v+Math.imul(Xe,Ze)|0,A=A+Math.imul(Xe,rt)|0,S=S+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,it)|0,v=v+Math.imul(ke,Ne)|0,A=A+Math.imul(ke,it)|0,S=S+Math.imul(re,Re)|0,v=v+Math.imul(re,lt)|0,v=v+Math.imul(le,Re)|0,A=A+Math.imul(le,lt)|0,S=S+Math.imul(K,Le)|0,v=v+Math.imul(K,ut)|0,v=v+Math.imul(E,Le)|0,A=A+Math.imul(E,ut)|0,S=S+Math.imul(X,Fe)|0,v=v+Math.imul(X,st)|0,v=v+Math.imul(V,Fe)|0,A=A+Math.imul(V,st)|0,S=S+Math.imul(N,qe)|0,v=v+Math.imul(N,dt)|0,v=v+Math.imul(ae,qe)|0,A=A+Math.imul(ae,dt)|0;var In=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(In>>>26)|0,In&=67108863,S=Math.imul(we,xe),v=Math.imul(we,Ve),v=v+Math.imul(He,xe)|0,A=Math.imul(He,Ve),S=S+Math.imul(me,Ge)|0,v=v+Math.imul(me,mt)|0,v=v+Math.imul(Me,Ge)|0,A=A+Math.imul(Me,mt)|0,S=S+Math.imul(ye,Ye)|0,v=v+Math.imul(ye,Pt)|0,v=v+Math.imul(Ie,Ye)|0,A=A+Math.imul(Ie,Pt)|0,S=S+Math.imul(be,Ze)|0,v=v+Math.imul(be,rt)|0,v=v+Math.imul(Pe,Ze)|0,A=A+Math.imul(Pe,rt)|0,S=S+Math.imul(Ce,Ne)|0,v=v+Math.imul(Ce,it)|0,v=v+Math.imul(Xe,Ne)|0,A=A+Math.imul(Xe,it)|0,S=S+Math.imul(ge,Re)|0,v=v+Math.imul(ge,lt)|0,v=v+Math.imul(ke,Re)|0,A=A+Math.imul(ke,lt)|0,S=S+Math.imul(re,Le)|0,v=v+Math.imul(re,ut)|0,v=v+Math.imul(le,Le)|0,A=A+Math.imul(le,ut)|0,S=S+Math.imul(K,Fe)|0,v=v+Math.imul(K,st)|0,v=v+Math.imul(E,Fe)|0,A=A+Math.imul(E,st)|0,S=S+Math.imul(X,qe)|0,v=v+Math.imul(X,dt)|0,v=v+Math.imul(V,qe)|0,A=A+Math.imul(V,dt)|0,S=S+Math.imul(N,at)|0,v=v+Math.imul(N,kt)|0,v=v+Math.imul(ae,at)|0,A=A+Math.imul(ae,kt)|0;var Ei=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,S=Math.imul(we,Ge),v=Math.imul(we,mt),v=v+Math.imul(He,Ge)|0,A=Math.imul(He,mt),S=S+Math.imul(me,Ye)|0,v=v+Math.imul(me,Pt)|0,v=v+Math.imul(Me,Ye)|0,A=A+Math.imul(Me,Pt)|0,S=S+Math.imul(ye,Ze)|0,v=v+Math.imul(ye,rt)|0,v=v+Math.imul(Ie,Ze)|0,A=A+Math.imul(Ie,rt)|0,S=S+Math.imul(be,Ne)|0,v=v+Math.imul(be,it)|0,v=v+Math.imul(Pe,Ne)|0,A=A+Math.imul(Pe,it)|0,S=S+Math.imul(Ce,Re)|0,v=v+Math.imul(Ce,lt)|0,v=v+Math.imul(Xe,Re)|0,A=A+Math.imul(Xe,lt)|0,S=S+Math.imul(ge,Le)|0,v=v+Math.imul(ge,ut)|0,v=v+Math.imul(ke,Le)|0,A=A+Math.imul(ke,ut)|0,S=S+Math.imul(re,Fe)|0,v=v+Math.imul(re,st)|0,v=v+Math.imul(le,Fe)|0,A=A+Math.imul(le,st)|0,S=S+Math.imul(K,qe)|0,v=v+Math.imul(K,dt)|0,v=v+Math.imul(E,qe)|0,A=A+Math.imul(E,dt)|0,S=S+Math.imul(X,at)|0,v=v+Math.imul(X,kt)|0,v=v+Math.imul(V,at)|0,A=A+Math.imul(V,kt)|0;var Mn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Mn>>>26)|0,Mn&=67108863,S=Math.imul(we,Ye),v=Math.imul(we,Pt),v=v+Math.imul(He,Ye)|0,A=Math.imul(He,Pt),S=S+Math.imul(me,Ze)|0,v=v+Math.imul(me,rt)|0,v=v+Math.imul(Me,Ze)|0,A=A+Math.imul(Me,rt)|0,S=S+Math.imul(ye,Ne)|0,v=v+Math.imul(ye,it)|0,v=v+Math.imul(Ie,Ne)|0,A=A+Math.imul(Ie,it)|0,S=S+Math.imul(be,Re)|0,v=v+Math.imul(be,lt)|0,v=v+Math.imul(Pe,Re)|0,A=A+Math.imul(Pe,lt)|0,S=S+Math.imul(Ce,Le)|0,v=v+Math.imul(Ce,ut)|0,v=v+Math.imul(Xe,Le)|0,A=A+Math.imul(Xe,ut)|0,S=S+Math.imul(ge,Fe)|0,v=v+Math.imul(ge,st)|0,v=v+Math.imul(ke,Fe)|0,A=A+Math.imul(ke,st)|0,S=S+Math.imul(re,qe)|0,v=v+Math.imul(re,dt)|0,v=v+Math.imul(le,qe)|0,A=A+Math.imul(le,dt)|0,S=S+Math.imul(K,at)|0,v=v+Math.imul(K,kt)|0,v=v+Math.imul(E,at)|0,A=A+Math.imul(E,kt)|0;var Cn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,S=Math.imul(we,Ze),v=Math.imul(we,rt),v=v+Math.imul(He,Ze)|0,A=Math.imul(He,rt),S=S+Math.imul(me,Ne)|0,v=v+Math.imul(me,it)|0,v=v+Math.imul(Me,Ne)|0,A=A+Math.imul(Me,it)|0,S=S+Math.imul(ye,Re)|0,v=v+Math.imul(ye,lt)|0,v=v+Math.imul(Ie,Re)|0,A=A+Math.imul(Ie,lt)|0,S=S+Math.imul(be,Le)|0,v=v+Math.imul(be,ut)|0,v=v+Math.imul(Pe,Le)|0,A=A+Math.imul(Pe,ut)|0,S=S+Math.imul(Ce,Fe)|0,v=v+Math.imul(Ce,st)|0,v=v+Math.imul(Xe,Fe)|0,A=A+Math.imul(Xe,st)|0,S=S+Math.imul(ge,qe)|0,v=v+Math.imul(ge,dt)|0,v=v+Math.imul(ke,qe)|0,A=A+Math.imul(ke,dt)|0,S=S+Math.imul(re,at)|0,v=v+Math.imul(re,kt)|0,v=v+Math.imul(le,at)|0,A=A+Math.imul(le,kt)|0;var Si=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Si>>>26)|0,Si&=67108863,S=Math.imul(we,Ne),v=Math.imul(we,it),v=v+Math.imul(He,Ne)|0,A=Math.imul(He,it),S=S+Math.imul(me,Re)|0,v=v+Math.imul(me,lt)|0,v=v+Math.imul(Me,Re)|0,A=A+Math.imul(Me,lt)|0,S=S+Math.imul(ye,Le)|0,v=v+Math.imul(ye,ut)|0,v=v+Math.imul(Ie,Le)|0,A=A+Math.imul(Ie,ut)|0,S=S+Math.imul(be,Fe)|0,v=v+Math.imul(be,st)|0,v=v+Math.imul(Pe,Fe)|0,A=A+Math.imul(Pe,st)|0,S=S+Math.imul(Ce,qe)|0,v=v+Math.imul(Ce,dt)|0,v=v+Math.imul(Xe,qe)|0,A=A+Math.imul(Xe,dt)|0,S=S+Math.imul(ge,at)|0,v=v+Math.imul(ge,kt)|0,v=v+Math.imul(ke,at)|0,A=A+Math.imul(ke,kt)|0;var sn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(sn>>>26)|0,sn&=67108863,S=Math.imul(we,Re),v=Math.imul(we,lt),v=v+Math.imul(He,Re)|0,A=Math.imul(He,lt),S=S+Math.imul(me,Le)|0,v=v+Math.imul(me,ut)|0,v=v+Math.imul(Me,Le)|0,A=A+Math.imul(Me,ut)|0,S=S+Math.imul(ye,Fe)|0,v=v+Math.imul(ye,st)|0,v=v+Math.imul(Ie,Fe)|0,A=A+Math.imul(Ie,st)|0,S=S+Math.imul(be,qe)|0,v=v+Math.imul(be,dt)|0,v=v+Math.imul(Pe,qe)|0,A=A+Math.imul(Pe,dt)|0,S=S+Math.imul(Ce,at)|0,v=v+Math.imul(Ce,kt)|0,v=v+Math.imul(Xe,at)|0,A=A+Math.imul(Xe,kt)|0;var on=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(on>>>26)|0,on&=67108863,S=Math.imul(we,Le),v=Math.imul(we,ut),v=v+Math.imul(He,Le)|0,A=Math.imul(He,ut),S=S+Math.imul(me,Fe)|0,v=v+Math.imul(me,st)|0,v=v+Math.imul(Me,Fe)|0,A=A+Math.imul(Me,st)|0,S=S+Math.imul(ye,qe)|0,v=v+Math.imul(ye,dt)|0,v=v+Math.imul(Ie,qe)|0,A=A+Math.imul(Ie,dt)|0,S=S+Math.imul(be,at)|0,v=v+Math.imul(be,kt)|0,v=v+Math.imul(Pe,at)|0,A=A+Math.imul(Pe,kt)|0;var Cr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,S=Math.imul(we,Fe),v=Math.imul(we,st),v=v+Math.imul(He,Fe)|0,A=Math.imul(He,st),S=S+Math.imul(me,qe)|0,v=v+Math.imul(me,dt)|0,v=v+Math.imul(Me,qe)|0,A=A+Math.imul(Me,dt)|0,S=S+Math.imul(ye,at)|0,v=v+Math.imul(ye,kt)|0,v=v+Math.imul(Ie,at)|0,A=A+Math.imul(Ie,kt)|0;var Pn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,S=Math.imul(we,qe),v=Math.imul(we,dt),v=v+Math.imul(He,qe)|0,A=Math.imul(He,dt),S=S+Math.imul(me,at)|0,v=v+Math.imul(me,kt)|0,v=v+Math.imul(Me,at)|0,A=A+Math.imul(Me,kt)|0;var Dn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,S=Math.imul(we,at),v=Math.imul(we,kt),v=v+Math.imul(He,at)|0,A=Math.imul(He,kt);var On=(D+S|0)+((v&8191)<<13)|0;return D=(A+(v>>>13)|0)+(On>>>26)|0,On&=67108863,C[0]=_t,C[1]=qt,C[2]=Qr,C[3]=Zr,C[4]=Xr,C[5]=ei,C[6]=vr,C[7]=Ai,C[8]=In,C[9]=Ei,C[10]=Mn,C[11]=Cn,C[12]=Si,C[13]=sn,C[14]=on,C[15]=Cr,C[16]=Pn,C[17]=Dn,C[18]=On,D!==0&&(C[19]=D,l.length++),l};Math.imul||($=O);function W(L,b,m){m.negative=b.negative^L.negative,m.length=L.length+b.length;for(var l=0,d=0,y=0;y<m.length-1;y++){var C=d;d=0;for(var D=l&67108863,S=Math.min(y,b.length-1),v=Math.max(0,y-L.length+1);v<=S;v++){var A=y-v,x=L.words[A]|0,N=b.words[v]|0,ae=x*N,R=ae&67108863;C=C+(ae/67108864|0)|0,R=R+D|0,D=R&67108863,C=C+(R>>>26)|0,d+=C>>>26,C&=67108863}m.words[y]=D,l=C,C=d}return l!==0?m.words[y]=l:m.length--,m.strip()}function k(L,b,m){var l=new F;return l.mulp(L,b,m)}s.prototype.mulTo=function(b,m){var l,d=this.length+b.length;return this.length===10&&b.length===10?l=$(this,b,m):d<63?l=O(this,b,m):d<1024?l=W(this,b,m):l=k(this,b,m),l};function F(L,b){this.x=L,this.y=b}F.prototype.makeRBT=function(b){for(var m=new Array(b),l=s.prototype._countBits(b)-1,d=0;d<b;d++)m[d]=this.revBin(d,l,b);return m},F.prototype.revBin=function(b,m,l){if(b===0||b===l-1)return b;for(var d=0,y=0;y<m;y++)d|=(b&1)<<m-y-1,b>>=1;return d},F.prototype.permute=function(b,m,l,d,y,C){for(var D=0;D<C;D++)d[D]=m[b[D]],y[D]=l[b[D]]},F.prototype.transform=function(b,m,l,d,y,C){this.permute(C,b,m,l,d,y);for(var D=1;D<y;D<<=1)for(var S=D<<1,v=Math.cos(2*Math.PI/S),A=Math.sin(2*Math.PI/S),x=0;x<y;x+=S)for(var N=v,ae=A,R=0;R<D;R++){var X=l[x+R],V=d[x+R],J=l[x+R+D],K=d[x+R+D],E=N*J-ae*K;K=N*K+ae*J,J=E,l[x+R]=X+J,d[x+R]=V+K,l[x+R+D]=X-J,d[x+R+D]=V-K,R!==S&&(E=v*N-A*ae,ae=v*ae+A*N,N=E)}},F.prototype.guessLen13b=function(b,m){var l=Math.max(m,b)|1,d=l&1,y=0;for(l=l/2|0;l;l=l>>>1)y++;return 1<<y+1+d},F.prototype.conjugate=function(b,m,l){if(!(l<=1))for(var d=0;d<l/2;d++){var y=b[d];b[d]=b[l-d-1],b[l-d-1]=y,y=m[d],m[d]=-m[l-d-1],m[l-d-1]=-y}},F.prototype.normalize13b=function(b,m){for(var l=0,d=0;d<m/2;d++){var y=Math.round(b[2*d+1]/m)*8192+Math.round(b[2*d]/m)+l;b[d]=y&67108863,y<67108864?l=0:l=y/67108864|0}return b},F.prototype.convert13b=function(b,m,l,d){for(var y=0,C=0;C<m;C++)y=y+(b[C]|0),l[2*C]=y&8191,y=y>>>13,l[2*C+1]=y&8191,y=y>>>13;for(C=2*m;C<d;++C)l[C]=0;i(y===0),i((y&-8192)===0)},F.prototype.stub=function(b){for(var m=new Array(b),l=0;l<b;l++)m[l]=0;return m},F.prototype.mulp=function(b,m,l){var d=2*this.guessLen13b(b.length,m.length),y=this.makeRBT(d),C=this.stub(d),D=new Array(d),S=new Array(d),v=new Array(d),A=new Array(d),x=new Array(d),N=new Array(d),ae=l.words;ae.length=d,this.convert13b(b.words,b.length,D,d),this.convert13b(m.words,m.length,A,d),this.transform(D,C,S,v,d,y),this.transform(A,C,x,N,d,y);for(var R=0;R<d;R++){var X=S[R]*x[R]-v[R]*N[R];v[R]=S[R]*N[R]+v[R]*x[R],S[R]=X}return this.conjugate(S,v,d),this.transform(S,v,ae,C,d,y),this.conjugate(ae,C,d),this.normalize13b(ae,d),l.negative=b.negative^m.negative,l.length=b.length+m.length,l.strip()},s.prototype.mul=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),this.mulTo(b,m)},s.prototype.mulf=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),k(this,b,m)},s.prototype.imul=function(b){return this.clone().mulTo(b,this)},s.prototype.imuln=function(b){i(typeof b=="number"),i(b<67108864);for(var m=0,l=0;l<this.length;l++){var d=(this.words[l]|0)*b,y=(d&67108863)+(m&67108863);m>>=26,m+=d/67108864|0,m+=y>>>26,this.words[l]=y&67108863}return m!==0&&(this.words[l]=m,this.length++),this},s.prototype.muln=function(b){return this.clone().imuln(b)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(b){var m=M(b);if(m.length===0)return new s(1);for(var l=this,d=0;d<m.length&&m[d]===0;d++,l=l.sqr());if(++d<m.length)for(var y=l.sqr();d<m.length;d++,y=y.sqr())m[d]!==0&&(l=l.mul(y));return l},s.prototype.iushln=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=67108863>>>26-m<<26-m,y;if(m!==0){var C=0;for(y=0;y<this.length;y++){var D=this.words[y]&d,S=(this.words[y]|0)-D<<m;this.words[y]=S|C,C=D>>>26-m}C&&(this.words[y]=C,this.length++)}if(l!==0){for(y=this.length-1;y>=0;y--)this.words[y+l]=this.words[y];for(y=0;y<l;y++)this.words[y]=0;this.length+=l}return this.strip()},s.prototype.ishln=function(b){return i(this.negative===0),this.iushln(b)},s.prototype.iushrn=function(b,m,l){i(typeof b=="number"&&b>=0);var d;m?d=(m-m%26)/26:d=0;var y=b%26,C=Math.min((b-y)/26,this.length),D=67108863^67108863>>>y<<y,S=l;if(d-=C,d=Math.max(0,d),S){for(var v=0;v<C;v++)S.words[v]=this.words[v];S.length=C}if(C!==0)if(this.length>C)for(this.length-=C,v=0;v<this.length;v++)this.words[v]=this.words[v+C];else this.words[0]=0,this.length=1;var A=0;for(v=this.length-1;v>=0&&(A!==0||v>=d);v--){var x=this.words[v]|0;this.words[v]=A<<26-y|x>>>y,A=x&D}return S&&A!==0&&(S.words[S.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(b,m,l){return i(this.negative===0),this.iushrn(b,m,l)},s.prototype.shln=function(b){return this.clone().ishln(b)},s.prototype.ushln=function(b){return this.clone().iushln(b)},s.prototype.shrn=function(b){return this.clone().ishrn(b)},s.prototype.ushrn=function(b){return this.clone().iushrn(b)},s.prototype.testn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return!1;var y=this.words[l];return!!(y&d)},s.prototype.imaskn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(m!==0&&l++,this.length=Math.min(l,this.length),m!==0){var d=67108863^67108863>>>m<<m;this.words[this.length-1]&=d}return this.strip()},s.prototype.maskn=function(b){return this.clone().imaskn(b)},s.prototype.iaddn=function(b){return i(typeof b=="number"),i(b<67108864),b<0?this.isubn(-b):this.negative!==0?this.length===1&&(this.words[0]|0)<b?(this.words[0]=b-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(b),this.negative=1,this):this._iaddn(b)},s.prototype._iaddn=function(b){this.words[0]+=b;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(b){if(i(typeof b=="number"),i(b<67108864),b<0)return this.iaddn(-b);if(this.negative!==0)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this.strip()},s.prototype.addn=function(b){return this.clone().iaddn(b)},s.prototype.subn=function(b){return this.clone().isubn(b)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(b,m,l){var d=b.length+l,y;this._expand(d);var C,D=0;for(y=0;y<b.length;y++){C=(this.words[y+l]|0)+D;var S=(b.words[y]|0)*m;C-=S&67108863,D=(C>>26)-(S/67108864|0),this.words[y+l]=C&67108863}for(;y<this.length-l;y++)C=(this.words[y+l]|0)+D,D=C>>26,this.words[y+l]=C&67108863;if(D===0)return this.strip();for(i(D===-1),D=0,y=0;y<this.length;y++)C=-(this.words[y]|0)+D,D=C>>26,this.words[y]=C&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(b,m){var l=this.length-b.length,d=this.clone(),y=b,C=y.words[y.length-1]|0,D=this._countBits(C);l=26-D,l!==0&&(y=y.ushln(l),d.iushln(l),C=y.words[y.length-1]|0);var S=d.length-y.length,v;if(m!=="mod"){v=new s(null),v.length=S+1,v.words=new Array(v.length);for(var A=0;A<v.length;A++)v.words[A]=0}var x=d.clone()._ishlnsubmul(y,1,S);x.negative===0&&(d=x,v&&(v.words[S]=1));for(var N=S-1;N>=0;N--){var ae=(d.words[y.length+N]|0)*67108864+(d.words[y.length+N-1]|0);for(ae=Math.min(ae/C|0,67108863),d._ishlnsubmul(y,ae,N);d.negative!==0;)ae--,d.negative=0,d._ishlnsubmul(y,1,N),d.isZero()||(d.negative^=1);v&&(v.words[N]=ae)}return v&&v.strip(),d.strip(),m!=="div"&&l!==0&&d.iushrn(l),{div:v||null,mod:d}},s.prototype.divmod=function(b,m,l){if(i(!b.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var d,y,C;return this.negative!==0&&b.negative===0?(C=this.neg().divmod(b,m),m!=="mod"&&(d=C.div.neg()),m!=="div"&&(y=C.mod.neg(),l&&y.negative!==0&&y.iadd(b)),{div:d,mod:y}):this.negative===0&&b.negative!==0?(C=this.divmod(b.neg(),m),m!=="mod"&&(d=C.div.neg()),{div:d,mod:C.mod}):this.negative&b.negative?(C=this.neg().divmod(b.neg(),m),m!=="div"&&(y=C.mod.neg(),l&&y.negative!==0&&y.isub(b)),{div:C.div,mod:y}):b.length>this.length||this.cmp(b)<0?{div:new s(0),mod:this}:b.length===1?m==="div"?{div:this.divn(b.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new s(this.modn(b.words[0]))}:this._wordDiv(b,m)},s.prototype.div=function(b){return this.divmod(b,"div",!1).div},s.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},s.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},s.prototype.divRound=function(b){var m=this.divmod(b);if(m.mod.isZero())return m.div;var l=m.div.negative!==0?m.mod.isub(b):m.mod,d=b.ushrn(1),y=b.andln(1),C=l.cmp(d);return C<0||y===1&&C===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(b){i(b<=67108863);for(var m=(1<<26)%b,l=0,d=this.length-1;d>=0;d--)l=(m*l+(this.words[d]|0))%b;return l},s.prototype.idivn=function(b){i(b<=67108863);for(var m=0,l=this.length-1;l>=0;l--){var d=(this.words[l]|0)+m*67108864;this.words[l]=d/b|0,m=d%b}return this.strip()},s.prototype.divn=function(b){return this.clone().idivn(b)},s.prototype.egcd=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),C=new s(0),D=new s(1),S=0;m.isEven()&&l.isEven();)m.iushrn(1),l.iushrn(1),++S;for(var v=l.clone(),A=m.clone();!m.isZero();){for(var x=0,N=1;!(m.words[0]&N)&&x<26;++x,N<<=1);if(x>0)for(m.iushrn(x);x-- >0;)(d.isOdd()||y.isOdd())&&(d.iadd(v),y.isub(A)),d.iushrn(1),y.iushrn(1);for(var ae=0,R=1;!(l.words[0]&R)&&ae<26;++ae,R<<=1);if(ae>0)for(l.iushrn(ae);ae-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(v),D.isub(A)),C.iushrn(1),D.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(C),y.isub(D)):(l.isub(m),C.isub(d),D.isub(y))}return{a:C,b:D,gcd:l.iushln(S)}},s.prototype._invmp=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),C=l.clone();m.cmpn(1)>0&&l.cmpn(1)>0;){for(var D=0,S=1;!(m.words[0]&S)&&D<26;++D,S<<=1);if(D>0)for(m.iushrn(D);D-- >0;)d.isOdd()&&d.iadd(C),d.iushrn(1);for(var v=0,A=1;!(l.words[0]&A)&&v<26;++v,A<<=1);if(v>0)for(l.iushrn(v);v-- >0;)y.isOdd()&&y.iadd(C),y.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(y)):(l.isub(m),y.isub(d))}var x;return m.cmpn(1)===0?x=d:x=y,x.cmpn(0)<0&&x.iadd(b),x},s.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var m=this.clone(),l=b.clone();m.negative=0,l.negative=0;for(var d=0;m.isEven()&&l.isEven();d++)m.iushrn(1),l.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;l.isEven();)l.iushrn(1);var y=m.cmp(l);if(y<0){var C=m;m=l,l=C}else if(y===0||l.cmpn(1)===0)break;m.isub(l)}while(!0);return l.iushln(d)},s.prototype.invm=function(b){return this.egcd(b).a.umod(b)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(b){return this.words[0]&b},s.prototype.bincn=function(b){i(typeof b=="number");var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var y=d,C=l;y!==0&&C<this.length;C++){var D=this.words[C]|0;D+=y,y=D>>>26,D&=67108863,this.words[C]=D}return y!==0&&(this.words[C]=y,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(b){var m=b<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var l;if(this.length>1)l=1;else{m&&(b=-b),i(b<=67108863,"Number is too big");var d=this.words[0]|0;l=d===b?0:d<b?-1:1}return this.negative!==0?-l|0:l},s.prototype.cmp=function(b){if(this.negative!==0&&b.negative===0)return-1;if(this.negative===0&&b.negative!==0)return 1;var m=this.ucmp(b);return this.negative!==0?-m|0:m},s.prototype.ucmp=function(b){if(this.length>b.length)return 1;if(this.length<b.length)return-1;for(var m=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,y=b.words[l]|0;if(d!==y){d<y?m=-1:d>y&&(m=1);break}}return m},s.prototype.gtn=function(b){return this.cmpn(b)===1},s.prototype.gt=function(b){return this.cmp(b)===1},s.prototype.gten=function(b){return this.cmpn(b)>=0},s.prototype.gte=function(b){return this.cmp(b)>=0},s.prototype.ltn=function(b){return this.cmpn(b)===-1},s.prototype.lt=function(b){return this.cmp(b)===-1},s.prototype.lten=function(b){return this.cmpn(b)<=0},s.prototype.lte=function(b){return this.cmp(b)<=0},s.prototype.eqn=function(b){return this.cmpn(b)===0},s.prototype.eq=function(b){return this.cmp(b)===0},s.red=function(b){return new ee(b)},s.prototype.toRed=function(b){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),b.convertTo(this)._forceRed(b)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(b){return this.red=b,this},s.prototype.forceRed=function(b){return i(!this.red,"Already a number in reduction context"),this._forceRed(b)},s.prototype.redAdd=function(b){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},s.prototype.redIAdd=function(b){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},s.prototype.redSub=function(b){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},s.prototype.redISub=function(b){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},s.prototype.redShl=function(b){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},s.prototype.redMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},s.prototype.redIMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(b){return i(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var Y={k256:null,p224:null,p192:null,p25519:null};function B(L,b){this.name=L,this.p=new s(b,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}B.prototype._tmp=function(){var b=new s(null);return b.words=new Array(Math.ceil(this.n/13)),b},B.prototype.ireduce=function(b){var m=b,l;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),l=m.bitLength();while(l>this.n);var d=l<this.n?-1:m.ucmp(this.p);return d===0?(m.words[0]=0,m.length=1):d>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},B.prototype.split=function(b,m){b.iushrn(this.n,0,m)},B.prototype.imulK=function(b){return b.imul(this.k)};function z(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(z,B),z.prototype.split=function(b,m){for(var l=4194303,d=Math.min(b.length,9),y=0;y<d;y++)m.words[y]=b.words[y];if(m.length=d,b.length<=9){b.words[0]=0,b.length=1;return}var C=b.words[9];for(m.words[m.length++]=C&l,y=10;y<b.length;y++){var D=b.words[y]|0;b.words[y-10]=(D&l)<<4|C>>>22,C=D}C>>>=22,b.words[y-10]=C,C===0&&b.length>10?b.length-=10:b.length-=9},z.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var m=0,l=0;l<b.length;l++){var d=b.words[l]|0;m+=d*977,b.words[l]=m&67108863,m=d*64+(m/67108864|0)}return b.words[b.length-1]===0&&(b.length--,b.words[b.length-1]===0&&b.length--),b};function j(){B.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(j,B);function _(){B.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(_,B);function U(){B.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(U,B),U.prototype.imulK=function(b){for(var m=0,l=0;l<b.length;l++){var d=(b.words[l]|0)*19+m,y=d&67108863;d>>>=26,b.words[l]=y,m=d}return m!==0&&(b.words[b.length++]=m),b},s._prime=function(b){if(Y[b])return Y[b];var m;if(b==="k256")m=new z;else if(b==="p224")m=new j;else if(b==="p192")m=new _;else if(b==="p25519")m=new U;else throw new Error("Unknown prime "+b);return Y[b]=m,m};function ee(L){if(typeof L=="string"){var b=s._prime(L);this.m=b.p,this.prime=b}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}ee.prototype._verify1=function(b){i(b.negative===0,"red works only with positives"),i(b.red,"red works only with red numbers")},ee.prototype._verify2=function(b,m){i((b.negative|m.negative)===0,"red works only with positives"),i(b.red&&b.red===m.red,"red works only with red numbers")},ee.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):b.umod(this.m)._forceRed(this)},ee.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},ee.prototype.add=function(b,m){this._verify2(b,m);var l=b.add(m);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},ee.prototype.iadd=function(b,m){this._verify2(b,m);var l=b.iadd(m);return l.cmp(this.m)>=0&&l.isub(this.m),l},ee.prototype.sub=function(b,m){this._verify2(b,m);var l=b.sub(m);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},ee.prototype.isub=function(b,m){this._verify2(b,m);var l=b.isub(m);return l.cmpn(0)<0&&l.iadd(this.m),l},ee.prototype.shl=function(b,m){return this._verify1(b),this.imod(b.ushln(m))},ee.prototype.imul=function(b,m){return this._verify2(b,m),this.imod(b.imul(m))},ee.prototype.mul=function(b,m){return this._verify2(b,m),this.imod(b.mul(m))},ee.prototype.isqr=function(b){return this.imul(b,b.clone())},ee.prototype.sqr=function(b){return this.mul(b,b)},ee.prototype.sqrt=function(b){if(b.isZero())return b.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var l=this.m.add(new s(1)).iushrn(2);return this.pow(b,l)}for(var d=this.m.subn(1),y=0;!d.isZero()&&d.andln(1)===0;)y++,d.iushrn(1);i(!d.isZero());var C=new s(1).toRed(this),D=C.redNeg(),S=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,S).cmp(D)!==0;)v.redIAdd(D);for(var A=this.pow(v,d),x=this.pow(b,d.addn(1).iushrn(1)),N=this.pow(b,d),ae=y;N.cmp(C)!==0;){for(var R=N,X=0;R.cmp(C)!==0;X++)R=R.redSqr();i(X<ae);var V=this.pow(A,new s(1).iushln(ae-X-1));x=x.redMul(V),A=V.redSqr(),N=N.redMul(A),ae=X}return x},ee.prototype.invm=function(b){var m=b._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},ee.prototype.pow=function(b,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return b.clone();var l=4,d=new Array(1<<l);d[0]=new s(1).toRed(this),d[1]=b;for(var y=2;y<d.length;y++)d[y]=this.mul(d[y-1],b);var C=d[0],D=0,S=0,v=m.bitLength()%26;for(v===0&&(v=26),y=m.length-1;y>=0;y--){for(var A=m.words[y],x=v-1;x>=0;x--){var N=A>>x&1;if(C!==d[0]&&(C=this.sqr(C)),N===0&&D===0){S=0;continue}D<<=1,D|=N,S++,!(S!==l&&(y!==0||x!==0))&&(C=this.mul(C,d[D]),S=0,D=0)}v=26}return C},ee.prototype.convertTo=function(b){var m=b.umod(this.m);return m===b?m.clone():m},ee.prototype.convertFrom=function(b){var m=b.clone();return m.red=null,m},s.mont=function(b){return new oe(b)};function oe(L){ee.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(oe,ee),oe.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},oe.prototype.convertFrom=function(b){var m=this.imod(b.mul(this.rinv));return m.red=null,m},oe.prototype.imul=function(b,m){if(b.isZero()||m.isZero())return b.words[0]=0,b.length=1,b;var l=b.imul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),C=y;return y.cmp(this.m)>=0?C=y.isub(this.m):y.cmpn(0)<0&&(C=y.iadd(this.m)),C._forceRed(this)},oe.prototype.mul=function(b,m){if(b.isZero()||m.isZero())return new s(0)._forceRed(this);var l=b.mul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),C=y;return y.cmp(this.m)>=0?C=y.isub(this.m):y.cmpn(0)<0&&(C=y.iadd(this.m)),C._forceRed(this)},oe.prototype.invm=function(b){var m=this.imod(b._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(r,fr)})(Vn);var Td={};(function(r){var e=r;function t(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var f=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)f[h]=s[h]|0;return f}if(a==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var h=0;h<s.length;h+=2)f.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var u=s.charCodeAt(h),g=u>>8,w=u&255;g?f.push(g,w):f.push(w)}return f}e.toArray=t;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var a="",f=0;f<s.length;f++)a+=i(s[f].toString(16));return a}e.toHex=n,e.encode=function(a,f){return f==="hex"?n(a):a}})(Td),function(r){var e=r,t=Vn.exports,i=xo,n=Td;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(g,w,P){var M=new Array(Math.max(g.bitLength(),P)+1),O;for(O=0;O<M.length;O+=1)M[O]=0;var $=1<<w+1,W=g.clone();for(O=0;O<M.length;O++){var k,F=W.andln($-1);W.isOdd()?(F>($>>1)-1?k=($>>1)-F:k=F,W.isubn(k)):k=0,M[O]=k,W.iushrn(1)}return M}e.getNAF=s;function a(g,w){var P=[[],[]];g=g.clone(),w=w.clone();for(var M=0,O=0,$;g.cmpn(-M)>0||w.cmpn(-O)>0;){var W=g.andln(3)+M&3,k=w.andln(3)+O&3;W===3&&(W=-1),k===3&&(k=-1);var F;W&1?($=g.andln(7)+M&7,($===3||$===5)&&k===2?F=-W:F=W):F=0,P[0].push(F);var Y;k&1?($=w.andln(7)+O&7,($===3||$===5)&&W===2?Y=-k:Y=k):Y=0,P[1].push(Y),2*M===F+1&&(M=1-M),2*O===Y+1&&(O=1-O),g.iushrn(1),w.iushrn(1)}return P}e.getJSF=a;function f(g,w,P){var M="_"+w;g.prototype[w]=function(){return this[M]!==void 0?this[M]:this[M]=P.call(this)}}e.cachedProperty=f;function h(g){return typeof g=="string"?e.toArray(g,"hex"):g}e.parseBytes=h;function u(g){return new t(g,"hex","le")}e.intFromLE=u}(Li);var Al={exports:{}},$d;Al.exports=function(e){return $d||($d=new ks(null)),$d.generate(e)};function ks(r){this.rand=r}if(Al.exports.Rand=ks,ks.prototype.generate=function(e){return this._rand(e)},ks.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i<t.length;i++)t[i]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?ks.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?ks.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(ks.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var um=il;if(typeof um.randomBytes!="function")throw new Error("Not supported");ks.prototype._rand=function(e){return um.randomBytes(e)}}catch{}var Nd={},So=Vn.exports,kc=Li,El=kc.getNAF,G9=kc.getJSF,Sl=kc.assert;function Hs(r,e){this.type=r,this.p=new So(e.p,16),this.red=e.prime?So.red(e.prime):So.mont(this.p),this.zero=new So(0).toRed(this.red),this.one=new So(1).toRed(this.red),this.two=new So(2).toRed(this.red),this.n=e.n&&new So(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Il=Hs;Hs.prototype.point=function(){throw new Error("Not implemented")},Hs.prototype.validate=function(){throw new Error("Not implemented")},Hs.prototype._fixedNafMul=function(e,t){Sl(e.precomputed);var i=e._getDoubles(),n=El(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),P=s;P>0;P--){for(f=0;f<a.length;f++)h=a[f],h===P?w=w.mixedAdd(i.points[f]):h===-P&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},Hs.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=El(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];Sl(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},Hs.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,P;for(g=0;g<n;g++){P=t[g];var M=P._getNAFPoints(e);a[g]=M.wnd,f[g]=M.points}for(g=n-1;g>=1;g-=2){var O=g-1,$=g;if(a[O]!==1||a[$]!==1){h[O]=El(i[O],a[O],this._bitLength),h[$]=El(i[$],a[$],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[$].length,u);continue}var W=[t[O],null,null,t[$]];t[O].y.cmp(t[$].y)===0?(W[1]=t[O].add(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg())):t[O].y.cmp(t[$].y.redNeg())===0?(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].add(t[$].neg())):(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],F=G9(i[O],i[$]);for(u=Math.max(F[0].length,u),h[O]=new Array(u),h[$]=new Array(u),w=0;w<u;w++){var Y=F[0][w]|0,B=F[1][w]|0;h[O][w]=k[(Y+1)*3+(B+1)],h[$][w]=0,f[O]=W}}var z=this.jpoint(null,null,null),j=this._wnafT4;for(g=u;g>=0;g--){for(var _=0;g>=0;){var U=!0;for(w=0;w<n;w++)j[w]=h[w][g]|0,j[w]!==0&&(U=!1);if(!U)break;_++,g--}if(g>=0&&_++,z=z.dblp(_),g<0)break;for(w=0;w<n;w++){var ee=j[w];ee!==0&&(ee>0?P=f[w][ee-1>>1]:ee<0&&(P=f[w][-ee-1>>1].neg()),P.type==="affine"?z=z.mixedAdd(P):z=z.add(P))}}for(g=0;g<n;g++)f[g]=null;return s?z:z.toP()};function Qi(r,e){this.curve=r,this.type=e,this.precomputed=null}Hs.BasePoint=Qi,Qi.prototype.eq=function(){throw new Error("Not implemented")},Qi.prototype.validate=function(){return this.curve.validate(this)},Hs.prototype.decodePoint=function(e,t){e=kc.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Sl(e[e.length-1]%2===0):e[0]===7&&Sl(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Qi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Qi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Qi.prototype.encode=function(e,t){return kc.encode(this._encode(t),e)},Qi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Qi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Qi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Qi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Qi.prototype._getBeta=function(){return null},Qi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var Y9=Li,dr=Vn.exports,Ld=xa.exports,Oa=Il,J9=Y9.assert;function Zi(r){Oa.call(this,"short",r),this.a=new dr(r.a,16).toRed(this.red),this.b=new dr(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Ld(Zi,Oa);var Q9=Zi;Zi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new dr(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new dr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],J9(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new dr(f.a,16),b:new dr(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},Zi.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:dr.mont(e),i=new dr(2).toRed(t).redInvm(),n=i.redNeg(),s=new dr(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},Zi.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new dr(1),a=new dr(0),f=new dr(0),h=new dr(1),u,g,w,P,M,O,$,W=0,k,F;i.cmpn(0)!==0;){var Y=n.div(i);k=n.sub(Y.mul(i)),F=f.sub(Y.mul(s));var B=h.sub(Y.mul(a));if(!w&&k.cmp(t)<0)u=$.neg(),g=s,w=k.neg(),P=F;else if(w&&++W===2)break;$=k,n=i,i=k,f=s,s=F,h=a,a=B}M=k.neg(),O=F;var z=w.sqr().add(P.sqr()),j=M.sqr().add(O.sqr());return j.cmp(z)>=0&&(M=u,O=g),w.negative&&(w=w.neg(),P=P.neg()),M.negative&&(M=M.neg(),O=O.neg()),[{a:w,b:P},{a:M,b:O}]},Zi.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),P=u.add(g).neg();return{k1:w,k2:P}},Zi.prototype.pointFromX=function(e,t){e=new dr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Zi.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Zi.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Rr(r,e,t,i){Oa.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new dr(e,16),this.y=new dr(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Ld(Rr,Oa.BasePoint),Zi.prototype.point=function(e,t,i){return new Rr(this,e,t,i)},Zi.prototype.pointFromJSON=function(e,t){return Rr.fromJSON(this,e,t)},Rr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Rr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Rr.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Rr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Rr.prototype.isInfinity=function(){return this.inf},Rr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Rr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Rr.prototype.getX=function(){return this.x.fromRed()},Rr.prototype.getY=function(){return this.y.fromRed()},Rr.prototype.mul=function(e){return e=new dr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Rr.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Rr.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Rr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Rr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Rr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function jr(r,e,t,i){Oa.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new dr(0)):(this.x=new dr(e,16),this.y=new dr(t,16),this.z=new dr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ld(jr,Oa.BasePoint),Zi.prototype.jpoint=function(e,t,i){return new jr(this,e,t,i)},jr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},jr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),P=n.redMul(g),M=u.redSqr().redIAdd(w).redISub(P).redISub(P),O=u.redMul(P.redISub(M)).redISub(a.redMul(w)),$=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(M,O,$)},jr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),P=h.redSqr().redIAdd(g).redISub(w).redISub(w),M=h.redMul(w.redISub(P)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(P,M,O)},jr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),P=g.redSqr(),M=P.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),$=a.redMul(P),W=O.redSqr().redISub($.redAdd($)),k=$.redISub(W),F=O.redMul(k);F=F.redIAdd(F).redISub(M);var Y=g.redMul(h);t+1<e&&(u=u.redMul(M)),a=W,h=Y,g=F}return this.curve.jpoint(a,g.redMul(s),h)},jr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),P=this.y.redSqr(),M=P.redSqr(),O=this.x.redAdd(P).redSqr().redISub(w).redISub(M);O=O.redIAdd(O);var $=w.redAdd(w).redIAdd(w),W=$.redSqr(),k=M.redIAdd(M);k=k.redIAdd(k),k=k.redIAdd(k),e=W.redISub(O).redISub(O),t=$.redMul(O.redISub(e)).redISub(k),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},jr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),P=this.y.redSqr(),M=this.x.redMul(P),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var $=M.redIAdd(M);$=$.redIAdd($);var W=$.redAdd($);e=O.redSqr().redISub(W),i=this.y.redAdd(this.z).redSqr().redISub(P).redISub(w);var k=P.redSqr();k=k.redIAdd(k),k=k.redIAdd(k),k=k.redIAdd(k),t=O.redMul($.redISub(e)).redISub(k)}return this.curve.jpoint(e,t,i)},jr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),P=g.redISub(w),M=f.redSqr();M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=h.redMul(P).redISub(M),$=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,$)},jr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var P=this.x.redMul(h).redISub(w);P=P.redIAdd(P),P=P.redIAdd(P);var M=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(P,M,O)},jr.prototype.mul=function(e,t){return e=new dr(e,t),this.curve._wnafMul(this,e)},jr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},jr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},jr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ra=Vn.exports,dm=xa.exports,Ml=Il,Z9=Li;function Ta(r){Ml.call(this,"mont",r),this.a=new Ra(r.a,16).toRed(this.red),this.b=new Ra(r.b,16).toRed(this.red),this.i4=new Ra(4).toRed(this.red).redInvm(),this.two=new Ra(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}dm(Ta,Ml);var X9=Ta;Ta.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),n=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Tr(r,e,t){Ml.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Ra(e,16),this.z=new Ra(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}dm(Tr,Ml.BasePoint),Ta.prototype.decodePoint=function(e,t){return this.point(Z9.toArray(e,t),1)},Ta.prototype.point=function(e,t){return new Tr(this,e,t)},Ta.prototype.pointFromJSON=function(e){return Tr.fromJSON(this,e)},Tr.prototype.precompute=function(){},Tr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Tr.fromJSON=function(e,t){return new Tr(e,t[0],t[1]||e.one)},Tr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Tr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Tr.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=t.redSub(n),a=t.redMul(n),f=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,f)},Tr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),f=a.redMul(i),h=s.redMul(n),u=t.z.redMul(f.redAdd(h).redSqr()),g=t.x.redMul(f.redISub(h).redSqr());return this.curve.point(u,g)},Tr.prototype.mul=function(e){for(var t=e.clone(),i=this,n=this.curve.point(null,null),s=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var f=a.length-1;f>=0;f--)a[f]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},Tr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Tr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Tr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var ex=Li,ms=Vn.exports,pm=xa.exports,Cl=Il,tx=ex.assert;function Gn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,Cl.call(this,"edwards",r),this.a=new ms(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ms(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ms(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),tx(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}pm(Gn,Cl);var rx=Gn;Gn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Gn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Gn.prototype.jpoint=function(e,t,i,n){return this.point(e,t,i,n)},Gn.prototype.pointFromX=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),a=n.redMul(s.redInvm()),f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var h=f.fromRed().isOdd();return(t&&!h||!t&&h)&&(f=f.redNeg()),this.point(e,f)},Gn.prototype.pointFromY=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)},Gn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),n=t.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return n.cmp(s)===0};function nr(r,e,t,i,n){Cl.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ms(e,16),this.y=new ms(t,16),this.z=i?new ms(i,16):this.curve.one,this.t=n&&new ms(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}pm(nr,Cl.BasePoint),Gn.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},Gn.prototype.point=function(e,t,i,n){return new nr(this,e,t,i,n)},nr.fromJSON=function(e,t){return new nr(e,t[0],t[1],t[2])},nr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},nr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),f=a.redSub(i),h=n.redSub(t),u=s.redMul(f),g=a.redMul(h),w=s.redMul(h),P=f.redMul(a);return this.curve.point(u,g,P,w)},nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),n,s,a,f,h,u;if(this.curve.twisted){f=this.curve._mulA(t);var g=f.redAdd(i);this.zOne?(n=e.redSub(t).redSub(i).redMul(g.redSub(this.curve.two)),s=g.redMul(f.redSub(i)),a=g.redSqr().redSub(g).redSub(g)):(h=this.z.redSqr(),u=g.redSub(h).redISub(h),n=e.redSub(t).redISub(i).redMul(u),s=g.redMul(f.redSub(i)),a=g.redMul(u))}else f=t.redAdd(i),h=this.curve._mulC(this.z).redSqr(),u=f.redSub(h).redSub(h),n=this.curve._mulC(e.redISub(f)).redMul(u),s=this.curve._mulC(f).redMul(t.redISub(i)),a=f.redMul(u);return this.curve.point(n,s,a)},nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},nr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=i.redSub(t),f=s.redSub(n),h=s.redAdd(n),u=i.redAdd(t),g=a.redMul(f),w=h.redMul(u),P=a.redMul(u),M=f.redMul(h);return this.curve.point(g,w,M,P)},nr.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(n).redMul(s),f=i.redSub(a),h=i.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),g=t.redMul(f).redMul(u),w,P;return this.curve.twisted?(w=t.redMul(h).redMul(s.redSub(this.curve._mulA(n))),P=f.redMul(h)):(w=t.redMul(h).redMul(s.redSub(n)),P=this.curve._mulC(f).redMul(h)),this.curve.point(g,w,P)},nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},nr.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)},nr.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)},nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},nr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add,function(r){var e=r;e.base=Il,e.short=Q9,e.mont=X9,e.edwards=rx}(Nd);var Pl={},Bd,gm;function ix(){return gm||(gm=1,Bd={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Bd}(function(r){var e=r,t=Ri,i=Nd,n=Li,s=n.assert;function a(u){u.type==="short"?this.curve=new i.short(u):u.type==="edwards"?this.curve=new i.edwards(u):this.curve=new i.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=a;function f(u,g){Object.defineProperty(e,u,{configurable:!0,enumerable:!0,get:function(){var w=new a(g);return Object.defineProperty(e,u,{configurable:!0,enumerable:!0,value:w}),w}})}f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=ix()}catch{h=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(Pl);var nx=Ri,Io=Td,vm=xo;function js(r){if(!(this instanceof js))return new js(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Io.toArray(r.entropy,r.entropyEnc||"hex"),t=Io.toArray(r.nonce,r.nonceEnc||"hex"),i=Io.toArray(r.pers,r.persEnc||"hex");vm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var sx=js;js.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},js.prototype._hmac=function(){return new nx.hmac(this.hash,this.K)},js.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},js.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=Io.toArray(e,t),i=Io.toArray(i,n),vm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},js.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=Io.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,Io.encode(a,t)};var ox=Vn.exports,ax=Li,Fd=ax.assert;function Yr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var cx=Yr;Yr.fromPublic=function(e,t,i){return t instanceof Yr?t:new Yr(e,{pub:t,pubEnc:i})},Yr.fromPrivate=function(e,t,i){return t instanceof Yr?t:new Yr(e,{priv:t,privEnc:i})},Yr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Yr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Yr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Yr.prototype._importPrivate=function(e,t){this.priv=new ox(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Yr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Fd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Fd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Yr.prototype.derive=function(e){return e.validate()||Fd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Yr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Yr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Yr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Dl=Vn.exports,Ud=Li,fx=Ud.assert;function Ol(r,e){if(r instanceof Ol)return r;this._importDER(r,e)||(fx(r.r&&r.s,"Signature without r or s"),this.r=new Dl(r.r,16),this.s=new Dl(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var lx=Ol;function hx(){this.place=0}function qd(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function mm(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}Ol.prototype._importDER=function(e,t){e=Ud.toArray(e,t);var i=new hx;if(e[i.place++]!==48)return!1;var n=qd(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=qd(e,i);if(s===!1||e[i.place]&128)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=qd(e,i);if(f===!1||e.length!==f+i.place||e[i.place]&128)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new Dl(a),this.s=new Dl(h),this.recoveryParam=null,!0};function zd(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Ol.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=mm(t),i=mm(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];zd(n,t.length),n=n.concat(t),n.push(2),zd(n,i.length);var s=n.concat(i),a=[48];return zd(a,s.length),a=a.concat(s),Ud.encode(a,e)};var Mo=Vn.exports,bm=sx,ux=Li,kd=Pl,dx=Al.exports,wm=ux.assert,Hd=cx,Rl=lx;function Xi(r){if(!(this instanceof Xi))return new Xi(r);typeof r=="string"&&(wm(Object.prototype.hasOwnProperty.call(kd,r),"Unknown curve "+r),r=kd[r]),r instanceof kd.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var px=Xi;Xi.prototype.keyPair=function(e){return new Hd(this,e)},Xi.prototype.keyFromPrivate=function(e,t){return Hd.fromPrivate(this,e,t)},Xi.prototype.keyFromPublic=function(e,t){return Hd.fromPublic(this,e,t)},Xi.prototype.genKeyPair=function(e){e||(e={});for(var t=new bm({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||dx(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new Mo(2));;){var s=new Mo(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Xi.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Xi.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new Mo(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),f=e.toArray("be",s),h=new bm({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new Mo(1)),g=0;;g++){var w=n.k?n.k(g):new Mo(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(u)>=0)){var P=this.g.mul(w);if(!P.isInfinity()){var M=P.getX(),O=M.umod(this.n);if(O.cmpn(0)!==0){var $=w.invm(this.n).mul(O.mul(t.getPrivate()).iadd(e));if($=$.umod(this.n),$.cmpn(0)!==0){var W=(P.getY().isOdd()?1:0)|(M.cmp(O)!==0?2:0);return n.canonical&&$.cmp(this.nh)>0&&($=this.n.sub($),W^=1),new Rl({r:O,s:$,recoveryParam:W})}}}}}},Xi.prototype.verify=function(e,t,i,n){e=this._truncateToN(new Mo(e,16)),i=this.keyFromPublic(i,n),t=new Rl(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),h=f.mul(e).umod(this.n),u=f.mul(s).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.eqXToP(s)):(g=this.g.mulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.getX().umod(this.n).cmp(s)===0)},Xi.prototype.recoverPubKey=function(r,e,t,i){wm((3&t)===t,"The recovery param is more than two bits"),e=new Rl(e,i);var n=this.n,s=new Mo(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),P=f.mul(g).umod(n);return this.g.mulAdd(w,a,P)},Xi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Rl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var Hc=Li,ym=Hc.assert,_m=Hc.parseBytes,$a=Hc.cachedProperty;function $r(r,e){this.eddsa=r,this._secret=_m(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=_m(e.pub)}$r.fromPublic=function(e,t){return t instanceof $r?t:new $r(e,{pub:t})},$r.fromSecret=function(e,t){return t instanceof $r?t:new $r(e,{secret:t})},$r.prototype.secret=function(){return this._secret},$a($r,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),$a($r,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),$a($r,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),$a($r,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),$a($r,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),$a($r,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),$r.prototype.sign=function(e){return ym(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},$r.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},$r.prototype.getSecret=function(e){return ym(this._secret,"KeyPair is public only"),Hc.encode(this.secret(),e)},$r.prototype.getPublic=function(e){return Hc.encode(this.pubBytes(),e)};var gx=$r,vx=Vn.exports,Tl=Li,xm=Tl.assert,$l=Tl.cachedProperty,mx=Tl.parseBytes;function Co(r,e){this.eddsa=r,typeof e!="object"&&(e=mx(e)),Array.isArray(e)&&(xm(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),xm(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof vx&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}$l(Co,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),$l(Co,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),$l(Co,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),$l(Co,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Co.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Co.prototype.toHex=function(){return Tl.encode(this.toBytes(),"hex").toUpperCase()};var bx=Co,wx=Ri,yx=Pl,Na=Li,_x=Na.assert,Am=Na.parseBytes,Em=gx,Sm=bx;function mi(r){if(_x(r==="ed25519","only tested with ed25519 so far"),!(this instanceof mi))return new mi(r);r=yx[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=wx.sha512}var xx=mi;mi.prototype.sign=function(e,t){e=Am(e);var i=this.keyFromSecret(t),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),a=this.encodePoint(s),f=this.hashInt(a,i.pubBytes(),e).mul(i.priv()),h=n.add(f).umod(this.curve.n);return this.makeSignature({R:s,S:h,Rencoded:a})},mi.prototype.verify=function(e,t,i){if(e=Am(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S()),f=t.R().add(n.pub().mul(s));return f.eq(a)},mi.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Na.intFromLE(e.digest()).umod(this.curve.n)},mi.prototype.keyFromPublic=function(e){return Em.fromPublic(this,e)},mi.prototype.keyFromSecret=function(e){return Em.fromSecret(this,e)},mi.prototype.makeSignature=function(e){return e instanceof Sm?e:new Sm(this,e)},mi.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},mi.prototype.decodePoint=function(e){e=Na.parseBytes(e);var t=e.length-1,i=e.slice(0,t).concat(e[t]&-129),n=(e[t]&128)!==0,s=Na.intFromLE(i);return this.curve.pointFromY(s,n)},mi.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},mi.prototype.decodeInt=function(e){return Na.intFromLE(e)},mi.prototype.isPoint=function(e){return e instanceof this.pointClass},function(r){var e=r;e.version=V9.version,e.utils=Li,e.rand=Al.exports,e.curve=Nd,e.curves=Pl,e.ec=px,e.eddsa=xx}(hm);var jd={},Im={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=$i;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.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 f.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},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,P=u<<3,M=u%128<112?128:256;this._buffer[g]=128;for(var O=g+1;O<M-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,M-8),e.writeUint32BE(P,this._buffer,M-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,M),this._finished=!0}for(var O=0;O<this.digestLength/8;O++)e.writeUint32BE(this._stateHi[O],h,O*8),e.writeUint32BE(this._stateLo[O],h,O*8+4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.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}},f.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},f.prototype.cleanSavedState=function(h){t.wipe(h.stateHi),t.wipe(h.stateLo),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA512=i;var n=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(f,h,u,g,w,P,M){for(var O=u[0],$=u[1],W=u[2],k=u[3],F=u[4],Y=u[5],B=u[6],z=u[7],j=g[0],_=g[1],U=g[2],ee=g[3],oe=g[4],L=g[5],b=g[6],m=g[7],l,d,y,C,D,S,v,A;M>=128;){for(var x=0;x<16;x++){var N=8*x+P;f[x]=e.readUint32BE(w,N),h[x]=e.readUint32BE(w,N+4)}for(var x=0;x<80;x++){var ae=O,R=$,X=W,V=k,J=F,K=Y,E=B,G=z,re=j,le=_,he=U,ge=ee,ke=oe,Te=L,Ce=b,Xe=m;if(l=z,d=m,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=(F>>>14|oe<<32-14)^(F>>>18|oe<<32-18)^(oe>>>41-32|F<<32-(41-32)),d=(oe>>>14|F<<32-14)^(oe>>>18|F<<32-18)^(F>>>41-32|oe<<32-(41-32)),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=F&Y^~F&B,d=oe&L^~oe&b,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=n[x*2],d=n[x*2+1],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=f[x%16],d=h[x%16],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,y=v&65535|A<<16,C=D&65535|S<<16,l=y,d=C,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=(O>>>28|j<<32-28)^(j>>>34-32|O<<32-(34-32))^(j>>>39-32|O<<32-(39-32)),d=(j>>>28|O<<32-28)^(O>>>34-32|j<<32-(34-32))^(O>>>39-32|j<<32-(39-32)),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=O&$^O&W^$&W,d=j&_^j&U^_&U,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,G=v&65535|A<<16,Xe=D&65535|S<<16,l=V,d=ge,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=y,d=C,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,V=v&65535|A<<16,ge=D&65535|S<<16,$=ae,W=R,k=X,F=V,Y=J,B=K,z=E,O=G,_=re,U=le,ee=he,oe=ge,L=ke,b=Te,m=Ce,j=Xe,x%16===15)for(var N=0;N<16;N++)l=f[N],d=h[N],D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=f[(N+9)%16],d=h[(N+9)%16],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,y=f[(N+1)%16],C=h[(N+1)%16],l=(y>>>1|C<<32-1)^(y>>>8|C<<32-8)^y>>>7,d=(C>>>1|y<<32-1)^(C>>>8|y<<32-8)^(C>>>7|y<<32-7),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,y=f[(N+14)%16],C=h[(N+14)%16],l=(y>>>19|C<<32-19)^(C>>>61-32|y<<32-(61-32))^y>>>6,d=(C>>>19|y<<32-19)^(y>>>61-32|C<<32-(61-32))^(C>>>6|y<<32-6),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,f[N]=v&65535|A<<16,h[N]=D&65535|S<<16}l=O,d=j,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[0],d=g[0],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[0]=O=v&65535|A<<16,g[0]=j=D&65535|S<<16,l=$,d=_,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[1],d=g[1],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[1]=$=v&65535|A<<16,g[1]=_=D&65535|S<<16,l=W,d=U,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[2],d=g[2],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[2]=W=v&65535|A<<16,g[2]=U=D&65535|S<<16,l=k,d=ee,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[3],d=g[3],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[3]=k=v&65535|A<<16,g[3]=ee=D&65535|S<<16,l=F,d=oe,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[4],d=g[4],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[4]=F=v&65535|A<<16,g[4]=oe=D&65535|S<<16,l=Y,d=L,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[5],d=g[5],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[5]=Y=v&65535|A<<16,g[5]=L=D&65535|S<<16,l=B,d=b,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[6],d=g[6],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[6]=B=v&65535|A<<16,g[6]=b=D&65535|S<<16,l=z,d=m,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[7],d=g[7],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[7]=z=v&65535|A<<16,g[7]=m=D&65535|S<<16,P+=128,M-=128}return P}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(Im),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=zs,t=Im,i=$i;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function n(V){const J=new Float64Array(16);if(V)for(let K=0;K<V.length;K++)J[K]=V[K];return J}const s=new Uint8Array(32);s[0]=9;const a=n(),f=n([1]),h=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),w=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),P=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(V,J){for(let K=0;K<16;K++)V[K]=J[K]|0}function O(V){let J=1;for(let K=0;K<16;K++){let E=V[K]+J+65535;J=Math.floor(E/65536),V[K]=E-J*65536}V[0]+=J-1+37*(J-1)}function $(V,J,K){const E=~(K-1);for(let G=0;G<16;G++){const re=E&(V[G]^J[G]);V[G]^=re,J[G]^=re}}function W(V,J){const K=n(),E=n();for(let G=0;G<16;G++)E[G]=J[G];O(E),O(E),O(E);for(let G=0;G<2;G++){K[0]=E[0]-65517;for(let le=1;le<15;le++)K[le]=E[le]-65535-(K[le-1]>>16&1),K[le-1]&=65535;K[15]=E[15]-32767-(K[14]>>16&1);const re=K[15]>>16&1;K[14]&=65535,$(E,K,1-re)}for(let G=0;G<16;G++)V[2*G]=E[G]&255,V[2*G+1]=E[G]>>8}function k(V,J){let K=0;for(let E=0;E<32;E++)K|=V[E]^J[E];return(1&K-1>>>8)-1}function F(V,J){const K=new Uint8Array(32),E=new Uint8Array(32);return W(K,V),W(E,J),k(K,E)}function Y(V){const J=new Uint8Array(32);return W(J,V),J[0]&1}function B(V,J){for(let K=0;K<16;K++)V[K]=J[2*K]+(J[2*K+1]<<8);V[15]&=32767}function z(V,J,K){for(let E=0;E<16;E++)V[E]=J[E]+K[E]}function j(V,J,K){for(let E=0;E<16;E++)V[E]=J[E]-K[E]}function _(V,J,K){let E,G,re=0,le=0,he=0,ge=0,ke=0,Te=0,Ce=0,Xe=0,$e=0,be=0,Pe=0,De=0,ye=0,Ie=0,Oe=0,me=0,Me=0,Be=0,we=0,He=0,We=0,xe=0,Ve=0,Ke=0,Ge=0,mt=0,It=0,Ye=0,Pt=0,Ot=0,Ze=0,rt=K[0],et=K[1],Ne=K[2],it=K[3],tt=K[4],Re=K[5],lt=K[6],ht=K[7],Le=K[8],ut=K[9],nt=K[10],Fe=K[11],st=K[12],Qe=K[13],qe=K[14],dt=K[15];E=J[0],re+=E*rt,le+=E*et,he+=E*Ne,ge+=E*it,ke+=E*tt,Te+=E*Re,Ce+=E*lt,Xe+=E*ht,$e+=E*Le,be+=E*ut,Pe+=E*nt,De+=E*Fe,ye+=E*st,Ie+=E*Qe,Oe+=E*qe,me+=E*dt,E=J[1],le+=E*rt,he+=E*et,ge+=E*Ne,ke+=E*it,Te+=E*tt,Ce+=E*Re,Xe+=E*lt,$e+=E*ht,be+=E*Le,Pe+=E*ut,De+=E*nt,ye+=E*Fe,Ie+=E*st,Oe+=E*Qe,me+=E*qe,Me+=E*dt,E=J[2],he+=E*rt,ge+=E*et,ke+=E*Ne,Te+=E*it,Ce+=E*tt,Xe+=E*Re,$e+=E*lt,be+=E*ht,Pe+=E*Le,De+=E*ut,ye+=E*nt,Ie+=E*Fe,Oe+=E*st,me+=E*Qe,Me+=E*qe,Be+=E*dt,E=J[3],ge+=E*rt,ke+=E*et,Te+=E*Ne,Ce+=E*it,Xe+=E*tt,$e+=E*Re,be+=E*lt,Pe+=E*ht,De+=E*Le,ye+=E*ut,Ie+=E*nt,Oe+=E*Fe,me+=E*st,Me+=E*Qe,Be+=E*qe,we+=E*dt,E=J[4],ke+=E*rt,Te+=E*et,Ce+=E*Ne,Xe+=E*it,$e+=E*tt,be+=E*Re,Pe+=E*lt,De+=E*ht,ye+=E*Le,Ie+=E*ut,Oe+=E*nt,me+=E*Fe,Me+=E*st,Be+=E*Qe,we+=E*qe,He+=E*dt,E=J[5],Te+=E*rt,Ce+=E*et,Xe+=E*Ne,$e+=E*it,be+=E*tt,Pe+=E*Re,De+=E*lt,ye+=E*ht,Ie+=E*Le,Oe+=E*ut,me+=E*nt,Me+=E*Fe,Be+=E*st,we+=E*Qe,He+=E*qe,We+=E*dt,E=J[6],Ce+=E*rt,Xe+=E*et,$e+=E*Ne,be+=E*it,Pe+=E*tt,De+=E*Re,ye+=E*lt,Ie+=E*ht,Oe+=E*Le,me+=E*ut,Me+=E*nt,Be+=E*Fe,we+=E*st,He+=E*Qe,We+=E*qe,xe+=E*dt,E=J[7],Xe+=E*rt,$e+=E*et,be+=E*Ne,Pe+=E*it,De+=E*tt,ye+=E*Re,Ie+=E*lt,Oe+=E*ht,me+=E*Le,Me+=E*ut,Be+=E*nt,we+=E*Fe,He+=E*st,We+=E*Qe,xe+=E*qe,Ve+=E*dt,E=J[8],$e+=E*rt,be+=E*et,Pe+=E*Ne,De+=E*it,ye+=E*tt,Ie+=E*Re,Oe+=E*lt,me+=E*ht,Me+=E*Le,Be+=E*ut,we+=E*nt,He+=E*Fe,We+=E*st,xe+=E*Qe,Ve+=E*qe,Ke+=E*dt,E=J[9],be+=E*rt,Pe+=E*et,De+=E*Ne,ye+=E*it,Ie+=E*tt,Oe+=E*Re,me+=E*lt,Me+=E*ht,Be+=E*Le,we+=E*ut,He+=E*nt,We+=E*Fe,xe+=E*st,Ve+=E*Qe,Ke+=E*qe,Ge+=E*dt,E=J[10],Pe+=E*rt,De+=E*et,ye+=E*Ne,Ie+=E*it,Oe+=E*tt,me+=E*Re,Me+=E*lt,Be+=E*ht,we+=E*Le,He+=E*ut,We+=E*nt,xe+=E*Fe,Ve+=E*st,Ke+=E*Qe,Ge+=E*qe,mt+=E*dt,E=J[11],De+=E*rt,ye+=E*et,Ie+=E*Ne,Oe+=E*it,me+=E*tt,Me+=E*Re,Be+=E*lt,we+=E*ht,He+=E*Le,We+=E*ut,xe+=E*nt,Ve+=E*Fe,Ke+=E*st,Ge+=E*Qe,mt+=E*qe,It+=E*dt,E=J[12],ye+=E*rt,Ie+=E*et,Oe+=E*Ne,me+=E*it,Me+=E*tt,Be+=E*Re,we+=E*lt,He+=E*ht,We+=E*Le,xe+=E*ut,Ve+=E*nt,Ke+=E*Fe,Ge+=E*st,mt+=E*Qe,It+=E*qe,Ye+=E*dt,E=J[13],Ie+=E*rt,Oe+=E*et,me+=E*Ne,Me+=E*it,Be+=E*tt,we+=E*Re,He+=E*lt,We+=E*ht,xe+=E*Le,Ve+=E*ut,Ke+=E*nt,Ge+=E*Fe,mt+=E*st,It+=E*Qe,Ye+=E*qe,Pt+=E*dt,E=J[14],Oe+=E*rt,me+=E*et,Me+=E*Ne,Be+=E*it,we+=E*tt,He+=E*Re,We+=E*lt,xe+=E*ht,Ve+=E*Le,Ke+=E*ut,Ge+=E*nt,mt+=E*Fe,It+=E*st,Ye+=E*Qe,Pt+=E*qe,Ot+=E*dt,E=J[15],me+=E*rt,Me+=E*et,Be+=E*Ne,we+=E*it,He+=E*tt,We+=E*Re,xe+=E*lt,Ve+=E*ht,Ke+=E*Le,Ge+=E*ut,mt+=E*nt,It+=E*Fe,Ye+=E*st,Pt+=E*Qe,Ot+=E*qe,Ze+=E*dt,re+=38*Me,le+=38*Be,he+=38*we,ge+=38*He,ke+=38*We,Te+=38*xe,Ce+=38*Ve,Xe+=38*Ke,$e+=38*Ge,be+=38*mt,Pe+=38*It,De+=38*Ye,ye+=38*Pt,Ie+=38*Ot,Oe+=38*Ze,G=1,E=re+G+65535,G=Math.floor(E/65536),re=E-G*65536,E=le+G+65535,G=Math.floor(E/65536),le=E-G*65536,E=he+G+65535,G=Math.floor(E/65536),he=E-G*65536,E=ge+G+65535,G=Math.floor(E/65536),ge=E-G*65536,E=ke+G+65535,G=Math.floor(E/65536),ke=E-G*65536,E=Te+G+65535,G=Math.floor(E/65536),Te=E-G*65536,E=Ce+G+65535,G=Math.floor(E/65536),Ce=E-G*65536,E=Xe+G+65535,G=Math.floor(E/65536),Xe=E-G*65536,E=$e+G+65535,G=Math.floor(E/65536),$e=E-G*65536,E=be+G+65535,G=Math.floor(E/65536),be=E-G*65536,E=Pe+G+65535,G=Math.floor(E/65536),Pe=E-G*65536,E=De+G+65535,G=Math.floor(E/65536),De=E-G*65536,E=ye+G+65535,G=Math.floor(E/65536),ye=E-G*65536,E=Ie+G+65535,G=Math.floor(E/65536),Ie=E-G*65536,E=Oe+G+65535,G=Math.floor(E/65536),Oe=E-G*65536,E=me+G+65535,G=Math.floor(E/65536),me=E-G*65536,re+=G-1+37*(G-1),G=1,E=re+G+65535,G=Math.floor(E/65536),re=E-G*65536,E=le+G+65535,G=Math.floor(E/65536),le=E-G*65536,E=he+G+65535,G=Math.floor(E/65536),he=E-G*65536,E=ge+G+65535,G=Math.floor(E/65536),ge=E-G*65536,E=ke+G+65535,G=Math.floor(E/65536),ke=E-G*65536,E=Te+G+65535,G=Math.floor(E/65536),Te=E-G*65536,E=Ce+G+65535,G=Math.floor(E/65536),Ce=E-G*65536,E=Xe+G+65535,G=Math.floor(E/65536),Xe=E-G*65536,E=$e+G+65535,G=Math.floor(E/65536),$e=E-G*65536,E=be+G+65535,G=Math.floor(E/65536),be=E-G*65536,E=Pe+G+65535,G=Math.floor(E/65536),Pe=E-G*65536,E=De+G+65535,G=Math.floor(E/65536),De=E-G*65536,E=ye+G+65535,G=Math.floor(E/65536),ye=E-G*65536,E=Ie+G+65535,G=Math.floor(E/65536),Ie=E-G*65536,E=Oe+G+65535,G=Math.floor(E/65536),Oe=E-G*65536,E=me+G+65535,G=Math.floor(E/65536),me=E-G*65536,re+=G-1+37*(G-1),V[0]=re,V[1]=le,V[2]=he,V[3]=ge,V[4]=ke,V[5]=Te,V[6]=Ce,V[7]=Xe,V[8]=$e,V[9]=be,V[10]=Pe,V[11]=De,V[12]=ye,V[13]=Ie,V[14]=Oe,V[15]=me}function U(V,J){_(V,J,J)}function ee(V,J){const K=n();let E;for(E=0;E<16;E++)K[E]=J[E];for(E=253;E>=0;E--)U(K,K),E!==2&&E!==4&&_(K,K,J);for(E=0;E<16;E++)V[E]=K[E]}function oe(V,J){const K=n();let E;for(E=0;E<16;E++)K[E]=J[E];for(E=250;E>=0;E--)U(K,K),E!==1&&_(K,K,J);for(E=0;E<16;E++)V[E]=K[E]}function L(V,J){const K=n(),E=n(),G=n(),re=n(),le=n(),he=n(),ge=n(),ke=n(),Te=n();j(K,V[1],V[0]),j(Te,J[1],J[0]),_(K,K,Te),z(E,V[0],V[1]),z(Te,J[0],J[1]),_(E,E,Te),_(G,V[3],J[3]),_(G,G,u),_(re,V[2],J[2]),z(re,re,re),j(le,E,K),j(he,re,G),z(ge,re,G),z(ke,E,K),_(V[0],le,he),_(V[1],ke,ge),_(V[2],ge,he),_(V[3],le,ke)}function b(V,J,K){for(let E=0;E<4;E++)$(V[E],J[E],K)}function m(V,J){const K=n(),E=n(),G=n();ee(G,J[2]),_(K,J[0],G),_(E,J[1],G),W(V,E),V[31]^=Y(K)<<7}function l(V,J,K){M(V[0],a),M(V[1],f),M(V[2],f),M(V[3],a);for(let E=255;E>=0;--E){const G=K[E/8|0]>>(E&7)&1;b(V,J,G),L(J,V),L(V,V),b(V,J,G)}}function d(V,J){const K=[n(),n(),n(),n()];M(K[0],g),M(K[1],w),M(K[2],f),_(K[3],g,w),l(V,K,J)}function y(V){if(V.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const J=(0,t.hash)(V);J[0]&=248,J[31]&=127,J[31]|=64;const K=new Uint8Array(32),E=[n(),n(),n(),n()];d(E,J),m(K,E);const G=new Uint8Array(64);return G.set(V),G.set(K,32),{publicKey:K,secretKey:G}}r.generateKeyPairFromSeed=y;function C(V){const J=(0,e.randomBytes)(32,V),K=y(J);return(0,i.wipe)(J),K}r.generateKeyPair=C;function D(V){if(V.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(V.subarray(32))}r.extractPublicKeyFromSecretKey=D;const S=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 v(V,J){let K,E,G,re;for(E=63;E>=32;--E){for(K=0,G=E-32,re=E-12;G<re;++G)J[G]+=K-16*J[E]*S[G-(E-32)],K=Math.floor((J[G]+128)/256),J[G]-=K*256;J[G]+=K,J[E]=0}for(K=0,G=0;G<32;G++)J[G]+=K-(J[31]>>4)*S[G],K=J[G]>>8,J[G]&=255;for(G=0;G<32;G++)J[G]-=K*S[G];for(E=0;E<32;E++)J[E+1]+=J[E]>>8,V[E]=J[E]&255}function A(V){const J=new Float64Array(64);for(let K=0;K<64;K++)J[K]=V[K];for(let K=0;K<64;K++)V[K]=0;v(V,J)}function x(V,J){const K=new Float64Array(64),E=[n(),n(),n(),n()],G=(0,t.hash)(V.subarray(0,32));G[0]&=248,G[31]&=127,G[31]|=64;const re=new Uint8Array(64);re.set(G.subarray(32),32);const le=new t.SHA512;le.update(re.subarray(32)),le.update(J);const he=le.digest();le.clean(),A(he),d(E,he),m(re,E),le.reset(),le.update(re.subarray(0,32)),le.update(V.subarray(32)),le.update(J);const ge=le.digest();A(ge);for(let ke=0;ke<32;ke++)K[ke]=he[ke];for(let ke=0;ke<32;ke++)for(let Te=0;Te<32;Te++)K[ke+Te]+=ge[ke]*G[Te];return v(re.subarray(32),K),re}r.sign=x;function N(V,J){const K=n(),E=n(),G=n(),re=n(),le=n(),he=n(),ge=n();return M(V[2],f),B(V[1],J),U(G,V[1]),_(re,G,h),j(G,G,V[2]),z(re,V[2],re),U(le,re),U(he,le),_(ge,he,le),_(K,ge,G),_(K,K,re),oe(K,K),_(K,K,G),_(K,K,re),_(K,K,re),_(V[0],K,re),U(E,V[0]),_(E,E,re),F(E,G)&&_(V[0],V[0],P),U(E,V[0]),_(E,E,re),F(E,G)?-1:(Y(V[0])===J[31]>>7&&j(V[0],a,V[0]),_(V[3],V[0],V[1]),0)}function ae(V,J,K){const E=new Uint8Array(32),G=[n(),n(),n(),n()],re=[n(),n(),n(),n()];if(K.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(N(re,V))return!1;const le=new t.SHA512;le.update(K.subarray(0,32)),le.update(V),le.update(J);const he=le.digest();return A(he),l(G,re,he),d(re,K.subarray(32)),L(G,re),m(E,G),!k(K,E)}r.verify=ae;function R(V){let J=[n(),n(),n(),n()];if(N(J,V))throw new Error("Ed25519: invalid public key");let K=n(),E=n(),G=J[1];z(K,f,G),j(E,f,G),ee(E,E),_(K,K,E);let re=new Uint8Array(32);return W(re,K),re}r.convertPublicKeyToX25519=R;function X(V){const J=(0,t.hash)(V.subarray(0,32));J[0]&=248,J[31]&=127,J[31]|=64;const K=new Uint8Array(J.subarray(0,32));return(0,i.wipe)(J),K}r.convertSecretKeyToX25519=X}(jd);const Ax="EdDSA",Ex="JWT",Nl=".",Ll="base64url",Mm="utf8",Cm="utf8",Sx=":",Ix="did",Mx="key",Pm="base58btc",Cx="z",Px="K36",Dx=32;function Wd(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Dm(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Wd(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ox(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=Dm(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return Wd(t)}function Om(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Rm=Om("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Kd=Om("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Dm(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Tm={utf8:Rm,"utf-8":Rm,hex:Da.base16,latin1:Kd,ascii:Kd,binary:Kd,...Da};function Bl(r,e="utf8"){const t=Tm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function La(r,e="utf8"){const t=Tm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wd(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const Rx=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),Tx=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function Po(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return Tx(r)}catch{return r}}function bs(r){return typeof r=="string"?r:Rx(r)||""}function $m(r){return Po(Bl(La(r,Ll),Mm))}function Fl(r){return Bl(La(bs(r),Mm),Ll)}function Nm(r){const e=La(Px,Pm),t=Cx+Bl(Ox([e,r]),Pm);return[Ix,Mx,t].join(Sx)}function $x(r){return Bl(r,Ll)}function Nx(r){return La(r,Ll)}function Lx(r){return La([Fl(r.header),Fl(r.payload)].join(Nl),Cm)}function Bx(r){return[Fl(r.header),Fl(r.payload),$x(r.signature)].join(Nl)}function Vd(r){const e=r.split(Nl),t=$m(e[0]),i=$m(e[1]),n=Nx(e[2]),s=La(e.slice(0,2).join(Nl),Cm);return{header:t,payload:i,signature:n,data:s}}function Lm(r=zs.randomBytes(Dx)){return jd.generateKeyPairFromSeed(r)}async function Fx(r,e,t,i,n=Ae.fromMiliseconds(Date.now())){const s={alg:Ax,typ:Ex},a=Nm(i.publicKey),f=n+t,h={iss:a,sub:r,aud:e,iat:n,exp:f},u=Lx({header:s,payload:h}),g=jd.sign(i.secretKey,u);return Bx({header:s,payload:h,signature:g})}const Ux={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},qx=":";function Ba(r){const[e,t]=r.split(qx);return{namespace:e,reference:t}}function Bm(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const n=r[i];t.push(...n.accounts)}),t}function Fm(r,e){return r.includes(":")?[r]:e.chains||[]}var zx=Object.defineProperty,Um=Object.getOwnPropertySymbols,kx=Object.prototype.hasOwnProperty,Hx=Object.prototype.propertyIsEnumerable,qm=(r,e,t)=>e in r?zx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zm=(r,e)=>{for(var t in e||(e={}))kx.call(e,t)&&qm(r,t,e[t]);if(Um)for(var t of Um(e))Hx.call(e,t)&&qm(r,t,e[t]);return r};const jx="ReactNative",Bi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Wx="js";function Ul(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Fa(){return!Dc()&&!!Yu()&&navigator.product===jx}function jc(){return!Ul()&&!!Yu()&&!!Dc()}function Wc(){return Fa()?Bi.reactNative:Ul()?Bi.node:jc()?Bi.browser:Bi.unknown}function Kx(){var r;try{return Fa()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function Vx(r,e){let t=Oc.parse(r);return t=zm(zm({},t),e),r=Oc.stringify(t),r}function km(){return Mg()||{name:"",description:"",url:"",icons:[""]}}function Gx(){if(Wc()===Bi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const r=r5();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function Yx(){var r;const e=Wc();return e===Bi.browser?[e,((r=Ig())==null?void 0:r.host)||"unknown"].join(":"):e}function Hm(r,e,t){const i=Gx(),n=Yx();return[[r,e].join("-"),[Wx,t].join("-"),i,n].join("/")}function Jx({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:a,bundleId:f}){const h=t.split("?"),u=Hm(r,e,i),g={auth:n,ua:u,projectId:s,useOnCloseEvent:a||void 0,origin:f||void 0},w=Vx(h[1]||"",g);return h[0]+"?"+w}function Do(r,e){return r.filter(t=>e.includes(t)).length===r.length}function jm(r){return Object.fromEntries(r.entries())}function Wm(r){return new Map(Object.entries(r))}function Oo(r=Ae.FIVE_MINUTES,e){const t=Ae.toMiliseconds(r||Ae.FIVE_MINUTES);let i,n,s;return{resolve:a=>{s&&i&&(clearTimeout(s),i(a))},reject:a=>{s&&n&&(clearTimeout(s),n(a))},done:()=>new Promise((a,f)=>{s=setTimeout(()=>{f(new Error(e))},t),i=a,n=f})}}function Ua(r,e,t){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(t)),e);try{const a=await r;i(a)}catch(a){n(a)}clearTimeout(s)})}function Km(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function Qx(r){return Km("topic",r)}function Zx(r){return Km("id",r)}function Vm(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Ir(r,e){return Ae.fromMiliseconds((e||Date.now())+Ae.toMiliseconds(r))}function Ws(r){return Date.now()>=Ae.toMiliseconds(r)}function Dt(r,e){return`${r}${e?`:${e}`:""}`}function ql(r=[],e=[]){return[...new Set([...r,...e])]}async function Xx({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t,s=n?.href;if(typeof s!="string")return;const a=eA(s,r,e),f=Wc();if(f===Bi.browser){if(!((i=Dc())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,rA()?"_blank":"_self","noreferrer noopener")}else f===Bi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}function eA(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${iA(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function tA(r,e){let t="";try{if(jc()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function Gm(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function Ym(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Gd(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function rA(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function iA(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function Jm(r){return Buffer.from(r,"base64").toString("utf-8")}const nA="https://rpc.walletconnect.org/v1";async function sA(r,e,t,i,n,s){switch(t.t){case"eip191":return oA(r,e,t.s);case"eip1271":return await aA(r,e,t.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function oA(r,e,t){return I_(iv(e),t).toLowerCase()===r.toLowerCase()}async function aA(r,e,t,i,n,s){const a=Ba(i);if(!a.namespace||!a.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const f="0x1626ba7e",h="0000000000000000000000000000000000000000000000000000000000000040",u="0000000000000000000000000000000000000000000000000000000000000041",g=t.substring(2),w=iv(e).substring(2),P=f+w+h+u+g,M=await fetch(`${s||nA}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:cA(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:P},"latest"]})}),{result:O}=await M.json();return O?O.slice(0,f.length).toLowerCase()===f.toLowerCase():!1}catch(f){return console.error("isValidEip1271Signature: ",f),!1}}function cA(){return Date.now()+Math.floor(Math.random()*1e3)}var fA=Object.defineProperty,lA=Object.defineProperties,hA=Object.getOwnPropertyDescriptors,Qm=Object.getOwnPropertySymbols,uA=Object.prototype.hasOwnProperty,dA=Object.prototype.propertyIsEnumerable,Zm=(r,e,t)=>e in r?fA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pA=(r,e)=>{for(var t in e||(e={}))uA.call(e,t)&&Zm(r,t,e[t]);if(Qm)for(var t of Qm(e))dA.call(e,t)&&Zm(r,t,e[t]);return r},gA=(r,e)=>lA(r,hA(e));const vA="did:pkh:",Yd=r=>r?.split(":"),mA=r=>{const e=r&&Yd(r);if(e)return r.includes(vA)?e[3]:e[1]},Jd=r=>{const e=r&&Yd(r);if(e)return e[2]+":"+e[3]},zl=r=>{const e=r&&Yd(r);if(e)return e.pop()};async function Xm(r){const{cacao:e,projectId:t}=r,{s:i,p:n}=e,s=eb(n,n.iss),a=zl(n.iss);return await sA(a,s,i,Jd(n.iss),t)}const eb=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=zl(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,a=`Version: ${r.version}`,f=`Chain ID: ${mA(e)}`,h=`Nonce: ${r.nonce}`,u=`Issued At: ${r.iat}`,g=r.exp?`Expiration Time: ${r.exp}`:void 0,w=r.nbf?`Not Before: ${r.nbf}`:void 0,P=r.requestId?`Request ID: ${r.requestId}`:void 0,M=r.resources?`Resources:${r.resources.map($=>`
23
- - ${$}`).join("")}`:void 0,O=kl(r.resources);if(O){const $=Kc(O);n=IA(n,$)}return[t,i,"",n,"",s,a,f,h,u,g,w,P,M].filter($=>$!=null).join(`
24
- `)};function bA(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function wA(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function Ro(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(a=>{if(typeof a!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${a}`)})})})}function yA(r,e,t,i={}){return t?.sort((n,s)=>n.localeCompare(s)),{att:{[r]:_A(e,t,i)}}}function _A(r,e,t={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${r}/${n}`]:[t]}));return Object.assign({},...i)}function tb(r){return Ro(r),`urn:recap:${bA(r).replace(/=/g,"")}`}function Kc(r){const e=wA(r.replace("urn:recap:",""));return Ro(e),e}function xA(r,e,t){const i=yA(r,e,t);return tb(i)}function AA(r){return r&&r.includes("urn:recap:")}function EA(r,e){const t=Kc(r),i=Kc(e),n=SA(t,i);return tb(n)}function SA(r,e){Ro(r),Ro(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return t.forEach(n=>{var s,a;Object.keys(((s=r.att)==null?void 0:s[n])||{}).concat(Object.keys(((a=e.att)==null?void 0:a[n])||{})).sort((f,h)=>f.localeCompare(h)).forEach(f=>{var h,u;i.att[n]=gA(pA({},i.att[n]),{[f]:((h=r.att[n])==null?void 0:h[f])||((u=e.att[n])==null?void 0:u[f])})})}),i}function IA(r="",e){Ro(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let n=0;Object.keys(e.att).forEach(f=>{const h=Object.keys(e.att[f]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));h.sort((w,P)=>w.action.localeCompare(P.action));const u={};h.forEach(w=>{u[w.ability]||(u[w.ability]=[]),u[w.ability].push(w.action)});const g=Object.keys(u).map(w=>(n++,`(${n}) '${w}': '${u[w].join("', '")}' for '${f}'.`));i.push(g.join(", ").replace(".,","."))});const s=i.join(" "),a=`${t}${s}`;return`${r?r+" ":""}${a}`}function rb(r){var e;const t=Kc(r);Ro(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function ib(r){const e=Kc(r);Ro(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&t.push(n[0].chains)})}),[...new Set(t.flat())]}function kl(r){if(!r)return;const e=r?.[r.length-1];return AA(e)?e:void 0}const nb="base10",si="base16",Ks="base64pad",Vc="base64url",Gc="utf8",sb=0,ws=1,Yc=2,MA=0,ob=1,Jc=12,Qd=32;function CA(){const r=Cd.generateKeyPair();return{privateKey:Ni(r.secretKey,si),publicKey:Ni(r.publicKey,si)}}function Zd(){const r=zs.randomBytes(Qd);return Ni(r,si)}function PA(r,e){const t=Cd.sharedKey(Ji(r,si),Ji(e,si),!0),i=new o7(qc.SHA256,t).expand(Qd);return Ni(i,si)}function Hl(r){const e=qc.hash(Ji(r,si));return Ni(e,si)}function ys(r){const e=qc.hash(Ji(r,Gc));return Ni(e,si)}function ab(r){return Ji(`${r}`,nb)}function To(r){return Number(Ni(r,nb))}function DA(r){const e=ab(typeof r.type<"u"?r.type:sb);if(To(e)===ws&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Ji(r.senderPublicKey,si):void 0,i=typeof r.iv<"u"?Ji(r.iv,si):zs.randomBytes(Jc),n=new _d.ChaCha20Poly1305(Ji(r.symKey,si)).seal(i,Ji(r.message,Gc));return cb({type:e,sealed:n,iv:i,senderPublicKey:t,encoding:r.encoding})}function OA(r,e){const t=ab(Yc),i=zs.randomBytes(Jc),n=Ji(r,Gc);return cb({type:t,sealed:n,iv:i,encoding:e})}function RA(r){const e=new _d.ChaCha20Poly1305(Ji(r.symKey,si)),{sealed:t,iv:i}=Qc({encoded:r.encoded,encoding:r?.encoding}),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return Ni(n,Gc)}function TA(r,e){const{sealed:t}=Qc({encoded:r,encoding:e});return Ni(t,Gc)}function cb(r){const{encoding:e=Ks}=r;if(To(r.type)===Yc)return Ni(Pd([r.type,r.sealed]),e);if(To(r.type)===ws){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ni(Pd([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return Ni(Pd([r.type,r.iv,r.sealed]),e)}function Qc(r){const{encoded:e,encoding:t=Ks}=r,i=Ji(e,t),n=i.slice(MA,ob),s=ob;if(To(n)===ws){const u=s+Qd,g=u+Jc,w=i.slice(s,u),P=i.slice(u,g),M=i.slice(g);return{type:n,sealed:M,iv:P,senderPublicKey:w}}if(To(n)===Yc){const u=i.slice(s),g=zs.randomBytes(Jc);return{type:n,sealed:u,iv:g}}const a=s+Jc,f=i.slice(s,a),h=i.slice(a);return{type:n,sealed:h,iv:f}}function $A(r,e){const t=Qc({encoded:r,encoding:e?.encoding});return fb({type:To(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?Ni(t.senderPublicKey,si):void 0,receiverPublicKey:e?.receiverPublicKey})}function fb(r){const e=r?.type||sb;if(e===ws){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function lb(r){return r.type===ws&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function hb(r){return r.type===Yc}function NA(r){return new hm.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function LA(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function BA(r){return Buffer.from(LA(r),"base64")}function FA(r,e){const[t,i,n]=r.split("."),s=BA(n);if(s.length!==64)throw new Error("Invalid signature length");const a=s.slice(0,32).toString("hex"),f=s.slice(32,64).toString("hex"),h=`${t}.${i}`,u=new qc.SHA256().update(Buffer.from(h)).digest(),g=NA(e),w=Buffer.from(u).toString("hex");if(!g.verify(w,{r:a,s:f}))throw new Error("Invalid signature");return Vd(r).payload}const UA="irn";function Xd(r){return r?.relay||{protocol:UA}}function Zc(r){const e=Ux[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var qA=Object.defineProperty,zA=Object.defineProperties,kA=Object.getOwnPropertyDescriptors,ub=Object.getOwnPropertySymbols,HA=Object.prototype.hasOwnProperty,jA=Object.prototype.propertyIsEnumerable,db=(r,e,t)=>e in r?qA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pb=(r,e)=>{for(var t in e||(e={}))HA.call(e,t)&&db(r,t,e[t]);if(ub)for(var t of ub(e))jA.call(e,t)&&db(r,t,e[t]);return r},WA=(r,e)=>zA(r,kA(e));function KA(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),a=r[n];t[s]=a}}),t}function gb(r){if(!r.includes("wc:")){const h=Jm(r);h!=null&&h.includes("wc:")&&(r=h)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",a=Oc.parse(s),f=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:i,topic:VA(n[0]),version:parseInt(n[1],10),symKey:a.symKey,relay:KA(a),methods:f,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function VA(r){return r.startsWith("//")?r.substring(2):r}function GA(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(n=>{const s=t+e+n;r[n]&&(i[s]=r[n])}),i}function vb(r){return`${r.protocol}:${r.topic}@${r.version}?`+Oc.stringify(pb(WA(pb({symKey:r.symKey},GA(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function jl(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function qa(r){const e=[];return r.forEach(t=>{const[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function YA(r){const e=[];return Object.values(r).forEach(t=>{e.push(...qa(t.accounts))}),e}function JA(r,e){const t=[];return Object.values(r).forEach(i=>{qa(i.accounts).includes(e)&&t.push(...i.methods)}),t}function QA(r,e){const t=[];return Object.values(r).forEach(i=>{qa(i.accounts).includes(e)&&t.push(...i.events)}),t}function e0(r){return r.includes(":")}function Xc(r){return e0(r)?r.split(":")[0]:r}function ZA(r){const e={};return r?.forEach(t=>{const[i,n]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${n}`)}),e}function mb(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=ZA(e);for(const[i,n]of Object.entries(t))n.methods?n.methods=ql(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return t}const XA={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}},eE={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function _e(r,e){const{message:t,code:i}=eE[r];return{message:e?`${t} ${e}`:t,code:i}}function Gt(r,e){const{message:t,code:i}=XA[r];return{message:e?`${t} ${e}`:t,code:i}}function Yn(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function ef(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function oi(r){return typeof r>"u"}function wr(r,e){return e&&oi(r)?!0:typeof r=="string"&&!!r.trim().length}function t0(r,e){return e&&oi(r)?!0:typeof r=="number"&&!isNaN(r)}function tE(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t);let s=!0;return Do(n,i)?(i.forEach(a=>{const{accounts:f,methods:h,events:u}=r.namespaces[a],g=qa(f),w=t[a];(!Do(Fm(a,w),g)||!Do(w.methods,h)||!Do(w.events,u))&&(s=!1)}),s):!1}function Wl(r){return wr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function rE(r){if(wr(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Wl(t)}}return!1}function iE(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(wr(r,!1)){if(e(r))return!0;const t=Jm(r);return e(t)}}catch{}return!1}function nE(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function sE(r){return r?.topic}function oE(r,e){let t=null;return wr(r?.publicKey,!1)||(t=_e("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function bb(r){let e=!0;return Yn(r)?r.length&&(e=r.every(t=>wr(t,!1))):e=!1,e}function aE(r,e,t){let i=null;return Yn(e)&&e.length?e.forEach(n=>{i||Wl(n)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Wl(r)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function cE(r,e,t){let i=null;return Object.entries(r).forEach(([n,s])=>{if(i)return;const a=aE(n,Fm(n,s),`${e} ${t}`);a&&(i=a)}),i}function fE(r,e){let t=null;return Yn(r)?r.forEach(i=>{t||rE(i)||(t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function lE(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=fE(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function hE(r,e){let t=null;return bb(r?.methods)?bb(r?.events)||(t=Gt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Gt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function wb(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=hE(i,`${e}, namespace`);n&&(t=n)}),t}function uE(r,e,t){let i=null;if(r&&ef(r)){const n=wb(r,e);n&&(i=n);const s=cE(r,e,t);s&&(i=s)}else i=_e("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function r0(r,e){let t=null;if(r&&ef(r)){const i=wb(r,e);i&&(t=i);const n=lE(r,e);n&&(t=n)}else t=_e("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function yb(r){return wr(r.protocol,!0)}function dE(r,e){let t=!1;return e&&!r?t=!0:r&&Yn(r)&&r.length&&r.forEach(i=>{t=yb(i)}),t}function pE(r){return typeof r=="number"}function bi(r){return typeof r<"u"&&typeof r!==null}function gE(r){return!(!r||typeof r!="object"||!r.code||!t0(r.code,!1)||!r.message||!wr(r.message,!1))}function vE(r){return!(oi(r)||!wr(r.method,!1))}function mE(r){return!(oi(r)||oi(r.result)&&oi(r.error)||!t0(r.id,!1)||!wr(r.jsonrpc,!1))}function bE(r){return!(oi(r)||!wr(r.name,!1))}function _b(r,e){return!(!Wl(e)||!YA(r).includes(e))}function wE(r,e,t){return wr(t,!1)?JA(r,e).includes(t):!1}function yE(r,e,t){return wr(t,!1)?QA(r,e).includes(t):!1}function xb(r,e,t){let i=null;const n=_E(r),s=xE(e),a=Object.keys(n),f=Object.keys(s),h=Ab(Object.keys(r)),u=Ab(Object.keys(e)),g=h.filter(w=>!u.includes(w));return g.length&&(i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
21
+ */(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",a=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?n=fr:s&&(n=self);var f=!n.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,h=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],P=[1,256,65536,16777216],M=[6,1536,393216,100663296],O=[0,8,16,24],$=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],W=[224,256,384,512],H=[128,256],F=["hex","buffer","arrayBuffer","array","digest"],Y={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),h&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});for(var B=function(R,X,V){return function(J){return new x(R,X,R).update(J)[V]()}},z=function(R,X,V){return function(J,K){return new x(R,X,K).update(J)[V]()}},j=function(R,X,V){return function(J,K,E,G){return l["cshake"+R].update(J,K,E,G)[V]()}},_=function(R,X,V){return function(J,K,E,G){return l["kmac"+R].update(J,K,E,G)[V]()}},U=function(R,X,V,J){for(var K=0;K<F.length;++K){var E=F[K];R[E]=X(V,J,E)}return R},ee=function(R,X){var V=B(R,X,"hex");return V.create=function(){return new x(R,X,R)},V.update=function(J){return V.create().update(J)},U(V,B,R,X)},oe=function(R,X){var V=z(R,X,"hex");return V.create=function(J){return new x(R,X,J)},V.update=function(J,K){return V.create(K).update(J)},U(V,z,R,X)},L=function(R,X){var V=Y[R],J=j(R,X,"hex");return J.create=function(K,E,G){return!E&&!G?l["shake"+R].create(K):new x(R,X,K).bytepad([E,G],V)},J.update=function(K,E,G,re){return J.create(E,G,re).update(K)},U(J,j,R,X)},b=function(R,X){var V=Y[R],J=_(R,X,"hex");return J.create=function(K,E,G){return new N(R,X,E).bytepad(["KMAC",G],V).bytepad([K],V)},J.update=function(K,E,G,re){return J.create(K,G,re).update(E)},U(J,_,R,X)},m=[{name:"keccak",padding:P,bits:W,createMethod:ee},{name:"sha3",padding:M,bits:W,createMethod:ee},{name:"shake",padding:g,bits:H,createMethod:oe},{name:"cshake",padding:w,bits:H,createMethod:L},{name:"kmac",padding:w,bits:H,createMethod:b}],l={},d=[],y=0;y<m.length;++y)for(var C=m[y],D=C.bits,S=0;S<D.length;++S){var v=C.name+"_"+D[S];if(d.push(v),l[v]=C.createMethod(D[S],C.padding),C.name!=="sha3"){var A=C.name+D[S];d.push(A),l[A]=l[v]}}function x(R,X,V){this.blocks=[],this.s=[],this.padding=X,this.outputBits=V,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(R<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=V>>5,this.extraBytes=(V&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}x.prototype.update=function(R){if(this.finalized)throw new Error(t);var X,V=typeof R;if(V!=="string"){if(V==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);X=!0}for(var J=this.blocks,K=this.byteCount,E=R.length,G=this.blockCount,re=0,le=this.s,he,ge;re<E;){if(this.reset)for(this.reset=!1,J[0]=this.block,he=1;he<G+1;++he)J[he]=0;if(X)for(he=this.start;re<E&&he<K;++re)J[he>>2]|=R[re]<<O[he++&3];else for(he=this.start;re<E&&he<K;++re)ge=R.charCodeAt(re),ge<128?J[he>>2]|=ge<<O[he++&3]:ge<2048?(J[he>>2]|=(192|ge>>6)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]):ge<55296||ge>=57344?(J[he>>2]|=(224|ge>>12)<<O[he++&3],J[he>>2]|=(128|ge>>6&63)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]):(ge=65536+((ge&1023)<<10|R.charCodeAt(++re)&1023),J[he>>2]|=(240|ge>>18)<<O[he++&3],J[he>>2]|=(128|ge>>12&63)<<O[he++&3],J[he>>2]|=(128|ge>>6&63)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]);if(this.lastByteIndex=he,he>=K){for(this.start=he-K,this.block=J[G],he=0;he<G;++he)le[he]^=J[he];ae(le),this.reset=!0}else this.start=he}return this},x.prototype.encode=function(R,X){var V=R&255,J=1,K=[V];for(R=R>>8,V=R&255;V>0;)K.unshift(V),R=R>>8,V=R&255,++J;return X?K.push(J):K.unshift(J),this.update(K),K.length},x.prototype.encodeString=function(R){var X,V=typeof R;if(V!=="string"){if(V==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);X=!0}var J=0,K=R.length;if(X)J=K;else for(var E=0;E<R.length;++E){var G=R.charCodeAt(E);G<128?J+=1:G<2048?J+=2:G<55296||G>=57344?J+=3:(G=65536+((G&1023)<<10|R.charCodeAt(++E)&1023),J+=4)}return J+=this.encode(J*8),this.update(R),J},x.prototype.bytepad=function(R,X){for(var V=this.encode(X),J=0;J<R.length;++J)V+=this.encodeString(R[J]);var K=X-V%X,E=[];return E.length=K,this.update(E),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,X=this.lastByteIndex,V=this.blockCount,J=this.s;if(R[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(R[0]=R[V],X=1;X<V+1;++X)R[X]=0;for(R[V-1]|=2147483648,X=0;X<V;++X)J[X]^=R[X];ae(J)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,G="",re;E<V;){for(K=0;K<R&&E<V;++K,++E)re=X[K],G+=u[re>>4&15]+u[re&15]+u[re>>12&15]+u[re>>8&15]+u[re>>20&15]+u[re>>16&15]+u[re>>28&15]+u[re>>24&15];E%R===0&&(ae(X),K=0)}return J&&(re=X[K],G+=u[re>>4&15]+u[re&15],J>1&&(G+=u[re>>12&15]+u[re>>8&15]),J>2&&(G+=u[re>>20&15]+u[re>>16&15])),G},x.prototype.arrayBuffer=function(){this.finalize();var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,G=this.outputBits>>3,re;J?re=new ArrayBuffer(V+1<<2):re=new ArrayBuffer(G);for(var le=new Uint32Array(re);E<V;){for(K=0;K<R&&E<V;++K,++E)le[E]=X[K];E%R===0&&ae(X)}return J&&(le[K]=X[K],re=re.slice(0,G)),re},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,G=[],re,le;E<V;){for(K=0;K<R&&E<V;++K,++E)re=E<<2,le=X[K],G[re]=le&255,G[re+1]=le>>8&255,G[re+2]=le>>16&255,G[re+3]=le>>24&255;E%R===0&&ae(X)}return J&&(re=E<<2,le=X[K],G[re]=le&255,J>1&&(G[re+1]=le>>8&255),J>2&&(G[re+2]=le>>16&255)),G};function N(R,X,V){x.call(this,R,X,V)}N.prototype=new x,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var ae=function(R){var X,V,J,K,E,G,re,le,he,ge,He,Te,Ce,Xe,$e,be,Pe,De,ye,Ie,Oe,me,Me,Be,we,ke,We,xe,Ve,Ke,Ge,mt,It,Ye,Pt,Ot,Ze,rt,et,Ne,it,tt,Re,lt,ht,Le,ut,nt,Fe,st,Qe,qe,dt,Ht,at,kt,_t,qt,Qr,Zr,Xr,ei,vr;for(J=0;J<48;J+=2)K=R[0]^R[10]^R[20]^R[30]^R[40],E=R[1]^R[11]^R[21]^R[31]^R[41],G=R[2]^R[12]^R[22]^R[32]^R[42],re=R[3]^R[13]^R[23]^R[33]^R[43],le=R[4]^R[14]^R[24]^R[34]^R[44],he=R[5]^R[15]^R[25]^R[35]^R[45],ge=R[6]^R[16]^R[26]^R[36]^R[46],He=R[7]^R[17]^R[27]^R[37]^R[47],Te=R[8]^R[18]^R[28]^R[38]^R[48],Ce=R[9]^R[19]^R[29]^R[39]^R[49],X=Te^(G<<1|re>>>31),V=Ce^(re<<1|G>>>31),R[0]^=X,R[1]^=V,R[10]^=X,R[11]^=V,R[20]^=X,R[21]^=V,R[30]^=X,R[31]^=V,R[40]^=X,R[41]^=V,X=K^(le<<1|he>>>31),V=E^(he<<1|le>>>31),R[2]^=X,R[3]^=V,R[12]^=X,R[13]^=V,R[22]^=X,R[23]^=V,R[32]^=X,R[33]^=V,R[42]^=X,R[43]^=V,X=G^(ge<<1|He>>>31),V=re^(He<<1|ge>>>31),R[4]^=X,R[5]^=V,R[14]^=X,R[15]^=V,R[24]^=X,R[25]^=V,R[34]^=X,R[35]^=V,R[44]^=X,R[45]^=V,X=le^(Te<<1|Ce>>>31),V=he^(Ce<<1|Te>>>31),R[6]^=X,R[7]^=V,R[16]^=X,R[17]^=V,R[26]^=X,R[27]^=V,R[36]^=X,R[37]^=V,R[46]^=X,R[47]^=V,X=ge^(K<<1|E>>>31),V=He^(E<<1|K>>>31),R[8]^=X,R[9]^=V,R[18]^=X,R[19]^=V,R[28]^=X,R[29]^=V,R[38]^=X,R[39]^=V,R[48]^=X,R[49]^=V,Xe=R[0],$e=R[1],Le=R[11]<<4|R[10]>>>28,ut=R[10]<<4|R[11]>>>28,xe=R[20]<<3|R[21]>>>29,Ve=R[21]<<3|R[20]>>>29,Zr=R[31]<<9|R[30]>>>23,Xr=R[30]<<9|R[31]>>>23,tt=R[40]<<18|R[41]>>>14,Re=R[41]<<18|R[40]>>>14,Ye=R[2]<<1|R[3]>>>31,Pt=R[3]<<1|R[2]>>>31,be=R[13]<<12|R[12]>>>20,Pe=R[12]<<12|R[13]>>>20,nt=R[22]<<10|R[23]>>>22,Fe=R[23]<<10|R[22]>>>22,Ke=R[33]<<13|R[32]>>>19,Ge=R[32]<<13|R[33]>>>19,ei=R[42]<<2|R[43]>>>30,vr=R[43]<<2|R[42]>>>30,Ht=R[5]<<30|R[4]>>>2,at=R[4]<<30|R[5]>>>2,Ot=R[14]<<6|R[15]>>>26,Ze=R[15]<<6|R[14]>>>26,De=R[25]<<11|R[24]>>>21,ye=R[24]<<11|R[25]>>>21,st=R[34]<<15|R[35]>>>17,Qe=R[35]<<15|R[34]>>>17,mt=R[45]<<29|R[44]>>>3,It=R[44]<<29|R[45]>>>3,Be=R[6]<<28|R[7]>>>4,we=R[7]<<28|R[6]>>>4,kt=R[17]<<23|R[16]>>>9,_t=R[16]<<23|R[17]>>>9,rt=R[26]<<25|R[27]>>>7,et=R[27]<<25|R[26]>>>7,Ie=R[36]<<21|R[37]>>>11,Oe=R[37]<<21|R[36]>>>11,qe=R[47]<<24|R[46]>>>8,dt=R[46]<<24|R[47]>>>8,lt=R[8]<<27|R[9]>>>5,ht=R[9]<<27|R[8]>>>5,ke=R[18]<<20|R[19]>>>12,We=R[19]<<20|R[18]>>>12,qt=R[29]<<7|R[28]>>>25,Qr=R[28]<<7|R[29]>>>25,Ne=R[38]<<8|R[39]>>>24,it=R[39]<<8|R[38]>>>24,me=R[48]<<14|R[49]>>>18,Me=R[49]<<14|R[48]>>>18,R[0]=Xe^~be&De,R[1]=$e^~Pe&ye,R[10]=Be^~ke&xe,R[11]=we^~We&Ve,R[20]=Ye^~Ot&rt,R[21]=Pt^~Ze&et,R[30]=lt^~Le&nt,R[31]=ht^~ut&Fe,R[40]=Ht^~kt&qt,R[41]=at^~_t&Qr,R[2]=be^~De&Ie,R[3]=Pe^~ye&Oe,R[12]=ke^~xe&Ke,R[13]=We^~Ve&Ge,R[22]=Ot^~rt&Ne,R[23]=Ze^~et&it,R[32]=Le^~nt&st,R[33]=ut^~Fe&Qe,R[42]=kt^~qt&Zr,R[43]=_t^~Qr&Xr,R[4]=De^~Ie&me,R[5]=ye^~Oe&Me,R[14]=xe^~Ke&mt,R[15]=Ve^~Ge&It,R[24]=rt^~Ne&tt,R[25]=et^~it&Re,R[34]=nt^~st&qe,R[35]=Fe^~Qe&dt,R[44]=qt^~Zr&ei,R[45]=Qr^~Xr&vr,R[6]=Ie^~me&Xe,R[7]=Oe^~Me&$e,R[16]=Ke^~mt&Be,R[17]=Ge^~It&we,R[26]=Ne^~tt&Ye,R[27]=it^~Re&Pt,R[36]=st^~qe&lt,R[37]=Qe^~dt&ht,R[46]=Zr^~ei&Ht,R[47]=Xr^~vr&at,R[8]=me^~Xe&be,R[9]=Me^~$e&Pe,R[18]=mt^~Be&ke,R[19]=It^~we&We,R[28]=tt^~Ye&Ot,R[29]=Re^~Pt&Ze,R[38]=qe^~lt&Le,R[39]=dt^~ht&ut,R[48]=ei^~Ht&kt,R[49]=vr^~at&_t,R[0]^=$[J],R[1]^=$[J+1]};if(f)r.exports=l;else for(y=0;y<d.length;++y)n[d[y]]=l[d[y]]})()})(Rg);var Z5=Rg.exports;const X5="logger/5.7.0";let Tg=!1,$g=!1;const rl={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ng=rl.default,Zu=null;function e4(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const Lg=e4();var Xu;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(Xu||(Xu={}));var wn;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(wn||(wn={}));const Bg="0123456789abcdef";class xt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();rl[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ng>rl[i])&&console.log.apply(console,t)}debug(...e){this._log(xt.levels.DEBUG,e)}info(...e){this._log(xt.levels.INFO,e)}warn(...e){this._log(xt.levels.WARNING,e)}makeError(e,t,i){if($g)return this.makeError("censored error",t,{});t||(t=xt.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(h=>{const u=i[h];try{if(u instanceof Uint8Array){let g="";for(let w=0;w<u.length;w++)g+=Bg[u[w]>>4],g+=Bg[u[w]&15];n.push(h+"=Uint8Array(0x"+g+")")}else n.push(h+"="+JSON.stringify(u))}catch{n.push(h+"="+JSON.stringify(i[h].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const s=e;let a="";switch(t){case wn.NUMERIC_FAULT:{a="NUMERIC_FAULT";const h=e;switch(h){case"overflow":case"underflow":case"division-by-zero":a+="-"+h;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case wn.CALL_EXCEPTION:case wn.INSUFFICIENT_FUNDS:case wn.MISSING_NEW:case wn.NONCE_EXPIRED:case wn.REPLACEMENT_UNDERPRICED:case wn.TRANSACTION_REPLACED:case wn.UNPREDICTABLE_GAS_LIMIT:a=t;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const f=new Error(e);return f.reason=s,f.code=t,Object.keys(i).forEach(function(h){f[h]=i[h]}),f}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,xt.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,n){e||this.throwError(t,i,n)}assertArgument(e,t,i,n){e||this.throwArgumentError(t,i,n)}checkNormalize(e){Lg&&this.throwError("platform missing String.prototype.normalize",xt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Lg})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,xt.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,xt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",xt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Zu||(Zu=new xt(X5)),Zu}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Tg){if(!e)return;this.globalLogger().throwError("error censorship permanent",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}$g=!!e,Tg=!!t}static setLogLevel(e){const t=rl[e.toLowerCase()];if(t==null){xt.globalLogger().warn("invalid log level - "+e);return}Ng=t}static from(e){return new xt(e)}}xt.errors=wn,xt.levels=Xu;const t4="bytes/5.7.0",br=new xt(t4);function Fg(r){return!!r.toHexString}function ba(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return ba(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function r4(r){return Oi(r)&&!(r.length%2)||wa(r)}function Ug(r){return typeof r=="number"&&r==r&&r%1===0}function wa(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!Ug(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!Ug(t)||t<0||t>=256)return!1}return!0}function ur(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),ba(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Fg(r)&&(r=r.toHexString()),Oi(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":br.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let n=0;n<t.length;n+=2)i.push(parseInt(t.substring(n,n+2),16));return ba(new Uint8Array(i))}return wa(r)?ba(new Uint8Array(r)):br.throwArgumentError("invalid arrayify value","value",r)}function i4(r){const e=r.map(n=>ur(n)),t=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(t);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),ba(i)}function n4(r,e){r=ur(r),r.length>e&&br.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),ba(t)}function Oi(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const ed="0123456789abcdef";function ii(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=ed[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Fg(r))return r.toHexString();if(Oi(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":br.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(wa(r)){let t="0x";for(let i=0;i<r.length;i++){let n=r[i];t+=ed[(n&240)>>4]+ed[n&15]}return t}return br.throwArgumentError("invalid hexlify value","value",r)}function s4(r){if(typeof r!="string")r=ii(r);else if(!Oi(r)||r.length%2)return null;return(r.length-2)/2}function qg(r,e,t){return typeof r!="string"?r=ii(r):(!Oi(r)||r.length%2)&&br.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function Fn(r,e){for(typeof r!="string"?r=ii(r):Oi(r)||br.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&br.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function zg(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(r4(r)){let t=ur(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=ii(t.slice(0,32)),e.s=ii(t.slice(32,64))):t.length===65?(e.r=ii(t.slice(0,32)),e.s=ii(t.slice(32,64)),e.v=t[64]):br.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:br.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=ii(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const n=n4(ur(e._vs),32);e._vs=ii(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&br.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),n[0]&=127;const a=ii(n);e.s==null?e.s=a:e.s!==a&&br.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?br.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&br.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!Oi(e.r)?br.throwArgumentError("signature missing or invalid r","signature",r):e.r=Fn(e.r,32),e.s==null||!Oi(e.s)?br.throwArgumentError("signature missing or invalid s","signature",r):e.s=Fn(e.s,32);const t=ur(e.s);t[0]>=128&&br.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=ii(t);e._vs&&(Oi(e._vs)||br.throwArgumentError("signature invalid _vs","signature",r),e._vs=Fn(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&br.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function td(r){return"0x"+Z5.keccak_256(ur(r))}var Hg={exports:{}},o4={},a4=Object.freeze({__proto__:null,default:o4}),il=zu(a4);(function(r){(function(e,t){function i(m,l){if(!m)throw new Error(l||"Assertion failed")}function n(m,l){m.super_=l;var d=function(){};d.prototype=l.prototype,m.prototype=new d,m.prototype.constructor=m}function s(m,l,d){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((l==="le"||l==="be")&&(d=l,l=10),this._init(m||0,l||10,d||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=il.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,d){return l.cmp(d)>0?l:d},s.min=function(l,d){return l.cmp(d)<0?l:d},s.prototype._init=function(l,d,y){if(typeof l=="number")return this._initNumber(l,d,y);if(typeof l=="object")return this._initArray(l,d,y);d==="hex"&&(d=16),i(d===(d|0)&&d>=2&&d<=36),l=l.toString().replace(/\s+/g,"");var C=0;l[0]==="-"&&(C++,this.negative=1),C<l.length&&(d===16?this._parseHex(l,C,y):(this._parseBase(l,d,C),y==="le"&&this._initArray(this.toArray(),d,y)))},s.prototype._initNumber=function(l,d,y){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(i(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),d,y)},s.prototype._initArray=function(l,d,y){if(i(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var D,S,v=0;if(y==="be")for(C=l.length-1,D=0;C>=0;C-=3)S=l[C]|l[C-1]<<8|l[C-2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);else if(y==="le")for(C=0,D=0;C<l.length;C+=3)S=l[C]|l[C+1]<<8|l[C+2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);return this._strip()};function f(m,l){var d=m.charCodeAt(l);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;i(!1,"Invalid character in "+m)}function h(m,l,d){var y=f(m,d);return d-1>=l&&(y|=f(m,d-1)<<4),y}s.prototype._parseHex=function(l,d,y){this.length=Math.ceil((l.length-d)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var D=0,S=0,v;if(y==="be")for(C=l.length-1;C>=d;C-=2)v=h(l,d,C)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8;else{var A=l.length-d;for(C=A%2===0?d+1:d;C<l.length;C+=2)v=h(l,d,C)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8}this._strip()};function u(m,l,d,y){for(var C=0,D=0,S=Math.min(m.length,d),v=l;v<S;v++){var A=m.charCodeAt(v)-48;C*=y,A>=49?D=A-49+10:A>=17?D=A-17+10:D=A,i(A>=0&&D<y,"Invalid character"),C+=D}return C}s.prototype._parseBase=function(l,d,y){this.words=[0],this.length=1;for(var C=0,D=1;D<=67108863;D*=d)C++;C--,D=D/d|0;for(var S=l.length-y,v=S%C,A=Math.min(S,S-v)+y,x=0,N=y;N<A;N+=C)x=u(l,N,N+C,d),this.imuln(D),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x);if(v!==0){var ae=1;for(x=u(l,N,l.length,d),N=0;N<v;N++)ae*=d;this.imuln(ae),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x)}this._strip()},s.prototype.copy=function(l){l.words=new Array(this.length);for(var d=0;d<this.length;d++)l.words[d]=this.words[d];l.length=this.length,l.negative=this.negative,l.red=this.red};function g(m,l){m.words=l.words,m.length=l.length,m.negative=l.negative,m.red=l.red}if(s.prototype._move=function(l){g(l,this)},s.prototype.clone=function(){var l=new s(null);return this.copy(l),l},s.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{s.prototype.inspect=w}else s.prototype.inspect=w;function w(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var P=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(l,d){l=l||10,d=d|0||1;var y;if(l===16||l==="hex"){y="";for(var C=0,D=0,S=0;S<this.length;S++){var v=this.words[S],A=((v<<C|D)&16777215).toString(16);D=v>>>24-C&16777215,C+=2,C>=26&&(C-=26,S--),D!==0||S!==this.length-1?y=P[6-A.length]+A+y:y=A+y}for(D!==0&&(y=D.toString(16)+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(l===(l|0)&&l>=2&&l<=36){var x=M[l],N=O[l];y="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var R=ae.modrn(N).toString(l);ae=ae.idivn(N),ae.isZero()?y=R+y:y=P[x-R.length]+R+y}for(this.isZero()&&(y="0"+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(l,d){return this.toArrayLike(a,l,d)}),s.prototype.toArray=function(l,d){return this.toArrayLike(Array,l,d)};var $=function(l,d){return l.allocUnsafe?l.allocUnsafe(d):new l(d)};s.prototype.toArrayLike=function(l,d,y){this._strip();var C=this.byteLength(),D=y||Math.max(1,C);i(C<=D,"byte array longer than desired length"),i(D>0,"Requested array length <= 0");var S=$(l,D),v=d==="le"?"LE":"BE";return this["_toArrayLike"+v](S,C),S},s.prototype._toArrayLikeLE=function(l,d){for(var y=0,C=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|C;l[y++]=v&255,y<l.length&&(l[y++]=v>>8&255),y<l.length&&(l[y++]=v>>16&255),S===6?(y<l.length&&(l[y++]=v>>24&255),C=0,S=0):(C=v>>>24,S+=2)}if(y<l.length)for(l[y++]=C;y<l.length;)l[y++]=0},s.prototype._toArrayLikeBE=function(l,d){for(var y=l.length-1,C=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|C;l[y--]=v&255,y>=0&&(l[y--]=v>>8&255),y>=0&&(l[y--]=v>>16&255),S===6?(y>=0&&(l[y--]=v>>24&255),C=0,S=0):(C=v>>>24,S+=2)}if(y>=0)for(l[y--]=C;y>=0;)l[y--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var d=l,y=0;return d>=4096&&(y+=13,d>>>=13),d>=64&&(y+=7,d>>>=7),d>=8&&(y+=4,d>>>=4),d>=2&&(y+=2,d>>>=2),y+d},s.prototype._zeroBits=function(l){if(l===0)return 26;var d=l,y=0;return d&8191||(y+=13,d>>>=13),d&127||(y+=7,d>>>=7),d&15||(y+=4,d>>>=4),d&3||(y+=2,d>>>=2),d&1||y++,y},s.prototype.bitLength=function(){var l=this.words[this.length-1],d=this._countBits(l);return(this.length-1)*26+d};function W(m){for(var l=new Array(m.bitLength()),d=0;d<l.length;d++){var y=d/26|0,C=d%26;l[d]=m.words[y]>>>C&1}return l}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,d=0;d<this.length;d++){var y=this._zeroBits(this.words[d]);if(l+=y,y!==26)break}return l},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},s.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var d=0;d<l.length;d++)this.words[d]=this.words[d]|l.words[d];return this._strip()},s.prototype.ior=function(l){return i((this.negative|l.negative)===0),this.iuor(l)},s.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var d;this.length>l.length?d=l:d=this;for(var y=0;y<d.length;y++)this.words[y]=this.words[y]&l.words[y];return this.length=d.length,this._strip()},s.prototype.iand=function(l){return i((this.negative|l.negative)===0),this.iuand(l)},s.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var d,y;this.length>l.length?(d=this,y=l):(d=l,y=this);for(var C=0;C<y.length;C++)this.words[C]=d.words[C]^y.words[C];if(this!==d)for(;C<d.length;C++)this.words[C]=d.words[C];return this.length=d.length,this._strip()},s.prototype.ixor=function(l){return i((this.negative|l.negative)===0),this.iuxor(l)},s.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){i(typeof l=="number"&&l>=0);var d=Math.ceil(l/26)|0,y=l%26;this._expand(d),y>0&&d--;for(var C=0;C<d;C++)this.words[C]=~this.words[C]&67108863;return y>0&&(this.words[C]=~this.words[C]&67108863>>26-y),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,d){i(typeof l=="number"&&l>=0);var y=l/26|0,C=l%26;return this._expand(y+1),d?this.words[y]=this.words[y]|1<<C:this.words[y]=this.words[y]&~(1<<C),this._strip()},s.prototype.iadd=function(l){var d;if(this.negative!==0&&l.negative===0)return this.negative=0,d=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,d=this.isub(l),l.negative=1,d._normSign();var y,C;this.length>l.length?(y=this,C=l):(y=l,C=this);for(var D=0,S=0;S<C.length;S++)d=(y.words[S]|0)+(C.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;for(;D!==0&&S<y.length;S++)d=(y.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;if(this.length=y.length,D!==0)this.words[this.length]=D,this.length++;else if(y!==this)for(;S<y.length;S++)this.words[S]=y.words[S];return this},s.prototype.add=function(l){var d;return l.negative!==0&&this.negative===0?(l.negative=0,d=this.sub(l),l.negative^=1,d):l.negative===0&&this.negative!==0?(this.negative=0,d=l.sub(this),this.negative=1,d):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var d=this.iadd(l);return l.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var y=this.cmp(l);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var C,D;y>0?(C=this,D=l):(C=l,D=this);for(var S=0,v=0;v<D.length;v++)d=(C.words[v]|0)-(D.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;for(;S!==0&&v<C.length;v++)d=(C.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;if(S===0&&v<C.length&&C!==this)for(;v<C.length;v++)this.words[v]=C.words[v];return this.length=Math.max(this.length,v),C!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(l){return this.clone().isub(l)};function H(m,l,d){d.negative=l.negative^m.negative;var y=m.length+l.length|0;d.length=y,y=y-1|0;var C=m.words[0]|0,D=l.words[0]|0,S=C*D,v=S&67108863,A=S/67108864|0;d.words[0]=v;for(var x=1;x<y;x++){for(var N=A>>>26,ae=A&67108863,R=Math.min(x,l.length-1),X=Math.max(0,x-m.length+1);X<=R;X++){var V=x-X|0;C=m.words[V]|0,D=l.words[X]|0,S=C*D+ae,N+=S/67108864|0,ae=S&67108863}d.words[x]=ae|0,A=N|0}return A!==0?d.words[x]=A|0:d.length--,d._strip()}var F=function(l,d,y){var C=l.words,D=d.words,S=y.words,v=0,A,x,N,ae=C[0]|0,R=ae&8191,X=ae>>>13,V=C[1]|0,J=V&8191,K=V>>>13,E=C[2]|0,G=E&8191,re=E>>>13,le=C[3]|0,he=le&8191,ge=le>>>13,He=C[4]|0,Te=He&8191,Ce=He>>>13,Xe=C[5]|0,$e=Xe&8191,be=Xe>>>13,Pe=C[6]|0,De=Pe&8191,ye=Pe>>>13,Ie=C[7]|0,Oe=Ie&8191,me=Ie>>>13,Me=C[8]|0,Be=Me&8191,we=Me>>>13,ke=C[9]|0,We=ke&8191,xe=ke>>>13,Ve=D[0]|0,Ke=Ve&8191,Ge=Ve>>>13,mt=D[1]|0,It=mt&8191,Ye=mt>>>13,Pt=D[2]|0,Ot=Pt&8191,Ze=Pt>>>13,rt=D[3]|0,et=rt&8191,Ne=rt>>>13,it=D[4]|0,tt=it&8191,Re=it>>>13,lt=D[5]|0,ht=lt&8191,Le=lt>>>13,ut=D[6]|0,nt=ut&8191,Fe=ut>>>13,st=D[7]|0,Qe=st&8191,qe=st>>>13,dt=D[8]|0,Ht=dt&8191,at=dt>>>13,kt=D[9]|0,_t=kt&8191,qt=kt>>>13;y.negative=l.negative^d.negative,y.length=19,A=Math.imul(R,Ke),x=Math.imul(R,Ge),x=x+Math.imul(X,Ke)|0,N=Math.imul(X,Ge);var Qr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,A=Math.imul(J,Ke),x=Math.imul(J,Ge),x=x+Math.imul(K,Ke)|0,N=Math.imul(K,Ge),A=A+Math.imul(R,It)|0,x=x+Math.imul(R,Ye)|0,x=x+Math.imul(X,It)|0,N=N+Math.imul(X,Ye)|0;var Zr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,A=Math.imul(G,Ke),x=Math.imul(G,Ge),x=x+Math.imul(re,Ke)|0,N=Math.imul(re,Ge),A=A+Math.imul(J,It)|0,x=x+Math.imul(J,Ye)|0,x=x+Math.imul(K,It)|0,N=N+Math.imul(K,Ye)|0,A=A+Math.imul(R,Ot)|0,x=x+Math.imul(R,Ze)|0,x=x+Math.imul(X,Ot)|0,N=N+Math.imul(X,Ze)|0;var Xr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,A=Math.imul(he,Ke),x=Math.imul(he,Ge),x=x+Math.imul(ge,Ke)|0,N=Math.imul(ge,Ge),A=A+Math.imul(G,It)|0,x=x+Math.imul(G,Ye)|0,x=x+Math.imul(re,It)|0,N=N+Math.imul(re,Ye)|0,A=A+Math.imul(J,Ot)|0,x=x+Math.imul(J,Ze)|0,x=x+Math.imul(K,Ot)|0,N=N+Math.imul(K,Ze)|0,A=A+Math.imul(R,et)|0,x=x+Math.imul(R,Ne)|0,x=x+Math.imul(X,et)|0,N=N+Math.imul(X,Ne)|0;var ei=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(ei>>>26)|0,ei&=67108863,A=Math.imul(Te,Ke),x=Math.imul(Te,Ge),x=x+Math.imul(Ce,Ke)|0,N=Math.imul(Ce,Ge),A=A+Math.imul(he,It)|0,x=x+Math.imul(he,Ye)|0,x=x+Math.imul(ge,It)|0,N=N+Math.imul(ge,Ye)|0,A=A+Math.imul(G,Ot)|0,x=x+Math.imul(G,Ze)|0,x=x+Math.imul(re,Ot)|0,N=N+Math.imul(re,Ze)|0,A=A+Math.imul(J,et)|0,x=x+Math.imul(J,Ne)|0,x=x+Math.imul(K,et)|0,N=N+Math.imul(K,Ne)|0,A=A+Math.imul(R,tt)|0,x=x+Math.imul(R,Re)|0,x=x+Math.imul(X,tt)|0,N=N+Math.imul(X,Re)|0;var vr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(vr>>>26)|0,vr&=67108863,A=Math.imul($e,Ke),x=Math.imul($e,Ge),x=x+Math.imul(be,Ke)|0,N=Math.imul(be,Ge),A=A+Math.imul(Te,It)|0,x=x+Math.imul(Te,Ye)|0,x=x+Math.imul(Ce,It)|0,N=N+Math.imul(Ce,Ye)|0,A=A+Math.imul(he,Ot)|0,x=x+Math.imul(he,Ze)|0,x=x+Math.imul(ge,Ot)|0,N=N+Math.imul(ge,Ze)|0,A=A+Math.imul(G,et)|0,x=x+Math.imul(G,Ne)|0,x=x+Math.imul(re,et)|0,N=N+Math.imul(re,Ne)|0,A=A+Math.imul(J,tt)|0,x=x+Math.imul(J,Re)|0,x=x+Math.imul(K,tt)|0,N=N+Math.imul(K,Re)|0,A=A+Math.imul(R,ht)|0,x=x+Math.imul(R,Le)|0,x=x+Math.imul(X,ht)|0,N=N+Math.imul(X,Le)|0;var Ai=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,A=Math.imul(De,Ke),x=Math.imul(De,Ge),x=x+Math.imul(ye,Ke)|0,N=Math.imul(ye,Ge),A=A+Math.imul($e,It)|0,x=x+Math.imul($e,Ye)|0,x=x+Math.imul(be,It)|0,N=N+Math.imul(be,Ye)|0,A=A+Math.imul(Te,Ot)|0,x=x+Math.imul(Te,Ze)|0,x=x+Math.imul(Ce,Ot)|0,N=N+Math.imul(Ce,Ze)|0,A=A+Math.imul(he,et)|0,x=x+Math.imul(he,Ne)|0,x=x+Math.imul(ge,et)|0,N=N+Math.imul(ge,Ne)|0,A=A+Math.imul(G,tt)|0,x=x+Math.imul(G,Re)|0,x=x+Math.imul(re,tt)|0,N=N+Math.imul(re,Re)|0,A=A+Math.imul(J,ht)|0,x=x+Math.imul(J,Le)|0,x=x+Math.imul(K,ht)|0,N=N+Math.imul(K,Le)|0,A=A+Math.imul(R,nt)|0,x=x+Math.imul(R,Fe)|0,x=x+Math.imul(X,nt)|0,N=N+Math.imul(X,Fe)|0;var Mn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Mn>>>26)|0,Mn&=67108863,A=Math.imul(Oe,Ke),x=Math.imul(Oe,Ge),x=x+Math.imul(me,Ke)|0,N=Math.imul(me,Ge),A=A+Math.imul(De,It)|0,x=x+Math.imul(De,Ye)|0,x=x+Math.imul(ye,It)|0,N=N+Math.imul(ye,Ye)|0,A=A+Math.imul($e,Ot)|0,x=x+Math.imul($e,Ze)|0,x=x+Math.imul(be,Ot)|0,N=N+Math.imul(be,Ze)|0,A=A+Math.imul(Te,et)|0,x=x+Math.imul(Te,Ne)|0,x=x+Math.imul(Ce,et)|0,N=N+Math.imul(Ce,Ne)|0,A=A+Math.imul(he,tt)|0,x=x+Math.imul(he,Re)|0,x=x+Math.imul(ge,tt)|0,N=N+Math.imul(ge,Re)|0,A=A+Math.imul(G,ht)|0,x=x+Math.imul(G,Le)|0,x=x+Math.imul(re,ht)|0,N=N+Math.imul(re,Le)|0,A=A+Math.imul(J,nt)|0,x=x+Math.imul(J,Fe)|0,x=x+Math.imul(K,nt)|0,N=N+Math.imul(K,Fe)|0,A=A+Math.imul(R,Qe)|0,x=x+Math.imul(R,qe)|0,x=x+Math.imul(X,Qe)|0,N=N+Math.imul(X,qe)|0;var Ei=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,A=Math.imul(Be,Ke),x=Math.imul(Be,Ge),x=x+Math.imul(we,Ke)|0,N=Math.imul(we,Ge),A=A+Math.imul(Oe,It)|0,x=x+Math.imul(Oe,Ye)|0,x=x+Math.imul(me,It)|0,N=N+Math.imul(me,Ye)|0,A=A+Math.imul(De,Ot)|0,x=x+Math.imul(De,Ze)|0,x=x+Math.imul(ye,Ot)|0,N=N+Math.imul(ye,Ze)|0,A=A+Math.imul($e,et)|0,x=x+Math.imul($e,Ne)|0,x=x+Math.imul(be,et)|0,N=N+Math.imul(be,Ne)|0,A=A+Math.imul(Te,tt)|0,x=x+Math.imul(Te,Re)|0,x=x+Math.imul(Ce,tt)|0,N=N+Math.imul(Ce,Re)|0,A=A+Math.imul(he,ht)|0,x=x+Math.imul(he,Le)|0,x=x+Math.imul(ge,ht)|0,N=N+Math.imul(ge,Le)|0,A=A+Math.imul(G,nt)|0,x=x+Math.imul(G,Fe)|0,x=x+Math.imul(re,nt)|0,N=N+Math.imul(re,Fe)|0,A=A+Math.imul(J,Qe)|0,x=x+Math.imul(J,qe)|0,x=x+Math.imul(K,Qe)|0,N=N+Math.imul(K,qe)|0,A=A+Math.imul(R,Ht)|0,x=x+Math.imul(R,at)|0,x=x+Math.imul(X,Ht)|0,N=N+Math.imul(X,at)|0;var Cn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,A=Math.imul(We,Ke),x=Math.imul(We,Ge),x=x+Math.imul(xe,Ke)|0,N=Math.imul(xe,Ge),A=A+Math.imul(Be,It)|0,x=x+Math.imul(Be,Ye)|0,x=x+Math.imul(we,It)|0,N=N+Math.imul(we,Ye)|0,A=A+Math.imul(Oe,Ot)|0,x=x+Math.imul(Oe,Ze)|0,x=x+Math.imul(me,Ot)|0,N=N+Math.imul(me,Ze)|0,A=A+Math.imul(De,et)|0,x=x+Math.imul(De,Ne)|0,x=x+Math.imul(ye,et)|0,N=N+Math.imul(ye,Ne)|0,A=A+Math.imul($e,tt)|0,x=x+Math.imul($e,Re)|0,x=x+Math.imul(be,tt)|0,N=N+Math.imul(be,Re)|0,A=A+Math.imul(Te,ht)|0,x=x+Math.imul(Te,Le)|0,x=x+Math.imul(Ce,ht)|0,N=N+Math.imul(Ce,Le)|0,A=A+Math.imul(he,nt)|0,x=x+Math.imul(he,Fe)|0,x=x+Math.imul(ge,nt)|0,N=N+Math.imul(ge,Fe)|0,A=A+Math.imul(G,Qe)|0,x=x+Math.imul(G,qe)|0,x=x+Math.imul(re,Qe)|0,N=N+Math.imul(re,qe)|0,A=A+Math.imul(J,Ht)|0,x=x+Math.imul(J,at)|0,x=x+Math.imul(K,Ht)|0,N=N+Math.imul(K,at)|0,A=A+Math.imul(R,_t)|0,x=x+Math.imul(R,qt)|0,x=x+Math.imul(X,_t)|0,N=N+Math.imul(X,qt)|0;var Pn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,A=Math.imul(We,It),x=Math.imul(We,Ye),x=x+Math.imul(xe,It)|0,N=Math.imul(xe,Ye),A=A+Math.imul(Be,Ot)|0,x=x+Math.imul(Be,Ze)|0,x=x+Math.imul(we,Ot)|0,N=N+Math.imul(we,Ze)|0,A=A+Math.imul(Oe,et)|0,x=x+Math.imul(Oe,Ne)|0,x=x+Math.imul(me,et)|0,N=N+Math.imul(me,Ne)|0,A=A+Math.imul(De,tt)|0,x=x+Math.imul(De,Re)|0,x=x+Math.imul(ye,tt)|0,N=N+Math.imul(ye,Re)|0,A=A+Math.imul($e,ht)|0,x=x+Math.imul($e,Le)|0,x=x+Math.imul(be,ht)|0,N=N+Math.imul(be,Le)|0,A=A+Math.imul(Te,nt)|0,x=x+Math.imul(Te,Fe)|0,x=x+Math.imul(Ce,nt)|0,N=N+Math.imul(Ce,Fe)|0,A=A+Math.imul(he,Qe)|0,x=x+Math.imul(he,qe)|0,x=x+Math.imul(ge,Qe)|0,N=N+Math.imul(ge,qe)|0,A=A+Math.imul(G,Ht)|0,x=x+Math.imul(G,at)|0,x=x+Math.imul(re,Ht)|0,N=N+Math.imul(re,at)|0,A=A+Math.imul(J,_t)|0,x=x+Math.imul(J,qt)|0,x=x+Math.imul(K,_t)|0,N=N+Math.imul(K,qt)|0;var Si=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Si>>>26)|0,Si&=67108863,A=Math.imul(We,Ot),x=Math.imul(We,Ze),x=x+Math.imul(xe,Ot)|0,N=Math.imul(xe,Ze),A=A+Math.imul(Be,et)|0,x=x+Math.imul(Be,Ne)|0,x=x+Math.imul(we,et)|0,N=N+Math.imul(we,Ne)|0,A=A+Math.imul(Oe,tt)|0,x=x+Math.imul(Oe,Re)|0,x=x+Math.imul(me,tt)|0,N=N+Math.imul(me,Re)|0,A=A+Math.imul(De,ht)|0,x=x+Math.imul(De,Le)|0,x=x+Math.imul(ye,ht)|0,N=N+Math.imul(ye,Le)|0,A=A+Math.imul($e,nt)|0,x=x+Math.imul($e,Fe)|0,x=x+Math.imul(be,nt)|0,N=N+Math.imul(be,Fe)|0,A=A+Math.imul(Te,Qe)|0,x=x+Math.imul(Te,qe)|0,x=x+Math.imul(Ce,Qe)|0,N=N+Math.imul(Ce,qe)|0,A=A+Math.imul(he,Ht)|0,x=x+Math.imul(he,at)|0,x=x+Math.imul(ge,Ht)|0,N=N+Math.imul(ge,at)|0,A=A+Math.imul(G,_t)|0,x=x+Math.imul(G,qt)|0,x=x+Math.imul(re,_t)|0,N=N+Math.imul(re,qt)|0;var cn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(cn>>>26)|0,cn&=67108863,A=Math.imul(We,et),x=Math.imul(We,Ne),x=x+Math.imul(xe,et)|0,N=Math.imul(xe,Ne),A=A+Math.imul(Be,tt)|0,x=x+Math.imul(Be,Re)|0,x=x+Math.imul(we,tt)|0,N=N+Math.imul(we,Re)|0,A=A+Math.imul(Oe,ht)|0,x=x+Math.imul(Oe,Le)|0,x=x+Math.imul(me,ht)|0,N=N+Math.imul(me,Le)|0,A=A+Math.imul(De,nt)|0,x=x+Math.imul(De,Fe)|0,x=x+Math.imul(ye,nt)|0,N=N+Math.imul(ye,Fe)|0,A=A+Math.imul($e,Qe)|0,x=x+Math.imul($e,qe)|0,x=x+Math.imul(be,Qe)|0,N=N+Math.imul(be,qe)|0,A=A+Math.imul(Te,Ht)|0,x=x+Math.imul(Te,at)|0,x=x+Math.imul(Ce,Ht)|0,N=N+Math.imul(Ce,at)|0,A=A+Math.imul(he,_t)|0,x=x+Math.imul(he,qt)|0,x=x+Math.imul(ge,_t)|0,N=N+Math.imul(ge,qt)|0;var fn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(fn>>>26)|0,fn&=67108863,A=Math.imul(We,tt),x=Math.imul(We,Re),x=x+Math.imul(xe,tt)|0,N=Math.imul(xe,Re),A=A+Math.imul(Be,ht)|0,x=x+Math.imul(Be,Le)|0,x=x+Math.imul(we,ht)|0,N=N+Math.imul(we,Le)|0,A=A+Math.imul(Oe,nt)|0,x=x+Math.imul(Oe,Fe)|0,x=x+Math.imul(me,nt)|0,N=N+Math.imul(me,Fe)|0,A=A+Math.imul(De,Qe)|0,x=x+Math.imul(De,qe)|0,x=x+Math.imul(ye,Qe)|0,N=N+Math.imul(ye,qe)|0,A=A+Math.imul($e,Ht)|0,x=x+Math.imul($e,at)|0,x=x+Math.imul(be,Ht)|0,N=N+Math.imul(be,at)|0,A=A+Math.imul(Te,_t)|0,x=x+Math.imul(Te,qt)|0,x=x+Math.imul(Ce,_t)|0,N=N+Math.imul(Ce,qt)|0;var Cr=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,A=Math.imul(We,ht),x=Math.imul(We,Le),x=x+Math.imul(xe,ht)|0,N=Math.imul(xe,Le),A=A+Math.imul(Be,nt)|0,x=x+Math.imul(Be,Fe)|0,x=x+Math.imul(we,nt)|0,N=N+Math.imul(we,Fe)|0,A=A+Math.imul(Oe,Qe)|0,x=x+Math.imul(Oe,qe)|0,x=x+Math.imul(me,Qe)|0,N=N+Math.imul(me,qe)|0,A=A+Math.imul(De,Ht)|0,x=x+Math.imul(De,at)|0,x=x+Math.imul(ye,Ht)|0,N=N+Math.imul(ye,at)|0,A=A+Math.imul($e,_t)|0,x=x+Math.imul($e,qt)|0,x=x+Math.imul(be,_t)|0,N=N+Math.imul(be,qt)|0;var Dn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,A=Math.imul(We,nt),x=Math.imul(We,Fe),x=x+Math.imul(xe,nt)|0,N=Math.imul(xe,Fe),A=A+Math.imul(Be,Qe)|0,x=x+Math.imul(Be,qe)|0,x=x+Math.imul(we,Qe)|0,N=N+Math.imul(we,qe)|0,A=A+Math.imul(Oe,Ht)|0,x=x+Math.imul(Oe,at)|0,x=x+Math.imul(me,Ht)|0,N=N+Math.imul(me,at)|0,A=A+Math.imul(De,_t)|0,x=x+Math.imul(De,qt)|0,x=x+Math.imul(ye,_t)|0,N=N+Math.imul(ye,qt)|0;var On=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(On>>>26)|0,On&=67108863,A=Math.imul(We,Qe),x=Math.imul(We,qe),x=x+Math.imul(xe,Qe)|0,N=Math.imul(xe,qe),A=A+Math.imul(Be,Ht)|0,x=x+Math.imul(Be,at)|0,x=x+Math.imul(we,Ht)|0,N=N+Math.imul(we,at)|0,A=A+Math.imul(Oe,_t)|0,x=x+Math.imul(Oe,qt)|0,x=x+Math.imul(me,_t)|0,N=N+Math.imul(me,qt)|0;var Rn=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,A=Math.imul(We,Ht),x=Math.imul(We,at),x=x+Math.imul(xe,Ht)|0,N=Math.imul(xe,at),A=A+Math.imul(Be,_t)|0,x=x+Math.imul(Be,qt)|0,x=x+Math.imul(we,_t)|0,N=N+Math.imul(we,qt)|0;var ta=(v+A|0)+((x&8191)<<13)|0;v=(N+(x>>>13)|0)+(ta>>>26)|0,ta&=67108863,A=Math.imul(We,_t),x=Math.imul(We,qt),x=x+Math.imul(xe,_t)|0,N=Math.imul(xe,qt);var co=(v+A|0)+((x&8191)<<13)|0;return v=(N+(x>>>13)|0)+(co>>>26)|0,co&=67108863,S[0]=Qr,S[1]=Zr,S[2]=Xr,S[3]=ei,S[4]=vr,S[5]=Ai,S[6]=Mn,S[7]=Ei,S[8]=Cn,S[9]=Pn,S[10]=Si,S[11]=cn,S[12]=fn,S[13]=Cr,S[14]=Dn,S[15]=On,S[16]=Rn,S[17]=ta,S[18]=co,v!==0&&(S[19]=v,y.length++),y};Math.imul||(F=H);function Y(m,l,d){d.negative=l.negative^m.negative,d.length=m.length+l.length;for(var y=0,C=0,D=0;D<d.length-1;D++){var S=C;C=0;for(var v=y&67108863,A=Math.min(D,l.length-1),x=Math.max(0,D-m.length+1);x<=A;x++){var N=D-x,ae=m.words[N]|0,R=l.words[x]|0,X=ae*R,V=X&67108863;S=S+(X/67108864|0)|0,V=V+v|0,v=V&67108863,S=S+(V>>>26)|0,C+=S>>>26,S&=67108863}d.words[D]=v,y=S,S=C}return y!==0?d.words[D]=y:d.length--,d._strip()}function B(m,l,d){return Y(m,l,d)}s.prototype.mulTo=function(l,d){var y,C=this.length+l.length;return this.length===10&&l.length===10?y=F(this,l,d):C<63?y=H(this,l,d):C<1024?y=Y(this,l,d):y=B(this,l,d),y},s.prototype.mul=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),this.mulTo(l,d)},s.prototype.mulf=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),B(this,l,d)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var d=l<0;d&&(l=-l),i(typeof l=="number"),i(l<67108864);for(var y=0,C=0;C<this.length;C++){var D=(this.words[C]|0)*l,S=(D&67108863)+(y&67108863);y>>=26,y+=D/67108864|0,y+=S>>>26,this.words[C]=S&67108863}return y!==0&&(this.words[C]=y,this.length++),d?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var d=W(l);if(d.length===0)return new s(1);for(var y=this,C=0;C<d.length&&d[C]===0;C++,y=y.sqr());if(++C<d.length)for(var D=y.sqr();C<d.length;C++,D=D.sqr())d[C]!==0&&(y=y.mul(D));return y},s.prototype.iushln=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,C=67108863>>>26-d<<26-d,D;if(d!==0){var S=0;for(D=0;D<this.length;D++){var v=this.words[D]&C,A=(this.words[D]|0)-v<<d;this.words[D]=A|S,S=v>>>26-d}S&&(this.words[D]=S,this.length++)}if(y!==0){for(D=this.length-1;D>=0;D--)this.words[D+y]=this.words[D];for(D=0;D<y;D++)this.words[D]=0;this.length+=y}return this._strip()},s.prototype.ishln=function(l){return i(this.negative===0),this.iushln(l)},s.prototype.iushrn=function(l,d,y){i(typeof l=="number"&&l>=0);var C;d?C=(d-d%26)/26:C=0;var D=l%26,S=Math.min((l-D)/26,this.length),v=67108863^67108863>>>D<<D,A=y;if(C-=S,C=Math.max(0,C),A){for(var x=0;x<S;x++)A.words[x]=this.words[x];A.length=S}if(S!==0)if(this.length>S)for(this.length-=S,x=0;x<this.length;x++)this.words[x]=this.words[x+S];else this.words[0]=0,this.length=1;var N=0;for(x=this.length-1;x>=0&&(N!==0||x>=C);x--){var ae=this.words[x]|0;this.words[x]=N<<26-D|ae>>>D,N=ae&v}return A&&N!==0&&(A.words[A.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,d,y){return i(this.negative===0),this.iushrn(l,d,y)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,C=1<<d;if(this.length<=y)return!1;var D=this.words[y];return!!(D&C)},s.prototype.imaskn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(d!==0&&y++,this.length=Math.min(y,this.length),d!==0){var C=67108863^67108863>>>d<<d;this.words[this.length-1]&=C}return this._strip()},s.prototype.maskn=function(l){return this.clone().imaskn(l)},s.prototype.iaddn=function(l){return i(typeof l=="number"),i(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},s.prototype._iaddn=function(l){this.words[0]+=l;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(l){if(i(typeof l=="number"),i(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(l){return this.clone().iaddn(l)},s.prototype.subn=function(l){return this.clone().isubn(l)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(l,d,y){var C=l.length+y,D;this._expand(C);var S,v=0;for(D=0;D<l.length;D++){S=(this.words[D+y]|0)+v;var A=(l.words[D]|0)*d;S-=A&67108863,v=(S>>26)-(A/67108864|0),this.words[D+y]=S&67108863}for(;D<this.length-y;D++)S=(this.words[D+y]|0)+v,v=S>>26,this.words[D+y]=S&67108863;if(v===0)return this._strip();for(i(v===-1),v=0,D=0;D<this.length;D++)S=-(this.words[D]|0)+v,v=S>>26,this.words[D]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,d){var y=this.length-l.length,C=this.clone(),D=l,S=D.words[D.length-1]|0,v=this._countBits(S);y=26-v,y!==0&&(D=D.ushln(y),C.iushln(y),S=D.words[D.length-1]|0);var A=C.length-D.length,x;if(d!=="mod"){x=new s(null),x.length=A+1,x.words=new Array(x.length);for(var N=0;N<x.length;N++)x.words[N]=0}var ae=C.clone()._ishlnsubmul(D,1,A);ae.negative===0&&(C=ae,x&&(x.words[A]=1));for(var R=A-1;R>=0;R--){var X=(C.words[D.length+R]|0)*67108864+(C.words[D.length+R-1]|0);for(X=Math.min(X/S|0,67108863),C._ishlnsubmul(D,X,R);C.negative!==0;)X--,C.negative=0,C._ishlnsubmul(D,1,R),C.isZero()||(C.negative^=1);x&&(x.words[R]=X)}return x&&x._strip(),C._strip(),d!=="div"&&y!==0&&C.iushrn(y),{div:x||null,mod:C}},s.prototype.divmod=function(l,d,y){if(i(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var C,D,S;return this.negative!==0&&l.negative===0?(S=this.neg().divmod(l,d),d!=="mod"&&(C=S.div.neg()),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.iadd(l)),{div:C,mod:D}):this.negative===0&&l.negative!==0?(S=this.divmod(l.neg(),d),d!=="mod"&&(C=S.div.neg()),{div:C,mod:S.mod}):this.negative&l.negative?(S=this.neg().divmod(l.neg(),d),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.isub(l)),{div:S.div,mod:D}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?d==="div"?{div:this.divn(l.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,d)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var d=this.divmod(l);if(d.mod.isZero())return d.div;var y=d.div.negative!==0?d.mod.isub(l):d.mod,C=l.ushrn(1),D=l.andln(1),S=y.cmp(C);return S<0||D===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=(1<<26)%l,C=0,D=this.length-1;D>=0;D--)C=(y*C+(this.words[D]|0))%l;return d?-C:C},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=0,C=this.length-1;C>=0;C--){var D=(this.words[C]|0)+y*67108864;this.words[C]=D/l|0,y=D%l}return this._strip(),d?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var C=new s(1),D=new s(0),S=new s(0),v=new s(1),A=0;d.isEven()&&y.isEven();)d.iushrn(1),y.iushrn(1),++A;for(var x=y.clone(),N=d.clone();!d.isZero();){for(var ae=0,R=1;!(d.words[0]&R)&&ae<26;++ae,R<<=1);if(ae>0)for(d.iushrn(ae);ae-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(x),D.isub(N)),C.iushrn(1),D.iushrn(1);for(var X=0,V=1;!(y.words[0]&V)&&X<26;++X,V<<=1);if(X>0)for(y.iushrn(X);X-- >0;)(S.isOdd()||v.isOdd())&&(S.iadd(x),v.isub(N)),S.iushrn(1),v.iushrn(1);d.cmp(y)>=0?(d.isub(y),C.isub(S),D.isub(v)):(y.isub(d),S.isub(C),v.isub(D))}return{a:S,b:v,gcd:y.iushln(A)}},s.prototype._invmp=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var C=new s(1),D=new s(0),S=y.clone();d.cmpn(1)>0&&y.cmpn(1)>0;){for(var v=0,A=1;!(d.words[0]&A)&&v<26;++v,A<<=1);if(v>0)for(d.iushrn(v);v-- >0;)C.isOdd()&&C.iadd(S),C.iushrn(1);for(var x=0,N=1;!(y.words[0]&N)&&x<26;++x,N<<=1);if(x>0)for(y.iushrn(x);x-- >0;)D.isOdd()&&D.iadd(S),D.iushrn(1);d.cmp(y)>=0?(d.isub(y),C.isub(D)):(y.isub(d),D.isub(C))}var ae;return d.cmpn(1)===0?ae=C:ae=D,ae.cmpn(0)<0&&ae.iadd(l),ae},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var d=this.clone(),y=l.clone();d.negative=0,y.negative=0;for(var C=0;d.isEven()&&y.isEven();C++)d.iushrn(1),y.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;y.isEven();)y.iushrn(1);var D=d.cmp(y);if(D<0){var S=d;d=y,y=S}else if(D===0||y.cmpn(1)===0)break;d.isub(y)}while(!0);return y.iushln(C)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){i(typeof l=="number");var d=l%26,y=(l-d)/26,C=1<<d;if(this.length<=y)return this._expand(y+1),this.words[y]|=C,this;for(var D=C,S=y;D!==0&&S<this.length;S++){var v=this.words[S]|0;v+=D,D=v>>>26,v&=67108863,this.words[S]=v}return D!==0&&(this.words[S]=D,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var d=l<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var y;if(this.length>1)y=1;else{d&&(l=-l),i(l<=67108863,"Number is too big");var C=this.words[0]|0;y=C===l?0:C<l?-1:1}return this.negative!==0?-y|0:y},s.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var d=this.ucmp(l);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var d=0,y=this.length-1;y>=0;y--){var C=this.words[y]|0,D=l.words[y]|0;if(C!==D){C<D?d=-1:C>D&&(d=1);break}}return d},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new L(l)},s.prototype.toRed=function(l){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return i(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return i(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var z={k256:null,p224:null,p192:null,p25519:null};function j(m,l){this.name=m,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},j.prototype.ireduce=function(l){var d=l,y;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),y=d.bitLength();while(y>this.n);var C=y<this.n?-1:d.ucmp(this.p);return C===0?(d.words[0]=0,d.length=1):C>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},j.prototype.split=function(l,d){l.iushrn(this.n,0,d)},j.prototype.imulK=function(l){return l.imul(this.k)};function _(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,j),_.prototype.split=function(l,d){for(var y=4194303,C=Math.min(l.length,9),D=0;D<C;D++)d.words[D]=l.words[D];if(d.length=C,l.length<=9){l.words[0]=0,l.length=1;return}var S=l.words[9];for(d.words[d.length++]=S&y,D=10;D<l.length;D++){var v=l.words[D]|0;l.words[D-10]=(v&y)<<4|S>>>22,S=v}S>>>=22,l.words[D-10]=S,S===0&&l.length>10?l.length-=10:l.length-=9},_.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var d=0,y=0;y<l.length;y++){var C=l.words[y]|0;d+=C*977,l.words[y]=d&67108863,d=C*64+(d/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function U(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(U,j);function ee(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(ee,j);function oe(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(oe,j),oe.prototype.imulK=function(l){for(var d=0,y=0;y<l.length;y++){var C=(l.words[y]|0)*19+d,D=C&67108863;C>>>=26,l.words[y]=D,d=C}return d!==0&&(l.words[l.length++]=d),l},s._prime=function(l){if(z[l])return z[l];var d;if(l==="k256")d=new _;else if(l==="p224")d=new U;else if(l==="p192")d=new ee;else if(l==="p25519")d=new oe;else throw new Error("Unknown prime "+l);return z[l]=d,d};function L(m){if(typeof m=="string"){var l=s._prime(m);this.m=l.p,this.prime=l}else i(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}L.prototype._verify1=function(l){i(l.negative===0,"red works only with positives"),i(l.red,"red works only with red numbers")},L.prototype._verify2=function(l,d){i((l.negative|d.negative)===0,"red works only with positives"),i(l.red&&l.red===d.red,"red works only with red numbers")},L.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(g(l,l.umod(this.m)._forceRed(this)),l)},L.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},L.prototype.add=function(l,d){this._verify2(l,d);var y=l.add(d);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},L.prototype.iadd=function(l,d){this._verify2(l,d);var y=l.iadd(d);return y.cmp(this.m)>=0&&y.isub(this.m),y},L.prototype.sub=function(l,d){this._verify2(l,d);var y=l.sub(d);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},L.prototype.isub=function(l,d){this._verify2(l,d);var y=l.isub(d);return y.cmpn(0)<0&&y.iadd(this.m),y},L.prototype.shl=function(l,d){return this._verify1(l),this.imod(l.ushln(d))},L.prototype.imul=function(l,d){return this._verify2(l,d),this.imod(l.imul(d))},L.prototype.mul=function(l,d){return this._verify2(l,d),this.imod(l.mul(d))},L.prototype.isqr=function(l){return this.imul(l,l.clone())},L.prototype.sqr=function(l){return this.mul(l,l)},L.prototype.sqrt=function(l){if(l.isZero())return l.clone();var d=this.m.andln(3);if(i(d%2===1),d===3){var y=this.m.add(new s(1)).iushrn(2);return this.pow(l,y)}for(var C=this.m.subn(1),D=0;!C.isZero()&&C.andln(1)===0;)D++,C.iushrn(1);i(!C.isZero());var S=new s(1).toRed(this),v=S.redNeg(),A=this.m.subn(1).iushrn(1),x=this.m.bitLength();for(x=new s(2*x*x).toRed(this);this.pow(x,A).cmp(v)!==0;)x.redIAdd(v);for(var N=this.pow(x,C),ae=this.pow(l,C.addn(1).iushrn(1)),R=this.pow(l,C),X=D;R.cmp(S)!==0;){for(var V=R,J=0;V.cmp(S)!==0;J++)V=V.redSqr();i(J<X);var K=this.pow(N,new s(1).iushln(X-J-1));ae=ae.redMul(K),N=K.redSqr(),R=R.redMul(N),X=J}return ae},L.prototype.invm=function(l){var d=l._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},L.prototype.pow=function(l,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return l.clone();var y=4,C=new Array(1<<y);C[0]=new s(1).toRed(this),C[1]=l;for(var D=2;D<C.length;D++)C[D]=this.mul(C[D-1],l);var S=C[0],v=0,A=0,x=d.bitLength()%26;for(x===0&&(x=26),D=d.length-1;D>=0;D--){for(var N=d.words[D],ae=x-1;ae>=0;ae--){var R=N>>ae&1;if(S!==C[0]&&(S=this.sqr(S)),R===0&&v===0){A=0;continue}v<<=1,v|=R,A++,!(A!==y&&(D!==0||ae!==0))&&(S=this.mul(S,C[v]),A=0,v=0)}x=26}return S},L.prototype.convertTo=function(l){var d=l.umod(this.m);return d===l?d.clone():d},L.prototype.convertFrom=function(l){var d=l.clone();return d.red=null,d},s.mont=function(l){return new b(l)};function b(m){L.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(b,L),b.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},b.prototype.convertFrom=function(l){var d=this.imod(l.mul(this.rinv));return d.red=null,d},b.prototype.imul=function(l,d){if(l.isZero()||d.isZero())return l.words[0]=0,l.length=1,l;var y=l.imul(d),C=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(C).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.mul=function(l,d){if(l.isZero()||d.isZero())return new s(0)._forceRed(this);var y=l.mul(d),C=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(C).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.invm=function(l){var d=this.imod(l._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(r,fr)})(Hg);var vt=Hg.exports;const kg="bignumber/5.7.0";var nl=vt.BN;const ds=new xt(kg),rd={},jg=9007199254740991;function c4(r){return r!=null&&(ir.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||Oi(r)||typeof r=="bigint"||wa(r))}let Wg=!1;class ir{constructor(e,t){e!==rd&&ds.throwError("cannot call constructor directly; use BigNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return gi(Tt(this).fromTwos(e))}toTwos(e){return gi(Tt(this).toTwos(e))}abs(){return this._hex[0]==="-"?ir.from(this._hex.substring(1)):this}add(e){return gi(Tt(this).add(Tt(e)))}sub(e){return gi(Tt(this).sub(Tt(e)))}div(e){return ir.from(e).isZero()&&Vi("division-by-zero","div"),gi(Tt(this).div(Tt(e)))}mul(e){return gi(Tt(this).mul(Tt(e)))}mod(e){const t=Tt(e);return t.isNeg()&&Vi("division-by-zero","mod"),gi(Tt(this).umod(t))}pow(e){const t=Tt(e);return t.isNeg()&&Vi("negative-power","pow"),gi(Tt(this).pow(t))}and(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Vi("unbound-bitwise-result","and"),gi(Tt(this).and(t))}or(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Vi("unbound-bitwise-result","or"),gi(Tt(this).or(t))}xor(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Vi("unbound-bitwise-result","xor"),gi(Tt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Vi("negative-width","mask"),gi(Tt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Vi("negative-width","shl"),gi(Tt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Vi("negative-width","shr"),gi(Tt(this).shrn(e))}eq(e){return Tt(this).eq(Tt(e))}lt(e){return Tt(this).lt(Tt(e))}lte(e){return Tt(this).lte(Tt(e))}gt(e){return Tt(this).gt(Tt(e))}gte(e){return Tt(this).gte(Tt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Tt(this).isZero()}toNumber(){try{return Tt(this).toNumber()}catch{Vi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ds.throwError("this platform does not support BigInt",xt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Wg||(Wg=!0,ds.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ds.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",xt.errors.UNEXPECTED_ARGUMENT,{}):ds.throwError("BigNumber.toString does not accept parameters",xt.errors.UNEXPECTED_ARGUMENT,{})),Tt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ir)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ir(rd,Rc(e)):e.match(/^-?[0-9]+$/)?new ir(rd,Rc(new nl(e))):ds.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Vi("underflow","BigNumber.from",e),(e>=jg||e<=-jg)&&Vi("overflow","BigNumber.from",e),ir.from(String(e));const t=e;if(typeof t=="bigint")return ir.from(t.toString());if(wa(t))return ir.from(ii(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return ir.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(Oi(i)||i[0]==="-"&&Oi(i.substring(1))))return ir.from(i)}return ds.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Rc(r){if(typeof r!="string")return Rc(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&ds.throwArgumentError("invalid hex","value",r),r=Rc(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function gi(r){return ir.from(Rc(r))}function Tt(r){const e=ir.from(r).toHexString();return e[0]==="-"?new nl("-"+e.substring(3),16):new nl(e.substring(2),16)}function Vi(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),ds.throwError(r,xt.errors.NUMERIC_FAULT,i)}function f4(r){return new nl(r,36).toString(16)}const ni=new xt(kg),Tc={},Kg=ir.from(0),Vg=ir.from(-1);function Gg(r,e,t,i){const n={fault:e,operation:t};return i!==void 0&&(n.value=i),ni.throwError(r,xt.errors.NUMERIC_FAULT,n)}let $c="0";for(;$c.length<256;)$c+=$c;function id(r){if(typeof r!="number")try{r=ir.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+$c.substring(0,r):ni.throwArgumentError("invalid decimal size","decimals",r)}function nd(r,e){e==null&&(e=0);const t=id(e);r=ir.from(r);const i=r.lt(Kg);i&&(r=r.mul(Vg));let n=r.mod(t).toString();for(;n.length<t.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=r.div(t).toString();return t.length===1?r=s:r=s+"."+n,i&&(r="-"+r),r}function ps(r,e){e==null&&(e=0);const t=id(e);(typeof r!="string"||!r.match(/^-?[0-9.]+$/))&&ni.throwArgumentError("invalid decimal value","value",r);const i=r.substring(0,1)==="-";i&&(r=r.substring(1)),r==="."&&ni.throwArgumentError("missing value","value",r);const n=r.split(".");n.length>2&&ni.throwArgumentError("too many decimal points","value",r);let s=n[0],a=n[1];for(s||(s="0"),a||(a="0");a[a.length-1]==="0";)a=a.substring(0,a.length-1);for(a.length>t.length-1&&Gg("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.length<t.length-1;)a+="0";const f=ir.from(s),h=ir.from(a);let u=f.mul(t).add(h);return i&&(u=u.mul(Vg)),u}class ya{constructor(e,t,i,n){e!==Tc&&ni.throwError("cannot use FixedFormat constructor; use FixedFormat.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=i,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=id(n),Object.freeze(this)}static from(e){if(e instanceof ya)return e;typeof e=="number"&&(e=`fixed128x${e}`);let t=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")t=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||ni.throwArgumentError("invalid fixed format","format",e),t=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(a,f,h)=>e[a]==null?h:(typeof e[a]!==f&&ni.throwArgumentError("invalid fixed format ("+a+" not "+f+")","format."+a,e[a]),e[a]);t=s("signed","boolean",t),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&ni.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&ni.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new ya(Tc,t,i,n)}}class zr{constructor(e,t,i,n){e!==Tc&&ni.throwError("cannot use FixedNumber constructor; use FixedNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&ni.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return zr.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(Yg.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(Yg.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&ni.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=zr.from("1"+$c.substring(0,e),this.format),n=l4.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&ni.throwArgumentError("invalid byte width","width",e);const t=ir.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Fn(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return zr.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!c4(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),zr.fromString(nd(e,t),ya.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=ya.from(t),n=ps(e,i.decimals);!i.signed&&n.lt(Kg)&&Gg("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=Fn(s,i.width/8));const a=nd(n,i.decimals);return new zr(Tc,s,a,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=ya.from(t);if(ur(e).length>i.width/8)throw new Error("overflow");let n=ir.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),a=nd(n,i.decimals);return new zr(Tc,s,a,i)}static from(e,t){if(typeof e=="string")return zr.fromString(e,t);if(wa(e))return zr.fromBytes(e,t);try{return zr.fromValue(e,0,t)}catch(i){if(i.code!==xt.errors.INVALID_ARGUMENT)throw i}return ni.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Yg=zr.from(1),l4=zr.from("0.5"),h4="strings/5.7.0",Jg=new xt(h4);var sl;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(sl||(sl={}));var _a;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(_a||(_a={}));function u4(r,e,t,i,n){return Jg.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}function Qg(r,e,t,i,n){if(r===_a.BAD_PREFIX||r===_a.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)s++;return s}return r===_a.OVERRUN?t.length-e-1:0}function d4(r,e,t,i,n){return r===_a.OVERLONG?(i.push(n),0):(i.push(65533),Qg(r,e,t))}Object.freeze({error:u4,ignore:Qg,replace:d4});function sd(r,e=sl.current){e!=sl.current&&(Jg.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const n=r.charCodeAt(i);if(n<128)t.push(n);else if(n<2048)t.push(n>>6|192),t.push(n&63|128);else if((n&64512)==55296){i++;const s=r.charCodeAt(i);if(i>=r.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const a=65536+((n&1023)<<10)+(s&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(n>>12|224),t.push(n>>6&63|128),t.push(n&63|128)}return ur(t)}function p4(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t<r.length;t+=4)e.push(parseInt(r.substring(t,t+4),16));return e}function od(r,e){e||(e=function(n){return[parseInt(n,16)]});let t=0,i={};return r.split(",").forEach(n=>{let s=n.split(":");t+=parseInt(s[0],16),i[t]=e(s[1])}),i}function Zg(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}Zg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),od("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),od("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),od("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",p4),Zg("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Xg="hash/5.7.0";function g4(r){r=atob(r);const e=[];for(let t=0;t<r.length;t++)e.push(r.charCodeAt(t));return ur(e)}function ev(r,e){e==null&&(e=1);const t=[],i=t.forEach,n=function(s,a){i.call(s,function(f){a>0&&Array.isArray(f)?n(f,a-1):t.push(f)})};return n(r,e),t}function v4(r){const e={};for(let t=0;t<r.length;t++){const i=r[t];e[i[0]]=i[1]}return e}function m4(r){let e=0;function t(){return r[e++]<<8|r[e++]}let i=t(),n=1,s=[0,1];for(let z=1;z<i;z++)s.push(n+=t());let a=t(),f=e;e+=a;let h=0,u=0;function g(){return h==0&&(u=u<<8|r[e++],h=8),u>>--h&1}const w=31,P=Math.pow(2,w),M=P>>>1,O=M>>1,$=P-1;let W=0;for(let z=0;z<w;z++)W=W<<1|g();let H=[],F=0,Y=P;for(;;){let z=Math.floor(((W-F+1)*n-1)/Y),j=0,_=i;for(;_-j>1;){let oe=j+_>>>1;z<s[oe]?_=oe:j=oe}if(j==0)break;H.push(j);let U=F+Math.floor(Y*s[j]/n),ee=F+Math.floor(Y*s[j+1]/n)-1;for(;!((U^ee)&M);)W=W<<1&$|g(),U=U<<1&$,ee=ee<<1&$|1;for(;U&~ee&O;)W=W&M|W<<1&$>>>1|g(),U=U<<1^M,ee=(ee^M)<<1|M|1;F=U,Y=1+ee-U}let B=i-4;return H.map(z=>{switch(z-B){case 3:return B+65792+(r[f++]<<16|r[f++]<<8|r[f++]);case 2:return B+256+(r[f++]<<8|r[f++]);case 1:return B+r[f++];default:return z-1}})}function b4(r){let e=0;return()=>r[e++]}function w4(r){return b4(m4(r))}function y4(r){return r&1?~r>>1:r>>1}function _4(r,e){let t=Array(r);for(let i=0;i<r;i++)t[i]=1+e();return t}function tv(r,e){let t=Array(r);for(let i=0,n=-1;i<r;i++)t[i]=n+=1+e();return t}function x4(r,e){let t=Array(r);for(let i=0,n=0;i<r;i++)t[i]=n+=y4(e());return t}function ol(r,e){let t=tv(r(),r),i=r(),n=tv(i,r),s=_4(i,r);for(let a=0;a<i;a++)for(let f=0;f<s[a];f++)t.push(n[a]+f);return e?t.map(a=>e[a]):t}function A4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(S4(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(I4(t,r))}return v4(ev(e))}function E4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function rv(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)x4(r,t).forEach((s,a)=>i[a].push(s));return i}function S4(r,e){let t=1+e(),i=e(),n=E4(e),s=rv(n.length,1+r,e);return ev(s.map((a,f)=>{const h=a[0],u=a.slice(1);return Array(n[f]).fill(void 0).map((g,w)=>{let P=w*i;return[h+w*t,u.map(M=>M+P)]})}))}function I4(r,e){let t=1+e();return rv(t,1+r,e).map(n=>[n[0],n.slice(1)])}function M4(r){let e=ol(r).sort((i,n)=>i-n);return t();function t(){let i=[];for(;;){let u=ol(r,e);if(u.length==0)break;i.push({set:new Set(u),node:t()})}i.sort((u,g)=>g.set.size-u.set.size);let n=r(),s=n%3;n=n/3|0;let a=!!(n&1);n>>=1;let f=n==1,h=n==2;return{branches:i,valid:s,fe0f:a,save:f,check:h}}}function C4(){return w4(g4("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const al=C4();new Set(ol(al)),new Set(ol(al)),A4(al),M4(al),new xt(Xg),new Uint8Array(32).fill(0);const P4=`Ethereum Signed Message:
22
+ `;function iv(r){return typeof r=="string"&&(r=sd(r)),td(i4([sd(P4),sd(String(r.length)),r]))}const D4="rlp/5.7.0";new xt(D4);const O4="address/5.7.0",Nc=new xt(O4);function nv(r){Oi(r,20)||Nc.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let n=0;n<40;n++)t[n]=e[n].charCodeAt(0);const i=ur(td(t));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const R4=9007199254740991;function T4(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const ad={};for(let r=0;r<10;r++)ad[String(r)]=String(r);for(let r=0;r<26;r++)ad[String.fromCharCode(65+r)]=String(10+r);const sv=Math.floor(T4(R4));function $4(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>ad[i]).join("");for(;e.length>=sv;){let i=e.substring(0,sv);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function N4(r){let e=null;if(typeof r!="string"&&Nc.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=nv(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&Nc.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==$4(r)&&Nc.throwArgumentError("bad icap checksum","address",r),e=f4(r.substring(4));e.length<40;)e="0"+e;e=nv("0x"+e)}else Nc.throwArgumentError("invalid address","address",r);return e}const L4="properties/5.7.0";new xt(L4);function Lc(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}new xt(Xg),new Uint8Array(32).fill(0),ir.from(-1);const B4=ir.from(0),F4=ir.from(1);ir.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Fn(F4.toHexString(),32),Fn(B4.toHexString(),32);var Ri={},$t={},Ao=ov;function ov(r,e){if(!r)throw new Error(e||"Assertion failed")}ov.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var xa={exports:{}};typeof Object.create=="function"?xa.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:xa.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}};var U4=Ao,q4=xa.exports;$t.inherits=q4;function z4(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function H4(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var i=0,n=0;n<r.length;n++){var s=r.charCodeAt(n);s<128?t[i++]=s:s<2048?(t[i++]=s>>6|192,t[i++]=s&63|128):z4(r,n)?(s=65536+((s&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128)}else for(n=0;n<r.length;n++)t[n]=r[n]|0;return t}$t.toArray=H4;function k4(r){for(var e="",t=0;t<r.length;t++)e+=cv(r[t].toString(16));return e}$t.toHex=k4;function av(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}$t.htonl=av;function j4(r,e){for(var t="",i=0;i<r.length;i++){var n=r[i];e==="little"&&(n=av(n)),t+=fv(n.toString(16))}return t}$t.toHex32=j4;function cv(r){return r.length===1?"0"+r:r}$t.zero2=cv;function fv(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}$t.zero8=fv;function W4(r,e,t,i){var n=t-e;U4(n%4===0);for(var s=new Array(n/4),a=0,f=e;a<s.length;a++,f+=4){var h;i==="big"?h=r[f]<<24|r[f+1]<<16|r[f+2]<<8|r[f+3]:h=r[f+3]<<24|r[f+2]<<16|r[f+1]<<8|r[f],s[a]=h>>>0}return s}$t.join32=W4;function K4(r,e){for(var t=new Array(r.length*4),i=0,n=0;i<r.length;i++,n+=4){var s=r[i];e==="big"?(t[n]=s>>>24,t[n+1]=s>>>16&255,t[n+2]=s>>>8&255,t[n+3]=s&255):(t[n+3]=s>>>24,t[n+2]=s>>>16&255,t[n+1]=s>>>8&255,t[n]=s&255)}return t}$t.split32=K4;function V4(r,e){return r>>>e|r<<32-e}$t.rotr32=V4;function G4(r,e){return r<<e|r>>>32-e}$t.rotl32=G4;function Y4(r,e){return r+e>>>0}$t.sum32=Y4;function J4(r,e,t){return r+e+t>>>0}$t.sum32_3=J4;function Q4(r,e,t,i){return r+e+t+i>>>0}$t.sum32_4=Q4;function Z4(r,e,t,i,n){return r+e+t+i+n>>>0}$t.sum32_5=Z4;function X4(r,e,t,i){var n=r[e],s=r[e+1],a=i+s>>>0,f=(a<i?1:0)+t+n;r[e]=f>>>0,r[e+1]=a}$t.sum64=X4;function e8(r,e,t,i){var n=e+i>>>0,s=(n<e?1:0)+r+t;return s>>>0}$t.sum64_hi=e8;function t8(r,e,t,i){var n=e+i;return n>>>0}$t.sum64_lo=t8;function r8(r,e,t,i,n,s,a,f){var h=0,u=e;u=u+i>>>0,h+=u<e?1:0,u=u+s>>>0,h+=u<s?1:0,u=u+f>>>0,h+=u<f?1:0;var g=r+t+n+a+h;return g>>>0}$t.sum64_4_hi=r8;function i8(r,e,t,i,n,s,a,f){var h=e+i+s+f;return h>>>0}$t.sum64_4_lo=i8;function n8(r,e,t,i,n,s,a,f,h,u){var g=0,w=e;w=w+i>>>0,g+=w<e?1:0,w=w+s>>>0,g+=w<s?1:0,w=w+f>>>0,g+=w<f?1:0,w=w+u>>>0,g+=w<u?1:0;var P=r+t+n+a+h+g;return P>>>0}$t.sum64_5_hi=n8;function s8(r,e,t,i,n,s,a,f,h,u){var g=e+i+s+f+u;return g>>>0}$t.sum64_5_lo=s8;function o8(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}$t.rotr64_hi=o8;function a8(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}$t.rotr64_lo=a8;function c8(r,e,t){return r>>>t}$t.shr64_hi=c8;function f8(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}$t.shr64_lo=f8;var Aa={},lv=$t,l8=Ao;function cl(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Aa.BlockHash=cl,cl.prototype.update=function(e,t){if(e=lv.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=lv.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},cl.prototype.digest=function(e){return this.update(this._pad()),l8(this.pending===null),this._digest(e)},cl.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,i=t-(e+this.padLength)%t,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,a=8;a<this.padLength;a++)n[s++]=0;return n};var Ea={},Un={},h8=$t,qn=h8.rotr32;function u8(r,e,t,i){if(r===0)return hv(e,t,i);if(r===1||r===3)return dv(e,t,i);if(r===2)return uv(e,t,i)}Un.ft_1=u8;function hv(r,e,t){return r&e^~r&t}Un.ch32=hv;function uv(r,e,t){return r&e^r&t^e&t}Un.maj32=uv;function dv(r,e,t){return r^e^t}Un.p32=dv;function d8(r){return qn(r,2)^qn(r,13)^qn(r,22)}Un.s0_256=d8;function p8(r){return qn(r,6)^qn(r,11)^qn(r,25)}Un.s1_256=p8;function g8(r){return qn(r,7)^qn(r,18)^r>>>3}Un.g0_256=g8;function v8(r){return qn(r,17)^qn(r,19)^r>>>10}Un.g1_256=v8;var Sa=$t,m8=Aa,b8=Un,cd=Sa.rotl32,Bc=Sa.sum32,w8=Sa.sum32_5,y8=b8.ft_1,pv=m8.BlockHash,_8=[1518500249,1859775393,2400959708,3395469782];function zn(){if(!(this instanceof zn))return new zn;pv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Sa.inherits(zn,pv);var x8=zn;zn.blockSize=512,zn.outSize=160,zn.hmacStrength=80,zn.padLength=64,zn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=cd(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4];for(n=0;n<i.length;n++){var g=~~(n/20),w=w8(cd(s,5),y8(g,a,f,h),u,i[n],_8[g]);u=h,h=f,f=cd(a,30),a=s,s=w}this.h[0]=Bc(this.h[0],s),this.h[1]=Bc(this.h[1],a),this.h[2]=Bc(this.h[2],f),this.h[3]=Bc(this.h[3],h),this.h[4]=Bc(this.h[4],u)},zn.prototype._digest=function(e){return e==="hex"?Sa.toHex32(this.h,"big"):Sa.split32(this.h,"big")};var Ia=$t,A8=Aa,Ma=Un,E8=Ao,yn=Ia.sum32,S8=Ia.sum32_4,I8=Ia.sum32_5,M8=Ma.ch32,C8=Ma.maj32,P8=Ma.s0_256,D8=Ma.s1_256,O8=Ma.g0_256,R8=Ma.g1_256,gv=A8.BlockHash,T8=[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 Hn(){if(!(this instanceof Hn))return new Hn;gv.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=T8,this.W=new Array(64)}Ia.inherits(Hn,gv);var vv=Hn;Hn.blockSize=512,Hn.outSize=256,Hn.hmacStrength=192,Hn.padLength=64,Hn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=S8(R8(i[n-2]),i[n-7],O8(i[n-15]),i[n-16]);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4],g=this.h[5],w=this.h[6],P=this.h[7];for(E8(this.k.length===i.length),n=0;n<i.length;n++){var M=I8(P,D8(u),M8(u,g,w),this.k[n],i[n]),O=yn(P8(s),C8(s,a,f));P=w,w=g,g=u,u=yn(h,M),h=f,f=a,a=s,s=yn(M,O)}this.h[0]=yn(this.h[0],s),this.h[1]=yn(this.h[1],a),this.h[2]=yn(this.h[2],f),this.h[3]=yn(this.h[3],h),this.h[4]=yn(this.h[4],u),this.h[5]=yn(this.h[5],g),this.h[6]=yn(this.h[6],w),this.h[7]=yn(this.h[7],P)},Hn.prototype._digest=function(e){return e==="hex"?Ia.toHex32(this.h,"big"):Ia.split32(this.h,"big")};var fd=$t,mv=vv;function gs(){if(!(this instanceof gs))return new gs;mv.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}fd.inherits(gs,mv);var $8=gs;gs.blockSize=512,gs.outSize=224,gs.hmacStrength=192,gs.padLength=64,gs.prototype._digest=function(e){return e==="hex"?fd.toHex32(this.h.slice(0,7),"big"):fd.split32(this.h.slice(0,7),"big")};var vi=$t,N8=Aa,L8=Ao,kn=vi.rotr64_hi,jn=vi.rotr64_lo,bv=vi.shr64_hi,wv=vi.shr64_lo,Fs=vi.sum64,ld=vi.sum64_hi,hd=vi.sum64_lo,B8=vi.sum64_4_hi,F8=vi.sum64_4_lo,U8=vi.sum64_5_hi,q8=vi.sum64_5_lo,yv=N8.BlockHash,z8=[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 _n(){if(!(this instanceof _n))return new _n;yv.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=z8,this.W=new Array(160)}vi.inherits(_n,yv);var _v=_n;_n.blockSize=1024,_n.outSize=512,_n.hmacStrength=192,_n.padLength=128,_n.prototype._prepareBlock=function(e,t){for(var i=this.W,n=0;n<32;n++)i[n]=e[t+n];for(;n<i.length;n+=2){var s=Z8(i[n-4],i[n-3]),a=X8(i[n-4],i[n-3]),f=i[n-14],h=i[n-13],u=J8(i[n-30],i[n-29]),g=Q8(i[n-30],i[n-29]),w=i[n-32],P=i[n-31];i[n]=B8(s,a,f,h,u,g,w,P),i[n+1]=F8(s,a,f,h,u,g,w,P)}},_n.prototype._update=function(e,t){this._prepareBlock(e,t);var i=this.W,n=this.h[0],s=this.h[1],a=this.h[2],f=this.h[3],h=this.h[4],u=this.h[5],g=this.h[6],w=this.h[7],P=this.h[8],M=this.h[9],O=this.h[10],$=this.h[11],W=this.h[12],H=this.h[13],F=this.h[14],Y=this.h[15];L8(this.k.length===i.length);for(var B=0;B<i.length;B+=2){var z=F,j=Y,_=G8(P,M),U=Y8(P,M),ee=H8(P,M,O,$,W),oe=k8(P,M,O,$,W,H),L=this.k[B],b=this.k[B+1],m=i[B],l=i[B+1],d=U8(z,j,_,U,ee,oe,L,b,m,l),y=q8(z,j,_,U,ee,oe,L,b,m,l);z=K8(n,s),j=V8(n,s),_=j8(n,s,a,f,h),U=W8(n,s,a,f,h,u);var C=ld(z,j,_,U),D=hd(z,j,_,U);F=W,Y=H,W=O,H=$,O=P,$=M,P=ld(g,w,d,y),M=hd(w,w,d,y),g=h,w=u,h=a,u=f,a=n,f=s,n=ld(d,y,C,D),s=hd(d,y,C,D)}Fs(this.h,0,n,s),Fs(this.h,2,a,f),Fs(this.h,4,h,u),Fs(this.h,6,g,w),Fs(this.h,8,P,M),Fs(this.h,10,O,$),Fs(this.h,12,W,H),Fs(this.h,14,F,Y)},_n.prototype._digest=function(e){return e==="hex"?vi.toHex32(this.h,"big"):vi.split32(this.h,"big")};function H8(r,e,t,i,n){var s=r&t^~r&n;return s<0&&(s+=4294967296),s}function k8(r,e,t,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function j8(r,e,t,i,n){var s=r&t^r&n^t&n;return s<0&&(s+=4294967296),s}function W8(r,e,t,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function K8(r,e){var t=kn(r,e,28),i=kn(e,r,2),n=kn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function V8(r,e){var t=jn(r,e,28),i=jn(e,r,2),n=jn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function G8(r,e){var t=kn(r,e,14),i=kn(r,e,18),n=kn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function Y8(r,e){var t=jn(r,e,14),i=jn(r,e,18),n=jn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function J8(r,e){var t=kn(r,e,1),i=kn(r,e,8),n=bv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function Q8(r,e){var t=jn(r,e,1),i=jn(r,e,8),n=wv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function Z8(r,e){var t=kn(r,e,19),i=kn(e,r,29),n=bv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}function X8(r,e){var t=jn(r,e,19),i=jn(e,r,29),n=wv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}var ud=$t,xv=_v;function vs(){if(!(this instanceof vs))return new vs;xv.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ud.inherits(vs,xv);var e_=vs;vs.blockSize=1024,vs.outSize=384,vs.hmacStrength=192,vs.padLength=128,vs.prototype._digest=function(e){return e==="hex"?ud.toHex32(this.h.slice(0,12),"big"):ud.split32(this.h.slice(0,12),"big")},Ea.sha1=x8,Ea.sha224=$8,Ea.sha256=vv,Ea.sha384=e_,Ea.sha512=_v;var Av={},Eo=$t,t_=Aa,fl=Eo.rotl32,Ev=Eo.sum32,Fc=Eo.sum32_3,Sv=Eo.sum32_4,Iv=t_.BlockHash;function Wn(){if(!(this instanceof Wn))return new Wn;Iv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Eo.inherits(Wn,Iv),Av.ripemd160=Wn,Wn.blockSize=512,Wn.outSize=160,Wn.hmacStrength=192,Wn.padLength=64,Wn.prototype._update=function(e,t){for(var i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],f=this.h[4],h=i,u=n,g=s,w=a,P=f,M=0;M<80;M++){var O=Ev(fl(Sv(i,Mv(M,n,s,a),e[n_[M]+t],r_(M)),o_[M]),f);i=f,f=a,a=fl(s,10),s=n,n=O,O=Ev(fl(Sv(h,Mv(79-M,u,g,w),e[s_[M]+t],i_(M)),a_[M]),P),h=P,P=w,w=fl(g,10),g=u,u=O}O=Fc(this.h[1],s,w),this.h[1]=Fc(this.h[2],a,P),this.h[2]=Fc(this.h[3],f,h),this.h[3]=Fc(this.h[4],i,u),this.h[4]=Fc(this.h[0],n,g),this.h[0]=O},Wn.prototype._digest=function(e){return e==="hex"?Eo.toHex32(this.h,"little"):Eo.split32(this.h,"little")};function Mv(r,e,t,i){return r<=15?e^t^i:r<=31?e&t|~e&i:r<=47?(e|~t)^i:r<=63?e&i|t&~i:e^(t|~i)}function r_(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function i_(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var n_=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],s_=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],o_=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],a_=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c_=$t,f_=Ao;function Ca(r,e,t){if(!(this instanceof Ca))return new Ca(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(c_.toArray(e,t))}var l_=Ca;Ca.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),f_(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Ca.prototype.update=function(e,t){return this.inner.update(e,t),this},Ca.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(r){var e=r;e.utils=$t,e.common=Aa,e.sha=Ea,e.ripemd=Av,e.hmac=l_,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Ri);function Pa(r,e,t){return t={path:e,exports:{},require:function(i,n){return h_(i,n??t.path)}},r(t,t.exports),t.exports}function h_(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var dd=Cv;function Cv(r,e){if(!r)throw new Error(e||"Assertion failed")}Cv.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var xn=Pa(function(r,e){var t=e;function i(a,f){if(Array.isArray(a))return a.slice();if(!a)return[];var h=[];if(typeof a!="string"){for(var u=0;u<a.length;u++)h[u]=a[u]|0;return h}if(f==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var u=0;u<a.length;u+=2)h.push(parseInt(a[u]+a[u+1],16))}else for(var u=0;u<a.length;u++){var g=a.charCodeAt(u),w=g>>8,P=g&255;w?h.push(w,P):h.push(P)}return h}t.toArray=i;function n(a){return a.length===1?"0"+a:a}t.zero2=n;function s(a){for(var f="",h=0;h<a.length;h++)f+=n(a[h].toString(16));return f}t.toHex=s,t.encode=function(f,h){return h==="hex"?s(f):f}}),Ti=Pa(function(r,e){var t=e;t.assert=dd,t.toArray=xn.toArray,t.zero2=xn.zero2,t.toHex=xn.toHex,t.encode=xn.encode;function i(h,u,g){var w=new Array(Math.max(h.bitLength(),g)+1);w.fill(0);for(var P=1<<u+1,M=h.clone(),O=0;O<w.length;O++){var $,W=M.andln(P-1);M.isOdd()?(W>(P>>1)-1?$=(P>>1)-W:$=W,M.isubn($)):$=0,w[O]=$,M.iushrn(1)}return w}t.getNAF=i;function n(h,u){var g=[[],[]];h=h.clone(),u=u.clone();for(var w=0,P=0,M;h.cmpn(-w)>0||u.cmpn(-P)>0;){var O=h.andln(3)+w&3,$=u.andln(3)+P&3;O===3&&(O=-1),$===3&&($=-1);var W;O&1?(M=h.andln(7)+w&7,(M===3||M===5)&&$===2?W=-O:W=O):W=0,g[0].push(W);var H;$&1?(M=u.andln(7)+P&7,(M===3||M===5)&&O===2?H=-$:H=$):H=0,g[1].push(H),2*w===W+1&&(w=1-w),2*P===H+1&&(P=1-P),h.iushrn(1),u.iushrn(1)}return g}t.getJSF=n;function s(h,u,g){var w="_"+u;h.prototype[u]=function(){return this[w]!==void 0?this[w]:this[w]=g.call(this)}}t.cachedProperty=s;function a(h){return typeof h=="string"?t.toArray(h,"hex"):h}t.parseBytes=a;function f(h){return new vt(h,"hex","le")}t.intFromLE=f}),ll=Ti.getNAF,u_=Ti.getJSF,hl=Ti.assert;function Us(r,e){this.type=r,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var So=Us;Us.prototype.point=function(){throw new Error("Not implemented")},Us.prototype.validate=function(){throw new Error("Not implemented")},Us.prototype._fixedNafMul=function(e,t){hl(e.precomputed);var i=e._getDoubles(),n=ll(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),P=s;P>0;P--){for(f=0;f<a.length;f++)h=a[f],h===P?w=w.mixedAdd(i.points[f]):h===-P&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},Us.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=ll(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];hl(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},Us.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,P;for(g=0;g<n;g++){P=t[g];var M=P._getNAFPoints(e);a[g]=M.wnd,f[g]=M.points}for(g=n-1;g>=1;g-=2){var O=g-1,$=g;if(a[O]!==1||a[$]!==1){h[O]=ll(i[O],a[O],this._bitLength),h[$]=ll(i[$],a[$],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[$].length,u);continue}var W=[t[O],null,null,t[$]];t[O].y.cmp(t[$].y)===0?(W[1]=t[O].add(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg())):t[O].y.cmp(t[$].y.redNeg())===0?(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].add(t[$].neg())):(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],F=u_(i[O],i[$]);for(u=Math.max(F[0].length,u),h[O]=new Array(u),h[$]=new Array(u),w=0;w<u;w++){var Y=F[0][w]|0,B=F[1][w]|0;h[O][w]=H[(Y+1)*3+(B+1)],h[$][w]=0,f[O]=W}}var z=this.jpoint(null,null,null),j=this._wnafT4;for(g=u;g>=0;g--){for(var _=0;g>=0;){var U=!0;for(w=0;w<n;w++)j[w]=h[w][g]|0,j[w]!==0&&(U=!1);if(!U)break;_++,g--}if(g>=0&&_++,z=z.dblp(_),g<0)break;for(w=0;w<n;w++){var ee=j[w];ee!==0&&(ee>0?P=f[w][ee-1>>1]:ee<0&&(P=f[w][-ee-1>>1].neg()),P.type==="affine"?z=z.mixedAdd(P):z=z.add(P))}}for(g=0;g<n;g++)f[g]=null;return s?z:z.toP()};function Gi(r,e){this.curve=r,this.type=e,this.precomputed=null}Us.BasePoint=Gi,Gi.prototype.eq=function(){throw new Error("Not implemented")},Gi.prototype.validate=function(){return this.curve.validate(this)},Us.prototype.decodePoint=function(e,t){e=Ti.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?hl(e[e.length-1]%2===0):e[0]===7&&hl(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Gi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Gi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Gi.prototype.encode=function(e,t){return Ti.encode(this._encode(t),e)},Gi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Gi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Gi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Gi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Gi.prototype._getBeta=function(){return null},Gi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var pd=Pa(function(r){typeof Object.create=="function"?r.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(t,i){if(i){t.super_=i;var n=function(){};n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t}}}),d_=Ti.assert;function Yi(r){So.call(this,"short",r),this.a=new vt(r.a,16).toRed(this.red),this.b=new vt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}pd(Yi,So);var p_=Yi;Yi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new vt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new vt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],d_(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new vt(f.a,16),b:new vt(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},Yi.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:vt.mont(e),i=new vt(2).toRed(t).redInvm(),n=i.redNeg(),s=new vt(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},Yi.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new vt(1),a=new vt(0),f=new vt(0),h=new vt(1),u,g,w,P,M,O,$,W=0,H,F;i.cmpn(0)!==0;){var Y=n.div(i);H=n.sub(Y.mul(i)),F=f.sub(Y.mul(s));var B=h.sub(Y.mul(a));if(!w&&H.cmp(t)<0)u=$.neg(),g=s,w=H.neg(),P=F;else if(w&&++W===2)break;$=H,n=i,i=H,f=s,s=F,h=a,a=B}M=H.neg(),O=F;var z=w.sqr().add(P.sqr()),j=M.sqr().add(O.sqr());return j.cmp(z)>=0&&(M=u,O=g),w.negative&&(w=w.neg(),P=P.neg()),M.negative&&(M=M.neg(),O=O.neg()),[{a:w,b:P},{a:M,b:O}]},Yi.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),P=u.add(g).neg();return{k1:w,k2:P}},Yi.prototype.pointFromX=function(e,t){e=new vt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Yi.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Yi.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Or(r,e,t,i){So.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new vt(e,16),this.y=new vt(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}pd(Or,So.BasePoint),Yi.prototype.point=function(e,t,i){return new Or(this,e,t,i)},Yi.prototype.pointFromJSON=function(e,t){return Or.fromJSON(this,e,t)},Or.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Or.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Or.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Or.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Or.prototype.isInfinity=function(){return this.inf},Or.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Or.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Or.prototype.getX=function(){return this.x.fromRed()},Or.prototype.getY=function(){return this.y.fromRed()},Or.prototype.mul=function(e){return e=new vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Or.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Or.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Or.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Or.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Or.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Hr(r,e,t,i){So.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}pd(Hr,So.BasePoint),Yi.prototype.jpoint=function(e,t,i){return new Hr(this,e,t,i)},Hr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},Hr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Hr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),P=n.redMul(g),M=u.redSqr().redIAdd(w).redISub(P).redISub(P),O=u.redMul(P.redISub(M)).redISub(a.redMul(w)),$=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(M,O,$)},Hr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),P=h.redSqr().redIAdd(g).redISub(w).redISub(w),M=h.redMul(w.redISub(P)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(P,M,O)},Hr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),P=g.redSqr(),M=P.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),$=a.redMul(P),W=O.redSqr().redISub($.redAdd($)),H=$.redISub(W),F=O.redMul(H);F=F.redIAdd(F).redISub(M);var Y=g.redMul(h);t+1<e&&(u=u.redMul(M)),a=W,h=Y,g=F}return this.curve.jpoint(a,g.redMul(s),h)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Hr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),P=this.y.redSqr(),M=P.redSqr(),O=this.x.redAdd(P).redSqr().redISub(w).redISub(M);O=O.redIAdd(O);var $=w.redAdd(w).redIAdd(w),W=$.redSqr(),H=M.redIAdd(M);H=H.redIAdd(H),H=H.redIAdd(H),e=W.redISub(O).redISub(O),t=$.redMul(O.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},Hr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),P=this.y.redSqr(),M=this.x.redMul(P),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var $=M.redIAdd(M);$=$.redIAdd($);var W=$.redAdd($);e=O.redSqr().redISub(W),i=this.y.redAdd(this.z).redSqr().redISub(P).redISub(w);var H=P.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),t=O.redMul($.redISub(e)).redISub(H)}return this.curve.jpoint(e,t,i)},Hr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),P=g.redISub(w),M=f.redSqr();M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=h.redMul(P).redISub(M),$=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,$)},Hr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var P=this.x.redMul(h).redISub(w);P=P.redIAdd(P),P=P.redIAdd(P);var M=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(P,M,O)},Hr.prototype.mul=function(e,t){return e=new vt(e,t),this.curve._wnafMul(this,e)},Hr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Hr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},Hr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Hr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ul=Pa(function(r,e){var t=e;t.base=So,t.short=p_,t.mont=null,t.edwards=null}),dl=Pa(function(r,e){var t=e,i=Ti.assert;function n(f){f.type==="short"?this.curve=new ul.short(f):f.type==="edwards"?this.curve=new ul.edwards(f):this.curve=new ul.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=n;function s(f,h){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var u=new n(h);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ri.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ri.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ri.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ri.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ri.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch{a=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ri.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function qs(r){if(!(this instanceof qs))return new qs(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=xn.toArray(r.entropy,r.entropyEnc||"hex"),t=xn.toArray(r.nonce,r.nonceEnc||"hex"),i=xn.toArray(r.pers,r.persEnc||"hex");dd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var Pv=qs;qs.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},qs.prototype._hmac=function(){return new Ri.hmac(this.hash,this.K)},qs.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},qs.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=xn.toArray(e,t),i=xn.toArray(i,n),dd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},qs.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=xn.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,xn.encode(a,t)};var gd=Ti.assert;function Vr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var vd=Vr;Vr.fromPublic=function(e,t,i){return t instanceof Vr?t:new Vr(e,{pub:t,pubEnc:i})},Vr.fromPrivate=function(e,t,i){return t instanceof Vr?t:new Vr(e,{priv:t,privEnc:i})},Vr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Vr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Vr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Vr.prototype._importPrivate=function(e,t){this.priv=new vt(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Vr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?gd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&gd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Vr.prototype.derive=function(e){return e.validate()||gd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Vr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Vr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Vr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var g_=Ti.assert;function pl(r,e){if(r instanceof pl)return r;this._importDER(r,e)||(g_(r.r&&r.s,"Signature without r or s"),this.r=new vt(r.r,16),this.s=new vt(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var gl=pl;function v_(){this.place=0}function md(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function Dv(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}pl.prototype._importDER=function(e,t){e=Ti.toArray(e,t);var i=new v_;if(e[i.place++]!==48)return!1;var n=md(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=md(e,i);if(s===!1)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=md(e,i);if(f===!1||e.length!==f+i.place)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new vt(a),this.s=new vt(h),this.recoveryParam=null,!0};function bd(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}pl.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=Dv(t),i=Dv(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];bd(n,t.length),n=n.concat(t),n.push(2),bd(n,i.length);var s=n.concat(i),a=[48];return bd(a,s.length),a=a.concat(s),Ti.encode(a,e)};var m_=function(){throw new Error("unsupported")},Ov=Ti.assert;function Ji(r){if(!(this instanceof Ji))return new Ji(r);typeof r=="string"&&(Ov(Object.prototype.hasOwnProperty.call(dl,r),"Unknown curve "+r),r=dl[r]),r instanceof dl.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var b_=Ji;Ji.prototype.keyPair=function(e){return new vd(this,e)},Ji.prototype.keyFromPrivate=function(e,t){return vd.fromPrivate(this,e,t)},Ji.prototype.keyFromPublic=function(e,t){return vd.fromPublic(this,e,t)},Ji.prototype.genKeyPair=function(e){e||(e={});for(var t=new Pv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||m_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new vt(2));;){var s=new vt(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Ji.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Ji.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new vt(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),f=e.toArray("be",s),h=new Pv({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new vt(1)),g=0;;g++){var w=n.k?n.k(g):new vt(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(u)>=0)){var P=this.g.mul(w);if(!P.isInfinity()){var M=P.getX(),O=M.umod(this.n);if(O.cmpn(0)!==0){var $=w.invm(this.n).mul(O.mul(t.getPrivate()).iadd(e));if($=$.umod(this.n),$.cmpn(0)!==0){var W=(P.getY().isOdd()?1:0)|(M.cmp(O)!==0?2:0);return n.canonical&&$.cmp(this.nh)>0&&($=this.n.sub($),W^=1),new gl({r:O,s:$,recoveryParam:W})}}}}}},Ji.prototype.verify=function(e,t,i,n){e=this._truncateToN(new vt(e,16)),i=this.keyFromPublic(i,n),t=new gl(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),h=f.mul(e).umod(this.n),u=f.mul(s).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.eqXToP(s)):(g=this.g.mulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.getX().umod(this.n).cmp(s)===0)},Ji.prototype.recoverPubKey=function(r,e,t,i){Ov((3&t)===t,"The recovery param is more than two bits"),e=new gl(e,i);var n=this.n,s=new vt(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),P=f.mul(g).umod(n);return this.g.mulAdd(w,a,P)},Ji.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new gl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var w_=Pa(function(r,e){var t=e;t.version="6.5.4",t.utils=Ti,t.rand=function(){throw new Error("unsupported")},t.curve=ul,t.curves=dl,t.ec=b_,t.eddsa=null}),y_=w_.ec;const __="signing-key/5.7.0",wd=new xt(__);let yd=null;function Kn(){return yd||(yd=new y_("secp256k1")),yd}class x_{constructor(e){Lc(this,"curve","secp256k1"),Lc(this,"privateKey",ii(e)),s4(this.privateKey)!==32&&wd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Kn().keyFromPrivate(ur(this.privateKey));Lc(this,"publicKey","0x"+t.getPublic(!1,"hex")),Lc(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Lc(this,"_isSigningKey",!0)}_addPoint(e){const t=Kn().keyFromPublic(ur(this.publicKey)),i=Kn().keyFromPublic(ur(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=Kn().keyFromPrivate(ur(this.privateKey)),i=ur(e);i.length!==32&&wd.throwArgumentError("bad digest length","digest",e);const n=t.sign(i,{canonical:!0});return zg({recoveryParam:n.recoveryParam,r:Fn("0x"+n.r.toString(16),32),s:Fn("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Kn().keyFromPrivate(ur(this.privateKey)),i=Kn().keyFromPublic(ur(Rv(e)));return Fn("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function A_(r,e){const t=zg(e),i={r:ur(t.r),s:ur(t.s)};return"0x"+Kn().recoverPubKey(ur(r),i,t.recoveryParam).encode("hex",!1)}function Rv(r,e){const t=ur(r);if(t.length===32){const i=new x_(t);return e?"0x"+Kn().keyFromPrivate(t).getPublic(!0,"hex"):i.publicKey}else{if(t.length===33)return e?ii(t):"0x"+Kn().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Kn().keyFromPublic(t).getPublic(!0,"hex"):ii(t)}return wd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const E_="transactions/5.7.0";new xt(E_);var Tv;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(Tv||(Tv={}));function S_(r){const e=Rv(r);return N4(qg(td(qg(e,1)),12))}function I_(r,e){return S_(A_(ur(r),e))}var _d={},vl={},yt={},$v={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,h){var u=f>>>16&65535,g=f&65535,w=h>>>16&65535,P=h&65535;return g*P+(u*P+g*w<<16>>>0)|0}r.mul=Math.imul||e;function t(f,h){return f+h|0}r.add=t;function i(f,h){return f-h|0}r.sub=i;function n(f,h){return f<<h|f>>>32-h}r.rotl=n;function s(f,h){return f<<32-h|f>>>h}r.rotr=s;function a(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||a,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})($v),Object.defineProperty(yt,"__esModule",{value:!0});var Nv=$v;function M_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}yt.readInt16BE=M_;function C_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}yt.readUint16BE=C_;function P_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}yt.readInt16LE=P_;function D_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}yt.readUint16LE=D_;function Lv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}yt.writeUint16BE=Lv,yt.writeInt16BE=Lv;function Bv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}yt.writeUint16LE=Bv,yt.writeInt16LE=Bv;function xd(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}yt.readInt32BE=xd;function Ad(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}yt.readUint32BE=Ad;function Ed(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}yt.readInt32LE=Ed;function Sd(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}yt.readUint32LE=Sd;function ml(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}yt.writeUint32BE=ml,yt.writeInt32BE=ml;function bl(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}yt.writeUint32LE=bl,yt.writeInt32LE=bl;function O_(r,e){e===void 0&&(e=0);var t=xd(r,e),i=xd(r,e+4);return t*4294967296+i-(i>>31)*4294967296}yt.readInt64BE=O_;function R_(r,e){e===void 0&&(e=0);var t=Ad(r,e),i=Ad(r,e+4);return t*4294967296+i}yt.readUint64BE=R_;function T_(r,e){e===void 0&&(e=0);var t=Ed(r,e),i=Ed(r,e+4);return i*4294967296+t-(t>>31)*4294967296}yt.readInt64LE=T_;function $_(r,e){e===void 0&&(e=0);var t=Sd(r,e),i=Sd(r,e+4);return i*4294967296+t}yt.readUint64LE=$_;function Fv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),ml(r/4294967296>>>0,e,t),ml(r>>>0,e,t+4),e}yt.writeUint64BE=Fv,yt.writeInt64BE=Fv;function Uv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),bl(r>>>0,e,t),bl(r/4294967296>>>0,e,t+4),e}yt.writeUint64LE=Uv,yt.writeInt64LE=Uv;function N_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}yt.readUintBE=N_;function L_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s<t+r/8;s++)i+=e[s]*n,n*=256;return i}yt.readUintLE=L_;function B_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Nv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=r/8+i-1;s>=i;s--)t[s]=e/n&255,n*=256;return t}yt.writeUintBE=B_;function F_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Nv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+r/8;s++)t[s]=e/n&255,n*=256;return t}yt.writeUintLE=F_;function U_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}yt.readFloat32BE=U_;function q_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}yt.readFloat32LE=q_;function z_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}yt.readFloat64BE=z_;function H_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}yt.readFloat64LE=H_;function k_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r),e}yt.writeFloat32BE=k_;function j_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r,!0),e}yt.writeFloat32LE=j_;function W_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r),e}yt.writeFloat64BE=W_;function K_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r,!0),e}yt.writeFloat64LE=K_;var $i={};Object.defineProperty($i,"__esModule",{value:!0});function V_(r){for(var e=0;e<r.length;e++)r[e]=0;return r}$i.wipe=V_,Object.defineProperty(vl,"__esModule",{value:!0});var Gr=yt,Id=$i,G_=20;function Y_(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,a=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],h=t[7]<<24|t[6]<<16|t[5]<<8|t[4],u=t[11]<<24|t[10]<<16|t[9]<<8|t[8],g=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],P=t[23]<<24|t[22]<<16|t[21]<<8|t[20],M=t[27]<<24|t[26]<<16|t[25]<<8|t[24],O=t[31]<<24|t[30]<<16|t[29]<<8|t[28],$=e[3]<<24|e[2]<<16|e[1]<<8|e[0],W=e[7]<<24|e[6]<<16|e[5]<<8|e[4],H=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,B=n,z=s,j=a,_=f,U=h,ee=u,oe=g,L=w,b=P,m=M,l=O,d=$,y=W,C=H,D=F,S=0;S<G_;S+=2)Y=Y+_|0,d^=Y,d=d>>>32-16|d<<16,L=L+d|0,_^=L,_=_>>>32-12|_<<12,B=B+U|0,y^=B,y=y>>>32-16|y<<16,b=b+y|0,U^=b,U=U>>>32-12|U<<12,z=z+ee|0,C^=z,C=C>>>32-16|C<<16,m=m+C|0,ee^=m,ee=ee>>>32-12|ee<<12,j=j+oe|0,D^=j,D=D>>>32-16|D<<16,l=l+D|0,oe^=l,oe=oe>>>32-12|oe<<12,z=z+ee|0,C^=z,C=C>>>32-8|C<<8,m=m+C|0,ee^=m,ee=ee>>>32-7|ee<<7,j=j+oe|0,D^=j,D=D>>>32-8|D<<8,l=l+D|0,oe^=l,oe=oe>>>32-7|oe<<7,B=B+U|0,y^=B,y=y>>>32-8|y<<8,b=b+y|0,U^=b,U=U>>>32-7|U<<7,Y=Y+_|0,d^=Y,d=d>>>32-8|d<<8,L=L+d|0,_^=L,_=_>>>32-7|_<<7,Y=Y+U|0,D^=Y,D=D>>>32-16|D<<16,m=m+D|0,U^=m,U=U>>>32-12|U<<12,B=B+ee|0,d^=B,d=d>>>32-16|d<<16,l=l+d|0,ee^=l,ee=ee>>>32-12|ee<<12,z=z+oe|0,y^=z,y=y>>>32-16|y<<16,L=L+y|0,oe^=L,oe=oe>>>32-12|oe<<12,j=j+_|0,C^=j,C=C>>>32-16|C<<16,b=b+C|0,_^=b,_=_>>>32-12|_<<12,z=z+oe|0,y^=z,y=y>>>32-8|y<<8,L=L+y|0,oe^=L,oe=oe>>>32-7|oe<<7,j=j+_|0,C^=j,C=C>>>32-8|C<<8,b=b+C|0,_^=b,_=_>>>32-7|_<<7,B=B+ee|0,d^=B,d=d>>>32-8|d<<8,l=l+d|0,ee^=l,ee=ee>>>32-7|ee<<7,Y=Y+U|0,D^=Y,D=D>>>32-8|D<<8,m=m+D|0,U^=m,U=U>>>32-7|U<<7;Gr.writeUint32LE(Y+i|0,r,0),Gr.writeUint32LE(B+n|0,r,4),Gr.writeUint32LE(z+s|0,r,8),Gr.writeUint32LE(j+a|0,r,12),Gr.writeUint32LE(_+f|0,r,16),Gr.writeUint32LE(U+h|0,r,20),Gr.writeUint32LE(ee+u|0,r,24),Gr.writeUint32LE(oe+g|0,r,28),Gr.writeUint32LE(L+w|0,r,32),Gr.writeUint32LE(b+P|0,r,36),Gr.writeUint32LE(m+M|0,r,40),Gr.writeUint32LE(l+O|0,r,44),Gr.writeUint32LE(d+$|0,r,48),Gr.writeUint32LE(y+W|0,r,52),Gr.writeUint32LE(C+H|0,r,56),Gr.writeUint32LE(D+F|0,r,60)}function qv(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var s,a;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),a=s.length-e.length,s.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,a=n}for(var f=new Uint8Array(64),h=0;h<t.length;h+=64){Y_(f,s,r);for(var u=h;u<h+64&&u<t.length;u++)i[u]=t[u]^f[u-h];Q_(s,0,a)}return Id.wipe(f),n===0&&Id.wipe(s),i}vl.streamXOR=qv;function J_(r,e,t,i){return i===void 0&&(i=0),Id.wipe(t),qv(r,e,t,t,i)}vl.stream=J_;function Q_(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var zv={},zs={};Object.defineProperty(zs,"__esModule",{value:!0});function Z_(r,e,t){return~(r-1)&e|r-1&t}zs.select=Z_;function X_(r,e){return(r|0)-(e|0)-1>>>31&1}zs.lessOrEqual=X_;function Hv(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}zs.compare=Hv;function e7(r,e){return r.length===0||e.length===0?!1:Hv(r,e)!==0}zs.equal=e7,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=zs,t=$i;r.DIGEST_LENGTH=16;var i=function(){function a(f){this.digestLength=r.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=f[0]|f[1]<<8;this._r[0]=h&8191;var u=f[2]|f[3]<<8;this._r[1]=(h>>>13|u<<3)&8191;var g=f[4]|f[5]<<8;this._r[2]=(u>>>10|g<<6)&7939;var w=f[6]|f[7]<<8;this._r[3]=(g>>>7|w<<9)&8191;var P=f[8]|f[9]<<8;this._r[4]=(w>>>4|P<<12)&255,this._r[5]=P>>>1&8190;var M=f[10]|f[11]<<8;this._r[6]=(P>>>14|M<<2)&8191;var O=f[12]|f[13]<<8;this._r[7]=(M>>>11|O<<5)&8065;var $=f[14]|f[15]<<8;this._r[8]=(O>>>8|$<<8)&8191,this._r[9]=$>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return a.prototype._blocks=function(f,h,u){for(var g=this._fin?0:2048,w=this._h[0],P=this._h[1],M=this._h[2],O=this._h[3],$=this._h[4],W=this._h[5],H=this._h[6],F=this._h[7],Y=this._h[8],B=this._h[9],z=this._r[0],j=this._r[1],_=this._r[2],U=this._r[3],ee=this._r[4],oe=this._r[5],L=this._r[6],b=this._r[7],m=this._r[8],l=this._r[9];u>=16;){var d=f[h+0]|f[h+1]<<8;w+=d&8191;var y=f[h+2]|f[h+3]<<8;P+=(d>>>13|y<<3)&8191;var C=f[h+4]|f[h+5]<<8;M+=(y>>>10|C<<6)&8191;var D=f[h+6]|f[h+7]<<8;O+=(C>>>7|D<<9)&8191;var S=f[h+8]|f[h+9]<<8;$+=(D>>>4|S<<12)&8191,W+=S>>>1&8191;var v=f[h+10]|f[h+11]<<8;H+=(S>>>14|v<<2)&8191;var A=f[h+12]|f[h+13]<<8;F+=(v>>>11|A<<5)&8191;var x=f[h+14]|f[h+15]<<8;Y+=(A>>>8|x<<8)&8191,B+=x>>>5|g;var N=0,ae=N;ae+=w*z,ae+=P*(5*l),ae+=M*(5*m),ae+=O*(5*b),ae+=$*(5*L),N=ae>>>13,ae&=8191,ae+=W*(5*oe),ae+=H*(5*ee),ae+=F*(5*U),ae+=Y*(5*_),ae+=B*(5*j),N+=ae>>>13,ae&=8191;var R=N;R+=w*j,R+=P*z,R+=M*(5*l),R+=O*(5*m),R+=$*(5*b),N=R>>>13,R&=8191,R+=W*(5*L),R+=H*(5*oe),R+=F*(5*ee),R+=Y*(5*U),R+=B*(5*_),N+=R>>>13,R&=8191;var X=N;X+=w*_,X+=P*j,X+=M*z,X+=O*(5*l),X+=$*(5*m),N=X>>>13,X&=8191,X+=W*(5*b),X+=H*(5*L),X+=F*(5*oe),X+=Y*(5*ee),X+=B*(5*U),N+=X>>>13,X&=8191;var V=N;V+=w*U,V+=P*_,V+=M*j,V+=O*z,V+=$*(5*l),N=V>>>13,V&=8191,V+=W*(5*m),V+=H*(5*b),V+=F*(5*L),V+=Y*(5*oe),V+=B*(5*ee),N+=V>>>13,V&=8191;var J=N;J+=w*ee,J+=P*U,J+=M*_,J+=O*j,J+=$*z,N=J>>>13,J&=8191,J+=W*(5*l),J+=H*(5*m),J+=F*(5*b),J+=Y*(5*L),J+=B*(5*oe),N+=J>>>13,J&=8191;var K=N;K+=w*oe,K+=P*ee,K+=M*U,K+=O*_,K+=$*j,N=K>>>13,K&=8191,K+=W*z,K+=H*(5*l),K+=F*(5*m),K+=Y*(5*b),K+=B*(5*L),N+=K>>>13,K&=8191;var E=N;E+=w*L,E+=P*oe,E+=M*ee,E+=O*U,E+=$*_,N=E>>>13,E&=8191,E+=W*j,E+=H*z,E+=F*(5*l),E+=Y*(5*m),E+=B*(5*b),N+=E>>>13,E&=8191;var G=N;G+=w*b,G+=P*L,G+=M*oe,G+=O*ee,G+=$*U,N=G>>>13,G&=8191,G+=W*_,G+=H*j,G+=F*z,G+=Y*(5*l),G+=B*(5*m),N+=G>>>13,G&=8191;var re=N;re+=w*m,re+=P*b,re+=M*L,re+=O*oe,re+=$*ee,N=re>>>13,re&=8191,re+=W*U,re+=H*_,re+=F*j,re+=Y*z,re+=B*(5*l),N+=re>>>13,re&=8191;var le=N;le+=w*l,le+=P*m,le+=M*b,le+=O*L,le+=$*oe,N=le>>>13,le&=8191,le+=W*ee,le+=H*U,le+=F*_,le+=Y*j,le+=B*z,N+=le>>>13,le&=8191,N=(N<<2)+N|0,N=N+ae|0,ae=N&8191,N=N>>>13,R+=N,w=ae,P=R,M=X,O=V,$=J,W=K,H=E,F=G,Y=re,B=le,h+=16,u-=16}this._h[0]=w,this._h[1]=P,this._h[2]=M,this._h[3]=O,this._h[4]=$,this._h[5]=W,this._h[6]=H,this._h[7]=F,this._h[8]=Y,this._h[9]=B},a.prototype.finish=function(f,h){h===void 0&&(h=0);var u=new Uint16Array(10),g,w,P,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(g=this._h[1]>>>13,this._h[1]&=8191,M=2;M<10;M++)this._h[M]+=g,g=this._h[M]>>>13,this._h[M]&=8191;for(this._h[0]+=g*5,g=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=g,g=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=g,u[0]=this._h[0]+5,g=u[0]>>>13,u[0]&=8191,M=1;M<10;M++)u[M]=this._h[M]+g,g=u[M]>>>13,u[M]&=8191;for(u[9]-=8192,w=(g^1)-1,M=0;M<10;M++)u[M]&=w;for(w=~w,M=0;M<10;M++)this._h[M]=this._h[M]&w|u[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,P=this._h[0]+this._pad[0],this._h[0]=P&65535,M=1;M<8;M++)P=(this._h[M]+this._pad[M]|0)+(P>>>16)|0,this._h[M]=P&65535;return f[h+0]=this._h[0]>>>0,f[h+1]=this._h[0]>>>8,f[h+2]=this._h[1]>>>0,f[h+3]=this._h[1]>>>8,f[h+4]=this._h[2]>>>0,f[h+5]=this._h[2]>>>8,f[h+6]=this._h[3]>>>0,f[h+7]=this._h[3]>>>8,f[h+8]=this._h[4]>>>0,f[h+9]=this._h[4]>>>8,f[h+10]=this._h[5]>>>0,f[h+11]=this._h[5]>>>8,f[h+12]=this._h[6]>>>0,f[h+13]=this._h[6]>>>8,f[h+14]=this._h[7]>>>0,f[h+15]=this._h[7]>>>8,this._finished=!0,this},a.prototype.update=function(f){var h=0,u=f.length,g;if(this._leftover){g=16-this._leftover,g>u&&(g=u);for(var w=0;w<g;w++)this._buffer[this._leftover+w]=f[h+w];if(u-=g,h+=g,this._leftover+=g,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(u>=16&&(g=u-u%16,this._blocks(f,h,g),h+=g,u-=g),u){for(var w=0;w<u;w++)this._buffer[this._leftover+w]=f[h+w];this._leftover+=u}return this},a.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},a.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},a}();r.Poly1305=i;function n(a,f){var h=new i(a);h.update(f);var u=h.digest();return h.clean(),u}r.oneTimeAuth=n;function s(a,f){return a.length!==r.DIGEST_LENGTH||f.length!==r.DIGEST_LENGTH?!1:e.equal(a,f)}r.equal=s}(zv),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=vl,t=zv,i=$i,n=yt,s=zs;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var a=new Uint8Array(16),f=function(){function h(u){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,u.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(u)}return h.prototype.seal=function(u,g,w,P){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var M=new Uint8Array(16);M.set(u,M.length-u.length);var O=new Uint8Array(32);e.stream(this._key,M,O,4);var $=g.length+this.tagLength,W;if(P){if(P.length!==$)throw new Error("ChaCha20Poly1305: incorrect destination length");W=P}else W=new Uint8Array($);return e.streamXOR(this._key,M,g,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),O,W.subarray(0,W.length-this.tagLength),w),i.wipe(M),W},h.prototype.open=function(u,g,w,P){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(g.length<this.tagLength)return null;var M=new Uint8Array(16);M.set(u,M.length-u.length);var O=new Uint8Array(32);e.stream(this._key,M,O,4);var $=new Uint8Array(this.tagLength);if(this._authenticate($,O,g.subarray(0,g.length-this.tagLength),w),!s.equal($,g.subarray(g.length-this.tagLength,g.length)))return null;var W=g.length-this.tagLength,H;if(P){if(P.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");H=P}else H=new Uint8Array(W);return e.streamXOR(this._key,M,g.subarray(0,g.length-this.tagLength),H,4),i.wipe(M),H},h.prototype.clean=function(){return i.wipe(this._key),this},h.prototype._authenticate=function(u,g,w,P){var M=new t.Poly1305(g);P&&(M.update(P),P.length%16>0&&M.update(a.subarray(P.length%16))),M.update(w),w.length%16>0&&M.update(a.subarray(w.length%16));var O=new Uint8Array(8);P&&n.writeUint64LE(P.length,O),M.update(O),n.writeUint64LE(w.length,O),M.update(O);for(var $=M.digest(),W=0;W<$.length;W++)u[W]=$[W];M.clean(),i.wipe($),i.wipe(O)},h}();r.ChaCha20Poly1305=f}(_d);var kv={},Uc={},Md={};Object.defineProperty(Md,"__esModule",{value:!0});function t7(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Md.isSerializableHash=t7,Object.defineProperty(Uc,"__esModule",{value:!0});var Vn=Md,r7=zs,i7=$i,jv=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),Vn.isSerializableHash(this._inner)&&Vn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),i7.wipe(i)}return r.prototype.reset=function(){if(!Vn.isSerializableHash(this._inner)||!Vn.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},r.prototype.clean=function(){Vn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Vn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.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)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!Vn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!Vn.isSerializableHash(this._inner)||!Vn.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},r.prototype.cleanSavedState=function(e){if(!Vn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();Uc.HMAC=jv;function n7(r,e,t){var i=new jv(r,e);i.update(t);var n=i.digest();return i.clean(),n}Uc.hmac=n7,Uc.equal=r7.equal,Object.defineProperty(kv,"__esModule",{value:!0});var Wv=Uc,Kv=$i,s7=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Wv.hmac(this._hash,i,t);this._hmac=new Wv.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),Kv.wipe(this._buffer),Kv.wipe(this._counter),this._bufpos=0},r}(),o7=kv.HKDF=s7,Hs={},wl={},yl={};Object.defineProperty(yl,"__esModule",{value:!0}),yl.BrowserRandomSource=void 0;const Vv=65536;class a7{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 t=new Uint8Array(e);for(let i=0;i<t.length;i+=Vv)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,Vv)));return t}}yl.BrowserRandomSource=a7;function c7(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _l={};Object.defineProperty(_l,"__esModule",{value:!0}),_l.NodeRandomSource=void 0;const f7=$i;class l7{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof c7<"u"){const e=il;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=t[n];return(0,f7.wipe)(t),i}}_l.NodeRandomSource=l7,Object.defineProperty(wl,"__esModule",{value:!0}),wl.SystemRandomSource=void 0;const h7=yl,u7=_l;class d7{constructor(){if(this.isAvailable=!1,this.name="",this._source=new h7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new u7.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)}}wl.SystemRandomSource=d7,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=wl,t=yt,i=$i;r.defaultRandomSource=new e.SystemRandomSource;function n(u,g=r.defaultRandomSource){return g.randomBytes(u)}r.randomBytes=n;function s(u=r.defaultRandomSource){const g=n(4,u),w=(0,t.readUint32LE)(g);return(0,i.wipe)(g),w}r.randomUint32=s;const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(u,g=a,w=r.defaultRandomSource){if(g.length<2)throw new Error("randomString charset is too short");if(g.length>256)throw new Error("randomString charset is too long");let P="";const M=g.length,O=256-256%M;for(;u>0;){const $=n(Math.ceil(u*256/O),w);for(let W=0;W<$.length&&u>0;W++){const H=$[W];H<O&&(P+=g.charAt(H%M),u--)}(0,i.wipe)($)}return P}r.randomString=f;function h(u,g=a,w=r.defaultRandomSource){const P=Math.ceil(u/(Math.log(g.length)/Math.LN2));return f(P,g,w)}r.randomStringForEntropy=h}(Hs);var qc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=$i;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.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 f.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},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._temp,this._state,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,P=u<<3,M=u%64<56?64:128;this._buffer[g]=128;for(var O=g+1;O<M-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,M-8),e.writeUint32BE(P,this._buffer,M-4),s(this._temp,this._state,this._buffer,0,M),this._finished=!0}for(var O=0;O<this.digestLength/4;O++)e.writeUint32BE(this._state[O],h,O*4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.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}},f.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},f.prototype.cleanSavedState=function(h){t.wipe(h.state),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA256=i;var n=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(f,h,u,g,w){for(;w>=64;){for(var P=h[0],M=h[1],O=h[2],$=h[3],W=h[4],H=h[5],F=h[6],Y=h[7],B=0;B<16;B++){var z=g+B*4;f[B]=e.readUint32BE(u,z)}for(var B=16;B<64;B++){var j=f[B-2],_=(j>>>17|j<<32-17)^(j>>>19|j<<32-19)^j>>>10;j=f[B-15];var U=(j>>>7|j<<32-7)^(j>>>18|j<<32-18)^j>>>3;f[B]=(_+f[B-7]|0)+(U+f[B-16]|0)}for(var B=0;B<64;B++){var _=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&H^~W&F)|0)+(Y+(n[B]+f[B]|0)|0)|0,U=((P>>>2|P<<32-2)^(P>>>13|P<<32-13)^(P>>>22|P<<32-22))+(P&M^P&O^M&O)|0;Y=F,F=H,H=W,W=$+_|0,$=O,O=M,M=P,P=_+U|0}h[0]+=P,h[1]+=M,h[2]+=O,h[3]+=$,h[4]+=W,h[5]+=H,h[6]+=F,h[7]+=Y,g+=64,w-=64}return g}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(qc);var Cd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=Hs,t=$i;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const z=new Float64Array(16);if(B)for(let j=0;j<B.length;j++)z[j]=B[j];return z}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function a(B){let z=1;for(let j=0;j<16;j++){let _=B[j]+z+65535;z=Math.floor(_/65536),B[j]=_-z*65536}B[0]+=z-1+37*(z-1)}function f(B,z,j){const _=~(j-1);for(let U=0;U<16;U++){const ee=_&(B[U]^z[U]);B[U]^=ee,z[U]^=ee}}function h(B,z){const j=i(),_=i();for(let U=0;U<16;U++)_[U]=z[U];a(_),a(_),a(_);for(let U=0;U<2;U++){j[0]=_[0]-65517;for(let oe=1;oe<15;oe++)j[oe]=_[oe]-65535-(j[oe-1]>>16&1),j[oe-1]&=65535;j[15]=_[15]-32767-(j[14]>>16&1);const ee=j[15]>>16&1;j[14]&=65535,f(_,j,1-ee)}for(let U=0;U<16;U++)B[2*U]=_[U]&255,B[2*U+1]=_[U]>>8}function u(B,z){for(let j=0;j<16;j++)B[j]=z[2*j]+(z[2*j+1]<<8);B[15]&=32767}function g(B,z,j){for(let _=0;_<16;_++)B[_]=z[_]+j[_]}function w(B,z,j){for(let _=0;_<16;_++)B[_]=z[_]-j[_]}function P(B,z,j){let _,U,ee=0,oe=0,L=0,b=0,m=0,l=0,d=0,y=0,C=0,D=0,S=0,v=0,A=0,x=0,N=0,ae=0,R=0,X=0,V=0,J=0,K=0,E=0,G=0,re=0,le=0,he=0,ge=0,He=0,Te=0,Ce=0,Xe=0,$e=j[0],be=j[1],Pe=j[2],De=j[3],ye=j[4],Ie=j[5],Oe=j[6],me=j[7],Me=j[8],Be=j[9],we=j[10],ke=j[11],We=j[12],xe=j[13],Ve=j[14],Ke=j[15];_=z[0],ee+=_*$e,oe+=_*be,L+=_*Pe,b+=_*De,m+=_*ye,l+=_*Ie,d+=_*Oe,y+=_*me,C+=_*Me,D+=_*Be,S+=_*we,v+=_*ke,A+=_*We,x+=_*xe,N+=_*Ve,ae+=_*Ke,_=z[1],oe+=_*$e,L+=_*be,b+=_*Pe,m+=_*De,l+=_*ye,d+=_*Ie,y+=_*Oe,C+=_*me,D+=_*Me,S+=_*Be,v+=_*we,A+=_*ke,x+=_*We,N+=_*xe,ae+=_*Ve,R+=_*Ke,_=z[2],L+=_*$e,b+=_*be,m+=_*Pe,l+=_*De,d+=_*ye,y+=_*Ie,C+=_*Oe,D+=_*me,S+=_*Me,v+=_*Be,A+=_*we,x+=_*ke,N+=_*We,ae+=_*xe,R+=_*Ve,X+=_*Ke,_=z[3],b+=_*$e,m+=_*be,l+=_*Pe,d+=_*De,y+=_*ye,C+=_*Ie,D+=_*Oe,S+=_*me,v+=_*Me,A+=_*Be,x+=_*we,N+=_*ke,ae+=_*We,R+=_*xe,X+=_*Ve,V+=_*Ke,_=z[4],m+=_*$e,l+=_*be,d+=_*Pe,y+=_*De,C+=_*ye,D+=_*Ie,S+=_*Oe,v+=_*me,A+=_*Me,x+=_*Be,N+=_*we,ae+=_*ke,R+=_*We,X+=_*xe,V+=_*Ve,J+=_*Ke,_=z[5],l+=_*$e,d+=_*be,y+=_*Pe,C+=_*De,D+=_*ye,S+=_*Ie,v+=_*Oe,A+=_*me,x+=_*Me,N+=_*Be,ae+=_*we,R+=_*ke,X+=_*We,V+=_*xe,J+=_*Ve,K+=_*Ke,_=z[6],d+=_*$e,y+=_*be,C+=_*Pe,D+=_*De,S+=_*ye,v+=_*Ie,A+=_*Oe,x+=_*me,N+=_*Me,ae+=_*Be,R+=_*we,X+=_*ke,V+=_*We,J+=_*xe,K+=_*Ve,E+=_*Ke,_=z[7],y+=_*$e,C+=_*be,D+=_*Pe,S+=_*De,v+=_*ye,A+=_*Ie,x+=_*Oe,N+=_*me,ae+=_*Me,R+=_*Be,X+=_*we,V+=_*ke,J+=_*We,K+=_*xe,E+=_*Ve,G+=_*Ke,_=z[8],C+=_*$e,D+=_*be,S+=_*Pe,v+=_*De,A+=_*ye,x+=_*Ie,N+=_*Oe,ae+=_*me,R+=_*Me,X+=_*Be,V+=_*we,J+=_*ke,K+=_*We,E+=_*xe,G+=_*Ve,re+=_*Ke,_=z[9],D+=_*$e,S+=_*be,v+=_*Pe,A+=_*De,x+=_*ye,N+=_*Ie,ae+=_*Oe,R+=_*me,X+=_*Me,V+=_*Be,J+=_*we,K+=_*ke,E+=_*We,G+=_*xe,re+=_*Ve,le+=_*Ke,_=z[10],S+=_*$e,v+=_*be,A+=_*Pe,x+=_*De,N+=_*ye,ae+=_*Ie,R+=_*Oe,X+=_*me,V+=_*Me,J+=_*Be,K+=_*we,E+=_*ke,G+=_*We,re+=_*xe,le+=_*Ve,he+=_*Ke,_=z[11],v+=_*$e,A+=_*be,x+=_*Pe,N+=_*De,ae+=_*ye,R+=_*Ie,X+=_*Oe,V+=_*me,J+=_*Me,K+=_*Be,E+=_*we,G+=_*ke,re+=_*We,le+=_*xe,he+=_*Ve,ge+=_*Ke,_=z[12],A+=_*$e,x+=_*be,N+=_*Pe,ae+=_*De,R+=_*ye,X+=_*Ie,V+=_*Oe,J+=_*me,K+=_*Me,E+=_*Be,G+=_*we,re+=_*ke,le+=_*We,he+=_*xe,ge+=_*Ve,He+=_*Ke,_=z[13],x+=_*$e,N+=_*be,ae+=_*Pe,R+=_*De,X+=_*ye,V+=_*Ie,J+=_*Oe,K+=_*me,E+=_*Me,G+=_*Be,re+=_*we,le+=_*ke,he+=_*We,ge+=_*xe,He+=_*Ve,Te+=_*Ke,_=z[14],N+=_*$e,ae+=_*be,R+=_*Pe,X+=_*De,V+=_*ye,J+=_*Ie,K+=_*Oe,E+=_*me,G+=_*Me,re+=_*Be,le+=_*we,he+=_*ke,ge+=_*We,He+=_*xe,Te+=_*Ve,Ce+=_*Ke,_=z[15],ae+=_*$e,R+=_*be,X+=_*Pe,V+=_*De,J+=_*ye,K+=_*Ie,E+=_*Oe,G+=_*me,re+=_*Me,le+=_*Be,he+=_*we,ge+=_*ke,He+=_*We,Te+=_*xe,Ce+=_*Ve,Xe+=_*Ke,ee+=38*R,oe+=38*X,L+=38*V,b+=38*J,m+=38*K,l+=38*E,d+=38*G,y+=38*re,C+=38*le,D+=38*he,S+=38*ge,v+=38*He,A+=38*Te,x+=38*Ce,N+=38*Xe,U=1,_=ee+U+65535,U=Math.floor(_/65536),ee=_-U*65536,_=oe+U+65535,U=Math.floor(_/65536),oe=_-U*65536,_=L+U+65535,U=Math.floor(_/65536),L=_-U*65536,_=b+U+65535,U=Math.floor(_/65536),b=_-U*65536,_=m+U+65535,U=Math.floor(_/65536),m=_-U*65536,_=l+U+65535,U=Math.floor(_/65536),l=_-U*65536,_=d+U+65535,U=Math.floor(_/65536),d=_-U*65536,_=y+U+65535,U=Math.floor(_/65536),y=_-U*65536,_=C+U+65535,U=Math.floor(_/65536),C=_-U*65536,_=D+U+65535,U=Math.floor(_/65536),D=_-U*65536,_=S+U+65535,U=Math.floor(_/65536),S=_-U*65536,_=v+U+65535,U=Math.floor(_/65536),v=_-U*65536,_=A+U+65535,U=Math.floor(_/65536),A=_-U*65536,_=x+U+65535,U=Math.floor(_/65536),x=_-U*65536,_=N+U+65535,U=Math.floor(_/65536),N=_-U*65536,_=ae+U+65535,U=Math.floor(_/65536),ae=_-U*65536,ee+=U-1+37*(U-1),U=1,_=ee+U+65535,U=Math.floor(_/65536),ee=_-U*65536,_=oe+U+65535,U=Math.floor(_/65536),oe=_-U*65536,_=L+U+65535,U=Math.floor(_/65536),L=_-U*65536,_=b+U+65535,U=Math.floor(_/65536),b=_-U*65536,_=m+U+65535,U=Math.floor(_/65536),m=_-U*65536,_=l+U+65535,U=Math.floor(_/65536),l=_-U*65536,_=d+U+65535,U=Math.floor(_/65536),d=_-U*65536,_=y+U+65535,U=Math.floor(_/65536),y=_-U*65536,_=C+U+65535,U=Math.floor(_/65536),C=_-U*65536,_=D+U+65535,U=Math.floor(_/65536),D=_-U*65536,_=S+U+65535,U=Math.floor(_/65536),S=_-U*65536,_=v+U+65535,U=Math.floor(_/65536),v=_-U*65536,_=A+U+65535,U=Math.floor(_/65536),A=_-U*65536,_=x+U+65535,U=Math.floor(_/65536),x=_-U*65536,_=N+U+65535,U=Math.floor(_/65536),N=_-U*65536,_=ae+U+65535,U=Math.floor(_/65536),ae=_-U*65536,ee+=U-1+37*(U-1),B[0]=ee,B[1]=oe,B[2]=L,B[3]=b,B[4]=m,B[5]=l,B[6]=d,B[7]=y,B[8]=C,B[9]=D,B[10]=S,B[11]=v,B[12]=A,B[13]=x,B[14]=N,B[15]=ae}function M(B,z){P(B,z,z)}function O(B,z){const j=i();for(let _=0;_<16;_++)j[_]=z[_];for(let _=253;_>=0;_--)M(j,j),_!==2&&_!==4&&P(j,j,z);for(let _=0;_<16;_++)B[_]=j[_]}function $(B,z){const j=new Uint8Array(32),_=new Float64Array(80),U=i(),ee=i(),oe=i(),L=i(),b=i(),m=i();for(let C=0;C<31;C++)j[C]=B[C];j[31]=B[31]&127|64,j[0]&=248,u(_,z);for(let C=0;C<16;C++)ee[C]=_[C];U[0]=L[0]=1;for(let C=254;C>=0;--C){const D=j[C>>>3]>>>(C&7)&1;f(U,ee,D),f(oe,L,D),g(b,U,oe),w(U,U,oe),g(oe,ee,L),w(ee,ee,L),M(L,b),M(m,U),P(U,oe,U),P(oe,ee,b),g(b,U,oe),w(U,U,oe),M(ee,U),w(oe,L,m),P(U,oe,s),g(U,U,L),P(oe,oe,U),P(U,L,m),P(L,ee,_),M(ee,b),f(U,ee,D),f(oe,L,D)}for(let C=0;C<16;C++)_[C+16]=U[C],_[C+32]=oe[C],_[C+48]=ee[C],_[C+64]=L[C];const l=_.subarray(32),d=_.subarray(16);O(l,l),P(d,d,l);const y=new Uint8Array(32);return h(y,d),y}r.scalarMult=$;function W(B){return $(B,n)}r.scalarMultBase=W;function H(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:W(z),secretKey:z}}r.generateKeyPairFromSeed=H;function F(B){const z=(0,e.randomBytes)(32,B),j=H(z);return(0,t.wipe)(z),j}r.generateKeyPair=F;function Y(B,z,j=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=$(B,z);if(j){let U=0;for(let ee=0;ee<_.length;ee++)U|=_[ee];if(U===0)throw new Error("X25519: invalid shared key")}return _}r.sharedKey=Y})(Cd);function Gv(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Pd(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=Gv(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t}function p7(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var $=0,W=0,H=0,F=O.length;H!==F&&O[H]===0;)H++,$++;for(var Y=(F-H)*g+1>>>0,B=new Uint8Array(Y);H!==F;){for(var z=O[H],j=0,_=Y-1;(z!==0||j<W)&&_!==-1;_--,j++)z+=256*B[_]>>>0,B[_]=z%f>>>0,z=z/f>>>0;if(z!==0)throw new Error("Non-zero carry");W=j,H++}for(var U=Y-W;U!==Y&&B[U]===0;)U++;for(var ee=h.repeat($);U<Y;++U)ee+=r.charAt(B[U]);return ee}function P(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var $=0;if(O[$]!==" "){for(var W=0,H=0;O[$]===h;)W++,$++;for(var F=(O.length-$)*u+1>>>0,Y=new Uint8Array(F);O[$];){var B=t[O.charCodeAt($)];if(B===255)return;for(var z=0,j=F-1;(B!==0||z<H)&&j!==-1;j--,z++)B+=f*Y[j]>>>0,Y[j]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");H=z,$++}if(O[$]!==" "){for(var _=F-H;_!==F&&Y[_]===0;)_++;for(var U=new Uint8Array(W+(F-_)),ee=W;_!==F;)U[ee++]=Y[_++];return U}}}function M(O){var $=P(O);if($)return $;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:M}}var g7=p7,v7=g7;const Yv=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},m7=r=>new TextEncoder().encode(r),b7=r=>new TextDecoder().decode(r);class w7{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class y7{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 Jv(this,e)}}class _7{constructor(e){this.decoders=e}or(e){return Jv(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Jv=(r,e)=>new _7({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class x7{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new w7(e,t,i),this.decoder=new y7(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const xl=({name:r,prefix:e,encode:t,decode:i})=>new x7(r,e,t,i),zc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=v7(t,e);return xl({prefix:r,name:e,encode:i,decode:s=>Yv(n(s))})},A7=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},E7=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},kr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>xl({prefix:e,name:r,encode(n){return E7(n,i,t)},decode(n){return A7(n,i,t,r)}}),S7=xl({prefix:"\0",name:"identity",encode:r=>b7(r),decode:r=>m7(r)});var I7=Object.freeze({__proto__:null,identity:S7});const M7=kr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var C7=Object.freeze({__proto__:null,base2:M7});const P7=kr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var D7=Object.freeze({__proto__:null,base8:P7});const O7=zc({prefix:"9",name:"base10",alphabet:"0123456789"});var R7=Object.freeze({__proto__:null,base10:O7});const T7=kr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$7=kr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var N7=Object.freeze({__proto__:null,base16:T7,base16upper:$7});const L7=kr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),B7=kr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),F7=kr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),U7=kr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q7=kr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),z7=kr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),H7=kr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),k7=kr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),j7=kr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var W7=Object.freeze({__proto__:null,base32:L7,base32upper:B7,base32pad:F7,base32padupper:U7,base32hex:q7,base32hexupper:z7,base32hexpad:H7,base32hexpadupper:k7,base32z:j7});const K7=zc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),V7=zc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var G7=Object.freeze({__proto__:null,base36:K7,base36upper:V7});const Y7=zc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),J7=zc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Q7=Object.freeze({__proto__:null,base58btc:Y7,base58flickr:J7});const Z7=kr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),X7=kr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),e9=kr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),t9=kr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var r9=Object.freeze({__proto__:null,base64:Z7,base64pad:X7,base64url:e9,base64urlpad:t9});const Qv=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}"),i9=Qv.reduce((r,e,t)=>(r[t]=e,r),[]),n9=Qv.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function s9(r){return r.reduce((e,t)=>(e+=i9[t],e),"")}function o9(r){const e=[];for(const t of r){const i=n9[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const a9=xl({prefix:"\u{1F680}",name:"base256emoji",encode:s9,decode:o9});var c9=Object.freeze({__proto__:null,base256emoji:a9}),f9=Xv,Zv=128,l9=127,h9=~l9,u9=Math.pow(2,31);function Xv(r,e,t){e=e||[],t=t||0;for(var i=t;r>=u9;)e[t++]=r&255|Zv,r/=128;for(;r&h9;)e[t++]=r&255|Zv,r>>>=7;return e[t]=r|0,Xv.bytes=t-i+1,e}var d9=Dd,p9=128,em=127;function Dd(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw Dd.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&em)<<n:(a&em)*Math.pow(2,n),n+=7}while(a>=p9);return Dd.bytes=s-i,t}var g9=Math.pow(2,7),v9=Math.pow(2,14),m9=Math.pow(2,21),b9=Math.pow(2,28),w9=Math.pow(2,35),y9=Math.pow(2,42),_9=Math.pow(2,49),x9=Math.pow(2,56),A9=Math.pow(2,63),E9=function(r){return r<g9?1:r<v9?2:r<m9?3:r<b9?4:r<w9?5:r<y9?6:r<_9?7:r<x9?8:r<A9?9:10},S9={encode:f9,decode:d9,encodingLength:E9},tm=S9;const rm=(r,e,t=0)=>(tm.encode(r,e,t),e),im=r=>tm.encodingLength(r),Od=(r,e)=>{const t=e.byteLength,i=im(r),n=i+im(t),s=new Uint8Array(n+t);return rm(r,s,0),rm(t,s,i),s.set(e,n),new I9(r,t,e,s)};class I9{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const nm=({name:r,code:e,encode:t})=>new M9(r,e,t);class M9{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Od(this.code,t):t.then(i=>Od(this.code,i))}else throw Error("Unknown type, must be binary type")}}const sm=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),C9=nm({name:"sha2-256",code:18,encode:sm("SHA-256")}),P9=nm({name:"sha2-512",code:19,encode:sm("SHA-512")});var D9=Object.freeze({__proto__:null,sha256:C9,sha512:P9});const om=0,O9="identity",am=Yv;var R9=Object.freeze({__proto__:null,identity:{code:om,name:O9,encode:am,digest:r=>Od(om,am(r))}});new TextEncoder,new TextDecoder;const Da={...I7,...C7,...D7,...R7,...N7,...W7,...G7,...Q7,...r9,...c9};({...D9,...R9});function cm(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const fm=cm("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Rd=cm("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Gv(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),lm={utf8:fm,"utf-8":fm,hex:Da.base16,latin1:Rd,ascii:Rd,binary:Rd,...Da};function Qi(r,e="utf8"){const t=lm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function Ni(r,e="utf8"){const t=lm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var hm={},T9="elliptic",$9="6.6.0",N9="EC cryptography",L9="lib/elliptic.js",B9=["lib"],F9={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},U9={type:"git",url:"git@github.com:indutny/elliptic"},q9=["EC","Elliptic","curve","Cryptography"],z9="Fedor Indutny <fedor@indutny.com>",H9="MIT",k9={url:"https://github.com/indutny/elliptic/issues"},j9="https://github.com/indutny/elliptic",W9={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},K9={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},V9={name:T9,version:$9,description:N9,main:L9,files:B9,scripts:F9,repository:U9,keywords:q9,author:z9,license:H9,bugs:k9,homepage:j9,devDependencies:W9,dependencies:K9},Li={},Gn={exports:{}};(function(r){(function(e,t){function i(L,b){if(!L)throw new Error(b||"Assertion failed")}function n(L,b){L.super_=b;var m=function(){};m.prototype=b.prototype,L.prototype=new m,L.prototype.constructor=L}function s(L,b,m){if(s.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((b==="le"||b==="be")&&(m=b,b=10),this._init(L||0,b||10,m||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=il.Buffer}catch{}s.isBN=function(b){return b instanceof s?!0:b!==null&&typeof b=="object"&&b.constructor.wordSize===s.wordSize&&Array.isArray(b.words)},s.max=function(b,m){return b.cmp(m)>0?b:m},s.min=function(b,m){return b.cmp(m)<0?b:m},s.prototype._init=function(b,m,l){if(typeof b=="number")return this._initNumber(b,m,l);if(typeof b=="object")return this._initArray(b,m,l);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),b=b.toString().replace(/\s+/g,"");var d=0;b[0]==="-"&&(d++,this.negative=1),d<b.length&&(m===16?this._parseHex(b,d,l):(this._parseBase(b,m,d),l==="le"&&this._initArray(this.toArray(),m,l)))},s.prototype._initNumber=function(b,m,l){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[b&67108863],this.length=1):b<4503599627370496?(this.words=[b&67108863,b/67108864&67108863],this.length=2):(i(b<9007199254740992),this.words=[b&67108863,b/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),m,l)},s.prototype._initArray=function(b,m,l){if(i(typeof b.length=="number"),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y,C,D=0;if(l==="be")for(d=b.length-1,y=0;d>=0;d-=3)C=b[d]|b[d-1]<<8|b[d-2]<<16,this.words[y]|=C<<D&67108863,this.words[y+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);else if(l==="le")for(d=0,y=0;d<b.length;d+=3)C=b[d]|b[d+1]<<8|b[d+2]<<16,this.words[y]|=C<<D&67108863,this.words[y+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);return this.strip()};function f(L,b){var m=L.charCodeAt(b);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function h(L,b,m){var l=f(L,m);return m-1>=b&&(l|=f(L,m-1)<<4),l}s.prototype._parseHex=function(b,m,l){this.length=Math.ceil((b.length-m)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y=0,C=0,D;if(l==="be")for(d=b.length-1;d>=m;d-=2)D=h(b,m,d)<<y,this.words[C]|=D&67108863,y>=18?(y-=18,C+=1,this.words[C]|=D>>>26):y+=8;else{var S=b.length-m;for(d=S%2===0?m+1:m;d<b.length;d+=2)D=h(b,m,d)<<y,this.words[C]|=D&67108863,y>=18?(y-=18,C+=1,this.words[C]|=D>>>26):y+=8}this.strip()};function u(L,b,m,l){for(var d=0,y=Math.min(L.length,m),C=b;C<y;C++){var D=L.charCodeAt(C)-48;d*=l,D>=49?d+=D-49+10:D>=17?d+=D-17+10:d+=D}return d}s.prototype._parseBase=function(b,m,l){this.words=[0],this.length=1;for(var d=0,y=1;y<=67108863;y*=m)d++;d--,y=y/m|0;for(var C=b.length-l,D=C%d,S=Math.min(C,C-D)+l,v=0,A=l;A<S;A+=d)v=u(b,A,A+d,m),this.imuln(y),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(D!==0){var x=1;for(v=u(b,A,b.length,m),A=0;A<D;A++)x*=m;this.imuln(x),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this.strip()},s.prototype.copy=function(b){b.words=new Array(this.length);for(var m=0;m<this.length;m++)b.words[m]=this.words[m];b.length=this.length,b.negative=this.negative,b.red=this.red},s.prototype.clone=function(){var b=new s(null);return this.copy(b),b},s.prototype._expand=function(b){for(;this.length<b;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var g=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(b,m){b=b||10,m=m|0||1;var l;if(b===16||b==="hex"){l="";for(var d=0,y=0,C=0;C<this.length;C++){var D=this.words[C],S=((D<<d|y)&16777215).toString(16);y=D>>>24-d&16777215,y!==0||C!==this.length-1?l=g[6-S.length]+S+l:l=S+l,d+=2,d>=26&&(d-=26,C--)}for(y!==0&&(l=y.toString(16)+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(b===(b|0)&&b>=2&&b<=36){var v=w[b],A=P[b];l="";var x=this.clone();for(x.negative=0;!x.isZero();){var N=x.modn(A).toString(b);x=x.idivn(A),x.isZero()?l=N+l:l=g[v-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var b=this.words[0];return this.length===2?b+=this.words[1]*67108864:this.length===3&&this.words[2]===1?b+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-b:b},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(b,m){return i(typeof a<"u"),this.toArrayLike(a,b,m)},s.prototype.toArray=function(b,m){return this.toArrayLike(Array,b,m)},s.prototype.toArrayLike=function(b,m,l){var d=this.byteLength(),y=l||Math.max(1,d);i(d<=y,"byte array longer than desired length"),i(y>0,"Requested array length <= 0"),this.strip();var C=m==="le",D=new b(y),S,v,A=this.clone();if(C){for(v=0;!A.isZero();v++)S=A.andln(255),A.iushrn(8),D[v]=S;for(;v<y;v++)D[v]=0}else{for(v=0;v<y-d;v++)D[v]=0;for(v=0;!A.isZero();v++)S=A.andln(255),A.iushrn(8),D[y-v-1]=S}return D},Math.clz32?s.prototype._countBits=function(b){return 32-Math.clz32(b)}:s.prototype._countBits=function(b){var m=b,l=0;return m>=4096&&(l+=13,m>>>=13),m>=64&&(l+=7,m>>>=7),m>=8&&(l+=4,m>>>=4),m>=2&&(l+=2,m>>>=2),l+m},s.prototype._zeroBits=function(b){if(b===0)return 26;var m=b,l=0;return m&8191||(l+=13,m>>>=13),m&127||(l+=7,m>>>=7),m&15||(l+=4,m>>>=4),m&3||(l+=2,m>>>=2),m&1||l++,l},s.prototype.bitLength=function(){var b=this.words[this.length-1],m=this._countBits(b);return(this.length-1)*26+m};function M(L){for(var b=new Array(L.bitLength()),m=0;m<b.length;m++){var l=m/26|0,d=m%26;b[m]=(L.words[l]&1<<d)>>>d}return b}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,m=0;m<this.length;m++){var l=this._zeroBits(this.words[m]);if(b+=l,l!==26)break}return b},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(b){return this.negative!==0?this.abs().inotn(b).iaddn(1):this.clone()},s.prototype.fromTwos=function(b){return this.testn(b-1)?this.notn(b).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(b){for(;this.length<b.length;)this.words[this.length++]=0;for(var m=0;m<b.length;m++)this.words[m]=this.words[m]|b.words[m];return this.strip()},s.prototype.ior=function(b){return i((this.negative|b.negative)===0),this.iuor(b)},s.prototype.or=function(b){return this.length>b.length?this.clone().ior(b):b.clone().ior(this)},s.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},s.prototype.iuand=function(b){var m;this.length>b.length?m=b:m=this;for(var l=0;l<m.length;l++)this.words[l]=this.words[l]&b.words[l];return this.length=m.length,this.strip()},s.prototype.iand=function(b){return i((this.negative|b.negative)===0),this.iuand(b)},s.prototype.and=function(b){return this.length>b.length?this.clone().iand(b):b.clone().iand(this)},s.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},s.prototype.iuxor=function(b){var m,l;this.length>b.length?(m=this,l=b):(m=b,l=this);for(var d=0;d<l.length;d++)this.words[d]=m.words[d]^l.words[d];if(this!==m)for(;d<m.length;d++)this.words[d]=m.words[d];return this.length=m.length,this.strip()},s.prototype.ixor=function(b){return i((this.negative|b.negative)===0),this.iuxor(b)},s.prototype.xor=function(b){return this.length>b.length?this.clone().ixor(b):b.clone().ixor(this)},s.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},s.prototype.inotn=function(b){i(typeof b=="number"&&b>=0);var m=Math.ceil(b/26)|0,l=b%26;this._expand(m),l>0&&m--;for(var d=0;d<m;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this.strip()},s.prototype.notn=function(b){return this.clone().inotn(b)},s.prototype.setn=function(b,m){i(typeof b=="number"&&b>=0);var l=b/26|0,d=b%26;return this._expand(l+1),m?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this.strip()},s.prototype.iadd=function(b){var m;if(this.negative!==0&&b.negative===0)return this.negative=0,m=this.isub(b),this.negative^=1,this._normSign();if(this.negative===0&&b.negative!==0)return b.negative=0,m=this.isub(b),b.negative=1,m._normSign();var l,d;this.length>b.length?(l=this,d=b):(l=b,d=this);for(var y=0,C=0;C<d.length;C++)m=(l.words[C]|0)+(d.words[C]|0)+y,this.words[C]=m&67108863,y=m>>>26;for(;y!==0&&C<l.length;C++)m=(l.words[C]|0)+y,this.words[C]=m&67108863,y=m>>>26;if(this.length=l.length,y!==0)this.words[this.length]=y,this.length++;else if(l!==this)for(;C<l.length;C++)this.words[C]=l.words[C];return this},s.prototype.add=function(b){var m;return b.negative!==0&&this.negative===0?(b.negative=0,m=this.sub(b),b.negative^=1,m):b.negative===0&&this.negative!==0?(this.negative=0,m=b.sub(this),this.negative=1,m):this.length>b.length?this.clone().iadd(b):b.clone().iadd(this)},s.prototype.isub=function(b){if(b.negative!==0){b.negative=0;var m=this.iadd(b);return b.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var l=this.cmp(b);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,y;l>0?(d=this,y=b):(d=b,y=this);for(var C=0,D=0;D<y.length;D++)m=(d.words[D]|0)-(y.words[D]|0)+C,C=m>>26,this.words[D]=m&67108863;for(;C!==0&&D<d.length;D++)m=(d.words[D]|0)+C,C=m>>26,this.words[D]=m&67108863;if(C===0&&D<d.length&&d!==this)for(;D<d.length;D++)this.words[D]=d.words[D];return this.length=Math.max(this.length,D),d!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(b){return this.clone().isub(b)};function O(L,b,m){m.negative=b.negative^L.negative;var l=L.length+b.length|0;m.length=l,l=l-1|0;var d=L.words[0]|0,y=b.words[0]|0,C=d*y,D=C&67108863,S=C/67108864|0;m.words[0]=D;for(var v=1;v<l;v++){for(var A=S>>>26,x=S&67108863,N=Math.min(v,b.length-1),ae=Math.max(0,v-L.length+1);ae<=N;ae++){var R=v-ae|0;d=L.words[R]|0,y=b.words[ae]|0,C=d*y+x,A+=C/67108864|0,x=C&67108863}m.words[v]=x|0,S=A|0}return S!==0?m.words[v]=S|0:m.length--,m.strip()}var $=function(b,m,l){var d=b.words,y=m.words,C=l.words,D=0,S,v,A,x=d[0]|0,N=x&8191,ae=x>>>13,R=d[1]|0,X=R&8191,V=R>>>13,J=d[2]|0,K=J&8191,E=J>>>13,G=d[3]|0,re=G&8191,le=G>>>13,he=d[4]|0,ge=he&8191,He=he>>>13,Te=d[5]|0,Ce=Te&8191,Xe=Te>>>13,$e=d[6]|0,be=$e&8191,Pe=$e>>>13,De=d[7]|0,ye=De&8191,Ie=De>>>13,Oe=d[8]|0,me=Oe&8191,Me=Oe>>>13,Be=d[9]|0,we=Be&8191,ke=Be>>>13,We=y[0]|0,xe=We&8191,Ve=We>>>13,Ke=y[1]|0,Ge=Ke&8191,mt=Ke>>>13,It=y[2]|0,Ye=It&8191,Pt=It>>>13,Ot=y[3]|0,Ze=Ot&8191,rt=Ot>>>13,et=y[4]|0,Ne=et&8191,it=et>>>13,tt=y[5]|0,Re=tt&8191,lt=tt>>>13,ht=y[6]|0,Le=ht&8191,ut=ht>>>13,nt=y[7]|0,Fe=nt&8191,st=nt>>>13,Qe=y[8]|0,qe=Qe&8191,dt=Qe>>>13,Ht=y[9]|0,at=Ht&8191,kt=Ht>>>13;l.negative=b.negative^m.negative,l.length=19,S=Math.imul(N,xe),v=Math.imul(N,Ve),v=v+Math.imul(ae,xe)|0,A=Math.imul(ae,Ve);var _t=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(X,xe),v=Math.imul(X,Ve),v=v+Math.imul(V,xe)|0,A=Math.imul(V,Ve),S=S+Math.imul(N,Ge)|0,v=v+Math.imul(N,mt)|0,v=v+Math.imul(ae,Ge)|0,A=A+Math.imul(ae,mt)|0;var qt=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(qt>>>26)|0,qt&=67108863,S=Math.imul(K,xe),v=Math.imul(K,Ve),v=v+Math.imul(E,xe)|0,A=Math.imul(E,Ve),S=S+Math.imul(X,Ge)|0,v=v+Math.imul(X,mt)|0,v=v+Math.imul(V,Ge)|0,A=A+Math.imul(V,mt)|0,S=S+Math.imul(N,Ye)|0,v=v+Math.imul(N,Pt)|0,v=v+Math.imul(ae,Ye)|0,A=A+Math.imul(ae,Pt)|0;var Qr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,S=Math.imul(re,xe),v=Math.imul(re,Ve),v=v+Math.imul(le,xe)|0,A=Math.imul(le,Ve),S=S+Math.imul(K,Ge)|0,v=v+Math.imul(K,mt)|0,v=v+Math.imul(E,Ge)|0,A=A+Math.imul(E,mt)|0,S=S+Math.imul(X,Ye)|0,v=v+Math.imul(X,Pt)|0,v=v+Math.imul(V,Ye)|0,A=A+Math.imul(V,Pt)|0,S=S+Math.imul(N,Ze)|0,v=v+Math.imul(N,rt)|0,v=v+Math.imul(ae,Ze)|0,A=A+Math.imul(ae,rt)|0;var Zr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,S=Math.imul(ge,xe),v=Math.imul(ge,Ve),v=v+Math.imul(He,xe)|0,A=Math.imul(He,Ve),S=S+Math.imul(re,Ge)|0,v=v+Math.imul(re,mt)|0,v=v+Math.imul(le,Ge)|0,A=A+Math.imul(le,mt)|0,S=S+Math.imul(K,Ye)|0,v=v+Math.imul(K,Pt)|0,v=v+Math.imul(E,Ye)|0,A=A+Math.imul(E,Pt)|0,S=S+Math.imul(X,Ze)|0,v=v+Math.imul(X,rt)|0,v=v+Math.imul(V,Ze)|0,A=A+Math.imul(V,rt)|0,S=S+Math.imul(N,Ne)|0,v=v+Math.imul(N,it)|0,v=v+Math.imul(ae,Ne)|0,A=A+Math.imul(ae,it)|0;var Xr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,S=Math.imul(Ce,xe),v=Math.imul(Ce,Ve),v=v+Math.imul(Xe,xe)|0,A=Math.imul(Xe,Ve),S=S+Math.imul(ge,Ge)|0,v=v+Math.imul(ge,mt)|0,v=v+Math.imul(He,Ge)|0,A=A+Math.imul(He,mt)|0,S=S+Math.imul(re,Ye)|0,v=v+Math.imul(re,Pt)|0,v=v+Math.imul(le,Ye)|0,A=A+Math.imul(le,Pt)|0,S=S+Math.imul(K,Ze)|0,v=v+Math.imul(K,rt)|0,v=v+Math.imul(E,Ze)|0,A=A+Math.imul(E,rt)|0,S=S+Math.imul(X,Ne)|0,v=v+Math.imul(X,it)|0,v=v+Math.imul(V,Ne)|0,A=A+Math.imul(V,it)|0,S=S+Math.imul(N,Re)|0,v=v+Math.imul(N,lt)|0,v=v+Math.imul(ae,Re)|0,A=A+Math.imul(ae,lt)|0;var ei=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(ei>>>26)|0,ei&=67108863,S=Math.imul(be,xe),v=Math.imul(be,Ve),v=v+Math.imul(Pe,xe)|0,A=Math.imul(Pe,Ve),S=S+Math.imul(Ce,Ge)|0,v=v+Math.imul(Ce,mt)|0,v=v+Math.imul(Xe,Ge)|0,A=A+Math.imul(Xe,mt)|0,S=S+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,Pt)|0,v=v+Math.imul(He,Ye)|0,A=A+Math.imul(He,Pt)|0,S=S+Math.imul(re,Ze)|0,v=v+Math.imul(re,rt)|0,v=v+Math.imul(le,Ze)|0,A=A+Math.imul(le,rt)|0,S=S+Math.imul(K,Ne)|0,v=v+Math.imul(K,it)|0,v=v+Math.imul(E,Ne)|0,A=A+Math.imul(E,it)|0,S=S+Math.imul(X,Re)|0,v=v+Math.imul(X,lt)|0,v=v+Math.imul(V,Re)|0,A=A+Math.imul(V,lt)|0,S=S+Math.imul(N,Le)|0,v=v+Math.imul(N,ut)|0,v=v+Math.imul(ae,Le)|0,A=A+Math.imul(ae,ut)|0;var vr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(vr>>>26)|0,vr&=67108863,S=Math.imul(ye,xe),v=Math.imul(ye,Ve),v=v+Math.imul(Ie,xe)|0,A=Math.imul(Ie,Ve),S=S+Math.imul(be,Ge)|0,v=v+Math.imul(be,mt)|0,v=v+Math.imul(Pe,Ge)|0,A=A+Math.imul(Pe,mt)|0,S=S+Math.imul(Ce,Ye)|0,v=v+Math.imul(Ce,Pt)|0,v=v+Math.imul(Xe,Ye)|0,A=A+Math.imul(Xe,Pt)|0,S=S+Math.imul(ge,Ze)|0,v=v+Math.imul(ge,rt)|0,v=v+Math.imul(He,Ze)|0,A=A+Math.imul(He,rt)|0,S=S+Math.imul(re,Ne)|0,v=v+Math.imul(re,it)|0,v=v+Math.imul(le,Ne)|0,A=A+Math.imul(le,it)|0,S=S+Math.imul(K,Re)|0,v=v+Math.imul(K,lt)|0,v=v+Math.imul(E,Re)|0,A=A+Math.imul(E,lt)|0,S=S+Math.imul(X,Le)|0,v=v+Math.imul(X,ut)|0,v=v+Math.imul(V,Le)|0,A=A+Math.imul(V,ut)|0,S=S+Math.imul(N,Fe)|0,v=v+Math.imul(N,st)|0,v=v+Math.imul(ae,Fe)|0,A=A+Math.imul(ae,st)|0;var Ai=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,S=Math.imul(me,xe),v=Math.imul(me,Ve),v=v+Math.imul(Me,xe)|0,A=Math.imul(Me,Ve),S=S+Math.imul(ye,Ge)|0,v=v+Math.imul(ye,mt)|0,v=v+Math.imul(Ie,Ge)|0,A=A+Math.imul(Ie,mt)|0,S=S+Math.imul(be,Ye)|0,v=v+Math.imul(be,Pt)|0,v=v+Math.imul(Pe,Ye)|0,A=A+Math.imul(Pe,Pt)|0,S=S+Math.imul(Ce,Ze)|0,v=v+Math.imul(Ce,rt)|0,v=v+Math.imul(Xe,Ze)|0,A=A+Math.imul(Xe,rt)|0,S=S+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,it)|0,v=v+Math.imul(He,Ne)|0,A=A+Math.imul(He,it)|0,S=S+Math.imul(re,Re)|0,v=v+Math.imul(re,lt)|0,v=v+Math.imul(le,Re)|0,A=A+Math.imul(le,lt)|0,S=S+Math.imul(K,Le)|0,v=v+Math.imul(K,ut)|0,v=v+Math.imul(E,Le)|0,A=A+Math.imul(E,ut)|0,S=S+Math.imul(X,Fe)|0,v=v+Math.imul(X,st)|0,v=v+Math.imul(V,Fe)|0,A=A+Math.imul(V,st)|0,S=S+Math.imul(N,qe)|0,v=v+Math.imul(N,dt)|0,v=v+Math.imul(ae,qe)|0,A=A+Math.imul(ae,dt)|0;var Mn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Mn>>>26)|0,Mn&=67108863,S=Math.imul(we,xe),v=Math.imul(we,Ve),v=v+Math.imul(ke,xe)|0,A=Math.imul(ke,Ve),S=S+Math.imul(me,Ge)|0,v=v+Math.imul(me,mt)|0,v=v+Math.imul(Me,Ge)|0,A=A+Math.imul(Me,mt)|0,S=S+Math.imul(ye,Ye)|0,v=v+Math.imul(ye,Pt)|0,v=v+Math.imul(Ie,Ye)|0,A=A+Math.imul(Ie,Pt)|0,S=S+Math.imul(be,Ze)|0,v=v+Math.imul(be,rt)|0,v=v+Math.imul(Pe,Ze)|0,A=A+Math.imul(Pe,rt)|0,S=S+Math.imul(Ce,Ne)|0,v=v+Math.imul(Ce,it)|0,v=v+Math.imul(Xe,Ne)|0,A=A+Math.imul(Xe,it)|0,S=S+Math.imul(ge,Re)|0,v=v+Math.imul(ge,lt)|0,v=v+Math.imul(He,Re)|0,A=A+Math.imul(He,lt)|0,S=S+Math.imul(re,Le)|0,v=v+Math.imul(re,ut)|0,v=v+Math.imul(le,Le)|0,A=A+Math.imul(le,ut)|0,S=S+Math.imul(K,Fe)|0,v=v+Math.imul(K,st)|0,v=v+Math.imul(E,Fe)|0,A=A+Math.imul(E,st)|0,S=S+Math.imul(X,qe)|0,v=v+Math.imul(X,dt)|0,v=v+Math.imul(V,qe)|0,A=A+Math.imul(V,dt)|0,S=S+Math.imul(N,at)|0,v=v+Math.imul(N,kt)|0,v=v+Math.imul(ae,at)|0,A=A+Math.imul(ae,kt)|0;var Ei=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,S=Math.imul(we,Ge),v=Math.imul(we,mt),v=v+Math.imul(ke,Ge)|0,A=Math.imul(ke,mt),S=S+Math.imul(me,Ye)|0,v=v+Math.imul(me,Pt)|0,v=v+Math.imul(Me,Ye)|0,A=A+Math.imul(Me,Pt)|0,S=S+Math.imul(ye,Ze)|0,v=v+Math.imul(ye,rt)|0,v=v+Math.imul(Ie,Ze)|0,A=A+Math.imul(Ie,rt)|0,S=S+Math.imul(be,Ne)|0,v=v+Math.imul(be,it)|0,v=v+Math.imul(Pe,Ne)|0,A=A+Math.imul(Pe,it)|0,S=S+Math.imul(Ce,Re)|0,v=v+Math.imul(Ce,lt)|0,v=v+Math.imul(Xe,Re)|0,A=A+Math.imul(Xe,lt)|0,S=S+Math.imul(ge,Le)|0,v=v+Math.imul(ge,ut)|0,v=v+Math.imul(He,Le)|0,A=A+Math.imul(He,ut)|0,S=S+Math.imul(re,Fe)|0,v=v+Math.imul(re,st)|0,v=v+Math.imul(le,Fe)|0,A=A+Math.imul(le,st)|0,S=S+Math.imul(K,qe)|0,v=v+Math.imul(K,dt)|0,v=v+Math.imul(E,qe)|0,A=A+Math.imul(E,dt)|0,S=S+Math.imul(X,at)|0,v=v+Math.imul(X,kt)|0,v=v+Math.imul(V,at)|0,A=A+Math.imul(V,kt)|0;var Cn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,S=Math.imul(we,Ye),v=Math.imul(we,Pt),v=v+Math.imul(ke,Ye)|0,A=Math.imul(ke,Pt),S=S+Math.imul(me,Ze)|0,v=v+Math.imul(me,rt)|0,v=v+Math.imul(Me,Ze)|0,A=A+Math.imul(Me,rt)|0,S=S+Math.imul(ye,Ne)|0,v=v+Math.imul(ye,it)|0,v=v+Math.imul(Ie,Ne)|0,A=A+Math.imul(Ie,it)|0,S=S+Math.imul(be,Re)|0,v=v+Math.imul(be,lt)|0,v=v+Math.imul(Pe,Re)|0,A=A+Math.imul(Pe,lt)|0,S=S+Math.imul(Ce,Le)|0,v=v+Math.imul(Ce,ut)|0,v=v+Math.imul(Xe,Le)|0,A=A+Math.imul(Xe,ut)|0,S=S+Math.imul(ge,Fe)|0,v=v+Math.imul(ge,st)|0,v=v+Math.imul(He,Fe)|0,A=A+Math.imul(He,st)|0,S=S+Math.imul(re,qe)|0,v=v+Math.imul(re,dt)|0,v=v+Math.imul(le,qe)|0,A=A+Math.imul(le,dt)|0,S=S+Math.imul(K,at)|0,v=v+Math.imul(K,kt)|0,v=v+Math.imul(E,at)|0,A=A+Math.imul(E,kt)|0;var Pn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,S=Math.imul(we,Ze),v=Math.imul(we,rt),v=v+Math.imul(ke,Ze)|0,A=Math.imul(ke,rt),S=S+Math.imul(me,Ne)|0,v=v+Math.imul(me,it)|0,v=v+Math.imul(Me,Ne)|0,A=A+Math.imul(Me,it)|0,S=S+Math.imul(ye,Re)|0,v=v+Math.imul(ye,lt)|0,v=v+Math.imul(Ie,Re)|0,A=A+Math.imul(Ie,lt)|0,S=S+Math.imul(be,Le)|0,v=v+Math.imul(be,ut)|0,v=v+Math.imul(Pe,Le)|0,A=A+Math.imul(Pe,ut)|0,S=S+Math.imul(Ce,Fe)|0,v=v+Math.imul(Ce,st)|0,v=v+Math.imul(Xe,Fe)|0,A=A+Math.imul(Xe,st)|0,S=S+Math.imul(ge,qe)|0,v=v+Math.imul(ge,dt)|0,v=v+Math.imul(He,qe)|0,A=A+Math.imul(He,dt)|0,S=S+Math.imul(re,at)|0,v=v+Math.imul(re,kt)|0,v=v+Math.imul(le,at)|0,A=A+Math.imul(le,kt)|0;var Si=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Si>>>26)|0,Si&=67108863,S=Math.imul(we,Ne),v=Math.imul(we,it),v=v+Math.imul(ke,Ne)|0,A=Math.imul(ke,it),S=S+Math.imul(me,Re)|0,v=v+Math.imul(me,lt)|0,v=v+Math.imul(Me,Re)|0,A=A+Math.imul(Me,lt)|0,S=S+Math.imul(ye,Le)|0,v=v+Math.imul(ye,ut)|0,v=v+Math.imul(Ie,Le)|0,A=A+Math.imul(Ie,ut)|0,S=S+Math.imul(be,Fe)|0,v=v+Math.imul(be,st)|0,v=v+Math.imul(Pe,Fe)|0,A=A+Math.imul(Pe,st)|0,S=S+Math.imul(Ce,qe)|0,v=v+Math.imul(Ce,dt)|0,v=v+Math.imul(Xe,qe)|0,A=A+Math.imul(Xe,dt)|0,S=S+Math.imul(ge,at)|0,v=v+Math.imul(ge,kt)|0,v=v+Math.imul(He,at)|0,A=A+Math.imul(He,kt)|0;var cn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(cn>>>26)|0,cn&=67108863,S=Math.imul(we,Re),v=Math.imul(we,lt),v=v+Math.imul(ke,Re)|0,A=Math.imul(ke,lt),S=S+Math.imul(me,Le)|0,v=v+Math.imul(me,ut)|0,v=v+Math.imul(Me,Le)|0,A=A+Math.imul(Me,ut)|0,S=S+Math.imul(ye,Fe)|0,v=v+Math.imul(ye,st)|0,v=v+Math.imul(Ie,Fe)|0,A=A+Math.imul(Ie,st)|0,S=S+Math.imul(be,qe)|0,v=v+Math.imul(be,dt)|0,v=v+Math.imul(Pe,qe)|0,A=A+Math.imul(Pe,dt)|0,S=S+Math.imul(Ce,at)|0,v=v+Math.imul(Ce,kt)|0,v=v+Math.imul(Xe,at)|0,A=A+Math.imul(Xe,kt)|0;var fn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(fn>>>26)|0,fn&=67108863,S=Math.imul(we,Le),v=Math.imul(we,ut),v=v+Math.imul(ke,Le)|0,A=Math.imul(ke,ut),S=S+Math.imul(me,Fe)|0,v=v+Math.imul(me,st)|0,v=v+Math.imul(Me,Fe)|0,A=A+Math.imul(Me,st)|0,S=S+Math.imul(ye,qe)|0,v=v+Math.imul(ye,dt)|0,v=v+Math.imul(Ie,qe)|0,A=A+Math.imul(Ie,dt)|0,S=S+Math.imul(be,at)|0,v=v+Math.imul(be,kt)|0,v=v+Math.imul(Pe,at)|0,A=A+Math.imul(Pe,kt)|0;var Cr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,S=Math.imul(we,Fe),v=Math.imul(we,st),v=v+Math.imul(ke,Fe)|0,A=Math.imul(ke,st),S=S+Math.imul(me,qe)|0,v=v+Math.imul(me,dt)|0,v=v+Math.imul(Me,qe)|0,A=A+Math.imul(Me,dt)|0,S=S+Math.imul(ye,at)|0,v=v+Math.imul(ye,kt)|0,v=v+Math.imul(Ie,at)|0,A=A+Math.imul(Ie,kt)|0;var Dn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,S=Math.imul(we,qe),v=Math.imul(we,dt),v=v+Math.imul(ke,qe)|0,A=Math.imul(ke,dt),S=S+Math.imul(me,at)|0,v=v+Math.imul(me,kt)|0,v=v+Math.imul(Me,at)|0,A=A+Math.imul(Me,kt)|0;var On=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(On>>>26)|0,On&=67108863,S=Math.imul(we,at),v=Math.imul(we,kt),v=v+Math.imul(ke,at)|0,A=Math.imul(ke,kt);var Rn=(D+S|0)+((v&8191)<<13)|0;return D=(A+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,C[0]=_t,C[1]=qt,C[2]=Qr,C[3]=Zr,C[4]=Xr,C[5]=ei,C[6]=vr,C[7]=Ai,C[8]=Mn,C[9]=Ei,C[10]=Cn,C[11]=Pn,C[12]=Si,C[13]=cn,C[14]=fn,C[15]=Cr,C[16]=Dn,C[17]=On,C[18]=Rn,D!==0&&(C[19]=D,l.length++),l};Math.imul||($=O);function W(L,b,m){m.negative=b.negative^L.negative,m.length=L.length+b.length;for(var l=0,d=0,y=0;y<m.length-1;y++){var C=d;d=0;for(var D=l&67108863,S=Math.min(y,b.length-1),v=Math.max(0,y-L.length+1);v<=S;v++){var A=y-v,x=L.words[A]|0,N=b.words[v]|0,ae=x*N,R=ae&67108863;C=C+(ae/67108864|0)|0,R=R+D|0,D=R&67108863,C=C+(R>>>26)|0,d+=C>>>26,C&=67108863}m.words[y]=D,l=C,C=d}return l!==0?m.words[y]=l:m.length--,m.strip()}function H(L,b,m){var l=new F;return l.mulp(L,b,m)}s.prototype.mulTo=function(b,m){var l,d=this.length+b.length;return this.length===10&&b.length===10?l=$(this,b,m):d<63?l=O(this,b,m):d<1024?l=W(this,b,m):l=H(this,b,m),l};function F(L,b){this.x=L,this.y=b}F.prototype.makeRBT=function(b){for(var m=new Array(b),l=s.prototype._countBits(b)-1,d=0;d<b;d++)m[d]=this.revBin(d,l,b);return m},F.prototype.revBin=function(b,m,l){if(b===0||b===l-1)return b;for(var d=0,y=0;y<m;y++)d|=(b&1)<<m-y-1,b>>=1;return d},F.prototype.permute=function(b,m,l,d,y,C){for(var D=0;D<C;D++)d[D]=m[b[D]],y[D]=l[b[D]]},F.prototype.transform=function(b,m,l,d,y,C){this.permute(C,b,m,l,d,y);for(var D=1;D<y;D<<=1)for(var S=D<<1,v=Math.cos(2*Math.PI/S),A=Math.sin(2*Math.PI/S),x=0;x<y;x+=S)for(var N=v,ae=A,R=0;R<D;R++){var X=l[x+R],V=d[x+R],J=l[x+R+D],K=d[x+R+D],E=N*J-ae*K;K=N*K+ae*J,J=E,l[x+R]=X+J,d[x+R]=V+K,l[x+R+D]=X-J,d[x+R+D]=V-K,R!==S&&(E=v*N-A*ae,ae=v*ae+A*N,N=E)}},F.prototype.guessLen13b=function(b,m){var l=Math.max(m,b)|1,d=l&1,y=0;for(l=l/2|0;l;l=l>>>1)y++;return 1<<y+1+d},F.prototype.conjugate=function(b,m,l){if(!(l<=1))for(var d=0;d<l/2;d++){var y=b[d];b[d]=b[l-d-1],b[l-d-1]=y,y=m[d],m[d]=-m[l-d-1],m[l-d-1]=-y}},F.prototype.normalize13b=function(b,m){for(var l=0,d=0;d<m/2;d++){var y=Math.round(b[2*d+1]/m)*8192+Math.round(b[2*d]/m)+l;b[d]=y&67108863,y<67108864?l=0:l=y/67108864|0}return b},F.prototype.convert13b=function(b,m,l,d){for(var y=0,C=0;C<m;C++)y=y+(b[C]|0),l[2*C]=y&8191,y=y>>>13,l[2*C+1]=y&8191,y=y>>>13;for(C=2*m;C<d;++C)l[C]=0;i(y===0),i((y&-8192)===0)},F.prototype.stub=function(b){for(var m=new Array(b),l=0;l<b;l++)m[l]=0;return m},F.prototype.mulp=function(b,m,l){var d=2*this.guessLen13b(b.length,m.length),y=this.makeRBT(d),C=this.stub(d),D=new Array(d),S=new Array(d),v=new Array(d),A=new Array(d),x=new Array(d),N=new Array(d),ae=l.words;ae.length=d,this.convert13b(b.words,b.length,D,d),this.convert13b(m.words,m.length,A,d),this.transform(D,C,S,v,d,y),this.transform(A,C,x,N,d,y);for(var R=0;R<d;R++){var X=S[R]*x[R]-v[R]*N[R];v[R]=S[R]*N[R]+v[R]*x[R],S[R]=X}return this.conjugate(S,v,d),this.transform(S,v,ae,C,d,y),this.conjugate(ae,C,d),this.normalize13b(ae,d),l.negative=b.negative^m.negative,l.length=b.length+m.length,l.strip()},s.prototype.mul=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),this.mulTo(b,m)},s.prototype.mulf=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),H(this,b,m)},s.prototype.imul=function(b){return this.clone().mulTo(b,this)},s.prototype.imuln=function(b){i(typeof b=="number"),i(b<67108864);for(var m=0,l=0;l<this.length;l++){var d=(this.words[l]|0)*b,y=(d&67108863)+(m&67108863);m>>=26,m+=d/67108864|0,m+=y>>>26,this.words[l]=y&67108863}return m!==0&&(this.words[l]=m,this.length++),this},s.prototype.muln=function(b){return this.clone().imuln(b)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(b){var m=M(b);if(m.length===0)return new s(1);for(var l=this,d=0;d<m.length&&m[d]===0;d++,l=l.sqr());if(++d<m.length)for(var y=l.sqr();d<m.length;d++,y=y.sqr())m[d]!==0&&(l=l.mul(y));return l},s.prototype.iushln=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=67108863>>>26-m<<26-m,y;if(m!==0){var C=0;for(y=0;y<this.length;y++){var D=this.words[y]&d,S=(this.words[y]|0)-D<<m;this.words[y]=S|C,C=D>>>26-m}C&&(this.words[y]=C,this.length++)}if(l!==0){for(y=this.length-1;y>=0;y--)this.words[y+l]=this.words[y];for(y=0;y<l;y++)this.words[y]=0;this.length+=l}return this.strip()},s.prototype.ishln=function(b){return i(this.negative===0),this.iushln(b)},s.prototype.iushrn=function(b,m,l){i(typeof b=="number"&&b>=0);var d;m?d=(m-m%26)/26:d=0;var y=b%26,C=Math.min((b-y)/26,this.length),D=67108863^67108863>>>y<<y,S=l;if(d-=C,d=Math.max(0,d),S){for(var v=0;v<C;v++)S.words[v]=this.words[v];S.length=C}if(C!==0)if(this.length>C)for(this.length-=C,v=0;v<this.length;v++)this.words[v]=this.words[v+C];else this.words[0]=0,this.length=1;var A=0;for(v=this.length-1;v>=0&&(A!==0||v>=d);v--){var x=this.words[v]|0;this.words[v]=A<<26-y|x>>>y,A=x&D}return S&&A!==0&&(S.words[S.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(b,m,l){return i(this.negative===0),this.iushrn(b,m,l)},s.prototype.shln=function(b){return this.clone().ishln(b)},s.prototype.ushln=function(b){return this.clone().iushln(b)},s.prototype.shrn=function(b){return this.clone().ishrn(b)},s.prototype.ushrn=function(b){return this.clone().iushrn(b)},s.prototype.testn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return!1;var y=this.words[l];return!!(y&d)},s.prototype.imaskn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(m!==0&&l++,this.length=Math.min(l,this.length),m!==0){var d=67108863^67108863>>>m<<m;this.words[this.length-1]&=d}return this.strip()},s.prototype.maskn=function(b){return this.clone().imaskn(b)},s.prototype.iaddn=function(b){return i(typeof b=="number"),i(b<67108864),b<0?this.isubn(-b):this.negative!==0?this.length===1&&(this.words[0]|0)<b?(this.words[0]=b-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(b),this.negative=1,this):this._iaddn(b)},s.prototype._iaddn=function(b){this.words[0]+=b;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(b){if(i(typeof b=="number"),i(b<67108864),b<0)return this.iaddn(-b);if(this.negative!==0)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this.strip()},s.prototype.addn=function(b){return this.clone().iaddn(b)},s.prototype.subn=function(b){return this.clone().isubn(b)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(b,m,l){var d=b.length+l,y;this._expand(d);var C,D=0;for(y=0;y<b.length;y++){C=(this.words[y+l]|0)+D;var S=(b.words[y]|0)*m;C-=S&67108863,D=(C>>26)-(S/67108864|0),this.words[y+l]=C&67108863}for(;y<this.length-l;y++)C=(this.words[y+l]|0)+D,D=C>>26,this.words[y+l]=C&67108863;if(D===0)return this.strip();for(i(D===-1),D=0,y=0;y<this.length;y++)C=-(this.words[y]|0)+D,D=C>>26,this.words[y]=C&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(b,m){var l=this.length-b.length,d=this.clone(),y=b,C=y.words[y.length-1]|0,D=this._countBits(C);l=26-D,l!==0&&(y=y.ushln(l),d.iushln(l),C=y.words[y.length-1]|0);var S=d.length-y.length,v;if(m!=="mod"){v=new s(null),v.length=S+1,v.words=new Array(v.length);for(var A=0;A<v.length;A++)v.words[A]=0}var x=d.clone()._ishlnsubmul(y,1,S);x.negative===0&&(d=x,v&&(v.words[S]=1));for(var N=S-1;N>=0;N--){var ae=(d.words[y.length+N]|0)*67108864+(d.words[y.length+N-1]|0);for(ae=Math.min(ae/C|0,67108863),d._ishlnsubmul(y,ae,N);d.negative!==0;)ae--,d.negative=0,d._ishlnsubmul(y,1,N),d.isZero()||(d.negative^=1);v&&(v.words[N]=ae)}return v&&v.strip(),d.strip(),m!=="div"&&l!==0&&d.iushrn(l),{div:v||null,mod:d}},s.prototype.divmod=function(b,m,l){if(i(!b.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var d,y,C;return this.negative!==0&&b.negative===0?(C=this.neg().divmod(b,m),m!=="mod"&&(d=C.div.neg()),m!=="div"&&(y=C.mod.neg(),l&&y.negative!==0&&y.iadd(b)),{div:d,mod:y}):this.negative===0&&b.negative!==0?(C=this.divmod(b.neg(),m),m!=="mod"&&(d=C.div.neg()),{div:d,mod:C.mod}):this.negative&b.negative?(C=this.neg().divmod(b.neg(),m),m!=="div"&&(y=C.mod.neg(),l&&y.negative!==0&&y.isub(b)),{div:C.div,mod:y}):b.length>this.length||this.cmp(b)<0?{div:new s(0),mod:this}:b.length===1?m==="div"?{div:this.divn(b.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new s(this.modn(b.words[0]))}:this._wordDiv(b,m)},s.prototype.div=function(b){return this.divmod(b,"div",!1).div},s.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},s.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},s.prototype.divRound=function(b){var m=this.divmod(b);if(m.mod.isZero())return m.div;var l=m.div.negative!==0?m.mod.isub(b):m.mod,d=b.ushrn(1),y=b.andln(1),C=l.cmp(d);return C<0||y===1&&C===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(b){i(b<=67108863);for(var m=(1<<26)%b,l=0,d=this.length-1;d>=0;d--)l=(m*l+(this.words[d]|0))%b;return l},s.prototype.idivn=function(b){i(b<=67108863);for(var m=0,l=this.length-1;l>=0;l--){var d=(this.words[l]|0)+m*67108864;this.words[l]=d/b|0,m=d%b}return this.strip()},s.prototype.divn=function(b){return this.clone().idivn(b)},s.prototype.egcd=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),C=new s(0),D=new s(1),S=0;m.isEven()&&l.isEven();)m.iushrn(1),l.iushrn(1),++S;for(var v=l.clone(),A=m.clone();!m.isZero();){for(var x=0,N=1;!(m.words[0]&N)&&x<26;++x,N<<=1);if(x>0)for(m.iushrn(x);x-- >0;)(d.isOdd()||y.isOdd())&&(d.iadd(v),y.isub(A)),d.iushrn(1),y.iushrn(1);for(var ae=0,R=1;!(l.words[0]&R)&&ae<26;++ae,R<<=1);if(ae>0)for(l.iushrn(ae);ae-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(v),D.isub(A)),C.iushrn(1),D.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(C),y.isub(D)):(l.isub(m),C.isub(d),D.isub(y))}return{a:C,b:D,gcd:l.iushln(S)}},s.prototype._invmp=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),C=l.clone();m.cmpn(1)>0&&l.cmpn(1)>0;){for(var D=0,S=1;!(m.words[0]&S)&&D<26;++D,S<<=1);if(D>0)for(m.iushrn(D);D-- >0;)d.isOdd()&&d.iadd(C),d.iushrn(1);for(var v=0,A=1;!(l.words[0]&A)&&v<26;++v,A<<=1);if(v>0)for(l.iushrn(v);v-- >0;)y.isOdd()&&y.iadd(C),y.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(y)):(l.isub(m),y.isub(d))}var x;return m.cmpn(1)===0?x=d:x=y,x.cmpn(0)<0&&x.iadd(b),x},s.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var m=this.clone(),l=b.clone();m.negative=0,l.negative=0;for(var d=0;m.isEven()&&l.isEven();d++)m.iushrn(1),l.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;l.isEven();)l.iushrn(1);var y=m.cmp(l);if(y<0){var C=m;m=l,l=C}else if(y===0||l.cmpn(1)===0)break;m.isub(l)}while(!0);return l.iushln(d)},s.prototype.invm=function(b){return this.egcd(b).a.umod(b)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(b){return this.words[0]&b},s.prototype.bincn=function(b){i(typeof b=="number");var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var y=d,C=l;y!==0&&C<this.length;C++){var D=this.words[C]|0;D+=y,y=D>>>26,D&=67108863,this.words[C]=D}return y!==0&&(this.words[C]=y,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(b){var m=b<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var l;if(this.length>1)l=1;else{m&&(b=-b),i(b<=67108863,"Number is too big");var d=this.words[0]|0;l=d===b?0:d<b?-1:1}return this.negative!==0?-l|0:l},s.prototype.cmp=function(b){if(this.negative!==0&&b.negative===0)return-1;if(this.negative===0&&b.negative!==0)return 1;var m=this.ucmp(b);return this.negative!==0?-m|0:m},s.prototype.ucmp=function(b){if(this.length>b.length)return 1;if(this.length<b.length)return-1;for(var m=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,y=b.words[l]|0;if(d!==y){d<y?m=-1:d>y&&(m=1);break}}return m},s.prototype.gtn=function(b){return this.cmpn(b)===1},s.prototype.gt=function(b){return this.cmp(b)===1},s.prototype.gten=function(b){return this.cmpn(b)>=0},s.prototype.gte=function(b){return this.cmp(b)>=0},s.prototype.ltn=function(b){return this.cmpn(b)===-1},s.prototype.lt=function(b){return this.cmp(b)===-1},s.prototype.lten=function(b){return this.cmpn(b)<=0},s.prototype.lte=function(b){return this.cmp(b)<=0},s.prototype.eqn=function(b){return this.cmpn(b)===0},s.prototype.eq=function(b){return this.cmp(b)===0},s.red=function(b){return new ee(b)},s.prototype.toRed=function(b){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),b.convertTo(this)._forceRed(b)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(b){return this.red=b,this},s.prototype.forceRed=function(b){return i(!this.red,"Already a number in reduction context"),this._forceRed(b)},s.prototype.redAdd=function(b){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},s.prototype.redIAdd=function(b){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},s.prototype.redSub=function(b){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},s.prototype.redISub=function(b){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},s.prototype.redShl=function(b){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},s.prototype.redMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},s.prototype.redIMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(b){return i(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var Y={k256:null,p224:null,p192:null,p25519:null};function B(L,b){this.name=L,this.p=new s(b,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}B.prototype._tmp=function(){var b=new s(null);return b.words=new Array(Math.ceil(this.n/13)),b},B.prototype.ireduce=function(b){var m=b,l;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),l=m.bitLength();while(l>this.n);var d=l<this.n?-1:m.ucmp(this.p);return d===0?(m.words[0]=0,m.length=1):d>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},B.prototype.split=function(b,m){b.iushrn(this.n,0,m)},B.prototype.imulK=function(b){return b.imul(this.k)};function z(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(z,B),z.prototype.split=function(b,m){for(var l=4194303,d=Math.min(b.length,9),y=0;y<d;y++)m.words[y]=b.words[y];if(m.length=d,b.length<=9){b.words[0]=0,b.length=1;return}var C=b.words[9];for(m.words[m.length++]=C&l,y=10;y<b.length;y++){var D=b.words[y]|0;b.words[y-10]=(D&l)<<4|C>>>22,C=D}C>>>=22,b.words[y-10]=C,C===0&&b.length>10?b.length-=10:b.length-=9},z.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var m=0,l=0;l<b.length;l++){var d=b.words[l]|0;m+=d*977,b.words[l]=m&67108863,m=d*64+(m/67108864|0)}return b.words[b.length-1]===0&&(b.length--,b.words[b.length-1]===0&&b.length--),b};function j(){B.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(j,B);function _(){B.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(_,B);function U(){B.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(U,B),U.prototype.imulK=function(b){for(var m=0,l=0;l<b.length;l++){var d=(b.words[l]|0)*19+m,y=d&67108863;d>>>=26,b.words[l]=y,m=d}return m!==0&&(b.words[b.length++]=m),b},s._prime=function(b){if(Y[b])return Y[b];var m;if(b==="k256")m=new z;else if(b==="p224")m=new j;else if(b==="p192")m=new _;else if(b==="p25519")m=new U;else throw new Error("Unknown prime "+b);return Y[b]=m,m};function ee(L){if(typeof L=="string"){var b=s._prime(L);this.m=b.p,this.prime=b}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}ee.prototype._verify1=function(b){i(b.negative===0,"red works only with positives"),i(b.red,"red works only with red numbers")},ee.prototype._verify2=function(b,m){i((b.negative|m.negative)===0,"red works only with positives"),i(b.red&&b.red===m.red,"red works only with red numbers")},ee.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):b.umod(this.m)._forceRed(this)},ee.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},ee.prototype.add=function(b,m){this._verify2(b,m);var l=b.add(m);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},ee.prototype.iadd=function(b,m){this._verify2(b,m);var l=b.iadd(m);return l.cmp(this.m)>=0&&l.isub(this.m),l},ee.prototype.sub=function(b,m){this._verify2(b,m);var l=b.sub(m);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},ee.prototype.isub=function(b,m){this._verify2(b,m);var l=b.isub(m);return l.cmpn(0)<0&&l.iadd(this.m),l},ee.prototype.shl=function(b,m){return this._verify1(b),this.imod(b.ushln(m))},ee.prototype.imul=function(b,m){return this._verify2(b,m),this.imod(b.imul(m))},ee.prototype.mul=function(b,m){return this._verify2(b,m),this.imod(b.mul(m))},ee.prototype.isqr=function(b){return this.imul(b,b.clone())},ee.prototype.sqr=function(b){return this.mul(b,b)},ee.prototype.sqrt=function(b){if(b.isZero())return b.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var l=this.m.add(new s(1)).iushrn(2);return this.pow(b,l)}for(var d=this.m.subn(1),y=0;!d.isZero()&&d.andln(1)===0;)y++,d.iushrn(1);i(!d.isZero());var C=new s(1).toRed(this),D=C.redNeg(),S=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,S).cmp(D)!==0;)v.redIAdd(D);for(var A=this.pow(v,d),x=this.pow(b,d.addn(1).iushrn(1)),N=this.pow(b,d),ae=y;N.cmp(C)!==0;){for(var R=N,X=0;R.cmp(C)!==0;X++)R=R.redSqr();i(X<ae);var V=this.pow(A,new s(1).iushln(ae-X-1));x=x.redMul(V),A=V.redSqr(),N=N.redMul(A),ae=X}return x},ee.prototype.invm=function(b){var m=b._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},ee.prototype.pow=function(b,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return b.clone();var l=4,d=new Array(1<<l);d[0]=new s(1).toRed(this),d[1]=b;for(var y=2;y<d.length;y++)d[y]=this.mul(d[y-1],b);var C=d[0],D=0,S=0,v=m.bitLength()%26;for(v===0&&(v=26),y=m.length-1;y>=0;y--){for(var A=m.words[y],x=v-1;x>=0;x--){var N=A>>x&1;if(C!==d[0]&&(C=this.sqr(C)),N===0&&D===0){S=0;continue}D<<=1,D|=N,S++,!(S!==l&&(y!==0||x!==0))&&(C=this.mul(C,d[D]),S=0,D=0)}v=26}return C},ee.prototype.convertTo=function(b){var m=b.umod(this.m);return m===b?m.clone():m},ee.prototype.convertFrom=function(b){var m=b.clone();return m.red=null,m},s.mont=function(b){return new oe(b)};function oe(L){ee.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(oe,ee),oe.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},oe.prototype.convertFrom=function(b){var m=this.imod(b.mul(this.rinv));return m.red=null,m},oe.prototype.imul=function(b,m){if(b.isZero()||m.isZero())return b.words[0]=0,b.length=1,b;var l=b.imul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),C=y;return y.cmp(this.m)>=0?C=y.isub(this.m):y.cmpn(0)<0&&(C=y.iadd(this.m)),C._forceRed(this)},oe.prototype.mul=function(b,m){if(b.isZero()||m.isZero())return new s(0)._forceRed(this);var l=b.mul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),C=y;return y.cmp(this.m)>=0?C=y.isub(this.m):y.cmpn(0)<0&&(C=y.iadd(this.m)),C._forceRed(this)},oe.prototype.invm=function(b){var m=this.imod(b._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(r,fr)})(Gn);var Td={};(function(r){var e=r;function t(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var f=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)f[h]=s[h]|0;return f}if(a==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var h=0;h<s.length;h+=2)f.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var u=s.charCodeAt(h),g=u>>8,w=u&255;g?f.push(g,w):f.push(w)}return f}e.toArray=t;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var a="",f=0;f<s.length;f++)a+=i(s[f].toString(16));return a}e.toHex=n,e.encode=function(a,f){return f==="hex"?n(a):a}})(Td),function(r){var e=r,t=Gn.exports,i=Ao,n=Td;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(g,w,P){var M=new Array(Math.max(g.bitLength(),P)+1),O;for(O=0;O<M.length;O+=1)M[O]=0;var $=1<<w+1,W=g.clone();for(O=0;O<M.length;O++){var H,F=W.andln($-1);W.isOdd()?(F>($>>1)-1?H=($>>1)-F:H=F,W.isubn(H)):H=0,M[O]=H,W.iushrn(1)}return M}e.getNAF=s;function a(g,w){var P=[[],[]];g=g.clone(),w=w.clone();for(var M=0,O=0,$;g.cmpn(-M)>0||w.cmpn(-O)>0;){var W=g.andln(3)+M&3,H=w.andln(3)+O&3;W===3&&(W=-1),H===3&&(H=-1);var F;W&1?($=g.andln(7)+M&7,($===3||$===5)&&H===2?F=-W:F=W):F=0,P[0].push(F);var Y;H&1?($=w.andln(7)+O&7,($===3||$===5)&&W===2?Y=-H:Y=H):Y=0,P[1].push(Y),2*M===F+1&&(M=1-M),2*O===Y+1&&(O=1-O),g.iushrn(1),w.iushrn(1)}return P}e.getJSF=a;function f(g,w,P){var M="_"+w;g.prototype[w]=function(){return this[M]!==void 0?this[M]:this[M]=P.call(this)}}e.cachedProperty=f;function h(g){return typeof g=="string"?e.toArray(g,"hex"):g}e.parseBytes=h;function u(g){return new t(g,"hex","le")}e.intFromLE=u}(Li);var Al={exports:{}},$d;Al.exports=function(e){return $d||($d=new ks(null)),$d.generate(e)};function ks(r){this.rand=r}if(Al.exports.Rand=ks,ks.prototype.generate=function(e){return this._rand(e)},ks.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i<t.length;i++)t[i]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?ks.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?ks.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(ks.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var um=il;if(typeof um.randomBytes!="function")throw new Error("Not supported");ks.prototype._rand=function(e){return um.randomBytes(e)}}catch{}var Nd={},Io=Gn.exports,Hc=Li,El=Hc.getNAF,G9=Hc.getJSF,Sl=Hc.assert;function js(r,e){this.type=r,this.p=new Io(e.p,16),this.red=e.prime?Io.red(e.prime):Io.mont(this.p),this.zero=new Io(0).toRed(this.red),this.one=new Io(1).toRed(this.red),this.two=new Io(2).toRed(this.red),this.n=e.n&&new Io(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Il=js;js.prototype.point=function(){throw new Error("Not implemented")},js.prototype.validate=function(){throw new Error("Not implemented")},js.prototype._fixedNafMul=function(e,t){Sl(e.precomputed);var i=e._getDoubles(),n=El(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),P=s;P>0;P--){for(f=0;f<a.length;f++)h=a[f],h===P?w=w.mixedAdd(i.points[f]):h===-P&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},js.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=El(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];Sl(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},js.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,P;for(g=0;g<n;g++){P=t[g];var M=P._getNAFPoints(e);a[g]=M.wnd,f[g]=M.points}for(g=n-1;g>=1;g-=2){var O=g-1,$=g;if(a[O]!==1||a[$]!==1){h[O]=El(i[O],a[O],this._bitLength),h[$]=El(i[$],a[$],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[$].length,u);continue}var W=[t[O],null,null,t[$]];t[O].y.cmp(t[$].y)===0?(W[1]=t[O].add(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg())):t[O].y.cmp(t[$].y.redNeg())===0?(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].add(t[$].neg())):(W[1]=t[O].toJ().mixedAdd(t[$]),W[2]=t[O].toJ().mixedAdd(t[$].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],F=G9(i[O],i[$]);for(u=Math.max(F[0].length,u),h[O]=new Array(u),h[$]=new Array(u),w=0;w<u;w++){var Y=F[0][w]|0,B=F[1][w]|0;h[O][w]=H[(Y+1)*3+(B+1)],h[$][w]=0,f[O]=W}}var z=this.jpoint(null,null,null),j=this._wnafT4;for(g=u;g>=0;g--){for(var _=0;g>=0;){var U=!0;for(w=0;w<n;w++)j[w]=h[w][g]|0,j[w]!==0&&(U=!1);if(!U)break;_++,g--}if(g>=0&&_++,z=z.dblp(_),g<0)break;for(w=0;w<n;w++){var ee=j[w];ee!==0&&(ee>0?P=f[w][ee-1>>1]:ee<0&&(P=f[w][-ee-1>>1].neg()),P.type==="affine"?z=z.mixedAdd(P):z=z.add(P))}}for(g=0;g<n;g++)f[g]=null;return s?z:z.toP()};function Zi(r,e){this.curve=r,this.type=e,this.precomputed=null}js.BasePoint=Zi,Zi.prototype.eq=function(){throw new Error("Not implemented")},Zi.prototype.validate=function(){return this.curve.validate(this)},js.prototype.decodePoint=function(e,t){e=Hc.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Sl(e[e.length-1]%2===0):e[0]===7&&Sl(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Zi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Zi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Zi.prototype.encode=function(e,t){return Hc.encode(this._encode(t),e)},Zi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Zi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Zi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Zi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Zi.prototype._getBeta=function(){return null},Zi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var Y9=Li,dr=Gn.exports,Ld=xa.exports,Oa=Il,J9=Y9.assert;function Xi(r){Oa.call(this,"short",r),this.a=new dr(r.a,16).toRed(this.red),this.b=new dr(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Ld(Xi,Oa);var Q9=Xi;Xi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new dr(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new dr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],J9(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new dr(f.a,16),b:new dr(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},Xi.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:dr.mont(e),i=new dr(2).toRed(t).redInvm(),n=i.redNeg(),s=new dr(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},Xi.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new dr(1),a=new dr(0),f=new dr(0),h=new dr(1),u,g,w,P,M,O,$,W=0,H,F;i.cmpn(0)!==0;){var Y=n.div(i);H=n.sub(Y.mul(i)),F=f.sub(Y.mul(s));var B=h.sub(Y.mul(a));if(!w&&H.cmp(t)<0)u=$.neg(),g=s,w=H.neg(),P=F;else if(w&&++W===2)break;$=H,n=i,i=H,f=s,s=F,h=a,a=B}M=H.neg(),O=F;var z=w.sqr().add(P.sqr()),j=M.sqr().add(O.sqr());return j.cmp(z)>=0&&(M=u,O=g),w.negative&&(w=w.neg(),P=P.neg()),M.negative&&(M=M.neg(),O=O.neg()),[{a:w,b:P},{a:M,b:O}]},Xi.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),P=u.add(g).neg();return{k1:w,k2:P}},Xi.prototype.pointFromX=function(e,t){e=new dr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Xi.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Xi.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Rr(r,e,t,i){Oa.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new dr(e,16),this.y=new dr(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Ld(Rr,Oa.BasePoint),Xi.prototype.point=function(e,t,i){return new Rr(this,e,t,i)},Xi.prototype.pointFromJSON=function(e,t){return Rr.fromJSON(this,e,t)},Rr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Rr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Rr.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Rr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Rr.prototype.isInfinity=function(){return this.inf},Rr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Rr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Rr.prototype.getX=function(){return this.x.fromRed()},Rr.prototype.getY=function(){return this.y.fromRed()},Rr.prototype.mul=function(e){return e=new dr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Rr.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Rr.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Rr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Rr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Rr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function jr(r,e,t,i){Oa.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new dr(0)):(this.x=new dr(e,16),this.y=new dr(t,16),this.z=new dr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ld(jr,Oa.BasePoint),Xi.prototype.jpoint=function(e,t,i){return new jr(this,e,t,i)},jr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},jr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),P=n.redMul(g),M=u.redSqr().redIAdd(w).redISub(P).redISub(P),O=u.redMul(P.redISub(M)).redISub(a.redMul(w)),$=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(M,O,$)},jr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),P=h.redSqr().redIAdd(g).redISub(w).redISub(w),M=h.redMul(w.redISub(P)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(P,M,O)},jr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),P=g.redSqr(),M=P.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),$=a.redMul(P),W=O.redSqr().redISub($.redAdd($)),H=$.redISub(W),F=O.redMul(H);F=F.redIAdd(F).redISub(M);var Y=g.redMul(h);t+1<e&&(u=u.redMul(M)),a=W,h=Y,g=F}return this.curve.jpoint(a,g.redMul(s),h)},jr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),P=this.y.redSqr(),M=P.redSqr(),O=this.x.redAdd(P).redSqr().redISub(w).redISub(M);O=O.redIAdd(O);var $=w.redAdd(w).redIAdd(w),W=$.redSqr(),H=M.redIAdd(M);H=H.redIAdd(H),H=H.redIAdd(H),e=W.redISub(O).redISub(O),t=$.redMul(O.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},jr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),P=this.y.redSqr(),M=this.x.redMul(P),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var $=M.redIAdd(M);$=$.redIAdd($);var W=$.redAdd($);e=O.redSqr().redISub(W),i=this.y.redAdd(this.z).redSqr().redISub(P).redISub(w);var H=P.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),t=O.redMul($.redISub(e)).redISub(H)}return this.curve.jpoint(e,t,i)},jr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),P=g.redISub(w),M=f.redSqr();M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=h.redMul(P).redISub(M),$=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,$)},jr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var P=this.x.redMul(h).redISub(w);P=P.redIAdd(P),P=P.redIAdd(P);var M=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(P,M,O)},jr.prototype.mul=function(e,t){return e=new dr(e,t),this.curve._wnafMul(this,e)},jr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},jr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},jr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ra=Gn.exports,dm=xa.exports,Ml=Il,Z9=Li;function Ta(r){Ml.call(this,"mont",r),this.a=new Ra(r.a,16).toRed(this.red),this.b=new Ra(r.b,16).toRed(this.red),this.i4=new Ra(4).toRed(this.red).redInvm(),this.two=new Ra(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}dm(Ta,Ml);var X9=Ta;Ta.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),n=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Tr(r,e,t){Ml.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Ra(e,16),this.z=new Ra(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}dm(Tr,Ml.BasePoint),Ta.prototype.decodePoint=function(e,t){return this.point(Z9.toArray(e,t),1)},Ta.prototype.point=function(e,t){return new Tr(this,e,t)},Ta.prototype.pointFromJSON=function(e){return Tr.fromJSON(this,e)},Tr.prototype.precompute=function(){},Tr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Tr.fromJSON=function(e,t){return new Tr(e,t[0],t[1]||e.one)},Tr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Tr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Tr.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=t.redSub(n),a=t.redMul(n),f=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,f)},Tr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),f=a.redMul(i),h=s.redMul(n),u=t.z.redMul(f.redAdd(h).redSqr()),g=t.x.redMul(f.redISub(h).redSqr());return this.curve.point(u,g)},Tr.prototype.mul=function(e){for(var t=e.clone(),i=this,n=this.curve.point(null,null),s=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var f=a.length-1;f>=0;f--)a[f]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},Tr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Tr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Tr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var ex=Li,ms=Gn.exports,pm=xa.exports,Cl=Il,tx=ex.assert;function Yn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,Cl.call(this,"edwards",r),this.a=new ms(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ms(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ms(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),tx(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}pm(Yn,Cl);var rx=Yn;Yn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Yn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Yn.prototype.jpoint=function(e,t,i,n){return this.point(e,t,i,n)},Yn.prototype.pointFromX=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),a=n.redMul(s.redInvm()),f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var h=f.fromRed().isOdd();return(t&&!h||!t&&h)&&(f=f.redNeg()),this.point(e,f)},Yn.prototype.pointFromY=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)},Yn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),n=t.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return n.cmp(s)===0};function nr(r,e,t,i,n){Cl.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ms(e,16),this.y=new ms(t,16),this.z=i?new ms(i,16):this.curve.one,this.t=n&&new ms(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}pm(nr,Cl.BasePoint),Yn.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},Yn.prototype.point=function(e,t,i,n){return new nr(this,e,t,i,n)},nr.fromJSON=function(e,t){return new nr(e,t[0],t[1],t[2])},nr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},nr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),f=a.redSub(i),h=n.redSub(t),u=s.redMul(f),g=a.redMul(h),w=s.redMul(h),P=f.redMul(a);return this.curve.point(u,g,P,w)},nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),n,s,a,f,h,u;if(this.curve.twisted){f=this.curve._mulA(t);var g=f.redAdd(i);this.zOne?(n=e.redSub(t).redSub(i).redMul(g.redSub(this.curve.two)),s=g.redMul(f.redSub(i)),a=g.redSqr().redSub(g).redSub(g)):(h=this.z.redSqr(),u=g.redSub(h).redISub(h),n=e.redSub(t).redISub(i).redMul(u),s=g.redMul(f.redSub(i)),a=g.redMul(u))}else f=t.redAdd(i),h=this.curve._mulC(this.z).redSqr(),u=f.redSub(h).redSub(h),n=this.curve._mulC(e.redISub(f)).redMul(u),s=this.curve._mulC(f).redMul(t.redISub(i)),a=f.redMul(u);return this.curve.point(n,s,a)},nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},nr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=i.redSub(t),f=s.redSub(n),h=s.redAdd(n),u=i.redAdd(t),g=a.redMul(f),w=h.redMul(u),P=a.redMul(u),M=f.redMul(h);return this.curve.point(g,w,M,P)},nr.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(n).redMul(s),f=i.redSub(a),h=i.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),g=t.redMul(f).redMul(u),w,P;return this.curve.twisted?(w=t.redMul(h).redMul(s.redSub(this.curve._mulA(n))),P=f.redMul(h)):(w=t.redMul(h).redMul(s.redSub(n)),P=this.curve._mulC(f).redMul(h)),this.curve.point(g,w,P)},nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},nr.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)},nr.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)},nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},nr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add,function(r){var e=r;e.base=Il,e.short=Q9,e.mont=X9,e.edwards=rx}(Nd);var Pl={},Bd,gm;function ix(){return gm||(gm=1,Bd={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Bd}(function(r){var e=r,t=Ri,i=Nd,n=Li,s=n.assert;function a(u){u.type==="short"?this.curve=new i.short(u):u.type==="edwards"?this.curve=new i.edwards(u):this.curve=new i.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=a;function f(u,g){Object.defineProperty(e,u,{configurable:!0,enumerable:!0,get:function(){var w=new a(g);return Object.defineProperty(e,u,{configurable:!0,enumerable:!0,value:w}),w}})}f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=ix()}catch{h=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(Pl);var nx=Ri,Mo=Td,vm=Ao;function Ws(r){if(!(this instanceof Ws))return new Ws(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Mo.toArray(r.entropy,r.entropyEnc||"hex"),t=Mo.toArray(r.nonce,r.nonceEnc||"hex"),i=Mo.toArray(r.pers,r.persEnc||"hex");vm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var sx=Ws;Ws.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Ws.prototype._hmac=function(){return new nx.hmac(this.hash,this.K)},Ws.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Ws.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=Mo.toArray(e,t),i=Mo.toArray(i,n),vm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Ws.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=Mo.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,Mo.encode(a,t)};var ox=Gn.exports,ax=Li,Fd=ax.assert;function Yr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var cx=Yr;Yr.fromPublic=function(e,t,i){return t instanceof Yr?t:new Yr(e,{pub:t,pubEnc:i})},Yr.fromPrivate=function(e,t,i){return t instanceof Yr?t:new Yr(e,{priv:t,privEnc:i})},Yr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Yr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Yr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Yr.prototype._importPrivate=function(e,t){this.priv=new ox(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Yr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Fd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Fd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Yr.prototype.derive=function(e){return e.validate()||Fd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Yr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Yr.prototype.verify=function(e,t,i){return this.ec.verify(e,t,this,void 0,i)},Yr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Dl=Gn.exports,Ud=Li,fx=Ud.assert;function Ol(r,e){if(r instanceof Ol)return r;this._importDER(r,e)||(fx(r.r&&r.s,"Signature without r or s"),this.r=new Dl(r.r,16),this.s=new Dl(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var lx=Ol;function hx(){this.place=0}function qd(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function mm(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}Ol.prototype._importDER=function(e,t){e=Ud.toArray(e,t);var i=new hx;if(e[i.place++]!==48)return!1;var n=qd(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=qd(e,i);if(s===!1||e[i.place]&128)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=qd(e,i);if(f===!1||e.length!==f+i.place||e[i.place]&128)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new Dl(a),this.s=new Dl(h),this.recoveryParam=null,!0};function zd(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Ol.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=mm(t),i=mm(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];zd(n,t.length),n=n.concat(t),n.push(2),zd(n,i.length);var s=n.concat(i),a=[48];return zd(a,s.length),a=a.concat(s),Ud.encode(a,e)};var bs=Gn.exports,bm=sx,ux=Li,Hd=Pl,dx=Al.exports,wm=ux.assert,kd=cx,Rl=lx;function en(r){if(!(this instanceof en))return new en(r);typeof r=="string"&&(wm(Object.prototype.hasOwnProperty.call(Hd,r),"Unknown curve "+r),r=Hd[r]),r instanceof Hd.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var px=en;en.prototype.keyPair=function(e){return new kd(this,e)},en.prototype.keyFromPrivate=function(e,t){return kd.fromPrivate(this,e,t)},en.prototype.keyFromPublic=function(e,t){return kd.fromPublic(this,e,t)},en.prototype.genKeyPair=function(e){e||(e={});for(var t=new bm({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||dx(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new bs(2));;){var s=new bs(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},en.prototype._truncateToN=function(e,t,i){var n;if(bs.isBN(e)||typeof e=="number")e=new bs(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new bs(e,16);else{var s=e.toString();n=s.length+1>>>1,e=new bs(s,16)}typeof i!="number"&&(i=n*8);var a=i-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},en.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,n.msgBitLength);for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),f=e.toArray("be",s),h=new bm({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new bs(1)),g=0;;g++){var w=n.k?n.k(g):new bs(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(u)>=0)){var P=this.g.mul(w);if(!P.isInfinity()){var M=P.getX(),O=M.umod(this.n);if(O.cmpn(0)!==0){var $=w.invm(this.n).mul(O.mul(t.getPrivate()).iadd(e));if($=$.umod(this.n),$.cmpn(0)!==0){var W=(P.getY().isOdd()?1:0)|(M.cmp(O)!==0?2:0);return n.canonical&&$.cmp(this.nh)>0&&($=this.n.sub($),W^=1),new Rl({r:O,s:$,recoveryParam:W})}}}}}},en.prototype.verify=function(e,t,i,n,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),i=this.keyFromPublic(i,n),t=new Rl(t,"hex");var a=t.r,f=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;var h=f.invm(this.n),u=h.mul(e).umod(this.n),g=h.mul(a).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(u,i.getPublic(),g),w.isInfinity()?!1:w.eqXToP(a)):(w=this.g.mulAdd(u,i.getPublic(),g),w.isInfinity()?!1:w.getX().umod(this.n).cmp(a)===0)},en.prototype.recoverPubKey=function(r,e,t,i){wm((3&t)===t,"The recovery param is more than two bits"),e=new Rl(e,i);var n=this.n,s=new bs(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),P=f.mul(g).umod(n);return this.g.mulAdd(w,a,P)},en.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Rl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var kc=Li,ym=kc.assert,_m=kc.parseBytes,$a=kc.cachedProperty;function $r(r,e){this.eddsa=r,this._secret=_m(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=_m(e.pub)}$r.fromPublic=function(e,t){return t instanceof $r?t:new $r(e,{pub:t})},$r.fromSecret=function(e,t){return t instanceof $r?t:new $r(e,{secret:t})},$r.prototype.secret=function(){return this._secret},$a($r,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),$a($r,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),$a($r,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),$a($r,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),$a($r,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),$a($r,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),$r.prototype.sign=function(e){return ym(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},$r.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},$r.prototype.getSecret=function(e){return ym(this._secret,"KeyPair is public only"),kc.encode(this.secret(),e)},$r.prototype.getPublic=function(e){return kc.encode(this.pubBytes(),e)};var gx=$r,vx=Gn.exports,Tl=Li,xm=Tl.assert,$l=Tl.cachedProperty,mx=Tl.parseBytes;function Co(r,e){this.eddsa=r,typeof e!="object"&&(e=mx(e)),Array.isArray(e)&&(xm(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),xm(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof vx&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}$l(Co,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),$l(Co,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),$l(Co,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),$l(Co,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Co.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Co.prototype.toHex=function(){return Tl.encode(this.toBytes(),"hex").toUpperCase()};var bx=Co,wx=Ri,yx=Pl,Na=Li,_x=Na.assert,Am=Na.parseBytes,Em=gx,Sm=bx;function mi(r){if(_x(r==="ed25519","only tested with ed25519 so far"),!(this instanceof mi))return new mi(r);r=yx[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=wx.sha512}var xx=mi;mi.prototype.sign=function(e,t){e=Am(e);var i=this.keyFromSecret(t),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),a=this.encodePoint(s),f=this.hashInt(a,i.pubBytes(),e).mul(i.priv()),h=n.add(f).umod(this.curve.n);return this.makeSignature({R:s,S:h,Rencoded:a})},mi.prototype.verify=function(e,t,i){if(e=Am(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S()),f=t.R().add(n.pub().mul(s));return f.eq(a)},mi.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Na.intFromLE(e.digest()).umod(this.curve.n)},mi.prototype.keyFromPublic=function(e){return Em.fromPublic(this,e)},mi.prototype.keyFromSecret=function(e){return Em.fromSecret(this,e)},mi.prototype.makeSignature=function(e){return e instanceof Sm?e:new Sm(this,e)},mi.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},mi.prototype.decodePoint=function(e){e=Na.parseBytes(e);var t=e.length-1,i=e.slice(0,t).concat(e[t]&-129),n=(e[t]&128)!==0,s=Na.intFromLE(i);return this.curve.pointFromY(s,n)},mi.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},mi.prototype.decodeInt=function(e){return Na.intFromLE(e)},mi.prototype.isPoint=function(e){return e instanceof this.pointClass},function(r){var e=r;e.version=V9.version,e.utils=Li,e.rand=Al.exports,e.curve=Nd,e.curves=Pl,e.ec=px,e.eddsa=xx}(hm);var jd={},Im={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=$i;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.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 f.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},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,P=u<<3,M=u%128<112?128:256;this._buffer[g]=128;for(var O=g+1;O<M-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,M-8),e.writeUint32BE(P,this._buffer,M-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,M),this._finished=!0}for(var O=0;O<this.digestLength/8;O++)e.writeUint32BE(this._stateHi[O],h,O*8),e.writeUint32BE(this._stateLo[O],h,O*8+4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.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}},f.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},f.prototype.cleanSavedState=function(h){t.wipe(h.stateHi),t.wipe(h.stateLo),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA512=i;var n=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(f,h,u,g,w,P,M){for(var O=u[0],$=u[1],W=u[2],H=u[3],F=u[4],Y=u[5],B=u[6],z=u[7],j=g[0],_=g[1],U=g[2],ee=g[3],oe=g[4],L=g[5],b=g[6],m=g[7],l,d,y,C,D,S,v,A;M>=128;){for(var x=0;x<16;x++){var N=8*x+P;f[x]=e.readUint32BE(w,N),h[x]=e.readUint32BE(w,N+4)}for(var x=0;x<80;x++){var ae=O,R=$,X=W,V=H,J=F,K=Y,E=B,G=z,re=j,le=_,he=U,ge=ee,He=oe,Te=L,Ce=b,Xe=m;if(l=z,d=m,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=(F>>>14|oe<<32-14)^(F>>>18|oe<<32-18)^(oe>>>41-32|F<<32-(41-32)),d=(oe>>>14|F<<32-14)^(oe>>>18|F<<32-18)^(F>>>41-32|oe<<32-(41-32)),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=F&Y^~F&B,d=oe&L^~oe&b,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=n[x*2],d=n[x*2+1],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=f[x%16],d=h[x%16],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,y=v&65535|A<<16,C=D&65535|S<<16,l=y,d=C,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=(O>>>28|j<<32-28)^(j>>>34-32|O<<32-(34-32))^(j>>>39-32|O<<32-(39-32)),d=(j>>>28|O<<32-28)^(O>>>34-32|j<<32-(34-32))^(O>>>39-32|j<<32-(39-32)),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=O&$^O&W^$&W,d=j&_^j&U^_&U,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,G=v&65535|A<<16,Xe=D&65535|S<<16,l=V,d=ge,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=y,d=C,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,V=v&65535|A<<16,ge=D&65535|S<<16,$=ae,W=R,H=X,F=V,Y=J,B=K,z=E,O=G,_=re,U=le,ee=he,oe=ge,L=He,b=Te,m=Ce,j=Xe,x%16===15)for(var N=0;N<16;N++)l=f[N],d=h[N],D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=f[(N+9)%16],d=h[(N+9)%16],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,y=f[(N+1)%16],C=h[(N+1)%16],l=(y>>>1|C<<32-1)^(y>>>8|C<<32-8)^y>>>7,d=(C>>>1|y<<32-1)^(C>>>8|y<<32-8)^(C>>>7|y<<32-7),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,y=f[(N+14)%16],C=h[(N+14)%16],l=(y>>>19|C<<32-19)^(C>>>61-32|y<<32-(61-32))^y>>>6,d=(C>>>19|y<<32-19)^(y>>>61-32|C<<32-(61-32))^(C>>>6|y<<32-6),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,f[N]=v&65535|A<<16,h[N]=D&65535|S<<16}l=O,d=j,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[0],d=g[0],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[0]=O=v&65535|A<<16,g[0]=j=D&65535|S<<16,l=$,d=_,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[1],d=g[1],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[1]=$=v&65535|A<<16,g[1]=_=D&65535|S<<16,l=W,d=U,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[2],d=g[2],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[2]=W=v&65535|A<<16,g[2]=U=D&65535|S<<16,l=H,d=ee,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[3],d=g[3],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[3]=H=v&65535|A<<16,g[3]=ee=D&65535|S<<16,l=F,d=oe,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[4],d=g[4],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[4]=F=v&65535|A<<16,g[4]=oe=D&65535|S<<16,l=Y,d=L,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[5],d=g[5],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[5]=Y=v&65535|A<<16,g[5]=L=D&65535|S<<16,l=B,d=b,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[6],d=g[6],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[6]=B=v&65535|A<<16,g[6]=b=D&65535|S<<16,l=z,d=m,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[7],d=g[7],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[7]=z=v&65535|A<<16,g[7]=m=D&65535|S<<16,P+=128,M-=128}return P}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(Im),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=Hs,t=Im,i=$i;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function n(V){const J=new Float64Array(16);if(V)for(let K=0;K<V.length;K++)J[K]=V[K];return J}const s=new Uint8Array(32);s[0]=9;const a=n(),f=n([1]),h=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),w=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),P=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(V,J){for(let K=0;K<16;K++)V[K]=J[K]|0}function O(V){let J=1;for(let K=0;K<16;K++){let E=V[K]+J+65535;J=Math.floor(E/65536),V[K]=E-J*65536}V[0]+=J-1+37*(J-1)}function $(V,J,K){const E=~(K-1);for(let G=0;G<16;G++){const re=E&(V[G]^J[G]);V[G]^=re,J[G]^=re}}function W(V,J){const K=n(),E=n();for(let G=0;G<16;G++)E[G]=J[G];O(E),O(E),O(E);for(let G=0;G<2;G++){K[0]=E[0]-65517;for(let le=1;le<15;le++)K[le]=E[le]-65535-(K[le-1]>>16&1),K[le-1]&=65535;K[15]=E[15]-32767-(K[14]>>16&1);const re=K[15]>>16&1;K[14]&=65535,$(E,K,1-re)}for(let G=0;G<16;G++)V[2*G]=E[G]&255,V[2*G+1]=E[G]>>8}function H(V,J){let K=0;for(let E=0;E<32;E++)K|=V[E]^J[E];return(1&K-1>>>8)-1}function F(V,J){const K=new Uint8Array(32),E=new Uint8Array(32);return W(K,V),W(E,J),H(K,E)}function Y(V){const J=new Uint8Array(32);return W(J,V),J[0]&1}function B(V,J){for(let K=0;K<16;K++)V[K]=J[2*K]+(J[2*K+1]<<8);V[15]&=32767}function z(V,J,K){for(let E=0;E<16;E++)V[E]=J[E]+K[E]}function j(V,J,K){for(let E=0;E<16;E++)V[E]=J[E]-K[E]}function _(V,J,K){let E,G,re=0,le=0,he=0,ge=0,He=0,Te=0,Ce=0,Xe=0,$e=0,be=0,Pe=0,De=0,ye=0,Ie=0,Oe=0,me=0,Me=0,Be=0,we=0,ke=0,We=0,xe=0,Ve=0,Ke=0,Ge=0,mt=0,It=0,Ye=0,Pt=0,Ot=0,Ze=0,rt=K[0],et=K[1],Ne=K[2],it=K[3],tt=K[4],Re=K[5],lt=K[6],ht=K[7],Le=K[8],ut=K[9],nt=K[10],Fe=K[11],st=K[12],Qe=K[13],qe=K[14],dt=K[15];E=J[0],re+=E*rt,le+=E*et,he+=E*Ne,ge+=E*it,He+=E*tt,Te+=E*Re,Ce+=E*lt,Xe+=E*ht,$e+=E*Le,be+=E*ut,Pe+=E*nt,De+=E*Fe,ye+=E*st,Ie+=E*Qe,Oe+=E*qe,me+=E*dt,E=J[1],le+=E*rt,he+=E*et,ge+=E*Ne,He+=E*it,Te+=E*tt,Ce+=E*Re,Xe+=E*lt,$e+=E*ht,be+=E*Le,Pe+=E*ut,De+=E*nt,ye+=E*Fe,Ie+=E*st,Oe+=E*Qe,me+=E*qe,Me+=E*dt,E=J[2],he+=E*rt,ge+=E*et,He+=E*Ne,Te+=E*it,Ce+=E*tt,Xe+=E*Re,$e+=E*lt,be+=E*ht,Pe+=E*Le,De+=E*ut,ye+=E*nt,Ie+=E*Fe,Oe+=E*st,me+=E*Qe,Me+=E*qe,Be+=E*dt,E=J[3],ge+=E*rt,He+=E*et,Te+=E*Ne,Ce+=E*it,Xe+=E*tt,$e+=E*Re,be+=E*lt,Pe+=E*ht,De+=E*Le,ye+=E*ut,Ie+=E*nt,Oe+=E*Fe,me+=E*st,Me+=E*Qe,Be+=E*qe,we+=E*dt,E=J[4],He+=E*rt,Te+=E*et,Ce+=E*Ne,Xe+=E*it,$e+=E*tt,be+=E*Re,Pe+=E*lt,De+=E*ht,ye+=E*Le,Ie+=E*ut,Oe+=E*nt,me+=E*Fe,Me+=E*st,Be+=E*Qe,we+=E*qe,ke+=E*dt,E=J[5],Te+=E*rt,Ce+=E*et,Xe+=E*Ne,$e+=E*it,be+=E*tt,Pe+=E*Re,De+=E*lt,ye+=E*ht,Ie+=E*Le,Oe+=E*ut,me+=E*nt,Me+=E*Fe,Be+=E*st,we+=E*Qe,ke+=E*qe,We+=E*dt,E=J[6],Ce+=E*rt,Xe+=E*et,$e+=E*Ne,be+=E*it,Pe+=E*tt,De+=E*Re,ye+=E*lt,Ie+=E*ht,Oe+=E*Le,me+=E*ut,Me+=E*nt,Be+=E*Fe,we+=E*st,ke+=E*Qe,We+=E*qe,xe+=E*dt,E=J[7],Xe+=E*rt,$e+=E*et,be+=E*Ne,Pe+=E*it,De+=E*tt,ye+=E*Re,Ie+=E*lt,Oe+=E*ht,me+=E*Le,Me+=E*ut,Be+=E*nt,we+=E*Fe,ke+=E*st,We+=E*Qe,xe+=E*qe,Ve+=E*dt,E=J[8],$e+=E*rt,be+=E*et,Pe+=E*Ne,De+=E*it,ye+=E*tt,Ie+=E*Re,Oe+=E*lt,me+=E*ht,Me+=E*Le,Be+=E*ut,we+=E*nt,ke+=E*Fe,We+=E*st,xe+=E*Qe,Ve+=E*qe,Ke+=E*dt,E=J[9],be+=E*rt,Pe+=E*et,De+=E*Ne,ye+=E*it,Ie+=E*tt,Oe+=E*Re,me+=E*lt,Me+=E*ht,Be+=E*Le,we+=E*ut,ke+=E*nt,We+=E*Fe,xe+=E*st,Ve+=E*Qe,Ke+=E*qe,Ge+=E*dt,E=J[10],Pe+=E*rt,De+=E*et,ye+=E*Ne,Ie+=E*it,Oe+=E*tt,me+=E*Re,Me+=E*lt,Be+=E*ht,we+=E*Le,ke+=E*ut,We+=E*nt,xe+=E*Fe,Ve+=E*st,Ke+=E*Qe,Ge+=E*qe,mt+=E*dt,E=J[11],De+=E*rt,ye+=E*et,Ie+=E*Ne,Oe+=E*it,me+=E*tt,Me+=E*Re,Be+=E*lt,we+=E*ht,ke+=E*Le,We+=E*ut,xe+=E*nt,Ve+=E*Fe,Ke+=E*st,Ge+=E*Qe,mt+=E*qe,It+=E*dt,E=J[12],ye+=E*rt,Ie+=E*et,Oe+=E*Ne,me+=E*it,Me+=E*tt,Be+=E*Re,we+=E*lt,ke+=E*ht,We+=E*Le,xe+=E*ut,Ve+=E*nt,Ke+=E*Fe,Ge+=E*st,mt+=E*Qe,It+=E*qe,Ye+=E*dt,E=J[13],Ie+=E*rt,Oe+=E*et,me+=E*Ne,Me+=E*it,Be+=E*tt,we+=E*Re,ke+=E*lt,We+=E*ht,xe+=E*Le,Ve+=E*ut,Ke+=E*nt,Ge+=E*Fe,mt+=E*st,It+=E*Qe,Ye+=E*qe,Pt+=E*dt,E=J[14],Oe+=E*rt,me+=E*et,Me+=E*Ne,Be+=E*it,we+=E*tt,ke+=E*Re,We+=E*lt,xe+=E*ht,Ve+=E*Le,Ke+=E*ut,Ge+=E*nt,mt+=E*Fe,It+=E*st,Ye+=E*Qe,Pt+=E*qe,Ot+=E*dt,E=J[15],me+=E*rt,Me+=E*et,Be+=E*Ne,we+=E*it,ke+=E*tt,We+=E*Re,xe+=E*lt,Ve+=E*ht,Ke+=E*Le,Ge+=E*ut,mt+=E*nt,It+=E*Fe,Ye+=E*st,Pt+=E*Qe,Ot+=E*qe,Ze+=E*dt,re+=38*Me,le+=38*Be,he+=38*we,ge+=38*ke,He+=38*We,Te+=38*xe,Ce+=38*Ve,Xe+=38*Ke,$e+=38*Ge,be+=38*mt,Pe+=38*It,De+=38*Ye,ye+=38*Pt,Ie+=38*Ot,Oe+=38*Ze,G=1,E=re+G+65535,G=Math.floor(E/65536),re=E-G*65536,E=le+G+65535,G=Math.floor(E/65536),le=E-G*65536,E=he+G+65535,G=Math.floor(E/65536),he=E-G*65536,E=ge+G+65535,G=Math.floor(E/65536),ge=E-G*65536,E=He+G+65535,G=Math.floor(E/65536),He=E-G*65536,E=Te+G+65535,G=Math.floor(E/65536),Te=E-G*65536,E=Ce+G+65535,G=Math.floor(E/65536),Ce=E-G*65536,E=Xe+G+65535,G=Math.floor(E/65536),Xe=E-G*65536,E=$e+G+65535,G=Math.floor(E/65536),$e=E-G*65536,E=be+G+65535,G=Math.floor(E/65536),be=E-G*65536,E=Pe+G+65535,G=Math.floor(E/65536),Pe=E-G*65536,E=De+G+65535,G=Math.floor(E/65536),De=E-G*65536,E=ye+G+65535,G=Math.floor(E/65536),ye=E-G*65536,E=Ie+G+65535,G=Math.floor(E/65536),Ie=E-G*65536,E=Oe+G+65535,G=Math.floor(E/65536),Oe=E-G*65536,E=me+G+65535,G=Math.floor(E/65536),me=E-G*65536,re+=G-1+37*(G-1),G=1,E=re+G+65535,G=Math.floor(E/65536),re=E-G*65536,E=le+G+65535,G=Math.floor(E/65536),le=E-G*65536,E=he+G+65535,G=Math.floor(E/65536),he=E-G*65536,E=ge+G+65535,G=Math.floor(E/65536),ge=E-G*65536,E=He+G+65535,G=Math.floor(E/65536),He=E-G*65536,E=Te+G+65535,G=Math.floor(E/65536),Te=E-G*65536,E=Ce+G+65535,G=Math.floor(E/65536),Ce=E-G*65536,E=Xe+G+65535,G=Math.floor(E/65536),Xe=E-G*65536,E=$e+G+65535,G=Math.floor(E/65536),$e=E-G*65536,E=be+G+65535,G=Math.floor(E/65536),be=E-G*65536,E=Pe+G+65535,G=Math.floor(E/65536),Pe=E-G*65536,E=De+G+65535,G=Math.floor(E/65536),De=E-G*65536,E=ye+G+65535,G=Math.floor(E/65536),ye=E-G*65536,E=Ie+G+65535,G=Math.floor(E/65536),Ie=E-G*65536,E=Oe+G+65535,G=Math.floor(E/65536),Oe=E-G*65536,E=me+G+65535,G=Math.floor(E/65536),me=E-G*65536,re+=G-1+37*(G-1),V[0]=re,V[1]=le,V[2]=he,V[3]=ge,V[4]=He,V[5]=Te,V[6]=Ce,V[7]=Xe,V[8]=$e,V[9]=be,V[10]=Pe,V[11]=De,V[12]=ye,V[13]=Ie,V[14]=Oe,V[15]=me}function U(V,J){_(V,J,J)}function ee(V,J){const K=n();let E;for(E=0;E<16;E++)K[E]=J[E];for(E=253;E>=0;E--)U(K,K),E!==2&&E!==4&&_(K,K,J);for(E=0;E<16;E++)V[E]=K[E]}function oe(V,J){const K=n();let E;for(E=0;E<16;E++)K[E]=J[E];for(E=250;E>=0;E--)U(K,K),E!==1&&_(K,K,J);for(E=0;E<16;E++)V[E]=K[E]}function L(V,J){const K=n(),E=n(),G=n(),re=n(),le=n(),he=n(),ge=n(),He=n(),Te=n();j(K,V[1],V[0]),j(Te,J[1],J[0]),_(K,K,Te),z(E,V[0],V[1]),z(Te,J[0],J[1]),_(E,E,Te),_(G,V[3],J[3]),_(G,G,u),_(re,V[2],J[2]),z(re,re,re),j(le,E,K),j(he,re,G),z(ge,re,G),z(He,E,K),_(V[0],le,he),_(V[1],He,ge),_(V[2],ge,he),_(V[3],le,He)}function b(V,J,K){for(let E=0;E<4;E++)$(V[E],J[E],K)}function m(V,J){const K=n(),E=n(),G=n();ee(G,J[2]),_(K,J[0],G),_(E,J[1],G),W(V,E),V[31]^=Y(K)<<7}function l(V,J,K){M(V[0],a),M(V[1],f),M(V[2],f),M(V[3],a);for(let E=255;E>=0;--E){const G=K[E/8|0]>>(E&7)&1;b(V,J,G),L(J,V),L(V,V),b(V,J,G)}}function d(V,J){const K=[n(),n(),n(),n()];M(K[0],g),M(K[1],w),M(K[2],f),_(K[3],g,w),l(V,K,J)}function y(V){if(V.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const J=(0,t.hash)(V);J[0]&=248,J[31]&=127,J[31]|=64;const K=new Uint8Array(32),E=[n(),n(),n(),n()];d(E,J),m(K,E);const G=new Uint8Array(64);return G.set(V),G.set(K,32),{publicKey:K,secretKey:G}}r.generateKeyPairFromSeed=y;function C(V){const J=(0,e.randomBytes)(32,V),K=y(J);return(0,i.wipe)(J),K}r.generateKeyPair=C;function D(V){if(V.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(V.subarray(32))}r.extractPublicKeyFromSecretKey=D;const S=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 v(V,J){let K,E,G,re;for(E=63;E>=32;--E){for(K=0,G=E-32,re=E-12;G<re;++G)J[G]+=K-16*J[E]*S[G-(E-32)],K=Math.floor((J[G]+128)/256),J[G]-=K*256;J[G]+=K,J[E]=0}for(K=0,G=0;G<32;G++)J[G]+=K-(J[31]>>4)*S[G],K=J[G]>>8,J[G]&=255;for(G=0;G<32;G++)J[G]-=K*S[G];for(E=0;E<32;E++)J[E+1]+=J[E]>>8,V[E]=J[E]&255}function A(V){const J=new Float64Array(64);for(let K=0;K<64;K++)J[K]=V[K];for(let K=0;K<64;K++)V[K]=0;v(V,J)}function x(V,J){const K=new Float64Array(64),E=[n(),n(),n(),n()],G=(0,t.hash)(V.subarray(0,32));G[0]&=248,G[31]&=127,G[31]|=64;const re=new Uint8Array(64);re.set(G.subarray(32),32);const le=new t.SHA512;le.update(re.subarray(32)),le.update(J);const he=le.digest();le.clean(),A(he),d(E,he),m(re,E),le.reset(),le.update(re.subarray(0,32)),le.update(V.subarray(32)),le.update(J);const ge=le.digest();A(ge);for(let He=0;He<32;He++)K[He]=he[He];for(let He=0;He<32;He++)for(let Te=0;Te<32;Te++)K[He+Te]+=ge[He]*G[Te];return v(re.subarray(32),K),re}r.sign=x;function N(V,J){const K=n(),E=n(),G=n(),re=n(),le=n(),he=n(),ge=n();return M(V[2],f),B(V[1],J),U(G,V[1]),_(re,G,h),j(G,G,V[2]),z(re,V[2],re),U(le,re),U(he,le),_(ge,he,le),_(K,ge,G),_(K,K,re),oe(K,K),_(K,K,G),_(K,K,re),_(K,K,re),_(V[0],K,re),U(E,V[0]),_(E,E,re),F(E,G)&&_(V[0],V[0],P),U(E,V[0]),_(E,E,re),F(E,G)?-1:(Y(V[0])===J[31]>>7&&j(V[0],a,V[0]),_(V[3],V[0],V[1]),0)}function ae(V,J,K){const E=new Uint8Array(32),G=[n(),n(),n(),n()],re=[n(),n(),n(),n()];if(K.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(N(re,V))return!1;const le=new t.SHA512;le.update(K.subarray(0,32)),le.update(V),le.update(J);const he=le.digest();return A(he),l(G,re,he),d(re,K.subarray(32)),L(G,re),m(E,G),!H(K,E)}r.verify=ae;function R(V){let J=[n(),n(),n(),n()];if(N(J,V))throw new Error("Ed25519: invalid public key");let K=n(),E=n(),G=J[1];z(K,f,G),j(E,f,G),ee(E,E),_(K,K,E);let re=new Uint8Array(32);return W(re,K),re}r.convertPublicKeyToX25519=R;function X(V){const J=(0,t.hash)(V.subarray(0,32));J[0]&=248,J[31]&=127,J[31]|=64;const K=new Uint8Array(J.subarray(0,32));return(0,i.wipe)(J),K}r.convertSecretKeyToX25519=X}(jd);const Ax="EdDSA",Ex="JWT",Nl=".",Ll="base64url",Mm="utf8",Cm="utf8",Sx=":",Ix="did",Mx="key",Pm="base58btc",Cx="z",Px="K36",Dx=32;function Wd(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Dm(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Wd(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ox(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=Dm(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return Wd(t)}function Om(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Rm=Om("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Kd=Om("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Dm(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Tm={utf8:Rm,"utf-8":Rm,hex:Da.base16,latin1:Kd,ascii:Kd,binary:Kd,...Da};function Bl(r,e="utf8"){const t=Tm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function La(r,e="utf8"){const t=Tm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wd(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const Rx=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),Tx=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function Po(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return Tx(r)}catch{return r}}function ws(r){return typeof r=="string"?r:Rx(r)||""}function $m(r){return Po(Bl(La(r,Ll),Mm))}function Fl(r){return Bl(La(ws(r),Mm),Ll)}function Nm(r){const e=La(Px,Pm),t=Cx+Bl(Ox([e,r]),Pm);return[Ix,Mx,t].join(Sx)}function $x(r){return Bl(r,Ll)}function Nx(r){return La(r,Ll)}function Lx(r){return La([Fl(r.header),Fl(r.payload)].join(Nl),Cm)}function Bx(r){return[Fl(r.header),Fl(r.payload),$x(r.signature)].join(Nl)}function Vd(r){const e=r.split(Nl),t=$m(e[0]),i=$m(e[1]),n=Nx(e[2]),s=La(e.slice(0,2).join(Nl),Cm);return{header:t,payload:i,signature:n,data:s}}function Lm(r=Hs.randomBytes(Dx)){return jd.generateKeyPairFromSeed(r)}async function Fx(r,e,t,i,n=Ae.fromMiliseconds(Date.now())){const s={alg:Ax,typ:Ex},a=Nm(i.publicKey),f=n+t,h={iss:a,sub:r,aud:e,iat:n,exp:f},u=Lx({header:s,payload:h}),g=jd.sign(i.secretKey,u);return Bx({header:s,payload:h,signature:g})}const Ux={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},qx=":";function Ba(r){const[e,t]=r.split(qx);return{namespace:e,reference:t}}function Bm(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const n=r[i];t.push(...n.accounts)}),t}function Fm(r,e){return r.includes(":")?[r]:e.chains||[]}var zx=Object.defineProperty,Um=Object.getOwnPropertySymbols,Hx=Object.prototype.hasOwnProperty,kx=Object.prototype.propertyIsEnumerable,qm=(r,e,t)=>e in r?zx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zm=(r,e)=>{for(var t in e||(e={}))Hx.call(e,t)&&qm(r,t,e[t]);if(Um)for(var t of Um(e))kx.call(e,t)&&qm(r,t,e[t]);return r};const jx="ReactNative",Bi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Wx="js";function Ul(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Fa(){return!Dc()&&!!Yu()&&navigator.product===jx}function jc(){return!Ul()&&!!Yu()&&!!Dc()}function Wc(){return Fa()?Bi.reactNative:Ul()?Bi.node:jc()?Bi.browser:Bi.unknown}function Kx(){var r;try{return Fa()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function Vx(r,e){let t=Oc.parse(r);return t=zm(zm({},t),e),r=Oc.stringify(t),r}function Hm(){return Mg()||{name:"",description:"",url:"",icons:[""]}}function Gx(){if(Wc()===Bi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const r=r5();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function Yx(){var r;const e=Wc();return e===Bi.browser?[e,((r=Ig())==null?void 0:r.host)||"unknown"].join(":"):e}function km(r,e,t){const i=Gx(),n=Yx();return[[r,e].join("-"),[Wx,t].join("-"),i,n].join("/")}function Jx({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:a,bundleId:f}){const h=t.split("?"),u=km(r,e,i),g={auth:n,ua:u,projectId:s,useOnCloseEvent:a||void 0,origin:f||void 0},w=Vx(h[1]||"",g);return h[0]+"?"+w}function Do(r,e){return r.filter(t=>e.includes(t)).length===r.length}function jm(r){return Object.fromEntries(r.entries())}function Wm(r){return new Map(Object.entries(r))}function Oo(r=Ae.FIVE_MINUTES,e){const t=Ae.toMiliseconds(r||Ae.FIVE_MINUTES);let i,n,s;return{resolve:a=>{s&&i&&(clearTimeout(s),i(a))},reject:a=>{s&&n&&(clearTimeout(s),n(a))},done:()=>new Promise((a,f)=>{s=setTimeout(()=>{f(new Error(e))},t),i=a,n=f})}}function Ua(r,e,t){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(t)),e);try{const a=await r;i(a)}catch(a){n(a)}clearTimeout(s)})}function Km(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function Qx(r){return Km("topic",r)}function Zx(r){return Km("id",r)}function Vm(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Ir(r,e){return Ae.fromMiliseconds((e||Date.now())+Ae.toMiliseconds(r))}function Ks(r){return Date.now()>=Ae.toMiliseconds(r)}function Dt(r,e){return`${r}${e?`:${e}`:""}`}function ql(r=[],e=[]){return[...new Set([...r,...e])]}async function Xx({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t,s=n?.href;if(typeof s!="string")return;const a=eA(s,r,e),f=Wc();if(f===Bi.browser){if(!((i=Dc())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,rA()?"_blank":"_self","noreferrer noopener")}else f===Bi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}function eA(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${iA(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function tA(r,e){let t="";try{if(jc()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function Gm(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function Ym(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Gd(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function rA(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function iA(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function Jm(r){return Buffer.from(r,"base64").toString("utf-8")}const nA="https://rpc.walletconnect.org/v1";async function sA(r,e,t,i,n,s){switch(t.t){case"eip191":return oA(r,e,t.s);case"eip1271":return await aA(r,e,t.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function oA(r,e,t){return I_(iv(e),t).toLowerCase()===r.toLowerCase()}async function aA(r,e,t,i,n,s){const a=Ba(i);if(!a.namespace||!a.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const f="0x1626ba7e",h="0000000000000000000000000000000000000000000000000000000000000040",u="0000000000000000000000000000000000000000000000000000000000000041",g=t.substring(2),w=iv(e).substring(2),P=f+w+h+u+g,M=await fetch(`${s||nA}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:cA(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:P},"latest"]})}),{result:O}=await M.json();return O?O.slice(0,f.length).toLowerCase()===f.toLowerCase():!1}catch(f){return console.error("isValidEip1271Signature: ",f),!1}}function cA(){return Date.now()+Math.floor(Math.random()*1e3)}var fA=Object.defineProperty,lA=Object.defineProperties,hA=Object.getOwnPropertyDescriptors,Qm=Object.getOwnPropertySymbols,uA=Object.prototype.hasOwnProperty,dA=Object.prototype.propertyIsEnumerable,Zm=(r,e,t)=>e in r?fA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pA=(r,e)=>{for(var t in e||(e={}))uA.call(e,t)&&Zm(r,t,e[t]);if(Qm)for(var t of Qm(e))dA.call(e,t)&&Zm(r,t,e[t]);return r},gA=(r,e)=>lA(r,hA(e));const vA="did:pkh:",Yd=r=>r?.split(":"),mA=r=>{const e=r&&Yd(r);if(e)return r.includes(vA)?e[3]:e[1]},Jd=r=>{const e=r&&Yd(r);if(e)return e[2]+":"+e[3]},zl=r=>{const e=r&&Yd(r);if(e)return e.pop()};async function Xm(r){const{cacao:e,projectId:t}=r,{s:i,p:n}=e,s=eb(n,n.iss),a=zl(n.iss);return await sA(a,s,i,Jd(n.iss),t)}const eb=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=zl(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,a=`Version: ${r.version}`,f=`Chain ID: ${mA(e)}`,h=`Nonce: ${r.nonce}`,u=`Issued At: ${r.iat}`,g=r.exp?`Expiration Time: ${r.exp}`:void 0,w=r.nbf?`Not Before: ${r.nbf}`:void 0,P=r.requestId?`Request ID: ${r.requestId}`:void 0,M=r.resources?`Resources:${r.resources.map($=>`
23
+ - ${$}`).join("")}`:void 0,O=Hl(r.resources);if(O){const $=Kc(O);n=IA(n,$)}return[t,i,"",n,"",s,a,f,h,u,g,w,P,M].filter($=>$!=null).join(`
24
+ `)};function bA(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function wA(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function Ro(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(a=>{if(typeof a!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${a}`)})})})}function yA(r,e,t,i={}){return t?.sort((n,s)=>n.localeCompare(s)),{att:{[r]:_A(e,t,i)}}}function _A(r,e,t={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${r}/${n}`]:[t]}));return Object.assign({},...i)}function tb(r){return Ro(r),`urn:recap:${bA(r).replace(/=/g,"")}`}function Kc(r){const e=wA(r.replace("urn:recap:",""));return Ro(e),e}function xA(r,e,t){const i=yA(r,e,t);return tb(i)}function AA(r){return r&&r.includes("urn:recap:")}function EA(r,e){const t=Kc(r),i=Kc(e),n=SA(t,i);return tb(n)}function SA(r,e){Ro(r),Ro(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return t.forEach(n=>{var s,a;Object.keys(((s=r.att)==null?void 0:s[n])||{}).concat(Object.keys(((a=e.att)==null?void 0:a[n])||{})).sort((f,h)=>f.localeCompare(h)).forEach(f=>{var h,u;i.att[n]=gA(pA({},i.att[n]),{[f]:((h=r.att[n])==null?void 0:h[f])||((u=e.att[n])==null?void 0:u[f])})})}),i}function IA(r="",e){Ro(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let n=0;Object.keys(e.att).forEach(f=>{const h=Object.keys(e.att[f]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));h.sort((w,P)=>w.action.localeCompare(P.action));const u={};h.forEach(w=>{u[w.ability]||(u[w.ability]=[]),u[w.ability].push(w.action)});const g=Object.keys(u).map(w=>(n++,`(${n}) '${w}': '${u[w].join("', '")}' for '${f}'.`));i.push(g.join(", ").replace(".,","."))});const s=i.join(" "),a=`${t}${s}`;return`${r?r+" ":""}${a}`}function rb(r){var e;const t=Kc(r);Ro(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function ib(r){const e=Kc(r);Ro(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&t.push(n[0].chains)})}),[...new Set(t.flat())]}function Hl(r){if(!r)return;const e=r?.[r.length-1];return AA(e)?e:void 0}const nb="base10",si="base16",Vs="base64pad",Vc="base64url",Gc="utf8",sb=0,ys=1,Yc=2,MA=0,ob=1,Jc=12,Qd=32;function CA(){const r=Cd.generateKeyPair();return{privateKey:Ni(r.secretKey,si),publicKey:Ni(r.publicKey,si)}}function Zd(){const r=Hs.randomBytes(Qd);return Ni(r,si)}function PA(r,e){const t=Cd.sharedKey(Qi(r,si),Qi(e,si),!0),i=new o7(qc.SHA256,t).expand(Qd);return Ni(i,si)}function kl(r){const e=qc.hash(Qi(r,si));return Ni(e,si)}function _s(r){const e=qc.hash(Qi(r,Gc));return Ni(e,si)}function ab(r){return Qi(`${r}`,nb)}function To(r){return Number(Ni(r,nb))}function DA(r){const e=ab(typeof r.type<"u"?r.type:sb);if(To(e)===ys&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Qi(r.senderPublicKey,si):void 0,i=typeof r.iv<"u"?Qi(r.iv,si):Hs.randomBytes(Jc),n=new _d.ChaCha20Poly1305(Qi(r.symKey,si)).seal(i,Qi(r.message,Gc));return cb({type:e,sealed:n,iv:i,senderPublicKey:t,encoding:r.encoding})}function OA(r,e){const t=ab(Yc),i=Hs.randomBytes(Jc),n=Qi(r,Gc);return cb({type:t,sealed:n,iv:i,encoding:e})}function RA(r){const e=new _d.ChaCha20Poly1305(Qi(r.symKey,si)),{sealed:t,iv:i}=Qc({encoded:r.encoded,encoding:r?.encoding}),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return Ni(n,Gc)}function TA(r,e){const{sealed:t}=Qc({encoded:r,encoding:e});return Ni(t,Gc)}function cb(r){const{encoding:e=Vs}=r;if(To(r.type)===Yc)return Ni(Pd([r.type,r.sealed]),e);if(To(r.type)===ys){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ni(Pd([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return Ni(Pd([r.type,r.iv,r.sealed]),e)}function Qc(r){const{encoded:e,encoding:t=Vs}=r,i=Qi(e,t),n=i.slice(MA,ob),s=ob;if(To(n)===ys){const u=s+Qd,g=u+Jc,w=i.slice(s,u),P=i.slice(u,g),M=i.slice(g);return{type:n,sealed:M,iv:P,senderPublicKey:w}}if(To(n)===Yc){const u=i.slice(s),g=Hs.randomBytes(Jc);return{type:n,sealed:u,iv:g}}const a=s+Jc,f=i.slice(s,a),h=i.slice(a);return{type:n,sealed:h,iv:f}}function $A(r,e){const t=Qc({encoded:r,encoding:e?.encoding});return fb({type:To(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?Ni(t.senderPublicKey,si):void 0,receiverPublicKey:e?.receiverPublicKey})}function fb(r){const e=r?.type||sb;if(e===ys){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function lb(r){return r.type===ys&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function hb(r){return r.type===Yc}function NA(r){return new hm.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function LA(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function BA(r){return Buffer.from(LA(r),"base64")}function FA(r,e){const[t,i,n]=r.split("."),s=BA(n);if(s.length!==64)throw new Error("Invalid signature length");const a=s.slice(0,32).toString("hex"),f=s.slice(32,64).toString("hex"),h=`${t}.${i}`,u=new qc.SHA256().update(Buffer.from(h)).digest(),g=NA(e),w=Buffer.from(u).toString("hex");if(!g.verify(w,{r:a,s:f}))throw new Error("Invalid signature");return Vd(r).payload}const UA="irn";function Xd(r){return r?.relay||{protocol:UA}}function Zc(r){const e=Ux[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var qA=Object.defineProperty,zA=Object.defineProperties,HA=Object.getOwnPropertyDescriptors,ub=Object.getOwnPropertySymbols,kA=Object.prototype.hasOwnProperty,jA=Object.prototype.propertyIsEnumerable,db=(r,e,t)=>e in r?qA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pb=(r,e)=>{for(var t in e||(e={}))kA.call(e,t)&&db(r,t,e[t]);if(ub)for(var t of ub(e))jA.call(e,t)&&db(r,t,e[t]);return r},WA=(r,e)=>zA(r,HA(e));function KA(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),a=r[n];t[s]=a}}),t}function gb(r){if(!r.includes("wc:")){const h=Jm(r);h!=null&&h.includes("wc:")&&(r=h)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",a=Oc.parse(s),f=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:i,topic:VA(n[0]),version:parseInt(n[1],10),symKey:a.symKey,relay:KA(a),methods:f,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function VA(r){return r.startsWith("//")?r.substring(2):r}function GA(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(n=>{const s=t+e+n;r[n]&&(i[s]=r[n])}),i}function vb(r){return`${r.protocol}:${r.topic}@${r.version}?`+Oc.stringify(pb(WA(pb({symKey:r.symKey},GA(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function jl(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function qa(r){const e=[];return r.forEach(t=>{const[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function YA(r){const e=[];return Object.values(r).forEach(t=>{e.push(...qa(t.accounts))}),e}function JA(r,e){const t=[];return Object.values(r).forEach(i=>{qa(i.accounts).includes(e)&&t.push(...i.methods)}),t}function QA(r,e){const t=[];return Object.values(r).forEach(i=>{qa(i.accounts).includes(e)&&t.push(...i.events)}),t}function e0(r){return r.includes(":")}function Xc(r){return e0(r)?r.split(":")[0]:r}function ZA(r){const e={};return r?.forEach(t=>{const[i,n]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${n}`)}),e}function mb(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=ZA(e);for(const[i,n]of Object.entries(t))n.methods?n.methods=ql(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return t}const XA={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}},eE={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function _e(r,e){const{message:t,code:i}=eE[r];return{message:e?`${t} ${e}`:t,code:i}}function Gt(r,e){const{message:t,code:i}=XA[r];return{message:e?`${t} ${e}`:t,code:i}}function Jn(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function ef(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function oi(r){return typeof r>"u"}function wr(r,e){return e&&oi(r)?!0:typeof r=="string"&&!!r.trim().length}function t0(r,e){return e&&oi(r)?!0:typeof r=="number"&&!isNaN(r)}function tE(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t);let s=!0;return Do(n,i)?(i.forEach(a=>{const{accounts:f,methods:h,events:u}=r.namespaces[a],g=qa(f),w=t[a];(!Do(Fm(a,w),g)||!Do(w.methods,h)||!Do(w.events,u))&&(s=!1)}),s):!1}function Wl(r){return wr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function rE(r){if(wr(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Wl(t)}}return!1}function iE(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(wr(r,!1)){if(e(r))return!0;const t=Jm(r);return e(t)}}catch{}return!1}function nE(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function sE(r){return r?.topic}function oE(r,e){let t=null;return wr(r?.publicKey,!1)||(t=_e("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function bb(r){let e=!0;return Jn(r)?r.length&&(e=r.every(t=>wr(t,!1))):e=!1,e}function aE(r,e,t){let i=null;return Jn(e)&&e.length?e.forEach(n=>{i||Wl(n)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Wl(r)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function cE(r,e,t){let i=null;return Object.entries(r).forEach(([n,s])=>{if(i)return;const a=aE(n,Fm(n,s),`${e} ${t}`);a&&(i=a)}),i}function fE(r,e){let t=null;return Jn(r)?r.forEach(i=>{t||rE(i)||(t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function lE(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=fE(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function hE(r,e){let t=null;return bb(r?.methods)?bb(r?.events)||(t=Gt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Gt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function wb(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=hE(i,`${e}, namespace`);n&&(t=n)}),t}function uE(r,e,t){let i=null;if(r&&ef(r)){const n=wb(r,e);n&&(i=n);const s=cE(r,e,t);s&&(i=s)}else i=_e("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function r0(r,e){let t=null;if(r&&ef(r)){const i=wb(r,e);i&&(t=i);const n=lE(r,e);n&&(t=n)}else t=_e("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function yb(r){return wr(r.protocol,!0)}function dE(r,e){let t=!1;return e&&!r?t=!0:r&&Jn(r)&&r.length&&r.forEach(i=>{t=yb(i)}),t}function pE(r){return typeof r=="number"}function bi(r){return typeof r<"u"&&typeof r!==null}function gE(r){return!(!r||typeof r!="object"||!r.code||!t0(r.code,!1)||!r.message||!wr(r.message,!1))}function vE(r){return!(oi(r)||!wr(r.method,!1))}function mE(r){return!(oi(r)||oi(r.result)&&oi(r.error)||!t0(r.id,!1)||!wr(r.jsonrpc,!1))}function bE(r){return!(oi(r)||!wr(r.name,!1))}function _b(r,e){return!(!Wl(e)||!YA(r).includes(e))}function wE(r,e,t){return wr(t,!1)?JA(r,e).includes(t):!1}function yE(r,e,t){return wr(t,!1)?QA(r,e).includes(t):!1}function xb(r,e,t){let i=null;const n=_E(r),s=xE(e),a=Object.keys(n),f=Object.keys(s),h=Ab(Object.keys(r)),u=Ab(Object.keys(e)),g=h.filter(w=>!u.includes(w));return g.length&&(i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
25
25
  Required: ${g.toString()}
26
26
  Received: ${Object.keys(e).toString()}`)),Do(a,f)||(i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
27
27
  Required: ${a.toString()}
28
28
  Approved: ${f.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||i)return;const P=qa(e[w].accounts);P.includes(w)||(i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${w}
29
29
  Required: ${w}
30
- Approved: ${P.toString()}`))}),a.forEach(w=>{i||(Do(n[w].methods,s[w].methods)?Do(n[w].events,s[w].events)||(i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function _E(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(n=>{e[n]={methods:r[t].methods,events:r[t].events}})}),e}function Ab(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function xE(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=qa(r[t].accounts);i?.forEach(n=>{e[n]={accounts:r[t].accounts.filter(s=>s.includes(`${n}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function AE(r,e){return t0(r,!1)&&r<=e.max&&r>=e.min}function Eb(){const r=Wc();return new Promise(e=>{switch(r){case Bi.browser:e(EE());break;case Bi.reactNative:e(SE());break;case Bi.node:e(IE());break;default:e(!0)}})}function EE(){return jc()&&navigator?.onLine}async function SE(){if(Fa()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function IE(){return!0}function ME(r){switch(Wc()){case Bi.browser:CE(r);break;case Bi.reactNative:PE(r);break}}function CE(r){!Fa()&&jc()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function PE(r){Fa()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const i0={};class tf{static get(e){return i0[e]}static set(e,t){i0[e]=t}static delete(e){delete i0[e]}}class $o{}class DE extends $o{constructor(e){super()}}const Sb=Ae.FIVE_SECONDS,za={pulse:"heartbeat_pulse"};class n0 extends DE{constructor(e){super(e),this.events=new qr.exports.EventEmitter,this.interval=Sb,this.interval=e?.interval||Sb}static async init(e){const t=new n0(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),Ae.toMiliseconds(this.interval))}pulse(){this.events.emit(za.pulse)}}const OE=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,RE=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,TE=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $E(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){NE(r);return}return e}function NE(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Kl(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!TE.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(OE.test(r)||RE.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,$E)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function LE(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function Nr(r,...e){try{return LE(r(...e))}catch(t){return Promise.reject(t)}}function BE(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function FE(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function Vl(r){if(BE(r))return String(r);if(FE(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Vl(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Ib(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const s0="base64:";function UE(r){if(typeof r=="string")return r;Ib();const e=Buffer.from(r).toString("base64");return s0+e}function qE(r){return typeof r!="string"||!r.startsWith(s0)?r:(Ib(),Buffer.from(r.slice(s0.length),"base64"))}function wi(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function zE(...r){return wi(r.join(":"))}function Gl(r){return r=wi(r),r?r+":":""}function tk(r){return r}const kE="memory",HE=()=>{const r=new Map;return{name:kE,options:{},hasItem(e){return r.has(e)},getItem(e){return r.get(e)||null},getItemRaw(e){return r.get(e)||null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function jE(r={}){const e={mounts:{"":r.driver||HE()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=u=>{for(const g of e.mountpoints)if(u.startsWith(g))return{base:g,relativeKey:u.slice(g.length),driver:e.mounts[g]};return{base:"",relativeKey:u,driver:e.mounts[""]}},i=(u,g)=>e.mountpoints.filter(w=>w.startsWith(u)||g&&u.startsWith(w)).map(w=>({relativeBase:u.length>w.length?u.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(u,g)=>{if(e.watching){g=wi(g);for(const w of e.watchListeners)w(u,g)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await Mb(e.mounts[u],n,u)}},a=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},f=(u,g,w)=>{const P=new Map,M=O=>{let $=P.get(O.base);return $||($={driver:O.driver,base:O.base,items:[]},P.set(O.base,$)),$};for(const O of u){const $=typeof O=="string",W=wi($?O:O.key),k=$?void 0:O.value,F=$||!O.options?g:{...g,...O.options},Y=t(W);M(Y).items.push({key:W,value:k,relativeKey:Y.relativeKey,options:F})}return Promise.all([...P.values()].map(O=>w(O))).then(O=>O.flat())},h={hasItem(u,g={}){u=wi(u);const{relativeKey:w,driver:P}=t(u);return Nr(P.hasItem,w,g)},getItem(u,g={}){u=wi(u);const{relativeKey:w,driver:P}=t(u);return Nr(P.getItem,w,g).then(M=>Kl(M))},getItems(u,g){return f(u,g,w=>w.driver.getItems?Nr(w.driver.getItems,w.items.map(P=>({key:P.relativeKey,options:P.options})),g).then(P=>P.map(M=>({key:zE(w.base,M.key),value:Kl(M.value)}))):Promise.all(w.items.map(P=>Nr(w.driver.getItem,P.relativeKey,P.options).then(M=>({key:P.key,value:Kl(M)})))))},getItemRaw(u,g={}){u=wi(u);const{relativeKey:w,driver:P}=t(u);return P.getItemRaw?Nr(P.getItemRaw,w,g):Nr(P.getItem,w,g).then(M=>qE(M))},async setItem(u,g,w={}){if(g===void 0)return h.removeItem(u);u=wi(u);const{relativeKey:P,driver:M}=t(u);M.setItem&&(await Nr(M.setItem,P,Vl(g),w),M.watch||n("update",u))},async setItems(u,g){await f(u,g,async w=>{w.driver.setItems&&await Nr(w.driver.setItems,w.items.map(P=>({key:P.relativeKey,value:Vl(P.value),options:P.options})),g),w.driver.setItem&&await Promise.all(w.items.map(P=>Nr(w.driver.setItem,P.relativeKey,Vl(P.value),P.options)))})},async setItemRaw(u,g,w={}){if(g===void 0)return h.removeItem(u,w);u=wi(u);const{relativeKey:P,driver:M}=t(u);if(M.setItemRaw)await Nr(M.setItemRaw,P,g,w);else if(M.setItem)await Nr(M.setItem,P,UE(g),w);else return;M.watch||n("update",u)},async removeItem(u,g={}){typeof g=="boolean"&&(g={removeMeta:g}),u=wi(u);const{relativeKey:w,driver:P}=t(u);P.removeItem&&(await Nr(P.removeItem,w,g),(g.removeMeta||g.removeMata)&&await Nr(P.removeItem,w+"$",g),P.watch||n("remove",u))},async getMeta(u,g={}){typeof g=="boolean"&&(g={nativeOnly:g}),u=wi(u);const{relativeKey:w,driver:P}=t(u),M=Object.create(null);if(P.getMeta&&Object.assign(M,await Nr(P.getMeta,w,g)),!g.nativeOnly){const O=await Nr(P.getItem,w+"$",g).then($=>Kl($));O&&typeof O=="object"&&(typeof O.atime=="string"&&(O.atime=new Date(O.atime)),typeof O.mtime=="string"&&(O.mtime=new Date(O.mtime)),Object.assign(M,O))}return M},setMeta(u,g,w={}){return this.setItem(u+"$",g,w)},removeMeta(u,g={}){return this.removeItem(u+"$",g)},async getKeys(u,g={}){u=Gl(u);const w=i(u,!0);let P=[];const M=[];for(const O of w){const W=(await Nr(O.driver.getKeys,O.relativeBase,g)).map(k=>O.mountpoint+wi(k)).filter(k=>!P.some(F=>k.startsWith(F)));M.push(...W),P=[O.mountpoint,...P.filter(k=>!k.startsWith(O.mountpoint))]}return u?M.filter(O=>O.startsWith(u)&&!O.endsWith("$")):M.filter(O=>!O.endsWith("$"))},async clear(u,g={}){u=Gl(u),await Promise.all(i(u,!1).map(async w=>{if(w.driver.clear)return Nr(w.driver.clear,w.relativeBase,g);if(w.driver.removeItem){const P=await w.driver.getKeys(w.relativeBase||"",g);return Promise.all(P.map(M=>w.driver.removeItem(M,g)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>Cb(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(g=>g!==u),e.watchListeners.length===0&&await a()}},async unwatch(){e.watchListeners=[],await a()},mount(u,g){if(u=Gl(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((w,P)=>P.length-w.length)),e.mounts[u]=g,e.watching&&Promise.resolve(Mb(g,n,u)).then(w=>{e.unwatch[u]=w}).catch(console.error),h},async unmount(u,g=!0){u=Gl(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u](),delete e.unwatch[u]),g&&await Cb(e.mounts[u]),e.mountpoints=e.mountpoints.filter(w=>w!==u),delete e.mounts[u])},getMount(u=""){u=wi(u)+":";const g=t(u);return{driver:g.driver,base:g.base}},getMounts(u="",g={}){return u=wi(u),i(u,g.parents).map(P=>({driver:P.driver,base:P.mountpoint}))}};return h}function Mb(r,e,t){return r.watch?r.watch((i,n)=>e(i,t+n)):()=>{}}async function Cb(r){typeof r.dispose=="function"&&await Nr(r.dispose)}function No(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function Pb(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=No(t);return(n,s)=>i.then(a=>s(a.transaction(e,n).objectStore(e)))}let o0;function rf(){return o0||(o0=Pb("keyval-store","keyval")),o0}function Db(r,e=rf()){return e("readonly",t=>No(t.get(r)))}function WE(r,e,t=rf()){return t("readwrite",i=>(i.put(e,r),No(i.transaction)))}function KE(r,e=rf()){return e("readwrite",t=>(t.delete(r),No(t.transaction)))}function VE(r=rf()){return r("readwrite",e=>(e.clear(),No(e.transaction)))}function GE(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},No(r.transaction)}function YE(r=rf()){return r("readonly",e=>{if(e.getAllKeys)return No(e.getAllKeys());const t=[];return GE(e,i=>t.push(i.key)).then(()=>t)})}const JE="idb-keyval";var QE=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=n=>e+n;let i;return r.dbName&&r.storeName&&(i=Pb(r.dbName,r.storeName)),{name:JE,options:r,async hasItem(n){return!(typeof await Db(t(n),i)>"u")},async getItem(n){return await Db(t(n),i)??null},setItem(n,s){return WE(t(n),s,i)},removeItem(n){return KE(t(n),i)},getKeys(){return YE(i)},clear(){return VE(i)}}};const ZE="WALLET_CONNECT_V2_INDEXED_DB",XE="keyvaluestorage";class eS{constructor(){this.indexedDb=jE({driver:QE({dbName:ZE,storeName:XE})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,bs(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var a0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Yl={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof a0<"u"&&a0.localStorage?Yl.exports=a0.localStorage:typeof window<"u"&&window.localStorage?Yl.exports=window.localStorage:Yl.exports=new e})();function tS(r){var e;return[r[0],Po((e=r[1])!=null?e:"")]}class rS{constructor(){this.localStorage=Yl.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(tS)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return Po(t)}async setItem(e,t){this.localStorage.setItem(e,bs(t))}async removeItem(e){this.localStorage.removeItem(e)}}const iS="wc_storage_version",Ob=1,nS=async(r,e,t)=>{const i=iS,n=await e.getItem(i);if(n&&n>=Ob){t(e);return}const s=await r.getKeys();if(!s.length){t(e);return}const a=[];for(;s.length;){const f=s.shift();if(!f)continue;const h=f.toLowerCase();if(h.includes("wc@")||h.includes("walletconnect")||h.includes("wc_")||h.includes("wallet_connect")){const u=await r.getItem(f);await e.setItem(f,u),a.push(f)}}await e.setItem(i,Ob),t(e),sS(r,a)},sS=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class oS{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new rS;this.storage=e;try{const t=new eS;nS(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}function aS(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var cS=fS;function fS(r,e,t){var i=t&&t.stringify||aS,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var a=new Array(s);a[0]=i(r);for(var f=1;f<s;f++)a[f]=i(e[f]);return a.join(" ")}if(typeof r!="string")return r;var h=e.length;if(h===0)return r;for(var u="",g=1-n,w=-1,P=r&&r.length||0,M=0;M<P;){if(r.charCodeAt(M)===37&&M+1<P){switch(w=w>-1?w:0,r.charCodeAt(M+1)){case 100:case 102:if(g>=h||e[g]==null)break;w<M&&(u+=r.slice(w,M)),u+=Number(e[g]),w=M+2,M++;break;case 105:if(g>=h||e[g]==null)break;w<M&&(u+=r.slice(w,M)),u+=Math.floor(Number(e[g])),w=M+2,M++;break;case 79:case 111:case 106:if(g>=h||e[g]===void 0)break;w<M&&(u+=r.slice(w,M));var O=typeof e[g];if(O==="string"){u+="'"+e[g]+"'",w=M+2,M++;break}if(O==="function"){u+=e[g].name||"<anonymous>",w=M+2,M++;break}u+=i(e[g]),w=M+2,M++;break;case 115:if(g>=h)break;w<M&&(u+=r.slice(w,M)),u+=String(e[g]),w=M+2,M++;break;case 37:w<M&&(u+=r.slice(w,M)),u+="%",w=M+2,M++,g--;break}++g}++M}return w===-1?r:(w<P&&(u+=r.slice(w)),u)}const Rb=cS;var Jn=Qn;const nf=wS().console||{},lS={mapHttpRequest:Ql,mapHttpResponse:Ql,wrapRequestSerializer:f0,wrapResponseSerializer:f0,wrapErrorSerializer:f0,req:Ql,res:Ql,err:gS};function hS(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Qn(r){r=r||{},r.browser=r.browser||{};const e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=r.browser.write||nf;r.browser.write&&(r.browser.asObject=!0);const i=r.serializers||{},n=hS(r.browser.serialize,i);let s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const a=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const f=r.level||"info",h=Object.create(t);h.log||(h.log=sf),Object.defineProperty(h,"levelVal",{get:g}),Object.defineProperty(h,"level",{get:w,set:P});const u={transmit:e,serialize:n,asObject:r.browser.asObject,levels:a,timestamp:vS(r)};h.levels=Qn.levels,h.level=f,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=sf,h.serializers=i,h._serialize=n,h._stdErrSerialize=s,h.child=M,e&&(h._logEvent=c0());function g(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function P(O){if(O!=="silent"&&!this.levels.values[O])throw Error("unknown level "+O);this._level=O,ka(u,h,"error","log"),ka(u,h,"fatal","error"),ka(u,h,"warn","error"),ka(u,h,"info","log"),ka(u,h,"debug","log"),ka(u,h,"trace","log")}function M(O,$){if(!O)throw new Error("missing bindings for child Pino");$=$||{},n&&O.serializers&&($.serializers=O.serializers);const W=$.serializers;if(n&&W){var k=Object.assign({},i,W),F=r.browser.serialize===!0?Object.keys(k):n;delete O.serializers,Jl([O],F,k,this._stdErrSerialize)}function Y(B){this._childLevel=(B._childLevel|0)+1,this.error=Ha(B,O,"error"),this.fatal=Ha(B,O,"fatal"),this.warn=Ha(B,O,"warn"),this.info=Ha(B,O,"info"),this.debug=Ha(B,O,"debug"),this.trace=Ha(B,O,"trace"),k&&(this.serializers=k,this._serialize=F),e&&(this._logEvent=c0([].concat(B._logEvent.bindings,O)))}return Y.prototype=this,new Y(this)}return h}Qn.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"}},Qn.stdSerializers=lS,Qn.stdTimeFunctions=Object.assign({},{nullTime:Tb,epochTime:$b,unixTime:mS,isoTime:bS});function ka(r,e,t,i){const n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?sf:n[t]?n[t]:nf[t]||nf[i]||sf,uS(r,e,t)}function uS(r,e,t){!r.transmit&&e[t]===sf||(e[t]=function(i){return function(){const s=r.timestamp(),a=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===nf?nf:this;for(var h=0;h<a.length;h++)a[h]=arguments[h];if(r.serialize&&!r.asObject&&Jl(a,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?i.call(f,dS(this,t,a,s)):i.apply(f,a),r.transmit){const u=r.transmit.level||e.level,g=Qn.levels.values[u],w=Qn.levels.values[t];if(w<g)return;pS(this,{ts:s,methodLevel:t,methodValue:w,transmitLevel:u,transmitValue:Qn.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},a)}}}(e[t]))}function dS(r,e,t,i){r._serialize&&Jl(t,r._serialize,r.serializers,r._stdErrSerialize);const n=t.slice();let s=n[0];const a={};i&&(a.time=i),a.level=Qn.levels.values[e];let f=(r._childLevel|0)+1;if(f<1&&(f=1),s!==null&&typeof s=="object"){for(;f--&&typeof n[0]=="object";)Object.assign(a,n.shift());s=n.length?Rb(n.shift(),n):void 0}else typeof s=="string"&&(s=Rb(n.shift(),n));return s!==void 0&&(a.msg=s),a}function Jl(r,e,t,i){for(const n in r)if(i&&r[n]instanceof Error)r[n]=Qn.stdSerializers.err(r[n]);else if(typeof r[n]=="object"&&!Array.isArray(r[n]))for(const s in r[n])e&&e.indexOf(s)>-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function Ha(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return r[t].apply(this,i)}}function pS(r,e,t){const i=e.send,n=e.ts,s=e.methodLevel,a=e.methodValue,f=e.val,h=r._logEvent.bindings;Jl(t,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=n,r._logEvent.messages=t.filter(function(u){return h.indexOf(u)===-1}),r._logEvent.level.label=s,r._logEvent.level.value=a,i(s,r._logEvent,f),r._logEvent=c0(h)}function c0(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function gS(r){const e={type:r.constructor.name,msg:r.message,stack:r.stack};for(const t in r)e[t]===void 0&&(e[t]=r[t]);return e}function vS(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?Tb:$b}function Ql(){return{}}function f0(r){return r}function sf(){}function Tb(){return!1}function $b(){return Date.now()}function mS(){return Math.round(Date.now()/1e3)}function bS(){return new Date(Date.now()).toISOString()}function wS(){function r(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 r(self)||r(window)||r(this)||{}}}const yS={level:"info"},of="custom_context",l0=1e3*1024;class _S{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Nb{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new _S(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class Lb{constructor(e,t=l0){this.level=e??"error",this.levelValue=Jn.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Nb(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Jn.levels.values.error?console.error(e):t===Jn.levels.values.warn?console.warn(e):t===Jn.levels.values.debug?console.debug(e):t===Jn.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(bs({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Nb(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(bs({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class xS{constructor(e,t=l0){this.baseChunkLogger=new Lb(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}}class AS{constructor(e,t=l0){this.baseChunkLogger=new Lb(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var ES=Object.defineProperty,SS=Object.defineProperties,IS=Object.getOwnPropertyDescriptors,Bb=Object.getOwnPropertySymbols,MS=Object.prototype.hasOwnProperty,CS=Object.prototype.propertyIsEnumerable,Fb=(r,e,t)=>e in r?ES(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zl=(r,e)=>{for(var t in e||(e={}))MS.call(e,t)&&Fb(r,t,e[t]);if(Bb)for(var t of Bb(e))CS.call(e,t)&&Fb(r,t,e[t]);return r},Xl=(r,e)=>SS(r,IS(e));function eh(r){return Xl(Zl({},r),{level:r?.level||yS.level})}function PS(r,e=of){return r[e]||""}function DS(r,e,t=of){return r[t]=e,r}function yi(r,e=of){let t="";return typeof r.bindings>"u"?t=PS(r,e):t=r.bindings().context||"",t}function OS(r,e,t=of){const i=yi(r,t);return i.trim()?`${i}/${e}`:e}function ai(r,e,t=of){const i=OS(r,e,t),n=r.child({context:i});return DS(n,i,t)}function RS(r){var e,t;const i=new xS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Jn(Xl(Zl({},r.opts),{level:"trace",browser:Xl(Zl({},(t=r.opts)==null?void 0:t.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function TS(r){var e;const t=new AS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Jn(Xl(Zl({},r.opts),{level:"trace"})),chunkLoggerController:t}}function $S(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?RS(r):TS(r)}class NS extends $o{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class LS extends $o{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class BS{constructor(e,t){this.logger=e,this.core=t}}class FS extends $o{constructor(e,t){super(),this.relayer=e,this.logger=t}}class US extends $o{constructor(e){super()}}class qS{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}}class zS extends $o{constructor(e,t){super(),this.relayer=e,this.logger=t}}class kS extends $o{constructor(e,t){super(),this.core=e,this.logger=t}}class HS{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}}class jS{constructor(e,t){this.projectId=e,this.logger=t}}class WS{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}}class KS{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class VS{constructor(e){this.client=e}}function GS(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Ub(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const qb=Ub("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),h0=Ub("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=GS(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),YS={utf8:qb,"utf-8":qb,hex:Da.base16,latin1:h0,ascii:h0,binary:h0,...Da};function JS(r,e="utf8"){const t=YS[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}const QS="PARSE_ERROR",ZS="INVALID_REQUEST",XS="METHOD_NOT_FOUND",eI="INVALID_PARAMS",zb="INTERNAL_ERROR",u0="SERVER_ERROR",tI=[-32700,-32600,-32601,-32602,-32603],af={[QS]:{code:-32700,message:"Parse error"},[ZS]:{code:-32600,message:"Invalid Request"},[XS]:{code:-32601,message:"Method not found"},[eI]:{code:-32602,message:"Invalid params"},[zb]:{code:-32603,message:"Internal error"},[u0]:{code:-32e3,message:"Server error"}},kb=u0;function rI(r){return tI.includes(r)}function Hb(r){return Object.keys(af).includes(r)?af[r]:af[kb]}function iI(r){const e=Object.values(af).find(t=>t.code===r);return e||af[kb]}function jb(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var Wb={};/*! *****************************************************************************
30
+ Approved: ${P.toString()}`))}),a.forEach(w=>{i||(Do(n[w].methods,s[w].methods)?Do(n[w].events,s[w].events)||(i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):i=_e("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function _E(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(n=>{e[n]={methods:r[t].methods,events:r[t].events}})}),e}function Ab(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function xE(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=qa(r[t].accounts);i?.forEach(n=>{e[n]={accounts:r[t].accounts.filter(s=>s.includes(`${n}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function AE(r,e){return t0(r,!1)&&r<=e.max&&r>=e.min}function Eb(){const r=Wc();return new Promise(e=>{switch(r){case Bi.browser:e(EE());break;case Bi.reactNative:e(SE());break;case Bi.node:e(IE());break;default:e(!0)}})}function EE(){return jc()&&navigator?.onLine}async function SE(){if(Fa()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function IE(){return!0}function ME(r){switch(Wc()){case Bi.browser:CE(r);break;case Bi.reactNative:PE(r);break}}function CE(r){!Fa()&&jc()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function PE(r){Fa()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const i0={};class tf{static get(e){return i0[e]}static set(e,t){i0[e]=t}static delete(e){delete i0[e]}}class $o{}class DE extends $o{constructor(e){super()}}const Sb=Ae.FIVE_SECONDS,za={pulse:"heartbeat_pulse"};class n0 extends DE{constructor(e){super(e),this.events=new qr.exports.EventEmitter,this.interval=Sb,this.interval=e?.interval||Sb}static async init(e){const t=new n0(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),Ae.toMiliseconds(this.interval))}pulse(){this.events.emit(za.pulse)}}const OE=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,RE=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,TE=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $E(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){NE(r);return}return e}function NE(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Kl(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!TE.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(OE.test(r)||RE.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,$E)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function LE(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function Nr(r,...e){try{return LE(r(...e))}catch(t){return Promise.reject(t)}}function BE(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function FE(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function Vl(r){if(BE(r))return String(r);if(FE(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Vl(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Ib(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const s0="base64:";function UE(r){if(typeof r=="string")return r;Ib();const e=Buffer.from(r).toString("base64");return s0+e}function qE(r){return typeof r!="string"||!r.startsWith(s0)?r:(Ib(),Buffer.from(r.slice(s0.length),"base64"))}function wi(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function zE(...r){return wi(r.join(":"))}function Gl(r){return r=wi(r),r?r+":":""}function rH(r){return r}const HE="memory",kE=()=>{const r=new Map;return{name:HE,options:{},hasItem(e){return r.has(e)},getItem(e){return r.get(e)||null},getItemRaw(e){return r.get(e)||null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function jE(r={}){const e={mounts:{"":r.driver||kE()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=u=>{for(const g of e.mountpoints)if(u.startsWith(g))return{base:g,relativeKey:u.slice(g.length),driver:e.mounts[g]};return{base:"",relativeKey:u,driver:e.mounts[""]}},i=(u,g)=>e.mountpoints.filter(w=>w.startsWith(u)||g&&u.startsWith(w)).map(w=>({relativeBase:u.length>w.length?u.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(u,g)=>{if(e.watching){g=wi(g);for(const w of e.watchListeners)w(u,g)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await Mb(e.mounts[u],n,u)}},a=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},f=(u,g,w)=>{const P=new Map,M=O=>{let $=P.get(O.base);return $||($={driver:O.driver,base:O.base,items:[]},P.set(O.base,$)),$};for(const O of u){const $=typeof O=="string",W=wi($?O:O.key),H=$?void 0:O.value,F=$||!O.options?g:{...g,...O.options},Y=t(W);M(Y).items.push({key:W,value:H,relativeKey:Y.relativeKey,options:F})}return Promise.all([...P.values()].map(O=>w(O))).then(O=>O.flat())},h={hasItem(u,g={}){u=wi(u);const{relativeKey:w,driver:P}=t(u);return Nr(P.hasItem,w,g)},getItem(u,g={}){u=wi(u);const{relativeKey:w,driver:P}=t(u);return Nr(P.getItem,w,g).then(M=>Kl(M))},getItems(u,g){return f(u,g,w=>w.driver.getItems?Nr(w.driver.getItems,w.items.map(P=>({key:P.relativeKey,options:P.options})),g).then(P=>P.map(M=>({key:zE(w.base,M.key),value:Kl(M.value)}))):Promise.all(w.items.map(P=>Nr(w.driver.getItem,P.relativeKey,P.options).then(M=>({key:P.key,value:Kl(M)})))))},getItemRaw(u,g={}){u=wi(u);const{relativeKey:w,driver:P}=t(u);return P.getItemRaw?Nr(P.getItemRaw,w,g):Nr(P.getItem,w,g).then(M=>qE(M))},async setItem(u,g,w={}){if(g===void 0)return h.removeItem(u);u=wi(u);const{relativeKey:P,driver:M}=t(u);M.setItem&&(await Nr(M.setItem,P,Vl(g),w),M.watch||n("update",u))},async setItems(u,g){await f(u,g,async w=>{w.driver.setItems&&await Nr(w.driver.setItems,w.items.map(P=>({key:P.relativeKey,value:Vl(P.value),options:P.options})),g),w.driver.setItem&&await Promise.all(w.items.map(P=>Nr(w.driver.setItem,P.relativeKey,Vl(P.value),P.options)))})},async setItemRaw(u,g,w={}){if(g===void 0)return h.removeItem(u,w);u=wi(u);const{relativeKey:P,driver:M}=t(u);if(M.setItemRaw)await Nr(M.setItemRaw,P,g,w);else if(M.setItem)await Nr(M.setItem,P,UE(g),w);else return;M.watch||n("update",u)},async removeItem(u,g={}){typeof g=="boolean"&&(g={removeMeta:g}),u=wi(u);const{relativeKey:w,driver:P}=t(u);P.removeItem&&(await Nr(P.removeItem,w,g),(g.removeMeta||g.removeMata)&&await Nr(P.removeItem,w+"$",g),P.watch||n("remove",u))},async getMeta(u,g={}){typeof g=="boolean"&&(g={nativeOnly:g}),u=wi(u);const{relativeKey:w,driver:P}=t(u),M=Object.create(null);if(P.getMeta&&Object.assign(M,await Nr(P.getMeta,w,g)),!g.nativeOnly){const O=await Nr(P.getItem,w+"$",g).then($=>Kl($));O&&typeof O=="object"&&(typeof O.atime=="string"&&(O.atime=new Date(O.atime)),typeof O.mtime=="string"&&(O.mtime=new Date(O.mtime)),Object.assign(M,O))}return M},setMeta(u,g,w={}){return this.setItem(u+"$",g,w)},removeMeta(u,g={}){return this.removeItem(u+"$",g)},async getKeys(u,g={}){u=Gl(u);const w=i(u,!0);let P=[];const M=[];for(const O of w){const W=(await Nr(O.driver.getKeys,O.relativeBase,g)).map(H=>O.mountpoint+wi(H)).filter(H=>!P.some(F=>H.startsWith(F)));M.push(...W),P=[O.mountpoint,...P.filter(H=>!H.startsWith(O.mountpoint))]}return u?M.filter(O=>O.startsWith(u)&&!O.endsWith("$")):M.filter(O=>!O.endsWith("$"))},async clear(u,g={}){u=Gl(u),await Promise.all(i(u,!1).map(async w=>{if(w.driver.clear)return Nr(w.driver.clear,w.relativeBase,g);if(w.driver.removeItem){const P=await w.driver.getKeys(w.relativeBase||"",g);return Promise.all(P.map(M=>w.driver.removeItem(M,g)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>Cb(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(g=>g!==u),e.watchListeners.length===0&&await a()}},async unwatch(){e.watchListeners=[],await a()},mount(u,g){if(u=Gl(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((w,P)=>P.length-w.length)),e.mounts[u]=g,e.watching&&Promise.resolve(Mb(g,n,u)).then(w=>{e.unwatch[u]=w}).catch(console.error),h},async unmount(u,g=!0){u=Gl(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u](),delete e.unwatch[u]),g&&await Cb(e.mounts[u]),e.mountpoints=e.mountpoints.filter(w=>w!==u),delete e.mounts[u])},getMount(u=""){u=wi(u)+":";const g=t(u);return{driver:g.driver,base:g.base}},getMounts(u="",g={}){return u=wi(u),i(u,g.parents).map(P=>({driver:P.driver,base:P.mountpoint}))}};return h}function Mb(r,e,t){return r.watch?r.watch((i,n)=>e(i,t+n)):()=>{}}async function Cb(r){typeof r.dispose=="function"&&await Nr(r.dispose)}function No(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function Pb(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=No(t);return(n,s)=>i.then(a=>s(a.transaction(e,n).objectStore(e)))}let o0;function rf(){return o0||(o0=Pb("keyval-store","keyval")),o0}function Db(r,e=rf()){return e("readonly",t=>No(t.get(r)))}function WE(r,e,t=rf()){return t("readwrite",i=>(i.put(e,r),No(i.transaction)))}function KE(r,e=rf()){return e("readwrite",t=>(t.delete(r),No(t.transaction)))}function VE(r=rf()){return r("readwrite",e=>(e.clear(),No(e.transaction)))}function GE(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},No(r.transaction)}function YE(r=rf()){return r("readonly",e=>{if(e.getAllKeys)return No(e.getAllKeys());const t=[];return GE(e,i=>t.push(i.key)).then(()=>t)})}const JE="idb-keyval";var QE=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=n=>e+n;let i;return r.dbName&&r.storeName&&(i=Pb(r.dbName,r.storeName)),{name:JE,options:r,async hasItem(n){return!(typeof await Db(t(n),i)>"u")},async getItem(n){return await Db(t(n),i)??null},setItem(n,s){return WE(t(n),s,i)},removeItem(n){return KE(t(n),i)},getKeys(){return YE(i)},clear(){return VE(i)}}};const ZE="WALLET_CONNECT_V2_INDEXED_DB",XE="keyvaluestorage";class eS{constructor(){this.indexedDb=jE({driver:QE({dbName:ZE,storeName:XE})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,ws(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var a0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Yl={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof a0<"u"&&a0.localStorage?Yl.exports=a0.localStorage:typeof window<"u"&&window.localStorage?Yl.exports=window.localStorage:Yl.exports=new e})();function tS(r){var e;return[r[0],Po((e=r[1])!=null?e:"")]}class rS{constructor(){this.localStorage=Yl.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(tS)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return Po(t)}async setItem(e,t){this.localStorage.setItem(e,ws(t))}async removeItem(e){this.localStorage.removeItem(e)}}const iS="wc_storage_version",Ob=1,nS=async(r,e,t)=>{const i=iS,n=await e.getItem(i);if(n&&n>=Ob){t(e);return}const s=await r.getKeys();if(!s.length){t(e);return}const a=[];for(;s.length;){const f=s.shift();if(!f)continue;const h=f.toLowerCase();if(h.includes("wc@")||h.includes("walletconnect")||h.includes("wc_")||h.includes("wallet_connect")){const u=await r.getItem(f);await e.setItem(f,u),a.push(f)}}await e.setItem(i,Ob),t(e),sS(r,a)},sS=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class oS{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new rS;this.storage=e;try{const t=new eS;nS(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}function aS(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var cS=fS;function fS(r,e,t){var i=t&&t.stringify||aS,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var a=new Array(s);a[0]=i(r);for(var f=1;f<s;f++)a[f]=i(e[f]);return a.join(" ")}if(typeof r!="string")return r;var h=e.length;if(h===0)return r;for(var u="",g=1-n,w=-1,P=r&&r.length||0,M=0;M<P;){if(r.charCodeAt(M)===37&&M+1<P){switch(w=w>-1?w:0,r.charCodeAt(M+1)){case 100:case 102:if(g>=h||e[g]==null)break;w<M&&(u+=r.slice(w,M)),u+=Number(e[g]),w=M+2,M++;break;case 105:if(g>=h||e[g]==null)break;w<M&&(u+=r.slice(w,M)),u+=Math.floor(Number(e[g])),w=M+2,M++;break;case 79:case 111:case 106:if(g>=h||e[g]===void 0)break;w<M&&(u+=r.slice(w,M));var O=typeof e[g];if(O==="string"){u+="'"+e[g]+"'",w=M+2,M++;break}if(O==="function"){u+=e[g].name||"<anonymous>",w=M+2,M++;break}u+=i(e[g]),w=M+2,M++;break;case 115:if(g>=h)break;w<M&&(u+=r.slice(w,M)),u+=String(e[g]),w=M+2,M++;break;case 37:w<M&&(u+=r.slice(w,M)),u+="%",w=M+2,M++,g--;break}++g}++M}return w===-1?r:(w<P&&(u+=r.slice(w)),u)}const Rb=cS;var Qn=Zn;const nf=wS().console||{},lS={mapHttpRequest:Ql,mapHttpResponse:Ql,wrapRequestSerializer:f0,wrapResponseSerializer:f0,wrapErrorSerializer:f0,req:Ql,res:Ql,err:gS};function hS(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Zn(r){r=r||{},r.browser=r.browser||{};const e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=r.browser.write||nf;r.browser.write&&(r.browser.asObject=!0);const i=r.serializers||{},n=hS(r.browser.serialize,i);let s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const a=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const f=r.level||"info",h=Object.create(t);h.log||(h.log=sf),Object.defineProperty(h,"levelVal",{get:g}),Object.defineProperty(h,"level",{get:w,set:P});const u={transmit:e,serialize:n,asObject:r.browser.asObject,levels:a,timestamp:vS(r)};h.levels=Zn.levels,h.level=f,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=sf,h.serializers=i,h._serialize=n,h._stdErrSerialize=s,h.child=M,e&&(h._logEvent=c0());function g(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function P(O){if(O!=="silent"&&!this.levels.values[O])throw Error("unknown level "+O);this._level=O,Ha(u,h,"error","log"),Ha(u,h,"fatal","error"),Ha(u,h,"warn","error"),Ha(u,h,"info","log"),Ha(u,h,"debug","log"),Ha(u,h,"trace","log")}function M(O,$){if(!O)throw new Error("missing bindings for child Pino");$=$||{},n&&O.serializers&&($.serializers=O.serializers);const W=$.serializers;if(n&&W){var H=Object.assign({},i,W),F=r.browser.serialize===!0?Object.keys(H):n;delete O.serializers,Jl([O],F,H,this._stdErrSerialize)}function Y(B){this._childLevel=(B._childLevel|0)+1,this.error=ka(B,O,"error"),this.fatal=ka(B,O,"fatal"),this.warn=ka(B,O,"warn"),this.info=ka(B,O,"info"),this.debug=ka(B,O,"debug"),this.trace=ka(B,O,"trace"),H&&(this.serializers=H,this._serialize=F),e&&(this._logEvent=c0([].concat(B._logEvent.bindings,O)))}return Y.prototype=this,new Y(this)}return h}Zn.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"}},Zn.stdSerializers=lS,Zn.stdTimeFunctions=Object.assign({},{nullTime:Tb,epochTime:$b,unixTime:mS,isoTime:bS});function Ha(r,e,t,i){const n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?sf:n[t]?n[t]:nf[t]||nf[i]||sf,uS(r,e,t)}function uS(r,e,t){!r.transmit&&e[t]===sf||(e[t]=function(i){return function(){const s=r.timestamp(),a=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===nf?nf:this;for(var h=0;h<a.length;h++)a[h]=arguments[h];if(r.serialize&&!r.asObject&&Jl(a,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?i.call(f,dS(this,t,a,s)):i.apply(f,a),r.transmit){const u=r.transmit.level||e.level,g=Zn.levels.values[u],w=Zn.levels.values[t];if(w<g)return;pS(this,{ts:s,methodLevel:t,methodValue:w,transmitLevel:u,transmitValue:Zn.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},a)}}}(e[t]))}function dS(r,e,t,i){r._serialize&&Jl(t,r._serialize,r.serializers,r._stdErrSerialize);const n=t.slice();let s=n[0];const a={};i&&(a.time=i),a.level=Zn.levels.values[e];let f=(r._childLevel|0)+1;if(f<1&&(f=1),s!==null&&typeof s=="object"){for(;f--&&typeof n[0]=="object";)Object.assign(a,n.shift());s=n.length?Rb(n.shift(),n):void 0}else typeof s=="string"&&(s=Rb(n.shift(),n));return s!==void 0&&(a.msg=s),a}function Jl(r,e,t,i){for(const n in r)if(i&&r[n]instanceof Error)r[n]=Zn.stdSerializers.err(r[n]);else if(typeof r[n]=="object"&&!Array.isArray(r[n]))for(const s in r[n])e&&e.indexOf(s)>-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function ka(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return r[t].apply(this,i)}}function pS(r,e,t){const i=e.send,n=e.ts,s=e.methodLevel,a=e.methodValue,f=e.val,h=r._logEvent.bindings;Jl(t,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=n,r._logEvent.messages=t.filter(function(u){return h.indexOf(u)===-1}),r._logEvent.level.label=s,r._logEvent.level.value=a,i(s,r._logEvent,f),r._logEvent=c0(h)}function c0(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function gS(r){const e={type:r.constructor.name,msg:r.message,stack:r.stack};for(const t in r)e[t]===void 0&&(e[t]=r[t]);return e}function vS(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?Tb:$b}function Ql(){return{}}function f0(r){return r}function sf(){}function Tb(){return!1}function $b(){return Date.now()}function mS(){return Math.round(Date.now()/1e3)}function bS(){return new Date(Date.now()).toISOString()}function wS(){function r(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 r(self)||r(window)||r(this)||{}}}const yS={level:"info"},of="custom_context",l0=1e3*1024;class _S{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Nb{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new _S(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class Lb{constructor(e,t=l0){this.level=e??"error",this.levelValue=Qn.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Nb(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Qn.levels.values.error?console.error(e):t===Qn.levels.values.warn?console.warn(e):t===Qn.levels.values.debug?console.debug(e):t===Qn.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(ws({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Nb(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(ws({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class xS{constructor(e,t=l0){this.baseChunkLogger=new Lb(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}}class AS{constructor(e,t=l0){this.baseChunkLogger=new Lb(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var ES=Object.defineProperty,SS=Object.defineProperties,IS=Object.getOwnPropertyDescriptors,Bb=Object.getOwnPropertySymbols,MS=Object.prototype.hasOwnProperty,CS=Object.prototype.propertyIsEnumerable,Fb=(r,e,t)=>e in r?ES(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zl=(r,e)=>{for(var t in e||(e={}))MS.call(e,t)&&Fb(r,t,e[t]);if(Bb)for(var t of Bb(e))CS.call(e,t)&&Fb(r,t,e[t]);return r},Xl=(r,e)=>SS(r,IS(e));function eh(r){return Xl(Zl({},r),{level:r?.level||yS.level})}function PS(r,e=of){return r[e]||""}function DS(r,e,t=of){return r[t]=e,r}function yi(r,e=of){let t="";return typeof r.bindings>"u"?t=PS(r,e):t=r.bindings().context||"",t}function OS(r,e,t=of){const i=yi(r,t);return i.trim()?`${i}/${e}`:e}function ai(r,e,t=of){const i=OS(r,e,t),n=r.child({context:i});return DS(n,i,t)}function RS(r){var e,t;const i=new xS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Qn(Xl(Zl({},r.opts),{level:"trace",browser:Xl(Zl({},(t=r.opts)==null?void 0:t.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function TS(r){var e;const t=new AS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Qn(Xl(Zl({},r.opts),{level:"trace"})),chunkLoggerController:t}}function $S(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?RS(r):TS(r)}class NS extends $o{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class LS extends $o{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class BS{constructor(e,t){this.logger=e,this.core=t}}class FS extends $o{constructor(e,t){super(),this.relayer=e,this.logger=t}}class US extends $o{constructor(e){super()}}class qS{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}}class zS extends $o{constructor(e,t){super(),this.relayer=e,this.logger=t}}class HS extends $o{constructor(e,t){super(),this.core=e,this.logger=t}}class kS{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}}class jS{constructor(e,t){this.projectId=e,this.logger=t}}class WS{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}}class KS{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class VS{constructor(e){this.client=e}}function GS(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Ub(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const qb=Ub("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),h0=Ub("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=GS(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),YS={utf8:qb,"utf-8":qb,hex:Da.base16,latin1:h0,ascii:h0,binary:h0,...Da};function JS(r,e="utf8"){const t=YS[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}const QS="PARSE_ERROR",ZS="INVALID_REQUEST",XS="METHOD_NOT_FOUND",eI="INVALID_PARAMS",zb="INTERNAL_ERROR",u0="SERVER_ERROR",tI=[-32700,-32600,-32601,-32602,-32603],af={[QS]:{code:-32700,message:"Parse error"},[ZS]:{code:-32600,message:"Invalid Request"},[XS]:{code:-32601,message:"Method not found"},[eI]:{code:-32602,message:"Invalid params"},[zb]:{code:-32603,message:"Internal error"},[u0]:{code:-32e3,message:"Server error"}},Hb=u0;function rI(r){return tI.includes(r)}function kb(r){return Object.keys(af).includes(r)?af[r]:af[Hb]}function iI(r){const e=Object.values(af).find(t=>t.code===r);return e||af[Hb]}function jb(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var Wb={};/*! *****************************************************************************
31
31
  Copyright (c) Microsoft Corporation.
32
32
 
33
33
  Permission to use, copy, modify, and/or distribute this software for any
@@ -40,51 +40,51 @@
40
40
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
41
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
42
  PERFORMANCE OF THIS SOFTWARE.
43
- ***************************************************************************** */var d0=function(r,e){return d0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},d0(r,e)};function nI(r,e){d0(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var p0=function(){return p0=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},p0.apply(this,arguments)};function sI(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function oI(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function aI(r,e){return function(t,i){e(t,i,r)}}function cI(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function fI(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function lI(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function hI(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function uI(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function g0(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Kb(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function dI(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Kb(arguments[e]));return r}function pI(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function cf(r){return this instanceof cf?(this.v=r,this):new cf(r)}function gI(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(P){i[P]&&(n[P]=function(M){return new Promise(function(O,$){s.push([P,M,O,$])>1||f(P,M)})})}function f(P,M){try{h(i[P](M))}catch(O){w(s[0][3],O)}}function h(P){P.value instanceof cf?Promise.resolve(P.value.v).then(u,g):w(s[0][2],P)}function u(P){f("next",P)}function g(P){f("throw",P)}function w(P,M){P(M),s.shift(),s.length&&f(s[0][0],s[0][1])}}function vI(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:cf(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function mI(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof g0=="function"?g0(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function bI(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function wI(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function yI(r){return r&&r.__esModule?r:{default:r}}function _I(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function xI(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var AI=Object.freeze({__proto__:null,__extends:nI,get __assign(){return p0},__rest:sI,__decorate:oI,__param:aI,__metadata:cI,__awaiter:fI,__generator:lI,__createBinding:hI,__exportStar:uI,__values:g0,__read:Kb,__spread:dI,__spreadArrays:pI,__await:cf,__asyncGenerator:gI,__asyncDelegator:vI,__asyncValues:mI,__makeTemplateObject:bI,__importStar:wI,__importDefault:yI,__classPrivateFieldGet:_I,__classPrivateFieldSet:xI}),EI=zu(AI),_s={},Vb;function SI(){if(Vb)return _s;Vb=1,Object.defineProperty(_s,"__esModule",{value:!0}),_s.isBrowserCryptoAvailable=_s.getSubtleCrypto=_s.getBrowerCrypto=void 0;function r(){return fr?.crypto||fr?.msCrypto||{}}_s.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}_s.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return _s.isBrowserCryptoAvailable=t,_s}var xs={},Gb;function II(){if(Gb)return xs;Gb=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.isBrowser=xs.isNode=xs.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}xs.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}xs.isNode=e;function t(){return!r()&&!e()}return xs.isBrowser=t,xs}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=EI;e.__exportStar(SI(),r),e.__exportStar(II(),r)})(Wb);function Vs(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Lo(r=6){return BigInt(Vs(r))}function Gs(r,e,t){return{id:t||Vs(),jsonrpc:"2.0",method:r,params:e}}function th(r,e){return{id:r,jsonrpc:"2.0",result:e}}function rh(r,e,t){return{id:r,jsonrpc:"2.0",error:MI(e,t)}}function MI(r,e){return typeof r>"u"?Hb(zb):(typeof r=="string"&&(r=Object.assign(Object.assign({},Hb(u0)),{message:r})),typeof e<"u"&&(r.data=e),rI(r.code)&&(r=iI(r.code)),r)}class CI{}class PI extends CI{constructor(){super()}}class DI extends PI{constructor(e){super()}}const OI="^https?:",RI="^wss?:";function TI(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Yb(r,e){const t=TI(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function Jb(r){return Yb(r,OI)}function Qb(r){return Yb(r,RI)}function $I(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function Zb(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function v0(r){return Zb(r)&&"method"in r}function ih(r){return Zb(r)&&(Zn(r)||en(r))}function Zn(r){return"result"in r}function en(r){return"error"in r}class yn extends DI{constructor(e){super(e),this.events=new qr.exports.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Gs(e.method,e.params||[],e.id||Lo().toString()),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{en(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ih(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}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",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const NI=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),LI=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Xb=r=>r.split("?")[0],e2=10,BI=NI();class FI{constructor(e){if(this.url=e,this.events=new qr.exports.EventEmitter,this.registering=!1,!Qb(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(bs(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!Qb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const n=new URLSearchParams(e).get("origin"),s=Wb.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!$I(e)},a=new BI(e,[],s);LI()?a.onerror=f=>{const h=f;i(this.emitError(h.error))}:a.on("error",f=>{i(this.emitError(f))}),a.onopen=()=>{this.onOpen(a),t(a)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Po(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=rh(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return jb(e,Xb(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>e2&&this.events.setMaxListeners(e2)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Xb(this.url)}`));return this.events.emit("register_error",t),t}}var m0={exports:{}};(function(r,e){var t=200,i="__lodash_hash_undefined__",n=1,s=2,a=9007199254740991,f="[object Arguments]",h="[object Array]",u="[object AsyncFunction]",g="[object Boolean]",w="[object Date]",P="[object Error]",M="[object Function]",O="[object GeneratorFunction]",$="[object Map]",W="[object Number]",k="[object Null]",F="[object Object]",Y="[object Promise]",B="[object Proxy]",z="[object RegExp]",j="[object Set]",_="[object String]",U="[object Symbol]",ee="[object Undefined]",oe="[object WeakMap]",L="[object ArrayBuffer]",b="[object DataView]",m="[object Float32Array]",l="[object Float64Array]",d="[object Int8Array]",y="[object Int16Array]",C="[object Int32Array]",D="[object Uint8Array]",S="[object Uint8ClampedArray]",v="[object Uint16Array]",A="[object Uint32Array]",x=/[\\^$.*+?()[\]{}|]/g,N=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,R={};R[m]=R[l]=R[d]=R[y]=R[C]=R[D]=R[S]=R[v]=R[A]=!0,R[f]=R[h]=R[L]=R[g]=R[b]=R[w]=R[P]=R[M]=R[$]=R[W]=R[F]=R[z]=R[j]=R[_]=R[oe]=!1;var X=typeof fr=="object"&&fr&&fr.Object===Object&&fr,V=typeof self=="object"&&self&&self.Object===Object&&self,J=X||V||Function("return this")(),K=e&&!e.nodeType&&e,E=K&&!0&&r&&!r.nodeType&&r,G=E&&E.exports===K,re=G&&X.process,le=function(){try{return re&&re.binding&&re.binding("util")}catch{}}(),he=le&&le.isTypedArray;function ge(Q,ne){for(var pe=-1,Ue=Q==null?0:Q.length,Xt=0,bt=[];++pe<Ue;){var or=Q[pe];ne(or,pe,Q)&&(bt[Xt++]=or)}return bt}function ke(Q,ne){for(var pe=-1,Ue=ne.length,Xt=Q.length;++pe<Ue;)Q[Xt+pe]=ne[pe];return Q}function Te(Q,ne){for(var pe=-1,Ue=Q==null?0:Q.length;++pe<Ue;)if(ne(Q[pe],pe,Q))return!0;return!1}function Ce(Q,ne){for(var pe=-1,Ue=Array(Q);++pe<Q;)Ue[pe]=ne(pe);return Ue}function Xe(Q){return function(ne){return Q(ne)}}function $e(Q,ne){return Q.has(ne)}function be(Q,ne){return Q?.[ne]}function Pe(Q){var ne=-1,pe=Array(Q.size);return Q.forEach(function(Ue,Xt){pe[++ne]=[Xt,Ue]}),pe}function De(Q,ne){return function(pe){return Q(ne(pe))}}function ye(Q){var ne=-1,pe=Array(Q.size);return Q.forEach(function(Ue){pe[++ne]=Ue}),pe}var Ie=Array.prototype,Oe=Function.prototype,me=Object.prototype,Me=J["__core-js_shared__"],Be=Oe.toString,we=me.hasOwnProperty,He=function(){var Q=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||"");return Q?"Symbol(src)_1."+Q:""}(),We=me.toString,xe=RegExp("^"+Be.call(we).replace(x,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=G?J.Buffer:void 0,Ke=J.Symbol,Ge=J.Uint8Array,mt=me.propertyIsEnumerable,It=Ie.splice,Ye=Ke?Ke.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Ot=Ve?Ve.isBuffer:void 0,Ze=De(Object.keys,Object),rt=qi(J,"DataView"),et=qi(J,"Map"),Ne=qi(J,"Promise"),it=qi(J,"Set"),tt=qi(J,"WeakMap"),Re=qi(Object,"create"),lt=Ms(rt),ht=Ms(et),Le=Ms(Ne),ut=Ms(it),nt=Ms(tt),Fe=Ke?Ke.prototype:void 0,st=Fe?Fe.valueOf:void 0;function Qe(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function qe(){this.__data__=Re?Re(null):{},this.size=0}function dt(Q){var ne=this.has(Q)&&delete this.__data__[Q];return this.size-=ne?1:0,ne}function zt(Q){var ne=this.__data__;if(Re){var pe=ne[Q];return pe===i?void 0:pe}return we.call(ne,Q)?ne[Q]:void 0}function at(Q){var ne=this.__data__;return Re?ne[Q]!==void 0:we.call(ne,Q)}function kt(Q,ne){var pe=this.__data__;return this.size+=this.has(Q)?0:1,pe[Q]=Re&&ne===void 0?i:ne,this}Qe.prototype.clear=qe,Qe.prototype.delete=dt,Qe.prototype.get=zt,Qe.prototype.has=at,Qe.prototype.set=kt;function _t(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function qt(){this.__data__=[],this.size=0}function Qr(Q){var ne=this.__data__,pe=ra(ne,Q);if(pe<0)return!1;var Ue=ne.length-1;return pe==Ue?ne.pop():It.call(ne,pe,1),--this.size,!0}function Zr(Q){var ne=this.__data__,pe=ra(ne,Q);return pe<0?void 0:ne[pe][1]}function Xr(Q){return ra(this.__data__,Q)>-1}function ei(Q,ne){var pe=this.__data__,Ue=ra(pe,Q);return Ue<0?(++this.size,pe.push([Q,ne])):pe[Ue][1]=ne,this}_t.prototype.clear=qt,_t.prototype.delete=Qr,_t.prototype.get=Zr,_t.prototype.has=Xr,_t.prototype.set=ei;function vr(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function Ai(){this.size=0,this.__data__={hash:new Qe,map:new(et||_t),string:new Qe}}function In(Q){var ne=co(this,Q).delete(Q);return this.size-=ne?1:0,ne}function Ei(Q){return co(this,Q).get(Q)}function Mn(Q){return co(this,Q).has(Q)}function Cn(Q,ne){var pe=co(this,Q),Ue=pe.size;return pe.set(Q,ne),this.size+=pe.size==Ue?0:1,this}vr.prototype.clear=Ai,vr.prototype.delete=In,vr.prototype.get=Ei,vr.prototype.has=Mn,vr.prototype.set=Cn;function Si(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.__data__=new vr;++ne<pe;)this.add(Q[ne])}function sn(Q){return this.__data__.set(Q,i),this}function on(Q){return this.__data__.has(Q)}Si.prototype.add=Si.prototype.push=sn,Si.prototype.has=on;function Cr(Q){var ne=this.__data__=new _t(Q);this.size=ne.size}function Pn(){this.__data__=new _t,this.size=0}function Dn(Q){var ne=this.__data__,pe=ne.delete(Q);return this.size=ne.size,pe}function On(Q){return this.__data__.get(Q)}function ta(Q){return this.__data__.has(Q)}function ao(Q,ne){var pe=this.__data__;if(pe instanceof _t){var Ue=pe.__data__;if(!et||Ue.length<t-1)return Ue.push([Q,ne]),this.size=++pe.size,this;pe=this.__data__=new vr(Ue)}return pe.set(Q,ne),this.size=pe.size,this}Cr.prototype.clear=Pn,Cr.prototype.delete=Dn,Cr.prototype.get=On,Cr.prototype.has=ta,Cr.prototype.set=ao;function qh(Q,ne){var pe=uc(Q),Ue=!pe&&Zh(Q),Xt=!pe&&!Ue&&Lf(Q),bt=!pe&&!Ue&&!Xt&&tu(Q),or=pe||Ue||Xt||bt,Er=or?Ce(Q.length,String):[],Bt=Er.length;for(var er in Q)(ne||we.call(Q,er))&&!(or&&(er=="length"||Xt&&(er=="offset"||er=="parent")||bt&&(er=="buffer"||er=="byteLength"||er=="byteOffset")||Vh(er,Bt)))&&Er.push(er);return Er}function ra(Q,ne){for(var pe=Q.length;pe--;)if(Qh(Q[pe][0],ne))return pe;return-1}function $f(Q,ne,pe){var Ue=ne(Q);return uc(Q)?Ue:ke(Ue,pe(Q))}function ia(Q){return Q==null?Q===void 0?ee:k:Ye&&Ye in Object(Q)?Wh(Q):Gp(Q)}function Nf(Q){return sa(Q)&&ia(Q)==f}function na(Q,ne,pe,Ue,Xt){return Q===ne?!0:Q==null||ne==null||!sa(Q)&&!sa(ne)?Q!==Q&&ne!==ne:zh(Q,ne,pe,Ue,na,Xt)}function zh(Q,ne,pe,Ue,Xt,bt){var or=uc(Q),Er=uc(ne),Bt=or?h:cs(Q),er=Er?h:cs(ne);Bt=Bt==f?F:Bt,er=er==f?F:er;var _r=Bt==F,Ii=er==F,Sr=Bt==er;if(Sr&&Lf(Q)){if(!Lf(ne))return!1;or=!0,_r=!1}if(Sr&&!_r)return bt||(bt=new Cr),or||tu(Q)?lc(Q,ne,pe,Ue,Xt,bt):Vp(Q,ne,Bt,pe,Ue,Xt,bt);if(!(pe&n)){var ar=_r&&we.call(Q,"__wrapped__"),hi=Ii&&we.call(ne,"__wrapped__");if(ar||hi){var Rn=ar?Q.value():Q,an=hi?ne.value():ne;return bt||(bt=new Cr),Xt(Rn,an,pe,Ue,bt)}}return Sr?(bt||(bt=new Cr),jh(Q,ne,pe,Ue,Xt,bt)):!1}function Kp(Q){if(!eu(Q)||Yh(Q))return!1;var ne=dc(Q)?xe:N;return ne.test(Ms(Q))}function kh(Q){return sa(Q)&&Xh(Q.length)&&!!R[ia(Q)]}function Hh(Q){if(!Jh(Q))return Ze(Q);var ne=[];for(var pe in Object(Q))we.call(Q,pe)&&pe!="constructor"&&ne.push(pe);return ne}function lc(Q,ne,pe,Ue,Xt,bt){var or=pe&n,Er=Q.length,Bt=ne.length;if(Er!=Bt&&!(or&&Bt>Er))return!1;var er=bt.get(Q);if(er&&bt.get(ne))return er==ne;var _r=-1,Ii=!0,Sr=pe&s?new Si:void 0;for(bt.set(Q,ne),bt.set(ne,Q);++_r<Er;){var ar=Q[_r],hi=ne[_r];if(Ue)var Rn=or?Ue(hi,ar,_r,ne,Q,bt):Ue(ar,hi,_r,Q,ne,bt);if(Rn!==void 0){if(Rn)continue;Ii=!1;break}if(Sr){if(!Te(ne,function(an,fs){if(!$e(Sr,fs)&&(ar===an||Xt(ar,an,pe,Ue,bt)))return Sr.push(fs)})){Ii=!1;break}}else if(!(ar===hi||Xt(ar,hi,pe,Ue,bt))){Ii=!1;break}}return bt.delete(Q),bt.delete(ne),Ii}function Vp(Q,ne,pe,Ue,Xt,bt,or){switch(pe){case b:if(Q.byteLength!=ne.byteLength||Q.byteOffset!=ne.byteOffset)return!1;Q=Q.buffer,ne=ne.buffer;case L:return!(Q.byteLength!=ne.byteLength||!bt(new Ge(Q),new Ge(ne)));case g:case w:case W:return Qh(+Q,+ne);case P:return Q.name==ne.name&&Q.message==ne.message;case z:case _:return Q==ne+"";case $:var Er=Pe;case j:var Bt=Ue&n;if(Er||(Er=ye),Q.size!=ne.size&&!Bt)return!1;var er=or.get(Q);if(er)return er==ne;Ue|=s,or.set(Q,ne);var _r=lc(Er(Q),Er(ne),Ue,Xt,bt,or);return or.delete(Q),_r;case U:if(st)return st.call(Q)==st.call(ne)}return!1}function jh(Q,ne,pe,Ue,Xt,bt){var or=pe&n,Er=hc(Q),Bt=Er.length,er=hc(ne),_r=er.length;if(Bt!=_r&&!or)return!1;for(var Ii=Bt;Ii--;){var Sr=Er[Ii];if(!(or?Sr in ne:we.call(ne,Sr)))return!1}var ar=bt.get(Q);if(ar&&bt.get(ne))return ar==ne;var hi=!0;bt.set(Q,ne),bt.set(ne,Q);for(var Rn=or;++Ii<Bt;){Sr=Er[Ii];var an=Q[Sr],fs=ne[Sr];if(Ue)var Bf=or?Ue(fs,an,Sr,ne,Q,bt):Ue(an,fs,Sr,Q,ne,bt);if(!(Bf===void 0?an===fs||Xt(an,fs,pe,Ue,bt):Bf)){hi=!1;break}Rn||(Rn=Sr=="constructor")}if(hi&&!Rn){var oa=Q.constructor,Fr=ne.constructor;oa!=Fr&&"constructor"in Q&&"constructor"in ne&&!(typeof oa=="function"&&oa instanceof oa&&typeof Fr=="function"&&Fr instanceof Fr)&&(hi=!1)}return bt.delete(Q),bt.delete(ne),hi}function hc(Q){return $f(Q,Qp,Kh)}function co(Q,ne){var pe=Q.__data__;return Gh(ne)?pe[typeof ne=="string"?"string":"hash"]:pe.map}function qi(Q,ne){var pe=be(Q,ne);return Kp(pe)?pe:void 0}function Wh(Q){var ne=we.call(Q,Ye),pe=Q[Ye];try{Q[Ye]=void 0;var Ue=!0}catch{}var Xt=We.call(Q);return Ue&&(ne?Q[Ye]=pe:delete Q[Ye]),Xt}var Kh=Pt?function(Q){return Q==null?[]:(Q=Object(Q),ge(Pt(Q),function(ne){return mt.call(Q,ne)}))}:Zt,cs=ia;(rt&&cs(new rt(new ArrayBuffer(1)))!=b||et&&cs(new et)!=$||Ne&&cs(Ne.resolve())!=Y||it&&cs(new it)!=j||tt&&cs(new tt)!=oe)&&(cs=function(Q){var ne=ia(Q),pe=ne==F?Q.constructor:void 0,Ue=pe?Ms(pe):"";if(Ue)switch(Ue){case lt:return b;case ht:return $;case Le:return Y;case ut:return j;case nt:return oe}return ne});function Vh(Q,ne){return ne=ne??a,!!ne&&(typeof Q=="number"||ae.test(Q))&&Q>-1&&Q%1==0&&Q<ne}function Gh(Q){var ne=typeof Q;return ne=="string"||ne=="number"||ne=="symbol"||ne=="boolean"?Q!=="__proto__":Q===null}function Yh(Q){return!!He&&He in Q}function Jh(Q){var ne=Q&&Q.constructor,pe=typeof ne=="function"&&ne.prototype||me;return Q===pe}function Gp(Q){return We.call(Q)}function Ms(Q){if(Q!=null){try{return Be.call(Q)}catch{}try{return Q+""}catch{}}return""}function Qh(Q,ne){return Q===ne||Q!==Q&&ne!==ne}var Zh=Nf(function(){return arguments}())?Nf:function(Q){return sa(Q)&&we.call(Q,"callee")&&!mt.call(Q,"callee")},uc=Array.isArray;function Yp(Q){return Q!=null&&Xh(Q.length)&&!dc(Q)}var Lf=Ot||Qt;function Jp(Q,ne){return na(Q,ne)}function dc(Q){if(!eu(Q))return!1;var ne=ia(Q);return ne==M||ne==O||ne==u||ne==B}function Xh(Q){return typeof Q=="number"&&Q>-1&&Q%1==0&&Q<=a}function eu(Q){var ne=typeof Q;return Q!=null&&(ne=="object"||ne=="function")}function sa(Q){return Q!=null&&typeof Q=="object"}var tu=he?Xe(he):kh;function Qp(Q){return Yp(Q)?qh(Q):Hh(Q)}function Zt(){return[]}function Qt(){return!1}r.exports=Jp})(m0,m0.exports);var UI=m0.exports,qI=Object.defineProperty,t2=Object.getOwnPropertySymbols,zI=Object.prototype.hasOwnProperty,kI=Object.prototype.propertyIsEnumerable,r2=(r,e,t)=>e in r?qI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ci=(r,e)=>{for(var t in e||(e={}))zI.call(e,t)&&r2(r,t,e[t]);if(t2)for(var t of t2(e))kI.call(e,t)&&r2(r,t,e[t]);return r};const i2="wc",n2=2,b0="core",Xn=`${i2}@2:${b0}:`,HI={name:b0,logger:"error"},jI={database:":memory:"},WI="crypto",s2="client_ed25519_seed",KI=Ae.ONE_DAY,VI="keychain",GI="0.3",YI="messages",JI="0.3",QI=Ae.SIX_HOURS,ZI="publisher",o2="irn",XI="error",a2="wss://relay.walletconnect.org",eM="relayer",fi={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},tM="_subscription",tn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},rM=.1,w0="2.17.1",sr={link_mode:"link_mode",relay:"relay"},iM="0.3",nM="WALLETCONNECT_CLIENT_ID",c2="WALLETCONNECT_LINK_MODE_APPS",es={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},sM="subscription",oM="0.3",aM=Ae.FIVE_SECONDS*1e3,cM="pairing",fM="0.3",ff={wc_pairingDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:0},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:0}}},Bo={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},_n={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},lM="history",hM="0.3",uM="expirer",rn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},dM="0.3",pM="verify-api",gM="https://verify.walletconnect.com",f2="https://verify.walletconnect.org",lf=f2,vM=`${lf}/v3`,mM=[gM,f2],bM="echo",wM="https://echo.walletconnect.com",ts={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},As={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},xn={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},Fo={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Uo={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},hf={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},yM=.1,_M="event-client",xM=86400,AM="https://pulse.walletconnect.org/batch";function EM(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var $=0,W=0,k=0,F=O.length;k!==F&&O[k]===0;)k++,$++;for(var Y=(F-k)*g+1>>>0,B=new Uint8Array(Y);k!==F;){for(var z=O[k],j=0,_=Y-1;(z!==0||j<W)&&_!==-1;_--,j++)z+=256*B[_]>>>0,B[_]=z%f>>>0,z=z/f>>>0;if(z!==0)throw new Error("Non-zero carry");W=j,k++}for(var U=Y-W;U!==Y&&B[U]===0;)U++;for(var ee=h.repeat($);U<Y;++U)ee+=r.charAt(B[U]);return ee}function P(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var $=0;if(O[$]!==" "){for(var W=0,k=0;O[$]===h;)W++,$++;for(var F=(O.length-$)*u+1>>>0,Y=new Uint8Array(F);O[$];){var B=t[O.charCodeAt($)];if(B===255)return;for(var z=0,j=F-1;(B!==0||z<k)&&j!==-1;j--,z++)B+=f*Y[j]>>>0,Y[j]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");k=z,$++}if(O[$]!==" "){for(var _=F-k;_!==F&&Y[_]===0;)_++;for(var U=new Uint8Array(W+(F-_)),ee=W;_!==F;)U[ee++]=Y[_++];return U}}}function M(O){var $=P(O);if($)return $;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:M}}var SM=EM,IM=SM;const l2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},MM=r=>new TextEncoder().encode(r),CM=r=>new TextDecoder().decode(r);class PM{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class DM{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 h2(this,e)}}class OM{constructor(e){this.decoders=e}or(e){return h2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const h2=(r,e)=>new OM(ci(ci({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class RM{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new PM(e,t,i),this.decoder=new DM(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const nh=({name:r,prefix:e,encode:t,decode:i})=>new RM(r,e,t,i),uf=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=IM(t,e);return nh({prefix:r,name:e,encode:i,decode:s=>l2(n(s))})},TM=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},$M=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},Wr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>nh({prefix:e,name:r,encode(n){return $M(n,i,t)},decode(n){return TM(n,i,t,r)}}),NM=nh({prefix:"\0",name:"identity",encode:r=>CM(r),decode:r=>MM(r)});var LM=Object.freeze({__proto__:null,identity:NM});const BM=Wr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var FM=Object.freeze({__proto__:null,base2:BM});const UM=Wr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var qM=Object.freeze({__proto__:null,base8:UM});const zM=uf({prefix:"9",name:"base10",alphabet:"0123456789"});var kM=Object.freeze({__proto__:null,base10:zM});const HM=Wr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jM=Wr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var WM=Object.freeze({__proto__:null,base16:HM,base16upper:jM});const KM=Wr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),VM=Wr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),GM=Wr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),YM=Wr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),JM=Wr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),QM=Wr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ZM=Wr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),XM=Wr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),eC=Wr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tC=Object.freeze({__proto__:null,base32:KM,base32upper:VM,base32pad:GM,base32padupper:YM,base32hex:JM,base32hexupper:QM,base32hexpad:ZM,base32hexpadupper:XM,base32z:eC});const rC=uf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),iC=uf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nC=Object.freeze({__proto__:null,base36:rC,base36upper:iC});const sC=uf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),oC=uf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var aC=Object.freeze({__proto__:null,base58btc:sC,base58flickr:oC});const cC=Wr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fC=Wr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),lC=Wr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hC=Wr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var uC=Object.freeze({__proto__:null,base64:cC,base64pad:fC,base64url:lC,base64urlpad:hC});const u2=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}"),dC=u2.reduce((r,e,t)=>(r[t]=e,r),[]),pC=u2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function gC(r){return r.reduce((e,t)=>(e+=dC[t],e),"")}function vC(r){const e=[];for(const t of r){const i=pC[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const mC=nh({prefix:"\u{1F680}",name:"base256emoji",encode:gC,decode:vC});var bC=Object.freeze({__proto__:null,base256emoji:mC}),wC=p2,d2=128,yC=127,_C=~yC,xC=Math.pow(2,31);function p2(r,e,t){e=e||[],t=t||0;for(var i=t;r>=xC;)e[t++]=r&255|d2,r/=128;for(;r&_C;)e[t++]=r&255|d2,r>>>=7;return e[t]=r|0,p2.bytes=t-i+1,e}var AC=y0,EC=128,g2=127;function y0(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw y0.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&g2)<<n:(a&g2)*Math.pow(2,n),n+=7}while(a>=EC);return y0.bytes=s-i,t}var SC=Math.pow(2,7),IC=Math.pow(2,14),MC=Math.pow(2,21),CC=Math.pow(2,28),PC=Math.pow(2,35),DC=Math.pow(2,42),OC=Math.pow(2,49),RC=Math.pow(2,56),TC=Math.pow(2,63),$C=function(r){return r<SC?1:r<IC?2:r<MC?3:r<CC?4:r<PC?5:r<DC?6:r<OC?7:r<RC?8:r<TC?9:10},NC={encode:wC,decode:AC,encodingLength:$C},v2=NC;const m2=(r,e,t=0)=>(v2.encode(r,e,t),e),b2=r=>v2.encodingLength(r),_0=(r,e)=>{const t=e.byteLength,i=b2(r),n=i+b2(t),s=new Uint8Array(n+t);return m2(r,s,0),m2(t,s,i),s.set(e,n),new LC(r,t,e,s)};class LC{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const w2=({name:r,code:e,encode:t})=>new BC(r,e,t);class BC{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?_0(this.code,t):t.then(i=>_0(this.code,i))}else throw Error("Unknown type, must be binary type")}}const y2=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),FC=w2({name:"sha2-256",code:18,encode:y2("SHA-256")}),UC=w2({name:"sha2-512",code:19,encode:y2("SHA-512")});var qC=Object.freeze({__proto__:null,sha256:FC,sha512:UC});const _2=0,zC="identity",x2=l2;var kC=Object.freeze({__proto__:null,identity:{code:_2,name:zC,encode:x2,digest:r=>_0(_2,x2(r))}});new TextEncoder,new TextDecoder;const A2=ci(ci(ci(ci(ci(ci(ci(ci(ci(ci({},LM),FM),qM),kM),WM),tC),nC),aC),uC),bC);ci(ci({},qC),kC);function HC(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function E2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const S2=E2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),x0=E2("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=HC(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),jC=ci({utf8:S2,"utf-8":S2,hex:A2.base16,latin1:x0,ascii:x0,binary:x0},A2);function WC(r,e="utf8"){const t=jC[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}class KC{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=VI,this.version=GI,this.initialized=!1,this.storagePrefix=Xn,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=_e("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=ai(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,jm(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Wm(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VC{constructor(e,t,i){this.core=e,this.logger=t,this.name=WI,this.randomSessionIdentifier=Zd(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),s=Lm(n);return Nm(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=CA();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),a=Lm(s),f=this.randomSessionIdentifier;return await Fx(f,n,KI,a)},this.generateSharedKey=(n,s,a)=>{this.isInitialized();const f=this.getPrivateKey(n),h=PA(f,s);return this.setSymKey(h,a)},this.setSymKey=async(n,s)=>{this.isInitialized();const a=s||Hl(n);return await this.keychain.set(a,n),a},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,a)=>{this.isInitialized();const f=fb(a),h=bs(s);if(hb(f))return OA(h,a?.encoding);if(lb(f)){const P=f.senderPublicKey,M=f.receiverPublicKey;n=await this.generateSharedKey(P,M)}const u=this.getSymKey(n),{type:g,senderPublicKey:w}=f;return DA({type:g,symKey:u,message:h,senderPublicKey:w,encoding:a?.encoding})},this.decode=async(n,s,a)=>{this.isInitialized();const f=$A(s,a);if(hb(f)){const h=TA(s,a?.encoding);return Po(h)}if(lb(f)){const h=f.receiverPublicKey,u=f.senderPublicKey;n=await this.generateSharedKey(h,u)}try{const h=this.getSymKey(n),u=RA({symKey:h,encoded:s,encoding:a?.encoding});return Po(u)}catch(h){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=(n,s=Ks)=>{const a=Qc({encoded:n,encoding:s});return To(a.type)},this.getPayloadSenderPublicKey=(n,s=Ks)=>{const a=Qc({encoded:n,encoding:s});return a.senderPublicKey?JS(a.senderPublicKey,si):void 0},this.core=e,this.logger=ai(t,this.name),this.keychain=i||new KC(this.core,this.logger)}get context(){return yi(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(s2)}catch{e=Zd(),await this.keychain.set(s2,e)}return WC(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class GC extends BS{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=YI,this.version=JI,this.initialized=!1,this.storagePrefix=Xn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const s=ys(n);let a=this.messages.get(i);return typeof a>"u"&&(a={}),typeof a[s]<"u"||(a[s]=n,this.messages.set(i,a),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const s=this.get(i),a=ys(n);return typeof s[a]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=ai(e,this.name),this.core=t}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,jm(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Wm(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class YC extends FS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new qr.exports.EventEmitter,this.name=ZI,this.queue=new Map,this.publishTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.failedPublishTimeout=Ae.toMiliseconds(Ae.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,n,s)=>{var a;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const f=s?.ttl||QI,h=Xd(s),u=s?.prompt||!1,g=s?.tag||0,w=s?.id||Lo().toString(),P={topic:i,message:n,opts:{ttl:f,relay:h,prompt:u,tag:g,id:w,attestation:s?.attestation}},M=`Failed to publish payload, please try again. id:${w} tag:${g}`,O=Date.now();let $,W=1;try{for(;$===void 0;){if(Date.now()-O>this.publishTimeout)throw new Error(M);this.logger.trace({id:w,attempts:W},`publisher.publish - attempt ${W}`),$=await await Ua(this.rpcPublish(i,n,f,h,u,g,w,s?.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,M),W++,$||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(fi.publish,P),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(a=s?.internal)!=null&&a.throwOnFailedPublish)throw k;this.queue.set(w,P)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=ai(t,this.name),this.registerEventListeners()}get context(){return yi(this.logger)}rpcPublish(e,t,i,n,s,a,f,h){var u,g,w,P;const M={method:Zc(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:a,attestation:h},id:f};return oi((u=M.params)==null?void 0:u.prompt)&&((g=M.params)==null||delete g.prompt),oi((w=M.params)==null?void 0:w.tag)&&((P=M.params)==null||delete P.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:M}),this.relayer.request(M)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(za.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(fi.connection_stalled);return}this.checkQueue()}),this.relayer.on(fi.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class JC{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var QC=Object.defineProperty,ZC=Object.defineProperties,XC=Object.getOwnPropertyDescriptors,I2=Object.getOwnPropertySymbols,eP=Object.prototype.hasOwnProperty,tP=Object.prototype.propertyIsEnumerable,M2=(r,e,t)=>e in r?QC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,df=(r,e)=>{for(var t in e||(e={}))eP.call(e,t)&&M2(r,t,e[t]);if(I2)for(var t of I2(e))tP.call(e,t)&&M2(r,t,e[t]);return r},A0=(r,e)=>ZC(r,XC(e));class rP extends zS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new JC,this.events=new qr.exports.EventEmitter,this.name=sM,this.version=oM,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Xn,this.subscribeTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const s=Xd(n),a={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,a);const f=await this.rpcSubscribe(i,s,n);return typeof f=="string"&&(this.onSubscribe(f,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),f}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((s,a)=>{const f=new Ae.Watch;f.start(n);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),f.stop(n),s(!0)),f.elapsed(n)>=aM&&(clearInterval(h),f.stop(n),a(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ai(t,this.name),this.clientId=""}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const n=Xd(i);await this.rpcUnsubscribe(e,t,n);const s=Gt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,i){var n;i?.transportType===sr.relay&&await this.restartToComplete();const s={method:Zc(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const a=(n=i?.internal)==null?void 0:n.throwOnFailedPublish;try{const f=ys(e+this.clientId);if(i?.transportType===sr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(u=>this.logger.warn(u))},Ae.toMiliseconds(Ae.ONE_SECOND)),f;const h=await Ua(this.relayer.request(s).catch(u=>this.logger.warn(u)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!h&&a)throw new Error(`Subscribing to ${e} failed, please try again`);return h?f:null}catch(f){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(fi.connection_stalled),a)throw f}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Zc(t.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await Ua(this.relayer.request(i).catch(n=>this.logger.warn(n)),this.subscribeTimeout)}catch{this.relayer.events.emit(fi.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:Zc(t.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await Ua(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(fi.connection_stalled)}return n}rpcUnsubscribe(e,t,i){const n={method:Zc(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,A0(df({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,df({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,df({},t)),this.topicMap.set(t.topic,e),this.events.emit(es.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(es.deleted,A0(df({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(es.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(es.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}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 batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Yn(t)&&this.onBatchSubscribe(t.map((i,n)=>A0(df({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(za.pulse,async()=>{await this.checkPending()}),this.events.on(es.created,async e=>{const t=es.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(es.deleted,async e=>{const t=es.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var iP=Object.defineProperty,C2=Object.getOwnPropertySymbols,nP=Object.prototype.hasOwnProperty,sP=Object.prototype.propertyIsEnumerable,P2=(r,e,t)=>e in r?iP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,D2=(r,e)=>{for(var t in e||(e={}))nP.call(e,t)&&P2(r,t,e[t]);if(C2)for(var t of C2(e))sP.call(e,t)&&P2(r,t,e[t]);return r};class oP extends US{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qr.exports.EventEmitter,this.name=eM,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Ae.toMiliseconds(Ae.THIRTY_SECONDS+Ae.ONE_SECOND),this.request=async t=>{var i,n;this.logger.debug("Publishing Request Payload");const s=t.id||Lo().toString();await this.toEstablishConnection();try{const a=this.provider.request(t);this.requestsInFlight.set(s,{promise:a,request:t}),this.logger.trace({id:s,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const f=await new Promise(async(h,u)=>{const g=()=>{u(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(tn.disconnect,g);const w=await a;this.provider.off(tn.disconnect,g),h(w)});return this.logger.trace({id:s,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - published"),f}catch(a){throw this.logger.debug(`Failed to Publish Request: ${s}`),a}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Ul())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,n;(n=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(fi.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(fi.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(tn.payload,this.onPayloadHandler),this.provider.on(tn.connect,this.onConnectHandler),this.provider.on(tn.disconnect,this.onDisconnectHandler),this.provider.on(tn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ai(e.logger,this.name):Jn(eh({level:e.logger||XI})),this.messages=new GC(this.logger,e.core),this.subscriber=new rP(this,this.logger),this.publisher=new YC(this,this.logger),this.relayUrl=e?.relayUrl||a2,this.projectId=e.projectId,this.bundleId=Kx(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return yi(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:sr.relay})}async subscribe(e,t){var i,n,s;this.isInitialized(),t?.transportType==="relay"&&await this.toEstablishConnection();const a=typeof((i=t?.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(n=t?.internal)==null?void 0:n.throwOnFailedPublish;let f=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",h;const u=g=>{g.topic===e&&(this.subscriber.off(es.created,u),h())};return await Promise.all([new Promise(g=>{h=g,this.subscriber.on(es.created,u)}),new Promise(async(g,w)=>{f=await this.subscriber.subscribe(e,D2({internal:{throwOnFailedPublish:a}},t)).catch(P=>{a&&w(P)})||f,g()})]),f}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Ua(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const n=()=>{this.provider.off(tn.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(tn.disconnect,n),await Ua(this.provider.connect(),Ae.toMiliseconds(Ae.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{i(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Eb())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const n=Ir(Ae.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(fi.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,i,n,s;if(Ul())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(a){this.logger.warn(a)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new yn(new FI(Jx({sdkVersion:w0,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),v0(e)){if(!e.method.endsWith(tM))return;const t=e.params,{topic:i,message:n,publishedAt:s,attestation:a}=t.data,f={topic:i,message:n,publishedAt:s,transportType:sr.relay,attestation:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(D2({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(e),await this.onMessageEvent(f)}else ih(e)&&this.events.emit(fi.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(fi.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=th(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(tn.payload,this.onPayloadHandler),this.provider.off(tn.connect,this.onConnectHandler),this.provider.off(tn.disconnect,this.onDisconnectHandler),this.provider.off(tn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Eb();ME(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(fi.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Ae.toMiliseconds(rM))))}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var aP=Object.defineProperty,O2=Object.getOwnPropertySymbols,cP=Object.prototype.hasOwnProperty,fP=Object.prototype.propertyIsEnumerable,R2=(r,e,t)=>e in r?aP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,T2=(r,e)=>{for(var t in e||(e={}))cP.call(e,t)&&R2(r,t,e[t]);if(O2)for(var t of O2(e))fP.call(e,t)&&R2(r,t,e[t]);return r};class qo extends qS{constructor(e,t,i,n=Xn,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=iM,this.cached=[],this.initialized=!1,this.storagePrefix=Xn,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(a=>{this.getKey&&a!==null&&!oi(a)?this.map.set(this.getKey(a),a):nE(a)?this.map.set(a.id,a):sE(a)&&this.map.set(a.topic,a)}),this.cached=[],this.initialized=!0)},this.set=async(a,f)=>{this.isInitialized(),this.map.has(a)?await this.update(a,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:a,value:f}),this.map.set(a,f),await this.persist())},this.get=a=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:a}),this.getData(a)),this.getAll=a=>(this.isInitialized(),a?this.values.filter(f=>Object.keys(a).every(h=>UI(f[h],a[h]))):this.values),this.update=async(a,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:a,update:f});const h=T2(T2({},this.getData(a)),f);this.map.set(a,h),await this.persist()},this.delete=async(a,f)=>{this.isInitialized(),this.map.has(a)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:a,reason:f}),this.map.delete(a),this.addToRecentlyDeleted(a),await this.persist())},this.logger=ai(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:n}=_e("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class lP{constructor(e,t){this.core=e,this.logger=t,this.name=cM,this.version=fM,this.events=new qr.exports,this.initialized=!1,this.storagePrefix=Xn,this.ignoredPayloadTypes=[ws],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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=Zd(),s=await this.core.crypto.setSymKey(n),a=Ir(Ae.FIVE_MINUTES),f={protocol:o2},h={topic:s,expiry:a,relay:f,active:!1,methods:i?.methods},u=vb({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:f,expiryTimestamp:a,methods:i?.methods});return this.events.emit(Bo.create,h),this.core.expirer.set(s,a),await this.pairings.set(s,h),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:u}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[ts.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:a,relay:f,expiryTimestamp:h,methods:u}=gb(i.uri);n.props.properties.topic=s,n.addTrace(ts.pairing_uri_validation_success),n.addTrace(ts.pairing_uri_not_expired);let g;if(this.pairings.keys.includes(s)){if(g=this.pairings.get(s),n.addTrace(ts.existing_pairing),g.active)throw n.setError(As.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(ts.pairing_not_expired)}const w=h||Ir(Ae.FIVE_MINUTES),P={topic:s,relay:f,expiry:w,active:!1,methods:u};this.core.expirer.set(s,w),await this.pairings.set(s,P),n.addTrace(ts.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(Bo.create,P),n.addTrace(ts.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(a,s),n.addTrace(ts.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(As.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:f})}catch(M){throw n.setError(As.subscribe_pairing_topic_failure),M}return n.addTrace(ts.subscribe_pairing_topic_success),P},this.activate=async({topic:i})=>{this.isInitialized();const n=Ir(Ae.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:a,resolve:f,reject:h}=Oo();this.events.once(Dt("pairing_ping",s),({error:u})=>{u?h(u):f()}),await a()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",Gt("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:s,expiry:a,methods:f}=i,h=this.core.crypto.keychain.get(n);return vb({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:h,relay:s,expiryTimestamp:a,methods:f})},this.sendRequest=async(i,n,s)=>{const a=Gs(n,s),f=await this.core.crypto.encode(i,a),h=ff[n].req;return this.core.history.set(i,a),this.core.relayer.publish(i,f,h),a.id},this.sendResult=async(i,n,s)=>{const a=th(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=ff[h.request.method].res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.sendError=async(i,n,s)=>{const a=rh(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=ff[h.request.method]?ff[h.request.method].res:ff.unregistered_method.res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Gt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Ws(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:s}=i,a=(await this.core.history.get(n,s.id)).request.method;switch(a){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(a)}},this.onPairingPingRequest=async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(Bo.ping,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onPairingPingResponse=(i,n)=>{const{id:s}=n;setTimeout(()=>{Zn(n)?this.events.emit(Dt("pairing_ping",s),{}):en(n)&&this.events.emit(Dt("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(Bo.delete,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:s,method:a}=n;try{if(this.registeredMethods.includes(a))return;const f=Gt("WC_METHOD_UNSUPPORTED",a);await this.sendError(s,i,f),this.logger.error(f)}catch(f){await this.sendError(s,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Gt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!bi(i)){const{message:f}=_e("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(As.malformed_pairing_uri),new Error(f)}if(!iE(i.uri)){const{message:f}=_e("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(As.malformed_pairing_uri),new Error(f)}const a=gb(i?.uri);if(!((s=a?.relay)!=null&&s.protocol)){const{message:f}=_e("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(As.malformed_pairing_uri),new Error(f)}if(!(a!=null&&a.symKey)){const{message:f}=_e("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(As.malformed_pairing_uri),new Error(f)}if(a!=null&&a.expiryTimestamp&&Ae.toMiliseconds(a?.expiryTimestamp)<Date.now()){n.setError(As.pairing_expired);const{message:f}=_e("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(f)}},this.isValidPing=async i=>{if(!bi(i)){const{message:s}=_e("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!bi(i)){const{message:s}=_e("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!wr(i,!1)){const{message:n}=_e("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=_e("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Ws(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=_e("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=ai(t,this.name),this.pairings=new qo(this.core,this.logger,this.name,this.storagePrefix)}get context(){return yi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(fi.message,async e=>{const{topic:t,message:i,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===sr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{v0(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):ih(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(rn.expired,async e=>{const{topic:t}=Vm(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Bo.expire,{topic:t}))})}}class hP extends LS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new qr.exports.EventEmitter,this.name=lM,this.version=hM,this.cached=[],this.initialized=!1,this.storagePrefix=Xn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const a={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:Ir(Ae.THIRTY_DAYS)};this.records.set(a.id,a),this.persist(),this.events.emit(_n.created,a)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=en(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(_n.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(_n.deleted,s)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ai(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Gs(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(_n.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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(_n.created,e=>{const t=_n.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(_n.updated,e=>{const t=_n.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(_n.deleted,e=>{const t=_n.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(za.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{Ae.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(_n.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class uP extends kS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new qr.exports.EventEmitter,this.name=uM,this.version=dM,this.cached=[],this.initialized=!1,this.storagePrefix=Xn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const s=this.formatTarget(i),a={target:s,expiry:n};this.expirations.set(s,a),this.checkExpiry(s,a),this.events.emit(rn.created,{target:s,expiration:a})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(rn.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ai(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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 Qx(e);if(typeof e=="number")return Zx(e);const{message:t}=_e("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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(rn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;Ae.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(rn.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(za.pulse,()=>this.checkExpirations()),this.events.on(rn.created,e=>{const t=rn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(rn.expired,e=>{const t=rn.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(rn.deleted,e=>{const t=rn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class dP extends HS{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=pM,this.verifyUrlV3=vM,this.storagePrefix=Xn,this.version=n2,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Ae.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async n=>{if(!jc()||this.isDevEnv)return;const s=window.location.origin,{id:a,decryptedId:f}=n,h=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${a}&decryptedId=${f}`;try{const u=Dc(),g=this.startAbortTimer(Ae.ONE_SECOND*5),w=await new Promise((P,M)=>{const O=()=>{window.removeEventListener("message",W),u.body.removeChild($),M("attestation aborted")};this.abortController.signal.addEventListener("abort",O);const $=u.createElement("iframe");$.src=h,$.style.display="none",$.addEventListener("error",O,{signal:this.abortController.signal});const W=k=>{if(k.data&&typeof k.data=="string")try{const F=JSON.parse(k.data);if(F.type==="verify_attestation"){if(Vd(F.attestation).payload.id!==a)return;clearInterval(g),u.body.removeChild($),this.abortController.signal.removeEventListener("abort",O),window.removeEventListener("message",W),P(F.attestation===null?"":F.attestation)}}catch(F){this.logger.warn(F)}};u.body.appendChild($),window.addEventListener("message",W,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(u){this.logger.warn(u)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:a,encryptedId:f}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Vd(s).payload.id!==f)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!a)return;const h=this.getVerifyUrl(n?.verifyUrl);return this.fetchAttestation(a,h)},this.fetchAttestation=async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const a=this.startAbortTimer(Ae.ONE_SECOND*5),f=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(a),f.status===200?await f.json():void 0},this.getVerifyUrl=n=>{let s=n||lf;return mM.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${lf}`),s=lf),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(Ae.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}const a=await this.fetchAndPersistPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const a=await this.fetchPublicKey();a&&(await this.persistPublicKey(a),s(a))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,s)=>{const a=FA(n,s.publicKey),f={hasExpired:Ae.toMiliseconds(a.exp)<Date.now(),payload:a};if(f.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:f.payload.origin,isScam:f.payload.isScam,isVerified:f.payload.isVerified}},this.logger=ai(t,this.name),this.abortController=new AbortController,this.isDevEnv=Gd(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return yi(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Ae.toMiliseconds(e))}}class pP extends jS{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=bM,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:a,enableEncrypted:f=!1}=i,h=`${wM}/${this.projectId}/clients`;await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:a,token:s,always_raw:f})})},this.logger=ai(t,this.context)}}var gP=Object.defineProperty,$2=Object.getOwnPropertySymbols,vP=Object.prototype.hasOwnProperty,mP=Object.prototype.propertyIsEnumerable,N2=(r,e,t)=>e in r?gP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pf=(r,e)=>{for(var t in e||(e={}))vP.call(e,t)&&N2(r,t,e[t]);if($2)for(var t of $2(e))mP.call(e,t)&&N2(r,t,e[t]);return r};class bP extends WS{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=_M,this.storagePrefix=Xn,this.storageVersion=yM,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!Gd())try{const n={eventId:Ym(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Hm(this.core.relayer.protocol,this.core.relayer.version,w0)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:a="",properties:{topic:f,trace:h}}=n,u=Ym(),g=this.core.projectId||"",w=Date.now(),P=pf({eventId:u,timestamp:w,props:{event:s,type:a,properties:{topic:f,trace:h}},bundleId:g,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,P),this.shouldPersist=!0),P},this.getEvent=n=>{const{eventId:s,topic:a}=n;if(s)return this.events.get(s);const f=Array.from(this.events.values()).find(h=>h.props.properties.topic===a);if(f)return pf(pf({},f),this.setMethods(f.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(za.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{Ae.fromMiliseconds(Date.now())-Ae.fromMiliseconds(n.timestamp)>xM&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)}),this.addTrace=(n,s)=>{const a=this.events.get(n);a&&(a.props.properties.trace.push(s),this.events.set(n,a),this.shouldPersist=!0)},this.setError=(n,s)=>{const a=this.events.get(n);a&&(a.props.type=s,a.timestamp=Date.now(),this.events.set(n,a),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,pf(pf({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,a]of this.events)a.props.type&&n.push(a);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${AM}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${w0}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>km().url,this.logger=ai(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var wP=Object.defineProperty,L2=Object.getOwnPropertySymbols,yP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,B2=(r,e,t)=>e in r?wP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F2=(r,e)=>{for(var t in e||(e={}))yP.call(e,t)&&B2(r,t,e[t]);if(L2)for(var t of L2(e))_P.call(e,t)&&B2(r,t,e[t]);return r};class E0 extends NS{constructor(e){var t;super(e),this.protocol=i2,this.version=n2,this.name=b0,this.events=new qr.exports.EventEmitter,this.initialized=!1,this.on=(a,f)=>this.events.on(a,f),this.once=(a,f)=>this.events.once(a,f),this.off=(a,f)=>this.events.off(a,f),this.removeListener=(a,f)=>this.events.removeListener(a,f),this.dispatchEnvelope=({topic:a,message:f,sessionExists:h})=>{if(!a||!f)return;const u={topic:a,message:f,publishedAt:Date.now(),transportType:sr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:h})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||a2,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=eh({level:typeof e?.logger=="string"&&e.logger?e.logger:HI.logger}),{logger:n,chunkLoggerController:s}=$S({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,f;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((f=this.logChunkController)==null||f.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ai(n,this.name),this.heartbeat=new n0,this.crypto=new VC(this,this.logger,e?.keychain),this.history=new hP(this,this.logger),this.expirer=new uP(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new oS(F2(F2({},jI),e?.storageOptions)),this.relayer=new oP({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new lP(this,this.logger),this.verify=new dP(this,this.logger,this.storage),this.echoClient=new pP(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new bP(this,this.logger,e?.telemetryEnabled)}static async init(e){const t=new E0(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(nM,i),t}get context(){return yi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(c2,this.linkModeSupportedApps))}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.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(c2)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const xP=E0,U2="wc",q2=2,z2="client",S0=`${U2}@${q2}:${z2}:`,I0={name:z2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},k2="WALLETCONNECT_DEEPLINK_CHOICE",AP="proposal",H2="Proposal expired",EP="session",ja=Ae.SEVEN_DAYS,SP="engine",Lr={wc_sessionPropose:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Ae.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Ae.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1119}}},M0={min:Ae.FIVE_MINUTES,max:Ae.SEVEN_DAYS},rs={idle:"IDLE",active:"ACTIVE"},IP="request",MP=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],CP="wc",PP="auth",DP="authKeys",OP="pairingTopics",RP="requests",sh=`${CP}@${1.5}:${PP}:`,oh=`${sh}:PUB_KEY`;var TP=Object.defineProperty,$P=Object.defineProperties,NP=Object.getOwnPropertyDescriptors,j2=Object.getOwnPropertySymbols,LP=Object.prototype.hasOwnProperty,BP=Object.prototype.propertyIsEnumerable,W2=(r,e,t)=>e in r?TP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pr=(r,e)=>{for(var t in e||(e={}))LP.call(e,t)&&W2(r,t,e[t]);if(j2)for(var t of j2(e))BP.call(e,t)&&W2(r,t,e[t]);return r},An=(r,e)=>$P(r,NP(e));class FP extends VS{constructor(e){super(e),this.name=SP,this.events=new qr.exports,this.initialized=!1,this.requestQueue={state:rs.idle,queue:[]},this.sessionRequestQueue={state:rs.idle,queue:[]},this.requestQueueDelay=Ae.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Lr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=An(pr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:f,relays:h}=i;let u=n,g,w=!1;try{u&&(w=this.client.core.pairing.pairings.get(u).active)}catch(B){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),B}if(!u||!w){const{topic:B,uri:z}=await this.client.core.pairing.create();u=B,g=z}if(!u){const{message:B}=_e("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(B)}const P=await this.client.core.crypto.generateKeyPair(),M=Lr.wc_sessionPropose.req.ttl||Ae.FIVE_MINUTES,O=Ir(M),$=pr({requiredNamespaces:s,optionalNamespaces:a,relays:h??[{protocol:o2}],proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:O,pairingTopic:u},f&&{sessionProperties:f}),{reject:W,resolve:k,done:F}=Oo(M,H2);this.events.once(Dt("session_connect"),async({error:B,session:z})=>{if(B)W(B);else if(z){z.self.publicKey=P;const j=An(pr({},z),{pairingTopic:$.pairingTopic,requiredNamespaces:$.requiredNamespaces,optionalNamespaces:$.optionalNamespaces,transportType:sr.relay});await this.client.session.set(z.topic,j),await this.setExpiry(z.topic,z.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:z.peer.metadata}),this.cleanupDuplicatePairings(j),k(j)}});const Y=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:$,throwOnFailedPublish:!0});return await this.setProposal(Y,pr({id:Y},$)),{uri:g,approval:F}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,n,s;const a=this.client.core.eventClient.createEvent({properties:{topic:(i=t?.id)==null?void 0:i.toString(),trace:[xn.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(U){throw a.setError(Fo.no_internet_connection),U}try{await this.isValidProposalId(t?.id)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${t?.id}) failed`),a.setError(Fo.proposal_not_found),U}try{await this.isValidApprove(t)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),a.setError(Fo.session_approve_namespace_validation_failure),U}const{id:f,relayProtocol:h,namespaces:u,sessionProperties:g,sessionConfig:w}=t,P=this.client.proposal.get(f);this.client.core.eventClient.deleteEvent({eventId:a.eventId});const{pairingTopic:M,proposer:O,requiredNamespaces:$,optionalNamespaces:W}=P;let k=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:M});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:xn.session_approve_started,properties:{topic:M,trace:[xn.session_approve_started,xn.session_namespaces_validation_success]}}));const F=await this.client.core.crypto.generateKeyPair(),Y=O.publicKey,B=await this.client.core.crypto.generateSharedKey(F,Y),z=pr(pr({relay:{protocol:h??"irn"},namespaces:u,controller:{publicKey:F,metadata:this.client.metadata},expiry:Ir(ja)},g&&{sessionProperties:g}),w&&{sessionConfig:w}),j=sr.relay;k.addTrace(xn.subscribing_session_topic);try{await this.client.core.relayer.subscribe(B,{transportType:j})}catch(U){throw k.setError(Fo.subscribe_session_topic_failure),U}k.addTrace(xn.subscribe_session_topic_success);const _=An(pr({},z),{topic:B,requiredNamespaces:$,optionalNamespaces:W,pairingTopic:M,acknowledged:!1,self:z.controller,peer:{publicKey:O.publicKey,metadata:O.metadata},controller:F,transportType:sr.relay});await this.client.session.set(B,_),k.addTrace(xn.store_session);try{k.addTrace(xn.publishing_session_settle),await this.sendRequest({topic:B,method:"wc_sessionSettle",params:z,throwOnFailedPublish:!0}).catch(U=>{throw k?.setError(Fo.session_settle_publish_failure),U}),k.addTrace(xn.session_settle_publish_success),k.addTrace(xn.publishing_session_approve),await this.sendResult({id:f,topic:M,result:{relay:{protocol:h??"irn"},responderPublicKey:F},throwOnFailedPublish:!0}).catch(U=>{throw k?.setError(Fo.session_approve_publish_failure),U}),k.addTrace(xn.session_approve_publish_success)}catch(U){throw this.client.logger.error(U),this.client.session.delete(B,Gt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(B),U}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:M,metadata:O.metadata}),await this.client.proposal.delete(f,Gt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:M}),await this.setExpiry(B,Ir(ja)),{topic:B,acknowledged:()=>Promise.resolve(this.client.session.get(B))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(a){throw this.client.logger.error("reject() -> isValidReject() failed"),a}const{id:i,reason:n}=t;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(a){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),a}s&&(await this.sendError({id:i,topic:s,error:n,rpcOpts:Lr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=t,{done:s,resolve:a,reject:f}=Oo(),h=Vs(),u=Lo().toString(),g=this.client.session.get(i).namespaces;return this.events.once(Dt("session_update",h),({error:w})=>{w?f(w):a()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:h,relayRpcId:u}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:g}),f(w)}),{acknowledged:s}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(h){throw this.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=t,n=Vs(),{done:s,resolve:a,reject:f}=Oo();return this.events.once(Dt("session_extend",n),({error:h})=>{h?f(h):a()}),await this.setExpiry(i,Ir(ja)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(h=>{f(h)}),{acknowledged:s}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(O){throw this.client.logger.error("request() -> isValidRequest() failed"),O}const{chainId:i,request:n,topic:s,expiry:a=Lr.wc_sessionRequest.req.ttl}=t,f=this.client.session.get(s);f?.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const h=Vs(),u=Lo().toString(),{done:g,resolve:w,reject:P}=Oo(a,"Request expired. Please try again.");this.events.once(Dt("session_request",h),({error:O,result:$})=>{O?P(O):w($)});const M=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);return M?(await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:An(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0,appLink:M}).catch(O=>P(O)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),await g()):await Promise.all([new Promise(async O=>{await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:An(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0}).catch($=>P($)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),O()}),new Promise(async O=>{var $;if(!(($=f.sessionConfig)!=null&&$.disableDeepLink)){const W=await tA(this.client.core.storage,k2);await Xx({id:h,topic:s,wcDeepLink:W})}O()}),g()]).then(O=>O[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:n}=t,{id:s}=n,a=this.client.session.get(i);a.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const f=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);Zn(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:f}):en(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:f}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=t;if(this.client.session.keys.includes(i)){const n=Vs(),s=Lo().toString(),{done:a,resolve:f,reject:h}=Oo();this.events.once(Dt("session_ping",n),({error:u})=>{u?h(u):f()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),a()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:n,chainId:s}=t,a=Lo().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:a})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Gt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=_e("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>tE(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(t);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),a=s?sr.link_mode:sr.relay;a===sr.relay&&await this.confirmOnlineStateOrThrow();const{chains:f,statement:h="",uri:u,domain:g,nonce:w,type:P,exp:M,nbf:O,methods:$=[],expiry:W}=t,k=[...t.resources||[]],{topic:F,uri:Y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:F,uri:Y}});const B=await this.client.core.crypto.generateKeyPair(),z=Hl(B);if(await Promise.all([this.client.auth.authKeys.set(oh,{responseTopic:z,publicKey:B}),this.client.auth.pairingTopics.set(z,{topic:z,pairingTopic:F})]),await this.client.core.relayer.subscribe(z,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${F}`),$.length>0){const{namespace:D}=Ba(f[0]);let S=xA(D,"request",$);kl(k)&&(S=EA(S,k.pop())),k.push(S)}const j=W&&W>Lr.wc_sessionAuthenticate.req.ttl?W:Lr.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:P??"caip122",chains:f,statement:h,aud:u,domain:g,version:"1",nonce:w,iat:new Date().toISOString(),exp:M,nbf:O,resources:k},requester:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:Ir(j)},U={eip155:{chains:f,methods:[...new Set(["personal_sign",...$])],events:["chainChanged","accountsChanged"]}},ee={requiredNamespaces:{},optionalNamespaces:U,relays:[{protocol:"irn"}],pairingTopic:F,proposer:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:Ir(Lr.wc_sessionPropose.req.ttl)},{done:oe,resolve:L,reject:b}=Oo(j,"Request expired"),m=async({error:D,session:S})=>{if(this.events.off(Dt("session_request",d),l),D)b(D);else if(S){S.self.publicKey=B,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:S.peer.metadata});const v=this.client.session.get(S.topic);await this.deleteProposal(y),L({session:v})}},l=async D=>{var S,v,A;if(await this.deletePendingAuthRequest(d,{message:"fulfilled",code:0}),D.error){const J=Gt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return D.error.code===J.code?void 0:(this.events.off(Dt("session_connect"),m),b(D.error.message))}await this.deleteProposal(y),this.events.off(Dt("session_connect"),m);const{cacaos:x,responder:N}=D.result,ae=[],R=[];for(const J of x){await Xm({cacao:J,projectId:this.client.core.projectId})||(this.client.logger.error(J,"Signature verification failed"),b(Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:K}=J,E=kl(K.resources),G=[Jd(K.iss)],re=zl(K.iss);if(E){const le=rb(E),he=ib(E);ae.push(...le),G.push(...he)}for(const le of G)R.push(`${le}:${re}`)}const X=await this.client.core.crypto.generateSharedKey(B,N.publicKey);let V;ae.length>0&&(V={topic:X,acknowledged:!0,self:{publicKey:B,metadata:this.client.metadata},peer:N,controller:N.publicKey,expiry:Ir(ja),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:F,namespaces:mb([...new Set(ae)],[...new Set(R)]),transportType:a},await this.client.core.relayer.subscribe(X,{transportType:a}),await this.client.session.set(X,V),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:N.metadata}),V=this.client.session.get(X)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(v=N.metadata.redirect)!=null&&v.linkMode&&(A=N.metadata.redirect)!=null&&A.universal&&i&&(this.client.core.addLinkModeSupportedApp(N.metadata.redirect.universal),this.client.session.update(X,{transportType:sr.link_mode})),L({auths:x,session:V})},d=Vs(),y=Vs();this.events.once(Dt("session_connect"),m),this.events.once(Dt("session_request",d),l);let C;try{if(s){const D=Gs("wc_sessionAuthenticate",_,d);this.client.core.history.set(F,D);const S=await this.client.core.crypto.encode("",D,{type:Yc,encoding:Vc});C=jl(i,F,S)}else await Promise.all([this.sendRequest({topic:F,method:"wc_sessionAuthenticate",params:_,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:d}),this.sendRequest({topic:F,method:"wc_sessionPropose",params:ee,expiry:Lr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:y})])}catch(D){throw this.events.off(Dt("session_connect"),m),this.events.off(Dt("session_request",d),l),D}return await this.setProposal(y,pr({id:y},ee)),await this.setAuthRequest(d,{request:An(pr({},_),{verifyContext:{}}),pairingTopic:F,transportType:a}),{uri:C??Y,response:oe}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:n}=t,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Uo.authenticated_session_approve_started]}});try{this.isInitialized()}catch(W){throw s.setError(hf.no_internet_connection),W}const a=this.getPendingAuthRequest(i);if(!a)throw s.setError(hf.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const f=a.transportType||sr.relay;f===sr.relay&&await this.confirmOnlineStateOrThrow();const h=a.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),g=Hl(h),w={type:ws,receiverPublicKey:h,senderPublicKey:u},P=[],M=[];for(const W of n){if(!await Xm({cacao:W,projectId:this.client.core.projectId})){s.setError(hf.invalid_cacao);const z=Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:g,error:z,encodeOpts:w}),new Error(z.message)}s.addTrace(Uo.cacaos_verified);const{p:k}=W,F=kl(k.resources),Y=[Jd(k.iss)],B=zl(k.iss);if(F){const z=rb(F),j=ib(F);P.push(...z),Y.push(...j)}for(const z of Y)M.push(`${z}:${B}`)}const O=await this.client.core.crypto.generateSharedKey(u,h);s.addTrace(Uo.create_authenticated_session_topic);let $;if(P?.length>0){$={topic:O,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:h,metadata:a.requester.metadata},controller:h,expiry:Ir(ja),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:a.pairingTopic,namespaces:mb([...new Set(P)],[...new Set(M)]),transportType:f},s.addTrace(Uo.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(O,{transportType:f})}catch(W){throw s.setError(hf.subscribe_authenticated_session_topic_failure),W}s.addTrace(Uo.subscribe_authenticated_session_topic_success),await this.client.session.set(O,$),s.addTrace(Uo.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:a.pairingTopic,metadata:a.requester.metadata})}s.addTrace(Uo.publishing_authenticated_session_approve);try{await this.sendResult({topic:g,id:i,result:{cacaos:n,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(a.requester.metadata,f)})}catch(W){throw s.setError(hf.authenticated_session_approve_publish_failure),W}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:a.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:$}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:n}=t,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const a=s.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),h=Hl(a),u={type:ws,receiverPublicKey:a,senderPublicKey:f};await this.sendError({id:i,topic:h,error:n,encodeOpts:u,rpcOpts:Lr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:n}=t;return eb(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var a,f;return((a=s.peerMetadata)==null?void 0:a.url)&&((f=s.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&s.topic&&s.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:a=!0,id:f=0}=t,{self:h}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Gt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(h.publicKey)&&await this.client.core.crypto.deleteKeyPair(h.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(k2).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===n&&this.deletePendingSessionRequest(u.id,Gt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=rs.idle),a&&this.client.events.emit("session_delete",{id:f,topic:n})},this.deleteProposal=async(t,i)=>{if(i)try{const n=this.client.proposal.get(t),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(Fo.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,Gt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==t),n&&(this.sessionRequestQueue.state=rs.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,Ir(Lr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:n,pairingTopic:s,transportType:a=sr.relay}=i;this.client.core.expirer.set(t,n.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:t,pairingTopic:s,verifyContext:n.verifyContext,transportType:a})},this.setPendingSessionRequest=async t=>{const{id:i,topic:n,params:s,verifyContext:a}=t,f=s.request.expiryTimestamp||Ir(Lr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,f),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:a})},this.sendRequest=async t=>{const{topic:i,method:n,params:s,expiry:a,relayRpcId:f,clientRpcId:h,throwOnFailedPublish:u,appLink:g}=t,w=Gs(n,s,h);let P;const M=!!g;try{const W=M?Vc:Ks;P=await this.client.core.crypto.encode(i,w,{encoding:W})}catch(W){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),W}let O;if(MP.includes(n)){const W=ys(JSON.stringify(w)),k=ys(P);O=await this.client.core.verify.register({id:k,decryptedId:W})}const $=Lr[n].req;if($.attestation=O,a&&($.ttl=a),f&&($.id=f),this.client.core.history.set(i,w),M){const W=jl(g,i,P);await global.Linking.openURL(W,this.client.name)}else{const W=Lr[n].req;a&&(W.ttl=a),f&&(W.id=f),u?(W.internal=An(pr({},W.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,P,W)):this.client.core.relayer.publish(i,P,W).catch(k=>this.client.logger.error(k))}return w.id},this.sendResult=async t=>{const{id:i,topic:n,result:s,throwOnFailedPublish:a,encodeOpts:f,appLink:h}=t,u=th(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const M=w?Vc:Ks;g=await this.client.core.crypto.encode(n,u,An(pr({},f||{}),{encoding:M}))}catch(M){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),M}let P;try{P=await this.client.core.history.get(n,i)}catch(M){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),M}if(w){const M=jl(h,n,g);await global.Linking.openURL(M,this.client.name)}else{const M=Lr[P.request.method].res;a?(M.internal=An(pr({},M.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,g,M)):this.client.core.relayer.publish(n,g,M).catch(O=>this.client.logger.error(O))}await this.client.core.history.resolve(u)},this.sendError=async t=>{const{id:i,topic:n,error:s,encodeOpts:a,rpcOpts:f,appLink:h}=t,u=rh(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const M=w?Vc:Ks;g=await this.client.core.crypto.encode(n,u,An(pr({},a||{}),{encoding:M}))}catch(M){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),M}let P;try{P=await this.client.core.history.get(n,i)}catch(M){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),M}if(w){const M=jl(h,n,g);await global.Linking.openURL(M,this.client.name)}else{const M=f||Lr[P.request.method].res;this.client.core.relayer.publish(n,g,M)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Ws(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Ws(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===rs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=rs.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=rs.idle},this.processRequest=async t=>{const{topic:i,payload:n,attestation:s,transportType:a,encryptedId:f}=t,h=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:h}))switch(h){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:f});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});default:return this.client.logger.info(`Unsupported request method ${h}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:n,transportType:s}=t,a=(await this.client.core.history.get(i,n.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:n}=_e("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:n}=t,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:n,attestation:s,encryptedId:a}=t,{params:f,id:h}=n;try{const u=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(pr({},n.params));const g=f.expiryTimestamp||Ir(Lr.wc_sessionPropose.req.ttl),w=pr({id:h,pairingTopic:i,expiryTimestamp:g},f);await this.setProposal(h,w);const P=await this.getVerifyContext({attestationId:s,hash:ys(JSON.stringify(n)),encryptedId:a,metadata:w.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(As.proposal_listener_not_found)),u?.addTrace(ts.emit_session_proposal),this.client.events.emit("session_proposal",{id:h,params:w,verifyContext:P})}catch(u){await this.sendError({id:h,topic:i,error:u,rpcOpts:Lr.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(t,i,n)=>{const{id:s}=i;if(Zn(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const f=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const h=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const u=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const g=await this.client.core.crypto.generateSharedKey(h,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:g});const w=await this.client.core.relayer.subscribe(g,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else if(en(i)){await this.client.proposal.delete(s,Gt("USER_DISCONNECTED"));const a=Dt("session_connect");if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners, 954`);this.events.emit(Dt("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:a,controller:f,expiry:h,namespaces:u,sessionProperties:g,sessionConfig:w}=i.params,P=An(pr(pr({topic:t,relay:a,expiry:h,namespaces:u,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},g&&{sessionProperties:g}),w&&{sessionConfig:w}),{transportType:sr.relay}),M=Dt("session_connect");if(this.events.listenerCount(M)===0)throw new Error(`emitting ${M} without any listeners 997`);this.events.emit(Dt("session_connect"),{session:P}),await this.sendResult({id:i.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionSettleResponse=async(t,i)=>{const{id:n}=i;Zn(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(Dt("session_approve",n),{})):en(i)&&(await this.client.session.delete(t,Gt("USER_DISCONNECTED")),this.events.emit(Dt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:n,id:s}=i;try{const a=`${t}_session_update`,f=tf.get(a);if(f&&this.isRequestOutOfSync(f,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:t,error:Gt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(pr({topic:t},n));try{tf.set(a,s),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0})}catch(h){throw tf.delete(a),h}this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(a){await this.sendError({id:s,topic:t,error:a}),this.client.logger.error(a)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:n}=i,s=Dt("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Zn(i)?this.events.emit(Dt("session_update",n),{}):en(i)&&this.events.emit(Dt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Ir(ja)),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{const{id:n}=i,s=Dt("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Zn(i)?this.events.emit(Dt("session_extend",n),{}):en(i)&&this.events.emit(Dt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{const{id:n}=i,s=Dt("session_ping",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Zn(i)?this.events.emit(Dt("session_ping",n),{}):en(i)&&this.events.emit(Dt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(fi.publish,async()=>{s(await this.deleteSession({topic:t,id:n}))})}),this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Gt("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async t=>{var i,n,s;const{topic:a,payload:f,attestation:h,encryptedId:u,transportType:g}=t,{id:w,params:P}=f;try{await this.isValidRequest(pr({topic:a},P));const M=this.client.session.get(a),O=await this.getVerifyContext({attestationId:h,hash:ys(JSON.stringify(Gs("wc_sessionRequest",P,w))),encryptedId:u,metadata:M.peer.metadata,transportType:g}),$={id:w,topic:a,params:P,verifyContext:O};await this.setPendingSessionRequest($),g===sr.link_mode&&(i=M.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=M.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest($):(this.addSessionRequestToSessionRequestQueue($),this.processSessionRequestQueue())}catch(M){await this.sendError({id:w,topic:a,error:M}),this.client.logger.error(M)}},this.onSessionRequestResponse=(t,i)=>{const{id:n}=i,s=Dt("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Zn(i)?this.events.emit(Dt("session_request",n),{result:i.result}):en(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:n,params:s}=i;try{const a=`${t}_session_event_${s.event.name}`,f=tf.get(a);if(f&&this.isRequestOutOfSync(f,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(pr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s}),tf.set(a,n)}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),Zn(i)?this.events.emit(Dt("session_request",n),{result:i.result}):en(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:n,payload:s,attestation:a,encryptedId:f,transportType:h}=t;try{const{requester:u,authPayload:g,expiryTimestamp:w}=s.params,P=await this.getVerifyContext({attestationId:a,hash:ys(JSON.stringify(s)),encryptedId:f,metadata:u.metadata,transportType:h}),M={requester:u,pairingTopic:n,id:s.id,authPayload:g,verifyContext:P,expiryTimestamp:w};await this.setAuthRequest(s.id,{request:M,pairingTopic:n,transportType:h}),h===sr.link_mode&&(i=u.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:P})}catch(u){this.client.logger.error(u);const g=s.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),P=this.getAppLinkIfEnabled(s.params.requester.metadata,h),M={type:ws,receiverPublicKey:g,senderPublicKey:w};await this.sendError({id:s.id,topic:n,error:u,encodeOpts:M,rpcOpts:Lr.wc_sessionAuthenticate.autoReject,appLink:P})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=rs.idle,this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===t&&s.request.method==="wc_sessionRequest").forEach(s=>{const a=s.request.id,f=Dt("session_request",a);if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners`);this.events.emit(Dt("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===rs.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=rs.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Gs("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async t=>{if(!bi(t)){const{message:h}=_e("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(h)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:a,relays:f}=t;if(oi(i)||await this.isValidPairingTopic(i),!dE(f,!0)){const{message:h}=_e("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(h)}!oi(n)&&ef(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!oi(s)&&ef(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),oi(a)||this.validateSessionProps(a,"sessionProperties")},this.validateNamespaces=(t,i)=>{const n=uE(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!bi(t))throw new Error(_e("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:a}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const f=this.client.proposal.get(i),h=r0(n,"approve()");if(h)throw new Error(h.message);const u=xb(f.requiredNamespaces,n,"approve()");if(u)throw new Error(u.message);if(!wr(s,!0)){const{message:g}=_e("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(g)}oi(a)||this.validateSessionProps(a,"sessionProperties")},this.isValidReject=async t=>{if(!bi(t)){const{message:s}=_e("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}const{id:i,reason:n}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!gE(n)){const{message:s}=_e("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!bi(t)){const{message:u}=_e("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(u)}const{relay:i,controller:n,namespaces:s,expiry:a}=t;if(!yb(i)){const{message:u}=_e("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const f=oE(n,"onSessionSettleRequest()");if(f)throw new Error(f.message);const h=r0(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Ws(a)){const{message:u}=_e("EXPIRED","onSessionSettleRequest()");throw new Error(u)}},this.isValidUpdate=async t=>{if(!bi(t)){const{message:h}=_e("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(h)}const{topic:i,namespaces:n}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),a=r0(n,"update()");if(a)throw new Error(a.message);const f=xb(s.requiredNamespaces,n,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!bi(t)){const{message:n}=_e("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!bi(t)){const{message:h}=_e("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(h)}const{topic:i,request:n,chainId:s,expiry:a}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!_b(f,s)){const{message:h}=_e("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(h)}if(!vE(n)){const{message:h}=_e("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(h)}if(!wE(f,s,n.method)){const{message:h}=_e("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(h)}if(a&&!AE(a,M0)){const{message:h}=_e("MISSING_OR_INVALID",`request() expiry: ${a}. Expiry must be a number (in seconds) between ${M0.min} and ${M0.max}`);throw new Error(h)}},this.isValidRespond=async t=>{var i;if(!bi(t)){const{message:a}=_e("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(a)}const{topic:n,response:s}=t;try{await this.isValidSessionTopic(n)}catch(a){throw(i=t?.response)!=null&&i.id&&this.cleanupAfterResponse(t),a}if(!mE(s)){const{message:a}=_e("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidPing=async t=>{if(!bi(t)){const{message:n}=_e("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!bi(t)){const{message:f}=_e("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!_b(a,s)){const{message:f}=_e("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(f)}if(!bE(n)){const{message:f}=_e("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}if(!yE(a,s,n.name)){const{message:f}=_e("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!bi(t)){const{message:n}=_e("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:n,domain:s,nonce:a}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!wr(n,!1))throw new Error("uri is required parameter");if(!wr(s,!1))throw new Error("domain is required parameter");if(!wr(a,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>Ba(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:f}=Ba(i[0]);if(f!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:n,encryptedId:s,metadata:a,transportType:f}=t,h={verified:{verifyUrl:a.verifyUrl||lf,validation:"UNKNOWN",origin:a.url||""}};try{if(f===sr.link_mode){const g=this.getAppLinkIfEnabled(a,f);return h.verified.validation=g&&new URL(g).origin===new URL(a.url).origin?"VALID":"INVALID",h}const u=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:a.verifyUrl});u&&(h.verified.origin=u.origin,h.verified.isScam=u.isScam,h.verified.validation=u.origin===new URL(a.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!wr(n,!1)){const{message:s}=_e("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const a of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(a)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:n}=_e("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(n)}},this.isLinkModeEnabled=(t,i)=>{var n,s,a,f,h,u,g,w,P;return!t||i!==sr.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((f=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:f.universal)!==void 0&&((u=(h=this.client.metadata)==null?void 0:h.redirect)==null?void 0:u.universal)!==""&&((g=t?.redirect)==null?void 0:g.universal)!==void 0&&((w=t?.redirect)==null?void 0:w.universal)!==""&&((P=t?.redirect)==null?void 0:P.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var n;return this.isLinkModeEnabled(t,i)?(n=t?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=Gm(t,"topic")||"",n=decodeURIComponent(Gm(t,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:sr.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var t;if(Gd()||Fa()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(fi.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:n,transportType:s}=e,{publicKey:a}=this.client.auth.authKeys.keys.includes(oh)?this.client.auth.authKeys.get(oh):{responseTopic:void 0,publicKey:void 0},f=await this.client.core.crypto.decode(t,i,{receiverPublicKey:a,encoding:s===sr.link_mode?Vc:Ks});try{v0(f)?(this.client.core.history.set(t,f),this.onRelayEventRequest({topic:t,payload:f,attestation:n,transportType:s,encryptedId:ys(i)})):ih(f)?(await this.client.core.history.resolve(f),await this.onRelayEventResponse({topic:t,payload:f,transportType:s}),this.client.core.history.delete(t,f.id)):this.onRelayEventUnknownPayload({topic:t,payload:f,transportType:s})}catch(h){this.client.logger.error(h)}}registerExpirerEvents(){this.client.core.expirer.on(rn.expired,async e=>{const{topic:t,id:i}=Vm(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,_e("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,_e("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(Bo.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Bo.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!wr(e,!1)){const{message:t}=_e("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=_e("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Ws(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=_e("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!wr(e,!1)){const{message:t}=_e("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=_e("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Ws(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=_e("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=_e("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),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(wr(e,!1)){const{message:t}=_e("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=_e("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!pE(e)){const{message:t}=_e("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=_e("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Ws(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=_e("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class UP extends qo{constructor(e,t){super(e,t,AP,S0),this.core=e,this.logger=t}}class qP extends qo{constructor(e,t){super(e,t,EP,S0),this.core=e,this.logger=t}}class zP extends qo{constructor(e,t){super(e,t,IP,S0,i=>i.id),this.core=e,this.logger=t}}class kP extends qo{constructor(e,t){super(e,t,DP,sh,()=>oh),this.core=e,this.logger=t}}class HP extends qo{constructor(e,t){super(e,t,OP,sh),this.core=e,this.logger=t}}class jP extends qo{constructor(e,t){super(e,t,RP,sh,i=>i.id),this.core=e,this.logger=t}}class WP{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new kP(this.core,this.logger),this.pairingTopics=new HP(this.core,this.logger),this.requests=new jP(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class C0 extends KS{constructor(e){super(e),this.protocol=U2,this.version=q2,this.name=I0.name,this.events=new qr.exports.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||I0.name,this.metadata=e?.metadata||km(),this.signConfig=e?.signConfig;const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Jn(eh({level:e?.logger||I0.logger}));this.core=e?.core||new xP(e),this.logger=ai(t,this.name),this.session=new qP(this.core,this.logger),this.proposal=new UP(this.core,this.logger),this.pendingRequest=new zP(this.core,this.logger),this.engine=new FP(this),this.auth=new WP(this.core,this.logger)}static async init(e){const t=new C0(e);return await t.initialize(),t}get context(){return yi(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.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var P0={exports:{}};/**
43
+ ***************************************************************************** */var d0=function(r,e){return d0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},d0(r,e)};function nI(r,e){d0(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var p0=function(){return p0=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},p0.apply(this,arguments)};function sI(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function oI(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function aI(r,e){return function(t,i){e(t,i,r)}}function cI(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function fI(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function lI(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function hI(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function uI(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function g0(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Kb(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function dI(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Kb(arguments[e]));return r}function pI(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function cf(r){return this instanceof cf?(this.v=r,this):new cf(r)}function gI(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(P){i[P]&&(n[P]=function(M){return new Promise(function(O,$){s.push([P,M,O,$])>1||f(P,M)})})}function f(P,M){try{h(i[P](M))}catch(O){w(s[0][3],O)}}function h(P){P.value instanceof cf?Promise.resolve(P.value.v).then(u,g):w(s[0][2],P)}function u(P){f("next",P)}function g(P){f("throw",P)}function w(P,M){P(M),s.shift(),s.length&&f(s[0][0],s[0][1])}}function vI(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:cf(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function mI(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof g0=="function"?g0(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function bI(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function wI(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function yI(r){return r&&r.__esModule?r:{default:r}}function _I(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function xI(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var AI=Object.freeze({__proto__:null,__extends:nI,get __assign(){return p0},__rest:sI,__decorate:oI,__param:aI,__metadata:cI,__awaiter:fI,__generator:lI,__createBinding:hI,__exportStar:uI,__values:g0,__read:Kb,__spread:dI,__spreadArrays:pI,__await:cf,__asyncGenerator:gI,__asyncDelegator:vI,__asyncValues:mI,__makeTemplateObject:bI,__importStar:wI,__importDefault:yI,__classPrivateFieldGet:_I,__classPrivateFieldSet:xI}),EI=zu(AI),xs={},Vb;function SI(){if(Vb)return xs;Vb=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.isBrowserCryptoAvailable=xs.getSubtleCrypto=xs.getBrowerCrypto=void 0;function r(){return fr?.crypto||fr?.msCrypto||{}}xs.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}xs.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return xs.isBrowserCryptoAvailable=t,xs}var As={},Gb;function II(){if(Gb)return As;Gb=1,Object.defineProperty(As,"__esModule",{value:!0}),As.isBrowser=As.isNode=As.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}As.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}As.isNode=e;function t(){return!r()&&!e()}return As.isBrowser=t,As}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=EI;e.__exportStar(SI(),r),e.__exportStar(II(),r)})(Wb);function Gs(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Lo(r=6){return BigInt(Gs(r))}function Ys(r,e,t){return{id:t||Gs(),jsonrpc:"2.0",method:r,params:e}}function th(r,e){return{id:r,jsonrpc:"2.0",result:e}}function rh(r,e,t){return{id:r,jsonrpc:"2.0",error:MI(e,t)}}function MI(r,e){return typeof r>"u"?kb(zb):(typeof r=="string"&&(r=Object.assign(Object.assign({},kb(u0)),{message:r})),typeof e<"u"&&(r.data=e),rI(r.code)&&(r=iI(r.code)),r)}class CI{}class PI extends CI{constructor(){super()}}class DI extends PI{constructor(e){super()}}const OI="^https?:",RI="^wss?:";function TI(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Yb(r,e){const t=TI(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function Jb(r){return Yb(r,OI)}function Qb(r){return Yb(r,RI)}function $I(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function Zb(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function v0(r){return Zb(r)&&"method"in r}function ih(r){return Zb(r)&&(Xn(r)||tn(r))}function Xn(r){return"result"in r}function tn(r){return"error"in r}class rn extends DI{constructor(e){super(e),this.events=new qr.exports.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Ys(e.method,e.params||[],e.id||Lo().toString()),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{tn(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ih(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}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",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const NI=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),LI=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Xb=r=>r.split("?")[0],e2=10,BI=NI();class FI{constructor(e){if(this.url=e,this.events=new qr.exports.EventEmitter,this.registering=!1,!Qb(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ws(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!Qb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const n=new URLSearchParams(e).get("origin"),s=Wb.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!$I(e)},a=new BI(e,[],s);LI()?a.onerror=f=>{const h=f;i(this.emitError(h.error))}:a.on("error",f=>{i(this.emitError(f))}),a.onopen=()=>{this.onOpen(a),t(a)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Po(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=rh(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return jb(e,Xb(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>e2&&this.events.setMaxListeners(e2)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Xb(this.url)}`));return this.events.emit("register_error",t),t}}var m0={exports:{}};(function(r,e){var t=200,i="__lodash_hash_undefined__",n=1,s=2,a=9007199254740991,f="[object Arguments]",h="[object Array]",u="[object AsyncFunction]",g="[object Boolean]",w="[object Date]",P="[object Error]",M="[object Function]",O="[object GeneratorFunction]",$="[object Map]",W="[object Number]",H="[object Null]",F="[object Object]",Y="[object Promise]",B="[object Proxy]",z="[object RegExp]",j="[object Set]",_="[object String]",U="[object Symbol]",ee="[object Undefined]",oe="[object WeakMap]",L="[object ArrayBuffer]",b="[object DataView]",m="[object Float32Array]",l="[object Float64Array]",d="[object Int8Array]",y="[object Int16Array]",C="[object Int32Array]",D="[object Uint8Array]",S="[object Uint8ClampedArray]",v="[object Uint16Array]",A="[object Uint32Array]",x=/[\\^$.*+?()[\]{}|]/g,N=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,R={};R[m]=R[l]=R[d]=R[y]=R[C]=R[D]=R[S]=R[v]=R[A]=!0,R[f]=R[h]=R[L]=R[g]=R[b]=R[w]=R[P]=R[M]=R[$]=R[W]=R[F]=R[z]=R[j]=R[_]=R[oe]=!1;var X=typeof fr=="object"&&fr&&fr.Object===Object&&fr,V=typeof self=="object"&&self&&self.Object===Object&&self,J=X||V||Function("return this")(),K=e&&!e.nodeType&&e,E=K&&!0&&r&&!r.nodeType&&r,G=E&&E.exports===K,re=G&&X.process,le=function(){try{return re&&re.binding&&re.binding("util")}catch{}}(),he=le&&le.isTypedArray;function ge(Q,ne){for(var pe=-1,Ue=Q==null?0:Q.length,Xt=0,bt=[];++pe<Ue;){var or=Q[pe];ne(or,pe,Q)&&(bt[Xt++]=or)}return bt}function He(Q,ne){for(var pe=-1,Ue=ne.length,Xt=Q.length;++pe<Ue;)Q[Xt+pe]=ne[pe];return Q}function Te(Q,ne){for(var pe=-1,Ue=Q==null?0:Q.length;++pe<Ue;)if(ne(Q[pe],pe,Q))return!0;return!1}function Ce(Q,ne){for(var pe=-1,Ue=Array(Q);++pe<Q;)Ue[pe]=ne(pe);return Ue}function Xe(Q){return function(ne){return Q(ne)}}function $e(Q,ne){return Q.has(ne)}function be(Q,ne){return Q?.[ne]}function Pe(Q){var ne=-1,pe=Array(Q.size);return Q.forEach(function(Ue,Xt){pe[++ne]=[Xt,Ue]}),pe}function De(Q,ne){return function(pe){return Q(ne(pe))}}function ye(Q){var ne=-1,pe=Array(Q.size);return Q.forEach(function(Ue){pe[++ne]=Ue}),pe}var Ie=Array.prototype,Oe=Function.prototype,me=Object.prototype,Me=J["__core-js_shared__"],Be=Oe.toString,we=me.hasOwnProperty,ke=function(){var Q=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||"");return Q?"Symbol(src)_1."+Q:""}(),We=me.toString,xe=RegExp("^"+Be.call(we).replace(x,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=G?J.Buffer:void 0,Ke=J.Symbol,Ge=J.Uint8Array,mt=me.propertyIsEnumerable,It=Ie.splice,Ye=Ke?Ke.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Ot=Ve?Ve.isBuffer:void 0,Ze=De(Object.keys,Object),rt=zi(J,"DataView"),et=zi(J,"Map"),Ne=zi(J,"Promise"),it=zi(J,"Set"),tt=zi(J,"WeakMap"),Re=zi(Object,"create"),lt=Cs(rt),ht=Cs(et),Le=Cs(Ne),ut=Cs(it),nt=Cs(tt),Fe=Ke?Ke.prototype:void 0,st=Fe?Fe.valueOf:void 0;function Qe(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function qe(){this.__data__=Re?Re(null):{},this.size=0}function dt(Q){var ne=this.has(Q)&&delete this.__data__[Q];return this.size-=ne?1:0,ne}function Ht(Q){var ne=this.__data__;if(Re){var pe=ne[Q];return pe===i?void 0:pe}return we.call(ne,Q)?ne[Q]:void 0}function at(Q){var ne=this.__data__;return Re?ne[Q]!==void 0:we.call(ne,Q)}function kt(Q,ne){var pe=this.__data__;return this.size+=this.has(Q)?0:1,pe[Q]=Re&&ne===void 0?i:ne,this}Qe.prototype.clear=qe,Qe.prototype.delete=dt,Qe.prototype.get=Ht,Qe.prototype.has=at,Qe.prototype.set=kt;function _t(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function qt(){this.__data__=[],this.size=0}function Qr(Q){var ne=this.__data__,pe=ra(ne,Q);if(pe<0)return!1;var Ue=ne.length-1;return pe==Ue?ne.pop():It.call(ne,pe,1),--this.size,!0}function Zr(Q){var ne=this.__data__,pe=ra(ne,Q);return pe<0?void 0:ne[pe][1]}function Xr(Q){return ra(this.__data__,Q)>-1}function ei(Q,ne){var pe=this.__data__,Ue=ra(pe,Q);return Ue<0?(++this.size,pe.push([Q,ne])):pe[Ue][1]=ne,this}_t.prototype.clear=qt,_t.prototype.delete=Qr,_t.prototype.get=Zr,_t.prototype.has=Xr,_t.prototype.set=ei;function vr(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function Ai(){this.size=0,this.__data__={hash:new Qe,map:new(et||_t),string:new Qe}}function Mn(Q){var ne=fo(this,Q).delete(Q);return this.size-=ne?1:0,ne}function Ei(Q){return fo(this,Q).get(Q)}function Cn(Q){return fo(this,Q).has(Q)}function Pn(Q,ne){var pe=fo(this,Q),Ue=pe.size;return pe.set(Q,ne),this.size+=pe.size==Ue?0:1,this}vr.prototype.clear=Ai,vr.prototype.delete=Mn,vr.prototype.get=Ei,vr.prototype.has=Cn,vr.prototype.set=Pn;function Si(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.__data__=new vr;++ne<pe;)this.add(Q[ne])}function cn(Q){return this.__data__.set(Q,i),this}function fn(Q){return this.__data__.has(Q)}Si.prototype.add=Si.prototype.push=cn,Si.prototype.has=fn;function Cr(Q){var ne=this.__data__=new _t(Q);this.size=ne.size}function Dn(){this.__data__=new _t,this.size=0}function On(Q){var ne=this.__data__,pe=ne.delete(Q);return this.size=ne.size,pe}function Rn(Q){return this.__data__.get(Q)}function ta(Q){return this.__data__.has(Q)}function co(Q,ne){var pe=this.__data__;if(pe instanceof _t){var Ue=pe.__data__;if(!et||Ue.length<t-1)return Ue.push([Q,ne]),this.size=++pe.size,this;pe=this.__data__=new vr(Ue)}return pe.set(Q,ne),this.size=pe.size,this}Cr.prototype.clear=Dn,Cr.prototype.delete=On,Cr.prototype.get=Rn,Cr.prototype.has=ta,Cr.prototype.set=co;function qh(Q,ne){var pe=uc(Q),Ue=!pe&&Zh(Q),Xt=!pe&&!Ue&&Lf(Q),bt=!pe&&!Ue&&!Xt&&tu(Q),or=pe||Ue||Xt||bt,Er=or?Ce(Q.length,String):[],Bt=Er.length;for(var er in Q)(ne||we.call(Q,er))&&!(or&&(er=="length"||Xt&&(er=="offset"||er=="parent")||bt&&(er=="buffer"||er=="byteLength"||er=="byteOffset")||Vh(er,Bt)))&&Er.push(er);return Er}function ra(Q,ne){for(var pe=Q.length;pe--;)if(Qh(Q[pe][0],ne))return pe;return-1}function $f(Q,ne,pe){var Ue=ne(Q);return uc(Q)?Ue:He(Ue,pe(Q))}function ia(Q){return Q==null?Q===void 0?ee:H:Ye&&Ye in Object(Q)?Wh(Q):Gp(Q)}function Nf(Q){return sa(Q)&&ia(Q)==f}function na(Q,ne,pe,Ue,Xt){return Q===ne?!0:Q==null||ne==null||!sa(Q)&&!sa(ne)?Q!==Q&&ne!==ne:zh(Q,ne,pe,Ue,na,Xt)}function zh(Q,ne,pe,Ue,Xt,bt){var or=uc(Q),Er=uc(ne),Bt=or?h:cs(Q),er=Er?h:cs(ne);Bt=Bt==f?F:Bt,er=er==f?F:er;var _r=Bt==F,Ii=er==F,Sr=Bt==er;if(Sr&&Lf(Q)){if(!Lf(ne))return!1;or=!0,_r=!1}if(Sr&&!_r)return bt||(bt=new Cr),or||tu(Q)?lc(Q,ne,pe,Ue,Xt,bt):Vp(Q,ne,Bt,pe,Ue,Xt,bt);if(!(pe&n)){var ar=_r&&we.call(Q,"__wrapped__"),hi=Ii&&we.call(ne,"__wrapped__");if(ar||hi){var Tn=ar?Q.value():Q,ln=hi?ne.value():ne;return bt||(bt=new Cr),Xt(Tn,ln,pe,Ue,bt)}}return Sr?(bt||(bt=new Cr),jh(Q,ne,pe,Ue,Xt,bt)):!1}function Kp(Q){if(!eu(Q)||Yh(Q))return!1;var ne=dc(Q)?xe:N;return ne.test(Cs(Q))}function Hh(Q){return sa(Q)&&Xh(Q.length)&&!!R[ia(Q)]}function kh(Q){if(!Jh(Q))return Ze(Q);var ne=[];for(var pe in Object(Q))we.call(Q,pe)&&pe!="constructor"&&ne.push(pe);return ne}function lc(Q,ne,pe,Ue,Xt,bt){var or=pe&n,Er=Q.length,Bt=ne.length;if(Er!=Bt&&!(or&&Bt>Er))return!1;var er=bt.get(Q);if(er&&bt.get(ne))return er==ne;var _r=-1,Ii=!0,Sr=pe&s?new Si:void 0;for(bt.set(Q,ne),bt.set(ne,Q);++_r<Er;){var ar=Q[_r],hi=ne[_r];if(Ue)var Tn=or?Ue(hi,ar,_r,ne,Q,bt):Ue(ar,hi,_r,Q,ne,bt);if(Tn!==void 0){if(Tn)continue;Ii=!1;break}if(Sr){if(!Te(ne,function(ln,fs){if(!$e(Sr,fs)&&(ar===ln||Xt(ar,ln,pe,Ue,bt)))return Sr.push(fs)})){Ii=!1;break}}else if(!(ar===hi||Xt(ar,hi,pe,Ue,bt))){Ii=!1;break}}return bt.delete(Q),bt.delete(ne),Ii}function Vp(Q,ne,pe,Ue,Xt,bt,or){switch(pe){case b:if(Q.byteLength!=ne.byteLength||Q.byteOffset!=ne.byteOffset)return!1;Q=Q.buffer,ne=ne.buffer;case L:return!(Q.byteLength!=ne.byteLength||!bt(new Ge(Q),new Ge(ne)));case g:case w:case W:return Qh(+Q,+ne);case P:return Q.name==ne.name&&Q.message==ne.message;case z:case _:return Q==ne+"";case $:var Er=Pe;case j:var Bt=Ue&n;if(Er||(Er=ye),Q.size!=ne.size&&!Bt)return!1;var er=or.get(Q);if(er)return er==ne;Ue|=s,or.set(Q,ne);var _r=lc(Er(Q),Er(ne),Ue,Xt,bt,or);return or.delete(Q),_r;case U:if(st)return st.call(Q)==st.call(ne)}return!1}function jh(Q,ne,pe,Ue,Xt,bt){var or=pe&n,Er=hc(Q),Bt=Er.length,er=hc(ne),_r=er.length;if(Bt!=_r&&!or)return!1;for(var Ii=Bt;Ii--;){var Sr=Er[Ii];if(!(or?Sr in ne:we.call(ne,Sr)))return!1}var ar=bt.get(Q);if(ar&&bt.get(ne))return ar==ne;var hi=!0;bt.set(Q,ne),bt.set(ne,Q);for(var Tn=or;++Ii<Bt;){Sr=Er[Ii];var ln=Q[Sr],fs=ne[Sr];if(Ue)var Bf=or?Ue(fs,ln,Sr,ne,Q,bt):Ue(ln,fs,Sr,Q,ne,bt);if(!(Bf===void 0?ln===fs||Xt(ln,fs,pe,Ue,bt):Bf)){hi=!1;break}Tn||(Tn=Sr=="constructor")}if(hi&&!Tn){var oa=Q.constructor,Fr=ne.constructor;oa!=Fr&&"constructor"in Q&&"constructor"in ne&&!(typeof oa=="function"&&oa instanceof oa&&typeof Fr=="function"&&Fr instanceof Fr)&&(hi=!1)}return bt.delete(Q),bt.delete(ne),hi}function hc(Q){return $f(Q,Qp,Kh)}function fo(Q,ne){var pe=Q.__data__;return Gh(ne)?pe[typeof ne=="string"?"string":"hash"]:pe.map}function zi(Q,ne){var pe=be(Q,ne);return Kp(pe)?pe:void 0}function Wh(Q){var ne=we.call(Q,Ye),pe=Q[Ye];try{Q[Ye]=void 0;var Ue=!0}catch{}var Xt=We.call(Q);return Ue&&(ne?Q[Ye]=pe:delete Q[Ye]),Xt}var Kh=Pt?function(Q){return Q==null?[]:(Q=Object(Q),ge(Pt(Q),function(ne){return mt.call(Q,ne)}))}:Zt,cs=ia;(rt&&cs(new rt(new ArrayBuffer(1)))!=b||et&&cs(new et)!=$||Ne&&cs(Ne.resolve())!=Y||it&&cs(new it)!=j||tt&&cs(new tt)!=oe)&&(cs=function(Q){var ne=ia(Q),pe=ne==F?Q.constructor:void 0,Ue=pe?Cs(pe):"";if(Ue)switch(Ue){case lt:return b;case ht:return $;case Le:return Y;case ut:return j;case nt:return oe}return ne});function Vh(Q,ne){return ne=ne??a,!!ne&&(typeof Q=="number"||ae.test(Q))&&Q>-1&&Q%1==0&&Q<ne}function Gh(Q){var ne=typeof Q;return ne=="string"||ne=="number"||ne=="symbol"||ne=="boolean"?Q!=="__proto__":Q===null}function Yh(Q){return!!ke&&ke in Q}function Jh(Q){var ne=Q&&Q.constructor,pe=typeof ne=="function"&&ne.prototype||me;return Q===pe}function Gp(Q){return We.call(Q)}function Cs(Q){if(Q!=null){try{return Be.call(Q)}catch{}try{return Q+""}catch{}}return""}function Qh(Q,ne){return Q===ne||Q!==Q&&ne!==ne}var Zh=Nf(function(){return arguments}())?Nf:function(Q){return sa(Q)&&we.call(Q,"callee")&&!mt.call(Q,"callee")},uc=Array.isArray;function Yp(Q){return Q!=null&&Xh(Q.length)&&!dc(Q)}var Lf=Ot||Qt;function Jp(Q,ne){return na(Q,ne)}function dc(Q){if(!eu(Q))return!1;var ne=ia(Q);return ne==M||ne==O||ne==u||ne==B}function Xh(Q){return typeof Q=="number"&&Q>-1&&Q%1==0&&Q<=a}function eu(Q){var ne=typeof Q;return Q!=null&&(ne=="object"||ne=="function")}function sa(Q){return Q!=null&&typeof Q=="object"}var tu=he?Xe(he):Hh;function Qp(Q){return Yp(Q)?qh(Q):kh(Q)}function Zt(){return[]}function Qt(){return!1}r.exports=Jp})(m0,m0.exports);var UI=m0.exports,qI=Object.defineProperty,t2=Object.getOwnPropertySymbols,zI=Object.prototype.hasOwnProperty,HI=Object.prototype.propertyIsEnumerable,r2=(r,e,t)=>e in r?qI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ci=(r,e)=>{for(var t in e||(e={}))zI.call(e,t)&&r2(r,t,e[t]);if(t2)for(var t of t2(e))HI.call(e,t)&&r2(r,t,e[t]);return r};const i2="wc",n2=2,b0="core",es=`${i2}@2:${b0}:`,kI={name:b0,logger:"error"},jI={database:":memory:"},WI="crypto",s2="client_ed25519_seed",KI=Ae.ONE_DAY,VI="keychain",GI="0.3",YI="messages",JI="0.3",QI=Ae.SIX_HOURS,ZI="publisher",o2="irn",XI="error",a2="wss://relay.walletconnect.org",eM="relayer",fi={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},tM="_subscription",nn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},rM=.1,w0="2.17.2",sr={link_mode:"link_mode",relay:"relay"},iM="0.3",nM="WALLETCONNECT_CLIENT_ID",c2="WALLETCONNECT_LINK_MODE_APPS",ts={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},sM="subscription",oM="0.3",aM=Ae.FIVE_SECONDS*1e3,cM="pairing",fM="0.3",ff={wc_pairingDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Ae.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:0},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:0}}},Bo={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},An={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},lM="history",hM="0.3",uM="expirer",sn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},dM="0.3",pM="verify-api",gM="https://verify.walletconnect.com",f2="https://verify.walletconnect.org",lf=f2,vM=`${lf}/v3`,mM=[gM,f2],bM="echo",wM="https://echo.walletconnect.com",rs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Es={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},En={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},Fo={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Uo={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},hf={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},yM=.1,_M="event-client",xM=86400,AM="https://pulse.walletconnect.org/batch";function EM(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var $=0,W=0,H=0,F=O.length;H!==F&&O[H]===0;)H++,$++;for(var Y=(F-H)*g+1>>>0,B=new Uint8Array(Y);H!==F;){for(var z=O[H],j=0,_=Y-1;(z!==0||j<W)&&_!==-1;_--,j++)z+=256*B[_]>>>0,B[_]=z%f>>>0,z=z/f>>>0;if(z!==0)throw new Error("Non-zero carry");W=j,H++}for(var U=Y-W;U!==Y&&B[U]===0;)U++;for(var ee=h.repeat($);U<Y;++U)ee+=r.charAt(B[U]);return ee}function P(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var $=0;if(O[$]!==" "){for(var W=0,H=0;O[$]===h;)W++,$++;for(var F=(O.length-$)*u+1>>>0,Y=new Uint8Array(F);O[$];){var B=t[O.charCodeAt($)];if(B===255)return;for(var z=0,j=F-1;(B!==0||z<H)&&j!==-1;j--,z++)B+=f*Y[j]>>>0,Y[j]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");H=z,$++}if(O[$]!==" "){for(var _=F-H;_!==F&&Y[_]===0;)_++;for(var U=new Uint8Array(W+(F-_)),ee=W;_!==F;)U[ee++]=Y[_++];return U}}}function M(O){var $=P(O);if($)return $;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:M}}var SM=EM,IM=SM;const l2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},MM=r=>new TextEncoder().encode(r),CM=r=>new TextDecoder().decode(r);class PM{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class DM{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 h2(this,e)}}class OM{constructor(e){this.decoders=e}or(e){return h2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const h2=(r,e)=>new OM(ci(ci({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class RM{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new PM(e,t,i),this.decoder=new DM(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const nh=({name:r,prefix:e,encode:t,decode:i})=>new RM(r,e,t,i),uf=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=IM(t,e);return nh({prefix:r,name:e,encode:i,decode:s=>l2(n(s))})},TM=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},$M=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},Wr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>nh({prefix:e,name:r,encode(n){return $M(n,i,t)},decode(n){return TM(n,i,t,r)}}),NM=nh({prefix:"\0",name:"identity",encode:r=>CM(r),decode:r=>MM(r)});var LM=Object.freeze({__proto__:null,identity:NM});const BM=Wr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var FM=Object.freeze({__proto__:null,base2:BM});const UM=Wr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var qM=Object.freeze({__proto__:null,base8:UM});const zM=uf({prefix:"9",name:"base10",alphabet:"0123456789"});var HM=Object.freeze({__proto__:null,base10:zM});const kM=Wr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jM=Wr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var WM=Object.freeze({__proto__:null,base16:kM,base16upper:jM});const KM=Wr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),VM=Wr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),GM=Wr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),YM=Wr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),JM=Wr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),QM=Wr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ZM=Wr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),XM=Wr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),eC=Wr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tC=Object.freeze({__proto__:null,base32:KM,base32upper:VM,base32pad:GM,base32padupper:YM,base32hex:JM,base32hexupper:QM,base32hexpad:ZM,base32hexpadupper:XM,base32z:eC});const rC=uf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),iC=uf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nC=Object.freeze({__proto__:null,base36:rC,base36upper:iC});const sC=uf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),oC=uf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var aC=Object.freeze({__proto__:null,base58btc:sC,base58flickr:oC});const cC=Wr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fC=Wr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),lC=Wr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hC=Wr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var uC=Object.freeze({__proto__:null,base64:cC,base64pad:fC,base64url:lC,base64urlpad:hC});const u2=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}"),dC=u2.reduce((r,e,t)=>(r[t]=e,r),[]),pC=u2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function gC(r){return r.reduce((e,t)=>(e+=dC[t],e),"")}function vC(r){const e=[];for(const t of r){const i=pC[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const mC=nh({prefix:"\u{1F680}",name:"base256emoji",encode:gC,decode:vC});var bC=Object.freeze({__proto__:null,base256emoji:mC}),wC=p2,d2=128,yC=127,_C=~yC,xC=Math.pow(2,31);function p2(r,e,t){e=e||[],t=t||0;for(var i=t;r>=xC;)e[t++]=r&255|d2,r/=128;for(;r&_C;)e[t++]=r&255|d2,r>>>=7;return e[t]=r|0,p2.bytes=t-i+1,e}var AC=y0,EC=128,g2=127;function y0(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw y0.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&g2)<<n:(a&g2)*Math.pow(2,n),n+=7}while(a>=EC);return y0.bytes=s-i,t}var SC=Math.pow(2,7),IC=Math.pow(2,14),MC=Math.pow(2,21),CC=Math.pow(2,28),PC=Math.pow(2,35),DC=Math.pow(2,42),OC=Math.pow(2,49),RC=Math.pow(2,56),TC=Math.pow(2,63),$C=function(r){return r<SC?1:r<IC?2:r<MC?3:r<CC?4:r<PC?5:r<DC?6:r<OC?7:r<RC?8:r<TC?9:10},NC={encode:wC,decode:AC,encodingLength:$C},v2=NC;const m2=(r,e,t=0)=>(v2.encode(r,e,t),e),b2=r=>v2.encodingLength(r),_0=(r,e)=>{const t=e.byteLength,i=b2(r),n=i+b2(t),s=new Uint8Array(n+t);return m2(r,s,0),m2(t,s,i),s.set(e,n),new LC(r,t,e,s)};class LC{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const w2=({name:r,code:e,encode:t})=>new BC(r,e,t);class BC{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?_0(this.code,t):t.then(i=>_0(this.code,i))}else throw Error("Unknown type, must be binary type")}}const y2=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),FC=w2({name:"sha2-256",code:18,encode:y2("SHA-256")}),UC=w2({name:"sha2-512",code:19,encode:y2("SHA-512")});var qC=Object.freeze({__proto__:null,sha256:FC,sha512:UC});const _2=0,zC="identity",x2=l2;var HC=Object.freeze({__proto__:null,identity:{code:_2,name:zC,encode:x2,digest:r=>_0(_2,x2(r))}});new TextEncoder,new TextDecoder;const A2=ci(ci(ci(ci(ci(ci(ci(ci(ci(ci({},LM),FM),qM),HM),WM),tC),nC),aC),uC),bC);ci(ci({},qC),HC);function kC(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function E2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const S2=E2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),x0=E2("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=kC(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),jC=ci({utf8:S2,"utf-8":S2,hex:A2.base16,latin1:x0,ascii:x0,binary:x0},A2);function WC(r,e="utf8"){const t=jC[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}class KC{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=VI,this.version=GI,this.initialized=!1,this.storagePrefix=es,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=_e("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=ai(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,jm(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Wm(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VC{constructor(e,t,i){this.core=e,this.logger=t,this.name=WI,this.randomSessionIdentifier=Zd(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),s=Lm(n);return Nm(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=CA();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),a=Lm(s),f=this.randomSessionIdentifier;return await Fx(f,n,KI,a)},this.generateSharedKey=(n,s,a)=>{this.isInitialized();const f=this.getPrivateKey(n),h=PA(f,s);return this.setSymKey(h,a)},this.setSymKey=async(n,s)=>{this.isInitialized();const a=s||kl(n);return await this.keychain.set(a,n),a},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,a)=>{this.isInitialized();const f=fb(a),h=ws(s);if(hb(f))return OA(h,a?.encoding);if(lb(f)){const P=f.senderPublicKey,M=f.receiverPublicKey;n=await this.generateSharedKey(P,M)}const u=this.getSymKey(n),{type:g,senderPublicKey:w}=f;return DA({type:g,symKey:u,message:h,senderPublicKey:w,encoding:a?.encoding})},this.decode=async(n,s,a)=>{this.isInitialized();const f=$A(s,a);if(hb(f)){const h=TA(s,a?.encoding);return Po(h)}if(lb(f)){const h=f.receiverPublicKey,u=f.senderPublicKey;n=await this.generateSharedKey(h,u)}try{const h=this.getSymKey(n),u=RA({symKey:h,encoded:s,encoding:a?.encoding});return Po(u)}catch(h){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=(n,s=Vs)=>{const a=Qc({encoded:n,encoding:s});return To(a.type)},this.getPayloadSenderPublicKey=(n,s=Vs)=>{const a=Qc({encoded:n,encoding:s});return a.senderPublicKey?JS(a.senderPublicKey,si):void 0},this.core=e,this.logger=ai(t,this.name),this.keychain=i||new KC(this.core,this.logger)}get context(){return yi(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(s2)}catch{e=Zd(),await this.keychain.set(s2,e)}return WC(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class GC extends BS{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=YI,this.version=JI,this.initialized=!1,this.storagePrefix=es,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const s=_s(n);let a=this.messages.get(i);return typeof a>"u"&&(a={}),typeof a[s]<"u"||(a[s]=n,this.messages.set(i,a),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const s=this.get(i),a=_s(n);return typeof s[a]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=ai(e,this.name),this.core=t}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,jm(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Wm(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class YC extends FS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new qr.exports.EventEmitter,this.name=ZI,this.queue=new Map,this.publishTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.failedPublishTimeout=Ae.toMiliseconds(Ae.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,n,s)=>{var a;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const f=s?.ttl||QI,h=Xd(s),u=s?.prompt||!1,g=s?.tag||0,w=s?.id||Lo().toString(),P={topic:i,message:n,opts:{ttl:f,relay:h,prompt:u,tag:g,id:w,attestation:s?.attestation}},M=`Failed to publish payload, please try again. id:${w} tag:${g}`,O=Date.now();let $,W=1;try{for(;$===void 0;){if(Date.now()-O>this.publishTimeout)throw new Error(M);this.logger.trace({id:w,attempts:W},`publisher.publish - attempt ${W}`),$=await await Ua(this.rpcPublish(i,n,f,h,u,g,w,s?.attestation).catch(H=>this.logger.warn(H)),this.publishTimeout,M),W++,$||await new Promise(H=>setTimeout(H,this.failedPublishTimeout))}this.relayer.events.emit(fi.publish,P),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:s}})}catch(H){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(H),(a=s?.internal)!=null&&a.throwOnFailedPublish)throw H;this.queue.set(w,P)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=ai(t,this.name),this.registerEventListeners()}get context(){return yi(this.logger)}rpcPublish(e,t,i,n,s,a,f,h){var u,g,w,P;const M={method:Zc(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:a,attestation:h},id:f};return oi((u=M.params)==null?void 0:u.prompt)&&((g=M.params)==null||delete g.prompt),oi((w=M.params)==null?void 0:w.tag)&&((P=M.params)==null||delete P.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:M}),this.relayer.request(M)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(za.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(fi.connection_stalled);return}this.checkQueue()}),this.relayer.on(fi.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class JC{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var QC=Object.defineProperty,ZC=Object.defineProperties,XC=Object.getOwnPropertyDescriptors,I2=Object.getOwnPropertySymbols,eP=Object.prototype.hasOwnProperty,tP=Object.prototype.propertyIsEnumerable,M2=(r,e,t)=>e in r?QC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,df=(r,e)=>{for(var t in e||(e={}))eP.call(e,t)&&M2(r,t,e[t]);if(I2)for(var t of I2(e))tP.call(e,t)&&M2(r,t,e[t]);return r},A0=(r,e)=>ZC(r,XC(e));class rP extends zS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new JC,this.events=new qr.exports.EventEmitter,this.name=sM,this.version=oM,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=es,this.subscribeTimeout=Ae.toMiliseconds(Ae.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const s=Xd(n),a={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,a);const f=await this.rpcSubscribe(i,s,n);return typeof f=="string"&&(this.onSubscribe(f,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),f}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((s,a)=>{const f=new Ae.Watch;f.start(n);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),f.stop(n),s(!0)),f.elapsed(n)>=aM&&(clearInterval(h),f.stop(n),a(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ai(t,this.name),this.clientId=""}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const n=Xd(i);await this.rpcUnsubscribe(e,t,n);const s=Gt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,i){var n;i?.transportType===sr.relay&&await this.restartToComplete();const s={method:Zc(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const a=(n=i?.internal)==null?void 0:n.throwOnFailedPublish;try{const f=_s(e+this.clientId);if(i?.transportType===sr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(u=>this.logger.warn(u))},Ae.toMiliseconds(Ae.ONE_SECOND)),f;const h=await Ua(this.relayer.request(s).catch(u=>this.logger.warn(u)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!h&&a)throw new Error(`Subscribing to ${e} failed, please try again`);return h?f:null}catch(f){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(fi.connection_stalled),a)throw f}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Zc(t.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await Ua(this.relayer.request(i).catch(n=>this.logger.warn(n)),this.subscribeTimeout)}catch{this.relayer.events.emit(fi.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:Zc(t.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await Ua(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(fi.connection_stalled)}return n}rpcUnsubscribe(e,t,i){const n={method:Zc(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,A0(df({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,df({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,df({},t)),this.topicMap.set(t.topic,e),this.events.emit(ts.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(ts.deleted,A0(df({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ts.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(ts.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}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 batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Jn(t)&&this.onBatchSubscribe(t.map((i,n)=>A0(df({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(za.pulse,async()=>{await this.checkPending()}),this.events.on(ts.created,async e=>{const t=ts.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(ts.deleted,async e=>{const t=ts.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var iP=Object.defineProperty,C2=Object.getOwnPropertySymbols,nP=Object.prototype.hasOwnProperty,sP=Object.prototype.propertyIsEnumerable,P2=(r,e,t)=>e in r?iP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,D2=(r,e)=>{for(var t in e||(e={}))nP.call(e,t)&&P2(r,t,e[t]);if(C2)for(var t of C2(e))sP.call(e,t)&&P2(r,t,e[t]);return r};class oP extends US{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qr.exports.EventEmitter,this.name=eM,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Ae.toMiliseconds(Ae.THIRTY_SECONDS+Ae.ONE_SECOND),this.request=async t=>{var i,n;this.logger.debug("Publishing Request Payload");const s=t.id||Lo().toString();await this.toEstablishConnection();try{const a=this.provider.request(t);this.requestsInFlight.set(s,{promise:a,request:t}),this.logger.trace({id:s,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const f=await new Promise(async(h,u)=>{const g=()=>{u(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(nn.disconnect,g);const w=await a;this.provider.off(nn.disconnect,g),h(w)});return this.logger.trace({id:s,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - published"),f}catch(a){throw this.logger.debug(`Failed to Publish Request: ${s}`),a}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Ul())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,n;(n=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(fi.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(fi.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(nn.payload,this.onPayloadHandler),this.provider.on(nn.connect,this.onConnectHandler),this.provider.on(nn.disconnect,this.onDisconnectHandler),this.provider.on(nn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ai(e.logger,this.name):Qn(eh({level:e.logger||XI})),this.messages=new GC(this.logger,e.core),this.subscriber=new rP(this,this.logger),this.publisher=new YC(this,this.logger),this.relayUrl=e?.relayUrl||a2,this.projectId=e.projectId,this.bundleId=Kx(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return yi(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:sr.relay})}async subscribe(e,t){var i,n,s;this.isInitialized(),t?.transportType==="relay"&&await this.toEstablishConnection();const a=typeof((i=t?.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(n=t?.internal)==null?void 0:n.throwOnFailedPublish;let f=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",h;const u=g=>{g.topic===e&&(this.subscriber.off(ts.created,u),h())};return await Promise.all([new Promise(g=>{h=g,this.subscriber.on(ts.created,u)}),new Promise(async(g,w)=>{f=await this.subscriber.subscribe(e,D2({internal:{throwOnFailedPublish:a}},t)).catch(P=>{a&&w(P)})||f,g()})]),f}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Ua(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const n=()=>{this.provider.off(nn.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(nn.disconnect,n),await Ua(this.provider.connect(),Ae.toMiliseconds(Ae.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{i(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Eb())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const n=Ir(Ae.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(fi.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,i,n,s;if(Ul())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(a){this.logger.warn(a)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new rn(new FI(Jx({sdkVersion:w0,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),v0(e)){if(!e.method.endsWith(tM))return;const t=e.params,{topic:i,message:n,publishedAt:s,attestation:a}=t.data,f={topic:i,message:n,publishedAt:s,transportType:sr.relay,attestation:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(D2({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(e),await this.onMessageEvent(f)}else ih(e)&&this.events.emit(fi.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(fi.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=th(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(nn.payload,this.onPayloadHandler),this.provider.off(nn.connect,this.onConnectHandler),this.provider.off(nn.disconnect,this.onDisconnectHandler),this.provider.off(nn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Eb();ME(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(fi.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Ae.toMiliseconds(rM))))}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var aP=Object.defineProperty,O2=Object.getOwnPropertySymbols,cP=Object.prototype.hasOwnProperty,fP=Object.prototype.propertyIsEnumerable,R2=(r,e,t)=>e in r?aP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,T2=(r,e)=>{for(var t in e||(e={}))cP.call(e,t)&&R2(r,t,e[t]);if(O2)for(var t of O2(e))fP.call(e,t)&&R2(r,t,e[t]);return r};class qo extends qS{constructor(e,t,i,n=es,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=iM,this.cached=[],this.initialized=!1,this.storagePrefix=es,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(a=>{this.getKey&&a!==null&&!oi(a)?this.map.set(this.getKey(a),a):nE(a)?this.map.set(a.id,a):sE(a)&&this.map.set(a.topic,a)}),this.cached=[],this.initialized=!0)},this.set=async(a,f)=>{this.isInitialized(),this.map.has(a)?await this.update(a,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:a,value:f}),this.map.set(a,f),await this.persist())},this.get=a=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:a}),this.getData(a)),this.getAll=a=>(this.isInitialized(),a?this.values.filter(f=>Object.keys(a).every(h=>UI(f[h],a[h]))):this.values),this.update=async(a,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:a,update:f});const h=T2(T2({},this.getData(a)),f);this.map.set(a,h),await this.persist()},this.delete=async(a,f)=>{this.isInitialized(),this.map.has(a)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:a,reason:f}),this.map.delete(a),this.addToRecentlyDeleted(a),await this.persist())},this.logger=ai(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:n}=_e("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class lP{constructor(e,t){this.core=e,this.logger=t,this.name=cM,this.version=fM,this.events=new qr.exports,this.initialized=!1,this.storagePrefix=es,this.ignoredPayloadTypes=[ys],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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=Zd(),s=await this.core.crypto.setSymKey(n),a=Ir(Ae.FIVE_MINUTES),f={protocol:o2},h={topic:s,expiry:a,relay:f,active:!1,methods:i?.methods},u=vb({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:f,expiryTimestamp:a,methods:i?.methods});return this.events.emit(Bo.create,h),this.core.expirer.set(s,a),await this.pairings.set(s,h),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:u}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[rs.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:a,relay:f,expiryTimestamp:h,methods:u}=gb(i.uri);n.props.properties.topic=s,n.addTrace(rs.pairing_uri_validation_success),n.addTrace(rs.pairing_uri_not_expired);let g;if(this.pairings.keys.includes(s)){if(g=this.pairings.get(s),n.addTrace(rs.existing_pairing),g.active)throw n.setError(Es.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(rs.pairing_not_expired)}const w=h||Ir(Ae.FIVE_MINUTES),P={topic:s,relay:f,expiry:w,active:!1,methods:u};this.core.expirer.set(s,w),await this.pairings.set(s,P),n.addTrace(rs.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(Bo.create,P),n.addTrace(rs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(a,s),n.addTrace(rs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(Es.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:f})}catch(M){throw n.setError(Es.subscribe_pairing_topic_failure),M}return n.addTrace(rs.subscribe_pairing_topic_success),P},this.activate=async({topic:i})=>{this.isInitialized();const n=Ir(Ae.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:a,resolve:f,reject:h}=Oo();this.events.once(Dt("pairing_ping",s),({error:u})=>{u?h(u):f()}),await a()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",Gt("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:s,expiry:a,methods:f}=i,h=this.core.crypto.keychain.get(n);return vb({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:h,relay:s,expiryTimestamp:a,methods:f})},this.sendRequest=async(i,n,s)=>{const a=Ys(n,s),f=await this.core.crypto.encode(i,a),h=ff[n].req;return this.core.history.set(i,a),this.core.relayer.publish(i,f,h),a.id},this.sendResult=async(i,n,s)=>{const a=th(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=ff[h.request.method].res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.sendError=async(i,n,s)=>{const a=rh(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=ff[h.request.method]?ff[h.request.method].res:ff.unregistered_method.res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Gt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Ks(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:s}=i,a=(await this.core.history.get(n,s.id)).request.method;switch(a){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(a)}},this.onPairingPingRequest=async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(Bo.ping,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onPairingPingResponse=(i,n)=>{const{id:s}=n;setTimeout(()=>{Xn(n)?this.events.emit(Dt("pairing_ping",s),{}):tn(n)&&this.events.emit(Dt("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(Bo.delete,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:s,method:a}=n;try{if(this.registeredMethods.includes(a))return;const f=Gt("WC_METHOD_UNSUPPORTED",a);await this.sendError(s,i,f),this.logger.error(f)}catch(f){await this.sendError(s,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Gt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!bi(i)){const{message:f}=_e("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(Es.malformed_pairing_uri),new Error(f)}if(!iE(i.uri)){const{message:f}=_e("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(Es.malformed_pairing_uri),new Error(f)}const a=gb(i?.uri);if(!((s=a?.relay)!=null&&s.protocol)){const{message:f}=_e("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(Es.malformed_pairing_uri),new Error(f)}if(!(a!=null&&a.symKey)){const{message:f}=_e("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(Es.malformed_pairing_uri),new Error(f)}if(a!=null&&a.expiryTimestamp&&Ae.toMiliseconds(a?.expiryTimestamp)<Date.now()){n.setError(Es.pairing_expired);const{message:f}=_e("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(f)}},this.isValidPing=async i=>{if(!bi(i)){const{message:s}=_e("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!bi(i)){const{message:s}=_e("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!wr(i,!1)){const{message:n}=_e("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=_e("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Ks(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=_e("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=ai(t,this.name),this.pairings=new qo(this.core,this.logger,this.name,this.storagePrefix)}get context(){return yi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(fi.message,async e=>{const{topic:t,message:i,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===sr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{v0(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):ih(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(sn.expired,async e=>{const{topic:t}=Vm(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Bo.expire,{topic:t}))})}}class hP extends LS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new qr.exports.EventEmitter,this.name=lM,this.version=hM,this.cached=[],this.initialized=!1,this.storagePrefix=es,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const a={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:Ir(Ae.THIRTY_DAYS)};this.records.set(a.id,a),this.persist(),this.events.emit(An.created,a)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=tn(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(An.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(An.deleted,s)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ai(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Ys(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(An.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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(An.created,e=>{const t=An.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(An.updated,e=>{const t=An.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(An.deleted,e=>{const t=An.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(za.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{Ae.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(An.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class uP extends HS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new qr.exports.EventEmitter,this.name=uM,this.version=dM,this.cached=[],this.initialized=!1,this.storagePrefix=es,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const s=this.formatTarget(i),a={target:s,expiry:n};this.expirations.set(s,a),this.checkExpiry(s,a),this.events.emit(sn.created,{target:s,expiration:a})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(sn.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ai(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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 Qx(e);if(typeof e=="number")return Zx(e);const{message:t}=_e("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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(sn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=_e("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=_e("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;Ae.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(sn.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(za.pulse,()=>this.checkExpirations()),this.events.on(sn.created,e=>{const t=sn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(sn.expired,e=>{const t=sn.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(sn.deleted,e=>{const t=sn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}}class dP extends kS{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=pM,this.verifyUrlV3=vM,this.storagePrefix=es,this.version=n2,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Ae.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async n=>{if(!jc()||this.isDevEnv)return;const s=window.location.origin,{id:a,decryptedId:f}=n,h=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${a}&decryptedId=${f}`;try{const u=Dc(),g=this.startAbortTimer(Ae.ONE_SECOND*5),w=await new Promise((P,M)=>{const O=()=>{window.removeEventListener("message",W),u.body.removeChild($),M("attestation aborted")};this.abortController.signal.addEventListener("abort",O);const $=u.createElement("iframe");$.src=h,$.style.display="none",$.addEventListener("error",O,{signal:this.abortController.signal});const W=H=>{if(H.data&&typeof H.data=="string")try{const F=JSON.parse(H.data);if(F.type==="verify_attestation"){if(Vd(F.attestation).payload.id!==a)return;clearInterval(g),u.body.removeChild($),this.abortController.signal.removeEventListener("abort",O),window.removeEventListener("message",W),P(F.attestation===null?"":F.attestation)}}catch(F){this.logger.warn(F)}};u.body.appendChild($),window.addEventListener("message",W,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(u){this.logger.warn(u)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:a,encryptedId:f}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Vd(s).payload.id!==f)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!a)return;const h=this.getVerifyUrl(n?.verifyUrl);return this.fetchAttestation(a,h)},this.fetchAttestation=async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const a=this.startAbortTimer(Ae.ONE_SECOND*5),f=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(a),f.status===200?await f.json():void 0},this.getVerifyUrl=n=>{let s=n||lf;return mM.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${lf}`),s=lf),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(Ae.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}const a=await this.fetchAndPersistPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const a=await this.fetchPublicKey();a&&(await this.persistPublicKey(a),s(a))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,s)=>{const a=FA(n,s.publicKey),f={hasExpired:Ae.toMiliseconds(a.exp)<Date.now(),payload:a};if(f.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:f.payload.origin,isScam:f.payload.isScam,isVerified:f.payload.isVerified}},this.logger=ai(t,this.name),this.abortController=new AbortController,this.isDevEnv=Gd(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return yi(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Ae.toMiliseconds(e))}}class pP extends jS{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=bM,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:a,enableEncrypted:f=!1}=i,h=`${wM}/${this.projectId}/clients`;await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:a,token:s,always_raw:f})})},this.logger=ai(t,this.context)}}var gP=Object.defineProperty,$2=Object.getOwnPropertySymbols,vP=Object.prototype.hasOwnProperty,mP=Object.prototype.propertyIsEnumerable,N2=(r,e,t)=>e in r?gP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pf=(r,e)=>{for(var t in e||(e={}))vP.call(e,t)&&N2(r,t,e[t]);if($2)for(var t of $2(e))mP.call(e,t)&&N2(r,t,e[t]);return r};class bP extends WS{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=_M,this.storagePrefix=es,this.storageVersion=yM,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!Gd())try{const n={eventId:Ym(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:km(this.core.relayer.protocol,this.core.relayer.version,w0)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:a="",properties:{topic:f,trace:h}}=n,u=Ym(),g=this.core.projectId||"",w=Date.now(),P=pf({eventId:u,timestamp:w,props:{event:s,type:a,properties:{topic:f,trace:h}},bundleId:g,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,P),this.shouldPersist=!0),P},this.getEvent=n=>{const{eventId:s,topic:a}=n;if(s)return this.events.get(s);const f=Array.from(this.events.values()).find(h=>h.props.properties.topic===a);if(f)return pf(pf({},f),this.setMethods(f.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(za.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{Ae.fromMiliseconds(Date.now())-Ae.fromMiliseconds(n.timestamp)>xM&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)}),this.addTrace=(n,s)=>{const a=this.events.get(n);a&&(a.props.properties.trace.push(s),this.events.set(n,a),this.shouldPersist=!0)},this.setError=(n,s)=>{const a=this.events.get(n);a&&(a.props.type=s,a.timestamp=Date.now(),this.events.set(n,a),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,pf(pf({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,a]of this.events)a.props.type&&n.push(a);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${AM}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${w0}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>Hm().url,this.logger=ai(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var wP=Object.defineProperty,L2=Object.getOwnPropertySymbols,yP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,B2=(r,e,t)=>e in r?wP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F2=(r,e)=>{for(var t in e||(e={}))yP.call(e,t)&&B2(r,t,e[t]);if(L2)for(var t of L2(e))_P.call(e,t)&&B2(r,t,e[t]);return r};class E0 extends NS{constructor(e){var t;super(e),this.protocol=i2,this.version=n2,this.name=b0,this.events=new qr.exports.EventEmitter,this.initialized=!1,this.on=(a,f)=>this.events.on(a,f),this.once=(a,f)=>this.events.once(a,f),this.off=(a,f)=>this.events.off(a,f),this.removeListener=(a,f)=>this.events.removeListener(a,f),this.dispatchEnvelope=({topic:a,message:f,sessionExists:h})=>{if(!a||!f)return;const u={topic:a,message:f,publishedAt:Date.now(),transportType:sr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:h})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||a2,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=eh({level:typeof e?.logger=="string"&&e.logger?e.logger:kI.logger}),{logger:n,chunkLoggerController:s}=$S({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,f;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((f=this.logChunkController)==null||f.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ai(n,this.name),this.heartbeat=new n0,this.crypto=new VC(this,this.logger,e?.keychain),this.history=new hP(this,this.logger),this.expirer=new uP(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new oS(F2(F2({},jI),e?.storageOptions)),this.relayer=new oP({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new lP(this,this.logger),this.verify=new dP(this,this.logger,this.storage),this.echoClient=new pP(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new bP(this,this.logger,e?.telemetryEnabled)}static async init(e){const t=new E0(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(nM,i),t}get context(){return yi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(c2,this.linkModeSupportedApps))}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.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(c2)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const xP=E0,U2="wc",q2=2,z2="client",S0=`${U2}@${q2}:${z2}:`,I0={name:z2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},H2="WALLETCONNECT_DEEPLINK_CHOICE",AP="proposal",k2="Proposal expired",EP="session",ja=Ae.SEVEN_DAYS,SP="engine",Lr={wc_sessionPropose:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Ae.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Ae.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Ae.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Ae.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Ae.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Ae.FIVE_MINUTES,prompt:!1,tag:1119}}},M0={min:Ae.FIVE_MINUTES,max:Ae.SEVEN_DAYS},is={idle:"IDLE",active:"ACTIVE"},IP="request",MP=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],CP="wc",PP="auth",DP="authKeys",OP="pairingTopics",RP="requests",sh=`${CP}@${1.5}:${PP}:`,oh=`${sh}:PUB_KEY`;var TP=Object.defineProperty,$P=Object.defineProperties,NP=Object.getOwnPropertyDescriptors,j2=Object.getOwnPropertySymbols,LP=Object.prototype.hasOwnProperty,BP=Object.prototype.propertyIsEnumerable,W2=(r,e,t)=>e in r?TP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pr=(r,e)=>{for(var t in e||(e={}))LP.call(e,t)&&W2(r,t,e[t]);if(j2)for(var t of j2(e))BP.call(e,t)&&W2(r,t,e[t]);return r},Sn=(r,e)=>$P(r,NP(e));class FP extends VS{constructor(e){super(e),this.name=SP,this.events=new qr.exports,this.initialized=!1,this.requestQueue={state:is.idle,queue:[]},this.sessionRequestQueue={state:is.idle,queue:[]},this.requestQueueDelay=Ae.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Lr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Sn(pr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:f,relays:h}=i;let u=n,g,w=!1;try{u&&(w=this.client.core.pairing.pairings.get(u).active)}catch(B){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),B}if(!u||!w){const{topic:B,uri:z}=await this.client.core.pairing.create();u=B,g=z}if(!u){const{message:B}=_e("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(B)}const P=await this.client.core.crypto.generateKeyPair(),M=Lr.wc_sessionPropose.req.ttl||Ae.FIVE_MINUTES,O=Ir(M),$=pr({requiredNamespaces:s,optionalNamespaces:a,relays:h??[{protocol:o2}],proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:O,pairingTopic:u},f&&{sessionProperties:f}),{reject:W,resolve:H,done:F}=Oo(M,k2);this.events.once(Dt("session_connect"),async({error:B,session:z})=>{if(B)W(B);else if(z){z.self.publicKey=P;const j=Sn(pr({},z),{pairingTopic:$.pairingTopic,requiredNamespaces:$.requiredNamespaces,optionalNamespaces:$.optionalNamespaces,transportType:sr.relay});await this.client.session.set(z.topic,j),await this.setExpiry(z.topic,z.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:z.peer.metadata}),this.cleanupDuplicatePairings(j),H(j)}});const Y=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:$,throwOnFailedPublish:!0});return await this.setProposal(Y,pr({id:Y},$)),{uri:g,approval:F}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,n,s;const a=this.client.core.eventClient.createEvent({properties:{topic:(i=t?.id)==null?void 0:i.toString(),trace:[En.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(U){throw a.setError(Fo.no_internet_connection),U}try{await this.isValidProposalId(t?.id)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${t?.id}) failed`),a.setError(Fo.proposal_not_found),U}try{await this.isValidApprove(t)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),a.setError(Fo.session_approve_namespace_validation_failure),U}const{id:f,relayProtocol:h,namespaces:u,sessionProperties:g,sessionConfig:w}=t,P=this.client.proposal.get(f);this.client.core.eventClient.deleteEvent({eventId:a.eventId});const{pairingTopic:M,proposer:O,requiredNamespaces:$,optionalNamespaces:W}=P;let H=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:M});H||(H=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:En.session_approve_started,properties:{topic:M,trace:[En.session_approve_started,En.session_namespaces_validation_success]}}));const F=await this.client.core.crypto.generateKeyPair(),Y=O.publicKey,B=await this.client.core.crypto.generateSharedKey(F,Y),z=pr(pr({relay:{protocol:h??"irn"},namespaces:u,controller:{publicKey:F,metadata:this.client.metadata},expiry:Ir(ja)},g&&{sessionProperties:g}),w&&{sessionConfig:w}),j=sr.relay;H.addTrace(En.subscribing_session_topic);try{await this.client.core.relayer.subscribe(B,{transportType:j})}catch(U){throw H.setError(Fo.subscribe_session_topic_failure),U}H.addTrace(En.subscribe_session_topic_success);const _=Sn(pr({},z),{topic:B,requiredNamespaces:$,optionalNamespaces:W,pairingTopic:M,acknowledged:!1,self:z.controller,peer:{publicKey:O.publicKey,metadata:O.metadata},controller:F,transportType:sr.relay});await this.client.session.set(B,_),H.addTrace(En.store_session);try{H.addTrace(En.publishing_session_settle),await this.sendRequest({topic:B,method:"wc_sessionSettle",params:z,throwOnFailedPublish:!0}).catch(U=>{throw H?.setError(Fo.session_settle_publish_failure),U}),H.addTrace(En.session_settle_publish_success),H.addTrace(En.publishing_session_approve),await this.sendResult({id:f,topic:M,result:{relay:{protocol:h??"irn"},responderPublicKey:F},throwOnFailedPublish:!0}).catch(U=>{throw H?.setError(Fo.session_approve_publish_failure),U}),H.addTrace(En.session_approve_publish_success)}catch(U){throw this.client.logger.error(U),this.client.session.delete(B,Gt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(B),U}return this.client.core.eventClient.deleteEvent({eventId:H.eventId}),await this.client.core.pairing.updateMetadata({topic:M,metadata:O.metadata}),await this.client.proposal.delete(f,Gt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:M}),await this.setExpiry(B,Ir(ja)),{topic:B,acknowledged:()=>Promise.resolve(this.client.session.get(B))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(a){throw this.client.logger.error("reject() -> isValidReject() failed"),a}const{id:i,reason:n}=t;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(a){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),a}s&&(await this.sendError({id:i,topic:s,error:n,rpcOpts:Lr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=t,{done:s,resolve:a,reject:f}=Oo(),h=Gs(),u=Lo().toString(),g=this.client.session.get(i).namespaces;return this.events.once(Dt("session_update",h),({error:w})=>{w?f(w):a()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:h,relayRpcId:u}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:g}),f(w)}),{acknowledged:s}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(h){throw this.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=t,n=Gs(),{done:s,resolve:a,reject:f}=Oo();return this.events.once(Dt("session_extend",n),({error:h})=>{h?f(h):a()}),await this.setExpiry(i,Ir(ja)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(h=>{f(h)}),{acknowledged:s}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(O){throw this.client.logger.error("request() -> isValidRequest() failed"),O}const{chainId:i,request:n,topic:s,expiry:a=Lr.wc_sessionRequest.req.ttl}=t,f=this.client.session.get(s);f?.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const h=Gs(),u=Lo().toString(),{done:g,resolve:w,reject:P}=Oo(a,"Request expired. Please try again.");this.events.once(Dt("session_request",h),({error:O,result:$})=>{O?P(O):w($)});const M=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);return M?(await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:Sn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0,appLink:M}).catch(O=>P(O)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),await g()):await Promise.all([new Promise(async O=>{await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:Sn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0}).catch($=>P($)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),O()}),new Promise(async O=>{var $;if(!(($=f.sessionConfig)!=null&&$.disableDeepLink)){const W=await tA(this.client.core.storage,H2);await Xx({id:h,topic:s,wcDeepLink:W})}O()}),g()]).then(O=>O[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:n}=t,{id:s}=n,a=this.client.session.get(i);a.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const f=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);Xn(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:f}):tn(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:f}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=t;if(this.client.session.keys.includes(i)){const n=Gs(),s=Lo().toString(),{done:a,resolve:f,reject:h}=Oo();this.events.once(Dt("session_ping",n),({error:u})=>{u?h(u):f()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),a()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:n,chainId:s}=t,a=Lo().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:a})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Gt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=_e("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>tE(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(t);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),a=s?sr.link_mode:sr.relay;a===sr.relay&&await this.confirmOnlineStateOrThrow();const{chains:f,statement:h="",uri:u,domain:g,nonce:w,type:P,exp:M,nbf:O,methods:$=[],expiry:W}=t,H=[...t.resources||[]],{topic:F,uri:Y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:F,uri:Y}});const B=await this.client.core.crypto.generateKeyPair(),z=kl(B);if(await Promise.all([this.client.auth.authKeys.set(oh,{responseTopic:z,publicKey:B}),this.client.auth.pairingTopics.set(z,{topic:z,pairingTopic:F})]),await this.client.core.relayer.subscribe(z,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${F}`),$.length>0){const{namespace:D}=Ba(f[0]);let S=xA(D,"request",$);Hl(H)&&(S=EA(S,H.pop())),H.push(S)}const j=W&&W>Lr.wc_sessionAuthenticate.req.ttl?W:Lr.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:P??"caip122",chains:f,statement:h,aud:u,domain:g,version:"1",nonce:w,iat:new Date().toISOString(),exp:M,nbf:O,resources:H},requester:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:Ir(j)},U={eip155:{chains:f,methods:[...new Set(["personal_sign",...$])],events:["chainChanged","accountsChanged"]}},ee={requiredNamespaces:{},optionalNamespaces:U,relays:[{protocol:"irn"}],pairingTopic:F,proposer:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:Ir(Lr.wc_sessionPropose.req.ttl)},{done:oe,resolve:L,reject:b}=Oo(j,"Request expired"),m=async({error:D,session:S})=>{if(this.events.off(Dt("session_request",d),l),D)b(D);else if(S){S.self.publicKey=B,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:S.peer.metadata});const v=this.client.session.get(S.topic);await this.deleteProposal(y),L({session:v})}},l=async D=>{var S,v,A;if(await this.deletePendingAuthRequest(d,{message:"fulfilled",code:0}),D.error){const J=Gt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return D.error.code===J.code?void 0:(this.events.off(Dt("session_connect"),m),b(D.error.message))}await this.deleteProposal(y),this.events.off(Dt("session_connect"),m);const{cacaos:x,responder:N}=D.result,ae=[],R=[];for(const J of x){await Xm({cacao:J,projectId:this.client.core.projectId})||(this.client.logger.error(J,"Signature verification failed"),b(Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:K}=J,E=Hl(K.resources),G=[Jd(K.iss)],re=zl(K.iss);if(E){const le=rb(E),he=ib(E);ae.push(...le),G.push(...he)}for(const le of G)R.push(`${le}:${re}`)}const X=await this.client.core.crypto.generateSharedKey(B,N.publicKey);let V;ae.length>0&&(V={topic:X,acknowledged:!0,self:{publicKey:B,metadata:this.client.metadata},peer:N,controller:N.publicKey,expiry:Ir(ja),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:F,namespaces:mb([...new Set(ae)],[...new Set(R)]),transportType:a},await this.client.core.relayer.subscribe(X,{transportType:a}),await this.client.session.set(X,V),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:N.metadata}),V=this.client.session.get(X)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(v=N.metadata.redirect)!=null&&v.linkMode&&(A=N.metadata.redirect)!=null&&A.universal&&i&&(this.client.core.addLinkModeSupportedApp(N.metadata.redirect.universal),this.client.session.update(X,{transportType:sr.link_mode})),L({auths:x,session:V})},d=Gs(),y=Gs();this.events.once(Dt("session_connect"),m),this.events.once(Dt("session_request",d),l);let C;try{if(s){const D=Ys("wc_sessionAuthenticate",_,d);this.client.core.history.set(F,D);const S=await this.client.core.crypto.encode("",D,{type:Yc,encoding:Vc});C=jl(i,F,S)}else await Promise.all([this.sendRequest({topic:F,method:"wc_sessionAuthenticate",params:_,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:d}),this.sendRequest({topic:F,method:"wc_sessionPropose",params:ee,expiry:Lr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:y})])}catch(D){throw this.events.off(Dt("session_connect"),m),this.events.off(Dt("session_request",d),l),D}return await this.setProposal(y,pr({id:y},ee)),await this.setAuthRequest(d,{request:Sn(pr({},_),{verifyContext:{}}),pairingTopic:F,transportType:a}),{uri:C??Y,response:oe}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:n}=t,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Uo.authenticated_session_approve_started]}});try{this.isInitialized()}catch(W){throw s.setError(hf.no_internet_connection),W}const a=this.getPendingAuthRequest(i);if(!a)throw s.setError(hf.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const f=a.transportType||sr.relay;f===sr.relay&&await this.confirmOnlineStateOrThrow();const h=a.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),g=kl(h),w={type:ys,receiverPublicKey:h,senderPublicKey:u},P=[],M=[];for(const W of n){if(!await Xm({cacao:W,projectId:this.client.core.projectId})){s.setError(hf.invalid_cacao);const z=Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:g,error:z,encodeOpts:w}),new Error(z.message)}s.addTrace(Uo.cacaos_verified);const{p:H}=W,F=Hl(H.resources),Y=[Jd(H.iss)],B=zl(H.iss);if(F){const z=rb(F),j=ib(F);P.push(...z),Y.push(...j)}for(const z of Y)M.push(`${z}:${B}`)}const O=await this.client.core.crypto.generateSharedKey(u,h);s.addTrace(Uo.create_authenticated_session_topic);let $;if(P?.length>0){$={topic:O,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:h,metadata:a.requester.metadata},controller:h,expiry:Ir(ja),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:a.pairingTopic,namespaces:mb([...new Set(P)],[...new Set(M)]),transportType:f},s.addTrace(Uo.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(O,{transportType:f})}catch(W){throw s.setError(hf.subscribe_authenticated_session_topic_failure),W}s.addTrace(Uo.subscribe_authenticated_session_topic_success),await this.client.session.set(O,$),s.addTrace(Uo.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:a.pairingTopic,metadata:a.requester.metadata})}s.addTrace(Uo.publishing_authenticated_session_approve);try{await this.sendResult({topic:g,id:i,result:{cacaos:n,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(a.requester.metadata,f)})}catch(W){throw s.setError(hf.authenticated_session_approve_publish_failure),W}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:a.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:$}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:n}=t,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const a=s.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),h=kl(a),u={type:ys,receiverPublicKey:a,senderPublicKey:f};await this.sendError({id:i,topic:h,error:n,encodeOpts:u,rpcOpts:Lr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:n}=t;return eb(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var a,f;return((a=s.peerMetadata)==null?void 0:a.url)&&((f=s.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&s.topic&&s.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:a=!0,id:f=0}=t,{self:h}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Gt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(h.publicKey)&&await this.client.core.crypto.deleteKeyPair(h.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(H2).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===n&&this.deletePendingSessionRequest(u.id,Gt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=is.idle),a&&this.client.events.emit("session_delete",{id:f,topic:n})},this.deleteProposal=async(t,i)=>{if(i)try{const n=this.client.proposal.get(t),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(Fo.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,Gt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==t),n&&(this.sessionRequestQueue.state=is.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,Ir(Lr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:n,pairingTopic:s,transportType:a=sr.relay}=i;this.client.core.expirer.set(t,n.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:t,pairingTopic:s,verifyContext:n.verifyContext,transportType:a})},this.setPendingSessionRequest=async t=>{const{id:i,topic:n,params:s,verifyContext:a}=t,f=s.request.expiryTimestamp||Ir(Lr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,f),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:a})},this.sendRequest=async t=>{const{topic:i,method:n,params:s,expiry:a,relayRpcId:f,clientRpcId:h,throwOnFailedPublish:u,appLink:g}=t,w=Ys(n,s,h);let P;const M=!!g;try{const W=M?Vc:Vs;P=await this.client.core.crypto.encode(i,w,{encoding:W})}catch(W){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),W}let O;if(MP.includes(n)){const W=_s(JSON.stringify(w)),H=_s(P);O=await this.client.core.verify.register({id:H,decryptedId:W})}const $=Lr[n].req;if($.attestation=O,a&&($.ttl=a),f&&($.id=f),this.client.core.history.set(i,w),M){const W=jl(g,i,P);await global.Linking.openURL(W,this.client.name)}else{const W=Lr[n].req;a&&(W.ttl=a),f&&(W.id=f),u?(W.internal=Sn(pr({},W.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,P,W)):this.client.core.relayer.publish(i,P,W).catch(H=>this.client.logger.error(H))}return w.id},this.sendResult=async t=>{const{id:i,topic:n,result:s,throwOnFailedPublish:a,encodeOpts:f,appLink:h}=t,u=th(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const M=w?Vc:Vs;g=await this.client.core.crypto.encode(n,u,Sn(pr({},f||{}),{encoding:M}))}catch(M){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),M}let P;try{P=await this.client.core.history.get(n,i)}catch(M){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),M}if(w){const M=jl(h,n,g);await global.Linking.openURL(M,this.client.name)}else{const M=Lr[P.request.method].res;a?(M.internal=Sn(pr({},M.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,g,M)):this.client.core.relayer.publish(n,g,M).catch(O=>this.client.logger.error(O))}await this.client.core.history.resolve(u)},this.sendError=async t=>{const{id:i,topic:n,error:s,encodeOpts:a,rpcOpts:f,appLink:h}=t,u=rh(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const M=w?Vc:Vs;g=await this.client.core.crypto.encode(n,u,Sn(pr({},a||{}),{encoding:M}))}catch(M){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),M}let P;try{P=await this.client.core.history.get(n,i)}catch(M){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),M}if(w){const M=jl(h,n,g);await global.Linking.openURL(M,this.client.name)}else{const M=f||Lr[P.request.method].res;this.client.core.relayer.publish(n,g,M)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Ks(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Ks(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===is.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=is.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=is.idle},this.processRequest=async t=>{const{topic:i,payload:n,attestation:s,transportType:a,encryptedId:f}=t,h=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:h}))switch(h){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:f});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});default:return this.client.logger.info(`Unsupported request method ${h}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:n,transportType:s}=t,a=(await this.client.core.history.get(i,n.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:n}=_e("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:n}=t,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:n,attestation:s,encryptedId:a}=t,{params:f,id:h}=n;try{const u=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(pr({},n.params));const g=f.expiryTimestamp||Ir(Lr.wc_sessionPropose.req.ttl),w=pr({id:h,pairingTopic:i,expiryTimestamp:g},f);await this.setProposal(h,w);const P=await this.getVerifyContext({attestationId:s,hash:_s(JSON.stringify(n)),encryptedId:a,metadata:w.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(Es.proposal_listener_not_found)),u?.addTrace(rs.emit_session_proposal),this.client.events.emit("session_proposal",{id:h,params:w,verifyContext:P})}catch(u){await this.sendError({id:h,topic:i,error:u,rpcOpts:Lr.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(t,i,n)=>{const{id:s}=i;if(Xn(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const f=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const h=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const u=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const g=await this.client.core.crypto.generateSharedKey(h,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:g});const w=await this.client.core.relayer.subscribe(g,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else if(tn(i)){await this.client.proposal.delete(s,Gt("USER_DISCONNECTED"));const a=Dt("session_connect");if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners, 954`);this.events.emit(Dt("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:a,controller:f,expiry:h,namespaces:u,sessionProperties:g,sessionConfig:w}=i.params,P=Sn(pr(pr({topic:t,relay:a,expiry:h,namespaces:u,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},g&&{sessionProperties:g}),w&&{sessionConfig:w}),{transportType:sr.relay}),M=Dt("session_connect");if(this.events.listenerCount(M)===0)throw new Error(`emitting ${M} without any listeners 997`);this.events.emit(Dt("session_connect"),{session:P}),await this.sendResult({id:i.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionSettleResponse=async(t,i)=>{const{id:n}=i;Xn(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(Dt("session_approve",n),{})):tn(i)&&(await this.client.session.delete(t,Gt("USER_DISCONNECTED")),this.events.emit(Dt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:n,id:s}=i;try{const a=`${t}_session_update`,f=tf.get(a);if(f&&this.isRequestOutOfSync(f,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:t,error:Gt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(pr({topic:t},n));try{tf.set(a,s),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0})}catch(h){throw tf.delete(a),h}this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(a){await this.sendError({id:s,topic:t,error:a}),this.client.logger.error(a)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:n}=i,s=Dt("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Xn(i)?this.events.emit(Dt("session_update",n),{}):tn(i)&&this.events.emit(Dt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Ir(ja)),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{const{id:n}=i,s=Dt("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Xn(i)?this.events.emit(Dt("session_extend",n),{}):tn(i)&&this.events.emit(Dt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{const{id:n}=i,s=Dt("session_ping",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Xn(i)?this.events.emit(Dt("session_ping",n),{}):tn(i)&&this.events.emit(Dt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(fi.publish,async()=>{s(await this.deleteSession({topic:t,id:n}))})}),this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Gt("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async t=>{var i,n,s;const{topic:a,payload:f,attestation:h,encryptedId:u,transportType:g}=t,{id:w,params:P}=f;try{await this.isValidRequest(pr({topic:a},P));const M=this.client.session.get(a),O=await this.getVerifyContext({attestationId:h,hash:_s(JSON.stringify(Ys("wc_sessionRequest",P,w))),encryptedId:u,metadata:M.peer.metadata,transportType:g}),$={id:w,topic:a,params:P,verifyContext:O};await this.setPendingSessionRequest($),g===sr.link_mode&&(i=M.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=M.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest($):(this.addSessionRequestToSessionRequestQueue($),this.processSessionRequestQueue())}catch(M){await this.sendError({id:w,topic:a,error:M}),this.client.logger.error(M)}},this.onSessionRequestResponse=(t,i)=>{const{id:n}=i,s=Dt("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Xn(i)?this.events.emit(Dt("session_request",n),{result:i.result}):tn(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:n,params:s}=i;try{const a=`${t}_session_event_${s.event.name}`,f=tf.get(a);if(f&&this.isRequestOutOfSync(f,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(pr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s}),tf.set(a,n)}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),Xn(i)?this.events.emit(Dt("session_request",n),{result:i.result}):tn(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:n,payload:s,attestation:a,encryptedId:f,transportType:h}=t;try{const{requester:u,authPayload:g,expiryTimestamp:w}=s.params,P=await this.getVerifyContext({attestationId:a,hash:_s(JSON.stringify(s)),encryptedId:f,metadata:u.metadata,transportType:h}),M={requester:u,pairingTopic:n,id:s.id,authPayload:g,verifyContext:P,expiryTimestamp:w};await this.setAuthRequest(s.id,{request:M,pairingTopic:n,transportType:h}),h===sr.link_mode&&(i=u.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:P})}catch(u){this.client.logger.error(u);const g=s.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),P=this.getAppLinkIfEnabled(s.params.requester.metadata,h),M={type:ys,receiverPublicKey:g,senderPublicKey:w};await this.sendError({id:s.id,topic:n,error:u,encodeOpts:M,rpcOpts:Lr.wc_sessionAuthenticate.autoReject,appLink:P})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=is.idle,this.processSessionRequestQueue()},Ae.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===t&&s.request.method==="wc_sessionRequest").forEach(s=>{const a=s.request.id,f=Dt("session_request",a);if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners`);this.events.emit(Dt("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===is.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=is.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Ys("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async t=>{if(!bi(t)){const{message:h}=_e("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(h)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:a,relays:f}=t;if(oi(i)||await this.isValidPairingTopic(i),!dE(f,!0)){const{message:h}=_e("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(h)}!oi(n)&&ef(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!oi(s)&&ef(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),oi(a)||this.validateSessionProps(a,"sessionProperties")},this.validateNamespaces=(t,i)=>{const n=uE(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!bi(t))throw new Error(_e("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:a}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const f=this.client.proposal.get(i),h=r0(n,"approve()");if(h)throw new Error(h.message);const u=xb(f.requiredNamespaces,n,"approve()");if(u)throw new Error(u.message);if(!wr(s,!0)){const{message:g}=_e("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(g)}oi(a)||this.validateSessionProps(a,"sessionProperties")},this.isValidReject=async t=>{if(!bi(t)){const{message:s}=_e("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}const{id:i,reason:n}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!gE(n)){const{message:s}=_e("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!bi(t)){const{message:u}=_e("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(u)}const{relay:i,controller:n,namespaces:s,expiry:a}=t;if(!yb(i)){const{message:u}=_e("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const f=oE(n,"onSessionSettleRequest()");if(f)throw new Error(f.message);const h=r0(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Ks(a)){const{message:u}=_e("EXPIRED","onSessionSettleRequest()");throw new Error(u)}},this.isValidUpdate=async t=>{if(!bi(t)){const{message:h}=_e("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(h)}const{topic:i,namespaces:n}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),a=r0(n,"update()");if(a)throw new Error(a.message);const f=xb(s.requiredNamespaces,n,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!bi(t)){const{message:n}=_e("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!bi(t)){const{message:h}=_e("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(h)}const{topic:i,request:n,chainId:s,expiry:a}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!_b(f,s)){const{message:h}=_e("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(h)}if(!vE(n)){const{message:h}=_e("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(h)}if(!wE(f,s,n.method)){const{message:h}=_e("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(h)}if(a&&!AE(a,M0)){const{message:h}=_e("MISSING_OR_INVALID",`request() expiry: ${a}. Expiry must be a number (in seconds) between ${M0.min} and ${M0.max}`);throw new Error(h)}},this.isValidRespond=async t=>{var i;if(!bi(t)){const{message:a}=_e("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(a)}const{topic:n,response:s}=t;try{await this.isValidSessionTopic(n)}catch(a){throw(i=t?.response)!=null&&i.id&&this.cleanupAfterResponse(t),a}if(!mE(s)){const{message:a}=_e("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidPing=async t=>{if(!bi(t)){const{message:n}=_e("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!bi(t)){const{message:f}=_e("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!_b(a,s)){const{message:f}=_e("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(f)}if(!bE(n)){const{message:f}=_e("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}if(!yE(a,s,n.name)){const{message:f}=_e("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!bi(t)){const{message:n}=_e("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:n,domain:s,nonce:a}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!wr(n,!1))throw new Error("uri is required parameter");if(!wr(s,!1))throw new Error("domain is required parameter");if(!wr(a,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>Ba(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:f}=Ba(i[0]);if(f!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:n,encryptedId:s,metadata:a,transportType:f}=t,h={verified:{verifyUrl:a.verifyUrl||lf,validation:"UNKNOWN",origin:a.url||""}};try{if(f===sr.link_mode){const g=this.getAppLinkIfEnabled(a,f);return h.verified.validation=g&&new URL(g).origin===new URL(a.url).origin?"VALID":"INVALID",h}const u=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:a.verifyUrl});u&&(h.verified.origin=u.origin,h.verified.isScam=u.isScam,h.verified.validation=u.origin===new URL(a.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!wr(n,!1)){const{message:s}=_e("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const a of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(a)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:n}=_e("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(n)}},this.isLinkModeEnabled=(t,i)=>{var n,s,a,f,h,u,g,w,P;return!t||i!==sr.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((f=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:f.universal)!==void 0&&((u=(h=this.client.metadata)==null?void 0:h.redirect)==null?void 0:u.universal)!==""&&((g=t?.redirect)==null?void 0:g.universal)!==void 0&&((w=t?.redirect)==null?void 0:w.universal)!==""&&((P=t?.redirect)==null?void 0:P.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var n;return this.isLinkModeEnabled(t,i)?(n=t?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=Gm(t,"topic")||"",n=decodeURIComponent(Gm(t,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:sr.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var t;if(Gd()||Fa()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=_e("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(fi.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:n,transportType:s}=e,{publicKey:a}=this.client.auth.authKeys.keys.includes(oh)?this.client.auth.authKeys.get(oh):{responseTopic:void 0,publicKey:void 0},f=await this.client.core.crypto.decode(t,i,{receiverPublicKey:a,encoding:s===sr.link_mode?Vc:Vs});try{v0(f)?(this.client.core.history.set(t,f),this.onRelayEventRequest({topic:t,payload:f,attestation:n,transportType:s,encryptedId:_s(i)})):ih(f)?(await this.client.core.history.resolve(f),await this.onRelayEventResponse({topic:t,payload:f,transportType:s}),this.client.core.history.delete(t,f.id)):this.onRelayEventUnknownPayload({topic:t,payload:f,transportType:s})}catch(h){this.client.logger.error(h)}}registerExpirerEvents(){this.client.core.expirer.on(sn.expired,async e=>{const{topic:t,id:i}=Vm(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,_e("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,_e("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(Bo.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Bo.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!wr(e,!1)){const{message:t}=_e("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=_e("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Ks(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=_e("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!wr(e,!1)){const{message:t}=_e("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=_e("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Ks(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=_e("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=_e("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),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(wr(e,!1)){const{message:t}=_e("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=_e("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!pE(e)){const{message:t}=_e("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=_e("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Ks(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=_e("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class UP extends qo{constructor(e,t){super(e,t,AP,S0),this.core=e,this.logger=t}}class qP extends qo{constructor(e,t){super(e,t,EP,S0),this.core=e,this.logger=t}}class zP extends qo{constructor(e,t){super(e,t,IP,S0,i=>i.id),this.core=e,this.logger=t}}class HP extends qo{constructor(e,t){super(e,t,DP,sh,()=>oh),this.core=e,this.logger=t}}class kP extends qo{constructor(e,t){super(e,t,OP,sh),this.core=e,this.logger=t}}class jP extends qo{constructor(e,t){super(e,t,RP,sh,i=>i.id),this.core=e,this.logger=t}}class WP{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new HP(this.core,this.logger),this.pairingTopics=new kP(this.core,this.logger),this.requests=new jP(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class C0 extends KS{constructor(e){super(e),this.protocol=U2,this.version=q2,this.name=I0.name,this.events=new qr.exports.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||I0.name,this.metadata=e?.metadata||Hm(),this.signConfig=e?.signConfig;const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qn(eh({level:e?.logger||I0.logger}));this.core=e?.core||new xP(e),this.logger=ai(t,this.name),this.session=new qP(this.core,this.logger),this.proposal=new UP(this.core,this.logger),this.pendingRequest=new zP(this.core,this.logger),this.engine=new FP(this),this.auth=new WP(this.core,this.logger)}static async init(e){const t=new C0(e);return await t.initialize(),t}get context(){return yi(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.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var P0={exports:{}};/**
44
44
  * @license
45
45
  * Lodash <https://lodash.com/>
46
46
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
47
47
  * Released under MIT license <https://lodash.com/license>
48
48
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
49
49
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
50
- */(function(r,e){(function(){var t,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",f="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",u=500,g="__lodash_placeholder__",w=1,P=2,M=4,O=1,$=2,W=1,k=2,F=4,Y=8,B=16,z=32,j=64,_=128,U=256,ee=512,oe=30,L="...",b=800,m=16,l=1,d=2,y=3,C=1/0,D=9007199254740991,S=17976931348623157e292,v=0/0,A=4294967295,x=A-1,N=A>>>1,ae=[["ary",_],["bind",W],["bindKey",k],["curry",Y],["curryRight",B],["flip",ee],["partial",z],["partialRight",j],["rearg",U]],R="[object Arguments]",X="[object Array]",V="[object AsyncFunction]",J="[object Boolean]",K="[object Date]",E="[object DOMException]",G="[object Error]",re="[object Function]",le="[object GeneratorFunction]",he="[object Map]",ge="[object Number]",ke="[object Null]",Te="[object Object]",Ce="[object Promise]",Xe="[object Proxy]",$e="[object RegExp]",be="[object Set]",Pe="[object String]",De="[object Symbol]",ye="[object Undefined]",Ie="[object WeakMap]",Oe="[object WeakSet]",me="[object ArrayBuffer]",Me="[object DataView]",Be="[object Float32Array]",we="[object Float64Array]",He="[object Int8Array]",We="[object Int16Array]",xe="[object Int32Array]",Ve="[object Uint8Array]",Ke="[object Uint8ClampedArray]",Ge="[object Uint16Array]",mt="[object Uint32Array]",It=/\b__p \+= '';/g,Ye=/\b(__p \+=) '' \+/g,Pt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Ze=/[&<>"']/g,rt=RegExp(Ot.source),et=RegExp(Ze.source),Ne=/<%-([\s\S]+?)%>/g,it=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,Re=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lt=/^\w*$/,ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Le=/[\\^$.*+?()[\]{}|]/g,ut=RegExp(Le.source),nt=/^\s+/,Fe=/\s/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qe=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zt=/[()=,{}\[\]\/\s]/,at=/\\(\\)?/g,kt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,qt=/^[-+]0x[0-9a-f]+$/i,Qr=/^0b[01]+$/i,Zr=/^\[object .+?Constructor\]$/,Xr=/^0o[0-7]+$/i,ei=/^(?:0|[1-9]\d*)$/,vr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ai=/($^)/,In=/['\n\r\u2028\u2029\\]/g,Ei="\\ud800-\\udfff",Mn="\\u0300-\\u036f",Cn="\\ufe20-\\ufe2f",Si="\\u20d0-\\u20ff",sn=Mn+Cn+Si,on="\\u2700-\\u27bf",Cr="a-z\\xdf-\\xf6\\xf8-\\xff",Pn="\\xac\\xb1\\xd7\\xf7",Dn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",On="\\u2000-\\u206f",ta=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ao="A-Z\\xc0-\\xd6\\xd8-\\xde",qh="\\ufe0e\\ufe0f",ra=Pn+Dn+On+ta,$f="['\u2019]",ia="["+Ei+"]",Nf="["+ra+"]",na="["+sn+"]",zh="\\d+",Kp="["+on+"]",kh="["+Cr+"]",Hh="[^"+Ei+ra+zh+on+Cr+ao+"]",lc="\\ud83c[\\udffb-\\udfff]",Vp="(?:"+na+"|"+lc+")",jh="[^"+Ei+"]",hc="(?:\\ud83c[\\udde6-\\uddff]){2}",co="[\\ud800-\\udbff][\\udc00-\\udfff]",qi="["+ao+"]",Wh="\\u200d",Kh="(?:"+kh+"|"+Hh+")",cs="(?:"+qi+"|"+Hh+")",Vh="(?:"+$f+"(?:d|ll|m|re|s|t|ve))?",Gh="(?:"+$f+"(?:D|LL|M|RE|S|T|VE))?",Yh=Vp+"?",Jh="["+qh+"]?",Gp="(?:"+Wh+"(?:"+[jh,hc,co].join("|")+")"+Jh+Yh+")*",Ms="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Qh="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Zh=Jh+Yh+Gp,uc="(?:"+[Kp,hc,co].join("|")+")"+Zh,Yp="(?:"+[jh+na+"?",na,hc,co,ia].join("|")+")",Lf=RegExp($f,"g"),Jp=RegExp(na,"g"),dc=RegExp(lc+"(?="+lc+")|"+Yp+Zh,"g"),Xh=RegExp([qi+"?"+kh+"+"+Vh+"(?="+[Nf,qi,"$"].join("|")+")",cs+"+"+Gh+"(?="+[Nf,qi+Kh,"$"].join("|")+")",qi+"?"+Kh+"+"+Vh,qi+"+"+Gh,Qh,Ms,zh,uc].join("|"),"g"),eu=RegExp("["+Wh+Ei+sn+qh+"]"),sa=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Qp=-1,Zt={};Zt[Be]=Zt[we]=Zt[He]=Zt[We]=Zt[xe]=Zt[Ve]=Zt[Ke]=Zt[Ge]=Zt[mt]=!0,Zt[R]=Zt[X]=Zt[me]=Zt[J]=Zt[Me]=Zt[K]=Zt[G]=Zt[re]=Zt[he]=Zt[ge]=Zt[Te]=Zt[$e]=Zt[be]=Zt[Pe]=Zt[Ie]=!1;var Qt={};Qt[R]=Qt[X]=Qt[me]=Qt[Me]=Qt[J]=Qt[K]=Qt[Be]=Qt[we]=Qt[He]=Qt[We]=Qt[xe]=Qt[he]=Qt[ge]=Qt[Te]=Qt[$e]=Qt[be]=Qt[Pe]=Qt[De]=Qt[Ve]=Qt[Ke]=Qt[Ge]=Qt[mt]=!0,Qt[G]=Qt[re]=Qt[Ie]=!1;var Q={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},ne={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Xt=parseFloat,bt=parseInt,or=typeof fr=="object"&&fr&&fr.Object===Object&&fr,Er=typeof self=="object"&&self&&self.Object===Object&&self,Bt=or||Er||Function("return this")(),er=e&&!e.nodeType&&e,_r=er&&!0&&r&&!r.nodeType&&r,Ii=_r&&_r.exports===er,Sr=Ii&&or.process,ar=function(){try{var ie=_r&&_r.require&&_r.require("util").types;return ie||Sr&&Sr.binding&&Sr.binding("util")}catch{}}(),hi=ar&&ar.isArrayBuffer,Rn=ar&&ar.isDate,an=ar&&ar.isMap,fs=ar&&ar.isRegExp,Bf=ar&&ar.isSet,oa=ar&&ar.isTypedArray;function Fr(ie,fe,ce){switch(ce.length){case 0:return ie.call(fe);case 1:return ie.call(fe,ce[0]);case 2:return ie.call(fe,ce[0],ce[1]);case 3:return ie.call(fe,ce[0],ce[1],ce[2])}return ie.apply(fe,ce)}function yN(ie,fe,ce,ze){for(var gt=-1,jt=ie==null?0:ie.length;++gt<jt;){var Pr=ie[gt];fe(ze,Pr,ce(Pr),ie)}return ze}function cn(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze&&fe(ie[ce],ce,ie)!==!1;);return ie}function _N(ie,fe){for(var ce=ie==null?0:ie.length;ce--&&fe(ie[ce],ce,ie)!==!1;);return ie}function kw(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(!fe(ie[ce],ce,ie))return!1;return!0}function fo(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=0,jt=[];++ce<ze;){var Pr=ie[ce];fe(Pr,ce,ie)&&(jt[gt++]=Pr)}return jt}function ru(ie,fe){var ce=ie==null?0:ie.length;return!!ce&&pc(ie,fe,0)>-1}function Zp(ie,fe,ce){for(var ze=-1,gt=ie==null?0:ie.length;++ze<gt;)if(ce(fe,ie[ze]))return!0;return!1}function cr(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=Array(ze);++ce<ze;)gt[ce]=fe(ie[ce],ce,ie);return gt}function lo(ie,fe){for(var ce=-1,ze=fe.length,gt=ie.length;++ce<ze;)ie[gt+ce]=fe[ce];return ie}function Xp(ie,fe,ce,ze){var gt=-1,jt=ie==null?0:ie.length;for(ze&&jt&&(ce=ie[++gt]);++gt<jt;)ce=fe(ce,ie[gt],gt,ie);return ce}function xN(ie,fe,ce,ze){var gt=ie==null?0:ie.length;for(ze&&gt&&(ce=ie[--gt]);gt--;)ce=fe(ce,ie[gt],gt,ie);return ce}function e1(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(fe(ie[ce],ce,ie))return!0;return!1}var AN=t1("length");function EN(ie){return ie.split("")}function SN(ie){return ie.match(dt)||[]}function Hw(ie,fe,ce){var ze;return ce(ie,function(gt,jt,Pr){if(fe(gt,jt,Pr))return ze=jt,!1}),ze}function iu(ie,fe,ce,ze){for(var gt=ie.length,jt=ce+(ze?1:-1);ze?jt--:++jt<gt;)if(fe(ie[jt],jt,ie))return jt;return-1}function pc(ie,fe,ce){return fe===fe?BN(ie,fe,ce):iu(ie,jw,ce)}function IN(ie,fe,ce,ze){for(var gt=ce-1,jt=ie.length;++gt<jt;)if(ze(ie[gt],fe))return gt;return-1}function jw(ie){return ie!==ie}function Ww(ie,fe){var ce=ie==null?0:ie.length;return ce?i1(ie,fe)/ce:v}function t1(ie){return function(fe){return fe==null?t:fe[ie]}}function r1(ie){return function(fe){return ie==null?t:ie[fe]}}function Kw(ie,fe,ce,ze,gt){return gt(ie,function(jt,Pr,tr){ce=ze?(ze=!1,jt):fe(ce,jt,Pr,tr)}),ce}function MN(ie,fe){var ce=ie.length;for(ie.sort(fe);ce--;)ie[ce]=ie[ce].value;return ie}function i1(ie,fe){for(var ce,ze=-1,gt=ie.length;++ze<gt;){var jt=fe(ie[ze]);jt!==t&&(ce=ce===t?jt:ce+jt)}return ce}function n1(ie,fe){for(var ce=-1,ze=Array(ie);++ce<ie;)ze[ce]=fe(ce);return ze}function CN(ie,fe){return cr(fe,function(ce){return[ce,ie[ce]]})}function Vw(ie){return ie&&ie.slice(0,Qw(ie)+1).replace(nt,"")}function zi(ie){return function(fe){return ie(fe)}}function s1(ie,fe){return cr(fe,function(ce){return ie[ce]})}function Ff(ie,fe){return ie.has(fe)}function Gw(ie,fe){for(var ce=-1,ze=ie.length;++ce<ze&&pc(fe,ie[ce],0)>-1;);return ce}function Yw(ie,fe){for(var ce=ie.length;ce--&&pc(fe,ie[ce],0)>-1;);return ce}function PN(ie,fe){for(var ce=ie.length,ze=0;ce--;)ie[ce]===fe&&++ze;return ze}var DN=r1(Q),ON=r1(ne);function RN(ie){return"\\"+Ue[ie]}function TN(ie,fe){return ie==null?t:ie[fe]}function gc(ie){return eu.test(ie)}function $N(ie){return sa.test(ie)}function NN(ie){for(var fe,ce=[];!(fe=ie.next()).done;)ce.push(fe.value);return ce}function o1(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze,gt){ce[++fe]=[gt,ze]}),ce}function Jw(ie,fe){return function(ce){return ie(fe(ce))}}function ho(ie,fe){for(var ce=-1,ze=ie.length,gt=0,jt=[];++ce<ze;){var Pr=ie[ce];(Pr===fe||Pr===g)&&(ie[ce]=g,jt[gt++]=ce)}return jt}function nu(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=ze}),ce}function LN(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=[ze,ze]}),ce}function BN(ie,fe,ce){for(var ze=ce-1,gt=ie.length;++ze<gt;)if(ie[ze]===fe)return ze;return-1}function FN(ie,fe,ce){for(var ze=ce+1;ze--;)if(ie[ze]===fe)return ze;return ze}function vc(ie){return gc(ie)?qN(ie):AN(ie)}function Tn(ie){return gc(ie)?zN(ie):EN(ie)}function Qw(ie){for(var fe=ie.length;fe--&&Fe.test(ie.charAt(fe)););return fe}var UN=r1(pe);function qN(ie){for(var fe=dc.lastIndex=0;dc.test(ie);)++fe;return fe}function zN(ie){return ie.match(dc)||[]}function kN(ie){return ie.match(Xh)||[]}var HN=function ie(fe){fe=fe==null?Bt:mc.defaults(Bt.Object(),fe,mc.pick(Bt,tu));var ce=fe.Array,ze=fe.Date,gt=fe.Error,jt=fe.Function,Pr=fe.Math,tr=fe.Object,a1=fe.RegExp,jN=fe.String,fn=fe.TypeError,su=ce.prototype,WN=jt.prototype,bc=tr.prototype,ou=fe["__core-js_shared__"],au=WN.toString,Yt=bc.hasOwnProperty,KN=0,Zw=function(){var o=/[^.]+$/.exec(ou&&ou.keys&&ou.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),cu=bc.toString,VN=au.call(tr),GN=Bt._,YN=a1("^"+au.call(Yt).replace(Le,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fu=Ii?fe.Buffer:t,uo=fe.Symbol,lu=fe.Uint8Array,Xw=fu?fu.allocUnsafe:t,hu=Jw(tr.getPrototypeOf,tr),ey=tr.create,ty=bc.propertyIsEnumerable,uu=su.splice,ry=uo?uo.isConcatSpreadable:t,Uf=uo?uo.iterator:t,aa=uo?uo.toStringTag:t,du=function(){try{var o=ua(tr,"defineProperty");return o({},"",{}),o}catch{}}(),JN=fe.clearTimeout!==Bt.clearTimeout&&fe.clearTimeout,QN=ze&&ze.now!==Bt.Date.now&&ze.now,ZN=fe.setTimeout!==Bt.setTimeout&&fe.setTimeout,pu=Pr.ceil,gu=Pr.floor,c1=tr.getOwnPropertySymbols,XN=fu?fu.isBuffer:t,iy=fe.isFinite,eL=su.join,tL=Jw(tr.keys,tr),Dr=Pr.max,ti=Pr.min,rL=ze.now,iL=fe.parseInt,ny=Pr.random,nL=su.reverse,f1=ua(fe,"DataView"),qf=ua(fe,"Map"),l1=ua(fe,"Promise"),wc=ua(fe,"Set"),zf=ua(fe,"WeakMap"),kf=ua(tr,"create"),vu=zf&&new zf,yc={},sL=da(f1),oL=da(qf),aL=da(l1),cL=da(wc),fL=da(zf),mu=uo?uo.prototype:t,Hf=mu?mu.valueOf:t,sy=mu?mu.toString:t;function q(o){if(mr(o)&&!wt(o)&&!(o instanceof Nt)){if(o instanceof ln)return o;if(Yt.call(o,"__wrapped__"))return o6(o)}return new ln(o)}var _c=function(){function o(){}return function(c){if(!hr(c))return{};if(ey)return ey(c);o.prototype=c;var p=new o;return o.prototype=t,p}}();function bu(){}function ln(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=t}q.templateSettings={escape:Ne,evaluate:it,interpolate:tt,variable:"",imports:{_:q}},q.prototype=bu.prototype,q.prototype.constructor=q,ln.prototype=_c(bu.prototype),ln.prototype.constructor=ln;function Nt(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}function lL(){var o=new Nt(this.__wrapped__);return o.__actions__=Mi(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Mi(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Mi(this.__views__),o}function hL(){if(this.__filtered__){var o=new Nt(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function uL(){var o=this.__wrapped__.value(),c=this.__dir__,p=wt(o),I=c<0,T=p?o.length:0,H=EB(0,T,this.__views__),Z=H.start,te=H.end,se=te-Z,ue=I?te:Z-1,de=this.__iteratees__,ve=de.length,Se=0,Je=ti(se,this.__takeCount__);if(!p||!I&&T==se&&Je==se)return Py(o,this.__actions__);var ct=[];e:for(;se--&&Se<Je;){ue+=c;for(var St=-1,ft=o[ue];++St<ve;){var Rt=de[St],Ft=Rt.iteratee,ji=Rt.type,pi=Ft(ft);if(ji==d)ft=pi;else if(!pi){if(ji==l)continue e;break e}}ct[Se++]=ft}return ct}Nt.prototype=_c(bu.prototype),Nt.prototype.constructor=Nt;function ca(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function dL(){this.__data__=kf?kf(null):{},this.size=0}function pL(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function gL(o){var c=this.__data__;if(kf){var p=c[o];return p===h?t:p}return Yt.call(c,o)?c[o]:t}function vL(o){var c=this.__data__;return kf?c[o]!==t:Yt.call(c,o)}function mL(o,c){var p=this.__data__;return this.size+=this.has(o)?0:1,p[o]=kf&&c===t?h:c,this}ca.prototype.clear=dL,ca.prototype.delete=pL,ca.prototype.get=gL,ca.prototype.has=vL,ca.prototype.set=mL;function Cs(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function bL(){this.__data__=[],this.size=0}function wL(o){var c=this.__data__,p=wu(c,o);if(p<0)return!1;var I=c.length-1;return p==I?c.pop():uu.call(c,p,1),--this.size,!0}function yL(o){var c=this.__data__,p=wu(c,o);return p<0?t:c[p][1]}function _L(o){return wu(this.__data__,o)>-1}function xL(o,c){var p=this.__data__,I=wu(p,o);return I<0?(++this.size,p.push([o,c])):p[I][1]=c,this}Cs.prototype.clear=bL,Cs.prototype.delete=wL,Cs.prototype.get=yL,Cs.prototype.has=_L,Cs.prototype.set=xL;function Ps(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function AL(){this.size=0,this.__data__={hash:new ca,map:new(qf||Cs),string:new ca}}function EL(o){var c=Ou(this,o).delete(o);return this.size-=c?1:0,c}function SL(o){return Ou(this,o).get(o)}function IL(o){return Ou(this,o).has(o)}function ML(o,c){var p=Ou(this,o),I=p.size;return p.set(o,c),this.size+=p.size==I?0:1,this}Ps.prototype.clear=AL,Ps.prototype.delete=EL,Ps.prototype.get=SL,Ps.prototype.has=IL,Ps.prototype.set=ML;function fa(o){var c=-1,p=o==null?0:o.length;for(this.__data__=new Ps;++c<p;)this.add(o[c])}function CL(o){return this.__data__.set(o,h),this}function PL(o){return this.__data__.has(o)}fa.prototype.add=fa.prototype.push=CL,fa.prototype.has=PL;function $n(o){var c=this.__data__=new Cs(o);this.size=c.size}function DL(){this.__data__=new Cs,this.size=0}function OL(o){var c=this.__data__,p=c.delete(o);return this.size=c.size,p}function RL(o){return this.__data__.get(o)}function TL(o){return this.__data__.has(o)}function $L(o,c){var p=this.__data__;if(p instanceof Cs){var I=p.__data__;if(!qf||I.length<n-1)return I.push([o,c]),this.size=++p.size,this;p=this.__data__=new Ps(I)}return p.set(o,c),this.size=p.size,this}$n.prototype.clear=DL,$n.prototype.delete=OL,$n.prototype.get=RL,$n.prototype.has=TL,$n.prototype.set=$L;function oy(o,c){var p=wt(o),I=!p&&pa(o),T=!p&&!I&&bo(o),H=!p&&!I&&!T&&Sc(o),Z=p||I||T||H,te=Z?n1(o.length,jN):[],se=te.length;for(var ue in o)(c||Yt.call(o,ue))&&!(Z&&(ue=="length"||T&&(ue=="offset"||ue=="parent")||H&&(ue=="buffer"||ue=="byteLength"||ue=="byteOffset")||Ts(ue,se)))&&te.push(ue);return te}function ay(o){var c=o.length;return c?o[_1(0,c-1)]:t}function NL(o,c){return Ru(Mi(o),la(c,0,o.length))}function LL(o){return Ru(Mi(o))}function h1(o,c,p){(p!==t&&!Nn(o[c],p)||p===t&&!(c in o))&&Ds(o,c,p)}function jf(o,c,p){var I=o[c];(!(Yt.call(o,c)&&Nn(I,p))||p===t&&!(c in o))&&Ds(o,c,p)}function wu(o,c){for(var p=o.length;p--;)if(Nn(o[p][0],c))return p;return-1}function BL(o,c,p,I){return po(o,function(T,H,Z){c(I,T,p(T),Z)}),I}function cy(o,c){return o&&hs(c,Ur(c),o)}function FL(o,c){return o&&hs(c,Pi(c),o)}function Ds(o,c,p){c=="__proto__"&&du?du(o,c,{configurable:!0,enumerable:!0,value:p,writable:!0}):o[c]=p}function u1(o,c){for(var p=-1,I=c.length,T=ce(I),H=o==null;++p<I;)T[p]=H?t:K1(o,c[p]);return T}function la(o,c,p){return o===o&&(p!==t&&(o=o<=p?o:p),c!==t&&(o=o>=c?o:c)),o}function hn(o,c,p,I,T,H){var Z,te=c&w,se=c&P,ue=c&M;if(p&&(Z=T?p(o,I,T,H):p(o)),Z!==t)return Z;if(!hr(o))return o;var de=wt(o);if(de){if(Z=IB(o),!te)return Mi(o,Z)}else{var ve=ri(o),Se=ve==re||ve==le;if(bo(o))return Ry(o,te);if(ve==Te||ve==R||Se&&!T){if(Z=se||Se?{}:Qy(o),!te)return se?gB(o,FL(Z,o)):pB(o,cy(Z,o))}else{if(!Qt[ve])return T?o:{};Z=MB(o,ve,te)}}H||(H=new $n);var Je=H.get(o);if(Je)return Je;H.set(o,Z),I6(o)?o.forEach(function(ft){Z.add(hn(ft,c,p,ft,o,H))}):E6(o)&&o.forEach(function(ft,Rt){Z.set(Rt,hn(ft,c,p,Rt,o,H))});var ct=ue?se?R1:O1:se?Pi:Ur,St=de?t:ct(o);return cn(St||o,function(ft,Rt){St&&(Rt=ft,ft=o[Rt]),jf(Z,Rt,hn(ft,c,p,Rt,o,H))}),Z}function UL(o){var c=Ur(o);return function(p){return fy(p,o,c)}}function fy(o,c,p){var I=p.length;if(o==null)return!I;for(o=tr(o);I--;){var T=p[I],H=c[T],Z=o[T];if(Z===t&&!(T in o)||!H(Z))return!1}return!0}function ly(o,c,p){if(typeof o!="function")throw new fn(a);return Qf(function(){o.apply(t,p)},c)}function Wf(o,c,p,I){var T=-1,H=ru,Z=!0,te=o.length,se=[],ue=c.length;if(!te)return se;p&&(c=cr(c,zi(p))),I?(H=Zp,Z=!1):c.length>=n&&(H=Ff,Z=!1,c=new fa(c));e:for(;++T<te;){var de=o[T],ve=p==null?de:p(de);if(de=I||de!==0?de:0,Z&&ve===ve){for(var Se=ue;Se--;)if(c[Se]===ve)continue e;se.push(de)}else H(c,ve,I)||se.push(de)}return se}var po=By(ls),hy=By(p1,!0);function qL(o,c){var p=!0;return po(o,function(I,T,H){return p=!!c(I,T,H),p}),p}function yu(o,c,p){for(var I=-1,T=o.length;++I<T;){var H=o[I],Z=c(H);if(Z!=null&&(te===t?Z===Z&&!Hi(Z):p(Z,te)))var te=Z,se=H}return se}function zL(o,c,p,I){var T=o.length;for(p=Et(p),p<0&&(p=-p>T?0:T+p),I=I===t||I>T?T:Et(I),I<0&&(I+=T),I=p>I?0:C6(I);p<I;)o[p++]=c;return o}function uy(o,c){var p=[];return po(o,function(I,T,H){c(I,T,H)&&p.push(I)}),p}function Kr(o,c,p,I,T){var H=-1,Z=o.length;for(p||(p=PB),T||(T=[]);++H<Z;){var te=o[H];c>0&&p(te)?c>1?Kr(te,c-1,p,I,T):lo(T,te):I||(T[T.length]=te)}return T}var d1=Fy(),dy=Fy(!0);function ls(o,c){return o&&d1(o,c,Ur)}function p1(o,c){return o&&dy(o,c,Ur)}function _u(o,c){return fo(c,function(p){return $s(o[p])})}function ha(o,c){c=vo(c,o);for(var p=0,I=c.length;o!=null&&p<I;)o=o[us(c[p++])];return p&&p==I?o:t}function py(o,c,p){var I=c(o);return wt(o)?I:lo(I,p(o))}function ui(o){return o==null?o===t?ye:ke:aa&&aa in tr(o)?AB(o):LB(o)}function g1(o,c){return o>c}function kL(o,c){return o!=null&&Yt.call(o,c)}function HL(o,c){return o!=null&&c in tr(o)}function jL(o,c,p){return o>=ti(c,p)&&o<Dr(c,p)}function v1(o,c,p){for(var I=p?Zp:ru,T=o[0].length,H=o.length,Z=H,te=ce(H),se=1/0,ue=[];Z--;){var de=o[Z];Z&&c&&(de=cr(de,zi(c))),se=ti(de.length,se),te[Z]=!p&&(c||T>=120&&de.length>=120)?new fa(Z&&de):t}de=o[0];var ve=-1,Se=te[0];e:for(;++ve<T&&ue.length<se;){var Je=de[ve],ct=c?c(Je):Je;if(Je=p||Je!==0?Je:0,!(Se?Ff(Se,ct):I(ue,ct,p))){for(Z=H;--Z;){var St=te[Z];if(!(St?Ff(St,ct):I(o[Z],ct,p)))continue e}Se&&Se.push(ct),ue.push(Je)}}return ue}function WL(o,c,p,I){return ls(o,function(T,H,Z){c(I,p(T),H,Z)}),I}function Kf(o,c,p){c=vo(c,o),o=t6(o,c);var I=o==null?o:o[us(dn(c))];return I==null?t:Fr(I,o,p)}function gy(o){return mr(o)&&ui(o)==R}function KL(o){return mr(o)&&ui(o)==me}function VL(o){return mr(o)&&ui(o)==K}function Vf(o,c,p,I,T){return o===c?!0:o==null||c==null||!mr(o)&&!mr(c)?o!==o&&c!==c:GL(o,c,p,I,Vf,T)}function GL(o,c,p,I,T,H){var Z=wt(o),te=wt(c),se=Z?X:ri(o),ue=te?X:ri(c);se=se==R?Te:se,ue=ue==R?Te:ue;var de=se==Te,ve=ue==Te,Se=se==ue;if(Se&&bo(o)){if(!bo(c))return!1;Z=!0,de=!1}if(Se&&!de)return H||(H=new $n),Z||Sc(o)?Gy(o,c,p,I,T,H):_B(o,c,se,p,I,T,H);if(!(p&O)){var Je=de&&Yt.call(o,"__wrapped__"),ct=ve&&Yt.call(c,"__wrapped__");if(Je||ct){var St=Je?o.value():o,ft=ct?c.value():c;return H||(H=new $n),T(St,ft,p,I,H)}}return Se?(H||(H=new $n),xB(o,c,p,I,T,H)):!1}function YL(o){return mr(o)&&ri(o)==he}function m1(o,c,p,I){var T=p.length,H=T,Z=!I;if(o==null)return!H;for(o=tr(o);T--;){var te=p[T];if(Z&&te[2]?te[1]!==o[te[0]]:!(te[0]in o))return!1}for(;++T<H;){te=p[T];var se=te[0],ue=o[se],de=te[1];if(Z&&te[2]){if(ue===t&&!(se in o))return!1}else{var ve=new $n;if(I)var Se=I(ue,de,se,o,c,ve);if(!(Se===t?Vf(de,ue,O|$,I,ve):Se))return!1}}return!0}function vy(o){if(!hr(o)||OB(o))return!1;var c=$s(o)?YN:Zr;return c.test(da(o))}function JL(o){return mr(o)&&ui(o)==$e}function QL(o){return mr(o)&&ri(o)==be}function ZL(o){return mr(o)&&Fu(o.length)&&!!Zt[ui(o)]}function my(o){return typeof o=="function"?o:o==null?Di:typeof o=="object"?wt(o)?yy(o[0],o[1]):wy(o):U6(o)}function b1(o){if(!Jf(o))return tL(o);var c=[];for(var p in tr(o))Yt.call(o,p)&&p!="constructor"&&c.push(p);return c}function XL(o){if(!hr(o))return NB(o);var c=Jf(o),p=[];for(var I in o)I=="constructor"&&(c||!Yt.call(o,I))||p.push(I);return p}function w1(o,c){return o<c}function by(o,c){var p=-1,I=Ci(o)?ce(o.length):[];return po(o,function(T,H,Z){I[++p]=c(T,H,Z)}),I}function wy(o){var c=$1(o);return c.length==1&&c[0][2]?Xy(c[0][0],c[0][1]):function(p){return p===o||m1(p,o,c)}}function yy(o,c){return L1(o)&&Zy(c)?Xy(us(o),c):function(p){var I=K1(p,o);return I===t&&I===c?V1(p,o):Vf(c,I,O|$)}}function xu(o,c,p,I,T){o!==c&&d1(c,function(H,Z){if(T||(T=new $n),hr(H))eB(o,c,Z,p,xu,I,T);else{var te=I?I(F1(o,Z),H,Z+"",o,c,T):t;te===t&&(te=H),h1(o,Z,te)}},Pi)}function eB(o,c,p,I,T,H,Z){var te=F1(o,p),se=F1(c,p),ue=Z.get(se);if(ue){h1(o,p,ue);return}var de=H?H(te,se,p+"",o,c,Z):t,ve=de===t;if(ve){var Se=wt(se),Je=!Se&&bo(se),ct=!Se&&!Je&&Sc(se);de=se,Se||Je||ct?wt(te)?de=te:xr(te)?de=Mi(te):Je?(ve=!1,de=Ry(se,!0)):ct?(ve=!1,de=Ty(se,!0)):de=[]:Zf(se)||pa(se)?(de=te,pa(te)?de=P6(te):(!hr(te)||$s(te))&&(de=Qy(se))):ve=!1}ve&&(Z.set(se,de),T(de,se,I,H,Z),Z.delete(se)),h1(o,p,de)}function _y(o,c){var p=o.length;if(p)return c+=c<0?p:0,Ts(c,p)?o[c]:t}function xy(o,c,p){c.length?c=cr(c,function(H){return wt(H)?function(Z){return ha(Z,H.length===1?H[0]:H)}:H}):c=[Di];var I=-1;c=cr(c,zi(ot()));var T=by(o,function(H,Z,te){var se=cr(c,function(ue){return ue(H)});return{criteria:se,index:++I,value:H}});return MN(T,function(H,Z){return dB(H,Z,p)})}function tB(o,c){return Ay(o,c,function(p,I){return V1(o,I)})}function Ay(o,c,p){for(var I=-1,T=c.length,H={};++I<T;){var Z=c[I],te=ha(o,Z);p(te,Z)&&Gf(H,vo(Z,o),te)}return H}function rB(o){return function(c){return ha(c,o)}}function y1(o,c,p,I){var T=I?IN:pc,H=-1,Z=c.length,te=o;for(o===c&&(c=Mi(c)),p&&(te=cr(o,zi(p)));++H<Z;)for(var se=0,ue=c[H],de=p?p(ue):ue;(se=T(te,de,se,I))>-1;)te!==o&&uu.call(te,se,1),uu.call(o,se,1);return o}function Ey(o,c){for(var p=o?c.length:0,I=p-1;p--;){var T=c[p];if(p==I||T!==H){var H=T;Ts(T)?uu.call(o,T,1):E1(o,T)}}return o}function _1(o,c){return o+gu(ny()*(c-o+1))}function iB(o,c,p,I){for(var T=-1,H=Dr(pu((c-o)/(p||1)),0),Z=ce(H);H--;)Z[I?H:++T]=o,o+=p;return Z}function x1(o,c){var p="";if(!o||c<1||c>D)return p;do c%2&&(p+=o),c=gu(c/2),c&&(o+=o);while(c);return p}function Mt(o,c){return U1(e6(o,c,Di),o+"")}function nB(o){return ay(Ic(o))}function sB(o,c){var p=Ic(o);return Ru(p,la(c,0,p.length))}function Gf(o,c,p,I){if(!hr(o))return o;c=vo(c,o);for(var T=-1,H=c.length,Z=H-1,te=o;te!=null&&++T<H;){var se=us(c[T]),ue=p;if(se==="__proto__"||se==="constructor"||se==="prototype")return o;if(T!=Z){var de=te[se];ue=I?I(de,se,te):t,ue===t&&(ue=hr(de)?de:Ts(c[T+1])?[]:{})}jf(te,se,ue),te=te[se]}return o}var Sy=vu?function(o,c){return vu.set(o,c),o}:Di,oB=du?function(o,c){return du(o,"toString",{configurable:!0,enumerable:!1,value:Y1(c),writable:!0})}:Di;function aB(o){return Ru(Ic(o))}function un(o,c,p){var I=-1,T=o.length;c<0&&(c=-c>T?0:T+c),p=p>T?T:p,p<0&&(p+=T),T=c>p?0:p-c>>>0,c>>>=0;for(var H=ce(T);++I<T;)H[I]=o[I+c];return H}function cB(o,c){var p;return po(o,function(I,T,H){return p=c(I,T,H),!p}),!!p}function Au(o,c,p){var I=0,T=o==null?I:o.length;if(typeof c=="number"&&c===c&&T<=N){for(;I<T;){var H=I+T>>>1,Z=o[H];Z!==null&&!Hi(Z)&&(p?Z<=c:Z<c)?I=H+1:T=H}return T}return A1(o,c,Di,p)}function A1(o,c,p,I){var T=0,H=o==null?0:o.length;if(H===0)return 0;c=p(c);for(var Z=c!==c,te=c===null,se=Hi(c),ue=c===t;T<H;){var de=gu((T+H)/2),ve=p(o[de]),Se=ve!==t,Je=ve===null,ct=ve===ve,St=Hi(ve);if(Z)var ft=I||ct;else ue?ft=ct&&(I||Se):te?ft=ct&&Se&&(I||!Je):se?ft=ct&&Se&&!Je&&(I||!St):Je||St?ft=!1:ft=I?ve<=c:ve<c;ft?T=de+1:H=de}return ti(H,x)}function Iy(o,c){for(var p=-1,I=o.length,T=0,H=[];++p<I;){var Z=o[p],te=c?c(Z):Z;if(!p||!Nn(te,se)){var se=te;H[T++]=Z===0?0:Z}}return H}function My(o){return typeof o=="number"?o:Hi(o)?v:+o}function ki(o){if(typeof o=="string")return o;if(wt(o))return cr(o,ki)+"";if(Hi(o))return sy?sy.call(o):"";var c=o+"";return c=="0"&&1/o==-C?"-0":c}function go(o,c,p){var I=-1,T=ru,H=o.length,Z=!0,te=[],se=te;if(p)Z=!1,T=Zp;else if(H>=n){var ue=c?null:wB(o);if(ue)return nu(ue);Z=!1,T=Ff,se=new fa}else se=c?[]:te;e:for(;++I<H;){var de=o[I],ve=c?c(de):de;if(de=p||de!==0?de:0,Z&&ve===ve){for(var Se=se.length;Se--;)if(se[Se]===ve)continue e;c&&se.push(ve),te.push(de)}else T(se,ve,p)||(se!==te&&se.push(ve),te.push(de))}return te}function E1(o,c){return c=vo(c,o),o=t6(o,c),o==null||delete o[us(dn(c))]}function Cy(o,c,p,I){return Gf(o,c,p(ha(o,c)),I)}function Eu(o,c,p,I){for(var T=o.length,H=I?T:-1;(I?H--:++H<T)&&c(o[H],H,o););return p?un(o,I?0:H,I?H+1:T):un(o,I?H+1:0,I?T:H)}function Py(o,c){var p=o;return p instanceof Nt&&(p=p.value()),Xp(c,function(I,T){return T.func.apply(T.thisArg,lo([I],T.args))},p)}function S1(o,c,p){var I=o.length;if(I<2)return I?go(o[0]):[];for(var T=-1,H=ce(I);++T<I;)for(var Z=o[T],te=-1;++te<I;)te!=T&&(H[T]=Wf(H[T]||Z,o[te],c,p));return go(Kr(H,1),c,p)}function Dy(o,c,p){for(var I=-1,T=o.length,H=c.length,Z={};++I<T;){var te=I<H?c[I]:t;p(Z,o[I],te)}return Z}function I1(o){return xr(o)?o:[]}function M1(o){return typeof o=="function"?o:Di}function vo(o,c){return wt(o)?o:L1(o,c)?[o]:s6(Vt(o))}var fB=Mt;function mo(o,c,p){var I=o.length;return p=p===t?I:p,!c&&p>=I?o:un(o,c,p)}var Oy=JN||function(o){return Bt.clearTimeout(o)};function Ry(o,c){if(c)return o.slice();var p=o.length,I=Xw?Xw(p):new o.constructor(p);return o.copy(I),I}function C1(o){var c=new o.constructor(o.byteLength);return new lu(c).set(new lu(o)),c}function lB(o,c){var p=c?C1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.byteLength)}function hB(o){var c=new o.constructor(o.source,_t.exec(o));return c.lastIndex=o.lastIndex,c}function uB(o){return Hf?tr(Hf.call(o)):{}}function Ty(o,c){var p=c?C1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.length)}function $y(o,c){if(o!==c){var p=o!==t,I=o===null,T=o===o,H=Hi(o),Z=c!==t,te=c===null,se=c===c,ue=Hi(c);if(!te&&!ue&&!H&&o>c||H&&Z&&se&&!te&&!ue||I&&Z&&se||!p&&se||!T)return 1;if(!I&&!H&&!ue&&o<c||ue&&p&&T&&!I&&!H||te&&p&&T||!Z&&T||!se)return-1}return 0}function dB(o,c,p){for(var I=-1,T=o.criteria,H=c.criteria,Z=T.length,te=p.length;++I<Z;){var se=$y(T[I],H[I]);if(se){if(I>=te)return se;var ue=p[I];return se*(ue=="desc"?-1:1)}}return o.index-c.index}function Ny(o,c,p,I){for(var T=-1,H=o.length,Z=p.length,te=-1,se=c.length,ue=Dr(H-Z,0),de=ce(se+ue),ve=!I;++te<se;)de[te]=c[te];for(;++T<Z;)(ve||T<H)&&(de[p[T]]=o[T]);for(;ue--;)de[te++]=o[T++];return de}function Ly(o,c,p,I){for(var T=-1,H=o.length,Z=-1,te=p.length,se=-1,ue=c.length,de=Dr(H-te,0),ve=ce(de+ue),Se=!I;++T<de;)ve[T]=o[T];for(var Je=T;++se<ue;)ve[Je+se]=c[se];for(;++Z<te;)(Se||T<H)&&(ve[Je+p[Z]]=o[T++]);return ve}function Mi(o,c){var p=-1,I=o.length;for(c||(c=ce(I));++p<I;)c[p]=o[p];return c}function hs(o,c,p,I){var T=!p;p||(p={});for(var H=-1,Z=c.length;++H<Z;){var te=c[H],se=I?I(p[te],o[te],te,p,o):t;se===t&&(se=o[te]),T?Ds(p,te,se):jf(p,te,se)}return p}function pB(o,c){return hs(o,N1(o),c)}function gB(o,c){return hs(o,Yy(o),c)}function Su(o,c){return function(p,I){var T=wt(p)?yN:BL,H=c?c():{};return T(p,o,ot(I,2),H)}}function xc(o){return Mt(function(c,p){var I=-1,T=p.length,H=T>1?p[T-1]:t,Z=T>2?p[2]:t;for(H=o.length>3&&typeof H=="function"?(T--,H):t,Z&&di(p[0],p[1],Z)&&(H=T<3?t:H,T=1),c=tr(c);++I<T;){var te=p[I];te&&o(c,te,I,H)}return c})}function By(o,c){return function(p,I){if(p==null)return p;if(!Ci(p))return o(p,I);for(var T=p.length,H=c?T:-1,Z=tr(p);(c?H--:++H<T)&&I(Z[H],H,Z)!==!1;);return p}}function Fy(o){return function(c,p,I){for(var T=-1,H=tr(c),Z=I(c),te=Z.length;te--;){var se=Z[o?te:++T];if(p(H[se],se,H)===!1)break}return c}}function vB(o,c,p){var I=c&W,T=Yf(o);function H(){var Z=this&&this!==Bt&&this instanceof H?T:o;return Z.apply(I?p:this,arguments)}return H}function Uy(o){return function(c){c=Vt(c);var p=gc(c)?Tn(c):t,I=p?p[0]:c.charAt(0),T=p?mo(p,1).join(""):c.slice(1);return I[o]()+T}}function Ac(o){return function(c){return Xp(B6(L6(c).replace(Lf,"")),o,"")}}function Yf(o){return function(){var c=arguments;switch(c.length){case 0:return new o;case 1:return new o(c[0]);case 2:return new o(c[0],c[1]);case 3:return new o(c[0],c[1],c[2]);case 4:return new o(c[0],c[1],c[2],c[3]);case 5:return new o(c[0],c[1],c[2],c[3],c[4]);case 6:return new o(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new o(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var p=_c(o.prototype),I=o.apply(p,c);return hr(I)?I:p}}function mB(o,c,p){var I=Yf(o);function T(){for(var H=arguments.length,Z=ce(H),te=H,se=Ec(T);te--;)Z[te]=arguments[te];var ue=H<3&&Z[0]!==se&&Z[H-1]!==se?[]:ho(Z,se);if(H-=ue.length,H<p)return jy(o,c,Iu,T.placeholder,t,Z,ue,t,t,p-H);var de=this&&this!==Bt&&this instanceof T?I:o;return Fr(de,this,Z)}return T}function qy(o){return function(c,p,I){var T=tr(c);if(!Ci(c)){var H=ot(p,3);c=Ur(c),p=function(te){return H(T[te],te,T)}}var Z=o(c,p,I);return Z>-1?T[H?c[Z]:Z]:t}}function zy(o){return Rs(function(c){var p=c.length,I=p,T=ln.prototype.thru;for(o&&c.reverse();I--;){var H=c[I];if(typeof H!="function")throw new fn(a);if(T&&!Z&&Du(H)=="wrapper")var Z=new ln([],!0)}for(I=Z?I:p;++I<p;){H=c[I];var te=Du(H),se=te=="wrapper"?T1(H):t;se&&B1(se[0])&&se[1]==(_|Y|z|U)&&!se[4].length&&se[9]==1?Z=Z[Du(se[0])].apply(Z,se[3]):Z=H.length==1&&B1(H)?Z[te]():Z.thru(H)}return function(){var ue=arguments,de=ue[0];if(Z&&ue.length==1&&wt(de))return Z.plant(de).value();for(var ve=0,Se=p?c[ve].apply(this,ue):de;++ve<p;)Se=c[ve].call(this,Se);return Se}})}function Iu(o,c,p,I,T,H,Z,te,se,ue){var de=c&_,ve=c&W,Se=c&k,Je=c&(Y|B),ct=c&ee,St=Se?t:Yf(o);function ft(){for(var Rt=arguments.length,Ft=ce(Rt),ji=Rt;ji--;)Ft[ji]=arguments[ji];if(Je)var pi=Ec(ft),Wi=PN(Ft,pi);if(I&&(Ft=Ny(Ft,I,T,Je)),H&&(Ft=Ly(Ft,H,Z,Je)),Rt-=Wi,Je&&Rt<ue){var Ar=ho(Ft,pi);return jy(o,c,Iu,ft.placeholder,p,Ft,Ar,te,se,ue-Rt)}var Ln=ve?p:this,Ls=Se?Ln[o]:o;return Rt=Ft.length,te?Ft=BB(Ft,te):ct&&Rt>1&&Ft.reverse(),de&&se<Rt&&(Ft.length=se),this&&this!==Bt&&this instanceof ft&&(Ls=St||Yf(Ls)),Ls.apply(Ln,Ft)}return ft}function ky(o,c){return function(p,I){return WL(p,o,c(I),{})}}function Mu(o,c){return function(p,I){var T;if(p===t&&I===t)return c;if(p!==t&&(T=p),I!==t){if(T===t)return I;typeof p=="string"||typeof I=="string"?(p=ki(p),I=ki(I)):(p=My(p),I=My(I)),T=o(p,I)}return T}}function P1(o){return Rs(function(c){return c=cr(c,zi(ot())),Mt(function(p){var I=this;return o(c,function(T){return Fr(T,I,p)})})})}function Cu(o,c){c=c===t?" ":ki(c);var p=c.length;if(p<2)return p?x1(c,o):c;var I=x1(c,pu(o/vc(c)));return gc(c)?mo(Tn(I),0,o).join(""):I.slice(0,o)}function bB(o,c,p,I){var T=c&W,H=Yf(o);function Z(){for(var te=-1,se=arguments.length,ue=-1,de=I.length,ve=ce(de+se),Se=this&&this!==Bt&&this instanceof Z?H:o;++ue<de;)ve[ue]=I[ue];for(;se--;)ve[ue++]=arguments[++te];return Fr(Se,T?p:this,ve)}return Z}function Hy(o){return function(c,p,I){return I&&typeof I!="number"&&di(c,p,I)&&(p=I=t),c=Ns(c),p===t?(p=c,c=0):p=Ns(p),I=I===t?c<p?1:-1:Ns(I),iB(c,p,I,o)}}function Pu(o){return function(c,p){return typeof c=="string"&&typeof p=="string"||(c=pn(c),p=pn(p)),o(c,p)}}function jy(o,c,p,I,T,H,Z,te,se,ue){var de=c&Y,ve=de?Z:t,Se=de?t:Z,Je=de?H:t,ct=de?t:H;c|=de?z:j,c&=~(de?j:z),c&F||(c&=~(W|k));var St=[o,c,T,Je,ve,ct,Se,te,se,ue],ft=p.apply(t,St);return B1(o)&&r6(ft,St),ft.placeholder=I,i6(ft,o,c)}function D1(o){var c=Pr[o];return function(p,I){if(p=pn(p),I=I==null?0:ti(Et(I),292),I&&iy(p)){var T=(Vt(p)+"e").split("e"),H=c(T[0]+"e"+(+T[1]+I));return T=(Vt(H)+"e").split("e"),+(T[0]+"e"+(+T[1]-I))}return c(p)}}var wB=wc&&1/nu(new wc([,-0]))[1]==C?function(o){return new wc(o)}:Z1;function Wy(o){return function(c){var p=ri(c);return p==he?o1(c):p==be?LN(c):CN(c,o(c))}}function Os(o,c,p,I,T,H,Z,te){var se=c&k;if(!se&&typeof o!="function")throw new fn(a);var ue=I?I.length:0;if(ue||(c&=~(z|j),I=T=t),Z=Z===t?Z:Dr(Et(Z),0),te=te===t?te:Et(te),ue-=T?T.length:0,c&j){var de=I,ve=T;I=T=t}var Se=se?t:T1(o),Je=[o,c,p,I,T,de,ve,H,Z,te];if(Se&&$B(Je,Se),o=Je[0],c=Je[1],p=Je[2],I=Je[3],T=Je[4],te=Je[9]=Je[9]===t?se?0:o.length:Dr(Je[9]-ue,0),!te&&c&(Y|B)&&(c&=~(Y|B)),!c||c==W)var ct=vB(o,c,p);else c==Y||c==B?ct=mB(o,c,te):(c==z||c==(W|z))&&!T.length?ct=bB(o,c,p,I):ct=Iu.apply(t,Je);var St=Se?Sy:r6;return i6(St(ct,Je),o,c)}function Ky(o,c,p,I){return o===t||Nn(o,bc[p])&&!Yt.call(I,p)?c:o}function Vy(o,c,p,I,T,H){return hr(o)&&hr(c)&&(H.set(c,o),xu(o,c,t,Vy,H),H.delete(c)),o}function yB(o){return Zf(o)?t:o}function Gy(o,c,p,I,T,H){var Z=p&O,te=o.length,se=c.length;if(te!=se&&!(Z&&se>te))return!1;var ue=H.get(o),de=H.get(c);if(ue&&de)return ue==c&&de==o;var ve=-1,Se=!0,Je=p&$?new fa:t;for(H.set(o,c),H.set(c,o);++ve<te;){var ct=o[ve],St=c[ve];if(I)var ft=Z?I(St,ct,ve,c,o,H):I(ct,St,ve,o,c,H);if(ft!==t){if(ft)continue;Se=!1;break}if(Je){if(!e1(c,function(Rt,Ft){if(!Ff(Je,Ft)&&(ct===Rt||T(ct,Rt,p,I,H)))return Je.push(Ft)})){Se=!1;break}}else if(!(ct===St||T(ct,St,p,I,H))){Se=!1;break}}return H.delete(o),H.delete(c),Se}function _B(o,c,p,I,T,H,Z){switch(p){case Me:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case me:return!(o.byteLength!=c.byteLength||!H(new lu(o),new lu(c)));case J:case K:case ge:return Nn(+o,+c);case G:return o.name==c.name&&o.message==c.message;case $e:case Pe:return o==c+"";case he:var te=o1;case be:var se=I&O;if(te||(te=nu),o.size!=c.size&&!se)return!1;var ue=Z.get(o);if(ue)return ue==c;I|=$,Z.set(o,c);var de=Gy(te(o),te(c),I,T,H,Z);return Z.delete(o),de;case De:if(Hf)return Hf.call(o)==Hf.call(c)}return!1}function xB(o,c,p,I,T,H){var Z=p&O,te=O1(o),se=te.length,ue=O1(c),de=ue.length;if(se!=de&&!Z)return!1;for(var ve=se;ve--;){var Se=te[ve];if(!(Z?Se in c:Yt.call(c,Se)))return!1}var Je=H.get(o),ct=H.get(c);if(Je&&ct)return Je==c&&ct==o;var St=!0;H.set(o,c),H.set(c,o);for(var ft=Z;++ve<se;){Se=te[ve];var Rt=o[Se],Ft=c[Se];if(I)var ji=Z?I(Ft,Rt,Se,c,o,H):I(Rt,Ft,Se,o,c,H);if(!(ji===t?Rt===Ft||T(Rt,Ft,p,I,H):ji)){St=!1;break}ft||(ft=Se=="constructor")}if(St&&!ft){var pi=o.constructor,Wi=c.constructor;pi!=Wi&&"constructor"in o&&"constructor"in c&&!(typeof pi=="function"&&pi instanceof pi&&typeof Wi=="function"&&Wi instanceof Wi)&&(St=!1)}return H.delete(o),H.delete(c),St}function Rs(o){return U1(e6(o,t,f6),o+"")}function O1(o){return py(o,Ur,N1)}function R1(o){return py(o,Pi,Yy)}var T1=vu?function(o){return vu.get(o)}:Z1;function Du(o){for(var c=o.name+"",p=yc[c],I=Yt.call(yc,c)?p.length:0;I--;){var T=p[I],H=T.func;if(H==null||H==o)return T.name}return c}function Ec(o){var c=Yt.call(q,"placeholder")?q:o;return c.placeholder}function ot(){var o=q.iteratee||J1;return o=o===J1?my:o,arguments.length?o(arguments[0],arguments[1]):o}function Ou(o,c){var p=o.__data__;return DB(c)?p[typeof c=="string"?"string":"hash"]:p.map}function $1(o){for(var c=Ur(o),p=c.length;p--;){var I=c[p],T=o[I];c[p]=[I,T,Zy(T)]}return c}function ua(o,c){var p=TN(o,c);return vy(p)?p:t}function AB(o){var c=Yt.call(o,aa),p=o[aa];try{o[aa]=t;var I=!0}catch{}var T=cu.call(o);return I&&(c?o[aa]=p:delete o[aa]),T}var N1=c1?function(o){return o==null?[]:(o=tr(o),fo(c1(o),function(c){return ty.call(o,c)}))}:X1,Yy=c1?function(o){for(var c=[];o;)lo(c,N1(o)),o=hu(o);return c}:X1,ri=ui;(f1&&ri(new f1(new ArrayBuffer(1)))!=Me||qf&&ri(new qf)!=he||l1&&ri(l1.resolve())!=Ce||wc&&ri(new wc)!=be||zf&&ri(new zf)!=Ie)&&(ri=function(o){var c=ui(o),p=c==Te?o.constructor:t,I=p?da(p):"";if(I)switch(I){case sL:return Me;case oL:return he;case aL:return Ce;case cL:return be;case fL:return Ie}return c});function EB(o,c,p){for(var I=-1,T=p.length;++I<T;){var H=p[I],Z=H.size;switch(H.type){case"drop":o+=Z;break;case"dropRight":c-=Z;break;case"take":c=ti(c,o+Z);break;case"takeRight":o=Dr(o,c-Z);break}}return{start:o,end:c}}function SB(o){var c=o.match(Qe);return c?c[1].split(qe):[]}function Jy(o,c,p){c=vo(c,o);for(var I=-1,T=c.length,H=!1;++I<T;){var Z=us(c[I]);if(!(H=o!=null&&p(o,Z)))break;o=o[Z]}return H||++I!=T?H:(T=o==null?0:o.length,!!T&&Fu(T)&&Ts(Z,T)&&(wt(o)||pa(o)))}function IB(o){var c=o.length,p=new o.constructor(c);return c&&typeof o[0]=="string"&&Yt.call(o,"index")&&(p.index=o.index,p.input=o.input),p}function Qy(o){return typeof o.constructor=="function"&&!Jf(o)?_c(hu(o)):{}}function MB(o,c,p){var I=o.constructor;switch(c){case me:return C1(o);case J:case K:return new I(+o);case Me:return lB(o,p);case Be:case we:case He:case We:case xe:case Ve:case Ke:case Ge:case mt:return Ty(o,p);case he:return new I;case ge:case Pe:return new I(o);case $e:return hB(o);case be:return new I;case De:return uB(o)}}function CB(o,c){var p=c.length;if(!p)return o;var I=p-1;return c[I]=(p>1?"& ":"")+c[I],c=c.join(p>2?", ":" "),o.replace(st,`{
50
+ */(function(r,e){(function(){var t,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",f="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",u=500,g="__lodash_placeholder__",w=1,P=2,M=4,O=1,$=2,W=1,H=2,F=4,Y=8,B=16,z=32,j=64,_=128,U=256,ee=512,oe=30,L="...",b=800,m=16,l=1,d=2,y=3,C=1/0,D=9007199254740991,S=17976931348623157e292,v=0/0,A=4294967295,x=A-1,N=A>>>1,ae=[["ary",_],["bind",W],["bindKey",H],["curry",Y],["curryRight",B],["flip",ee],["partial",z],["partialRight",j],["rearg",U]],R="[object Arguments]",X="[object Array]",V="[object AsyncFunction]",J="[object Boolean]",K="[object Date]",E="[object DOMException]",G="[object Error]",re="[object Function]",le="[object GeneratorFunction]",he="[object Map]",ge="[object Number]",He="[object Null]",Te="[object Object]",Ce="[object Promise]",Xe="[object Proxy]",$e="[object RegExp]",be="[object Set]",Pe="[object String]",De="[object Symbol]",ye="[object Undefined]",Ie="[object WeakMap]",Oe="[object WeakSet]",me="[object ArrayBuffer]",Me="[object DataView]",Be="[object Float32Array]",we="[object Float64Array]",ke="[object Int8Array]",We="[object Int16Array]",xe="[object Int32Array]",Ve="[object Uint8Array]",Ke="[object Uint8ClampedArray]",Ge="[object Uint16Array]",mt="[object Uint32Array]",It=/\b__p \+= '';/g,Ye=/\b(__p \+=) '' \+/g,Pt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Ze=/[&<>"']/g,rt=RegExp(Ot.source),et=RegExp(Ze.source),Ne=/<%-([\s\S]+?)%>/g,it=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,Re=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lt=/^\w*$/,ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Le=/[\\^$.*+?()[\]{}|]/g,ut=RegExp(Le.source),nt=/^\s+/,Fe=/\s/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qe=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ht=/[()=,{}\[\]\/\s]/,at=/\\(\\)?/g,kt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,qt=/^[-+]0x[0-9a-f]+$/i,Qr=/^0b[01]+$/i,Zr=/^\[object .+?Constructor\]$/,Xr=/^0o[0-7]+$/i,ei=/^(?:0|[1-9]\d*)$/,vr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ai=/($^)/,Mn=/['\n\r\u2028\u2029\\]/g,Ei="\\ud800-\\udfff",Cn="\\u0300-\\u036f",Pn="\\ufe20-\\ufe2f",Si="\\u20d0-\\u20ff",cn=Cn+Pn+Si,fn="\\u2700-\\u27bf",Cr="a-z\\xdf-\\xf6\\xf8-\\xff",Dn="\\xac\\xb1\\xd7\\xf7",On="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Rn="\\u2000-\\u206f",ta=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",co="A-Z\\xc0-\\xd6\\xd8-\\xde",qh="\\ufe0e\\ufe0f",ra=Dn+On+Rn+ta,$f="['\u2019]",ia="["+Ei+"]",Nf="["+ra+"]",na="["+cn+"]",zh="\\d+",Kp="["+fn+"]",Hh="["+Cr+"]",kh="[^"+Ei+ra+zh+fn+Cr+co+"]",lc="\\ud83c[\\udffb-\\udfff]",Vp="(?:"+na+"|"+lc+")",jh="[^"+Ei+"]",hc="(?:\\ud83c[\\udde6-\\uddff]){2}",fo="[\\ud800-\\udbff][\\udc00-\\udfff]",zi="["+co+"]",Wh="\\u200d",Kh="(?:"+Hh+"|"+kh+")",cs="(?:"+zi+"|"+kh+")",Vh="(?:"+$f+"(?:d|ll|m|re|s|t|ve))?",Gh="(?:"+$f+"(?:D|LL|M|RE|S|T|VE))?",Yh=Vp+"?",Jh="["+qh+"]?",Gp="(?:"+Wh+"(?:"+[jh,hc,fo].join("|")+")"+Jh+Yh+")*",Cs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Qh="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Zh=Jh+Yh+Gp,uc="(?:"+[Kp,hc,fo].join("|")+")"+Zh,Yp="(?:"+[jh+na+"?",na,hc,fo,ia].join("|")+")",Lf=RegExp($f,"g"),Jp=RegExp(na,"g"),dc=RegExp(lc+"(?="+lc+")|"+Yp+Zh,"g"),Xh=RegExp([zi+"?"+Hh+"+"+Vh+"(?="+[Nf,zi,"$"].join("|")+")",cs+"+"+Gh+"(?="+[Nf,zi+Kh,"$"].join("|")+")",zi+"?"+Kh+"+"+Vh,zi+"+"+Gh,Qh,Cs,zh,uc].join("|"),"g"),eu=RegExp("["+Wh+Ei+cn+qh+"]"),sa=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Qp=-1,Zt={};Zt[Be]=Zt[we]=Zt[ke]=Zt[We]=Zt[xe]=Zt[Ve]=Zt[Ke]=Zt[Ge]=Zt[mt]=!0,Zt[R]=Zt[X]=Zt[me]=Zt[J]=Zt[Me]=Zt[K]=Zt[G]=Zt[re]=Zt[he]=Zt[ge]=Zt[Te]=Zt[$e]=Zt[be]=Zt[Pe]=Zt[Ie]=!1;var Qt={};Qt[R]=Qt[X]=Qt[me]=Qt[Me]=Qt[J]=Qt[K]=Qt[Be]=Qt[we]=Qt[ke]=Qt[We]=Qt[xe]=Qt[he]=Qt[ge]=Qt[Te]=Qt[$e]=Qt[be]=Qt[Pe]=Qt[De]=Qt[Ve]=Qt[Ke]=Qt[Ge]=Qt[mt]=!0,Qt[G]=Qt[re]=Qt[Ie]=!1;var Q={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},ne={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Xt=parseFloat,bt=parseInt,or=typeof fr=="object"&&fr&&fr.Object===Object&&fr,Er=typeof self=="object"&&self&&self.Object===Object&&self,Bt=or||Er||Function("return this")(),er=e&&!e.nodeType&&e,_r=er&&!0&&r&&!r.nodeType&&r,Ii=_r&&_r.exports===er,Sr=Ii&&or.process,ar=function(){try{var ie=_r&&_r.require&&_r.require("util").types;return ie||Sr&&Sr.binding&&Sr.binding("util")}catch{}}(),hi=ar&&ar.isArrayBuffer,Tn=ar&&ar.isDate,ln=ar&&ar.isMap,fs=ar&&ar.isRegExp,Bf=ar&&ar.isSet,oa=ar&&ar.isTypedArray;function Fr(ie,fe,ce){switch(ce.length){case 0:return ie.call(fe);case 1:return ie.call(fe,ce[0]);case 2:return ie.call(fe,ce[0],ce[1]);case 3:return ie.call(fe,ce[0],ce[1],ce[2])}return ie.apply(fe,ce)}function _N(ie,fe,ce,ze){for(var gt=-1,Wt=ie==null?0:ie.length;++gt<Wt;){var Pr=ie[gt];fe(ze,Pr,ce(Pr),ie)}return ze}function hn(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze&&fe(ie[ce],ce,ie)!==!1;);return ie}function xN(ie,fe){for(var ce=ie==null?0:ie.length;ce--&&fe(ie[ce],ce,ie)!==!1;);return ie}function Hw(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(!fe(ie[ce],ce,ie))return!1;return!0}function lo(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=0,Wt=[];++ce<ze;){var Pr=ie[ce];fe(Pr,ce,ie)&&(Wt[gt++]=Pr)}return Wt}function ru(ie,fe){var ce=ie==null?0:ie.length;return!!ce&&pc(ie,fe,0)>-1}function Zp(ie,fe,ce){for(var ze=-1,gt=ie==null?0:ie.length;++ze<gt;)if(ce(fe,ie[ze]))return!0;return!1}function cr(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=Array(ze);++ce<ze;)gt[ce]=fe(ie[ce],ce,ie);return gt}function ho(ie,fe){for(var ce=-1,ze=fe.length,gt=ie.length;++ce<ze;)ie[gt+ce]=fe[ce];return ie}function Xp(ie,fe,ce,ze){var gt=-1,Wt=ie==null?0:ie.length;for(ze&&Wt&&(ce=ie[++gt]);++gt<Wt;)ce=fe(ce,ie[gt],gt,ie);return ce}function AN(ie,fe,ce,ze){var gt=ie==null?0:ie.length;for(ze&&gt&&(ce=ie[--gt]);gt--;)ce=fe(ce,ie[gt],gt,ie);return ce}function e1(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(fe(ie[ce],ce,ie))return!0;return!1}var EN=t1("length");function SN(ie){return ie.split("")}function IN(ie){return ie.match(dt)||[]}function kw(ie,fe,ce){var ze;return ce(ie,function(gt,Wt,Pr){if(fe(gt,Wt,Pr))return ze=Wt,!1}),ze}function iu(ie,fe,ce,ze){for(var gt=ie.length,Wt=ce+(ze?1:-1);ze?Wt--:++Wt<gt;)if(fe(ie[Wt],Wt,ie))return Wt;return-1}function pc(ie,fe,ce){return fe===fe?FN(ie,fe,ce):iu(ie,jw,ce)}function MN(ie,fe,ce,ze){for(var gt=ce-1,Wt=ie.length;++gt<Wt;)if(ze(ie[gt],fe))return gt;return-1}function jw(ie){return ie!==ie}function Ww(ie,fe){var ce=ie==null?0:ie.length;return ce?i1(ie,fe)/ce:v}function t1(ie){return function(fe){return fe==null?t:fe[ie]}}function r1(ie){return function(fe){return ie==null?t:ie[fe]}}function Kw(ie,fe,ce,ze,gt){return gt(ie,function(Wt,Pr,tr){ce=ze?(ze=!1,Wt):fe(ce,Wt,Pr,tr)}),ce}function CN(ie,fe){var ce=ie.length;for(ie.sort(fe);ce--;)ie[ce]=ie[ce].value;return ie}function i1(ie,fe){for(var ce,ze=-1,gt=ie.length;++ze<gt;){var Wt=fe(ie[ze]);Wt!==t&&(ce=ce===t?Wt:ce+Wt)}return ce}function n1(ie,fe){for(var ce=-1,ze=Array(ie);++ce<ie;)ze[ce]=fe(ce);return ze}function PN(ie,fe){return cr(fe,function(ce){return[ce,ie[ce]]})}function Vw(ie){return ie&&ie.slice(0,Qw(ie)+1).replace(nt,"")}function Hi(ie){return function(fe){return ie(fe)}}function s1(ie,fe){return cr(fe,function(ce){return ie[ce]})}function Ff(ie,fe){return ie.has(fe)}function Gw(ie,fe){for(var ce=-1,ze=ie.length;++ce<ze&&pc(fe,ie[ce],0)>-1;);return ce}function Yw(ie,fe){for(var ce=ie.length;ce--&&pc(fe,ie[ce],0)>-1;);return ce}function DN(ie,fe){for(var ce=ie.length,ze=0;ce--;)ie[ce]===fe&&++ze;return ze}var ON=r1(Q),RN=r1(ne);function TN(ie){return"\\"+Ue[ie]}function $N(ie,fe){return ie==null?t:ie[fe]}function gc(ie){return eu.test(ie)}function NN(ie){return sa.test(ie)}function LN(ie){for(var fe,ce=[];!(fe=ie.next()).done;)ce.push(fe.value);return ce}function o1(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze,gt){ce[++fe]=[gt,ze]}),ce}function Jw(ie,fe){return function(ce){return ie(fe(ce))}}function uo(ie,fe){for(var ce=-1,ze=ie.length,gt=0,Wt=[];++ce<ze;){var Pr=ie[ce];(Pr===fe||Pr===g)&&(ie[ce]=g,Wt[gt++]=ce)}return Wt}function nu(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=ze}),ce}function BN(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=[ze,ze]}),ce}function FN(ie,fe,ce){for(var ze=ce-1,gt=ie.length;++ze<gt;)if(ie[ze]===fe)return ze;return-1}function UN(ie,fe,ce){for(var ze=ce+1;ze--;)if(ie[ze]===fe)return ze;return ze}function vc(ie){return gc(ie)?zN(ie):EN(ie)}function $n(ie){return gc(ie)?HN(ie):SN(ie)}function Qw(ie){for(var fe=ie.length;fe--&&Fe.test(ie.charAt(fe)););return fe}var qN=r1(pe);function zN(ie){for(var fe=dc.lastIndex=0;dc.test(ie);)++fe;return fe}function HN(ie){return ie.match(dc)||[]}function kN(ie){return ie.match(Xh)||[]}var jN=function ie(fe){fe=fe==null?Bt:mc.defaults(Bt.Object(),fe,mc.pick(Bt,tu));var ce=fe.Array,ze=fe.Date,gt=fe.Error,Wt=fe.Function,Pr=fe.Math,tr=fe.Object,a1=fe.RegExp,WN=fe.String,un=fe.TypeError,su=ce.prototype,KN=Wt.prototype,bc=tr.prototype,ou=fe["__core-js_shared__"],au=KN.toString,Yt=bc.hasOwnProperty,VN=0,Zw=function(){var o=/[^.]+$/.exec(ou&&ou.keys&&ou.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),cu=bc.toString,GN=au.call(tr),YN=Bt._,JN=a1("^"+au.call(Yt).replace(Le,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fu=Ii?fe.Buffer:t,po=fe.Symbol,lu=fe.Uint8Array,Xw=fu?fu.allocUnsafe:t,hu=Jw(tr.getPrototypeOf,tr),ey=tr.create,ty=bc.propertyIsEnumerable,uu=su.splice,ry=po?po.isConcatSpreadable:t,Uf=po?po.iterator:t,aa=po?po.toStringTag:t,du=function(){try{var o=ua(tr,"defineProperty");return o({},"",{}),o}catch{}}(),QN=fe.clearTimeout!==Bt.clearTimeout&&fe.clearTimeout,ZN=ze&&ze.now!==Bt.Date.now&&ze.now,XN=fe.setTimeout!==Bt.setTimeout&&fe.setTimeout,pu=Pr.ceil,gu=Pr.floor,c1=tr.getOwnPropertySymbols,eL=fu?fu.isBuffer:t,iy=fe.isFinite,tL=su.join,rL=Jw(tr.keys,tr),Dr=Pr.max,ti=Pr.min,iL=ze.now,nL=fe.parseInt,ny=Pr.random,sL=su.reverse,f1=ua(fe,"DataView"),qf=ua(fe,"Map"),l1=ua(fe,"Promise"),wc=ua(fe,"Set"),zf=ua(fe,"WeakMap"),Hf=ua(tr,"create"),vu=zf&&new zf,yc={},oL=da(f1),aL=da(qf),cL=da(l1),fL=da(wc),lL=da(zf),mu=po?po.prototype:t,kf=mu?mu.valueOf:t,sy=mu?mu.toString:t;function q(o){if(mr(o)&&!wt(o)&&!(o instanceof Nt)){if(o instanceof dn)return o;if(Yt.call(o,"__wrapped__"))return o6(o)}return new dn(o)}var _c=function(){function o(){}return function(c){if(!hr(c))return{};if(ey)return ey(c);o.prototype=c;var p=new o;return o.prototype=t,p}}();function bu(){}function dn(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=t}q.templateSettings={escape:Ne,evaluate:it,interpolate:tt,variable:"",imports:{_:q}},q.prototype=bu.prototype,q.prototype.constructor=q,dn.prototype=_c(bu.prototype),dn.prototype.constructor=dn;function Nt(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}function hL(){var o=new Nt(this.__wrapped__);return o.__actions__=Mi(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Mi(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Mi(this.__views__),o}function uL(){if(this.__filtered__){var o=new Nt(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function dL(){var o=this.__wrapped__.value(),c=this.__dir__,p=wt(o),I=c<0,T=p?o.length:0,k=SB(0,T,this.__views__),Z=k.start,te=k.end,se=te-Z,ue=I?te:Z-1,de=this.__iteratees__,ve=de.length,Se=0,Je=ti(se,this.__takeCount__);if(!p||!I&&T==se&&Je==se)return Py(o,this.__actions__);var ct=[];e:for(;se--&&Se<Je;){ue+=c;for(var St=-1,ft=o[ue];++St<ve;){var Rt=de[St],Ft=Rt.iteratee,Wi=Rt.type,pi=Ft(ft);if(Wi==d)ft=pi;else if(!pi){if(Wi==l)continue e;break e}}ct[Se++]=ft}return ct}Nt.prototype=_c(bu.prototype),Nt.prototype.constructor=Nt;function ca(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function pL(){this.__data__=Hf?Hf(null):{},this.size=0}function gL(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function vL(o){var c=this.__data__;if(Hf){var p=c[o];return p===h?t:p}return Yt.call(c,o)?c[o]:t}function mL(o){var c=this.__data__;return Hf?c[o]!==t:Yt.call(c,o)}function bL(o,c){var p=this.__data__;return this.size+=this.has(o)?0:1,p[o]=Hf&&c===t?h:c,this}ca.prototype.clear=pL,ca.prototype.delete=gL,ca.prototype.get=vL,ca.prototype.has=mL,ca.prototype.set=bL;function Ps(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function wL(){this.__data__=[],this.size=0}function yL(o){var c=this.__data__,p=wu(c,o);if(p<0)return!1;var I=c.length-1;return p==I?c.pop():uu.call(c,p,1),--this.size,!0}function _L(o){var c=this.__data__,p=wu(c,o);return p<0?t:c[p][1]}function xL(o){return wu(this.__data__,o)>-1}function AL(o,c){var p=this.__data__,I=wu(p,o);return I<0?(++this.size,p.push([o,c])):p[I][1]=c,this}Ps.prototype.clear=wL,Ps.prototype.delete=yL,Ps.prototype.get=_L,Ps.prototype.has=xL,Ps.prototype.set=AL;function Ds(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function EL(){this.size=0,this.__data__={hash:new ca,map:new(qf||Ps),string:new ca}}function SL(o){var c=Ou(this,o).delete(o);return this.size-=c?1:0,c}function IL(o){return Ou(this,o).get(o)}function ML(o){return Ou(this,o).has(o)}function CL(o,c){var p=Ou(this,o),I=p.size;return p.set(o,c),this.size+=p.size==I?0:1,this}Ds.prototype.clear=EL,Ds.prototype.delete=SL,Ds.prototype.get=IL,Ds.prototype.has=ML,Ds.prototype.set=CL;function fa(o){var c=-1,p=o==null?0:o.length;for(this.__data__=new Ds;++c<p;)this.add(o[c])}function PL(o){return this.__data__.set(o,h),this}function DL(o){return this.__data__.has(o)}fa.prototype.add=fa.prototype.push=PL,fa.prototype.has=DL;function Nn(o){var c=this.__data__=new Ps(o);this.size=c.size}function OL(){this.__data__=new Ps,this.size=0}function RL(o){var c=this.__data__,p=c.delete(o);return this.size=c.size,p}function TL(o){return this.__data__.get(o)}function $L(o){return this.__data__.has(o)}function NL(o,c){var p=this.__data__;if(p instanceof Ps){var I=p.__data__;if(!qf||I.length<n-1)return I.push([o,c]),this.size=++p.size,this;p=this.__data__=new Ds(I)}return p.set(o,c),this.size=p.size,this}Nn.prototype.clear=OL,Nn.prototype.delete=RL,Nn.prototype.get=TL,Nn.prototype.has=$L,Nn.prototype.set=NL;function oy(o,c){var p=wt(o),I=!p&&pa(o),T=!p&&!I&&wo(o),k=!p&&!I&&!T&&Sc(o),Z=p||I||T||k,te=Z?n1(o.length,WN):[],se=te.length;for(var ue in o)(c||Yt.call(o,ue))&&!(Z&&(ue=="length"||T&&(ue=="offset"||ue=="parent")||k&&(ue=="buffer"||ue=="byteLength"||ue=="byteOffset")||$s(ue,se)))&&te.push(ue);return te}function ay(o){var c=o.length;return c?o[_1(0,c-1)]:t}function LL(o,c){return Ru(Mi(o),la(c,0,o.length))}function BL(o){return Ru(Mi(o))}function h1(o,c,p){(p!==t&&!Ln(o[c],p)||p===t&&!(c in o))&&Os(o,c,p)}function jf(o,c,p){var I=o[c];(!(Yt.call(o,c)&&Ln(I,p))||p===t&&!(c in o))&&Os(o,c,p)}function wu(o,c){for(var p=o.length;p--;)if(Ln(o[p][0],c))return p;return-1}function FL(o,c,p,I){return go(o,function(T,k,Z){c(I,T,p(T),Z)}),I}function cy(o,c){return o&&hs(c,Ur(c),o)}function UL(o,c){return o&&hs(c,Pi(c),o)}function Os(o,c,p){c=="__proto__"&&du?du(o,c,{configurable:!0,enumerable:!0,value:p,writable:!0}):o[c]=p}function u1(o,c){for(var p=-1,I=c.length,T=ce(I),k=o==null;++p<I;)T[p]=k?t:K1(o,c[p]);return T}function la(o,c,p){return o===o&&(p!==t&&(o=o<=p?o:p),c!==t&&(o=o>=c?o:c)),o}function pn(o,c,p,I,T,k){var Z,te=c&w,se=c&P,ue=c&M;if(p&&(Z=T?p(o,I,T,k):p(o)),Z!==t)return Z;if(!hr(o))return o;var de=wt(o);if(de){if(Z=MB(o),!te)return Mi(o,Z)}else{var ve=ri(o),Se=ve==re||ve==le;if(wo(o))return Ry(o,te);if(ve==Te||ve==R||Se&&!T){if(Z=se||Se?{}:Qy(o),!te)return se?vB(o,UL(Z,o)):gB(o,cy(Z,o))}else{if(!Qt[ve])return T?o:{};Z=CB(o,ve,te)}}k||(k=new Nn);var Je=k.get(o);if(Je)return Je;k.set(o,Z),I6(o)?o.forEach(function(ft){Z.add(pn(ft,c,p,ft,o,k))}):E6(o)&&o.forEach(function(ft,Rt){Z.set(Rt,pn(ft,c,p,Rt,o,k))});var ct=ue?se?R1:O1:se?Pi:Ur,St=de?t:ct(o);return hn(St||o,function(ft,Rt){St&&(Rt=ft,ft=o[Rt]),jf(Z,Rt,pn(ft,c,p,Rt,o,k))}),Z}function qL(o){var c=Ur(o);return function(p){return fy(p,o,c)}}function fy(o,c,p){var I=p.length;if(o==null)return!I;for(o=tr(o);I--;){var T=p[I],k=c[T],Z=o[T];if(Z===t&&!(T in o)||!k(Z))return!1}return!0}function ly(o,c,p){if(typeof o!="function")throw new un(a);return Qf(function(){o.apply(t,p)},c)}function Wf(o,c,p,I){var T=-1,k=ru,Z=!0,te=o.length,se=[],ue=c.length;if(!te)return se;p&&(c=cr(c,Hi(p))),I?(k=Zp,Z=!1):c.length>=n&&(k=Ff,Z=!1,c=new fa(c));e:for(;++T<te;){var de=o[T],ve=p==null?de:p(de);if(de=I||de!==0?de:0,Z&&ve===ve){for(var Se=ue;Se--;)if(c[Se]===ve)continue e;se.push(de)}else k(c,ve,I)||se.push(de)}return se}var go=By(ls),hy=By(p1,!0);function zL(o,c){var p=!0;return go(o,function(I,T,k){return p=!!c(I,T,k),p}),p}function yu(o,c,p){for(var I=-1,T=o.length;++I<T;){var k=o[I],Z=c(k);if(Z!=null&&(te===t?Z===Z&&!ji(Z):p(Z,te)))var te=Z,se=k}return se}function HL(o,c,p,I){var T=o.length;for(p=Et(p),p<0&&(p=-p>T?0:T+p),I=I===t||I>T?T:Et(I),I<0&&(I+=T),I=p>I?0:C6(I);p<I;)o[p++]=c;return o}function uy(o,c){var p=[];return go(o,function(I,T,k){c(I,T,k)&&p.push(I)}),p}function Kr(o,c,p,I,T){var k=-1,Z=o.length;for(p||(p=DB),T||(T=[]);++k<Z;){var te=o[k];c>0&&p(te)?c>1?Kr(te,c-1,p,I,T):ho(T,te):I||(T[T.length]=te)}return T}var d1=Fy(),dy=Fy(!0);function ls(o,c){return o&&d1(o,c,Ur)}function p1(o,c){return o&&dy(o,c,Ur)}function _u(o,c){return lo(c,function(p){return Ns(o[p])})}function ha(o,c){c=mo(c,o);for(var p=0,I=c.length;o!=null&&p<I;)o=o[us(c[p++])];return p&&p==I?o:t}function py(o,c,p){var I=c(o);return wt(o)?I:ho(I,p(o))}function ui(o){return o==null?o===t?ye:He:aa&&aa in tr(o)?EB(o):BB(o)}function g1(o,c){return o>c}function kL(o,c){return o!=null&&Yt.call(o,c)}function jL(o,c){return o!=null&&c in tr(o)}function WL(o,c,p){return o>=ti(c,p)&&o<Dr(c,p)}function v1(o,c,p){for(var I=p?Zp:ru,T=o[0].length,k=o.length,Z=k,te=ce(k),se=1/0,ue=[];Z--;){var de=o[Z];Z&&c&&(de=cr(de,Hi(c))),se=ti(de.length,se),te[Z]=!p&&(c||T>=120&&de.length>=120)?new fa(Z&&de):t}de=o[0];var ve=-1,Se=te[0];e:for(;++ve<T&&ue.length<se;){var Je=de[ve],ct=c?c(Je):Je;if(Je=p||Je!==0?Je:0,!(Se?Ff(Se,ct):I(ue,ct,p))){for(Z=k;--Z;){var St=te[Z];if(!(St?Ff(St,ct):I(o[Z],ct,p)))continue e}Se&&Se.push(ct),ue.push(Je)}}return ue}function KL(o,c,p,I){return ls(o,function(T,k,Z){c(I,p(T),k,Z)}),I}function Kf(o,c,p){c=mo(c,o),o=t6(o,c);var I=o==null?o:o[us(vn(c))];return I==null?t:Fr(I,o,p)}function gy(o){return mr(o)&&ui(o)==R}function VL(o){return mr(o)&&ui(o)==me}function GL(o){return mr(o)&&ui(o)==K}function Vf(o,c,p,I,T){return o===c?!0:o==null||c==null||!mr(o)&&!mr(c)?o!==o&&c!==c:YL(o,c,p,I,Vf,T)}function YL(o,c,p,I,T,k){var Z=wt(o),te=wt(c),se=Z?X:ri(o),ue=te?X:ri(c);se=se==R?Te:se,ue=ue==R?Te:ue;var de=se==Te,ve=ue==Te,Se=se==ue;if(Se&&wo(o)){if(!wo(c))return!1;Z=!0,de=!1}if(Se&&!de)return k||(k=new Nn),Z||Sc(o)?Gy(o,c,p,I,T,k):xB(o,c,se,p,I,T,k);if(!(p&O)){var Je=de&&Yt.call(o,"__wrapped__"),ct=ve&&Yt.call(c,"__wrapped__");if(Je||ct){var St=Je?o.value():o,ft=ct?c.value():c;return k||(k=new Nn),T(St,ft,p,I,k)}}return Se?(k||(k=new Nn),AB(o,c,p,I,T,k)):!1}function JL(o){return mr(o)&&ri(o)==he}function m1(o,c,p,I){var T=p.length,k=T,Z=!I;if(o==null)return!k;for(o=tr(o);T--;){var te=p[T];if(Z&&te[2]?te[1]!==o[te[0]]:!(te[0]in o))return!1}for(;++T<k;){te=p[T];var se=te[0],ue=o[se],de=te[1];if(Z&&te[2]){if(ue===t&&!(se in o))return!1}else{var ve=new Nn;if(I)var Se=I(ue,de,se,o,c,ve);if(!(Se===t?Vf(de,ue,O|$,I,ve):Se))return!1}}return!0}function vy(o){if(!hr(o)||RB(o))return!1;var c=Ns(o)?JN:Zr;return c.test(da(o))}function QL(o){return mr(o)&&ui(o)==$e}function ZL(o){return mr(o)&&ri(o)==be}function XL(o){return mr(o)&&Fu(o.length)&&!!Zt[ui(o)]}function my(o){return typeof o=="function"?o:o==null?Di:typeof o=="object"?wt(o)?yy(o[0],o[1]):wy(o):U6(o)}function b1(o){if(!Jf(o))return rL(o);var c=[];for(var p in tr(o))Yt.call(o,p)&&p!="constructor"&&c.push(p);return c}function eB(o){if(!hr(o))return LB(o);var c=Jf(o),p=[];for(var I in o)I=="constructor"&&(c||!Yt.call(o,I))||p.push(I);return p}function w1(o,c){return o<c}function by(o,c){var p=-1,I=Ci(o)?ce(o.length):[];return go(o,function(T,k,Z){I[++p]=c(T,k,Z)}),I}function wy(o){var c=$1(o);return c.length==1&&c[0][2]?Xy(c[0][0],c[0][1]):function(p){return p===o||m1(p,o,c)}}function yy(o,c){return L1(o)&&Zy(c)?Xy(us(o),c):function(p){var I=K1(p,o);return I===t&&I===c?V1(p,o):Vf(c,I,O|$)}}function xu(o,c,p,I,T){o!==c&&d1(c,function(k,Z){if(T||(T=new Nn),hr(k))tB(o,c,Z,p,xu,I,T);else{var te=I?I(F1(o,Z),k,Z+"",o,c,T):t;te===t&&(te=k),h1(o,Z,te)}},Pi)}function tB(o,c,p,I,T,k,Z){var te=F1(o,p),se=F1(c,p),ue=Z.get(se);if(ue){h1(o,p,ue);return}var de=k?k(te,se,p+"",o,c,Z):t,ve=de===t;if(ve){var Se=wt(se),Je=!Se&&wo(se),ct=!Se&&!Je&&Sc(se);de=se,Se||Je||ct?wt(te)?de=te:xr(te)?de=Mi(te):Je?(ve=!1,de=Ry(se,!0)):ct?(ve=!1,de=Ty(se,!0)):de=[]:Zf(se)||pa(se)?(de=te,pa(te)?de=P6(te):(!hr(te)||Ns(te))&&(de=Qy(se))):ve=!1}ve&&(Z.set(se,de),T(de,se,I,k,Z),Z.delete(se)),h1(o,p,de)}function _y(o,c){var p=o.length;if(p)return c+=c<0?p:0,$s(c,p)?o[c]:t}function xy(o,c,p){c.length?c=cr(c,function(k){return wt(k)?function(Z){return ha(Z,k.length===1?k[0]:k)}:k}):c=[Di];var I=-1;c=cr(c,Hi(ot()));var T=by(o,function(k,Z,te){var se=cr(c,function(ue){return ue(k)});return{criteria:se,index:++I,value:k}});return CN(T,function(k,Z){return pB(k,Z,p)})}function rB(o,c){return Ay(o,c,function(p,I){return V1(o,I)})}function Ay(o,c,p){for(var I=-1,T=c.length,k={};++I<T;){var Z=c[I],te=ha(o,Z);p(te,Z)&&Gf(k,mo(Z,o),te)}return k}function iB(o){return function(c){return ha(c,o)}}function y1(o,c,p,I){var T=I?MN:pc,k=-1,Z=c.length,te=o;for(o===c&&(c=Mi(c)),p&&(te=cr(o,Hi(p)));++k<Z;)for(var se=0,ue=c[k],de=p?p(ue):ue;(se=T(te,de,se,I))>-1;)te!==o&&uu.call(te,se,1),uu.call(o,se,1);return o}function Ey(o,c){for(var p=o?c.length:0,I=p-1;p--;){var T=c[p];if(p==I||T!==k){var k=T;$s(T)?uu.call(o,T,1):E1(o,T)}}return o}function _1(o,c){return o+gu(ny()*(c-o+1))}function nB(o,c,p,I){for(var T=-1,k=Dr(pu((c-o)/(p||1)),0),Z=ce(k);k--;)Z[I?k:++T]=o,o+=p;return Z}function x1(o,c){var p="";if(!o||c<1||c>D)return p;do c%2&&(p+=o),c=gu(c/2),c&&(o+=o);while(c);return p}function Mt(o,c){return U1(e6(o,c,Di),o+"")}function sB(o){return ay(Ic(o))}function oB(o,c){var p=Ic(o);return Ru(p,la(c,0,p.length))}function Gf(o,c,p,I){if(!hr(o))return o;c=mo(c,o);for(var T=-1,k=c.length,Z=k-1,te=o;te!=null&&++T<k;){var se=us(c[T]),ue=p;if(se==="__proto__"||se==="constructor"||se==="prototype")return o;if(T!=Z){var de=te[se];ue=I?I(de,se,te):t,ue===t&&(ue=hr(de)?de:$s(c[T+1])?[]:{})}jf(te,se,ue),te=te[se]}return o}var Sy=vu?function(o,c){return vu.set(o,c),o}:Di,aB=du?function(o,c){return du(o,"toString",{configurable:!0,enumerable:!1,value:Y1(c),writable:!0})}:Di;function cB(o){return Ru(Ic(o))}function gn(o,c,p){var I=-1,T=o.length;c<0&&(c=-c>T?0:T+c),p=p>T?T:p,p<0&&(p+=T),T=c>p?0:p-c>>>0,c>>>=0;for(var k=ce(T);++I<T;)k[I]=o[I+c];return k}function fB(o,c){var p;return go(o,function(I,T,k){return p=c(I,T,k),!p}),!!p}function Au(o,c,p){var I=0,T=o==null?I:o.length;if(typeof c=="number"&&c===c&&T<=N){for(;I<T;){var k=I+T>>>1,Z=o[k];Z!==null&&!ji(Z)&&(p?Z<=c:Z<c)?I=k+1:T=k}return T}return A1(o,c,Di,p)}function A1(o,c,p,I){var T=0,k=o==null?0:o.length;if(k===0)return 0;c=p(c);for(var Z=c!==c,te=c===null,se=ji(c),ue=c===t;T<k;){var de=gu((T+k)/2),ve=p(o[de]),Se=ve!==t,Je=ve===null,ct=ve===ve,St=ji(ve);if(Z)var ft=I||ct;else ue?ft=ct&&(I||Se):te?ft=ct&&Se&&(I||!Je):se?ft=ct&&Se&&!Je&&(I||!St):Je||St?ft=!1:ft=I?ve<=c:ve<c;ft?T=de+1:k=de}return ti(k,x)}function Iy(o,c){for(var p=-1,I=o.length,T=0,k=[];++p<I;){var Z=o[p],te=c?c(Z):Z;if(!p||!Ln(te,se)){var se=te;k[T++]=Z===0?0:Z}}return k}function My(o){return typeof o=="number"?o:ji(o)?v:+o}function ki(o){if(typeof o=="string")return o;if(wt(o))return cr(o,ki)+"";if(ji(o))return sy?sy.call(o):"";var c=o+"";return c=="0"&&1/o==-C?"-0":c}function vo(o,c,p){var I=-1,T=ru,k=o.length,Z=!0,te=[],se=te;if(p)Z=!1,T=Zp;else if(k>=n){var ue=c?null:yB(o);if(ue)return nu(ue);Z=!1,T=Ff,se=new fa}else se=c?[]:te;e:for(;++I<k;){var de=o[I],ve=c?c(de):de;if(de=p||de!==0?de:0,Z&&ve===ve){for(var Se=se.length;Se--;)if(se[Se]===ve)continue e;c&&se.push(ve),te.push(de)}else T(se,ve,p)||(se!==te&&se.push(ve),te.push(de))}return te}function E1(o,c){return c=mo(c,o),o=t6(o,c),o==null||delete o[us(vn(c))]}function Cy(o,c,p,I){return Gf(o,c,p(ha(o,c)),I)}function Eu(o,c,p,I){for(var T=o.length,k=I?T:-1;(I?k--:++k<T)&&c(o[k],k,o););return p?gn(o,I?0:k,I?k+1:T):gn(o,I?k+1:0,I?T:k)}function Py(o,c){var p=o;return p instanceof Nt&&(p=p.value()),Xp(c,function(I,T){return T.func.apply(T.thisArg,ho([I],T.args))},p)}function S1(o,c,p){var I=o.length;if(I<2)return I?vo(o[0]):[];for(var T=-1,k=ce(I);++T<I;)for(var Z=o[T],te=-1;++te<I;)te!=T&&(k[T]=Wf(k[T]||Z,o[te],c,p));return vo(Kr(k,1),c,p)}function Dy(o,c,p){for(var I=-1,T=o.length,k=c.length,Z={};++I<T;){var te=I<k?c[I]:t;p(Z,o[I],te)}return Z}function I1(o){return xr(o)?o:[]}function M1(o){return typeof o=="function"?o:Di}function mo(o,c){return wt(o)?o:L1(o,c)?[o]:s6(Vt(o))}var lB=Mt;function bo(o,c,p){var I=o.length;return p=p===t?I:p,!c&&p>=I?o:gn(o,c,p)}var Oy=QN||function(o){return Bt.clearTimeout(o)};function Ry(o,c){if(c)return o.slice();var p=o.length,I=Xw?Xw(p):new o.constructor(p);return o.copy(I),I}function C1(o){var c=new o.constructor(o.byteLength);return new lu(c).set(new lu(o)),c}function hB(o,c){var p=c?C1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.byteLength)}function uB(o){var c=new o.constructor(o.source,_t.exec(o));return c.lastIndex=o.lastIndex,c}function dB(o){return kf?tr(kf.call(o)):{}}function Ty(o,c){var p=c?C1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.length)}function $y(o,c){if(o!==c){var p=o!==t,I=o===null,T=o===o,k=ji(o),Z=c!==t,te=c===null,se=c===c,ue=ji(c);if(!te&&!ue&&!k&&o>c||k&&Z&&se&&!te&&!ue||I&&Z&&se||!p&&se||!T)return 1;if(!I&&!k&&!ue&&o<c||ue&&p&&T&&!I&&!k||te&&p&&T||!Z&&T||!se)return-1}return 0}function pB(o,c,p){for(var I=-1,T=o.criteria,k=c.criteria,Z=T.length,te=p.length;++I<Z;){var se=$y(T[I],k[I]);if(se){if(I>=te)return se;var ue=p[I];return se*(ue=="desc"?-1:1)}}return o.index-c.index}function Ny(o,c,p,I){for(var T=-1,k=o.length,Z=p.length,te=-1,se=c.length,ue=Dr(k-Z,0),de=ce(se+ue),ve=!I;++te<se;)de[te]=c[te];for(;++T<Z;)(ve||T<k)&&(de[p[T]]=o[T]);for(;ue--;)de[te++]=o[T++];return de}function Ly(o,c,p,I){for(var T=-1,k=o.length,Z=-1,te=p.length,se=-1,ue=c.length,de=Dr(k-te,0),ve=ce(de+ue),Se=!I;++T<de;)ve[T]=o[T];for(var Je=T;++se<ue;)ve[Je+se]=c[se];for(;++Z<te;)(Se||T<k)&&(ve[Je+p[Z]]=o[T++]);return ve}function Mi(o,c){var p=-1,I=o.length;for(c||(c=ce(I));++p<I;)c[p]=o[p];return c}function hs(o,c,p,I){var T=!p;p||(p={});for(var k=-1,Z=c.length;++k<Z;){var te=c[k],se=I?I(p[te],o[te],te,p,o):t;se===t&&(se=o[te]),T?Os(p,te,se):jf(p,te,se)}return p}function gB(o,c){return hs(o,N1(o),c)}function vB(o,c){return hs(o,Yy(o),c)}function Su(o,c){return function(p,I){var T=wt(p)?_N:FL,k=c?c():{};return T(p,o,ot(I,2),k)}}function xc(o){return Mt(function(c,p){var I=-1,T=p.length,k=T>1?p[T-1]:t,Z=T>2?p[2]:t;for(k=o.length>3&&typeof k=="function"?(T--,k):t,Z&&di(p[0],p[1],Z)&&(k=T<3?t:k,T=1),c=tr(c);++I<T;){var te=p[I];te&&o(c,te,I,k)}return c})}function By(o,c){return function(p,I){if(p==null)return p;if(!Ci(p))return o(p,I);for(var T=p.length,k=c?T:-1,Z=tr(p);(c?k--:++k<T)&&I(Z[k],k,Z)!==!1;);return p}}function Fy(o){return function(c,p,I){for(var T=-1,k=tr(c),Z=I(c),te=Z.length;te--;){var se=Z[o?te:++T];if(p(k[se],se,k)===!1)break}return c}}function mB(o,c,p){var I=c&W,T=Yf(o);function k(){var Z=this&&this!==Bt&&this instanceof k?T:o;return Z.apply(I?p:this,arguments)}return k}function Uy(o){return function(c){c=Vt(c);var p=gc(c)?$n(c):t,I=p?p[0]:c.charAt(0),T=p?bo(p,1).join(""):c.slice(1);return I[o]()+T}}function Ac(o){return function(c){return Xp(B6(L6(c).replace(Lf,"")),o,"")}}function Yf(o){return function(){var c=arguments;switch(c.length){case 0:return new o;case 1:return new o(c[0]);case 2:return new o(c[0],c[1]);case 3:return new o(c[0],c[1],c[2]);case 4:return new o(c[0],c[1],c[2],c[3]);case 5:return new o(c[0],c[1],c[2],c[3],c[4]);case 6:return new o(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new o(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var p=_c(o.prototype),I=o.apply(p,c);return hr(I)?I:p}}function bB(o,c,p){var I=Yf(o);function T(){for(var k=arguments.length,Z=ce(k),te=k,se=Ec(T);te--;)Z[te]=arguments[te];var ue=k<3&&Z[0]!==se&&Z[k-1]!==se?[]:uo(Z,se);if(k-=ue.length,k<p)return jy(o,c,Iu,T.placeholder,t,Z,ue,t,t,p-k);var de=this&&this!==Bt&&this instanceof T?I:o;return Fr(de,this,Z)}return T}function qy(o){return function(c,p,I){var T=tr(c);if(!Ci(c)){var k=ot(p,3);c=Ur(c),p=function(te){return k(T[te],te,T)}}var Z=o(c,p,I);return Z>-1?T[k?c[Z]:Z]:t}}function zy(o){return Ts(function(c){var p=c.length,I=p,T=dn.prototype.thru;for(o&&c.reverse();I--;){var k=c[I];if(typeof k!="function")throw new un(a);if(T&&!Z&&Du(k)=="wrapper")var Z=new dn([],!0)}for(I=Z?I:p;++I<p;){k=c[I];var te=Du(k),se=te=="wrapper"?T1(k):t;se&&B1(se[0])&&se[1]==(_|Y|z|U)&&!se[4].length&&se[9]==1?Z=Z[Du(se[0])].apply(Z,se[3]):Z=k.length==1&&B1(k)?Z[te]():Z.thru(k)}return function(){var ue=arguments,de=ue[0];if(Z&&ue.length==1&&wt(de))return Z.plant(de).value();for(var ve=0,Se=p?c[ve].apply(this,ue):de;++ve<p;)Se=c[ve].call(this,Se);return Se}})}function Iu(o,c,p,I,T,k,Z,te,se,ue){var de=c&_,ve=c&W,Se=c&H,Je=c&(Y|B),ct=c&ee,St=Se?t:Yf(o);function ft(){for(var Rt=arguments.length,Ft=ce(Rt),Wi=Rt;Wi--;)Ft[Wi]=arguments[Wi];if(Je)var pi=Ec(ft),Ki=DN(Ft,pi);if(I&&(Ft=Ny(Ft,I,T,Je)),k&&(Ft=Ly(Ft,k,Z,Je)),Rt-=Ki,Je&&Rt<ue){var Ar=uo(Ft,pi);return jy(o,c,Iu,ft.placeholder,p,Ft,Ar,te,se,ue-Rt)}var Bn=ve?p:this,Bs=Se?Bn[o]:o;return Rt=Ft.length,te?Ft=FB(Ft,te):ct&&Rt>1&&Ft.reverse(),de&&se<Rt&&(Ft.length=se),this&&this!==Bt&&this instanceof ft&&(Bs=St||Yf(Bs)),Bs.apply(Bn,Ft)}return ft}function Hy(o,c){return function(p,I){return KL(p,o,c(I),{})}}function Mu(o,c){return function(p,I){var T;if(p===t&&I===t)return c;if(p!==t&&(T=p),I!==t){if(T===t)return I;typeof p=="string"||typeof I=="string"?(p=ki(p),I=ki(I)):(p=My(p),I=My(I)),T=o(p,I)}return T}}function P1(o){return Ts(function(c){return c=cr(c,Hi(ot())),Mt(function(p){var I=this;return o(c,function(T){return Fr(T,I,p)})})})}function Cu(o,c){c=c===t?" ":ki(c);var p=c.length;if(p<2)return p?x1(c,o):c;var I=x1(c,pu(o/vc(c)));return gc(c)?bo($n(I),0,o).join(""):I.slice(0,o)}function wB(o,c,p,I){var T=c&W,k=Yf(o);function Z(){for(var te=-1,se=arguments.length,ue=-1,de=I.length,ve=ce(de+se),Se=this&&this!==Bt&&this instanceof Z?k:o;++ue<de;)ve[ue]=I[ue];for(;se--;)ve[ue++]=arguments[++te];return Fr(Se,T?p:this,ve)}return Z}function ky(o){return function(c,p,I){return I&&typeof I!="number"&&di(c,p,I)&&(p=I=t),c=Ls(c),p===t?(p=c,c=0):p=Ls(p),I=I===t?c<p?1:-1:Ls(I),nB(c,p,I,o)}}function Pu(o){return function(c,p){return typeof c=="string"&&typeof p=="string"||(c=mn(c),p=mn(p)),o(c,p)}}function jy(o,c,p,I,T,k,Z,te,se,ue){var de=c&Y,ve=de?Z:t,Se=de?t:Z,Je=de?k:t,ct=de?t:k;c|=de?z:j,c&=~(de?j:z),c&F||(c&=~(W|H));var St=[o,c,T,Je,ve,ct,Se,te,se,ue],ft=p.apply(t,St);return B1(o)&&r6(ft,St),ft.placeholder=I,i6(ft,o,c)}function D1(o){var c=Pr[o];return function(p,I){if(p=mn(p),I=I==null?0:ti(Et(I),292),I&&iy(p)){var T=(Vt(p)+"e").split("e"),k=c(T[0]+"e"+(+T[1]+I));return T=(Vt(k)+"e").split("e"),+(T[0]+"e"+(+T[1]-I))}return c(p)}}var yB=wc&&1/nu(new wc([,-0]))[1]==C?function(o){return new wc(o)}:Z1;function Wy(o){return function(c){var p=ri(c);return p==he?o1(c):p==be?BN(c):PN(c,o(c))}}function Rs(o,c,p,I,T,k,Z,te){var se=c&H;if(!se&&typeof o!="function")throw new un(a);var ue=I?I.length:0;if(ue||(c&=~(z|j),I=T=t),Z=Z===t?Z:Dr(Et(Z),0),te=te===t?te:Et(te),ue-=T?T.length:0,c&j){var de=I,ve=T;I=T=t}var Se=se?t:T1(o),Je=[o,c,p,I,T,de,ve,k,Z,te];if(Se&&NB(Je,Se),o=Je[0],c=Je[1],p=Je[2],I=Je[3],T=Je[4],te=Je[9]=Je[9]===t?se?0:o.length:Dr(Je[9]-ue,0),!te&&c&(Y|B)&&(c&=~(Y|B)),!c||c==W)var ct=mB(o,c,p);else c==Y||c==B?ct=bB(o,c,te):(c==z||c==(W|z))&&!T.length?ct=wB(o,c,p,I):ct=Iu.apply(t,Je);var St=Se?Sy:r6;return i6(St(ct,Je),o,c)}function Ky(o,c,p,I){return o===t||Ln(o,bc[p])&&!Yt.call(I,p)?c:o}function Vy(o,c,p,I,T,k){return hr(o)&&hr(c)&&(k.set(c,o),xu(o,c,t,Vy,k),k.delete(c)),o}function _B(o){return Zf(o)?t:o}function Gy(o,c,p,I,T,k){var Z=p&O,te=o.length,se=c.length;if(te!=se&&!(Z&&se>te))return!1;var ue=k.get(o),de=k.get(c);if(ue&&de)return ue==c&&de==o;var ve=-1,Se=!0,Je=p&$?new fa:t;for(k.set(o,c),k.set(c,o);++ve<te;){var ct=o[ve],St=c[ve];if(I)var ft=Z?I(St,ct,ve,c,o,k):I(ct,St,ve,o,c,k);if(ft!==t){if(ft)continue;Se=!1;break}if(Je){if(!e1(c,function(Rt,Ft){if(!Ff(Je,Ft)&&(ct===Rt||T(ct,Rt,p,I,k)))return Je.push(Ft)})){Se=!1;break}}else if(!(ct===St||T(ct,St,p,I,k))){Se=!1;break}}return k.delete(o),k.delete(c),Se}function xB(o,c,p,I,T,k,Z){switch(p){case Me:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case me:return!(o.byteLength!=c.byteLength||!k(new lu(o),new lu(c)));case J:case K:case ge:return Ln(+o,+c);case G:return o.name==c.name&&o.message==c.message;case $e:case Pe:return o==c+"";case he:var te=o1;case be:var se=I&O;if(te||(te=nu),o.size!=c.size&&!se)return!1;var ue=Z.get(o);if(ue)return ue==c;I|=$,Z.set(o,c);var de=Gy(te(o),te(c),I,T,k,Z);return Z.delete(o),de;case De:if(kf)return kf.call(o)==kf.call(c)}return!1}function AB(o,c,p,I,T,k){var Z=p&O,te=O1(o),se=te.length,ue=O1(c),de=ue.length;if(se!=de&&!Z)return!1;for(var ve=se;ve--;){var Se=te[ve];if(!(Z?Se in c:Yt.call(c,Se)))return!1}var Je=k.get(o),ct=k.get(c);if(Je&&ct)return Je==c&&ct==o;var St=!0;k.set(o,c),k.set(c,o);for(var ft=Z;++ve<se;){Se=te[ve];var Rt=o[Se],Ft=c[Se];if(I)var Wi=Z?I(Ft,Rt,Se,c,o,k):I(Rt,Ft,Se,o,c,k);if(!(Wi===t?Rt===Ft||T(Rt,Ft,p,I,k):Wi)){St=!1;break}ft||(ft=Se=="constructor")}if(St&&!ft){var pi=o.constructor,Ki=c.constructor;pi!=Ki&&"constructor"in o&&"constructor"in c&&!(typeof pi=="function"&&pi instanceof pi&&typeof Ki=="function"&&Ki instanceof Ki)&&(St=!1)}return k.delete(o),k.delete(c),St}function Ts(o){return U1(e6(o,t,f6),o+"")}function O1(o){return py(o,Ur,N1)}function R1(o){return py(o,Pi,Yy)}var T1=vu?function(o){return vu.get(o)}:Z1;function Du(o){for(var c=o.name+"",p=yc[c],I=Yt.call(yc,c)?p.length:0;I--;){var T=p[I],k=T.func;if(k==null||k==o)return T.name}return c}function Ec(o){var c=Yt.call(q,"placeholder")?q:o;return c.placeholder}function ot(){var o=q.iteratee||J1;return o=o===J1?my:o,arguments.length?o(arguments[0],arguments[1]):o}function Ou(o,c){var p=o.__data__;return OB(c)?p[typeof c=="string"?"string":"hash"]:p.map}function $1(o){for(var c=Ur(o),p=c.length;p--;){var I=c[p],T=o[I];c[p]=[I,T,Zy(T)]}return c}function ua(o,c){var p=$N(o,c);return vy(p)?p:t}function EB(o){var c=Yt.call(o,aa),p=o[aa];try{o[aa]=t;var I=!0}catch{}var T=cu.call(o);return I&&(c?o[aa]=p:delete o[aa]),T}var N1=c1?function(o){return o==null?[]:(o=tr(o),lo(c1(o),function(c){return ty.call(o,c)}))}:X1,Yy=c1?function(o){for(var c=[];o;)ho(c,N1(o)),o=hu(o);return c}:X1,ri=ui;(f1&&ri(new f1(new ArrayBuffer(1)))!=Me||qf&&ri(new qf)!=he||l1&&ri(l1.resolve())!=Ce||wc&&ri(new wc)!=be||zf&&ri(new zf)!=Ie)&&(ri=function(o){var c=ui(o),p=c==Te?o.constructor:t,I=p?da(p):"";if(I)switch(I){case oL:return Me;case aL:return he;case cL:return Ce;case fL:return be;case lL:return Ie}return c});function SB(o,c,p){for(var I=-1,T=p.length;++I<T;){var k=p[I],Z=k.size;switch(k.type){case"drop":o+=Z;break;case"dropRight":c-=Z;break;case"take":c=ti(c,o+Z);break;case"takeRight":o=Dr(o,c-Z);break}}return{start:o,end:c}}function IB(o){var c=o.match(Qe);return c?c[1].split(qe):[]}function Jy(o,c,p){c=mo(c,o);for(var I=-1,T=c.length,k=!1;++I<T;){var Z=us(c[I]);if(!(k=o!=null&&p(o,Z)))break;o=o[Z]}return k||++I!=T?k:(T=o==null?0:o.length,!!T&&Fu(T)&&$s(Z,T)&&(wt(o)||pa(o)))}function MB(o){var c=o.length,p=new o.constructor(c);return c&&typeof o[0]=="string"&&Yt.call(o,"index")&&(p.index=o.index,p.input=o.input),p}function Qy(o){return typeof o.constructor=="function"&&!Jf(o)?_c(hu(o)):{}}function CB(o,c,p){var I=o.constructor;switch(c){case me:return C1(o);case J:case K:return new I(+o);case Me:return hB(o,p);case Be:case we:case ke:case We:case xe:case Ve:case Ke:case Ge:case mt:return Ty(o,p);case he:return new I;case ge:case Pe:return new I(o);case $e:return uB(o);case be:return new I;case De:return dB(o)}}function PB(o,c){var p=c.length;if(!p)return o;var I=p-1;return c[I]=(p>1?"& ":"")+c[I],c=c.join(p>2?", ":" "),o.replace(st,`{
51
51
  /* [wrapped with `+c+`] */
52
- `)}function PB(o){return wt(o)||pa(o)||!!(ry&&o&&o[ry])}function Ts(o,c){var p=typeof o;return c=c??D,!!c&&(p=="number"||p!="symbol"&&ei.test(o))&&o>-1&&o%1==0&&o<c}function di(o,c,p){if(!hr(p))return!1;var I=typeof c;return(I=="number"?Ci(p)&&Ts(c,p.length):I=="string"&&c in p)?Nn(p[c],o):!1}function L1(o,c){if(wt(o))return!1;var p=typeof o;return p=="number"||p=="symbol"||p=="boolean"||o==null||Hi(o)?!0:lt.test(o)||!Re.test(o)||c!=null&&o in tr(c)}function DB(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function B1(o){var c=Du(o),p=q[c];if(typeof p!="function"||!(c in Nt.prototype))return!1;if(o===p)return!0;var I=T1(p);return!!I&&o===I[0]}function OB(o){return!!Zw&&Zw in o}var RB=ou?$s:eg;function Jf(o){var c=o&&o.constructor,p=typeof c=="function"&&c.prototype||bc;return o===p}function Zy(o){return o===o&&!hr(o)}function Xy(o,c){return function(p){return p==null?!1:p[o]===c&&(c!==t||o in tr(p))}}function TB(o){var c=Lu(o,function(I){return p.size===u&&p.clear(),I}),p=c.cache;return c}function $B(o,c){var p=o[1],I=c[1],T=p|I,H=T<(W|k|_),Z=I==_&&p==Y||I==_&&p==U&&o[7].length<=c[8]||I==(_|U)&&c[7].length<=c[8]&&p==Y;if(!(H||Z))return o;I&W&&(o[2]=c[2],T|=p&W?0:F);var te=c[3];if(te){var se=o[3];o[3]=se?Ny(se,te,c[4]):te,o[4]=se?ho(o[3],g):c[4]}return te=c[5],te&&(se=o[5],o[5]=se?Ly(se,te,c[6]):te,o[6]=se?ho(o[5],g):c[6]),te=c[7],te&&(o[7]=te),I&_&&(o[8]=o[8]==null?c[8]:ti(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=T,o}function NB(o){var c=[];if(o!=null)for(var p in tr(o))c.push(p);return c}function LB(o){return cu.call(o)}function e6(o,c,p){return c=Dr(c===t?o.length-1:c,0),function(){for(var I=arguments,T=-1,H=Dr(I.length-c,0),Z=ce(H);++T<H;)Z[T]=I[c+T];T=-1;for(var te=ce(c+1);++T<c;)te[T]=I[T];return te[c]=p(Z),Fr(o,this,te)}}function t6(o,c){return c.length<2?o:ha(o,un(c,0,-1))}function BB(o,c){for(var p=o.length,I=ti(c.length,p),T=Mi(o);I--;){var H=c[I];o[I]=Ts(H,p)?T[H]:t}return o}function F1(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var r6=n6(Sy),Qf=ZN||function(o,c){return Bt.setTimeout(o,c)},U1=n6(oB);function i6(o,c,p){var I=c+"";return U1(o,CB(I,FB(SB(I),p)))}function n6(o){var c=0,p=0;return function(){var I=rL(),T=m-(I-p);if(p=I,T>0){if(++c>=b)return arguments[0]}else c=0;return o.apply(t,arguments)}}function Ru(o,c){var p=-1,I=o.length,T=I-1;for(c=c===t?I:c;++p<c;){var H=_1(p,T),Z=o[H];o[H]=o[p],o[p]=Z}return o.length=c,o}var s6=TB(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(ht,function(p,I,T,H){c.push(T?H.replace(at,"$1"):I||p)}),c});function us(o){if(typeof o=="string"||Hi(o))return o;var c=o+"";return c=="0"&&1/o==-C?"-0":c}function da(o){if(o!=null){try{return au.call(o)}catch{}try{return o+""}catch{}}return""}function FB(o,c){return cn(ae,function(p){var I="_."+p[0];c&p[1]&&!ru(o,I)&&o.push(I)}),o.sort()}function o6(o){if(o instanceof Nt)return o.clone();var c=new ln(o.__wrapped__,o.__chain__);return c.__actions__=Mi(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function UB(o,c,p){(p?di(o,c,p):c===t)?c=1:c=Dr(Et(c),0);var I=o==null?0:o.length;if(!I||c<1)return[];for(var T=0,H=0,Z=ce(pu(I/c));T<I;)Z[H++]=un(o,T,T+=c);return Z}function qB(o){for(var c=-1,p=o==null?0:o.length,I=0,T=[];++c<p;){var H=o[c];H&&(T[I++]=H)}return T}function zB(){var o=arguments.length;if(!o)return[];for(var c=ce(o-1),p=arguments[0],I=o;I--;)c[I-1]=arguments[I];return lo(wt(p)?Mi(p):[p],Kr(c,1))}var kB=Mt(function(o,c){return xr(o)?Wf(o,Kr(c,1,xr,!0)):[]}),HB=Mt(function(o,c){var p=dn(c);return xr(p)&&(p=t),xr(o)?Wf(o,Kr(c,1,xr,!0),ot(p,2)):[]}),jB=Mt(function(o,c){var p=dn(c);return xr(p)&&(p=t),xr(o)?Wf(o,Kr(c,1,xr,!0),t,p):[]});function WB(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),un(o,c<0?0:c,I)):[]}function KB(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),c=I-c,un(o,0,c<0?0:c)):[]}function VB(o,c){return o&&o.length?Eu(o,ot(c,3),!0,!0):[]}function GB(o,c){return o&&o.length?Eu(o,ot(c,3),!0):[]}function YB(o,c,p,I){var T=o==null?0:o.length;return T?(p&&typeof p!="number"&&di(o,c,p)&&(p=0,I=T),zL(o,c,p,I)):[]}function a6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:Et(p);return T<0&&(T=Dr(I+T,0)),iu(o,ot(c,3),T)}function c6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I-1;return p!==t&&(T=Et(p),T=p<0?Dr(I+T,0):ti(T,I-1)),iu(o,ot(c,3),T,!0)}function f6(o){var c=o==null?0:o.length;return c?Kr(o,1):[]}function JB(o){var c=o==null?0:o.length;return c?Kr(o,C):[]}function QB(o,c){var p=o==null?0:o.length;return p?(c=c===t?1:Et(c),Kr(o,c)):[]}function ZB(o){for(var c=-1,p=o==null?0:o.length,I={};++c<p;){var T=o[c];I[T[0]]=T[1]}return I}function l6(o){return o&&o.length?o[0]:t}function XB(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:Et(p);return T<0&&(T=Dr(I+T,0)),pc(o,c,T)}function eF(o){var c=o==null?0:o.length;return c?un(o,0,-1):[]}var tF=Mt(function(o){var c=cr(o,I1);return c.length&&c[0]===o[0]?v1(c):[]}),rF=Mt(function(o){var c=dn(o),p=cr(o,I1);return c===dn(p)?c=t:p.pop(),p.length&&p[0]===o[0]?v1(p,ot(c,2)):[]}),iF=Mt(function(o){var c=dn(o),p=cr(o,I1);return c=typeof c=="function"?c:t,c&&p.pop(),p.length&&p[0]===o[0]?v1(p,t,c):[]});function nF(o,c){return o==null?"":eL.call(o,c)}function dn(o){var c=o==null?0:o.length;return c?o[c-1]:t}function sF(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I;return p!==t&&(T=Et(p),T=T<0?Dr(I+T,0):ti(T,I-1)),c===c?FN(o,c,T):iu(o,jw,T,!0)}function oF(o,c){return o&&o.length?_y(o,Et(c)):t}var aF=Mt(h6);function h6(o,c){return o&&o.length&&c&&c.length?y1(o,c):o}function cF(o,c,p){return o&&o.length&&c&&c.length?y1(o,c,ot(p,2)):o}function fF(o,c,p){return o&&o.length&&c&&c.length?y1(o,c,t,p):o}var lF=Rs(function(o,c){var p=o==null?0:o.length,I=u1(o,c);return Ey(o,cr(c,function(T){return Ts(T,p)?+T:T}).sort($y)),I});function hF(o,c){var p=[];if(!(o&&o.length))return p;var I=-1,T=[],H=o.length;for(c=ot(c,3);++I<H;){var Z=o[I];c(Z,I,o)&&(p.push(Z),T.push(I))}return Ey(o,T),p}function q1(o){return o==null?o:nL.call(o)}function uF(o,c,p){var I=o==null?0:o.length;return I?(p&&typeof p!="number"&&di(o,c,p)?(c=0,p=I):(c=c==null?0:Et(c),p=p===t?I:Et(p)),un(o,c,p)):[]}function dF(o,c){return Au(o,c)}function pF(o,c,p){return A1(o,c,ot(p,2))}function gF(o,c){var p=o==null?0:o.length;if(p){var I=Au(o,c);if(I<p&&Nn(o[I],c))return I}return-1}function vF(o,c){return Au(o,c,!0)}function mF(o,c,p){return A1(o,c,ot(p,2),!0)}function bF(o,c){var p=o==null?0:o.length;if(p){var I=Au(o,c,!0)-1;if(Nn(o[I],c))return I}return-1}function wF(o){return o&&o.length?Iy(o):[]}function yF(o,c){return o&&o.length?Iy(o,ot(c,2)):[]}function _F(o){var c=o==null?0:o.length;return c?un(o,1,c):[]}function xF(o,c,p){return o&&o.length?(c=p||c===t?1:Et(c),un(o,0,c<0?0:c)):[]}function AF(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),c=I-c,un(o,c<0?0:c,I)):[]}function EF(o,c){return o&&o.length?Eu(o,ot(c,3),!1,!0):[]}function SF(o,c){return o&&o.length?Eu(o,ot(c,3)):[]}var IF=Mt(function(o){return go(Kr(o,1,xr,!0))}),MF=Mt(function(o){var c=dn(o);return xr(c)&&(c=t),go(Kr(o,1,xr,!0),ot(c,2))}),CF=Mt(function(o){var c=dn(o);return c=typeof c=="function"?c:t,go(Kr(o,1,xr,!0),t,c)});function PF(o){return o&&o.length?go(o):[]}function DF(o,c){return o&&o.length?go(o,ot(c,2)):[]}function OF(o,c){return c=typeof c=="function"?c:t,o&&o.length?go(o,t,c):[]}function z1(o){if(!(o&&o.length))return[];var c=0;return o=fo(o,function(p){if(xr(p))return c=Dr(p.length,c),!0}),n1(c,function(p){return cr(o,t1(p))})}function u6(o,c){if(!(o&&o.length))return[];var p=z1(o);return c==null?p:cr(p,function(I){return Fr(c,t,I)})}var RF=Mt(function(o,c){return xr(o)?Wf(o,c):[]}),TF=Mt(function(o){return S1(fo(o,xr))}),$F=Mt(function(o){var c=dn(o);return xr(c)&&(c=t),S1(fo(o,xr),ot(c,2))}),NF=Mt(function(o){var c=dn(o);return c=typeof c=="function"?c:t,S1(fo(o,xr),t,c)}),LF=Mt(z1);function BF(o,c){return Dy(o||[],c||[],jf)}function FF(o,c){return Dy(o||[],c||[],Gf)}var UF=Mt(function(o){var c=o.length,p=c>1?o[c-1]:t;return p=typeof p=="function"?(o.pop(),p):t,u6(o,p)});function d6(o){var c=q(o);return c.__chain__=!0,c}function qF(o,c){return c(o),o}function Tu(o,c){return c(o)}var zF=Rs(function(o){var c=o.length,p=c?o[0]:0,I=this.__wrapped__,T=function(H){return u1(H,o)};return c>1||this.__actions__.length||!(I instanceof Nt)||!Ts(p)?this.thru(T):(I=I.slice(p,+p+(c?1:0)),I.__actions__.push({func:Tu,args:[T],thisArg:t}),new ln(I,this.__chain__).thru(function(H){return c&&!H.length&&H.push(t),H}))});function kF(){return d6(this)}function HF(){return new ln(this.value(),this.__chain__)}function jF(){this.__values__===t&&(this.__values__=M6(this.value()));var o=this.__index__>=this.__values__.length,c=o?t:this.__values__[this.__index__++];return{done:o,value:c}}function WF(){return this}function KF(o){for(var c,p=this;p instanceof bu;){var I=o6(p);I.__index__=0,I.__values__=t,c?T.__wrapped__=I:c=I;var T=I;p=p.__wrapped__}return T.__wrapped__=o,c}function VF(){var o=this.__wrapped__;if(o instanceof Nt){var c=o;return this.__actions__.length&&(c=new Nt(this)),c=c.reverse(),c.__actions__.push({func:Tu,args:[q1],thisArg:t}),new ln(c,this.__chain__)}return this.thru(q1)}function GF(){return Py(this.__wrapped__,this.__actions__)}var YF=Su(function(o,c,p){Yt.call(o,p)?++o[p]:Ds(o,p,1)});function JF(o,c,p){var I=wt(o)?kw:qL;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}function QF(o,c){var p=wt(o)?fo:uy;return p(o,ot(c,3))}var ZF=qy(a6),XF=qy(c6);function eU(o,c){return Kr($u(o,c),1)}function tU(o,c){return Kr($u(o,c),C)}function rU(o,c,p){return p=p===t?1:Et(p),Kr($u(o,c),p)}function p6(o,c){var p=wt(o)?cn:po;return p(o,ot(c,3))}function g6(o,c){var p=wt(o)?_N:hy;return p(o,ot(c,3))}var iU=Su(function(o,c,p){Yt.call(o,p)?o[p].push(c):Ds(o,p,[c])});function nU(o,c,p,I){o=Ci(o)?o:Ic(o),p=p&&!I?Et(p):0;var T=o.length;return p<0&&(p=Dr(T+p,0)),Uu(o)?p<=T&&o.indexOf(c,p)>-1:!!T&&pc(o,c,p)>-1}var sU=Mt(function(o,c,p){var I=-1,T=typeof c=="function",H=Ci(o)?ce(o.length):[];return po(o,function(Z){H[++I]=T?Fr(c,Z,p):Kf(Z,c,p)}),H}),oU=Su(function(o,c,p){Ds(o,p,c)});function $u(o,c){var p=wt(o)?cr:by;return p(o,ot(c,3))}function aU(o,c,p,I){return o==null?[]:(wt(c)||(c=c==null?[]:[c]),p=I?t:p,wt(p)||(p=p==null?[]:[p]),xy(o,c,p))}var cU=Su(function(o,c,p){o[p?0:1].push(c)},function(){return[[],[]]});function fU(o,c,p){var I=wt(o)?Xp:Kw,T=arguments.length<3;return I(o,ot(c,4),p,T,po)}function lU(o,c,p){var I=wt(o)?xN:Kw,T=arguments.length<3;return I(o,ot(c,4),p,T,hy)}function hU(o,c){var p=wt(o)?fo:uy;return p(o,Bu(ot(c,3)))}function uU(o){var c=wt(o)?ay:nB;return c(o)}function dU(o,c,p){(p?di(o,c,p):c===t)?c=1:c=Et(c);var I=wt(o)?NL:sB;return I(o,c)}function pU(o){var c=wt(o)?LL:aB;return c(o)}function gU(o){if(o==null)return 0;if(Ci(o))return Uu(o)?vc(o):o.length;var c=ri(o);return c==he||c==be?o.size:b1(o).length}function vU(o,c,p){var I=wt(o)?e1:cB;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}var mU=Mt(function(o,c){if(o==null)return[];var p=c.length;return p>1&&di(o,c[0],c[1])?c=[]:p>2&&di(c[0],c[1],c[2])&&(c=[c[0]]),xy(o,Kr(c,1),[])}),Nu=QN||function(){return Bt.Date.now()};function bU(o,c){if(typeof c!="function")throw new fn(a);return o=Et(o),function(){if(--o<1)return c.apply(this,arguments)}}function v6(o,c,p){return c=p?t:c,c=o&&c==null?o.length:c,Os(o,_,t,t,t,t,c)}function m6(o,c){var p;if(typeof c!="function")throw new fn(a);return o=Et(o),function(){return--o>0&&(p=c.apply(this,arguments)),o<=1&&(c=t),p}}var k1=Mt(function(o,c,p){var I=W;if(p.length){var T=ho(p,Ec(k1));I|=z}return Os(o,I,c,p,T)}),b6=Mt(function(o,c,p){var I=W|k;if(p.length){var T=ho(p,Ec(b6));I|=z}return Os(c,I,o,p,T)});function w6(o,c,p){c=p?t:c;var I=Os(o,Y,t,t,t,t,t,c);return I.placeholder=w6.placeholder,I}function y6(o,c,p){c=p?t:c;var I=Os(o,B,t,t,t,t,t,c);return I.placeholder=y6.placeholder,I}function _6(o,c,p){var I,T,H,Z,te,se,ue=0,de=!1,ve=!1,Se=!0;if(typeof o!="function")throw new fn(a);c=pn(c)||0,hr(p)&&(de=!!p.leading,ve="maxWait"in p,H=ve?Dr(pn(p.maxWait)||0,c):H,Se="trailing"in p?!!p.trailing:Se);function Je(Ar){var Ln=I,Ls=T;return I=T=t,ue=Ar,Z=o.apply(Ls,Ln),Z}function ct(Ar){return ue=Ar,te=Qf(Rt,c),de?Je(Ar):Z}function St(Ar){var Ln=Ar-se,Ls=Ar-ue,q6=c-Ln;return ve?ti(q6,H-Ls):q6}function ft(Ar){var Ln=Ar-se,Ls=Ar-ue;return se===t||Ln>=c||Ln<0||ve&&Ls>=H}function Rt(){var Ar=Nu();if(ft(Ar))return Ft(Ar);te=Qf(Rt,St(Ar))}function Ft(Ar){return te=t,Se&&I?Je(Ar):(I=T=t,Z)}function ji(){te!==t&&Oy(te),ue=0,I=se=T=te=t}function pi(){return te===t?Z:Ft(Nu())}function Wi(){var Ar=Nu(),Ln=ft(Ar);if(I=arguments,T=this,se=Ar,Ln){if(te===t)return ct(se);if(ve)return Oy(te),te=Qf(Rt,c),Je(se)}return te===t&&(te=Qf(Rt,c)),Z}return Wi.cancel=ji,Wi.flush=pi,Wi}var wU=Mt(function(o,c){return ly(o,1,c)}),yU=Mt(function(o,c,p){return ly(o,pn(c)||0,p)});function _U(o){return Os(o,ee)}function Lu(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new fn(a);var p=function(){var I=arguments,T=c?c.apply(this,I):I[0],H=p.cache;if(H.has(T))return H.get(T);var Z=o.apply(this,I);return p.cache=H.set(T,Z)||H,Z};return p.cache=new(Lu.Cache||Ps),p}Lu.Cache=Ps;function Bu(o){if(typeof o!="function")throw new fn(a);return function(){var c=arguments;switch(c.length){case 0:return!o.call(this);case 1:return!o.call(this,c[0]);case 2:return!o.call(this,c[0],c[1]);case 3:return!o.call(this,c[0],c[1],c[2])}return!o.apply(this,c)}}function xU(o){return m6(2,o)}var AU=fB(function(o,c){c=c.length==1&&wt(c[0])?cr(c[0],zi(ot())):cr(Kr(c,1),zi(ot()));var p=c.length;return Mt(function(I){for(var T=-1,H=ti(I.length,p);++T<H;)I[T]=c[T].call(this,I[T]);return Fr(o,this,I)})}),H1=Mt(function(o,c){var p=ho(c,Ec(H1));return Os(o,z,t,c,p)}),x6=Mt(function(o,c){var p=ho(c,Ec(x6));return Os(o,j,t,c,p)}),EU=Rs(function(o,c){return Os(o,U,t,t,t,c)});function SU(o,c){if(typeof o!="function")throw new fn(a);return c=c===t?c:Et(c),Mt(o,c)}function IU(o,c){if(typeof o!="function")throw new fn(a);return c=c==null?0:Dr(Et(c),0),Mt(function(p){var I=p[c],T=mo(p,0,c);return I&&lo(T,I),Fr(o,this,T)})}function MU(o,c,p){var I=!0,T=!0;if(typeof o!="function")throw new fn(a);return hr(p)&&(I="leading"in p?!!p.leading:I,T="trailing"in p?!!p.trailing:T),_6(o,c,{leading:I,maxWait:c,trailing:T})}function CU(o){return v6(o,1)}function PU(o,c){return H1(M1(c),o)}function DU(){if(!arguments.length)return[];var o=arguments[0];return wt(o)?o:[o]}function OU(o){return hn(o,M)}function RU(o,c){return c=typeof c=="function"?c:t,hn(o,M,c)}function TU(o){return hn(o,w|M)}function $U(o,c){return c=typeof c=="function"?c:t,hn(o,w|M,c)}function NU(o,c){return c==null||fy(o,c,Ur(c))}function Nn(o,c){return o===c||o!==o&&c!==c}var LU=Pu(g1),BU=Pu(function(o,c){return o>=c}),pa=gy(function(){return arguments}())?gy:function(o){return mr(o)&&Yt.call(o,"callee")&&!ty.call(o,"callee")},wt=ce.isArray,FU=hi?zi(hi):KL;function Ci(o){return o!=null&&Fu(o.length)&&!$s(o)}function xr(o){return mr(o)&&Ci(o)}function UU(o){return o===!0||o===!1||mr(o)&&ui(o)==J}var bo=XN||eg,qU=Rn?zi(Rn):VL;function zU(o){return mr(o)&&o.nodeType===1&&!Zf(o)}function kU(o){if(o==null)return!0;if(Ci(o)&&(wt(o)||typeof o=="string"||typeof o.splice=="function"||bo(o)||Sc(o)||pa(o)))return!o.length;var c=ri(o);if(c==he||c==be)return!o.size;if(Jf(o))return!b1(o).length;for(var p in o)if(Yt.call(o,p))return!1;return!0}function HU(o,c){return Vf(o,c)}function jU(o,c,p){p=typeof p=="function"?p:t;var I=p?p(o,c):t;return I===t?Vf(o,c,t,p):!!I}function j1(o){if(!mr(o))return!1;var c=ui(o);return c==G||c==E||typeof o.message=="string"&&typeof o.name=="string"&&!Zf(o)}function WU(o){return typeof o=="number"&&iy(o)}function $s(o){if(!hr(o))return!1;var c=ui(o);return c==re||c==le||c==V||c==Xe}function A6(o){return typeof o=="number"&&o==Et(o)}function Fu(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=D}function hr(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function mr(o){return o!=null&&typeof o=="object"}var E6=an?zi(an):YL;function KU(o,c){return o===c||m1(o,c,$1(c))}function VU(o,c,p){return p=typeof p=="function"?p:t,m1(o,c,$1(c),p)}function GU(o){return S6(o)&&o!=+o}function YU(o){if(RB(o))throw new gt(s);return vy(o)}function JU(o){return o===null}function QU(o){return o==null}function S6(o){return typeof o=="number"||mr(o)&&ui(o)==ge}function Zf(o){if(!mr(o)||ui(o)!=Te)return!1;var c=hu(o);if(c===null)return!0;var p=Yt.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&au.call(p)==VN}var W1=fs?zi(fs):JL;function ZU(o){return A6(o)&&o>=-D&&o<=D}var I6=Bf?zi(Bf):QL;function Uu(o){return typeof o=="string"||!wt(o)&&mr(o)&&ui(o)==Pe}function Hi(o){return typeof o=="symbol"||mr(o)&&ui(o)==De}var Sc=oa?zi(oa):ZL;function XU(o){return o===t}function eq(o){return mr(o)&&ri(o)==Ie}function tq(o){return mr(o)&&ui(o)==Oe}var rq=Pu(w1),iq=Pu(function(o,c){return o<=c});function M6(o){if(!o)return[];if(Ci(o))return Uu(o)?Tn(o):Mi(o);if(Uf&&o[Uf])return NN(o[Uf]());var c=ri(o),p=c==he?o1:c==be?nu:Ic;return p(o)}function Ns(o){if(!o)return o===0?o:0;if(o=pn(o),o===C||o===-C){var c=o<0?-1:1;return c*S}return o===o?o:0}function Et(o){var c=Ns(o),p=c%1;return c===c?p?c-p:c:0}function C6(o){return o?la(Et(o),0,A):0}function pn(o){if(typeof o=="number")return o;if(Hi(o))return v;if(hr(o)){var c=typeof o.valueOf=="function"?o.valueOf():o;o=hr(c)?c+"":c}if(typeof o!="string")return o===0?o:+o;o=Vw(o);var p=Qr.test(o);return p||Xr.test(o)?bt(o.slice(2),p?2:8):qt.test(o)?v:+o}function P6(o){return hs(o,Pi(o))}function nq(o){return o?la(Et(o),-D,D):o===0?o:0}function Vt(o){return o==null?"":ki(o)}var sq=xc(function(o,c){if(Jf(c)||Ci(c)){hs(c,Ur(c),o);return}for(var p in c)Yt.call(c,p)&&jf(o,p,c[p])}),D6=xc(function(o,c){hs(c,Pi(c),o)}),qu=xc(function(o,c,p,I){hs(c,Pi(c),o,I)}),oq=xc(function(o,c,p,I){hs(c,Ur(c),o,I)}),aq=Rs(u1);function cq(o,c){var p=_c(o);return c==null?p:cy(p,c)}var fq=Mt(function(o,c){o=tr(o);var p=-1,I=c.length,T=I>2?c[2]:t;for(T&&di(c[0],c[1],T)&&(I=1);++p<I;)for(var H=c[p],Z=Pi(H),te=-1,se=Z.length;++te<se;){var ue=Z[te],de=o[ue];(de===t||Nn(de,bc[ue])&&!Yt.call(o,ue))&&(o[ue]=H[ue])}return o}),lq=Mt(function(o){return o.push(t,Vy),Fr(O6,t,o)});function hq(o,c){return Hw(o,ot(c,3),ls)}function uq(o,c){return Hw(o,ot(c,3),p1)}function dq(o,c){return o==null?o:d1(o,ot(c,3),Pi)}function pq(o,c){return o==null?o:dy(o,ot(c,3),Pi)}function gq(o,c){return o&&ls(o,ot(c,3))}function vq(o,c){return o&&p1(o,ot(c,3))}function mq(o){return o==null?[]:_u(o,Ur(o))}function bq(o){return o==null?[]:_u(o,Pi(o))}function K1(o,c,p){var I=o==null?t:ha(o,c);return I===t?p:I}function wq(o,c){return o!=null&&Jy(o,c,kL)}function V1(o,c){return o!=null&&Jy(o,c,HL)}var yq=ky(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=cu.call(c)),o[c]=p},Y1(Di)),_q=ky(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=cu.call(c)),Yt.call(o,c)?o[c].push(p):o[c]=[p]},ot),xq=Mt(Kf);function Ur(o){return Ci(o)?oy(o):b1(o)}function Pi(o){return Ci(o)?oy(o,!0):XL(o)}function Aq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,H){Ds(p,c(I,T,H),I)}),p}function Eq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,H){Ds(p,T,c(I,T,H))}),p}var Sq=xc(function(o,c,p){xu(o,c,p)}),O6=xc(function(o,c,p,I){xu(o,c,p,I)}),Iq=Rs(function(o,c){var p={};if(o==null)return p;var I=!1;c=cr(c,function(H){return H=vo(H,o),I||(I=H.length>1),H}),hs(o,R1(o),p),I&&(p=hn(p,w|P|M,yB));for(var T=c.length;T--;)E1(p,c[T]);return p});function Mq(o,c){return R6(o,Bu(ot(c)))}var Cq=Rs(function(o,c){return o==null?{}:tB(o,c)});function R6(o,c){if(o==null)return{};var p=cr(R1(o),function(I){return[I]});return c=ot(c),Ay(o,p,function(I,T){return c(I,T[0])})}function Pq(o,c,p){c=vo(c,o);var I=-1,T=c.length;for(T||(T=1,o=t);++I<T;){var H=o==null?t:o[us(c[I])];H===t&&(I=T,H=p),o=$s(H)?H.call(o):H}return o}function Dq(o,c,p){return o==null?o:Gf(o,c,p)}function Oq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Gf(o,c,p,I)}var T6=Wy(Ur),$6=Wy(Pi);function Rq(o,c,p){var I=wt(o),T=I||bo(o)||Sc(o);if(c=ot(c,4),p==null){var H=o&&o.constructor;T?p=I?new H:[]:hr(o)?p=$s(H)?_c(hu(o)):{}:p={}}return(T?cn:ls)(o,function(Z,te,se){return c(p,Z,te,se)}),p}function Tq(o,c){return o==null?!0:E1(o,c)}function $q(o,c,p){return o==null?o:Cy(o,c,M1(p))}function Nq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Cy(o,c,M1(p),I)}function Ic(o){return o==null?[]:s1(o,Ur(o))}function Lq(o){return o==null?[]:s1(o,Pi(o))}function Bq(o,c,p){return p===t&&(p=c,c=t),p!==t&&(p=pn(p),p=p===p?p:0),c!==t&&(c=pn(c),c=c===c?c:0),la(pn(o),c,p)}function Fq(o,c,p){return c=Ns(c),p===t?(p=c,c=0):p=Ns(p),o=pn(o),jL(o,c,p)}function Uq(o,c,p){if(p&&typeof p!="boolean"&&di(o,c,p)&&(c=p=t),p===t&&(typeof c=="boolean"?(p=c,c=t):typeof o=="boolean"&&(p=o,o=t)),o===t&&c===t?(o=0,c=1):(o=Ns(o),c===t?(c=o,o=0):c=Ns(c)),o>c){var I=o;o=c,c=I}if(p||o%1||c%1){var T=ny();return ti(o+T*(c-o+Xt("1e-"+((T+"").length-1))),c)}return _1(o,c)}var qq=Ac(function(o,c,p){return c=c.toLowerCase(),o+(p?N6(c):c)});function N6(o){return G1(Vt(o).toLowerCase())}function L6(o){return o=Vt(o),o&&o.replace(vr,DN).replace(Jp,"")}function zq(o,c,p){o=Vt(o),c=ki(c);var I=o.length;p=p===t?I:la(Et(p),0,I);var T=p;return p-=c.length,p>=0&&o.slice(p,T)==c}function kq(o){return o=Vt(o),o&&et.test(o)?o.replace(Ze,ON):o}function Hq(o){return o=Vt(o),o&&ut.test(o)?o.replace(Le,"\\$&"):o}var jq=Ac(function(o,c,p){return o+(p?"-":"")+c.toLowerCase()}),Wq=Ac(function(o,c,p){return o+(p?" ":"")+c.toLowerCase()}),Kq=Uy("toLowerCase");function Vq(o,c,p){o=Vt(o),c=Et(c);var I=c?vc(o):0;if(!c||I>=c)return o;var T=(c-I)/2;return Cu(gu(T),p)+o+Cu(pu(T),p)}function Gq(o,c,p){o=Vt(o),c=Et(c);var I=c?vc(o):0;return c&&I<c?o+Cu(c-I,p):o}function Yq(o,c,p){o=Vt(o),c=Et(c);var I=c?vc(o):0;return c&&I<c?Cu(c-I,p)+o:o}function Jq(o,c,p){return p||c==null?c=0:c&&(c=+c),iL(Vt(o).replace(nt,""),c||0)}function Qq(o,c,p){return(p?di(o,c,p):c===t)?c=1:c=Et(c),x1(Vt(o),c)}function Zq(){var o=arguments,c=Vt(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var Xq=Ac(function(o,c,p){return o+(p?"_":"")+c.toLowerCase()});function ez(o,c,p){return p&&typeof p!="number"&&di(o,c,p)&&(c=p=t),p=p===t?A:p>>>0,p?(o=Vt(o),o&&(typeof c=="string"||c!=null&&!W1(c))&&(c=ki(c),!c&&gc(o))?mo(Tn(o),0,p):o.split(c,p)):[]}var tz=Ac(function(o,c,p){return o+(p?" ":"")+G1(c)});function rz(o,c,p){return o=Vt(o),p=p==null?0:la(Et(p),0,o.length),c=ki(c),o.slice(p,p+c.length)==c}function iz(o,c,p){var I=q.templateSettings;p&&di(o,c,p)&&(c=t),o=Vt(o),c=qu({},c,I,Ky);var T=qu({},c.imports,I.imports,Ky),H=Ur(T),Z=s1(T,H),te,se,ue=0,de=c.interpolate||Ai,ve="__p += '",Se=a1((c.escape||Ai).source+"|"+de.source+"|"+(de===tt?kt:Ai).source+"|"+(c.evaluate||Ai).source+"|$","g"),Je="//# sourceURL="+(Yt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Qp+"]")+`
53
- `;o.replace(Se,function(ft,Rt,Ft,ji,pi,Wi){return Ft||(Ft=ji),ve+=o.slice(ue,Wi).replace(In,RN),Rt&&(te=!0,ve+=`' +
52
+ `)}function DB(o){return wt(o)||pa(o)||!!(ry&&o&&o[ry])}function $s(o,c){var p=typeof o;return c=c??D,!!c&&(p=="number"||p!="symbol"&&ei.test(o))&&o>-1&&o%1==0&&o<c}function di(o,c,p){if(!hr(p))return!1;var I=typeof c;return(I=="number"?Ci(p)&&$s(c,p.length):I=="string"&&c in p)?Ln(p[c],o):!1}function L1(o,c){if(wt(o))return!1;var p=typeof o;return p=="number"||p=="symbol"||p=="boolean"||o==null||ji(o)?!0:lt.test(o)||!Re.test(o)||c!=null&&o in tr(c)}function OB(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function B1(o){var c=Du(o),p=q[c];if(typeof p!="function"||!(c in Nt.prototype))return!1;if(o===p)return!0;var I=T1(p);return!!I&&o===I[0]}function RB(o){return!!Zw&&Zw in o}var TB=ou?Ns:eg;function Jf(o){var c=o&&o.constructor,p=typeof c=="function"&&c.prototype||bc;return o===p}function Zy(o){return o===o&&!hr(o)}function Xy(o,c){return function(p){return p==null?!1:p[o]===c&&(c!==t||o in tr(p))}}function $B(o){var c=Lu(o,function(I){return p.size===u&&p.clear(),I}),p=c.cache;return c}function NB(o,c){var p=o[1],I=c[1],T=p|I,k=T<(W|H|_),Z=I==_&&p==Y||I==_&&p==U&&o[7].length<=c[8]||I==(_|U)&&c[7].length<=c[8]&&p==Y;if(!(k||Z))return o;I&W&&(o[2]=c[2],T|=p&W?0:F);var te=c[3];if(te){var se=o[3];o[3]=se?Ny(se,te,c[4]):te,o[4]=se?uo(o[3],g):c[4]}return te=c[5],te&&(se=o[5],o[5]=se?Ly(se,te,c[6]):te,o[6]=se?uo(o[5],g):c[6]),te=c[7],te&&(o[7]=te),I&_&&(o[8]=o[8]==null?c[8]:ti(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=T,o}function LB(o){var c=[];if(o!=null)for(var p in tr(o))c.push(p);return c}function BB(o){return cu.call(o)}function e6(o,c,p){return c=Dr(c===t?o.length-1:c,0),function(){for(var I=arguments,T=-1,k=Dr(I.length-c,0),Z=ce(k);++T<k;)Z[T]=I[c+T];T=-1;for(var te=ce(c+1);++T<c;)te[T]=I[T];return te[c]=p(Z),Fr(o,this,te)}}function t6(o,c){return c.length<2?o:ha(o,gn(c,0,-1))}function FB(o,c){for(var p=o.length,I=ti(c.length,p),T=Mi(o);I--;){var k=c[I];o[I]=$s(k,p)?T[k]:t}return o}function F1(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var r6=n6(Sy),Qf=XN||function(o,c){return Bt.setTimeout(o,c)},U1=n6(aB);function i6(o,c,p){var I=c+"";return U1(o,PB(I,UB(IB(I),p)))}function n6(o){var c=0,p=0;return function(){var I=iL(),T=m-(I-p);if(p=I,T>0){if(++c>=b)return arguments[0]}else c=0;return o.apply(t,arguments)}}function Ru(o,c){var p=-1,I=o.length,T=I-1;for(c=c===t?I:c;++p<c;){var k=_1(p,T),Z=o[k];o[k]=o[p],o[p]=Z}return o.length=c,o}var s6=$B(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(ht,function(p,I,T,k){c.push(T?k.replace(at,"$1"):I||p)}),c});function us(o){if(typeof o=="string"||ji(o))return o;var c=o+"";return c=="0"&&1/o==-C?"-0":c}function da(o){if(o!=null){try{return au.call(o)}catch{}try{return o+""}catch{}}return""}function UB(o,c){return hn(ae,function(p){var I="_."+p[0];c&p[1]&&!ru(o,I)&&o.push(I)}),o.sort()}function o6(o){if(o instanceof Nt)return o.clone();var c=new dn(o.__wrapped__,o.__chain__);return c.__actions__=Mi(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function qB(o,c,p){(p?di(o,c,p):c===t)?c=1:c=Dr(Et(c),0);var I=o==null?0:o.length;if(!I||c<1)return[];for(var T=0,k=0,Z=ce(pu(I/c));T<I;)Z[k++]=gn(o,T,T+=c);return Z}function zB(o){for(var c=-1,p=o==null?0:o.length,I=0,T=[];++c<p;){var k=o[c];k&&(T[I++]=k)}return T}function HB(){var o=arguments.length;if(!o)return[];for(var c=ce(o-1),p=arguments[0],I=o;I--;)c[I-1]=arguments[I];return ho(wt(p)?Mi(p):[p],Kr(c,1))}var kB=Mt(function(o,c){return xr(o)?Wf(o,Kr(c,1,xr,!0)):[]}),jB=Mt(function(o,c){var p=vn(c);return xr(p)&&(p=t),xr(o)?Wf(o,Kr(c,1,xr,!0),ot(p,2)):[]}),WB=Mt(function(o,c){var p=vn(c);return xr(p)&&(p=t),xr(o)?Wf(o,Kr(c,1,xr,!0),t,p):[]});function KB(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),gn(o,c<0?0:c,I)):[]}function VB(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),c=I-c,gn(o,0,c<0?0:c)):[]}function GB(o,c){return o&&o.length?Eu(o,ot(c,3),!0,!0):[]}function YB(o,c){return o&&o.length?Eu(o,ot(c,3),!0):[]}function JB(o,c,p,I){var T=o==null?0:o.length;return T?(p&&typeof p!="number"&&di(o,c,p)&&(p=0,I=T),HL(o,c,p,I)):[]}function a6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:Et(p);return T<0&&(T=Dr(I+T,0)),iu(o,ot(c,3),T)}function c6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I-1;return p!==t&&(T=Et(p),T=p<0?Dr(I+T,0):ti(T,I-1)),iu(o,ot(c,3),T,!0)}function f6(o){var c=o==null?0:o.length;return c?Kr(o,1):[]}function QB(o){var c=o==null?0:o.length;return c?Kr(o,C):[]}function ZB(o,c){var p=o==null?0:o.length;return p?(c=c===t?1:Et(c),Kr(o,c)):[]}function XB(o){for(var c=-1,p=o==null?0:o.length,I={};++c<p;){var T=o[c];I[T[0]]=T[1]}return I}function l6(o){return o&&o.length?o[0]:t}function eF(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:Et(p);return T<0&&(T=Dr(I+T,0)),pc(o,c,T)}function tF(o){var c=o==null?0:o.length;return c?gn(o,0,-1):[]}var rF=Mt(function(o){var c=cr(o,I1);return c.length&&c[0]===o[0]?v1(c):[]}),iF=Mt(function(o){var c=vn(o),p=cr(o,I1);return c===vn(p)?c=t:p.pop(),p.length&&p[0]===o[0]?v1(p,ot(c,2)):[]}),nF=Mt(function(o){var c=vn(o),p=cr(o,I1);return c=typeof c=="function"?c:t,c&&p.pop(),p.length&&p[0]===o[0]?v1(p,t,c):[]});function sF(o,c){return o==null?"":tL.call(o,c)}function vn(o){var c=o==null?0:o.length;return c?o[c-1]:t}function oF(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I;return p!==t&&(T=Et(p),T=T<0?Dr(I+T,0):ti(T,I-1)),c===c?UN(o,c,T):iu(o,jw,T,!0)}function aF(o,c){return o&&o.length?_y(o,Et(c)):t}var cF=Mt(h6);function h6(o,c){return o&&o.length&&c&&c.length?y1(o,c):o}function fF(o,c,p){return o&&o.length&&c&&c.length?y1(o,c,ot(p,2)):o}function lF(o,c,p){return o&&o.length&&c&&c.length?y1(o,c,t,p):o}var hF=Ts(function(o,c){var p=o==null?0:o.length,I=u1(o,c);return Ey(o,cr(c,function(T){return $s(T,p)?+T:T}).sort($y)),I});function uF(o,c){var p=[];if(!(o&&o.length))return p;var I=-1,T=[],k=o.length;for(c=ot(c,3);++I<k;){var Z=o[I];c(Z,I,o)&&(p.push(Z),T.push(I))}return Ey(o,T),p}function q1(o){return o==null?o:sL.call(o)}function dF(o,c,p){var I=o==null?0:o.length;return I?(p&&typeof p!="number"&&di(o,c,p)?(c=0,p=I):(c=c==null?0:Et(c),p=p===t?I:Et(p)),gn(o,c,p)):[]}function pF(o,c){return Au(o,c)}function gF(o,c,p){return A1(o,c,ot(p,2))}function vF(o,c){var p=o==null?0:o.length;if(p){var I=Au(o,c);if(I<p&&Ln(o[I],c))return I}return-1}function mF(o,c){return Au(o,c,!0)}function bF(o,c,p){return A1(o,c,ot(p,2),!0)}function wF(o,c){var p=o==null?0:o.length;if(p){var I=Au(o,c,!0)-1;if(Ln(o[I],c))return I}return-1}function yF(o){return o&&o.length?Iy(o):[]}function _F(o,c){return o&&o.length?Iy(o,ot(c,2)):[]}function xF(o){var c=o==null?0:o.length;return c?gn(o,1,c):[]}function AF(o,c,p){return o&&o.length?(c=p||c===t?1:Et(c),gn(o,0,c<0?0:c)):[]}function EF(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),c=I-c,gn(o,c<0?0:c,I)):[]}function SF(o,c){return o&&o.length?Eu(o,ot(c,3),!1,!0):[]}function IF(o,c){return o&&o.length?Eu(o,ot(c,3)):[]}var MF=Mt(function(o){return vo(Kr(o,1,xr,!0))}),CF=Mt(function(o){var c=vn(o);return xr(c)&&(c=t),vo(Kr(o,1,xr,!0),ot(c,2))}),PF=Mt(function(o){var c=vn(o);return c=typeof c=="function"?c:t,vo(Kr(o,1,xr,!0),t,c)});function DF(o){return o&&o.length?vo(o):[]}function OF(o,c){return o&&o.length?vo(o,ot(c,2)):[]}function RF(o,c){return c=typeof c=="function"?c:t,o&&o.length?vo(o,t,c):[]}function z1(o){if(!(o&&o.length))return[];var c=0;return o=lo(o,function(p){if(xr(p))return c=Dr(p.length,c),!0}),n1(c,function(p){return cr(o,t1(p))})}function u6(o,c){if(!(o&&o.length))return[];var p=z1(o);return c==null?p:cr(p,function(I){return Fr(c,t,I)})}var TF=Mt(function(o,c){return xr(o)?Wf(o,c):[]}),$F=Mt(function(o){return S1(lo(o,xr))}),NF=Mt(function(o){var c=vn(o);return xr(c)&&(c=t),S1(lo(o,xr),ot(c,2))}),LF=Mt(function(o){var c=vn(o);return c=typeof c=="function"?c:t,S1(lo(o,xr),t,c)}),BF=Mt(z1);function FF(o,c){return Dy(o||[],c||[],jf)}function UF(o,c){return Dy(o||[],c||[],Gf)}var qF=Mt(function(o){var c=o.length,p=c>1?o[c-1]:t;return p=typeof p=="function"?(o.pop(),p):t,u6(o,p)});function d6(o){var c=q(o);return c.__chain__=!0,c}function zF(o,c){return c(o),o}function Tu(o,c){return c(o)}var HF=Ts(function(o){var c=o.length,p=c?o[0]:0,I=this.__wrapped__,T=function(k){return u1(k,o)};return c>1||this.__actions__.length||!(I instanceof Nt)||!$s(p)?this.thru(T):(I=I.slice(p,+p+(c?1:0)),I.__actions__.push({func:Tu,args:[T],thisArg:t}),new dn(I,this.__chain__).thru(function(k){return c&&!k.length&&k.push(t),k}))});function kF(){return d6(this)}function jF(){return new dn(this.value(),this.__chain__)}function WF(){this.__values__===t&&(this.__values__=M6(this.value()));var o=this.__index__>=this.__values__.length,c=o?t:this.__values__[this.__index__++];return{done:o,value:c}}function KF(){return this}function VF(o){for(var c,p=this;p instanceof bu;){var I=o6(p);I.__index__=0,I.__values__=t,c?T.__wrapped__=I:c=I;var T=I;p=p.__wrapped__}return T.__wrapped__=o,c}function GF(){var o=this.__wrapped__;if(o instanceof Nt){var c=o;return this.__actions__.length&&(c=new Nt(this)),c=c.reverse(),c.__actions__.push({func:Tu,args:[q1],thisArg:t}),new dn(c,this.__chain__)}return this.thru(q1)}function YF(){return Py(this.__wrapped__,this.__actions__)}var JF=Su(function(o,c,p){Yt.call(o,p)?++o[p]:Os(o,p,1)});function QF(o,c,p){var I=wt(o)?Hw:zL;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}function ZF(o,c){var p=wt(o)?lo:uy;return p(o,ot(c,3))}var XF=qy(a6),eU=qy(c6);function tU(o,c){return Kr($u(o,c),1)}function rU(o,c){return Kr($u(o,c),C)}function iU(o,c,p){return p=p===t?1:Et(p),Kr($u(o,c),p)}function p6(o,c){var p=wt(o)?hn:go;return p(o,ot(c,3))}function g6(o,c){var p=wt(o)?xN:hy;return p(o,ot(c,3))}var nU=Su(function(o,c,p){Yt.call(o,p)?o[p].push(c):Os(o,p,[c])});function sU(o,c,p,I){o=Ci(o)?o:Ic(o),p=p&&!I?Et(p):0;var T=o.length;return p<0&&(p=Dr(T+p,0)),Uu(o)?p<=T&&o.indexOf(c,p)>-1:!!T&&pc(o,c,p)>-1}var oU=Mt(function(o,c,p){var I=-1,T=typeof c=="function",k=Ci(o)?ce(o.length):[];return go(o,function(Z){k[++I]=T?Fr(c,Z,p):Kf(Z,c,p)}),k}),aU=Su(function(o,c,p){Os(o,p,c)});function $u(o,c){var p=wt(o)?cr:by;return p(o,ot(c,3))}function cU(o,c,p,I){return o==null?[]:(wt(c)||(c=c==null?[]:[c]),p=I?t:p,wt(p)||(p=p==null?[]:[p]),xy(o,c,p))}var fU=Su(function(o,c,p){o[p?0:1].push(c)},function(){return[[],[]]});function lU(o,c,p){var I=wt(o)?Xp:Kw,T=arguments.length<3;return I(o,ot(c,4),p,T,go)}function hU(o,c,p){var I=wt(o)?AN:Kw,T=arguments.length<3;return I(o,ot(c,4),p,T,hy)}function uU(o,c){var p=wt(o)?lo:uy;return p(o,Bu(ot(c,3)))}function dU(o){var c=wt(o)?ay:sB;return c(o)}function pU(o,c,p){(p?di(o,c,p):c===t)?c=1:c=Et(c);var I=wt(o)?LL:oB;return I(o,c)}function gU(o){var c=wt(o)?BL:cB;return c(o)}function vU(o){if(o==null)return 0;if(Ci(o))return Uu(o)?vc(o):o.length;var c=ri(o);return c==he||c==be?o.size:b1(o).length}function mU(o,c,p){var I=wt(o)?e1:fB;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}var bU=Mt(function(o,c){if(o==null)return[];var p=c.length;return p>1&&di(o,c[0],c[1])?c=[]:p>2&&di(c[0],c[1],c[2])&&(c=[c[0]]),xy(o,Kr(c,1),[])}),Nu=ZN||function(){return Bt.Date.now()};function wU(o,c){if(typeof c!="function")throw new un(a);return o=Et(o),function(){if(--o<1)return c.apply(this,arguments)}}function v6(o,c,p){return c=p?t:c,c=o&&c==null?o.length:c,Rs(o,_,t,t,t,t,c)}function m6(o,c){var p;if(typeof c!="function")throw new un(a);return o=Et(o),function(){return--o>0&&(p=c.apply(this,arguments)),o<=1&&(c=t),p}}var H1=Mt(function(o,c,p){var I=W;if(p.length){var T=uo(p,Ec(H1));I|=z}return Rs(o,I,c,p,T)}),b6=Mt(function(o,c,p){var I=W|H;if(p.length){var T=uo(p,Ec(b6));I|=z}return Rs(c,I,o,p,T)});function w6(o,c,p){c=p?t:c;var I=Rs(o,Y,t,t,t,t,t,c);return I.placeholder=w6.placeholder,I}function y6(o,c,p){c=p?t:c;var I=Rs(o,B,t,t,t,t,t,c);return I.placeholder=y6.placeholder,I}function _6(o,c,p){var I,T,k,Z,te,se,ue=0,de=!1,ve=!1,Se=!0;if(typeof o!="function")throw new un(a);c=mn(c)||0,hr(p)&&(de=!!p.leading,ve="maxWait"in p,k=ve?Dr(mn(p.maxWait)||0,c):k,Se="trailing"in p?!!p.trailing:Se);function Je(Ar){var Bn=I,Bs=T;return I=T=t,ue=Ar,Z=o.apply(Bs,Bn),Z}function ct(Ar){return ue=Ar,te=Qf(Rt,c),de?Je(Ar):Z}function St(Ar){var Bn=Ar-se,Bs=Ar-ue,q6=c-Bn;return ve?ti(q6,k-Bs):q6}function ft(Ar){var Bn=Ar-se,Bs=Ar-ue;return se===t||Bn>=c||Bn<0||ve&&Bs>=k}function Rt(){var Ar=Nu();if(ft(Ar))return Ft(Ar);te=Qf(Rt,St(Ar))}function Ft(Ar){return te=t,Se&&I?Je(Ar):(I=T=t,Z)}function Wi(){te!==t&&Oy(te),ue=0,I=se=T=te=t}function pi(){return te===t?Z:Ft(Nu())}function Ki(){var Ar=Nu(),Bn=ft(Ar);if(I=arguments,T=this,se=Ar,Bn){if(te===t)return ct(se);if(ve)return Oy(te),te=Qf(Rt,c),Je(se)}return te===t&&(te=Qf(Rt,c)),Z}return Ki.cancel=Wi,Ki.flush=pi,Ki}var yU=Mt(function(o,c){return ly(o,1,c)}),_U=Mt(function(o,c,p){return ly(o,mn(c)||0,p)});function xU(o){return Rs(o,ee)}function Lu(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new un(a);var p=function(){var I=arguments,T=c?c.apply(this,I):I[0],k=p.cache;if(k.has(T))return k.get(T);var Z=o.apply(this,I);return p.cache=k.set(T,Z)||k,Z};return p.cache=new(Lu.Cache||Ds),p}Lu.Cache=Ds;function Bu(o){if(typeof o!="function")throw new un(a);return function(){var c=arguments;switch(c.length){case 0:return!o.call(this);case 1:return!o.call(this,c[0]);case 2:return!o.call(this,c[0],c[1]);case 3:return!o.call(this,c[0],c[1],c[2])}return!o.apply(this,c)}}function AU(o){return m6(2,o)}var EU=lB(function(o,c){c=c.length==1&&wt(c[0])?cr(c[0],Hi(ot())):cr(Kr(c,1),Hi(ot()));var p=c.length;return Mt(function(I){for(var T=-1,k=ti(I.length,p);++T<k;)I[T]=c[T].call(this,I[T]);return Fr(o,this,I)})}),k1=Mt(function(o,c){var p=uo(c,Ec(k1));return Rs(o,z,t,c,p)}),x6=Mt(function(o,c){var p=uo(c,Ec(x6));return Rs(o,j,t,c,p)}),SU=Ts(function(o,c){return Rs(o,U,t,t,t,c)});function IU(o,c){if(typeof o!="function")throw new un(a);return c=c===t?c:Et(c),Mt(o,c)}function MU(o,c){if(typeof o!="function")throw new un(a);return c=c==null?0:Dr(Et(c),0),Mt(function(p){var I=p[c],T=bo(p,0,c);return I&&ho(T,I),Fr(o,this,T)})}function CU(o,c,p){var I=!0,T=!0;if(typeof o!="function")throw new un(a);return hr(p)&&(I="leading"in p?!!p.leading:I,T="trailing"in p?!!p.trailing:T),_6(o,c,{leading:I,maxWait:c,trailing:T})}function PU(o){return v6(o,1)}function DU(o,c){return k1(M1(c),o)}function OU(){if(!arguments.length)return[];var o=arguments[0];return wt(o)?o:[o]}function RU(o){return pn(o,M)}function TU(o,c){return c=typeof c=="function"?c:t,pn(o,M,c)}function $U(o){return pn(o,w|M)}function NU(o,c){return c=typeof c=="function"?c:t,pn(o,w|M,c)}function LU(o,c){return c==null||fy(o,c,Ur(c))}function Ln(o,c){return o===c||o!==o&&c!==c}var BU=Pu(g1),FU=Pu(function(o,c){return o>=c}),pa=gy(function(){return arguments}())?gy:function(o){return mr(o)&&Yt.call(o,"callee")&&!ty.call(o,"callee")},wt=ce.isArray,UU=hi?Hi(hi):VL;function Ci(o){return o!=null&&Fu(o.length)&&!Ns(o)}function xr(o){return mr(o)&&Ci(o)}function qU(o){return o===!0||o===!1||mr(o)&&ui(o)==J}var wo=eL||eg,zU=Tn?Hi(Tn):GL;function HU(o){return mr(o)&&o.nodeType===1&&!Zf(o)}function kU(o){if(o==null)return!0;if(Ci(o)&&(wt(o)||typeof o=="string"||typeof o.splice=="function"||wo(o)||Sc(o)||pa(o)))return!o.length;var c=ri(o);if(c==he||c==be)return!o.size;if(Jf(o))return!b1(o).length;for(var p in o)if(Yt.call(o,p))return!1;return!0}function jU(o,c){return Vf(o,c)}function WU(o,c,p){p=typeof p=="function"?p:t;var I=p?p(o,c):t;return I===t?Vf(o,c,t,p):!!I}function j1(o){if(!mr(o))return!1;var c=ui(o);return c==G||c==E||typeof o.message=="string"&&typeof o.name=="string"&&!Zf(o)}function KU(o){return typeof o=="number"&&iy(o)}function Ns(o){if(!hr(o))return!1;var c=ui(o);return c==re||c==le||c==V||c==Xe}function A6(o){return typeof o=="number"&&o==Et(o)}function Fu(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=D}function hr(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function mr(o){return o!=null&&typeof o=="object"}var E6=ln?Hi(ln):JL;function VU(o,c){return o===c||m1(o,c,$1(c))}function GU(o,c,p){return p=typeof p=="function"?p:t,m1(o,c,$1(c),p)}function YU(o){return S6(o)&&o!=+o}function JU(o){if(TB(o))throw new gt(s);return vy(o)}function QU(o){return o===null}function ZU(o){return o==null}function S6(o){return typeof o=="number"||mr(o)&&ui(o)==ge}function Zf(o){if(!mr(o)||ui(o)!=Te)return!1;var c=hu(o);if(c===null)return!0;var p=Yt.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&au.call(p)==GN}var W1=fs?Hi(fs):QL;function XU(o){return A6(o)&&o>=-D&&o<=D}var I6=Bf?Hi(Bf):ZL;function Uu(o){return typeof o=="string"||!wt(o)&&mr(o)&&ui(o)==Pe}function ji(o){return typeof o=="symbol"||mr(o)&&ui(o)==De}var Sc=oa?Hi(oa):XL;function eq(o){return o===t}function tq(o){return mr(o)&&ri(o)==Ie}function rq(o){return mr(o)&&ui(o)==Oe}var iq=Pu(w1),nq=Pu(function(o,c){return o<=c});function M6(o){if(!o)return[];if(Ci(o))return Uu(o)?$n(o):Mi(o);if(Uf&&o[Uf])return LN(o[Uf]());var c=ri(o),p=c==he?o1:c==be?nu:Ic;return p(o)}function Ls(o){if(!o)return o===0?o:0;if(o=mn(o),o===C||o===-C){var c=o<0?-1:1;return c*S}return o===o?o:0}function Et(o){var c=Ls(o),p=c%1;return c===c?p?c-p:c:0}function C6(o){return o?la(Et(o),0,A):0}function mn(o){if(typeof o=="number")return o;if(ji(o))return v;if(hr(o)){var c=typeof o.valueOf=="function"?o.valueOf():o;o=hr(c)?c+"":c}if(typeof o!="string")return o===0?o:+o;o=Vw(o);var p=Qr.test(o);return p||Xr.test(o)?bt(o.slice(2),p?2:8):qt.test(o)?v:+o}function P6(o){return hs(o,Pi(o))}function sq(o){return o?la(Et(o),-D,D):o===0?o:0}function Vt(o){return o==null?"":ki(o)}var oq=xc(function(o,c){if(Jf(c)||Ci(c)){hs(c,Ur(c),o);return}for(var p in c)Yt.call(c,p)&&jf(o,p,c[p])}),D6=xc(function(o,c){hs(c,Pi(c),o)}),qu=xc(function(o,c,p,I){hs(c,Pi(c),o,I)}),aq=xc(function(o,c,p,I){hs(c,Ur(c),o,I)}),cq=Ts(u1);function fq(o,c){var p=_c(o);return c==null?p:cy(p,c)}var lq=Mt(function(o,c){o=tr(o);var p=-1,I=c.length,T=I>2?c[2]:t;for(T&&di(c[0],c[1],T)&&(I=1);++p<I;)for(var k=c[p],Z=Pi(k),te=-1,se=Z.length;++te<se;){var ue=Z[te],de=o[ue];(de===t||Ln(de,bc[ue])&&!Yt.call(o,ue))&&(o[ue]=k[ue])}return o}),hq=Mt(function(o){return o.push(t,Vy),Fr(O6,t,o)});function uq(o,c){return kw(o,ot(c,3),ls)}function dq(o,c){return kw(o,ot(c,3),p1)}function pq(o,c){return o==null?o:d1(o,ot(c,3),Pi)}function gq(o,c){return o==null?o:dy(o,ot(c,3),Pi)}function vq(o,c){return o&&ls(o,ot(c,3))}function mq(o,c){return o&&p1(o,ot(c,3))}function bq(o){return o==null?[]:_u(o,Ur(o))}function wq(o){return o==null?[]:_u(o,Pi(o))}function K1(o,c,p){var I=o==null?t:ha(o,c);return I===t?p:I}function yq(o,c){return o!=null&&Jy(o,c,kL)}function V1(o,c){return o!=null&&Jy(o,c,jL)}var _q=Hy(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=cu.call(c)),o[c]=p},Y1(Di)),xq=Hy(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=cu.call(c)),Yt.call(o,c)?o[c].push(p):o[c]=[p]},ot),Aq=Mt(Kf);function Ur(o){return Ci(o)?oy(o):b1(o)}function Pi(o){return Ci(o)?oy(o,!0):eB(o)}function Eq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,k){Os(p,c(I,T,k),I)}),p}function Sq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,k){Os(p,T,c(I,T,k))}),p}var Iq=xc(function(o,c,p){xu(o,c,p)}),O6=xc(function(o,c,p,I){xu(o,c,p,I)}),Mq=Ts(function(o,c){var p={};if(o==null)return p;var I=!1;c=cr(c,function(k){return k=mo(k,o),I||(I=k.length>1),k}),hs(o,R1(o),p),I&&(p=pn(p,w|P|M,_B));for(var T=c.length;T--;)E1(p,c[T]);return p});function Cq(o,c){return R6(o,Bu(ot(c)))}var Pq=Ts(function(o,c){return o==null?{}:rB(o,c)});function R6(o,c){if(o==null)return{};var p=cr(R1(o),function(I){return[I]});return c=ot(c),Ay(o,p,function(I,T){return c(I,T[0])})}function Dq(o,c,p){c=mo(c,o);var I=-1,T=c.length;for(T||(T=1,o=t);++I<T;){var k=o==null?t:o[us(c[I])];k===t&&(I=T,k=p),o=Ns(k)?k.call(o):k}return o}function Oq(o,c,p){return o==null?o:Gf(o,c,p)}function Rq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Gf(o,c,p,I)}var T6=Wy(Ur),$6=Wy(Pi);function Tq(o,c,p){var I=wt(o),T=I||wo(o)||Sc(o);if(c=ot(c,4),p==null){var k=o&&o.constructor;T?p=I?new k:[]:hr(o)?p=Ns(k)?_c(hu(o)):{}:p={}}return(T?hn:ls)(o,function(Z,te,se){return c(p,Z,te,se)}),p}function $q(o,c){return o==null?!0:E1(o,c)}function Nq(o,c,p){return o==null?o:Cy(o,c,M1(p))}function Lq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Cy(o,c,M1(p),I)}function Ic(o){return o==null?[]:s1(o,Ur(o))}function Bq(o){return o==null?[]:s1(o,Pi(o))}function Fq(o,c,p){return p===t&&(p=c,c=t),p!==t&&(p=mn(p),p=p===p?p:0),c!==t&&(c=mn(c),c=c===c?c:0),la(mn(o),c,p)}function Uq(o,c,p){return c=Ls(c),p===t?(p=c,c=0):p=Ls(p),o=mn(o),WL(o,c,p)}function qq(o,c,p){if(p&&typeof p!="boolean"&&di(o,c,p)&&(c=p=t),p===t&&(typeof c=="boolean"?(p=c,c=t):typeof o=="boolean"&&(p=o,o=t)),o===t&&c===t?(o=0,c=1):(o=Ls(o),c===t?(c=o,o=0):c=Ls(c)),o>c){var I=o;o=c,c=I}if(p||o%1||c%1){var T=ny();return ti(o+T*(c-o+Xt("1e-"+((T+"").length-1))),c)}return _1(o,c)}var zq=Ac(function(o,c,p){return c=c.toLowerCase(),o+(p?N6(c):c)});function N6(o){return G1(Vt(o).toLowerCase())}function L6(o){return o=Vt(o),o&&o.replace(vr,ON).replace(Jp,"")}function Hq(o,c,p){o=Vt(o),c=ki(c);var I=o.length;p=p===t?I:la(Et(p),0,I);var T=p;return p-=c.length,p>=0&&o.slice(p,T)==c}function kq(o){return o=Vt(o),o&&et.test(o)?o.replace(Ze,RN):o}function jq(o){return o=Vt(o),o&&ut.test(o)?o.replace(Le,"\\$&"):o}var Wq=Ac(function(o,c,p){return o+(p?"-":"")+c.toLowerCase()}),Kq=Ac(function(o,c,p){return o+(p?" ":"")+c.toLowerCase()}),Vq=Uy("toLowerCase");function Gq(o,c,p){o=Vt(o),c=Et(c);var I=c?vc(o):0;if(!c||I>=c)return o;var T=(c-I)/2;return Cu(gu(T),p)+o+Cu(pu(T),p)}function Yq(o,c,p){o=Vt(o),c=Et(c);var I=c?vc(o):0;return c&&I<c?o+Cu(c-I,p):o}function Jq(o,c,p){o=Vt(o),c=Et(c);var I=c?vc(o):0;return c&&I<c?Cu(c-I,p)+o:o}function Qq(o,c,p){return p||c==null?c=0:c&&(c=+c),nL(Vt(o).replace(nt,""),c||0)}function Zq(o,c,p){return(p?di(o,c,p):c===t)?c=1:c=Et(c),x1(Vt(o),c)}function Xq(){var o=arguments,c=Vt(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var ez=Ac(function(o,c,p){return o+(p?"_":"")+c.toLowerCase()});function tz(o,c,p){return p&&typeof p!="number"&&di(o,c,p)&&(c=p=t),p=p===t?A:p>>>0,p?(o=Vt(o),o&&(typeof c=="string"||c!=null&&!W1(c))&&(c=ki(c),!c&&gc(o))?bo($n(o),0,p):o.split(c,p)):[]}var rz=Ac(function(o,c,p){return o+(p?" ":"")+G1(c)});function iz(o,c,p){return o=Vt(o),p=p==null?0:la(Et(p),0,o.length),c=ki(c),o.slice(p,p+c.length)==c}function nz(o,c,p){var I=q.templateSettings;p&&di(o,c,p)&&(c=t),o=Vt(o),c=qu({},c,I,Ky);var T=qu({},c.imports,I.imports,Ky),k=Ur(T),Z=s1(T,k),te,se,ue=0,de=c.interpolate||Ai,ve="__p += '",Se=a1((c.escape||Ai).source+"|"+de.source+"|"+(de===tt?kt:Ai).source+"|"+(c.evaluate||Ai).source+"|$","g"),Je="//# sourceURL="+(Yt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Qp+"]")+`
53
+ `;o.replace(Se,function(ft,Rt,Ft,Wi,pi,Ki){return Ft||(Ft=Wi),ve+=o.slice(ue,Ki).replace(Mn,TN),Rt&&(te=!0,ve+=`' +
54
54
  __e(`+Rt+`) +
55
55
  '`),pi&&(se=!0,ve+=`';
56
56
  `+pi+`;
57
57
  __p += '`),Ft&&(ve+=`' +
58
58
  ((__t = (`+Ft+`)) == null ? '' : __t) +
59
- '`),ue=Wi+ft.length,ft}),ve+=`';
59
+ '`),ue=Ki+ft.length,ft}),ve+=`';
60
60
  `;var ct=Yt.call(c,"variable")&&c.variable;if(!ct)ve=`with (obj) {
61
61
  `+ve+`
62
62
  }
63
- `;else if(zt.test(ct))throw new gt(f);ve=(se?ve.replace(It,""):ve).replace(Ye,"$1").replace(Pt,"$1;"),ve="function("+(ct||"obj")+`) {
63
+ `;else if(Ht.test(ct))throw new gt(f);ve=(se?ve.replace(It,""):ve).replace(Ye,"$1").replace(Pt,"$1;"),ve="function("+(ct||"obj")+`) {
64
64
  `+(ct?"":`obj || (obj = {});
65
65
  `)+"var __t, __p = ''"+(te?", __e = _.escape":"")+(se?`, __j = Array.prototype.join;
66
66
  function print() { __p += __j.call(arguments, '') }
67
67
  `:`;
68
68
  `)+ve+`return __p
69
- }`;var St=F6(function(){return jt(H,Je+"return "+ve).apply(t,Z)});if(St.source=ve,j1(St))throw St;return St}function nz(o){return Vt(o).toLowerCase()}function sz(o){return Vt(o).toUpperCase()}function oz(o,c,p){if(o=Vt(o),o&&(p||c===t))return Vw(o);if(!o||!(c=ki(c)))return o;var I=Tn(o),T=Tn(c),H=Gw(I,T),Z=Yw(I,T)+1;return mo(I,H,Z).join("")}function az(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.slice(0,Qw(o)+1);if(!o||!(c=ki(c)))return o;var I=Tn(o),T=Yw(I,Tn(c))+1;return mo(I,0,T).join("")}function cz(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.replace(nt,"");if(!o||!(c=ki(c)))return o;var I=Tn(o),T=Gw(I,Tn(c));return mo(I,T).join("")}function fz(o,c){var p=oe,I=L;if(hr(c)){var T="separator"in c?c.separator:T;p="length"in c?Et(c.length):p,I="omission"in c?ki(c.omission):I}o=Vt(o);var H=o.length;if(gc(o)){var Z=Tn(o);H=Z.length}if(p>=H)return o;var te=p-vc(I);if(te<1)return I;var se=Z?mo(Z,0,te).join(""):o.slice(0,te);if(T===t)return se+I;if(Z&&(te+=se.length-te),W1(T)){if(o.slice(te).search(T)){var ue,de=se;for(T.global||(T=a1(T.source,Vt(_t.exec(T))+"g")),T.lastIndex=0;ue=T.exec(de);)var ve=ue.index;se=se.slice(0,ve===t?te:ve)}}else if(o.indexOf(ki(T),te)!=te){var Se=se.lastIndexOf(T);Se>-1&&(se=se.slice(0,Se))}return se+I}function lz(o){return o=Vt(o),o&&rt.test(o)?o.replace(Ot,UN):o}var hz=Ac(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),G1=Uy("toUpperCase");function B6(o,c,p){return o=Vt(o),c=p?t:c,c===t?$N(o)?kN(o):SN(o):o.match(c)||[]}var F6=Mt(function(o,c){try{return Fr(o,t,c)}catch(p){return j1(p)?p:new gt(p)}}),uz=Rs(function(o,c){return cn(c,function(p){p=us(p),Ds(o,p,k1(o[p],o))}),o});function dz(o){var c=o==null?0:o.length,p=ot();return o=c?cr(o,function(I){if(typeof I[1]!="function")throw new fn(a);return[p(I[0]),I[1]]}):[],Mt(function(I){for(var T=-1;++T<c;){var H=o[T];if(Fr(H[0],this,I))return Fr(H[1],this,I)}})}function pz(o){return UL(hn(o,w))}function Y1(o){return function(){return o}}function gz(o,c){return o==null||o!==o?c:o}var vz=zy(),mz=zy(!0);function Di(o){return o}function J1(o){return my(typeof o=="function"?o:hn(o,w))}function bz(o){return wy(hn(o,w))}function wz(o,c){return yy(o,hn(c,w))}var yz=Mt(function(o,c){return function(p){return Kf(p,o,c)}}),_z=Mt(function(o,c){return function(p){return Kf(o,p,c)}});function Q1(o,c,p){var I=Ur(c),T=_u(c,I);p==null&&!(hr(c)&&(T.length||!I.length))&&(p=c,c=o,o=this,T=_u(c,Ur(c)));var H=!(hr(p)&&"chain"in p)||!!p.chain,Z=$s(o);return cn(T,function(te){var se=c[te];o[te]=se,Z&&(o.prototype[te]=function(){var ue=this.__chain__;if(H||ue){var de=o(this.__wrapped__),ve=de.__actions__=Mi(this.__actions__);return ve.push({func:se,args:arguments,thisArg:o}),de.__chain__=ue,de}return se.apply(o,lo([this.value()],arguments))})}),o}function xz(){return Bt._===this&&(Bt._=GN),this}function Z1(){}function Az(o){return o=Et(o),Mt(function(c){return _y(c,o)})}var Ez=P1(cr),Sz=P1(kw),Iz=P1(e1);function U6(o){return L1(o)?t1(us(o)):rB(o)}function Mz(o){return function(c){return o==null?t:ha(o,c)}}var Cz=Hy(),Pz=Hy(!0);function X1(){return[]}function eg(){return!1}function Dz(){return{}}function Oz(){return""}function Rz(){return!0}function Tz(o,c){if(o=Et(o),o<1||o>D)return[];var p=A,I=ti(o,A);c=ot(c),o-=A;for(var T=n1(I,c);++p<o;)c(p);return T}function $z(o){return wt(o)?cr(o,us):Hi(o)?[o]:Mi(s6(Vt(o)))}function Nz(o){var c=++KN;return Vt(o)+c}var Lz=Mu(function(o,c){return o+c},0),Bz=D1("ceil"),Fz=Mu(function(o,c){return o/c},1),Uz=D1("floor");function qz(o){return o&&o.length?yu(o,Di,g1):t}function zz(o,c){return o&&o.length?yu(o,ot(c,2),g1):t}function kz(o){return Ww(o,Di)}function Hz(o,c){return Ww(o,ot(c,2))}function jz(o){return o&&o.length?yu(o,Di,w1):t}function Wz(o,c){return o&&o.length?yu(o,ot(c,2),w1):t}var Kz=Mu(function(o,c){return o*c},1),Vz=D1("round"),Gz=Mu(function(o,c){return o-c},0);function Yz(o){return o&&o.length?i1(o,Di):0}function Jz(o,c){return o&&o.length?i1(o,ot(c,2)):0}return q.after=bU,q.ary=v6,q.assign=sq,q.assignIn=D6,q.assignInWith=qu,q.assignWith=oq,q.at=aq,q.before=m6,q.bind=k1,q.bindAll=uz,q.bindKey=b6,q.castArray=DU,q.chain=d6,q.chunk=UB,q.compact=qB,q.concat=zB,q.cond=dz,q.conforms=pz,q.constant=Y1,q.countBy=YF,q.create=cq,q.curry=w6,q.curryRight=y6,q.debounce=_6,q.defaults=fq,q.defaultsDeep=lq,q.defer=wU,q.delay=yU,q.difference=kB,q.differenceBy=HB,q.differenceWith=jB,q.drop=WB,q.dropRight=KB,q.dropRightWhile=VB,q.dropWhile=GB,q.fill=YB,q.filter=QF,q.flatMap=eU,q.flatMapDeep=tU,q.flatMapDepth=rU,q.flatten=f6,q.flattenDeep=JB,q.flattenDepth=QB,q.flip=_U,q.flow=vz,q.flowRight=mz,q.fromPairs=ZB,q.functions=mq,q.functionsIn=bq,q.groupBy=iU,q.initial=eF,q.intersection=tF,q.intersectionBy=rF,q.intersectionWith=iF,q.invert=yq,q.invertBy=_q,q.invokeMap=sU,q.iteratee=J1,q.keyBy=oU,q.keys=Ur,q.keysIn=Pi,q.map=$u,q.mapKeys=Aq,q.mapValues=Eq,q.matches=bz,q.matchesProperty=wz,q.memoize=Lu,q.merge=Sq,q.mergeWith=O6,q.method=yz,q.methodOf=_z,q.mixin=Q1,q.negate=Bu,q.nthArg=Az,q.omit=Iq,q.omitBy=Mq,q.once=xU,q.orderBy=aU,q.over=Ez,q.overArgs=AU,q.overEvery=Sz,q.overSome=Iz,q.partial=H1,q.partialRight=x6,q.partition=cU,q.pick=Cq,q.pickBy=R6,q.property=U6,q.propertyOf=Mz,q.pull=aF,q.pullAll=h6,q.pullAllBy=cF,q.pullAllWith=fF,q.pullAt=lF,q.range=Cz,q.rangeRight=Pz,q.rearg=EU,q.reject=hU,q.remove=hF,q.rest=SU,q.reverse=q1,q.sampleSize=dU,q.set=Dq,q.setWith=Oq,q.shuffle=pU,q.slice=uF,q.sortBy=mU,q.sortedUniq=wF,q.sortedUniqBy=yF,q.split=ez,q.spread=IU,q.tail=_F,q.take=xF,q.takeRight=AF,q.takeRightWhile=EF,q.takeWhile=SF,q.tap=qF,q.throttle=MU,q.thru=Tu,q.toArray=M6,q.toPairs=T6,q.toPairsIn=$6,q.toPath=$z,q.toPlainObject=P6,q.transform=Rq,q.unary=CU,q.union=IF,q.unionBy=MF,q.unionWith=CF,q.uniq=PF,q.uniqBy=DF,q.uniqWith=OF,q.unset=Tq,q.unzip=z1,q.unzipWith=u6,q.update=$q,q.updateWith=Nq,q.values=Ic,q.valuesIn=Lq,q.without=RF,q.words=B6,q.wrap=PU,q.xor=TF,q.xorBy=$F,q.xorWith=NF,q.zip=LF,q.zipObject=BF,q.zipObjectDeep=FF,q.zipWith=UF,q.entries=T6,q.entriesIn=$6,q.extend=D6,q.extendWith=qu,Q1(q,q),q.add=Lz,q.attempt=F6,q.camelCase=qq,q.capitalize=N6,q.ceil=Bz,q.clamp=Bq,q.clone=OU,q.cloneDeep=TU,q.cloneDeepWith=$U,q.cloneWith=RU,q.conformsTo=NU,q.deburr=L6,q.defaultTo=gz,q.divide=Fz,q.endsWith=zq,q.eq=Nn,q.escape=kq,q.escapeRegExp=Hq,q.every=JF,q.find=ZF,q.findIndex=a6,q.findKey=hq,q.findLast=XF,q.findLastIndex=c6,q.findLastKey=uq,q.floor=Uz,q.forEach=p6,q.forEachRight=g6,q.forIn=dq,q.forInRight=pq,q.forOwn=gq,q.forOwnRight=vq,q.get=K1,q.gt=LU,q.gte=BU,q.has=wq,q.hasIn=V1,q.head=l6,q.identity=Di,q.includes=nU,q.indexOf=XB,q.inRange=Fq,q.invoke=xq,q.isArguments=pa,q.isArray=wt,q.isArrayBuffer=FU,q.isArrayLike=Ci,q.isArrayLikeObject=xr,q.isBoolean=UU,q.isBuffer=bo,q.isDate=qU,q.isElement=zU,q.isEmpty=kU,q.isEqual=HU,q.isEqualWith=jU,q.isError=j1,q.isFinite=WU,q.isFunction=$s,q.isInteger=A6,q.isLength=Fu,q.isMap=E6,q.isMatch=KU,q.isMatchWith=VU,q.isNaN=GU,q.isNative=YU,q.isNil=QU,q.isNull=JU,q.isNumber=S6,q.isObject=hr,q.isObjectLike=mr,q.isPlainObject=Zf,q.isRegExp=W1,q.isSafeInteger=ZU,q.isSet=I6,q.isString=Uu,q.isSymbol=Hi,q.isTypedArray=Sc,q.isUndefined=XU,q.isWeakMap=eq,q.isWeakSet=tq,q.join=nF,q.kebabCase=jq,q.last=dn,q.lastIndexOf=sF,q.lowerCase=Wq,q.lowerFirst=Kq,q.lt=rq,q.lte=iq,q.max=qz,q.maxBy=zz,q.mean=kz,q.meanBy=Hz,q.min=jz,q.minBy=Wz,q.stubArray=X1,q.stubFalse=eg,q.stubObject=Dz,q.stubString=Oz,q.stubTrue=Rz,q.multiply=Kz,q.nth=oF,q.noConflict=xz,q.noop=Z1,q.now=Nu,q.pad=Vq,q.padEnd=Gq,q.padStart=Yq,q.parseInt=Jq,q.random=Uq,q.reduce=fU,q.reduceRight=lU,q.repeat=Qq,q.replace=Zq,q.result=Pq,q.round=Vz,q.runInContext=ie,q.sample=uU,q.size=gU,q.snakeCase=Xq,q.some=vU,q.sortedIndex=dF,q.sortedIndexBy=pF,q.sortedIndexOf=gF,q.sortedLastIndex=vF,q.sortedLastIndexBy=mF,q.sortedLastIndexOf=bF,q.startCase=tz,q.startsWith=rz,q.subtract=Gz,q.sum=Yz,q.sumBy=Jz,q.template=iz,q.times=Tz,q.toFinite=Ns,q.toInteger=Et,q.toLength=C6,q.toLower=nz,q.toNumber=pn,q.toSafeInteger=nq,q.toString=Vt,q.toUpper=sz,q.trim=oz,q.trimEnd=az,q.trimStart=cz,q.truncate=fz,q.unescape=lz,q.uniqueId=Nz,q.upperCase=hz,q.upperFirst=G1,q.each=p6,q.eachRight=g6,q.first=l6,Q1(q,function(){var o={};return ls(q,function(c,p){Yt.call(q.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),q.VERSION=i,cn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){q[o].placeholder=q}),cn(["drop","take"],function(o,c){Nt.prototype[o]=function(p){p=p===t?1:Dr(Et(p),0);var I=this.__filtered__&&!c?new Nt(this):this.clone();return I.__filtered__?I.__takeCount__=ti(p,I.__takeCount__):I.__views__.push({size:ti(p,A),type:o+(I.__dir__<0?"Right":"")}),I},Nt.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),cn(["filter","map","takeWhile"],function(o,c){var p=c+1,I=p==l||p==y;Nt.prototype[o]=function(T){var H=this.clone();return H.__iteratees__.push({iteratee:ot(T,3),type:p}),H.__filtered__=H.__filtered__||I,H}}),cn(["head","last"],function(o,c){var p="take"+(c?"Right":"");Nt.prototype[o]=function(){return this[p](1).value()[0]}}),cn(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");Nt.prototype[o]=function(){return this.__filtered__?new Nt(this):this[p](1)}}),Nt.prototype.compact=function(){return this.filter(Di)},Nt.prototype.find=function(o){return this.filter(o).head()},Nt.prototype.findLast=function(o){return this.reverse().find(o)},Nt.prototype.invokeMap=Mt(function(o,c){return typeof o=="function"?new Nt(this):this.map(function(p){return Kf(p,o,c)})}),Nt.prototype.reject=function(o){return this.filter(Bu(ot(o)))},Nt.prototype.slice=function(o,c){o=Et(o);var p=this;return p.__filtered__&&(o>0||c<0)?new Nt(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==t&&(c=Et(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},Nt.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Nt.prototype.toArray=function(){return this.take(A)},ls(Nt.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),I=/^(?:head|last)$/.test(c),T=q[I?"take"+(c=="last"?"Right":""):c],H=I||/^find/.test(c);T&&(q.prototype[c]=function(){var Z=this.__wrapped__,te=I?[1]:arguments,se=Z instanceof Nt,ue=te[0],de=se||wt(Z),ve=function(Rt){var Ft=T.apply(q,lo([Rt],te));return I&&Se?Ft[0]:Ft};de&&p&&typeof ue=="function"&&ue.length!=1&&(se=de=!1);var Se=this.__chain__,Je=!!this.__actions__.length,ct=H&&!Se,St=se&&!Je;if(!H&&de){Z=St?Z:new Nt(this);var ft=o.apply(Z,te);return ft.__actions__.push({func:Tu,args:[ve],thisArg:t}),new ln(ft,Se)}return ct&&St?o.apply(this,te):(ft=this.thru(ve),ct?I?ft.value()[0]:ft.value():ft)})}),cn(["pop","push","shift","sort","splice","unshift"],function(o){var c=su[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",I=/^(?:pop|shift)$/.test(o);q.prototype[o]=function(){var T=arguments;if(I&&!this.__chain__){var H=this.value();return c.apply(wt(H)?H:[],T)}return this[p](function(Z){return c.apply(wt(Z)?Z:[],T)})}}),ls(Nt.prototype,function(o,c){var p=q[c];if(p){var I=p.name+"";Yt.call(yc,I)||(yc[I]=[]),yc[I].push({name:c,func:p})}}),yc[Iu(t,k).name]=[{name:"wrapper",func:t}],Nt.prototype.clone=lL,Nt.prototype.reverse=hL,Nt.prototype.value=uL,q.prototype.at=zF,q.prototype.chain=kF,q.prototype.commit=HF,q.prototype.next=jF,q.prototype.plant=KF,q.prototype.reverse=VF,q.prototype.toJSON=q.prototype.valueOf=q.prototype.value=GF,q.prototype.first=q.prototype.head,Uf&&(q.prototype[Uf]=WF),q},mc=HN();_r?((_r.exports=mc)._=mc,er._=mc):Bt._=mc}).call(fr)})(P0,P0.exports);var D0={exports:{}};(function(r,e){var t=typeof self<"u"?self:fr,i=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(a){var f={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(l){return l&&DataView.prototype.isPrototypeOf(l)}if(f.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(l){return l&&u.indexOf(Object.prototype.toString.call(l))>-1};function w(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function P(l){return typeof l!="string"&&(l=String(l)),l}function M(l){var d={next:function(){var y=l.shift();return{done:y===void 0,value:y}}};return f.iterable&&(d[Symbol.iterator]=function(){return d}),d}function O(l){this.map={},l instanceof O?l.forEach(function(d,y){this.append(y,d)},this):Array.isArray(l)?l.forEach(function(d){this.append(d[0],d[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(d){this.append(d,l[d])},this)}O.prototype.append=function(l,d){l=w(l),d=P(d);var y=this.map[l];this.map[l]=y?y+", "+d:d},O.prototype.delete=function(l){delete this.map[w(l)]},O.prototype.get=function(l){return l=w(l),this.has(l)?this.map[l]:null},O.prototype.has=function(l){return this.map.hasOwnProperty(w(l))},O.prototype.set=function(l,d){this.map[w(l)]=P(d)},O.prototype.forEach=function(l,d){for(var y in this.map)this.map.hasOwnProperty(y)&&l.call(d,this.map[y],y,this)},O.prototype.keys=function(){var l=[];return this.forEach(function(d,y){l.push(y)}),M(l)},O.prototype.values=function(){var l=[];return this.forEach(function(d){l.push(d)}),M(l)},O.prototype.entries=function(){var l=[];return this.forEach(function(d,y){l.push([y,d])}),M(l)},f.iterable&&(O.prototype[Symbol.iterator]=O.prototype.entries);function $(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function W(l){return new Promise(function(d,y){l.onload=function(){d(l.result)},l.onerror=function(){y(l.error)}})}function k(l){var d=new FileReader,y=W(d);return d.readAsArrayBuffer(l),y}function F(l){var d=new FileReader,y=W(d);return d.readAsText(l),y}function Y(l){for(var d=new Uint8Array(l),y=new Array(d.length),C=0;C<d.length;C++)y[C]=String.fromCharCode(d[C]);return y.join("")}function B(l){if(l.slice)return l.slice(0);var d=new Uint8Array(l.byteLength);return d.set(new Uint8Array(l)),d.buffer}function z(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:f.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:f.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():f.arrayBuffer&&f.blob&&h(l)?(this._bodyArrayBuffer=B(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||g(l))?this._bodyArrayBuffer=B(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var l=$(this);if(l)return l;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?$(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(k)}),this.text=function(){var l=$(this);if(l)return l;if(this._bodyBlob)return F(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Y(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(ee)}),this.json=function(){return this.text().then(JSON.parse)},this}var j=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(l){var d=l.toUpperCase();return j.indexOf(d)>-1?d:l}function U(l,d){d=d||{};var y=d.body;if(l instanceof U){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,d.headers||(this.headers=new O(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!y&&l._bodyInit!=null&&(y=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=d.credentials||this.credentials||"same-origin",(d.headers||!this.headers)&&(this.headers=new O(d.headers)),this.method=_(d.method||this.method||"GET"),this.mode=d.mode||this.mode||null,this.signal=d.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&y)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(y)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ee(l){var d=new FormData;return l.trim().split("&").forEach(function(y){if(y){var C=y.split("="),D=C.shift().replace(/\+/g," "),S=C.join("=").replace(/\+/g," ");d.append(decodeURIComponent(D),decodeURIComponent(S))}}),d}function oe(l){var d=new O,y=l.replace(/\r?\n[\t ]+/g," ");return y.split(/\r?\n/).forEach(function(C){var D=C.split(":"),S=D.shift().trim();if(S){var v=D.join(":").trim();d.append(S,v)}}),d}z.call(U.prototype);function L(l,d){d||(d={}),this.type="default",this.status=d.status===void 0?200:d.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in d?d.statusText:"OK",this.headers=new O(d.headers),this.url=d.url||"",this._initBody(l)}z.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new O(this.headers),url:this.url})},L.error=function(){var l=new L(null,{status:0,statusText:""});return l.type="error",l};var b=[301,302,303,307,308];L.redirect=function(l,d){if(b.indexOf(d)===-1)throw new RangeError("Invalid status code");return new L(null,{status:d,headers:{location:l}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(d,y){this.message=d,this.name=y;var C=Error(d);this.stack=C.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function m(l,d){return new Promise(function(y,C){var D=new U(l,d);if(D.signal&&D.signal.aborted)return C(new a.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function v(){S.abort()}S.onload=function(){var A={status:S.status,statusText:S.statusText,headers:oe(S.getAllResponseHeaders()||"")};A.url="responseURL"in S?S.responseURL:A.headers.get("X-Request-URL");var x="response"in S?S.response:S.responseText;y(new L(x,A))},S.onerror=function(){C(new TypeError("Network request failed"))},S.ontimeout=function(){C(new TypeError("Network request failed"))},S.onabort=function(){C(new a.DOMException("Aborted","AbortError"))},S.open(D.method,D.url,!0),D.credentials==="include"?S.withCredentials=!0:D.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&f.blob&&(S.responseType="blob"),D.headers.forEach(function(A,x){S.setRequestHeader(x,A)}),D.signal&&(D.signal.addEventListener("abort",v),S.onreadystatechange=function(){S.readyState===4&&D.signal.removeEventListener("abort",v)}),S.send(typeof D._bodyInit>"u"?null:D._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=O,s.Request=U,s.Response=L),a.Headers=O,a.Request=U,a.Response=L,a.fetch=m,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})(D0,D0.exports);var K2=z6(D0.exports),KP=Object.defineProperty,VP=Object.defineProperties,GP=Object.getOwnPropertyDescriptors,V2=Object.getOwnPropertySymbols,YP=Object.prototype.hasOwnProperty,JP=Object.prototype.propertyIsEnumerable,G2=(r,e,t)=>e in r?KP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Y2=(r,e)=>{for(var t in e||(e={}))YP.call(e,t)&&G2(r,t,e[t]);if(V2)for(var t of V2(e))JP.call(e,t)&&G2(r,t,e[t]);return r},J2=(r,e)=>VP(r,GP(e));const QP={Accept:"application/json","Content-Type":"application/json"},ZP="POST",Q2={headers:QP,method:ZP},Z2=10;class is{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new qr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!Jb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}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){this.isAvailable||await this.register();try{const t=bs(e),i=await(await K2(this.url,J2(Y2({},Q2),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!Jb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return n(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=bs({id:1,jsonrpc:"2.0",method:"test",params:[]});await K2(e,J2(Y2({},Q2),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}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 t=typeof e.data=="string"?Po(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=rh(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return jb(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Z2&&this.events.setMaxListeners(Z2)}}const X2="error",XP="wss://relay.walletconnect.org",eD="wc",tD="universal_provider",e3=`${eD}@2:${tD}:`,t3="https://rpc.walletconnect.org/v1/",Wa="generic",rD=`${t3}bundler`,En={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var iD=Object.defineProperty,nD=Object.defineProperties,sD=Object.getOwnPropertyDescriptors,r3=Object.getOwnPropertySymbols,oD=Object.prototype.hasOwnProperty,aD=Object.prototype.propertyIsEnumerable,i3=(r,e,t)=>e in r?iD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ah=(r,e)=>{for(var t in e||(e={}))oD.call(e,t)&&i3(r,t,e[t]);if(r3)for(var t of r3(e))aD.call(e,t)&&i3(r,t,e[t]);return r},cD=(r,e)=>nD(r,sD(e));function Sn(r,e,t){var i;const n=Ba(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${t3}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function zo(r){return r.includes(":")?r.split(":")[1]:r}function n3(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function fD(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const s=e.namespaces[n].accounts;i.push(...s)}),i}function O0(r={},e={}){const t=s3(r),i=s3(e);return P0.exports.merge(t,i)}function s3(r){var e,t,i,n;const s={};if(!ef(r))return s;for(const[a,f]of Object.entries(r)){const h=e0(a)?[a]:f.chains,u=f.methods||[],g=f.events||[],w=f.rpcMap||{},P=Xc(a);s[P]=cD(ah(ah({},s[P]),f),{chains:ql(h,(e=s[P])==null?void 0:e.chains),methods:ql(u,(t=s[P])==null?void 0:t.methods),events:ql(g,(i=s[P])==null?void 0:i.events),rpcMap:ah(ah({},w),(n=s[P])==null?void 0:n.rpcMap)})}return s}function lD(r){return r.includes(":")?r.split(":")[2]:r}function o3(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],s=i.events||[],a=i.accounts||[],f=e0(t)?[t]:i.chains?i.chains:n3(i.accounts);e[t]={chains:f,methods:n,events:s,accounts:a}}return e}function R0(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const a3={},Wt=r=>a3[r],T0=(r,e)=>{a3[r]=e};class hD{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}}var uD=Object.defineProperty,dD=Object.defineProperties,pD=Object.getOwnPropertyDescriptors,c3=Object.getOwnPropertySymbols,gD=Object.prototype.hasOwnProperty,vD=Object.prototype.propertyIsEnumerable,f3=(r,e,t)=>e in r?uD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l3=(r,e)=>{for(var t in e||(e={}))gD.call(e,t)&&f3(r,t,e[t]);if(c3)for(var t of c3(e))vD.call(e,t)&&f3(r,t,e[t]);return r},h3=(r,e)=>dD(r,pD(e));class mD{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||Sn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(zo(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const s=parseInt(n,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const s=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const a=this.client.session.get(e.topic),f=((n=a?.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[s])return f?.[s];const h=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:h3(l3({},a.sessionProperties||{}),{capabilities:h3(l3({},f||{}),{[s]:h})})})}catch(u){console.warn("Failed to update session with capabilities",u)}return h}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),s=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(s){const f=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from bundler",h,f)}}const a=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,a)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Gs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,t){return`${rD}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class bD{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}}class wD{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}}class yD{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||Sn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new yn(new is(i,Wt("disableProviderPing")))}}class _D{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=zo(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}}class xD{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}}class AD{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}}class ED{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||Sn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace);return typeof i>"u"?void 0:new yn(new is(i,Wt("disableProviderPing")))}}class SD{constructor(e){this.name=Wa,this.namespace=e.namespace,this.events=Wt("events"),this.client=Wt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(En.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const s=Ba(n);i[`${s.namespace}:${s.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Sn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new yn(new is(i,Wt("disableProviderPing")))}}var ID=Object.defineProperty,MD=Object.defineProperties,CD=Object.getOwnPropertyDescriptors,u3=Object.getOwnPropertySymbols,PD=Object.prototype.hasOwnProperty,DD=Object.prototype.propertyIsEnumerable,d3=(r,e,t)=>e in r?ID(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ch=(r,e)=>{for(var t in e||(e={}))PD.call(e,t)&&d3(r,t,e[t]);if(u3)for(var t of u3(e))DD.call(e,t)&&d3(r,t,e[t]);return r},$0=(r,e)=>MD(r,CD(e));class N0{constructor(e){this.events=new qr.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Jn(eh({level:e?.logger||X2})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new N0(e);return await t.initialize(),t}async request(e,t,i){const[n,s]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:ch({},e),chainId:`${n}:${s}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const s=new Date().getTime();this.request(e,i,n).then(a=>t(null,th(s,a))).catch(a=>t(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Gt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const s=await n();if(this.session=s.session,this.session){const a=o3(this.session.namespaces);this.namespaces=O0(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(s=>{this.session=s;const a=o3(s.namespaces);this.namespaces=O0(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==H2)throw s;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),s=this.getProvider(i);s.name===Wa?s.setDefaultChain(`${i}:${n}`,t):s.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Yn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await C0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||X2,relayUrl:this.providerOpts.relayUrl||XP,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Xc(t)))];T0("client",this.client),T0("events",this.events),T0("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=fD(t,this.session),n=n3(i),s=O0(this.namespaces,this.optionalNamespaces),a=$0(ch({},s[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new mD({namespace:a});break;case"algorand":this.rpcProviders[t]=new yD({namespace:a});break;case"solana":this.rpcProviders[t]=new bD({namespace:a});break;case"cosmos":this.rpcProviders[t]=new wD({namespace:a});break;case"polkadot":this.rpcProviders[t]=new hD({namespace:a});break;case"cip34":this.rpcProviders[t]=new _D({namespace:a});break;case"elrond":this.rpcProviders[t]=new xD({namespace:a});break;case"multiversx":this.rpcProviders[t]=new AD({namespace:a});break;case"near":this.rpcProviders[t]=new ED({namespace:a});break;default:this.rpcProviders[Wa]?this.rpcProviders[Wa].updateNamespace(a):this.rpcProviders[Wa]=new SD({namespace:a})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&Yn(n)&&this.events.emit("accountsChanged",n.map(lD))}else if(i.name==="chainChanged"){const n=t.chainId,s=t.event.data,a=Xc(n),f=R0(n)!==R0(s)?`${a}:${R0(s)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,s=(i=this.client)==null?void 0:i.session.get(e);this.session=$0(ch({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",$0(ch({},Gt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(En.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Wa]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(a=>Xc(a)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=Xc(Object.keys(this.namespaces)[0]),s=this.rpcProviders[n].getDefaultChain();return[n,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${e3}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${e3}/${e}`)}}const OD=N0,RD="wc",TD="ethereum_provider",$D=`${RD}@2:${TD}:`,ND="https://rpc.walletconnect.org/v1/",fh=["eth_sendTransaction","personal_sign"],p3=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],lh=["chainChanged","accountsChanged"],g3=["chainChanged","accountsChanged","message","disconnect","connect"];var LD=Object.defineProperty,BD=Object.defineProperties,FD=Object.getOwnPropertyDescriptors,v3=Object.getOwnPropertySymbols,UD=Object.prototype.hasOwnProperty,qD=Object.prototype.propertyIsEnumerable,m3=(r,e,t)=>e in r?LD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ka=(r,e)=>{for(var t in e||(e={}))UD.call(e,t)&&m3(r,t,e[t]);if(v3)for(var t of v3(e))qD.call(e,t)&&m3(r,t,e[t]);return r},L0=(r,e)=>BD(r,FD(e));function hh(r){return Number(r[0].split(":")[1])}function uh(r){return`0x${r.toString(16)}`}function zD(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:s,optionalEvents:a,rpcMap:f}=r;if(!Yn(e))throw new Error("Invalid chains");const h={chains:e,methods:i||fh,events:s||lh,rpcMap:Ka({},e.length?{[hh(e)]:f[hh(e)]}:{})},u=s?.filter(M=>!lh.includes(M)),g=i?.filter(M=>!fh.includes(M));if(!t&&!a&&!n&&!(u!=null&&u.length)&&!(g!=null&&g.length))return{required:e.length?h:void 0};const w=u?.length&&g?.length||!t,P={chains:[...new Set(w?h.chains.concat(t||[]):t)],methods:[...new Set(h.methods.concat(n!=null&&n.length?n:p3))],events:[...new Set(h.events.concat(a!=null&&a.length?a:g3))],rpcMap:f};return{required:e.length?h:void 0,optional:t.length?P:void 0}}class dh{constructor(){this.events=new qr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=$D,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new dh;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=zD(this.rpc);try{const n=await new Promise(async(a,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(L0(Ka({namespaces:Ka({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(u=>{a(u)}).catch(u=>{f(new Error(u.message))})});if(!n)return;const s=Bm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:uh(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const i=await new Promise(async(s,a)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(L0(Ka({},e),{chains:this.rpc.chains}),t).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})}),n=i.session;if(n){const s=Bm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:uh(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",uh(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",L0(Ka({},Gt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}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 t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",uh(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e?.chains)!=null?t:[],s=(i=e?.optionalChains)!=null?i:[],a=n.concat(s);if(!a.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?e?.methods||fh:[],h=n.length?e?.events||lh:[],u=e?.optionalMethods||[],g=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(a,e.projectId),P=e?.qrModalOptions||void 0;return{chains:n?.map(M=>this.formatChainId(M)),optionalChains:s.map(M=>this.formatChainId(M)),methods:f,events:h,optionalMethods:u,optionalEvents:g,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:P,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?hh(this.rpc.chains):hh(this.rpc.optionalChains),this.signer=await OD.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await Promise.resolve().then(function(){return lO});t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Ka({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&Yn(t)&&(this.rpc.chains=t.map(s=>this.formatChainId(s)),t.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)})),i&&Yn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(s=>this.formatChainId(s)),i.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${ND}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const kD=dh,HD=Symbol(),b3=Object.getPrototypeOf,B0=new WeakMap,jD=r=>r&&(B0.has(r)?B0.get(r):b3(r)===Object.prototype||b3(r)===Array.prototype),WD=r=>jD(r)&&r[HD]||null,w3=(r,e=!0)=>{B0.set(r,e)},F0=r=>typeof r=="object"&&r!==null,Ys=new WeakMap,ph=new WeakSet,KD=(r=Object.is,e=(u,g)=>new Proxy(u,g),t=u=>F0(u)&&!ph.has(u)&&(Array.isArray(u)||!(Symbol.iterator in u))&&!(u instanceof WeakMap)&&!(u instanceof WeakSet)&&!(u instanceof Error)&&!(u instanceof Number)&&!(u instanceof Date)&&!(u instanceof String)&&!(u instanceof RegExp)&&!(u instanceof ArrayBuffer),i=u=>{switch(u.status){case"fulfilled":return u.value;case"rejected":throw u.reason;default:throw u}},n=new WeakMap,s=(u,g,w=i)=>{const P=n.get(u);if(P?.[0]===g)return P[1];const M=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u));return w3(M,!0),n.set(u,[g,M]),Reflect.ownKeys(u).forEach(O=>{if(Object.getOwnPropertyDescriptor(M,O))return;const $=Reflect.get(u,O),W={value:$,enumerable:!0,configurable:!0};if(ph.has($))w3($,!1);else if($ instanceof Promise)delete W.value,W.get=()=>w($);else if(Ys.has($)){const[k,F]=Ys.get($);W.value=s(k,F(),w)}Object.defineProperty(M,O,W)}),Object.preventExtensions(M)},a=new WeakMap,f=[1,1],h=u=>{if(!F0(u))throw new Error("object required");const g=a.get(u);if(g)return g;let w=f[0];const P=new Set,M=(ee,oe=++f[0])=>{w!==oe&&(w=oe,P.forEach(L=>L(ee,oe)))};let O=f[1];const $=(ee=++f[1])=>(O!==ee&&!P.size&&(O=ee,k.forEach(([oe])=>{const L=oe[1](ee);L>w&&(w=L)})),w),W=ee=>(oe,L)=>{const b=[...oe];b[1]=[ee,...b[1]],M(b,L)},k=new Map,F=(ee,oe)=>{if(k.has(ee))throw new Error("prop listener already exists");if(P.size){const L=oe[3](W(ee));k.set(ee,[oe,L])}else k.set(ee,[oe])},Y=ee=>{var oe;const L=k.get(ee);L&&(k.delete(ee),(oe=L[1])==null||oe.call(L))},B=ee=>(P.add(ee),P.size===1&&k.forEach(([L,b],m)=>{if(b)throw new Error("remove already exists");const l=L[3](W(m));k.set(m,[L,l])}),()=>{P.delete(ee),P.size===0&&k.forEach(([L,b],m)=>{b&&(b(),k.set(m,[L]))})}),z=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u)),_=e(z,{deleteProperty(ee,oe){const L=Reflect.get(ee,oe);Y(oe);const b=Reflect.deleteProperty(ee,oe);return b&&M(["delete",[oe],L]),b},set(ee,oe,L,b){const m=Reflect.has(ee,oe),l=Reflect.get(ee,oe,b);if(m&&(r(l,L)||a.has(L)&&r(l,a.get(L))))return!0;Y(oe),F0(L)&&(L=WD(L)||L);let d=L;if(L instanceof Promise)L.then(y=>{L.status="fulfilled",L.value=y,M(["resolve",[oe],y])}).catch(y=>{L.status="rejected",L.reason=y,M(["reject",[oe],y])});else{!Ys.has(L)&&t(L)&&(d=h(L));const y=!ph.has(d)&&Ys.get(d);y&&F(oe,y)}return Reflect.set(ee,oe,d,b),M(["set",[oe],L,l]),!0}});a.set(u,_);const U=[z,$,s,B];return Ys.set(_,U),Reflect.ownKeys(u).forEach(ee=>{const oe=Object.getOwnPropertyDescriptor(u,ee);"value"in oe&&(_[ee]=u[ee],delete oe.value,delete oe.writable),Object.defineProperty(z,ee,oe)}),_})=>[h,Ys,ph,r,e,t,i,n,s,a,f],[VD]=KD();function Js(r={}){return VD(r)}function ko(r,e,t){const i=Ys.get(r);i||console.warn("Please use proxy object");let n;const s=[],a=i[3];let f=!1;const u=a(g=>{if(s.push(g),t){e(s.splice(0));return}n||(n=Promise.resolve().then(()=>{n=void 0,f&&e(s.splice(0))}))});return f=!0,()=>{f=!1,u()}}function GD(r,e){const t=Ys.get(r);t||console.warn("Please use proxy object");const[i,n,s]=t;return s(i,n(),e)}const Br=Js({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),lr={state:Br,subscribe(r){return ko(Br,()=>r(Br))},push(r,e){r!==Br.view&&(Br.view=r,e&&(Br.data=e),Br.history.push(r))},reset(r){Br.view=r,Br.history=[r]},replace(r){Br.history.length>1&&(Br.history[Br.history.length-1]=r,Br.view=r)},goBack(){if(Br.history.length>1){Br.history.pop();const[r]=Br.history.slice(-1);Br.view=r}},setData(r){Br.data=r}},je={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return je.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const r=navigator.userAgent.toLowerCase();return je.isMobile()&&(r.includes("iphone")||r.includes("ipad"))},isHttpUrl(r){return r.startsWith("http://")||r.startsWith("https://")},isArray(r){return Array.isArray(r)&&r.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(r,e,t){if(je.isHttpUrl(r))return this.formatUniversalUrl(r,e,t);let i=r;i.includes("://")||(i=r.replaceAll("/","").replaceAll(":",""),i=`${i}://`),i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},formatUniversalUrl(r,e,t){if(!je.isHttpUrl(r))return this.formatNativeUrl(r,e,t);let i=r;if(i.startsWith("https://t.me")){const s=Buffer.from(e).toString("base64").replace(/[=]/g,"");i.endsWith("/")&&(i=i.slice(0,-1)),this.setWalletConnectDeepLink(i,t);const a=new URL(i);return a.searchParams.set("startapp",s),a.toString()}i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},async wait(r){return new Promise(e=>{setTimeout(e,r)})},openHref(r,e){const t=this.isTelegram()?"_blank":e;window.open(r,t,"noreferrer noopener")},setWalletConnectDeepLink(r,e){try{localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:r,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(r){try{const[e]=r.split("?");localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(je.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(je.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var r;const e=(r=lr.state.data)==null?void 0:r.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},YD=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Jr=Js({enabled:YD,userSessionId:"",events:[],connectedWalletId:void 0}),y3={state:Jr,subscribe(r){return ko(Jr.events,()=>r(GD(Jr.events[Jr.events.length-1])))},initialize(){Jr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Jr.userSessionId=crypto.randomUUID())},setConnectedWalletId(r){Jr.connectedWalletId=r},click(r){if(Jr.enabled){const e={type:"CLICK",name:r.name,userSessionId:Jr.userSessionId,timestamp:Date.now(),data:r};Jr.events.push(e)}},track(r){if(Jr.enabled){const e={type:"TRACK",name:r.name,userSessionId:Jr.userSessionId,timestamp:Date.now(),data:r};Jr.events.push(e)}},view(r){if(Jr.enabled){const e={type:"VIEW",name:r.name,userSessionId:Jr.userSessionId,timestamp:Date.now(),data:r};Jr.events.push(e)}}},ns=Js({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),yr={state:ns,subscribe(r){return ko(ns,()=>r(ns))},setChains(r){ns.chains=r},setWalletConnectUri(r){ns.walletConnectUri=r},setIsCustomDesktop(r){ns.isCustomDesktop=r},setIsCustomMobile(r){ns.isCustomMobile=r},setIsDataLoaded(r){ns.isDataLoaded=r},setIsUiLoaded(r){ns.isUiLoaded=r},setIsAuth(r){ns.isAuth=r}},gh=Js({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),Fi={state:gh,subscribe(r){return ko(gh,()=>r(gh))},setConfig(r){var e,t;y3.initialize(),yr.setChains(r.chains),yr.setIsAuth(!!r.enableAuthMode),yr.setIsCustomMobile(!!((e=r.mobileWallets)!=null&&e.length)),yr.setIsCustomDesktop(!!((t=r.desktopWallets)!=null&&t.length)),je.setModalVersionInStorage(),Object.assign(gh,r)}};var JD=Object.defineProperty,_3=Object.getOwnPropertySymbols,QD=Object.prototype.hasOwnProperty,ZD=Object.prototype.propertyIsEnumerable,x3=(r,e,t)=>e in r?JD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,XD=(r,e)=>{for(var t in e||(e={}))QD.call(e,t)&&x3(r,t,e[t]);if(_3)for(var t of _3(e))ZD.call(e,t)&&x3(r,t,e[t]);return r};const U0="https://explorer-api.walletconnect.com",q0="wcm",z0="js-2.7.0";async function vh(r,e){const t=XD({sdkType:q0,sdkVersion:z0},e),i=new URL(r,U0);return i.searchParams.append("projectId",Fi.state.projectId),Object.entries(t).forEach(([s,a])=>{a&&i.searchParams.append(s,String(a))}),(await fetch(i)).json()}const Ho={async getDesktopListings(r){return vh("/w3m/v1/getDesktopListings",r)},async getMobileListings(r){return vh("/w3m/v1/getMobileListings",r)},async getInjectedListings(r){return vh("/w3m/v1/getInjectedListings",r)},async getAllListings(r){return vh("/w3m/v1/getAllListings",r)},getWalletImageUrl(r){return`${U0}/w3m/v1/getWalletImage/${r}?projectId=${Fi.state.projectId}&sdkType=${q0}&sdkVersion=${z0}`},getAssetImageUrl(r){return`${U0}/w3m/v1/getAssetImage/${r}?projectId=${Fi.state.projectId}&sdkType=${q0}&sdkVersion=${z0}`}};var eO=Object.defineProperty,A3=Object.getOwnPropertySymbols,tO=Object.prototype.hasOwnProperty,rO=Object.prototype.propertyIsEnumerable,E3=(r,e,t)=>e in r?eO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,iO=(r,e)=>{for(var t in e||(e={}))tO.call(e,t)&&E3(r,t,e[t]);if(A3)for(var t of A3(e))rO.call(e,t)&&E3(r,t,e[t]);return r};const S3=je.isMobile(),ss=Js({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),_i={state:ss,async getRecomendedWallets(){const{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:e}=Fi.state;if(r==="NONE"||e==="ALL"&&!r)return ss.recomendedWallets;if(je.isArray(r)){const i={recommendedIds:r.join(",")},{listings:n}=await Ho.getAllListings(i),s=Object.values(n);s.sort((a,f)=>{const h=r.indexOf(a.id),u=r.indexOf(f.id);return h-u}),ss.recomendedWallets=s}else{const{chains:t,isAuth:i}=yr.state,n=t?.join(","),s=je.isArray(e),a={page:1,sdks:i?"auth_v1":void 0,entries:je.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:s?e.join(","):void 0},{listings:f}=S3?await Ho.getMobileListings(a):await Ho.getDesktopListings(a);ss.recomendedWallets=Object.values(f)}return ss.recomendedWallets},async getWallets(r){const e=iO({},r),{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:i}=Fi.state,{recomendedWallets:n}=ss;if(i==="ALL")return ss.wallets;n.length?e.excludedIds=n.map(w=>w.id).join(","):je.isArray(t)&&(e.excludedIds=t.join(",")),je.isArray(i)&&(e.excludedIds=[e.excludedIds,i].filter(Boolean).join(",")),yr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:a}=r,{listings:f,total:h}=S3?await Ho.getMobileListings(e):await Ho.getDesktopListings(e),u=Object.values(f),g=a?"search":"wallets";return ss[g]={listings:[...ss[g].listings,...u],total:h,page:s??1},{listings:u,total:h}},getWalletImageUrl(r){return Ho.getWalletImageUrl(r)},getAssetImageUrl(r){return Ho.getAssetImageUrl(r)},resetSearch(){ss.search={listings:[],total:0,page:1}}},Va=Js({open:!1}),jo={state:Va,subscribe(r){return ko(Va,()=>r(Va))},async open(r){return new Promise(e=>{const{isUiLoaded:t,isDataLoaded:i}=yr.state;if(je.removeWalletConnectDeepLink(),yr.setWalletConnectUri(r?.uri),yr.setChains(r?.chains),lr.reset("ConnectWallet"),t&&i)Va.open=!0,e();else{const n=setInterval(()=>{const s=yr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(n),Va.open=!0,e())},200)}})},close(){Va.open=!1}};var nO=Object.defineProperty,I3=Object.getOwnPropertySymbols,sO=Object.prototype.hasOwnProperty,oO=Object.prototype.propertyIsEnumerable,M3=(r,e,t)=>e in r?nO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,aO=(r,e)=>{for(var t in e||(e={}))sO.call(e,t)&&M3(r,t,e[t]);if(I3)for(var t of I3(e))oO.call(e,t)&&M3(r,t,e[t]);return r};function cO(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const gf=Js({themeMode:cO()?"dark":"light"}),Qs={state:gf,subscribe(r){return ko(gf,()=>r(gf))},setThemeConfig(r){const{themeMode:e,themeVariables:t}=r;e&&(gf.themeMode=e),t&&(gf.themeVariables=aO({},t))}},Wo=Js({open:!1,message:"",variant:"success"}),Zs={state:Wo,subscribe(r){return ko(Wo,()=>r(Wo))},openToast(r,e){Wo.open=!0,Wo.message=r,Wo.variant=e},closeToast(){Wo.open=!1}};class fO{constructor(e){this.openModal=jo.open,this.closeModal=jo.close,this.subscribeModal=jo.subscribe,this.setTheme=Qs.setThemeConfig,Qs.setThemeConfig(e),Fi.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return wN});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),yr.setIsUiLoaded(!0)}}}var lO=Object.freeze({__proto__:null,WalletConnectModal:fO});/**
69
+ }`;var St=F6(function(){return Wt(k,Je+"return "+ve).apply(t,Z)});if(St.source=ve,j1(St))throw St;return St}function sz(o){return Vt(o).toLowerCase()}function oz(o){return Vt(o).toUpperCase()}function az(o,c,p){if(o=Vt(o),o&&(p||c===t))return Vw(o);if(!o||!(c=ki(c)))return o;var I=$n(o),T=$n(c),k=Gw(I,T),Z=Yw(I,T)+1;return bo(I,k,Z).join("")}function cz(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.slice(0,Qw(o)+1);if(!o||!(c=ki(c)))return o;var I=$n(o),T=Yw(I,$n(c))+1;return bo(I,0,T).join("")}function fz(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.replace(nt,"");if(!o||!(c=ki(c)))return o;var I=$n(o),T=Gw(I,$n(c));return bo(I,T).join("")}function lz(o,c){var p=oe,I=L;if(hr(c)){var T="separator"in c?c.separator:T;p="length"in c?Et(c.length):p,I="omission"in c?ki(c.omission):I}o=Vt(o);var k=o.length;if(gc(o)){var Z=$n(o);k=Z.length}if(p>=k)return o;var te=p-vc(I);if(te<1)return I;var se=Z?bo(Z,0,te).join(""):o.slice(0,te);if(T===t)return se+I;if(Z&&(te+=se.length-te),W1(T)){if(o.slice(te).search(T)){var ue,de=se;for(T.global||(T=a1(T.source,Vt(_t.exec(T))+"g")),T.lastIndex=0;ue=T.exec(de);)var ve=ue.index;se=se.slice(0,ve===t?te:ve)}}else if(o.indexOf(ki(T),te)!=te){var Se=se.lastIndexOf(T);Se>-1&&(se=se.slice(0,Se))}return se+I}function hz(o){return o=Vt(o),o&&rt.test(o)?o.replace(Ot,qN):o}var uz=Ac(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),G1=Uy("toUpperCase");function B6(o,c,p){return o=Vt(o),c=p?t:c,c===t?NN(o)?kN(o):IN(o):o.match(c)||[]}var F6=Mt(function(o,c){try{return Fr(o,t,c)}catch(p){return j1(p)?p:new gt(p)}}),dz=Ts(function(o,c){return hn(c,function(p){p=us(p),Os(o,p,H1(o[p],o))}),o});function pz(o){var c=o==null?0:o.length,p=ot();return o=c?cr(o,function(I){if(typeof I[1]!="function")throw new un(a);return[p(I[0]),I[1]]}):[],Mt(function(I){for(var T=-1;++T<c;){var k=o[T];if(Fr(k[0],this,I))return Fr(k[1],this,I)}})}function gz(o){return qL(pn(o,w))}function Y1(o){return function(){return o}}function vz(o,c){return o==null||o!==o?c:o}var mz=zy(),bz=zy(!0);function Di(o){return o}function J1(o){return my(typeof o=="function"?o:pn(o,w))}function wz(o){return wy(pn(o,w))}function yz(o,c){return yy(o,pn(c,w))}var _z=Mt(function(o,c){return function(p){return Kf(p,o,c)}}),xz=Mt(function(o,c){return function(p){return Kf(o,p,c)}});function Q1(o,c,p){var I=Ur(c),T=_u(c,I);p==null&&!(hr(c)&&(T.length||!I.length))&&(p=c,c=o,o=this,T=_u(c,Ur(c)));var k=!(hr(p)&&"chain"in p)||!!p.chain,Z=Ns(o);return hn(T,function(te){var se=c[te];o[te]=se,Z&&(o.prototype[te]=function(){var ue=this.__chain__;if(k||ue){var de=o(this.__wrapped__),ve=de.__actions__=Mi(this.__actions__);return ve.push({func:se,args:arguments,thisArg:o}),de.__chain__=ue,de}return se.apply(o,ho([this.value()],arguments))})}),o}function Az(){return Bt._===this&&(Bt._=YN),this}function Z1(){}function Ez(o){return o=Et(o),Mt(function(c){return _y(c,o)})}var Sz=P1(cr),Iz=P1(Hw),Mz=P1(e1);function U6(o){return L1(o)?t1(us(o)):iB(o)}function Cz(o){return function(c){return o==null?t:ha(o,c)}}var Pz=ky(),Dz=ky(!0);function X1(){return[]}function eg(){return!1}function Oz(){return{}}function Rz(){return""}function Tz(){return!0}function $z(o,c){if(o=Et(o),o<1||o>D)return[];var p=A,I=ti(o,A);c=ot(c),o-=A;for(var T=n1(I,c);++p<o;)c(p);return T}function Nz(o){return wt(o)?cr(o,us):ji(o)?[o]:Mi(s6(Vt(o)))}function Lz(o){var c=++VN;return Vt(o)+c}var Bz=Mu(function(o,c){return o+c},0),Fz=D1("ceil"),Uz=Mu(function(o,c){return o/c},1),qz=D1("floor");function zz(o){return o&&o.length?yu(o,Di,g1):t}function Hz(o,c){return o&&o.length?yu(o,ot(c,2),g1):t}function kz(o){return Ww(o,Di)}function jz(o,c){return Ww(o,ot(c,2))}function Wz(o){return o&&o.length?yu(o,Di,w1):t}function Kz(o,c){return o&&o.length?yu(o,ot(c,2),w1):t}var Vz=Mu(function(o,c){return o*c},1),Gz=D1("round"),Yz=Mu(function(o,c){return o-c},0);function Jz(o){return o&&o.length?i1(o,Di):0}function Qz(o,c){return o&&o.length?i1(o,ot(c,2)):0}return q.after=wU,q.ary=v6,q.assign=oq,q.assignIn=D6,q.assignInWith=qu,q.assignWith=aq,q.at=cq,q.before=m6,q.bind=H1,q.bindAll=dz,q.bindKey=b6,q.castArray=OU,q.chain=d6,q.chunk=qB,q.compact=zB,q.concat=HB,q.cond=pz,q.conforms=gz,q.constant=Y1,q.countBy=JF,q.create=fq,q.curry=w6,q.curryRight=y6,q.debounce=_6,q.defaults=lq,q.defaultsDeep=hq,q.defer=yU,q.delay=_U,q.difference=kB,q.differenceBy=jB,q.differenceWith=WB,q.drop=KB,q.dropRight=VB,q.dropRightWhile=GB,q.dropWhile=YB,q.fill=JB,q.filter=ZF,q.flatMap=tU,q.flatMapDeep=rU,q.flatMapDepth=iU,q.flatten=f6,q.flattenDeep=QB,q.flattenDepth=ZB,q.flip=xU,q.flow=mz,q.flowRight=bz,q.fromPairs=XB,q.functions=bq,q.functionsIn=wq,q.groupBy=nU,q.initial=tF,q.intersection=rF,q.intersectionBy=iF,q.intersectionWith=nF,q.invert=_q,q.invertBy=xq,q.invokeMap=oU,q.iteratee=J1,q.keyBy=aU,q.keys=Ur,q.keysIn=Pi,q.map=$u,q.mapKeys=Eq,q.mapValues=Sq,q.matches=wz,q.matchesProperty=yz,q.memoize=Lu,q.merge=Iq,q.mergeWith=O6,q.method=_z,q.methodOf=xz,q.mixin=Q1,q.negate=Bu,q.nthArg=Ez,q.omit=Mq,q.omitBy=Cq,q.once=AU,q.orderBy=cU,q.over=Sz,q.overArgs=EU,q.overEvery=Iz,q.overSome=Mz,q.partial=k1,q.partialRight=x6,q.partition=fU,q.pick=Pq,q.pickBy=R6,q.property=U6,q.propertyOf=Cz,q.pull=cF,q.pullAll=h6,q.pullAllBy=fF,q.pullAllWith=lF,q.pullAt=hF,q.range=Pz,q.rangeRight=Dz,q.rearg=SU,q.reject=uU,q.remove=uF,q.rest=IU,q.reverse=q1,q.sampleSize=pU,q.set=Oq,q.setWith=Rq,q.shuffle=gU,q.slice=dF,q.sortBy=bU,q.sortedUniq=yF,q.sortedUniqBy=_F,q.split=tz,q.spread=MU,q.tail=xF,q.take=AF,q.takeRight=EF,q.takeRightWhile=SF,q.takeWhile=IF,q.tap=zF,q.throttle=CU,q.thru=Tu,q.toArray=M6,q.toPairs=T6,q.toPairsIn=$6,q.toPath=Nz,q.toPlainObject=P6,q.transform=Tq,q.unary=PU,q.union=MF,q.unionBy=CF,q.unionWith=PF,q.uniq=DF,q.uniqBy=OF,q.uniqWith=RF,q.unset=$q,q.unzip=z1,q.unzipWith=u6,q.update=Nq,q.updateWith=Lq,q.values=Ic,q.valuesIn=Bq,q.without=TF,q.words=B6,q.wrap=DU,q.xor=$F,q.xorBy=NF,q.xorWith=LF,q.zip=BF,q.zipObject=FF,q.zipObjectDeep=UF,q.zipWith=qF,q.entries=T6,q.entriesIn=$6,q.extend=D6,q.extendWith=qu,Q1(q,q),q.add=Bz,q.attempt=F6,q.camelCase=zq,q.capitalize=N6,q.ceil=Fz,q.clamp=Fq,q.clone=RU,q.cloneDeep=$U,q.cloneDeepWith=NU,q.cloneWith=TU,q.conformsTo=LU,q.deburr=L6,q.defaultTo=vz,q.divide=Uz,q.endsWith=Hq,q.eq=Ln,q.escape=kq,q.escapeRegExp=jq,q.every=QF,q.find=XF,q.findIndex=a6,q.findKey=uq,q.findLast=eU,q.findLastIndex=c6,q.findLastKey=dq,q.floor=qz,q.forEach=p6,q.forEachRight=g6,q.forIn=pq,q.forInRight=gq,q.forOwn=vq,q.forOwnRight=mq,q.get=K1,q.gt=BU,q.gte=FU,q.has=yq,q.hasIn=V1,q.head=l6,q.identity=Di,q.includes=sU,q.indexOf=eF,q.inRange=Uq,q.invoke=Aq,q.isArguments=pa,q.isArray=wt,q.isArrayBuffer=UU,q.isArrayLike=Ci,q.isArrayLikeObject=xr,q.isBoolean=qU,q.isBuffer=wo,q.isDate=zU,q.isElement=HU,q.isEmpty=kU,q.isEqual=jU,q.isEqualWith=WU,q.isError=j1,q.isFinite=KU,q.isFunction=Ns,q.isInteger=A6,q.isLength=Fu,q.isMap=E6,q.isMatch=VU,q.isMatchWith=GU,q.isNaN=YU,q.isNative=JU,q.isNil=ZU,q.isNull=QU,q.isNumber=S6,q.isObject=hr,q.isObjectLike=mr,q.isPlainObject=Zf,q.isRegExp=W1,q.isSafeInteger=XU,q.isSet=I6,q.isString=Uu,q.isSymbol=ji,q.isTypedArray=Sc,q.isUndefined=eq,q.isWeakMap=tq,q.isWeakSet=rq,q.join=sF,q.kebabCase=Wq,q.last=vn,q.lastIndexOf=oF,q.lowerCase=Kq,q.lowerFirst=Vq,q.lt=iq,q.lte=nq,q.max=zz,q.maxBy=Hz,q.mean=kz,q.meanBy=jz,q.min=Wz,q.minBy=Kz,q.stubArray=X1,q.stubFalse=eg,q.stubObject=Oz,q.stubString=Rz,q.stubTrue=Tz,q.multiply=Vz,q.nth=aF,q.noConflict=Az,q.noop=Z1,q.now=Nu,q.pad=Gq,q.padEnd=Yq,q.padStart=Jq,q.parseInt=Qq,q.random=qq,q.reduce=lU,q.reduceRight=hU,q.repeat=Zq,q.replace=Xq,q.result=Dq,q.round=Gz,q.runInContext=ie,q.sample=dU,q.size=vU,q.snakeCase=ez,q.some=mU,q.sortedIndex=pF,q.sortedIndexBy=gF,q.sortedIndexOf=vF,q.sortedLastIndex=mF,q.sortedLastIndexBy=bF,q.sortedLastIndexOf=wF,q.startCase=rz,q.startsWith=iz,q.subtract=Yz,q.sum=Jz,q.sumBy=Qz,q.template=nz,q.times=$z,q.toFinite=Ls,q.toInteger=Et,q.toLength=C6,q.toLower=sz,q.toNumber=mn,q.toSafeInteger=sq,q.toString=Vt,q.toUpper=oz,q.trim=az,q.trimEnd=cz,q.trimStart=fz,q.truncate=lz,q.unescape=hz,q.uniqueId=Lz,q.upperCase=uz,q.upperFirst=G1,q.each=p6,q.eachRight=g6,q.first=l6,Q1(q,function(){var o={};return ls(q,function(c,p){Yt.call(q.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),q.VERSION=i,hn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){q[o].placeholder=q}),hn(["drop","take"],function(o,c){Nt.prototype[o]=function(p){p=p===t?1:Dr(Et(p),0);var I=this.__filtered__&&!c?new Nt(this):this.clone();return I.__filtered__?I.__takeCount__=ti(p,I.__takeCount__):I.__views__.push({size:ti(p,A),type:o+(I.__dir__<0?"Right":"")}),I},Nt.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),hn(["filter","map","takeWhile"],function(o,c){var p=c+1,I=p==l||p==y;Nt.prototype[o]=function(T){var k=this.clone();return k.__iteratees__.push({iteratee:ot(T,3),type:p}),k.__filtered__=k.__filtered__||I,k}}),hn(["head","last"],function(o,c){var p="take"+(c?"Right":"");Nt.prototype[o]=function(){return this[p](1).value()[0]}}),hn(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");Nt.prototype[o]=function(){return this.__filtered__?new Nt(this):this[p](1)}}),Nt.prototype.compact=function(){return this.filter(Di)},Nt.prototype.find=function(o){return this.filter(o).head()},Nt.prototype.findLast=function(o){return this.reverse().find(o)},Nt.prototype.invokeMap=Mt(function(o,c){return typeof o=="function"?new Nt(this):this.map(function(p){return Kf(p,o,c)})}),Nt.prototype.reject=function(o){return this.filter(Bu(ot(o)))},Nt.prototype.slice=function(o,c){o=Et(o);var p=this;return p.__filtered__&&(o>0||c<0)?new Nt(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==t&&(c=Et(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},Nt.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Nt.prototype.toArray=function(){return this.take(A)},ls(Nt.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),I=/^(?:head|last)$/.test(c),T=q[I?"take"+(c=="last"?"Right":""):c],k=I||/^find/.test(c);T&&(q.prototype[c]=function(){var Z=this.__wrapped__,te=I?[1]:arguments,se=Z instanceof Nt,ue=te[0],de=se||wt(Z),ve=function(Rt){var Ft=T.apply(q,ho([Rt],te));return I&&Se?Ft[0]:Ft};de&&p&&typeof ue=="function"&&ue.length!=1&&(se=de=!1);var Se=this.__chain__,Je=!!this.__actions__.length,ct=k&&!Se,St=se&&!Je;if(!k&&de){Z=St?Z:new Nt(this);var ft=o.apply(Z,te);return ft.__actions__.push({func:Tu,args:[ve],thisArg:t}),new dn(ft,Se)}return ct&&St?o.apply(this,te):(ft=this.thru(ve),ct?I?ft.value()[0]:ft.value():ft)})}),hn(["pop","push","shift","sort","splice","unshift"],function(o){var c=su[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",I=/^(?:pop|shift)$/.test(o);q.prototype[o]=function(){var T=arguments;if(I&&!this.__chain__){var k=this.value();return c.apply(wt(k)?k:[],T)}return this[p](function(Z){return c.apply(wt(Z)?Z:[],T)})}}),ls(Nt.prototype,function(o,c){var p=q[c];if(p){var I=p.name+"";Yt.call(yc,I)||(yc[I]=[]),yc[I].push({name:c,func:p})}}),yc[Iu(t,H).name]=[{name:"wrapper",func:t}],Nt.prototype.clone=hL,Nt.prototype.reverse=uL,Nt.prototype.value=dL,q.prototype.at=HF,q.prototype.chain=kF,q.prototype.commit=jF,q.prototype.next=WF,q.prototype.plant=VF,q.prototype.reverse=GF,q.prototype.toJSON=q.prototype.valueOf=q.prototype.value=YF,q.prototype.first=q.prototype.head,Uf&&(q.prototype[Uf]=KF),q},mc=jN();_r?((_r.exports=mc)._=mc,er._=mc):Bt._=mc}).call(fr)})(P0,P0.exports);var D0={exports:{}};(function(r,e){var t=typeof self<"u"?self:fr,i=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(a){var f={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(l){return l&&DataView.prototype.isPrototypeOf(l)}if(f.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(l){return l&&u.indexOf(Object.prototype.toString.call(l))>-1};function w(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function P(l){return typeof l!="string"&&(l=String(l)),l}function M(l){var d={next:function(){var y=l.shift();return{done:y===void 0,value:y}}};return f.iterable&&(d[Symbol.iterator]=function(){return d}),d}function O(l){this.map={},l instanceof O?l.forEach(function(d,y){this.append(y,d)},this):Array.isArray(l)?l.forEach(function(d){this.append(d[0],d[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(d){this.append(d,l[d])},this)}O.prototype.append=function(l,d){l=w(l),d=P(d);var y=this.map[l];this.map[l]=y?y+", "+d:d},O.prototype.delete=function(l){delete this.map[w(l)]},O.prototype.get=function(l){return l=w(l),this.has(l)?this.map[l]:null},O.prototype.has=function(l){return this.map.hasOwnProperty(w(l))},O.prototype.set=function(l,d){this.map[w(l)]=P(d)},O.prototype.forEach=function(l,d){for(var y in this.map)this.map.hasOwnProperty(y)&&l.call(d,this.map[y],y,this)},O.prototype.keys=function(){var l=[];return this.forEach(function(d,y){l.push(y)}),M(l)},O.prototype.values=function(){var l=[];return this.forEach(function(d){l.push(d)}),M(l)},O.prototype.entries=function(){var l=[];return this.forEach(function(d,y){l.push([y,d])}),M(l)},f.iterable&&(O.prototype[Symbol.iterator]=O.prototype.entries);function $(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function W(l){return new Promise(function(d,y){l.onload=function(){d(l.result)},l.onerror=function(){y(l.error)}})}function H(l){var d=new FileReader,y=W(d);return d.readAsArrayBuffer(l),y}function F(l){var d=new FileReader,y=W(d);return d.readAsText(l),y}function Y(l){for(var d=new Uint8Array(l),y=new Array(d.length),C=0;C<d.length;C++)y[C]=String.fromCharCode(d[C]);return y.join("")}function B(l){if(l.slice)return l.slice(0);var d=new Uint8Array(l.byteLength);return d.set(new Uint8Array(l)),d.buffer}function z(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:f.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:f.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():f.arrayBuffer&&f.blob&&h(l)?(this._bodyArrayBuffer=B(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||g(l))?this._bodyArrayBuffer=B(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var l=$(this);if(l)return l;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?$(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(H)}),this.text=function(){var l=$(this);if(l)return l;if(this._bodyBlob)return F(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Y(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(ee)}),this.json=function(){return this.text().then(JSON.parse)},this}var j=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(l){var d=l.toUpperCase();return j.indexOf(d)>-1?d:l}function U(l,d){d=d||{};var y=d.body;if(l instanceof U){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,d.headers||(this.headers=new O(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!y&&l._bodyInit!=null&&(y=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=d.credentials||this.credentials||"same-origin",(d.headers||!this.headers)&&(this.headers=new O(d.headers)),this.method=_(d.method||this.method||"GET"),this.mode=d.mode||this.mode||null,this.signal=d.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&y)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(y)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ee(l){var d=new FormData;return l.trim().split("&").forEach(function(y){if(y){var C=y.split("="),D=C.shift().replace(/\+/g," "),S=C.join("=").replace(/\+/g," ");d.append(decodeURIComponent(D),decodeURIComponent(S))}}),d}function oe(l){var d=new O,y=l.replace(/\r?\n[\t ]+/g," ");return y.split(/\r?\n/).forEach(function(C){var D=C.split(":"),S=D.shift().trim();if(S){var v=D.join(":").trim();d.append(S,v)}}),d}z.call(U.prototype);function L(l,d){d||(d={}),this.type="default",this.status=d.status===void 0?200:d.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in d?d.statusText:"OK",this.headers=new O(d.headers),this.url=d.url||"",this._initBody(l)}z.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new O(this.headers),url:this.url})},L.error=function(){var l=new L(null,{status:0,statusText:""});return l.type="error",l};var b=[301,302,303,307,308];L.redirect=function(l,d){if(b.indexOf(d)===-1)throw new RangeError("Invalid status code");return new L(null,{status:d,headers:{location:l}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(d,y){this.message=d,this.name=y;var C=Error(d);this.stack=C.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function m(l,d){return new Promise(function(y,C){var D=new U(l,d);if(D.signal&&D.signal.aborted)return C(new a.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function v(){S.abort()}S.onload=function(){var A={status:S.status,statusText:S.statusText,headers:oe(S.getAllResponseHeaders()||"")};A.url="responseURL"in S?S.responseURL:A.headers.get("X-Request-URL");var x="response"in S?S.response:S.responseText;y(new L(x,A))},S.onerror=function(){C(new TypeError("Network request failed"))},S.ontimeout=function(){C(new TypeError("Network request failed"))},S.onabort=function(){C(new a.DOMException("Aborted","AbortError"))},S.open(D.method,D.url,!0),D.credentials==="include"?S.withCredentials=!0:D.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&f.blob&&(S.responseType="blob"),D.headers.forEach(function(A,x){S.setRequestHeader(x,A)}),D.signal&&(D.signal.addEventListener("abort",v),S.onreadystatechange=function(){S.readyState===4&&D.signal.removeEventListener("abort",v)}),S.send(typeof D._bodyInit>"u"?null:D._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=O,s.Request=U,s.Response=L),a.Headers=O,a.Request=U,a.Response=L,a.fetch=m,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})(D0,D0.exports);var K2=z6(D0.exports),KP=Object.defineProperty,VP=Object.defineProperties,GP=Object.getOwnPropertyDescriptors,V2=Object.getOwnPropertySymbols,YP=Object.prototype.hasOwnProperty,JP=Object.prototype.propertyIsEnumerable,G2=(r,e,t)=>e in r?KP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Y2=(r,e)=>{for(var t in e||(e={}))YP.call(e,t)&&G2(r,t,e[t]);if(V2)for(var t of V2(e))JP.call(e,t)&&G2(r,t,e[t]);return r},J2=(r,e)=>VP(r,GP(e));const QP={Accept:"application/json","Content-Type":"application/json"},ZP="POST",Q2={headers:QP,method:ZP},Z2=10;class In{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new qr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!Jb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}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){this.isAvailable||await this.register();try{const t=ws(e),i=await(await K2(this.url,J2(Y2({},Q2),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!Jb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return n(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ws({id:1,jsonrpc:"2.0",method:"test",params:[]});await K2(e,J2(Y2({},Q2),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}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 t=typeof e.data=="string"?Po(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=rh(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return jb(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Z2&&this.events.setMaxListeners(Z2)}}const X2="error",XP="wss://relay.walletconnect.org",eD="wc",tD="universal_provider",e3=`${eD}@2:${tD}:`,t3="https://rpc.walletconnect.org/v1/",Wa="generic",rD=`${t3}bundler`,on={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var iD=Object.defineProperty,nD=Object.defineProperties,sD=Object.getOwnPropertyDescriptors,r3=Object.getOwnPropertySymbols,oD=Object.prototype.hasOwnProperty,aD=Object.prototype.propertyIsEnumerable,i3=(r,e,t)=>e in r?iD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ah=(r,e)=>{for(var t in e||(e={}))oD.call(e,t)&&i3(r,t,e[t]);if(r3)for(var t of r3(e))aD.call(e,t)&&i3(r,t,e[t]);return r},cD=(r,e)=>nD(r,sD(e));function Fi(r,e,t){var i;const n=Ba(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${t3}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function zo(r){return r.includes(":")?r.split(":")[1]:r}function n3(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function fD(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const s=e.namespaces[n].accounts;i.push(...s)}),i}function O0(r={},e={}){const t=s3(r),i=s3(e);return P0.exports.merge(t,i)}function s3(r){var e,t,i,n;const s={};if(!ef(r))return s;for(const[a,f]of Object.entries(r)){const h=e0(a)?[a]:f.chains,u=f.methods||[],g=f.events||[],w=f.rpcMap||{},P=Xc(a);s[P]=cD(ah(ah({},s[P]),f),{chains:ql(h,(e=s[P])==null?void 0:e.chains),methods:ql(u,(t=s[P])==null?void 0:t.methods),events:ql(g,(i=s[P])==null?void 0:i.events),rpcMap:ah(ah({},w),(n=s[P])==null?void 0:n.rpcMap)})}return s}function lD(r){return r.includes(":")?r.split(":")[2]:r}function o3(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],s=i.events||[],a=i.accounts||[],f=e0(t)?[t]:i.chains?i.chains:n3(i.accounts);e[t]={chains:f,methods:n,events:s,accounts:a}}return e}function R0(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const a3={},zt=r=>a3[r],T0=(r,e)=>{a3[r]=e};class hD{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}}var uD=Object.defineProperty,dD=Object.defineProperties,pD=Object.getOwnPropertyDescriptors,c3=Object.getOwnPropertySymbols,gD=Object.prototype.hasOwnProperty,vD=Object.prototype.propertyIsEnumerable,f3=(r,e,t)=>e in r?uD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l3=(r,e)=>{for(var t in e||(e={}))gD.call(e,t)&&f3(r,t,e[t]);if(c3)for(var t of c3(e))vD.call(e,t)&&f3(r,t,e[t]);return r},h3=(r,e)=>dD(r,pD(e));class mD{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||Fi(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(zo(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const s=parseInt(n,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const s=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const a=this.client.session.get(e.topic),f=((n=a?.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[s])return f?.[s];const h=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:h3(l3({},a.sessionProperties||{}),{capabilities:h3(l3({},f||{}),{[s]:h})})})}catch(u){console.warn("Failed to update session with capabilities",u)}return h}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),s=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(s){const f=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from bundler",h,f)}}const a=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,a)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ys("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,t){return`${rD}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class bD{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}}class wD{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}}class yD{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||Fi(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new rn(new In(i,zt("disableProviderPing")))}}class _D{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=zo(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}}class xD{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}}class AD{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=zo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}}class ED{constructor(e){this.name="near",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||Fi(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace);return typeof i>"u"?void 0:new rn(new In(i,zt("disableProviderPing")))}}class SD{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||Fi(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace);return typeof i>"u"?void 0:new rn(new In(i))}}class ID{constructor(e){this.name=Wa,this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(on.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const s=Ba(n);i[`${s.namespace}:${s.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new rn(new In(i,zt("disableProviderPing")))}}var MD=Object.defineProperty,CD=Object.defineProperties,PD=Object.getOwnPropertyDescriptors,u3=Object.getOwnPropertySymbols,DD=Object.prototype.hasOwnProperty,OD=Object.prototype.propertyIsEnumerable,d3=(r,e,t)=>e in r?MD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ch=(r,e)=>{for(var t in e||(e={}))DD.call(e,t)&&d3(r,t,e[t]);if(u3)for(var t of u3(e))OD.call(e,t)&&d3(r,t,e[t]);return r},$0=(r,e)=>CD(r,PD(e));class N0{constructor(e){this.events=new qr.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qn(eh({level:e?.logger||X2})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new N0(e);return await t.initialize(),t}async request(e,t,i){const[n,s]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:ch({},e),chainId:`${n}:${s}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const s=new Date().getTime();this.request(e,i,n).then(a=>t(null,th(s,a))).catch(a=>t(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Gt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const s=await n();if(this.session=s.session,this.session){const a=o3(this.session.namespaces);this.namespaces=O0(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(s=>{this.session=s;const a=o3(s.namespaces);this.namespaces=O0(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==k2)throw s;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),s=this.getProvider(i);s.name===Wa?s.setDefaultChain(`${i}:${n}`,t):s.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Jn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await C0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||X2,relayUrl:this.providerOpts.relayUrl||XP,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Xc(t)))];T0("client",this.client),T0("events",this.events),T0("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=fD(t,this.session),n=n3(i),s=O0(this.namespaces,this.optionalNamespaces),a=$0(ch({},s[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new mD({namespace:a});break;case"algorand":this.rpcProviders[t]=new yD({namespace:a});break;case"solana":this.rpcProviders[t]=new bD({namespace:a});break;case"cosmos":this.rpcProviders[t]=new wD({namespace:a});break;case"polkadot":this.rpcProviders[t]=new hD({namespace:a});break;case"cip34":this.rpcProviders[t]=new _D({namespace:a});break;case"elrond":this.rpcProviders[t]=new xD({namespace:a});break;case"multiversx":this.rpcProviders[t]=new AD({namespace:a});break;case"near":this.rpcProviders[t]=new ED({namespace:a});break;case"tezos":this.rpcProviders[t]=new SD({namespace:a});break;default:this.rpcProviders[Wa]?this.rpcProviders[Wa].updateNamespace(a):this.rpcProviders[Wa]=new ID({namespace:a})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&Jn(n)&&this.events.emit("accountsChanged",n.map(lD))}else if(i.name==="chainChanged"){const n=t.chainId,s=t.event.data,a=Xc(n),f=R0(n)!==R0(s)?`${a}:${R0(s)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,s=(i=this.client)==null?void 0:i.session.get(e);this.session=$0(ch({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",$0(ch({},Gt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(on.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Wa]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(a=>Xc(a)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=Xc(Object.keys(this.namespaces)[0]),s=this.rpcProviders[n].getDefaultChain();return[n,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${e3}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${e3}/${e}`)}}const RD=N0,TD="wc",$D="ethereum_provider",ND=`${TD}@2:${$D}:`,LD="https://rpc.walletconnect.org/v1/",fh=["eth_sendTransaction","personal_sign"],p3=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],lh=["chainChanged","accountsChanged"],g3=["chainChanged","accountsChanged","message","disconnect","connect"];var BD=Object.defineProperty,FD=Object.defineProperties,UD=Object.getOwnPropertyDescriptors,v3=Object.getOwnPropertySymbols,qD=Object.prototype.hasOwnProperty,zD=Object.prototype.propertyIsEnumerable,m3=(r,e,t)=>e in r?BD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ka=(r,e)=>{for(var t in e||(e={}))qD.call(e,t)&&m3(r,t,e[t]);if(v3)for(var t of v3(e))zD.call(e,t)&&m3(r,t,e[t]);return r},L0=(r,e)=>FD(r,UD(e));function hh(r){return Number(r[0].split(":")[1])}function uh(r){return`0x${r.toString(16)}`}function HD(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:s,optionalEvents:a,rpcMap:f}=r;if(!Jn(e))throw new Error("Invalid chains");const h={chains:e,methods:i||fh,events:s||lh,rpcMap:Ka({},e.length?{[hh(e)]:f[hh(e)]}:{})},u=s?.filter(M=>!lh.includes(M)),g=i?.filter(M=>!fh.includes(M));if(!t&&!a&&!n&&!(u!=null&&u.length)&&!(g!=null&&g.length))return{required:e.length?h:void 0};const w=u?.length&&g?.length||!t,P={chains:[...new Set(w?h.chains.concat(t||[]):t)],methods:[...new Set(h.methods.concat(n!=null&&n.length?n:p3))],events:[...new Set(h.events.concat(a!=null&&a.length?a:g3))],rpcMap:f};return{required:e.length?h:void 0,optional:t.length?P:void 0}}class dh{constructor(){this.events=new qr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=ND,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new dh;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=HD(this.rpc);try{const n=await new Promise(async(a,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(L0(Ka({namespaces:Ka({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(u=>{a(u)}).catch(u=>{f(new Error(u.message))})});if(!n)return;const s=Bm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:uh(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const i=await new Promise(async(s,a)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(L0(Ka({},e),{chains:this.rpc.chains}),t).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})}),n=i.session;if(n){const s=Bm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:uh(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",uh(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",L0(Ka({},Gt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}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 t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",uh(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e?.chains)!=null?t:[],s=(i=e?.optionalChains)!=null?i:[],a=n.concat(s);if(!a.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?e?.methods||fh:[],h=n.length?e?.events||lh:[],u=e?.optionalMethods||[],g=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(a,e.projectId),P=e?.qrModalOptions||void 0;return{chains:n?.map(M=>this.formatChainId(M)),optionalChains:s.map(M=>this.formatChainId(M)),methods:f,events:h,optionalMethods:u,optionalEvents:g,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:P,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?hh(this.rpc.chains):hh(this.rpc.optionalChains),this.signer=await RD.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await Promise.resolve().then(function(){return hO});t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Ka({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&Jn(t)&&(this.rpc.chains=t.map(s=>this.formatChainId(s)),t.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)})),i&&Jn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(s=>this.formatChainId(s)),i.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${LD}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const kD=dh,jD=Symbol(),b3=Object.getPrototypeOf,B0=new WeakMap,WD=r=>r&&(B0.has(r)?B0.get(r):b3(r)===Object.prototype||b3(r)===Array.prototype),KD=r=>WD(r)&&r[jD]||null,w3=(r,e=!0)=>{B0.set(r,e)},F0=r=>typeof r=="object"&&r!==null,Js=new WeakMap,ph=new WeakSet,VD=(r=Object.is,e=(u,g)=>new Proxy(u,g),t=u=>F0(u)&&!ph.has(u)&&(Array.isArray(u)||!(Symbol.iterator in u))&&!(u instanceof WeakMap)&&!(u instanceof WeakSet)&&!(u instanceof Error)&&!(u instanceof Number)&&!(u instanceof Date)&&!(u instanceof String)&&!(u instanceof RegExp)&&!(u instanceof ArrayBuffer),i=u=>{switch(u.status){case"fulfilled":return u.value;case"rejected":throw u.reason;default:throw u}},n=new WeakMap,s=(u,g,w=i)=>{const P=n.get(u);if(P?.[0]===g)return P[1];const M=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u));return w3(M,!0),n.set(u,[g,M]),Reflect.ownKeys(u).forEach(O=>{if(Object.getOwnPropertyDescriptor(M,O))return;const $=Reflect.get(u,O),W={value:$,enumerable:!0,configurable:!0};if(ph.has($))w3($,!1);else if($ instanceof Promise)delete W.value,W.get=()=>w($);else if(Js.has($)){const[H,F]=Js.get($);W.value=s(H,F(),w)}Object.defineProperty(M,O,W)}),Object.preventExtensions(M)},a=new WeakMap,f=[1,1],h=u=>{if(!F0(u))throw new Error("object required");const g=a.get(u);if(g)return g;let w=f[0];const P=new Set,M=(ee,oe=++f[0])=>{w!==oe&&(w=oe,P.forEach(L=>L(ee,oe)))};let O=f[1];const $=(ee=++f[1])=>(O!==ee&&!P.size&&(O=ee,H.forEach(([oe])=>{const L=oe[1](ee);L>w&&(w=L)})),w),W=ee=>(oe,L)=>{const b=[...oe];b[1]=[ee,...b[1]],M(b,L)},H=new Map,F=(ee,oe)=>{if(H.has(ee))throw new Error("prop listener already exists");if(P.size){const L=oe[3](W(ee));H.set(ee,[oe,L])}else H.set(ee,[oe])},Y=ee=>{var oe;const L=H.get(ee);L&&(H.delete(ee),(oe=L[1])==null||oe.call(L))},B=ee=>(P.add(ee),P.size===1&&H.forEach(([L,b],m)=>{if(b)throw new Error("remove already exists");const l=L[3](W(m));H.set(m,[L,l])}),()=>{P.delete(ee),P.size===0&&H.forEach(([L,b],m)=>{b&&(b(),H.set(m,[L]))})}),z=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u)),_=e(z,{deleteProperty(ee,oe){const L=Reflect.get(ee,oe);Y(oe);const b=Reflect.deleteProperty(ee,oe);return b&&M(["delete",[oe],L]),b},set(ee,oe,L,b){const m=Reflect.has(ee,oe),l=Reflect.get(ee,oe,b);if(m&&(r(l,L)||a.has(L)&&r(l,a.get(L))))return!0;Y(oe),F0(L)&&(L=KD(L)||L);let d=L;if(L instanceof Promise)L.then(y=>{L.status="fulfilled",L.value=y,M(["resolve",[oe],y])}).catch(y=>{L.status="rejected",L.reason=y,M(["reject",[oe],y])});else{!Js.has(L)&&t(L)&&(d=h(L));const y=!ph.has(d)&&Js.get(d);y&&F(oe,y)}return Reflect.set(ee,oe,d,b),M(["set",[oe],L,l]),!0}});a.set(u,_);const U=[z,$,s,B];return Js.set(_,U),Reflect.ownKeys(u).forEach(ee=>{const oe=Object.getOwnPropertyDescriptor(u,ee);"value"in oe&&(_[ee]=u[ee],delete oe.value,delete oe.writable),Object.defineProperty(z,ee,oe)}),_})=>[h,Js,ph,r,e,t,i,n,s,a,f],[GD]=VD();function Qs(r={}){return GD(r)}function Ho(r,e,t){const i=Js.get(r);i||console.warn("Please use proxy object");let n;const s=[],a=i[3];let f=!1;const u=a(g=>{if(s.push(g),t){e(s.splice(0));return}n||(n=Promise.resolve().then(()=>{n=void 0,f&&e(s.splice(0))}))});return f=!0,()=>{f=!1,u()}}function YD(r,e){const t=Js.get(r);t||console.warn("Please use proxy object");const[i,n,s]=t;return s(i,n(),e)}const Br=Qs({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),lr={state:Br,subscribe(r){return Ho(Br,()=>r(Br))},push(r,e){r!==Br.view&&(Br.view=r,e&&(Br.data=e),Br.history.push(r))},reset(r){Br.view=r,Br.history=[r]},replace(r){Br.history.length>1&&(Br.history[Br.history.length-1]=r,Br.view=r)},goBack(){if(Br.history.length>1){Br.history.pop();const[r]=Br.history.slice(-1);Br.view=r}},setData(r){Br.data=r}},je={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return je.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const r=navigator.userAgent.toLowerCase();return je.isMobile()&&(r.includes("iphone")||r.includes("ipad"))},isHttpUrl(r){return r.startsWith("http://")||r.startsWith("https://")},isArray(r){return Array.isArray(r)&&r.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(r,e,t){if(je.isHttpUrl(r))return this.formatUniversalUrl(r,e,t);let i=r;i.includes("://")||(i=r.replaceAll("/","").replaceAll(":",""),i=`${i}://`),i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},formatUniversalUrl(r,e,t){if(!je.isHttpUrl(r))return this.formatNativeUrl(r,e,t);let i=r;if(i.startsWith("https://t.me")){const s=Buffer.from(e).toString("base64").replace(/[=]/g,"");i.endsWith("/")&&(i=i.slice(0,-1)),this.setWalletConnectDeepLink(i,t);const a=new URL(i);return a.searchParams.set("startapp",s),a.toString()}i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},async wait(r){return new Promise(e=>{setTimeout(e,r)})},openHref(r,e){const t=this.isTelegram()?"_blank":e;window.open(r,t,"noreferrer noopener")},setWalletConnectDeepLink(r,e){try{localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:r,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(r){try{const[e]=r.split("?");localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(je.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(je.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var r;const e=(r=lr.state.data)==null?void 0:r.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},JD=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Jr=Qs({enabled:JD,userSessionId:"",events:[],connectedWalletId:void 0}),y3={state:Jr,subscribe(r){return Ho(Jr.events,()=>r(YD(Jr.events[Jr.events.length-1])))},initialize(){Jr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Jr.userSessionId=crypto.randomUUID())},setConnectedWalletId(r){Jr.connectedWalletId=r},click(r){if(Jr.enabled){const e={type:"CLICK",name:r.name,userSessionId:Jr.userSessionId,timestamp:Date.now(),data:r};Jr.events.push(e)}},track(r){if(Jr.enabled){const e={type:"TRACK",name:r.name,userSessionId:Jr.userSessionId,timestamp:Date.now(),data:r};Jr.events.push(e)}},view(r){if(Jr.enabled){const e={type:"VIEW",name:r.name,userSessionId:Jr.userSessionId,timestamp:Date.now(),data:r};Jr.events.push(e)}}},ns=Qs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),yr={state:ns,subscribe(r){return Ho(ns,()=>r(ns))},setChains(r){ns.chains=r},setWalletConnectUri(r){ns.walletConnectUri=r},setIsCustomDesktop(r){ns.isCustomDesktop=r},setIsCustomMobile(r){ns.isCustomMobile=r},setIsDataLoaded(r){ns.isDataLoaded=r},setIsUiLoaded(r){ns.isUiLoaded=r},setIsAuth(r){ns.isAuth=r}},gh=Qs({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),Ui={state:gh,subscribe(r){return Ho(gh,()=>r(gh))},setConfig(r){var e,t;y3.initialize(),yr.setChains(r.chains),yr.setIsAuth(!!r.enableAuthMode),yr.setIsCustomMobile(!!((e=r.mobileWallets)!=null&&e.length)),yr.setIsCustomDesktop(!!((t=r.desktopWallets)!=null&&t.length)),je.setModalVersionInStorage(),Object.assign(gh,r)}};var QD=Object.defineProperty,_3=Object.getOwnPropertySymbols,ZD=Object.prototype.hasOwnProperty,XD=Object.prototype.propertyIsEnumerable,x3=(r,e,t)=>e in r?QD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eO=(r,e)=>{for(var t in e||(e={}))ZD.call(e,t)&&x3(r,t,e[t]);if(_3)for(var t of _3(e))XD.call(e,t)&&x3(r,t,e[t]);return r};const U0="https://explorer-api.walletconnect.com",q0="wcm",z0="js-2.7.0";async function vh(r,e){const t=eO({sdkType:q0,sdkVersion:z0},e),i=new URL(r,U0);return i.searchParams.append("projectId",Ui.state.projectId),Object.entries(t).forEach(([s,a])=>{a&&i.searchParams.append(s,String(a))}),(await fetch(i)).json()}const ko={async getDesktopListings(r){return vh("/w3m/v1/getDesktopListings",r)},async getMobileListings(r){return vh("/w3m/v1/getMobileListings",r)},async getInjectedListings(r){return vh("/w3m/v1/getInjectedListings",r)},async getAllListings(r){return vh("/w3m/v1/getAllListings",r)},getWalletImageUrl(r){return`${U0}/w3m/v1/getWalletImage/${r}?projectId=${Ui.state.projectId}&sdkType=${q0}&sdkVersion=${z0}`},getAssetImageUrl(r){return`${U0}/w3m/v1/getAssetImage/${r}?projectId=${Ui.state.projectId}&sdkType=${q0}&sdkVersion=${z0}`}};var tO=Object.defineProperty,A3=Object.getOwnPropertySymbols,rO=Object.prototype.hasOwnProperty,iO=Object.prototype.propertyIsEnumerable,E3=(r,e,t)=>e in r?tO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,nO=(r,e)=>{for(var t in e||(e={}))rO.call(e,t)&&E3(r,t,e[t]);if(A3)for(var t of A3(e))iO.call(e,t)&&E3(r,t,e[t]);return r};const S3=je.isMobile(),ss=Qs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),_i={state:ss,async getRecomendedWallets(){const{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:e}=Ui.state;if(r==="NONE"||e==="ALL"&&!r)return ss.recomendedWallets;if(je.isArray(r)){const i={recommendedIds:r.join(",")},{listings:n}=await ko.getAllListings(i),s=Object.values(n);s.sort((a,f)=>{const h=r.indexOf(a.id),u=r.indexOf(f.id);return h-u}),ss.recomendedWallets=s}else{const{chains:t,isAuth:i}=yr.state,n=t?.join(","),s=je.isArray(e),a={page:1,sdks:i?"auth_v1":void 0,entries:je.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:s?e.join(","):void 0},{listings:f}=S3?await ko.getMobileListings(a):await ko.getDesktopListings(a);ss.recomendedWallets=Object.values(f)}return ss.recomendedWallets},async getWallets(r){const e=nO({},r),{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:i}=Ui.state,{recomendedWallets:n}=ss;if(i==="ALL")return ss.wallets;n.length?e.excludedIds=n.map(w=>w.id).join(","):je.isArray(t)&&(e.excludedIds=t.join(",")),je.isArray(i)&&(e.excludedIds=[e.excludedIds,i].filter(Boolean).join(",")),yr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:a}=r,{listings:f,total:h}=S3?await ko.getMobileListings(e):await ko.getDesktopListings(e),u=Object.values(f),g=a?"search":"wallets";return ss[g]={listings:[...ss[g].listings,...u],total:h,page:s??1},{listings:u,total:h}},getWalletImageUrl(r){return ko.getWalletImageUrl(r)},getAssetImageUrl(r){return ko.getAssetImageUrl(r)},resetSearch(){ss.search={listings:[],total:0,page:1}}},Va=Qs({open:!1}),jo={state:Va,subscribe(r){return Ho(Va,()=>r(Va))},async open(r){return new Promise(e=>{const{isUiLoaded:t,isDataLoaded:i}=yr.state;if(je.removeWalletConnectDeepLink(),yr.setWalletConnectUri(r?.uri),yr.setChains(r?.chains),lr.reset("ConnectWallet"),t&&i)Va.open=!0,e();else{const n=setInterval(()=>{const s=yr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(n),Va.open=!0,e())},200)}})},close(){Va.open=!1}};var sO=Object.defineProperty,I3=Object.getOwnPropertySymbols,oO=Object.prototype.hasOwnProperty,aO=Object.prototype.propertyIsEnumerable,M3=(r,e,t)=>e in r?sO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,cO=(r,e)=>{for(var t in e||(e={}))oO.call(e,t)&&M3(r,t,e[t]);if(I3)for(var t of I3(e))aO.call(e,t)&&M3(r,t,e[t]);return r};function fO(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const gf=Qs({themeMode:fO()?"dark":"light"}),Zs={state:gf,subscribe(r){return Ho(gf,()=>r(gf))},setThemeConfig(r){const{themeMode:e,themeVariables:t}=r;e&&(gf.themeMode=e),t&&(gf.themeVariables=cO({},t))}},Wo=Qs({open:!1,message:"",variant:"success"}),Xs={state:Wo,subscribe(r){return Ho(Wo,()=>r(Wo))},openToast(r,e){Wo.open=!0,Wo.message=r,Wo.variant=e},closeToast(){Wo.open=!1}};class lO{constructor(e){this.openModal=jo.open,this.closeModal=jo.close,this.subscribeModal=jo.subscribe,this.setTheme=Zs.setThemeConfig,Zs.setThemeConfig(e),Ui.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return yN});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),yr.setIsUiLoaded(!0)}}}var hO=Object.freeze({__proto__:null,WalletConnectModal:lO});/**
70
70
  * @license
71
71
  * Copyright 2019 Google LLC
72
72
  * SPDX-License-Identifier: BSD-3-Clause
73
- */const mh=window,k0=mh.ShadowRoot&&(mh.ShadyCSS===void 0||mh.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,H0=Symbol(),C3=new WeakMap;class P3{constructor(e,t,i){if(this._$cssResult$=!0,i!==H0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(k0&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=C3.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&C3.set(t,e))}return e}toString(){return this.cssText}}const hO=r=>new P3(typeof r=="string"?r:r+"",void 0,H0),Ht=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((i,n,s)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[s+1],r[0]);return new P3(t,r,H0)},uO=(r,e)=>{k0?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{const i=document.createElement("style"),n=mh.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},D3=k0?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return hO(t)})(r):r;/**
73
+ */const mh=window,H0=mh.ShadowRoot&&(mh.ShadyCSS===void 0||mh.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,k0=Symbol(),C3=new WeakMap;class P3{constructor(e,t,i){if(this._$cssResult$=!0,i!==k0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(H0&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=C3.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&C3.set(t,e))}return e}toString(){return this.cssText}}const uO=r=>new P3(typeof r=="string"?r:r+"",void 0,k0),jt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((i,n,s)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[s+1],r[0]);return new P3(t,r,k0)},dO=(r,e)=>{H0?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{const i=document.createElement("style"),n=mh.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},D3=H0?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return uO(t)})(r):r;/**
74
74
  * @license
75
75
  * Copyright 2017 Google LLC
76
76
  * SPDX-License-Identifier: BSD-3-Clause
77
- */var j0;const bh=window,O3=bh.trustedTypes,dO=O3?O3.emptyScript:"",R3=bh.reactiveElementPolyfillSupport,W0={toAttribute(r,e){switch(e){case Boolean:r=r?dO:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},T3=(r,e)=>e!==r&&(e==e||r==r),K0={attribute:!0,type:String,converter:W0,reflect:!1,hasChanged:T3},V0="finalized";class Ga extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,i)=>{const n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=K0){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){const s=this[e];this[t]=n,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||K0}static finalize(){if(this.hasOwnProperty(V0))return!1;this[V0]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(D3(n))}else e!==void 0&&t.push(D3(e));return t}static _$Ep(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return uO(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=K0){var n;const s=this.constructor._$Ep(e,i);if(s!==void 0&&i.reflect===!0){const a=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:W0).toAttribute(t,i.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,t){var i;const n=this.constructor,s=n._$Ev.get(e);if(s!==void 0&&this._$El!==s){const a=n.getPropertyOptions(s),f=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?a.converter:W0;this._$El=s,this[s]=f.fromAttribute(t,a.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||T3)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,s)=>this[s]=n),this._$Ei=void 0);let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var s;return(s=n.hostUpdate)===null||s===void 0?void 0:s.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}Ga[V0]=!0,Ga.elementProperties=new Map,Ga.elementStyles=[],Ga.shadowRootOptions={mode:"open"},R3?.({ReactiveElement:Ga}),((j0=bh.reactiveElementVersions)!==null&&j0!==void 0?j0:bh.reactiveElementVersions=[]).push("1.6.3");/**
77
+ */var j0;const bh=window,O3=bh.trustedTypes,pO=O3?O3.emptyScript:"",R3=bh.reactiveElementPolyfillSupport,W0={toAttribute(r,e){switch(e){case Boolean:r=r?pO:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},T3=(r,e)=>e!==r&&(e==e||r==r),K0={attribute:!0,type:String,converter:W0,reflect:!1,hasChanged:T3},V0="finalized";class Ga extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,i)=>{const n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=K0){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){const s=this[e];this[t]=n,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||K0}static finalize(){if(this.hasOwnProperty(V0))return!1;this[V0]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(D3(n))}else e!==void 0&&t.push(D3(e));return t}static _$Ep(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return dO(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=K0){var n;const s=this.constructor._$Ep(e,i);if(s!==void 0&&i.reflect===!0){const a=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:W0).toAttribute(t,i.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,t){var i;const n=this.constructor,s=n._$Ev.get(e);if(s!==void 0&&this._$El!==s){const a=n.getPropertyOptions(s),f=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?a.converter:W0;this._$El=s,this[s]=f.fromAttribute(t,a.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||T3)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,s)=>this[s]=n),this._$Ei=void 0);let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var s;return(s=n.hostUpdate)===null||s===void 0?void 0:s.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}Ga[V0]=!0,Ga.elementProperties=new Map,Ga.elementStyles=[],Ga.shadowRootOptions={mode:"open"},R3?.({ReactiveElement:Ga}),((j0=bh.reactiveElementVersions)!==null&&j0!==void 0?j0:bh.reactiveElementVersions=[]).push("1.6.3");/**
78
78
  * @license
79
79
  * Copyright 2017 Google LLC
80
80
  * SPDX-License-Identifier: BSD-3-Clause
81
- */var G0;const wh=window,Ya=wh.trustedTypes,$3=Ya?Ya.createPolicy("lit-html",{createHTML:r=>r}):void 0,Y0="$lit$",Xs=`lit$${(Math.random()+"").slice(9)}$`,N3="?"+Xs,pO=`<${N3}>`,Ko=document,vf=()=>Ko.createComment(""),mf=r=>r===null||typeof r!="object"&&typeof r!="function",L3=Array.isArray,gO=r=>L3(r)||typeof r?.[Symbol.iterator]=="function",J0=`[
81
+ */var G0;const wh=window,Ya=wh.trustedTypes,$3=Ya?Ya.createPolicy("lit-html",{createHTML:r=>r}):void 0,Y0="$lit$",eo=`lit$${(Math.random()+"").slice(9)}$`,N3="?"+eo,gO=`<${N3}>`,Ko=document,vf=()=>Ko.createComment(""),mf=r=>r===null||typeof r!="object"&&typeof r!="function",L3=Array.isArray,vO=r=>L3(r)||typeof r?.[Symbol.iterator]=="function",J0=`[
82
82
  \f\r]`,bf=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B3=/-->/g,F3=/>/g,Vo=RegExp(`>|${J0}(?:([^\\s"'>=/]+)(${J0}*=${J0}*(?:[^
83
- \f\r"'\`<>=]|("|')|))|$)`,"g"),U3=/'/g,q3=/"/g,z3=/^(?:script|style|textarea|title)$/i,k3=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ee=k3(1),gr=k3(2),Go=Symbol.for("lit-noChange"),Mr=Symbol.for("lit-nothing"),H3=new WeakMap,Yo=Ko.createTreeWalker(Ko,129,null,!1);function j3(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $3!==void 0?$3.createHTML(e):e}const vO=(r,e)=>{const t=r.length-1,i=[];let n,s=e===2?"<svg>":"",a=bf;for(let f=0;f<t;f++){const h=r[f];let u,g,w=-1,P=0;for(;P<h.length&&(a.lastIndex=P,g=a.exec(h),g!==null);)P=a.lastIndex,a===bf?g[1]==="!--"?a=B3:g[1]!==void 0?a=F3:g[2]!==void 0?(z3.test(g[2])&&(n=RegExp("</"+g[2],"g")),a=Vo):g[3]!==void 0&&(a=Vo):a===Vo?g[0]===">"?(a=n??bf,w=-1):g[1]===void 0?w=-2:(w=a.lastIndex-g[2].length,u=g[1],a=g[3]===void 0?Vo:g[3]==='"'?q3:U3):a===q3||a===U3?a=Vo:a===B3||a===F3?a=bf:(a=Vo,n=void 0);const M=a===Vo&&r[f+1].startsWith("/>")?" ":"";s+=a===bf?h+pO:w>=0?(i.push(u),h.slice(0,w)+Y0+h.slice(w)+Xs+M):h+Xs+(w===-2?(i.push(void 0),f):M)}return[j3(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),i]};class wf{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let s=0,a=0;const f=e.length-1,h=this.parts,[u,g]=vO(e,t);if(this.el=wf.createElement(u,i),Yo.currentNode=this.el.content,t===2){const w=this.el.content,P=w.firstChild;P.remove(),w.append(...P.childNodes)}for(;(n=Yo.nextNode())!==null&&h.length<f;){if(n.nodeType===1){if(n.hasAttributes()){const w=[];for(const P of n.getAttributeNames())if(P.endsWith(Y0)||P.startsWith(Xs)){const M=g[a++];if(w.push(P),M!==void 0){const O=n.getAttribute(M.toLowerCase()+Y0).split(Xs),$=/([.?@])?(.*)/.exec(M);h.push({type:1,index:s,name:$[2],strings:O,ctor:$[1]==="."?bO:$[1]==="?"?yO:$[1]==="@"?_O:yh})}else h.push({type:6,index:s})}for(const P of w)n.removeAttribute(P)}if(z3.test(n.tagName)){const w=n.textContent.split(Xs),P=w.length-1;if(P>0){n.textContent=Ya?Ya.emptyScript:"";for(let M=0;M<P;M++)n.append(w[M],vf()),Yo.nextNode(),h.push({type:2,index:++s});n.append(w[P],vf())}}}else if(n.nodeType===8)if(n.data===N3)h.push({type:2,index:s});else{let w=-1;for(;(w=n.data.indexOf(Xs,w+1))!==-1;)h.push({type:7,index:s}),w+=Xs.length-1}s++}}static createElement(e,t){const i=Ko.createElement("template");return i.innerHTML=e,i}}function Ja(r,e,t=r,i){var n,s,a,f;if(e===Go)return e;let h=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl;const u=mf(e)?void 0:e._$litDirective$;return h?.constructor!==u&&((s=h?._$AO)===null||s===void 0||s.call(h,!1),u===void 0?h=void 0:(h=new u(r),h._$AT(r,t,i)),i!==void 0?((a=(f=t)._$Co)!==null&&a!==void 0?a:f._$Co=[])[i]=h:t._$Cl=h),h!==void 0&&(e=Ja(r,h._$AS(r,e.values),h,i)),e}class mO{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:i},parts:n}=this._$AD,s=((t=e?.creationScope)!==null&&t!==void 0?t:Ko).importNode(i,!0);Yo.currentNode=s;let a=Yo.nextNode(),f=0,h=0,u=n[0];for(;u!==void 0;){if(f===u.index){let g;u.type===2?g=new yf(a,a.nextSibling,this,e):u.type===1?g=new u.ctor(a,u.name,u.strings,this,e):u.type===6&&(g=new xO(a,this,e)),this._$AV.push(g),u=n[++h]}f!==u?.index&&(a=Yo.nextNode(),f++)}return Yo.currentNode=Ko,s}v(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class yf{constructor(e,t,i,n){var s;this.type=2,this._$AH=Mr,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cp=(s=n?.isConnected)===null||s===void 0||s}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ja(this,e,t),mf(e)?e===Mr||e==null||e===""?(this._$AH!==Mr&&this._$AR(),this._$AH=Mr):e!==this._$AH&&e!==Go&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):gO(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Mr&&mf(this._$AH)?this._$AA.nextSibling.data=e:this.$(Ko.createTextNode(e)),this._$AH=e}g(e){var t;const{values:i,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=wf.createElement(j3(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===s)this._$AH.v(i);else{const a=new mO(s,this),f=a.u(this.options);a.v(i),this.$(f),this._$AH=a}}_$AC(e){let t=H3.get(e.strings);return t===void 0&&H3.set(e.strings,t=new wf(e)),t}T(e){L3(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const s of e)n===t.length?t.push(i=new yf(this.k(vf()),this.k(vf()),this,this.options)):i=t[n],i._$AI(s),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}}class yh{constructor(e,t,i,n,s){this.type=1,this._$AH=Mr,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Mr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){const s=this.strings;let a=!1;if(s===void 0)e=Ja(this,e,t,0),a=!mf(e)||e!==this._$AH&&e!==Go,a&&(this._$AH=e);else{const f=e;let h,u;for(e=s[0],h=0;h<s.length-1;h++)u=Ja(this,f[i+h],t,h),u===Go&&(u=this._$AH[h]),a||(a=!mf(u)||u!==this._$AH[h]),u===Mr?e=Mr:e!==Mr&&(e+=(u??"")+s[h+1]),this._$AH[h]=u}a&&!n&&this.j(e)}j(e){e===Mr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class bO extends yh{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Mr?void 0:e}}const wO=Ya?Ya.emptyScript:"";class yO extends yh{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Mr?this.element.setAttribute(this.name,wO):this.element.removeAttribute(this.name)}}class _O extends yh{constructor(e,t,i,n,s){super(e,t,i,n,s),this.type=5}_$AI(e,t=this){var i;if((e=(i=Ja(this,e,t,0))!==null&&i!==void 0?i:Mr)===Go)return;const n=this._$AH,s=e===Mr&&n!==Mr||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,a=e!==Mr&&(n===Mr||s);s&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}}class xO{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ja(this,e)}}const W3=wh.litHtmlPolyfillSupport;W3?.(wf,yf),((G0=wh.litHtmlVersions)!==null&&G0!==void 0?G0:wh.litHtmlVersions=[]).push("2.8.0");const AO=(r,e,t)=>{var i,n;const s=(i=t?.renderBefore)!==null&&i!==void 0?i:e;let a=s._$litPart$;if(a===void 0){const f=(n=t?.renderBefore)!==null&&n!==void 0?n:null;s._$litPart$=a=new yf(e.insertBefore(vf(),f),f,void 0,t??{})}return a._$AI(r),a};/**
83
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),U3=/'/g,q3=/"/g,z3=/^(?:script|style|textarea|title)$/i,H3=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ee=H3(1),gr=H3(2),Go=Symbol.for("lit-noChange"),Mr=Symbol.for("lit-nothing"),k3=new WeakMap,Yo=Ko.createTreeWalker(Ko,129,null,!1);function j3(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $3!==void 0?$3.createHTML(e):e}const mO=(r,e)=>{const t=r.length-1,i=[];let n,s=e===2?"<svg>":"",a=bf;for(let f=0;f<t;f++){const h=r[f];let u,g,w=-1,P=0;for(;P<h.length&&(a.lastIndex=P,g=a.exec(h),g!==null);)P=a.lastIndex,a===bf?g[1]==="!--"?a=B3:g[1]!==void 0?a=F3:g[2]!==void 0?(z3.test(g[2])&&(n=RegExp("</"+g[2],"g")),a=Vo):g[3]!==void 0&&(a=Vo):a===Vo?g[0]===">"?(a=n??bf,w=-1):g[1]===void 0?w=-2:(w=a.lastIndex-g[2].length,u=g[1],a=g[3]===void 0?Vo:g[3]==='"'?q3:U3):a===q3||a===U3?a=Vo:a===B3||a===F3?a=bf:(a=Vo,n=void 0);const M=a===Vo&&r[f+1].startsWith("/>")?" ":"";s+=a===bf?h+gO:w>=0?(i.push(u),h.slice(0,w)+Y0+h.slice(w)+eo+M):h+eo+(w===-2?(i.push(void 0),f):M)}return[j3(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),i]};class wf{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let s=0,a=0;const f=e.length-1,h=this.parts,[u,g]=mO(e,t);if(this.el=wf.createElement(u,i),Yo.currentNode=this.el.content,t===2){const w=this.el.content,P=w.firstChild;P.remove(),w.append(...P.childNodes)}for(;(n=Yo.nextNode())!==null&&h.length<f;){if(n.nodeType===1){if(n.hasAttributes()){const w=[];for(const P of n.getAttributeNames())if(P.endsWith(Y0)||P.startsWith(eo)){const M=g[a++];if(w.push(P),M!==void 0){const O=n.getAttribute(M.toLowerCase()+Y0).split(eo),$=/([.?@])?(.*)/.exec(M);h.push({type:1,index:s,name:$[2],strings:O,ctor:$[1]==="."?wO:$[1]==="?"?_O:$[1]==="@"?xO:yh})}else h.push({type:6,index:s})}for(const P of w)n.removeAttribute(P)}if(z3.test(n.tagName)){const w=n.textContent.split(eo),P=w.length-1;if(P>0){n.textContent=Ya?Ya.emptyScript:"";for(let M=0;M<P;M++)n.append(w[M],vf()),Yo.nextNode(),h.push({type:2,index:++s});n.append(w[P],vf())}}}else if(n.nodeType===8)if(n.data===N3)h.push({type:2,index:s});else{let w=-1;for(;(w=n.data.indexOf(eo,w+1))!==-1;)h.push({type:7,index:s}),w+=eo.length-1}s++}}static createElement(e,t){const i=Ko.createElement("template");return i.innerHTML=e,i}}function Ja(r,e,t=r,i){var n,s,a,f;if(e===Go)return e;let h=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl;const u=mf(e)?void 0:e._$litDirective$;return h?.constructor!==u&&((s=h?._$AO)===null||s===void 0||s.call(h,!1),u===void 0?h=void 0:(h=new u(r),h._$AT(r,t,i)),i!==void 0?((a=(f=t)._$Co)!==null&&a!==void 0?a:f._$Co=[])[i]=h:t._$Cl=h),h!==void 0&&(e=Ja(r,h._$AS(r,e.values),h,i)),e}class bO{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:i},parts:n}=this._$AD,s=((t=e?.creationScope)!==null&&t!==void 0?t:Ko).importNode(i,!0);Yo.currentNode=s;let a=Yo.nextNode(),f=0,h=0,u=n[0];for(;u!==void 0;){if(f===u.index){let g;u.type===2?g=new yf(a,a.nextSibling,this,e):u.type===1?g=new u.ctor(a,u.name,u.strings,this,e):u.type===6&&(g=new AO(a,this,e)),this._$AV.push(g),u=n[++h]}f!==u?.index&&(a=Yo.nextNode(),f++)}return Yo.currentNode=Ko,s}v(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class yf{constructor(e,t,i,n){var s;this.type=2,this._$AH=Mr,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cp=(s=n?.isConnected)===null||s===void 0||s}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ja(this,e,t),mf(e)?e===Mr||e==null||e===""?(this._$AH!==Mr&&this._$AR(),this._$AH=Mr):e!==this._$AH&&e!==Go&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):vO(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Mr&&mf(this._$AH)?this._$AA.nextSibling.data=e:this.$(Ko.createTextNode(e)),this._$AH=e}g(e){var t;const{values:i,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=wf.createElement(j3(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===s)this._$AH.v(i);else{const a=new bO(s,this),f=a.u(this.options);a.v(i),this.$(f),this._$AH=a}}_$AC(e){let t=k3.get(e.strings);return t===void 0&&k3.set(e.strings,t=new wf(e)),t}T(e){L3(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const s of e)n===t.length?t.push(i=new yf(this.k(vf()),this.k(vf()),this,this.options)):i=t[n],i._$AI(s),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}}class yh{constructor(e,t,i,n,s){this.type=1,this._$AH=Mr,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Mr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){const s=this.strings;let a=!1;if(s===void 0)e=Ja(this,e,t,0),a=!mf(e)||e!==this._$AH&&e!==Go,a&&(this._$AH=e);else{const f=e;let h,u;for(e=s[0],h=0;h<s.length-1;h++)u=Ja(this,f[i+h],t,h),u===Go&&(u=this._$AH[h]),a||(a=!mf(u)||u!==this._$AH[h]),u===Mr?e=Mr:e!==Mr&&(e+=(u??"")+s[h+1]),this._$AH[h]=u}a&&!n&&this.j(e)}j(e){e===Mr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class wO extends yh{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Mr?void 0:e}}const yO=Ya?Ya.emptyScript:"";class _O extends yh{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Mr?this.element.setAttribute(this.name,yO):this.element.removeAttribute(this.name)}}class xO extends yh{constructor(e,t,i,n,s){super(e,t,i,n,s),this.type=5}_$AI(e,t=this){var i;if((e=(i=Ja(this,e,t,0))!==null&&i!==void 0?i:Mr)===Go)return;const n=this._$AH,s=e===Mr&&n!==Mr||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,a=e!==Mr&&(n===Mr||s);s&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}}class AO{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ja(this,e)}}const W3=wh.litHtmlPolyfillSupport;W3?.(wf,yf),((G0=wh.litHtmlVersions)!==null&&G0!==void 0?G0:wh.litHtmlVersions=[]).push("2.8.0");const EO=(r,e,t)=>{var i,n;const s=(i=t?.renderBefore)!==null&&i!==void 0?i:e;let a=s._$litPart$;if(a===void 0){const f=(n=t?.renderBefore)!==null&&n!==void 0?n:null;s._$litPart$=a=new yf(e.insertBefore(vf(),f),f,void 0,t??{})}return a._$AI(r),a};/**
84
84
  * @license
85
85
  * Copyright 2017 Google LLC
86
86
  * SPDX-License-Identifier: BSD-3-Clause
87
- */var Q0,Z0;class Ct extends Ga{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=AO(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return Go}}Ct.finalized=!0,Ct._$litElement$=!0,(Q0=globalThis.litElementHydrateSupport)===null||Q0===void 0||Q0.call(globalThis,{LitElement:Ct});const K3=globalThis.litElementPolyfillSupport;K3?.({LitElement:Ct}),((Z0=globalThis.litElementVersions)!==null&&Z0!==void 0?Z0:globalThis.litElementVersions=[]).push("3.3.3");/**
87
+ */var Q0,Z0;class Ct extends Ga{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=EO(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return Go}}Ct.finalized=!0,Ct._$litElement$=!0,(Q0=globalThis.litElementHydrateSupport)===null||Q0===void 0||Q0.call(globalThis,{LitElement:Ct});const K3=globalThis.litElementPolyfillSupport;K3?.({LitElement:Ct}),((Z0=globalThis.litElementVersions)!==null&&Z0!==void 0?Z0:globalThis.litElementVersions=[]).push("3.3.3");/**
88
88
  * @license
89
89
  * Copyright 2017 Google LLC
90
90
  * SPDX-License-Identifier: BSD-3-Clause
@@ -92,7 +92,7 @@ function print() { __p += __j.call(arguments, '') }
92
92
  * @license
93
93
  * Copyright 2017 Google LLC
94
94
  * SPDX-License-Identifier: BSD-3-Clause
95
- */const EO=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},SO=(r,e,t)=>{e.constructor.createProperty(t,r)};function At(r){return(e,t)=>t!==void 0?SO(r,e,t):EO(r,e)}/**
95
+ */const SO=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},IO=(r,e,t)=>{e.constructor.createProperty(t,r)};function At(r){return(e,t)=>t!==void 0?IO(r,e,t):SO(r,e)}/**
96
96
  * @license
97
97
  * Copyright 2017 Google LLC
98
98
  * SPDX-License-Identifier: BSD-3-Clause
@@ -104,20 +104,20 @@ function print() { __p += __j.call(arguments, '') }
104
104
  * @license
105
105
  * Copyright 2017 Google LLC
106
106
  * SPDX-License-Identifier: BSD-3-Clause
107
- */const IO={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},MO=r=>(...e)=>({_$litDirective$:r,values:e});class CO{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
107
+ */const MO={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},CO=r=>(...e)=>({_$litDirective$:r,values:e});class PO{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
108
108
  * @license
109
109
  * Copyright 2018 Google LLC
110
110
  * SPDX-License-Identifier: BSD-3-Clause
111
- */const Es=MO(class extends CO{constructor(r){var e;if(super(r),r.type!==IO.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var t,i;if(this.it===void 0){this.it=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((t=this.nt)===null||t===void 0)&&t.has(s))&&this.it.add(s);return this.render(e)}const n=r.element.classList;this.it.forEach(s=>{s in e||(n.remove(s),this.it.delete(s))});for(const s in e){const a=!!e[s];a===this.it.has(s)||!((i=this.nt)===null||i===void 0)&&i.has(s)||(a?(n.add(s),this.it.add(s)):(n.remove(s),this.it.delete(s)))}return Go}});function PO(r,e){r.indexOf(e)===-1&&r.push(e)}const V3=(r,e,t)=>Math.min(Math.max(t,r),e),nn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},_h=r=>typeof r=="number",Qa=r=>Array.isArray(r)&&!_h(r[0]),DO=(r,e,t)=>{const i=e-r;return((t-r)%i+i)%i+r};function OO(r,e){return Qa(r)?r[DO(0,r.length,e)]:r}const G3=(r,e,t)=>-t*r+t*e+r,Y3=()=>{},eo=r=>r,ep=(r,e,t)=>e-r===0?1:(t-r)/(e-r);function J3(r,e){const t=r[r.length-1];for(let i=1;i<=e;i++){const n=ep(0,e,i);r.push(G3(t,1,n))}}function RO(r){const e=[0];return J3(e,r-1),e}function TO(r,e=RO(r.length),t=eo){const i=r.length,n=i-e.length;return n>0&&J3(e,n),s=>{let a=0;for(;a<i-2&&!(s<e[a+1]);a++);let f=V3(0,1,ep(e[a],e[a+1],s));return f=OO(t,a)(f),G3(r[a],r[a+1],f)}}const Q3=r=>Array.isArray(r)&&_h(r[0]),tp=r=>typeof r=="object"&&!!r.createAnimation,Jo=r=>typeof r=="function",$O=r=>typeof r=="string",_f={ms:r=>r*1e3,s:r=>r/1e3},Z3=(r,e,t)=>(((1-3*t+3*e)*r+(3*t-6*e))*r+3*e)*r,NO=1e-7,LO=12;function BO(r,e,t,i,n){let s,a,f=0;do a=e+(t-e)/2,s=Z3(a,i,n)-r,s>0?t=a:e=a;while(Math.abs(s)>NO&&++f<LO);return a}function xf(r,e,t,i){if(r===e&&t===i)return eo;const n=s=>BO(s,0,1,r,t);return s=>s===0||s===1?s:Z3(n(s),e,i)}const FO=(r,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*r,n=e==="end"?Math.floor(i):Math.ceil(i);return V3(0,1,n/r)},UO={ease:xf(.25,.1,.25,1),"ease-in":xf(.42,0,1,1),"ease-in-out":xf(.42,0,.58,1),"ease-out":xf(0,0,.58,1)},qO=/\((.*?)\)/;function X3(r){if(Jo(r))return r;if(Q3(r))return xf(...r);const e=UO[r];if(e)return e;if(r.startsWith("steps")){const t=qO.exec(r);if(t){const i=t[1].split(",");return FO(parseFloat(i[0]),i[1].trim())}}return eo}class ew{constructor(e,t=[0,1],{easing:i,duration:n=nn.duration,delay:s=nn.delay,endDelay:a=nn.endDelay,repeat:f=nn.repeat,offset:h,direction:u="normal",autoplay:g=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=eo,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((P,M)=>{this.resolve=P,this.reject=M}),i=i||nn.easing,tp(i)){const P=i.createAnimation(t);i=P.easing,t=P.keyframes||t,n=P.duration||n}this.repeat=f,this.easing=Qa(i)?eo:X3(i),this.updateDuration(n);const w=TO(t,h,Qa(i)?i.map(X3):eo);this.tick=P=>{var M;s=s;let O=0;this.pauseTime!==void 0?O=this.pauseTime:O=(P-this.startTime)*this.rate,this.t=O,O/=1e3,O=Math.max(O-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(O=this.totalDuration);const $=O/this.duration;let W=Math.floor($),k=$%1;!k&&$>=1&&(k=1),k===1&&W--;const F=W%2;(u==="reverse"||u==="alternate"&&F||u==="alternate-reverse"&&!F)&&(k=1-k);const Y=O>=this.totalDuration?1:Math.min(k,1),B=w(this.easing(Y));e(B),this.pauseTime===void 0&&(this.playState==="finished"||O>=this.totalDuration+a)?(this.playState="finished",(M=this.resolve)===null||M===void 0||M.call(this,B)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},g&&this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var rp=function(){};process.env.NODE_ENV!=="production"&&(rp=function(r,e){if(!r)throw new Error(e)});class zO{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const ip=new WeakMap;function tw(r){return ip.has(r)||ip.set(r,{transforms:[],values:new Map}),ip.get(r)}function kO(r,e){return r.has(e)||r.set(e,new zO),r.get(e)}const HO=["","X","Y","Z"],jO=["translate","scale","rotate","skew"],xh={x:"translateX",y:"translateY",z:"translateZ"},rw={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:r=>r+"deg"},WO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:r=>r+"px"},rotate:rw,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:eo},skew:rw},Af=new Map,np=r=>`--motion-${r}`,Ah=["x","y","z"];jO.forEach(r=>{HO.forEach(e=>{Ah.push(r+e),Af.set(np(r+e),WO[r])})});const KO=(r,e)=>Ah.indexOf(r)-Ah.indexOf(e),VO=new Set(Ah),iw=r=>VO.has(r),GO=(r,e)=>{xh[e]&&(e=xh[e]);const{transforms:t}=tw(r);PO(t,e),r.style.transform=YO(t)},YO=r=>r.sort(KO).reduce(JO,"").trim(),JO=(r,e)=>`${r} ${e}(var(${np(e)}))`,sp=r=>r.startsWith("--"),nw=new Set;function QO(r){if(!nw.has(r)){nw.add(r);try{const{syntax:e,initialValue:t}=Af.has(r)?Af.get(r):{};CSS.registerProperty({name:r,inherits:!1,syntax:e,initialValue:t})}catch{}}}const op=(r,e)=>document.createElement("div").animate(r,e),sw={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{op({opacity:[1]})}catch{return!1}return!0},finished:()=>!!op({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{op({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},ap={},Za={};for(const r in sw)Za[r]=()=>(ap[r]===void 0&&(ap[r]=sw[r]()),ap[r]);const ZO=.015,XO=(r,e)=>{let t="";const i=Math.round(e/ZO);for(let n=0;n<i;n++)t+=r(ep(0,i-1,n))+", ";return t.substring(0,t.length-2)},ow=(r,e)=>Jo(r)?Za.linearEasing()?`linear(${XO(r,e)})`:nn.easing:Q3(r)?eR(r):r,eR=([r,e,t,i])=>`cubic-bezier(${r}, ${e}, ${t}, ${i})`;function tR(r,e){for(let t=0;t<r.length;t++)r[t]===null&&(r[t]=t?r[t-1]:e());return r}const rR=r=>Array.isArray(r)?r:[r];function cp(r){return xh[r]&&(r=xh[r]),iw(r)?np(r):r}const Eh={get:(r,e)=>{e=cp(e);let t=sp(e)?r.style.getPropertyValue(e):getComputedStyle(r)[e];if(!t&&t!==0){const i=Af.get(e);i&&(t=i.initialValue)}return t},set:(r,e,t)=>{e=cp(e),sp(e)?r.style.setProperty(e,t):r.style[e]=t}};function aw(r,e=!0){if(!(!r||r.playState==="finished"))try{r.stop?r.stop():(e&&r.commitStyles(),r.cancel())}catch{}}function iR(r,e){var t;let i=e?.toDefaultUnit||eo;const n=r[r.length-1];if($O(n)){const s=((t=n.match(/(-?[\d.]+)([a-z%]*)/))===null||t===void 0?void 0:t[2])||"";s&&(i=a=>a+s)}return i}function nR(){return window.__MOTION_DEV_TOOLS_RECORD}function sR(r,e,t,i={},n){const s=nR(),a=i.record!==!1&&s;let f,{duration:h=nn.duration,delay:u=nn.delay,endDelay:g=nn.endDelay,repeat:w=nn.repeat,easing:P=nn.easing,persist:M=!1,direction:O,offset:$,allowWebkitAcceleration:W=!1,autoplay:k=!0}=i;const F=tw(r),Y=iw(e);let B=Za.waapi();Y&&GO(r,e);const z=cp(e),j=kO(F.values,z),_=Af.get(z);return aw(j.animation,!(tp(P)&&j.generator)&&i.record!==!1),()=>{const U=()=>{var L,b;return(b=(L=Eh.get(r,z))!==null&&L!==void 0?L:_?.initialValue)!==null&&b!==void 0?b:0};let ee=tR(rR(t),U);const oe=iR(ee,_);if(tp(P)){const L=P.createAnimation(ee,e!=="opacity",U,z,j);P=L.easing,ee=L.keyframes||ee,h=L.duration||h}if(sp(z)&&(Za.cssRegisterProperty()?QO(z):B=!1),Y&&!Za.linearEasing()&&(Jo(P)||Qa(P)&&P.some(Jo))&&(B=!1),B){_&&(ee=ee.map(m=>_h(m)?_.toDefaultUnit(m):m)),ee.length===1&&(!Za.partialKeyframes()||a)&&ee.unshift(U());const L={delay:_f.ms(u),duration:_f.ms(h),endDelay:_f.ms(g),easing:Qa(P)?void 0:ow(P,h),direction:O,iterations:w+1,fill:"both"};f=r.animate({[z]:ee,offset:$,easing:Qa(P)?P.map(m=>ow(m,h)):void 0},L),f.finished||(f.finished=new Promise((m,l)=>{f.onfinish=m,f.oncancel=l}));const b=ee[ee.length-1];f.finished.then(()=>{M||(Eh.set(r,z,b),f.cancel())}).catch(Y3),W||(f.playbackRate=1.000001)}else if(n&&Y)ee=ee.map(L=>typeof L=="string"?parseFloat(L):L),ee.length===1&&ee.unshift(parseFloat(U())),f=new n(L=>{Eh.set(r,z,oe?oe(L):L)},ee,Object.assign(Object.assign({},i),{duration:h,easing:P}));else{const L=ee[ee.length-1];Eh.set(r,z,_&&_h(L)?_.toDefaultUnit(L):L)}return a&&s(r,e,ee,{duration:h,delay:u,easing:P,repeat:w,offset:$},"motion-one"),j.setAnimation(f),f&&!k&&f.pause(),f}}const oR=(r,e)=>r[e]?Object.assign(Object.assign({},r),r[e]):Object.assign({},r);function cw(r,e){var t;return typeof r=="string"?e?((t=e[r])!==null&&t!==void 0||(e[r]=document.querySelectorAll(r)),r=e[r]):r=document.querySelectorAll(r):r instanceof Element&&(r=[r]),Array.from(r||[])}const aR=r=>r(),fw=(r,e,t=nn.duration)=>new Proxy({animations:r.map(aR).filter(Boolean),duration:t,options:e},fR),cR=r=>r.animations[0],fR={get:(r,e)=>{const t=cR(r);switch(e){case"duration":return r.duration;case"currentTime":return _f.s(t?.[e]||0);case"playbackRate":case"playState":return t?.[e];case"finished":return r.finished||(r.finished=Promise.all(r.animations.map(lR)).catch(Y3)),r.finished;case"stop":return()=>{r.animations.forEach(i=>aw(i))};case"forEachNative":return i=>{r.animations.forEach(n=>i(n,r))};default:return typeof t?.[e]>"u"?void 0:()=>r.animations.forEach(i=>i[e]())}},set:(r,e,t)=>{switch(e){case"currentTime":t=_f.ms(t);case"playbackRate":for(let i=0;i<r.animations.length;i++)r.animations[i][e]=t;return!0}return!1}},lR=r=>r.finished;function hR(r,e,t){return Jo(r)?r(e,t):r}function uR(r){return function(t,i,n={}){t=cw(t);const s=t.length;rp(!!s,"No valid element provided."),rp(!!i,"No keyframes defined.");const a=[];for(let f=0;f<s;f++){const h=t[f];for(const u in i){const g=oR(n,u);g.delay=hR(g.delay,f,s);const w=sR(h,u,i[u],g,r);a.push(w)}}return fw(a,n,n.duration)}}const dR=uR(ew);function pR(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}typeof SuppressedError=="function"&&SuppressedError;const gR={any:0,all:1};function vR(r,e,{root:t,margin:i,amount:n="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=cw(r),a=new WeakMap,f=u=>{u.forEach(g=>{const w=a.get(g.target);if(g.isIntersecting!==!!w)if(g.isIntersecting){const P=e(g);Jo(P)?a.set(g.target,P):h.unobserve(g.target)}else w&&(w(g),a.delete(g.target))})},h=new IntersectionObserver(f,{root:t,rootMargin:i,threshold:typeof n=="number"?n:gR[n]});return s.forEach(u=>h.observe(u)),()=>h.disconnect()}function fp(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:t}}))}function lw(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:t}}))}const mR={isActive:r=>!!r.inView,subscribe:(r,{enable:e,disable:t},{inViewOptions:i={}})=>{const{once:n}=i,s=pR(i,["once"]);return vR(r,a=>{if(e(),lw(r,"viewenter",a),!n)return f=>{t(),lw(r,"viewleave",f)}},s)}},hw=(r,e,t)=>i=>{i.pointerType&&i.pointerType!=="mouse"||(t(),fp(r,e,i))};[...Object.keys({inView:mR,hover:{isActive:r=>!!r.hover,subscribe:(r,{enable:e,disable:t})=>{const i=hw(r,"hoverstart",e),n=hw(r,"hoverend",t);return r.addEventListener("pointerenter",i),r.addEventListener("pointerleave",n),()=>{r.removeEventListener("pointerenter",i),r.removeEventListener("pointerleave",n)}}},press:{isActive:r=>!!r.press,subscribe:(r,{enable:e,disable:t})=>{const i=s=>{t(),fp(r,"pressend",s),window.removeEventListener("pointerup",i)},n=s=>{e(),fp(r,"pressstart",s),window.addEventListener("pointerup",i)};return r.addEventListener("pointerdown",n),()=>{r.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",i)}}}})];function bR(r,e={}){return fw([()=>{const t=new ew(r,[0,1],e);return t.finished.catch(()=>{}),t}],e,e.duration)}function Qo(r,e,t){return(Jo(r)?bR:dR)(r,e,t)}/**
111
+ */const Ss=CO(class extends PO{constructor(r){var e;if(super(r),r.type!==MO.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var t,i;if(this.it===void 0){this.it=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((t=this.nt)===null||t===void 0)&&t.has(s))&&this.it.add(s);return this.render(e)}const n=r.element.classList;this.it.forEach(s=>{s in e||(n.remove(s),this.it.delete(s))});for(const s in e){const a=!!e[s];a===this.it.has(s)||!((i=this.nt)===null||i===void 0)&&i.has(s)||(a?(n.add(s),this.it.add(s)):(n.remove(s),this.it.delete(s)))}return Go}});function DO(r,e){r.indexOf(e)===-1&&r.push(e)}const V3=(r,e,t)=>Math.min(Math.max(t,r),e),an={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},_h=r=>typeof r=="number",Qa=r=>Array.isArray(r)&&!_h(r[0]),OO=(r,e,t)=>{const i=e-r;return((t-r)%i+i)%i+r};function RO(r,e){return Qa(r)?r[OO(0,r.length,e)]:r}const G3=(r,e,t)=>-t*r+t*e+r,Y3=()=>{},to=r=>r,ep=(r,e,t)=>e-r===0?1:(t-r)/(e-r);function J3(r,e){const t=r[r.length-1];for(let i=1;i<=e;i++){const n=ep(0,e,i);r.push(G3(t,1,n))}}function TO(r){const e=[0];return J3(e,r-1),e}function $O(r,e=TO(r.length),t=to){const i=r.length,n=i-e.length;return n>0&&J3(e,n),s=>{let a=0;for(;a<i-2&&!(s<e[a+1]);a++);let f=V3(0,1,ep(e[a],e[a+1],s));return f=RO(t,a)(f),G3(r[a],r[a+1],f)}}const Q3=r=>Array.isArray(r)&&_h(r[0]),tp=r=>typeof r=="object"&&!!r.createAnimation,Jo=r=>typeof r=="function",NO=r=>typeof r=="string",_f={ms:r=>r*1e3,s:r=>r/1e3},Z3=(r,e,t)=>(((1-3*t+3*e)*r+(3*t-6*e))*r+3*e)*r,LO=1e-7,BO=12;function FO(r,e,t,i,n){let s,a,f=0;do a=e+(t-e)/2,s=Z3(a,i,n)-r,s>0?t=a:e=a;while(Math.abs(s)>LO&&++f<BO);return a}function xf(r,e,t,i){if(r===e&&t===i)return to;const n=s=>FO(s,0,1,r,t);return s=>s===0||s===1?s:Z3(n(s),e,i)}const UO=(r,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*r,n=e==="end"?Math.floor(i):Math.ceil(i);return V3(0,1,n/r)},qO={ease:xf(.25,.1,.25,1),"ease-in":xf(.42,0,1,1),"ease-in-out":xf(.42,0,.58,1),"ease-out":xf(0,0,.58,1)},zO=/\((.*?)\)/;function X3(r){if(Jo(r))return r;if(Q3(r))return xf(...r);const e=qO[r];if(e)return e;if(r.startsWith("steps")){const t=zO.exec(r);if(t){const i=t[1].split(",");return UO(parseFloat(i[0]),i[1].trim())}}return to}class ew{constructor(e,t=[0,1],{easing:i,duration:n=an.duration,delay:s=an.delay,endDelay:a=an.endDelay,repeat:f=an.repeat,offset:h,direction:u="normal",autoplay:g=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=to,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((P,M)=>{this.resolve=P,this.reject=M}),i=i||an.easing,tp(i)){const P=i.createAnimation(t);i=P.easing,t=P.keyframes||t,n=P.duration||n}this.repeat=f,this.easing=Qa(i)?to:X3(i),this.updateDuration(n);const w=$O(t,h,Qa(i)?i.map(X3):to);this.tick=P=>{var M;s=s;let O=0;this.pauseTime!==void 0?O=this.pauseTime:O=(P-this.startTime)*this.rate,this.t=O,O/=1e3,O=Math.max(O-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(O=this.totalDuration);const $=O/this.duration;let W=Math.floor($),H=$%1;!H&&$>=1&&(H=1),H===1&&W--;const F=W%2;(u==="reverse"||u==="alternate"&&F||u==="alternate-reverse"&&!F)&&(H=1-H);const Y=O>=this.totalDuration?1:Math.min(H,1),B=w(this.easing(Y));e(B),this.pauseTime===void 0&&(this.playState==="finished"||O>=this.totalDuration+a)?(this.playState="finished",(M=this.resolve)===null||M===void 0||M.call(this,B)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},g&&this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var rp=function(){};process.env.NODE_ENV!=="production"&&(rp=function(r,e){if(!r)throw new Error(e)});class HO{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const ip=new WeakMap;function tw(r){return ip.has(r)||ip.set(r,{transforms:[],values:new Map}),ip.get(r)}function kO(r,e){return r.has(e)||r.set(e,new HO),r.get(e)}const jO=["","X","Y","Z"],WO=["translate","scale","rotate","skew"],xh={x:"translateX",y:"translateY",z:"translateZ"},rw={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:r=>r+"deg"},KO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:r=>r+"px"},rotate:rw,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:to},skew:rw},Af=new Map,np=r=>`--motion-${r}`,Ah=["x","y","z"];WO.forEach(r=>{jO.forEach(e=>{Ah.push(r+e),Af.set(np(r+e),KO[r])})});const VO=(r,e)=>Ah.indexOf(r)-Ah.indexOf(e),GO=new Set(Ah),iw=r=>GO.has(r),YO=(r,e)=>{xh[e]&&(e=xh[e]);const{transforms:t}=tw(r);DO(t,e),r.style.transform=JO(t)},JO=r=>r.sort(VO).reduce(QO,"").trim(),QO=(r,e)=>`${r} ${e}(var(${np(e)}))`,sp=r=>r.startsWith("--"),nw=new Set;function ZO(r){if(!nw.has(r)){nw.add(r);try{const{syntax:e,initialValue:t}=Af.has(r)?Af.get(r):{};CSS.registerProperty({name:r,inherits:!1,syntax:e,initialValue:t})}catch{}}}const op=(r,e)=>document.createElement("div").animate(r,e),sw={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{op({opacity:[1]})}catch{return!1}return!0},finished:()=>!!op({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{op({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},ap={},Za={};for(const r in sw)Za[r]=()=>(ap[r]===void 0&&(ap[r]=sw[r]()),ap[r]);const XO=.015,eR=(r,e)=>{let t="";const i=Math.round(e/XO);for(let n=0;n<i;n++)t+=r(ep(0,i-1,n))+", ";return t.substring(0,t.length-2)},ow=(r,e)=>Jo(r)?Za.linearEasing()?`linear(${eR(r,e)})`:an.easing:Q3(r)?tR(r):r,tR=([r,e,t,i])=>`cubic-bezier(${r}, ${e}, ${t}, ${i})`;function rR(r,e){for(let t=0;t<r.length;t++)r[t]===null&&(r[t]=t?r[t-1]:e());return r}const iR=r=>Array.isArray(r)?r:[r];function cp(r){return xh[r]&&(r=xh[r]),iw(r)?np(r):r}const Eh={get:(r,e)=>{e=cp(e);let t=sp(e)?r.style.getPropertyValue(e):getComputedStyle(r)[e];if(!t&&t!==0){const i=Af.get(e);i&&(t=i.initialValue)}return t},set:(r,e,t)=>{e=cp(e),sp(e)?r.style.setProperty(e,t):r.style[e]=t}};function aw(r,e=!0){if(!(!r||r.playState==="finished"))try{r.stop?r.stop():(e&&r.commitStyles(),r.cancel())}catch{}}function nR(r,e){var t;let i=e?.toDefaultUnit||to;const n=r[r.length-1];if(NO(n)){const s=((t=n.match(/(-?[\d.]+)([a-z%]*)/))===null||t===void 0?void 0:t[2])||"";s&&(i=a=>a+s)}return i}function sR(){return window.__MOTION_DEV_TOOLS_RECORD}function oR(r,e,t,i={},n){const s=sR(),a=i.record!==!1&&s;let f,{duration:h=an.duration,delay:u=an.delay,endDelay:g=an.endDelay,repeat:w=an.repeat,easing:P=an.easing,persist:M=!1,direction:O,offset:$,allowWebkitAcceleration:W=!1,autoplay:H=!0}=i;const F=tw(r),Y=iw(e);let B=Za.waapi();Y&&YO(r,e);const z=cp(e),j=kO(F.values,z),_=Af.get(z);return aw(j.animation,!(tp(P)&&j.generator)&&i.record!==!1),()=>{const U=()=>{var L,b;return(b=(L=Eh.get(r,z))!==null&&L!==void 0?L:_?.initialValue)!==null&&b!==void 0?b:0};let ee=rR(iR(t),U);const oe=nR(ee,_);if(tp(P)){const L=P.createAnimation(ee,e!=="opacity",U,z,j);P=L.easing,ee=L.keyframes||ee,h=L.duration||h}if(sp(z)&&(Za.cssRegisterProperty()?ZO(z):B=!1),Y&&!Za.linearEasing()&&(Jo(P)||Qa(P)&&P.some(Jo))&&(B=!1),B){_&&(ee=ee.map(m=>_h(m)?_.toDefaultUnit(m):m)),ee.length===1&&(!Za.partialKeyframes()||a)&&ee.unshift(U());const L={delay:_f.ms(u),duration:_f.ms(h),endDelay:_f.ms(g),easing:Qa(P)?void 0:ow(P,h),direction:O,iterations:w+1,fill:"both"};f=r.animate({[z]:ee,offset:$,easing:Qa(P)?P.map(m=>ow(m,h)):void 0},L),f.finished||(f.finished=new Promise((m,l)=>{f.onfinish=m,f.oncancel=l}));const b=ee[ee.length-1];f.finished.then(()=>{M||(Eh.set(r,z,b),f.cancel())}).catch(Y3),W||(f.playbackRate=1.000001)}else if(n&&Y)ee=ee.map(L=>typeof L=="string"?parseFloat(L):L),ee.length===1&&ee.unshift(parseFloat(U())),f=new n(L=>{Eh.set(r,z,oe?oe(L):L)},ee,Object.assign(Object.assign({},i),{duration:h,easing:P}));else{const L=ee[ee.length-1];Eh.set(r,z,_&&_h(L)?_.toDefaultUnit(L):L)}return a&&s(r,e,ee,{duration:h,delay:u,easing:P,repeat:w,offset:$},"motion-one"),j.setAnimation(f),f&&!H&&f.pause(),f}}const aR=(r,e)=>r[e]?Object.assign(Object.assign({},r),r[e]):Object.assign({},r);function cw(r,e){var t;return typeof r=="string"?e?((t=e[r])!==null&&t!==void 0||(e[r]=document.querySelectorAll(r)),r=e[r]):r=document.querySelectorAll(r):r instanceof Element&&(r=[r]),Array.from(r||[])}const cR=r=>r(),fw=(r,e,t=an.duration)=>new Proxy({animations:r.map(cR).filter(Boolean),duration:t,options:e},lR),fR=r=>r.animations[0],lR={get:(r,e)=>{const t=fR(r);switch(e){case"duration":return r.duration;case"currentTime":return _f.s(t?.[e]||0);case"playbackRate":case"playState":return t?.[e];case"finished":return r.finished||(r.finished=Promise.all(r.animations.map(hR)).catch(Y3)),r.finished;case"stop":return()=>{r.animations.forEach(i=>aw(i))};case"forEachNative":return i=>{r.animations.forEach(n=>i(n,r))};default:return typeof t?.[e]>"u"?void 0:()=>r.animations.forEach(i=>i[e]())}},set:(r,e,t)=>{switch(e){case"currentTime":t=_f.ms(t);case"playbackRate":for(let i=0;i<r.animations.length;i++)r.animations[i][e]=t;return!0}return!1}},hR=r=>r.finished;function uR(r,e,t){return Jo(r)?r(e,t):r}function dR(r){return function(t,i,n={}){t=cw(t);const s=t.length;rp(!!s,"No valid element provided."),rp(!!i,"No keyframes defined.");const a=[];for(let f=0;f<s;f++){const h=t[f];for(const u in i){const g=aR(n,u);g.delay=uR(g.delay,f,s);const w=oR(h,u,i[u],g,r);a.push(w)}}return fw(a,n,n.duration)}}const pR=dR(ew);function gR(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}typeof SuppressedError=="function"&&SuppressedError;const vR={any:0,all:1};function mR(r,e,{root:t,margin:i,amount:n="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=cw(r),a=new WeakMap,f=u=>{u.forEach(g=>{const w=a.get(g.target);if(g.isIntersecting!==!!w)if(g.isIntersecting){const P=e(g);Jo(P)?a.set(g.target,P):h.unobserve(g.target)}else w&&(w(g),a.delete(g.target))})},h=new IntersectionObserver(f,{root:t,rootMargin:i,threshold:typeof n=="number"?n:vR[n]});return s.forEach(u=>h.observe(u)),()=>h.disconnect()}function fp(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:t}}))}function lw(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:t}}))}const bR={isActive:r=>!!r.inView,subscribe:(r,{enable:e,disable:t},{inViewOptions:i={}})=>{const{once:n}=i,s=gR(i,["once"]);return mR(r,a=>{if(e(),lw(r,"viewenter",a),!n)return f=>{t(),lw(r,"viewleave",f)}},s)}},hw=(r,e,t)=>i=>{i.pointerType&&i.pointerType!=="mouse"||(t(),fp(r,e,i))};[...Object.keys({inView:bR,hover:{isActive:r=>!!r.hover,subscribe:(r,{enable:e,disable:t})=>{const i=hw(r,"hoverstart",e),n=hw(r,"hoverend",t);return r.addEventListener("pointerenter",i),r.addEventListener("pointerleave",n),()=>{r.removeEventListener("pointerenter",i),r.removeEventListener("pointerleave",n)}}},press:{isActive:r=>!!r.press,subscribe:(r,{enable:e,disable:t})=>{const i=s=>{t(),fp(r,"pressend",s),window.removeEventListener("pointerup",i)},n=s=>{e(),fp(r,"pressstart",s),window.addEventListener("pointerup",i)};return r.addEventListener("pointerdown",n),()=>{r.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",i)}}}})];function wR(r,e={}){return fw([()=>{const t=new ew(r,[0,1],e);return t.finished.catch(()=>{}),t}],e,e.duration)}function Qo(r,e,t){return(Jo(r)?wR:pR)(r,e,t)}/**
112
112
  * @license
113
113
  * Copyright 2018 Google LLC
114
114
  * SPDX-License-Identifier: BSD-3-Clause
115
- */const li=r=>r??Mr;var Ef={},wR=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},uw={},Ui={};let lp;const yR=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Ui.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},Ui.getSymbolTotalCodewords=function(e){return yR[e]},Ui.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e},Ui.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');lp=e},Ui.isKanjiModeEnabled=function(){return typeof lp<"u"},Ui.toSJIS=function(e){return lp(e)};var Sh={};(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+t)}}r.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},r.from=function(i,n){if(r.isValid(i))return i;try{return e(i)}catch{return n}}})(Sh);function dw(){this.buffer=[],this.length=0}dw.prototype={get:function(r){const e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var _R=dw;function Sf(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Sf.prototype.set=function(r,e,t,i){const n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)},Sf.prototype.get=function(r,e){return this.data[r*this.size+e]},Sf.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t},Sf.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};var xR=Sf,pw={};(function(r){const e=Ui.getSymbolSize;r.getRowColCoords=function(i){if(i===1)return[];const n=Math.floor(i/7)+2,s=e(i),a=s===145?26:Math.ceil((s-13)/(2*n-2))*2,f=[s-7];for(let h=1;h<n-1;h++)f[h]=f[h-1]-a;return f.push(6),f.reverse()},r.getPositions=function(i){const n=[],s=r.getRowColCoords(i),a=s.length;for(let f=0;f<a;f++)for(let h=0;h<a;h++)f===0&&h===0||f===0&&h===a-1||f===a-1&&h===0||n.push([s[f],s[h]]);return n}})(pw);var gw={};const AR=Ui.getSymbolSize,vw=7;gw.getPositions=function(e){const t=AR(e);return[[0,0],[t-vw,0],[0,t-vw]]};var mw={};(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};r.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},r.from=function(n){return r.isValid(n)?parseInt(n,10):void 0},r.getPenaltyN1=function(n){const s=n.size;let a=0,f=0,h=0,u=null,g=null;for(let w=0;w<s;w++){f=h=0,u=g=null;for(let P=0;P<s;P++){let M=n.get(w,P);M===u?f++:(f>=5&&(a+=e.N1+(f-5)),u=M,f=1),M=n.get(P,w),M===g?h++:(h>=5&&(a+=e.N1+(h-5)),g=M,h=1)}f>=5&&(a+=e.N1+(f-5)),h>=5&&(a+=e.N1+(h-5))}return a},r.getPenaltyN2=function(n){const s=n.size;let a=0;for(let f=0;f<s-1;f++)for(let h=0;h<s-1;h++){const u=n.get(f,h)+n.get(f,h+1)+n.get(f+1,h)+n.get(f+1,h+1);(u===4||u===0)&&a++}return a*e.N2},r.getPenaltyN3=function(n){const s=n.size;let a=0,f=0,h=0;for(let u=0;u<s;u++){f=h=0;for(let g=0;g<s;g++)f=f<<1&2047|n.get(u,g),g>=10&&(f===1488||f===93)&&a++,h=h<<1&2047|n.get(g,u),g>=10&&(h===1488||h===93)&&a++}return a*e.N3},r.getPenaltyN4=function(n){let s=0;const a=n.data.length;for(let h=0;h<a;h++)s+=n.data[h];return Math.abs(Math.ceil(s*100/a/5)-10)*e.N4};function t(i,n,s){switch(i){case r.Patterns.PATTERN000:return(n+s)%2===0;case r.Patterns.PATTERN001:return n%2===0;case r.Patterns.PATTERN010:return s%3===0;case r.Patterns.PATTERN011:return(n+s)%3===0;case r.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case r.Patterns.PATTERN101:return n*s%2+n*s%3===0;case r.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case r.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}r.applyMask=function(n,s){const a=s.size;for(let f=0;f<a;f++)for(let h=0;h<a;h++)s.isReserved(h,f)||s.xor(h,f,t(n,h,f))},r.getBestMask=function(n,s){const a=Object.keys(r.Patterns).length;let f=0,h=1/0;for(let u=0;u<a;u++){s(u),r.applyMask(u,n);const g=r.getPenaltyN1(n)+r.getPenaltyN2(n)+r.getPenaltyN3(n)+r.getPenaltyN4(n);r.applyMask(u,n),g<h&&(h=g,f=u)}return f}})(mw);var Ih={};const to=Sh,Mh=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ch=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Ih.getBlocksCount=function(e,t){switch(t){case to.L:return Mh[(e-1)*4+0];case to.M:return Mh[(e-1)*4+1];case to.Q:return Mh[(e-1)*4+2];case to.H:return Mh[(e-1)*4+3];default:return}},Ih.getTotalCodewordsCount=function(e,t){switch(t){case to.L:return Ch[(e-1)*4+0];case to.M:return Ch[(e-1)*4+1];case to.Q:return Ch[(e-1)*4+2];case to.H:return Ch[(e-1)*4+3];default:return}};var bw={},Ph={};const If=new Uint8Array(512),Dh=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)If[t]=e,Dh[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)If[t]=If[t-255]})(),Ph.log=function(e){if(e<1)throw new Error("log("+e+")");return Dh[e]},Ph.exp=function(e){return If[e]},Ph.mul=function(e,t){return e===0||t===0?0:If[Dh[e]+Dh[t]]},function(r){const e=Ph;r.mul=function(i,n){const s=new Uint8Array(i.length+n.length-1);for(let a=0;a<i.length;a++)for(let f=0;f<n.length;f++)s[a+f]^=e.mul(i[a],n[f]);return s},r.mod=function(i,n){let s=new Uint8Array(i);for(;s.length-n.length>=0;){const a=s[0];for(let h=0;h<n.length;h++)s[h]^=e.mul(n[h],a);let f=0;for(;f<s.length&&s[f]===0;)f++;s=s.slice(f)}return s},r.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let s=0;s<i;s++)n=r.mul(n,new Uint8Array([1,e.exp(s)]));return n}}(bw);const ww=bw;function hp(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}hp.prototype.initialize=function(e){this.degree=e,this.genPoly=ww.generateECPolynomial(this.degree)},hp.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const i=ww.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){const s=new Uint8Array(this.degree);return s.set(i,n),s}return i};var ER=hp,yw={},ro={},up={};up.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var os={};const _w="[0-9]+",SR="[A-Z $%*+\\-./:]+";let Mf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Mf=Mf.replace(/u/g,"\\u");const IR="(?:(?![A-Z0-9 $%*+\\-./:]|"+Mf+`)(?:.|[\r
116
- ]))+`;os.KANJI=new RegExp(Mf,"g"),os.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),os.BYTE=new RegExp(IR,"g"),os.NUMERIC=new RegExp(_w,"g"),os.ALPHANUMERIC=new RegExp(SR,"g");const MR=new RegExp("^"+Mf+"$"),CR=new RegExp("^"+_w+"$"),PR=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");os.testKanji=function(e){return MR.test(e)},os.testNumeric=function(e){return CR.test(e)},os.testAlphanumeric=function(e){return PR.test(e)},function(r){const e=up,t=os;r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(s,a){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?s.ccBits[0]:a<27?s.ccBits[1]:s.ccBits[2]},r.getBestModeForData=function(s){return t.testNumeric(s)?r.NUMERIC:t.testAlphanumeric(s)?r.ALPHANUMERIC:t.testKanji(s)?r.KANJI:r.BYTE},r.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},r.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+n)}}r.from=function(s,a){if(r.isValid(s))return s;try{return i(s)}catch{return a}}}(ro),function(r){const e=Ui,t=Ih,i=Sh,n=ro,s=up,a=7973,f=e.getBCHDigit(a);function h(P,M,O){for(let $=1;$<=40;$++)if(M<=r.getCapacity($,O,P))return $}function u(P,M){return n.getCharCountIndicator(P,M)+4}function g(P,M){let O=0;return P.forEach(function($){const W=u($.mode,M);O+=W+$.getBitsLength()}),O}function w(P,M){for(let O=1;O<=40;O++)if(g(P,O)<=r.getCapacity(O,M,n.MIXED))return O}r.from=function(M,O){return s.isValid(M)?parseInt(M,10):O},r.getCapacity=function(M,O,$){if(!s.isValid(M))throw new Error("Invalid QR Code version");typeof $>"u"&&($=n.BYTE);const W=e.getSymbolTotalCodewords(M),k=t.getTotalCodewordsCount(M,O),F=(W-k)*8;if($===n.MIXED)return F;const Y=F-u($,M);switch($){case n.NUMERIC:return Math.floor(Y/10*3);case n.ALPHANUMERIC:return Math.floor(Y/11*2);case n.KANJI:return Math.floor(Y/13);case n.BYTE:default:return Math.floor(Y/8)}},r.getBestVersionForData=function(M,O){let $;const W=i.from(O,i.M);if(Array.isArray(M)){if(M.length>1)return w(M,W);if(M.length===0)return 1;$=M[0]}else $=M;return h($.mode,$.getLength(),W)},r.getEncodedBits=function(M){if(!s.isValid(M)||M<7)throw new Error("Invalid QR Code version");let O=M<<12;for(;e.getBCHDigit(O)-f>=0;)O^=a<<e.getBCHDigit(O)-f;return M<<12|O}}(yw);var xw={};const dp=Ui,Aw=1335,DR=21522,Ew=dp.getBCHDigit(Aw);xw.getEncodedBits=function(e,t){const i=e.bit<<3|t;let n=i<<10;for(;dp.getBCHDigit(n)-Ew>=0;)n^=Aw<<dp.getBCHDigit(n)-Ew;return(i<<10|n)^DR};var Sw={};const OR=ro;function Xa(r){this.mode=OR.NUMERIC,this.data=r.toString()}Xa.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},Xa.prototype.getLength=function(){return this.data.length},Xa.prototype.getBitsLength=function(){return Xa.getBitsLength(this.data.length)},Xa.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);const s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};var RR=Xa;const TR=ro,pp=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ec(r){this.mode=TR.ALPHANUMERIC,this.data=r}ec.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},ec.prototype.getLength=function(){return this.data.length},ec.prototype.getBitsLength=function(){return ec.getBitsLength(this.data.length)},ec.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=pp.indexOf(this.data[t])*45;i+=pp.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(pp.indexOf(this.data[t]),6)};var $R=ec,NR=function(e){for(var t=[],i=e.length,n=0;n<i;n++){var s=e.charCodeAt(n);if(s>=55296&&s<=56319&&i>n+1){var a=e.charCodeAt(n+1);a>=56320&&a<=57343&&(s=(s-55296)*1024+a-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer};const LR=NR,BR=ro;function tc(r){this.mode=BR.BYTE,typeof r=="string"&&(r=LR(r)),this.data=new Uint8Array(r)}tc.getBitsLength=function(e){return e*8},tc.prototype.getLength=function(){return this.data.length},tc.prototype.getBitsLength=function(){return tc.getBitsLength(this.data.length)},tc.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)};var FR=tc;const UR=ro,qR=Ui;function rc(r){this.mode=UR.KANJI,this.data=r}rc.getBitsLength=function(e){return e*13},rc.prototype.getLength=function(){return this.data.length},rc.prototype.getBitsLength=function(){return rc.getBitsLength(this.data.length)},rc.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let t=qR.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
117
- Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};var zR=rc,Iw={exports:{}};(function(r){var e={single_source_shortest_paths:function(t,i,n){var s={},a={};a[i]=0;var f=e.PriorityQueue.make();f.push(i,0);for(var h,u,g,w,P,M,O,$,W;!f.empty();){h=f.pop(),u=h.value,w=h.cost,P=t[u]||{};for(g in P)P.hasOwnProperty(g)&&(M=P[g],O=w+M,$=a[g],W=typeof a[g]>"u",(W||$>O)&&(a[g]=O,f.push(g,O),s[g]=u))}if(typeof n<"u"&&typeof a[n]>"u"){var k=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(k)}return s},extract_shortest_path_from_predecessor_list:function(t,i){for(var n=[],s=i;s;)n.push(s),t[s],s=t[s];return n.reverse(),n},find_path:function(t,i,n){var s=e.single_source_shortest_paths(t,i,n);return e.extract_shortest_path_from_predecessor_list(s,n)},PriorityQueue:{make:function(t){var i=e.PriorityQueue,n={},s;t=t||{};for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);return n.queue=[],n.sorter=t.sorter||i.default_sorter,n},default_sorter:function(t,i){return t.cost-i.cost},push:function(t,i){var n={value:t,cost:i};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=e})(Iw),function(r){const e=ro,t=RR,i=$R,n=FR,s=zR,a=os,f=Ui,h=Iw.exports;function u(k){return unescape(encodeURIComponent(k)).length}function g(k,F,Y){const B=[];let z;for(;(z=k.exec(Y))!==null;)B.push({data:z[0],index:z.index,mode:F,length:z[0].length});return B}function w(k){const F=g(a.NUMERIC,e.NUMERIC,k),Y=g(a.ALPHANUMERIC,e.ALPHANUMERIC,k);let B,z;return f.isKanjiModeEnabled()?(B=g(a.BYTE,e.BYTE,k),z=g(a.KANJI,e.KANJI,k)):(B=g(a.BYTE_KANJI,e.BYTE,k),z=[]),F.concat(Y,B,z).sort(function(_,U){return _.index-U.index}).map(function(_){return{data:_.data,mode:_.mode,length:_.length}})}function P(k,F){switch(F){case e.NUMERIC:return t.getBitsLength(k);case e.ALPHANUMERIC:return i.getBitsLength(k);case e.KANJI:return s.getBitsLength(k);case e.BYTE:return n.getBitsLength(k)}}function M(k){return k.reduce(function(F,Y){const B=F.length-1>=0?F[F.length-1]:null;return B&&B.mode===Y.mode?(F[F.length-1].data+=Y.data,F):(F.push(Y),F)},[])}function O(k){const F=[];for(let Y=0;Y<k.length;Y++){const B=k[Y];switch(B.mode){case e.NUMERIC:F.push([B,{data:B.data,mode:e.ALPHANUMERIC,length:B.length},{data:B.data,mode:e.BYTE,length:B.length}]);break;case e.ALPHANUMERIC:F.push([B,{data:B.data,mode:e.BYTE,length:B.length}]);break;case e.KANJI:F.push([B,{data:B.data,mode:e.BYTE,length:u(B.data)}]);break;case e.BYTE:F.push([{data:B.data,mode:e.BYTE,length:u(B.data)}])}}return F}function $(k,F){const Y={},B={start:{}};let z=["start"];for(let j=0;j<k.length;j++){const _=k[j],U=[];for(let ee=0;ee<_.length;ee++){const oe=_[ee],L=""+j+ee;U.push(L),Y[L]={node:oe,lastCount:0},B[L]={};for(let b=0;b<z.length;b++){const m=z[b];Y[m]&&Y[m].node.mode===oe.mode?(B[m][L]=P(Y[m].lastCount+oe.length,oe.mode)-P(Y[m].lastCount,oe.mode),Y[m].lastCount+=oe.length):(Y[m]&&(Y[m].lastCount=oe.length),B[m][L]=P(oe.length,oe.mode)+4+e.getCharCountIndicator(oe.mode,F))}}z=U}for(let j=0;j<z.length;j++)B[z[j]].end=0;return{map:B,table:Y}}function W(k,F){let Y;const B=e.getBestModeForData(k);if(Y=e.from(F,B),Y!==e.BYTE&&Y.bit<B.bit)throw new Error('"'+k+'" cannot be encoded with mode '+e.toString(Y)+`.
118
- Suggested mode is: `+e.toString(B));switch(Y===e.KANJI&&!f.isKanjiModeEnabled()&&(Y=e.BYTE),Y){case e.NUMERIC:return new t(k);case e.ALPHANUMERIC:return new i(k);case e.KANJI:return new s(k);case e.BYTE:return new n(k)}}r.fromArray=function(F){return F.reduce(function(Y,B){return typeof B=="string"?Y.push(W(B,null)):B.data&&Y.push(W(B.data,B.mode)),Y},[])},r.fromString=function(F,Y){const B=w(F,f.isKanjiModeEnabled()),z=O(B),j=$(z,Y),_=h.find_path(j.map,"start","end"),U=[];for(let ee=1;ee<_.length-1;ee++)U.push(j.table[_[ee]].node);return r.fromArray(M(U))},r.rawSplit=function(F){return r.fromArray(w(F,f.isKanjiModeEnabled()))}}(Sw);const Oh=Ui,gp=Sh,kR=_R,HR=xR,jR=pw,WR=gw,vp=mw,mp=Ih,KR=ER,Rh=yw,VR=xw,GR=ro,bp=Sw;function YR(r,e){const t=r.size,i=WR.getPositions(e);for(let n=0;n<i.length;n++){const s=i[n][0],a=i[n][1];for(let f=-1;f<=7;f++)if(!(s+f<=-1||t<=s+f))for(let h=-1;h<=7;h++)a+h<=-1||t<=a+h||(f>=0&&f<=6&&(h===0||h===6)||h>=0&&h<=6&&(f===0||f===6)||f>=2&&f<=4&&h>=2&&h<=4?r.set(s+f,a+h,!0,!0):r.set(s+f,a+h,!1,!0))}}function JR(r){const e=r.size;for(let t=8;t<e-8;t++){const i=t%2===0;r.set(t,6,i,!0),r.set(6,t,i,!0)}}function QR(r,e){const t=jR.getPositions(e);for(let i=0;i<t.length;i++){const n=t[i][0],s=t[i][1];for(let a=-2;a<=2;a++)for(let f=-2;f<=2;f++)a===-2||a===2||f===-2||f===2||a===0&&f===0?r.set(n+a,s+f,!0,!0):r.set(n+a,s+f,!1,!0)}}function ZR(r,e){const t=r.size,i=Rh.getEncodedBits(e);let n,s,a;for(let f=0;f<18;f++)n=Math.floor(f/3),s=f%3+t-8-3,a=(i>>f&1)===1,r.set(n,s,a,!0),r.set(s,n,a,!0)}function wp(r,e,t){const i=r.size,n=VR.getEncodedBits(e,t);let s,a;for(s=0;s<15;s++)a=(n>>s&1)===1,s<6?r.set(s,8,a,!0):s<8?r.set(s+1,8,a,!0):r.set(i-15+s,8,a,!0),s<8?r.set(8,i-s-1,a,!0):s<9?r.set(8,15-s-1+1,a,!0):r.set(8,15-s-1,a,!0);r.set(i-8,8,1,!0)}function XR(r,e){const t=r.size;let i=-1,n=t-1,s=7,a=0;for(let f=t-1;f>0;f-=2)for(f===6&&f--;;){for(let h=0;h<2;h++)if(!r.isReserved(n,f-h)){let u=!1;a<e.length&&(u=(e[a]>>>s&1)===1),r.set(n,f-h,u),s--,s===-1&&(a++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function eT(r,e,t){const i=new kR;t.forEach(function(h){i.put(h.mode.bit,4),i.put(h.getLength(),GR.getCharCountIndicator(h.mode,r)),h.write(i)});const n=Oh.getSymbolTotalCodewords(r),s=mp.getTotalCodewordsCount(r,e),a=(n-s)*8;for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);const f=(a-i.getLengthInBits())/8;for(let h=0;h<f;h++)i.put(h%2?17:236,8);return tT(i,r,e)}function tT(r,e,t){const i=Oh.getSymbolTotalCodewords(e),n=mp.getTotalCodewordsCount(e,t),s=i-n,a=mp.getBlocksCount(e,t),f=i%a,h=a-f,u=Math.floor(i/a),g=Math.floor(s/a),w=g+1,P=u-g,M=new KR(P);let O=0;const $=new Array(a),W=new Array(a);let k=0;const F=new Uint8Array(r.buffer);for(let _=0;_<a;_++){const U=_<h?g:w;$[_]=F.slice(O,O+U),W[_]=M.encode($[_]),O+=U,k=Math.max(k,U)}const Y=new Uint8Array(i);let B=0,z,j;for(z=0;z<k;z++)for(j=0;j<a;j++)z<$[j].length&&(Y[B++]=$[j][z]);for(z=0;z<P;z++)for(j=0;j<a;j++)Y[B++]=W[j][z];return Y}function rT(r,e,t,i){let n;if(Array.isArray(r))n=bp.fromArray(r);else if(typeof r=="string"){let u=e;if(!u){const g=bp.rawSplit(r);u=Rh.getBestVersionForData(g,t)}n=bp.fromString(r,u||40)}else throw new Error("Invalid data");const s=Rh.getBestVersionForData(n,t);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
115
+ */const li=r=>r??Mr;var Ef={},yR=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},uw={},qi={};let lp;const _R=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];qi.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},qi.getSymbolTotalCodewords=function(e){return _R[e]},qi.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e},qi.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');lp=e},qi.isKanjiModeEnabled=function(){return typeof lp<"u"},qi.toSJIS=function(e){return lp(e)};var Sh={};(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+t)}}r.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},r.from=function(i,n){if(r.isValid(i))return i;try{return e(i)}catch{return n}}})(Sh);function dw(){this.buffer=[],this.length=0}dw.prototype={get:function(r){const e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var xR=dw;function Sf(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Sf.prototype.set=function(r,e,t,i){const n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)},Sf.prototype.get=function(r,e){return this.data[r*this.size+e]},Sf.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t},Sf.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};var AR=Sf,pw={};(function(r){const e=qi.getSymbolSize;r.getRowColCoords=function(i){if(i===1)return[];const n=Math.floor(i/7)+2,s=e(i),a=s===145?26:Math.ceil((s-13)/(2*n-2))*2,f=[s-7];for(let h=1;h<n-1;h++)f[h]=f[h-1]-a;return f.push(6),f.reverse()},r.getPositions=function(i){const n=[],s=r.getRowColCoords(i),a=s.length;for(let f=0;f<a;f++)for(let h=0;h<a;h++)f===0&&h===0||f===0&&h===a-1||f===a-1&&h===0||n.push([s[f],s[h]]);return n}})(pw);var gw={};const ER=qi.getSymbolSize,vw=7;gw.getPositions=function(e){const t=ER(e);return[[0,0],[t-vw,0],[0,t-vw]]};var mw={};(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};r.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},r.from=function(n){return r.isValid(n)?parseInt(n,10):void 0},r.getPenaltyN1=function(n){const s=n.size;let a=0,f=0,h=0,u=null,g=null;for(let w=0;w<s;w++){f=h=0,u=g=null;for(let P=0;P<s;P++){let M=n.get(w,P);M===u?f++:(f>=5&&(a+=e.N1+(f-5)),u=M,f=1),M=n.get(P,w),M===g?h++:(h>=5&&(a+=e.N1+(h-5)),g=M,h=1)}f>=5&&(a+=e.N1+(f-5)),h>=5&&(a+=e.N1+(h-5))}return a},r.getPenaltyN2=function(n){const s=n.size;let a=0;for(let f=0;f<s-1;f++)for(let h=0;h<s-1;h++){const u=n.get(f,h)+n.get(f,h+1)+n.get(f+1,h)+n.get(f+1,h+1);(u===4||u===0)&&a++}return a*e.N2},r.getPenaltyN3=function(n){const s=n.size;let a=0,f=0,h=0;for(let u=0;u<s;u++){f=h=0;for(let g=0;g<s;g++)f=f<<1&2047|n.get(u,g),g>=10&&(f===1488||f===93)&&a++,h=h<<1&2047|n.get(g,u),g>=10&&(h===1488||h===93)&&a++}return a*e.N3},r.getPenaltyN4=function(n){let s=0;const a=n.data.length;for(let h=0;h<a;h++)s+=n.data[h];return Math.abs(Math.ceil(s*100/a/5)-10)*e.N4};function t(i,n,s){switch(i){case r.Patterns.PATTERN000:return(n+s)%2===0;case r.Patterns.PATTERN001:return n%2===0;case r.Patterns.PATTERN010:return s%3===0;case r.Patterns.PATTERN011:return(n+s)%3===0;case r.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case r.Patterns.PATTERN101:return n*s%2+n*s%3===0;case r.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case r.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}r.applyMask=function(n,s){const a=s.size;for(let f=0;f<a;f++)for(let h=0;h<a;h++)s.isReserved(h,f)||s.xor(h,f,t(n,h,f))},r.getBestMask=function(n,s){const a=Object.keys(r.Patterns).length;let f=0,h=1/0;for(let u=0;u<a;u++){s(u),r.applyMask(u,n);const g=r.getPenaltyN1(n)+r.getPenaltyN2(n)+r.getPenaltyN3(n)+r.getPenaltyN4(n);r.applyMask(u,n),g<h&&(h=g,f=u)}return f}})(mw);var Ih={};const ro=Sh,Mh=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ch=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Ih.getBlocksCount=function(e,t){switch(t){case ro.L:return Mh[(e-1)*4+0];case ro.M:return Mh[(e-1)*4+1];case ro.Q:return Mh[(e-1)*4+2];case ro.H:return Mh[(e-1)*4+3];default:return}},Ih.getTotalCodewordsCount=function(e,t){switch(t){case ro.L:return Ch[(e-1)*4+0];case ro.M:return Ch[(e-1)*4+1];case ro.Q:return Ch[(e-1)*4+2];case ro.H:return Ch[(e-1)*4+3];default:return}};var bw={},Ph={};const If=new Uint8Array(512),Dh=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)If[t]=e,Dh[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)If[t]=If[t-255]})(),Ph.log=function(e){if(e<1)throw new Error("log("+e+")");return Dh[e]},Ph.exp=function(e){return If[e]},Ph.mul=function(e,t){return e===0||t===0?0:If[Dh[e]+Dh[t]]},function(r){const e=Ph;r.mul=function(i,n){const s=new Uint8Array(i.length+n.length-1);for(let a=0;a<i.length;a++)for(let f=0;f<n.length;f++)s[a+f]^=e.mul(i[a],n[f]);return s},r.mod=function(i,n){let s=new Uint8Array(i);for(;s.length-n.length>=0;){const a=s[0];for(let h=0;h<n.length;h++)s[h]^=e.mul(n[h],a);let f=0;for(;f<s.length&&s[f]===0;)f++;s=s.slice(f)}return s},r.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let s=0;s<i;s++)n=r.mul(n,new Uint8Array([1,e.exp(s)]));return n}}(bw);const ww=bw;function hp(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}hp.prototype.initialize=function(e){this.degree=e,this.genPoly=ww.generateECPolynomial(this.degree)},hp.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const i=ww.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){const s=new Uint8Array(this.degree);return s.set(i,n),s}return i};var SR=hp,yw={},io={},up={};up.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var os={};const _w="[0-9]+",IR="[A-Z $%*+\\-./:]+";let Mf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Mf=Mf.replace(/u/g,"\\u");const MR="(?:(?![A-Z0-9 $%*+\\-./:]|"+Mf+`)(?:.|[\r
116
+ ]))+`;os.KANJI=new RegExp(Mf,"g"),os.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),os.BYTE=new RegExp(MR,"g"),os.NUMERIC=new RegExp(_w,"g"),os.ALPHANUMERIC=new RegExp(IR,"g");const CR=new RegExp("^"+Mf+"$"),PR=new RegExp("^"+_w+"$"),DR=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");os.testKanji=function(e){return CR.test(e)},os.testNumeric=function(e){return PR.test(e)},os.testAlphanumeric=function(e){return DR.test(e)},function(r){const e=up,t=os;r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(s,a){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?s.ccBits[0]:a<27?s.ccBits[1]:s.ccBits[2]},r.getBestModeForData=function(s){return t.testNumeric(s)?r.NUMERIC:t.testAlphanumeric(s)?r.ALPHANUMERIC:t.testKanji(s)?r.KANJI:r.BYTE},r.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},r.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+n)}}r.from=function(s,a){if(r.isValid(s))return s;try{return i(s)}catch{return a}}}(io),function(r){const e=qi,t=Ih,i=Sh,n=io,s=up,a=7973,f=e.getBCHDigit(a);function h(P,M,O){for(let $=1;$<=40;$++)if(M<=r.getCapacity($,O,P))return $}function u(P,M){return n.getCharCountIndicator(P,M)+4}function g(P,M){let O=0;return P.forEach(function($){const W=u($.mode,M);O+=W+$.getBitsLength()}),O}function w(P,M){for(let O=1;O<=40;O++)if(g(P,O)<=r.getCapacity(O,M,n.MIXED))return O}r.from=function(M,O){return s.isValid(M)?parseInt(M,10):O},r.getCapacity=function(M,O,$){if(!s.isValid(M))throw new Error("Invalid QR Code version");typeof $>"u"&&($=n.BYTE);const W=e.getSymbolTotalCodewords(M),H=t.getTotalCodewordsCount(M,O),F=(W-H)*8;if($===n.MIXED)return F;const Y=F-u($,M);switch($){case n.NUMERIC:return Math.floor(Y/10*3);case n.ALPHANUMERIC:return Math.floor(Y/11*2);case n.KANJI:return Math.floor(Y/13);case n.BYTE:default:return Math.floor(Y/8)}},r.getBestVersionForData=function(M,O){let $;const W=i.from(O,i.M);if(Array.isArray(M)){if(M.length>1)return w(M,W);if(M.length===0)return 1;$=M[0]}else $=M;return h($.mode,$.getLength(),W)},r.getEncodedBits=function(M){if(!s.isValid(M)||M<7)throw new Error("Invalid QR Code version");let O=M<<12;for(;e.getBCHDigit(O)-f>=0;)O^=a<<e.getBCHDigit(O)-f;return M<<12|O}}(yw);var xw={};const dp=qi,Aw=1335,OR=21522,Ew=dp.getBCHDigit(Aw);xw.getEncodedBits=function(e,t){const i=e.bit<<3|t;let n=i<<10;for(;dp.getBCHDigit(n)-Ew>=0;)n^=Aw<<dp.getBCHDigit(n)-Ew;return(i<<10|n)^OR};var Sw={};const RR=io;function Xa(r){this.mode=RR.NUMERIC,this.data=r.toString()}Xa.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},Xa.prototype.getLength=function(){return this.data.length},Xa.prototype.getBitsLength=function(){return Xa.getBitsLength(this.data.length)},Xa.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);const s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};var TR=Xa;const $R=io,pp=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ec(r){this.mode=$R.ALPHANUMERIC,this.data=r}ec.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},ec.prototype.getLength=function(){return this.data.length},ec.prototype.getBitsLength=function(){return ec.getBitsLength(this.data.length)},ec.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=pp.indexOf(this.data[t])*45;i+=pp.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(pp.indexOf(this.data[t]),6)};var NR=ec,LR=function(e){for(var t=[],i=e.length,n=0;n<i;n++){var s=e.charCodeAt(n);if(s>=55296&&s<=56319&&i>n+1){var a=e.charCodeAt(n+1);a>=56320&&a<=57343&&(s=(s-55296)*1024+a-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer};const BR=LR,FR=io;function tc(r){this.mode=FR.BYTE,typeof r=="string"&&(r=BR(r)),this.data=new Uint8Array(r)}tc.getBitsLength=function(e){return e*8},tc.prototype.getLength=function(){return this.data.length},tc.prototype.getBitsLength=function(){return tc.getBitsLength(this.data.length)},tc.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)};var UR=tc;const qR=io,zR=qi;function rc(r){this.mode=qR.KANJI,this.data=r}rc.getBitsLength=function(e){return e*13},rc.prototype.getLength=function(){return this.data.length},rc.prototype.getBitsLength=function(){return rc.getBitsLength(this.data.length)},rc.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let t=zR.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
117
+ Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};var HR=rc,Iw={exports:{}};(function(r){var e={single_source_shortest_paths:function(t,i,n){var s={},a={};a[i]=0;var f=e.PriorityQueue.make();f.push(i,0);for(var h,u,g,w,P,M,O,$,W;!f.empty();){h=f.pop(),u=h.value,w=h.cost,P=t[u]||{};for(g in P)P.hasOwnProperty(g)&&(M=P[g],O=w+M,$=a[g],W=typeof a[g]>"u",(W||$>O)&&(a[g]=O,f.push(g,O),s[g]=u))}if(typeof n<"u"&&typeof a[n]>"u"){var H=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(H)}return s},extract_shortest_path_from_predecessor_list:function(t,i){for(var n=[],s=i;s;)n.push(s),t[s],s=t[s];return n.reverse(),n},find_path:function(t,i,n){var s=e.single_source_shortest_paths(t,i,n);return e.extract_shortest_path_from_predecessor_list(s,n)},PriorityQueue:{make:function(t){var i=e.PriorityQueue,n={},s;t=t||{};for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);return n.queue=[],n.sorter=t.sorter||i.default_sorter,n},default_sorter:function(t,i){return t.cost-i.cost},push:function(t,i){var n={value:t,cost:i};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=e})(Iw),function(r){const e=io,t=TR,i=NR,n=UR,s=HR,a=os,f=qi,h=Iw.exports;function u(H){return unescape(encodeURIComponent(H)).length}function g(H,F,Y){const B=[];let z;for(;(z=H.exec(Y))!==null;)B.push({data:z[0],index:z.index,mode:F,length:z[0].length});return B}function w(H){const F=g(a.NUMERIC,e.NUMERIC,H),Y=g(a.ALPHANUMERIC,e.ALPHANUMERIC,H);let B,z;return f.isKanjiModeEnabled()?(B=g(a.BYTE,e.BYTE,H),z=g(a.KANJI,e.KANJI,H)):(B=g(a.BYTE_KANJI,e.BYTE,H),z=[]),F.concat(Y,B,z).sort(function(_,U){return _.index-U.index}).map(function(_){return{data:_.data,mode:_.mode,length:_.length}})}function P(H,F){switch(F){case e.NUMERIC:return t.getBitsLength(H);case e.ALPHANUMERIC:return i.getBitsLength(H);case e.KANJI:return s.getBitsLength(H);case e.BYTE:return n.getBitsLength(H)}}function M(H){return H.reduce(function(F,Y){const B=F.length-1>=0?F[F.length-1]:null;return B&&B.mode===Y.mode?(F[F.length-1].data+=Y.data,F):(F.push(Y),F)},[])}function O(H){const F=[];for(let Y=0;Y<H.length;Y++){const B=H[Y];switch(B.mode){case e.NUMERIC:F.push([B,{data:B.data,mode:e.ALPHANUMERIC,length:B.length},{data:B.data,mode:e.BYTE,length:B.length}]);break;case e.ALPHANUMERIC:F.push([B,{data:B.data,mode:e.BYTE,length:B.length}]);break;case e.KANJI:F.push([B,{data:B.data,mode:e.BYTE,length:u(B.data)}]);break;case e.BYTE:F.push([{data:B.data,mode:e.BYTE,length:u(B.data)}])}}return F}function $(H,F){const Y={},B={start:{}};let z=["start"];for(let j=0;j<H.length;j++){const _=H[j],U=[];for(let ee=0;ee<_.length;ee++){const oe=_[ee],L=""+j+ee;U.push(L),Y[L]={node:oe,lastCount:0},B[L]={};for(let b=0;b<z.length;b++){const m=z[b];Y[m]&&Y[m].node.mode===oe.mode?(B[m][L]=P(Y[m].lastCount+oe.length,oe.mode)-P(Y[m].lastCount,oe.mode),Y[m].lastCount+=oe.length):(Y[m]&&(Y[m].lastCount=oe.length),B[m][L]=P(oe.length,oe.mode)+4+e.getCharCountIndicator(oe.mode,F))}}z=U}for(let j=0;j<z.length;j++)B[z[j]].end=0;return{map:B,table:Y}}function W(H,F){let Y;const B=e.getBestModeForData(H);if(Y=e.from(F,B),Y!==e.BYTE&&Y.bit<B.bit)throw new Error('"'+H+'" cannot be encoded with mode '+e.toString(Y)+`.
118
+ Suggested mode is: `+e.toString(B));switch(Y===e.KANJI&&!f.isKanjiModeEnabled()&&(Y=e.BYTE),Y){case e.NUMERIC:return new t(H);case e.ALPHANUMERIC:return new i(H);case e.KANJI:return new s(H);case e.BYTE:return new n(H)}}r.fromArray=function(F){return F.reduce(function(Y,B){return typeof B=="string"?Y.push(W(B,null)):B.data&&Y.push(W(B.data,B.mode)),Y},[])},r.fromString=function(F,Y){const B=w(F,f.isKanjiModeEnabled()),z=O(B),j=$(z,Y),_=h.find_path(j.map,"start","end"),U=[];for(let ee=1;ee<_.length-1;ee++)U.push(j.table[_[ee]].node);return r.fromArray(M(U))},r.rawSplit=function(F){return r.fromArray(w(F,f.isKanjiModeEnabled()))}}(Sw);const Oh=qi,gp=Sh,kR=xR,jR=AR,WR=pw,KR=gw,vp=mw,mp=Ih,VR=SR,Rh=yw,GR=xw,YR=io,bp=Sw;function JR(r,e){const t=r.size,i=KR.getPositions(e);for(let n=0;n<i.length;n++){const s=i[n][0],a=i[n][1];for(let f=-1;f<=7;f++)if(!(s+f<=-1||t<=s+f))for(let h=-1;h<=7;h++)a+h<=-1||t<=a+h||(f>=0&&f<=6&&(h===0||h===6)||h>=0&&h<=6&&(f===0||f===6)||f>=2&&f<=4&&h>=2&&h<=4?r.set(s+f,a+h,!0,!0):r.set(s+f,a+h,!1,!0))}}function QR(r){const e=r.size;for(let t=8;t<e-8;t++){const i=t%2===0;r.set(t,6,i,!0),r.set(6,t,i,!0)}}function ZR(r,e){const t=WR.getPositions(e);for(let i=0;i<t.length;i++){const n=t[i][0],s=t[i][1];for(let a=-2;a<=2;a++)for(let f=-2;f<=2;f++)a===-2||a===2||f===-2||f===2||a===0&&f===0?r.set(n+a,s+f,!0,!0):r.set(n+a,s+f,!1,!0)}}function XR(r,e){const t=r.size,i=Rh.getEncodedBits(e);let n,s,a;for(let f=0;f<18;f++)n=Math.floor(f/3),s=f%3+t-8-3,a=(i>>f&1)===1,r.set(n,s,a,!0),r.set(s,n,a,!0)}function wp(r,e,t){const i=r.size,n=GR.getEncodedBits(e,t);let s,a;for(s=0;s<15;s++)a=(n>>s&1)===1,s<6?r.set(s,8,a,!0):s<8?r.set(s+1,8,a,!0):r.set(i-15+s,8,a,!0),s<8?r.set(8,i-s-1,a,!0):s<9?r.set(8,15-s-1+1,a,!0):r.set(8,15-s-1,a,!0);r.set(i-8,8,1,!0)}function eT(r,e){const t=r.size;let i=-1,n=t-1,s=7,a=0;for(let f=t-1;f>0;f-=2)for(f===6&&f--;;){for(let h=0;h<2;h++)if(!r.isReserved(n,f-h)){let u=!1;a<e.length&&(u=(e[a]>>>s&1)===1),r.set(n,f-h,u),s--,s===-1&&(a++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function tT(r,e,t){const i=new kR;t.forEach(function(h){i.put(h.mode.bit,4),i.put(h.getLength(),YR.getCharCountIndicator(h.mode,r)),h.write(i)});const n=Oh.getSymbolTotalCodewords(r),s=mp.getTotalCodewordsCount(r,e),a=(n-s)*8;for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);const f=(a-i.getLengthInBits())/8;for(let h=0;h<f;h++)i.put(h%2?17:236,8);return rT(i,r,e)}function rT(r,e,t){const i=Oh.getSymbolTotalCodewords(e),n=mp.getTotalCodewordsCount(e,t),s=i-n,a=mp.getBlocksCount(e,t),f=i%a,h=a-f,u=Math.floor(i/a),g=Math.floor(s/a),w=g+1,P=u-g,M=new VR(P);let O=0;const $=new Array(a),W=new Array(a);let H=0;const F=new Uint8Array(r.buffer);for(let _=0;_<a;_++){const U=_<h?g:w;$[_]=F.slice(O,O+U),W[_]=M.encode($[_]),O+=U,H=Math.max(H,U)}const Y=new Uint8Array(i);let B=0,z,j;for(z=0;z<H;z++)for(j=0;j<a;j++)z<$[j].length&&(Y[B++]=$[j][z]);for(z=0;z<P;z++)for(j=0;j<a;j++)Y[B++]=W[j][z];return Y}function iT(r,e,t,i){let n;if(Array.isArray(r))n=bp.fromArray(r);else if(typeof r=="string"){let u=e;if(!u){const g=bp.rawSplit(r);u=Rh.getBestVersionForData(g,t)}n=bp.fromString(r,u||40)}else throw new Error("Invalid data");const s=Rh.getBestVersionForData(n,t);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
119
119
  The chosen QR Code version cannot contain this amount of data.
120
120
  Minimum version required to store current data is: `+s+`.
121
- `);const a=eT(e,t,n),f=Oh.getSymbolSize(e),h=new HR(f);return YR(h,e),JR(h),QR(h,e),wp(h,t,0),e>=7&&ZR(h,e),XR(h,a),isNaN(i)&&(i=vp.getBestMask(h,wp.bind(null,h,t))),vp.applyMask(i,h),wp(h,t,i),{modules:h,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}uw.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=gp.M,n,s;return typeof t<"u"&&(i=gp.from(t.errorCorrectionLevel,gp.M),n=Rh.from(t.version),s=vp.from(t.maskPattern),t.toSJISFunc&&Oh.setToSJISFunction(t.toSJISFunc)),rT(e,n,i,s)};var Mw={},yp={};(function(r){function e(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let i=t.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+t);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(s){return[s,s]}))),i.length===6&&i.push("F","F");const n=parseInt(i.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+i.slice(0,6).join("")}}r.getOptions=function(i){i||(i={}),i.color||(i.color={});const n=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,s=i.width&&i.width>=21?i.width:void 0,a=i.scale||4;return{width:s,scale:s?4:a,margin:n,color:{dark:e(i.color.dark||"#000000ff"),light:e(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},r.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},r.getImageWidth=function(i,n){const s=r.getScale(i,n);return Math.floor((i+n.margin*2)*s)},r.qrToImageData=function(i,n,s){const a=n.modules.size,f=n.modules.data,h=r.getScale(a,s),u=Math.floor((a+s.margin*2)*h),g=s.margin*h,w=[s.color.light,s.color.dark];for(let P=0;P<u;P++)for(let M=0;M<u;M++){let O=(P*u+M)*4,$=s.color.light;if(P>=g&&M>=g&&P<u-g&&M<u-g){const W=Math.floor((P-g)/h),k=Math.floor((M-g)/h);$=w[f[W*a+k]?1:0]}i[O++]=$.r,i[O++]=$.g,i[O++]=$.b,i[O]=$.a}}})(yp),function(r){const e=yp;function t(n,s,a){n.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=a,s.width=a,s.style.height=a+"px",s.style.width=a+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}r.render=function(s,a,f){let h=f,u=a;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),a||(u=i()),h=e.getOptions(h);const g=e.getImageWidth(s.modules.size,h),w=u.getContext("2d"),P=w.createImageData(g,g);return e.qrToImageData(P.data,s,h),t(w,u,g),w.putImageData(P,0,0),u},r.renderToDataURL=function(s,a,f){let h=f;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),h||(h={});const u=r.render(s,a,h),g=h.type||"image/png",w=h.rendererOpts||{};return u.toDataURL(g,w.quality)}}(Mw);var Cw={};const iT=yp;function Pw(r,e){const t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function _p(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function nT(r,e,t){let i="",n=0,s=!1,a=0;for(let f=0;f<r.length;f++){const h=Math.floor(f%e),u=Math.floor(f/e);!h&&!s&&(s=!0),r[f]?(a++,f>0&&h>0&&r[f-1]||(i+=s?_p("M",h+t,.5+u+t):_p("m",n,0),n=0,s=!1),h+1<e&&r[f+1]||(i+=_p("h",a),a=0)):n++}return i}Cw.render=function(e,t,i){const n=iT.getOptions(t),s=e.modules.size,a=e.modules.data,f=s+n.margin*2,h=n.color.light.a?"<path "+Pw(n.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",u="<path "+Pw(n.color.dark,"stroke")+' d="'+nT(a,s,n.margin)+'"/>',g='viewBox="0 0 '+f+" "+f+'"',P='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+g+' shape-rendering="crispEdges">'+h+u+`</svg>
122
- `;return typeof i=="function"&&i(null,P),P};const sT=wR,xp=uw,Dw=Mw,oT=Cw;function Ap(r,e,t,i,n){const s=[].slice.call(arguments,1),a=s.length,f=typeof s[a-1]=="function";if(!f&&!sT())throw new Error("Callback required as last argument");if(f){if(a<2)throw new Error("Too few arguments provided");a===2?(n=t,t=e,e=i=void 0):a===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(t=e,e=i=void 0):a===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(h,u){try{const g=xp.create(t,i);h(r(g,e,i))}catch(g){u(g)}})}try{const h=xp.create(t,i);n(null,r(h,e,i))}catch(h){n(h)}}Ef.create=xp.create,Ef.toCanvas=Ap.bind(null,Dw.render),Ef.toDataURL=Ap.bind(null,Dw.renderToDataURL),Ef.toString=Ap.bind(null,function(r,e,t){return oT.render(r,t)});var aT=Object.defineProperty,Ow=Object.getOwnPropertySymbols,cT=Object.prototype.hasOwnProperty,fT=Object.prototype.propertyIsEnumerable,Rw=(r,e,t)=>e in r?aT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ep=(r,e)=>{for(var t in e||(e={}))cT.call(e,t)&&Rw(r,t,e[t]);if(Ow)for(var t of Ow(e))fT.call(e,t)&&Rw(r,t,e[t]);return r};function lT(){var r;const e=(r=Qs.state.themeMode)!=null?r:"dark",i={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":i.foreground[1],"--wcm-color-fg-2":i.foreground[2],"--wcm-color-fg-3":i.foreground[3],"--wcm-color-bg-1":i.background[1],"--wcm-color-bg-2":i.background[2],"--wcm-color-bg-3":i.background[3],"--wcm-color-overlay":i.overlay}}function Tw(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const Lt={getPreset(r){return Tw()[r]},setTheme(){const r=document.querySelector(":root"),{themeVariables:e}=Qs.state;if(r){const t=Ep(Ep(Ep({},lT()),Tw()),e);Object.entries(t).forEach(([i,n])=>r.style.setProperty(i,n))}},globalCss:Ht`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},hT=Ht`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var uT=Object.defineProperty,dT=Object.getOwnPropertyDescriptor,ic=(r,e,t,i)=>{for(var n=i>1?void 0:i?dT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&uT(e,t,n),n};let io=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const r={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),Ee`<button class="${Es(r)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};io.styles=[Lt.globalCss,hT],ic([At({type:Boolean})],io.prototype,"disabled",2),ic([At()],io.prototype,"iconLeft",2),ic([At()],io.prototype,"iconRight",2),ic([At()],io.prototype,"onClick",2),ic([At()],io.prototype,"variant",2),io=ic([Ut("wcm-button")],io);const pT=Ht`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var gT=Object.defineProperty,vT=Object.getOwnPropertyDescriptor,Sp=(r,e,t,i)=>{for(var n=i>1?void 0:i?vT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&gT(e,t,n),n};let Cf=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const r={"wcm-secondary":this.variant==="secondary"};return Ee`<button ?disabled="${this.disabled}" class="${Es(r)}"><slot></slot></button>`}};Cf.styles=[Lt.globalCss,pT],Sp([At({type:Boolean})],Cf.prototype,"disabled",2),Sp([At()],Cf.prototype,"variant",2),Cf=Sp([Ut("wcm-button-big")],Cf);const mT=Ht`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var bT=Object.defineProperty,wT=Object.getOwnPropertyDescriptor,yT=(r,e,t,i)=>{for(var n=i>1?void 0:i?wT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&bT(e,t,n),n};let Ip=class extends Ct{render(){return Ee`<div><slot></slot></div>`}};Ip.styles=[Lt.globalCss,mT],Ip=yT([Ut("wcm-info-footer")],Ip);const Kt={CROSS_ICON:gr`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:gr`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:gr`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:gr`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:gr`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:gr`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:gr`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:gr`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:gr`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:gr`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:gr`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:gr`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:gr`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:gr`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:gr`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:gr`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},_T=Ht`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var xT=Object.defineProperty,AT=Object.getOwnPropertyDescriptor,ET=(r,e,t,i)=>{for(var n=i>1?void 0:i?AT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&xT(e,t,n),n};let Mp=class extends Ct{render(){return Ee`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Kt.WALLET_CONNECT_LOGO} <button @click="${jo.close}">${Kt.CROSS_ICON}</button></div>`}};Mp.styles=[Lt.globalCss,_T],Mp=ET([Ut("wcm-modal-backcard")],Mp);const ST=Ht`main{padding:20px;padding-top:0;width:100%}`;var IT=Object.defineProperty,MT=Object.getOwnPropertyDescriptor,CT=(r,e,t,i)=>{for(var n=i>1?void 0:i?MT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&IT(e,t,n),n};let Cp=class extends Ct{render(){return Ee`<main><slot></slot></main>`}};Cp.styles=[Lt.globalCss,ST],Cp=CT([Ut("wcm-modal-content")],Cp);const PT=Ht`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var DT=Object.defineProperty,OT=Object.getOwnPropertyDescriptor,RT=(r,e,t,i)=>{for(var n=i>1?void 0:i?OT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&DT(e,t,n),n};let Pp=class extends Ct{render(){return Ee`<footer><slot></slot></footer>`}};Pp.styles=[Lt.globalCss,PT],Pp=RT([Ut("wcm-modal-footer")],Pp);const TT=Ht`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var $T=Object.defineProperty,NT=Object.getOwnPropertyDescriptor,Pf=(r,e,t,i)=>{for(var n=i>1?void 0:i?NT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&$T(e,t,n),n};let Zo=class extends Ct{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return Ee`<button class="wcm-back-btn" @click="${lr.goBack}">${Kt.BACK_ICON}</button>`}actionBtnTemplate(){return Ee`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const r={"wcm-border":this.border},e=lr.state.history.length>1,t=this.title?Ee`<wcm-text variant="big-bold">${this.title}</wcm-text>`:Ee`<slot></slot>`;return Ee`<header class="${Es(r)}">${e?this.backBtnTemplate():null} ${t} ${this.onAction?this.actionBtnTemplate():null}</header>`}};Zo.styles=[Lt.globalCss,TT],Pf([At()],Zo.prototype,"title",2),Pf([At()],Zo.prototype,"onAction",2),Pf([At()],Zo.prototype,"actionIcon",2),Pf([At({type:Boolean})],Zo.prototype,"border",2),Zo=Pf([Ut("wcm-modal-header")],Zo);const pt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(r,e){const t=r.renderRoot.querySelector(e);if(!t)throw new Error(`${e} not found`);return t},getWalletIcon({id:r,image_id:e}){const{walletImages:t}=Fi.state;return t?.[r]?t[r]:e?_i.getWalletImageUrl(e):""},getWalletName(r,e=!1){return e&&r.length>8?`${r.substring(0,8)}..`:r},isMobileAnimation(){return window.innerWidth<=pt.MOBILE_BREAKPOINT},async preloadImage(r){const e=new Promise((t,i)=>{const n=new Image;n.onload=t,n.onerror=i,n.crossOrigin="anonymous",n.src=r});return Promise.race([e,je.wait(3e3)])},getErrorMessage(r){return r instanceof Error?r.message:"Unknown Error"},debounce(r,e=500){let t;return(...i)=>{function n(){r(...i)}t&&clearTimeout(t),t=setTimeout(n,e)}},handleMobileLinking(r,e="_self"){const{walletConnectUri:t}=yr.state,{mobile:i,name:n}=r,s=i?.native,a=i?.universal;pt.setRecentWallet(r);function f(h){if(s){const u=je.formatNativeUrl(s,h,n);je.openHref(u,e)}else if(a){const u=je.formatUniversalUrl(a,h,n);je.openHref(u,e)}}t&&f(t)},handleAndroidLinking(){const{walletConnectUri:r}=yr.state;r&&(je.setWalletConnectAndroidDeepLink(r),je.openHref(r,je.isTelegram()?"_blank":"_self"))},async handleUriCopy(){const{walletConnectUri:r}=yr.state;if(r)try{await navigator.clipboard.writeText(r),Zs.openToast("Link copied","success")}catch{Zs.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:r}=Fi.state,e=Object.values(r??{});return Object.values(e)},truncate(r,e=8){return r.length<=e?r:`${r.substring(0,4)}...${r.substring(r.length-4)}`},setRecentWallet(r){try{localStorage.setItem(pt.WCM_RECENT_WALLET_DATA,JSON.stringify(r))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const r=localStorage.getItem(pt.WCM_RECENT_WALLET_DATA);return r?JSON.parse(r):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(r,e){return r.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){je.openHref(pt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:r,mobile:e}=je.getWalletRouterData(),t=!!r?.native,i=!!r?.universal,n=!!e?.native||!!e?.universal;return{isDesktop:t,isMobile:n,isWeb:i}},goToConnectingView(r){lr.setData({Wallet:r});const e=je.isMobile(),{isDesktop:t,isWeb:i,isMobile:n}=pt.getCachedRouterWalletPlatforms();e?n?(lr.push("MobileConnecting"),!je.isAndroid()&&je.isTelegram()&&this.handleMobileLinking(r,"_blank")):i?lr.push("WebConnecting"):lr.push("InstallWallet"):t?lr.push("DesktopConnecting"):i?lr.push("WebConnecting"):n?lr.push("MobileQrcodeConnecting"):lr.push("InstallWallet")}},LT=Ht`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var BT=Object.defineProperty,FT=Object.getOwnPropertyDescriptor,Dp=(r,e,t,i)=>{for(var n=i>1?void 0:i?FT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&BT(e,t,n),n};let Df=class extends Ct{constructor(){super(),this.view=lr.state.view,this.prevView=lr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=lr.subscribe(r=>{this.view!==r.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([r])=>{const e=`${r.contentRect.height}px`;this.oldHeight!=="0px"&&Qo(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var r,e;(r=this.unsubscribe)==null||r.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return pt.getShadowRootElement(this,".wcm-router")}get contentEl(){return pt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return Ee`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return Ee`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return Ee`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return Ee`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return Ee`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return Ee`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return Ee`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return Ee`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return Ee`<div>Not Found</div>`}}async onChangeRoute(){await Qo(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=lr.state.view,Qo(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return Ee`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Df.styles=[Lt.globalCss,LT],Dp([xi()],Df.prototype,"view",2),Dp([xi()],Df.prototype,"prevView",2),Df=Dp([Ut("wcm-modal-router")],Df);const UT=Ht`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var qT=Object.defineProperty,zT=Object.getOwnPropertyDescriptor,$w=(r,e,t,i)=>{for(var n=i>1?void 0:i?zT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&qT(e,t,n),n};let Th=class extends Ct{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=Zs.subscribe(r=>{r.open?(this.open=!0,this.timeout=setTimeout(()=>Zs.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var r;(r=this.unsubscribe)==null||r.call(this),clearTimeout(this.timeout),Zs.closeToast()}render(){const{message:r,variant:e}=Zs.state,t={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?Ee`<div class="${Es(t)}">${e==="success"?Kt.CHECKMARK_ICON:null} ${e==="error"?Kt.CROSS_ICON:null}<wcm-text variant="small-regular">${r}</wcm-text></div>`:null}};Th.styles=[Lt.globalCss,UT],$w([xi()],Th.prototype,"open",2),Th=$w([Ut("wcm-modal-toast")],Th);const kT=.1,Nw=2.5,Ss=7;function Op(r,e,t){return r===e?!1:(r-e<0?e-r:r-e)<=t+kT}function HT(r,e){const t=Array.prototype.slice.call(Ef.create(r,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(t.length);return t.reduce((n,s,a)=>(a%i===0?n.push([s]):n[n.length-1].push(s))&&n,[])}const jT={generate(r,e,t){const i="#141414",n="#ffffff",s=[],a=HT(r,"Q"),f=e/a.length,h=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];h.forEach(({x:O,y:$})=>{const W=(a.length-Ss)*f*O,k=(a.length-Ss)*f*$,F=.45;for(let Y=0;Y<h.length;Y+=1){const B=f*(Ss-Y*2);s.push(gr`<rect fill="${Y%2===0?i:n}" height="${B}" rx="${B*F}" ry="${B*F}" width="${B}" x="${W+f*Y}" y="${k+f*Y}">`)}});const u=Math.floor((t+25)/f),g=a.length/2-u/2,w=a.length/2+u/2-1,P=[];a.forEach((O,$)=>{O.forEach((W,k)=>{if(a[$][k]&&!($<Ss&&k<Ss||$>a.length-(Ss+1)&&k<Ss||$<Ss&&k>a.length-(Ss+1))&&!($>g&&$<w&&k>g&&k<w)){const F=$*f+f/2,Y=k*f+f/2;P.push([F,Y])}})});const M={};return P.forEach(([O,$])=>{M[O]?M[O].push($):M[O]=[$]}),Object.entries(M).map(([O,$])=>{const W=$.filter(k=>$.every(F=>!Op(k,F,f)));return[Number(O),W]}).forEach(([O,$])=>{$.forEach(W=>{s.push(gr`<circle cx="${O}" cy="${W}" fill="${i}" r="${f/Nw}">`)})}),Object.entries(M).filter(([O,$])=>$.length>1).map(([O,$])=>{const W=$.filter(k=>$.some(F=>Op(k,F,f)));return[Number(O),W]}).map(([O,$])=>{$.sort((k,F)=>k<F?-1:1);const W=[];for(const k of $){const F=W.find(Y=>Y.some(B=>Op(k,B,f)));F?F.push(k):W.push([k])}return[O,W.map(k=>[k[0],k[k.length-1]])]}).forEach(([O,$])=>{$.forEach(([W,k])=>{s.push(gr`<line x1="${O}" x2="${O}" y1="${W}" y2="${k}" stroke="${i}" stroke-width="${f/(Nw/2)}" stroke-linecap="round">`)})}),s}},WT=Ht`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var KT=Object.defineProperty,VT=Object.getOwnPropertyDescriptor,nc=(r,e,t,i)=>{for(var n=i>1?void 0:i?VT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&KT(e,t,n),n};let Is=class extends Ct{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e=Qs.state.themeMode==="light"?this.size:this.size-18*2;return gr`<svg height="${e}" width="${e}">${jT.generate(this.uri,e,e/4)}</svg>`}render(){const r={"wcm-dark":Qs.state.themeMode==="dark"};return Ee`<div style="${`width: ${this.size}px`}" class="${Es(r)}">${this.walletId||this.imageUrl?Ee`<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}" imageUrl="${li(this.imageUrl)}"></wcm-wallet-image>`:Kt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Is.styles=[Lt.globalCss,WT],nc([At()],Is.prototype,"uri",2),nc([At({type:Number})],Is.prototype,"size",2),nc([At()],Is.prototype,"imageId",2),nc([At()],Is.prototype,"walletId",2),nc([At()],Is.prototype,"imageUrl",2),Is=nc([Ut("wcm-qrcode")],Is);const GT=Ht`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var YT=Object.defineProperty,JT=Object.getOwnPropertyDescriptor,Lw=(r,e,t,i)=>{for(var n=i>1?void 0:i?JT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&YT(e,t,n),n};let $h=class extends Ct{constructor(){super(...arguments),this.onChange=()=>null}render(){return Ee`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Kt.SEARCH_ICON}`}};$h.styles=[Lt.globalCss,GT],Lw([At()],$h.prototype,"onChange",2),$h=Lw([Ut("wcm-search-input")],$h);const QT=Ht`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var ZT=Object.defineProperty,XT=Object.getOwnPropertyDescriptor,e$=(r,e,t,i)=>{for(var n=i>1?void 0:i?XT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&ZT(e,t,n),n};let Rp=class extends Ct{render(){return Ee`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Rp.styles=[Lt.globalCss,QT],Rp=e$([Ut("wcm-spinner")],Rp);const t$=Ht`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var r$=Object.defineProperty,i$=Object.getOwnPropertyDescriptor,Tp=(r,e,t,i)=>{for(var n=i>1?void 0:i?i$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&r$(e,t,n),n};let Of=class extends Ct{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const r={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return Ee`<span><slot class="${Es(r)}"></slot></span>`}};Of.styles=[Lt.globalCss,t$],Tp([At()],Of.prototype,"variant",2),Tp([At()],Of.prototype,"color",2),Of=Tp([Ut("wcm-text")],Of);const n$=Ht`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var s$=Object.defineProperty,o$=Object.getOwnPropertyDescriptor,no=(r,e,t,i)=>{for(var n=i>1?void 0:i?o$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&s$(e,t,n),n};let as=class extends Ct{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?Ee`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?Ee`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){y3.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var r;return Ee`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${li(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(r=this.label)!=null?r:pt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};as.styles=[Lt.globalCss,n$],no([At()],as.prototype,"onClick",2),no([At()],as.prototype,"name",2),no([At()],as.prototype,"walletId",2),no([At()],as.prototype,"label",2),no([At()],as.prototype,"imageId",2),no([At({type:Boolean})],as.prototype,"installed",2),no([At({type:Boolean})],as.prototype,"recent",2),as=no([Ut("wcm-wallet-button")],as);const a$=Ht`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var c$=Object.defineProperty,f$=Object.getOwnPropertyDescriptor,Nh=(r,e,t,i)=>{for(var n=i>1?void 0:i?f$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&c$(e,t,n),n};let sc=class extends Ct{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var r;const e=(r=this.imageUrl)!=null&&r.length?this.imageUrl:pt.getWalletIcon({id:this.walletId,image_id:this.imageId});return Ee`${e.length?Ee`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Kt.WALLET_PLACEHOLDER}`}};sc.styles=[Lt.globalCss,a$],Nh([At()],sc.prototype,"walletId",2),Nh([At()],sc.prototype,"imageId",2),Nh([At()],sc.prototype,"imageUrl",2),sc=Nh([Ut("wcm-wallet-image")],sc);var l$=Object.defineProperty,h$=Object.getOwnPropertyDescriptor,Bw=(r,e,t,i)=>{for(var n=i>1?void 0:i?h$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&l$(e,t,n),n};let $p=class extends Ct{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(r){try{r?.length&&await Promise.all(r.map(async e=>pt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",r)}}async preloadListings(){if(Fi.state.enableExplorer){await _i.getRecomendedWallets(),yr.setIsDataLoaded(!0);const{recomendedWallets:r}=_i.state,e=r.map(t=>pt.getWalletIcon(t));await this.loadImages(e)}else yr.setIsDataLoaded(!0)}async preloadCustomImages(){const r=pt.getCustomImageUrls();await this.loadImages(r)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(r){console.error(r),Zs.openToast("Failed preloading","error")}}};Bw([xi()],$p.prototype,"preload",2),$p=Bw([Ut("wcm-explorer-context")],$p);var u$=Object.defineProperty,d$=Object.getOwnPropertyDescriptor,p$=(r,e,t,i)=>{for(var n=i>1?void 0:i?d$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&u$(e,t,n),n};let Fw=class extends Ct{constructor(){super(),this.unsubscribeTheme=void 0,Lt.setTheme(),this.unsubscribeTheme=Qs.subscribe(Lt.setTheme)}disconnectedCallback(){var r;(r=this.unsubscribeTheme)==null||r.call(this)}};Fw=p$([Ut("wcm-theme-context")],Fw);const g$=Ht`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var v$=Object.defineProperty,m$=Object.getOwnPropertyDescriptor,b$=(r,e,t,i)=>{for(var n=i>1?void 0:i?m$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&v$(e,t,n),n};let Np=class extends Ct{onGoToQrcode(){lr.push("Qrcode")}render(){const{recomendedWallets:r}=_i.state,e=[...r,...r],t=je.RECOMMENDED_WALLET_AMOUNT*2;return Ee`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(t)].map((i,n)=>{const s=e[n%e.length];return s?Ee`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Kt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${pt.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Np.styles=[Lt.globalCss,g$],Np=b$([Ut("wcm-android-wallet-selection")],Np);const w$=Ht`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var y$=Object.defineProperty,_$=Object.getOwnPropertyDescriptor,oc=(r,e,t,i)=>{for(var n=i>1?void 0:i?_$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&y$(e,t,n),n};let so=class extends Ct{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var r,e;const s=(e=(r=Qs.state.themeVariables)==null?void 0:r["--wcm-wallet-icon-large-border-radius"])!=null?e:Lt.getPreset("--wcm-wallet-icon-large-border-radius");let a=0;s.includes("%")?a=88/100*parseInt(s,10):a=parseInt(s,10),a*=1.17;const f=317-a*1.57,h=425-a*1.8;return Ee`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${a}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${f}" stroke-dashoffset="${h}"></use></svg>`}render(){const r={"wcm-error":this.isError,"wcm-stale":this.isStale};return Ee`<div class="${Es(r)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};so.styles=[Lt.globalCss,w$],oc([At()],so.prototype,"walletId",2),oc([At()],so.prototype,"imageId",2),oc([At({type:Boolean})],so.prototype,"isError",2),oc([At({type:Boolean})],so.prototype,"isStale",2),oc([At()],so.prototype,"label",2),so=oc([Ut("wcm-connector-waiting")],so);const ac={manualWallets(){var r,e;const{mobileWallets:t,desktopWallets:i}=Fi.state,n=(r=ac.recentWallet())==null?void 0:r.id,s=je.isMobile()?t:i,a=s?.filter(f=>n!==f.id);return(e=je.isMobile()?a?.map(({id:f,name:h,links:u})=>({id:f,name:h,mobile:u,links:u})):a?.map(({id:f,name:h,links:u})=>({id:f,name:h,desktop:u,links:u})))!=null?e:[]},recentWallet(){return pt.getRecentWallet()},recomendedWallets(r=!1){var e;const t=r||(e=ac.recentWallet())==null?void 0:e.id,{recomendedWallets:i}=_i.state;return i.filter(s=>t!==s.id)}},oo={onConnecting(r){pt.goToConnectingView(r)},manualWalletsTemplate(){return ac.manualWallets().map(e=>Ee`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(r=!1){return ac.recomendedWallets(r).map(t=>Ee`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${t.image_id}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recentWalletTemplate(){const r=ac.recentWallet();if(r)return Ee`<wcm-wallet-button name="${r.name}" walletId="${r.id}" imageId="${li(r.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`}},x$=Ht`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var A$=Object.defineProperty,E$=Object.getOwnPropertyDescriptor,S$=(r,e,t,i)=>{for(var n=i>1?void 0:i?E$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&A$(e,t,n),n};let Lp=class extends Ct{render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Fi.state,t=r!=="ALL"&&e,i=oo.manualWalletsTemplate(),n=oo.recomendedWalletsTemplate();let a=[oo.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>4||t;let h=[];f?h=a.slice(0,3):h=a;const u=!!h.length;return Ee`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Kt.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${u?Ee`<wcm-modal-footer><div class="wcm-desktop-title">${Kt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${h} ${f?Ee`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Lp.styles=[Lt.globalCss,x$],Lp=S$([Ut("wcm-desktop-wallet-selection")],Lp);const I$=Ht`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var M$=Object.defineProperty,C$=Object.getOwnPropertyDescriptor,P$=(r,e,t,i)=>{for(var n=i>1?void 0:i?C$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&M$(e,t,n),n};let Bp=class extends Ct{render(){const{termsOfServiceUrl:r,privacyPolicyUrl:e}=Fi.state;return r??e?Ee`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${r?Ee`<a href="${r}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${r&&e?"and":null} ${e?Ee`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Bp.styles=[Lt.globalCss,I$],Bp=P$([Ut("wcm-legal-notice")],Bp);const D$=Ht`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var O$=Object.defineProperty,R$=Object.getOwnPropertyDescriptor,T$=(r,e,t,i)=>{for(var n=i>1?void 0:i?R$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&O$(e,t,n),n};let Fp=class extends Ct{onQrcode(){lr.push("Qrcode")}render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Fi.state,t=r!=="ALL"&&e,i=oo.manualWalletsTemplate(),n=oo.recomendedWalletsTemplate();let a=[oo.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>8||t;let h=[];f?h=a.slice(0,7):h=a;const u=!!h.length;return Ee`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header>${u?Ee`<wcm-modal-content><div>${h} ${f?Ee`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Fp.styles=[Lt.globalCss,D$],Fp=T$([Ut("wcm-mobile-wallet-selection")],Fp);const $$=Ht`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var N$=Object.defineProperty,L$=Object.getOwnPropertyDescriptor,Up=(r,e,t,i)=>{for(var n=i>1?void 0:i?L$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&N$(e,t,n),n};let cc=class extends Ct{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=jo.subscribe(r=>{r.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var r;(r=this.unsubscribeModal)==null||r.call(this)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return pt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(r){if(document.querySelector("body"))if(r){const t=document.getElementById("wcm-styles");t?.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(r){r.target===r.currentTarget&&jo.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const r=pt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,t=.2;await Promise.all([Qo(this.overlayEl,{opacity:[0,1]},{delay:e,duration:t}).finished,Qo(this.containerEl,r,{delay:e,duration:t}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const r=pt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([Qo(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,Qo(this.containerEl,r,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",r=>{var e;r.key==="Escape"?jo.close():r.key==="Tab"&&((e=r.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var r;(r=this.abortController)==null||r.abort(),this.abortController=void 0}render(){const r={"wcm-overlay":!0,"wcm-active":this.active};return Ee`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Es(r)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?Ee`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};cc.styles=[Lt.globalCss,$$],Up([xi()],cc.prototype,"open",2),Up([xi()],cc.prototype,"active",2),cc=Up([Ut("wcm-modal")],cc);const B$=Ht`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var F$=Object.defineProperty,U$=Object.getOwnPropertyDescriptor,Rf=(r,e,t,i)=>{for(var n=i>1?void 0:i?U$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&F$(e,t,n),n};let Xo=class extends Ct{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){je.isMobile()?lr.replace("MobileConnecting"):lr.replace("MobileQrcodeConnecting")}onDesktop(){lr.replace("DesktopConnecting")}onWeb(){lr.replace("WebConnecting")}render(){return Ee`<div>${this.isRetry?Ee`<slot></slot>`:null} ${this.isMobile?Ee`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Kt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?Ee`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Kt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?Ee`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Kt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};Xo.styles=[Lt.globalCss,B$],Rf([At({type:Boolean})],Xo.prototype,"isMobile",2),Rf([At({type:Boolean})],Xo.prototype,"isDesktop",2),Rf([At({type:Boolean})],Xo.prototype,"isWeb",2),Rf([At({type:Boolean})],Xo.prototype,"isRetry",2),Xo=Rf([Ut("wcm-platform-selection")],Xo);const q$=Ht`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var z$=Object.defineProperty,k$=Object.getOwnPropertyDescriptor,H$=(r,e,t,i)=>{for(var n=i>1?void 0:i?k$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&z$(e,t,n),n};let qp=class extends Ct{onClick(){lr.push("WalletExplorer")}render(){const{recomendedWallets:r}=_i.state,e=ac.manualWallets(),t=[...r,...e].reverse().slice(0,4);return Ee`<button @click="${this.onClick}"><div class="wcm-icons">${t.map(i=>{const n=pt.getWalletIcon(i);if(n)return Ee`<img crossorigin="anonymous" src="${n}">`;const s=pt.getWalletIcon({id:i.id});return s?Ee`<img crossorigin="anonymous" src="${s}">`:Kt.WALLET_PLACEHOLDER})} ${[...Array(4-t.length)].map(()=>Kt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};qp.styles=[Lt.globalCss,q$],qp=H$([Ut("wcm-view-all-wallets-button")],qp);const j$=Ht`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var W$=Object.defineProperty,K$=Object.getOwnPropertyDescriptor,Lh=(r,e,t,i)=>{for(var n=i>1?void 0:i?K$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&W$(e,t,n),n};let fc=class extends Ct{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:r}=yr.state;this.uri=r},0)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-qr-container")}render(){return Ee`<div class="wcm-qr-container">${this.uri?Ee`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-qrcode>`:Ee`<wcm-spinner></wcm-spinner>`}</div>`}};fc.styles=[Lt.globalCss,j$],Lh([At()],fc.prototype,"walletId",2),Lh([At()],fc.prototype,"imageId",2),Lh([xi()],fc.prototype,"uri",2),fc=Lh([Ut("wcm-walletconnect-qr")],fc);var V$=Object.defineProperty,G$=Object.getOwnPropertyDescriptor,Y$=(r,e,t,i)=>{for(var n=i>1?void 0:i?G$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&V$(e,t,n),n};let zp=class extends Ct{viewTemplate(){return je.isAndroid()&&!je.isTelegram()?Ee`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:je.isMobile()?Ee`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:Ee`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return Ee`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};zp.styles=[Lt.globalCss],zp=Y$([Ut("wcm-connect-wallet-view")],zp);const J$=Ht`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var Q$=Object.defineProperty,Z$=Object.getOwnPropertyDescriptor,Uw=(r,e,t,i)=>{for(var n=i>1?void 0:i?Z$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Q$(e,t,n),n};let Bh=class extends Ct{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.native,n=e?.universal;if(i){const s=je.formatNativeUrl(i,r,t);je.openHref(s,"_self")}else if(n){const s=je.formatUniversalUrl(n,r,t);je.openHref(s,"_blank")}}openDesktopApp(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${r} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isWeb="${n}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Bh.styles=[Lt.globalCss,J$],Uw([xi()],Bh.prototype,"isError",2),Bh=Uw([Ut("wcm-desktop-connecting-view")],Bh);const X$=Ht`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var eN=Object.defineProperty,tN=Object.getOwnPropertyDescriptor,rN=(r,e,t,i)=>{for(var n=i>1?void 0:i?tN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&eN(e,t,n),n};let kp=class extends Ct{onInstall(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,homepage:i}=je.getWalletRouterData();return Ee`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${r} to continue. If multiple browser extensions are installed, disable non ${r} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(i)}" .iconLeft="${Kt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};kp.styles=[Lt.globalCss,X$],kp=rN([Ut("wcm-install-wallet-view")],kp);const iN=Ht`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var nN=Object.defineProperty,sN=Object.getOwnPropertyDescriptor,qw=(r,e,t,i)=>{for(var n=i>1?void 0:i?sN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&nN(e,t,n),n};let Fh=class extends Ct{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(r,e=!1){const{mobile:t,name:i}=je.getWalletRouterData(),n=t?.native,s=t?.universal,a=je.isTelegram()?"_blank":"_self";if(r=je.isTelegram()&&je.isAndroid()?encodeURIComponent(r):r,n&&!e){const f=je.formatNativeUrl(n,r,i);je.openHref(f,a)}else if(s){const f=je.formatUniversalUrl(s,r,i);je.openHref(f,a)}}openMobileApp(r=!1){const{walletConnectUri:e}=yr.state,t=je.getWalletRouterData();e&&this.onFormatAndRedirect(e,r),pt.setRecentWallet(t)}onGoToAppStore(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,app:i,mobile:n}=je.getWalletRouterData(),{isWeb:s}=pt.getCachedRouterWalletPlatforms(),a=i?.ios,f=n?.universal;return Ee`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${f?Ee`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${li(t)}"></wcm-wallet-image><wcm-text>${`Get ${r}`}</wcm-text></div><wcm-button .iconRight="${Kt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(a)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Fh.styles=[Lt.globalCss,iN],qw([xi()],Fh.prototype,"isError",2),Fh=qw([Ut("wcm-mobile-connecting-view")],Fh);const oN=Ht`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var aN=Object.defineProperty,cN=Object.getOwnPropertyDescriptor,fN=(r,e,t,i)=>{for(var n=i>1?void 0:i?cN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&aN(e,t,n),n};let Hp=class extends Ct{render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isDesktop:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${li(t)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${r} app`}</wcm-text><wcm-platform-selection .isDesktop="${i}" .isWeb="${n}"></wcm-platform-selection></wcm-info-footer>`}};Hp.styles=[Lt.globalCss,oN],Hp=fN([Ut("wcm-mobile-qr-connecting-view")],Hp);var lN=Object.defineProperty,hN=Object.getOwnPropertyDescriptor,uN=(r,e,t,i)=>{for(var n=i>1?void 0:i?hN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&lN(e,t,n),n};let jp=class extends Ct{render(){return Ee`<wcm-modal-header title="Scan the code" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};jp.styles=[Lt.globalCss],jp=uN([Ut("wcm-qrcode-view")],jp);const dN=Ht`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var pN=Object.defineProperty,gN=Object.getOwnPropertyDescriptor,Tf=(r,e,t,i)=>{for(var n=i>1?void 0:i?gN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&pN(e,t,n),n};const Wp=40;let ea=class extends Ct{constructor(){super(...arguments),this.loading=!_i.state.wallets.listings.length,this.firstFetch=!_i.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=pt.debounce(r=>{r.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=r,_i.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),_i.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var r;(r=this.intersectionObserver)==null||r.disconnect()}get placeholderEl(){return pt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([r])=>{r.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:r,search:e}=_i.state,{listings:t,total:i}=this.search?e:r;return i<=Wp||t.length>=i}async fetchWallets(){var r;const{wallets:e,search:t}=_i.state,{listings:i,total:n,page:s}=this.search?t:e;if(!this.endReached&&(this.firstFetch||n>Wp&&i.length<n))try{this.loading=!0;const a=(r=yr.state.chains)==null?void 0:r.join(","),{listings:f}=await _i.getWallets({page:this.firstFetch?1:s+1,entries:Wp,search:this.search,version:2,chains:a}),h=f.map(u=>pt.getWalletIcon(u));await Promise.all([...h.map(async u=>pt.preloadImage(u)),je.wait(300)]),this.endReached=this.isLastPage()}catch(a){console.error(a),Zs.openToast(pt.getErrorMessage(a),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(r){je.isAndroid()?pt.handleMobileLinking(r):pt.goToConnectingView(r)}onSearchChange(r){const{value:e}=r.target;this.searchDebounce(e)}render(){const{wallets:r,search:e}=_i.state,{listings:t}=this.search?e:r,i=this.loading&&!t.length,n=this.search.length>=3;let s=oo.manualWalletsTemplate(),a=oo.recomendedWalletsTemplate(!0);n&&(s=s.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)),a=a.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)));const f=!this.loading&&!t.length&&!a.length,h={"wcm-loading":i,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":f};return Ee`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Es(h)}"><div class="wcm-grid">${i?null:s} ${i?null:a} ${i?null:t.map(u=>Ee`${u?Ee`<wcm-wallet-button imageId="${u.image_id}" name="${u.name}" walletId="${u.id}" .onClick="${()=>this.onConnect(u)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${f?Ee`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!f&&this.loading?Ee`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ea.styles=[Lt.globalCss,dN],Tf([xi()],ea.prototype,"loading",2),Tf([xi()],ea.prototype,"firstFetch",2),Tf([xi()],ea.prototype,"search",2),Tf([xi()],ea.prototype,"endReached",2),ea=Tf([Ut("wcm-wallet-explorer-view")],ea);const vN=Ht`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var mN=Object.defineProperty,bN=Object.getOwnPropertyDescriptor,zw=(r,e,t,i)=>{for(var n=i>1?void 0:i?bN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&mN(e,t,n),n};let Uh=class extends Ct{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.universal;if(i){const n=je.formatUniversalUrl(i,r,t);je.openHref(n,"_blank")}}openWebWallet(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isDesktop:n}=pt.getCachedRouterWalletPlatforms(),s=je.isMobile();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${r} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isDesktop="${s?!1:n}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Uh.styles=[Lt.globalCss,vN],zw([xi()],Uh.prototype,"isError",2),Uh=zw([Ut("wcm-web-connecting-view")],Uh);var wN=Object.freeze({__proto__:null,get WcmModal(){return cc},get WcmQrCode(){return Is}});gn.EthereumProvider=kD,gn.OPTIONAL_EVENTS=g3,gn.OPTIONAL_METHODS=p3,gn.REQUIRED_EVENTS=lh,gn.REQUIRED_METHODS=fh,gn.default=dh,Object.defineProperty(gn,"__esModule",{value:!0})});
121
+ `);const a=tT(e,t,n),f=Oh.getSymbolSize(e),h=new jR(f);return JR(h,e),QR(h),ZR(h,e),wp(h,t,0),e>=7&&XR(h,e),eT(h,a),isNaN(i)&&(i=vp.getBestMask(h,wp.bind(null,h,t))),vp.applyMask(i,h),wp(h,t,i),{modules:h,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}uw.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=gp.M,n,s;return typeof t<"u"&&(i=gp.from(t.errorCorrectionLevel,gp.M),n=Rh.from(t.version),s=vp.from(t.maskPattern),t.toSJISFunc&&Oh.setToSJISFunction(t.toSJISFunc)),iT(e,n,i,s)};var Mw={},yp={};(function(r){function e(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let i=t.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+t);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(s){return[s,s]}))),i.length===6&&i.push("F","F");const n=parseInt(i.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+i.slice(0,6).join("")}}r.getOptions=function(i){i||(i={}),i.color||(i.color={});const n=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,s=i.width&&i.width>=21?i.width:void 0,a=i.scale||4;return{width:s,scale:s?4:a,margin:n,color:{dark:e(i.color.dark||"#000000ff"),light:e(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},r.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},r.getImageWidth=function(i,n){const s=r.getScale(i,n);return Math.floor((i+n.margin*2)*s)},r.qrToImageData=function(i,n,s){const a=n.modules.size,f=n.modules.data,h=r.getScale(a,s),u=Math.floor((a+s.margin*2)*h),g=s.margin*h,w=[s.color.light,s.color.dark];for(let P=0;P<u;P++)for(let M=0;M<u;M++){let O=(P*u+M)*4,$=s.color.light;if(P>=g&&M>=g&&P<u-g&&M<u-g){const W=Math.floor((P-g)/h),H=Math.floor((M-g)/h);$=w[f[W*a+H]?1:0]}i[O++]=$.r,i[O++]=$.g,i[O++]=$.b,i[O]=$.a}}})(yp),function(r){const e=yp;function t(n,s,a){n.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=a,s.width=a,s.style.height=a+"px",s.style.width=a+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}r.render=function(s,a,f){let h=f,u=a;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),a||(u=i()),h=e.getOptions(h);const g=e.getImageWidth(s.modules.size,h),w=u.getContext("2d"),P=w.createImageData(g,g);return e.qrToImageData(P.data,s,h),t(w,u,g),w.putImageData(P,0,0),u},r.renderToDataURL=function(s,a,f){let h=f;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),h||(h={});const u=r.render(s,a,h),g=h.type||"image/png",w=h.rendererOpts||{};return u.toDataURL(g,w.quality)}}(Mw);var Cw={};const nT=yp;function Pw(r,e){const t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function _p(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function sT(r,e,t){let i="",n=0,s=!1,a=0;for(let f=0;f<r.length;f++){const h=Math.floor(f%e),u=Math.floor(f/e);!h&&!s&&(s=!0),r[f]?(a++,f>0&&h>0&&r[f-1]||(i+=s?_p("M",h+t,.5+u+t):_p("m",n,0),n=0,s=!1),h+1<e&&r[f+1]||(i+=_p("h",a),a=0)):n++}return i}Cw.render=function(e,t,i){const n=nT.getOptions(t),s=e.modules.size,a=e.modules.data,f=s+n.margin*2,h=n.color.light.a?"<path "+Pw(n.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",u="<path "+Pw(n.color.dark,"stroke")+' d="'+sT(a,s,n.margin)+'"/>',g='viewBox="0 0 '+f+" "+f+'"',P='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+g+' shape-rendering="crispEdges">'+h+u+`</svg>
122
+ `;return typeof i=="function"&&i(null,P),P};const oT=yR,xp=uw,Dw=Mw,aT=Cw;function Ap(r,e,t,i,n){const s=[].slice.call(arguments,1),a=s.length,f=typeof s[a-1]=="function";if(!f&&!oT())throw new Error("Callback required as last argument");if(f){if(a<2)throw new Error("Too few arguments provided");a===2?(n=t,t=e,e=i=void 0):a===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(t=e,e=i=void 0):a===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(h,u){try{const g=xp.create(t,i);h(r(g,e,i))}catch(g){u(g)}})}try{const h=xp.create(t,i);n(null,r(h,e,i))}catch(h){n(h)}}Ef.create=xp.create,Ef.toCanvas=Ap.bind(null,Dw.render),Ef.toDataURL=Ap.bind(null,Dw.renderToDataURL),Ef.toString=Ap.bind(null,function(r,e,t){return aT.render(r,t)});var cT=Object.defineProperty,Ow=Object.getOwnPropertySymbols,fT=Object.prototype.hasOwnProperty,lT=Object.prototype.propertyIsEnumerable,Rw=(r,e,t)=>e in r?cT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ep=(r,e)=>{for(var t in e||(e={}))fT.call(e,t)&&Rw(r,t,e[t]);if(Ow)for(var t of Ow(e))lT.call(e,t)&&Rw(r,t,e[t]);return r};function hT(){var r;const e=(r=Zs.state.themeMode)!=null?r:"dark",i={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":i.foreground[1],"--wcm-color-fg-2":i.foreground[2],"--wcm-color-fg-3":i.foreground[3],"--wcm-color-bg-1":i.background[1],"--wcm-color-bg-2":i.background[2],"--wcm-color-bg-3":i.background[3],"--wcm-color-overlay":i.overlay}}function Tw(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const Lt={getPreset(r){return Tw()[r]},setTheme(){const r=document.querySelector(":root"),{themeVariables:e}=Zs.state;if(r){const t=Ep(Ep(Ep({},hT()),Tw()),e);Object.entries(t).forEach(([i,n])=>r.style.setProperty(i,n))}},globalCss:jt`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},uT=jt`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var dT=Object.defineProperty,pT=Object.getOwnPropertyDescriptor,ic=(r,e,t,i)=>{for(var n=i>1?void 0:i?pT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&dT(e,t,n),n};let no=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const r={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),Ee`<button class="${Ss(r)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};no.styles=[Lt.globalCss,uT],ic([At({type:Boolean})],no.prototype,"disabled",2),ic([At()],no.prototype,"iconLeft",2),ic([At()],no.prototype,"iconRight",2),ic([At()],no.prototype,"onClick",2),ic([At()],no.prototype,"variant",2),no=ic([Ut("wcm-button")],no);const gT=jt`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var vT=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,Sp=(r,e,t,i)=>{for(var n=i>1?void 0:i?mT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&vT(e,t,n),n};let Cf=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const r={"wcm-secondary":this.variant==="secondary"};return Ee`<button ?disabled="${this.disabled}" class="${Ss(r)}"><slot></slot></button>`}};Cf.styles=[Lt.globalCss,gT],Sp([At({type:Boolean})],Cf.prototype,"disabled",2),Sp([At()],Cf.prototype,"variant",2),Cf=Sp([Ut("wcm-button-big")],Cf);const bT=jt`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var wT=Object.defineProperty,yT=Object.getOwnPropertyDescriptor,_T=(r,e,t,i)=>{for(var n=i>1?void 0:i?yT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&wT(e,t,n),n};let Ip=class extends Ct{render(){return Ee`<div><slot></slot></div>`}};Ip.styles=[Lt.globalCss,bT],Ip=_T([Ut("wcm-info-footer")],Ip);const Kt={CROSS_ICON:gr`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:gr`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:gr`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:gr`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:gr`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:gr`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:gr`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:gr`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:gr`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:gr`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:gr`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:gr`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:gr`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:gr`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:gr`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:gr`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},xT=jt`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var AT=Object.defineProperty,ET=Object.getOwnPropertyDescriptor,ST=(r,e,t,i)=>{for(var n=i>1?void 0:i?ET(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&AT(e,t,n),n};let Mp=class extends Ct{render(){return Ee`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Kt.WALLET_CONNECT_LOGO} <button @click="${jo.close}">${Kt.CROSS_ICON}</button></div>`}};Mp.styles=[Lt.globalCss,xT],Mp=ST([Ut("wcm-modal-backcard")],Mp);const IT=jt`main{padding:20px;padding-top:0;width:100%}`;var MT=Object.defineProperty,CT=Object.getOwnPropertyDescriptor,PT=(r,e,t,i)=>{for(var n=i>1?void 0:i?CT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&MT(e,t,n),n};let Cp=class extends Ct{render(){return Ee`<main><slot></slot></main>`}};Cp.styles=[Lt.globalCss,IT],Cp=PT([Ut("wcm-modal-content")],Cp);const DT=jt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var OT=Object.defineProperty,RT=Object.getOwnPropertyDescriptor,TT=(r,e,t,i)=>{for(var n=i>1?void 0:i?RT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&OT(e,t,n),n};let Pp=class extends Ct{render(){return Ee`<footer><slot></slot></footer>`}};Pp.styles=[Lt.globalCss,DT],Pp=TT([Ut("wcm-modal-footer")],Pp);const $T=jt`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var NT=Object.defineProperty,LT=Object.getOwnPropertyDescriptor,Pf=(r,e,t,i)=>{for(var n=i>1?void 0:i?LT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&NT(e,t,n),n};let Zo=class extends Ct{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return Ee`<button class="wcm-back-btn" @click="${lr.goBack}">${Kt.BACK_ICON}</button>`}actionBtnTemplate(){return Ee`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const r={"wcm-border":this.border},e=lr.state.history.length>1,t=this.title?Ee`<wcm-text variant="big-bold">${this.title}</wcm-text>`:Ee`<slot></slot>`;return Ee`<header class="${Ss(r)}">${e?this.backBtnTemplate():null} ${t} ${this.onAction?this.actionBtnTemplate():null}</header>`}};Zo.styles=[Lt.globalCss,$T],Pf([At()],Zo.prototype,"title",2),Pf([At()],Zo.prototype,"onAction",2),Pf([At()],Zo.prototype,"actionIcon",2),Pf([At({type:Boolean})],Zo.prototype,"border",2),Zo=Pf([Ut("wcm-modal-header")],Zo);const pt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(r,e){const t=r.renderRoot.querySelector(e);if(!t)throw new Error(`${e} not found`);return t},getWalletIcon({id:r,image_id:e}){const{walletImages:t}=Ui.state;return t?.[r]?t[r]:e?_i.getWalletImageUrl(e):""},getWalletName(r,e=!1){return e&&r.length>8?`${r.substring(0,8)}..`:r},isMobileAnimation(){return window.innerWidth<=pt.MOBILE_BREAKPOINT},async preloadImage(r){const e=new Promise((t,i)=>{const n=new Image;n.onload=t,n.onerror=i,n.crossOrigin="anonymous",n.src=r});return Promise.race([e,je.wait(3e3)])},getErrorMessage(r){return r instanceof Error?r.message:"Unknown Error"},debounce(r,e=500){let t;return(...i)=>{function n(){r(...i)}t&&clearTimeout(t),t=setTimeout(n,e)}},handleMobileLinking(r,e="_self"){const{walletConnectUri:t}=yr.state,{mobile:i,name:n}=r,s=i?.native,a=i?.universal;pt.setRecentWallet(r);function f(h){if(s){const u=je.formatNativeUrl(s,h,n);je.openHref(u,e)}else if(a){const u=je.formatUniversalUrl(a,h,n);je.openHref(u,e)}}t&&f(t)},handleAndroidLinking(){const{walletConnectUri:r}=yr.state;r&&(je.setWalletConnectAndroidDeepLink(r),je.openHref(r,je.isTelegram()?"_blank":"_self"))},async handleUriCopy(){const{walletConnectUri:r}=yr.state;if(r)try{await navigator.clipboard.writeText(r),Xs.openToast("Link copied","success")}catch{Xs.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:r}=Ui.state,e=Object.values(r??{});return Object.values(e)},truncate(r,e=8){return r.length<=e?r:`${r.substring(0,4)}...${r.substring(r.length-4)}`},setRecentWallet(r){try{localStorage.setItem(pt.WCM_RECENT_WALLET_DATA,JSON.stringify(r))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const r=localStorage.getItem(pt.WCM_RECENT_WALLET_DATA);return r?JSON.parse(r):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(r,e){return r.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){je.openHref(pt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:r,mobile:e}=je.getWalletRouterData(),t=!!r?.native,i=!!r?.universal,n=!!e?.native||!!e?.universal;return{isDesktop:t,isMobile:n,isWeb:i}},goToConnectingView(r){lr.setData({Wallet:r});const e=je.isMobile(),{isDesktop:t,isWeb:i,isMobile:n}=pt.getCachedRouterWalletPlatforms();e?n?(lr.push("MobileConnecting"),!je.isAndroid()&&je.isTelegram()&&this.handleMobileLinking(r,"_blank")):i?lr.push("WebConnecting"):lr.push("InstallWallet"):t?lr.push("DesktopConnecting"):i?lr.push("WebConnecting"):n?lr.push("MobileQrcodeConnecting"):lr.push("InstallWallet")}},BT=jt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var FT=Object.defineProperty,UT=Object.getOwnPropertyDescriptor,Dp=(r,e,t,i)=>{for(var n=i>1?void 0:i?UT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&FT(e,t,n),n};let Df=class extends Ct{constructor(){super(),this.view=lr.state.view,this.prevView=lr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=lr.subscribe(r=>{this.view!==r.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([r])=>{const e=`${r.contentRect.height}px`;this.oldHeight!=="0px"&&Qo(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var r,e;(r=this.unsubscribe)==null||r.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return pt.getShadowRootElement(this,".wcm-router")}get contentEl(){return pt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return Ee`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return Ee`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return Ee`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return Ee`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return Ee`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return Ee`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return Ee`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return Ee`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return Ee`<div>Not Found</div>`}}async onChangeRoute(){await Qo(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=lr.state.view,Qo(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return Ee`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Df.styles=[Lt.globalCss,BT],Dp([xi()],Df.prototype,"view",2),Dp([xi()],Df.prototype,"prevView",2),Df=Dp([Ut("wcm-modal-router")],Df);const qT=jt`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var zT=Object.defineProperty,HT=Object.getOwnPropertyDescriptor,$w=(r,e,t,i)=>{for(var n=i>1?void 0:i?HT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&zT(e,t,n),n};let Th=class extends Ct{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=Xs.subscribe(r=>{r.open?(this.open=!0,this.timeout=setTimeout(()=>Xs.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var r;(r=this.unsubscribe)==null||r.call(this),clearTimeout(this.timeout),Xs.closeToast()}render(){const{message:r,variant:e}=Xs.state,t={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?Ee`<div class="${Ss(t)}">${e==="success"?Kt.CHECKMARK_ICON:null} ${e==="error"?Kt.CROSS_ICON:null}<wcm-text variant="small-regular">${r}</wcm-text></div>`:null}};Th.styles=[Lt.globalCss,qT],$w([xi()],Th.prototype,"open",2),Th=$w([Ut("wcm-modal-toast")],Th);const kT=.1,Nw=2.5,Is=7;function Op(r,e,t){return r===e?!1:(r-e<0?e-r:r-e)<=t+kT}function jT(r,e){const t=Array.prototype.slice.call(Ef.create(r,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(t.length);return t.reduce((n,s,a)=>(a%i===0?n.push([s]):n[n.length-1].push(s))&&n,[])}const WT={generate(r,e,t){const i="#141414",n="#ffffff",s=[],a=jT(r,"Q"),f=e/a.length,h=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];h.forEach(({x:O,y:$})=>{const W=(a.length-Is)*f*O,H=(a.length-Is)*f*$,F=.45;for(let Y=0;Y<h.length;Y+=1){const B=f*(Is-Y*2);s.push(gr`<rect fill="${Y%2===0?i:n}" height="${B}" rx="${B*F}" ry="${B*F}" width="${B}" x="${W+f*Y}" y="${H+f*Y}">`)}});const u=Math.floor((t+25)/f),g=a.length/2-u/2,w=a.length/2+u/2-1,P=[];a.forEach((O,$)=>{O.forEach((W,H)=>{if(a[$][H]&&!($<Is&&H<Is||$>a.length-(Is+1)&&H<Is||$<Is&&H>a.length-(Is+1))&&!($>g&&$<w&&H>g&&H<w)){const F=$*f+f/2,Y=H*f+f/2;P.push([F,Y])}})});const M={};return P.forEach(([O,$])=>{M[O]?M[O].push($):M[O]=[$]}),Object.entries(M).map(([O,$])=>{const W=$.filter(H=>$.every(F=>!Op(H,F,f)));return[Number(O),W]}).forEach(([O,$])=>{$.forEach(W=>{s.push(gr`<circle cx="${O}" cy="${W}" fill="${i}" r="${f/Nw}">`)})}),Object.entries(M).filter(([O,$])=>$.length>1).map(([O,$])=>{const W=$.filter(H=>$.some(F=>Op(H,F,f)));return[Number(O),W]}).map(([O,$])=>{$.sort((H,F)=>H<F?-1:1);const W=[];for(const H of $){const F=W.find(Y=>Y.some(B=>Op(H,B,f)));F?F.push(H):W.push([H])}return[O,W.map(H=>[H[0],H[H.length-1]])]}).forEach(([O,$])=>{$.forEach(([W,H])=>{s.push(gr`<line x1="${O}" x2="${O}" y1="${W}" y2="${H}" stroke="${i}" stroke-width="${f/(Nw/2)}" stroke-linecap="round">`)})}),s}},KT=jt`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var VT=Object.defineProperty,GT=Object.getOwnPropertyDescriptor,nc=(r,e,t,i)=>{for(var n=i>1?void 0:i?GT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&VT(e,t,n),n};let Ms=class extends Ct{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e=Zs.state.themeMode==="light"?this.size:this.size-18*2;return gr`<svg height="${e}" width="${e}">${WT.generate(this.uri,e,e/4)}</svg>`}render(){const r={"wcm-dark":Zs.state.themeMode==="dark"};return Ee`<div style="${`width: ${this.size}px`}" class="${Ss(r)}">${this.walletId||this.imageUrl?Ee`<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}" imageUrl="${li(this.imageUrl)}"></wcm-wallet-image>`:Kt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Ms.styles=[Lt.globalCss,KT],nc([At()],Ms.prototype,"uri",2),nc([At({type:Number})],Ms.prototype,"size",2),nc([At()],Ms.prototype,"imageId",2),nc([At()],Ms.prototype,"walletId",2),nc([At()],Ms.prototype,"imageUrl",2),Ms=nc([Ut("wcm-qrcode")],Ms);const YT=jt`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var JT=Object.defineProperty,QT=Object.getOwnPropertyDescriptor,Lw=(r,e,t,i)=>{for(var n=i>1?void 0:i?QT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&JT(e,t,n),n};let $h=class extends Ct{constructor(){super(...arguments),this.onChange=()=>null}render(){return Ee`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Kt.SEARCH_ICON}`}};$h.styles=[Lt.globalCss,YT],Lw([At()],$h.prototype,"onChange",2),$h=Lw([Ut("wcm-search-input")],$h);const ZT=jt`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var XT=Object.defineProperty,e$=Object.getOwnPropertyDescriptor,t$=(r,e,t,i)=>{for(var n=i>1?void 0:i?e$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&XT(e,t,n),n};let Rp=class extends Ct{render(){return Ee`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Rp.styles=[Lt.globalCss,ZT],Rp=t$([Ut("wcm-spinner")],Rp);const r$=jt`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var i$=Object.defineProperty,n$=Object.getOwnPropertyDescriptor,Tp=(r,e,t,i)=>{for(var n=i>1?void 0:i?n$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&i$(e,t,n),n};let Of=class extends Ct{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const r={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return Ee`<span><slot class="${Ss(r)}"></slot></span>`}};Of.styles=[Lt.globalCss,r$],Tp([At()],Of.prototype,"variant",2),Tp([At()],Of.prototype,"color",2),Of=Tp([Ut("wcm-text")],Of);const s$=jt`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var o$=Object.defineProperty,a$=Object.getOwnPropertyDescriptor,so=(r,e,t,i)=>{for(var n=i>1?void 0:i?a$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&o$(e,t,n),n};let as=class extends Ct{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?Ee`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?Ee`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){y3.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var r;return Ee`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${li(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(r=this.label)!=null?r:pt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};as.styles=[Lt.globalCss,s$],so([At()],as.prototype,"onClick",2),so([At()],as.prototype,"name",2),so([At()],as.prototype,"walletId",2),so([At()],as.prototype,"label",2),so([At()],as.prototype,"imageId",2),so([At({type:Boolean})],as.prototype,"installed",2),so([At({type:Boolean})],as.prototype,"recent",2),as=so([Ut("wcm-wallet-button")],as);const c$=jt`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var f$=Object.defineProperty,l$=Object.getOwnPropertyDescriptor,Nh=(r,e,t,i)=>{for(var n=i>1?void 0:i?l$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&f$(e,t,n),n};let sc=class extends Ct{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var r;const e=(r=this.imageUrl)!=null&&r.length?this.imageUrl:pt.getWalletIcon({id:this.walletId,image_id:this.imageId});return Ee`${e.length?Ee`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Kt.WALLET_PLACEHOLDER}`}};sc.styles=[Lt.globalCss,c$],Nh([At()],sc.prototype,"walletId",2),Nh([At()],sc.prototype,"imageId",2),Nh([At()],sc.prototype,"imageUrl",2),sc=Nh([Ut("wcm-wallet-image")],sc);var h$=Object.defineProperty,u$=Object.getOwnPropertyDescriptor,Bw=(r,e,t,i)=>{for(var n=i>1?void 0:i?u$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&h$(e,t,n),n};let $p=class extends Ct{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(r){try{r?.length&&await Promise.all(r.map(async e=>pt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",r)}}async preloadListings(){if(Ui.state.enableExplorer){await _i.getRecomendedWallets(),yr.setIsDataLoaded(!0);const{recomendedWallets:r}=_i.state,e=r.map(t=>pt.getWalletIcon(t));await this.loadImages(e)}else yr.setIsDataLoaded(!0)}async preloadCustomImages(){const r=pt.getCustomImageUrls();await this.loadImages(r)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(r){console.error(r),Xs.openToast("Failed preloading","error")}}};Bw([xi()],$p.prototype,"preload",2),$p=Bw([Ut("wcm-explorer-context")],$p);var d$=Object.defineProperty,p$=Object.getOwnPropertyDescriptor,g$=(r,e,t,i)=>{for(var n=i>1?void 0:i?p$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&d$(e,t,n),n};let Fw=class extends Ct{constructor(){super(),this.unsubscribeTheme=void 0,Lt.setTheme(),this.unsubscribeTheme=Zs.subscribe(Lt.setTheme)}disconnectedCallback(){var r;(r=this.unsubscribeTheme)==null||r.call(this)}};Fw=g$([Ut("wcm-theme-context")],Fw);const v$=jt`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var m$=Object.defineProperty,b$=Object.getOwnPropertyDescriptor,w$=(r,e,t,i)=>{for(var n=i>1?void 0:i?b$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&m$(e,t,n),n};let Np=class extends Ct{onGoToQrcode(){lr.push("Qrcode")}render(){const{recomendedWallets:r}=_i.state,e=[...r,...r],t=je.RECOMMENDED_WALLET_AMOUNT*2;return Ee`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(t)].map((i,n)=>{const s=e[n%e.length];return s?Ee`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Kt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${pt.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Np.styles=[Lt.globalCss,v$],Np=w$([Ut("wcm-android-wallet-selection")],Np);const y$=jt`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var _$=Object.defineProperty,x$=Object.getOwnPropertyDescriptor,oc=(r,e,t,i)=>{for(var n=i>1?void 0:i?x$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&_$(e,t,n),n};let oo=class extends Ct{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var r,e;const s=(e=(r=Zs.state.themeVariables)==null?void 0:r["--wcm-wallet-icon-large-border-radius"])!=null?e:Lt.getPreset("--wcm-wallet-icon-large-border-radius");let a=0;s.includes("%")?a=88/100*parseInt(s,10):a=parseInt(s,10),a*=1.17;const f=317-a*1.57,h=425-a*1.8;return Ee`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${a}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${f}" stroke-dashoffset="${h}"></use></svg>`}render(){const r={"wcm-error":this.isError,"wcm-stale":this.isStale};return Ee`<div class="${Ss(r)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};oo.styles=[Lt.globalCss,y$],oc([At()],oo.prototype,"walletId",2),oc([At()],oo.prototype,"imageId",2),oc([At({type:Boolean})],oo.prototype,"isError",2),oc([At({type:Boolean})],oo.prototype,"isStale",2),oc([At()],oo.prototype,"label",2),oo=oc([Ut("wcm-connector-waiting")],oo);const ac={manualWallets(){var r,e;const{mobileWallets:t,desktopWallets:i}=Ui.state,n=(r=ac.recentWallet())==null?void 0:r.id,s=je.isMobile()?t:i,a=s?.filter(f=>n!==f.id);return(e=je.isMobile()?a?.map(({id:f,name:h,links:u})=>({id:f,name:h,mobile:u,links:u})):a?.map(({id:f,name:h,links:u})=>({id:f,name:h,desktop:u,links:u})))!=null?e:[]},recentWallet(){return pt.getRecentWallet()},recomendedWallets(r=!1){var e;const t=r||(e=ac.recentWallet())==null?void 0:e.id,{recomendedWallets:i}=_i.state;return i.filter(s=>t!==s.id)}},ao={onConnecting(r){pt.goToConnectingView(r)},manualWalletsTemplate(){return ac.manualWallets().map(e=>Ee`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(r=!1){return ac.recomendedWallets(r).map(t=>Ee`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${t.image_id}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recentWalletTemplate(){const r=ac.recentWallet();if(r)return Ee`<wcm-wallet-button name="${r.name}" walletId="${r.id}" imageId="${li(r.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`}},A$=jt`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var E$=Object.defineProperty,S$=Object.getOwnPropertyDescriptor,I$=(r,e,t,i)=>{for(var n=i>1?void 0:i?S$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&E$(e,t,n),n};let Lp=class extends Ct{render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Ui.state,t=r!=="ALL"&&e,i=ao.manualWalletsTemplate(),n=ao.recomendedWalletsTemplate();let a=[ao.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>4||t;let h=[];f?h=a.slice(0,3):h=a;const u=!!h.length;return Ee`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Kt.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${u?Ee`<wcm-modal-footer><div class="wcm-desktop-title">${Kt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${h} ${f?Ee`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Lp.styles=[Lt.globalCss,A$],Lp=I$([Ut("wcm-desktop-wallet-selection")],Lp);const M$=jt`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var C$=Object.defineProperty,P$=Object.getOwnPropertyDescriptor,D$=(r,e,t,i)=>{for(var n=i>1?void 0:i?P$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&C$(e,t,n),n};let Bp=class extends Ct{render(){const{termsOfServiceUrl:r,privacyPolicyUrl:e}=Ui.state;return r??e?Ee`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${r?Ee`<a href="${r}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${r&&e?"and":null} ${e?Ee`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Bp.styles=[Lt.globalCss,M$],Bp=D$([Ut("wcm-legal-notice")],Bp);const O$=jt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var R$=Object.defineProperty,T$=Object.getOwnPropertyDescriptor,$$=(r,e,t,i)=>{for(var n=i>1?void 0:i?T$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&R$(e,t,n),n};let Fp=class extends Ct{onQrcode(){lr.push("Qrcode")}render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Ui.state,t=r!=="ALL"&&e,i=ao.manualWalletsTemplate(),n=ao.recomendedWalletsTemplate();let a=[ao.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>8||t;let h=[];f?h=a.slice(0,7):h=a;const u=!!h.length;return Ee`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header>${u?Ee`<wcm-modal-content><div>${h} ${f?Ee`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Fp.styles=[Lt.globalCss,O$],Fp=$$([Ut("wcm-mobile-wallet-selection")],Fp);const N$=jt`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var L$=Object.defineProperty,B$=Object.getOwnPropertyDescriptor,Up=(r,e,t,i)=>{for(var n=i>1?void 0:i?B$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&L$(e,t,n),n};let cc=class extends Ct{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=jo.subscribe(r=>{r.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var r;(r=this.unsubscribeModal)==null||r.call(this)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return pt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(r){if(document.querySelector("body"))if(r){const t=document.getElementById("wcm-styles");t?.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(r){r.target===r.currentTarget&&jo.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const r=pt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,t=.2;await Promise.all([Qo(this.overlayEl,{opacity:[0,1]},{delay:e,duration:t}).finished,Qo(this.containerEl,r,{delay:e,duration:t}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const r=pt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([Qo(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,Qo(this.containerEl,r,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",r=>{var e;r.key==="Escape"?jo.close():r.key==="Tab"&&((e=r.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var r;(r=this.abortController)==null||r.abort(),this.abortController=void 0}render(){const r={"wcm-overlay":!0,"wcm-active":this.active};return Ee`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Ss(r)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?Ee`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};cc.styles=[Lt.globalCss,N$],Up([xi()],cc.prototype,"open",2),Up([xi()],cc.prototype,"active",2),cc=Up([Ut("wcm-modal")],cc);const F$=jt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var U$=Object.defineProperty,q$=Object.getOwnPropertyDescriptor,Rf=(r,e,t,i)=>{for(var n=i>1?void 0:i?q$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&U$(e,t,n),n};let Xo=class extends Ct{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){je.isMobile()?lr.replace("MobileConnecting"):lr.replace("MobileQrcodeConnecting")}onDesktop(){lr.replace("DesktopConnecting")}onWeb(){lr.replace("WebConnecting")}render(){return Ee`<div>${this.isRetry?Ee`<slot></slot>`:null} ${this.isMobile?Ee`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Kt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?Ee`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Kt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?Ee`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Kt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};Xo.styles=[Lt.globalCss,F$],Rf([At({type:Boolean})],Xo.prototype,"isMobile",2),Rf([At({type:Boolean})],Xo.prototype,"isDesktop",2),Rf([At({type:Boolean})],Xo.prototype,"isWeb",2),Rf([At({type:Boolean})],Xo.prototype,"isRetry",2),Xo=Rf([Ut("wcm-platform-selection")],Xo);const z$=jt`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var H$=Object.defineProperty,k$=Object.getOwnPropertyDescriptor,j$=(r,e,t,i)=>{for(var n=i>1?void 0:i?k$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&H$(e,t,n),n};let qp=class extends Ct{onClick(){lr.push("WalletExplorer")}render(){const{recomendedWallets:r}=_i.state,e=ac.manualWallets(),t=[...r,...e].reverse().slice(0,4);return Ee`<button @click="${this.onClick}"><div class="wcm-icons">${t.map(i=>{const n=pt.getWalletIcon(i);if(n)return Ee`<img crossorigin="anonymous" src="${n}">`;const s=pt.getWalletIcon({id:i.id});return s?Ee`<img crossorigin="anonymous" src="${s}">`:Kt.WALLET_PLACEHOLDER})} ${[...Array(4-t.length)].map(()=>Kt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};qp.styles=[Lt.globalCss,z$],qp=j$([Ut("wcm-view-all-wallets-button")],qp);const W$=jt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var K$=Object.defineProperty,V$=Object.getOwnPropertyDescriptor,Lh=(r,e,t,i)=>{for(var n=i>1?void 0:i?V$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&K$(e,t,n),n};let fc=class extends Ct{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:r}=yr.state;this.uri=r},0)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-qr-container")}render(){return Ee`<div class="wcm-qr-container">${this.uri?Ee`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-qrcode>`:Ee`<wcm-spinner></wcm-spinner>`}</div>`}};fc.styles=[Lt.globalCss,W$],Lh([At()],fc.prototype,"walletId",2),Lh([At()],fc.prototype,"imageId",2),Lh([xi()],fc.prototype,"uri",2),fc=Lh([Ut("wcm-walletconnect-qr")],fc);var G$=Object.defineProperty,Y$=Object.getOwnPropertyDescriptor,J$=(r,e,t,i)=>{for(var n=i>1?void 0:i?Y$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&G$(e,t,n),n};let zp=class extends Ct{viewTemplate(){return je.isAndroid()&&!je.isTelegram()?Ee`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:je.isMobile()?Ee`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:Ee`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return Ee`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};zp.styles=[Lt.globalCss],zp=J$([Ut("wcm-connect-wallet-view")],zp);const Q$=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var Z$=Object.defineProperty,X$=Object.getOwnPropertyDescriptor,Uw=(r,e,t,i)=>{for(var n=i>1?void 0:i?X$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Z$(e,t,n),n};let Bh=class extends Ct{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.native,n=e?.universal;if(i){const s=je.formatNativeUrl(i,r,t);je.openHref(s,"_self")}else if(n){const s=je.formatUniversalUrl(n,r,t);je.openHref(s,"_blank")}}openDesktopApp(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${r} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isWeb="${n}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Bh.styles=[Lt.globalCss,Q$],Uw([xi()],Bh.prototype,"isError",2),Bh=Uw([Ut("wcm-desktop-connecting-view")],Bh);const eN=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var tN=Object.defineProperty,rN=Object.getOwnPropertyDescriptor,iN=(r,e,t,i)=>{for(var n=i>1?void 0:i?rN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&tN(e,t,n),n};let Hp=class extends Ct{onInstall(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,homepage:i}=je.getWalletRouterData();return Ee`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${r} to continue. If multiple browser extensions are installed, disable non ${r} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(i)}" .iconLeft="${Kt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};Hp.styles=[Lt.globalCss,eN],Hp=iN([Ut("wcm-install-wallet-view")],Hp);const nN=jt`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var sN=Object.defineProperty,oN=Object.getOwnPropertyDescriptor,qw=(r,e,t,i)=>{for(var n=i>1?void 0:i?oN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&sN(e,t,n),n};let Fh=class extends Ct{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(r,e=!1){const{mobile:t,name:i}=je.getWalletRouterData(),n=t?.native,s=t?.universal,a=je.isTelegram()?"_blank":"_self";if(r=je.isTelegram()&&je.isAndroid()?encodeURIComponent(r):r,n&&!e){const f=je.formatNativeUrl(n,r,i);je.openHref(f,a)}else if(s){const f=je.formatUniversalUrl(s,r,i);je.openHref(f,a)}}openMobileApp(r=!1){const{walletConnectUri:e}=yr.state,t=je.getWalletRouterData();e&&this.onFormatAndRedirect(e,r),pt.setRecentWallet(t)}onGoToAppStore(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,app:i,mobile:n}=je.getWalletRouterData(),{isWeb:s}=pt.getCachedRouterWalletPlatforms(),a=i?.ios,f=n?.universal;return Ee`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${f?Ee`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${li(t)}"></wcm-wallet-image><wcm-text>${`Get ${r}`}</wcm-text></div><wcm-button .iconRight="${Kt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(a)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Fh.styles=[Lt.globalCss,nN],qw([xi()],Fh.prototype,"isError",2),Fh=qw([Ut("wcm-mobile-connecting-view")],Fh);const aN=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var cN=Object.defineProperty,fN=Object.getOwnPropertyDescriptor,lN=(r,e,t,i)=>{for(var n=i>1?void 0:i?fN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&cN(e,t,n),n};let kp=class extends Ct{render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isDesktop:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${li(t)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${r} app`}</wcm-text><wcm-platform-selection .isDesktop="${i}" .isWeb="${n}"></wcm-platform-selection></wcm-info-footer>`}};kp.styles=[Lt.globalCss,aN],kp=lN([Ut("wcm-mobile-qr-connecting-view")],kp);var hN=Object.defineProperty,uN=Object.getOwnPropertyDescriptor,dN=(r,e,t,i)=>{for(var n=i>1?void 0:i?uN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&hN(e,t,n),n};let jp=class extends Ct{render(){return Ee`<wcm-modal-header title="Scan the code" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};jp.styles=[Lt.globalCss],jp=dN([Ut("wcm-qrcode-view")],jp);const pN=jt`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var gN=Object.defineProperty,vN=Object.getOwnPropertyDescriptor,Tf=(r,e,t,i)=>{for(var n=i>1?void 0:i?vN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&gN(e,t,n),n};const Wp=40;let ea=class extends Ct{constructor(){super(...arguments),this.loading=!_i.state.wallets.listings.length,this.firstFetch=!_i.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=pt.debounce(r=>{r.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=r,_i.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),_i.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var r;(r=this.intersectionObserver)==null||r.disconnect()}get placeholderEl(){return pt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([r])=>{r.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:r,search:e}=_i.state,{listings:t,total:i}=this.search?e:r;return i<=Wp||t.length>=i}async fetchWallets(){var r;const{wallets:e,search:t}=_i.state,{listings:i,total:n,page:s}=this.search?t:e;if(!this.endReached&&(this.firstFetch||n>Wp&&i.length<n))try{this.loading=!0;const a=(r=yr.state.chains)==null?void 0:r.join(","),{listings:f}=await _i.getWallets({page:this.firstFetch?1:s+1,entries:Wp,search:this.search,version:2,chains:a}),h=f.map(u=>pt.getWalletIcon(u));await Promise.all([...h.map(async u=>pt.preloadImage(u)),je.wait(300)]),this.endReached=this.isLastPage()}catch(a){console.error(a),Xs.openToast(pt.getErrorMessage(a),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(r){je.isAndroid()?pt.handleMobileLinking(r):pt.goToConnectingView(r)}onSearchChange(r){const{value:e}=r.target;this.searchDebounce(e)}render(){const{wallets:r,search:e}=_i.state,{listings:t}=this.search?e:r,i=this.loading&&!t.length,n=this.search.length>=3;let s=ao.manualWalletsTemplate(),a=ao.recomendedWalletsTemplate(!0);n&&(s=s.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)),a=a.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)));const f=!this.loading&&!t.length&&!a.length,h={"wcm-loading":i,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":f};return Ee`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Ss(h)}"><div class="wcm-grid">${i?null:s} ${i?null:a} ${i?null:t.map(u=>Ee`${u?Ee`<wcm-wallet-button imageId="${u.image_id}" name="${u.name}" walletId="${u.id}" .onClick="${()=>this.onConnect(u)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${f?Ee`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!f&&this.loading?Ee`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ea.styles=[Lt.globalCss,pN],Tf([xi()],ea.prototype,"loading",2),Tf([xi()],ea.prototype,"firstFetch",2),Tf([xi()],ea.prototype,"search",2),Tf([xi()],ea.prototype,"endReached",2),ea=Tf([Ut("wcm-wallet-explorer-view")],ea);const mN=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var bN=Object.defineProperty,wN=Object.getOwnPropertyDescriptor,zw=(r,e,t,i)=>{for(var n=i>1?void 0:i?wN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&bN(e,t,n),n};let Uh=class extends Ct{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.universal;if(i){const n=je.formatUniversalUrl(i,r,t);je.openHref(n,"_blank")}}openWebWallet(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isDesktop:n}=pt.getCachedRouterWalletPlatforms(),s=je.isMobile();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${r} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isDesktop="${s?!1:n}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Uh.styles=[Lt.globalCss,mN],zw([xi()],Uh.prototype,"isError",2),Uh=zw([Ut("wcm-web-connecting-view")],Uh);var yN=Object.freeze({__proto__:null,get WcmModal(){return cc},get WcmQrCode(){return Ms}});bn.EthereumProvider=kD,bn.OPTIONAL_EVENTS=g3,bn.OPTIONAL_METHODS=p3,bn.REQUIRED_EVENTS=lh,bn.REQUIRED_METHODS=fh,bn.default=dh,Object.defineProperty(bn,"__esModule",{value:!0})});
123
123
  //# sourceMappingURL=index.umd.js.map