@walletconnect/ethereum-provider 2.12.1 → 2.12.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(Dn,ka){typeof exports=="object"&&typeof module<"u"?ka(exports,require("stream")):typeof define=="function"&&define.amd?define(["exports","stream"],ka):(Dn=typeof globalThis<"u"?globalThis:Dn||self,ka(Dn["@walletconnect/ethereum-provider"]={},Dn.stream$1))})(this,function(Dn,ka){"use strict";var Jn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function s3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Us(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Dr={exports:{}},Lo=typeof Reflect=="object"?Reflect:null,Kp=Lo&&typeof Lo.apply=="function"?Lo.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},al;Lo&&typeof Lo.ownKeys=="function"?al=Lo.ownKeys:Object.getOwnPropertySymbols?al=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:al=function(e){return Object.getOwnPropertyNames(e)};function o3(t){console&&console.warn&&console.warn(t)}var Wp=Number.isNaN||function(e){return e!==e};function zt(){zt.init.call(this)}Dr.exports=zt,Dr.exports.once=u3,zt.EventEmitter=zt,zt.prototype._events=void 0,zt.prototype._eventsCount=0,zt.prototype._maxListeners=void 0;var Vp=10;function cl(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(zt,"defaultMaxListeners",{enumerable:!0,get:function(){return Vp},set:function(t){if(typeof t!="number"||t<0||Wp(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Vp=t}}),zt.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},zt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Wp(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 Gp(t){return t._maxListeners===void 0?zt.defaultMaxListeners:t._maxListeners}zt.prototype.getMaxListeners=function(){return Gp(this)},zt.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var c;if(r.length>0&&(c=r[0]),c instanceof Error)throw c;var l=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw l.context=c,l}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")Kp(f,this,r);else for(var h=f.length,m=Xp(f,h),n=0;n<h;++n)Kp(m[n],this,r);return!0};function Yp(t,e,r,n){var i,s,c;if(cl(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),c=s[e]),c===void 0)c=s[e]=r,++t._eventsCount;else if(typeof c=="function"?c=s[e]=n?[r,c]:[c,r]:n?c.unshift(r):c.push(r),i=Gp(t),i>0&&c.length>i&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=c.length,o3(l)}return t}zt.prototype.addListener=function(e,r){return Yp(this,e,r,!1)},zt.prototype.on=zt.prototype.addListener,zt.prototype.prependListener=function(e,r){return Yp(this,e,r,!0)};function a3(){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 Jp(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=a3.bind(n);return i.listener=r,n.wrapFn=i,i}zt.prototype.once=function(e,r){return cl(r),this.on(e,Jp(this,e,r)),this},zt.prototype.prependOnceListener=function(e,r){return cl(r),this.prependListener(e,Jp(this,e,r)),this},zt.prototype.removeListener=function(e,r){var n,i,s,c,l;if(cl(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,c=n.length-1;c>=0;c--)if(n[c]===r||n[c].listener===r){l=n[c].listener,s=c;break}if(s<0)return this;s===0?n.shift():c3(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,l||r)}return this},zt.prototype.off=zt.prototype.removeListener,zt.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),c;for(i=0;i<s.length;++i)c=s[i],c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Qp(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?l3(i):Xp(i,i.length)}zt.prototype.listeners=function(e){return Qp(this,e,!0)},zt.prototype.rawListeners=function(e){return Qp(this,e,!1)},zt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Zp.call(t,e)},zt.prototype.listenerCount=Zp;function Zp(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}zt.prototype.eventNames=function(){return this._eventsCount>0?al(this._events):[]};function Xp(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function c3(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function l3(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function u3(t,e){return new Promise(function(r,n){function i(c){t.removeListener(e,s),n(c)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}e1(t,e,s,{once:!0}),e!=="error"&&h3(t,i,{once:!0})})}function h3(t,e,r){typeof t.on=="function"&&e1(t,"error",e,r)}function e1(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var t1=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},f3=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),d3=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),p3=function(){function t(e,r,n,i){this.name=e,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return t}(),g3=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),m3=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),v3=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,y3=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,r1=3,w3=[["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",v3]],n1=[["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 b3(t){return t?i1(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new m3:typeof navigator<"u"?i1(navigator.userAgent):A3()}function _3(t){return t!==""&&w3.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function i1(t){var e=_3(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new g3;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<r1&&(i=t1(t1([],i,!0),x3(r1-i.length),!0)):i=[];var s=i.join("."),c=E3(t),l=y3.exec(t);return l&&l[1]?new p3(r,s,c,l[1]):new f3(r,s,c)}function E3(t){for(var e=0,r=n1.length;e<r;e++){var n=n1[e],i=n[0],s=n[1],c=s.exec(t);if(c)return i}return null}function A3(){var t=typeof process<"u"&&process.version;return t?new d3(process.version.slice(1)):null}function x3(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var _e={};/*! *****************************************************************************
1
+ (function(Yn,Fr){typeof exports=="object"&&typeof module<"u"?Fr(exports):typeof define=="function"&&define.amd?define(["exports"],Fr):(Yn=typeof globalThis<"u"?globalThis:Yn||self,Fr(Yn["@walletconnect/ethereum-provider"]={}))})(this,function(Yn){"use strict";var Fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function e3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function $o(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Dr={exports:{}},No=typeof Reflect=="object"?Reflect:null,Kp=No&&typeof No.apply=="function"?No.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},al;No&&typeof No.ownKeys=="function"?al=No.ownKeys:Object.getOwnPropertySymbols?al=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:al=function(e){return Object.getOwnPropertyNames(e)};function t3(t){console&&console.warn&&console.warn(t)}var Wp=Number.isNaN||function(e){return e!==e};function zt(){zt.init.call(this)}Dr.exports=zt,Dr.exports.once=s3,zt.EventEmitter=zt,zt.prototype._events=void 0,zt.prototype._eventsCount=0,zt.prototype._maxListeners=void 0;var Vp=10;function cl(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(zt,"defaultMaxListeners",{enumerable:!0,get:function(){return Vp},set:function(t){if(typeof t!="number"||t<0||Wp(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Vp=t}}),zt.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},zt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Wp(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 Gp(t){return t._maxListeners===void 0?zt.defaultMaxListeners:t._maxListeners}zt.prototype.getMaxListeners=function(){return Gp(this)},zt.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var c;if(r.length>0&&(c=r[0]),c instanceof Error)throw c;var l=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw l.context=c,l}var f=o[e];if(f===void 0)return!1;if(typeof f=="function")Kp(f,this,r);else for(var h=f.length,g=Xp(f,h),n=0;n<h;++n)Kp(g[n],this,r);return!0};function Yp(t,e,r,n){var i,o,c;if(cl(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),c=o[e]),c===void 0)c=o[e]=r,++t._eventsCount;else if(typeof c=="function"?c=o[e]=n?[r,c]:[c,r]:n?c.unshift(r):c.push(r),i=Gp(t),i>0&&c.length>i&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=c.length,t3(l)}return t}zt.prototype.addListener=function(e,r){return Yp(this,e,r,!1)},zt.prototype.on=zt.prototype.addListener,zt.prototype.prependListener=function(e,r){return Yp(this,e,r,!0)};function r3(){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 Jp(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=r3.bind(n);return i.listener=r,n.wrapFn=i,i}zt.prototype.once=function(e,r){return cl(r),this.on(e,Jp(this,e,r)),this},zt.prototype.prependOnceListener=function(e,r){return cl(r),this.prependListener(e,Jp(this,e,r)),this},zt.prototype.removeListener=function(e,r){var n,i,o,c,l;if(cl(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,c=n.length-1;c>=0;c--)if(n[c]===r||n[c].listener===r){l=n[c].listener,o=c;break}if(o<0)return this;o===0?n.shift():n3(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,l||r)}return this},zt.prototype.off=zt.prototype.removeListener,zt.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),c;for(i=0;i<o.length;++i)c=o[i],c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Qp(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?i3(i):Xp(i,i.length)}zt.prototype.listeners=function(e){return Qp(this,e,!0)},zt.prototype.rawListeners=function(e){return Qp(this,e,!1)},zt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Zp.call(t,e)},zt.prototype.listenerCount=Zp;function Zp(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}zt.prototype.eventNames=function(){return this._eventsCount>0?al(this._events):[]};function Xp(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function n3(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function i3(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function s3(t,e){return new Promise(function(r,n){function i(c){t.removeListener(e,o),n(c)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}e1(t,e,o,{once:!0}),e!=="error"&&o3(t,i,{once:!0})})}function o3(t,e,r){typeof t.on=="function"&&e1(t,"error",e,r)}function e1(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var t1=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},a3=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),c3=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),l3=function(){function t(e,r,n,i){this.name=e,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return t}(),u3=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),h3=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),f3=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,d3=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,r1=3,p3=[["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",f3]],n1=[["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 g3(t){return t?i1(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new h3:typeof navigator<"u"?i1(navigator.userAgent):w3()}function m3(t){return t!==""&&p3.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var o=i.exec(t);return!!o&&[n,o]},!1)}function i1(t){var e=m3(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new u3;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<r1&&(i=t1(t1([],i,!0),y3(r1-i.length),!0)):i=[];var o=i.join("."),c=v3(t),l=d3.exec(t);return l&&l[1]?new l3(r,o,c,l[1]):new a3(r,o,c)}function v3(t){for(var e=0,r=n1.length;e<r;e++){var n=n1[e],i=n[0],o=n[1],c=o.exec(t);if(c)return i}return null}function w3(){var t=typeof process<"u"&&process.version;return t?new c3(process.version.slice(1)):null}function y3(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var _e={};/*! *****************************************************************************
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 Nh=function(t,e){return Nh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Nh(t,e)};function S3(t,e){Nh(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Rh=function(){return Rh=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Rh.apply(this,arguments)};function I3(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function D3(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function C3(t,e){return function(r,n){e(r,n,t)}}function O3(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function P3(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function M3(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function T3(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function $3(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Lh(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s1(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function N3(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s1(arguments[e]));return t}function R3(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function qa(t){return this instanceof qa?(this.v=t,this):new qa(t)}function L3(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof qa?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function B3(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:qa(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function U3(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Lh=="function"?Lh(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function F3(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function j3(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function k3(t){return t&&t.__esModule?t:{default:t}}function q3(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function z3(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var H3=Object.freeze({__proto__:null,__extends:S3,get __assign(){return Rh},__rest:I3,__decorate:D3,__param:C3,__metadata:O3,__awaiter:P3,__generator:M3,__createBinding:T3,__exportStar:$3,__values:Lh,__read:s1,__spread:N3,__spreadArrays:R3,__await:qa,__asyncGenerator:L3,__asyncDelegator:B3,__asyncValues:U3,__makeTemplateObject:F3,__importStar:j3,__importDefault:k3,__classPrivateFieldGet:q3,__classPrivateFieldSet:z3}),ll=Us(H3),Bh={},za={},o1;function K3(){if(o1)return za;o1=1,Object.defineProperty(za,"__esModule",{value:!0}),za.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return za.delay=t,za}var Fs={},Uh={},js={},a1;function W3(){return a1||(a1=1,Object.defineProperty(js,"__esModule",{value:!0}),js.ONE_THOUSAND=js.ONE_HUNDRED=void 0,js.ONE_HUNDRED=100,js.ONE_THOUSAND=1e3),js}var Fh={},c1;function V3(){return c1||(c1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(Fh)),Fh}var l1;function u1(){return l1||(l1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(W3(),t),e.__exportStar(V3(),t)}(Uh)),Uh}var h1;function G3(){if(h1)return Fs;h1=1,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.fromMiliseconds=Fs.toMiliseconds=void 0;const t=u1();function e(n){return n*t.ONE_THOUSAND}Fs.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Fs.fromMiliseconds=r,Fs}var f1;function Y3(){return f1||(f1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(K3(),t),e.__exportStar(G3(),t)}(Bh)),Bh}var Bo={},d1;function J3(){if(d1)return Bo;d1=1,Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return Bo.Watch=t,Bo.default=t,Bo}var jh={},Ha={},p1;function Q3(){if(p1)return Ha;p1=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.IWatch=void 0;class t{}return Ha.IWatch=t,Ha}var g1;function Z3(){return g1||(g1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),ll.__exportStar(Q3(),t)}(jh)),jh}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(Y3(),t),e.__exportStar(J3(),t),e.__exportStar(Z3(),t),e.__exportStar(u1(),t)})(_e);var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.getLocalStorage=Jt.getLocalStorageOrThrow=Jt.getCrypto=Jt.getCryptoOrThrow=m1=Jt.getLocation=Jt.getLocationOrThrow=qh=Jt.getNavigator=Jt.getNavigatorOrThrow=kh=Jt.getDocument=Jt.getDocumentOrThrow=Jt.getFromWindowOrThrow=Jt.getFromWindow=void 0;function ks(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Jt.getFromWindow=ks;function Uo(t){const e=ks(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Jt.getFromWindowOrThrow=Uo;function X3(){return Uo("document")}Jt.getDocumentOrThrow=X3;function e6(){return ks("document")}var kh=Jt.getDocument=e6;function t6(){return Uo("navigator")}Jt.getNavigatorOrThrow=t6;function r6(){return ks("navigator")}var qh=Jt.getNavigator=r6;function n6(){return Uo("location")}Jt.getLocationOrThrow=n6;function i6(){return ks("location")}var m1=Jt.getLocation=i6;function s6(){return Uo("crypto")}Jt.getCryptoOrThrow=s6;function o6(){return ks("crypto")}Jt.getCrypto=o6;function a6(){return Uo("localStorage")}Jt.getLocalStorageOrThrow=a6;function c6(){return ks("localStorage")}Jt.getLocalStorage=c6;var zh={};Object.defineProperty(zh,"__esModule",{value:!0});var v1=zh.getWindowMetadata=void 0;const y1=Jt;function l6(){let t,e;try{t=y1.getDocumentOrThrow(),e=y1.getLocationOrThrow()}catch{return null}function r(){const _=t.getElementsByTagName("link"),E=[];for(let A=0;A<_.length;A++){const I=_[A],R=I.getAttribute("rel");if(R&&R.toLowerCase().indexOf("icon")>-1){const W=I.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let Y=e.protocol+"//"+e.host;if(W.indexOf("/")===0)Y+=W;else{const F=e.pathname.split("/");F.pop();const z=F.join("/");Y+=z+"/"+W}E.push(Y)}else if(W.indexOf("//")===0){const Y=e.protocol+W;E.push(Y)}else E.push(W)}}return E}function n(..._){const E=t.getElementsByTagName("meta");for(let A=0;A<E.length;A++){const I=E[A],R=["itemprop","property","name"].map(W=>I.getAttribute(W)).filter(W=>W?_.includes(W):!1);if(R.length&&R){const W=I.getAttribute("content");if(W)return W}}return""}function i(){let _=n("name","og:site_name","og:title","twitter:title");return _||(_=t.title),_}function s(){return n("description","og:description","twitter:description","keywords")}const c=i(),l=s(),f=e.origin,h=r();return{description:l,url:f,icons:h,name:c}}v1=zh.getWindowMetadata=l6;var Ka={},u6=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),w1="%[a-f0-9]{2}",b1=new RegExp("("+w1+")|([^%]+?)","gi"),_1=new RegExp("("+w1+")+","gi");function Hh(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Hh(r),Hh(n))}function h6(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(b1)||[],r=1;r<e.length;r++)t=Hh(e,r).join(""),e=t.match(b1)||[];return t}}function f6(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=_1.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=h6(r[0]);n!==r[0]&&(e[r[0]]=n)}r=_1.exec(t)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var c=i[s];t=t.replace(new RegExp(c,"g"),e[c])}return t}var d6=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return f6(t)}},p6=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},g6=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s<n.length;s++){var c=n[s],l=t[c];(i?e.indexOf(c)!==-1:e(c,l,t))&&(r[c]=l)}return r};(function(t){const e=u6,r=d6,n=p6,i=g6,s=F=>F==null,c=Symbol("encodeFragmentIdentifier");function l(F){switch(F.arrayFormat){case"index":return z=>($,j)=>{const P=$.length;return j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,[m(z,F),"[",P,"]"].join("")]:[...$,[m(z,F),"[",m(P,F),"]=",m(j,F)].join("")]};case"bracket":return z=>($,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,[m(z,F),"[]"].join("")]:[...$,[m(z,F),"[]=",m(j,F)].join("")];case"colon-list-separator":return z=>($,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,[m(z,F),":list="].join("")]:[...$,[m(z,F),":list=",m(j,F)].join("")];case"comma":case"separator":case"bracket-separator":{const z=F.arrayFormat==="bracket-separator"?"[]=":"=";return $=>(j,P)=>P===void 0||F.skipNull&&P===null||F.skipEmptyString&&P===""?j:(P=P===null?"":P,j.length===0?[[m($,F),z,m(P,F)].join("")]:[[j,m(P,F)].join(F.arrayFormatSeparator)])}default:return z=>($,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,m(z,F)]:[...$,[m(z,F),"=",m(j,F)].join("")]}}function f(F){let z;switch(F.arrayFormat){case"index":return($,j,P)=>{if(z=/\[(\d*)\]$/.exec($),$=$.replace(/\[\d*\]$/,""),!z){P[$]=j;return}P[$]===void 0&&(P[$]={}),P[$][z[1]]=j};case"bracket":return($,j,P)=>{if(z=/(\[\])$/.exec($),$=$.replace(/\[\]$/,""),!z){P[$]=j;return}if(P[$]===void 0){P[$]=[j];return}P[$]=[].concat(P[$],j)};case"colon-list-separator":return($,j,P)=>{if(z=/(:list)$/.exec($),$=$.replace(/:list$/,""),!z){P[$]=j;return}if(P[$]===void 0){P[$]=[j];return}P[$]=[].concat(P[$],j)};case"comma":case"separator":return($,j,P)=>{const g=typeof j=="string"&&j.includes(F.arrayFormatSeparator),C=typeof j=="string"&&!g&&_(j,F).includes(F.arrayFormatSeparator);j=C?_(j,F):j;const Z=g||C?j.split(F.arrayFormatSeparator).map(J=>_(J,F)):j===null?j:_(j,F);P[$]=Z};case"bracket-separator":return($,j,P)=>{const g=/(\[\])$/.test($);if($=$.replace(/\[\]$/,""),!g){P[$]=j&&_(j,F);return}const C=j===null?[]:j.split(F.arrayFormatSeparator).map(Z=>_(Z,F));if(P[$]===void 0){P[$]=C;return}P[$]=[].concat(P[$],C)};default:return($,j,P)=>{if(P[$]===void 0){P[$]=j;return}P[$]=[].concat(P[$],j)}}}function h(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(F,z){return z.encode?z.strict?e(F):encodeURIComponent(F):F}function _(F,z){return z.decode?r(F):F}function E(F){return Array.isArray(F)?F.sort():typeof F=="object"?E(Object.keys(F)).sort((z,$)=>Number(z)-Number($)).map(z=>F[z]):F}function A(F){const z=F.indexOf("#");return z!==-1&&(F=F.slice(0,z)),F}function I(F){let z="";const $=F.indexOf("#");return $!==-1&&(z=F.slice($)),z}function R(F){F=A(F);const z=F.indexOf("?");return z===-1?"":F.slice(z+1)}function W(F,z){return z.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):z.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function Y(F,z){z=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},z),h(z.arrayFormatSeparator);const $=f(z),j=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return j;for(const P of F.split("&")){if(P==="")continue;let[g,C]=n(z.decode?P.replace(/\+/g," "):P,"=");C=C===void 0?null:["comma","separator","bracket-separator"].includes(z.arrayFormat)?C:_(C,z),$(_(g,z),C,j)}for(const P of Object.keys(j)){const g=j[P];if(typeof g=="object"&&g!==null)for(const C of Object.keys(g))g[C]=W(g[C],z);else j[P]=W(g,z)}return z.sort===!1?j:(z.sort===!0?Object.keys(j).sort():Object.keys(j).sort(z.sort)).reduce((P,g)=>{const C=j[g];return C&&typeof C=="object"&&!Array.isArray(C)?P[g]=E(C):P[g]=C,P},Object.create(null))}t.extract=R,t.parse=Y,t.stringify=(F,z)=>{if(!F)return"";z=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},z),h(z.arrayFormatSeparator);const $=C=>z.skipNull&&s(F[C])||z.skipEmptyString&&F[C]==="",j=l(z),P={};for(const C of Object.keys(F))$(C)||(P[C]=F[C]);const g=Object.keys(P);return z.sort!==!1&&g.sort(z.sort),g.map(C=>{const Z=F[C];return Z===void 0?"":Z===null?m(C,z):Array.isArray(Z)?Z.length===0&&z.arrayFormat==="bracket-separator"?m(C,z)+"[]":Z.reduce(j(C),[]).join("&"):m(C,z)+"="+m(Z,z)}).filter(C=>C.length>0).join("&")},t.parseUrl=(F,z)=>{z=Object.assign({decode:!0},z);const[$,j]=n(F,"#");return Object.assign({url:$.split("?")[0]||"",query:Y(R(F),z)},z&&z.parseFragmentIdentifier&&j?{fragmentIdentifier:_(j,z)}:{})},t.stringifyUrl=(F,z)=>{z=Object.assign({encode:!0,strict:!0,[c]:!0},z);const $=A(F.url).split("?")[0]||"",j=t.extract(F.url),P=t.parse(j,{sort:!1}),g=Object.assign(P,F.query);let C=t.stringify(g,z);C&&(C=`?${C}`);let Z=I(F.url);return F.fragmentIdentifier&&(Z=`#${z[c]?m(F.fragmentIdentifier,z):F.fragmentIdentifier}`),`${$}${C}${Z}`},t.pick=(F,z,$)=>{$=Object.assign({parseFragmentIdentifier:!0,[c]:!1},$);const{url:j,query:P,fragmentIdentifier:g}=t.parseUrl(F,$);return t.stringifyUrl({url:j,query:i(P,z),fragmentIdentifier:g},$)},t.exclude=(F,z,$)=>{const j=Array.isArray(z)?P=>!z.includes(P):(P,g)=>!z(P,g);return t.pick(F,j,$)}})(Ka);var Kh={},ul={},ct={},E1={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(l,f){var h=l>>>16&65535,m=l&65535,_=f>>>16&65535,E=f&65535;return m*E+(h*E+m*_<<16>>>0)|0}t.mul=Math.imul||e;function r(l,f){return l+f|0}t.add=r;function n(l,f){return l-f|0}t.sub=n;function i(l,f){return l<<f|l>>>32-f}t.rotl=i;function s(l,f){return l<<32-f|l>>>f}t.rotr=s;function c(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}t.isInteger=Number.isInteger||c,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(l){return t.isInteger(l)&&l>=-t.MAX_SAFE_INTEGER&&l<=t.MAX_SAFE_INTEGER}})(E1),Object.defineProperty(ct,"__esModule",{value:!0});var A1=E1;function m6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}ct.readInt16BE=m6;function v6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}ct.readUint16BE=v6;function y6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}ct.readInt16LE=y6;function w6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}ct.readUint16LE=w6;function x1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}ct.writeUint16BE=x1,ct.writeInt16BE=x1;function S1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}ct.writeUint16LE=S1,ct.writeInt16LE=S1;function Wh(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}ct.readInt32BE=Wh;function Vh(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}ct.readUint32BE=Vh;function Gh(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}ct.readInt32LE=Gh;function Yh(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}ct.readUint32LE=Yh;function hl(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}ct.writeUint32BE=hl,ct.writeInt32BE=hl;function fl(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}ct.writeUint32LE=fl,ct.writeInt32LE=fl;function b6(t,e){e===void 0&&(e=0);var r=Wh(t,e),n=Wh(t,e+4);return r*4294967296+n-(n>>31)*4294967296}ct.readInt64BE=b6;function _6(t,e){e===void 0&&(e=0);var r=Vh(t,e),n=Vh(t,e+4);return r*4294967296+n}ct.readUint64BE=_6;function E6(t,e){e===void 0&&(e=0);var r=Gh(t,e),n=Gh(t,e+4);return n*4294967296+r-(r>>31)*4294967296}ct.readInt64LE=E6;function A6(t,e){e===void 0&&(e=0);var r=Yh(t,e),n=Yh(t,e+4);return n*4294967296+r}ct.readUint64LE=A6;function I1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),hl(t/4294967296>>>0,e,r),hl(t>>>0,e,r+4),e}ct.writeUint64BE=I1,ct.writeInt64BE=I1;function D1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fl(t>>>0,e,r),fl(t/4294967296>>>0,e,r+4),e}ct.writeUint64LE=D1,ct.writeInt64LE=D1;function x6(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}ct.readUintBE=x6;function S6(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+t/8;s++)n+=e[s]*i,i*=256;return n}ct.readUintLE=S6;function I6(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!A1.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=t/8+n-1;s>=n;s--)r[s]=e/i&255,i*=256;return r}ct.writeUintBE=I6;function D6(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!A1.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+t/8;s++)r[s]=e/i&255,i*=256;return r}ct.writeUintLE=D6;function C6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}ct.readFloat32BE=C6;function O6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}ct.readFloat32LE=O6;function P6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}ct.readFloat64BE=P6;function M6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}ct.readFloat64LE=M6;function T6(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t),e}ct.writeFloat32BE=T6;function $6(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t,!0),e}ct.writeFloat32LE=$6;function N6(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t),e}ct.writeFloat64BE=N6;function R6(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t,!0),e}ct.writeFloat64LE=R6;var fn={};Object.defineProperty(fn,"__esModule",{value:!0});function L6(t){for(var e=0;e<t.length;e++)t[e]=0;return t}fn.wipe=L6,Object.defineProperty(ul,"__esModule",{value:!0});var $r=ct,Jh=fn,B6=20;function U6(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,c=1797285236,l=r[3]<<24|r[2]<<16|r[1]<<8|r[0],f=r[7]<<24|r[6]<<16|r[5]<<8|r[4],h=r[11]<<24|r[10]<<16|r[9]<<8|r[8],m=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=r[19]<<24|r[18]<<16|r[17]<<8|r[16],E=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],I=r[31]<<24|r[30]<<16|r[29]<<8|r[28],R=e[3]<<24|e[2]<<16|e[1]<<8|e[0],W=e[7]<<24|e[6]<<16|e[5]<<8|e[4],Y=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],z=n,$=i,j=s,P=c,g=l,C=f,Z=h,J=m,te=_,ae=E,p=A,d=I,b=R,D=W,M=Y,N=F,U=0;U<B6;U+=2)z=z+g|0,b^=z,b=b>>>32-16|b<<16,te=te+b|0,g^=te,g=g>>>32-12|g<<12,$=$+C|0,D^=$,D=D>>>32-16|D<<16,ae=ae+D|0,C^=ae,C=C>>>32-12|C<<12,j=j+Z|0,M^=j,M=M>>>32-16|M<<16,p=p+M|0,Z^=p,Z=Z>>>32-12|Z<<12,P=P+J|0,N^=P,N=N>>>32-16|N<<16,d=d+N|0,J^=d,J=J>>>32-12|J<<12,j=j+Z|0,M^=j,M=M>>>32-8|M<<8,p=p+M|0,Z^=p,Z=Z>>>32-7|Z<<7,P=P+J|0,N^=P,N=N>>>32-8|N<<8,d=d+N|0,J^=d,J=J>>>32-7|J<<7,$=$+C|0,D^=$,D=D>>>32-8|D<<8,ae=ae+D|0,C^=ae,C=C>>>32-7|C<<7,z=z+g|0,b^=z,b=b>>>32-8|b<<8,te=te+b|0,g^=te,g=g>>>32-7|g<<7,z=z+C|0,N^=z,N=N>>>32-16|N<<16,p=p+N|0,C^=p,C=C>>>32-12|C<<12,$=$+Z|0,b^=$,b=b>>>32-16|b<<16,d=d+b|0,Z^=d,Z=Z>>>32-12|Z<<12,j=j+J|0,D^=j,D=D>>>32-16|D<<16,te=te+D|0,J^=te,J=J>>>32-12|J<<12,P=P+g|0,M^=P,M=M>>>32-16|M<<16,ae=ae+M|0,g^=ae,g=g>>>32-12|g<<12,j=j+J|0,D^=j,D=D>>>32-8|D<<8,te=te+D|0,J^=te,J=J>>>32-7|J<<7,P=P+g|0,M^=P,M=M>>>32-8|M<<8,ae=ae+M|0,g^=ae,g=g>>>32-7|g<<7,$=$+Z|0,b^=$,b=b>>>32-8|b<<8,d=d+b|0,Z^=d,Z=Z>>>32-7|Z<<7,z=z+C|0,N^=z,N=N>>>32-8|N<<8,p=p+N|0,C^=p,C=C>>>32-7|C<<7;$r.writeUint32LE(z+n|0,t,0),$r.writeUint32LE($+i|0,t,4),$r.writeUint32LE(j+s|0,t,8),$r.writeUint32LE(P+c|0,t,12),$r.writeUint32LE(g+l|0,t,16),$r.writeUint32LE(C+f|0,t,20),$r.writeUint32LE(Z+h|0,t,24),$r.writeUint32LE(J+m|0,t,28),$r.writeUint32LE(te+_|0,t,32),$r.writeUint32LE(ae+E|0,t,36),$r.writeUint32LE(p+A|0,t,40),$r.writeUint32LE(d+I|0,t,44),$r.writeUint32LE(b+R|0,t,48),$r.writeUint32LE(D+W|0,t,52),$r.writeUint32LE(M+Y|0,t,56),$r.writeUint32LE(N+F|0,t,60)}function C1(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,c;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),c=s.length-e.length,s.set(e,c)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,c=i}for(var l=new Uint8Array(64),f=0;f<r.length;f+=64){U6(l,s,t);for(var h=f;h<f+64&&h<r.length;h++)n[h]=r[h]^l[h-f];j6(s,0,c)}return Jh.wipe(l),i===0&&Jh.wipe(s),n}ul.streamXOR=C1;function F6(t,e,r,n){return n===void 0&&(n=0),Jh.wipe(r),C1(t,e,r,r,n)}ul.stream=F6;function j6(t,e,r){for(var n=1;r--;)n=n+(t[e]&255)|0,t[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var O1={},ns={};Object.defineProperty(ns,"__esModule",{value:!0});function k6(t,e,r){return~(t-1)&e|t-1&r}ns.select=k6;function q6(t,e){return(t|0)-(e|0)-1>>>31&1}ns.lessOrEqual=q6;function P1(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 1&r-1>>>8}ns.compare=P1;function z6(t,e){return t.length===0||e.length===0?!1:P1(t,e)!==0}ns.equal=z6,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ns,r=fn;t.DIGEST_LENGTH=16;var n=function(){function c(l){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var f=l[0]|l[1]<<8;this._r[0]=f&8191;var h=l[2]|l[3]<<8;this._r[1]=(f>>>13|h<<3)&8191;var m=l[4]|l[5]<<8;this._r[2]=(h>>>10|m<<6)&7939;var _=l[6]|l[7]<<8;this._r[3]=(m>>>7|_<<9)&8191;var E=l[8]|l[9]<<8;this._r[4]=(_>>>4|E<<12)&255,this._r[5]=E>>>1&8190;var A=l[10]|l[11]<<8;this._r[6]=(E>>>14|A<<2)&8191;var I=l[12]|l[13]<<8;this._r[7]=(A>>>11|I<<5)&8065;var R=l[14]|l[15]<<8;this._r[8]=(I>>>8|R<<8)&8191,this._r[9]=R>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return c.prototype._blocks=function(l,f,h){for(var m=this._fin?0:2048,_=this._h[0],E=this._h[1],A=this._h[2],I=this._h[3],R=this._h[4],W=this._h[5],Y=this._h[6],F=this._h[7],z=this._h[8],$=this._h[9],j=this._r[0],P=this._r[1],g=this._r[2],C=this._r[3],Z=this._r[4],J=this._r[5],te=this._r[6],ae=this._r[7],p=this._r[8],d=this._r[9];h>=16;){var b=l[f+0]|l[f+1]<<8;_+=b&8191;var D=l[f+2]|l[f+3]<<8;E+=(b>>>13|D<<3)&8191;var M=l[f+4]|l[f+5]<<8;A+=(D>>>10|M<<6)&8191;var N=l[f+6]|l[f+7]<<8;I+=(M>>>7|N<<9)&8191;var U=l[f+8]|l[f+9]<<8;R+=(N>>>4|U<<12)&8191,W+=U>>>1&8191;var O=l[f+10]|l[f+11]<<8;Y+=(U>>>14|O<<2)&8191;var v=l[f+12]|l[f+13]<<8;F+=(O>>>11|v<<5)&8191;var L=l[f+14]|l[f+15]<<8;z+=(v>>>8|L<<8)&8191,$+=L>>>5|m;var oe=0,de=oe;de+=_*j,de+=E*(5*d),de+=A*(5*p),de+=I*(5*ae),de+=R*(5*te),oe=de>>>13,de&=8191,de+=W*(5*J),de+=Y*(5*Z),de+=F*(5*C),de+=z*(5*g),de+=$*(5*P),oe+=de>>>13,de&=8191;var x=oe;x+=_*P,x+=E*j,x+=A*(5*d),x+=I*(5*p),x+=R*(5*ae),oe=x>>>13,x&=8191,x+=W*(5*te),x+=Y*(5*J),x+=F*(5*Z),x+=z*(5*C),x+=$*(5*g),oe+=x>>>13,x&=8191;var ne=oe;ne+=_*g,ne+=E*P,ne+=A*j,ne+=I*(5*d),ne+=R*(5*p),oe=ne>>>13,ne&=8191,ne+=W*(5*ae),ne+=Y*(5*te),ne+=F*(5*J),ne+=z*(5*Z),ne+=$*(5*C),oe+=ne>>>13,ne&=8191;var q=oe;q+=_*C,q+=E*g,q+=A*P,q+=I*j,q+=R*(5*d),oe=q>>>13,q&=8191,q+=W*(5*p),q+=Y*(5*ae),q+=F*(5*te),q+=z*(5*J),q+=$*(5*Z),oe+=q>>>13,q&=8191;var H=oe;H+=_*Z,H+=E*C,H+=A*g,H+=I*P,H+=R*j,oe=H>>>13,H&=8191,H+=W*(5*d),H+=Y*(5*p),H+=F*(5*ae),H+=z*(5*te),H+=$*(5*J),oe+=H>>>13,H&=8191;var V=oe;V+=_*J,V+=E*Z,V+=A*C,V+=I*g,V+=R*P,oe=V>>>13,V&=8191,V+=W*j,V+=Y*(5*d),V+=F*(5*p),V+=z*(5*ae),V+=$*(5*te),oe+=V>>>13,V&=8191;var y=oe;y+=_*te,y+=E*J,y+=A*Z,y+=I*C,y+=R*g,oe=y>>>13,y&=8191,y+=W*P,y+=Y*j,y+=F*(5*d),y+=z*(5*p),y+=$*(5*ae),oe+=y>>>13,y&=8191;var k=oe;k+=_*ae,k+=E*te,k+=A*J,k+=I*Z,k+=R*C,oe=k>>>13,k&=8191,k+=W*g,k+=Y*P,k+=F*j,k+=z*(5*d),k+=$*(5*p),oe+=k>>>13,k&=8191;var ie=oe;ie+=_*p,ie+=E*ae,ie+=A*te,ie+=I*J,ie+=R*Z,oe=ie>>>13,ie&=8191,ie+=W*C,ie+=Y*g,ie+=F*P,ie+=z*j,ie+=$*(5*d),oe+=ie>>>13,ie&=8191;var fe=oe;fe+=_*d,fe+=E*p,fe+=A*ae,fe+=I*te,fe+=R*J,oe=fe>>>13,fe&=8191,fe+=W*Z,fe+=Y*C,fe+=F*g,fe+=z*P,fe+=$*j,oe+=fe>>>13,fe&=8191,oe=(oe<<2)+oe|0,oe=oe+de|0,de=oe&8191,oe=oe>>>13,x+=oe,_=de,E=x,A=ne,I=q,R=H,W=V,Y=y,F=k,z=ie,$=fe,f+=16,h-=16}this._h[0]=_,this._h[1]=E,this._h[2]=A,this._h[3]=I,this._h[4]=R,this._h[5]=W,this._h[6]=Y,this._h[7]=F,this._h[8]=z,this._h[9]=$},c.prototype.finish=function(l,f){f===void 0&&(f=0);var h=new Uint16Array(10),m,_,E,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=m,m=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,h[0]=this._h[0]+5,m=h[0]>>>13,h[0]&=8191,A=1;A<10;A++)h[A]=this._h[A]+m,m=h[A]>>>13,h[A]&=8191;for(h[9]-=8192,_=(m^1)-1,A=0;A<10;A++)h[A]&=_;for(_=~_,A=0;A<10;A++)this._h[A]=this._h[A]&_|h[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,E=this._h[0]+this._pad[0],this._h[0]=E&65535,A=1;A<8;A++)E=(this._h[A]+this._pad[A]|0)+(E>>>16)|0,this._h[A]=E&65535;return l[f+0]=this._h[0]>>>0,l[f+1]=this._h[0]>>>8,l[f+2]=this._h[1]>>>0,l[f+3]=this._h[1]>>>8,l[f+4]=this._h[2]>>>0,l[f+5]=this._h[2]>>>8,l[f+6]=this._h[3]>>>0,l[f+7]=this._h[3]>>>8,l[f+8]=this._h[4]>>>0,l[f+9]=this._h[4]>>>8,l[f+10]=this._h[5]>>>0,l[f+11]=this._h[5]>>>8,l[f+12]=this._h[6]>>>0,l[f+13]=this._h[6]>>>8,l[f+14]=this._h[7]>>>0,l[f+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(l){var f=0,h=l.length,m;if(this._leftover){m=16-this._leftover,m>h&&(m=h);for(var _=0;_<m;_++)this._buffer[this._leftover+_]=l[f+_];if(h-=m,f+=m,this._leftover+=m,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(m=h-h%16,this._blocks(l,f,m),f+=m,h-=m),h){for(var _=0;_<h;_++)this._buffer[this._leftover+_]=l[f+_];this._leftover+=h}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},c.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},c}();t.Poly1305=n;function i(c,l){var f=new n(c);f.update(l);var h=f.digest();return f.clean(),h}t.oneTimeAuth=i;function s(c,l){return c.length!==t.DIGEST_LENGTH||l.length!==t.DIGEST_LENGTH?!1:e.equal(c,l)}t.equal=s}(O1),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ul,r=O1,n=fn,i=ct,s=ns;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var c=new Uint8Array(16),l=function(){function f(h){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,h.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return f.prototype.seal=function(h,m,_,E){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(h,A.length-h.length);var I=new Uint8Array(32);e.stream(this._key,A,I,4);var R=m.length+this.tagLength,W;if(E){if(E.length!==R)throw new Error("ChaCha20Poly1305: incorrect destination length");W=E}else W=new Uint8Array(R);return e.streamXOR(this._key,A,m,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),I,W.subarray(0,W.length-this.tagLength),_),n.wipe(A),W},f.prototype.open=function(h,m,_,E){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length<this.tagLength)return null;var A=new Uint8Array(16);A.set(h,A.length-h.length);var I=new Uint8Array(32);e.stream(this._key,A,I,4);var R=new Uint8Array(this.tagLength);if(this._authenticate(R,I,m.subarray(0,m.length-this.tagLength),_),!s.equal(R,m.subarray(m.length-this.tagLength,m.length)))return null;var W=m.length-this.tagLength,Y;if(E){if(E.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");Y=E}else Y=new Uint8Array(W);return e.streamXOR(this._key,A,m.subarray(0,m.length-this.tagLength),Y,4),n.wipe(A),Y},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,m,_,E){var A=new r.Poly1305(m);E&&(A.update(E),E.length%16>0&&A.update(c.subarray(E.length%16))),A.update(_),_.length%16>0&&A.update(c.subarray(_.length%16));var I=new Uint8Array(8);E&&i.writeUint64LE(E.length,I),A.update(I),i.writeUint64LE(_.length,I),A.update(I);for(var R=A.digest(),W=0;W<R.length;W++)h[W]=R[W];A.clean(),n.wipe(R),n.wipe(I)},f}();t.ChaCha20Poly1305=l}(Kh);var M1={},Wa={},Qh={};Object.defineProperty(Qh,"__esModule",{value:!0});function H6(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Qh.isSerializableHash=H6,Object.defineProperty(Wa,"__esModule",{value:!0});var ci=Qh,K6=ns,W6=fn,T1=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),ci.isSerializableHash(this._inner)&&ci.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),W6.wipe(n)}return t.prototype.reset=function(){if(!ci.isSerializableHash(this._inner)||!ci.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){ci.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),ci.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!ci.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!ci.isSerializableHash(this._inner)||!ci.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!ci.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Wa.HMAC=T1;function V6(t,e,r){var n=new T1(t,e);n.update(r);var i=n.digest();return n.clean(),i}Wa.hmac=V6,Wa.equal=K6.equal,Object.defineProperty(M1,"__esModule",{value:!0});var $1=Wa,N1=fn,G6=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=$1.hmac(this._hash,n,r);this._hmac=new $1.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n<r.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[n]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),N1.wipe(this._buffer),N1.wipe(this._counter),this._bufpos=0},t}(),Y6=M1.HKDF=G6,Fo={},dl={},pl={};Object.defineProperty(pl,"__esModule",{value:!0}),pl.BrowserRandomSource=void 0;const R1=65536;class J6{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n<r.length;n+=R1)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,R1)));return r}}pl.BrowserRandomSource=J6;function Q6(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var gl={},Z6={},X6=Object.freeze({__proto__:null,default:Z6}),e5=Us(X6);Object.defineProperty(gl,"__esModule",{value:!0}),gl.NodeRandomSource=void 0;const t5=fn;class r5{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Q6<"u"){const e=e5;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=r[i];return(0,t5.wipe)(r),n}}gl.NodeRandomSource=r5,Object.defineProperty(dl,"__esModule",{value:!0}),dl.SystemRandomSource=void 0;const n5=pl,i5=gl;class s5{constructor(){if(this.isAvailable=!1,this.name="",this._source=new n5.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new i5.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)}}dl.SystemRandomSource=s5,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=dl,r=ct,n=fn;t.defaultRandomSource=new e.SystemRandomSource;function i(h,m=t.defaultRandomSource){return m.randomBytes(h)}t.randomBytes=i;function s(h=t.defaultRandomSource){const m=i(4,h),_=(0,r.readUint32LE)(m);return(0,n.wipe)(m),_}t.randomUint32=s;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(h,m=c,_=t.defaultRandomSource){if(m.length<2)throw new Error("randomString charset is too short");if(m.length>256)throw new Error("randomString charset is too long");let E="";const A=m.length,I=256-256%A;for(;h>0;){const R=i(Math.ceil(h*256/I),_);for(let W=0;W<R.length&&h>0;W++){const Y=R[W];Y<I&&(E+=m.charAt(Y%A),h--)}(0,n.wipe)(R)}return E}t.randomString=l;function f(h,m=c,_=t.defaultRandomSource){const E=Math.ceil(h/(Math.log(m.length)/Math.LN2));return l(E,m,_)}t.randomStringForEntropy=f}(Fo);var ml={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ct,r=fn;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var n=function(){function l(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},l.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=s(this._temp,this._state,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},l.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,_=h/536870912|0,E=h<<3,A=h%64<56?64:128;this._buffer[m]=128;for(var I=m+1;I<A-8;I++)this._buffer[I]=0;e.writeUint32BE(_,this._buffer,A-8),e.writeUint32BE(E,this._buffer,A-4),s(this._temp,this._state,this._buffer,0,A),this._finished=!0}for(var I=0;I<this.digestLength/4;I++)e.writeUint32BE(this._state[I],f,I*4);return this},l.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},l.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}},l.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(f){r.wipe(f.state),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},l}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(l,f,h,m,_){for(;_>=64;){for(var E=f[0],A=f[1],I=f[2],R=f[3],W=f[4],Y=f[5],F=f[6],z=f[7],$=0;$<16;$++){var j=m+$*4;l[$]=e.readUint32BE(h,j)}for(var $=16;$<64;$++){var P=l[$-2],g=(P>>>17|P<<32-17)^(P>>>19|P<<32-19)^P>>>10;P=l[$-15];var C=(P>>>7|P<<32-7)^(P>>>18|P<<32-18)^P>>>3;l[$]=(g+l[$-7]|0)+(C+l[$-16]|0)}for(var $=0;$<64;$++){var g=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&Y^~W&F)|0)+(z+(i[$]+l[$]|0)|0)|0,C=((E>>>2|E<<32-2)^(E>>>13|E<<32-13)^(E>>>22|E<<32-22))+(E&A^E&I^A&I)|0;z=F,F=Y,Y=W,W=R+g|0,R=I,I=A,A=E,E=g+C|0}f[0]+=E,f[1]+=A,f[2]+=I,f[3]+=R,f[4]+=W,f[5]+=Y,f[6]+=F,f[7]+=z,m+=64,_-=64}return m}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}t.hash=c})(ml);var Zh={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Fo,r=fn;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n($){const j=new Float64Array(16);if($)for(let P=0;P<$.length;P++)j[P]=$[P];return j}const i=new Uint8Array(32);i[0]=9;const s=n([56129,1]);function c($){let j=1;for(let P=0;P<16;P++){let g=$[P]+j+65535;j=Math.floor(g/65536),$[P]=g-j*65536}$[0]+=j-1+37*(j-1)}function l($,j,P){const g=~(P-1);for(let C=0;C<16;C++){const Z=g&($[C]^j[C]);$[C]^=Z,j[C]^=Z}}function f($,j){const P=n(),g=n();for(let C=0;C<16;C++)g[C]=j[C];c(g),c(g),c(g);for(let C=0;C<2;C++){P[0]=g[0]-65517;for(let J=1;J<15;J++)P[J]=g[J]-65535-(P[J-1]>>16&1),P[J-1]&=65535;P[15]=g[15]-32767-(P[14]>>16&1);const Z=P[15]>>16&1;P[14]&=65535,l(g,P,1-Z)}for(let C=0;C<16;C++)$[2*C]=g[C]&255,$[2*C+1]=g[C]>>8}function h($,j){for(let P=0;P<16;P++)$[P]=j[2*P]+(j[2*P+1]<<8);$[15]&=32767}function m($,j,P){for(let g=0;g<16;g++)$[g]=j[g]+P[g]}function _($,j,P){for(let g=0;g<16;g++)$[g]=j[g]-P[g]}function E($,j,P){let g,C,Z=0,J=0,te=0,ae=0,p=0,d=0,b=0,D=0,M=0,N=0,U=0,O=0,v=0,L=0,oe=0,de=0,x=0,ne=0,q=0,H=0,V=0,y=0,k=0,ie=0,fe=0,ue=0,Oe=0,Me=0,Ie=0,Pt=0,ze=0,Ce=P[0],Fe=P[1],Ee=P[2],Ae=P[3],Ge=P[4],we=P[5],xe=P[6],Be=P[7],be=P[8],Pe=P[9],je=P[10],Te=P[11],$e=P[12],lt=P[13],Re=P[14],Ne=P[15];g=j[0],Z+=g*Ce,J+=g*Fe,te+=g*Ee,ae+=g*Ae,p+=g*Ge,d+=g*we,b+=g*xe,D+=g*Be,M+=g*be,N+=g*Pe,U+=g*je,O+=g*Te,v+=g*$e,L+=g*lt,oe+=g*Re,de+=g*Ne,g=j[1],J+=g*Ce,te+=g*Fe,ae+=g*Ee,p+=g*Ae,d+=g*Ge,b+=g*we,D+=g*xe,M+=g*Be,N+=g*be,U+=g*Pe,O+=g*je,v+=g*Te,L+=g*$e,oe+=g*lt,de+=g*Re,x+=g*Ne,g=j[2],te+=g*Ce,ae+=g*Fe,p+=g*Ee,d+=g*Ae,b+=g*Ge,D+=g*we,M+=g*xe,N+=g*Be,U+=g*be,O+=g*Pe,v+=g*je,L+=g*Te,oe+=g*$e,de+=g*lt,x+=g*Re,ne+=g*Ne,g=j[3],ae+=g*Ce,p+=g*Fe,d+=g*Ee,b+=g*Ae,D+=g*Ge,M+=g*we,N+=g*xe,U+=g*Be,O+=g*be,v+=g*Pe,L+=g*je,oe+=g*Te,de+=g*$e,x+=g*lt,ne+=g*Re,q+=g*Ne,g=j[4],p+=g*Ce,d+=g*Fe,b+=g*Ee,D+=g*Ae,M+=g*Ge,N+=g*we,U+=g*xe,O+=g*Be,v+=g*be,L+=g*Pe,oe+=g*je,de+=g*Te,x+=g*$e,ne+=g*lt,q+=g*Re,H+=g*Ne,g=j[5],d+=g*Ce,b+=g*Fe,D+=g*Ee,M+=g*Ae,N+=g*Ge,U+=g*we,O+=g*xe,v+=g*Be,L+=g*be,oe+=g*Pe,de+=g*je,x+=g*Te,ne+=g*$e,q+=g*lt,H+=g*Re,V+=g*Ne,g=j[6],b+=g*Ce,D+=g*Fe,M+=g*Ee,N+=g*Ae,U+=g*Ge,O+=g*we,v+=g*xe,L+=g*Be,oe+=g*be,de+=g*Pe,x+=g*je,ne+=g*Te,q+=g*$e,H+=g*lt,V+=g*Re,y+=g*Ne,g=j[7],D+=g*Ce,M+=g*Fe,N+=g*Ee,U+=g*Ae,O+=g*Ge,v+=g*we,L+=g*xe,oe+=g*Be,de+=g*be,x+=g*Pe,ne+=g*je,q+=g*Te,H+=g*$e,V+=g*lt,y+=g*Re,k+=g*Ne,g=j[8],M+=g*Ce,N+=g*Fe,U+=g*Ee,O+=g*Ae,v+=g*Ge,L+=g*we,oe+=g*xe,de+=g*Be,x+=g*be,ne+=g*Pe,q+=g*je,H+=g*Te,V+=g*$e,y+=g*lt,k+=g*Re,ie+=g*Ne,g=j[9],N+=g*Ce,U+=g*Fe,O+=g*Ee,v+=g*Ae,L+=g*Ge,oe+=g*we,de+=g*xe,x+=g*Be,ne+=g*be,q+=g*Pe,H+=g*je,V+=g*Te,y+=g*$e,k+=g*lt,ie+=g*Re,fe+=g*Ne,g=j[10],U+=g*Ce,O+=g*Fe,v+=g*Ee,L+=g*Ae,oe+=g*Ge,de+=g*we,x+=g*xe,ne+=g*Be,q+=g*be,H+=g*Pe,V+=g*je,y+=g*Te,k+=g*$e,ie+=g*lt,fe+=g*Re,ue+=g*Ne,g=j[11],O+=g*Ce,v+=g*Fe,L+=g*Ee,oe+=g*Ae,de+=g*Ge,x+=g*we,ne+=g*xe,q+=g*Be,H+=g*be,V+=g*Pe,y+=g*je,k+=g*Te,ie+=g*$e,fe+=g*lt,ue+=g*Re,Oe+=g*Ne,g=j[12],v+=g*Ce,L+=g*Fe,oe+=g*Ee,de+=g*Ae,x+=g*Ge,ne+=g*we,q+=g*xe,H+=g*Be,V+=g*be,y+=g*Pe,k+=g*je,ie+=g*Te,fe+=g*$e,ue+=g*lt,Oe+=g*Re,Me+=g*Ne,g=j[13],L+=g*Ce,oe+=g*Fe,de+=g*Ee,x+=g*Ae,ne+=g*Ge,q+=g*we,H+=g*xe,V+=g*Be,y+=g*be,k+=g*Pe,ie+=g*je,fe+=g*Te,ue+=g*$e,Oe+=g*lt,Me+=g*Re,Ie+=g*Ne,g=j[14],oe+=g*Ce,de+=g*Fe,x+=g*Ee,ne+=g*Ae,q+=g*Ge,H+=g*we,V+=g*xe,y+=g*Be,k+=g*be,ie+=g*Pe,fe+=g*je,ue+=g*Te,Oe+=g*$e,Me+=g*lt,Ie+=g*Re,Pt+=g*Ne,g=j[15],de+=g*Ce,x+=g*Fe,ne+=g*Ee,q+=g*Ae,H+=g*Ge,V+=g*we,y+=g*xe,k+=g*Be,ie+=g*be,fe+=g*Pe,ue+=g*je,Oe+=g*Te,Me+=g*$e,Ie+=g*lt,Pt+=g*Re,ze+=g*Ne,Z+=38*x,J+=38*ne,te+=38*q,ae+=38*H,p+=38*V,d+=38*y,b+=38*k,D+=38*ie,M+=38*fe,N+=38*ue,U+=38*Oe,O+=38*Me,v+=38*Ie,L+=38*Pt,oe+=38*ze,C=1,g=Z+C+65535,C=Math.floor(g/65536),Z=g-C*65536,g=J+C+65535,C=Math.floor(g/65536),J=g-C*65536,g=te+C+65535,C=Math.floor(g/65536),te=g-C*65536,g=ae+C+65535,C=Math.floor(g/65536),ae=g-C*65536,g=p+C+65535,C=Math.floor(g/65536),p=g-C*65536,g=d+C+65535,C=Math.floor(g/65536),d=g-C*65536,g=b+C+65535,C=Math.floor(g/65536),b=g-C*65536,g=D+C+65535,C=Math.floor(g/65536),D=g-C*65536,g=M+C+65535,C=Math.floor(g/65536),M=g-C*65536,g=N+C+65535,C=Math.floor(g/65536),N=g-C*65536,g=U+C+65535,C=Math.floor(g/65536),U=g-C*65536,g=O+C+65535,C=Math.floor(g/65536),O=g-C*65536,g=v+C+65535,C=Math.floor(g/65536),v=g-C*65536,g=L+C+65535,C=Math.floor(g/65536),L=g-C*65536,g=oe+C+65535,C=Math.floor(g/65536),oe=g-C*65536,g=de+C+65535,C=Math.floor(g/65536),de=g-C*65536,Z+=C-1+37*(C-1),C=1,g=Z+C+65535,C=Math.floor(g/65536),Z=g-C*65536,g=J+C+65535,C=Math.floor(g/65536),J=g-C*65536,g=te+C+65535,C=Math.floor(g/65536),te=g-C*65536,g=ae+C+65535,C=Math.floor(g/65536),ae=g-C*65536,g=p+C+65535,C=Math.floor(g/65536),p=g-C*65536,g=d+C+65535,C=Math.floor(g/65536),d=g-C*65536,g=b+C+65535,C=Math.floor(g/65536),b=g-C*65536,g=D+C+65535,C=Math.floor(g/65536),D=g-C*65536,g=M+C+65535,C=Math.floor(g/65536),M=g-C*65536,g=N+C+65535,C=Math.floor(g/65536),N=g-C*65536,g=U+C+65535,C=Math.floor(g/65536),U=g-C*65536,g=O+C+65535,C=Math.floor(g/65536),O=g-C*65536,g=v+C+65535,C=Math.floor(g/65536),v=g-C*65536,g=L+C+65535,C=Math.floor(g/65536),L=g-C*65536,g=oe+C+65535,C=Math.floor(g/65536),oe=g-C*65536,g=de+C+65535,C=Math.floor(g/65536),de=g-C*65536,Z+=C-1+37*(C-1),$[0]=Z,$[1]=J,$[2]=te,$[3]=ae,$[4]=p,$[5]=d,$[6]=b,$[7]=D,$[8]=M,$[9]=N,$[10]=U,$[11]=O,$[12]=v,$[13]=L,$[14]=oe,$[15]=de}function A($,j){E($,j,j)}function I($,j){const P=n();for(let g=0;g<16;g++)P[g]=j[g];for(let g=253;g>=0;g--)A(P,P),g!==2&&g!==4&&E(P,P,j);for(let g=0;g<16;g++)$[g]=P[g]}function R($,j){const P=new Uint8Array(32),g=new Float64Array(80),C=n(),Z=n(),J=n(),te=n(),ae=n(),p=n();for(let M=0;M<31;M++)P[M]=$[M];P[31]=$[31]&127|64,P[0]&=248,h(g,j);for(let M=0;M<16;M++)Z[M]=g[M];C[0]=te[0]=1;for(let M=254;M>=0;--M){const N=P[M>>>3]>>>(M&7)&1;l(C,Z,N),l(J,te,N),m(ae,C,J),_(C,C,J),m(J,Z,te),_(Z,Z,te),A(te,ae),A(p,C),E(C,J,C),E(J,Z,ae),m(ae,C,J),_(C,C,J),A(Z,C),_(J,te,p),E(C,J,s),m(C,C,te),E(J,J,C),E(C,te,p),E(te,Z,g),A(Z,ae),l(C,Z,N),l(J,te,N)}for(let M=0;M<16;M++)g[M+16]=C[M],g[M+32]=J[M],g[M+48]=Z[M],g[M+64]=te[M];const d=g.subarray(32),b=g.subarray(16);I(d,d),E(b,b,d);const D=new Uint8Array(32);return f(D,b),D}t.scalarMult=R;function W($){return R($,i)}t.scalarMultBase=W;function Y($){if($.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const j=new Uint8Array($);return{publicKey:W(j),secretKey:j}}t.generateKeyPairFromSeed=Y;function F($){const j=(0,e.randomBytes)(32,$),P=Y(j);return(0,r.wipe)(j),P}t.generateKeyPair=F;function z($,j,P=!1){if($.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(j.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const g=R($,j);if(P){let C=0;for(let Z=0;Z<g.length;Z++)C|=g[Z];if(C===0)throw new Error("X25519: invalid shared key")}return g}t.sharedKey=z})(Zh);function Xh(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function L1(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Xh(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function ef(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=L1(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return Xh(r)}function o5(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),c=s.charCodeAt(0);if(r[c]!==255)throw new TypeError(s+" is ambiguous");r[c]=i}var l=t.length,f=t.charAt(0),h=Math.log(l)/Math.log(256),m=Math.log(256)/Math.log(l);function _(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var R=0,W=0,Y=0,F=I.length;Y!==F&&I[Y]===0;)Y++,R++;for(var z=(F-Y)*m+1>>>0,$=new Uint8Array(z);Y!==F;){for(var j=I[Y],P=0,g=z-1;(j!==0||P<W)&&g!==-1;g--,P++)j+=256*$[g]>>>0,$[g]=j%l>>>0,j=j/l>>>0;if(j!==0)throw new Error("Non-zero carry");W=P,Y++}for(var C=z-W;C!==z&&$[C]===0;)C++;for(var Z=f.repeat(R);C<z;++C)Z+=t.charAt($[C]);return Z}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var R=0;if(I[R]!==" "){for(var W=0,Y=0;I[R]===f;)W++,R++;for(var F=(I.length-R)*h+1>>>0,z=new Uint8Array(F);I[R];){var $=r[I.charCodeAt(R)];if($===255)return;for(var j=0,P=F-1;($!==0||j<Y)&&P!==-1;P--,j++)$+=l*z[P]>>>0,z[P]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");Y=j,R++}if(I[R]!==" "){for(var g=F-Y;g!==F&&z[g]===0;)g++;for(var C=new Uint8Array(W+(F-g)),Z=W;g!==F;)C[Z++]=z[g++];return C}}}function A(I){var R=E(I);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:A}}var a5=o5,c5=a5;const B1=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},l5=t=>new TextEncoder().encode(t),u5=t=>new TextDecoder().decode(t);class h5{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class f5{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return U1(this,e)}}class d5{constructor(e){this.decoders=e}or(e){return U1(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const U1=(t,e)=>new d5({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class p5{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new h5(e,r,n),this.decoder=new f5(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vl=({name:t,prefix:e,encode:r,decode:n})=>new p5(t,e,r,n),Va=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=c5(r,e);return vl({prefix:t,name:e,encode:n,decode:s=>B1(i(s))})},g5=(t,e,r,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let s=t.length;for(;t[s-1]==="=";)--s;const c=new Uint8Array(s*r/8|0);let l=0,f=0,h=0;for(let m=0;m<s;++m){const _=i[t[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|_,l+=r,l>=8&&(l-=8,c[h++]=255&f>>l)}if(l>=r||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return c},m5=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",c=0,l=0;for(let f=0;f<t.length;++f)for(l=l<<8|t[f],c+=8;c>r;)c-=r,s+=e[i&l>>c];if(c&&(s+=e[i&l<<r-c]),n)for(;s.length*r&7;)s+="=";return s},Cr=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>vl({prefix:e,name:t,encode(i){return m5(i,n,r)},decode(i){return g5(i,n,r,t)}}),v5=vl({prefix:"\0",name:"identity",encode:t=>u5(t),decode:t=>l5(t)});var y5=Object.freeze({__proto__:null,identity:v5});const w5=Cr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var b5=Object.freeze({__proto__:null,base2:w5});const _5=Cr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var E5=Object.freeze({__proto__:null,base8:_5});const A5=Va({prefix:"9",name:"base10",alphabet:"0123456789"});var x5=Object.freeze({__proto__:null,base10:A5});const S5=Cr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),I5=Cr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var D5=Object.freeze({__proto__:null,base16:S5,base16upper:I5});const C5=Cr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),O5=Cr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),P5=Cr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),M5=Cr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),T5=Cr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$5=Cr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),N5=Cr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),R5=Cr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),L5=Cr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var B5=Object.freeze({__proto__:null,base32:C5,base32upper:O5,base32pad:P5,base32padupper:M5,base32hex:T5,base32hexupper:$5,base32hexpad:N5,base32hexpadupper:R5,base32z:L5});const U5=Va({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),F5=Va({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var j5=Object.freeze({__proto__:null,base36:U5,base36upper:F5});const k5=Va({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),q5=Va({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var z5=Object.freeze({__proto__:null,base58btc:k5,base58flickr:q5});const H5=Cr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),K5=Cr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),W5=Cr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),V5=Cr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var G5=Object.freeze({__proto__:null,base64:H5,base64pad:K5,base64url:W5,base64urlpad:V5});const F1=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}"),Y5=F1.reduce((t,e,r)=>(t[r]=e,t),[]),J5=F1.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Q5(t){return t.reduce((e,r)=>(e+=Y5[r],e),"")}function Z5(t){const e=[];for(const r of t){const n=J5[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const X5=vl({prefix:"\u{1F680}",name:"base256emoji",encode:Q5,decode:Z5});var e_=Object.freeze({__proto__:null,base256emoji:X5}),t_=k1,j1=128,r_=127,n_=~r_,i_=Math.pow(2,31);function k1(t,e,r){e=e||[],r=r||0;for(var n=r;t>=i_;)e[r++]=t&255|j1,t/=128;for(;t&n_;)e[r++]=t&255|j1,t>>>=7;return e[r]=t|0,k1.bytes=r-n+1,e}var s_=tf,o_=128,q1=127;function tf(t,n){var r=0,n=n||0,i=0,s=n,c,l=t.length;do{if(s>=l)throw tf.bytes=0,new RangeError("Could not decode varint");c=t[s++],r+=i<28?(c&q1)<<i:(c&q1)*Math.pow(2,i),i+=7}while(c>=o_);return tf.bytes=s-n,r}var a_=Math.pow(2,7),c_=Math.pow(2,14),l_=Math.pow(2,21),u_=Math.pow(2,28),h_=Math.pow(2,35),f_=Math.pow(2,42),d_=Math.pow(2,49),p_=Math.pow(2,56),g_=Math.pow(2,63),m_=function(t){return t<a_?1:t<c_?2:t<l_?3:t<u_?4:t<h_?5:t<f_?6:t<d_?7:t<p_?8:t<g_?9:10},v_={encode:t_,decode:s_,encodingLength:m_},z1=v_;const H1=(t,e,r=0)=>(z1.encode(t,e,r),e),K1=t=>z1.encodingLength(t),rf=(t,e)=>{const r=e.byteLength,n=K1(t),i=n+K1(r),s=new Uint8Array(i+r);return H1(t,s,0),H1(r,s,n),s.set(e,i),new y_(t,r,e,s)};class y_{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const W1=({name:t,code:e,encode:r})=>new w_(t,e,r);class w_{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?rf(this.code,r):r.then(n=>rf(this.code,n))}else throw Error("Unknown type, must be binary type")}}const V1=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),b_=W1({name:"sha2-256",code:18,encode:V1("SHA-256")}),__=W1({name:"sha2-512",code:19,encode:V1("SHA-512")});var E_=Object.freeze({__proto__:null,sha256:b_,sha512:__});const G1=0,A_="identity",Y1=B1;var x_=Object.freeze({__proto__:null,identity:{code:G1,name:A_,encode:Y1,digest:t=>rf(G1,Y1(t))}});new TextEncoder,new TextDecoder;const J1={...y5,...b5,...E5,...x5,...D5,...B5,...j5,...z5,...G5,...e_};({...E_,...x_});function Q1(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Z1=Q1("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),nf=Q1("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=L1(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),X1={utf8:Z1,"utf-8":Z1,hex:J1.base16,latin1:nf,ascii:nf,binary:nf,...J1};function Xr(t,e="utf8"){const r=X1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xh(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Fr(t,e="utf8"){const r=X1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const S_={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},I_=":";function yl(t){const[e,r]=t.split(I_);return{namespace:e,reference:r}}function eg(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function tg(t,e){return t.includes(":")?[t]:e.chains||[]}var D_=Object.defineProperty,rg=Object.getOwnPropertySymbols,C_=Object.prototype.hasOwnProperty,O_=Object.prototype.propertyIsEnumerable,ng=(t,e,r)=>e in t?D_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ig=(t,e)=>{for(var r in e||(e={}))C_.call(e,r)&&ng(t,r,e[r]);if(rg)for(var r of rg(e))O_.call(e,r)&&ng(t,r,e[r]);return t};const P_="ReactNative",dn={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},M_="js";function Ga(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function jo(){return!kh()&&!!qh()&&navigator.product===P_}function ko(){return!Ga()&&!!qh()&&!!kh()}function Ya(){return jo()?dn.reactNative:Ga()?dn.node:ko()?dn.browser:dn.unknown}function T_(){var t;try{return jo()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function $_(t,e){let r=Ka.parse(t);return r=ig(ig({},r),e),t=Ka.stringify(r),t}function N_(){return v1()||{name:"",description:"",url:"",icons:[""]}}function R_(){if(Ya()===dn.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=b3();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function L_(){var t;const e=Ya();return e===dn.browser?[e,((t=m1())==null?void 0:t.host)||"unknown"].join(":"):e}function B_(t,e,r){const n=R_(),i=L_();return[[t,e].join("-"),[M_,r].join("-"),n,i].join("/")}function U_({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:c,bundleId:l}){const f=r.split("?"),h=B_(t,e,n),m={auth:i,ua:h,projectId:s,useOnCloseEvent:c||void 0,origin:l||void 0},_=$_(f[1]||"",m);return f[0]+"?"+_}function qs(t,e){return t.filter(r=>e.includes(r)).length===t.length}function sg(t){return Object.fromEntries(t.entries())}function og(t){return new Map(Object.entries(t))}function zs(t=_e.FIVE_MINUTES,e){const r=_e.toMiliseconds(t||_e.FIVE_MINUTES);let n,i,s;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c))},reject:c=>{s&&i&&(clearTimeout(s),i(c))},done:()=>new Promise((c,l)=>{s=setTimeout(()=>{l(new Error(e))},r),n=c,i=l})}}function Ja(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const c=await t;n(c)}catch(c){i(c)}clearTimeout(s)})}function ag(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function F_(t){return ag("topic",t)}function j_(t){return ag("id",t)}function cg(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Nr(t,e){return _e.fromMiliseconds((e||Date.now())+_e.toMiliseconds(t))}function is(t){return Date.now()>=_e.toMiliseconds(t)}function yt(t,e){return`${t}${e?`:${e}`:""}`}function wl(t=[],e=[]){return[...new Set([...t,...e])]}async function k_({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;const n=typeof r=="string"?JSON.parse(r):r;let i=n?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));const s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,c=Ya();c===dn.browser?s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):c===dn.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function q_(t,e){try{return await t.getItem(e)||(ko()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var lg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function z_(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var ug={exports:{}};/**
14
+ ***************************************************************************** */var Bh=function(t,e){return Bh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Bh(t,e)};function b3(t,e){Bh(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Uh=function(){return Uh=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Uh.apply(this,arguments)};function _3(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function E3(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(i<3?c(o):i>3?c(e,r,o):c(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}function A3(t,e){return function(r,n){e(r,n,t)}}function x3(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function I3(t,e,r,n){function i(o){return o instanceof r?o:new r(function(c){c(o)})}return new(r||(r=Promise))(function(o,c){function l(g){try{h(n.next(g))}catch(_){c(_)}}function f(g){try{h(n.throw(g))}catch(_){c(_)}}function h(g){g.done?o(g.value):i(g.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function S3(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(g){return f([h,g])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=h[0]&2?i.return:h[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,h[1])).done)return o;switch(i=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){r.label=h[1];break}if(h[0]===6&&r.label<o[1]){r.label=o[1],o=h;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(h);break}o[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(g){h=[6,g],i=0}finally{n=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function D3(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function C3(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Fh(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s1(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return o}function O3(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s1(arguments[e]));return t}function P3(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var o=arguments[e],c=0,l=o.length;c<l;c++,i++)n[i]=o[c];return n}function ka(t){return this instanceof ka?(this.v=t,this):new ka(t)}function M3(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(S,U){o.push([E,A,S,U])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(S){_(o[0][3],S)}}function f(E){E.value instanceof ka?Promise.resolve(E.value.v).then(h,g):_(o[0][2],E)}function h(E){l("next",E)}function g(E){l("throw",E)}function _(E,A){E(A),o.shift(),o.length&&l(o[0][0],o[0][1])}}function T3(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,o){e[i]=t[i]?function(c){return(r=!r)?{value:ka(t[i](c)),done:i==="return"}:o?o(c):c}:o}}function $3(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Fh=="function"?Fh(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(c){return new Promise(function(l,f){c=t[o](c),i(l,f,c.done,c.value)})}}function i(o,c,l,f){Promise.resolve(f).then(function(h){o({value:h,done:l})},c)}}function N3(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function R3(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function L3(t){return t&&t.__esModule?t:{default:t}}function B3(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function U3(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var F3=Object.freeze({__proto__:null,__extends:b3,get __assign(){return Uh},__rest:_3,__decorate:E3,__param:A3,__metadata:x3,__awaiter:I3,__generator:S3,__createBinding:D3,__exportStar:C3,__values:Fh,__read:s1,__spread:O3,__spreadArrays:P3,__await:ka,__asyncGenerator:M3,__asyncDelegator:T3,__asyncValues:$3,__makeTemplateObject:N3,__importStar:R3,__importDefault:L3,__classPrivateFieldGet:B3,__classPrivateFieldSet:U3}),ll=$o(F3),jh={},qa={},o1;function j3(){if(o1)return qa;o1=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return qa.delay=t,qa}var Us={},kh={},Fs={},a1;function k3(){return a1||(a1=1,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.ONE_THOUSAND=Fs.ONE_HUNDRED=void 0,Fs.ONE_HUNDRED=100,Fs.ONE_THOUSAND=1e3),Fs}var qh={},c1;function q3(){return c1||(c1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(qh)),qh}var l1;function u1(){return l1||(l1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(k3(),t),e.__exportStar(q3(),t)}(kh)),kh}var h1;function z3(){if(h1)return Us;h1=1,Object.defineProperty(Us,"__esModule",{value:!0}),Us.fromMiliseconds=Us.toMiliseconds=void 0;const t=u1();function e(n){return n*t.ONE_THOUSAND}Us.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Us.fromMiliseconds=r,Us}var f1;function H3(){return f1||(f1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(j3(),t),e.__exportStar(z3(),t)}(jh)),jh}var Ro={},d1;function K3(){if(d1)return Ro;d1=1,Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return Ro.Watch=t,Ro.default=t,Ro}var zh={},za={},p1;function W3(){if(p1)return za;p1=1,Object.defineProperty(za,"__esModule",{value:!0}),za.IWatch=void 0;class t{}return za.IWatch=t,za}var g1;function V3(){return g1||(g1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),ll.__exportStar(W3(),t)}(zh)),zh}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(H3(),t),e.__exportStar(K3(),t),e.__exportStar(V3(),t),e.__exportStar(u1(),t)})(_e);var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.getLocalStorage=Jt.getLocalStorageOrThrow=Jt.getCrypto=Jt.getCryptoOrThrow=m1=Jt.getLocation=Jt.getLocationOrThrow=Kh=Jt.getNavigator=Jt.getNavigatorOrThrow=Hh=Jt.getDocument=Jt.getDocumentOrThrow=Jt.getFromWindowOrThrow=Jt.getFromWindow=void 0;function js(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Jt.getFromWindow=js;function Lo(t){const e=js(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Jt.getFromWindowOrThrow=Lo;function G3(){return Lo("document")}Jt.getDocumentOrThrow=G3;function Y3(){return js("document")}var Hh=Jt.getDocument=Y3;function J3(){return Lo("navigator")}Jt.getNavigatorOrThrow=J3;function Q3(){return js("navigator")}var Kh=Jt.getNavigator=Q3;function Z3(){return Lo("location")}Jt.getLocationOrThrow=Z3;function X3(){return js("location")}var m1=Jt.getLocation=X3;function e6(){return Lo("crypto")}Jt.getCryptoOrThrow=e6;function t6(){return js("crypto")}Jt.getCrypto=t6;function r6(){return Lo("localStorage")}Jt.getLocalStorageOrThrow=r6;function n6(){return js("localStorage")}Jt.getLocalStorage=n6;var Wh={};Object.defineProperty(Wh,"__esModule",{value:!0});var v1=Wh.getWindowMetadata=void 0;const w1=Jt;function i6(){let t,e;try{t=w1.getDocumentOrThrow(),e=w1.getLocationOrThrow()}catch{return null}function r(){const _=t.getElementsByTagName("link"),E=[];for(let A=0;A<_.length;A++){const S=_[A],U=S.getAttribute("rel");if(U&&U.toLowerCase().indexOf("icon")>-1){const W=S.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let Y=e.protocol+"//"+e.host;if(W.indexOf("/")===0)Y+=W;else{const B=e.pathname.split("/");B.pop();const z=B.join("/");Y+=z+"/"+W}E.push(Y)}else if(W.indexOf("//")===0){const Y=e.protocol+W;E.push(Y)}else E.push(W)}}return E}function n(..._){const E=t.getElementsByTagName("meta");for(let A=0;A<E.length;A++){const S=E[A],U=["itemprop","property","name"].map(W=>S.getAttribute(W)).filter(W=>W?_.includes(W):!1);if(U.length&&U){const W=S.getAttribute("content");if(W)return W}}return""}function i(){let _=n("name","og:site_name","og:title","twitter:title");return _||(_=t.title),_}function o(){return n("description","og:description","twitter:description","keywords")}const c=i(),l=o(),f=e.origin,h=r();return{description:l,url:f,icons:h,name:c}}v1=Wh.getWindowMetadata=i6;var Ha={},s6=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),y1="%[a-f0-9]{2}",b1=new RegExp("("+y1+")|([^%]+?)","gi"),_1=new RegExp("("+y1+")+","gi");function Vh(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Vh(r),Vh(n))}function o6(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(b1)||[],r=1;r<e.length;r++)t=Vh(e,r).join(""),e=t.match(b1)||[];return t}}function a6(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=_1.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=o6(r[0]);n!==r[0]&&(e[r[0]]=n)}r=_1.exec(t)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),o=0;o<i.length;o++){var c=i[o];t=t.replace(new RegExp(c,"g"),e[c])}return t}var c6=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return a6(t)}},l6=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},u6=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),o=0;o<n.length;o++){var c=n[o],l=t[c];(i?e.indexOf(c)!==-1:e(c,l,t))&&(r[c]=l)}return r};(function(t){const e=s6,r=c6,n=l6,i=u6,o=B=>B==null,c=Symbol("encodeFragmentIdentifier");function l(B){switch(B.arrayFormat){case"index":return z=>(P,F)=>{const j=P.length;return F===void 0||B.skipNull&&F===null||B.skipEmptyString&&F===""?P:F===null?[...P,[g(z,B),"[",j,"]"].join("")]:[...P,[g(z,B),"[",g(j,B),"]=",g(F,B)].join("")]};case"bracket":return z=>(P,F)=>F===void 0||B.skipNull&&F===null||B.skipEmptyString&&F===""?P:F===null?[...P,[g(z,B),"[]"].join("")]:[...P,[g(z,B),"[]=",g(F,B)].join("")];case"colon-list-separator":return z=>(P,F)=>F===void 0||B.skipNull&&F===null||B.skipEmptyString&&F===""?P:F===null?[...P,[g(z,B),":list="].join("")]:[...P,[g(z,B),":list=",g(F,B)].join("")];case"comma":case"separator":case"bracket-separator":{const z=B.arrayFormat==="bracket-separator"?"[]=":"=";return P=>(F,j)=>j===void 0||B.skipNull&&j===null||B.skipEmptyString&&j===""?F:(j=j===null?"":j,F.length===0?[[g(P,B),z,g(j,B)].join("")]:[[F,g(j,B)].join(B.arrayFormatSeparator)])}default:return z=>(P,F)=>F===void 0||B.skipNull&&F===null||B.skipEmptyString&&F===""?P:F===null?[...P,g(z,B)]:[...P,[g(z,B),"=",g(F,B)].join("")]}}function f(B){let z;switch(B.arrayFormat){case"index":return(P,F,j)=>{if(z=/\[(\d*)\]$/.exec(P),P=P.replace(/\[\d*\]$/,""),!z){j[P]=F;return}j[P]===void 0&&(j[P]={}),j[P][z[1]]=F};case"bracket":return(P,F,j)=>{if(z=/(\[\])$/.exec(P),P=P.replace(/\[\]$/,""),!z){j[P]=F;return}if(j[P]===void 0){j[P]=[F];return}j[P]=[].concat(j[P],F)};case"colon-list-separator":return(P,F,j)=>{if(z=/(:list)$/.exec(P),P=P.replace(/:list$/,""),!z){j[P]=F;return}if(j[P]===void 0){j[P]=[F];return}j[P]=[].concat(j[P],F)};case"comma":case"separator":return(P,F,j)=>{const m=typeof F=="string"&&F.includes(B.arrayFormatSeparator),T=typeof F=="string"&&!m&&_(F,B).includes(B.arrayFormatSeparator);F=T?_(F,B):F;const te=m||T?F.split(B.arrayFormatSeparator).map(ee=>_(ee,B)):F===null?F:_(F,B);j[P]=te};case"bracket-separator":return(P,F,j)=>{const m=/(\[\])$/.test(P);if(P=P.replace(/\[\]$/,""),!m){j[P]=F&&_(F,B);return}const T=F===null?[]:F.split(B.arrayFormatSeparator).map(te=>_(te,B));if(j[P]===void 0){j[P]=T;return}j[P]=[].concat(j[P],T)};default:return(P,F,j)=>{if(j[P]===void 0){j[P]=F;return}j[P]=[].concat(j[P],F)}}}function h(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(B,z){return z.encode?z.strict?e(B):encodeURIComponent(B):B}function _(B,z){return z.decode?r(B):B}function E(B){return Array.isArray(B)?B.sort():typeof B=="object"?E(Object.keys(B)).sort((z,P)=>Number(z)-Number(P)).map(z=>B[z]):B}function A(B){const z=B.indexOf("#");return z!==-1&&(B=B.slice(0,z)),B}function S(B){let z="";const P=B.indexOf("#");return P!==-1&&(z=B.slice(P)),z}function U(B){B=A(B);const z=B.indexOf("?");return z===-1?"":B.slice(z+1)}function W(B,z){return z.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):z.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function Y(B,z){z=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},z),h(z.arrayFormatSeparator);const P=f(z),F=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return F;for(const j of B.split("&")){if(j==="")continue;let[m,T]=n(z.decode?j.replace(/\+/g," "):j,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(z.arrayFormat)?T:_(T,z),P(_(m,z),T,F)}for(const j of Object.keys(F)){const m=F[j];if(typeof m=="object"&&m!==null)for(const T of Object.keys(m))m[T]=W(m[T],z);else F[j]=W(m,z)}return z.sort===!1?F:(z.sort===!0?Object.keys(F).sort():Object.keys(F).sort(z.sort)).reduce((j,m)=>{const T=F[m];return T&&typeof T=="object"&&!Array.isArray(T)?j[m]=E(T):j[m]=T,j},Object.create(null))}t.extract=U,t.parse=Y,t.stringify=(B,z)=>{if(!B)return"";z=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},z),h(z.arrayFormatSeparator);const P=T=>z.skipNull&&o(B[T])||z.skipEmptyString&&B[T]==="",F=l(z),j={};for(const T of Object.keys(B))P(T)||(j[T]=B[T]);const m=Object.keys(j);return z.sort!==!1&&m.sort(z.sort),m.map(T=>{const te=B[T];return te===void 0?"":te===null?g(T,z):Array.isArray(te)?te.length===0&&z.arrayFormat==="bracket-separator"?g(T,z)+"[]":te.reduce(F(T),[]).join("&"):g(T,z)+"="+g(te,z)}).filter(T=>T.length>0).join("&")},t.parseUrl=(B,z)=>{z=Object.assign({decode:!0},z);const[P,F]=n(B,"#");return Object.assign({url:P.split("?")[0]||"",query:Y(U(B),z)},z&&z.parseFragmentIdentifier&&F?{fragmentIdentifier:_(F,z)}:{})},t.stringifyUrl=(B,z)=>{z=Object.assign({encode:!0,strict:!0,[c]:!0},z);const P=A(B.url).split("?")[0]||"",F=t.extract(B.url),j=t.parse(F,{sort:!1}),m=Object.assign(j,B.query);let T=t.stringify(m,z);T&&(T=`?${T}`);let te=S(B.url);return B.fragmentIdentifier&&(te=`#${z[c]?g(B.fragmentIdentifier,z):B.fragmentIdentifier}`),`${P}${T}${te}`},t.pick=(B,z,P)=>{P=Object.assign({parseFragmentIdentifier:!0,[c]:!1},P);const{url:F,query:j,fragmentIdentifier:m}=t.parseUrl(B,P);return t.stringifyUrl({url:F,query:i(j,z),fragmentIdentifier:m},P)},t.exclude=(B,z,P)=>{const F=Array.isArray(z)?j=>!z.includes(j):(j,m)=>!z(j,m);return t.pick(B,F,P)}})(Ha);var Gh={},ul={},ct={},E1={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(l,f){var h=l>>>16&65535,g=l&65535,_=f>>>16&65535,E=f&65535;return g*E+(h*E+g*_<<16>>>0)|0}t.mul=Math.imul||e;function r(l,f){return l+f|0}t.add=r;function n(l,f){return l-f|0}t.sub=n;function i(l,f){return l<<f|l>>>32-f}t.rotl=i;function o(l,f){return l<<32-f|l>>>f}t.rotr=o;function c(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}t.isInteger=Number.isInteger||c,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(l){return t.isInteger(l)&&l>=-t.MAX_SAFE_INTEGER&&l<=t.MAX_SAFE_INTEGER}})(E1),Object.defineProperty(ct,"__esModule",{value:!0});var A1=E1;function h6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}ct.readInt16BE=h6;function f6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}ct.readUint16BE=f6;function d6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}ct.readInt16LE=d6;function p6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}ct.readUint16LE=p6;function x1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}ct.writeUint16BE=x1,ct.writeInt16BE=x1;function I1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}ct.writeUint16LE=I1,ct.writeInt16LE=I1;function Yh(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}ct.readInt32BE=Yh;function Jh(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}ct.readUint32BE=Jh;function Qh(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}ct.readInt32LE=Qh;function Zh(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}ct.readUint32LE=Zh;function hl(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}ct.writeUint32BE=hl,ct.writeInt32BE=hl;function fl(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}ct.writeUint32LE=fl,ct.writeInt32LE=fl;function g6(t,e){e===void 0&&(e=0);var r=Yh(t,e),n=Yh(t,e+4);return r*4294967296+n-(n>>31)*4294967296}ct.readInt64BE=g6;function m6(t,e){e===void 0&&(e=0);var r=Jh(t,e),n=Jh(t,e+4);return r*4294967296+n}ct.readUint64BE=m6;function v6(t,e){e===void 0&&(e=0);var r=Qh(t,e),n=Qh(t,e+4);return n*4294967296+r-(r>>31)*4294967296}ct.readInt64LE=v6;function w6(t,e){e===void 0&&(e=0);var r=Zh(t,e),n=Zh(t,e+4);return n*4294967296+r}ct.readUint64LE=w6;function S1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),hl(t/4294967296>>>0,e,r),hl(t>>>0,e,r+4),e}ct.writeUint64BE=S1,ct.writeInt64BE=S1;function D1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fl(t>>>0,e,r),fl(t/4294967296>>>0,e,r+4),e}ct.writeUint64LE=D1,ct.writeInt64LE=D1;function y6(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=t/8+r-1;o>=r;o--)n+=e[o]*i,i*=256;return n}ct.readUintBE=y6;function b6(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o<r+t/8;o++)n+=e[o]*i,i*=256;return n}ct.readUintLE=b6;function _6(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!A1.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,o=t/8+n-1;o>=n;o--)r[o]=e/i&255,i*=256;return r}ct.writeUintBE=_6;function E6(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!A1.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,o=n;o<n+t/8;o++)r[o]=e/i&255,i*=256;return r}ct.writeUintLE=E6;function A6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}ct.readFloat32BE=A6;function x6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}ct.readFloat32LE=x6;function I6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}ct.readFloat64BE=I6;function S6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}ct.readFloat64LE=S6;function D6(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t),e}ct.writeFloat32BE=D6;function C6(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t,!0),e}ct.writeFloat32LE=C6;function O6(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t),e}ct.writeFloat64BE=O6;function P6(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t,!0),e}ct.writeFloat64LE=P6;var pn={};Object.defineProperty(pn,"__esModule",{value:!0});function M6(t){for(var e=0;e<t.length;e++)t[e]=0;return t}pn.wipe=M6,Object.defineProperty(ul,"__esModule",{value:!0});var $r=ct,Xh=pn,T6=20;function $6(t,e,r){for(var n=1634760805,i=857760878,o=2036477234,c=1797285236,l=r[3]<<24|r[2]<<16|r[1]<<8|r[0],f=r[7]<<24|r[6]<<16|r[5]<<8|r[4],h=r[11]<<24|r[10]<<16|r[9]<<8|r[8],g=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=r[19]<<24|r[18]<<16|r[17]<<8|r[16],E=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],S=r[31]<<24|r[30]<<16|r[29]<<8|r[28],U=e[3]<<24|e[2]<<16|e[1]<<8|e[0],W=e[7]<<24|e[6]<<16|e[5]<<8|e[4],Y=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],z=n,P=i,F=o,j=c,m=l,T=f,te=h,ee=g,ne=_,fe=E,d=A,p=S,b=U,D=W,O=Y,$=B,L=0;L<T6;L+=2)z=z+m|0,b^=z,b=b>>>32-16|b<<16,ne=ne+b|0,m^=ne,m=m>>>32-12|m<<12,P=P+T|0,D^=P,D=D>>>32-16|D<<16,fe=fe+D|0,T^=fe,T=T>>>32-12|T<<12,F=F+te|0,O^=F,O=O>>>32-16|O<<16,d=d+O|0,te^=d,te=te>>>32-12|te<<12,j=j+ee|0,$^=j,$=$>>>32-16|$<<16,p=p+$|0,ee^=p,ee=ee>>>32-12|ee<<12,F=F+te|0,O^=F,O=O>>>32-8|O<<8,d=d+O|0,te^=d,te=te>>>32-7|te<<7,j=j+ee|0,$^=j,$=$>>>32-8|$<<8,p=p+$|0,ee^=p,ee=ee>>>32-7|ee<<7,P=P+T|0,D^=P,D=D>>>32-8|D<<8,fe=fe+D|0,T^=fe,T=T>>>32-7|T<<7,z=z+m|0,b^=z,b=b>>>32-8|b<<8,ne=ne+b|0,m^=ne,m=m>>>32-7|m<<7,z=z+T|0,$^=z,$=$>>>32-16|$<<16,d=d+$|0,T^=d,T=T>>>32-12|T<<12,P=P+te|0,b^=P,b=b>>>32-16|b<<16,p=p+b|0,te^=p,te=te>>>32-12|te<<12,F=F+ee|0,D^=F,D=D>>>32-16|D<<16,ne=ne+D|0,ee^=ne,ee=ee>>>32-12|ee<<12,j=j+m|0,O^=j,O=O>>>32-16|O<<16,fe=fe+O|0,m^=fe,m=m>>>32-12|m<<12,F=F+ee|0,D^=F,D=D>>>32-8|D<<8,ne=ne+D|0,ee^=ne,ee=ee>>>32-7|ee<<7,j=j+m|0,O^=j,O=O>>>32-8|O<<8,fe=fe+O|0,m^=fe,m=m>>>32-7|m<<7,P=P+te|0,b^=P,b=b>>>32-8|b<<8,p=p+b|0,te^=p,te=te>>>32-7|te<<7,z=z+T|0,$^=z,$=$>>>32-8|$<<8,d=d+$|0,T^=d,T=T>>>32-7|T<<7;$r.writeUint32LE(z+n|0,t,0),$r.writeUint32LE(P+i|0,t,4),$r.writeUint32LE(F+o|0,t,8),$r.writeUint32LE(j+c|0,t,12),$r.writeUint32LE(m+l|0,t,16),$r.writeUint32LE(T+f|0,t,20),$r.writeUint32LE(te+h|0,t,24),$r.writeUint32LE(ee+g|0,t,28),$r.writeUint32LE(ne+_|0,t,32),$r.writeUint32LE(fe+E|0,t,36),$r.writeUint32LE(d+A|0,t,40),$r.writeUint32LE(p+S|0,t,44),$r.writeUint32LE(b+U|0,t,48),$r.writeUint32LE(D+W|0,t,52),$r.writeUint32LE(O+Y|0,t,56),$r.writeUint32LE($+B|0,t,60)}function C1(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var o,c;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");o=new Uint8Array(16),c=o.length-e.length,o.set(e,c)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");o=e,c=i}for(var l=new Uint8Array(64),f=0;f<r.length;f+=64){$6(l,o,t);for(var h=f;h<f+64&&h<r.length;h++)n[h]=r[h]^l[h-f];R6(o,0,c)}return Xh.wipe(l),i===0&&Xh.wipe(o),n}ul.streamXOR=C1;function N6(t,e,r,n){return n===void 0&&(n=0),Xh.wipe(r),C1(t,e,r,r,n)}ul.stream=N6;function R6(t,e,r){for(var n=1;r--;)n=n+(t[e]&255)|0,t[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var O1={},is={};Object.defineProperty(is,"__esModule",{value:!0});function L6(t,e,r){return~(t-1)&e|t-1&r}is.select=L6;function B6(t,e){return(t|0)-(e|0)-1>>>31&1}is.lessOrEqual=B6;function P1(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 1&r-1>>>8}is.compare=P1;function U6(t,e){return t.length===0||e.length===0?!1:P1(t,e)!==0}is.equal=U6,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=is,r=pn;t.DIGEST_LENGTH=16;var n=function(){function c(l){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var f=l[0]|l[1]<<8;this._r[0]=f&8191;var h=l[2]|l[3]<<8;this._r[1]=(f>>>13|h<<3)&8191;var g=l[4]|l[5]<<8;this._r[2]=(h>>>10|g<<6)&7939;var _=l[6]|l[7]<<8;this._r[3]=(g>>>7|_<<9)&8191;var E=l[8]|l[9]<<8;this._r[4]=(_>>>4|E<<12)&255,this._r[5]=E>>>1&8190;var A=l[10]|l[11]<<8;this._r[6]=(E>>>14|A<<2)&8191;var S=l[12]|l[13]<<8;this._r[7]=(A>>>11|S<<5)&8065;var U=l[14]|l[15]<<8;this._r[8]=(S>>>8|U<<8)&8191,this._r[9]=U>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return c.prototype._blocks=function(l,f,h){for(var g=this._fin?0:2048,_=this._h[0],E=this._h[1],A=this._h[2],S=this._h[3],U=this._h[4],W=this._h[5],Y=this._h[6],B=this._h[7],z=this._h[8],P=this._h[9],F=this._r[0],j=this._r[1],m=this._r[2],T=this._r[3],te=this._r[4],ee=this._r[5],ne=this._r[6],fe=this._r[7],d=this._r[8],p=this._r[9];h>=16;){var b=l[f+0]|l[f+1]<<8;_+=b&8191;var D=l[f+2]|l[f+3]<<8;E+=(b>>>13|D<<3)&8191;var O=l[f+4]|l[f+5]<<8;A+=(D>>>10|O<<6)&8191;var $=l[f+6]|l[f+7]<<8;S+=(O>>>7|$<<9)&8191;var L=l[f+8]|l[f+9]<<8;U+=($>>>4|L<<12)&8191,W+=L>>>1&8191;var C=l[f+10]|l[f+11]<<8;Y+=(L>>>14|C<<2)&8191;var v=l[f+12]|l[f+13]<<8;B+=(C>>>11|v<<5)&8191;var N=l[f+14]|l[f+15]<<8;z+=(v>>>8|N<<8)&8191,P+=N>>>5|g;var oe=0,pe=oe;pe+=_*F,pe+=E*(5*p),pe+=A*(5*d),pe+=S*(5*fe),pe+=U*(5*ne),oe=pe>>>13,pe&=8191,pe+=W*(5*ee),pe+=Y*(5*te),pe+=B*(5*T),pe+=z*(5*m),pe+=P*(5*j),oe+=pe>>>13,pe&=8191;var x=oe;x+=_*j,x+=E*F,x+=A*(5*p),x+=S*(5*d),x+=U*(5*fe),oe=x>>>13,x&=8191,x+=W*(5*ne),x+=Y*(5*ee),x+=B*(5*te),x+=z*(5*T),x+=P*(5*m),oe+=x>>>13,x&=8191;var re=oe;re+=_*m,re+=E*j,re+=A*F,re+=S*(5*p),re+=U*(5*d),oe=re>>>13,re&=8191,re+=W*(5*fe),re+=Y*(5*ne),re+=B*(5*ee),re+=z*(5*te),re+=P*(5*T),oe+=re>>>13,re&=8191;var q=oe;q+=_*T,q+=E*m,q+=A*j,q+=S*F,q+=U*(5*p),oe=q>>>13,q&=8191,q+=W*(5*d),q+=Y*(5*fe),q+=B*(5*ne),q+=z*(5*ee),q+=P*(5*te),oe+=q>>>13,q&=8191;var H=oe;H+=_*te,H+=E*T,H+=A*m,H+=S*j,H+=U*F,oe=H>>>13,H&=8191,H+=W*(5*p),H+=Y*(5*d),H+=B*(5*fe),H+=z*(5*ne),H+=P*(5*ee),oe+=H>>>13,H&=8191;var V=oe;V+=_*ee,V+=E*te,V+=A*T,V+=S*m,V+=U*j,oe=V>>>13,V&=8191,V+=W*F,V+=Y*(5*p),V+=B*(5*d),V+=z*(5*fe),V+=P*(5*ne),oe+=V>>>13,V&=8191;var w=oe;w+=_*ne,w+=E*ee,w+=A*te,w+=S*T,w+=U*m,oe=w>>>13,w&=8191,w+=W*j,w+=Y*F,w+=B*(5*p),w+=z*(5*d),w+=P*(5*fe),oe+=w>>>13,w&=8191;var k=oe;k+=_*fe,k+=E*ne,k+=A*ee,k+=S*te,k+=U*T,oe=k>>>13,k&=8191,k+=W*m,k+=Y*j,k+=B*F,k+=z*(5*p),k+=P*(5*d),oe+=k>>>13,k&=8191;var ie=oe;ie+=_*d,ie+=E*fe,ie+=A*ne,ie+=S*ee,ie+=U*te,oe=ie>>>13,ie&=8191,ie+=W*T,ie+=Y*m,ie+=B*j,ie+=z*F,ie+=P*(5*p),oe+=ie>>>13,ie&=8191;var he=oe;he+=_*p,he+=E*d,he+=A*fe,he+=S*ne,he+=U*ee,oe=he>>>13,he&=8191,he+=W*te,he+=Y*T,he+=B*m,he+=z*j,he+=P*F,oe+=he>>>13,he&=8191,oe=(oe<<2)+oe|0,oe=oe+pe|0,pe=oe&8191,oe=oe>>>13,x+=oe,_=pe,E=x,A=re,S=q,U=H,W=V,Y=w,B=k,z=ie,P=he,f+=16,h-=16}this._h[0]=_,this._h[1]=E,this._h[2]=A,this._h[3]=S,this._h[4]=U,this._h[5]=W,this._h[6]=Y,this._h[7]=B,this._h[8]=z,this._h[9]=P},c.prototype.finish=function(l,f){f===void 0&&(f=0);var h=new Uint16Array(10),g,_,E,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(g=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=g,g=this._h[A]>>>13,this._h[A]&=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,h[0]=this._h[0]+5,g=h[0]>>>13,h[0]&=8191,A=1;A<10;A++)h[A]=this._h[A]+g,g=h[A]>>>13,h[A]&=8191;for(h[9]-=8192,_=(g^1)-1,A=0;A<10;A++)h[A]&=_;for(_=~_,A=0;A<10;A++)this._h[A]=this._h[A]&_|h[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,E=this._h[0]+this._pad[0],this._h[0]=E&65535,A=1;A<8;A++)E=(this._h[A]+this._pad[A]|0)+(E>>>16)|0,this._h[A]=E&65535;return l[f+0]=this._h[0]>>>0,l[f+1]=this._h[0]>>>8,l[f+2]=this._h[1]>>>0,l[f+3]=this._h[1]>>>8,l[f+4]=this._h[2]>>>0,l[f+5]=this._h[2]>>>8,l[f+6]=this._h[3]>>>0,l[f+7]=this._h[3]>>>8,l[f+8]=this._h[4]>>>0,l[f+9]=this._h[4]>>>8,l[f+10]=this._h[5]>>>0,l[f+11]=this._h[5]>>>8,l[f+12]=this._h[6]>>>0,l[f+13]=this._h[6]>>>8,l[f+14]=this._h[7]>>>0,l[f+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(l){var f=0,h=l.length,g;if(this._leftover){g=16-this._leftover,g>h&&(g=h);for(var _=0;_<g;_++)this._buffer[this._leftover+_]=l[f+_];if(h-=g,f+=g,this._leftover+=g,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(g=h-h%16,this._blocks(l,f,g),f+=g,h-=g),h){for(var _=0;_<h;_++)this._buffer[this._leftover+_]=l[f+_];this._leftover+=h}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},c.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},c}();t.Poly1305=n;function i(c,l){var f=new n(c);f.update(l);var h=f.digest();return f.clean(),h}t.oneTimeAuth=i;function o(c,l){return c.length!==t.DIGEST_LENGTH||l.length!==t.DIGEST_LENGTH?!1:e.equal(c,l)}t.equal=o}(O1),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ul,r=O1,n=pn,i=ct,o=is;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var c=new Uint8Array(16),l=function(){function f(h){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,h.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return f.prototype.seal=function(h,g,_,E){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(h,A.length-h.length);var S=new Uint8Array(32);e.stream(this._key,A,S,4);var U=g.length+this.tagLength,W;if(E){if(E.length!==U)throw new Error("ChaCha20Poly1305: incorrect destination length");W=E}else W=new Uint8Array(U);return e.streamXOR(this._key,A,g,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),S,W.subarray(0,W.length-this.tagLength),_),n.wipe(A),W},f.prototype.open=function(h,g,_,E){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(g.length<this.tagLength)return null;var A=new Uint8Array(16);A.set(h,A.length-h.length);var S=new Uint8Array(32);e.stream(this._key,A,S,4);var U=new Uint8Array(this.tagLength);if(this._authenticate(U,S,g.subarray(0,g.length-this.tagLength),_),!o.equal(U,g.subarray(g.length-this.tagLength,g.length)))return null;var W=g.length-this.tagLength,Y;if(E){if(E.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");Y=E}else Y=new Uint8Array(W);return e.streamXOR(this._key,A,g.subarray(0,g.length-this.tagLength),Y,4),n.wipe(A),Y},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,g,_,E){var A=new r.Poly1305(g);E&&(A.update(E),E.length%16>0&&A.update(c.subarray(E.length%16))),A.update(_),_.length%16>0&&A.update(c.subarray(_.length%16));var S=new Uint8Array(8);E&&i.writeUint64LE(E.length,S),A.update(S),i.writeUint64LE(_.length,S),A.update(S);for(var U=A.digest(),W=0;W<U.length;W++)h[W]=U[W];A.clean(),n.wipe(U),n.wipe(S)},f}();t.ChaCha20Poly1305=l}(Gh);var M1={},Ka={},ef={};Object.defineProperty(ef,"__esModule",{value:!0});function F6(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}ef.isSerializableHash=F6,Object.defineProperty(Ka,"__esModule",{value:!0});var ai=ef,j6=is,k6=pn,T1=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),ai.isSerializableHash(this._inner)&&ai.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),k6.wipe(n)}return t.prototype.reset=function(){if(!ai.isSerializableHash(this._inner)||!ai.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){ai.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),ai.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!ai.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!ai.isSerializableHash(this._inner)||!ai.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!ai.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Ka.HMAC=T1;function q6(t,e,r){var n=new T1(t,e);n.update(r);var i=n.digest();return n.clean(),i}Ka.hmac=q6,Ka.equal=j6.equal,Object.defineProperty(M1,"__esModule",{value:!0});var $1=Ka,N1=pn,z6=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=$1.hmac(this._hash,n,r);this._hmac=new $1.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n<r.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[n]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),N1.wipe(this._buffer),N1.wipe(this._counter),this._bufpos=0},t}(),H6=M1.HKDF=z6,Bo={},dl={},pl={};Object.defineProperty(pl,"__esModule",{value:!0}),pl.BrowserRandomSource=void 0;const R1=65536;class K6{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n<r.length;n+=R1)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,R1)));return r}}pl.BrowserRandomSource=K6;function W6(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var gl={},V6={},G6=Object.freeze({__proto__:null,default:V6}),Y6=$o(G6);Object.defineProperty(gl,"__esModule",{value:!0}),gl.NodeRandomSource=void 0;const J6=pn;class Q6{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof W6<"u"){const e=Y6;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=r[i];return(0,J6.wipe)(r),n}}gl.NodeRandomSource=Q6,Object.defineProperty(dl,"__esModule",{value:!0}),dl.SystemRandomSource=void 0;const Z6=pl,X6=gl;class e5{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Z6.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new X6.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)}}dl.SystemRandomSource=e5,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=dl,r=ct,n=pn;t.defaultRandomSource=new e.SystemRandomSource;function i(h,g=t.defaultRandomSource){return g.randomBytes(h)}t.randomBytes=i;function o(h=t.defaultRandomSource){const g=i(4,h),_=(0,r.readUint32LE)(g);return(0,n.wipe)(g),_}t.randomUint32=o;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(h,g=c,_=t.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 E="";const A=g.length,S=256-256%A;for(;h>0;){const U=i(Math.ceil(h*256/S),_);for(let W=0;W<U.length&&h>0;W++){const Y=U[W];Y<S&&(E+=g.charAt(Y%A),h--)}(0,n.wipe)(U)}return E}t.randomString=l;function f(h,g=c,_=t.defaultRandomSource){const E=Math.ceil(h/(Math.log(g.length)/Math.LN2));return l(E,g,_)}t.randomStringForEntropy=f}(Bo);var ml={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ct,r=pn;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var n=function(){function l(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},l.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=f[g++],h--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(g=o(this._temp,this._state,f,g,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[g++],h--;return this},l.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,g=this._bufferLength,_=h/536870912|0,E=h<<3,A=h%64<56?64:128;this._buffer[g]=128;for(var S=g+1;S<A-8;S++)this._buffer[S]=0;e.writeUint32BE(_,this._buffer,A-8),e.writeUint32BE(E,this._buffer,A-4),o(this._temp,this._state,this._buffer,0,A),this._finished=!0}for(var S=0;S<this.digestLength/4;S++)e.writeUint32BE(this._state[S],f,S*4);return this},l.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},l.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}},l.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(f){r.wipe(f.state),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},l}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function o(l,f,h,g,_){for(;_>=64;){for(var E=f[0],A=f[1],S=f[2],U=f[3],W=f[4],Y=f[5],B=f[6],z=f[7],P=0;P<16;P++){var F=g+P*4;l[P]=e.readUint32BE(h,F)}for(var P=16;P<64;P++){var j=l[P-2],m=(j>>>17|j<<32-17)^(j>>>19|j<<32-19)^j>>>10;j=l[P-15];var T=(j>>>7|j<<32-7)^(j>>>18|j<<32-18)^j>>>3;l[P]=(m+l[P-7]|0)+(T+l[P-16]|0)}for(var P=0;P<64;P++){var m=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&Y^~W&B)|0)+(z+(i[P]+l[P]|0)|0)|0,T=((E>>>2|E<<32-2)^(E>>>13|E<<32-13)^(E>>>22|E<<32-22))+(E&A^E&S^A&S)|0;z=B,B=Y,Y=W,W=U+m|0,U=S,S=A,A=E,E=m+T|0}f[0]+=E,f[1]+=A,f[2]+=S,f[3]+=U,f[4]+=W,f[5]+=Y,f[6]+=B,f[7]+=z,g+=64,_-=64}return g}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}t.hash=c})(ml);var tf={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Bo,r=pn;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(P){const F=new Float64Array(16);if(P)for(let j=0;j<P.length;j++)F[j]=P[j];return F}const i=new Uint8Array(32);i[0]=9;const o=n([56129,1]);function c(P){let F=1;for(let j=0;j<16;j++){let m=P[j]+F+65535;F=Math.floor(m/65536),P[j]=m-F*65536}P[0]+=F-1+37*(F-1)}function l(P,F,j){const m=~(j-1);for(let T=0;T<16;T++){const te=m&(P[T]^F[T]);P[T]^=te,F[T]^=te}}function f(P,F){const j=n(),m=n();for(let T=0;T<16;T++)m[T]=F[T];c(m),c(m),c(m);for(let T=0;T<2;T++){j[0]=m[0]-65517;for(let ee=1;ee<15;ee++)j[ee]=m[ee]-65535-(j[ee-1]>>16&1),j[ee-1]&=65535;j[15]=m[15]-32767-(j[14]>>16&1);const te=j[15]>>16&1;j[14]&=65535,l(m,j,1-te)}for(let T=0;T<16;T++)P[2*T]=m[T]&255,P[2*T+1]=m[T]>>8}function h(P,F){for(let j=0;j<16;j++)P[j]=F[2*j]+(F[2*j+1]<<8);P[15]&=32767}function g(P,F,j){for(let m=0;m<16;m++)P[m]=F[m]+j[m]}function _(P,F,j){for(let m=0;m<16;m++)P[m]=F[m]-j[m]}function E(P,F,j){let m,T,te=0,ee=0,ne=0,fe=0,d=0,p=0,b=0,D=0,O=0,$=0,L=0,C=0,v=0,N=0,oe=0,pe=0,x=0,re=0,q=0,H=0,V=0,w=0,k=0,ie=0,he=0,le=0,Oe=0,Me=0,Se=0,Pt=0,ze=0,Ce=j[0],Fe=j[1],Ee=j[2],Ae=j[3],Ge=j[4],ye=j[5],xe=j[6],Be=j[7],be=j[8],Pe=j[9],je=j[10],Te=j[11],$e=j[12],lt=j[13],Re=j[14],Ne=j[15];m=F[0],te+=m*Ce,ee+=m*Fe,ne+=m*Ee,fe+=m*Ae,d+=m*Ge,p+=m*ye,b+=m*xe,D+=m*Be,O+=m*be,$+=m*Pe,L+=m*je,C+=m*Te,v+=m*$e,N+=m*lt,oe+=m*Re,pe+=m*Ne,m=F[1],ee+=m*Ce,ne+=m*Fe,fe+=m*Ee,d+=m*Ae,p+=m*Ge,b+=m*ye,D+=m*xe,O+=m*Be,$+=m*be,L+=m*Pe,C+=m*je,v+=m*Te,N+=m*$e,oe+=m*lt,pe+=m*Re,x+=m*Ne,m=F[2],ne+=m*Ce,fe+=m*Fe,d+=m*Ee,p+=m*Ae,b+=m*Ge,D+=m*ye,O+=m*xe,$+=m*Be,L+=m*be,C+=m*Pe,v+=m*je,N+=m*Te,oe+=m*$e,pe+=m*lt,x+=m*Re,re+=m*Ne,m=F[3],fe+=m*Ce,d+=m*Fe,p+=m*Ee,b+=m*Ae,D+=m*Ge,O+=m*ye,$+=m*xe,L+=m*Be,C+=m*be,v+=m*Pe,N+=m*je,oe+=m*Te,pe+=m*$e,x+=m*lt,re+=m*Re,q+=m*Ne,m=F[4],d+=m*Ce,p+=m*Fe,b+=m*Ee,D+=m*Ae,O+=m*Ge,$+=m*ye,L+=m*xe,C+=m*Be,v+=m*be,N+=m*Pe,oe+=m*je,pe+=m*Te,x+=m*$e,re+=m*lt,q+=m*Re,H+=m*Ne,m=F[5],p+=m*Ce,b+=m*Fe,D+=m*Ee,O+=m*Ae,$+=m*Ge,L+=m*ye,C+=m*xe,v+=m*Be,N+=m*be,oe+=m*Pe,pe+=m*je,x+=m*Te,re+=m*$e,q+=m*lt,H+=m*Re,V+=m*Ne,m=F[6],b+=m*Ce,D+=m*Fe,O+=m*Ee,$+=m*Ae,L+=m*Ge,C+=m*ye,v+=m*xe,N+=m*Be,oe+=m*be,pe+=m*Pe,x+=m*je,re+=m*Te,q+=m*$e,H+=m*lt,V+=m*Re,w+=m*Ne,m=F[7],D+=m*Ce,O+=m*Fe,$+=m*Ee,L+=m*Ae,C+=m*Ge,v+=m*ye,N+=m*xe,oe+=m*Be,pe+=m*be,x+=m*Pe,re+=m*je,q+=m*Te,H+=m*$e,V+=m*lt,w+=m*Re,k+=m*Ne,m=F[8],O+=m*Ce,$+=m*Fe,L+=m*Ee,C+=m*Ae,v+=m*Ge,N+=m*ye,oe+=m*xe,pe+=m*Be,x+=m*be,re+=m*Pe,q+=m*je,H+=m*Te,V+=m*$e,w+=m*lt,k+=m*Re,ie+=m*Ne,m=F[9],$+=m*Ce,L+=m*Fe,C+=m*Ee,v+=m*Ae,N+=m*Ge,oe+=m*ye,pe+=m*xe,x+=m*Be,re+=m*be,q+=m*Pe,H+=m*je,V+=m*Te,w+=m*$e,k+=m*lt,ie+=m*Re,he+=m*Ne,m=F[10],L+=m*Ce,C+=m*Fe,v+=m*Ee,N+=m*Ae,oe+=m*Ge,pe+=m*ye,x+=m*xe,re+=m*Be,q+=m*be,H+=m*Pe,V+=m*je,w+=m*Te,k+=m*$e,ie+=m*lt,he+=m*Re,le+=m*Ne,m=F[11],C+=m*Ce,v+=m*Fe,N+=m*Ee,oe+=m*Ae,pe+=m*Ge,x+=m*ye,re+=m*xe,q+=m*Be,H+=m*be,V+=m*Pe,w+=m*je,k+=m*Te,ie+=m*$e,he+=m*lt,le+=m*Re,Oe+=m*Ne,m=F[12],v+=m*Ce,N+=m*Fe,oe+=m*Ee,pe+=m*Ae,x+=m*Ge,re+=m*ye,q+=m*xe,H+=m*Be,V+=m*be,w+=m*Pe,k+=m*je,ie+=m*Te,he+=m*$e,le+=m*lt,Oe+=m*Re,Me+=m*Ne,m=F[13],N+=m*Ce,oe+=m*Fe,pe+=m*Ee,x+=m*Ae,re+=m*Ge,q+=m*ye,H+=m*xe,V+=m*Be,w+=m*be,k+=m*Pe,ie+=m*je,he+=m*Te,le+=m*$e,Oe+=m*lt,Me+=m*Re,Se+=m*Ne,m=F[14],oe+=m*Ce,pe+=m*Fe,x+=m*Ee,re+=m*Ae,q+=m*Ge,H+=m*ye,V+=m*xe,w+=m*Be,k+=m*be,ie+=m*Pe,he+=m*je,le+=m*Te,Oe+=m*$e,Me+=m*lt,Se+=m*Re,Pt+=m*Ne,m=F[15],pe+=m*Ce,x+=m*Fe,re+=m*Ee,q+=m*Ae,H+=m*Ge,V+=m*ye,w+=m*xe,k+=m*Be,ie+=m*be,he+=m*Pe,le+=m*je,Oe+=m*Te,Me+=m*$e,Se+=m*lt,Pt+=m*Re,ze+=m*Ne,te+=38*x,ee+=38*re,ne+=38*q,fe+=38*H,d+=38*V,p+=38*w,b+=38*k,D+=38*ie,O+=38*he,$+=38*le,L+=38*Oe,C+=38*Me,v+=38*Se,N+=38*Pt,oe+=38*ze,T=1,m=te+T+65535,T=Math.floor(m/65536),te=m-T*65536,m=ee+T+65535,T=Math.floor(m/65536),ee=m-T*65536,m=ne+T+65535,T=Math.floor(m/65536),ne=m-T*65536,m=fe+T+65535,T=Math.floor(m/65536),fe=m-T*65536,m=d+T+65535,T=Math.floor(m/65536),d=m-T*65536,m=p+T+65535,T=Math.floor(m/65536),p=m-T*65536,m=b+T+65535,T=Math.floor(m/65536),b=m-T*65536,m=D+T+65535,T=Math.floor(m/65536),D=m-T*65536,m=O+T+65535,T=Math.floor(m/65536),O=m-T*65536,m=$+T+65535,T=Math.floor(m/65536),$=m-T*65536,m=L+T+65535,T=Math.floor(m/65536),L=m-T*65536,m=C+T+65535,T=Math.floor(m/65536),C=m-T*65536,m=v+T+65535,T=Math.floor(m/65536),v=m-T*65536,m=N+T+65535,T=Math.floor(m/65536),N=m-T*65536,m=oe+T+65535,T=Math.floor(m/65536),oe=m-T*65536,m=pe+T+65535,T=Math.floor(m/65536),pe=m-T*65536,te+=T-1+37*(T-1),T=1,m=te+T+65535,T=Math.floor(m/65536),te=m-T*65536,m=ee+T+65535,T=Math.floor(m/65536),ee=m-T*65536,m=ne+T+65535,T=Math.floor(m/65536),ne=m-T*65536,m=fe+T+65535,T=Math.floor(m/65536),fe=m-T*65536,m=d+T+65535,T=Math.floor(m/65536),d=m-T*65536,m=p+T+65535,T=Math.floor(m/65536),p=m-T*65536,m=b+T+65535,T=Math.floor(m/65536),b=m-T*65536,m=D+T+65535,T=Math.floor(m/65536),D=m-T*65536,m=O+T+65535,T=Math.floor(m/65536),O=m-T*65536,m=$+T+65535,T=Math.floor(m/65536),$=m-T*65536,m=L+T+65535,T=Math.floor(m/65536),L=m-T*65536,m=C+T+65535,T=Math.floor(m/65536),C=m-T*65536,m=v+T+65535,T=Math.floor(m/65536),v=m-T*65536,m=N+T+65535,T=Math.floor(m/65536),N=m-T*65536,m=oe+T+65535,T=Math.floor(m/65536),oe=m-T*65536,m=pe+T+65535,T=Math.floor(m/65536),pe=m-T*65536,te+=T-1+37*(T-1),P[0]=te,P[1]=ee,P[2]=ne,P[3]=fe,P[4]=d,P[5]=p,P[6]=b,P[7]=D,P[8]=O,P[9]=$,P[10]=L,P[11]=C,P[12]=v,P[13]=N,P[14]=oe,P[15]=pe}function A(P,F){E(P,F,F)}function S(P,F){const j=n();for(let m=0;m<16;m++)j[m]=F[m];for(let m=253;m>=0;m--)A(j,j),m!==2&&m!==4&&E(j,j,F);for(let m=0;m<16;m++)P[m]=j[m]}function U(P,F){const j=new Uint8Array(32),m=new Float64Array(80),T=n(),te=n(),ee=n(),ne=n(),fe=n(),d=n();for(let O=0;O<31;O++)j[O]=P[O];j[31]=P[31]&127|64,j[0]&=248,h(m,F);for(let O=0;O<16;O++)te[O]=m[O];T[0]=ne[0]=1;for(let O=254;O>=0;--O){const $=j[O>>>3]>>>(O&7)&1;l(T,te,$),l(ee,ne,$),g(fe,T,ee),_(T,T,ee),g(ee,te,ne),_(te,te,ne),A(ne,fe),A(d,T),E(T,ee,T),E(ee,te,fe),g(fe,T,ee),_(T,T,ee),A(te,T),_(ee,ne,d),E(T,ee,o),g(T,T,ne),E(ee,ee,T),E(T,ne,d),E(ne,te,m),A(te,fe),l(T,te,$),l(ee,ne,$)}for(let O=0;O<16;O++)m[O+16]=T[O],m[O+32]=ee[O],m[O+48]=te[O],m[O+64]=ne[O];const p=m.subarray(32),b=m.subarray(16);S(p,p),E(b,b,p);const D=new Uint8Array(32);return f(D,b),D}t.scalarMult=U;function W(P){return U(P,i)}t.scalarMultBase=W;function Y(P){if(P.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const F=new Uint8Array(P);return{publicKey:W(F),secretKey:F}}t.generateKeyPairFromSeed=Y;function B(P){const F=(0,e.randomBytes)(32,P),j=Y(F);return(0,r.wipe)(F),j}t.generateKeyPair=B;function z(P,F,j=!1){if(P.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(F.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const m=U(P,F);if(j){let T=0;for(let te=0;te<m.length;te++)T|=m[te];if(T===0)throw new Error("X25519: invalid shared key")}return m}t.sharedKey=z})(tf);function rf(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function L1(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?rf(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function nf(t,e){e||(e=t.reduce((i,o)=>i+o.length,0));const r=L1(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return rf(r)}function t5(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),c=o.charCodeAt(0);if(r[c]!==255)throw new TypeError(o+" is ambiguous");r[c]=i}var l=t.length,f=t.charAt(0),h=Math.log(l)/Math.log(256),g=Math.log(256)/Math.log(l);function _(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var U=0,W=0,Y=0,B=S.length;Y!==B&&S[Y]===0;)Y++,U++;for(var z=(B-Y)*g+1>>>0,P=new Uint8Array(z);Y!==B;){for(var F=S[Y],j=0,m=z-1;(F!==0||j<W)&&m!==-1;m--,j++)F+=256*P[m]>>>0,P[m]=F%l>>>0,F=F/l>>>0;if(F!==0)throw new Error("Non-zero carry");W=j,Y++}for(var T=z-W;T!==z&&P[T]===0;)T++;for(var te=f.repeat(U);T<z;++T)te+=t.charAt(P[T]);return te}function E(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var U=0;if(S[U]!==" "){for(var W=0,Y=0;S[U]===f;)W++,U++;for(var B=(S.length-U)*h+1>>>0,z=new Uint8Array(B);S[U];){var P=r[S.charCodeAt(U)];if(P===255)return;for(var F=0,j=B-1;(P!==0||F<Y)&&j!==-1;j--,F++)P+=l*z[j]>>>0,z[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");Y=F,U++}if(S[U]!==" "){for(var m=B-Y;m!==B&&z[m]===0;)m++;for(var T=new Uint8Array(W+(B-m)),te=W;m!==B;)T[te++]=z[m++];return T}}}function A(S){var U=E(S);if(U)return U;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:A}}var r5=t5,n5=r5;const B1=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},i5=t=>new TextEncoder().encode(t),s5=t=>new TextDecoder().decode(t);class o5{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class a5{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return U1(this,e)}}class c5{constructor(e){this.decoders=e}or(e){return U1(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const U1=(t,e)=>new c5({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class l5{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new o5(e,r,n),this.decoder=new a5(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vl=({name:t,prefix:e,encode:r,decode:n})=>new l5(t,e,r,n),Wa=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=n5(r,e);return vl({prefix:t,name:e,encode:n,decode:o=>B1(i(o))})},u5=(t,e,r,n)=>{const i={};for(let g=0;g<e.length;++g)i[e[g]]=g;let o=t.length;for(;t[o-1]==="=";)--o;const c=new Uint8Array(o*r/8|0);let l=0,f=0,h=0;for(let g=0;g<o;++g){const _=i[t[g]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|_,l+=r,l>=8&&(l-=8,c[h++]=255&f>>l)}if(l>=r||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return c},h5=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let o="",c=0,l=0;for(let f=0;f<t.length;++f)for(l=l<<8|t[f],c+=8;c>r;)c-=r,o+=e[i&l>>c];if(c&&(o+=e[i&l<<r-c]),n)for(;o.length*r&7;)o+="=";return o},Cr=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>vl({prefix:e,name:t,encode(i){return h5(i,n,r)},decode(i){return u5(i,n,r,t)}}),f5=vl({prefix:"\0",name:"identity",encode:t=>s5(t),decode:t=>i5(t)});var d5=Object.freeze({__proto__:null,identity:f5});const p5=Cr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var g5=Object.freeze({__proto__:null,base2:p5});const m5=Cr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var v5=Object.freeze({__proto__:null,base8:m5});const w5=Wa({prefix:"9",name:"base10",alphabet:"0123456789"});var y5=Object.freeze({__proto__:null,base10:w5});const b5=Cr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_5=Cr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var E5=Object.freeze({__proto__:null,base16:b5,base16upper:_5});const A5=Cr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),x5=Cr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),I5=Cr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),S5=Cr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),D5=Cr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C5=Cr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),O5=Cr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),P5=Cr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),M5=Cr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var T5=Object.freeze({__proto__:null,base32:A5,base32upper:x5,base32pad:I5,base32padupper:S5,base32hex:D5,base32hexupper:C5,base32hexpad:O5,base32hexpadupper:P5,base32z:M5});const $5=Wa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),N5=Wa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var R5=Object.freeze({__proto__:null,base36:$5,base36upper:N5});const L5=Wa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),B5=Wa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var U5=Object.freeze({__proto__:null,base58btc:L5,base58flickr:B5});const F5=Cr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),j5=Cr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),k5=Cr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),q5=Cr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var z5=Object.freeze({__proto__:null,base64:F5,base64pad:j5,base64url:k5,base64urlpad:q5});const F1=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}"),H5=F1.reduce((t,e,r)=>(t[r]=e,t),[]),K5=F1.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function W5(t){return t.reduce((e,r)=>(e+=H5[r],e),"")}function V5(t){const e=[];for(const r of t){const n=K5[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const G5=vl({prefix:"\u{1F680}",name:"base256emoji",encode:W5,decode:V5});var Y5=Object.freeze({__proto__:null,base256emoji:G5}),J5=k1,j1=128,Q5=127,Z5=~Q5,X5=Math.pow(2,31);function k1(t,e,r){e=e||[],r=r||0;for(var n=r;t>=X5;)e[r++]=t&255|j1,t/=128;for(;t&Z5;)e[r++]=t&255|j1,t>>>=7;return e[r]=t|0,k1.bytes=r-n+1,e}var e_=sf,t_=128,q1=127;function sf(t,n){var r=0,n=n||0,i=0,o=n,c,l=t.length;do{if(o>=l)throw sf.bytes=0,new RangeError("Could not decode varint");c=t[o++],r+=i<28?(c&q1)<<i:(c&q1)*Math.pow(2,i),i+=7}while(c>=t_);return sf.bytes=o-n,r}var r_=Math.pow(2,7),n_=Math.pow(2,14),i_=Math.pow(2,21),s_=Math.pow(2,28),o_=Math.pow(2,35),a_=Math.pow(2,42),c_=Math.pow(2,49),l_=Math.pow(2,56),u_=Math.pow(2,63),h_=function(t){return t<r_?1:t<n_?2:t<i_?3:t<s_?4:t<o_?5:t<a_?6:t<c_?7:t<l_?8:t<u_?9:10},f_={encode:J5,decode:e_,encodingLength:h_},z1=f_;const H1=(t,e,r=0)=>(z1.encode(t,e,r),e),K1=t=>z1.encodingLength(t),of=(t,e)=>{const r=e.byteLength,n=K1(t),i=n+K1(r),o=new Uint8Array(i+r);return H1(t,o,0),H1(r,o,n),o.set(e,i),new d_(t,r,e,o)};class d_{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const W1=({name:t,code:e,encode:r})=>new p_(t,e,r);class p_{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?of(this.code,r):r.then(n=>of(this.code,n))}else throw Error("Unknown type, must be binary type")}}const V1=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),g_=W1({name:"sha2-256",code:18,encode:V1("SHA-256")}),m_=W1({name:"sha2-512",code:19,encode:V1("SHA-512")});var v_=Object.freeze({__proto__:null,sha256:g_,sha512:m_});const G1=0,w_="identity",Y1=B1;var y_=Object.freeze({__proto__:null,identity:{code:G1,name:w_,encode:Y1,digest:t=>of(G1,Y1(t))}});new TextEncoder,new TextDecoder;const J1={...d5,...g5,...v5,...y5,...E5,...T5,...R5,...U5,...z5,...Y5};({...v_,...y_});function Q1(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Z1=Q1("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),af=Q1("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=L1(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),X1={utf8:Z1,"utf-8":Z1,hex:J1.base16,latin1:af,ascii:af,binary:af,...J1};function Xr(t,e="utf8"){const r=X1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?rf(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function jr(t,e="utf8"){const r=X1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const b_={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},__=":";function wl(t){const[e,r]=t.split(__);return{namespace:e,reference:r}}function eg(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function tg(t,e){return t.includes(":")?[t]:e.chains||[]}var E_=Object.defineProperty,rg=Object.getOwnPropertySymbols,A_=Object.prototype.hasOwnProperty,x_=Object.prototype.propertyIsEnumerable,ng=(t,e,r)=>e in t?E_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ig=(t,e)=>{for(var r in e||(e={}))A_.call(e,r)&&ng(t,r,e[r]);if(rg)for(var r of rg(e))x_.call(e,r)&&ng(t,r,e[r]);return t};const I_="ReactNative",gn={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},S_="js";function Va(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Uo(){return!Hh()&&!!Kh()&&navigator.product===I_}function Fo(){return!Va()&&!!Kh()&&!!Hh()}function Ga(){return Uo()?gn.reactNative:Va()?gn.node:Fo()?gn.browser:gn.unknown}function D_(){var t;try{return Uo()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function C_(t,e){let r=Ha.parse(t);return r=ig(ig({},r),e),t=Ha.stringify(r),t}function O_(){return v1()||{name:"",description:"",url:"",icons:[""]}}function P_(){if(Ga()===gn.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=g3();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function M_(){var t;const e=Ga();return e===gn.browser?[e,((t=m1())==null?void 0:t.host)||"unknown"].join(":"):e}function T_(t,e,r){const n=P_(),i=M_();return[[t,e].join("-"),[S_,r].join("-"),n,i].join("/")}function $_({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:o,useOnCloseEvent:c,bundleId:l}){const f=r.split("?"),h=T_(t,e,n),g={auth:i,ua:h,projectId:o,useOnCloseEvent:c||void 0,origin:l||void 0},_=C_(f[1]||"",g);return f[0]+"?"+_}function ks(t,e){return t.filter(r=>e.includes(r)).length===t.length}function sg(t){return Object.fromEntries(t.entries())}function og(t){return new Map(Object.entries(t))}function qs(t=_e.FIVE_MINUTES,e){const r=_e.toMiliseconds(t||_e.FIVE_MINUTES);let n,i,o;return{resolve:c=>{o&&n&&(clearTimeout(o),n(c))},reject:c=>{o&&i&&(clearTimeout(o),i(c))},done:()=>new Promise((c,l)=>{o=setTimeout(()=>{l(new Error(e))},r),n=c,i=l})}}function Ya(t,e,r){return new Promise(async(n,i)=>{const o=setTimeout(()=>i(new Error(r)),e);try{const c=await t;n(c)}catch(c){i(c)}clearTimeout(o)})}function ag(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function N_(t){return ag("topic",t)}function R_(t){return ag("id",t)}function cg(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Nr(t,e){return _e.fromMiliseconds((e||Date.now())+_e.toMiliseconds(t))}function ss(t){return Date.now()>=_e.toMiliseconds(t)}function wt(t,e){return`${t}${e?`:${e}`:""}`}function yl(t=[],e=[]){return[...new Set([...t,...e])]}async function L_({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;const n=typeof r=="string"?JSON.parse(r):r;let i=n?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));const o=`${i}/wc?requestId=${t}&sessionTopic=${e}`,c=Ga();c===gn.browser?o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,"_self","noreferrer noopener"):c===gn.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(n){console.error(n)}}async function B_(t,e){try{return await t.getItem(e)||(Fo()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var lg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function U_(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var ug={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(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",c=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;c?i=lg:s&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,f=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",h="0123456789abcdef".split(""),m=[31,7936,2031616,520093696],_=[4,1024,262144,67108864],E=[1,256,65536,16777216],A=[6,1536,393216,100663296],I=[0,8,16,24],R=[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],Y=[128,256],F=["hex","buffer","arrayBuffer","array","digest"],z={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});for(var $=function(x,ne,q){return function(H){return new L(x,ne,x).update(H)[q]()}},j=function(x,ne,q){return function(H,V){return new L(x,ne,V).update(H)[q]()}},P=function(x,ne,q){return function(H,V,y,k){return d["cshake"+x].update(H,V,y,k)[q]()}},g=function(x,ne,q){return function(H,V,y,k){return d["kmac"+x].update(H,V,y,k)[q]()}},C=function(x,ne,q,H){for(var V=0;V<F.length;++V){var y=F[V];x[y]=ne(q,H,y)}return x},Z=function(x,ne){var q=$(x,ne,"hex");return q.create=function(){return new L(x,ne,x)},q.update=function(H){return q.create().update(H)},C(q,$,x,ne)},J=function(x,ne){var q=j(x,ne,"hex");return q.create=function(H){return new L(x,ne,H)},q.update=function(H,V){return q.create(V).update(H)},C(q,j,x,ne)},te=function(x,ne){var q=z[x],H=P(x,ne,"hex");return H.create=function(V,y,k){return!y&&!k?d["shake"+x].create(V):new L(x,ne,V).bytepad([y,k],q)},H.update=function(V,y,k,ie){return H.create(y,k,ie).update(V)},C(H,P,x,ne)},ae=function(x,ne){var q=z[x],H=g(x,ne,"hex");return H.create=function(V,y,k){return new oe(x,ne,y).bytepad(["KMAC",k],q).bytepad([V],q)},H.update=function(V,y,k,ie){return H.create(V,k,ie).update(y)},C(H,g,x,ne)},p=[{name:"keccak",padding:E,bits:W,createMethod:Z},{name:"sha3",padding:A,bits:W,createMethod:Z},{name:"shake",padding:m,bits:Y,createMethod:J},{name:"cshake",padding:_,bits:Y,createMethod:te},{name:"kmac",padding:_,bits:Y,createMethod:ae}],d={},b=[],D=0;D<p.length;++D)for(var M=p[D],N=M.bits,U=0;U<N.length;++U){var O=M.name+"_"+N[U];if(b.push(O),d[O]=M.createMethod(N[U],M.padding),M.name!=="sha3"){var v=M.name+N[U];b.push(v),d[v]=d[O]}}function L(x,ne,q){this.blocks=[],this.s=[],this.padding=ne,this.outputBits=q,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(x<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=q>>5,this.extraBytes=(q&31)>>3;for(var H=0;H<50;++H)this.s[H]=0}L.prototype.update=function(x){if(this.finalized)throw new Error(r);var ne,q=typeof x;if(q!=="string"){if(q==="object"){if(x===null)throw new Error(e);if(f&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!f||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);ne=!0}for(var H=this.blocks,V=this.byteCount,y=x.length,k=this.blockCount,ie=0,fe=this.s,ue,Oe;ie<y;){if(this.reset)for(this.reset=!1,H[0]=this.block,ue=1;ue<k+1;++ue)H[ue]=0;if(ne)for(ue=this.start;ie<y&&ue<V;++ie)H[ue>>2]|=x[ie]<<I[ue++&3];else for(ue=this.start;ie<y&&ue<V;++ie)Oe=x.charCodeAt(ie),Oe<128?H[ue>>2]|=Oe<<I[ue++&3]:Oe<2048?(H[ue>>2]|=(192|Oe>>6)<<I[ue++&3],H[ue>>2]|=(128|Oe&63)<<I[ue++&3]):Oe<55296||Oe>=57344?(H[ue>>2]|=(224|Oe>>12)<<I[ue++&3],H[ue>>2]|=(128|Oe>>6&63)<<I[ue++&3],H[ue>>2]|=(128|Oe&63)<<I[ue++&3]):(Oe=65536+((Oe&1023)<<10|x.charCodeAt(++ie)&1023),H[ue>>2]|=(240|Oe>>18)<<I[ue++&3],H[ue>>2]|=(128|Oe>>12&63)<<I[ue++&3],H[ue>>2]|=(128|Oe>>6&63)<<I[ue++&3],H[ue>>2]|=(128|Oe&63)<<I[ue++&3]);if(this.lastByteIndex=ue,ue>=V){for(this.start=ue-V,this.block=H[k],ue=0;ue<k;++ue)fe[ue]^=H[ue];de(fe),this.reset=!0}else this.start=ue}return this},L.prototype.encode=function(x,ne){var q=x&255,H=1,V=[q];for(x=x>>8,q=x&255;q>0;)V.unshift(q),x=x>>8,q=x&255,++H;return ne?V.push(H):V.unshift(H),this.update(V),V.length},L.prototype.encodeString=function(x){var ne,q=typeof x;if(q!=="string"){if(q==="object"){if(x===null)throw new Error(e);if(f&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!f||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);ne=!0}var H=0,V=x.length;if(ne)H=V;else for(var y=0;y<x.length;++y){var k=x.charCodeAt(y);k<128?H+=1:k<2048?H+=2:k<55296||k>=57344?H+=3:(k=65536+((k&1023)<<10|x.charCodeAt(++y)&1023),H+=4)}return H+=this.encode(H*8),this.update(x),H},L.prototype.bytepad=function(x,ne){for(var q=this.encode(ne),H=0;H<x.length;++H)q+=this.encodeString(x[H]);var V=ne-q%ne,y=[];return y.length=V,this.update(y),this},L.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,ne=this.lastByteIndex,q=this.blockCount,H=this.s;if(x[ne>>2]|=this.padding[ne&3],this.lastByteIndex===this.byteCount)for(x[0]=x[q],ne=1;ne<q+1;++ne)x[ne]=0;for(x[q-1]|=2147483648,ne=0;ne<q;++ne)H[ne]^=x[ne];de(H)}},L.prototype.toString=L.prototype.hex=function(){this.finalize();for(var x=this.blockCount,ne=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,y=0,k="",ie;y<q;){for(V=0;V<x&&y<q;++V,++y)ie=ne[V],k+=h[ie>>4&15]+h[ie&15]+h[ie>>12&15]+h[ie>>8&15]+h[ie>>20&15]+h[ie>>16&15]+h[ie>>28&15]+h[ie>>24&15];y%x===0&&(de(ne),V=0)}return H&&(ie=ne[V],k+=h[ie>>4&15]+h[ie&15],H>1&&(k+=h[ie>>12&15]+h[ie>>8&15]),H>2&&(k+=h[ie>>20&15]+h[ie>>16&15])),k},L.prototype.arrayBuffer=function(){this.finalize();var x=this.blockCount,ne=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,y=0,k=this.outputBits>>3,ie;H?ie=new ArrayBuffer(q+1<<2):ie=new ArrayBuffer(k);for(var fe=new Uint32Array(ie);y<q;){for(V=0;V<x&&y<q;++V,++y)fe[y]=ne[V];y%x===0&&de(ne)}return H&&(fe[V]=ne[V],ie=ie.slice(0,k)),ie},L.prototype.buffer=L.prototype.arrayBuffer,L.prototype.digest=L.prototype.array=function(){this.finalize();for(var x=this.blockCount,ne=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,y=0,k=[],ie,fe;y<q;){for(V=0;V<x&&y<q;++V,++y)ie=y<<2,fe=ne[V],k[ie]=fe&255,k[ie+1]=fe>>8&255,k[ie+2]=fe>>16&255,k[ie+3]=fe>>24&255;y%x===0&&de(ne)}return H&&(ie=y<<2,fe=ne[V],k[ie]=fe&255,H>1&&(k[ie+1]=fe>>8&255),H>2&&(k[ie+2]=fe>>16&255)),k};function oe(x,ne,q){L.call(this,x,ne,q)}oe.prototype=new L,oe.prototype.finalize=function(){return this.encode(this.outputBits,!0),L.prototype.finalize.call(this)};var de=function(x){var ne,q,H,V,y,k,ie,fe,ue,Oe,Me,Ie,Pt,ze,Ce,Fe,Ee,Ae,Ge,we,xe,Be,be,Pe,je,Te,$e,lt,Re,Ne,nr,dt,Et,ir,St,Ot,Vr,Ye,He,Rt,Je,Ve,Mt,Xe,et,Lt,tt,Qe,Ft,Ze,ke,Ht,rt,jt,ri,kt,vt,Bn,Un,Fn,jn,kn,xr;for(H=0;H<48;H+=2)V=x[0]^x[10]^x[20]^x[30]^x[40],y=x[1]^x[11]^x[21]^x[31]^x[41],k=x[2]^x[12]^x[22]^x[32]^x[42],ie=x[3]^x[13]^x[23]^x[33]^x[43],fe=x[4]^x[14]^x[24]^x[34]^x[44],ue=x[5]^x[15]^x[25]^x[35]^x[45],Oe=x[6]^x[16]^x[26]^x[36]^x[46],Me=x[7]^x[17]^x[27]^x[37]^x[47],Ie=x[8]^x[18]^x[28]^x[38]^x[48],Pt=x[9]^x[19]^x[29]^x[39]^x[49],ne=Ie^(k<<1|ie>>>31),q=Pt^(ie<<1|k>>>31),x[0]^=ne,x[1]^=q,x[10]^=ne,x[11]^=q,x[20]^=ne,x[21]^=q,x[30]^=ne,x[31]^=q,x[40]^=ne,x[41]^=q,ne=V^(fe<<1|ue>>>31),q=y^(ue<<1|fe>>>31),x[2]^=ne,x[3]^=q,x[12]^=ne,x[13]^=q,x[22]^=ne,x[23]^=q,x[32]^=ne,x[33]^=q,x[42]^=ne,x[43]^=q,ne=k^(Oe<<1|Me>>>31),q=ie^(Me<<1|Oe>>>31),x[4]^=ne,x[5]^=q,x[14]^=ne,x[15]^=q,x[24]^=ne,x[25]^=q,x[34]^=ne,x[35]^=q,x[44]^=ne,x[45]^=q,ne=fe^(Ie<<1|Pt>>>31),q=ue^(Pt<<1|Ie>>>31),x[6]^=ne,x[7]^=q,x[16]^=ne,x[17]^=q,x[26]^=ne,x[27]^=q,x[36]^=ne,x[37]^=q,x[46]^=ne,x[47]^=q,ne=Oe^(V<<1|y>>>31),q=Me^(y<<1|V>>>31),x[8]^=ne,x[9]^=q,x[18]^=ne,x[19]^=q,x[28]^=ne,x[29]^=q,x[38]^=ne,x[39]^=q,x[48]^=ne,x[49]^=q,ze=x[0],Ce=x[1],Lt=x[11]<<4|x[10]>>>28,tt=x[10]<<4|x[11]>>>28,lt=x[20]<<3|x[21]>>>29,Re=x[21]<<3|x[20]>>>29,Fn=x[31]<<9|x[30]>>>23,jn=x[30]<<9|x[31]>>>23,Ve=x[40]<<18|x[41]>>>14,Mt=x[41]<<18|x[40]>>>14,ir=x[2]<<1|x[3]>>>31,St=x[3]<<1|x[2]>>>31,Fe=x[13]<<12|x[12]>>>20,Ee=x[12]<<12|x[13]>>>20,Qe=x[22]<<10|x[23]>>>22,Ft=x[23]<<10|x[22]>>>22,Ne=x[33]<<13|x[32]>>>19,nr=x[32]<<13|x[33]>>>19,kn=x[42]<<2|x[43]>>>30,xr=x[43]<<2|x[42]>>>30,jt=x[5]<<30|x[4]>>>2,ri=x[4]<<30|x[5]>>>2,Ot=x[14]<<6|x[15]>>>26,Vr=x[15]<<6|x[14]>>>26,Ae=x[25]<<11|x[24]>>>21,Ge=x[24]<<11|x[25]>>>21,Ze=x[34]<<15|x[35]>>>17,ke=x[35]<<15|x[34]>>>17,dt=x[45]<<29|x[44]>>>3,Et=x[44]<<29|x[45]>>>3,Pe=x[6]<<28|x[7]>>>4,je=x[7]<<28|x[6]>>>4,kt=x[17]<<23|x[16]>>>9,vt=x[16]<<23|x[17]>>>9,Ye=x[26]<<25|x[27]>>>7,He=x[27]<<25|x[26]>>>7,we=x[36]<<21|x[37]>>>11,xe=x[37]<<21|x[36]>>>11,Ht=x[47]<<24|x[46]>>>8,rt=x[46]<<24|x[47]>>>8,Xe=x[8]<<27|x[9]>>>5,et=x[9]<<27|x[8]>>>5,Te=x[18]<<20|x[19]>>>12,$e=x[19]<<20|x[18]>>>12,Bn=x[29]<<7|x[28]>>>25,Un=x[28]<<7|x[29]>>>25,Rt=x[38]<<8|x[39]>>>24,Je=x[39]<<8|x[38]>>>24,Be=x[48]<<14|x[49]>>>18,be=x[49]<<14|x[48]>>>18,x[0]=ze^~Fe&Ae,x[1]=Ce^~Ee&Ge,x[10]=Pe^~Te&lt,x[11]=je^~$e&Re,x[20]=ir^~Ot&Ye,x[21]=St^~Vr&He,x[30]=Xe^~Lt&Qe,x[31]=et^~tt&Ft,x[40]=jt^~kt&Bn,x[41]=ri^~vt&Un,x[2]=Fe^~Ae&we,x[3]=Ee^~Ge&xe,x[12]=Te^~lt&Ne,x[13]=$e^~Re&nr,x[22]=Ot^~Ye&Rt,x[23]=Vr^~He&Je,x[32]=Lt^~Qe&Ze,x[33]=tt^~Ft&ke,x[42]=kt^~Bn&Fn,x[43]=vt^~Un&jn,x[4]=Ae^~we&Be,x[5]=Ge^~xe&be,x[14]=lt^~Ne&dt,x[15]=Re^~nr&Et,x[24]=Ye^~Rt&Ve,x[25]=He^~Je&Mt,x[34]=Qe^~Ze&Ht,x[35]=Ft^~ke&rt,x[44]=Bn^~Fn&kn,x[45]=Un^~jn&xr,x[6]=we^~Be&ze,x[7]=xe^~be&Ce,x[16]=Ne^~dt&Pe,x[17]=nr^~Et&je,x[26]=Rt^~Ve&ir,x[27]=Je^~Mt&St,x[36]=Ze^~Ht&Xe,x[37]=ke^~rt&et,x[46]=Fn^~kn&jt,x[47]=jn^~xr&ri,x[8]=Be^~ze&Fe,x[9]=be^~Ce&Ee,x[18]=dt^~Pe&Te,x[19]=Et^~je&$e,x[28]=Ve^~ir&Ot,x[29]=Mt^~St&Vr,x[38]=Ht^~Xe&Lt,x[39]=rt^~et&tt,x[48]=kn^~jt&kt,x[49]=xr^~ri&vt,x[0]^=R[H],x[1]^=R[H+1]};if(l)t.exports=d;else for(D=0;D<b.length;++D)i[b[D]]=d[b[D]]})()})(ug);var H_=ug.exports;const K_="logger/5.7.0";let hg=!1,fg=!1;const bl={debug:1,default:2,info:2,warning:3,error:4,off:5};let dg=bl.default,sf=null;function W_(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const pg=W_();var of;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(of||(of={}));var Qn;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Qn||(Qn={}));const gg="0123456789abcdef";class ut{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();bl[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(dg>bl[n])&&console.log.apply(console,r)}debug(...e){this._log(ut.levels.DEBUG,e)}info(...e){this._log(ut.levels.INFO,e)}warn(...e){this._log(ut.levels.WARNING,e)}makeError(e,r,n){if(fg)return this.makeError("censored error",r,{});r||(r=ut.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(f=>{const h=n[f];try{if(h instanceof Uint8Array){let m="";for(let _=0;_<h.length;_++)m+=gg[h[_]>>4],m+=gg[h[_]&15];i.push(f+"=Uint8Array(0x"+m+")")}else i.push(f+"="+JSON.stringify(h))}catch{i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let c="";switch(r){case Qn.NUMERIC_FAULT:{c="NUMERIC_FAULT";const f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":c+="-"+f;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case Qn.CALL_EXCEPTION:case Qn.INSUFFICIENT_FUNDS:case Qn.MISSING_NEW:case Qn.NONCE_EXPIRED:case Qn.REPLACEMENT_UNDERPRICED:case Qn.TRANSACTION_REPLACED:case Qn.UNPREDICTABLE_GAS_LIMIT:c=r;break}c&&(e+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=s,l.code=r,Object.keys(n).forEach(function(f){l[f]=n[f]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,ut.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){pg&&this.throwError("platform missing String.prototype.normalize",ut.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:pg})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",e<r&&this.throwError("missing argument"+n,ut.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+n,ut.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",ut.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",ut.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",ut.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return sf||(sf=new ut(K_)),sf}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hg){if(!e)return;this.globalLogger().throwError("error censorship permanent",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fg=!!e,hg=!!r}static setLogLevel(e){const r=bl[e.toLowerCase()];if(r==null){ut.globalLogger().warn("invalid log level - "+e);return}dg=r}static from(e){return new ut(e)}}ut.errors=Qn,ut.levels=of;const V_="bytes/5.7.0",lr=new ut(V_);function mg(t){return!!t.toHexString}function qo(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return qo(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function G_(t){return pn(t)&&!(t.length%2)||zo(t)}function vg(t){return typeof t=="number"&&t==t&&t%1===0}function zo(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!vg(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!vg(r)||r<0||r>=256)return!1}return!0}function or(t,e){if(e||(e={}),typeof t=="number"){lr.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),qo(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),mg(t)&&(t=t.toHexString()),pn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":lr.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return qo(new Uint8Array(n))}return zo(t)?qo(new Uint8Array(t)):lr.throwArgumentError("invalid arrayify value","value",t)}function Y_(t){const e=t.map(i=>or(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),qo(n)}function J_(t,e){t=or(t),t.length>e&&lr.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),qo(r)}function pn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const af="0123456789abcdef";function jr(t,e){if(e||(e={}),typeof t=="number"){lr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=af[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),mg(t))return t.toHexString();if(pn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":lr.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(zo(t)){let r="0x";for(let n=0;n<t.length;n++){let i=t[n];r+=af[(i&240)>>4]+af[i&15]}return r}return lr.throwArgumentError("invalid hexlify value","value",t)}function Q_(t){if(typeof t!="string")t=jr(t);else if(!pn(t)||t.length%2)return null;return(t.length-2)/2}function yg(t,e,r){return typeof t!="string"?t=jr(t):(!pn(t)||t.length%2)&&lr.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function li(t,e){for(typeof t!="string"?t=jr(t):pn(t)||lr.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&lr.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function wg(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(G_(t)){let r=or(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=jr(r.slice(0,32)),e.s=jr(r.slice(32,64))):r.length===65?(e.r=jr(r.slice(0,32)),e.s=jr(r.slice(32,64)),e.v=r[64]):lr.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:lr.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=jr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=J_(or(e._vs),32);e._vs=jr(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&lr.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const c=jr(i);e.s==null?e.s=c:e.s!==c&&lr.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?lr.throwArgumentError("signature missing v and recoveryParam","signature",t):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 i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&lr.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pn(e.r)?lr.throwArgumentError("signature missing or invalid r","signature",t):e.r=li(e.r,32),e.s==null||!pn(e.s)?lr.throwArgumentError("signature missing or invalid s","signature",t):e.s=li(e.s,32);const r=or(e.s);r[0]>=128&&lr.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=jr(r);e._vs&&(pn(e._vs)||lr.throwArgumentError("signature invalid _vs","signature",t),e._vs=li(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&lr.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function cf(t){return"0x"+H_.keccak_256(or(t))}var bg={exports:{}},Z_={},X_=Object.freeze({__proto__:null,default:Z_}),e8=z_(X_);(function(t){(function(e,r){function n(p,d){if(!p)throw new Error(d||"Assertion failed")}function i(p,d){p.super_=d;var b=function(){};b.prototype=d.prototype,p.prototype=new b,p.prototype.constructor=p}function s(p,d,b){if(s.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((d==="le"||d==="be")&&(b=d,d=10),this._init(p||0,d||10,b||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=e8.Buffer}catch{}s.isBN=function(p){return p instanceof s?!0:p!==null&&typeof p=="object"&&p.constructor.wordSize===s.wordSize&&Array.isArray(p.words)},s.max=function(p,d){return p.cmp(d)>0?p:d},s.min=function(p,d){return p.cmp(d)<0?p:d},s.prototype._init=function(p,d,b){if(typeof p=="number")return this._initNumber(p,d,b);if(typeof p=="object")return this._initArray(p,d,b);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),p=p.toString().replace(/\s+/g,"");var D=0;p[0]==="-"&&(D++,this.negative=1),D<p.length&&(d===16?this._parseHex(p,D,b):(this._parseBase(p,d,D),b==="le"&&this._initArray(this.toArray(),d,b)))},s.prototype._initNumber=function(p,d,b){p<0&&(this.negative=1,p=-p),p<67108864?(this.words=[p&67108863],this.length=1):p<4503599627370496?(this.words=[p&67108863,p/67108864&67108863],this.length=2):(n(p<9007199254740992),this.words=[p&67108863,p/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),d,b)},s.prototype._initArray=function(p,d,b){if(n(typeof p.length=="number"),p.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(p.length/3),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var M,N,U=0;if(b==="be")for(D=p.length-1,M=0;D>=0;D-=3)N=p[D]|p[D-1]<<8|p[D-2]<<16,this.words[M]|=N<<U&67108863,this.words[M+1]=N>>>26-U&67108863,U+=24,U>=26&&(U-=26,M++);else if(b==="le")for(D=0,M=0;D<p.length;D+=3)N=p[D]|p[D+1]<<8|p[D+2]<<16,this.words[M]|=N<<U&67108863,this.words[M+1]=N>>>26-U&67108863,U+=24,U>=26&&(U-=26,M++);return this._strip()};function l(p,d){var b=p.charCodeAt(d);if(b>=48&&b<=57)return b-48;if(b>=65&&b<=70)return b-55;if(b>=97&&b<=102)return b-87;n(!1,"Invalid character in "+p)}function f(p,d,b){var D=l(p,b);return b-1>=d&&(D|=l(p,b-1)<<4),D}s.prototype._parseHex=function(p,d,b){this.length=Math.ceil((p.length-d)/6),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var M=0,N=0,U;if(b==="be")for(D=p.length-1;D>=d;D-=2)U=f(p,d,D)<<M,this.words[N]|=U&67108863,M>=18?(M-=18,N+=1,this.words[N]|=U>>>26):M+=8;else{var O=p.length-d;for(D=O%2===0?d+1:d;D<p.length;D+=2)U=f(p,d,D)<<M,this.words[N]|=U&67108863,M>=18?(M-=18,N+=1,this.words[N]|=U>>>26):M+=8}this._strip()};function h(p,d,b,D){for(var M=0,N=0,U=Math.min(p.length,b),O=d;O<U;O++){var v=p.charCodeAt(O)-48;M*=D,v>=49?N=v-49+10:v>=17?N=v-17+10:N=v,n(v>=0&&N<D,"Invalid character"),M+=N}return M}s.prototype._parseBase=function(p,d,b){this.words=[0],this.length=1;for(var D=0,M=1;M<=67108863;M*=d)D++;D--,M=M/d|0;for(var N=p.length-b,U=N%D,O=Math.min(N,N-U)+b,v=0,L=b;L<O;L+=D)v=h(p,L,L+D,d),this.imuln(M),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(U!==0){var oe=1;for(v=h(p,L,p.length,d),L=0;L<U;L++)oe*=d;this.imuln(oe),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var d=0;d<this.length;d++)p.words[d]=this.words[d];p.length=this.length,p.negative=this.negative,p.red=this.red};function m(p,d){p.words=d.words,p.length=d.length,p.negative=d.negative,p.red=d.red}if(s.prototype._move=function(p){m(p,this)},s.prototype.clone=function(){var p=new s(null);return this.copy(p),p},s.prototype._expand=function(p){for(;this.length<p;)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")]=_}catch{s.prototype.inspect=_}else s.prototype.inspect=_;function _(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var E=["","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"],A=[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],I=[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(p,d){p=p||10,d=d|0||1;var b;if(p===16||p==="hex"){b="";for(var D=0,M=0,N=0;N<this.length;N++){var U=this.words[N],O=((U<<D|M)&16777215).toString(16);M=U>>>24-D&16777215,D+=2,D>=26&&(D-=26,N--),M!==0||N!==this.length-1?b=E[6-O.length]+O+b:b=O+b}for(M!==0&&(b=M.toString(16)+b);b.length%d!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(p===(p|0)&&p>=2&&p<=36){var v=A[p],L=I[p];b="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var de=oe.modrn(L).toString(p);oe=oe.idivn(L),oe.isZero()?b=de+b:b=E[v-de.length]+de+b}for(this.isZero()&&(b="0"+b);b.length%d!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},c&&(s.prototype.toBuffer=function(p,d){return this.toArrayLike(c,p,d)}),s.prototype.toArray=function(p,d){return this.toArrayLike(Array,p,d)};var R=function(p,d){return p.allocUnsafe?p.allocUnsafe(d):new p(d)};s.prototype.toArrayLike=function(p,d,b){this._strip();var D=this.byteLength(),M=b||Math.max(1,D);n(D<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0");var N=R(p,M),U=d==="le"?"LE":"BE";return this["_toArrayLike"+U](N,D),N},s.prototype._toArrayLikeLE=function(p,d){for(var b=0,D=0,M=0,N=0;M<this.length;M++){var U=this.words[M]<<N|D;p[b++]=U&255,b<p.length&&(p[b++]=U>>8&255),b<p.length&&(p[b++]=U>>16&255),N===6?(b<p.length&&(p[b++]=U>>24&255),D=0,N=0):(D=U>>>24,N+=2)}if(b<p.length)for(p[b++]=D;b<p.length;)p[b++]=0},s.prototype._toArrayLikeBE=function(p,d){for(var b=p.length-1,D=0,M=0,N=0;M<this.length;M++){var U=this.words[M]<<N|D;p[b--]=U&255,b>=0&&(p[b--]=U>>8&255),b>=0&&(p[b--]=U>>16&255),N===6?(b>=0&&(p[b--]=U>>24&255),D=0,N=0):(D=U>>>24,N+=2)}if(b>=0)for(p[b--]=D;b>=0;)p[b--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var d=p,b=0;return d>=4096&&(b+=13,d>>>=13),d>=64&&(b+=7,d>>>=7),d>=8&&(b+=4,d>>>=4),d>=2&&(b+=2,d>>>=2),b+d},s.prototype._zeroBits=function(p){if(p===0)return 26;var d=p,b=0;return d&8191||(b+=13,d>>>=13),d&127||(b+=7,d>>>=7),d&15||(b+=4,d>>>=4),d&3||(b+=2,d>>>=2),d&1||b++,b},s.prototype.bitLength=function(){var p=this.words[this.length-1],d=this._countBits(p);return(this.length-1)*26+d};function W(p){for(var d=new Array(p.bitLength()),b=0;b<d.length;b++){var D=b/26|0,M=b%26;d[b]=p.words[D]>>>M&1}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var p=0,d=0;d<this.length;d++){var b=this._zeroBits(this.words[d]);if(p+=b,b!==26)break}return p},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(p){return this.negative!==0?this.abs().inotn(p).iaddn(1):this.clone()},s.prototype.fromTwos=function(p){return this.testn(p-1)?this.notn(p).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(p){for(;this.length<p.length;)this.words[this.length++]=0;for(var d=0;d<p.length;d++)this.words[d]=this.words[d]|p.words[d];return this._strip()},s.prototype.ior=function(p){return n((this.negative|p.negative)===0),this.iuor(p)},s.prototype.or=function(p){return this.length>p.length?this.clone().ior(p):p.clone().ior(this)},s.prototype.uor=function(p){return this.length>p.length?this.clone().iuor(p):p.clone().iuor(this)},s.prototype.iuand=function(p){var d;this.length>p.length?d=p:d=this;for(var b=0;b<d.length;b++)this.words[b]=this.words[b]&p.words[b];return this.length=d.length,this._strip()},s.prototype.iand=function(p){return n((this.negative|p.negative)===0),this.iuand(p)},s.prototype.and=function(p){return this.length>p.length?this.clone().iand(p):p.clone().iand(this)},s.prototype.uand=function(p){return this.length>p.length?this.clone().iuand(p):p.clone().iuand(this)},s.prototype.iuxor=function(p){var d,b;this.length>p.length?(d=this,b=p):(d=p,b=this);for(var D=0;D<b.length;D++)this.words[D]=d.words[D]^b.words[D];if(this!==d)for(;D<d.length;D++)this.words[D]=d.words[D];return this.length=d.length,this._strip()},s.prototype.ixor=function(p){return n((this.negative|p.negative)===0),this.iuxor(p)},s.prototype.xor=function(p){return this.length>p.length?this.clone().ixor(p):p.clone().ixor(this)},s.prototype.uxor=function(p){return this.length>p.length?this.clone().iuxor(p):p.clone().iuxor(this)},s.prototype.inotn=function(p){n(typeof p=="number"&&p>=0);var d=Math.ceil(p/26)|0,b=p%26;this._expand(d),b>0&&d--;for(var D=0;D<d;D++)this.words[D]=~this.words[D]&67108863;return b>0&&(this.words[D]=~this.words[D]&67108863>>26-b),this._strip()},s.prototype.notn=function(p){return this.clone().inotn(p)},s.prototype.setn=function(p,d){n(typeof p=="number"&&p>=0);var b=p/26|0,D=p%26;return this._expand(b+1),d?this.words[b]=this.words[b]|1<<D:this.words[b]=this.words[b]&~(1<<D),this._strip()},s.prototype.iadd=function(p){var d;if(this.negative!==0&&p.negative===0)return this.negative=0,d=this.isub(p),this.negative^=1,this._normSign();if(this.negative===0&&p.negative!==0)return p.negative=0,d=this.isub(p),p.negative=1,d._normSign();var b,D;this.length>p.length?(b=this,D=p):(b=p,D=this);for(var M=0,N=0;N<D.length;N++)d=(b.words[N]|0)+(D.words[N]|0)+M,this.words[N]=d&67108863,M=d>>>26;for(;M!==0&&N<b.length;N++)d=(b.words[N]|0)+M,this.words[N]=d&67108863,M=d>>>26;if(this.length=b.length,M!==0)this.words[this.length]=M,this.length++;else if(b!==this)for(;N<b.length;N++)this.words[N]=b.words[N];return this},s.prototype.add=function(p){var d;return p.negative!==0&&this.negative===0?(p.negative=0,d=this.sub(p),p.negative^=1,d):p.negative===0&&this.negative!==0?(this.negative=0,d=p.sub(this),this.negative=1,d):this.length>p.length?this.clone().iadd(p):p.clone().iadd(this)},s.prototype.isub=function(p){if(p.negative!==0){p.negative=0;var d=this.iadd(p);return p.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(p),this.negative=1,this._normSign();var b=this.cmp(p);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var D,M;b>0?(D=this,M=p):(D=p,M=this);for(var N=0,U=0;U<M.length;U++)d=(D.words[U]|0)-(M.words[U]|0)+N,N=d>>26,this.words[U]=d&67108863;for(;N!==0&&U<D.length;U++)d=(D.words[U]|0)+N,N=d>>26,this.words[U]=d&67108863;if(N===0&&U<D.length&&D!==this)for(;U<D.length;U++)this.words[U]=D.words[U];return this.length=Math.max(this.length,U),D!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function Y(p,d,b){b.negative=d.negative^p.negative;var D=p.length+d.length|0;b.length=D,D=D-1|0;var M=p.words[0]|0,N=d.words[0]|0,U=M*N,O=U&67108863,v=U/67108864|0;b.words[0]=O;for(var L=1;L<D;L++){for(var oe=v>>>26,de=v&67108863,x=Math.min(L,d.length-1),ne=Math.max(0,L-p.length+1);ne<=x;ne++){var q=L-ne|0;M=p.words[q]|0,N=d.words[ne]|0,U=M*N+de,oe+=U/67108864|0,de=U&67108863}b.words[L]=de|0,v=oe|0}return v!==0?b.words[L]=v|0:b.length--,b._strip()}var F=function(p,d,b){var D=p.words,M=d.words,N=b.words,U=0,O,v,L,oe=D[0]|0,de=oe&8191,x=oe>>>13,ne=D[1]|0,q=ne&8191,H=ne>>>13,V=D[2]|0,y=V&8191,k=V>>>13,ie=D[3]|0,fe=ie&8191,ue=ie>>>13,Oe=D[4]|0,Me=Oe&8191,Ie=Oe>>>13,Pt=D[5]|0,ze=Pt&8191,Ce=Pt>>>13,Fe=D[6]|0,Ee=Fe&8191,Ae=Fe>>>13,Ge=D[7]|0,we=Ge&8191,xe=Ge>>>13,Be=D[8]|0,be=Be&8191,Pe=Be>>>13,je=D[9]|0,Te=je&8191,$e=je>>>13,lt=M[0]|0,Re=lt&8191,Ne=lt>>>13,nr=M[1]|0,dt=nr&8191,Et=nr>>>13,ir=M[2]|0,St=ir&8191,Ot=ir>>>13,Vr=M[3]|0,Ye=Vr&8191,He=Vr>>>13,Rt=M[4]|0,Je=Rt&8191,Ve=Rt>>>13,Mt=M[5]|0,Xe=Mt&8191,et=Mt>>>13,Lt=M[6]|0,tt=Lt&8191,Qe=Lt>>>13,Ft=M[7]|0,Ze=Ft&8191,ke=Ft>>>13,Ht=M[8]|0,rt=Ht&8191,jt=Ht>>>13,ri=M[9]|0,kt=ri&8191,vt=ri>>>13;b.negative=p.negative^d.negative,b.length=19,O=Math.imul(de,Re),v=Math.imul(de,Ne),v=v+Math.imul(x,Re)|0,L=Math.imul(x,Ne);var Bn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,O=Math.imul(q,Re),v=Math.imul(q,Ne),v=v+Math.imul(H,Re)|0,L=Math.imul(H,Ne),O=O+Math.imul(de,dt)|0,v=v+Math.imul(de,Et)|0,v=v+Math.imul(x,dt)|0,L=L+Math.imul(x,Et)|0;var Un=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Un>>>26)|0,Un&=67108863,O=Math.imul(y,Re),v=Math.imul(y,Ne),v=v+Math.imul(k,Re)|0,L=Math.imul(k,Ne),O=O+Math.imul(q,dt)|0,v=v+Math.imul(q,Et)|0,v=v+Math.imul(H,dt)|0,L=L+Math.imul(H,Et)|0,O=O+Math.imul(de,St)|0,v=v+Math.imul(de,Ot)|0,v=v+Math.imul(x,St)|0,L=L+Math.imul(x,Ot)|0;var Fn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(fe,Re),v=Math.imul(fe,Ne),v=v+Math.imul(ue,Re)|0,L=Math.imul(ue,Ne),O=O+Math.imul(y,dt)|0,v=v+Math.imul(y,Et)|0,v=v+Math.imul(k,dt)|0,L=L+Math.imul(k,Et)|0,O=O+Math.imul(q,St)|0,v=v+Math.imul(q,Ot)|0,v=v+Math.imul(H,St)|0,L=L+Math.imul(H,Ot)|0,O=O+Math.imul(de,Ye)|0,v=v+Math.imul(de,He)|0,v=v+Math.imul(x,Ye)|0,L=L+Math.imul(x,He)|0;var jn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(jn>>>26)|0,jn&=67108863,O=Math.imul(Me,Re),v=Math.imul(Me,Ne),v=v+Math.imul(Ie,Re)|0,L=Math.imul(Ie,Ne),O=O+Math.imul(fe,dt)|0,v=v+Math.imul(fe,Et)|0,v=v+Math.imul(ue,dt)|0,L=L+Math.imul(ue,Et)|0,O=O+Math.imul(y,St)|0,v=v+Math.imul(y,Ot)|0,v=v+Math.imul(k,St)|0,L=L+Math.imul(k,Ot)|0,O=O+Math.imul(q,Ye)|0,v=v+Math.imul(q,He)|0,v=v+Math.imul(H,Ye)|0,L=L+Math.imul(H,He)|0,O=O+Math.imul(de,Je)|0,v=v+Math.imul(de,Ve)|0,v=v+Math.imul(x,Je)|0,L=L+Math.imul(x,Ve)|0;var kn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(kn>>>26)|0,kn&=67108863,O=Math.imul(ze,Re),v=Math.imul(ze,Ne),v=v+Math.imul(Ce,Re)|0,L=Math.imul(Ce,Ne),O=O+Math.imul(Me,dt)|0,v=v+Math.imul(Me,Et)|0,v=v+Math.imul(Ie,dt)|0,L=L+Math.imul(Ie,Et)|0,O=O+Math.imul(fe,St)|0,v=v+Math.imul(fe,Ot)|0,v=v+Math.imul(ue,St)|0,L=L+Math.imul(ue,Ot)|0,O=O+Math.imul(y,Ye)|0,v=v+Math.imul(y,He)|0,v=v+Math.imul(k,Ye)|0,L=L+Math.imul(k,He)|0,O=O+Math.imul(q,Je)|0,v=v+Math.imul(q,Ve)|0,v=v+Math.imul(H,Je)|0,L=L+Math.imul(H,Ve)|0,O=O+Math.imul(de,Xe)|0,v=v+Math.imul(de,et)|0,v=v+Math.imul(x,Xe)|0,L=L+Math.imul(x,et)|0;var xr=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(xr>>>26)|0,xr&=67108863,O=Math.imul(Ee,Re),v=Math.imul(Ee,Ne),v=v+Math.imul(Ae,Re)|0,L=Math.imul(Ae,Ne),O=O+Math.imul(ze,dt)|0,v=v+Math.imul(ze,Et)|0,v=v+Math.imul(Ce,dt)|0,L=L+Math.imul(Ce,Et)|0,O=O+Math.imul(Me,St)|0,v=v+Math.imul(Me,Ot)|0,v=v+Math.imul(Ie,St)|0,L=L+Math.imul(Ie,Ot)|0,O=O+Math.imul(fe,Ye)|0,v=v+Math.imul(fe,He)|0,v=v+Math.imul(ue,Ye)|0,L=L+Math.imul(ue,He)|0,O=O+Math.imul(y,Je)|0,v=v+Math.imul(y,Ve)|0,v=v+Math.imul(k,Je)|0,L=L+Math.imul(k,Ve)|0,O=O+Math.imul(q,Xe)|0,v=v+Math.imul(q,et)|0,v=v+Math.imul(H,Xe)|0,L=L+Math.imul(H,et)|0,O=O+Math.imul(de,tt)|0,v=v+Math.imul(de,Qe)|0,v=v+Math.imul(x,tt)|0,L=L+Math.imul(x,Qe)|0;var Ii=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,O=Math.imul(we,Re),v=Math.imul(we,Ne),v=v+Math.imul(xe,Re)|0,L=Math.imul(xe,Ne),O=O+Math.imul(Ee,dt)|0,v=v+Math.imul(Ee,Et)|0,v=v+Math.imul(Ae,dt)|0,L=L+Math.imul(Ae,Et)|0,O=O+Math.imul(ze,St)|0,v=v+Math.imul(ze,Ot)|0,v=v+Math.imul(Ce,St)|0,L=L+Math.imul(Ce,Ot)|0,O=O+Math.imul(Me,Ye)|0,v=v+Math.imul(Me,He)|0,v=v+Math.imul(Ie,Ye)|0,L=L+Math.imul(Ie,He)|0,O=O+Math.imul(fe,Je)|0,v=v+Math.imul(fe,Ve)|0,v=v+Math.imul(ue,Je)|0,L=L+Math.imul(ue,Ve)|0,O=O+Math.imul(y,Xe)|0,v=v+Math.imul(y,et)|0,v=v+Math.imul(k,Xe)|0,L=L+Math.imul(k,et)|0,O=O+Math.imul(q,tt)|0,v=v+Math.imul(q,Qe)|0,v=v+Math.imul(H,tt)|0,L=L+Math.imul(H,Qe)|0,O=O+Math.imul(de,Ze)|0,v=v+Math.imul(de,ke)|0,v=v+Math.imul(x,Ze)|0,L=L+Math.imul(x,ke)|0;var mo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(mo>>>26)|0,mo&=67108863,O=Math.imul(be,Re),v=Math.imul(be,Ne),v=v+Math.imul(Pe,Re)|0,L=Math.imul(Pe,Ne),O=O+Math.imul(we,dt)|0,v=v+Math.imul(we,Et)|0,v=v+Math.imul(xe,dt)|0,L=L+Math.imul(xe,Et)|0,O=O+Math.imul(Ee,St)|0,v=v+Math.imul(Ee,Ot)|0,v=v+Math.imul(Ae,St)|0,L=L+Math.imul(Ae,Ot)|0,O=O+Math.imul(ze,Ye)|0,v=v+Math.imul(ze,He)|0,v=v+Math.imul(Ce,Ye)|0,L=L+Math.imul(Ce,He)|0,O=O+Math.imul(Me,Je)|0,v=v+Math.imul(Me,Ve)|0,v=v+Math.imul(Ie,Je)|0,L=L+Math.imul(Ie,Ve)|0,O=O+Math.imul(fe,Xe)|0,v=v+Math.imul(fe,et)|0,v=v+Math.imul(ue,Xe)|0,L=L+Math.imul(ue,et)|0,O=O+Math.imul(y,tt)|0,v=v+Math.imul(y,Qe)|0,v=v+Math.imul(k,tt)|0,L=L+Math.imul(k,Qe)|0,O=O+Math.imul(q,Ze)|0,v=v+Math.imul(q,ke)|0,v=v+Math.imul(H,Ze)|0,L=L+Math.imul(H,ke)|0,O=O+Math.imul(de,rt)|0,v=v+Math.imul(de,jt)|0,v=v+Math.imul(x,rt)|0,L=L+Math.imul(x,jt)|0;var Di=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Di>>>26)|0,Di&=67108863,O=Math.imul(Te,Re),v=Math.imul(Te,Ne),v=v+Math.imul($e,Re)|0,L=Math.imul($e,Ne),O=O+Math.imul(be,dt)|0,v=v+Math.imul(be,Et)|0,v=v+Math.imul(Pe,dt)|0,L=L+Math.imul(Pe,Et)|0,O=O+Math.imul(we,St)|0,v=v+Math.imul(we,Ot)|0,v=v+Math.imul(xe,St)|0,L=L+Math.imul(xe,Ot)|0,O=O+Math.imul(Ee,Ye)|0,v=v+Math.imul(Ee,He)|0,v=v+Math.imul(Ae,Ye)|0,L=L+Math.imul(Ae,He)|0,O=O+Math.imul(ze,Je)|0,v=v+Math.imul(ze,Ve)|0,v=v+Math.imul(Ce,Je)|0,L=L+Math.imul(Ce,Ve)|0,O=O+Math.imul(Me,Xe)|0,v=v+Math.imul(Me,et)|0,v=v+Math.imul(Ie,Xe)|0,L=L+Math.imul(Ie,et)|0,O=O+Math.imul(fe,tt)|0,v=v+Math.imul(fe,Qe)|0,v=v+Math.imul(ue,tt)|0,L=L+Math.imul(ue,Qe)|0,O=O+Math.imul(y,Ze)|0,v=v+Math.imul(y,ke)|0,v=v+Math.imul(k,Ze)|0,L=L+Math.imul(k,ke)|0,O=O+Math.imul(q,rt)|0,v=v+Math.imul(q,jt)|0,v=v+Math.imul(H,rt)|0,L=L+Math.imul(H,jt)|0,O=O+Math.imul(de,kt)|0,v=v+Math.imul(de,vt)|0,v=v+Math.imul(x,kt)|0,L=L+Math.imul(x,vt)|0;var vo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(vo>>>26)|0,vo&=67108863,O=Math.imul(Te,dt),v=Math.imul(Te,Et),v=v+Math.imul($e,dt)|0,L=Math.imul($e,Et),O=O+Math.imul(be,St)|0,v=v+Math.imul(be,Ot)|0,v=v+Math.imul(Pe,St)|0,L=L+Math.imul(Pe,Ot)|0,O=O+Math.imul(we,Ye)|0,v=v+Math.imul(we,He)|0,v=v+Math.imul(xe,Ye)|0,L=L+Math.imul(xe,He)|0,O=O+Math.imul(Ee,Je)|0,v=v+Math.imul(Ee,Ve)|0,v=v+Math.imul(Ae,Je)|0,L=L+Math.imul(Ae,Ve)|0,O=O+Math.imul(ze,Xe)|0,v=v+Math.imul(ze,et)|0,v=v+Math.imul(Ce,Xe)|0,L=L+Math.imul(Ce,et)|0,O=O+Math.imul(Me,tt)|0,v=v+Math.imul(Me,Qe)|0,v=v+Math.imul(Ie,tt)|0,L=L+Math.imul(Ie,Qe)|0,O=O+Math.imul(fe,Ze)|0,v=v+Math.imul(fe,ke)|0,v=v+Math.imul(ue,Ze)|0,L=L+Math.imul(ue,ke)|0,O=O+Math.imul(y,rt)|0,v=v+Math.imul(y,jt)|0,v=v+Math.imul(k,rt)|0,L=L+Math.imul(k,jt)|0,O=O+Math.imul(q,kt)|0,v=v+Math.imul(q,vt)|0,v=v+Math.imul(H,kt)|0,L=L+Math.imul(H,vt)|0;var yo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(yo>>>26)|0,yo&=67108863,O=Math.imul(Te,St),v=Math.imul(Te,Ot),v=v+Math.imul($e,St)|0,L=Math.imul($e,Ot),O=O+Math.imul(be,Ye)|0,v=v+Math.imul(be,He)|0,v=v+Math.imul(Pe,Ye)|0,L=L+Math.imul(Pe,He)|0,O=O+Math.imul(we,Je)|0,v=v+Math.imul(we,Ve)|0,v=v+Math.imul(xe,Je)|0,L=L+Math.imul(xe,Ve)|0,O=O+Math.imul(Ee,Xe)|0,v=v+Math.imul(Ee,et)|0,v=v+Math.imul(Ae,Xe)|0,L=L+Math.imul(Ae,et)|0,O=O+Math.imul(ze,tt)|0,v=v+Math.imul(ze,Qe)|0,v=v+Math.imul(Ce,tt)|0,L=L+Math.imul(Ce,Qe)|0,O=O+Math.imul(Me,Ze)|0,v=v+Math.imul(Me,ke)|0,v=v+Math.imul(Ie,Ze)|0,L=L+Math.imul(Ie,ke)|0,O=O+Math.imul(fe,rt)|0,v=v+Math.imul(fe,jt)|0,v=v+Math.imul(ue,rt)|0,L=L+Math.imul(ue,jt)|0,O=O+Math.imul(y,kt)|0,v=v+Math.imul(y,vt)|0,v=v+Math.imul(k,kt)|0,L=L+Math.imul(k,vt)|0;var Ci=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,O=Math.imul(Te,Ye),v=Math.imul(Te,He),v=v+Math.imul($e,Ye)|0,L=Math.imul($e,He),O=O+Math.imul(be,Je)|0,v=v+Math.imul(be,Ve)|0,v=v+Math.imul(Pe,Je)|0,L=L+Math.imul(Pe,Ve)|0,O=O+Math.imul(we,Xe)|0,v=v+Math.imul(we,et)|0,v=v+Math.imul(xe,Xe)|0,L=L+Math.imul(xe,et)|0,O=O+Math.imul(Ee,tt)|0,v=v+Math.imul(Ee,Qe)|0,v=v+Math.imul(Ae,tt)|0,L=L+Math.imul(Ae,Qe)|0,O=O+Math.imul(ze,Ze)|0,v=v+Math.imul(ze,ke)|0,v=v+Math.imul(Ce,Ze)|0,L=L+Math.imul(Ce,ke)|0,O=O+Math.imul(Me,rt)|0,v=v+Math.imul(Me,jt)|0,v=v+Math.imul(Ie,rt)|0,L=L+Math.imul(Ie,jt)|0,O=O+Math.imul(fe,kt)|0,v=v+Math.imul(fe,vt)|0,v=v+Math.imul(ue,kt)|0,L=L+Math.imul(ue,vt)|0;var Is=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Is>>>26)|0,Is&=67108863,O=Math.imul(Te,Je),v=Math.imul(Te,Ve),v=v+Math.imul($e,Je)|0,L=Math.imul($e,Ve),O=O+Math.imul(be,Xe)|0,v=v+Math.imul(be,et)|0,v=v+Math.imul(Pe,Xe)|0,L=L+Math.imul(Pe,et)|0,O=O+Math.imul(we,tt)|0,v=v+Math.imul(we,Qe)|0,v=v+Math.imul(xe,tt)|0,L=L+Math.imul(xe,Qe)|0,O=O+Math.imul(Ee,Ze)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Ae,Ze)|0,L=L+Math.imul(Ae,ke)|0,O=O+Math.imul(ze,rt)|0,v=v+Math.imul(ze,jt)|0,v=v+Math.imul(Ce,rt)|0,L=L+Math.imul(Ce,jt)|0,O=O+Math.imul(Me,kt)|0,v=v+Math.imul(Me,vt)|0,v=v+Math.imul(Ie,kt)|0,L=L+Math.imul(Ie,vt)|0;var Ds=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Ds>>>26)|0,Ds&=67108863,O=Math.imul(Te,Xe),v=Math.imul(Te,et),v=v+Math.imul($e,Xe)|0,L=Math.imul($e,et),O=O+Math.imul(be,tt)|0,v=v+Math.imul(be,Qe)|0,v=v+Math.imul(Pe,tt)|0,L=L+Math.imul(Pe,Qe)|0,O=O+Math.imul(we,Ze)|0,v=v+Math.imul(we,ke)|0,v=v+Math.imul(xe,Ze)|0,L=L+Math.imul(xe,ke)|0,O=O+Math.imul(Ee,rt)|0,v=v+Math.imul(Ee,jt)|0,v=v+Math.imul(Ae,rt)|0,L=L+Math.imul(Ae,jt)|0,O=O+Math.imul(ze,kt)|0,v=v+Math.imul(ze,vt)|0,v=v+Math.imul(Ce,kt)|0,L=L+Math.imul(Ce,vt)|0;var Gr=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,O=Math.imul(Te,tt),v=Math.imul(Te,Qe),v=v+Math.imul($e,tt)|0,L=Math.imul($e,Qe),O=O+Math.imul(be,Ze)|0,v=v+Math.imul(be,ke)|0,v=v+Math.imul(Pe,Ze)|0,L=L+Math.imul(Pe,ke)|0,O=O+Math.imul(we,rt)|0,v=v+Math.imul(we,jt)|0,v=v+Math.imul(xe,rt)|0,L=L+Math.imul(xe,jt)|0,O=O+Math.imul(Ee,kt)|0,v=v+Math.imul(Ee,vt)|0,v=v+Math.imul(Ae,kt)|0,L=L+Math.imul(Ae,vt)|0;var wo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(wo>>>26)|0,wo&=67108863,O=Math.imul(Te,Ze),v=Math.imul(Te,ke),v=v+Math.imul($e,Ze)|0,L=Math.imul($e,ke),O=O+Math.imul(be,rt)|0,v=v+Math.imul(be,jt)|0,v=v+Math.imul(Pe,rt)|0,L=L+Math.imul(Pe,jt)|0,O=O+Math.imul(we,kt)|0,v=v+Math.imul(we,vt)|0,v=v+Math.imul(xe,kt)|0,L=L+Math.imul(xe,vt)|0;var bo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(bo>>>26)|0,bo&=67108863,O=Math.imul(Te,rt),v=Math.imul(Te,jt),v=v+Math.imul($e,rt)|0,L=Math.imul($e,jt),O=O+Math.imul(be,kt)|0,v=v+Math.imul(be,vt)|0,v=v+Math.imul(Pe,kt)|0,L=L+Math.imul(Pe,vt)|0;var _o=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(_o>>>26)|0,_o&=67108863,O=Math.imul(Te,kt),v=Math.imul(Te,vt),v=v+Math.imul($e,kt)|0,L=Math.imul($e,vt);var Eo=(U+O|0)+((v&8191)<<13)|0;return U=(L+(v>>>13)|0)+(Eo>>>26)|0,Eo&=67108863,N[0]=Bn,N[1]=Un,N[2]=Fn,N[3]=jn,N[4]=kn,N[5]=xr,N[6]=Ii,N[7]=mo,N[8]=Di,N[9]=vo,N[10]=yo,N[11]=Ci,N[12]=Is,N[13]=Ds,N[14]=Gr,N[15]=wo,N[16]=bo,N[17]=_o,N[18]=Eo,U!==0&&(N[19]=U,b.length++),b};Math.imul||(F=Y);function z(p,d,b){b.negative=d.negative^p.negative,b.length=p.length+d.length;for(var D=0,M=0,N=0;N<b.length-1;N++){var U=M;M=0;for(var O=D&67108863,v=Math.min(N,d.length-1),L=Math.max(0,N-p.length+1);L<=v;L++){var oe=N-L,de=p.words[oe]|0,x=d.words[L]|0,ne=de*x,q=ne&67108863;U=U+(ne/67108864|0)|0,q=q+O|0,O=q&67108863,U=U+(q>>>26)|0,M+=U>>>26,U&=67108863}b.words[N]=O,D=U,U=M}return D!==0?b.words[N]=D:b.length--,b._strip()}function $(p,d,b){return z(p,d,b)}s.prototype.mulTo=function(p,d){var b,D=this.length+p.length;return this.length===10&&p.length===10?b=F(this,p,d):D<63?b=Y(this,p,d):D<1024?b=z(this,p,d):b=$(this,p,d),b},s.prototype.mul=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),this.mulTo(p,d)},s.prototype.mulf=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),$(this,p,d)},s.prototype.imul=function(p){return this.clone().mulTo(p,this)},s.prototype.imuln=function(p){var d=p<0;d&&(p=-p),n(typeof p=="number"),n(p<67108864);for(var b=0,D=0;D<this.length;D++){var M=(this.words[D]|0)*p,N=(M&67108863)+(b&67108863);b>>=26,b+=M/67108864|0,b+=N>>>26,this.words[D]=N&67108863}return b!==0&&(this.words[D]=b,this.length++),d?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var d=W(p);if(d.length===0)return new s(1);for(var b=this,D=0;D<d.length&&d[D]===0;D++,b=b.sqr());if(++D<d.length)for(var M=b.sqr();D<d.length;D++,M=M.sqr())d[D]!==0&&(b=b.mul(M));return b},s.prototype.iushln=function(p){n(typeof p=="number"&&p>=0);var d=p%26,b=(p-d)/26,D=67108863>>>26-d<<26-d,M;if(d!==0){var N=0;for(M=0;M<this.length;M++){var U=this.words[M]&D,O=(this.words[M]|0)-U<<d;this.words[M]=O|N,N=U>>>26-d}N&&(this.words[M]=N,this.length++)}if(b!==0){for(M=this.length-1;M>=0;M--)this.words[M+b]=this.words[M];for(M=0;M<b;M++)this.words[M]=0;this.length+=b}return this._strip()},s.prototype.ishln=function(p){return n(this.negative===0),this.iushln(p)},s.prototype.iushrn=function(p,d,b){n(typeof p=="number"&&p>=0);var D;d?D=(d-d%26)/26:D=0;var M=p%26,N=Math.min((p-M)/26,this.length),U=67108863^67108863>>>M<<M,O=b;if(D-=N,D=Math.max(0,D),O){for(var v=0;v<N;v++)O.words[v]=this.words[v];O.length=N}if(N!==0)if(this.length>N)for(this.length-=N,v=0;v<this.length;v++)this.words[v]=this.words[v+N];else this.words[0]=0,this.length=1;var L=0;for(v=this.length-1;v>=0&&(L!==0||v>=D);v--){var oe=this.words[v]|0;this.words[v]=L<<26-M|oe>>>M,L=oe&U}return O&&L!==0&&(O.words[O.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(p,d,b){return n(this.negative===0),this.iushrn(p,d,b)},s.prototype.shln=function(p){return this.clone().ishln(p)},s.prototype.ushln=function(p){return this.clone().iushln(p)},s.prototype.shrn=function(p){return this.clone().ishrn(p)},s.prototype.ushrn=function(p){return this.clone().iushrn(p)},s.prototype.testn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,b=(p-d)/26,D=1<<d;if(this.length<=b)return!1;var M=this.words[b];return!!(M&D)},s.prototype.imaskn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,b=(p-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(d!==0&&b++,this.length=Math.min(b,this.length),d!==0){var D=67108863^67108863>>>d<<d;this.words[this.length-1]&=D}return this._strip()},s.prototype.maskn=function(p){return this.clone().imaskn(p)},s.prototype.iaddn=function(p){return n(typeof p=="number"),n(p<67108864),p<0?this.isubn(-p):this.negative!==0?this.length===1&&(this.words[0]|0)<=p?(this.words[0]=p-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(p),this.negative=1,this):this._iaddn(p)},s.prototype._iaddn=function(p){this.words[0]+=p;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(p){if(n(typeof p=="number"),n(p<67108864),p<0)return this.iaddn(-p);if(this.negative!==0)return this.negative=0,this.iaddn(p),this.negative=1,this;if(this.words[0]-=p,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(p){return this.clone().iaddn(p)},s.prototype.subn=function(p){return this.clone().isubn(p)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(p,d,b){var D=p.length+b,M;this._expand(D);var N,U=0;for(M=0;M<p.length;M++){N=(this.words[M+b]|0)+U;var O=(p.words[M]|0)*d;N-=O&67108863,U=(N>>26)-(O/67108864|0),this.words[M+b]=N&67108863}for(;M<this.length-b;M++)N=(this.words[M+b]|0)+U,U=N>>26,this.words[M+b]=N&67108863;if(U===0)return this._strip();for(n(U===-1),U=0,M=0;M<this.length;M++)N=-(this.words[M]|0)+U,U=N>>26,this.words[M]=N&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var b=this.length-p.length,D=this.clone(),M=p,N=M.words[M.length-1]|0,U=this._countBits(N);b=26-U,b!==0&&(M=M.ushln(b),D.iushln(b),N=M.words[M.length-1]|0);var O=D.length-M.length,v;if(d!=="mod"){v=new s(null),v.length=O+1,v.words=new Array(v.length);for(var L=0;L<v.length;L++)v.words[L]=0}var oe=D.clone()._ishlnsubmul(M,1,O);oe.negative===0&&(D=oe,v&&(v.words[O]=1));for(var de=O-1;de>=0;de--){var x=(D.words[M.length+de]|0)*67108864+(D.words[M.length+de-1]|0);for(x=Math.min(x/N|0,67108863),D._ishlnsubmul(M,x,de);D.negative!==0;)x--,D.negative=0,D._ishlnsubmul(M,1,de),D.isZero()||(D.negative^=1);v&&(v.words[de]=x)}return v&&v._strip(),D._strip(),d!=="div"&&b!==0&&D.iushrn(b),{div:v||null,mod:D}},s.prototype.divmod=function(p,d,b){if(n(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var D,M,N;return this.negative!==0&&p.negative===0?(N=this.neg().divmod(p,d),d!=="mod"&&(D=N.div.neg()),d!=="div"&&(M=N.mod.neg(),b&&M.negative!==0&&M.iadd(p)),{div:D,mod:M}):this.negative===0&&p.negative!==0?(N=this.divmod(p.neg(),d),d!=="mod"&&(D=N.div.neg()),{div:D,mod:N.mod}):this.negative&p.negative?(N=this.neg().divmod(p.neg(),d),d!=="div"&&(M=N.mod.neg(),b&&M.negative!==0&&M.isub(p)),{div:N.div,mod:M}):p.length>this.length||this.cmp(p)<0?{div:new s(0),mod:this}:p.length===1?d==="div"?{div:this.divn(p.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(p.words[0]))}:{div:this.divn(p.words[0]),mod:new s(this.modrn(p.words[0]))}:this._wordDiv(p,d)},s.prototype.div=function(p){return this.divmod(p,"div",!1).div},s.prototype.mod=function(p){return this.divmod(p,"mod",!1).mod},s.prototype.umod=function(p){return this.divmod(p,"mod",!0).mod},s.prototype.divRound=function(p){var d=this.divmod(p);if(d.mod.isZero())return d.div;var b=d.div.negative!==0?d.mod.isub(p):d.mod,D=p.ushrn(1),M=p.andln(1),N=b.cmp(D);return N<0||M===1&&N===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var b=(1<<26)%p,D=0,M=this.length-1;M>=0;M--)D=(b*D+(this.words[M]|0))%p;return d?-D:D},s.prototype.modn=function(p){return this.modrn(p)},s.prototype.idivn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var b=0,D=this.length-1;D>=0;D--){var M=(this.words[D]|0)+b*67108864;this.words[D]=M/p|0,b=M%p}return this._strip(),d?this.ineg():this},s.prototype.divn=function(p){return this.clone().idivn(p)},s.prototype.egcd=function(p){n(p.negative===0),n(!p.isZero());var d=this,b=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var D=new s(1),M=new s(0),N=new s(0),U=new s(1),O=0;d.isEven()&&b.isEven();)d.iushrn(1),b.iushrn(1),++O;for(var v=b.clone(),L=d.clone();!d.isZero();){for(var oe=0,de=1;!(d.words[0]&de)&&oe<26;++oe,de<<=1);if(oe>0)for(d.iushrn(oe);oe-- >0;)(D.isOdd()||M.isOdd())&&(D.iadd(v),M.isub(L)),D.iushrn(1),M.iushrn(1);for(var x=0,ne=1;!(b.words[0]&ne)&&x<26;++x,ne<<=1);if(x>0)for(b.iushrn(x);x-- >0;)(N.isOdd()||U.isOdd())&&(N.iadd(v),U.isub(L)),N.iushrn(1),U.iushrn(1);d.cmp(b)>=0?(d.isub(b),D.isub(N),M.isub(U)):(b.isub(d),N.isub(D),U.isub(M))}return{a:N,b:U,gcd:b.iushln(O)}},s.prototype._invmp=function(p){n(p.negative===0),n(!p.isZero());var d=this,b=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var D=new s(1),M=new s(0),N=b.clone();d.cmpn(1)>0&&b.cmpn(1)>0;){for(var U=0,O=1;!(d.words[0]&O)&&U<26;++U,O<<=1);if(U>0)for(d.iushrn(U);U-- >0;)D.isOdd()&&D.iadd(N),D.iushrn(1);for(var v=0,L=1;!(b.words[0]&L)&&v<26;++v,L<<=1);if(v>0)for(b.iushrn(v);v-- >0;)M.isOdd()&&M.iadd(N),M.iushrn(1);d.cmp(b)>=0?(d.isub(b),D.isub(M)):(b.isub(d),M.isub(D))}var oe;return d.cmpn(1)===0?oe=D:oe=M,oe.cmpn(0)<0&&oe.iadd(p),oe},s.prototype.gcd=function(p){if(this.isZero())return p.abs();if(p.isZero())return this.abs();var d=this.clone(),b=p.clone();d.negative=0,b.negative=0;for(var D=0;d.isEven()&&b.isEven();D++)d.iushrn(1),b.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;b.isEven();)b.iushrn(1);var M=d.cmp(b);if(M<0){var N=d;d=b,b=N}else if(M===0||b.cmpn(1)===0)break;d.isub(b)}while(!0);return b.iushln(D)},s.prototype.invm=function(p){return this.egcd(p).a.umod(p)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(p){return this.words[0]&p},s.prototype.bincn=function(p){n(typeof p=="number");var d=p%26,b=(p-d)/26,D=1<<d;if(this.length<=b)return this._expand(b+1),this.words[b]|=D,this;for(var M=D,N=b;M!==0&&N<this.length;N++){var U=this.words[N]|0;U+=M,M=U>>>26,U&=67108863,this.words[N]=U}return M!==0&&(this.words[N]=M,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(p){var d=p<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var b;if(this.length>1)b=1;else{d&&(p=-p),n(p<=67108863,"Number is too big");var D=this.words[0]|0;b=D===p?0:D<p?-1:1}return this.negative!==0?-b|0:b},s.prototype.cmp=function(p){if(this.negative!==0&&p.negative===0)return-1;if(this.negative===0&&p.negative!==0)return 1;var d=this.ucmp(p);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(p){if(this.length>p.length)return 1;if(this.length<p.length)return-1;for(var d=0,b=this.length-1;b>=0;b--){var D=this.words[b]|0,M=p.words[b]|0;if(D!==M){D<M?d=-1:D>M&&(d=1);break}}return d},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new te(p)},s.prototype.toRed=function(p){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return n(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return n(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var j={k256:null,p224:null,p192:null,p25519:null};function P(p,d){this.name=p,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}P.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},P.prototype.ireduce=function(p){var d=p,b;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),b=d.bitLength();while(b>this.n);var D=b<this.n?-1:d.ucmp(this.p);return D===0?(d.words[0]=0,d.length=1):D>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},P.prototype.split=function(p,d){p.iushrn(this.n,0,d)},P.prototype.imulK=function(p){return p.imul(this.k)};function g(){P.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(g,P),g.prototype.split=function(p,d){for(var b=4194303,D=Math.min(p.length,9),M=0;M<D;M++)d.words[M]=p.words[M];if(d.length=D,p.length<=9){p.words[0]=0,p.length=1;return}var N=p.words[9];for(d.words[d.length++]=N&b,M=10;M<p.length;M++){var U=p.words[M]|0;p.words[M-10]=(U&b)<<4|N>>>22,N=U}N>>>=22,p.words[M-10]=N,N===0&&p.length>10?p.length-=10:p.length-=9},g.prototype.imulK=function(p){p.words[p.length]=0,p.words[p.length+1]=0,p.length+=2;for(var d=0,b=0;b<p.length;b++){var D=p.words[b]|0;d+=D*977,p.words[b]=d&67108863,d=D*64+(d/67108864|0)}return p.words[p.length-1]===0&&(p.length--,p.words[p.length-1]===0&&p.length--),p};function C(){P.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(C,P);function Z(){P.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(Z,P);function J(){P.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(J,P),J.prototype.imulK=function(p){for(var d=0,b=0;b<p.length;b++){var D=(p.words[b]|0)*19+d,M=D&67108863;D>>>=26,p.words[b]=M,d=D}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(j[p])return j[p];var d;if(p==="k256")d=new g;else if(p==="p224")d=new C;else if(p==="p192")d=new Z;else if(p==="p25519")d=new J;else throw new Error("Unknown prime "+p);return j[p]=d,d};function te(p){if(typeof p=="string"){var d=s._prime(p);this.m=d.p,this.prime=d}else n(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}te.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},te.prototype._verify2=function(p,d){n((p.negative|d.negative)===0,"red works only with positives"),n(p.red&&p.red===d.red,"red works only with red numbers")},te.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(m(p,p.umod(this.m)._forceRed(this)),p)},te.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},te.prototype.add=function(p,d){this._verify2(p,d);var b=p.add(d);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},te.prototype.iadd=function(p,d){this._verify2(p,d);var b=p.iadd(d);return b.cmp(this.m)>=0&&b.isub(this.m),b},te.prototype.sub=function(p,d){this._verify2(p,d);var b=p.sub(d);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},te.prototype.isub=function(p,d){this._verify2(p,d);var b=p.isub(d);return b.cmpn(0)<0&&b.iadd(this.m),b},te.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},te.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},te.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},te.prototype.isqr=function(p){return this.imul(p,p.clone())},te.prototype.sqr=function(p){return this.mul(p,p)},te.prototype.sqrt=function(p){if(p.isZero())return p.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var b=this.m.add(new s(1)).iushrn(2);return this.pow(p,b)}for(var D=this.m.subn(1),M=0;!D.isZero()&&D.andln(1)===0;)M++,D.iushrn(1);n(!D.isZero());var N=new s(1).toRed(this),U=N.redNeg(),O=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,O).cmp(U)!==0;)v.redIAdd(U);for(var L=this.pow(v,D),oe=this.pow(p,D.addn(1).iushrn(1)),de=this.pow(p,D),x=M;de.cmp(N)!==0;){for(var ne=de,q=0;ne.cmp(N)!==0;q++)ne=ne.redSqr();n(q<x);var H=this.pow(L,new s(1).iushln(x-q-1));oe=oe.redMul(H),L=H.redSqr(),de=de.redMul(L),x=q}return oe},te.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},te.prototype.pow=function(p,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return p.clone();var b=4,D=new Array(1<<b);D[0]=new s(1).toRed(this),D[1]=p;for(var M=2;M<D.length;M++)D[M]=this.mul(D[M-1],p);var N=D[0],U=0,O=0,v=d.bitLength()%26;for(v===0&&(v=26),M=d.length-1;M>=0;M--){for(var L=d.words[M],oe=v-1;oe>=0;oe--){var de=L>>oe&1;if(N!==D[0]&&(N=this.sqr(N)),de===0&&U===0){O=0;continue}U<<=1,U|=de,O++,!(O!==b&&(M!==0||oe!==0))&&(N=this.mul(N,D[U]),O=0,U=0)}v=26}return N},te.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},te.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new ae(p)};function ae(p){te.call(this,p),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)}i(ae,te),ae.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},ae.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},ae.prototype.imul=function(p,d){if(p.isZero()||d.isZero())return p.words[0]=0,p.length=1,p;var b=p.imul(d),D=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=b.isub(D).iushrn(this.shift),N=M;return M.cmp(this.m)>=0?N=M.isub(this.m):M.cmpn(0)<0&&(N=M.iadd(this.m)),N._forceRed(this)},ae.prototype.mul=function(p,d){if(p.isZero()||d.isZero())return new s(0)._forceRed(this);var b=p.mul(d),D=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=b.isub(D).iushrn(this.shift),N=M;return M.cmp(this.m)>=0?N=M.isub(this.m):M.cmpn(0)<0&&(N=M.iadd(this.m)),N._forceRed(this)},ae.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(t,lg)})(bg);var st=bg.exports;const _g="bignumber/5.7.0";var _l=st.BN;const Ni=new ut(_g),lf={},Eg=9007199254740991;function t8(t){return t!=null&&(Qt.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||pn(t)||typeof t=="bigint"||zo(t))}let Ag=!1;class Qt{constructor(e,r){e!==lf&&Ni.throwError("cannot call constructor directly; use BigNumber.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return en(bt(this).fromTwos(e))}toTwos(e){return en(bt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Qt.from(this._hex.substring(1)):this}add(e){return en(bt(this).add(bt(e)))}sub(e){return en(bt(this).sub(bt(e)))}div(e){return Qt.from(e).isZero()&&Cn("division-by-zero","div"),en(bt(this).div(bt(e)))}mul(e){return en(bt(this).mul(bt(e)))}mod(e){const r=bt(e);return r.isNeg()&&Cn("division-by-zero","mod"),en(bt(this).umod(r))}pow(e){const r=bt(e);return r.isNeg()&&Cn("negative-power","pow"),en(bt(this).pow(r))}and(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Cn("unbound-bitwise-result","and"),en(bt(this).and(r))}or(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Cn("unbound-bitwise-result","or"),en(bt(this).or(r))}xor(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Cn("unbound-bitwise-result","xor"),en(bt(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Cn("negative-width","mask"),en(bt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Cn("negative-width","shl"),en(bt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Cn("negative-width","shr"),en(bt(this).shrn(e))}eq(e){return bt(this).eq(bt(e))}lt(e){return bt(this).lt(bt(e))}lte(e){return bt(this).lte(bt(e))}gt(e){return bt(this).gt(bt(e))}gte(e){return bt(this).gte(bt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return bt(this).isZero()}toNumber(){try{return bt(this).toNumber()}catch{Cn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ni.throwError("this platform does not support BigInt",ut.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Ag||(Ag=!0,Ni.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ni.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ut.errors.UNEXPECTED_ARGUMENT,{}):Ni.throwError("BigNumber.toString does not accept parameters",ut.errors.UNEXPECTED_ARGUMENT,{})),bt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Qt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Qt(lf,Qa(e)):e.match(/^-?[0-9]+$/)?new Qt(lf,Qa(new _l(e))):Ni.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Cn("underflow","BigNumber.from",e),(e>=Eg||e<=-Eg)&&Cn("overflow","BigNumber.from",e),Qt.from(String(e));const r=e;if(typeof r=="bigint")return Qt.from(r.toString());if(zo(r))return Qt.from(jr(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Qt.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pn(n)||n[0]==="-"&&pn(n.substring(1))))return Qt.from(n)}return Ni.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Qa(t){if(typeof t!="string")return Qa(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ni.throwArgumentError("invalid hex","value",t),t=Qa(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function en(t){return Qt.from(Qa(t))}function bt(t){const e=Qt.from(t).toHexString();return e[0]==="-"?new _l("-"+e.substring(3),16):new _l(e.substring(2),16)}function Cn(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),Ni.throwError(t,ut.errors.NUMERIC_FAULT,n)}function r8(t){return new _l(t,36).toString(16)}const kr=new ut(_g),Za={},xg=Qt.from(0),Sg=Qt.from(-1);function Ig(t,e,r,n){const i={fault:e,operation:r};return n!==void 0&&(i.value=n),kr.throwError(t,ut.errors.NUMERIC_FAULT,i)}let Xa="0";for(;Xa.length<256;)Xa+=Xa;function uf(t){if(typeof t!="number")try{t=Qt.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Xa.substring(0,t):kr.throwArgumentError("invalid decimal size","decimals",t)}function hf(t,e){e==null&&(e=0);const r=uf(e);t=Qt.from(t);const n=t.lt(xg);n&&(t=t.mul(Sg));let i=t.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return r.length===1?t=s:t=s+"."+i,n&&(t="-"+t),t}function Ri(t,e){e==null&&(e=0);const r=uf(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&kr.throwArgumentError("invalid decimal value","value",t);const n=t.substring(0,1)==="-";n&&(t=t.substring(1)),t==="."&&kr.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&kr.throwArgumentError("too many decimal points","value",t);let s=i[0],c=i[1];for(s||(s="0"),c||(c="0");c[c.length-1]==="0";)c=c.substring(0,c.length-1);for(c.length>r.length-1&&Ig("fractional component exceeds decimals","underflow","parseFixed"),c===""&&(c="0");c.length<r.length-1;)c+="0";const l=Qt.from(s),f=Qt.from(c);let h=l.mul(r).add(f);return n&&(h=h.mul(Sg)),h}class Ho{constructor(e,r,n,i){e!==Za&&kr.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=n,this.decimals=i,this.name=(r?"":"u")+"fixed"+String(n)+"x"+String(i),this._multiplier=uf(i),Object.freeze(this)}static from(e){if(e instanceof Ho)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,n=128,i=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||kr.throwArgumentError("invalid fixed format","format",e),r=s[1]!=="u",n=parseInt(s[2]),i=parseInt(s[3])}}else if(e){const s=(c,l,f)=>e[c]==null?f:(typeof e[c]!==l&&kr.throwArgumentError("invalid fixed format ("+c+" not "+l+")","format."+c,e[c]),e[c]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&kr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&kr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new Ho(Za,r,n,i)}}class Or{constructor(e,r,n,i){e!==Za&&kr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&kr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Or.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Dg.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Or.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Dg.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&kr.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const n=Or.from("1"+Xa.substring(0,e),this.format),i=n8.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}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&&kr.throwArgumentError("invalid byte width","width",e);const r=Qt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return li(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Or.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!t8(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),Or.fromString(hf(e,r),Ho.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=Ho.from(r),i=Ri(e,n.decimals);!n.signed&&i.lt(xg)&&Ig("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=li(s,n.width/8));const c=hf(i,n.decimals);return new Or(Za,s,c,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=Ho.from(r);if(or(e).length>n.width/8)throw new Error("overflow");let i=Qt.from(e);n.signed&&(i=i.fromTwos(n.width));const s=i.toTwos((n.signed?0:1)+n.width).toHexString(),c=hf(i,n.decimals);return new Or(Za,s,c,n)}static from(e,r){if(typeof e=="string")return Or.fromString(e,r);if(zo(e))return Or.fromBytes(e,r);try{return Or.fromValue(e,0,r)}catch(n){if(n.code!==ut.errors.INVALID_ARGUMENT)throw n}return kr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Dg=Or.from(1),n8=Or.from("0.5"),i8="strings/5.7.0",Cg=new ut(i8);var El;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(El||(El={}));var Ko;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ko||(Ko={}));function s8(t,e,r,n,i){return Cg.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function Og(t,e,r,n,i){if(t===Ko.BAD_PREFIX||t===Ko.UNEXPECTED_CONTINUE){let s=0;for(let c=e+1;c<r.length&&r[c]>>6===2;c++)s++;return s}return t===Ko.OVERRUN?r.length-e-1:0}function o8(t,e,r,n,i){return t===Ko.OVERLONG?(n.push(i),0):(n.push(65533),Og(t,e,r))}Object.freeze({error:s8,ignore:Og,replace:o8});function ff(t,e=El.current){e!=El.current&&(Cg.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n<t.length;n++){const i=t.charCodeAt(n);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const c=65536+((i&1023)<<10)+(s&1023);r.push(c>>18|240),r.push(c>>12&63|128),r.push(c>>6&63|128),r.push(c&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return or(r)}function a8(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function df(t,e){e||(e=function(i){return[parseInt(i,16)]});let r=0,n={};return t.split(",").forEach(i=>{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function Pg(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}Pg("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(t=>parseInt(t,16)),df("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"),df("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"),df("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",a8),Pg("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 Mg="hash/5.7.0";function c8(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return or(e)}function Tg(t,e){e==null&&(e=1);const r=[],n=r.forEach,i=function(s,c){n.call(s,function(l){c>0&&Array.isArray(l)?i(l,c-1):r.push(l)})};return i(t,e),r}function l8(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[n[0]]=n[1]}return e}function u8(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let j=1;j<n;j++)s.push(i+=r());let c=r(),l=e;e+=c;let f=0,h=0;function m(){return f==0&&(h=h<<8|t[e++],f=8),h>>--f&1}const _=31,E=Math.pow(2,_),A=E>>>1,I=A>>1,R=E-1;let W=0;for(let j=0;j<_;j++)W=W<<1|m();let Y=[],F=0,z=E;for(;;){let j=Math.floor(((W-F+1)*i-1)/z),P=0,g=n;for(;g-P>1;){let J=P+g>>>1;j<s[J]?g=J:P=J}if(P==0)break;Y.push(P);let C=F+Math.floor(z*s[P]/i),Z=F+Math.floor(z*s[P+1]/i)-1;for(;!((C^Z)&A);)W=W<<1&R|m(),C=C<<1&R,Z=Z<<1&R|1;for(;C&~Z&I;)W=W&A|W<<1&R>>>1|m(),C=C<<1^A,Z=(Z^A)<<1|A|1;F=C,z=1+Z-C}let $=n-4;return Y.map(j=>{switch(j-$){case 3:return $+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return $+256+(t[l++]<<8|t[l++]);case 1:return $+t[l++];default:return j-1}})}function h8(t){let e=0;return()=>t[e++]}function f8(t){return h8(u8(t))}function d8(t){return t&1?~t>>1:t>>1}function p8(t,e){let r=Array(t);for(let n=0;n<t;n++)r[n]=1+e();return r}function $g(t,e){let r=Array(t);for(let n=0,i=-1;n<t;n++)r[n]=i+=1+e();return r}function g8(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=d8(e());return r}function Al(t,e){let r=$g(t(),t),n=t(),i=$g(n,t),s=p8(n,t);for(let c=0;c<n;c++)for(let l=0;l<s[c];l++)r.push(i[c]+l);return e?r.map(c=>e[c]):r}function m8(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(y8(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(w8(r,t))}return l8(Tg(e))}function v8(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Ng(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;i<e;i++)g8(t,r).forEach((s,c)=>n[c].push(s));return n}function y8(t,e){let r=1+e(),n=e(),i=v8(e),s=Ng(i.length,1+t,e);return Tg(s.map((c,l)=>{const f=c[0],h=c.slice(1);return Array(i[l]).fill(void 0).map((m,_)=>{let E=_*n;return[f+_*r,h.map(A=>A+E)]})}))}function w8(t,e){let r=1+e();return Ng(r,1+t,e).map(n=>[n[0],n.slice(1)])}function b8(t){let e=Al(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let h=Al(t,e);if(h.length==0)break;n.push({set:new Set(h),node:r()})}n.sort((h,m)=>m.set.size-h.set.size);let i=t(),s=i%3;i=i/3|0;let c=!!(i&1);i>>=1;let l=i==1,f=i==2;return{branches:n,valid:s,fe0f:c,save:l,check:f}}}function _8(){return f8(c8("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 xl=_8();new Set(Al(xl)),new Set(Al(xl)),m8(xl),b8(xl),new ut(Mg),new Uint8Array(32).fill(0);const E8=`Ethereum Signed Message:
22
- `;function Rg(t){return typeof t=="string"&&(t=ff(t)),cf(Y_([ff(E8),ff(String(t.length)),t]))}const A8="rlp/5.7.0";new ut(A8);const x8="address/5.7.0",ec=new ut(x8);function Lg(t){pn(t,20)||ec.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=or(cf(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const S8=9007199254740991;function I8(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const pf={};for(let t=0;t<10;t++)pf[String(t)]=String(t);for(let t=0;t<26;t++)pf[String.fromCharCode(65+t)]=String(10+t);const Bg=Math.floor(I8(S8));function D8(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>pf[n]).join("");for(;e.length>=Bg;){let n=e.substring(0,Bg);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function C8(t){let e=null;if(typeof t!="string"&&ec.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Lg(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&ec.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==D8(t)&&ec.throwArgumentError("bad icap checksum","address",t),e=r8(t.substring(4));e.length<40;)e="0"+e;e=Lg("0x"+e)}else ec.throwArgumentError("invalid address","address",t);return e}const O8="properties/5.7.0";new ut(O8);function tc(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new ut(Mg),new Uint8Array(32).fill(0),Qt.from(-1);const P8=Qt.from(0),M8=Qt.from(1);Qt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),li(M8.toHexString(),32),li(P8.toHexString(),32);var ui={},_t={},rc=Ug;function Ug(t,e){if(!t)throw new Error(e||"Assertion failed")}Ug.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var gf={exports:{}};typeof Object.create=="function"?gf.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:gf.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var T8=rc,$8=gf.exports;_t.inherits=$8;function N8(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function R8(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):N8(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i<t.length;i++)r[i]=t[i]|0;return r}_t.toArray=R8;function L8(t){for(var e="",r=0;r<t.length;r++)e+=jg(t[r].toString(16));return e}_t.toHex=L8;function Fg(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}_t.htonl=Fg;function B8(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];e==="little"&&(i=Fg(i)),r+=kg(i.toString(16))}return r}_t.toHex32=B8;function jg(t){return t.length===1?"0"+t:t}_t.zero2=jg;function kg(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}_t.zero8=kg;function U8(t,e,r,n){var i=r-e;T8(i%4===0);for(var s=new Array(i/4),c=0,l=e;c<s.length;c++,l+=4){var f;n==="big"?f=t[l]<<24|t[l+1]<<16|t[l+2]<<8|t[l+3]:f=t[l+3]<<24|t[l+2]<<16|t[l+1]<<8|t[l],s[c]=f>>>0}return s}_t.join32=U8;function F8(t,e){for(var r=new Array(t.length*4),n=0,i=0;n<t.length;n++,i+=4){var s=t[n];e==="big"?(r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}_t.split32=F8;function j8(t,e){return t>>>e|t<<32-e}_t.rotr32=j8;function k8(t,e){return t<<e|t>>>32-e}_t.rotl32=k8;function q8(t,e){return t+e>>>0}_t.sum32=q8;function z8(t,e,r){return t+e+r>>>0}_t.sum32_3=z8;function H8(t,e,r,n){return t+e+r+n>>>0}_t.sum32_4=H8;function K8(t,e,r,n,i){return t+e+r+n+i>>>0}_t.sum32_5=K8;function W8(t,e,r,n){var i=t[e],s=t[e+1],c=n+s>>>0,l=(c<n?1:0)+r+i;t[e]=l>>>0,t[e+1]=c}_t.sum64=W8;function V8(t,e,r,n){var i=e+n>>>0,s=(i<e?1:0)+t+r;return s>>>0}_t.sum64_hi=V8;function G8(t,e,r,n){var i=e+n;return i>>>0}_t.sum64_lo=G8;function Y8(t,e,r,n,i,s,c,l){var f=0,h=e;h=h+n>>>0,f+=h<e?1:0,h=h+s>>>0,f+=h<s?1:0,h=h+l>>>0,f+=h<l?1:0;var m=t+r+i+c+f;return m>>>0}_t.sum64_4_hi=Y8;function J8(t,e,r,n,i,s,c,l){var f=e+n+s+l;return f>>>0}_t.sum64_4_lo=J8;function Q8(t,e,r,n,i,s,c,l,f,h){var m=0,_=e;_=_+n>>>0,m+=_<e?1:0,_=_+s>>>0,m+=_<s?1:0,_=_+l>>>0,m+=_<l?1:0,_=_+h>>>0,m+=_<h?1:0;var E=t+r+i+c+f+m;return E>>>0}_t.sum64_5_hi=Q8;function Z8(t,e,r,n,i,s,c,l,f,h){var m=e+n+s+l+h;return m>>>0}_t.sum64_5_lo=Z8;function X8(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}_t.rotr64_hi=X8;function e4(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.rotr64_lo=e4;function t4(t,e,r){return t>>>r}_t.shr64_hi=t4;function r4(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.shr64_lo=r4;var Wo={},qg=_t,n4=rc;function Sl(){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}Wo.BlockHash=Sl,Sl.prototype.update=function(t,e){if(t=qg.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=qg.join32(t,0,t.length-r,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this},Sl.prototype.digest=function(t){return this.update(this._pad()),n4(this.pending===null),this._digest(t)},Sl.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s<this.padLength;s++)n[i++]=0;return n};var Vo={},hi={},i4=_t,fi=i4.rotr32;function s4(t,e,r,n){if(t===0)return zg(e,r,n);if(t===1||t===3)return Kg(e,r,n);if(t===2)return Hg(e,r,n)}hi.ft_1=s4;function zg(t,e,r){return t&e^~t&r}hi.ch32=zg;function Hg(t,e,r){return t&e^t&r^e&r}hi.maj32=Hg;function Kg(t,e,r){return t^e^r}hi.p32=Kg;function o4(t){return fi(t,2)^fi(t,13)^fi(t,22)}hi.s0_256=o4;function a4(t){return fi(t,6)^fi(t,11)^fi(t,25)}hi.s1_256=a4;function c4(t){return fi(t,7)^fi(t,18)^t>>>3}hi.g0_256=c4;function l4(t){return fi(t,17)^fi(t,19)^t>>>10}hi.g1_256=l4;var Go=_t,u4=Wo,h4=hi,mf=Go.rotl32,nc=Go.sum32,f4=Go.sum32_5,d4=h4.ft_1,Wg=u4.BlockHash,p4=[1518500249,1859775393,2400959708,3395469782];function di(){if(!(this instanceof di))return new di;Wg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Go.inherits(di,Wg);var g4=di;di.blockSize=512,di.outSize=160,di.hmacStrength=80,di.padLength=64,di.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=mf(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],s=this.h[1],c=this.h[2],l=this.h[3],f=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),m=f4(mf(i,5),d4(h,s,c,l),f,r[n],p4[h]);f=l,l=c,c=mf(s,30),s=i,i=m}this.h[0]=nc(this.h[0],i),this.h[1]=nc(this.h[1],s),this.h[2]=nc(this.h[2],c),this.h[3]=nc(this.h[3],l),this.h[4]=nc(this.h[4],f)},di.prototype._digest=function(t){return t==="hex"?Go.toHex32(this.h,"big"):Go.split32(this.h,"big")};var Yo=_t,m4=Wo,Jo=hi,v4=rc,Zn=Yo.sum32,y4=Yo.sum32_4,w4=Yo.sum32_5,b4=Jo.ch32,_4=Jo.maj32,E4=Jo.s0_256,A4=Jo.s1_256,x4=Jo.g0_256,S4=Jo.g1_256,Vg=m4.BlockHash,I4=[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 pi(){if(!(this instanceof pi))return new pi;Vg.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I4,this.W=new Array(64)}Yo.inherits(pi,Vg);var Gg=pi;pi.blockSize=512,pi.outSize=256,pi.hmacStrength=192,pi.padLength=64,pi.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=y4(S4(r[n-2]),r[n-7],x4(r[n-15]),r[n-16]);var i=this.h[0],s=this.h[1],c=this.h[2],l=this.h[3],f=this.h[4],h=this.h[5],m=this.h[6],_=this.h[7];for(v4(this.k.length===r.length),n=0;n<r.length;n++){var E=w4(_,A4(f),b4(f,h,m),this.k[n],r[n]),A=Zn(E4(i),_4(i,s,c));_=m,m=h,h=f,f=Zn(l,E),l=c,c=s,s=i,i=Zn(E,A)}this.h[0]=Zn(this.h[0],i),this.h[1]=Zn(this.h[1],s),this.h[2]=Zn(this.h[2],c),this.h[3]=Zn(this.h[3],l),this.h[4]=Zn(this.h[4],f),this.h[5]=Zn(this.h[5],h),this.h[6]=Zn(this.h[6],m),this.h[7]=Zn(this.h[7],_)},pi.prototype._digest=function(t){return t==="hex"?Yo.toHex32(this.h,"big"):Yo.split32(this.h,"big")};var vf=_t,Yg=Gg;function Li(){if(!(this instanceof Li))return new Li;Yg.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}vf.inherits(Li,Yg);var D4=Li;Li.blockSize=512,Li.outSize=224,Li.hmacStrength=192,Li.padLength=64,Li.prototype._digest=function(t){return t==="hex"?vf.toHex32(this.h.slice(0,7),"big"):vf.split32(this.h.slice(0,7),"big")};var tn=_t,C4=Wo,O4=rc,gi=tn.rotr64_hi,mi=tn.rotr64_lo,Jg=tn.shr64_hi,Qg=tn.shr64_lo,ss=tn.sum64,yf=tn.sum64_hi,wf=tn.sum64_lo,P4=tn.sum64_4_hi,M4=tn.sum64_4_lo,T4=tn.sum64_5_hi,$4=tn.sum64_5_lo,Zg=C4.BlockHash,N4=[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 Xn(){if(!(this instanceof Xn))return new Xn;Zg.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=N4,this.W=new Array(160)}tn.inherits(Xn,Zg);var Xg=Xn;Xn.blockSize=1024,Xn.outSize=512,Xn.hmacStrength=192,Xn.padLength=128,Xn.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=K4(r[n-4],r[n-3]),s=W4(r[n-4],r[n-3]),c=r[n-14],l=r[n-13],f=z4(r[n-30],r[n-29]),h=H4(r[n-30],r[n-29]),m=r[n-32],_=r[n-31];r[n]=P4(i,s,c,l,f,h,m,_),r[n+1]=M4(i,s,c,l,f,h,m,_)}},Xn.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],s=this.h[2],c=this.h[3],l=this.h[4],f=this.h[5],h=this.h[6],m=this.h[7],_=this.h[8],E=this.h[9],A=this.h[10],I=this.h[11],R=this.h[12],W=this.h[13],Y=this.h[14],F=this.h[15];O4(this.k.length===r.length);for(var z=0;z<r.length;z+=2){var $=Y,j=F,P=k4(_,E),g=q4(_,E),C=R4(_,E,A,I,R),Z=L4(_,E,A,I,R,W),J=this.k[z],te=this.k[z+1],ae=r[z],p=r[z+1],d=T4($,j,P,g,C,Z,J,te,ae,p),b=$4($,j,P,g,C,Z,J,te,ae,p);$=F4(n,i),j=j4(n,i),P=B4(n,i,s,c,l),g=U4(n,i,s,c,l,f);var D=yf($,j,P,g),M=wf($,j,P,g);Y=R,F=W,R=A,W=I,A=_,I=E,_=yf(h,m,d,b),E=wf(m,m,d,b),h=l,m=f,l=s,f=c,s=n,c=i,n=yf(d,b,D,M),i=wf(d,b,D,M)}ss(this.h,0,n,i),ss(this.h,2,s,c),ss(this.h,4,l,f),ss(this.h,6,h,m),ss(this.h,8,_,E),ss(this.h,10,A,I),ss(this.h,12,R,W),ss(this.h,14,Y,F)},Xn.prototype._digest=function(t){return t==="hex"?tn.toHex32(this.h,"big"):tn.split32(this.h,"big")};function R4(t,e,r,n,i){var s=t&r^~t&i;return s<0&&(s+=4294967296),s}function L4(t,e,r,n,i,s){var c=e&n^~e&s;return c<0&&(c+=4294967296),c}function B4(t,e,r,n,i){var s=t&r^t&i^r&i;return s<0&&(s+=4294967296),s}function U4(t,e,r,n,i,s){var c=e&n^e&s^n&s;return c<0&&(c+=4294967296),c}function F4(t,e){var r=gi(t,e,28),n=gi(e,t,2),i=gi(e,t,7),s=r^n^i;return s<0&&(s+=4294967296),s}function j4(t,e){var r=mi(t,e,28),n=mi(e,t,2),i=mi(e,t,7),s=r^n^i;return s<0&&(s+=4294967296),s}function k4(t,e){var r=gi(t,e,14),n=gi(t,e,18),i=gi(e,t,9),s=r^n^i;return s<0&&(s+=4294967296),s}function q4(t,e){var r=mi(t,e,14),n=mi(t,e,18),i=mi(e,t,9),s=r^n^i;return s<0&&(s+=4294967296),s}function z4(t,e){var r=gi(t,e,1),n=gi(t,e,8),i=Jg(t,e,7),s=r^n^i;return s<0&&(s+=4294967296),s}function H4(t,e){var r=mi(t,e,1),n=mi(t,e,8),i=Qg(t,e,7),s=r^n^i;return s<0&&(s+=4294967296),s}function K4(t,e){var r=gi(t,e,19),n=gi(e,t,29),i=Jg(t,e,6),s=r^n^i;return s<0&&(s+=4294967296),s}function W4(t,e){var r=mi(t,e,19),n=mi(e,t,29),i=Qg(t,e,6),s=r^n^i;return s<0&&(s+=4294967296),s}var bf=_t,em=Xg;function Bi(){if(!(this instanceof Bi))return new Bi;em.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}bf.inherits(Bi,em);var V4=Bi;Bi.blockSize=1024,Bi.outSize=384,Bi.hmacStrength=192,Bi.padLength=128,Bi.prototype._digest=function(t){return t==="hex"?bf.toHex32(this.h.slice(0,12),"big"):bf.split32(this.h.slice(0,12),"big")},Vo.sha1=g4,Vo.sha224=D4,Vo.sha256=Gg,Vo.sha384=V4,Vo.sha512=Xg;var tm={},Hs=_t,G4=Wo,Il=Hs.rotl32,rm=Hs.sum32,ic=Hs.sum32_3,nm=Hs.sum32_4,im=G4.BlockHash;function vi(){if(!(this instanceof vi))return new vi;im.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Hs.inherits(vi,im),tm.ripemd160=vi,vi.blockSize=512,vi.outSize=160,vi.hmacStrength=192,vi.padLength=64,vi.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],s=this.h[3],c=this.h[4],l=r,f=n,h=i,m=s,_=c,E=0;E<80;E++){var A=rm(Il(nm(r,sm(E,n,i,s),t[Q4[E]+e],Y4(E)),X4[E]),c);r=c,c=s,s=Il(i,10),i=n,n=A,A=rm(Il(nm(l,sm(79-E,f,h,m),t[Z4[E]+e],J4(E)),eE[E]),_),l=_,_=m,m=Il(h,10),h=f,f=A}A=ic(this.h[1],i,m),this.h[1]=ic(this.h[2],s,_),this.h[2]=ic(this.h[3],c,l),this.h[3]=ic(this.h[4],r,f),this.h[4]=ic(this.h[0],n,h),this.h[0]=A},vi.prototype._digest=function(t){return t==="hex"?Hs.toHex32(this.h,"little"):Hs.split32(this.h,"little")};function sm(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function Y4(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function J4(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var Q4=[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],Z4=[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],X4=[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],eE=[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],tE=_t,rE=rc;function Qo(t,e,r){if(!(this instanceof Qo))return new Qo(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(tE.toArray(e,r))}var nE=Qo;Qo.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),rE(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=new this.Hash().update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=new this.Hash().update(t)},Qo.prototype.update=function(t,e){return this.inner.update(t,e),this},Qo.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=_t,e.common=Wo,e.sha=Vo,e.ripemd=tm,e.hmac=nE,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}(ui);function Zo(t,e,r){return r={path:e,exports:{},require:function(n,i){return iE(n,i??r.path)}},t(r,r.exports),r.exports}function iE(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var _f=om;function om(t,e){if(!t)throw new Error(e||"Assertion failed")}om.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var ei=Zo(function(t,e){var r=e;function n(c,l){if(Array.isArray(c))return c.slice();if(!c)return[];var f=[];if(typeof c!="string"){for(var h=0;h<c.length;h++)f[h]=c[h]|0;return f}if(l==="hex"){c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c);for(var h=0;h<c.length;h+=2)f.push(parseInt(c[h]+c[h+1],16))}else for(var h=0;h<c.length;h++){var m=c.charCodeAt(h),_=m>>8,E=m&255;_?f.push(_,E):f.push(E)}return f}r.toArray=n;function i(c){return c.length===1?"0"+c:c}r.zero2=i;function s(c){for(var l="",f=0;f<c.length;f++)l+=i(c[f].toString(16));return l}r.toHex=s,r.encode=function(c,l){return l==="hex"?s(c):c}}),gn=Zo(function(t,e){var r=e;r.assert=_f,r.toArray=ei.toArray,r.zero2=ei.zero2,r.toHex=ei.toHex,r.encode=ei.encode;function n(f,h,m){var _=new Array(Math.max(f.bitLength(),m)+1);_.fill(0);for(var E=1<<h+1,A=f.clone(),I=0;I<_.length;I++){var R,W=A.andln(E-1);A.isOdd()?(W>(E>>1)-1?R=(E>>1)-W:R=W,A.isubn(R)):R=0,_[I]=R,A.iushrn(1)}return _}r.getNAF=n;function i(f,h){var m=[[],[]];f=f.clone(),h=h.clone();for(var _=0,E=0,A;f.cmpn(-_)>0||h.cmpn(-E)>0;){var I=f.andln(3)+_&3,R=h.andln(3)+E&3;I===3&&(I=-1),R===3&&(R=-1);var W;I&1?(A=f.andln(7)+_&7,(A===3||A===5)&&R===2?W=-I:W=I):W=0,m[0].push(W);var Y;R&1?(A=h.andln(7)+E&7,(A===3||A===5)&&I===2?Y=-R:Y=R):Y=0,m[1].push(Y),2*_===W+1&&(_=1-_),2*E===Y+1&&(E=1-E),f.iushrn(1),h.iushrn(1)}return m}r.getJSF=i;function s(f,h,m){var _="_"+h;f.prototype[h]=function(){return this[_]!==void 0?this[_]:this[_]=m.call(this)}}r.cachedProperty=s;function c(f){return typeof f=="string"?r.toArray(f,"hex"):f}r.parseBytes=c;function l(f){return new st(f,"hex","le")}r.intFromLE=l}),Dl=gn.getNAF,sE=gn.getJSF,Cl=gn.assert;function os(t,e){this.type=t,this.p=new st(e.p,16),this.red=e.prime?st.red(e.prime):st.mont(this.p),this.zero=new st(0).toRed(this.red),this.one=new st(1).toRed(this.red),this.two=new st(2).toRed(this.red),this.n=e.n&&new st(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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ks=os;os.prototype.point=function(){throw new Error("Not implemented")},os.prototype.validate=function(){throw new Error("Not implemented")},os.prototype._fixedNafMul=function(t,e){Cl(t.precomputed);var r=t._getDoubles(),n=Dl(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2===0?2:1);i/=3;var s=[],c,l;for(c=0;c<n.length;c+=r.step){l=0;for(var f=c+r.step-1;f>=c;f--)l=(l<<1)+n[f];s.push(l)}for(var h=this.jpoint(null,null,null),m=this.jpoint(null,null,null),_=i;_>0;_--){for(c=0;c<s.length;c++)l=s[c],l===_?m=m.mixedAdd(r.points[c]):l===-_&&(m=m.mixedAdd(r.points[c].neg()));h=h.add(m)}return h.toP()},os.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=Dl(e,r,this._bitLength),c=this.jpoint(null,null,null),l=s.length-1;l>=0;l--){for(var f=0;l>=0&&s[l]===0;l--)f++;if(l>=0&&f++,c=c.dblp(f),l<0)break;var h=s[l];Cl(h!==0),t.type==="affine"?h>0?c=c.mixedAdd(i[h-1>>1]):c=c.mixedAdd(i[-h-1>>1].neg()):h>0?c=c.add(i[h-1>>1]):c=c.add(i[-h-1>>1].neg())}return t.type==="affine"?c.toP():c},os.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,c=this._wnafT2,l=this._wnafT3,f=0,h,m,_;for(h=0;h<n;h++){_=e[h];var E=_._getNAFPoints(t);s[h]=E.wnd,c[h]=E.points}for(h=n-1;h>=1;h-=2){var A=h-1,I=h;if(s[A]!==1||s[I]!==1){l[A]=Dl(r[A],s[A],this._bitLength),l[I]=Dl(r[I],s[I],this._bitLength),f=Math.max(l[A].length,f),f=Math.max(l[I].length,f);continue}var R=[e[A],null,null,e[I]];e[A].y.cmp(e[I].y)===0?(R[1]=e[A].add(e[I]),R[2]=e[A].toJ().mixedAdd(e[I].neg())):e[A].y.cmp(e[I].y.redNeg())===0?(R[1]=e[A].toJ().mixedAdd(e[I]),R[2]=e[A].add(e[I].neg())):(R[1]=e[A].toJ().mixedAdd(e[I]),R[2]=e[A].toJ().mixedAdd(e[I].neg()));var W=[-3,-1,-5,-7,0,7,5,1,3],Y=sE(r[A],r[I]);for(f=Math.max(Y[0].length,f),l[A]=new Array(f),l[I]=new Array(f),m=0;m<f;m++){var F=Y[0][m]|0,z=Y[1][m]|0;l[A][m]=W[(F+1)*3+(z+1)],l[I][m]=0,c[A]=R}}var $=this.jpoint(null,null,null),j=this._wnafT4;for(h=f;h>=0;h--){for(var P=0;h>=0;){var g=!0;for(m=0;m<n;m++)j[m]=l[m][h]|0,j[m]!==0&&(g=!1);if(!g)break;P++,h--}if(h>=0&&P++,$=$.dblp(P),h<0)break;for(m=0;m<n;m++){var C=j[m];C!==0&&(C>0?_=c[m][C-1>>1]:C<0&&(_=c[m][-C-1>>1].neg()),_.type==="affine"?$=$.mixedAdd(_):$=$.add(_))}}for(h=0;h<n;h++)c[h]=null;return i?$:$.toP()};function On(t,e){this.curve=t,this.type=e,this.precomputed=null}os.BasePoint=On,On.prototype.eq=function(){throw new Error("Not implemented")},On.prototype.validate=function(){return this.curve.validate(this)},os.prototype.decodePoint=function(t,e){t=gn.toArray(t,e);var r=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*r){t[0]===6?Cl(t[t.length-1]%2===0):t[0]===7&&Cl(t[t.length-1]%2===1);var n=this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));return n}else if((t[0]===2||t[0]===3)&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),t[0]===3);throw new Error("Unknown point format")},On.prototype.encodeCompressed=function(t){return this.encode(t,!0)},On.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},On.prototype.encode=function(t,e){return gn.encode(this._encode(e),t)},On.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},On.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((t.bitLength()+1)/e.step):!1},On.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var s=0;s<t;s++)n=n.dbl();r.push(n)}return{step:t,points:r}},On.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=r===1?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},On.prototype._getBeta=function(){return null},On.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Ef=Zo(function(t){typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}}),oE=gn.assert;function Pn(t){Ks.call(this,"short",t),this.a=new st(t.a,16).toRed(this.red),this.b=new st(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Ef(Pn,Ks);var aE=Pn;Pn.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var e,r;if(t.beta)e=new st(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=n[0].cmp(n[1])<0?n[0]:n[1],e=e.toRed(this.red)}if(t.lambda)r=new st(t.lambda,16);else{var i=this._getEndoRoots(this.n);this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))===0?r=i[0]:(r=i[1],oE(this.g.mul(r).x.cmp(this.g.x.redMul(e))===0))}var s;return t.basis?s=t.basis.map(function(c){return{a:new st(c.a,16),b:new st(c.b,16)}}):s=this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},Pn.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:st.mont(t),r=new st(2).toRed(e).redInvm(),n=r.redNeg(),i=new st(3).toRed(e).redNeg().redSqrt().redMul(r),s=n.redAdd(i).fromRed(),c=n.redSub(i).fromRed();return[s,c]},Pn.prototype._getEndoBasis=function(t){for(var e=this.n.ushrn(Math.floor(this.n.bitLength()/2)),r=t,n=this.n.clone(),i=new st(1),s=new st(0),c=new st(0),l=new st(1),f,h,m,_,E,A,I,R=0,W,Y;r.cmpn(0)!==0;){var F=n.div(r);W=n.sub(F.mul(r)),Y=c.sub(F.mul(i));var z=l.sub(F.mul(s));if(!m&&W.cmp(e)<0)f=I.neg(),h=i,m=W.neg(),_=Y;else if(m&&++R===2)break;I=W,n=r,r=W,c=i,i=Y,l=s,s=z}E=W.neg(),A=Y;var $=m.sqr().add(_.sqr()),j=E.sqr().add(A.sqr());return j.cmp($)>=0&&(E=f,A=h),m.negative&&(m=m.neg(),_=_.neg()),E.negative&&(E=E.neg(),A=A.neg()),[{a:m,b:_},{a:E,b:A}]},Pn.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),c=i.mul(r.a),l=s.mul(n.a),f=i.mul(r.b),h=s.mul(n.b),m=t.sub(c).sub(l),_=f.add(h).neg();return{k1:m,k2:_}},Pn.prototype.pointFromX=function(t,e){t=new st(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Pn.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Pn.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s<t.length;s++){var c=this._endoSplit(e[s]),l=t[s],f=l._getBeta();c.k1.negative&&(c.k1.ineg(),l=l.neg(!0)),c.k2.negative&&(c.k2.ineg(),f=f.neg(!0)),n[s*2]=l,n[s*2+1]=f,i[s*2]=c.k1,i[s*2+1]=c.k2}for(var h=this._wnafMulAdd(1,n,i,s*2,r),m=0;m<s*2;m++)n[m]=null,i[m]=null;return h};function br(t,e,r,n){Ks.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new st(e,16),this.y=new st(r,16),n&&(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)}Ef(br,Ks.BasePoint),Pn.prototype.point=function(t,e,r){return new br(this,t,e,r)},Pn.prototype.pointFromJSON=function(t,e){return br.fromJSON(this,t,e)},br.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(i){return r.point(i.x.redMul(r.endo.beta),i.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},br.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]},br.fromJSON=function(t,e,r){typeof e=="string"&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(c){return t.point(c[0],c[1],r)}var s=e[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(i))}},n},br.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)+">"},br.prototype.isInfinity=function(){return this.inf},br.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},br.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),c=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,c)},br.prototype.getX=function(){return this.x.fromRed()},br.prototype.getY=function(){return this.y.fromRed()},br.prototype.mul=function(t){return t=new st(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},br.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},br.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},br.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},br.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},br.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Pr(t,e,r,n){Ks.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new st(0)):(this.x=new st(e,16),this.y=new st(r,16),this.z=new st(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.zOne=this.z===this.curve.one}Ef(Pr,Ks.BasePoint),Pn.prototype.jpoint=function(t,e,r){return new Pr(this,t,e,r)},Pr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Pr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Pr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),c=t.y.redMul(r.redMul(this.z)),l=n.redSub(i),f=s.redSub(c);if(l.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=l.redSqr(),m=h.redMul(l),_=n.redMul(h),E=f.redSqr().redIAdd(m).redISub(_).redISub(_),A=f.redMul(_.redISub(E)).redISub(s.redMul(m)),I=this.z.redMul(t.z).redMul(l);return this.curve.jpoint(E,A,I)},Pr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),c=r.redSub(n),l=i.redSub(s);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),h=f.redMul(c),m=r.redMul(f),_=l.redSqr().redIAdd(h).redISub(m).redISub(m),E=l.redMul(m.redISub(_)).redISub(i.redMul(h)),A=this.z.redMul(c);return this.curve.jpoint(_,E,A)},Pr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,s=this.x,c=this.y,l=this.z,f=l.redSqr().redSqr(),h=c.redAdd(c);for(e=0;e<t;e++){var m=s.redSqr(),_=h.redSqr(),E=_.redSqr(),A=m.redAdd(m).redIAdd(m).redIAdd(n.redMul(f)),I=s.redMul(_),R=A.redSqr().redISub(I.redAdd(I)),W=I.redISub(R),Y=A.redMul(W);Y=Y.redIAdd(Y).redISub(E);var F=h.redMul(l);e+1<t&&(f=f.redMul(E)),s=R,l=F,h=Y}return this.curve.jpoint(s,h.redMul(i),l)},Pr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Pr.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),c=this.x.redAdd(i).redSqr().redISub(n).redISub(s);c=c.redIAdd(c);var l=n.redAdd(n).redIAdd(n),f=l.redSqr().redISub(c).redISub(c),h=s.redIAdd(s);h=h.redIAdd(h),h=h.redIAdd(h),t=f,e=l.redMul(c.redISub(f)).redISub(h),r=this.y.redAdd(this.y)}else{var m=this.x.redSqr(),_=this.y.redSqr(),E=_.redSqr(),A=this.x.redAdd(_).redSqr().redISub(m).redISub(E);A=A.redIAdd(A);var I=m.redAdd(m).redIAdd(m),R=I.redSqr(),W=E.redIAdd(E);W=W.redIAdd(W),W=W.redIAdd(W),t=R.redISub(A).redISub(A),e=I.redMul(A.redISub(t)).redISub(W),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},Pr.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),c=this.x.redAdd(i).redSqr().redISub(n).redISub(s);c=c.redIAdd(c);var l=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=l.redSqr().redISub(c).redISub(c);t=f;var h=s.redIAdd(s);h=h.redIAdd(h),h=h.redIAdd(h),e=l.redMul(c.redISub(f)).redISub(h),r=this.y.redAdd(this.y)}else{var m=this.z.redSqr(),_=this.y.redSqr(),E=this.x.redMul(_),A=this.x.redSub(m).redMul(this.x.redAdd(m));A=A.redAdd(A).redIAdd(A);var I=E.redIAdd(E);I=I.redIAdd(I);var R=I.redAdd(I);t=A.redSqr().redISub(R),r=this.y.redAdd(this.z).redSqr().redISub(_).redISub(m);var W=_.redSqr();W=W.redIAdd(W),W=W.redIAdd(W),W=W.redIAdd(W),e=A.redMul(I.redISub(t)).redISub(W)}return this.curve.jpoint(t,e,r)},Pr.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=e.redSqr(),c=r.redSqr(),l=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(i)),f=e.redAdd(e);f=f.redIAdd(f);var h=f.redMul(c),m=l.redSqr().redISub(h.redAdd(h)),_=h.redISub(m),E=c.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=l.redMul(_).redISub(E),I=r.redAdd(r).redMul(n);return this.curve.jpoint(m,A,I)},Pr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),s=i.redSqr(),c=this.x.redAdd(e).redSqr().redISub(t).redISub(n);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(s);var l=c.redSqr(),f=n.redIAdd(n);f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var h=i.redIAdd(c).redSqr().redISub(s).redISub(l).redISub(f),m=e.redMul(h);m=m.redIAdd(m),m=m.redIAdd(m);var _=this.x.redMul(l).redISub(m);_=_.redIAdd(_),_=_.redIAdd(_);var E=this.y.redMul(h.redMul(f.redISub(h)).redISub(c.redMul(l)));E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=this.z.redAdd(c).redSqr().redISub(r).redISub(l);return this.curve.jpoint(_,E,A)},Pr.prototype.mul=function(t,e){return t=new st(t,e),this.curve._wnafMul(this,t)},Pr.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)!==0)return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)===0},Pr.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(this.x.cmp(r)===0)return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Pr.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)+">"},Pr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ol=Zo(function(t,e){var r=e;r.base=Ks,r.short=aE,r.mont=null,r.edwards=null}),Pl=Zo(function(t,e){var r=e,n=gn.assert;function i(l){l.type==="short"?this.curve=new Ol.short(l):l.type==="edwards"?this.curve=new Ol.edwards(l):this.curve=new Ol.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(l,f){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var h=new i(f);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:h}),h}})}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:ui.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:ui.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:ui.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:ui.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:ui.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:ui.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:ui.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=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:ui.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function as(t){if(!(this instanceof as))return new as(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ei.toArray(t.entropy,t.entropyEnc||"hex"),r=ei.toArray(t.nonce,t.nonceEnc||"hex"),n=ei.toArray(t.pers,t.persEnc||"hex");_f(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var am=as;as.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},as.prototype._hmac=function(){return new ui.hmac(this.hash,this.K)},as.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},as.prototype.reseed=function(t,e,r,n){typeof e!="string"&&(n=r,r=e,e=null),t=ei.toArray(t,e),r=ei.toArray(r,n),_f(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},as.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=ei.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,t);return this._update(r),this._reseed++,ei.encode(s,e)};var Af=gn.assert;function Rr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var xf=Rr;Rr.fromPublic=function(t,e,r){return e instanceof Rr?e:new Rr(t,{pub:e,pubEnc:r})},Rr.fromPrivate=function(t,e,r){return e instanceof Rr?e:new Rr(t,{priv:e,privEnc:r})},Rr.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},Rr.prototype.getPublic=function(t,e){return typeof t=="string"&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Rr.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv},Rr.prototype._importPrivate=function(t,e){this.priv=new st(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Rr.prototype._importPublic=function(t,e){if(t.x||t.y){this.ec.curve.type==="mont"?Af(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Af(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,e)},Rr.prototype.derive=function(t){return t.validate()||Af(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Rr.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Rr.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Rr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var cE=gn.assert;function Ml(t,e){if(t instanceof Ml)return t;this._importDER(t,e)||(cE(t.r&&t.s,"Signature without r or s"),this.r=new st(t.r,16),this.s=new st(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Tl=Ml;function lE(){this.place=0}function Sf(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,c=e.place;s<n;s++,c++)i<<=8,i|=t[c],i>>>=0;return i<=127?!1:(e.place=c,i)}function cm(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}Ml.prototype._importDER=function(t,e){t=gn.toArray(t,e);var r=new lE;if(t[r.place++]!==48)return!1;var n=Sf(t,r);if(n===!1||n+r.place!==t.length||t[r.place++]!==2)return!1;var i=Sf(t,r);if(i===!1)return!1;var s=t.slice(r.place,i+r.place);if(r.place+=i,t[r.place++]!==2)return!1;var c=Sf(t,r);if(c===!1||t.length!==c+r.place)return!1;var l=t.slice(r.place,c+r.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new st(s),this.s=new st(l),this.recoveryParam=null,!0};function If(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ml.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=cm(e),r=cm(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];If(n,e.length),n=n.concat(e),n.push(2),If(n,r.length);var i=n.concat(r),s=[48];return If(s,i.length),s=s.concat(i),gn.encode(s,t)};var uE=function(){throw new Error("unsupported")},lm=gn.assert;function Mn(t){if(!(this instanceof Mn))return new Mn(t);typeof t=="string"&&(lm(Object.prototype.hasOwnProperty.call(Pl,t),"Unknown curve "+t),t=Pl[t]),t instanceof Pl.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hE=Mn;Mn.prototype.keyPair=function(t){return new xf(this,t)},Mn.prototype.keyFromPrivate=function(t,e){return xf.fromPrivate(this,t,e)},Mn.prototype.keyFromPublic=function(t,e){return xf.fromPublic(this,t,e)},Mn.prototype.genKeyPair=function(t){t||(t={});for(var e=new am({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||uE(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new st(2));;){var i=new st(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Mn.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Mn.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new st(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),c=t.toArray("be",i),l=new am({hash:this.hash,entropy:s,nonce:c,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new st(1)),h=0;;h++){var m=n.k?n.k(h):new st(l.generate(this.n.byteLength()));if(m=this._truncateToN(m,!0),!(m.cmpn(1)<=0||m.cmp(f)>=0)){var _=this.g.mul(m);if(!_.isInfinity()){var E=_.getX(),A=E.umod(this.n);if(A.cmpn(0)!==0){var I=m.invm(this.n).mul(A.mul(e.getPrivate()).iadd(t));if(I=I.umod(this.n),I.cmpn(0)!==0){var R=(_.getY().isOdd()?1:0)|(E.cmp(A)!==0?2:0);return n.canonical&&I.cmp(this.nh)>0&&(I=this.n.sub(I),R^=1),new Tl({r:A,s:I,recoveryParam:R})}}}}}},Mn.prototype.verify=function(t,e,r,n){t=this._truncateToN(new st(t,16)),r=this.keyFromPublic(r,n),e=new Tl(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var c=s.invm(this.n),l=c.mul(t).umod(this.n),f=c.mul(i).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(l,r.getPublic(),f),h.isInfinity()?!1:h.eqXToP(i)):(h=this.g.mulAdd(l,r.getPublic(),f),h.isInfinity()?!1:h.getX().umod(this.n).cmp(i)===0)},Mn.prototype.recoverPubKey=function(t,e,r,n){lm((3&r)===r,"The recovery param is more than two bits"),e=new Tl(e,n);var i=this.n,s=new st(t),c=e.r,l=e.s,f=r&1,h=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");h?c=this.curve.pointFromX(c.add(this.curve.n),f):c=this.curve.pointFromX(c,f);var m=e.r.invm(i),_=i.sub(s).mul(m).umod(i),E=l.mul(m).umod(i);return this.g.mulAdd(_,c,E)},Mn.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Tl(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var fE=Zo(function(t,e){var r=e;r.version="6.5.4",r.utils=gn,r.rand=function(){throw new Error("unsupported")},r.curve=Ol,r.curves=Pl,r.ec=hE,r.eddsa=null}),dE=fE.ec;const pE="signing-key/5.7.0",Df=new ut(pE);let Cf=null;function yi(){return Cf||(Cf=new dE("secp256k1")),Cf}class gE{constructor(e){tc(this,"curve","secp256k1"),tc(this,"privateKey",jr(e)),Q_(this.privateKey)!==32&&Df.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=yi().keyFromPrivate(or(this.privateKey));tc(this,"publicKey","0x"+r.getPublic(!1,"hex")),tc(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),tc(this,"_isSigningKey",!0)}_addPoint(e){const r=yi().keyFromPublic(or(this.publicKey)),n=yi().keyFromPublic(or(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=yi().keyFromPrivate(or(this.privateKey)),n=or(e);n.length!==32&&Df.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return wg({recoveryParam:i.recoveryParam,r:li("0x"+i.r.toString(16),32),s:li("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=yi().keyFromPrivate(or(this.privateKey)),n=yi().keyFromPublic(or(um(e)));return li("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function mE(t,e){const r=wg(e),n={r:or(r.r),s:or(r.s)};return"0x"+yi().recoverPubKey(or(t),n,r.recoveryParam).encode("hex",!1)}function um(t,e){const r=or(t);if(r.length===32){const n=new gE(r);return e?"0x"+yi().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?jr(r):"0x"+yi().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+yi().keyFromPublic(r).getPublic(!0,"hex"):jr(r)}return Df.throwArgumentError("invalid public or private key","key","[REDACTED]")}const vE="transactions/5.7.0";new ut(vE);var hm;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(hm||(hm={}));function yE(t){const e=um(t);return C8(yg(cf(yg(e,1)),12))}function wE(t,e){return yE(mE(or(t),e))}const bE="https://rpc.walletconnect.com/v1";async function _E(t,e,r,n,i,s){switch(r.t){case"eip191":return EE(t,e,r.s);case"eip1271":return await AE(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function EE(t,e,r){return wE(Rg(e),r).toLowerCase()===t.toLowerCase()}async function AE(t,e,r,n,i,s){try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",f="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),m=Rg(e).substring(2),_=c+m+l+f+h,E=await fetch(`${s||bE}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:xE(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:_},"latest"]})}),{result:A}=await E.json();return A?A.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function xE(){return Date.now()+Math.floor(Math.random()*1e3)}var SE=Object.defineProperty,IE=Object.defineProperties,DE=Object.getOwnPropertyDescriptors,fm=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,OE=Object.prototype.propertyIsEnumerable,dm=(t,e,r)=>e in t?SE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PE=(t,e)=>{for(var r in e||(e={}))CE.call(e,r)&&dm(t,r,e[r]);if(fm)for(var r of fm(e))OE.call(e,r)&&dm(t,r,e[r]);return t},ME=(t,e)=>IE(t,DE(e));const TE="did:pkh:",Of=t=>t?.split(":"),pm=t=>{const e=t&&Of(t);if(e)return t.includes(TE)?e[3]:e[1]},gm=t=>{const e=t&&Of(t);if(e)return e[2]+":"+e[3]},$l=t=>{const e=t&&Of(t);if(e)return e.pop()};async function mm(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=vm(i,i.iss),c=$l(i.iss);return await _E(c,s,n,pm(i.iss),r)}const vm=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=$l(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,c=`Version: ${t.version}`,l=`Chain ID: ${pm(e)}`,f=`Nonce: ${t.nonce}`,h=`Issued At: ${t.iat}`,m=t.resources?`Resources:${t.resources.map(E=>`
23
- - ${E}`).join("")}`:void 0,_=Nl(t.resources);if(_){const E=sc(_);i=kE(i,E)}return[r,n,"",i,"",s,c,l,f,h,m].filter(E=>E!=null).join(`
24
- `)};function $E(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function NE(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Ws(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(c=>{if(typeof c!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${c}`)})})})}function RE(t,e,r,n={}){return r?.sort((i,s)=>i.localeCompare(s)),{att:{[t]:LE(e,r,n)}}}function LE(t,e,r={}){e=e?.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function ym(t){return Ws(t),`urn:recap:${$E(t).replace(/=/g,"")}`}function sc(t){const e=NE(t.replace("urn:recap:",""));return Ws(e),e}function BE(t,e,r){const n=RE(t,e,r);return ym(n)}function UE(t){return t&&t.includes("urn:recap:")}function FE(t,e){const r=sc(t),n=sc(e),i=jE(r,n);return ym(i)}function jE(t,e){Ws(t),Ws(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,c;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((c=e.att)==null?void 0:c[i])||{})).sort((l,f)=>l.localeCompare(f)).forEach(l=>{var f,h;n.att[i]=ME(PE({},n.att[i]),{[l]:((f=t.att[i])==null?void 0:f[l])||((h=e.att[i])==null?void 0:h[l])})})}),n}function kE(t="",e){Ws(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(l=>{const f=Object.keys(e.att[l]).map(_=>({ability:_.split("/")[0],action:_.split("/")[1]}));f.sort((_,E)=>_.action.localeCompare(E.action));const h={};f.forEach(_=>{h[_.ability]||(h[_.ability]=[]),h[_.ability].push(_.action)});const m=Object.keys(h).map(_=>(i++,`(${i}) '${_}': '${h[_].join("', '")}' for '${l}'.`));n.push(m.join(", ").replace(".,","."))});const s=n.join(" "),c=`${r}${s}`;return`${t?t+" ":""}${c}`}function wm(t){var e;const r=sc(t);Ws(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function bm(t){const e=sc(t);Ws(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function Nl(t){if(!t)return;const e=t?.[t.length-1];return UE(e)?e:void 0}const _m="base10",qr="base16",Pf="base64pad",Mf="utf8",Em=0,cs=1,qE=0,Am=1,Tf=12,$f=32;function zE(){const t=Zh.generateKeyPair();return{privateKey:Fr(t.secretKey,qr),publicKey:Fr(t.publicKey,qr)}}function Nf(){const t=Fo.randomBytes($f);return Fr(t,qr)}function HE(t,e){const r=Zh.sharedKey(Xr(t,qr),Xr(e,qr),!0),n=new Y6(ml.SHA256,r).expand($f);return Fr(n,qr)}function Rl(t){const e=ml.hash(Xr(t,qr));return Fr(e,qr)}function Vs(t){const e=ml.hash(Xr(t,Mf));return Fr(e,qr)}function KE(t){return Xr(`${t}`,_m)}function oc(t){return Number(Fr(t,_m))}function WE(t){const e=KE(typeof t.type<"u"?t.type:Em);if(oc(e)===cs&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Xr(t.senderPublicKey,qr):void 0,n=typeof t.iv<"u"?Xr(t.iv,qr):Fo.randomBytes(Tf),i=new Kh.ChaCha20Poly1305(Xr(t.symKey,qr)).seal(n,Xr(t.message,Mf));return GE({type:e,sealed:i,iv:n,senderPublicKey:r})}function VE(t){const e=new Kh.ChaCha20Poly1305(Xr(t.symKey,qr)),{sealed:r,iv:n}=Ll(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Fr(i,Mf)}function GE(t){if(oc(t.type)===cs){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Fr(ef([t.type,t.senderPublicKey,t.iv,t.sealed]),Pf)}return Fr(ef([t.type,t.iv,t.sealed]),Pf)}function Ll(t){const e=Xr(t,Pf),r=e.slice(qE,Am),n=Am;if(oc(r)===cs){const l=n+$f,f=l+Tf,h=e.slice(n,l),m=e.slice(l,f),_=e.slice(f);return{type:r,sealed:_,iv:m,senderPublicKey:h}}const i=n+Tf,s=e.slice(n,i),c=e.slice(i);return{type:r,sealed:c,iv:s}}function YE(t,e){const r=Ll(t);return xm({type:oc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Fr(r.senderPublicKey,qr):void 0,receiverPublicKey:e?.receiverPublicKey})}function xm(t){const e=t?.type||Em;if(e===cs){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Sm(t){return t.type===cs&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}const JE="irn";function Rf(t){return t?.relay||{protocol:JE}}function Bl(t){const e=S_[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var QE=Object.defineProperty,ZE=Object.defineProperties,XE=Object.getOwnPropertyDescriptors,Im=Object.getOwnPropertySymbols,eA=Object.prototype.hasOwnProperty,tA=Object.prototype.propertyIsEnumerable,Dm=(t,e,r)=>e in t?QE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cm=(t,e)=>{for(var r in e||(e={}))eA.call(e,r)&&Dm(t,r,e[r]);if(Im)for(var r of Im(e))tA.call(e,r)&&Dm(t,r,e[r]);return t},rA=(t,e)=>ZE(t,XE(e));function nA(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),c=t[i];r[s]=c}}),r}function Om(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",c=Ka.parse(s),l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:iA(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:nA(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function iA(t){return t.startsWith("//")?t.substring(2):t}function sA(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function oA(t){return`${t.protocol}:${t.topic}@${t.version}?`+Ka.stringify(Cm(rA(Cm({symKey:t.symKey},sA(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Xo(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function aA(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Xo(r.accounts))}),e}function cA(t,e){const r=[];return Object.values(t).forEach(n=>{Xo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function lA(t,e){const r=[];return Object.values(t).forEach(n=>{Xo(n.accounts).includes(e)&&r.push(...n.events)}),r}function Lf(t){return t.includes(":")}function ac(t){return Lf(t)?t.split(":")[0]:t}function uA(t){const e={};return t?.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function Pm(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=uA(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=wl(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const hA={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}},fA={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 me(t,e){const{message:r,code:n}=fA[t];return{message:e?`${r} ${e}`:r,code:n}}function Ut(t,e){const{message:r,code:n}=hA[t];return{message:e?`${r} ${e}`:r,code:n}}function wi(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function cc(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function zr(t){return typeof t>"u"}function ur(t,e){return e&&zr(t)?!0:typeof t=="string"&&!!t.trim().length}function Bf(t,e){return e&&zr(t)?!0:typeof t=="number"&&!isNaN(t)}function dA(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return qs(i,n)?(n.forEach(c=>{const{accounts:l,methods:f,events:h}=t.namespaces[c],m=Xo(l),_=r[c];(!qs(tg(c,_),m)||!qs(_.methods,f)||!qs(_.events,h))&&(s=!1)}),s):!1}function Ul(t){return ur(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function pA(t){if(ur(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Ul(r)}}return!1}function gA(t){if(ur(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function mA(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function vA(t){return t?.topic}function yA(t,e){let r=null;return ur(t?.publicKey,!1)||(r=me("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Mm(t){let e=!0;return wi(t)?t.length&&(e=t.every(r=>ur(r,!1))):e=!1,e}function wA(t,e,r){let n=null;return wi(e)&&e.length?e.forEach(i=>{n||Ul(i)||(n=Ut("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Ul(t)||(n=Ut("UNSUPPORTED_CHAINS",`${r}, 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"] }`)),n}function bA(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const c=wA(i,tg(i,s),`${e} ${r}`);c&&(n=c)}),n}function _A(t,e){let r=null;return wi(t)?t.forEach(n=>{r||pA(n)||(r=Ut("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ut("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function EA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=_A(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function AA(t,e){let r=null;return Mm(t?.methods)?Mm(t?.events)||(r=Ut("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ut("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Tm(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=AA(n,`${e}, namespace`);i&&(r=i)}),r}function xA(t,e,r){let n=null;if(t&&cc(t)){const i=Tm(t,e);i&&(n=i);const s=bA(t,e,r);s&&(n=s)}else n=me("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function Uf(t,e){let r=null;if(t&&cc(t)){const n=Tm(t,e);n&&(r=n);const i=EA(t,e);i&&(r=i)}else r=me("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function $m(t){return ur(t.protocol,!0)}function SA(t,e){let r=!1;return e&&!t?r=!0:t&&wi(t)&&t.length&&t.forEach(n=>{r=$m(n)}),r}function IA(t){return typeof t=="number"}function rn(t){return typeof t<"u"&&typeof t!==null}function DA(t){return!(!t||typeof t!="object"||!t.code||!Bf(t.code,!1)||!t.message||!ur(t.message,!1))}function CA(t){return!(zr(t)||!ur(t.method,!1))}function OA(t){return!(zr(t)||zr(t.result)&&zr(t.error)||!Bf(t.id,!1)||!ur(t.jsonrpc,!1))}function PA(t){return!(zr(t)||!ur(t.name,!1))}function Nm(t,e){return!(!Ul(e)||!aA(t).includes(e))}function MA(t,e,r){return ur(r,!1)?cA(t,e).includes(r):!1}function TA(t,e,r){return ur(r,!1)?lA(t,e).includes(r):!1}function Rm(t,e,r){let n=null;const i=$A(t),s=NA(e),c=Object.keys(i),l=Object.keys(s),f=Lm(Object.keys(t)),h=Lm(Object.keys(e)),m=f.filter(_=>!h.includes(_));return m.length&&(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
25
- Required: ${m.toString()}
26
- Received: ${Object.keys(e).toString()}`)),qs(c,l)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
21
+ */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",c=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;c?i=lg:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,f=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",h="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],_=[4,1024,262144,67108864],E=[1,256,65536,16777216],A=[6,1536,393216,100663296],S=[0,8,16,24],U=[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],Y=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],z={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});for(var P=function(x,re,q){return function(H){return new N(x,re,x).update(H)[q]()}},F=function(x,re,q){return function(H,V){return new N(x,re,V).update(H)[q]()}},j=function(x,re,q){return function(H,V,w,k){return p["cshake"+x].update(H,V,w,k)[q]()}},m=function(x,re,q){return function(H,V,w,k){return p["kmac"+x].update(H,V,w,k)[q]()}},T=function(x,re,q,H){for(var V=0;V<B.length;++V){var w=B[V];x[w]=re(q,H,w)}return x},te=function(x,re){var q=P(x,re,"hex");return q.create=function(){return new N(x,re,x)},q.update=function(H){return q.create().update(H)},T(q,P,x,re)},ee=function(x,re){var q=F(x,re,"hex");return q.create=function(H){return new N(x,re,H)},q.update=function(H,V){return q.create(V).update(H)},T(q,F,x,re)},ne=function(x,re){var q=z[x],H=j(x,re,"hex");return H.create=function(V,w,k){return!w&&!k?p["shake"+x].create(V):new N(x,re,V).bytepad([w,k],q)},H.update=function(V,w,k,ie){return H.create(w,k,ie).update(V)},T(H,j,x,re)},fe=function(x,re){var q=z[x],H=m(x,re,"hex");return H.create=function(V,w,k){return new oe(x,re,w).bytepad(["KMAC",k],q).bytepad([V],q)},H.update=function(V,w,k,ie){return H.create(V,k,ie).update(w)},T(H,m,x,re)},d=[{name:"keccak",padding:E,bits:W,createMethod:te},{name:"sha3",padding:A,bits:W,createMethod:te},{name:"shake",padding:g,bits:Y,createMethod:ee},{name:"cshake",padding:_,bits:Y,createMethod:ne},{name:"kmac",padding:_,bits:Y,createMethod:fe}],p={},b=[],D=0;D<d.length;++D)for(var O=d[D],$=O.bits,L=0;L<$.length;++L){var C=O.name+"_"+$[L];if(b.push(C),p[C]=O.createMethod($[L],O.padding),O.name!=="sha3"){var v=O.name+$[L];b.push(v),p[v]=p[C]}}function N(x,re,q){this.blocks=[],this.s=[],this.padding=re,this.outputBits=q,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(x<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=q>>5,this.extraBytes=(q&31)>>3;for(var H=0;H<50;++H)this.s[H]=0}N.prototype.update=function(x){if(this.finalized)throw new Error(r);var re,q=typeof x;if(q!=="string"){if(q==="object"){if(x===null)throw new Error(e);if(f&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!f||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);re=!0}for(var H=this.blocks,V=this.byteCount,w=x.length,k=this.blockCount,ie=0,he=this.s,le,Oe;ie<w;){if(this.reset)for(this.reset=!1,H[0]=this.block,le=1;le<k+1;++le)H[le]=0;if(re)for(le=this.start;ie<w&&le<V;++ie)H[le>>2]|=x[ie]<<S[le++&3];else for(le=this.start;ie<w&&le<V;++ie)Oe=x.charCodeAt(ie),Oe<128?H[le>>2]|=Oe<<S[le++&3]:Oe<2048?(H[le>>2]|=(192|Oe>>6)<<S[le++&3],H[le>>2]|=(128|Oe&63)<<S[le++&3]):Oe<55296||Oe>=57344?(H[le>>2]|=(224|Oe>>12)<<S[le++&3],H[le>>2]|=(128|Oe>>6&63)<<S[le++&3],H[le>>2]|=(128|Oe&63)<<S[le++&3]):(Oe=65536+((Oe&1023)<<10|x.charCodeAt(++ie)&1023),H[le>>2]|=(240|Oe>>18)<<S[le++&3],H[le>>2]|=(128|Oe>>12&63)<<S[le++&3],H[le>>2]|=(128|Oe>>6&63)<<S[le++&3],H[le>>2]|=(128|Oe&63)<<S[le++&3]);if(this.lastByteIndex=le,le>=V){for(this.start=le-V,this.block=H[k],le=0;le<k;++le)he[le]^=H[le];pe(he),this.reset=!0}else this.start=le}return this},N.prototype.encode=function(x,re){var q=x&255,H=1,V=[q];for(x=x>>8,q=x&255;q>0;)V.unshift(q),x=x>>8,q=x&255,++H;return re?V.push(H):V.unshift(H),this.update(V),V.length},N.prototype.encodeString=function(x){var re,q=typeof x;if(q!=="string"){if(q==="object"){if(x===null)throw new Error(e);if(f&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!f||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);re=!0}var H=0,V=x.length;if(re)H=V;else for(var w=0;w<x.length;++w){var k=x.charCodeAt(w);k<128?H+=1:k<2048?H+=2:k<55296||k>=57344?H+=3:(k=65536+((k&1023)<<10|x.charCodeAt(++w)&1023),H+=4)}return H+=this.encode(H*8),this.update(x),H},N.prototype.bytepad=function(x,re){for(var q=this.encode(re),H=0;H<x.length;++H)q+=this.encodeString(x[H]);var V=re-q%re,w=[];return w.length=V,this.update(w),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,re=this.lastByteIndex,q=this.blockCount,H=this.s;if(x[re>>2]|=this.padding[re&3],this.lastByteIndex===this.byteCount)for(x[0]=x[q],re=1;re<q+1;++re)x[re]=0;for(x[q-1]|=2147483648,re=0;re<q;++re)H[re]^=x[re];pe(H)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var x=this.blockCount,re=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,k="",ie;w<q;){for(V=0;V<x&&w<q;++V,++w)ie=re[V],k+=h[ie>>4&15]+h[ie&15]+h[ie>>12&15]+h[ie>>8&15]+h[ie>>20&15]+h[ie>>16&15]+h[ie>>28&15]+h[ie>>24&15];w%x===0&&(pe(re),V=0)}return H&&(ie=re[V],k+=h[ie>>4&15]+h[ie&15],H>1&&(k+=h[ie>>12&15]+h[ie>>8&15]),H>2&&(k+=h[ie>>20&15]+h[ie>>16&15])),k},N.prototype.arrayBuffer=function(){this.finalize();var x=this.blockCount,re=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,k=this.outputBits>>3,ie;H?ie=new ArrayBuffer(q+1<<2):ie=new ArrayBuffer(k);for(var he=new Uint32Array(ie);w<q;){for(V=0;V<x&&w<q;++V,++w)he[w]=re[V];w%x===0&&pe(re)}return H&&(he[V]=re[V],ie=ie.slice(0,k)),ie},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var x=this.blockCount,re=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,k=[],ie,he;w<q;){for(V=0;V<x&&w<q;++V,++w)ie=w<<2,he=re[V],k[ie]=he&255,k[ie+1]=he>>8&255,k[ie+2]=he>>16&255,k[ie+3]=he>>24&255;w%x===0&&pe(re)}return H&&(ie=w<<2,he=re[V],k[ie]=he&255,H>1&&(k[ie+1]=he>>8&255),H>2&&(k[ie+2]=he>>16&255)),k};function oe(x,re,q){N.call(this,x,re,q)}oe.prototype=new N,oe.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var pe=function(x){var re,q,H,V,w,k,ie,he,le,Oe,Me,Se,Pt,ze,Ce,Fe,Ee,Ae,Ge,ye,xe,Be,be,Pe,je,Te,$e,lt,Re,Ne,nr,dt,Et,ir,It,Ot,Vr,Ye,He,Rt,Je,Ve,Mt,Xe,et,Lt,tt,Qe,Ft,Ze,ke,Ht,rt,jt,ti,kt,vt,Ln,Bn,Un,Fn,jn,xr;for(H=0;H<48;H+=2)V=x[0]^x[10]^x[20]^x[30]^x[40],w=x[1]^x[11]^x[21]^x[31]^x[41],k=x[2]^x[12]^x[22]^x[32]^x[42],ie=x[3]^x[13]^x[23]^x[33]^x[43],he=x[4]^x[14]^x[24]^x[34]^x[44],le=x[5]^x[15]^x[25]^x[35]^x[45],Oe=x[6]^x[16]^x[26]^x[36]^x[46],Me=x[7]^x[17]^x[27]^x[37]^x[47],Se=x[8]^x[18]^x[28]^x[38]^x[48],Pt=x[9]^x[19]^x[29]^x[39]^x[49],re=Se^(k<<1|ie>>>31),q=Pt^(ie<<1|k>>>31),x[0]^=re,x[1]^=q,x[10]^=re,x[11]^=q,x[20]^=re,x[21]^=q,x[30]^=re,x[31]^=q,x[40]^=re,x[41]^=q,re=V^(he<<1|le>>>31),q=w^(le<<1|he>>>31),x[2]^=re,x[3]^=q,x[12]^=re,x[13]^=q,x[22]^=re,x[23]^=q,x[32]^=re,x[33]^=q,x[42]^=re,x[43]^=q,re=k^(Oe<<1|Me>>>31),q=ie^(Me<<1|Oe>>>31),x[4]^=re,x[5]^=q,x[14]^=re,x[15]^=q,x[24]^=re,x[25]^=q,x[34]^=re,x[35]^=q,x[44]^=re,x[45]^=q,re=he^(Se<<1|Pt>>>31),q=le^(Pt<<1|Se>>>31),x[6]^=re,x[7]^=q,x[16]^=re,x[17]^=q,x[26]^=re,x[27]^=q,x[36]^=re,x[37]^=q,x[46]^=re,x[47]^=q,re=Oe^(V<<1|w>>>31),q=Me^(w<<1|V>>>31),x[8]^=re,x[9]^=q,x[18]^=re,x[19]^=q,x[28]^=re,x[29]^=q,x[38]^=re,x[39]^=q,x[48]^=re,x[49]^=q,ze=x[0],Ce=x[1],Lt=x[11]<<4|x[10]>>>28,tt=x[10]<<4|x[11]>>>28,lt=x[20]<<3|x[21]>>>29,Re=x[21]<<3|x[20]>>>29,Un=x[31]<<9|x[30]>>>23,Fn=x[30]<<9|x[31]>>>23,Ve=x[40]<<18|x[41]>>>14,Mt=x[41]<<18|x[40]>>>14,ir=x[2]<<1|x[3]>>>31,It=x[3]<<1|x[2]>>>31,Fe=x[13]<<12|x[12]>>>20,Ee=x[12]<<12|x[13]>>>20,Qe=x[22]<<10|x[23]>>>22,Ft=x[23]<<10|x[22]>>>22,Ne=x[33]<<13|x[32]>>>19,nr=x[32]<<13|x[33]>>>19,jn=x[42]<<2|x[43]>>>30,xr=x[43]<<2|x[42]>>>30,jt=x[5]<<30|x[4]>>>2,ti=x[4]<<30|x[5]>>>2,Ot=x[14]<<6|x[15]>>>26,Vr=x[15]<<6|x[14]>>>26,Ae=x[25]<<11|x[24]>>>21,Ge=x[24]<<11|x[25]>>>21,Ze=x[34]<<15|x[35]>>>17,ke=x[35]<<15|x[34]>>>17,dt=x[45]<<29|x[44]>>>3,Et=x[44]<<29|x[45]>>>3,Pe=x[6]<<28|x[7]>>>4,je=x[7]<<28|x[6]>>>4,kt=x[17]<<23|x[16]>>>9,vt=x[16]<<23|x[17]>>>9,Ye=x[26]<<25|x[27]>>>7,He=x[27]<<25|x[26]>>>7,ye=x[36]<<21|x[37]>>>11,xe=x[37]<<21|x[36]>>>11,Ht=x[47]<<24|x[46]>>>8,rt=x[46]<<24|x[47]>>>8,Xe=x[8]<<27|x[9]>>>5,et=x[9]<<27|x[8]>>>5,Te=x[18]<<20|x[19]>>>12,$e=x[19]<<20|x[18]>>>12,Ln=x[29]<<7|x[28]>>>25,Bn=x[28]<<7|x[29]>>>25,Rt=x[38]<<8|x[39]>>>24,Je=x[39]<<8|x[38]>>>24,Be=x[48]<<14|x[49]>>>18,be=x[49]<<14|x[48]>>>18,x[0]=ze^~Fe&Ae,x[1]=Ce^~Ee&Ge,x[10]=Pe^~Te&lt,x[11]=je^~$e&Re,x[20]=ir^~Ot&Ye,x[21]=It^~Vr&He,x[30]=Xe^~Lt&Qe,x[31]=et^~tt&Ft,x[40]=jt^~kt&Ln,x[41]=ti^~vt&Bn,x[2]=Fe^~Ae&ye,x[3]=Ee^~Ge&xe,x[12]=Te^~lt&Ne,x[13]=$e^~Re&nr,x[22]=Ot^~Ye&Rt,x[23]=Vr^~He&Je,x[32]=Lt^~Qe&Ze,x[33]=tt^~Ft&ke,x[42]=kt^~Ln&Un,x[43]=vt^~Bn&Fn,x[4]=Ae^~ye&Be,x[5]=Ge^~xe&be,x[14]=lt^~Ne&dt,x[15]=Re^~nr&Et,x[24]=Ye^~Rt&Ve,x[25]=He^~Je&Mt,x[34]=Qe^~Ze&Ht,x[35]=Ft^~ke&rt,x[44]=Ln^~Un&jn,x[45]=Bn^~Fn&xr,x[6]=ye^~Be&ze,x[7]=xe^~be&Ce,x[16]=Ne^~dt&Pe,x[17]=nr^~Et&je,x[26]=Rt^~Ve&ir,x[27]=Je^~Mt&It,x[36]=Ze^~Ht&Xe,x[37]=ke^~rt&et,x[46]=Un^~jn&jt,x[47]=Fn^~xr&ti,x[8]=Be^~ze&Fe,x[9]=be^~Ce&Ee,x[18]=dt^~Pe&Te,x[19]=Et^~je&$e,x[28]=Ve^~ir&Ot,x[29]=Mt^~It&Vr,x[38]=Ht^~Xe&Lt,x[39]=rt^~et&tt,x[48]=jn^~jt&kt,x[49]=xr^~ti&vt,x[0]^=U[H],x[1]^=U[H+1]};if(l)t.exports=p;else for(D=0;D<b.length;++D)i[b[D]]=p[b[D]]})()})(ug);var F_=ug.exports;const j_="logger/5.7.0";let hg=!1,fg=!1;const bl={debug:1,default:2,info:2,warning:3,error:4,off:5};let dg=bl.default,cf=null;function k_(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const pg=k_();var lf;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(lf||(lf={}));var Jn;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Jn||(Jn={}));const gg="0123456789abcdef";class ut{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();bl[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(dg>bl[n])&&console.log.apply(console,r)}debug(...e){this._log(ut.levels.DEBUG,e)}info(...e){this._log(ut.levels.INFO,e)}warn(...e){this._log(ut.levels.WARNING,e)}makeError(e,r,n){if(fg)return this.makeError("censored error",r,{});r||(r=ut.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(f=>{const h=n[f];try{if(h instanceof Uint8Array){let g="";for(let _=0;_<h.length;_++)g+=gg[h[_]>>4],g+=gg[h[_]&15];i.push(f+"=Uint8Array(0x"+g+")")}else i.push(f+"="+JSON.stringify(h))}catch{i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let c="";switch(r){case Jn.NUMERIC_FAULT:{c="NUMERIC_FAULT";const f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":c+="-"+f;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case Jn.CALL_EXCEPTION:case Jn.INSUFFICIENT_FUNDS:case Jn.MISSING_NEW:case Jn.NONCE_EXPIRED:case Jn.REPLACEMENT_UNDERPRICED:case Jn.TRANSACTION_REPLACED:case Jn.UNPREDICTABLE_GAS_LIMIT:c=r;break}c&&(e+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(f){l[f]=n[f]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,ut.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){pg&&this.throwError("platform missing String.prototype.normalize",ut.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:pg})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",e<r&&this.throwError("missing argument"+n,ut.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+n,ut.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",ut.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",ut.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",ut.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return cf||(cf=new ut(j_)),cf}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hg){if(!e)return;this.globalLogger().throwError("error censorship permanent",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fg=!!e,hg=!!r}static setLogLevel(e){const r=bl[e.toLowerCase()];if(r==null){ut.globalLogger().warn("invalid log level - "+e);return}dg=r}static from(e){return new ut(e)}}ut.errors=Jn,ut.levels=lf;const q_="bytes/5.7.0",lr=new ut(q_);function mg(t){return!!t.toHexString}function jo(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return jo(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function z_(t){return mn(t)&&!(t.length%2)||ko(t)}function vg(t){return typeof t=="number"&&t==t&&t%1===0}function ko(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!vg(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!vg(r)||r<0||r>=256)return!1}return!0}function or(t,e){if(e||(e={}),typeof t=="number"){lr.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),jo(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),mg(t)&&(t=t.toHexString()),mn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":lr.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return jo(new Uint8Array(n))}return ko(t)?jo(new Uint8Array(t)):lr.throwArgumentError("invalid arrayify value","value",t)}function H_(t){const e=t.map(i=>or(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),jo(n)}function K_(t,e){t=or(t),t.length>e&&lr.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),jo(r)}function mn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const uf="0123456789abcdef";function kr(t,e){if(e||(e={}),typeof t=="number"){lr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=uf[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),mg(t))return t.toHexString();if(mn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":lr.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ko(t)){let r="0x";for(let n=0;n<t.length;n++){let i=t[n];r+=uf[(i&240)>>4]+uf[i&15]}return r}return lr.throwArgumentError("invalid hexlify value","value",t)}function W_(t){if(typeof t!="string")t=kr(t);else if(!mn(t)||t.length%2)return null;return(t.length-2)/2}function wg(t,e,r){return typeof t!="string"?t=kr(t):(!mn(t)||t.length%2)&&lr.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function ci(t,e){for(typeof t!="string"?t=kr(t):mn(t)||lr.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&lr.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function yg(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(z_(t)){let r=or(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=kr(r.slice(0,32)),e.s=kr(r.slice(32,64))):r.length===65?(e.r=kr(r.slice(0,32)),e.s=kr(r.slice(32,64)),e.v=r[64]):lr.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:lr.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=kr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=K_(or(e._vs),32);e._vs=kr(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&lr.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const c=kr(i);e.s==null?e.s=c:e.s!==c&&lr.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?lr.throwArgumentError("signature missing v and recoveryParam","signature",t):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 i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&lr.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!mn(e.r)?lr.throwArgumentError("signature missing or invalid r","signature",t):e.r=ci(e.r,32),e.s==null||!mn(e.s)?lr.throwArgumentError("signature missing or invalid s","signature",t):e.s=ci(e.s,32);const r=or(e.s);r[0]>=128&&lr.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=kr(r);e._vs&&(mn(e._vs)||lr.throwArgumentError("signature invalid _vs","signature",t),e._vs=ci(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&lr.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function hf(t){return"0x"+F_.keccak_256(or(t))}var bg={exports:{}},V_={},G_=Object.freeze({__proto__:null,default:V_}),Y_=U_(G_);(function(t){(function(e,r){function n(d,p){if(!d)throw new Error(p||"Assertion failed")}function i(d,p){d.super_=p;var b=function(){};b.prototype=p.prototype,d.prototype=new b,d.prototype.constructor=d}function o(d,p,b){if(o.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((p==="le"||p==="be")&&(b=p,p=10),this._init(d||0,p||10,b||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=Y_.Buffer}catch{}o.isBN=function(d){return d instanceof o?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===o.wordSize&&Array.isArray(d.words)},o.max=function(d,p){return d.cmp(p)>0?d:p},o.min=function(d,p){return d.cmp(p)<0?d:p},o.prototype._init=function(d,p,b){if(typeof d=="number")return this._initNumber(d,p,b);if(typeof d=="object")return this._initArray(d,p,b);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),d=d.toString().replace(/\s+/g,"");var D=0;d[0]==="-"&&(D++,this.negative=1),D<d.length&&(p===16?this._parseHex(d,D,b):(this._parseBase(d,p,D),b==="le"&&this._initArray(this.toArray(),p,b)))},o.prototype._initNumber=function(d,p,b){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(n(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),p,b)},o.prototype._initArray=function(d,p,b){if(n(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var O,$,L=0;if(b==="be")for(D=d.length-1,O=0;D>=0;D-=3)$=d[D]|d[D-1]<<8|d[D-2]<<16,this.words[O]|=$<<L&67108863,this.words[O+1]=$>>>26-L&67108863,L+=24,L>=26&&(L-=26,O++);else if(b==="le")for(D=0,O=0;D<d.length;D+=3)$=d[D]|d[D+1]<<8|d[D+2]<<16,this.words[O]|=$<<L&67108863,this.words[O+1]=$>>>26-L&67108863,L+=24,L>=26&&(L-=26,O++);return this._strip()};function l(d,p){var b=d.charCodeAt(p);if(b>=48&&b<=57)return b-48;if(b>=65&&b<=70)return b-55;if(b>=97&&b<=102)return b-87;n(!1,"Invalid character in "+d)}function f(d,p,b){var D=l(d,b);return b-1>=p&&(D|=l(d,b-1)<<4),D}o.prototype._parseHex=function(d,p,b){this.length=Math.ceil((d.length-p)/6),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var O=0,$=0,L;if(b==="be")for(D=d.length-1;D>=p;D-=2)L=f(d,p,D)<<O,this.words[$]|=L&67108863,O>=18?(O-=18,$+=1,this.words[$]|=L>>>26):O+=8;else{var C=d.length-p;for(D=C%2===0?p+1:p;D<d.length;D+=2)L=f(d,p,D)<<O,this.words[$]|=L&67108863,O>=18?(O-=18,$+=1,this.words[$]|=L>>>26):O+=8}this._strip()};function h(d,p,b,D){for(var O=0,$=0,L=Math.min(d.length,b),C=p;C<L;C++){var v=d.charCodeAt(C)-48;O*=D,v>=49?$=v-49+10:v>=17?$=v-17+10:$=v,n(v>=0&&$<D,"Invalid character"),O+=$}return O}o.prototype._parseBase=function(d,p,b){this.words=[0],this.length=1;for(var D=0,O=1;O<=67108863;O*=p)D++;D--,O=O/p|0;for(var $=d.length-b,L=$%D,C=Math.min($,$-L)+b,v=0,N=b;N<C;N+=D)v=h(d,N,N+D,p),this.imuln(O),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(L!==0){var oe=1;for(v=h(d,N,d.length,p),N=0;N<L;N++)oe*=p;this.imuln(oe),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},o.prototype.copy=function(d){d.words=new Array(this.length);for(var p=0;p<this.length;p++)d.words[p]=this.words[p];d.length=this.length,d.negative=this.negative,d.red=this.red};function g(d,p){d.words=p.words,d.length=p.length,d.negative=p.negative,d.red=p.red}if(o.prototype._move=function(d){g(d,this)},o.prototype.clone=function(){var d=new o(null);return this.copy(d),d},o.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=_}catch{o.prototype.inspect=_}else o.prototype.inspect=_;function _(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var E=["","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"],A=[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],S=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(d,p){d=d||10,p=p|0||1;var b;if(d===16||d==="hex"){b="";for(var D=0,O=0,$=0;$<this.length;$++){var L=this.words[$],C=((L<<D|O)&16777215).toString(16);O=L>>>24-D&16777215,D+=2,D>=26&&(D-=26,$--),O!==0||$!==this.length-1?b=E[6-C.length]+C+b:b=C+b}for(O!==0&&(b=O.toString(16)+b);b.length%p!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(d===(d|0)&&d>=2&&d<=36){var v=A[d],N=S[d];b="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var pe=oe.modrn(N).toString(d);oe=oe.idivn(N),oe.isZero()?b=pe+b:b=E[v-pe.length]+pe+b}for(this.isZero()&&(b="0"+b);b.length%p!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},o.prototype.toJSON=function(){return this.toString(16,2)},c&&(o.prototype.toBuffer=function(d,p){return this.toArrayLike(c,d,p)}),o.prototype.toArray=function(d,p){return this.toArrayLike(Array,d,p)};var U=function(d,p){return d.allocUnsafe?d.allocUnsafe(p):new d(p)};o.prototype.toArrayLike=function(d,p,b){this._strip();var D=this.byteLength(),O=b||Math.max(1,D);n(D<=O,"byte array longer than desired length"),n(O>0,"Requested array length <= 0");var $=U(d,O),L=p==="le"?"LE":"BE";return this["_toArrayLike"+L]($,D),$},o.prototype._toArrayLikeLE=function(d,p){for(var b=0,D=0,O=0,$=0;O<this.length;O++){var L=this.words[O]<<$|D;d[b++]=L&255,b<d.length&&(d[b++]=L>>8&255),b<d.length&&(d[b++]=L>>16&255),$===6?(b<d.length&&(d[b++]=L>>24&255),D=0,$=0):(D=L>>>24,$+=2)}if(b<d.length)for(d[b++]=D;b<d.length;)d[b++]=0},o.prototype._toArrayLikeBE=function(d,p){for(var b=d.length-1,D=0,O=0,$=0;O<this.length;O++){var L=this.words[O]<<$|D;d[b--]=L&255,b>=0&&(d[b--]=L>>8&255),b>=0&&(d[b--]=L>>16&255),$===6?(b>=0&&(d[b--]=L>>24&255),D=0,$=0):(D=L>>>24,$+=2)}if(b>=0)for(d[b--]=D;b>=0;)d[b--]=0},Math.clz32?o.prototype._countBits=function(d){return 32-Math.clz32(d)}:o.prototype._countBits=function(d){var p=d,b=0;return p>=4096&&(b+=13,p>>>=13),p>=64&&(b+=7,p>>>=7),p>=8&&(b+=4,p>>>=4),p>=2&&(b+=2,p>>>=2),b+p},o.prototype._zeroBits=function(d){if(d===0)return 26;var p=d,b=0;return p&8191||(b+=13,p>>>=13),p&127||(b+=7,p>>>=7),p&15||(b+=4,p>>>=4),p&3||(b+=2,p>>>=2),p&1||b++,b},o.prototype.bitLength=function(){var d=this.words[this.length-1],p=this._countBits(d);return(this.length-1)*26+p};function W(d){for(var p=new Array(d.bitLength()),b=0;b<p.length;b++){var D=b/26|0,O=b%26;p[b]=d.words[D]>>>O&1}return p}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,p=0;p<this.length;p++){var b=this._zeroBits(this.words[p]);if(d+=b,b!==26)break}return d},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},o.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var p=0;p<d.length;p++)this.words[p]=this.words[p]|d.words[p];return this._strip()},o.prototype.ior=function(d){return n((this.negative|d.negative)===0),this.iuor(d)},o.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},o.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},o.prototype.iuand=function(d){var p;this.length>d.length?p=d:p=this;for(var b=0;b<p.length;b++)this.words[b]=this.words[b]&d.words[b];return this.length=p.length,this._strip()},o.prototype.iand=function(d){return n((this.negative|d.negative)===0),this.iuand(d)},o.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},o.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},o.prototype.iuxor=function(d){var p,b;this.length>d.length?(p=this,b=d):(p=d,b=this);for(var D=0;D<b.length;D++)this.words[D]=p.words[D]^b.words[D];if(this!==p)for(;D<p.length;D++)this.words[D]=p.words[D];return this.length=p.length,this._strip()},o.prototype.ixor=function(d){return n((this.negative|d.negative)===0),this.iuxor(d)},o.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},o.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},o.prototype.inotn=function(d){n(typeof d=="number"&&d>=0);var p=Math.ceil(d/26)|0,b=d%26;this._expand(p),b>0&&p--;for(var D=0;D<p;D++)this.words[D]=~this.words[D]&67108863;return b>0&&(this.words[D]=~this.words[D]&67108863>>26-b),this._strip()},o.prototype.notn=function(d){return this.clone().inotn(d)},o.prototype.setn=function(d,p){n(typeof d=="number"&&d>=0);var b=d/26|0,D=d%26;return this._expand(b+1),p?this.words[b]=this.words[b]|1<<D:this.words[b]=this.words[b]&~(1<<D),this._strip()},o.prototype.iadd=function(d){var p;if(this.negative!==0&&d.negative===0)return this.negative=0,p=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,p=this.isub(d),d.negative=1,p._normSign();var b,D;this.length>d.length?(b=this,D=d):(b=d,D=this);for(var O=0,$=0;$<D.length;$++)p=(b.words[$]|0)+(D.words[$]|0)+O,this.words[$]=p&67108863,O=p>>>26;for(;O!==0&&$<b.length;$++)p=(b.words[$]|0)+O,this.words[$]=p&67108863,O=p>>>26;if(this.length=b.length,O!==0)this.words[this.length]=O,this.length++;else if(b!==this)for(;$<b.length;$++)this.words[$]=b.words[$];return this},o.prototype.add=function(d){var p;return d.negative!==0&&this.negative===0?(d.negative=0,p=this.sub(d),d.negative^=1,p):d.negative===0&&this.negative!==0?(this.negative=0,p=d.sub(this),this.negative=1,p):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},o.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var p=this.iadd(d);return d.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var b=this.cmp(d);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var D,O;b>0?(D=this,O=d):(D=d,O=this);for(var $=0,L=0;L<O.length;L++)p=(D.words[L]|0)-(O.words[L]|0)+$,$=p>>26,this.words[L]=p&67108863;for(;$!==0&&L<D.length;L++)p=(D.words[L]|0)+$,$=p>>26,this.words[L]=p&67108863;if($===0&&L<D.length&&D!==this)for(;L<D.length;L++)this.words[L]=D.words[L];return this.length=Math.max(this.length,L),D!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(d){return this.clone().isub(d)};function Y(d,p,b){b.negative=p.negative^d.negative;var D=d.length+p.length|0;b.length=D,D=D-1|0;var O=d.words[0]|0,$=p.words[0]|0,L=O*$,C=L&67108863,v=L/67108864|0;b.words[0]=C;for(var N=1;N<D;N++){for(var oe=v>>>26,pe=v&67108863,x=Math.min(N,p.length-1),re=Math.max(0,N-d.length+1);re<=x;re++){var q=N-re|0;O=d.words[q]|0,$=p.words[re]|0,L=O*$+pe,oe+=L/67108864|0,pe=L&67108863}b.words[N]=pe|0,v=oe|0}return v!==0?b.words[N]=v|0:b.length--,b._strip()}var B=function(d,p,b){var D=d.words,O=p.words,$=b.words,L=0,C,v,N,oe=D[0]|0,pe=oe&8191,x=oe>>>13,re=D[1]|0,q=re&8191,H=re>>>13,V=D[2]|0,w=V&8191,k=V>>>13,ie=D[3]|0,he=ie&8191,le=ie>>>13,Oe=D[4]|0,Me=Oe&8191,Se=Oe>>>13,Pt=D[5]|0,ze=Pt&8191,Ce=Pt>>>13,Fe=D[6]|0,Ee=Fe&8191,Ae=Fe>>>13,Ge=D[7]|0,ye=Ge&8191,xe=Ge>>>13,Be=D[8]|0,be=Be&8191,Pe=Be>>>13,je=D[9]|0,Te=je&8191,$e=je>>>13,lt=O[0]|0,Re=lt&8191,Ne=lt>>>13,nr=O[1]|0,dt=nr&8191,Et=nr>>>13,ir=O[2]|0,It=ir&8191,Ot=ir>>>13,Vr=O[3]|0,Ye=Vr&8191,He=Vr>>>13,Rt=O[4]|0,Je=Rt&8191,Ve=Rt>>>13,Mt=O[5]|0,Xe=Mt&8191,et=Mt>>>13,Lt=O[6]|0,tt=Lt&8191,Qe=Lt>>>13,Ft=O[7]|0,Ze=Ft&8191,ke=Ft>>>13,Ht=O[8]|0,rt=Ht&8191,jt=Ht>>>13,ti=O[9]|0,kt=ti&8191,vt=ti>>>13;b.negative=d.negative^p.negative,b.length=19,C=Math.imul(pe,Re),v=Math.imul(pe,Ne),v=v+Math.imul(x,Re)|0,N=Math.imul(x,Ne);var Ln=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,C=Math.imul(q,Re),v=Math.imul(q,Ne),v=v+Math.imul(H,Re)|0,N=Math.imul(H,Ne),C=C+Math.imul(pe,dt)|0,v=v+Math.imul(pe,Et)|0,v=v+Math.imul(x,dt)|0,N=N+Math.imul(x,Et)|0;var Bn=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,C=Math.imul(w,Re),v=Math.imul(w,Ne),v=v+Math.imul(k,Re)|0,N=Math.imul(k,Ne),C=C+Math.imul(q,dt)|0,v=v+Math.imul(q,Et)|0,v=v+Math.imul(H,dt)|0,N=N+Math.imul(H,Et)|0,C=C+Math.imul(pe,It)|0,v=v+Math.imul(pe,Ot)|0,v=v+Math.imul(x,It)|0,N=N+Math.imul(x,Ot)|0;var Un=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Un>>>26)|0,Un&=67108863,C=Math.imul(he,Re),v=Math.imul(he,Ne),v=v+Math.imul(le,Re)|0,N=Math.imul(le,Ne),C=C+Math.imul(w,dt)|0,v=v+Math.imul(w,Et)|0,v=v+Math.imul(k,dt)|0,N=N+Math.imul(k,Et)|0,C=C+Math.imul(q,It)|0,v=v+Math.imul(q,Ot)|0,v=v+Math.imul(H,It)|0,N=N+Math.imul(H,Ot)|0,C=C+Math.imul(pe,Ye)|0,v=v+Math.imul(pe,He)|0,v=v+Math.imul(x,Ye)|0,N=N+Math.imul(x,He)|0;var Fn=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,C=Math.imul(Me,Re),v=Math.imul(Me,Ne),v=v+Math.imul(Se,Re)|0,N=Math.imul(Se,Ne),C=C+Math.imul(he,dt)|0,v=v+Math.imul(he,Et)|0,v=v+Math.imul(le,dt)|0,N=N+Math.imul(le,Et)|0,C=C+Math.imul(w,It)|0,v=v+Math.imul(w,Ot)|0,v=v+Math.imul(k,It)|0,N=N+Math.imul(k,Ot)|0,C=C+Math.imul(q,Ye)|0,v=v+Math.imul(q,He)|0,v=v+Math.imul(H,Ye)|0,N=N+Math.imul(H,He)|0,C=C+Math.imul(pe,Je)|0,v=v+Math.imul(pe,Ve)|0,v=v+Math.imul(x,Je)|0,N=N+Math.imul(x,Ve)|0;var jn=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(jn>>>26)|0,jn&=67108863,C=Math.imul(ze,Re),v=Math.imul(ze,Ne),v=v+Math.imul(Ce,Re)|0,N=Math.imul(Ce,Ne),C=C+Math.imul(Me,dt)|0,v=v+Math.imul(Me,Et)|0,v=v+Math.imul(Se,dt)|0,N=N+Math.imul(Se,Et)|0,C=C+Math.imul(he,It)|0,v=v+Math.imul(he,Ot)|0,v=v+Math.imul(le,It)|0,N=N+Math.imul(le,Ot)|0,C=C+Math.imul(w,Ye)|0,v=v+Math.imul(w,He)|0,v=v+Math.imul(k,Ye)|0,N=N+Math.imul(k,He)|0,C=C+Math.imul(q,Je)|0,v=v+Math.imul(q,Ve)|0,v=v+Math.imul(H,Je)|0,N=N+Math.imul(H,Ve)|0,C=C+Math.imul(pe,Xe)|0,v=v+Math.imul(pe,et)|0,v=v+Math.imul(x,Xe)|0,N=N+Math.imul(x,et)|0;var xr=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(xr>>>26)|0,xr&=67108863,C=Math.imul(Ee,Re),v=Math.imul(Ee,Ne),v=v+Math.imul(Ae,Re)|0,N=Math.imul(Ae,Ne),C=C+Math.imul(ze,dt)|0,v=v+Math.imul(ze,Et)|0,v=v+Math.imul(Ce,dt)|0,N=N+Math.imul(Ce,Et)|0,C=C+Math.imul(Me,It)|0,v=v+Math.imul(Me,Ot)|0,v=v+Math.imul(Se,It)|0,N=N+Math.imul(Se,Ot)|0,C=C+Math.imul(he,Ye)|0,v=v+Math.imul(he,He)|0,v=v+Math.imul(le,Ye)|0,N=N+Math.imul(le,He)|0,C=C+Math.imul(w,Je)|0,v=v+Math.imul(w,Ve)|0,v=v+Math.imul(k,Je)|0,N=N+Math.imul(k,Ve)|0,C=C+Math.imul(q,Xe)|0,v=v+Math.imul(q,et)|0,v=v+Math.imul(H,Xe)|0,N=N+Math.imul(H,et)|0,C=C+Math.imul(pe,tt)|0,v=v+Math.imul(pe,Qe)|0,v=v+Math.imul(x,tt)|0,N=N+Math.imul(x,Qe)|0;var Di=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Di>>>26)|0,Di&=67108863,C=Math.imul(ye,Re),v=Math.imul(ye,Ne),v=v+Math.imul(xe,Re)|0,N=Math.imul(xe,Ne),C=C+Math.imul(Ee,dt)|0,v=v+Math.imul(Ee,Et)|0,v=v+Math.imul(Ae,dt)|0,N=N+Math.imul(Ae,Et)|0,C=C+Math.imul(ze,It)|0,v=v+Math.imul(ze,Ot)|0,v=v+Math.imul(Ce,It)|0,N=N+Math.imul(Ce,Ot)|0,C=C+Math.imul(Me,Ye)|0,v=v+Math.imul(Me,He)|0,v=v+Math.imul(Se,Ye)|0,N=N+Math.imul(Se,He)|0,C=C+Math.imul(he,Je)|0,v=v+Math.imul(he,Ve)|0,v=v+Math.imul(le,Je)|0,N=N+Math.imul(le,Ve)|0,C=C+Math.imul(w,Xe)|0,v=v+Math.imul(w,et)|0,v=v+Math.imul(k,Xe)|0,N=N+Math.imul(k,et)|0,C=C+Math.imul(q,tt)|0,v=v+Math.imul(q,Qe)|0,v=v+Math.imul(H,tt)|0,N=N+Math.imul(H,Qe)|0,C=C+Math.imul(pe,Ze)|0,v=v+Math.imul(pe,ke)|0,v=v+Math.imul(x,Ze)|0,N=N+Math.imul(x,ke)|0;var fo=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(fo>>>26)|0,fo&=67108863,C=Math.imul(be,Re),v=Math.imul(be,Ne),v=v+Math.imul(Pe,Re)|0,N=Math.imul(Pe,Ne),C=C+Math.imul(ye,dt)|0,v=v+Math.imul(ye,Et)|0,v=v+Math.imul(xe,dt)|0,N=N+Math.imul(xe,Et)|0,C=C+Math.imul(Ee,It)|0,v=v+Math.imul(Ee,Ot)|0,v=v+Math.imul(Ae,It)|0,N=N+Math.imul(Ae,Ot)|0,C=C+Math.imul(ze,Ye)|0,v=v+Math.imul(ze,He)|0,v=v+Math.imul(Ce,Ye)|0,N=N+Math.imul(Ce,He)|0,C=C+Math.imul(Me,Je)|0,v=v+Math.imul(Me,Ve)|0,v=v+Math.imul(Se,Je)|0,N=N+Math.imul(Se,Ve)|0,C=C+Math.imul(he,Xe)|0,v=v+Math.imul(he,et)|0,v=v+Math.imul(le,Xe)|0,N=N+Math.imul(le,et)|0,C=C+Math.imul(w,tt)|0,v=v+Math.imul(w,Qe)|0,v=v+Math.imul(k,tt)|0,N=N+Math.imul(k,Qe)|0,C=C+Math.imul(q,Ze)|0,v=v+Math.imul(q,ke)|0,v=v+Math.imul(H,Ze)|0,N=N+Math.imul(H,ke)|0,C=C+Math.imul(pe,rt)|0,v=v+Math.imul(pe,jt)|0,v=v+Math.imul(x,rt)|0,N=N+Math.imul(x,jt)|0;var Ci=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,C=Math.imul(Te,Re),v=Math.imul(Te,Ne),v=v+Math.imul($e,Re)|0,N=Math.imul($e,Ne),C=C+Math.imul(be,dt)|0,v=v+Math.imul(be,Et)|0,v=v+Math.imul(Pe,dt)|0,N=N+Math.imul(Pe,Et)|0,C=C+Math.imul(ye,It)|0,v=v+Math.imul(ye,Ot)|0,v=v+Math.imul(xe,It)|0,N=N+Math.imul(xe,Ot)|0,C=C+Math.imul(Ee,Ye)|0,v=v+Math.imul(Ee,He)|0,v=v+Math.imul(Ae,Ye)|0,N=N+Math.imul(Ae,He)|0,C=C+Math.imul(ze,Je)|0,v=v+Math.imul(ze,Ve)|0,v=v+Math.imul(Ce,Je)|0,N=N+Math.imul(Ce,Ve)|0,C=C+Math.imul(Me,Xe)|0,v=v+Math.imul(Me,et)|0,v=v+Math.imul(Se,Xe)|0,N=N+Math.imul(Se,et)|0,C=C+Math.imul(he,tt)|0,v=v+Math.imul(he,Qe)|0,v=v+Math.imul(le,tt)|0,N=N+Math.imul(le,Qe)|0,C=C+Math.imul(w,Ze)|0,v=v+Math.imul(w,ke)|0,v=v+Math.imul(k,Ze)|0,N=N+Math.imul(k,ke)|0,C=C+Math.imul(q,rt)|0,v=v+Math.imul(q,jt)|0,v=v+Math.imul(H,rt)|0,N=N+Math.imul(H,jt)|0,C=C+Math.imul(pe,kt)|0,v=v+Math.imul(pe,vt)|0,v=v+Math.imul(x,kt)|0,N=N+Math.imul(x,vt)|0;var po=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(po>>>26)|0,po&=67108863,C=Math.imul(Te,dt),v=Math.imul(Te,Et),v=v+Math.imul($e,dt)|0,N=Math.imul($e,Et),C=C+Math.imul(be,It)|0,v=v+Math.imul(be,Ot)|0,v=v+Math.imul(Pe,It)|0,N=N+Math.imul(Pe,Ot)|0,C=C+Math.imul(ye,Ye)|0,v=v+Math.imul(ye,He)|0,v=v+Math.imul(xe,Ye)|0,N=N+Math.imul(xe,He)|0,C=C+Math.imul(Ee,Je)|0,v=v+Math.imul(Ee,Ve)|0,v=v+Math.imul(Ae,Je)|0,N=N+Math.imul(Ae,Ve)|0,C=C+Math.imul(ze,Xe)|0,v=v+Math.imul(ze,et)|0,v=v+Math.imul(Ce,Xe)|0,N=N+Math.imul(Ce,et)|0,C=C+Math.imul(Me,tt)|0,v=v+Math.imul(Me,Qe)|0,v=v+Math.imul(Se,tt)|0,N=N+Math.imul(Se,Qe)|0,C=C+Math.imul(he,Ze)|0,v=v+Math.imul(he,ke)|0,v=v+Math.imul(le,Ze)|0,N=N+Math.imul(le,ke)|0,C=C+Math.imul(w,rt)|0,v=v+Math.imul(w,jt)|0,v=v+Math.imul(k,rt)|0,N=N+Math.imul(k,jt)|0,C=C+Math.imul(q,kt)|0,v=v+Math.imul(q,vt)|0,v=v+Math.imul(H,kt)|0,N=N+Math.imul(H,vt)|0;var go=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(go>>>26)|0,go&=67108863,C=Math.imul(Te,It),v=Math.imul(Te,Ot),v=v+Math.imul($e,It)|0,N=Math.imul($e,Ot),C=C+Math.imul(be,Ye)|0,v=v+Math.imul(be,He)|0,v=v+Math.imul(Pe,Ye)|0,N=N+Math.imul(Pe,He)|0,C=C+Math.imul(ye,Je)|0,v=v+Math.imul(ye,Ve)|0,v=v+Math.imul(xe,Je)|0,N=N+Math.imul(xe,Ve)|0,C=C+Math.imul(Ee,Xe)|0,v=v+Math.imul(Ee,et)|0,v=v+Math.imul(Ae,Xe)|0,N=N+Math.imul(Ae,et)|0,C=C+Math.imul(ze,tt)|0,v=v+Math.imul(ze,Qe)|0,v=v+Math.imul(Ce,tt)|0,N=N+Math.imul(Ce,Qe)|0,C=C+Math.imul(Me,Ze)|0,v=v+Math.imul(Me,ke)|0,v=v+Math.imul(Se,Ze)|0,N=N+Math.imul(Se,ke)|0,C=C+Math.imul(he,rt)|0,v=v+Math.imul(he,jt)|0,v=v+Math.imul(le,rt)|0,N=N+Math.imul(le,jt)|0,C=C+Math.imul(w,kt)|0,v=v+Math.imul(w,vt)|0,v=v+Math.imul(k,kt)|0,N=N+Math.imul(k,vt)|0;var Oi=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,C=Math.imul(Te,Ye),v=Math.imul(Te,He),v=v+Math.imul($e,Ye)|0,N=Math.imul($e,He),C=C+Math.imul(be,Je)|0,v=v+Math.imul(be,Ve)|0,v=v+Math.imul(Pe,Je)|0,N=N+Math.imul(Pe,Ve)|0,C=C+Math.imul(ye,Xe)|0,v=v+Math.imul(ye,et)|0,v=v+Math.imul(xe,Xe)|0,N=N+Math.imul(xe,et)|0,C=C+Math.imul(Ee,tt)|0,v=v+Math.imul(Ee,Qe)|0,v=v+Math.imul(Ae,tt)|0,N=N+Math.imul(Ae,Qe)|0,C=C+Math.imul(ze,Ze)|0,v=v+Math.imul(ze,ke)|0,v=v+Math.imul(Ce,Ze)|0,N=N+Math.imul(Ce,ke)|0,C=C+Math.imul(Me,rt)|0,v=v+Math.imul(Me,jt)|0,v=v+Math.imul(Se,rt)|0,N=N+Math.imul(Se,jt)|0,C=C+Math.imul(he,kt)|0,v=v+Math.imul(he,vt)|0,v=v+Math.imul(le,kt)|0,N=N+Math.imul(le,vt)|0;var Ss=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Ss>>>26)|0,Ss&=67108863,C=Math.imul(Te,Je),v=Math.imul(Te,Ve),v=v+Math.imul($e,Je)|0,N=Math.imul($e,Ve),C=C+Math.imul(be,Xe)|0,v=v+Math.imul(be,et)|0,v=v+Math.imul(Pe,Xe)|0,N=N+Math.imul(Pe,et)|0,C=C+Math.imul(ye,tt)|0,v=v+Math.imul(ye,Qe)|0,v=v+Math.imul(xe,tt)|0,N=N+Math.imul(xe,Qe)|0,C=C+Math.imul(Ee,Ze)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Ae,Ze)|0,N=N+Math.imul(Ae,ke)|0,C=C+Math.imul(ze,rt)|0,v=v+Math.imul(ze,jt)|0,v=v+Math.imul(Ce,rt)|0,N=N+Math.imul(Ce,jt)|0,C=C+Math.imul(Me,kt)|0,v=v+Math.imul(Me,vt)|0,v=v+Math.imul(Se,kt)|0,N=N+Math.imul(Se,vt)|0;var Ds=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Ds>>>26)|0,Ds&=67108863,C=Math.imul(Te,Xe),v=Math.imul(Te,et),v=v+Math.imul($e,Xe)|0,N=Math.imul($e,et),C=C+Math.imul(be,tt)|0,v=v+Math.imul(be,Qe)|0,v=v+Math.imul(Pe,tt)|0,N=N+Math.imul(Pe,Qe)|0,C=C+Math.imul(ye,Ze)|0,v=v+Math.imul(ye,ke)|0,v=v+Math.imul(xe,Ze)|0,N=N+Math.imul(xe,ke)|0,C=C+Math.imul(Ee,rt)|0,v=v+Math.imul(Ee,jt)|0,v=v+Math.imul(Ae,rt)|0,N=N+Math.imul(Ae,jt)|0,C=C+Math.imul(ze,kt)|0,v=v+Math.imul(ze,vt)|0,v=v+Math.imul(Ce,kt)|0,N=N+Math.imul(Ce,vt)|0;var Gr=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,C=Math.imul(Te,tt),v=Math.imul(Te,Qe),v=v+Math.imul($e,tt)|0,N=Math.imul($e,Qe),C=C+Math.imul(be,Ze)|0,v=v+Math.imul(be,ke)|0,v=v+Math.imul(Pe,Ze)|0,N=N+Math.imul(Pe,ke)|0,C=C+Math.imul(ye,rt)|0,v=v+Math.imul(ye,jt)|0,v=v+Math.imul(xe,rt)|0,N=N+Math.imul(xe,jt)|0,C=C+Math.imul(Ee,kt)|0,v=v+Math.imul(Ee,vt)|0,v=v+Math.imul(Ae,kt)|0,N=N+Math.imul(Ae,vt)|0;var mo=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(mo>>>26)|0,mo&=67108863,C=Math.imul(Te,Ze),v=Math.imul(Te,ke),v=v+Math.imul($e,Ze)|0,N=Math.imul($e,ke),C=C+Math.imul(be,rt)|0,v=v+Math.imul(be,jt)|0,v=v+Math.imul(Pe,rt)|0,N=N+Math.imul(Pe,jt)|0,C=C+Math.imul(ye,kt)|0,v=v+Math.imul(ye,vt)|0,v=v+Math.imul(xe,kt)|0,N=N+Math.imul(xe,vt)|0;var vo=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(vo>>>26)|0,vo&=67108863,C=Math.imul(Te,rt),v=Math.imul(Te,jt),v=v+Math.imul($e,rt)|0,N=Math.imul($e,jt),C=C+Math.imul(be,kt)|0,v=v+Math.imul(be,vt)|0,v=v+Math.imul(Pe,kt)|0,N=N+Math.imul(Pe,vt)|0;var wo=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(wo>>>26)|0,wo&=67108863,C=Math.imul(Te,kt),v=Math.imul(Te,vt),v=v+Math.imul($e,kt)|0,N=Math.imul($e,vt);var yo=(L+C|0)+((v&8191)<<13)|0;return L=(N+(v>>>13)|0)+(yo>>>26)|0,yo&=67108863,$[0]=Ln,$[1]=Bn,$[2]=Un,$[3]=Fn,$[4]=jn,$[5]=xr,$[6]=Di,$[7]=fo,$[8]=Ci,$[9]=po,$[10]=go,$[11]=Oi,$[12]=Ss,$[13]=Ds,$[14]=Gr,$[15]=mo,$[16]=vo,$[17]=wo,$[18]=yo,L!==0&&($[19]=L,b.length++),b};Math.imul||(B=Y);function z(d,p,b){b.negative=p.negative^d.negative,b.length=d.length+p.length;for(var D=0,O=0,$=0;$<b.length-1;$++){var L=O;O=0;for(var C=D&67108863,v=Math.min($,p.length-1),N=Math.max(0,$-d.length+1);N<=v;N++){var oe=$-N,pe=d.words[oe]|0,x=p.words[N]|0,re=pe*x,q=re&67108863;L=L+(re/67108864|0)|0,q=q+C|0,C=q&67108863,L=L+(q>>>26)|0,O+=L>>>26,L&=67108863}b.words[$]=C,D=L,L=O}return D!==0?b.words[$]=D:b.length--,b._strip()}function P(d,p,b){return z(d,p,b)}o.prototype.mulTo=function(d,p){var b,D=this.length+d.length;return this.length===10&&d.length===10?b=B(this,d,p):D<63?b=Y(this,d,p):D<1024?b=z(this,d,p):b=P(this,d,p),b},o.prototype.mul=function(d){var p=new o(null);return p.words=new Array(this.length+d.length),this.mulTo(d,p)},o.prototype.mulf=function(d){var p=new o(null);return p.words=new Array(this.length+d.length),P(this,d,p)},o.prototype.imul=function(d){return this.clone().mulTo(d,this)},o.prototype.imuln=function(d){var p=d<0;p&&(d=-d),n(typeof d=="number"),n(d<67108864);for(var b=0,D=0;D<this.length;D++){var O=(this.words[D]|0)*d,$=(O&67108863)+(b&67108863);b>>=26,b+=O/67108864|0,b+=$>>>26,this.words[D]=$&67108863}return b!==0&&(this.words[D]=b,this.length++),p?this.ineg():this},o.prototype.muln=function(d){return this.clone().imuln(d)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(d){var p=W(d);if(p.length===0)return new o(1);for(var b=this,D=0;D<p.length&&p[D]===0;D++,b=b.sqr());if(++D<p.length)for(var O=b.sqr();D<p.length;D++,O=O.sqr())p[D]!==0&&(b=b.mul(O));return b},o.prototype.iushln=function(d){n(typeof d=="number"&&d>=0);var p=d%26,b=(d-p)/26,D=67108863>>>26-p<<26-p,O;if(p!==0){var $=0;for(O=0;O<this.length;O++){var L=this.words[O]&D,C=(this.words[O]|0)-L<<p;this.words[O]=C|$,$=L>>>26-p}$&&(this.words[O]=$,this.length++)}if(b!==0){for(O=this.length-1;O>=0;O--)this.words[O+b]=this.words[O];for(O=0;O<b;O++)this.words[O]=0;this.length+=b}return this._strip()},o.prototype.ishln=function(d){return n(this.negative===0),this.iushln(d)},o.prototype.iushrn=function(d,p,b){n(typeof d=="number"&&d>=0);var D;p?D=(p-p%26)/26:D=0;var O=d%26,$=Math.min((d-O)/26,this.length),L=67108863^67108863>>>O<<O,C=b;if(D-=$,D=Math.max(0,D),C){for(var v=0;v<$;v++)C.words[v]=this.words[v];C.length=$}if($!==0)if(this.length>$)for(this.length-=$,v=0;v<this.length;v++)this.words[v]=this.words[v+$];else this.words[0]=0,this.length=1;var N=0;for(v=this.length-1;v>=0&&(N!==0||v>=D);v--){var oe=this.words[v]|0;this.words[v]=N<<26-O|oe>>>O,N=oe&L}return C&&N!==0&&(C.words[C.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(d,p,b){return n(this.negative===0),this.iushrn(d,p,b)},o.prototype.shln=function(d){return this.clone().ishln(d)},o.prototype.ushln=function(d){return this.clone().iushln(d)},o.prototype.shrn=function(d){return this.clone().ishrn(d)},o.prototype.ushrn=function(d){return this.clone().iushrn(d)},o.prototype.testn=function(d){n(typeof d=="number"&&d>=0);var p=d%26,b=(d-p)/26,D=1<<p;if(this.length<=b)return!1;var O=this.words[b];return!!(O&D)},o.prototype.imaskn=function(d){n(typeof d=="number"&&d>=0);var p=d%26,b=(d-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(p!==0&&b++,this.length=Math.min(b,this.length),p!==0){var D=67108863^67108863>>>p<<p;this.words[this.length-1]&=D}return this._strip()},o.prototype.maskn=function(d){return this.clone().imaskn(d)},o.prototype.iaddn=function(d){return n(typeof d=="number"),n(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<=d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},o.prototype._iaddn=function(d){this.words[0]+=d;for(var p=0;p<this.length&&this.words[p]>=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},o.prototype.isubn=function(d){if(n(typeof d=="number"),n(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p<this.length&&this.words[p]<0;p++)this.words[p]+=67108864,this.words[p+1]-=1;return this._strip()},o.prototype.addn=function(d){return this.clone().iaddn(d)},o.prototype.subn=function(d){return this.clone().isubn(d)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(d,p,b){var D=d.length+b,O;this._expand(D);var $,L=0;for(O=0;O<d.length;O++){$=(this.words[O+b]|0)+L;var C=(d.words[O]|0)*p;$-=C&67108863,L=($>>26)-(C/67108864|0),this.words[O+b]=$&67108863}for(;O<this.length-b;O++)$=(this.words[O+b]|0)+L,L=$>>26,this.words[O+b]=$&67108863;if(L===0)return this._strip();for(n(L===-1),L=0,O=0;O<this.length;O++)$=-(this.words[O]|0)+L,L=$>>26,this.words[O]=$&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,p){var b=this.length-d.length,D=this.clone(),O=d,$=O.words[O.length-1]|0,L=this._countBits($);b=26-L,b!==0&&(O=O.ushln(b),D.iushln(b),$=O.words[O.length-1]|0);var C=D.length-O.length,v;if(p!=="mod"){v=new o(null),v.length=C+1,v.words=new Array(v.length);for(var N=0;N<v.length;N++)v.words[N]=0}var oe=D.clone()._ishlnsubmul(O,1,C);oe.negative===0&&(D=oe,v&&(v.words[C]=1));for(var pe=C-1;pe>=0;pe--){var x=(D.words[O.length+pe]|0)*67108864+(D.words[O.length+pe-1]|0);for(x=Math.min(x/$|0,67108863),D._ishlnsubmul(O,x,pe);D.negative!==0;)x--,D.negative=0,D._ishlnsubmul(O,1,pe),D.isZero()||(D.negative^=1);v&&(v.words[pe]=x)}return v&&v._strip(),D._strip(),p!=="div"&&b!==0&&D.iushrn(b),{div:v||null,mod:D}},o.prototype.divmod=function(d,p,b){if(n(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var D,O,$;return this.negative!==0&&d.negative===0?($=this.neg().divmod(d,p),p!=="mod"&&(D=$.div.neg()),p!=="div"&&(O=$.mod.neg(),b&&O.negative!==0&&O.iadd(d)),{div:D,mod:O}):this.negative===0&&d.negative!==0?($=this.divmod(d.neg(),p),p!=="mod"&&(D=$.div.neg()),{div:D,mod:$.mod}):this.negative&d.negative?($=this.neg().divmod(d.neg(),p),p!=="div"&&(O=$.mod.neg(),b&&O.negative!==0&&O.isub(d)),{div:$.div,mod:O}):d.length>this.length||this.cmp(d)<0?{div:new o(0),mod:this}:d.length===1?p==="div"?{div:this.divn(d.words[0]),mod:null}:p==="mod"?{div:null,mod:new o(this.modrn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new o(this.modrn(d.words[0]))}:this._wordDiv(d,p)},o.prototype.div=function(d){return this.divmod(d,"div",!1).div},o.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},o.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},o.prototype.divRound=function(d){var p=this.divmod(d);if(p.mod.isZero())return p.div;var b=p.div.negative!==0?p.mod.isub(d):p.mod,D=d.ushrn(1),O=d.andln(1),$=b.cmp(D);return $<0||O===1&&$===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},o.prototype.modrn=function(d){var p=d<0;p&&(d=-d),n(d<=67108863);for(var b=(1<<26)%d,D=0,O=this.length-1;O>=0;O--)D=(b*D+(this.words[O]|0))%d;return p?-D:D},o.prototype.modn=function(d){return this.modrn(d)},o.prototype.idivn=function(d){var p=d<0;p&&(d=-d),n(d<=67108863);for(var b=0,D=this.length-1;D>=0;D--){var O=(this.words[D]|0)+b*67108864;this.words[D]=O/d|0,b=O%d}return this._strip(),p?this.ineg():this},o.prototype.divn=function(d){return this.clone().idivn(d)},o.prototype.egcd=function(d){n(d.negative===0),n(!d.isZero());var p=this,b=d.clone();p.negative!==0?p=p.umod(d):p=p.clone();for(var D=new o(1),O=new o(0),$=new o(0),L=new o(1),C=0;p.isEven()&&b.isEven();)p.iushrn(1),b.iushrn(1),++C;for(var v=b.clone(),N=p.clone();!p.isZero();){for(var oe=0,pe=1;!(p.words[0]&pe)&&oe<26;++oe,pe<<=1);if(oe>0)for(p.iushrn(oe);oe-- >0;)(D.isOdd()||O.isOdd())&&(D.iadd(v),O.isub(N)),D.iushrn(1),O.iushrn(1);for(var x=0,re=1;!(b.words[0]&re)&&x<26;++x,re<<=1);if(x>0)for(b.iushrn(x);x-- >0;)($.isOdd()||L.isOdd())&&($.iadd(v),L.isub(N)),$.iushrn(1),L.iushrn(1);p.cmp(b)>=0?(p.isub(b),D.isub($),O.isub(L)):(b.isub(p),$.isub(D),L.isub(O))}return{a:$,b:L,gcd:b.iushln(C)}},o.prototype._invmp=function(d){n(d.negative===0),n(!d.isZero());var p=this,b=d.clone();p.negative!==0?p=p.umod(d):p=p.clone();for(var D=new o(1),O=new o(0),$=b.clone();p.cmpn(1)>0&&b.cmpn(1)>0;){for(var L=0,C=1;!(p.words[0]&C)&&L<26;++L,C<<=1);if(L>0)for(p.iushrn(L);L-- >0;)D.isOdd()&&D.iadd($),D.iushrn(1);for(var v=0,N=1;!(b.words[0]&N)&&v<26;++v,N<<=1);if(v>0)for(b.iushrn(v);v-- >0;)O.isOdd()&&O.iadd($),O.iushrn(1);p.cmp(b)>=0?(p.isub(b),D.isub(O)):(b.isub(p),O.isub(D))}var oe;return p.cmpn(1)===0?oe=D:oe=O,oe.cmpn(0)<0&&oe.iadd(d),oe},o.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var p=this.clone(),b=d.clone();p.negative=0,b.negative=0;for(var D=0;p.isEven()&&b.isEven();D++)p.iushrn(1),b.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;b.isEven();)b.iushrn(1);var O=p.cmp(b);if(O<0){var $=p;p=b,b=$}else if(O===0||b.cmpn(1)===0)break;p.isub(b)}while(!0);return b.iushln(D)},o.prototype.invm=function(d){return this.egcd(d).a.umod(d)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(d){return this.words[0]&d},o.prototype.bincn=function(d){n(typeof d=="number");var p=d%26,b=(d-p)/26,D=1<<p;if(this.length<=b)return this._expand(b+1),this.words[b]|=D,this;for(var O=D,$=b;O!==0&&$<this.length;$++){var L=this.words[$]|0;L+=O,O=L>>>26,L&=67108863,this.words[$]=L}return O!==0&&(this.words[$]=O,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(d){var p=d<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var b;if(this.length>1)b=1;else{p&&(d=-d),n(d<=67108863,"Number is too big");var D=this.words[0]|0;b=D===d?0:D<d?-1:1}return this.negative!==0?-b|0:b},o.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var p=this.ucmp(d);return this.negative!==0?-p|0:p},o.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var p=0,b=this.length-1;b>=0;b--){var D=this.words[b]|0,O=d.words[b]|0;if(D!==O){D<O?p=-1:D>O&&(p=1);break}}return p},o.prototype.gtn=function(d){return this.cmpn(d)===1},o.prototype.gt=function(d){return this.cmp(d)===1},o.prototype.gten=function(d){return this.cmpn(d)>=0},o.prototype.gte=function(d){return this.cmp(d)>=0},o.prototype.ltn=function(d){return this.cmpn(d)===-1},o.prototype.lt=function(d){return this.cmp(d)===-1},o.prototype.lten=function(d){return this.cmpn(d)<=0},o.prototype.lte=function(d){return this.cmp(d)<=0},o.prototype.eqn=function(d){return this.cmpn(d)===0},o.prototype.eq=function(d){return this.cmp(d)===0},o.red=function(d){return new ne(d)},o.prototype.toRed=function(d){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(d){return this.red=d,this},o.prototype.forceRed=function(d){return n(!this.red,"Already a number in reduction context"),this._forceRed(d)},o.prototype.redAdd=function(d){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},o.prototype.redIAdd=function(d){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},o.prototype.redSub=function(d){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},o.prototype.redISub=function(d){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},o.prototype.redShl=function(d){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},o.prototype.redMul=function(d){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},o.prototype.redIMul=function(d){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(d){return n(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var F={k256:null,p224:null,p192:null,p25519:null};function j(d,p){this.name=d,this.p=new o(p,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var d=new o(null);return d.words=new Array(Math.ceil(this.n/13)),d},j.prototype.ireduce=function(d){var p=d,b;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),b=p.bitLength();while(b>this.n);var D=b<this.n?-1:p.ucmp(this.p);return D===0?(p.words[0]=0,p.length=1):D>0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},j.prototype.split=function(d,p){d.iushrn(this.n,0,p)},j.prototype.imulK=function(d){return d.imul(this.k)};function m(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(m,j),m.prototype.split=function(d,p){for(var b=4194303,D=Math.min(d.length,9),O=0;O<D;O++)p.words[O]=d.words[O];if(p.length=D,d.length<=9){d.words[0]=0,d.length=1;return}var $=d.words[9];for(p.words[p.length++]=$&b,O=10;O<d.length;O++){var L=d.words[O]|0;d.words[O-10]=(L&b)<<4|$>>>22,$=L}$>>>=22,d.words[O-10]=$,$===0&&d.length>10?d.length-=10:d.length-=9},m.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var p=0,b=0;b<d.length;b++){var D=d.words[b]|0;p+=D*977,d.words[b]=p&67108863,p=D*64+(p/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function T(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(T,j);function te(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(te,j);function ee(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ee,j),ee.prototype.imulK=function(d){for(var p=0,b=0;b<d.length;b++){var D=(d.words[b]|0)*19+p,O=D&67108863;D>>>=26,d.words[b]=O,p=D}return p!==0&&(d.words[d.length++]=p),d},o._prime=function(d){if(F[d])return F[d];var p;if(d==="k256")p=new m;else if(d==="p224")p=new T;else if(d==="p192")p=new te;else if(d==="p25519")p=new ee;else throw new Error("Unknown prime "+d);return F[d]=p,p};function ne(d){if(typeof d=="string"){var p=o._prime(d);this.m=p.p,this.prime=p}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}ne.prototype._verify1=function(d){n(d.negative===0,"red works only with positives"),n(d.red,"red works only with red numbers")},ne.prototype._verify2=function(d,p){n((d.negative|p.negative)===0,"red works only with positives"),n(d.red&&d.red===p.red,"red works only with red numbers")},ne.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(g(d,d.umod(this.m)._forceRed(this)),d)},ne.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},ne.prototype.add=function(d,p){this._verify2(d,p);var b=d.add(p);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},ne.prototype.iadd=function(d,p){this._verify2(d,p);var b=d.iadd(p);return b.cmp(this.m)>=0&&b.isub(this.m),b},ne.prototype.sub=function(d,p){this._verify2(d,p);var b=d.sub(p);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},ne.prototype.isub=function(d,p){this._verify2(d,p);var b=d.isub(p);return b.cmpn(0)<0&&b.iadd(this.m),b},ne.prototype.shl=function(d,p){return this._verify1(d),this.imod(d.ushln(p))},ne.prototype.imul=function(d,p){return this._verify2(d,p),this.imod(d.imul(p))},ne.prototype.mul=function(d,p){return this._verify2(d,p),this.imod(d.mul(p))},ne.prototype.isqr=function(d){return this.imul(d,d.clone())},ne.prototype.sqr=function(d){return this.mul(d,d)},ne.prototype.sqrt=function(d){if(d.isZero())return d.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var b=this.m.add(new o(1)).iushrn(2);return this.pow(d,b)}for(var D=this.m.subn(1),O=0;!D.isZero()&&D.andln(1)===0;)O++,D.iushrn(1);n(!D.isZero());var $=new o(1).toRed(this),L=$.redNeg(),C=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new o(2*v*v).toRed(this);this.pow(v,C).cmp(L)!==0;)v.redIAdd(L);for(var N=this.pow(v,D),oe=this.pow(d,D.addn(1).iushrn(1)),pe=this.pow(d,D),x=O;pe.cmp($)!==0;){for(var re=pe,q=0;re.cmp($)!==0;q++)re=re.redSqr();n(q<x);var H=this.pow(N,new o(1).iushln(x-q-1));oe=oe.redMul(H),N=H.redSqr(),pe=pe.redMul(N),x=q}return oe},ne.prototype.invm=function(d){var p=d._invmp(this.m);return p.negative!==0?(p.negative=0,this.imod(p).redNeg()):this.imod(p)},ne.prototype.pow=function(d,p){if(p.isZero())return new o(1).toRed(this);if(p.cmpn(1)===0)return d.clone();var b=4,D=new Array(1<<b);D[0]=new o(1).toRed(this),D[1]=d;for(var O=2;O<D.length;O++)D[O]=this.mul(D[O-1],d);var $=D[0],L=0,C=0,v=p.bitLength()%26;for(v===0&&(v=26),O=p.length-1;O>=0;O--){for(var N=p.words[O],oe=v-1;oe>=0;oe--){var pe=N>>oe&1;if($!==D[0]&&($=this.sqr($)),pe===0&&L===0){C=0;continue}L<<=1,L|=pe,C++,!(C!==b&&(O!==0||oe!==0))&&($=this.mul($,D[L]),C=0,L=0)}v=26}return $},ne.prototype.convertTo=function(d){var p=d.umod(this.m);return p===d?p.clone():p},ne.prototype.convertFrom=function(d){var p=d.clone();return p.red=null,p},o.mont=function(d){return new fe(d)};function fe(d){ne.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(fe,ne),fe.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},fe.prototype.convertFrom=function(d){var p=this.imod(d.mul(this.rinv));return p.red=null,p},fe.prototype.imul=function(d,p){if(d.isZero()||p.isZero())return d.words[0]=0,d.length=1,d;var b=d.imul(p),D=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=b.isub(D).iushrn(this.shift),$=O;return O.cmp(this.m)>=0?$=O.isub(this.m):O.cmpn(0)<0&&($=O.iadd(this.m)),$._forceRed(this)},fe.prototype.mul=function(d,p){if(d.isZero()||p.isZero())return new o(0)._forceRed(this);var b=d.mul(p),D=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=b.isub(D).iushrn(this.shift),$=O;return O.cmp(this.m)>=0?$=O.isub(this.m):O.cmpn(0)<0&&($=O.iadd(this.m)),$._forceRed(this)},fe.prototype.invm=function(d){var p=this.imod(d._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,lg)})(bg);var st=bg.exports;const _g="bignumber/5.7.0";var _l=st.BN;const Ri=new ut(_g),ff={},Eg=9007199254740991;function J_(t){return t!=null&&(Qt.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||mn(t)||typeof t=="bigint"||ko(t))}let Ag=!1;class Qt{constructor(e,r){e!==ff&&Ri.throwError("cannot call constructor directly; use BigNumber.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return en(bt(this).fromTwos(e))}toTwos(e){return en(bt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Qt.from(this._hex.substring(1)):this}add(e){return en(bt(this).add(bt(e)))}sub(e){return en(bt(this).sub(bt(e)))}div(e){return Qt.from(e).isZero()&&Dn("division-by-zero","div"),en(bt(this).div(bt(e)))}mul(e){return en(bt(this).mul(bt(e)))}mod(e){const r=bt(e);return r.isNeg()&&Dn("division-by-zero","mod"),en(bt(this).umod(r))}pow(e){const r=bt(e);return r.isNeg()&&Dn("negative-power","pow"),en(bt(this).pow(r))}and(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Dn("unbound-bitwise-result","and"),en(bt(this).and(r))}or(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Dn("unbound-bitwise-result","or"),en(bt(this).or(r))}xor(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Dn("unbound-bitwise-result","xor"),en(bt(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Dn("negative-width","mask"),en(bt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Dn("negative-width","shl"),en(bt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Dn("negative-width","shr"),en(bt(this).shrn(e))}eq(e){return bt(this).eq(bt(e))}lt(e){return bt(this).lt(bt(e))}lte(e){return bt(this).lte(bt(e))}gt(e){return bt(this).gt(bt(e))}gte(e){return bt(this).gte(bt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return bt(this).isZero()}toNumber(){try{return bt(this).toNumber()}catch{Dn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ri.throwError("this platform does not support BigInt",ut.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Ag||(Ag=!0,Ri.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ri.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ut.errors.UNEXPECTED_ARGUMENT,{}):Ri.throwError("BigNumber.toString does not accept parameters",ut.errors.UNEXPECTED_ARGUMENT,{})),bt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Qt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Qt(ff,Ja(e)):e.match(/^-?[0-9]+$/)?new Qt(ff,Ja(new _l(e))):Ri.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Dn("underflow","BigNumber.from",e),(e>=Eg||e<=-Eg)&&Dn("overflow","BigNumber.from",e),Qt.from(String(e));const r=e;if(typeof r=="bigint")return Qt.from(r.toString());if(ko(r))return Qt.from(kr(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Qt.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(mn(n)||n[0]==="-"&&mn(n.substring(1))))return Qt.from(n)}return Ri.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Ja(t){if(typeof t!="string")return Ja(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ri.throwArgumentError("invalid hex","value",t),t=Ja(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function en(t){return Qt.from(Ja(t))}function bt(t){const e=Qt.from(t).toHexString();return e[0]==="-"?new _l("-"+e.substring(3),16):new _l(e.substring(2),16)}function Dn(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),Ri.throwError(t,ut.errors.NUMERIC_FAULT,n)}function Q_(t){return new _l(t,36).toString(16)}const qr=new ut(_g),Qa={},xg=Qt.from(0),Ig=Qt.from(-1);function Sg(t,e,r,n){const i={fault:e,operation:r};return n!==void 0&&(i.value=n),qr.throwError(t,ut.errors.NUMERIC_FAULT,i)}let Za="0";for(;Za.length<256;)Za+=Za;function df(t){if(typeof t!="number")try{t=Qt.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Za.substring(0,t):qr.throwArgumentError("invalid decimal size","decimals",t)}function pf(t,e){e==null&&(e=0);const r=df(e);t=Qt.from(t);const n=t.lt(xg);n&&(t=t.mul(Ig));let i=t.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=t.div(r).toString();return r.length===1?t=o:t=o+"."+i,n&&(t="-"+t),t}function Li(t,e){e==null&&(e=0);const r=df(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&qr.throwArgumentError("invalid decimal value","value",t);const n=t.substring(0,1)==="-";n&&(t=t.substring(1)),t==="."&&qr.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&qr.throwArgumentError("too many decimal points","value",t);let o=i[0],c=i[1];for(o||(o="0"),c||(c="0");c[c.length-1]==="0";)c=c.substring(0,c.length-1);for(c.length>r.length-1&&Sg("fractional component exceeds decimals","underflow","parseFixed"),c===""&&(c="0");c.length<r.length-1;)c+="0";const l=Qt.from(o),f=Qt.from(c);let h=l.mul(r).add(f);return n&&(h=h.mul(Ig)),h}class qo{constructor(e,r,n,i){e!==Qa&&qr.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=n,this.decimals=i,this.name=(r?"":"u")+"fixed"+String(n)+"x"+String(i),this._multiplier=df(i),Object.freeze(this)}static from(e){if(e instanceof qo)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,n=128,i=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const o=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||qr.throwArgumentError("invalid fixed format","format",e),r=o[1]!=="u",n=parseInt(o[2]),i=parseInt(o[3])}}else if(e){const o=(c,l,f)=>e[c]==null?f:(typeof e[c]!==l&&qr.throwArgumentError("invalid fixed format ("+c+" not "+l+")","format."+c,e[c]),e[c]);r=o("signed","boolean",r),n=o("width","number",n),i=o("decimals","number",i)}return n%8&&qr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&qr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new qo(Qa,r,n,i)}}class Or{constructor(e,r,n,i){e!==Qa&&qr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&qr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Li(this._value,this.format.decimals),n=Li(e._value,e.format.decimals);return Or.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Li(this._value,this.format.decimals),n=Li(e._value,e.format.decimals);return Or.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Li(this._value,this.format.decimals),n=Li(e._value,e.format.decimals);return Or.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Li(this._value,this.format.decimals),n=Li(e._value,e.format.decimals);return Or.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Or.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Dg.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Or.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Dg.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&qr.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const n=Or.from("1"+Za.substring(0,e),this.format),i=Z_.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}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&&qr.throwArgumentError("invalid byte width","width",e);const r=Qt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return ci(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Or.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!J_(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),Or.fromString(pf(e,r),qo.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=qo.from(r),i=Li(e,n.decimals);!n.signed&&i.lt(xg)&&Sg("unsigned value cannot be negative","overflow","value",e);let o=null;n.signed?o=i.toTwos(n.width).toHexString():(o=i.toHexString(),o=ci(o,n.width/8));const c=pf(i,n.decimals);return new Or(Qa,o,c,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=qo.from(r);if(or(e).length>n.width/8)throw new Error("overflow");let i=Qt.from(e);n.signed&&(i=i.fromTwos(n.width));const o=i.toTwos((n.signed?0:1)+n.width).toHexString(),c=pf(i,n.decimals);return new Or(Qa,o,c,n)}static from(e,r){if(typeof e=="string")return Or.fromString(e,r);if(ko(e))return Or.fromBytes(e,r);try{return Or.fromValue(e,0,r)}catch(n){if(n.code!==ut.errors.INVALID_ARGUMENT)throw n}return qr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Dg=Or.from(1),Z_=Or.from("0.5"),X_="strings/5.7.0",Cg=new ut(X_);var El;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(El||(El={}));var zo;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(zo||(zo={}));function e8(t,e,r,n,i){return Cg.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function Og(t,e,r,n,i){if(t===zo.BAD_PREFIX||t===zo.UNEXPECTED_CONTINUE){let o=0;for(let c=e+1;c<r.length&&r[c]>>6===2;c++)o++;return o}return t===zo.OVERRUN?r.length-e-1:0}function t8(t,e,r,n,i){return t===zo.OVERLONG?(n.push(i),0):(n.push(65533),Og(t,e,r))}Object.freeze({error:e8,ignore:Og,replace:t8});function gf(t,e=El.current){e!=El.current&&(Cg.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n<t.length;n++){const i=t.charCodeAt(n);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const c=65536+((i&1023)<<10)+(o&1023);r.push(c>>18|240),r.push(c>>12&63|128),r.push(c>>6&63|128),r.push(c&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return or(r)}function r8(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function mf(t,e){e||(e=function(i){return[parseInt(i,16)]});let r=0,n={};return t.split(",").forEach(i=>{let o=i.split(":");r+=parseInt(o[0],16),n[r]=e(o[1])}),n}function Pg(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}Pg("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(t=>parseInt(t,16)),mf("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"),mf("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"),mf("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",r8),Pg("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 Mg="hash/5.7.0";function n8(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return or(e)}function Tg(t,e){e==null&&(e=1);const r=[],n=r.forEach,i=function(o,c){n.call(o,function(l){c>0&&Array.isArray(l)?i(l,c-1):r.push(l)})};return i(t,e),r}function i8(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[n[0]]=n[1]}return e}function s8(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let F=1;F<n;F++)o.push(i+=r());let c=r(),l=e;e+=c;let f=0,h=0;function g(){return f==0&&(h=h<<8|t[e++],f=8),h>>--f&1}const _=31,E=Math.pow(2,_),A=E>>>1,S=A>>1,U=E-1;let W=0;for(let F=0;F<_;F++)W=W<<1|g();let Y=[],B=0,z=E;for(;;){let F=Math.floor(((W-B+1)*i-1)/z),j=0,m=n;for(;m-j>1;){let ee=j+m>>>1;F<o[ee]?m=ee:j=ee}if(j==0)break;Y.push(j);let T=B+Math.floor(z*o[j]/i),te=B+Math.floor(z*o[j+1]/i)-1;for(;!((T^te)&A);)W=W<<1&U|g(),T=T<<1&U,te=te<<1&U|1;for(;T&~te&S;)W=W&A|W<<1&U>>>1|g(),T=T<<1^A,te=(te^A)<<1|A|1;B=T,z=1+te-T}let P=n-4;return Y.map(F=>{switch(F-P){case 3:return P+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return P+256+(t[l++]<<8|t[l++]);case 1:return P+t[l++];default:return F-1}})}function o8(t){let e=0;return()=>t[e++]}function a8(t){return o8(s8(t))}function c8(t){return t&1?~t>>1:t>>1}function l8(t,e){let r=Array(t);for(let n=0;n<t;n++)r[n]=1+e();return r}function $g(t,e){let r=Array(t);for(let n=0,i=-1;n<t;n++)r[n]=i+=1+e();return r}function u8(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=c8(e());return r}function Al(t,e){let r=$g(t(),t),n=t(),i=$g(n,t),o=l8(n,t);for(let c=0;c<n;c++)for(let l=0;l<o[c];l++)r.push(i[c]+l);return e?r.map(c=>e[c]):r}function h8(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(d8(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(p8(r,t))}return i8(Tg(e))}function f8(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Ng(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;i<e;i++)u8(t,r).forEach((o,c)=>n[c].push(o));return n}function d8(t,e){let r=1+e(),n=e(),i=f8(e),o=Ng(i.length,1+t,e);return Tg(o.map((c,l)=>{const f=c[0],h=c.slice(1);return Array(i[l]).fill(void 0).map((g,_)=>{let E=_*n;return[f+_*r,h.map(A=>A+E)]})}))}function p8(t,e){let r=1+e();return Ng(r,1+t,e).map(n=>[n[0],n.slice(1)])}function g8(t){let e=Al(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let h=Al(t,e);if(h.length==0)break;n.push({set:new Set(h),node:r()})}n.sort((h,g)=>g.set.size-h.set.size);let i=t(),o=i%3;i=i/3|0;let c=!!(i&1);i>>=1;let l=i==1,f=i==2;return{branches:n,valid:o,fe0f:c,save:l,check:f}}}function m8(){return a8(n8("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 xl=m8();new Set(Al(xl)),new Set(Al(xl)),h8(xl),g8(xl),new ut(Mg),new Uint8Array(32).fill(0);const v8=`Ethereum Signed Message:
22
+ `;function Rg(t){return typeof t=="string"&&(t=gf(t)),hf(H_([gf(v8),gf(String(t.length)),t]))}const w8="rlp/5.7.0";new ut(w8);const y8="address/5.7.0",Xa=new ut(y8);function Lg(t){mn(t,20)||Xa.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=or(hf(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const b8=9007199254740991;function _8(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const vf={};for(let t=0;t<10;t++)vf[String(t)]=String(t);for(let t=0;t<26;t++)vf[String.fromCharCode(65+t)]=String(10+t);const Bg=Math.floor(_8(b8));function E8(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>vf[n]).join("");for(;e.length>=Bg;){let n=e.substring(0,Bg);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function A8(t){let e=null;if(typeof t!="string"&&Xa.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Lg(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Xa.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==E8(t)&&Xa.throwArgumentError("bad icap checksum","address",t),e=Q_(t.substring(4));e.length<40;)e="0"+e;e=Lg("0x"+e)}else Xa.throwArgumentError("invalid address","address",t);return e}const x8="properties/5.7.0";new ut(x8);function ec(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new ut(Mg),new Uint8Array(32).fill(0),Qt.from(-1);const I8=Qt.from(0),S8=Qt.from(1);Qt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),ci(S8.toHexString(),32),ci(I8.toHexString(),32);var li={},_t={},tc=Ug;function Ug(t,e){if(!t)throw new Error(e||"Assertion failed")}Ug.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var wf={exports:{}};typeof Object.create=="function"?wf.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:wf.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var D8=tc,C8=wf.exports;_t.inherits=C8;function O8(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function P8(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):O8(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i<t.length;i++)r[i]=t[i]|0;return r}_t.toArray=P8;function M8(t){for(var e="",r=0;r<t.length;r++)e+=jg(t[r].toString(16));return e}_t.toHex=M8;function Fg(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}_t.htonl=Fg;function T8(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];e==="little"&&(i=Fg(i)),r+=kg(i.toString(16))}return r}_t.toHex32=T8;function jg(t){return t.length===1?"0"+t:t}_t.zero2=jg;function kg(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}_t.zero8=kg;function $8(t,e,r,n){var i=r-e;D8(i%4===0);for(var o=new Array(i/4),c=0,l=e;c<o.length;c++,l+=4){var f;n==="big"?f=t[l]<<24|t[l+1]<<16|t[l+2]<<8|t[l+3]:f=t[l+3]<<24|t[l+2]<<16|t[l+1]<<8|t[l],o[c]=f>>>0}return o}_t.join32=$8;function N8(t,e){for(var r=new Array(t.length*4),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];e==="big"?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}_t.split32=N8;function R8(t,e){return t>>>e|t<<32-e}_t.rotr32=R8;function L8(t,e){return t<<e|t>>>32-e}_t.rotl32=L8;function B8(t,e){return t+e>>>0}_t.sum32=B8;function U8(t,e,r){return t+e+r>>>0}_t.sum32_3=U8;function F8(t,e,r,n){return t+e+r+n>>>0}_t.sum32_4=F8;function j8(t,e,r,n,i){return t+e+r+n+i>>>0}_t.sum32_5=j8;function k8(t,e,r,n){var i=t[e],o=t[e+1],c=n+o>>>0,l=(c<n?1:0)+r+i;t[e]=l>>>0,t[e+1]=c}_t.sum64=k8;function q8(t,e,r,n){var i=e+n>>>0,o=(i<e?1:0)+t+r;return o>>>0}_t.sum64_hi=q8;function z8(t,e,r,n){var i=e+n;return i>>>0}_t.sum64_lo=z8;function H8(t,e,r,n,i,o,c,l){var f=0,h=e;h=h+n>>>0,f+=h<e?1:0,h=h+o>>>0,f+=h<o?1:0,h=h+l>>>0,f+=h<l?1:0;var g=t+r+i+c+f;return g>>>0}_t.sum64_4_hi=H8;function K8(t,e,r,n,i,o,c,l){var f=e+n+o+l;return f>>>0}_t.sum64_4_lo=K8;function W8(t,e,r,n,i,o,c,l,f,h){var g=0,_=e;_=_+n>>>0,g+=_<e?1:0,_=_+o>>>0,g+=_<o?1:0,_=_+l>>>0,g+=_<l?1:0,_=_+h>>>0,g+=_<h?1:0;var E=t+r+i+c+f+g;return E>>>0}_t.sum64_5_hi=W8;function V8(t,e,r,n,i,o,c,l,f,h){var g=e+n+o+l+h;return g>>>0}_t.sum64_5_lo=V8;function G8(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}_t.rotr64_hi=G8;function Y8(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.rotr64_lo=Y8;function J8(t,e,r){return t>>>r}_t.shr64_hi=J8;function Q8(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.shr64_lo=Q8;var Ho={},qg=_t,Z8=tc;function Il(){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}Ho.BlockHash=Il,Il.prototype.update=function(t,e){if(t=qg.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=qg.join32(t,0,t.length-r,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this},Il.prototype.digest=function(t){return this.update(this._pad()),Z8(this.pending===null),this._digest(t)},Il.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,this.endian==="big"){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n};var Ko={},ui={},X8=_t,hi=X8.rotr32;function e4(t,e,r,n){if(t===0)return zg(e,r,n);if(t===1||t===3)return Kg(e,r,n);if(t===2)return Hg(e,r,n)}ui.ft_1=e4;function zg(t,e,r){return t&e^~t&r}ui.ch32=zg;function Hg(t,e,r){return t&e^t&r^e&r}ui.maj32=Hg;function Kg(t,e,r){return t^e^r}ui.p32=Kg;function t4(t){return hi(t,2)^hi(t,13)^hi(t,22)}ui.s0_256=t4;function r4(t){return hi(t,6)^hi(t,11)^hi(t,25)}ui.s1_256=r4;function n4(t){return hi(t,7)^hi(t,18)^t>>>3}ui.g0_256=n4;function i4(t){return hi(t,17)^hi(t,19)^t>>>10}ui.g1_256=i4;var Wo=_t,s4=Ho,o4=ui,yf=Wo.rotl32,rc=Wo.sum32,a4=Wo.sum32_5,c4=o4.ft_1,Wg=s4.BlockHash,l4=[1518500249,1859775393,2400959708,3395469782];function fi(){if(!(this instanceof fi))return new fi;Wg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Wo.inherits(fi,Wg);var u4=fi;fi.blockSize=512,fi.outSize=160,fi.hmacStrength=80,fi.padLength=64,fi.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=yf(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],c=this.h[2],l=this.h[3],f=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),g=a4(yf(i,5),c4(h,o,c,l),f,r[n],l4[h]);f=l,l=c,c=yf(o,30),o=i,i=g}this.h[0]=rc(this.h[0],i),this.h[1]=rc(this.h[1],o),this.h[2]=rc(this.h[2],c),this.h[3]=rc(this.h[3],l),this.h[4]=rc(this.h[4],f)},fi.prototype._digest=function(t){return t==="hex"?Wo.toHex32(this.h,"big"):Wo.split32(this.h,"big")};var Vo=_t,h4=Ho,Go=ui,f4=tc,Qn=Vo.sum32,d4=Vo.sum32_4,p4=Vo.sum32_5,g4=Go.ch32,m4=Go.maj32,v4=Go.s0_256,w4=Go.s1_256,y4=Go.g0_256,b4=Go.g1_256,Vg=h4.BlockHash,_4=[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 di(){if(!(this instanceof di))return new di;Vg.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=_4,this.W=new Array(64)}Vo.inherits(di,Vg);var Gg=di;di.blockSize=512,di.outSize=256,di.hmacStrength=192,di.padLength=64,di.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=d4(b4(r[n-2]),r[n-7],y4(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],c=this.h[2],l=this.h[3],f=this.h[4],h=this.h[5],g=this.h[6],_=this.h[7];for(f4(this.k.length===r.length),n=0;n<r.length;n++){var E=p4(_,w4(f),g4(f,h,g),this.k[n],r[n]),A=Qn(v4(i),m4(i,o,c));_=g,g=h,h=f,f=Qn(l,E),l=c,c=o,o=i,i=Qn(E,A)}this.h[0]=Qn(this.h[0],i),this.h[1]=Qn(this.h[1],o),this.h[2]=Qn(this.h[2],c),this.h[3]=Qn(this.h[3],l),this.h[4]=Qn(this.h[4],f),this.h[5]=Qn(this.h[5],h),this.h[6]=Qn(this.h[6],g),this.h[7]=Qn(this.h[7],_)},di.prototype._digest=function(t){return t==="hex"?Vo.toHex32(this.h,"big"):Vo.split32(this.h,"big")};var bf=_t,Yg=Gg;function Bi(){if(!(this instanceof Bi))return new Bi;Yg.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}bf.inherits(Bi,Yg);var E4=Bi;Bi.blockSize=512,Bi.outSize=224,Bi.hmacStrength=192,Bi.padLength=64,Bi.prototype._digest=function(t){return t==="hex"?bf.toHex32(this.h.slice(0,7),"big"):bf.split32(this.h.slice(0,7),"big")};var tn=_t,A4=Ho,x4=tc,pi=tn.rotr64_hi,gi=tn.rotr64_lo,Jg=tn.shr64_hi,Qg=tn.shr64_lo,os=tn.sum64,_f=tn.sum64_hi,Ef=tn.sum64_lo,I4=tn.sum64_4_hi,S4=tn.sum64_4_lo,D4=tn.sum64_5_hi,C4=tn.sum64_5_lo,Zg=A4.BlockHash,O4=[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 Zn(){if(!(this instanceof Zn))return new Zn;Zg.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=O4,this.W=new Array(160)}tn.inherits(Zn,Zg);var Xg=Zn;Zn.blockSize=1024,Zn.outSize=512,Zn.hmacStrength=192,Zn.padLength=128,Zn.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=j4(r[n-4],r[n-3]),o=k4(r[n-4],r[n-3]),c=r[n-14],l=r[n-13],f=U4(r[n-30],r[n-29]),h=F4(r[n-30],r[n-29]),g=r[n-32],_=r[n-31];r[n]=I4(i,o,c,l,f,h,g,_),r[n+1]=S4(i,o,c,l,f,h,g,_)}},Zn.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],c=this.h[3],l=this.h[4],f=this.h[5],h=this.h[6],g=this.h[7],_=this.h[8],E=this.h[9],A=this.h[10],S=this.h[11],U=this.h[12],W=this.h[13],Y=this.h[14],B=this.h[15];x4(this.k.length===r.length);for(var z=0;z<r.length;z+=2){var P=Y,F=B,j=L4(_,E),m=B4(_,E),T=P4(_,E,A,S,U),te=M4(_,E,A,S,U,W),ee=this.k[z],ne=this.k[z+1],fe=r[z],d=r[z+1],p=D4(P,F,j,m,T,te,ee,ne,fe,d),b=C4(P,F,j,m,T,te,ee,ne,fe,d);P=N4(n,i),F=R4(n,i),j=T4(n,i,o,c,l),m=$4(n,i,o,c,l,f);var D=_f(P,F,j,m),O=Ef(P,F,j,m);Y=U,B=W,U=A,W=S,A=_,S=E,_=_f(h,g,p,b),E=Ef(g,g,p,b),h=l,g=f,l=o,f=c,o=n,c=i,n=_f(p,b,D,O),i=Ef(p,b,D,O)}os(this.h,0,n,i),os(this.h,2,o,c),os(this.h,4,l,f),os(this.h,6,h,g),os(this.h,8,_,E),os(this.h,10,A,S),os(this.h,12,U,W),os(this.h,14,Y,B)},Zn.prototype._digest=function(t){return t==="hex"?tn.toHex32(this.h,"big"):tn.split32(this.h,"big")};function P4(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function M4(t,e,r,n,i,o){var c=e&n^~e&o;return c<0&&(c+=4294967296),c}function T4(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function $4(t,e,r,n,i,o){var c=e&n^e&o^n&o;return c<0&&(c+=4294967296),c}function N4(t,e){var r=pi(t,e,28),n=pi(e,t,2),i=pi(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function R4(t,e){var r=gi(t,e,28),n=gi(e,t,2),i=gi(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function L4(t,e){var r=pi(t,e,14),n=pi(t,e,18),i=pi(e,t,9),o=r^n^i;return o<0&&(o+=4294967296),o}function B4(t,e){var r=gi(t,e,14),n=gi(t,e,18),i=gi(e,t,9),o=r^n^i;return o<0&&(o+=4294967296),o}function U4(t,e){var r=pi(t,e,1),n=pi(t,e,8),i=Jg(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function F4(t,e){var r=gi(t,e,1),n=gi(t,e,8),i=Qg(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function j4(t,e){var r=pi(t,e,19),n=pi(e,t,29),i=Jg(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}function k4(t,e){var r=gi(t,e,19),n=gi(e,t,29),i=Qg(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}var Af=_t,em=Xg;function Ui(){if(!(this instanceof Ui))return new Ui;em.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Af.inherits(Ui,em);var q4=Ui;Ui.blockSize=1024,Ui.outSize=384,Ui.hmacStrength=192,Ui.padLength=128,Ui.prototype._digest=function(t){return t==="hex"?Af.toHex32(this.h.slice(0,12),"big"):Af.split32(this.h.slice(0,12),"big")},Ko.sha1=u4,Ko.sha224=E4,Ko.sha256=Gg,Ko.sha384=q4,Ko.sha512=Xg;var tm={},zs=_t,z4=Ho,Sl=zs.rotl32,rm=zs.sum32,nc=zs.sum32_3,nm=zs.sum32_4,im=z4.BlockHash;function mi(){if(!(this instanceof mi))return new mi;im.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}zs.inherits(mi,im),tm.ripemd160=mi,mi.blockSize=512,mi.outSize=160,mi.hmacStrength=192,mi.padLength=64,mi.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],o=this.h[3],c=this.h[4],l=r,f=n,h=i,g=o,_=c,E=0;E<80;E++){var A=rm(Sl(nm(r,sm(E,n,i,o),t[W4[E]+e],H4(E)),G4[E]),c);r=c,c=o,o=Sl(i,10),i=n,n=A,A=rm(Sl(nm(l,sm(79-E,f,h,g),t[V4[E]+e],K4(E)),Y4[E]),_),l=_,_=g,g=Sl(h,10),h=f,f=A}A=nc(this.h[1],i,g),this.h[1]=nc(this.h[2],o,_),this.h[2]=nc(this.h[3],c,l),this.h[3]=nc(this.h[4],r,f),this.h[4]=nc(this.h[0],n,h),this.h[0]=A},mi.prototype._digest=function(t){return t==="hex"?zs.toHex32(this.h,"little"):zs.split32(this.h,"little")};function sm(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function H4(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function K4(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var W4=[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],V4=[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],G4=[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],Y4=[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],J4=_t,Q4=tc;function Yo(t,e,r){if(!(this instanceof Yo))return new Yo(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(J4.toArray(e,r))}var Z4=Yo;Yo.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),Q4(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=new this.Hash().update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=new this.Hash().update(t)},Yo.prototype.update=function(t,e){return this.inner.update(t,e),this},Yo.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=_t,e.common=Ho,e.sha=Ko,e.ripemd=tm,e.hmac=Z4,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}(li);function Jo(t,e,r){return r={path:e,exports:{},require:function(n,i){return X4(n,i??r.path)}},t(r,r.exports),r.exports}function X4(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var xf=om;function om(t,e){if(!t)throw new Error(e||"Assertion failed")}om.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Xn=Jo(function(t,e){var r=e;function n(c,l){if(Array.isArray(c))return c.slice();if(!c)return[];var f=[];if(typeof c!="string"){for(var h=0;h<c.length;h++)f[h]=c[h]|0;return f}if(l==="hex"){c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c);for(var h=0;h<c.length;h+=2)f.push(parseInt(c[h]+c[h+1],16))}else for(var h=0;h<c.length;h++){var g=c.charCodeAt(h),_=g>>8,E=g&255;_?f.push(_,E):f.push(E)}return f}r.toArray=n;function i(c){return c.length===1?"0"+c:c}r.zero2=i;function o(c){for(var l="",f=0;f<c.length;f++)l+=i(c[f].toString(16));return l}r.toHex=o,r.encode=function(c,l){return l==="hex"?o(c):c}}),vn=Jo(function(t,e){var r=e;r.assert=xf,r.toArray=Xn.toArray,r.zero2=Xn.zero2,r.toHex=Xn.toHex,r.encode=Xn.encode;function n(f,h,g){var _=new Array(Math.max(f.bitLength(),g)+1);_.fill(0);for(var E=1<<h+1,A=f.clone(),S=0;S<_.length;S++){var U,W=A.andln(E-1);A.isOdd()?(W>(E>>1)-1?U=(E>>1)-W:U=W,A.isubn(U)):U=0,_[S]=U,A.iushrn(1)}return _}r.getNAF=n;function i(f,h){var g=[[],[]];f=f.clone(),h=h.clone();for(var _=0,E=0,A;f.cmpn(-_)>0||h.cmpn(-E)>0;){var S=f.andln(3)+_&3,U=h.andln(3)+E&3;S===3&&(S=-1),U===3&&(U=-1);var W;S&1?(A=f.andln(7)+_&7,(A===3||A===5)&&U===2?W=-S:W=S):W=0,g[0].push(W);var Y;U&1?(A=h.andln(7)+E&7,(A===3||A===5)&&S===2?Y=-U:Y=U):Y=0,g[1].push(Y),2*_===W+1&&(_=1-_),2*E===Y+1&&(E=1-E),f.iushrn(1),h.iushrn(1)}return g}r.getJSF=i;function o(f,h,g){var _="_"+h;f.prototype[h]=function(){return this[_]!==void 0?this[_]:this[_]=g.call(this)}}r.cachedProperty=o;function c(f){return typeof f=="string"?r.toArray(f,"hex"):f}r.parseBytes=c;function l(f){return new st(f,"hex","le")}r.intFromLE=l}),Dl=vn.getNAF,eE=vn.getJSF,Cl=vn.assert;function as(t,e){this.type=t,this.p=new st(e.p,16),this.red=e.prime?st.red(e.prime):st.mont(this.p),this.zero=new st(0).toRed(this.red),this.one=new st(1).toRed(this.red),this.two=new st(2).toRed(this.red),this.n=e.n&&new st(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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hs=as;as.prototype.point=function(){throw new Error("Not implemented")},as.prototype.validate=function(){throw new Error("Not implemented")},as.prototype._fixedNafMul=function(t,e){Cl(t.precomputed);var r=t._getDoubles(),n=Dl(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2===0?2:1);i/=3;var o=[],c,l;for(c=0;c<n.length;c+=r.step){l=0;for(var f=c+r.step-1;f>=c;f--)l=(l<<1)+n[f];o.push(l)}for(var h=this.jpoint(null,null,null),g=this.jpoint(null,null,null),_=i;_>0;_--){for(c=0;c<o.length;c++)l=o[c],l===_?g=g.mixedAdd(r.points[c]):l===-_&&(g=g.mixedAdd(r.points[c].neg()));h=h.add(g)}return h.toP()},as.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Dl(e,r,this._bitLength),c=this.jpoint(null,null,null),l=o.length-1;l>=0;l--){for(var f=0;l>=0&&o[l]===0;l--)f++;if(l>=0&&f++,c=c.dblp(f),l<0)break;var h=o[l];Cl(h!==0),t.type==="affine"?h>0?c=c.mixedAdd(i[h-1>>1]):c=c.mixedAdd(i[-h-1>>1].neg()):h>0?c=c.add(i[h-1>>1]):c=c.add(i[-h-1>>1].neg())}return t.type==="affine"?c.toP():c},as.prototype._wnafMulAdd=function(t,e,r,n,i){var o=this._wnafT1,c=this._wnafT2,l=this._wnafT3,f=0,h,g,_;for(h=0;h<n;h++){_=e[h];var E=_._getNAFPoints(t);o[h]=E.wnd,c[h]=E.points}for(h=n-1;h>=1;h-=2){var A=h-1,S=h;if(o[A]!==1||o[S]!==1){l[A]=Dl(r[A],o[A],this._bitLength),l[S]=Dl(r[S],o[S],this._bitLength),f=Math.max(l[A].length,f),f=Math.max(l[S].length,f);continue}var U=[e[A],null,null,e[S]];e[A].y.cmp(e[S].y)===0?(U[1]=e[A].add(e[S]),U[2]=e[A].toJ().mixedAdd(e[S].neg())):e[A].y.cmp(e[S].y.redNeg())===0?(U[1]=e[A].toJ().mixedAdd(e[S]),U[2]=e[A].add(e[S].neg())):(U[1]=e[A].toJ().mixedAdd(e[S]),U[2]=e[A].toJ().mixedAdd(e[S].neg()));var W=[-3,-1,-5,-7,0,7,5,1,3],Y=eE(r[A],r[S]);for(f=Math.max(Y[0].length,f),l[A]=new Array(f),l[S]=new Array(f),g=0;g<f;g++){var B=Y[0][g]|0,z=Y[1][g]|0;l[A][g]=W[(B+1)*3+(z+1)],l[S][g]=0,c[A]=U}}var P=this.jpoint(null,null,null),F=this._wnafT4;for(h=f;h>=0;h--){for(var j=0;h>=0;){var m=!0;for(g=0;g<n;g++)F[g]=l[g][h]|0,F[g]!==0&&(m=!1);if(!m)break;j++,h--}if(h>=0&&j++,P=P.dblp(j),h<0)break;for(g=0;g<n;g++){var T=F[g];T!==0&&(T>0?_=c[g][T-1>>1]:T<0&&(_=c[g][-T-1>>1].neg()),_.type==="affine"?P=P.mixedAdd(_):P=P.add(_))}}for(h=0;h<n;h++)c[h]=null;return i?P:P.toP()};function Cn(t,e){this.curve=t,this.type=e,this.precomputed=null}as.BasePoint=Cn,Cn.prototype.eq=function(){throw new Error("Not implemented")},Cn.prototype.validate=function(){return this.curve.validate(this)},as.prototype.decodePoint=function(t,e){t=vn.toArray(t,e);var r=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*r){t[0]===6?Cl(t[t.length-1]%2===0):t[0]===7&&Cl(t[t.length-1]%2===1);var n=this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));return n}else if((t[0]===2||t[0]===3)&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),t[0]===3);throw new Error("Unknown point format")},Cn.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Cn.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Cn.prototype.encode=function(t,e){return vn.encode(this._encode(e),t)},Cn.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Cn.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((t.bitLength()+1)/e.step):!1},Cn.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},Cn.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=r===1?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},Cn.prototype._getBeta=function(){return null},Cn.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var If=Jo(function(t){typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}}),tE=vn.assert;function On(t){Hs.call(this,"short",t),this.a=new st(t.a,16).toRed(this.red),this.b=new st(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}If(On,Hs);var rE=On;On.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var e,r;if(t.beta)e=new st(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=n[0].cmp(n[1])<0?n[0]:n[1],e=e.toRed(this.red)}if(t.lambda)r=new st(t.lambda,16);else{var i=this._getEndoRoots(this.n);this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))===0?r=i[0]:(r=i[1],tE(this.g.mul(r).x.cmp(this.g.x.redMul(e))===0))}var o;return t.basis?o=t.basis.map(function(c){return{a:new st(c.a,16),b:new st(c.b,16)}}):o=this._getEndoBasis(r),{beta:e,lambda:r,basis:o}}},On.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:st.mont(t),r=new st(2).toRed(e).redInvm(),n=r.redNeg(),i=new st(3).toRed(e).redNeg().redSqrt().redMul(r),o=n.redAdd(i).fromRed(),c=n.redSub(i).fromRed();return[o,c]},On.prototype._getEndoBasis=function(t){for(var e=this.n.ushrn(Math.floor(this.n.bitLength()/2)),r=t,n=this.n.clone(),i=new st(1),o=new st(0),c=new st(0),l=new st(1),f,h,g,_,E,A,S,U=0,W,Y;r.cmpn(0)!==0;){var B=n.div(r);W=n.sub(B.mul(r)),Y=c.sub(B.mul(i));var z=l.sub(B.mul(o));if(!g&&W.cmp(e)<0)f=S.neg(),h=i,g=W.neg(),_=Y;else if(g&&++U===2)break;S=W,n=r,r=W,c=i,i=Y,l=o,o=z}E=W.neg(),A=Y;var P=g.sqr().add(_.sqr()),F=E.sqr().add(A.sqr());return F.cmp(P)>=0&&(E=f,A=h),g.negative&&(g=g.neg(),_=_.neg()),E.negative&&(E=E.neg(),A=A.neg()),[{a:g,b:_},{a:E,b:A}]},On.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),c=i.mul(r.a),l=o.mul(n.a),f=i.mul(r.b),h=o.mul(n.b),g=t.sub(c).sub(l),_=f.add(h).neg();return{k1:g,k2:_}},On.prototype.pointFromX=function(t,e){t=new st(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},On.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},On.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var c=this._endoSplit(e[o]),l=t[o],f=l._getBeta();c.k1.negative&&(c.k1.ineg(),l=l.neg(!0)),c.k2.negative&&(c.k2.ineg(),f=f.neg(!0)),n[o*2]=l,n[o*2+1]=f,i[o*2]=c.k1,i[o*2+1]=c.k2}for(var h=this._wnafMulAdd(1,n,i,o*2,r),g=0;g<o*2;g++)n[g]=null,i[g]=null;return h};function br(t,e,r,n){Hs.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new st(e,16),this.y=new st(r,16),n&&(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)}If(br,Hs.BasePoint),On.prototype.point=function(t,e,r){return new br(this,t,e,r)},On.prototype.pointFromJSON=function(t,e){return br.fromJSON(this,t,e)},br.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(i){return r.point(i.x.redMul(r.endo.beta),i.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},br.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]},br.fromJSON=function(t,e,r){typeof e=="string"&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(c){return t.point(c[0],c[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},br.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)+">"},br.prototype.isInfinity=function(){return this.inf},br.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},br.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),c=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,c)},br.prototype.getX=function(){return this.x.fromRed()},br.prototype.getY=function(){return this.y.fromRed()},br.prototype.mul=function(t){return t=new st(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},br.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},br.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},br.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},br.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},br.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Pr(t,e,r,n){Hs.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new st(0)):(this.x=new st(e,16),this.y=new st(r,16),this.z=new st(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.zOne=this.z===this.curve.one}If(Pr,Hs.BasePoint),On.prototype.jpoint=function(t,e,r){return new Pr(this,t,e,r)},Pr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Pr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Pr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),c=t.y.redMul(r.redMul(this.z)),l=n.redSub(i),f=o.redSub(c);if(l.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=l.redSqr(),g=h.redMul(l),_=n.redMul(h),E=f.redSqr().redIAdd(g).redISub(_).redISub(_),A=f.redMul(_.redISub(E)).redISub(o.redMul(g)),S=this.z.redMul(t.z).redMul(l);return this.curve.jpoint(E,A,S)},Pr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),c=r.redSub(n),l=i.redSub(o);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),h=f.redMul(c),g=r.redMul(f),_=l.redSqr().redIAdd(h).redISub(g).redISub(g),E=l.redMul(g.redISub(_)).redISub(i.redMul(h)),A=this.z.redMul(c);return this.curve.jpoint(_,E,A)},Pr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,c=this.y,l=this.z,f=l.redSqr().redSqr(),h=c.redAdd(c);for(e=0;e<t;e++){var g=o.redSqr(),_=h.redSqr(),E=_.redSqr(),A=g.redAdd(g).redIAdd(g).redIAdd(n.redMul(f)),S=o.redMul(_),U=A.redSqr().redISub(S.redAdd(S)),W=S.redISub(U),Y=A.redMul(W);Y=Y.redIAdd(Y).redISub(E);var B=h.redMul(l);e+1<t&&(f=f.redMul(E)),o=U,l=B,h=Y}return this.curve.jpoint(o,h.redMul(i),l)},Pr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Pr.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),c=this.x.redAdd(i).redSqr().redISub(n).redISub(o);c=c.redIAdd(c);var l=n.redAdd(n).redIAdd(n),f=l.redSqr().redISub(c).redISub(c),h=o.redIAdd(o);h=h.redIAdd(h),h=h.redIAdd(h),t=f,e=l.redMul(c.redISub(f)).redISub(h),r=this.y.redAdd(this.y)}else{var g=this.x.redSqr(),_=this.y.redSqr(),E=_.redSqr(),A=this.x.redAdd(_).redSqr().redISub(g).redISub(E);A=A.redIAdd(A);var S=g.redAdd(g).redIAdd(g),U=S.redSqr(),W=E.redIAdd(E);W=W.redIAdd(W),W=W.redIAdd(W),t=U.redISub(A).redISub(A),e=S.redMul(A.redISub(t)).redISub(W),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},Pr.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),c=this.x.redAdd(i).redSqr().redISub(n).redISub(o);c=c.redIAdd(c);var l=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=l.redSqr().redISub(c).redISub(c);t=f;var h=o.redIAdd(o);h=h.redIAdd(h),h=h.redIAdd(h),e=l.redMul(c.redISub(f)).redISub(h),r=this.y.redAdd(this.y)}else{var g=this.z.redSqr(),_=this.y.redSqr(),E=this.x.redMul(_),A=this.x.redSub(g).redMul(this.x.redAdd(g));A=A.redAdd(A).redIAdd(A);var S=E.redIAdd(E);S=S.redIAdd(S);var U=S.redAdd(S);t=A.redSqr().redISub(U),r=this.y.redAdd(this.z).redSqr().redISub(_).redISub(g);var W=_.redSqr();W=W.redIAdd(W),W=W.redIAdd(W),W=W.redIAdd(W),e=A.redMul(S.redISub(t)).redISub(W)}return this.curve.jpoint(t,e,r)},Pr.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),c=r.redSqr(),l=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),f=e.redAdd(e);f=f.redIAdd(f);var h=f.redMul(c),g=l.redSqr().redISub(h.redAdd(h)),_=h.redISub(g),E=c.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=l.redMul(_).redISub(E),S=r.redAdd(r).redMul(n);return this.curve.jpoint(g,A,S)},Pr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),c=this.x.redAdd(e).redSqr().redISub(t).redISub(n);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(o);var l=c.redSqr(),f=n.redIAdd(n);f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var h=i.redIAdd(c).redSqr().redISub(o).redISub(l).redISub(f),g=e.redMul(h);g=g.redIAdd(g),g=g.redIAdd(g);var _=this.x.redMul(l).redISub(g);_=_.redIAdd(_),_=_.redIAdd(_);var E=this.y.redMul(h.redMul(f.redISub(h)).redISub(c.redMul(l)));E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=this.z.redAdd(c).redSqr().redISub(r).redISub(l);return this.curve.jpoint(_,E,A)},Pr.prototype.mul=function(t,e){return t=new st(t,e),this.curve._wnafMul(this,t)},Pr.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)!==0)return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)===0},Pr.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(this.x.cmp(r)===0)return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Pr.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)+">"},Pr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ol=Jo(function(t,e){var r=e;r.base=Hs,r.short=rE,r.mont=null,r.edwards=null}),Pl=Jo(function(t,e){var r=e,n=vn.assert;function i(l){l.type==="short"?this.curve=new Ol.short(l):l.type==="edwards"?this.curve=new Ol.edwards(l):this.curve=new Ol.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,f){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var h=new i(f);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:h}),h}})}o("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:li.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:li.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:li.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:li.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"]}),o("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:li.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:li.sha256,gRed:!1,g:["9"]}),o("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:li.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=void 0}o("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:li.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function cs(t){if(!(this instanceof cs))return new cs(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Xn.toArray(t.entropy,t.entropyEnc||"hex"),r=Xn.toArray(t.nonce,t.nonceEnc||"hex"),n=Xn.toArray(t.pers,t.persEnc||"hex");xf(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var am=cs;cs.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},cs.prototype._hmac=function(){return new li.hmac(this.hash,this.K)},cs.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},cs.prototype.reseed=function(t,e,r,n){typeof e!="string"&&(n=r,r=e,e=null),t=Xn.toArray(t,e),r=Xn.toArray(r,n),xf(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},cs.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=Xn.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(r),this._reseed++,Xn.encode(o,e)};var Sf=vn.assert;function Rr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Df=Rr;Rr.fromPublic=function(t,e,r){return e instanceof Rr?e:new Rr(t,{pub:e,pubEnc:r})},Rr.fromPrivate=function(t,e,r){return e instanceof Rr?e:new Rr(t,{priv:e,privEnc:r})},Rr.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},Rr.prototype.getPublic=function(t,e){return typeof t=="string"&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Rr.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv},Rr.prototype._importPrivate=function(t,e){this.priv=new st(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Rr.prototype._importPublic=function(t,e){if(t.x||t.y){this.ec.curve.type==="mont"?Sf(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Sf(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,e)},Rr.prototype.derive=function(t){return t.validate()||Sf(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Rr.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Rr.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Rr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var nE=vn.assert;function Ml(t,e){if(t instanceof Ml)return t;this._importDER(t,e)||(nE(t.r&&t.s,"Signature without r or s"),this.r=new st(t.r,16),this.s=new st(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Tl=Ml;function iE(){this.place=0}function Cf(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,c=e.place;o<n;o++,c++)i<<=8,i|=t[c],i>>>=0;return i<=127?!1:(e.place=c,i)}function cm(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}Ml.prototype._importDER=function(t,e){t=vn.toArray(t,e);var r=new iE;if(t[r.place++]!==48)return!1;var n=Cf(t,r);if(n===!1||n+r.place!==t.length||t[r.place++]!==2)return!1;var i=Cf(t,r);if(i===!1)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,t[r.place++]!==2)return!1;var c=Cf(t,r);if(c===!1||t.length!==c+r.place)return!1;var l=t.slice(r.place,c+r.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new st(o),this.s=new st(l),this.recoveryParam=null,!0};function Of(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ml.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=cm(e),r=cm(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];Of(n,e.length),n=n.concat(e),n.push(2),Of(n,r.length);var i=n.concat(r),o=[48];return Of(o,i.length),o=o.concat(i),vn.encode(o,t)};var sE=function(){throw new Error("unsupported")},lm=vn.assert;function Pn(t){if(!(this instanceof Pn))return new Pn(t);typeof t=="string"&&(lm(Object.prototype.hasOwnProperty.call(Pl,t),"Unknown curve "+t),t=Pl[t]),t instanceof Pl.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var oE=Pn;Pn.prototype.keyPair=function(t){return new Df(this,t)},Pn.prototype.keyFromPrivate=function(t,e){return Df.fromPrivate(this,t,e)},Pn.prototype.keyFromPublic=function(t,e){return Df.fromPublic(this,t,e)},Pn.prototype.genKeyPair=function(t){t||(t={});for(var e=new am({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||sE(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new st(2));;){var i=new st(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Pn.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Pn.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new st(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),c=t.toArray("be",i),l=new am({hash:this.hash,entropy:o,nonce:c,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new st(1)),h=0;;h++){var g=n.k?n.k(h):new st(l.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(f)>=0)){var _=this.g.mul(g);if(!_.isInfinity()){var E=_.getX(),A=E.umod(this.n);if(A.cmpn(0)!==0){var S=g.invm(this.n).mul(A.mul(e.getPrivate()).iadd(t));if(S=S.umod(this.n),S.cmpn(0)!==0){var U=(_.getY().isOdd()?1:0)|(E.cmp(A)!==0?2:0);return n.canonical&&S.cmp(this.nh)>0&&(S=this.n.sub(S),U^=1),new Tl({r:A,s:S,recoveryParam:U})}}}}}},Pn.prototype.verify=function(t,e,r,n){t=this._truncateToN(new st(t,16)),r=this.keyFromPublic(r,n),e=new Tl(e,"hex");var i=e.r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c=o.invm(this.n),l=c.mul(t).umod(this.n),f=c.mul(i).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(l,r.getPublic(),f),h.isInfinity()?!1:h.eqXToP(i)):(h=this.g.mulAdd(l,r.getPublic(),f),h.isInfinity()?!1:h.getX().umod(this.n).cmp(i)===0)},Pn.prototype.recoverPubKey=function(t,e,r,n){lm((3&r)===r,"The recovery param is more than two bits"),e=new Tl(e,n);var i=this.n,o=new st(t),c=e.r,l=e.s,f=r&1,h=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");h?c=this.curve.pointFromX(c.add(this.curve.n),f):c=this.curve.pointFromX(c,f);var g=e.r.invm(i),_=i.sub(o).mul(g).umod(i),E=l.mul(g).umod(i);return this.g.mulAdd(_,c,E)},Pn.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Tl(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var aE=Jo(function(t,e){var r=e;r.version="6.5.4",r.utils=vn,r.rand=function(){throw new Error("unsupported")},r.curve=Ol,r.curves=Pl,r.ec=oE,r.eddsa=null}),cE=aE.ec;const lE="signing-key/5.7.0",Pf=new ut(lE);let Mf=null;function vi(){return Mf||(Mf=new cE("secp256k1")),Mf}class uE{constructor(e){ec(this,"curve","secp256k1"),ec(this,"privateKey",kr(e)),W_(this.privateKey)!==32&&Pf.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=vi().keyFromPrivate(or(this.privateKey));ec(this,"publicKey","0x"+r.getPublic(!1,"hex")),ec(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ec(this,"_isSigningKey",!0)}_addPoint(e){const r=vi().keyFromPublic(or(this.publicKey)),n=vi().keyFromPublic(or(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=vi().keyFromPrivate(or(this.privateKey)),n=or(e);n.length!==32&&Pf.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return yg({recoveryParam:i.recoveryParam,r:ci("0x"+i.r.toString(16),32),s:ci("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=vi().keyFromPrivate(or(this.privateKey)),n=vi().keyFromPublic(or(um(e)));return ci("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function hE(t,e){const r=yg(e),n={r:or(r.r),s:or(r.s)};return"0x"+vi().recoverPubKey(or(t),n,r.recoveryParam).encode("hex",!1)}function um(t,e){const r=or(t);if(r.length===32){const n=new uE(r);return e?"0x"+vi().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?kr(r):"0x"+vi().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+vi().keyFromPublic(r).getPublic(!0,"hex"):kr(r)}return Pf.throwArgumentError("invalid public or private key","key","[REDACTED]")}const fE="transactions/5.7.0";new ut(fE);var hm;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(hm||(hm={}));function dE(t){const e=um(t);return A8(wg(hf(wg(e,1)),12))}function pE(t,e){return dE(hE(or(t),e))}const gE="https://rpc.walletconnect.com/v1";async function mE(t,e,r,n,i,o){switch(r.t){case"eip191":return vE(t,e,r.s);case"eip1271":return await wE(t,e,r.s,n,i,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function vE(t,e,r){return pE(Rg(e),r).toLowerCase()===t.toLowerCase()}async function wE(t,e,r,n,i,o){try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",f="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),g=Rg(e).substring(2),_=c+g+l+f+h,E=await fetch(`${o||gE}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:yE(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:_},"latest"]})}),{result:A}=await E.json();return A?A.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function yE(){return Date.now()+Math.floor(Math.random()*1e3)}var bE=Object.defineProperty,_E=Object.defineProperties,EE=Object.getOwnPropertyDescriptors,fm=Object.getOwnPropertySymbols,AE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,dm=(t,e,r)=>e in t?bE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,IE=(t,e)=>{for(var r in e||(e={}))AE.call(e,r)&&dm(t,r,e[r]);if(fm)for(var r of fm(e))xE.call(e,r)&&dm(t,r,e[r]);return t},SE=(t,e)=>_E(t,EE(e));const DE="did:pkh:",Tf=t=>t?.split(":"),pm=t=>{const e=t&&Tf(t);if(e)return t.includes(DE)?e[3]:e[1]},gm=t=>{const e=t&&Tf(t);if(e)return e[2]+":"+e[3]},$l=t=>{const e=t&&Tf(t);if(e)return e.pop()};async function mm(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,o=vm(i,i.iss),c=$l(i.iss);return await mE(c,o,n,pm(i.iss),r)}const vm=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=$l(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const o=`URI: ${t.aud||t.uri}`,c=`Version: ${t.version}`,l=`Chain ID: ${pm(e)}`,f=`Nonce: ${t.nonce}`,h=`Issued At: ${t.iat}`,g=t.resources?`Resources:${t.resources.map(E=>`
23
+ - ${E}`).join("")}`:void 0,_=Nl(t.resources);if(_){const E=ic(_);i=LE(i,E)}return[r,n,"",i,"",o,c,l,f,h,g].filter(E=>E!=null).join(`
24
+ `)};function CE(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function OE(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Ks(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const o=n[i];if(!Array.isArray(o))throw new Error(`Ability limits ${i} must be an array of objects, found: ${o}`);if(!o.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);o.forEach(c=>{if(typeof c!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${c}`)})})})}function PE(t,e,r,n={}){return r?.sort((i,o)=>i.localeCompare(o)),{att:{[t]:ME(e,r,n)}}}function ME(t,e,r={}){e=e?.sort((i,o)=>i.localeCompare(o));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function wm(t){return Ks(t),`urn:recap:${CE(t).replace(/=/g,"")}`}function ic(t){const e=OE(t.replace("urn:recap:",""));return Ks(e),e}function TE(t,e,r){const n=PE(t,e,r);return wm(n)}function $E(t){return t&&t.includes("urn:recap:")}function NE(t,e){const r=ic(t),n=ic(e),i=RE(r,n);return wm(i)}function RE(t,e){Ks(t),Ks(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,o)=>i.localeCompare(o)),n={att:{}};return r.forEach(i=>{var o,c;Object.keys(((o=t.att)==null?void 0:o[i])||{}).concat(Object.keys(((c=e.att)==null?void 0:c[i])||{})).sort((l,f)=>l.localeCompare(f)).forEach(l=>{var f,h;n.att[i]=SE(IE({},n.att[i]),{[l]:((f=t.att[i])==null?void 0:f[l])||((h=e.att[i])==null?void 0:h[l])})})}),n}function LE(t="",e){Ks(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(l=>{const f=Object.keys(e.att[l]).map(_=>({ability:_.split("/")[0],action:_.split("/")[1]}));f.sort((_,E)=>_.action.localeCompare(E.action));const h={};f.forEach(_=>{h[_.ability]||(h[_.ability]=[]),h[_.ability].push(_.action)});const g=Object.keys(h).map(_=>(i++,`(${i}) '${_}': '${h[_].join("', '")}' for '${l}'.`));n.push(g.join(", ").replace(".,","."))});const o=n.join(" "),c=`${r}${o}`;return`${t?t+" ":""}${c}`}function ym(t){var e;const r=ic(t);Ks(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function bm(t){const e=ic(t);Ks(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var o;(o=i?.[0])!=null&&o.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function Nl(t){if(!t)return;const e=t?.[t.length-1];return $E(e)?e:void 0}const _m="base10",zr="base16",$f="base64pad",Nf="utf8",Em=0,ls=1,BE=0,Am=1,Rf=12,Lf=32;function UE(){const t=tf.generateKeyPair();return{privateKey:jr(t.secretKey,zr),publicKey:jr(t.publicKey,zr)}}function Bf(){const t=Bo.randomBytes(Lf);return jr(t,zr)}function FE(t,e){const r=tf.sharedKey(Xr(t,zr),Xr(e,zr),!0),n=new H6(ml.SHA256,r).expand(Lf);return jr(n,zr)}function Rl(t){const e=ml.hash(Xr(t,zr));return jr(e,zr)}function Ws(t){const e=ml.hash(Xr(t,Nf));return jr(e,zr)}function jE(t){return Xr(`${t}`,_m)}function sc(t){return Number(jr(t,_m))}function kE(t){const e=jE(typeof t.type<"u"?t.type:Em);if(sc(e)===ls&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Xr(t.senderPublicKey,zr):void 0,n=typeof t.iv<"u"?Xr(t.iv,zr):Bo.randomBytes(Rf),i=new Gh.ChaCha20Poly1305(Xr(t.symKey,zr)).seal(n,Xr(t.message,Nf));return zE({type:e,sealed:i,iv:n,senderPublicKey:r})}function qE(t){const e=new Gh.ChaCha20Poly1305(Xr(t.symKey,zr)),{sealed:r,iv:n}=Ll(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return jr(i,Nf)}function zE(t){if(sc(t.type)===ls){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return jr(nf([t.type,t.senderPublicKey,t.iv,t.sealed]),$f)}return jr(nf([t.type,t.iv,t.sealed]),$f)}function Ll(t){const e=Xr(t,$f),r=e.slice(BE,Am),n=Am;if(sc(r)===ls){const l=n+Lf,f=l+Rf,h=e.slice(n,l),g=e.slice(l,f),_=e.slice(f);return{type:r,sealed:_,iv:g,senderPublicKey:h}}const i=n+Rf,o=e.slice(n,i),c=e.slice(i);return{type:r,sealed:c,iv:o}}function HE(t,e){const r=Ll(t);return xm({type:sc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?jr(r.senderPublicKey,zr):void 0,receiverPublicKey:e?.receiverPublicKey})}function xm(t){const e=t?.type||Em;if(e===ls){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Im(t){return t.type===ls&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}const KE="irn";function Uf(t){return t?.relay||{protocol:KE}}function Bl(t){const e=b_[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var WE=Object.defineProperty,VE=Object.defineProperties,GE=Object.getOwnPropertyDescriptors,Sm=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,Dm=(t,e,r)=>e in t?WE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cm=(t,e)=>{for(var r in e||(e={}))YE.call(e,r)&&Dm(t,r,e[r]);if(Sm)for(var r of Sm(e))JE.call(e,r)&&Dm(t,r,e[r]);return t},QE=(t,e)=>VE(t,GE(e));function ZE(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const o=i.replace(n,""),c=t[i];r[o]=c}}),r}function Om(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),o=typeof r<"u"?t.substring(r):"",c=Ha.parse(o),l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:XE(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:ZE(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function XE(t){return t.startsWith("//")?t.substring(2):t}function eA(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const o=r+e+i;t[i]&&(n[o]=t[i])}),n}function tA(t){return`${t.protocol}:${t.topic}@${t.version}?`+Ha.stringify(Cm(QE(Cm({symKey:t.symKey},eA(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Qo(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function rA(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Qo(r.accounts))}),e}function nA(t,e){const r=[];return Object.values(t).forEach(n=>{Qo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function iA(t,e){const r=[];return Object.values(t).forEach(n=>{Qo(n.accounts).includes(e)&&r.push(...n.events)}),r}function Ff(t){return t.includes(":")}function oc(t){return Ff(t)?t.split(":")[0]:t}function sA(t){const e={};return t?.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function Pm(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=sA(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=yl(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const oA={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}},aA={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 me(t,e){const{message:r,code:n}=aA[t];return{message:e?`${r} ${e}`:r,code:n}}function Ut(t,e){const{message:r,code:n}=oA[t];return{message:e?`${r} ${e}`:r,code:n}}function wi(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function ac(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Hr(t){return typeof t>"u"}function ur(t,e){return e&&Hr(t)?!0:typeof t=="string"&&!!t.trim().length}function jf(t,e){return e&&Hr(t)?!0:typeof t=="number"&&!isNaN(t)}function cA(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let o=!0;return ks(i,n)?(n.forEach(c=>{const{accounts:l,methods:f,events:h}=t.namespaces[c],g=Qo(l),_=r[c];(!ks(tg(c,_),g)||!ks(_.methods,f)||!ks(_.events,h))&&(o=!1)}),o):!1}function Ul(t){return ur(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function lA(t){if(ur(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Ul(r)}}return!1}function uA(t){if(ur(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function hA(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function fA(t){return t?.topic}function dA(t,e){let r=null;return ur(t?.publicKey,!1)||(r=me("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Mm(t){let e=!0;return wi(t)?t.length&&(e=t.every(r=>ur(r,!1))):e=!1,e}function pA(t,e,r){let n=null;return wi(e)&&e.length?e.forEach(i=>{n||Ul(i)||(n=Ut("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Ul(t)||(n=Ut("UNSUPPORTED_CHAINS",`${r}, 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"] }`)),n}function gA(t,e,r){let n=null;return Object.entries(t).forEach(([i,o])=>{if(n)return;const c=pA(i,tg(i,o),`${e} ${r}`);c&&(n=c)}),n}function mA(t,e){let r=null;return wi(t)?t.forEach(n=>{r||lA(n)||(r=Ut("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ut("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function vA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=mA(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function wA(t,e){let r=null;return Mm(t?.methods)?Mm(t?.events)||(r=Ut("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ut("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Tm(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=wA(n,`${e}, namespace`);i&&(r=i)}),r}function yA(t,e,r){let n=null;if(t&&ac(t)){const i=Tm(t,e);i&&(n=i);const o=gA(t,e,r);o&&(n=o)}else n=me("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function kf(t,e){let r=null;if(t&&ac(t)){const n=Tm(t,e);n&&(r=n);const i=vA(t,e);i&&(r=i)}else r=me("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function $m(t){return ur(t.protocol,!0)}function bA(t,e){let r=!1;return e&&!t?r=!0:t&&wi(t)&&t.length&&t.forEach(n=>{r=$m(n)}),r}function _A(t){return typeof t=="number"}function rn(t){return typeof t<"u"&&typeof t!==null}function EA(t){return!(!t||typeof t!="object"||!t.code||!jf(t.code,!1)||!t.message||!ur(t.message,!1))}function AA(t){return!(Hr(t)||!ur(t.method,!1))}function xA(t){return!(Hr(t)||Hr(t.result)&&Hr(t.error)||!jf(t.id,!1)||!ur(t.jsonrpc,!1))}function IA(t){return!(Hr(t)||!ur(t.name,!1))}function Nm(t,e){return!(!Ul(e)||!rA(t).includes(e))}function SA(t,e,r){return ur(r,!1)?nA(t,e).includes(r):!1}function DA(t,e,r){return ur(r,!1)?iA(t,e).includes(r):!1}function Rm(t,e,r){let n=null;const i=CA(t),o=OA(e),c=Object.keys(i),l=Object.keys(o),f=Lm(Object.keys(t)),h=Lm(Object.keys(e)),g=f.filter(_=>!h.includes(_));return g.length&&(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
25
+ Required: ${g.toString()}
26
+ Received: ${Object.keys(e).toString()}`)),ks(c,l)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
27
27
  Required: ${c.toString()}
28
- Approved: ${l.toString()}`)),Object.keys(e).forEach(_=>{if(!_.includes(":")||n)return;const E=Xo(e[_].accounts);E.includes(_)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${_}
28
+ Approved: ${l.toString()}`)),Object.keys(e).forEach(_=>{if(!_.includes(":")||n)return;const E=Qo(e[_].accounts);E.includes(_)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${_}
29
29
  Required: ${_}
30
- Approved: ${E.toString()}`))}),c.forEach(_=>{n||(qs(i[_].methods,s[_].methods)?qs(i[_].events,s[_].events)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${_}`)):n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${_}`))}),n}function $A(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function Lm(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function NA(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Xo(t[r].accounts);n?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function RA(t,e){return Bf(t,!1)&&t<=e.max&&t>=e.min}function Bm(){const t=Ya();return new Promise(e=>{switch(t){case dn.browser:e(LA());break;case dn.reactNative:e(BA());break;case dn.node:e(UA());break;default:e(!0)}})}function LA(){return ko()&&navigator?.onLine}async function BA(){if(jo()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t?.isConnected}return!0}function UA(){return!0}function FA(t){switch(Ya()){case dn.browser:jA(t);break;case dn.reactNative:kA(t);break}}function jA(t){!jo()&&ko()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function kA(t){jo()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const Ff={};class lc{static get(e){return Ff[e]}static set(e,r){Ff[e]=r}static delete(e){delete Ff[e]}}const qA=/"(?:_|\\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*:/,zA=/"(?: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*:/,HA=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function KA(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){WA(t);return}return e}function WA(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Fl(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!HA.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(qA.test(t)||zA.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,KA)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function VA(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function _r(t,...e){try{return VA(t(...e))}catch(r){return Promise.reject(r)}}function GA(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function YA(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function jl(t){if(GA(t))return String(t);if(YA(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return jl(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Um(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const jf="base64:";function JA(t){if(typeof t=="string")return t;Um();const e=Buffer.from(t).toString("base64");return jf+e}function QA(t){return typeof t!="string"||!t.startsWith(jf)?t:(Um(),Buffer.from(t.slice(jf.length),"base64"))}function nn(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function ZA(...t){return nn(t.join(":"))}function kl(t){return t=nn(t),t?t+":":""}function jF(t){return t}const XA="memory",e7=()=>{const t=new Map;return{name:XA,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)||null},getItemRaw(e){return t.get(e)||null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}};function t7(t={}){const e={mounts:{"":t.driver||e7()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=h=>{for(const m of e.mountpoints)if(h.startsWith(m))return{base:m,relativeKey:h.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:h,driver:e.mounts[""]}},n=(h,m)=>e.mountpoints.filter(_=>_.startsWith(h)||m&&h.startsWith(_)).map(_=>({relativeBase:h.length>_.length?h.slice(_.length):void 0,mountpoint:_,driver:e.mounts[_]})),i=(h,m)=>{if(e.watching){m=nn(m);for(const _ of e.watchListeners)_(h,m)}},s=async()=>{if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=await Fm(e.mounts[h],i,h)}},c=async()=>{if(e.watching){for(const h in e.unwatch)await e.unwatch[h]();e.unwatch={},e.watching=!1}},l=(h,m,_)=>{const E=new Map,A=I=>{let R=E.get(I.base);return R||(R={driver:I.driver,base:I.base,items:[]},E.set(I.base,R)),R};for(const I of h){const R=typeof I=="string",W=nn(R?I:I.key),Y=R?void 0:I.value,F=R||!I.options?m:{...m,...I.options},z=r(W);A(z).items.push({key:W,value:Y,relativeKey:z.relativeKey,options:F})}return Promise.all([...E.values()].map(I=>_(I))).then(I=>I.flat())},f={hasItem(h,m={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return _r(E.hasItem,_,m)},getItem(h,m={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return _r(E.getItem,_,m).then(A=>Fl(A))},getItems(h,m){return l(h,m,_=>_.driver.getItems?_r(_.driver.getItems,_.items.map(E=>({key:E.relativeKey,options:E.options})),m).then(E=>E.map(A=>({key:ZA(_.base,A.key),value:Fl(A.value)}))):Promise.all(_.items.map(E=>_r(_.driver.getItem,E.relativeKey,E.options).then(A=>({key:E.key,value:Fl(A)})))))},getItemRaw(h,m={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return E.getItemRaw?_r(E.getItemRaw,_,m):_r(E.getItem,_,m).then(A=>QA(A))},async setItem(h,m,_={}){if(m===void 0)return f.removeItem(h);h=nn(h);const{relativeKey:E,driver:A}=r(h);A.setItem&&(await _r(A.setItem,E,jl(m),_),A.watch||i("update",h))},async setItems(h,m){await l(h,m,async _=>{_.driver.setItems&&await _r(_.driver.setItems,_.items.map(E=>({key:E.relativeKey,value:jl(E.value),options:E.options})),m),_.driver.setItem&&await Promise.all(_.items.map(E=>_r(_.driver.setItem,E.relativeKey,jl(E.value),E.options)))})},async setItemRaw(h,m,_={}){if(m===void 0)return f.removeItem(h,_);h=nn(h);const{relativeKey:E,driver:A}=r(h);if(A.setItemRaw)await _r(A.setItemRaw,E,m,_);else if(A.setItem)await _r(A.setItem,E,JA(m),_);else return;A.watch||i("update",h)},async removeItem(h,m={}){typeof m=="boolean"&&(m={removeMeta:m}),h=nn(h);const{relativeKey:_,driver:E}=r(h);E.removeItem&&(await _r(E.removeItem,_,m),(m.removeMeta||m.removeMata)&&await _r(E.removeItem,_+"$",m),E.watch||i("remove",h))},async getMeta(h,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),h=nn(h);const{relativeKey:_,driver:E}=r(h),A=Object.create(null);if(E.getMeta&&Object.assign(A,await _r(E.getMeta,_,m)),!m.nativeOnly){const I=await _r(E.getItem,_+"$",m).then(R=>Fl(R));I&&typeof I=="object"&&(typeof I.atime=="string"&&(I.atime=new Date(I.atime)),typeof I.mtime=="string"&&(I.mtime=new Date(I.mtime)),Object.assign(A,I))}return A},setMeta(h,m,_={}){return this.setItem(h+"$",m,_)},removeMeta(h,m={}){return this.removeItem(h+"$",m)},async getKeys(h,m={}){h=kl(h);const _=n(h,!0);let E=[];const A=[];for(const I of _){const W=(await _r(I.driver.getKeys,I.relativeBase,m)).map(Y=>I.mountpoint+nn(Y)).filter(Y=>!E.some(F=>Y.startsWith(F)));A.push(...W),E=[I.mountpoint,...E.filter(Y=>!Y.startsWith(I.mountpoint))]}return h?A.filter(I=>I.startsWith(h)&&!I.endsWith("$")):A.filter(I=>!I.endsWith("$"))},async clear(h,m={}){h=kl(h),await Promise.all(n(h,!1).map(async _=>{if(_.driver.clear)return _r(_.driver.clear,_.relativeBase,m);if(_.driver.removeItem){const E=await _.driver.getKeys(_.relativeBase||"",m);return Promise.all(E.map(A=>_.driver.removeItem(A,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>jm(h)))},async watch(h){return await s(),e.watchListeners.push(h),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==h),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(h,m){if(h=kl(h),h&&e.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(e.mountpoints.push(h),e.mountpoints.sort((_,E)=>E.length-_.length)),e.mounts[h]=m,e.watching&&Promise.resolve(Fm(m,i,h)).then(_=>{e.unwatch[h]=_}).catch(console.error),f},async unmount(h,m=!0){h=kl(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),m&&await jm(e.mounts[h]),e.mountpoints=e.mountpoints.filter(_=>_!==h),delete e.mounts[h])},getMount(h=""){h=nn(h)+":";const m=r(h);return{driver:m.driver,base:m.base}},getMounts(h="",m={}){return h=nn(h),n(h,m.parents).map(E=>({driver:E.driver,base:E.mountpoint}))}};return f}function Fm(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function jm(t){typeof t.dispose=="function"&&await _r(t.dispose)}function Gs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function km(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Gs(r);return(i,s)=>n.then(c=>s(c.transaction(e,i).objectStore(e)))}let kf;function uc(){return kf||(kf=km("keyval-store","keyval")),kf}function qm(t,e=uc()){return e("readonly",r=>Gs(r.get(t)))}function r7(t,e,r=uc()){return r("readwrite",n=>(n.put(e,t),Gs(n.transaction)))}function n7(t,e=uc()){return e("readwrite",r=>(r.delete(t),Gs(r.transaction)))}function i7(t=uc()){return t("readwrite",e=>(e.clear(),Gs(e.transaction)))}function s7(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Gs(t.transaction)}function o7(t=uc()){return t("readonly",e=>{if(e.getAllKeys)return Gs(e.getAllKeys());const r=[];return s7(e,n=>r.push(n.key)).then(()=>r)})}const a7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),c7=t=>{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,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function hc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return c7(t)}catch{return t}}function Ui(t){return typeof t=="string"?t:a7(t)||""}const l7="idb-keyval";var u7=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=km(t.dbName,t.storeName)),{name:l7,options:t,async hasItem(i){return!(typeof await qm(r(i),n)>"u")},async getItem(i){return await qm(r(i),n)??null},setItem(i,s){return r7(r(i),s,n)},removeItem(i){return n7(r(i),n)},getKeys(){return o7(n)},clear(){return i7(n)}}};const h7="WALLET_CONNECT_V2_INDEXED_DB",f7="keyvaluestorage";class d7{constructor(){this.indexedDb=t7({driver:u7({dbName:h7,storeName:f7})})}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 r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Ui(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var qf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ql={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof qf<"u"&&qf.localStorage?ql.exports=qf.localStorage:typeof window<"u"&&window.localStorage?ql.exports=window.localStorage:ql.exports=new e})();function p7(t){var e;return[t[0],hc((e=t[1])!=null?e:"")]}class g7{constructor(){this.localStorage=ql.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(p7)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return hc(r)}async setItem(e,r){this.localStorage.setItem(e,Ui(r))}async removeItem(e){this.localStorage.removeItem(e)}}const m7="wc_storage_version",zm=1,v7=async(t,e,r)=>{const n=m7,i=await e.getItem(n);if(i&&i>=zm){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const c=[];for(;s.length;){const l=s.shift();if(!l)continue;const f=l.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const h=await t.getItem(l);await e.setItem(l,h),c.push(l)}}await e.setItem(n,zm),r(e),y7(t,c)},y7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class w7{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new g7;this.storage=e;try{const r=new d7;v7(e,r,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,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}var ea={};/*! *****************************************************************************
30
+ Approved: ${E.toString()}`))}),c.forEach(_=>{n||(ks(i[_].methods,o[_].methods)?ks(i[_].events,o[_].events)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${_}`)):n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${_}`))}),n}function CA(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function Lm(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function OA(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Qo(t[r].accounts);n?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(o=>o.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function PA(t,e){return jf(t,!1)&&t<=e.max&&t>=e.min}function Bm(){const t=Ga();return new Promise(e=>{switch(t){case gn.browser:e(MA());break;case gn.reactNative:e(TA());break;case gn.node:e($A());break;default:e(!0)}})}function MA(){return Fo()&&navigator?.onLine}async function TA(){if(Uo()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t?.isConnected}return!0}function $A(){return!0}function NA(t){switch(Ga()){case gn.browser:RA(t);break;case gn.reactNative:LA(t);break}}function RA(t){!Uo()&&Fo()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function LA(t){Uo()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const qf={};class cc{static get(e){return qf[e]}static set(e,r){qf[e]=r}static delete(e){delete qf[e]}}const BA=/"(?:_|\\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*:/,UA=/"(?: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*:/,FA=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function jA(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){kA(t);return}return e}function kA(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Fl(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!FA.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(BA.test(t)||UA.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,jA)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function qA(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function _r(t,...e){try{return qA(t(...e))}catch(r){return Promise.reject(r)}}function zA(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function HA(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function jl(t){if(zA(t))return String(t);if(HA(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return jl(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Um(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const zf="base64:";function KA(t){if(typeof t=="string")return t;Um();const e=Buffer.from(t).toString("base64");return zf+e}function WA(t){return typeof t!="string"||!t.startsWith(zf)?t:(Um(),Buffer.from(t.slice(zf.length),"base64"))}function nn(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function VA(...t){return nn(t.join(":"))}function kl(t){return t=nn(t),t?t+":":""}function IF(t){return t}const GA="memory",YA=()=>{const t=new Map;return{name:GA,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)||null},getItemRaw(e){return t.get(e)||null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}};function JA(t={}){const e={mounts:{"":t.driver||YA()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=h=>{for(const g of e.mountpoints)if(h.startsWith(g))return{base:g,relativeKey:h.slice(g.length),driver:e.mounts[g]};return{base:"",relativeKey:h,driver:e.mounts[""]}},n=(h,g)=>e.mountpoints.filter(_=>_.startsWith(h)||g&&h.startsWith(_)).map(_=>({relativeBase:h.length>_.length?h.slice(_.length):void 0,mountpoint:_,driver:e.mounts[_]})),i=(h,g)=>{if(e.watching){g=nn(g);for(const _ of e.watchListeners)_(h,g)}},o=async()=>{if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=await Fm(e.mounts[h],i,h)}},c=async()=>{if(e.watching){for(const h in e.unwatch)await e.unwatch[h]();e.unwatch={},e.watching=!1}},l=(h,g,_)=>{const E=new Map,A=S=>{let U=E.get(S.base);return U||(U={driver:S.driver,base:S.base,items:[]},E.set(S.base,U)),U};for(const S of h){const U=typeof S=="string",W=nn(U?S:S.key),Y=U?void 0:S.value,B=U||!S.options?g:{...g,...S.options},z=r(W);A(z).items.push({key:W,value:Y,relativeKey:z.relativeKey,options:B})}return Promise.all([...E.values()].map(S=>_(S))).then(S=>S.flat())},f={hasItem(h,g={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return _r(E.hasItem,_,g)},getItem(h,g={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return _r(E.getItem,_,g).then(A=>Fl(A))},getItems(h,g){return l(h,g,_=>_.driver.getItems?_r(_.driver.getItems,_.items.map(E=>({key:E.relativeKey,options:E.options})),g).then(E=>E.map(A=>({key:VA(_.base,A.key),value:Fl(A.value)}))):Promise.all(_.items.map(E=>_r(_.driver.getItem,E.relativeKey,E.options).then(A=>({key:E.key,value:Fl(A)})))))},getItemRaw(h,g={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return E.getItemRaw?_r(E.getItemRaw,_,g):_r(E.getItem,_,g).then(A=>WA(A))},async setItem(h,g,_={}){if(g===void 0)return f.removeItem(h);h=nn(h);const{relativeKey:E,driver:A}=r(h);A.setItem&&(await _r(A.setItem,E,jl(g),_),A.watch||i("update",h))},async setItems(h,g){await l(h,g,async _=>{_.driver.setItems&&await _r(_.driver.setItems,_.items.map(E=>({key:E.relativeKey,value:jl(E.value),options:E.options})),g),_.driver.setItem&&await Promise.all(_.items.map(E=>_r(_.driver.setItem,E.relativeKey,jl(E.value),E.options)))})},async setItemRaw(h,g,_={}){if(g===void 0)return f.removeItem(h,_);h=nn(h);const{relativeKey:E,driver:A}=r(h);if(A.setItemRaw)await _r(A.setItemRaw,E,g,_);else if(A.setItem)await _r(A.setItem,E,KA(g),_);else return;A.watch||i("update",h)},async removeItem(h,g={}){typeof g=="boolean"&&(g={removeMeta:g}),h=nn(h);const{relativeKey:_,driver:E}=r(h);E.removeItem&&(await _r(E.removeItem,_,g),(g.removeMeta||g.removeMata)&&await _r(E.removeItem,_+"$",g),E.watch||i("remove",h))},async getMeta(h,g={}){typeof g=="boolean"&&(g={nativeOnly:g}),h=nn(h);const{relativeKey:_,driver:E}=r(h),A=Object.create(null);if(E.getMeta&&Object.assign(A,await _r(E.getMeta,_,g)),!g.nativeOnly){const S=await _r(E.getItem,_+"$",g).then(U=>Fl(U));S&&typeof S=="object"&&(typeof S.atime=="string"&&(S.atime=new Date(S.atime)),typeof S.mtime=="string"&&(S.mtime=new Date(S.mtime)),Object.assign(A,S))}return A},setMeta(h,g,_={}){return this.setItem(h+"$",g,_)},removeMeta(h,g={}){return this.removeItem(h+"$",g)},async getKeys(h,g={}){h=kl(h);const _=n(h,!0);let E=[];const A=[];for(const S of _){const W=(await _r(S.driver.getKeys,S.relativeBase,g)).map(Y=>S.mountpoint+nn(Y)).filter(Y=>!E.some(B=>Y.startsWith(B)));A.push(...W),E=[S.mountpoint,...E.filter(Y=>!Y.startsWith(S.mountpoint))]}return h?A.filter(S=>S.startsWith(h)&&!S.endsWith("$")):A.filter(S=>!S.endsWith("$"))},async clear(h,g={}){h=kl(h),await Promise.all(n(h,!1).map(async _=>{if(_.driver.clear)return _r(_.driver.clear,_.relativeBase,g);if(_.driver.removeItem){const E=await _.driver.getKeys(_.relativeBase||"",g);return Promise.all(E.map(A=>_.driver.removeItem(A,g)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>jm(h)))},async watch(h){return await o(),e.watchListeners.push(h),async()=>{e.watchListeners=e.watchListeners.filter(g=>g!==h),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(h,g){if(h=kl(h),h&&e.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(e.mountpoints.push(h),e.mountpoints.sort((_,E)=>E.length-_.length)),e.mounts[h]=g,e.watching&&Promise.resolve(Fm(g,i,h)).then(_=>{e.unwatch[h]=_}).catch(console.error),f},async unmount(h,g=!0){h=kl(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),g&&await jm(e.mounts[h]),e.mountpoints=e.mountpoints.filter(_=>_!==h),delete e.mounts[h])},getMount(h=""){h=nn(h)+":";const g=r(h);return{driver:g.driver,base:g.base}},getMounts(h="",g={}){return h=nn(h),n(h,g.parents).map(E=>({driver:E.driver,base:E.mountpoint}))}};return f}function Fm(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function jm(t){typeof t.dispose=="function"&&await _r(t.dispose)}function Vs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function km(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Vs(r);return(i,o)=>n.then(c=>o(c.transaction(e,i).objectStore(e)))}let Hf;function lc(){return Hf||(Hf=km("keyval-store","keyval")),Hf}function qm(t,e=lc()){return e("readonly",r=>Vs(r.get(t)))}function QA(t,e,r=lc()){return r("readwrite",n=>(n.put(e,t),Vs(n.transaction)))}function ZA(t,e=lc()){return e("readwrite",r=>(r.delete(t),Vs(r.transaction)))}function XA(t=lc()){return t("readwrite",e=>(e.clear(),Vs(e.transaction)))}function e7(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Vs(t.transaction)}function t7(t=lc()){return t("readonly",e=>{if(e.getAllKeys)return Vs(e.getAllKeys());const r=[];return e7(e,n=>r.push(n.key)).then(()=>r)})}const r7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),n7=t=>{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,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function uc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return n7(t)}catch{return t}}function Fi(t){return typeof t=="string"?t:r7(t)||""}const i7="idb-keyval";var s7=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=km(t.dbName,t.storeName)),{name:i7,options:t,async hasItem(i){return!(typeof await qm(r(i),n)>"u")},async getItem(i){return await qm(r(i),n)??null},setItem(i,o){return QA(r(i),o,n)},removeItem(i){return ZA(r(i),n)},getKeys(){return t7(n)},clear(){return XA(n)}}};const o7="WALLET_CONNECT_V2_INDEXED_DB",a7="keyvaluestorage";class c7{constructor(){this.indexedDb=JA({driver:s7({dbName:o7,storeName:a7})})}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 r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Fi(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var Kf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ql={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Kf<"u"&&Kf.localStorage?ql.exports=Kf.localStorage:typeof window<"u"&&window.localStorage?ql.exports=window.localStorage:ql.exports=new e})();function l7(t){var e;return[t[0],uc((e=t[1])!=null?e:"")]}class u7{constructor(){this.localStorage=ql.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(l7)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return uc(r)}async setItem(e,r){this.localStorage.setItem(e,Fi(r))}async removeItem(e){this.localStorage.removeItem(e)}}const h7="wc_storage_version",zm=1,f7=async(t,e,r)=>{const n=h7,i=await e.getItem(n);if(i&&i>=zm){r(e);return}const o=await t.getKeys();if(!o.length){r(e);return}const c=[];for(;o.length;){const l=o.shift();if(!l)continue;const f=l.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const h=await t.getItem(l);await e.setItem(l,h),c.push(l)}}await e.setItem(n,zm),r(e),d7(t,c)},d7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class p7{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new u7;this.storage=e;try{const r=new c7;f7(e,r,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,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}var Zo={};/*! *****************************************************************************
31
31
  Copyright (c) Microsoft Corporation.
32
32
 
33
33
  Permission to use, copy, modify, and/or distribute this software for any
@@ -40,7 +40,7 @@
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 zf=function(t,e){return zf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},zf(t,e)};function b7(t,e){zf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Hf=function(){return Hf=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Hf.apply(this,arguments)};function _7(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function E7(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function A7(t,e){return function(r,n){e(r,n,t)}}function x7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function S7(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function I7(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function D7(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function C7(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Kf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function O7(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Hm(arguments[e]));return t}function P7(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function fc(t){return this instanceof fc?(this.v=t,this):new fc(t)}function M7(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof fc?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function T7(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:fc(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function $7(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Kf=="function"?Kf(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function N7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function R7(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function L7(t){return t&&t.__esModule?t:{default:t}}function B7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function U7(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var F7=Object.freeze({__proto__:null,__extends:b7,get __assign(){return Hf},__rest:_7,__decorate:E7,__param:A7,__metadata:x7,__awaiter:S7,__generator:I7,__createBinding:D7,__exportStar:C7,__values:Kf,__read:Hm,__spread:O7,__spreadArrays:P7,__await:fc,__asyncGenerator:M7,__asyncDelegator:T7,__asyncValues:$7,__makeTemplateObject:N7,__importStar:R7,__importDefault:L7,__classPrivateFieldGet:B7,__classPrivateFieldSet:U7}),zl=Us(F7),dc={},Wf={},pc={};class Ys{}var j7=Object.freeze({__proto__:null,IEvents:Ys}),k7=Us(j7),Km;function q7(){if(Km)return pc;Km=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.IHeartBeat=void 0;const t=k7;class e extends t.IEvents{constructor(n){super()}}return pc.IHeartBeat=e,pc}var Wm;function Vm(){return Wm||(Wm=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),zl.__exportStar(q7(),t)}(Wf)),Wf}var Vf={},Js={},Gm;function z7(){if(Gm)return Js;Gm=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.HEARTBEAT_EVENTS=Js.HEARTBEAT_INTERVAL=void 0;const t=_e;return Js.HEARTBEAT_INTERVAL=t.FIVE_SECONDS,Js.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Js}var Ym;function Jm(){return Ym||(Ym=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),zl.__exportStar(z7(),t)}(Vf)),Vf}var Qm;function H7(){if(Qm)return dc;Qm=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.HeartBeat=void 0;const t=zl,e=Dr.exports,r=_e,n=Vm(),i=Jm();class s extends n.IHeartBeat{constructor(l){super(l),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=l?.interval||i.HEARTBEAT_INTERVAL}static init(l){return t.__awaiter(this,void 0,void 0,function*(){const f=new s(l);return yield f.init(),f})}init(){return t.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(l,f){this.events.on(l,f)}once(l,f){this.events.once(l,f)}off(l,f){this.events.off(l,f)}removeListener(l,f){this.events.removeListener(l,f)}initialize(){return t.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return dc.HeartBeat=s,dc}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=zl;e.__exportStar(H7(),t),e.__exportStar(Vm(),t),e.__exportStar(Jm(),t)})(ea);var Gf,Zm;function K7(){if(Zm)return Gf;Zm=1;function t(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}Gf=e;function e(r,n,i){var s=i&&i.stringify||t,c=1;if(typeof r=="object"&&r!==null){var l=n.length+c;if(l===1)return r;var f=new Array(l);f[0]=s(r);for(var h=1;h<l;h++)f[h]=s(n[h]);return f.join(" ")}if(typeof r!="string")return r;var m=n.length;if(m===0)return r;for(var _="",E=1-c,A=-1,I=r&&r.length||0,R=0;R<I;){if(r.charCodeAt(R)===37&&R+1<I){switch(A=A>-1?A:0,r.charCodeAt(R+1)){case 100:case 102:if(E>=m||n[E]==null)break;A<R&&(_+=r.slice(A,R)),_+=Number(n[E]),A=R+2,R++;break;case 105:if(E>=m||n[E]==null)break;A<R&&(_+=r.slice(A,R)),_+=Math.floor(Number(n[E])),A=R+2,R++;break;case 79:case 111:case 106:if(E>=m||n[E]===void 0)break;A<R&&(_+=r.slice(A,R));var W=typeof n[E];if(W==="string"){_+="'"+n[E]+"'",A=R+2,R++;break}if(W==="function"){_+=n[E].name||"<anonymous>",A=R+2,R++;break}_+=s(n[E]),A=R+2,R++;break;case 115:if(E>=m)break;A<R&&(_+=r.slice(A,R)),_+=String(n[E]),A=R+2,R++;break;case 37:A<R&&(_+=r.slice(A,R)),_+="%",A=R+2,R++,E--;break}++E}++R}return A===-1?r:(A<I&&(_+=r.slice(A)),_)}return Gf}var Yf,Xm;function ev(){if(Xm)return Yf;Xm=1;const t=K7();Yf=i;const e=j().console||{},r={mapHttpRequest:I,mapHttpResponse:I,wrapRequestSerializer:R,wrapResponseSerializer:R,wrapErrorSerializer:R,req:I,res:I,err:E};function n(P,g){return Array.isArray(P)?P.filter(function(Z){return Z!=="!stdSerializers.err"}):P===!0?Object.keys(g):!1}function i(P){P=P||{},P.browser=P.browser||{};const g=P.browser.transmit;if(g&&typeof g.send!="function")throw Error("pino: transmit option must have a send function");const C=P.browser.write||e;P.browser.write&&(P.browser.asObject=!0);const Z=P.serializers||{},J=n(P.browser.serialize,Z);let te=P.browser.serialize;Array.isArray(P.browser.serialize)&&P.browser.serialize.indexOf("!stdSerializers.err")>-1&&(te=!1);const ae=["error","fatal","warn","info","debug","trace"];typeof C=="function"&&(C.error=C.fatal=C.warn=C.info=C.debug=C.trace=C),P.enabled===!1&&(P.level="silent");const p=P.level||"info",d=Object.create(C);d.log||(d.log=W),Object.defineProperty(d,"levelVal",{get:D}),Object.defineProperty(d,"level",{get:M,set:N});const b={transmit:g,serialize:J,asObject:P.browser.asObject,levels:ae,timestamp:A(P)};d.levels=i.levels,d.level=p,d.setMaxListeners=d.getMaxListeners=d.emit=d.addListener=d.on=d.prependListener=d.once=d.prependOnceListener=d.removeListener=d.removeAllListeners=d.listeners=d.listenerCount=d.eventNames=d.write=d.flush=W,d.serializers=Z,d._serialize=J,d._stdErrSerialize=te,d.child=U,g&&(d._logEvent=_());function D(){return this.level==="silent"?1/0:this.levels.values[this.level]}function M(){return this._level}function N(O){if(O!=="silent"&&!this.levels.values[O])throw Error("unknown level "+O);this._level=O,s(b,d,"error","log"),s(b,d,"fatal","error"),s(b,d,"warn","error"),s(b,d,"info","log"),s(b,d,"debug","log"),s(b,d,"trace","log")}function U(O,v){if(!O)throw new Error("missing bindings for child Pino");v=v||{},J&&O.serializers&&(v.serializers=O.serializers);const L=v.serializers;if(J&&L){var oe=Object.assign({},Z,L),de=P.browser.serialize===!0?Object.keys(oe):J;delete O.serializers,f([O],de,oe,this._stdErrSerialize)}function x(ne){this._childLevel=(ne._childLevel|0)+1,this.error=h(ne,O,"error"),this.fatal=h(ne,O,"fatal"),this.warn=h(ne,O,"warn"),this.info=h(ne,O,"info"),this.debug=h(ne,O,"debug"),this.trace=h(ne,O,"trace"),oe&&(this.serializers=oe,this._serialize=de),g&&(this._logEvent=_([].concat(ne._logEvent.bindings,O)))}return x.prototype=this,new x(this)}return d}i.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"}},i.stdSerializers=r,i.stdTimeFunctions=Object.assign({},{nullTime:Y,epochTime:F,unixTime:z,isoTime:$});function s(P,g,C,Z){const J=Object.getPrototypeOf(g);g[C]=g.levelVal>g.levels.values[C]?W:J[C]?J[C]:e[C]||e[Z]||W,c(P,g,C)}function c(P,g,C){!P.transmit&&g[C]===W||(g[C]=function(Z){return function(){const te=P.timestamp(),ae=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var d=0;d<ae.length;d++)ae[d]=arguments[d];if(P.serialize&&!P.asObject&&f(ae,this._serialize,this.serializers,this._stdErrSerialize),P.asObject?Z.call(p,l(this,C,ae,te)):Z.apply(p,ae),P.transmit){const b=P.transmit.level||g.level,D=i.levels.values[b],M=i.levels.values[C];if(M<D)return;m(this,{ts:te,methodLevel:C,methodValue:M,transmitLevel:b,transmitValue:i.levels.values[P.transmit.level||g.level],send:P.transmit.send,val:g.levelVal},ae)}}}(g[C]))}function l(P,g,C,Z){P._serialize&&f(C,P._serialize,P.serializers,P._stdErrSerialize);const J=C.slice();let te=J[0];const ae={};Z&&(ae.time=Z),ae.level=i.levels.values[g];let p=(P._childLevel|0)+1;if(p<1&&(p=1),te!==null&&typeof te=="object"){for(;p--&&typeof J[0]=="object";)Object.assign(ae,J.shift());te=J.length?t(J.shift(),J):void 0}else typeof te=="string"&&(te=t(J.shift(),J));return te!==void 0&&(ae.msg=te),ae}function f(P,g,C,Z){for(const J in P)if(Z&&P[J]instanceof Error)P[J]=i.stdSerializers.err(P[J]);else if(typeof P[J]=="object"&&!Array.isArray(P[J]))for(const te in P[J])g&&g.indexOf(te)>-1&&te in C&&(P[J][te]=C[te](P[J][te]))}function h(P,g,C){return function(){const Z=new Array(1+arguments.length);Z[0]=g;for(var J=1;J<Z.length;J++)Z[J]=arguments[J-1];return P[C].apply(this,Z)}}function m(P,g,C){const Z=g.send,J=g.ts,te=g.methodLevel,ae=g.methodValue,p=g.val,d=P._logEvent.bindings;f(C,P._serialize||Object.keys(P.serializers),P.serializers,P._stdErrSerialize===void 0?!0:P._stdErrSerialize),P._logEvent.ts=J,P._logEvent.messages=C.filter(function(b){return d.indexOf(b)===-1}),P._logEvent.level.label=te,P._logEvent.level.value=ae,Z(te,P._logEvent,p),P._logEvent=_(d)}function _(P){return{ts:0,messages:[],bindings:P||[],level:{label:"",value:0}}}function E(P){const g={type:P.constructor.name,msg:P.message,stack:P.stack};for(const C in P)g[C]===void 0&&(g[C]=P[C]);return g}function A(P){return typeof P.timestamp=="function"?P.timestamp:P.timestamp===!1?Y:F}function I(){return{}}function R(P){return P}function W(){}function Y(){return!1}function F(){return Date.now()}function z(){return Math.round(Date.now()/1e3)}function $(){return new Date(Date.now()).toISOString()}function j(){function P(g){return typeof g<"u"&&g}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 P(self)||P(window)||P(this)||{}}}return Yf}var ls=ev();const W7={level:"info"},gc="custom_context",Jf=1e3*1024;class V7{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 tv{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new V7(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.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 r=this.head;for(;r!==null;)e.push(r.value),r=r.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 r=e.value;return e=e.next,{done:!1,value:r}}}}}class rv{constructor(e,r=Jf){this.level=e??"error",this.levelValue=ls.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new tv(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ls.levels.values.error?console.error(e):r===ls.levels.values.warn?console.warn(e):r===ls.levels.values.debug?console.debug(e):r===ls.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Ui({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new tv(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Ui({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class G7{constructor(e,r=Jf){this.baseChunkLogger=new rv(e,r)}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 r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}}class Y7 extends ka.Writable{constructor(e,r=Jf){super({objectMode:!0}),this.baseChunkLogger=new rv(e,r)}_write(e,r,n){try{this.baseChunkLogger.appendToLogs(e),n()}catch(i){n(i)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var J7=Object.defineProperty,Q7=Object.defineProperties,Z7=Object.getOwnPropertyDescriptors,nv=Object.getOwnPropertySymbols,X7=Object.prototype.hasOwnProperty,ex=Object.prototype.propertyIsEnumerable,iv=(t,e,r)=>e in t?J7(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hl=(t,e)=>{for(var r in e||(e={}))X7.call(e,r)&&iv(t,r,e[r]);if(nv)for(var r of nv(e))ex.call(e,r)&&iv(t,r,e[r]);return t},Kl=(t,e)=>Q7(t,Z7(e));function sv(t){return Kl(Hl({},t),{level:t?.level||W7.level})}function tx(t,e=gc){return t[e]||""}function rx(t,e,r=gc){return t[r]=e,t}function mn(t,e=gc){let r="";return typeof t.bindings>"u"?r=tx(t,e):r=t.bindings().context||"",r}function nx(t,e,r=gc){const n=mn(t,r);return n.trim()?`${n}/${e}`:e}function vn(t,e,r=gc){const n=nx(t,e,r),i=t.child({context:n});return rx(i,n,r)}function ix(t){var e,r;const n=new G7((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ls(Kl(Hl({},t.opts),{level:"trace",browser:Kl(Hl({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function sx(t){var e;const r=new Y7((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ls(Kl(Hl({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function ox(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?ix(t):sx(t)}class ax extends Ys{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class cx extends Ys{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class lx{constructor(e,r){this.logger=e,this.core=r}}class ux extends Ys{constructor(e,r){super(),this.relayer=e,this.logger=r}}class hx extends Ys{constructor(e){super()}}class fx{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class dx extends Ys{constructor(e,r){super(),this.relayer=e,this.logger=r}}class px extends Ys{constructor(e,r){super(),this.core=e,this.logger=r}}class gx{constructor(e,r){this.projectId=e,this.logger=r}}class mx{constructor(e,r){this.projectId=e,this.logger=r}}class vx{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class yx{constructor(e){this.client=e}}var Qf={},ov={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ct,r=fn;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function l(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},l.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},l.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,_=h/536870912|0,E=h<<3,A=h%128<112?128:256;this._buffer[m]=128;for(var I=m+1;I<A-8;I++)this._buffer[I]=0;e.writeUint32BE(_,this._buffer,A-8),e.writeUint32BE(E,this._buffer,A-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,A),this._finished=!0}for(var I=0;I<this.digestLength/8;I++)e.writeUint32BE(this._stateHi[I],f,I*8),e.writeUint32BE(this._stateLo[I],f,I*8+4);return this},l.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},l.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}},l.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(f){r.wipe(f.stateHi),r.wipe(f.stateLo),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},l}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(l,f,h,m,_,E,A){for(var I=h[0],R=h[1],W=h[2],Y=h[3],F=h[4],z=h[5],$=h[6],j=h[7],P=m[0],g=m[1],C=m[2],Z=m[3],J=m[4],te=m[5],ae=m[6],p=m[7],d,b,D,M,N,U,O,v;A>=128;){for(var L=0;L<16;L++){var oe=8*L+E;l[L]=e.readUint32BE(_,oe),f[L]=e.readUint32BE(_,oe+4)}for(var L=0;L<80;L++){var de=I,x=R,ne=W,q=Y,H=F,V=z,y=$,k=j,ie=P,fe=g,ue=C,Oe=Z,Me=J,Ie=te,Pt=ae,ze=p;if(d=j,b=p,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=(F>>>14|J<<32-14)^(F>>>18|J<<32-18)^(J>>>41-32|F<<32-(41-32)),b=(J>>>14|F<<32-14)^(J>>>18|F<<32-18)^(F>>>41-32|J<<32-(41-32)),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=F&z^~F&$,b=J&te^~J&ae,N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=i[L*2],b=i[L*2+1],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=l[L%16],b=f[L%16],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,D=O&65535|v<<16,M=N&65535|U<<16,d=D,b=M,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=(I>>>28|P<<32-28)^(P>>>34-32|I<<32-(34-32))^(P>>>39-32|I<<32-(39-32)),b=(P>>>28|I<<32-28)^(I>>>34-32|P<<32-(34-32))^(I>>>39-32|P<<32-(39-32)),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=I&R^I&W^R&W,b=P&g^P&C^g&C,N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,k=O&65535|v<<16,ze=N&65535|U<<16,d=q,b=Oe,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=D,b=M,N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,q=O&65535|v<<16,Oe=N&65535|U<<16,R=de,W=x,Y=ne,F=q,z=H,$=V,j=y,I=k,g=ie,C=fe,Z=ue,J=Oe,te=Me,ae=Ie,p=Pt,P=ze,L%16===15)for(var oe=0;oe<16;oe++)d=l[oe],b=f[oe],N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=l[(oe+9)%16],b=f[(oe+9)%16],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,D=l[(oe+1)%16],M=f[(oe+1)%16],d=(D>>>1|M<<32-1)^(D>>>8|M<<32-8)^D>>>7,b=(M>>>1|D<<32-1)^(M>>>8|D<<32-8)^(M>>>7|D<<32-7),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,D=l[(oe+14)%16],M=f[(oe+14)%16],d=(D>>>19|M<<32-19)^(M>>>61-32|D<<32-(61-32))^D>>>6,b=(M>>>19|D<<32-19)^(D>>>61-32|M<<32-(61-32))^(M>>>6|D<<32-6),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,l[oe]=O&65535|v<<16,f[oe]=N&65535|U<<16}d=I,b=P,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[0],b=m[0],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[0]=I=O&65535|v<<16,m[0]=P=N&65535|U<<16,d=R,b=g,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[1],b=m[1],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[1]=R=O&65535|v<<16,m[1]=g=N&65535|U<<16,d=W,b=C,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[2],b=m[2],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[2]=W=O&65535|v<<16,m[2]=C=N&65535|U<<16,d=Y,b=Z,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[3],b=m[3],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[3]=Y=O&65535|v<<16,m[3]=Z=N&65535|U<<16,d=F,b=J,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[4],b=m[4],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[4]=F=O&65535|v<<16,m[4]=J=N&65535|U<<16,d=z,b=te,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[5],b=m[5],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[5]=z=O&65535|v<<16,m[5]=te=N&65535|U<<16,d=$,b=ae,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[6],b=m[6],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[6]=$=O&65535|v<<16,m[6]=ae=N&65535|U<<16,d=j,b=p,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[7],b=m[7],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[7]=j=O&65535|v<<16,m[7]=p=N&65535|U<<16,E+=128,A-=128}return E}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}t.hash=c})(ov),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Fo,r=ov,n=fn;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(q){const H=new Float64Array(16);if(q)for(let V=0;V<q.length;V++)H[V]=q[V];return H}const s=new Uint8Array(32);s[0]=9;const c=i(),l=i([1]),f=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),_=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),E=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function A(q,H){for(let V=0;V<16;V++)q[V]=H[V]|0}function I(q){let H=1;for(let V=0;V<16;V++){let y=q[V]+H+65535;H=Math.floor(y/65536),q[V]=y-H*65536}q[0]+=H-1+37*(H-1)}function R(q,H,V){const y=~(V-1);for(let k=0;k<16;k++){const ie=y&(q[k]^H[k]);q[k]^=ie,H[k]^=ie}}function W(q,H){const V=i(),y=i();for(let k=0;k<16;k++)y[k]=H[k];I(y),I(y),I(y);for(let k=0;k<2;k++){V[0]=y[0]-65517;for(let fe=1;fe<15;fe++)V[fe]=y[fe]-65535-(V[fe-1]>>16&1),V[fe-1]&=65535;V[15]=y[15]-32767-(V[14]>>16&1);const ie=V[15]>>16&1;V[14]&=65535,R(y,V,1-ie)}for(let k=0;k<16;k++)q[2*k]=y[k]&255,q[2*k+1]=y[k]>>8}function Y(q,H){let V=0;for(let y=0;y<32;y++)V|=q[y]^H[y];return(1&V-1>>>8)-1}function F(q,H){const V=new Uint8Array(32),y=new Uint8Array(32);return W(V,q),W(y,H),Y(V,y)}function z(q){const H=new Uint8Array(32);return W(H,q),H[0]&1}function $(q,H){for(let V=0;V<16;V++)q[V]=H[2*V]+(H[2*V+1]<<8);q[15]&=32767}function j(q,H,V){for(let y=0;y<16;y++)q[y]=H[y]+V[y]}function P(q,H,V){for(let y=0;y<16;y++)q[y]=H[y]-V[y]}function g(q,H,V){let y,k,ie=0,fe=0,ue=0,Oe=0,Me=0,Ie=0,Pt=0,ze=0,Ce=0,Fe=0,Ee=0,Ae=0,Ge=0,we=0,xe=0,Be=0,be=0,Pe=0,je=0,Te=0,$e=0,lt=0,Re=0,Ne=0,nr=0,dt=0,Et=0,ir=0,St=0,Ot=0,Vr=0,Ye=V[0],He=V[1],Rt=V[2],Je=V[3],Ve=V[4],Mt=V[5],Xe=V[6],et=V[7],Lt=V[8],tt=V[9],Qe=V[10],Ft=V[11],Ze=V[12],ke=V[13],Ht=V[14],rt=V[15];y=H[0],ie+=y*Ye,fe+=y*He,ue+=y*Rt,Oe+=y*Je,Me+=y*Ve,Ie+=y*Mt,Pt+=y*Xe,ze+=y*et,Ce+=y*Lt,Fe+=y*tt,Ee+=y*Qe,Ae+=y*Ft,Ge+=y*Ze,we+=y*ke,xe+=y*Ht,Be+=y*rt,y=H[1],fe+=y*Ye,ue+=y*He,Oe+=y*Rt,Me+=y*Je,Ie+=y*Ve,Pt+=y*Mt,ze+=y*Xe,Ce+=y*et,Fe+=y*Lt,Ee+=y*tt,Ae+=y*Qe,Ge+=y*Ft,we+=y*Ze,xe+=y*ke,Be+=y*Ht,be+=y*rt,y=H[2],ue+=y*Ye,Oe+=y*He,Me+=y*Rt,Ie+=y*Je,Pt+=y*Ve,ze+=y*Mt,Ce+=y*Xe,Fe+=y*et,Ee+=y*Lt,Ae+=y*tt,Ge+=y*Qe,we+=y*Ft,xe+=y*Ze,Be+=y*ke,be+=y*Ht,Pe+=y*rt,y=H[3],Oe+=y*Ye,Me+=y*He,Ie+=y*Rt,Pt+=y*Je,ze+=y*Ve,Ce+=y*Mt,Fe+=y*Xe,Ee+=y*et,Ae+=y*Lt,Ge+=y*tt,we+=y*Qe,xe+=y*Ft,Be+=y*Ze,be+=y*ke,Pe+=y*Ht,je+=y*rt,y=H[4],Me+=y*Ye,Ie+=y*He,Pt+=y*Rt,ze+=y*Je,Ce+=y*Ve,Fe+=y*Mt,Ee+=y*Xe,Ae+=y*et,Ge+=y*Lt,we+=y*tt,xe+=y*Qe,Be+=y*Ft,be+=y*Ze,Pe+=y*ke,je+=y*Ht,Te+=y*rt,y=H[5],Ie+=y*Ye,Pt+=y*He,ze+=y*Rt,Ce+=y*Je,Fe+=y*Ve,Ee+=y*Mt,Ae+=y*Xe,Ge+=y*et,we+=y*Lt,xe+=y*tt,Be+=y*Qe,be+=y*Ft,Pe+=y*Ze,je+=y*ke,Te+=y*Ht,$e+=y*rt,y=H[6],Pt+=y*Ye,ze+=y*He,Ce+=y*Rt,Fe+=y*Je,Ee+=y*Ve,Ae+=y*Mt,Ge+=y*Xe,we+=y*et,xe+=y*Lt,Be+=y*tt,be+=y*Qe,Pe+=y*Ft,je+=y*Ze,Te+=y*ke,$e+=y*Ht,lt+=y*rt,y=H[7],ze+=y*Ye,Ce+=y*He,Fe+=y*Rt,Ee+=y*Je,Ae+=y*Ve,Ge+=y*Mt,we+=y*Xe,xe+=y*et,Be+=y*Lt,be+=y*tt,Pe+=y*Qe,je+=y*Ft,Te+=y*Ze,$e+=y*ke,lt+=y*Ht,Re+=y*rt,y=H[8],Ce+=y*Ye,Fe+=y*He,Ee+=y*Rt,Ae+=y*Je,Ge+=y*Ve,we+=y*Mt,xe+=y*Xe,Be+=y*et,be+=y*Lt,Pe+=y*tt,je+=y*Qe,Te+=y*Ft,$e+=y*Ze,lt+=y*ke,Re+=y*Ht,Ne+=y*rt,y=H[9],Fe+=y*Ye,Ee+=y*He,Ae+=y*Rt,Ge+=y*Je,we+=y*Ve,xe+=y*Mt,Be+=y*Xe,be+=y*et,Pe+=y*Lt,je+=y*tt,Te+=y*Qe,$e+=y*Ft,lt+=y*Ze,Re+=y*ke,Ne+=y*Ht,nr+=y*rt,y=H[10],Ee+=y*Ye,Ae+=y*He,Ge+=y*Rt,we+=y*Je,xe+=y*Ve,Be+=y*Mt,be+=y*Xe,Pe+=y*et,je+=y*Lt,Te+=y*tt,$e+=y*Qe,lt+=y*Ft,Re+=y*Ze,Ne+=y*ke,nr+=y*Ht,dt+=y*rt,y=H[11],Ae+=y*Ye,Ge+=y*He,we+=y*Rt,xe+=y*Je,Be+=y*Ve,be+=y*Mt,Pe+=y*Xe,je+=y*et,Te+=y*Lt,$e+=y*tt,lt+=y*Qe,Re+=y*Ft,Ne+=y*Ze,nr+=y*ke,dt+=y*Ht,Et+=y*rt,y=H[12],Ge+=y*Ye,we+=y*He,xe+=y*Rt,Be+=y*Je,be+=y*Ve,Pe+=y*Mt,je+=y*Xe,Te+=y*et,$e+=y*Lt,lt+=y*tt,Re+=y*Qe,Ne+=y*Ft,nr+=y*Ze,dt+=y*ke,Et+=y*Ht,ir+=y*rt,y=H[13],we+=y*Ye,xe+=y*He,Be+=y*Rt,be+=y*Je,Pe+=y*Ve,je+=y*Mt,Te+=y*Xe,$e+=y*et,lt+=y*Lt,Re+=y*tt,Ne+=y*Qe,nr+=y*Ft,dt+=y*Ze,Et+=y*ke,ir+=y*Ht,St+=y*rt,y=H[14],xe+=y*Ye,Be+=y*He,be+=y*Rt,Pe+=y*Je,je+=y*Ve,Te+=y*Mt,$e+=y*Xe,lt+=y*et,Re+=y*Lt,Ne+=y*tt,nr+=y*Qe,dt+=y*Ft,Et+=y*Ze,ir+=y*ke,St+=y*Ht,Ot+=y*rt,y=H[15],Be+=y*Ye,be+=y*He,Pe+=y*Rt,je+=y*Je,Te+=y*Ve,$e+=y*Mt,lt+=y*Xe,Re+=y*et,Ne+=y*Lt,nr+=y*tt,dt+=y*Qe,Et+=y*Ft,ir+=y*Ze,St+=y*ke,Ot+=y*Ht,Vr+=y*rt,ie+=38*be,fe+=38*Pe,ue+=38*je,Oe+=38*Te,Me+=38*$e,Ie+=38*lt,Pt+=38*Re,ze+=38*Ne,Ce+=38*nr,Fe+=38*dt,Ee+=38*Et,Ae+=38*ir,Ge+=38*St,we+=38*Ot,xe+=38*Vr,k=1,y=ie+k+65535,k=Math.floor(y/65536),ie=y-k*65536,y=fe+k+65535,k=Math.floor(y/65536),fe=y-k*65536,y=ue+k+65535,k=Math.floor(y/65536),ue=y-k*65536,y=Oe+k+65535,k=Math.floor(y/65536),Oe=y-k*65536,y=Me+k+65535,k=Math.floor(y/65536),Me=y-k*65536,y=Ie+k+65535,k=Math.floor(y/65536),Ie=y-k*65536,y=Pt+k+65535,k=Math.floor(y/65536),Pt=y-k*65536,y=ze+k+65535,k=Math.floor(y/65536),ze=y-k*65536,y=Ce+k+65535,k=Math.floor(y/65536),Ce=y-k*65536,y=Fe+k+65535,k=Math.floor(y/65536),Fe=y-k*65536,y=Ee+k+65535,k=Math.floor(y/65536),Ee=y-k*65536,y=Ae+k+65535,k=Math.floor(y/65536),Ae=y-k*65536,y=Ge+k+65535,k=Math.floor(y/65536),Ge=y-k*65536,y=we+k+65535,k=Math.floor(y/65536),we=y-k*65536,y=xe+k+65535,k=Math.floor(y/65536),xe=y-k*65536,y=Be+k+65535,k=Math.floor(y/65536),Be=y-k*65536,ie+=k-1+37*(k-1),k=1,y=ie+k+65535,k=Math.floor(y/65536),ie=y-k*65536,y=fe+k+65535,k=Math.floor(y/65536),fe=y-k*65536,y=ue+k+65535,k=Math.floor(y/65536),ue=y-k*65536,y=Oe+k+65535,k=Math.floor(y/65536),Oe=y-k*65536,y=Me+k+65535,k=Math.floor(y/65536),Me=y-k*65536,y=Ie+k+65535,k=Math.floor(y/65536),Ie=y-k*65536,y=Pt+k+65535,k=Math.floor(y/65536),Pt=y-k*65536,y=ze+k+65535,k=Math.floor(y/65536),ze=y-k*65536,y=Ce+k+65535,k=Math.floor(y/65536),Ce=y-k*65536,y=Fe+k+65535,k=Math.floor(y/65536),Fe=y-k*65536,y=Ee+k+65535,k=Math.floor(y/65536),Ee=y-k*65536,y=Ae+k+65535,k=Math.floor(y/65536),Ae=y-k*65536,y=Ge+k+65535,k=Math.floor(y/65536),Ge=y-k*65536,y=we+k+65535,k=Math.floor(y/65536),we=y-k*65536,y=xe+k+65535,k=Math.floor(y/65536),xe=y-k*65536,y=Be+k+65535,k=Math.floor(y/65536),Be=y-k*65536,ie+=k-1+37*(k-1),q[0]=ie,q[1]=fe,q[2]=ue,q[3]=Oe,q[4]=Me,q[5]=Ie,q[6]=Pt,q[7]=ze,q[8]=Ce,q[9]=Fe,q[10]=Ee,q[11]=Ae,q[12]=Ge,q[13]=we,q[14]=xe,q[15]=Be}function C(q,H){g(q,H,H)}function Z(q,H){const V=i();let y;for(y=0;y<16;y++)V[y]=H[y];for(y=253;y>=0;y--)C(V,V),y!==2&&y!==4&&g(V,V,H);for(y=0;y<16;y++)q[y]=V[y]}function J(q,H){const V=i();let y;for(y=0;y<16;y++)V[y]=H[y];for(y=250;y>=0;y--)C(V,V),y!==1&&g(V,V,H);for(y=0;y<16;y++)q[y]=V[y]}function te(q,H){const V=i(),y=i(),k=i(),ie=i(),fe=i(),ue=i(),Oe=i(),Me=i(),Ie=i();P(V,q[1],q[0]),P(Ie,H[1],H[0]),g(V,V,Ie),j(y,q[0],q[1]),j(Ie,H[0],H[1]),g(y,y,Ie),g(k,q[3],H[3]),g(k,k,h),g(ie,q[2],H[2]),j(ie,ie,ie),P(fe,y,V),P(ue,ie,k),j(Oe,ie,k),j(Me,y,V),g(q[0],fe,ue),g(q[1],Me,Oe),g(q[2],Oe,ue),g(q[3],fe,Me)}function ae(q,H,V){for(let y=0;y<4;y++)R(q[y],H[y],V)}function p(q,H){const V=i(),y=i(),k=i();Z(k,H[2]),g(V,H[0],k),g(y,H[1],k),W(q,y),q[31]^=z(V)<<7}function d(q,H,V){A(q[0],c),A(q[1],l),A(q[2],l),A(q[3],c);for(let y=255;y>=0;--y){const k=V[y/8|0]>>(y&7)&1;ae(q,H,k),te(H,q),te(q,q),ae(q,H,k)}}function b(q,H){const V=[i(),i(),i(),i()];A(V[0],m),A(V[1],_),A(V[2],l),g(V[3],m,_),d(q,V,H)}function D(q){if(q.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const H=(0,r.hash)(q);H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(32),y=[i(),i(),i(),i()];b(y,H),p(V,y);const k=new Uint8Array(64);return k.set(q),k.set(V,32),{publicKey:V,secretKey:k}}t.generateKeyPairFromSeed=D;function M(q){const H=(0,e.randomBytes)(32,q),V=D(H);return(0,n.wipe)(H),V}t.generateKeyPair=M;function N(q){if(q.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(q.subarray(32))}t.extractPublicKeyFromSecretKey=N;const U=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 O(q,H){let V,y,k,ie;for(y=63;y>=32;--y){for(V=0,k=y-32,ie=y-12;k<ie;++k)H[k]+=V-16*H[y]*U[k-(y-32)],V=Math.floor((H[k]+128)/256),H[k]-=V*256;H[k]+=V,H[y]=0}for(V=0,k=0;k<32;k++)H[k]+=V-(H[31]>>4)*U[k],V=H[k]>>8,H[k]&=255;for(k=0;k<32;k++)H[k]-=V*U[k];for(y=0;y<32;y++)H[y+1]+=H[y]>>8,q[y]=H[y]&255}function v(q){const H=new Float64Array(64);for(let V=0;V<64;V++)H[V]=q[V];for(let V=0;V<64;V++)q[V]=0;O(q,H)}function L(q,H){const V=new Float64Array(64),y=[i(),i(),i(),i()],k=(0,r.hash)(q.subarray(0,32));k[0]&=248,k[31]&=127,k[31]|=64;const ie=new Uint8Array(64);ie.set(k.subarray(32),32);const fe=new r.SHA512;fe.update(ie.subarray(32)),fe.update(H);const ue=fe.digest();fe.clean(),v(ue),b(y,ue),p(ie,y),fe.reset(),fe.update(ie.subarray(0,32)),fe.update(q.subarray(32)),fe.update(H);const Oe=fe.digest();v(Oe);for(let Me=0;Me<32;Me++)V[Me]=ue[Me];for(let Me=0;Me<32;Me++)for(let Ie=0;Ie<32;Ie++)V[Me+Ie]+=Oe[Me]*k[Ie];return O(ie.subarray(32),V),ie}t.sign=L;function oe(q,H){const V=i(),y=i(),k=i(),ie=i(),fe=i(),ue=i(),Oe=i();return A(q[2],l),$(q[1],H),C(k,q[1]),g(ie,k,f),P(k,k,q[2]),j(ie,q[2],ie),C(fe,ie),C(ue,fe),g(Oe,ue,fe),g(V,Oe,k),g(V,V,ie),J(V,V),g(V,V,k),g(V,V,ie),g(V,V,ie),g(q[0],V,ie),C(y,q[0]),g(y,y,ie),F(y,k)&&g(q[0],q[0],E),C(y,q[0]),g(y,y,ie),F(y,k)?-1:(z(q[0])===H[31]>>7&&P(q[0],c,q[0]),g(q[3],q[0],q[1]),0)}function de(q,H,V){const y=new Uint8Array(32),k=[i(),i(),i(),i()],ie=[i(),i(),i(),i()];if(V.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(oe(ie,q))return!1;const fe=new r.SHA512;fe.update(V.subarray(0,32)),fe.update(q),fe.update(H);const ue=fe.digest();return v(ue),d(k,ie,ue),b(ie,V.subarray(32)),te(k,ie),p(y,k),!Y(V,y)}t.verify=de;function x(q){let H=[i(),i(),i(),i()];if(oe(H,q))throw new Error("Ed25519: invalid public key");let V=i(),y=i(),k=H[1];j(V,l,k),P(y,l,k),Z(y,y),g(V,V,y);let ie=new Uint8Array(32);return W(ie,V),ie}t.convertPublicKeyToX25519=x;function ne(q){const H=(0,r.hash)(q.subarray(0,32));H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(H.subarray(0,32));return(0,n.wipe)(H),V}t.convertSecretKeyToX25519=ne}(Qf);const wx="EdDSA",bx="JWT",av=".",cv="base64url",_x="utf8",Ex="utf8",Ax=":",xx="did",Sx="key",lv="base58btc",Ix="z",Dx="K36",Cx=32;function Wl(t){return Fr(Xr(Ui(t),_x),cv)}function uv(t){const e=Xr(Dx,lv),r=Ix+Fr(ef([e,t]),lv);return[xx,Sx,r].join(Ax)}function Ox(t){return Fr(t,cv)}function Px(t){return Xr([Wl(t.header),Wl(t.payload)].join(av),Ex)}function Mx(t){return[Wl(t.header),Wl(t.payload),Ox(t.signature)].join(av)}function hv(t=Fo.randomBytes(Cx)){return Qf.generateKeyPairFromSeed(t)}async function Tx(t,e,r,n,i=_e.fromMiliseconds(Date.now())){const s={alg:wx,typ:bx},c=uv(n.publicKey),l=i+r,f={iss:c,sub:t,aud:e,iat:i,exp:l},h=Px({header:s,payload:f}),m=Qf.sign(n.secretKey,h);return Mx({header:s,payload:f,signature:m})}const $x="PARSE_ERROR",Nx="INVALID_REQUEST",Rx="METHOD_NOT_FOUND",Lx="INVALID_PARAMS",fv="INTERNAL_ERROR",Zf="SERVER_ERROR",Bx=[-32700,-32600,-32601,-32602,-32603],mc={[$x]:{code:-32700,message:"Parse error"},[Nx]:{code:-32600,message:"Invalid Request"},[Rx]:{code:-32601,message:"Method not found"},[Lx]:{code:-32602,message:"Invalid params"},[fv]:{code:-32603,message:"Internal error"},[Zf]:{code:-32e3,message:"Server error"}},dv=Zf;function Ux(t){return Bx.includes(t)}function pv(t){return Object.keys(mc).includes(t)?mc[t]:mc[dv]}function Fx(t){const e=Object.values(mc).find(r=>r.code===t);return e||mc[dv]}function gv(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var mv={};/*! *****************************************************************************
43
+ ***************************************************************************** */var Wf=function(t,e){return Wf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Wf(t,e)};function g7(t,e){Wf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Vf=function(){return Vf=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Vf.apply(this,arguments)};function m7(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function v7(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(i<3?c(o):i>3?c(e,r,o):c(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}function w7(t,e){return function(r,n){e(r,n,t)}}function y7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function b7(t,e,r,n){function i(o){return o instanceof r?o:new r(function(c){c(o)})}return new(r||(r=Promise))(function(o,c){function l(g){try{h(n.next(g))}catch(_){c(_)}}function f(g){try{h(n.throw(g))}catch(_){c(_)}}function h(g){g.done?o(g.value):i(g.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function _7(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(g){return f([h,g])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=h[0]&2?i.return:h[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,h[1])).done)return o;switch(i=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){r.label=h[1];break}if(h[0]===6&&r.label<o[1]){r.label=o[1],o=h;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(h);break}o[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(g){h=[6,g],i=0}finally{n=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function E7(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function A7(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Gf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return o}function x7(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Hm(arguments[e]));return t}function I7(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var o=arguments[e],c=0,l=o.length;c<l;c++,i++)n[i]=o[c];return n}function hc(t){return this instanceof hc?(this.v=t,this):new hc(t)}function S7(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(S,U){o.push([E,A,S,U])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(S){_(o[0][3],S)}}function f(E){E.value instanceof hc?Promise.resolve(E.value.v).then(h,g):_(o[0][2],E)}function h(E){l("next",E)}function g(E){l("throw",E)}function _(E,A){E(A),o.shift(),o.length&&l(o[0][0],o[0][1])}}function D7(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,o){e[i]=t[i]?function(c){return(r=!r)?{value:hc(t[i](c)),done:i==="return"}:o?o(c):c}:o}}function C7(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Gf=="function"?Gf(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(c){return new Promise(function(l,f){c=t[o](c),i(l,f,c.done,c.value)})}}function i(o,c,l,f){Promise.resolve(f).then(function(h){o({value:h,done:l})},c)}}function O7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function P7(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function M7(t){return t&&t.__esModule?t:{default:t}}function T7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function $7(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var N7=Object.freeze({__proto__:null,__extends:g7,get __assign(){return Vf},__rest:m7,__decorate:v7,__param:w7,__metadata:y7,__awaiter:b7,__generator:_7,__createBinding:E7,__exportStar:A7,__values:Gf,__read:Hm,__spread:x7,__spreadArrays:I7,__await:hc,__asyncGenerator:S7,__asyncDelegator:D7,__asyncValues:C7,__makeTemplateObject:O7,__importStar:P7,__importDefault:M7,__classPrivateFieldGet:T7,__classPrivateFieldSet:$7}),zl=$o(N7),fc={},Yf={},dc={};class Gs{}var R7=Object.freeze({__proto__:null,IEvents:Gs}),L7=$o(R7),Km;function B7(){if(Km)return dc;Km=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.IHeartBeat=void 0;const t=L7;class e extends t.IEvents{constructor(n){super()}}return dc.IHeartBeat=e,dc}var Wm;function Vm(){return Wm||(Wm=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),zl.__exportStar(B7(),t)}(Yf)),Yf}var Jf={},Ys={},Gm;function U7(){if(Gm)return Ys;Gm=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.HEARTBEAT_EVENTS=Ys.HEARTBEAT_INTERVAL=void 0;const t=_e;return Ys.HEARTBEAT_INTERVAL=t.FIVE_SECONDS,Ys.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Ys}var Ym;function Jm(){return Ym||(Ym=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),zl.__exportStar(U7(),t)}(Jf)),Jf}var Qm;function F7(){if(Qm)return fc;Qm=1,Object.defineProperty(fc,"__esModule",{value:!0}),fc.HeartBeat=void 0;const t=zl,e=Dr.exports,r=_e,n=Vm(),i=Jm();class o extends n.IHeartBeat{constructor(l){super(l),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=l?.interval||i.HEARTBEAT_INTERVAL}static init(l){return t.__awaiter(this,void 0,void 0,function*(){const f=new o(l);return yield f.init(),f})}init(){return t.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(l,f){this.events.on(l,f)}once(l,f){this.events.once(l,f)}off(l,f){this.events.off(l,f)}removeListener(l,f){this.events.removeListener(l,f)}initialize(){return t.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return fc.HeartBeat=o,fc}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=zl;e.__exportStar(F7(),t),e.__exportStar(Vm(),t),e.__exportStar(Jm(),t)})(Zo);function j7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var k7=q7;function q7(t,e,r){var n=r&&r.stringify||j7,i=1;if(typeof t=="object"&&t!==null){var o=e.length+i;if(o===1)return t;var c=new Array(o);c[0]=n(t);for(var l=1;l<o;l++)c[l]=n(e[l]);return c.join(" ")}if(typeof t!="string")return t;var f=e.length;if(f===0)return t;for(var h="",g=1-i,_=-1,E=t&&t.length||0,A=0;A<E;){if(t.charCodeAt(A)===37&&A+1<E){switch(_=_>-1?_:0,t.charCodeAt(A+1)){case 100:case 102:if(g>=f||e[g]==null)break;_<A&&(h+=t.slice(_,A)),h+=Number(e[g]),_=A+2,A++;break;case 105:if(g>=f||e[g]==null)break;_<A&&(h+=t.slice(_,A)),h+=Math.floor(Number(e[g])),_=A+2,A++;break;case 79:case 111:case 106:if(g>=f||e[g]===void 0)break;_<A&&(h+=t.slice(_,A));var S=typeof e[g];if(S==="string"){h+="'"+e[g]+"'",_=A+2,A++;break}if(S==="function"){h+=e[g].name||"<anonymous>",_=A+2,A++;break}h+=n(e[g]),_=A+2,A++;break;case 115:if(g>=f)break;_<A&&(h+=t.slice(_,A)),h+=String(e[g]),_=A+2,A++;break;case 37:_<A&&(h+=t.slice(_,A)),h+="%",_=A+2,A++,g--;break}++g}++A}return _===-1?t:(_<E&&(h+=t.slice(_)),h)}const Zm=k7;var yi=bi;const pc=Z7().console||{},z7={mapHttpRequest:Kl,mapHttpResponse:Kl,wrapRequestSerializer:Zf,wrapResponseSerializer:Zf,wrapErrorSerializer:Zf,req:Kl,res:Kl,err:G7};function H7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function bi(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||pc;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=H7(t.browser.serialize,n);let o=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);const c=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const l=t.level||"info",f=Object.create(r);f.log||(f.log=gc),Object.defineProperty(f,"levelVal",{get:g}),Object.defineProperty(f,"level",{get:_,set:E});const h={transmit:e,serialize:i,asObject:t.browser.asObject,levels:c,timestamp:Y7(t)};f.levels=bi.levels,f.level=l,f.setMaxListeners=f.getMaxListeners=f.emit=f.addListener=f.on=f.prependListener=f.once=f.prependOnceListener=f.removeListener=f.removeAllListeners=f.listeners=f.listenerCount=f.eventNames=f.write=f.flush=gc,f.serializers=n,f._serialize=i,f._stdErrSerialize=o,f.child=A,e&&(f._logEvent=Qf());function g(){return this.level==="silent"?1/0:this.levels.values[this.level]}function _(){return this._level}function E(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Xo(h,f,"error","log"),Xo(h,f,"fatal","error"),Xo(h,f,"warn","error"),Xo(h,f,"info","log"),Xo(h,f,"debug","log"),Xo(h,f,"trace","log")}function A(S,U){if(!S)throw new Error("missing bindings for child Pino");U=U||{},i&&S.serializers&&(U.serializers=S.serializers);const W=U.serializers;if(i&&W){var Y=Object.assign({},n,W),B=t.browser.serialize===!0?Object.keys(Y):i;delete S.serializers,Hl([S],B,Y,this._stdErrSerialize)}function z(P){this._childLevel=(P._childLevel|0)+1,this.error=ea(P,S,"error"),this.fatal=ea(P,S,"fatal"),this.warn=ea(P,S,"warn"),this.info=ea(P,S,"info"),this.debug=ea(P,S,"debug"),this.trace=ea(P,S,"trace"),Y&&(this.serializers=Y,this._serialize=B),e&&(this._logEvent=Qf([].concat(P._logEvent.bindings,S)))}return z.prototype=this,new z(this)}return f}bi.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"}},bi.stdSerializers=z7,bi.stdTimeFunctions=Object.assign({},{nullTime:Xm,epochTime:ev,unixTime:J7,isoTime:Q7});function Xo(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?gc:i[r]?i[r]:pc[r]||pc[n]||gc,K7(t,e,r)}function K7(t,e,r){!t.transmit&&e[r]===gc||(e[r]=function(n){return function(){const o=t.timestamp(),c=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===pc?pc:this;for(var f=0;f<c.length;f++)c[f]=arguments[f];if(t.serialize&&!t.asObject&&Hl(c,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(l,W7(this,r,c,o)):n.apply(l,c),t.transmit){const h=t.transmit.level||e.level,g=bi.levels.values[h],_=bi.levels.values[r];if(_<g)return;V7(this,{ts:o,methodLevel:r,methodValue:_,transmitLevel:h,transmitValue:bi.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},c)}}}(e[r]))}function W7(t,e,r,n){t._serialize&&Hl(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let o=i[0];const c={};n&&(c.time=n),c.level=bi.levels.values[e];let l=(t._childLevel|0)+1;if(l<1&&(l=1),o!==null&&typeof o=="object"){for(;l--&&typeof i[0]=="object";)Object.assign(c,i.shift());o=i.length?Zm(i.shift(),i):void 0}else typeof o=="string"&&(o=Zm(i.shift(),i));return o!==void 0&&(c.msg=o),c}function Hl(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=bi.stdSerializers.err(t[i]);else if(typeof t[i]=="object"&&!Array.isArray(t[i]))for(const o in t[i])e&&e.indexOf(o)>-1&&o in r&&(t[i][o]=r[o](t[i][o]))}function ea(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return t[r].apply(this,n)}}function V7(t,e,r){const n=e.send,i=e.ts,o=e.methodLevel,c=e.methodValue,l=e.val,f=t._logEvent.bindings;Hl(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(h){return f.indexOf(h)===-1}),t._logEvent.level.label=o,t._logEvent.level.value=c,n(o,t._logEvent,l),t._logEvent=Qf(f)}function Qf(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function G7(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function Y7(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Xm:ev}function Kl(){return{}}function Zf(t){return t}function gc(){}function Xm(){return!1}function ev(){return Date.now()}function J7(){return Math.round(Date.now()/1e3)}function Q7(){return new Date(Date.now()).toISOString()}function Z7(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const X7={level:"info"},mc="custom_context",Xf=1e3*1024;class ex{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 tv{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new ex(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.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 r=this.head;for(;r!==null;)e.push(r.value),r=r.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 r=e.value;return e=e.next,{done:!1,value:r}}}}}class rv{constructor(e,r=Xf){this.level=e??"error",this.levelValue=yi.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new tv(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===yi.levels.values.error?console.error(e):r===yi.levels.values.warn?console.warn(e):r===yi.levels.values.debug?console.debug(e):r===yi.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Fi({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new tv(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Fi({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class tx{constructor(e,r=Xf){this.baseChunkLogger=new rv(e,r)}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 r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}}class rx{constructor(e,r=Xf){this.baseChunkLogger=new rv(e,r)}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 nx=Object.defineProperty,ix=Object.defineProperties,sx=Object.getOwnPropertyDescriptors,nv=Object.getOwnPropertySymbols,ox=Object.prototype.hasOwnProperty,ax=Object.prototype.propertyIsEnumerable,iv=(t,e,r)=>e in t?nx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wl=(t,e)=>{for(var r in e||(e={}))ox.call(e,r)&&iv(t,r,e[r]);if(nv)for(var r of nv(e))ax.call(e,r)&&iv(t,r,e[r]);return t},Vl=(t,e)=>ix(t,sx(e));function Gl(t){return Vl(Wl({},t),{level:t?.level||X7.level})}function cx(t,e=mc){return t[e]||""}function lx(t,e,r=mc){return t[r]=e,t}function sn(t,e=mc){let r="";return typeof t.bindings>"u"?r=cx(t,e):r=t.bindings().context||"",r}function ux(t,e,r=mc){const n=sn(t,r);return n.trim()?`${n}/${e}`:e}function on(t,e,r=mc){const n=ux(t,e,r),i=t.child({context:n});return lx(i,n,r)}function hx(t){var e,r;const n=new tx((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:yi(Vl(Wl({},t.opts),{level:"trace",browser:Vl(Wl({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function fx(t){var e;const r=new rx((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:yi(Vl(Wl({},t.opts),{level:"trace"})),chunkLoggerController:r}}function dx(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?hx(t):fx(t)}class px extends Gs{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class gx extends Gs{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class mx{constructor(e,r){this.logger=e,this.core=r}}class vx extends Gs{constructor(e,r){super(),this.relayer=e,this.logger=r}}class wx extends Gs{constructor(e){super()}}class yx{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class bx extends Gs{constructor(e,r){super(),this.relayer=e,this.logger=r}}class _x extends Gs{constructor(e,r){super(),this.core=e,this.logger=r}}class Ex{constructor(e,r){this.projectId=e,this.logger=r}}class Ax{constructor(e,r){this.projectId=e,this.logger=r}}class xx{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class Ix{constructor(e){this.client=e}}var e0={},sv={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ct,r=pn;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function l(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},l.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var g=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=f[g++],h--;this._bufferLength===this.blockSize&&(o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(g=o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,g,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[g++],h--;return this},l.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,g=this._bufferLength,_=h/536870912|0,E=h<<3,A=h%128<112?128:256;this._buffer[g]=128;for(var S=g+1;S<A-8;S++)this._buffer[S]=0;e.writeUint32BE(_,this._buffer,A-8),e.writeUint32BE(E,this._buffer,A-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,A),this._finished=!0}for(var S=0;S<this.digestLength/8;S++)e.writeUint32BE(this._stateHi[S],f,S*8),e.writeUint32BE(this._stateLo[S],f,S*8+4);return this},l.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},l.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}},l.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(f){r.wipe(f.stateHi),r.wipe(f.stateLo),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},l}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function o(l,f,h,g,_,E,A){for(var S=h[0],U=h[1],W=h[2],Y=h[3],B=h[4],z=h[5],P=h[6],F=h[7],j=g[0],m=g[1],T=g[2],te=g[3],ee=g[4],ne=g[5],fe=g[6],d=g[7],p,b,D,O,$,L,C,v;A>=128;){for(var N=0;N<16;N++){var oe=8*N+E;l[N]=e.readUint32BE(_,oe),f[N]=e.readUint32BE(_,oe+4)}for(var N=0;N<80;N++){var pe=S,x=U,re=W,q=Y,H=B,V=z,w=P,k=F,ie=j,he=m,le=T,Oe=te,Me=ee,Se=ne,Pt=fe,ze=d;if(p=F,b=d,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=(B>>>14|ee<<32-14)^(B>>>18|ee<<32-18)^(ee>>>41-32|B<<32-(41-32)),b=(ee>>>14|B<<32-14)^(ee>>>18|B<<32-18)^(B>>>41-32|ee<<32-(41-32)),$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=B&z^~B&P,b=ee&ne^~ee&fe,$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=i[N*2],b=i[N*2+1],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=l[N%16],b=f[N%16],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,D=C&65535|v<<16,O=$&65535|L<<16,p=D,b=O,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=(S>>>28|j<<32-28)^(j>>>34-32|S<<32-(34-32))^(j>>>39-32|S<<32-(39-32)),b=(j>>>28|S<<32-28)^(S>>>34-32|j<<32-(34-32))^(S>>>39-32|j<<32-(39-32)),$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=S&U^S&W^U&W,b=j&m^j&T^m&T,$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,k=C&65535|v<<16,ze=$&65535|L<<16,p=q,b=Oe,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=D,b=O,$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,q=C&65535|v<<16,Oe=$&65535|L<<16,U=pe,W=x,Y=re,B=q,z=H,P=V,F=w,S=k,m=ie,T=he,te=le,ee=Oe,ne=Me,fe=Se,d=Pt,j=ze,N%16===15)for(var oe=0;oe<16;oe++)p=l[oe],b=f[oe],$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=l[(oe+9)%16],b=f[(oe+9)%16],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,D=l[(oe+1)%16],O=f[(oe+1)%16],p=(D>>>1|O<<32-1)^(D>>>8|O<<32-8)^D>>>7,b=(O>>>1|D<<32-1)^(O>>>8|D<<32-8)^(O>>>7|D<<32-7),$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,D=l[(oe+14)%16],O=f[(oe+14)%16],p=(D>>>19|O<<32-19)^(O>>>61-32|D<<32-(61-32))^D>>>6,b=(O>>>19|D<<32-19)^(D>>>61-32|O<<32-(61-32))^(O>>>6|D<<32-6),$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,l[oe]=C&65535|v<<16,f[oe]=$&65535|L<<16}p=S,b=j,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[0],b=g[0],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[0]=S=C&65535|v<<16,g[0]=j=$&65535|L<<16,p=U,b=m,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[1],b=g[1],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[1]=U=C&65535|v<<16,g[1]=m=$&65535|L<<16,p=W,b=T,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[2],b=g[2],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[2]=W=C&65535|v<<16,g[2]=T=$&65535|L<<16,p=Y,b=te,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[3],b=g[3],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[3]=Y=C&65535|v<<16,g[3]=te=$&65535|L<<16,p=B,b=ee,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[4],b=g[4],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[4]=B=C&65535|v<<16,g[4]=ee=$&65535|L<<16,p=z,b=ne,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[5],b=g[5],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[5]=z=C&65535|v<<16,g[5]=ne=$&65535|L<<16,p=P,b=fe,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[6],b=g[6],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[6]=P=C&65535|v<<16,g[6]=fe=$&65535|L<<16,p=F,b=d,$=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[7],b=g[7],$+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=$>>>16,C+=L>>>16,v+=C>>>16,h[7]=F=C&65535|v<<16,g[7]=d=$&65535|L<<16,E+=128,A-=128}return E}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}t.hash=c})(sv),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Bo,r=sv,n=pn;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(q){const H=new Float64Array(16);if(q)for(let V=0;V<q.length;V++)H[V]=q[V];return H}const o=new Uint8Array(32);o[0]=9;const c=i(),l=i([1]),f=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),_=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),E=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function A(q,H){for(let V=0;V<16;V++)q[V]=H[V]|0}function S(q){let H=1;for(let V=0;V<16;V++){let w=q[V]+H+65535;H=Math.floor(w/65536),q[V]=w-H*65536}q[0]+=H-1+37*(H-1)}function U(q,H,V){const w=~(V-1);for(let k=0;k<16;k++){const ie=w&(q[k]^H[k]);q[k]^=ie,H[k]^=ie}}function W(q,H){const V=i(),w=i();for(let k=0;k<16;k++)w[k]=H[k];S(w),S(w),S(w);for(let k=0;k<2;k++){V[0]=w[0]-65517;for(let he=1;he<15;he++)V[he]=w[he]-65535-(V[he-1]>>16&1),V[he-1]&=65535;V[15]=w[15]-32767-(V[14]>>16&1);const ie=V[15]>>16&1;V[14]&=65535,U(w,V,1-ie)}for(let k=0;k<16;k++)q[2*k]=w[k]&255,q[2*k+1]=w[k]>>8}function Y(q,H){let V=0;for(let w=0;w<32;w++)V|=q[w]^H[w];return(1&V-1>>>8)-1}function B(q,H){const V=new Uint8Array(32),w=new Uint8Array(32);return W(V,q),W(w,H),Y(V,w)}function z(q){const H=new Uint8Array(32);return W(H,q),H[0]&1}function P(q,H){for(let V=0;V<16;V++)q[V]=H[2*V]+(H[2*V+1]<<8);q[15]&=32767}function F(q,H,V){for(let w=0;w<16;w++)q[w]=H[w]+V[w]}function j(q,H,V){for(let w=0;w<16;w++)q[w]=H[w]-V[w]}function m(q,H,V){let w,k,ie=0,he=0,le=0,Oe=0,Me=0,Se=0,Pt=0,ze=0,Ce=0,Fe=0,Ee=0,Ae=0,Ge=0,ye=0,xe=0,Be=0,be=0,Pe=0,je=0,Te=0,$e=0,lt=0,Re=0,Ne=0,nr=0,dt=0,Et=0,ir=0,It=0,Ot=0,Vr=0,Ye=V[0],He=V[1],Rt=V[2],Je=V[3],Ve=V[4],Mt=V[5],Xe=V[6],et=V[7],Lt=V[8],tt=V[9],Qe=V[10],Ft=V[11],Ze=V[12],ke=V[13],Ht=V[14],rt=V[15];w=H[0],ie+=w*Ye,he+=w*He,le+=w*Rt,Oe+=w*Je,Me+=w*Ve,Se+=w*Mt,Pt+=w*Xe,ze+=w*et,Ce+=w*Lt,Fe+=w*tt,Ee+=w*Qe,Ae+=w*Ft,Ge+=w*Ze,ye+=w*ke,xe+=w*Ht,Be+=w*rt,w=H[1],he+=w*Ye,le+=w*He,Oe+=w*Rt,Me+=w*Je,Se+=w*Ve,Pt+=w*Mt,ze+=w*Xe,Ce+=w*et,Fe+=w*Lt,Ee+=w*tt,Ae+=w*Qe,Ge+=w*Ft,ye+=w*Ze,xe+=w*ke,Be+=w*Ht,be+=w*rt,w=H[2],le+=w*Ye,Oe+=w*He,Me+=w*Rt,Se+=w*Je,Pt+=w*Ve,ze+=w*Mt,Ce+=w*Xe,Fe+=w*et,Ee+=w*Lt,Ae+=w*tt,Ge+=w*Qe,ye+=w*Ft,xe+=w*Ze,Be+=w*ke,be+=w*Ht,Pe+=w*rt,w=H[3],Oe+=w*Ye,Me+=w*He,Se+=w*Rt,Pt+=w*Je,ze+=w*Ve,Ce+=w*Mt,Fe+=w*Xe,Ee+=w*et,Ae+=w*Lt,Ge+=w*tt,ye+=w*Qe,xe+=w*Ft,Be+=w*Ze,be+=w*ke,Pe+=w*Ht,je+=w*rt,w=H[4],Me+=w*Ye,Se+=w*He,Pt+=w*Rt,ze+=w*Je,Ce+=w*Ve,Fe+=w*Mt,Ee+=w*Xe,Ae+=w*et,Ge+=w*Lt,ye+=w*tt,xe+=w*Qe,Be+=w*Ft,be+=w*Ze,Pe+=w*ke,je+=w*Ht,Te+=w*rt,w=H[5],Se+=w*Ye,Pt+=w*He,ze+=w*Rt,Ce+=w*Je,Fe+=w*Ve,Ee+=w*Mt,Ae+=w*Xe,Ge+=w*et,ye+=w*Lt,xe+=w*tt,Be+=w*Qe,be+=w*Ft,Pe+=w*Ze,je+=w*ke,Te+=w*Ht,$e+=w*rt,w=H[6],Pt+=w*Ye,ze+=w*He,Ce+=w*Rt,Fe+=w*Je,Ee+=w*Ve,Ae+=w*Mt,Ge+=w*Xe,ye+=w*et,xe+=w*Lt,Be+=w*tt,be+=w*Qe,Pe+=w*Ft,je+=w*Ze,Te+=w*ke,$e+=w*Ht,lt+=w*rt,w=H[7],ze+=w*Ye,Ce+=w*He,Fe+=w*Rt,Ee+=w*Je,Ae+=w*Ve,Ge+=w*Mt,ye+=w*Xe,xe+=w*et,Be+=w*Lt,be+=w*tt,Pe+=w*Qe,je+=w*Ft,Te+=w*Ze,$e+=w*ke,lt+=w*Ht,Re+=w*rt,w=H[8],Ce+=w*Ye,Fe+=w*He,Ee+=w*Rt,Ae+=w*Je,Ge+=w*Ve,ye+=w*Mt,xe+=w*Xe,Be+=w*et,be+=w*Lt,Pe+=w*tt,je+=w*Qe,Te+=w*Ft,$e+=w*Ze,lt+=w*ke,Re+=w*Ht,Ne+=w*rt,w=H[9],Fe+=w*Ye,Ee+=w*He,Ae+=w*Rt,Ge+=w*Je,ye+=w*Ve,xe+=w*Mt,Be+=w*Xe,be+=w*et,Pe+=w*Lt,je+=w*tt,Te+=w*Qe,$e+=w*Ft,lt+=w*Ze,Re+=w*ke,Ne+=w*Ht,nr+=w*rt,w=H[10],Ee+=w*Ye,Ae+=w*He,Ge+=w*Rt,ye+=w*Je,xe+=w*Ve,Be+=w*Mt,be+=w*Xe,Pe+=w*et,je+=w*Lt,Te+=w*tt,$e+=w*Qe,lt+=w*Ft,Re+=w*Ze,Ne+=w*ke,nr+=w*Ht,dt+=w*rt,w=H[11],Ae+=w*Ye,Ge+=w*He,ye+=w*Rt,xe+=w*Je,Be+=w*Ve,be+=w*Mt,Pe+=w*Xe,je+=w*et,Te+=w*Lt,$e+=w*tt,lt+=w*Qe,Re+=w*Ft,Ne+=w*Ze,nr+=w*ke,dt+=w*Ht,Et+=w*rt,w=H[12],Ge+=w*Ye,ye+=w*He,xe+=w*Rt,Be+=w*Je,be+=w*Ve,Pe+=w*Mt,je+=w*Xe,Te+=w*et,$e+=w*Lt,lt+=w*tt,Re+=w*Qe,Ne+=w*Ft,nr+=w*Ze,dt+=w*ke,Et+=w*Ht,ir+=w*rt,w=H[13],ye+=w*Ye,xe+=w*He,Be+=w*Rt,be+=w*Je,Pe+=w*Ve,je+=w*Mt,Te+=w*Xe,$e+=w*et,lt+=w*Lt,Re+=w*tt,Ne+=w*Qe,nr+=w*Ft,dt+=w*Ze,Et+=w*ke,ir+=w*Ht,It+=w*rt,w=H[14],xe+=w*Ye,Be+=w*He,be+=w*Rt,Pe+=w*Je,je+=w*Ve,Te+=w*Mt,$e+=w*Xe,lt+=w*et,Re+=w*Lt,Ne+=w*tt,nr+=w*Qe,dt+=w*Ft,Et+=w*Ze,ir+=w*ke,It+=w*Ht,Ot+=w*rt,w=H[15],Be+=w*Ye,be+=w*He,Pe+=w*Rt,je+=w*Je,Te+=w*Ve,$e+=w*Mt,lt+=w*Xe,Re+=w*et,Ne+=w*Lt,nr+=w*tt,dt+=w*Qe,Et+=w*Ft,ir+=w*Ze,It+=w*ke,Ot+=w*Ht,Vr+=w*rt,ie+=38*be,he+=38*Pe,le+=38*je,Oe+=38*Te,Me+=38*$e,Se+=38*lt,Pt+=38*Re,ze+=38*Ne,Ce+=38*nr,Fe+=38*dt,Ee+=38*Et,Ae+=38*ir,Ge+=38*It,ye+=38*Ot,xe+=38*Vr,k=1,w=ie+k+65535,k=Math.floor(w/65536),ie=w-k*65536,w=he+k+65535,k=Math.floor(w/65536),he=w-k*65536,w=le+k+65535,k=Math.floor(w/65536),le=w-k*65536,w=Oe+k+65535,k=Math.floor(w/65536),Oe=w-k*65536,w=Me+k+65535,k=Math.floor(w/65536),Me=w-k*65536,w=Se+k+65535,k=Math.floor(w/65536),Se=w-k*65536,w=Pt+k+65535,k=Math.floor(w/65536),Pt=w-k*65536,w=ze+k+65535,k=Math.floor(w/65536),ze=w-k*65536,w=Ce+k+65535,k=Math.floor(w/65536),Ce=w-k*65536,w=Fe+k+65535,k=Math.floor(w/65536),Fe=w-k*65536,w=Ee+k+65535,k=Math.floor(w/65536),Ee=w-k*65536,w=Ae+k+65535,k=Math.floor(w/65536),Ae=w-k*65536,w=Ge+k+65535,k=Math.floor(w/65536),Ge=w-k*65536,w=ye+k+65535,k=Math.floor(w/65536),ye=w-k*65536,w=xe+k+65535,k=Math.floor(w/65536),xe=w-k*65536,w=Be+k+65535,k=Math.floor(w/65536),Be=w-k*65536,ie+=k-1+37*(k-1),k=1,w=ie+k+65535,k=Math.floor(w/65536),ie=w-k*65536,w=he+k+65535,k=Math.floor(w/65536),he=w-k*65536,w=le+k+65535,k=Math.floor(w/65536),le=w-k*65536,w=Oe+k+65535,k=Math.floor(w/65536),Oe=w-k*65536,w=Me+k+65535,k=Math.floor(w/65536),Me=w-k*65536,w=Se+k+65535,k=Math.floor(w/65536),Se=w-k*65536,w=Pt+k+65535,k=Math.floor(w/65536),Pt=w-k*65536,w=ze+k+65535,k=Math.floor(w/65536),ze=w-k*65536,w=Ce+k+65535,k=Math.floor(w/65536),Ce=w-k*65536,w=Fe+k+65535,k=Math.floor(w/65536),Fe=w-k*65536,w=Ee+k+65535,k=Math.floor(w/65536),Ee=w-k*65536,w=Ae+k+65535,k=Math.floor(w/65536),Ae=w-k*65536,w=Ge+k+65535,k=Math.floor(w/65536),Ge=w-k*65536,w=ye+k+65535,k=Math.floor(w/65536),ye=w-k*65536,w=xe+k+65535,k=Math.floor(w/65536),xe=w-k*65536,w=Be+k+65535,k=Math.floor(w/65536),Be=w-k*65536,ie+=k-1+37*(k-1),q[0]=ie,q[1]=he,q[2]=le,q[3]=Oe,q[4]=Me,q[5]=Se,q[6]=Pt,q[7]=ze,q[8]=Ce,q[9]=Fe,q[10]=Ee,q[11]=Ae,q[12]=Ge,q[13]=ye,q[14]=xe,q[15]=Be}function T(q,H){m(q,H,H)}function te(q,H){const V=i();let w;for(w=0;w<16;w++)V[w]=H[w];for(w=253;w>=0;w--)T(V,V),w!==2&&w!==4&&m(V,V,H);for(w=0;w<16;w++)q[w]=V[w]}function ee(q,H){const V=i();let w;for(w=0;w<16;w++)V[w]=H[w];for(w=250;w>=0;w--)T(V,V),w!==1&&m(V,V,H);for(w=0;w<16;w++)q[w]=V[w]}function ne(q,H){const V=i(),w=i(),k=i(),ie=i(),he=i(),le=i(),Oe=i(),Me=i(),Se=i();j(V,q[1],q[0]),j(Se,H[1],H[0]),m(V,V,Se),F(w,q[0],q[1]),F(Se,H[0],H[1]),m(w,w,Se),m(k,q[3],H[3]),m(k,k,h),m(ie,q[2],H[2]),F(ie,ie,ie),j(he,w,V),j(le,ie,k),F(Oe,ie,k),F(Me,w,V),m(q[0],he,le),m(q[1],Me,Oe),m(q[2],Oe,le),m(q[3],he,Me)}function fe(q,H,V){for(let w=0;w<4;w++)U(q[w],H[w],V)}function d(q,H){const V=i(),w=i(),k=i();te(k,H[2]),m(V,H[0],k),m(w,H[1],k),W(q,w),q[31]^=z(V)<<7}function p(q,H,V){A(q[0],c),A(q[1],l),A(q[2],l),A(q[3],c);for(let w=255;w>=0;--w){const k=V[w/8|0]>>(w&7)&1;fe(q,H,k),ne(H,q),ne(q,q),fe(q,H,k)}}function b(q,H){const V=[i(),i(),i(),i()];A(V[0],g),A(V[1],_),A(V[2],l),m(V[3],g,_),p(q,V,H)}function D(q){if(q.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const H=(0,r.hash)(q);H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(32),w=[i(),i(),i(),i()];b(w,H),d(V,w);const k=new Uint8Array(64);return k.set(q),k.set(V,32),{publicKey:V,secretKey:k}}t.generateKeyPairFromSeed=D;function O(q){const H=(0,e.randomBytes)(32,q),V=D(H);return(0,n.wipe)(H),V}t.generateKeyPair=O;function $(q){if(q.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(q.subarray(32))}t.extractPublicKeyFromSecretKey=$;const L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function C(q,H){let V,w,k,ie;for(w=63;w>=32;--w){for(V=0,k=w-32,ie=w-12;k<ie;++k)H[k]+=V-16*H[w]*L[k-(w-32)],V=Math.floor((H[k]+128)/256),H[k]-=V*256;H[k]+=V,H[w]=0}for(V=0,k=0;k<32;k++)H[k]+=V-(H[31]>>4)*L[k],V=H[k]>>8,H[k]&=255;for(k=0;k<32;k++)H[k]-=V*L[k];for(w=0;w<32;w++)H[w+1]+=H[w]>>8,q[w]=H[w]&255}function v(q){const H=new Float64Array(64);for(let V=0;V<64;V++)H[V]=q[V];for(let V=0;V<64;V++)q[V]=0;C(q,H)}function N(q,H){const V=new Float64Array(64),w=[i(),i(),i(),i()],k=(0,r.hash)(q.subarray(0,32));k[0]&=248,k[31]&=127,k[31]|=64;const ie=new Uint8Array(64);ie.set(k.subarray(32),32);const he=new r.SHA512;he.update(ie.subarray(32)),he.update(H);const le=he.digest();he.clean(),v(le),b(w,le),d(ie,w),he.reset(),he.update(ie.subarray(0,32)),he.update(q.subarray(32)),he.update(H);const Oe=he.digest();v(Oe);for(let Me=0;Me<32;Me++)V[Me]=le[Me];for(let Me=0;Me<32;Me++)for(let Se=0;Se<32;Se++)V[Me+Se]+=Oe[Me]*k[Se];return C(ie.subarray(32),V),ie}t.sign=N;function oe(q,H){const V=i(),w=i(),k=i(),ie=i(),he=i(),le=i(),Oe=i();return A(q[2],l),P(q[1],H),T(k,q[1]),m(ie,k,f),j(k,k,q[2]),F(ie,q[2],ie),T(he,ie),T(le,he),m(Oe,le,he),m(V,Oe,k),m(V,V,ie),ee(V,V),m(V,V,k),m(V,V,ie),m(V,V,ie),m(q[0],V,ie),T(w,q[0]),m(w,w,ie),B(w,k)&&m(q[0],q[0],E),T(w,q[0]),m(w,w,ie),B(w,k)?-1:(z(q[0])===H[31]>>7&&j(q[0],c,q[0]),m(q[3],q[0],q[1]),0)}function pe(q,H,V){const w=new Uint8Array(32),k=[i(),i(),i(),i()],ie=[i(),i(),i(),i()];if(V.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(oe(ie,q))return!1;const he=new r.SHA512;he.update(V.subarray(0,32)),he.update(q),he.update(H);const le=he.digest();return v(le),p(k,ie,le),b(ie,V.subarray(32)),ne(k,ie),d(w,k),!Y(V,w)}t.verify=pe;function x(q){let H=[i(),i(),i(),i()];if(oe(H,q))throw new Error("Ed25519: invalid public key");let V=i(),w=i(),k=H[1];F(V,l,k),j(w,l,k),te(w,w),m(V,V,w);let ie=new Uint8Array(32);return W(ie,V),ie}t.convertPublicKeyToX25519=x;function re(q){const H=(0,r.hash)(q.subarray(0,32));H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(H.subarray(0,32));return(0,n.wipe)(H),V}t.convertSecretKeyToX25519=re}(e0);const Sx="EdDSA",Dx="JWT",ov=".",av="base64url",Cx="utf8",Ox="utf8",Px=":",Mx="did",Tx="key",cv="base58btc",$x="z",Nx="K36",Rx=32;function Yl(t){return jr(Xr(Fi(t),Cx),av)}function lv(t){const e=Xr(Nx,cv),r=$x+jr(nf([e,t]),cv);return[Mx,Tx,r].join(Px)}function Lx(t){return jr(t,av)}function Bx(t){return Xr([Yl(t.header),Yl(t.payload)].join(ov),Ox)}function Ux(t){return[Yl(t.header),Yl(t.payload),Lx(t.signature)].join(ov)}function uv(t=Bo.randomBytes(Rx)){return e0.generateKeyPairFromSeed(t)}async function Fx(t,e,r,n,i=_e.fromMiliseconds(Date.now())){const o={alg:Sx,typ:Dx},c=lv(n.publicKey),l=i+r,f={iss:c,sub:t,aud:e,iat:i,exp:l},h=Bx({header:o,payload:f}),g=e0.sign(n.secretKey,h);return Ux({header:o,payload:f,signature:g})}const jx="PARSE_ERROR",kx="INVALID_REQUEST",qx="METHOD_NOT_FOUND",zx="INVALID_PARAMS",hv="INTERNAL_ERROR",t0="SERVER_ERROR",Hx=[-32700,-32600,-32601,-32602,-32603],vc={[jx]:{code:-32700,message:"Parse error"},[kx]:{code:-32600,message:"Invalid Request"},[qx]:{code:-32601,message:"Method not found"},[zx]:{code:-32602,message:"Invalid params"},[hv]:{code:-32603,message:"Internal error"},[t0]:{code:-32e3,message:"Server error"}},fv=t0;function Kx(t){return Hx.includes(t)}function dv(t){return Object.keys(vc).includes(t)?vc[t]:vc[fv]}function Wx(t){const e=Object.values(vc).find(r=>r.code===t);return e||vc[fv]}function pv(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var gv={};/*! *****************************************************************************
44
44
  Copyright (c) Microsoft Corporation.
45
45
 
46
46
  Permission to use, copy, modify, and/or distribute this software for any
@@ -53,76 +53,63 @@
53
53
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
54
54
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
55
55
  PERFORMANCE OF THIS SOFTWARE.
56
- ***************************************************************************** */var Xf=function(t,e){return Xf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Xf(t,e)};function jx(t,e){Xf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var e0=function(){return e0=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},e0.apply(this,arguments)};function kx(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function qx(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function zx(t,e){return function(r,n){e(r,n,t)}}function Hx(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Kx(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function Wx(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Vx(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Gx(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function t0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vv(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function Yx(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(vv(arguments[e]));return t}function Jx(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function vc(t){return this instanceof vc?(this.v=t,this):new vc(t)}function Qx(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof vc?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Zx(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:vc(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function Xx(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof t0=="function"?t0(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function eS(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function tS(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function rS(t){return t&&t.__esModule?t:{default:t}}function nS(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function iS(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var sS=Object.freeze({__proto__:null,__extends:jx,get __assign(){return e0},__rest:kx,__decorate:qx,__param:zx,__metadata:Hx,__awaiter:Kx,__generator:Wx,__createBinding:Vx,__exportStar:Gx,__values:t0,__read:vv,__spread:Yx,__spreadArrays:Jx,__await:vc,__asyncGenerator:Qx,__asyncDelegator:Zx,__asyncValues:Xx,__makeTemplateObject:eS,__importStar:tS,__importDefault:rS,__classPrivateFieldGet:nS,__classPrivateFieldSet:iS}),oS=Us(sS),Fi={},yv;function aS(){if(yv)return Fi;yv=1,Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.isBrowserCryptoAvailable=Fi.getSubtleCrypto=Fi.getBrowerCrypto=void 0;function t(){return Jn?.crypto||Jn?.msCrypto||{}}Fi.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Fi.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Fi.isBrowserCryptoAvailable=r,Fi}var ji={},wv;function cS(){if(wv)return ji;wv=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.isBrowser=ji.isNode=ji.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ji.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}ji.isNode=e;function r(){return!t()&&!e()}return ji.isBrowser=r,ji}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=oS;e.__exportStar(aS(),t),e.__exportStar(cS(),t)})(mv);function us(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Qs(t=6){return BigInt(us(t))}function ta(t,e,r){return{id:r||us(),jsonrpc:"2.0",method:t,params:e}}function Vl(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gl(t,e,r){return{id:t,jsonrpc:"2.0",error:lS(e,r)}}function lS(t,e){return typeof t>"u"?pv(fv):(typeof t=="string"&&(t=Object.assign(Object.assign({},pv(Zf)),{message:t})),typeof e<"u"&&(t.data=e),Ux(t.code)&&(t=Fx(t.code)),t)}class uS{}class hS extends uS{constructor(){super()}}class fS extends hS{constructor(e){super()}}const dS="^https?:",pS="^wss?:";function gS(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function bv(t,e){const r=gS(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function _v(t){return bv(t,dS)}function Ev(t){return bv(t,pS)}function mS(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Av(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function r0(t){return Av(t)&&"method"in t}function Yl(t){return Av(t)&&(bi(t)||Tn(t))}function bi(t){return"result"in t}function Tn(t){return"error"in t}class ki extends fS{constructor(e){super(e),this.events=new Dr.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,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ta(e.method,e.params||[],e.id||Qs().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Tn(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yl(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 vS=()=>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"),yS=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",xv=t=>t.split("?")[0],Sv=10,wS=vS();class bS{constructor(e){if(this.url=e,this.events=new Dr.exports.EventEmitter,this.registering=!1,!Ev(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ui(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!Ev(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=mv.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mS(e)},c=new wS(e,[],s);yS()?c.onerror=l=>{const f=l;n(this.emitError(f.error))}:c.on("error",l=>{n(this.emitError(l))}),c.onopen=()=>{this.onOpen(c),r(c)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),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 r=typeof e.data=="string"?hc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gl(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return gv(e,xv(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Sv&&this.events.setMaxListeners(Sv)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${xv(this.url)}`));return this.events.emit("register_error",r),r}}var n0={exports:{}};(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,c=9007199254740991,l="[object Arguments]",f="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",_="[object Date]",E="[object Error]",A="[object Function]",I="[object GeneratorFunction]",R="[object Map]",W="[object Number]",Y="[object Null]",F="[object Object]",z="[object Promise]",$="[object Proxy]",j="[object RegExp]",P="[object Set]",g="[object String]",C="[object Symbol]",Z="[object Undefined]",J="[object WeakMap]",te="[object ArrayBuffer]",ae="[object DataView]",p="[object Float32Array]",d="[object Float64Array]",b="[object Int8Array]",D="[object Int16Array]",M="[object Int32Array]",N="[object Uint8Array]",U="[object Uint8ClampedArray]",O="[object Uint16Array]",v="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,de=/^(?:0|[1-9]\d*)$/,x={};x[p]=x[d]=x[b]=x[D]=x[M]=x[N]=x[U]=x[O]=x[v]=!0,x[l]=x[f]=x[te]=x[m]=x[ae]=x[_]=x[E]=x[A]=x[R]=x[W]=x[F]=x[j]=x[P]=x[g]=x[J]=!1;var ne=typeof Jn=="object"&&Jn&&Jn.Object===Object&&Jn,q=typeof self=="object"&&self&&self.Object===Object&&self,H=ne||q||Function("return this")(),V=e&&!e.nodeType&&e,y=V&&!0&&t&&!t.nodeType&&t,k=y&&y.exports===V,ie=k&&ne.process,fe=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),ue=fe&&fe.isTypedArray;function Oe(K,X){for(var pe=-1,Se=K==null?0:K.length,Vt=0,ot=[];++pe<Se;){var Zt=K[pe];X(Zt,pe,K)&&(ot[Vt++]=Zt)}return ot}function Me(K,X){for(var pe=-1,Se=X.length,Vt=K.length;++pe<Se;)K[Vt+pe]=X[pe];return K}function Ie(K,X){for(var pe=-1,Se=K==null?0:K.length;++pe<Se;)if(X(K[pe],pe,K))return!0;return!1}function Pt(K,X){for(var pe=-1,Se=Array(K);++pe<K;)Se[pe]=X(pe);return Se}function ze(K){return function(X){return K(X)}}function Ce(K,X){return K.has(X)}function Fe(K,X){return K?.[X]}function Ee(K){var X=-1,pe=Array(K.size);return K.forEach(function(Se,Vt){pe[++X]=[Vt,Se]}),pe}function Ae(K,X){return function(pe){return K(X(pe))}}function Ge(K){var X=-1,pe=Array(K.size);return K.forEach(function(Se){pe[++X]=Se}),pe}var we=Array.prototype,xe=Function.prototype,Be=Object.prototype,be=H["__core-js_shared__"],Pe=xe.toString,je=Be.hasOwnProperty,Te=function(){var K=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return K?"Symbol(src)_1."+K:""}(),$e=Be.toString,lt=RegExp("^"+Pe.call(je).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=k?H.Buffer:void 0,Ne=H.Symbol,nr=H.Uint8Array,dt=Be.propertyIsEnumerable,Et=we.splice,ir=Ne?Ne.toStringTag:void 0,St=Object.getOwnPropertySymbols,Ot=Re?Re.isBuffer:void 0,Vr=Ae(Object.keys,Object),Ye=_n(H,"DataView"),He=_n(H,"Map"),Rt=_n(H,"Promise"),Je=_n(H,"Set"),Ve=_n(H,"WeakMap"),Mt=_n(Object,"create"),Xe=Vi(Ye),et=Vi(He),Lt=Vi(Rt),tt=Vi(Je),Qe=Vi(Ve),Ft=Ne?Ne.prototype:void 0,Ze=Ft?Ft.valueOf:void 0;function ke(K){var X=-1,pe=K==null?0:K.length;for(this.clear();++X<pe;){var Se=K[X];this.set(Se[0],Se[1])}}function Ht(){this.__data__=Mt?Mt(null):{},this.size=0}function rt(K){var X=this.has(K)&&delete this.__data__[K];return this.size-=X?1:0,X}function jt(K){var X=this.__data__;if(Mt){var pe=X[K];return pe===n?void 0:pe}return je.call(X,K)?X[K]:void 0}function ri(K){var X=this.__data__;return Mt?X[K]!==void 0:je.call(X,K)}function kt(K,X){var pe=this.__data__;return this.size+=this.has(K)?0:1,pe[K]=Mt&&X===void 0?n:X,this}ke.prototype.clear=Ht,ke.prototype.delete=rt,ke.prototype.get=jt,ke.prototype.has=ri,ke.prototype.set=kt;function vt(K){var X=-1,pe=K==null?0:K.length;for(this.clear();++X<pe;){var Se=K[X];this.set(Se[0],Se[1])}}function Bn(){this.__data__=[],this.size=0}function Un(K){var X=this.__data__,pe=Ao(X,K);if(pe<0)return!1;var Se=X.length-1;return pe==Se?X.pop():Et.call(X,pe,1),--this.size,!0}function Fn(K){var X=this.__data__,pe=Ao(X,K);return pe<0?void 0:X[pe][1]}function jn(K){return Ao(this.__data__,K)>-1}function kn(K,X){var pe=this.__data__,Se=Ao(pe,K);return Se<0?(++this.size,pe.push([K,X])):pe[Se][1]=X,this}vt.prototype.clear=Bn,vt.prototype.delete=Un,vt.prototype.get=Fn,vt.prototype.has=jn,vt.prototype.set=kn;function xr(K){var X=-1,pe=K==null?0:K.length;for(this.clear();++X<pe;){var Se=K[X];this.set(Se[0],Se[1])}}function Ii(){this.size=0,this.__data__={hash:new ke,map:new(He||vt),string:new ke}}function mo(K){var X=Cs(this,K).delete(K);return this.size-=X?1:0,X}function Di(K){return Cs(this,K).get(K)}function vo(K){return Cs(this,K).has(K)}function yo(K,X){var pe=Cs(this,K),Se=pe.size;return pe.set(K,X),this.size+=pe.size==Se?0:1,this}xr.prototype.clear=Ii,xr.prototype.delete=mo,xr.prototype.get=Di,xr.prototype.has=vo,xr.prototype.set=yo;function Ci(K){var X=-1,pe=K==null?0:K.length;for(this.__data__=new xr;++X<pe;)this.add(K[X])}function Is(K){return this.__data__.set(K,n),this}function Ds(K){return this.__data__.has(K)}Ci.prototype.add=Ci.prototype.push=Is,Ci.prototype.has=Ds;function Gr(K){var X=this.__data__=new vt(K);this.size=X.size}function wo(){this.__data__=new vt,this.size=0}function bo(K){var X=this.__data__,pe=X.delete(K);return this.size=X.size,pe}function _o(K){return this.__data__.get(K)}function Eo(K){return this.__data__.has(K)}function Tu(K,X){var pe=this.__data__;if(pe instanceof vt){var Se=pe.__data__;if(!He||Se.length<r-1)return Se.push([K,X]),this.size=++pe.size,this;pe=this.__data__=new xr(Se)}return pe.set(K,X),this.size=pe.size,this}Gr.prototype.clear=wo,Gr.prototype.delete=bo,Gr.prototype.get=_o,Gr.prototype.has=Eo,Gr.prototype.set=Tu;function $u(K,X){var pe=Ia(K),Se=!pe&&Ku(K),Vt=!pe&&!Se&&Hc(K),ot=!pe&&!Se&&!Vt&&Gu(K),Zt=pe||Se||Vt||ot,gr=Zt?Pt(K.length,String):[],It=gr.length;for(var Gt in K)(X||je.call(K,Gt))&&!(Zt&&(Gt=="length"||Vt&&(Gt=="offset"||Gt=="parent")||ot&&(Gt=="buffer"||Gt=="byteLength"||Gt=="byteOffset")||ju(Gt,It)))&&gr.push(Gt);return gr}function Ao(K,X){for(var pe=K.length;pe--;)if(Hu(K[pe][0],X))return pe;return-1}function qc(K,X,pe){var Se=X(K);return Ia(K)?Se:Me(Se,pe(K))}function xo(K){return K==null?K===void 0?Z:Y:ir&&ir in Object(K)?Uu(K):Ud(K)}function zc(K){return Io(K)&&xo(K)==l}function So(K,X,pe,Se,Vt){return K===X?!0:K==null||X==null||!Io(K)&&!Io(X)?K!==K&&X!==X:Nu(K,X,pe,Se,So,Vt)}function Nu(K,X,pe,Se,Vt,ot){var Zt=Ia(K),gr=Ia(X),It=Zt?f:Oi(K),Gt=gr?f:Oi(X);It=It==l?F:It,Gt=Gt==l?F:Gt;var fr=It==F,an=Gt==F,mr=It==Gt;if(mr&&Hc(K)){if(!Hc(X))return!1;Zt=!0,fr=!1}if(mr&&!fr)return ot||(ot=new Gr),Zt||Gu(K)?xa(K,X,pe,Se,Vt,ot):Bd(K,X,It,pe,Se,Vt,ot);if(!(pe&i)){var Xt=fr&&je.call(K,"__wrapped__"),Yr=an&&je.call(X,"__wrapped__");if(Xt||Yr){var ni=Xt?K.value():K,qn=Yr?X.value():X;return ot||(ot=new Gr),Vt(ni,qn,pe,Se,ot)}}return mr?(ot||(ot=new Gr),Bu(K,X,pe,Se,Vt,ot)):!1}function Ld(K){if(!Vu(K)||qu(K))return!1;var X=Da(K)?lt:oe;return X.test(Vi(K))}function Ru(K){return Io(K)&&Wu(K.length)&&!!x[xo(K)]}function Lu(K){if(!zu(K))return Vr(K);var X=[];for(var pe in Object(K))je.call(K,pe)&&pe!="constructor"&&X.push(pe);return X}function xa(K,X,pe,Se,Vt,ot){var Zt=pe&i,gr=K.length,It=X.length;if(gr!=It&&!(Zt&&It>gr))return!1;var Gt=ot.get(K);if(Gt&&ot.get(X))return Gt==X;var fr=-1,an=!0,mr=pe&s?new Ci:void 0;for(ot.set(K,X),ot.set(X,K);++fr<gr;){var Xt=K[fr],Yr=X[fr];if(Se)var ni=Zt?Se(Yr,Xt,fr,X,K,ot):Se(Xt,Yr,fr,K,X,ot);if(ni!==void 0){if(ni)continue;an=!1;break}if(mr){if(!Ie(X,function(qn,Pi){if(!Ce(mr,Pi)&&(Xt===qn||Vt(Xt,qn,pe,Se,ot)))return mr.push(Pi)})){an=!1;break}}else if(!(Xt===Yr||Vt(Xt,Yr,pe,Se,ot))){an=!1;break}}return ot.delete(K),ot.delete(X),an}function Bd(K,X,pe,Se,Vt,ot,Zt){switch(pe){case ae:if(K.byteLength!=X.byteLength||K.byteOffset!=X.byteOffset)return!1;K=K.buffer,X=X.buffer;case te:return!(K.byteLength!=X.byteLength||!ot(new nr(K),new nr(X)));case m:case _:case W:return Hu(+K,+X);case E:return K.name==X.name&&K.message==X.message;case j:case g:return K==X+"";case R:var gr=Ee;case P:var It=Se&i;if(gr||(gr=Ge),K.size!=X.size&&!It)return!1;var Gt=Zt.get(K);if(Gt)return Gt==X;Se|=s,Zt.set(K,X);var fr=xa(gr(K),gr(X),Se,Vt,ot,Zt);return Zt.delete(K),fr;case C:if(Ze)return Ze.call(K)==Ze.call(X)}return!1}function Bu(K,X,pe,Se,Vt,ot){var Zt=pe&i,gr=Sa(K),It=gr.length,Gt=Sa(X),fr=Gt.length;if(It!=fr&&!Zt)return!1;for(var an=It;an--;){var mr=gr[an];if(!(Zt?mr in X:je.call(X,mr)))return!1}var Xt=ot.get(K);if(Xt&&ot.get(X))return Xt==X;var Yr=!0;ot.set(K,X),ot.set(X,K);for(var ni=Zt;++an<It;){mr=gr[an];var qn=K[mr],Pi=X[mr];if(Se)var Kc=Zt?Se(Pi,qn,mr,X,K,ot):Se(qn,Pi,mr,K,X,ot);if(!(Kc===void 0?qn===Pi||Vt(qn,Pi,pe,Se,ot):Kc)){Yr=!1;break}ni||(ni=mr=="constructor")}if(Yr&&!ni){var Do=K.constructor,Sr=X.constructor;Do!=Sr&&"constructor"in K&&"constructor"in X&&!(typeof Do=="function"&&Do instanceof Do&&typeof Sr=="function"&&Sr instanceof Sr)&&(Yr=!1)}return ot.delete(K),ot.delete(X),Yr}function Sa(K){return qc(K,kd,Fu)}function Cs(K,X){var pe=K.__data__;return ku(X)?pe[typeof X=="string"?"string":"hash"]:pe.map}function _n(K,X){var pe=Fe(K,X);return Ld(pe)?pe:void 0}function Uu(K){var X=je.call(K,ir),pe=K[ir];try{K[ir]=void 0;var Se=!0}catch{}var Vt=$e.call(K);return Se&&(X?K[ir]=pe:delete K[ir]),Vt}var Fu=St?function(K){return K==null?[]:(K=Object(K),Oe(St(K),function(X){return dt.call(K,X)}))}:Wt,Oi=xo;(Ye&&Oi(new Ye(new ArrayBuffer(1)))!=ae||He&&Oi(new He)!=R||Rt&&Oi(Rt.resolve())!=z||Je&&Oi(new Je)!=P||Ve&&Oi(new Ve)!=J)&&(Oi=function(K){var X=xo(K),pe=X==F?K.constructor:void 0,Se=pe?Vi(pe):"";if(Se)switch(Se){case Xe:return ae;case et:return R;case Lt:return z;case tt:return P;case Qe:return J}return X});function ju(K,X){return X=X??c,!!X&&(typeof K=="number"||de.test(K))&&K>-1&&K%1==0&&K<X}function ku(K){var X=typeof K;return X=="string"||X=="number"||X=="symbol"||X=="boolean"?K!=="__proto__":K===null}function qu(K){return!!Te&&Te in K}function zu(K){var X=K&&K.constructor,pe=typeof X=="function"&&X.prototype||Be;return K===pe}function Ud(K){return $e.call(K)}function Vi(K){if(K!=null){try{return Pe.call(K)}catch{}try{return K+""}catch{}}return""}function Hu(K,X){return K===X||K!==K&&X!==X}var Ku=zc(function(){return arguments}())?zc:function(K){return Io(K)&&je.call(K,"callee")&&!dt.call(K,"callee")},Ia=Array.isArray;function Fd(K){return K!=null&&Wu(K.length)&&!Da(K)}var Hc=Ot||Kt;function jd(K,X){return So(K,X)}function Da(K){if(!Vu(K))return!1;var X=xo(K);return X==A||X==I||X==h||X==$}function Wu(K){return typeof K=="number"&&K>-1&&K%1==0&&K<=c}function Vu(K){var X=typeof K;return K!=null&&(X=="object"||X=="function")}function Io(K){return K!=null&&typeof K=="object"}var Gu=ue?ze(ue):Ru;function kd(K){return Fd(K)?$u(K):Lu(K)}function Wt(){return[]}function Kt(){return!1}t.exports=jd})(n0,n0.exports);var _S=n0.exports;function ES(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],c=[],l={},f=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:f,headers:{keys:function(){return s},entries:function(){return c},get:function(m){return l[m.toLowerCase()]},has:function(m){return m.toLowerCase()in l}}}};for(var h in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(m,_,E){s.push(_=_.toLowerCase()),c.push([_,E]),l[_]=l[_]?l[_]+","+E:E}),r(f())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(h,e.headers[h]);i.send(e.body||null)})}var AS=Object.freeze({__proto__:null,default:ES}),Iv=Us(AS),xS=self.fetch||(self.fetch=Iv.default||Iv),SS=Object.defineProperty,Dv=Object.getOwnPropertySymbols,IS=Object.prototype.hasOwnProperty,DS=Object.prototype.propertyIsEnumerable,Cv=(t,e,r)=>e in t?SS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e)=>{for(var r in e||(e={}))IS.call(e,r)&&Cv(t,r,e[r]);if(Dv)for(var r of Dv(e))DS.call(e,r)&&Cv(t,r,e[r]);return t};function CS(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),c=s.charCodeAt(0);if(r[c]!==255)throw new TypeError(s+" is ambiguous");r[c]=i}var l=t.length,f=t.charAt(0),h=Math.log(l)/Math.log(256),m=Math.log(256)/Math.log(l);function _(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var R=0,W=0,Y=0,F=I.length;Y!==F&&I[Y]===0;)Y++,R++;for(var z=(F-Y)*m+1>>>0,$=new Uint8Array(z);Y!==F;){for(var j=I[Y],P=0,g=z-1;(j!==0||P<W)&&g!==-1;g--,P++)j+=256*$[g]>>>0,$[g]=j%l>>>0,j=j/l>>>0;if(j!==0)throw new Error("Non-zero carry");W=P,Y++}for(var C=z-W;C!==z&&$[C]===0;)C++;for(var Z=f.repeat(R);C<z;++C)Z+=t.charAt($[C]);return Z}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var R=0;if(I[R]!==" "){for(var W=0,Y=0;I[R]===f;)W++,R++;for(var F=(I.length-R)*h+1>>>0,z=new Uint8Array(F);I[R];){var $=r[I.charCodeAt(R)];if($===255)return;for(var j=0,P=F-1;($!==0||j<Y)&&P!==-1;P--,j++)$+=l*z[P]>>>0,z[P]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");Y=j,R++}if(I[R]!==" "){for(var g=F-Y;g!==F&&z[g]===0;)g++;for(var C=new Uint8Array(W+(F-g)),Z=W;g!==F;)C[Z++]=z[g++];return C}}}function A(I){var R=E(I);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:A}}var OS=CS,PS=OS;const Ov=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},MS=t=>new TextEncoder().encode(t),TS=t=>new TextDecoder().decode(t);class $S{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class NS{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Pv(this,e)}}class RS{constructor(e){this.decoders=e}or(e){return Pv(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Pv=(t,e)=>new RS(Hr(Hr({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class LS{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new $S(e,r,n),this.decoder=new NS(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Jl=({name:t,prefix:e,encode:r,decode:n})=>new LS(t,e,r,n),yc=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=PS(r,e);return Jl({prefix:t,name:e,encode:n,decode:s=>Ov(i(s))})},BS=(t,e,r,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let s=t.length;for(;t[s-1]==="=";)--s;const c=new Uint8Array(s*r/8|0);let l=0,f=0,h=0;for(let m=0;m<s;++m){const _=i[t[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|_,l+=r,l>=8&&(l-=8,c[h++]=255&f>>l)}if(l>=r||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return c},US=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",c=0,l=0;for(let f=0;f<t.length;++f)for(l=l<<8|t[f],c+=8;c>r;)c-=r,s+=e[i&l>>c];if(c&&(s+=e[i&l<<r-c]),n)for(;s.length*r&7;)s+="=";return s},Mr=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Jl({prefix:e,name:t,encode(i){return US(i,n,r)},decode(i){return BS(i,n,r,t)}}),FS=Jl({prefix:"\0",name:"identity",encode:t=>TS(t),decode:t=>MS(t)});var jS=Object.freeze({__proto__:null,identity:FS});const kS=Mr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qS=Object.freeze({__proto__:null,base2:kS});const zS=Mr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var HS=Object.freeze({__proto__:null,base8:zS});const KS=yc({prefix:"9",name:"base10",alphabet:"0123456789"});var WS=Object.freeze({__proto__:null,base10:KS});const VS=Mr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),GS=Mr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var YS=Object.freeze({__proto__:null,base16:VS,base16upper:GS});const JS=Mr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),QS=Mr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ZS=Mr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),XS=Mr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),e9=Mr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),t9=Mr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),r9=Mr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),n9=Mr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),i9=Mr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var s9=Object.freeze({__proto__:null,base32:JS,base32upper:QS,base32pad:ZS,base32padupper:XS,base32hex:e9,base32hexupper:t9,base32hexpad:r9,base32hexpadupper:n9,base32z:i9});const o9=yc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),a9=yc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var c9=Object.freeze({__proto__:null,base36:o9,base36upper:a9});const l9=yc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),u9=yc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var h9=Object.freeze({__proto__:null,base58btc:l9,base58flickr:u9});const f9=Mr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),d9=Mr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),p9=Mr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),g9=Mr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var m9=Object.freeze({__proto__:null,base64:f9,base64pad:d9,base64url:p9,base64urlpad:g9});const Mv=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}"),v9=Mv.reduce((t,e,r)=>(t[r]=e,t),[]),y9=Mv.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function w9(t){return t.reduce((e,r)=>(e+=v9[r],e),"")}function b9(t){const e=[];for(const r of t){const n=y9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const _9=Jl({prefix:"\u{1F680}",name:"base256emoji",encode:w9,decode:b9});var E9=Object.freeze({__proto__:null,base256emoji:_9}),A9=$v,Tv=128,x9=127,S9=~x9,I9=Math.pow(2,31);function $v(t,e,r){e=e||[],r=r||0;for(var n=r;t>=I9;)e[r++]=t&255|Tv,t/=128;for(;t&S9;)e[r++]=t&255|Tv,t>>>=7;return e[r]=t|0,$v.bytes=r-n+1,e}var D9=i0,C9=128,Nv=127;function i0(t,n){var r=0,n=n||0,i=0,s=n,c,l=t.length;do{if(s>=l)throw i0.bytes=0,new RangeError("Could not decode varint");c=t[s++],r+=i<28?(c&Nv)<<i:(c&Nv)*Math.pow(2,i),i+=7}while(c>=C9);return i0.bytes=s-n,r}var O9=Math.pow(2,7),P9=Math.pow(2,14),M9=Math.pow(2,21),T9=Math.pow(2,28),$9=Math.pow(2,35),N9=Math.pow(2,42),R9=Math.pow(2,49),L9=Math.pow(2,56),B9=Math.pow(2,63),U9=function(t){return t<O9?1:t<P9?2:t<M9?3:t<T9?4:t<$9?5:t<N9?6:t<R9?7:t<L9?8:t<B9?9:10},F9={encode:A9,decode:D9,encodingLength:U9},Rv=F9;const Lv=(t,e,r=0)=>(Rv.encode(t,e,r),e),Bv=t=>Rv.encodingLength(t),s0=(t,e)=>{const r=e.byteLength,n=Bv(t),i=n+Bv(r),s=new Uint8Array(i+r);return Lv(t,s,0),Lv(r,s,n),s.set(e,i),new j9(t,r,e,s)};class j9{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Uv=({name:t,code:e,encode:r})=>new k9(t,e,r);class k9{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?s0(this.code,r):r.then(n=>s0(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Fv=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),q9=Uv({name:"sha2-256",code:18,encode:Fv("SHA-256")}),z9=Uv({name:"sha2-512",code:19,encode:Fv("SHA-512")});var H9=Object.freeze({__proto__:null,sha256:q9,sha512:z9});const jv=0,K9="identity",kv=Ov;var W9=Object.freeze({__proto__:null,identity:{code:jv,name:K9,encode:kv,digest:t=>s0(jv,kv(t))}});new TextEncoder,new TextDecoder;const qv=Hr(Hr(Hr(Hr(Hr(Hr(Hr(Hr(Hr(Hr({},jS),qS),HS),WS),YS),s9),c9),h9),m9),E9);Hr(Hr({},H9),W9);function zv(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function V9(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?zv(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Hv(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Kv=Hv("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),o0=Hv("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=V9(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),G9=Hr({utf8:Kv,"utf-8":Kv,hex:qv.base16,latin1:o0,ascii:o0,binary:o0},qv);function Y9(t,e="utf8"){const r=G9[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?zv(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}const Wv="wc",J9=2,a0="core",hs=`${Wv}@2:${a0}:`,Q9={name:a0,logger:"error"},Z9={database:":memory:"},X9="crypto",Vv="client_ed25519_seed",eI=_e.ONE_DAY,tI="keychain",rI="0.3",nI="messages",iI="0.3",sI=_e.SIX_HOURS,oI="publisher",Gv="irn",aI="error",Yv="wss://relay.walletconnect.com",Jv="wss://relay.walletconnect.org",cI="relayer",yn={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"},lI="_subscription",$n={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},uI=_e.ONE_SECOND,hI="2.12.1",fI=1e4,dI="0.3",pI="WALLETCONNECT_CLIENT_ID",_i={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},gI="subscription",mI="0.3",vI=_e.FIVE_SECONDS*1e3,yI="pairing",wI="0.3",wc={wc_pairingDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:0},res:{ttl:_e.ONE_DAY,prompt:!1,tag:0}}},ra={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},ti={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},bI="history",_I="0.3",EI="expirer",Nn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},AI="0.3",c0="verify-api",na="https://verify.walletconnect.com",l0="https://verify.walletconnect.org",xI=[na,l0],SI="echo",II="https://echo.walletconnect.com";class DI{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=tI,this.version=rI,this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=me("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=vn(r,this.name)}get context(){return mn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,sg(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?og(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CI{constructor(e,r,n){this.core=e,this.logger=r,this.name=X9,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=hv(i);return uv(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=zE();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),c=hv(s),l=Nf();return await Tx(l,i,eI,c)},this.generateSharedKey=(i,s,c)=>{this.isInitialized();const l=this.getPrivateKey(i),f=HE(l,s);return this.setSymKey(f,c)},this.setSymKey=async(i,s)=>{this.isInitialized();const c=s||Rl(i);return await this.keychain.set(c,i),c},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,c)=>{this.isInitialized();const l=xm(c),f=Ui(s);if(Sm(l)){const E=l.senderPublicKey,A=l.receiverPublicKey;i=await this.generateSharedKey(E,A)}const h=this.getSymKey(i),{type:m,senderPublicKey:_}=l;return WE({type:m,symKey:h,message:f,senderPublicKey:_})},this.decode=async(i,s,c)=>{this.isInitialized();const l=YE(s,c);if(Sm(l)){const f=l.receiverPublicKey,h=l.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=VE({symKey:f,encoded:s});return hc(h)}catch(f){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(f)}},this.getPayloadType=i=>{const s=Ll(i);return oc(s.type)},this.getPayloadSenderPublicKey=i=>{const s=Ll(i);return s.senderPublicKey?Fr(s.senderPublicKey,qr):void 0},this.core=e,this.logger=vn(r,this.name),this.keychain=n||new DI(this.core,this.logger)}get context(){return mn(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Vv)}catch{e=Nf(),await this.keychain.set(Vv,e)}return Y9(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class OI extends lx{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=nI,this.version=iI,this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Vs(i);let c=this.messages.get(n);return typeof c>"u"&&(c={}),typeof c[s]<"u"||(c[s]=i,this.messages.set(n,c),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),c=Vs(i);return typeof s[c]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=vn(e,this.name),this.core=r}get context(){return mn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,sg(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?og(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class PI extends ux{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Dr.exports.EventEmitter,this.name=oI,this.queue=new Map,this.publishTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.failedPublishTimeout=_e.toMiliseconds(_e.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const l=s?.ttl||sI,f=Rf(s),h=s?.prompt||!1,m=s?.tag||0,_=s?.id||Qs().toString(),E={topic:n,message:i,opts:{ttl:l,relay:f,prompt:h,tag:m,id:_}},A=`Failed to publish payload, please try again. id:${_} tag:${m}`,I=Date.now();let R,W=1;try{for(;R===void 0;){if(Date.now()-I>this.publishTimeout)throw new Error(A);this.logger.trace({id:_,attempts:W},`publisher.publish - attempt ${W}`),R=await await Ja(this.rpcPublish(n,i,l,f,h,m,_).catch(Y=>this.logger.warn(Y)),this.publishTimeout,A),W++,R||await new Promise(Y=>setTimeout(Y,this.failedPublishTimeout))}this.relayer.events.emit(yn.publish,E),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:_,topic:n,message:i,opts:s}})}catch(Y){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(Y),(c=s?.internal)!=null&&c.throwOnFailedPublish)throw Y;this.queue.set(_,E)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=vn(r,this.name),this.registerEventListeners()}get context(){return mn(this.logger)}rpcPublish(e,r,n,i,s,c,l){var f,h,m,_;const E={method:Bl(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:c},id:l};return zr((f=E.params)==null?void 0:f.prompt)&&((h=E.params)==null||delete h.prompt),zr((m=E.params)==null?void 0:m.tag)&&((_=E.params)==null||delete _.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:E}),this.relayer.request(E)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(yn.connection_stalled);return}this.checkQueue()}),this.relayer.on(yn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class MI{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var TI=Object.defineProperty,$I=Object.defineProperties,NI=Object.getOwnPropertyDescriptors,Qv=Object.getOwnPropertySymbols,RI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,Zv=(t,e,r)=>e in t?TI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bc=(t,e)=>{for(var r in e||(e={}))RI.call(e,r)&&Zv(t,r,e[r]);if(Qv)for(var r of Qv(e))LI.call(e,r)&&Zv(t,r,e[r]);return t},u0=(t,e)=>$I(t,NI(e));class BI extends dx{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new MI,this.events=new Dr.exports.EventEmitter,this.name=gI,this.version=mI,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hs,this.subscribeTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=Rf(i),c={topic:n,relay:s};this.pending.set(n,c);const l=await this.rpcSubscribe(n,s);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),l}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,c)=>{const l=new _e.Watch;l.start(i);const f=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(f),l.stop(i),s(!0)),l.elapsed(i)>=vI&&(clearInterval(f),l.stop(i),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.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=vn(r,this.name),this.clientId=""}get context(){return mn(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,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=Rf(n);await this.rpcUnsubscribe(e,r,i);const s=Ut("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){const n={method:Bl(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Ja(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?Vs(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(yn.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:Bl(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Ja(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(yn.connection_stalled)}}rpcUnsubscribe(e,r,n){const i={method:Bl(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,u0(bc({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,bc({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,bc({},r)),this.topicMap.set(r.topic,e),this.events.emit(_i.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(_i.deleted,u0(bc({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(_i.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(_i.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);wi(r)&&this.onBatchSubscribe(r.map((n,i)=>u0(bc({},e[i]),{id:n})))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(_i.created,async e=>{const r=_i.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(_i.deleted,async e=>{const r=_i.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var UI=Object.defineProperty,Xv=Object.getOwnPropertySymbols,FI=Object.prototype.hasOwnProperty,jI=Object.prototype.propertyIsEnumerable,ey=(t,e,r)=>e in t?UI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kI=(t,e)=>{for(var r in e||(e={}))FI.call(e,r)&&ey(t,r,e[r]);if(Xv)for(var r of Xv(e))jI.call(e,r)&&ey(t,r,e[r]);return t};class qI extends hx{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Dr.exports.EventEmitter,this.name=cI,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=_e.toMiliseconds(_e.THIRTY_SECONDS+_e.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||Qs().toString();await this.toEstablishConnection();try{const c=this.provider.request(r);this.requestsInFlight.set(s,{promise:c,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const l=await new Promise(async(f,h)=>{const m=()=>{h(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on($n.disconnect,m);const _=await c;this.provider.off($n.disconnect,m),f(_)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),l}catch(c){throw this.logger.debug(`Failed to Publish Request: ${s}`),c}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Ga())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(yn.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(yn.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on($n.payload,this.onPayloadHandler),this.provider.on($n.connect,this.onConnectHandler),this.provider.on($n.disconnect,this.onDisconnectHandler),this.provider.on($n.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?vn(e.logger,this.name):ls(sv({level:e.logger||aI})),this.messages=new OI(this.logger,e.core),this.subscriber=new BI(this,this.logger),this.publisher=new PI(this,this.logger),this.relayUrl=e?.relayUrl||Yv,this.projectId=e.projectId,this.bundleId=T_(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Jv}...`),await this.restartTransport(Jv)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},fI)}get context(){return mn(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",s;const c=l=>{l.topic===e&&(this.subscriber.off(_i.created,c),s())};return await Promise.all([new Promise(l=>{s=l,this.subscriber.on(_i.created,c)}),new Promise(async l=>{i=await this.subscriber.subscribe(e,r)||i,l()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async 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 Ja(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(r,n)=>{const i=()=>{this.provider.off($n.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on($n.disconnect,i),await Ja(this.provider.connect(),_e.toMiliseconds(_e.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Bm())throw new Error("No internet connection detected. Please restart your network and try again.")}startPingTimeout(){var e,r,n,i,s;if(Ga())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(c){this.logger.warn(c)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ki(new bS(U_({sdkVersion:hI,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:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),r0(e)){if(!e.method.endsWith(lI))return;const r=e.params,{topic:n,message:i,publishedAt:s}=r.data,c={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(kI({type:"event",event:r.id},c)),this.events.emit(r.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else Yl(e)&&this.events.emit(yn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(yn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vl(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off($n.payload,this.onPayloadHandler),this.provider.off($n.connect,this.onConnectHandler),this.provider.off($n.disconnect,this.onDisconnectHandler),this.provider.off($n.error,this.onProviderErrorHandler)}async registerEventListeners(){let e=await Bm();FA(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.events.emit(yn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},_e.toMiliseconds(uI))}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var zI=Object.defineProperty,ty=Object.getOwnPropertySymbols,HI=Object.prototype.hasOwnProperty,KI=Object.prototype.propertyIsEnumerable,ry=(t,e,r)=>e in t?zI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ny=(t,e)=>{for(var r in e||(e={}))HI.call(e,r)&&ry(t,r,e[r]);if(ty)for(var r of ty(e))KI.call(e,r)&&ry(t,r,e[r]);return t};class Zs extends fx{constructor(e,r,n,i=hs,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=dI,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!zr(c)?this.map.set(this.getKey(c),c):mA(c)?this.map.set(c.id,c):vA(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,l)=>{this.isInitialized(),this.map.has(c)?await this.update(c,l):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:l}),this.map.set(c,l),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(l=>Object.keys(c).every(f=>_S(l[f],c[f]))):this.values),this.update=async(c,l)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:l});const f=ny(ny({},this.getData(c)),l);this.map.set(c,f),await this.persist()},this.delete=async(c,l)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:l}),this.map.delete(c),this.addToRecentlyDeleted(c),await this.persist())},this.logger=vn(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return mn(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 r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=me("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WI{constructor(e,r){this.core=e,this.logger=r,this.name=yI,this.version=wI,this.events=new Dr.exports,this.initialized=!1,this.storagePrefix=hs,this.ignoredPayloadTypes=[cs],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=Nf(),s=await this.core.crypto.setSymKey(i),c=Nr(_e.FIVE_MINUTES),l={protocol:Gv},f={topic:s,expiry:c,relay:l,active:!1},h=oA({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:l,expiryTimestamp:c,methods:n?.methods});return await this.pairings.set(s,f),await this.core.relayer.subscribe(s),this.core.expirer.set(s,c),{topic:s,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:s,relay:c,expiryTimestamp:l,methods:f}=Om(n.uri);let h;if(this.pairings.keys.includes(i)&&(h=this.pairings.get(i),h.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);const m=l||Nr(_e.FIVE_MINUTES),_={topic:i,relay:c,expiry:m,active:!1,methods:f};return await this.pairings.set(i,_),this.core.expirer.set(i,m),n.activatePairing&&await this.activate({topic:i}),this.events.emit(ra.create,_),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:c}),_},this.activate=async({topic:n})=>{this.isInitialized();const i=Nr(_e.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:c,resolve:l,reject:f}=zs();this.events.once(yt("pairing_ping",s),({error:h})=>{h?f(h):l()}),await c()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Ut("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{const c=ta(i,s),l=await this.core.crypto.encode(n,c),f=wc[i].req;return this.core.history.set(n,c),this.core.relayer.publish(n,l,f),c.id},this.sendResult=async(n,i,s)=>{const c=Vl(n,s),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=wc[f.request.method].res;await this.core.relayer.publish(i,l,h),await this.core.history.resolve(c)},this.sendError=async(n,i,s)=>{const c=Gl(n,s),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=wc[f.request.method]?wc[f.request.method].res:wc.unregistered_method.res;await this.core.relayer.publish(i,l,h),await this.core.history.resolve(c)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Ut("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>is(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,c=(await this.core.history.get(i,s.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(ra.ping,{id:s,topic:n})}catch(c){await this.sendError(s,n,c),this.logger.error(c)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{bi(i)?this.events.emit(yt("pairing_ping",s),{}):Tn(i)&&this.events.emit(yt("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(ra.delete,{id:s,topic:n})}catch(c){await this.sendError(s,n,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:c}=i;try{if(this.registeredMethods.includes(c))return;const l=Ut("WC_METHOD_UNSUPPORTED",c);await this.sendError(s,n,l),this.logger.error(l)}catch(l){await this.sendError(s,n,l),this.logger.error(l)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Ut("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!rn(n)){const{message:c}=me("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!gA(n.uri)){const{message:c}=me("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const s=Om(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){const{message:c}=me("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(c)}if(!(s!=null&&s.symKey)){const{message:c}=me("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(c)}if(s!=null&&s.expiryTimestamp&&_e.toMiliseconds(s?.expiryTimestamp)<Date.now()){const{message:c}=me("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}},this.isValidPing=async n=>{if(!rn(n)){const{message:s}=me("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!rn(n)){const{message:s}=me("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ur(n,!1)){const{message:i}=me("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=me("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(is(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=me("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=vn(r,this.name),this.pairings=new Zs(this.core,this.logger,this.name,this.storagePrefix)}get context(){return mn(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(yn.message,async e=>{const{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(r,n);try{r0(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Yl(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Nn.expired,async e=>{const{topic:r}=cg(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(ra.expire,{topic:r}))})}}class VI extends cx{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Dr.exports.EventEmitter,this.name=bI,this.version=_I,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const c={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:Nr(_e.THIRTY_DAYS)};this.records.set(c.id,c),this.persist(),this.events.emit(ti.created,c)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Tn(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(ti.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(ti.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=vn(r,this.name)}get context(){return mn(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(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ta(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(ti.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(ti.created,e=>{const r=ti.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(ti.updated,e=>{const r=ti.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(ti.deleted,e=>{const r=ti.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{_e.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(ti.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class GI extends px{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Dr.exports.EventEmitter,this.name=EI,this.version=AI,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),c={target:s,expiry:i};this.expirations.set(s,c),this.checkExpiry(s,c),this.events.emit(Nn.created,{target:s,expiration:c})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Nn.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=vn(r,this.name)}get context(){return mn(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 F_(e);if(typeof e=="number")return j_(e);const{message:r}=me("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Nn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;_e.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Nn.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Nn.created,e=>{const r=Nn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Nn.expired,e=>{const r=Nn.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Nn.deleted,e=>{const r=Nn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class YI extends gx{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=c0,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||jo()||!ko())return;const i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=l0;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const i=this.getVerifyUrl(n?.verifyUrl);let s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(c){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(c),s=await this.fetchAttestation(n.attestationId,l0)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const s=this.startAbortTimer(_e.ONE_SECOND*2),c=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),c.status===200?await c.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const i=s=>{s.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{const c=document.getElementById(c0);if(c)return this.iframe=c,this.onInit(),s();window.addEventListener("message",i);const l=document.createElement("iframe");l.id=c0,l.src=`${this.verifyUrl}/${this.projectId}`,l.style.display="none",document.body.append(l),this.iframe=l,n=s}),new Promise((s,c)=>setTimeout(()=>{window.removeEventListener("message",i),c("verify iframe load timeout")},_e.toMiliseconds(_e.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||na;return xI.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${na}`),i=na),i},this.logger=vn(r,this.name),this.verifyUrl=na,this.abortController=new AbortController,this.isDevEnv=Ga()&&process.env.IS_VITEST}get context(){return mn(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),_e.toMiliseconds(e))}}class JI extends mx{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=SI,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:c,enableEncrypted:l=!1}=n,f=`${II}/${this.projectId}/clients`;await xS(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:s,always_raw:l})})},this.logger=vn(r,this.context)}}var QI=Object.defineProperty,iy=Object.getOwnPropertySymbols,ZI=Object.prototype.hasOwnProperty,XI=Object.prototype.propertyIsEnumerable,sy=(t,e,r)=>e in t?QI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oy=(t,e)=>{for(var r in e||(e={}))ZI.call(e,r)&&sy(t,r,e[r]);if(iy)for(var r of iy(e))XI.call(e,r)&&sy(t,r,e[r]);return t};class h0 extends ax{constructor(e){var r;super(e),this.protocol=Wv,this.version=J9,this.name=a0,this.events=new Dr.exports.EventEmitter,this.initialized=!1,this.on=(c,l)=>this.events.on(c,l),this.once=(c,l)=>this.events.once(c,l),this.off=(c,l)=>this.events.off(c,l),this.removeListener=(c,l)=>this.events.removeListener(c,l),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Yv,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=sv({level:typeof e?.logger=="string"&&e.logger?e.logger:Q9.logger}),{logger:i,chunkLoggerController:s}=ox({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=vn(i,this.name),this.heartbeat=new ea.HeartBeat,this.crypto=new CI(this,this.logger,e?.keychain),this.history=new VI(this,this.logger),this.expirer=new GI(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new w7(oy(oy({},Z9),e?.storageOptions)),this.relayer=new qI({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new WI(this,this.logger),this.verify=new YI(this.projectId||"",this.logger),this.echoClient=new JI(this.projectId||"",this.logger)}static async init(e){const r=new h0(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(pI,n),r}get context(){return mn(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 initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const eD=h0;var Xs={};/*! *****************************************************************************
57
- Copyright (c) Microsoft Corporation.
58
-
59
- Permission to use, copy, modify, and/or distribute this software for any
60
- purpose with or without fee is hereby granted.
61
-
62
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
63
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
64
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
65
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
66
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
67
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
68
- PERFORMANCE OF THIS SOFTWARE.
69
- ***************************************************************************** */var f0=function(t,e){return f0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},f0(t,e)};function tD(t,e){f0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var d0=function(){return d0=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},d0.apply(this,arguments)};function rD(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function nD(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function iD(t,e){return function(r,n){e(r,n,t)}}function sD(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function oD(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function aD(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function cD(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function lD(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function p0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ay(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function uD(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(ay(arguments[e]));return t}function hD(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function _c(t){return this instanceof _c?(this.v=t,this):new _c(t)}function fD(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof _c?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function dD(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:_c(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function pD(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof p0=="function"?p0(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function gD(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function mD(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function vD(t){return t&&t.__esModule?t:{default:t}}function yD(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function wD(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var bD=Object.freeze({__proto__:null,__extends:tD,get __assign(){return d0},__rest:rD,__decorate:nD,__param:iD,__metadata:sD,__awaiter:oD,__generator:aD,__createBinding:cD,__exportStar:lD,__values:p0,__read:ay,__spread:uD,__spreadArrays:hD,__await:_c,__asyncGenerator:fD,__asyncDelegator:dD,__asyncValues:pD,__makeTemplateObject:gD,__importStar:mD,__importDefault:vD,__classPrivateFieldGet:yD,__classPrivateFieldSet:wD}),_D=Us(bD),eo={},cy;function ly(){return cy||(cy=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.PINO_CUSTOM_CONTEXT_KEY=eo.PINO_LOGGER_DEFAULTS=void 0,eo.PINO_LOGGER_DEFAULTS={level:"info"},eo.PINO_CUSTOM_CONTEXT_KEY="custom_context"),eo}var Kr={},uy;function ED(){if(uy)return Kr;uy=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.generateChildLogger=Kr.formatChildLoggerContext=Kr.getLoggerContext=Kr.setBrowserLoggerContext=Kr.getBrowserLoggerContext=Kr.getDefaultLoggerOptions=void 0;const t=ly();function e(l){return Object.assign(Object.assign({},l),{level:l?.level||t.PINO_LOGGER_DEFAULTS.level})}Kr.getDefaultLoggerOptions=e;function r(l,f=t.PINO_CUSTOM_CONTEXT_KEY){return l[f]||""}Kr.getBrowserLoggerContext=r;function n(l,f,h=t.PINO_CUSTOM_CONTEXT_KEY){return l[h]=f,l}Kr.setBrowserLoggerContext=n;function i(l,f=t.PINO_CUSTOM_CONTEXT_KEY){let h="";return typeof l.bindings>"u"?h=r(l,f):h=l.bindings().context||"",h}Kr.getLoggerContext=i;function s(l,f,h=t.PINO_CUSTOM_CONTEXT_KEY){const m=i(l,h);return m.trim()?`${m}/${f}`:f}Kr.formatChildLoggerContext=s;function c(l,f,h=t.PINO_CUSTOM_CONTEXT_KEY){const m=s(l,f,h),_=l.child({context:m});return n(_,m,h)}return Kr.generateChildLogger=c,Kr}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const e=_D,r=e.__importDefault(ev());Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return r.default}}),e.__exportStar(ly(),t),e.__exportStar(ED(),t)})(Xs);const hy="wc",fy=2,dy="client",g0=`${hy}@${fy}:${dy}:`,m0={name:dy,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},py="WALLETCONNECT_DEEPLINK_CHOICE",AD="proposal",gy="Proposal expired",xD="session",ia=_e.SEVEN_DAYS,SD="engine",Rn={wc_sessionPropose:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1104},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1106},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1112},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1114},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:_e.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:_e.ONE_HOUR,prompt:!1,tag:1117}}},v0={min:_e.FIVE_MINUTES,max:_e.SEVEN_DAYS},qi={idle:"IDLE",active:"ACTIVE"},ID="request",DD=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],CD="wc",OD="auth",PD="authKeys",MD="pairingTopics",TD="requests",Ql=`${CD}@${1.5}:${OD}:`,Zl=`${Ql}:PUB_KEY`;var $D=Object.defineProperty,ND=Object.defineProperties,RD=Object.getOwnPropertyDescriptors,my=Object.getOwnPropertySymbols,LD=Object.prototype.hasOwnProperty,BD=Object.prototype.propertyIsEnumerable,vy=(t,e,r)=>e in t?$D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))LD.call(e,r)&&vy(t,r,e[r]);if(my)for(var r of my(e))BD.call(e,r)&&vy(t,r,e[r]);return t},sa=(t,e)=>ND(t,RD(e));class UD extends yx{constructor(e){super(e),this.name=SD,this.events=new Dr.exports,this.initialized=!1,this.requestQueue={state:qi.idle,queue:[]},this.sessionRequestQueue={state:qi.idle,queue:[]},this.requestQueueDelay=_e.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Rn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const n=sa(Er({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:c,sessionProperties:l,relays:f}=n;let h=i,m,_=!1;try{h&&(_=this.client.core.pairing.pairings.get(h).active)}catch($){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),$}if(!h||!_){const{topic:$,uri:j}=await this.client.core.pairing.create();h=$,m=j}if(!h){const{message:$}=me("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error($)}const E=await this.client.core.crypto.generateKeyPair(),A=Rn.wc_sessionPropose.req.ttl||_e.FIVE_MINUTES,I=Nr(A),R=Er({requiredNamespaces:s,optionalNamespaces:c,relays:f??[{protocol:Gv}],proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:I},l&&{sessionProperties:l}),{reject:W,resolve:Y,done:F}=zs(A,gy);this.events.once(yt("session_connect"),async({error:$,session:j})=>{if($)W($);else if(j){j.self.publicKey=E;const P=sa(Er({},j),{requiredNamespaces:R.requiredNamespaces,optionalNamespaces:R.optionalNamespaces});await this.client.session.set(j.topic,P),await this.setExpiry(j.topic,j.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:j.peer.metadata}),Y(P)}});const z=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:R,throwOnFailedPublish:!0});return await this.setProposal(z,Er({id:z},R)),{uri:m,approval:F}},this.pair=async r=>{await this.isInitialized();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{await this.isInitialized();try{await this.isValidApprove(r)}catch(F){throw this.client.logger.error("approve() -> isValidApprove() failed"),F}const{id:n,relayProtocol:i,namespaces:s,sessionProperties:c,sessionConfig:l}=r;let f;try{f=this.client.proposal.get(n)}catch(F){throw this.client.logger.error(`approve() -> proposal.get(${n}) failed`),F}let{pairingTopic:h,proposer:m,requiredNamespaces:_,optionalNamespaces:E}=f;h=h||"";const A=await this.client.core.crypto.generateKeyPair(),I=m.publicKey,R=await this.client.core.crypto.generateSharedKey(A,I),W=Er(Er({relay:{protocol:i??"irn"},namespaces:s,pairingTopic:h,controller:{publicKey:A,metadata:this.client.metadata},expiry:Nr(ia)},c&&{sessionProperties:c}),l&&{sessionConfig:l});await this.client.core.relayer.subscribe(R);const Y=sa(Er({},W),{topic:R,requiredNamespaces:_,optionalNamespaces:E,pairingTopic:h,acknowledged:!1,self:W.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:A});await this.client.session.set(R,Y);try{await this.sendResult({id:n,topic:h,result:{relay:{protocol:i??"irn"},responderPublicKey:A},throwOnFailedPublish:!0}),await this.sendRequest({topic:R,method:"wc_sessionSettle",params:W,throwOnFailedPublish:!0})}catch(F){throw this.client.logger.error(F),this.client.session.delete(R,Ut("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(R),F}return await this.client.core.pairing.updateMetadata({topic:h,metadata:m.metadata}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(R,Nr(ia)),{topic:R,acknowledged:()=>new Promise(F=>setTimeout(()=>F(this.client.session.get(R)),500))}},this.reject=async r=>{await this.isInitialized();try{await this.isValidReject(r)}catch(c){throw this.client.logger.error("reject() -> isValidReject() failed"),c}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(c){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),c}s&&(await this.sendError({id:n,topic:s,error:i}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized();try{await this.isValidUpdate(r)}catch(_){throw this.client.logger.error("update() -> isValidUpdate() failed"),_}const{topic:n,namespaces:i}=r,{done:s,resolve:c,reject:l}=zs(),f=us(),h=Qs().toString(),m=this.client.session.get(n).namespaces;return this.events.once(yt("session_update",f),({error:_})=>{_?l(_):c()}),await this.client.session.update(n,{namespaces:i}),this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:f,relayRpcId:h}).catch(_=>{this.client.logger.error(_),this.client.session.update(n,{namespaces:m}),l(_)}),{acknowledged:s}},this.extend=async r=>{await this.isInitialized();try{await this.isValidExtend(r)}catch(f){throw this.client.logger.error("extend() -> isValidExtend() failed"),f}const{topic:n}=r,i=us(),{done:s,resolve:c,reject:l}=zs();return this.events.once(yt("session_extend",i),({error:f})=>{f?l(f):c()}),await this.setExpiry(n,Nr(ia)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(f=>{l(f)}),{acknowledged:s}},this.request=async r=>{await this.isInitialized();try{await this.isValidRequest(r)}catch(A){throw this.client.logger.error("request() -> isValidRequest() failed"),A}const{chainId:n,request:i,topic:s,expiry:c=Rn.wc_sessionRequest.req.ttl}=r,l=this.client.session.get(s),f=us(),h=Qs().toString(),{done:m,resolve:_,reject:E}=zs(c,"Request expired. Please try again.");return this.events.once(yt("session_request",f),({error:A,result:I})=>{A?E(A):_(I)}),await Promise.all([new Promise(async A=>{await this.sendRequest({clientRpcId:f,relayRpcId:h,topic:s,method:"wc_sessionRequest",params:{request:sa(Er({},i),{expiryTimestamp:Nr(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(I=>E(I)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:f}),A()}),new Promise(async A=>{var I;if(!((I=l.sessionConfig)!=null&&I.disableDeepLink)){const R=await q_(this.client.core.storage,py);k_({id:f,topic:s,wcDeepLink:R})}A()}),m()]).then(A=>A[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i;bi(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):Tn(i)&&await this.sendError({id:s,topic:n,error:i.error}),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=us(),s=Qs().toString(),{done:c,resolve:l,reject:f}=zs();this.events.once(yt("session_ping",i),({error:h})=>{h?f(h):l()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),c()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,c=Qs().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:c})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Ut("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=me("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>dA(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async r=>{this.isInitialized(),this.isValidAuthenticate(r);const{chains:n,statement:i="",uri:s,domain:c,nonce:l,type:f,exp:h,nbf:m,methods:_=[]}=r,E=[...r.resources||[]],{topic:A,uri:I}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:A,uri:I}});const R=await this.client.core.crypto.generateKeyPair(),W=Rl(R);if(await Promise.all([this.client.auth.authKeys.set(Zl,{responseTopic:W,publicKey:R}),this.client.auth.pairingTopics.set(W,{topic:W,pairingTopic:A})]),await this.client.core.relayer.subscribe(W),this.client.logger.info(`sending request to new pairing topic: ${A}`),_.length>0){const{namespace:ae}=yl(n[0]);let p=BE(ae,"request",_);Nl(E)&&(p=FE(p,E.pop())),E.push(p)}const Y=Nr(Rn.wc_sessionPropose.req.ttl),F={authPayload:{type:f??"caip122",chains:n,statement:i,aud:s,domain:c,version:"1",nonce:l,iat:new Date().toISOString(),exp:h,nbf:m,resources:E},requester:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Y},z={eip155:{chains:n,methods:[...new Set(["personal_sign",..._])],events:["chainChanged","accountsChanged"]}},$={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],proposer:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Y},{done:j,resolve:P,reject:g}=zs(Rn.wc_sessionAuthenticate.req.ttl,"Request expired"),C=async({error:ae,session:p})=>{if(this.events.off(yt("session_request",J),Z),ae)g(ae);else if(p){p.self.publicKey=R,await this.client.session.set(p.topic,p),await this.setExpiry(p.topic,p.expiry),A&&await this.client.core.pairing.updateMetadata({topic:A,metadata:p.peer.metadata});const d=this.client.session.get(p.topic);P({session:d})}},Z=async ae=>{if(ae.error){const U=Ut("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return ae.error.code===U.code?void 0:(this.events.off(yt("session_connect"),C),g(ae.error.message))}this.events.off(yt("session_connect"),C);const{cacaos:p,responder:d}=ae.result,b=[],D=[];for(const U of p){await mm({cacao:U,projectId:this.client.core.projectId})||(this.client.logger.error(U,"Signature verification failed"),g(Ut("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:O}=U,v=Nl(O.resources),L=[gm(O.iss)],oe=$l(O.iss);if(v){const de=wm(v),x=bm(v);b.push(...de),L.push(...x)}for(const de of L)D.push(`${de}:${oe}`)}const M=await this.client.core.crypto.generateSharedKey(R,d.publicKey);let N;b.length>0&&(N={topic:M,acknowledged:!0,self:{publicKey:R,metadata:this.client.metadata},peer:d,controller:d.publicKey,expiry:Nr(ia),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:A,namespaces:Pm([...new Set(b)],[...new Set(D)])},await this.client.core.relayer.subscribe(M),await this.client.session.set(M,N),N=this.client.session.get(M)),P({auths:p,session:N})},J=us(),te=us();this.events.once(yt("session_connect"),C),this.events.once(yt("session_request",J),Z);try{await Promise.all([this.sendRequest({topic:A,method:"wc_sessionAuthenticate",params:F,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:J}),this.sendRequest({topic:A,method:"wc_sessionPropose",params:$,expiry:Rn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:te})])}catch(ae){throw this.events.off(yt("session_connect"),C),this.events.off(yt("session_request",J),Z),ae}return await this.setProposal(te,Er({id:te},$)),await this.client.auth.requests.set(J,{authPayload:F.authPayload,requester:F.requester,expiryTimestamp:Y,id:J,pairingTopic:A,verifyContext:{}}),{uri:I,response:j}},this.approveSessionAuthenticate=async r=>{this.isInitialized();const{id:n,auths:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);const c=s.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=Rl(c),h={type:cs,receiverPublicKey:c,senderPublicKey:l},m=[],_=[];for(const I of i){if(!await mm({cacao:I,projectId:this.client.core.projectId})){const z=Ut("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:z,encodeOpts:h}),new Error(z.message)}const{p:R}=I,W=Nl(R.resources),Y=[gm(R.iss)],F=$l(R.iss);if(W){const z=wm(W),$=bm(W);m.push(...z),Y.push(...$)}for(const z of Y)_.push(`${z}:${F}`)}const E=await this.client.core.crypto.generateSharedKey(l,c);let A;return m?.length>0&&(A={topic:E,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:s.requester.metadata},controller:c,expiry:Nr(ia),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:Pm([...new Set(m)],[...new Set(_)])},await this.client.core.relayer.subscribe(E),await this.client.session.set(E,A)),await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(n,{message:"fullfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),{session:A}},this.rejectSessionAuthenticate=async r=>{await this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);const c=s.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=Rl(c),h={type:cs,receiverPublicKey:c,senderPublicKey:l};await this.sendError({id:n,topic:f,error:i,encodeOpts:h}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return vm(n,i)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var c,l;return((c=s.peerMetadata)==null?void 0:c.url)&&((l=s.peerMetadata)==null?void 0:l.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{const{topic:n,expirerHasDeleted:i=!1,emitEvent:s=!0,id:c=0}=r,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Ut("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),i||this.client.core.expirer.del(n),this.client.core.storage.removeItem(py).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===n&&this.deletePendingSessionRequest(f.id,Ut("USER_DISCONNECTED"))}),s&&this.client.events.emit("session_delete",{id:c,topic:n})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ut("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=qi.idle,this.client.events.emit("session_request_expire",{id:r}))},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,Nr(Rn.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:c}=r,l=s.request.expiryTimestamp||Nr(Rn.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:c}),l&&this.client.core.expirer.set(n,l)},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:c,relayRpcId:l,clientRpcId:f,throwOnFailedPublish:h}=r,m=ta(i,s,f);if(ko()&&DD.includes(i)){const A=Vs(JSON.stringify(m));this.client.core.verify.register({attestationId:A})}let _;try{_=await this.client.core.crypto.encode(n,m)}catch(A){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),A}const E=Rn[i].req;return c&&(E.ttl=c),l&&(E.id=l),this.client.core.history.set(n,m),h?(E.internal=sa(Er({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,_,E)):this.client.core.relayer.publish(n,_,E).catch(A=>this.client.logger.error(A)),m.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:c,encodeOpts:l}=r,f=Vl(n,s);let h;try{h=await this.client.core.crypto.encode(i,f,l)}catch(E){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),E}let m;try{m=await this.client.core.history.get(i,n)}catch(E){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),E}const _=Rn[m.request.method].res;c?(_.internal=sa(Er({},_.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,h,_)):this.client.core.relayer.publish(i,h,_).catch(E=>this.client.logger.error(E)),await this.client.core.history.resolve(f)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:c}=r,l=Gl(n,s);let f;try{f=await this.client.core.crypto.encode(i,l,c)}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let h;try{h=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}const m=Rn[h.request.method].res;this.client.core.relayer.publish(i,f,m),await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;is(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{is(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===qi.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=qi.active;const r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=qi.idle},this.processRequest=r=>{const{topic:n,payload:i}=r,s=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:s}))switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=me("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidConnect(Er({},n.params));const c=i.expiryTimestamp||Nr(Rn.wc_sessionPropose.req.ttl),l=Er({id:s,pairingTopic:r,expiryTimestamp:c},i);await this.setProposal(s,l);const f=Vs(JSON.stringify(n)),h=await this.getVerifyContext(f,l.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:l,verifyContext:h})}catch(c){await this.sendError({id:s,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionProposeResponse=async(r,n)=>{const{id:i}=n;if(bi(n)){const{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});const c=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const f=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const h=await this.client.core.crypto.generateSharedKey(l,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const m=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:m}),await this.client.core.pairing.activate({topic:r})}else if(Tn(n)){await this.client.proposal.delete(i,Ut("USER_DISCONNECTED"));const s=yt("session_connect");if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners, 954`);this.events.emit(yt("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:c,controller:l,expiry:f,namespaces:h,sessionProperties:m,pairingTopic:_,sessionConfig:E}=n.params,A=Er(Er({topic:r,relay:c,expiry:f,namespaces:h,acknowledged:!0,pairingTopic:_,requiredNamespaces:{},optionalNamespaces:{},controller:l.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:l.publicKey,metadata:l.metadata}},m&&{sessionProperties:m}),E&&{sessionConfig:E});await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0});const I=yt("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(yt("session_connect"),{session:A}),this.cleanupDuplicatePairings(A)}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;bi(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(yt("session_approve",i),{})):Tn(n)&&(await this.client.session.delete(r,Ut("USER_DISCONNECTED")),this.events.emit(yt("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const c=`${r}_session_update`,l=lc.get(c);if(l&&this.isRequestOutOfSync(l,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Ut("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Er({topic:r},i));try{lc.set(c,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(f){throw lc.delete(c),f}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(c){await this.sendError({id:s,topic:r,error:c}),this.client.logger.error(c)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=yt("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bi(n)?this.events.emit(yt("session_update",i),{}):Tn(n)&&this.events.emit(yt("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Nr(ia)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=yt("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bi(n)?this.events.emit(yt("session_extend",i),{}):Tn(n)&&this.events.emit(yt("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=yt("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{bi(n)?this.events.emit(yt("session_ping",i),{}):Tn(n)&&this.events.emit(yt("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(yn.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Ut("USER_DISCONNECTED")})])}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{const{id:i,params:s}=n;try{await this.isValidRequest(Er({topic:r},s));const c=Vs(JSON.stringify(ta("wc_sessionRequest",s,i))),l=this.client.session.get(r),f=await this.getVerifyContext(c,l.peer.metadata),h={id:i,topic:r,params:s,verifyContext:f};await this.setPendingSessionRequest(h),this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue()}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=yt("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bi(n)?this.events.emit(yt("session_request",i),{result:n.result}):Tn(n)&&this.events.emit(yt("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const c=`${r}_session_event_${s.event.name}`,l=lc.get(c);if(l&&this.isRequestOutOfSync(l,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Er({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),lc.set(c,i)}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),bi(n)?this.events.emit(yt("session_request",i),{result:n.result}):Tn(n)&&this.events.emit(yt("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async(r,n)=>{const{requester:i,authPayload:s,expiryTimestamp:c}=n.params,l=Vs(JSON.stringify(n)),f=await this.getVerifyContext(l,this.client.metadata),h={requester:i,pairingTopic:r,id:n.id,authPayload:s,verifyContext:f,expiryTimestamp:c};await this.client.auth.requests.set(n.id,h),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id})},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=qi.idle,this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const c=s.request.id,l=yt("session_request",c);if(this.events.listenerCount(l)===0)throw new Error(`emitting ${l} without any listeners`);this.events.emit(yt("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===qi.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=qi.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,ta("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(f)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:c,relays:l}=r;if(zr(n)||await this.isValidPairingTopic(n),!SA(l,!0)){const{message:f}=me("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(f)}!zr(i)&&cc(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!zr(s)&&cc(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),zr(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=xA(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!rn(r))throw new Error(me("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:c}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),f=Uf(i,"approve()");if(f)throw new Error(f.message);const h=Rm(l.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!ur(s,!0)){const{message:m}=me("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(m)}zr(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async r=>{if(!rn(r)){const{message:s}=me("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!DA(i)){const{message:s}=me("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!rn(r)){const{message:h}=me("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(h)}const{relay:n,controller:i,namespaces:s,expiry:c}=r;if(!$m(n)){const{message:h}=me("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const l=yA(i,"onSessionSettleRequest()");if(l)throw new Error(l.message);const f=Uf(s,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(is(c)){const{message:h}=me("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(f)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),c=Uf(i,"update()");if(c)throw new Error(c.message);const l=Rm(s.requiredNamespaces,i,"update()");if(l)throw new Error(l.message)},this.isValidExtend=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(f)}const{topic:n,request:i,chainId:s,expiry:c}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:l}=this.client.session.get(n);if(!Nm(l,s)){const{message:f}=me("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(f)}if(!CA(i)){const{message:f}=me("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!MA(l,s,i.method)){const{message:f}=me("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!RA(c,v0)){const{message:f}=me("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${v0.min} and ${v0.max}`);throw new Error(f)}},this.isValidRespond=async r=>{var n;if(!rn(r)){const{message:c}=me("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(c)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(c){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),c}if(!OA(s)){const{message:c}=me("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(c)}},this.isValidPing=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!rn(r)){const{message:l}=me("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(l)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Nm(c,s)){const{message:l}=me("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(l)}if(!PA(i)){const{message:l}=me("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}if(!TA(c,s,i.name)){const{message:l}=me("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}},this.isValidDisconnect=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:c}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!ur(i,!1))throw new Error("uri is required parameter");if(!ur(s,!1))throw new Error("domain is required parameter");if(!ur(c,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(f=>yl(f).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:l}=yl(n[0]);if(l!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(r,n)=>{const i={verified:{verifyUrl:n.verifyUrl||na,validation:"UNKNOWN",origin:n.url||""}};try{const s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!ur(i,!1)){const{message:s}=me("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const c of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(c)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=me("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(yn.message,async e=>{const{topic:r,message:n}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(Zl)?this.client.auth.authKeys.get(Zl):{responseTopic:void 0,publicKey:void 0},s=await this.client.core.crypto.decode(r,n,{receiverPublicKey:i});try{r0(s)?(this.client.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yl(s)?(await this.client.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.client.core.history.delete(r,s.id)):this.onRelayEventUnknownPayload({topic:r,payload:s})}catch(c){this.client.logger.error(c)}})}registerExpirerEvents(){this.client.core.expirer.on(Nn.expired,async e=>{const{topic:r,id:n}=cg(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,me("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(ra.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(ra.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ur(e,!1)){const{message:r}=me("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(is(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=me("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!ur(e,!1)){const{message:r}=me("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(is(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=me("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=me("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}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(ur(e,!1)){const{message:r}=me("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=me("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!IA(e)){const{message:r}=me("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(is(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=me("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class FD extends Zs{constructor(e,r){super(e,r,AD,g0),this.core=e,this.logger=r}}class jD extends Zs{constructor(e,r){super(e,r,xD,g0),this.core=e,this.logger=r}}class kD extends Zs{constructor(e,r){super(e,r,ID,g0,n=>n.id),this.core=e,this.logger=r}}class qD extends Zs{constructor(e,r){super(e,r,PD,Ql,()=>Zl),this.core=e,this.logger=r}}class zD extends Zs{constructor(e,r){super(e,r,MD,Ql),this.core=e,this.logger=r}}class HD extends Zs{constructor(e,r){super(e,r,TD,Ql,n=>n.id),this.core=e,this.logger=r}}class KD{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new qD(this.core,this.logger),this.pairingTopics=new zD(this.core,this.logger),this.requests=new HD(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class y0 extends vx{constructor(e){super(e),this.protocol=hy,this.version=fy,this.name=m0.name,this.events=new Dr.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async n=>{try{return await this.engine.authenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||m0.name,this.metadata=e?.metadata||N_();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xs.pino(Xs.getDefaultLoggerOptions({level:e?.logger||m0.logger}));this.core=e?.core||new eD(e),this.logger=Xs.generateChildLogger(r,this.name),this.session=new jD(this.core,this.logger),this.proposal=new FD(this.core,this.logger),this.pendingRequest=new kD(this.core,this.logger),this.engine=new UD(this),this.auth=new KD(this.core,this.logger)}static async init(e){const r=new y0(e);return await r.initialize(),r}get context(){return Xs.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var w0={exports:{}};(function(t,e){var r=typeof self<"u"?self:Jn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(c){var l={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function f(d){return d&&DataView.prototype.isPrototypeOf(d)}if(l.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(d){return d&&h.indexOf(Object.prototype.toString.call(d))>-1};function _(d){if(typeof d!="string"&&(d=String(d)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(d))throw new TypeError("Invalid character in header field name");return d.toLowerCase()}function E(d){return typeof d!="string"&&(d=String(d)),d}function A(d){var b={next:function(){var D=d.shift();return{done:D===void 0,value:D}}};return l.iterable&&(b[Symbol.iterator]=function(){return b}),b}function I(d){this.map={},d instanceof I?d.forEach(function(b,D){this.append(D,b)},this):Array.isArray(d)?d.forEach(function(b){this.append(b[0],b[1])},this):d&&Object.getOwnPropertyNames(d).forEach(function(b){this.append(b,d[b])},this)}I.prototype.append=function(d,b){d=_(d),b=E(b);var D=this.map[d];this.map[d]=D?D+", "+b:b},I.prototype.delete=function(d){delete this.map[_(d)]},I.prototype.get=function(d){return d=_(d),this.has(d)?this.map[d]:null},I.prototype.has=function(d){return this.map.hasOwnProperty(_(d))},I.prototype.set=function(d,b){this.map[_(d)]=E(b)},I.prototype.forEach=function(d,b){for(var D in this.map)this.map.hasOwnProperty(D)&&d.call(b,this.map[D],D,this)},I.prototype.keys=function(){var d=[];return this.forEach(function(b,D){d.push(D)}),A(d)},I.prototype.values=function(){var d=[];return this.forEach(function(b){d.push(b)}),A(d)},I.prototype.entries=function(){var d=[];return this.forEach(function(b,D){d.push([D,b])}),A(d)},l.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function R(d){if(d.bodyUsed)return Promise.reject(new TypeError("Already read"));d.bodyUsed=!0}function W(d){return new Promise(function(b,D){d.onload=function(){b(d.result)},d.onerror=function(){D(d.error)}})}function Y(d){var b=new FileReader,D=W(b);return b.readAsArrayBuffer(d),D}function F(d){var b=new FileReader,D=W(b);return b.readAsText(d),D}function z(d){for(var b=new Uint8Array(d),D=new Array(b.length),M=0;M<b.length;M++)D[M]=String.fromCharCode(b[M]);return D.join("")}function $(d){if(d.slice)return d.slice(0);var b=new Uint8Array(d.byteLength);return b.set(new Uint8Array(d)),b.buffer}function j(){return this.bodyUsed=!1,this._initBody=function(d){this._bodyInit=d,d?typeof d=="string"?this._bodyText=d:l.blob&&Blob.prototype.isPrototypeOf(d)?this._bodyBlob=d:l.formData&&FormData.prototype.isPrototypeOf(d)?this._bodyFormData=d:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)?this._bodyText=d.toString():l.arrayBuffer&&l.blob&&f(d)?(this._bodyArrayBuffer=$(d.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(d)||m(d))?this._bodyArrayBuffer=$(d):this._bodyText=d=Object.prototype.toString.call(d):this._bodyText="",this.headers.get("content-type")||(typeof d=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var d=R(this);if(d)return d;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?R(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var d=R(this);if(d)return d;if(this._bodyBlob)return F(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(z(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(Z)}),this.json=function(){return this.text().then(JSON.parse)},this}var P=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(d){var b=d.toUpperCase();return P.indexOf(b)>-1?b:d}function C(d,b){b=b||{};var D=b.body;if(d instanceof C){if(d.bodyUsed)throw new TypeError("Already read");this.url=d.url,this.credentials=d.credentials,b.headers||(this.headers=new I(d.headers)),this.method=d.method,this.mode=d.mode,this.signal=d.signal,!D&&d._bodyInit!=null&&(D=d._bodyInit,d.bodyUsed=!0)}else this.url=String(d);if(this.credentials=b.credentials||this.credentials||"same-origin",(b.headers||!this.headers)&&(this.headers=new I(b.headers)),this.method=g(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.signal=b.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function Z(d){var b=new FormData;return d.trim().split("&").forEach(function(D){if(D){var M=D.split("="),N=M.shift().replace(/\+/g," "),U=M.join("=").replace(/\+/g," ");b.append(decodeURIComponent(N),decodeURIComponent(U))}}),b}function J(d){var b=new I,D=d.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(M){var N=M.split(":"),U=N.shift().trim();if(U){var O=N.join(":").trim();b.append(U,O)}}),b}j.call(C.prototype);function te(d,b){b||(b={}),this.type="default",this.status=b.status===void 0?200:b.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new I(b.headers),this.url=b.url||"",this._initBody(d)}j.call(te.prototype),te.prototype.clone=function(){return new te(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},te.error=function(){var d=new te(null,{status:0,statusText:""});return d.type="error",d};var ae=[301,302,303,307,308];te.redirect=function(d,b){if(ae.indexOf(b)===-1)throw new RangeError("Invalid status code");return new te(null,{status:b,headers:{location:d}})},c.DOMException=s.DOMException;try{new c.DOMException}catch{c.DOMException=function(b,D){this.message=b,this.name=D;var M=Error(b);this.stack=M.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function p(d,b){return new Promise(function(D,M){var N=new C(d,b);if(N.signal&&N.signal.aborted)return M(new c.DOMException("Aborted","AbortError"));var U=new XMLHttpRequest;function O(){U.abort()}U.onload=function(){var v={status:U.status,statusText:U.statusText,headers:J(U.getAllResponseHeaders()||"")};v.url="responseURL"in U?U.responseURL:v.headers.get("X-Request-URL");var L="response"in U?U.response:U.responseText;D(new te(L,v))},U.onerror=function(){M(new TypeError("Network request failed"))},U.ontimeout=function(){M(new TypeError("Network request failed"))},U.onabort=function(){M(new c.DOMException("Aborted","AbortError"))},U.open(N.method,N.url,!0),N.credentials==="include"?U.withCredentials=!0:N.credentials==="omit"&&(U.withCredentials=!1),"responseType"in U&&l.blob&&(U.responseType="blob"),N.headers.forEach(function(v,L){U.setRequestHeader(L,v)}),N.signal&&(N.signal.addEventListener("abort",O),U.onreadystatechange=function(){U.readyState===4&&N.signal.removeEventListener("abort",O)}),U.send(typeof N._bodyInit>"u"?null:N._bodyInit)})}return p.polyfill=!0,s.fetch||(s.fetch=p,s.Headers=I,s.Request=C,s.Response=te),c.Headers=I,c.Request=C,c.Response=te,c.fetch=p,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(w0,w0.exports);var yy=s3(w0.exports);const wy={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},by=10;class fs{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new Dr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!_v(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,r){this.isAvailable||await this.register();try{const n=Ui(e),s=await(await yy(this.url,Object.assign(Object.assign({},wy),{body:n}))).json();this.onPayload({data:s})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!_v(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Ui({id:1,jsonrpc:"2.0",method:"test",params:[]});await yy(e,Object.assign(Object.assign({},wy),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?hc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gl(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return gv(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>by&&this.events.setMaxListeners(by)}}const _y="error",WD="wss://relay.walletconnect.com",VD="wc",GD="universal_provider",Ey=`${VD}@2:${GD}:`,YD="https://rpc.walletconnect.com/v1/",zi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},b0={exports:{}};/**
56
+ ***************************************************************************** */var r0=function(t,e){return r0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},r0(t,e)};function Vx(t,e){r0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var n0=function(){return n0=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},n0.apply(this,arguments)};function Gx(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Yx(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(i<3?c(o):i>3?c(e,r,o):c(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}function Jx(t,e){return function(r,n){e(r,n,t)}}function Qx(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Zx(t,e,r,n){function i(o){return o instanceof r?o:new r(function(c){c(o)})}return new(r||(r=Promise))(function(o,c){function l(g){try{h(n.next(g))}catch(_){c(_)}}function f(g){try{h(n.throw(g))}catch(_){c(_)}}function h(g){g.done?o(g.value):i(g.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function Xx(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(g){return f([h,g])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=h[0]&2?i.return:h[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,h[1])).done)return o;switch(i=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){r.label=h[1];break}if(h[0]===6&&r.label<o[1]){r.label=o[1],o=h;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(h);break}o[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(g){h=[6,g],i=0}finally{n=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function e9(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function t9(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function i0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function mv(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return o}function r9(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(mv(arguments[e]));return t}function n9(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var o=arguments[e],c=0,l=o.length;c<l;c++,i++)n[i]=o[c];return n}function wc(t){return this instanceof wc?(this.v=t,this):new wc(t)}function i9(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(S,U){o.push([E,A,S,U])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(S){_(o[0][3],S)}}function f(E){E.value instanceof wc?Promise.resolve(E.value.v).then(h,g):_(o[0][2],E)}function h(E){l("next",E)}function g(E){l("throw",E)}function _(E,A){E(A),o.shift(),o.length&&l(o[0][0],o[0][1])}}function s9(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,o){e[i]=t[i]?function(c){return(r=!r)?{value:wc(t[i](c)),done:i==="return"}:o?o(c):c}:o}}function o9(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof i0=="function"?i0(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(c){return new Promise(function(l,f){c=t[o](c),i(l,f,c.done,c.value)})}}function i(o,c,l,f){Promise.resolve(f).then(function(h){o({value:h,done:l})},c)}}function a9(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function c9(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function l9(t){return t&&t.__esModule?t:{default:t}}function u9(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function h9(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var f9=Object.freeze({__proto__:null,__extends:Vx,get __assign(){return n0},__rest:Gx,__decorate:Yx,__param:Jx,__metadata:Qx,__awaiter:Zx,__generator:Xx,__createBinding:e9,__exportStar:t9,__values:i0,__read:mv,__spread:r9,__spreadArrays:n9,__await:wc,__asyncGenerator:i9,__asyncDelegator:s9,__asyncValues:o9,__makeTemplateObject:a9,__importStar:c9,__importDefault:l9,__classPrivateFieldGet:u9,__classPrivateFieldSet:h9}),d9=$o(f9),ji={},vv;function p9(){if(vv)return ji;vv=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.isBrowserCryptoAvailable=ji.getSubtleCrypto=ji.getBrowerCrypto=void 0;function t(){return Fr?.crypto||Fr?.msCrypto||{}}ji.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}ji.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return ji.isBrowserCryptoAvailable=r,ji}var ki={},wv;function g9(){if(wv)return ki;wv=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.isBrowser=ki.isNode=ki.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ki.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}ki.isNode=e;function r(){return!t()&&!e()}return ki.isBrowser=r,ki}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=d9;e.__exportStar(p9(),t),e.__exportStar(g9(),t)})(gv);function us(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Js(t=6){return BigInt(us(t))}function ta(t,e,r){return{id:r||us(),jsonrpc:"2.0",method:t,params:e}}function Jl(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Ql(t,e,r){return{id:t,jsonrpc:"2.0",error:m9(e,r)}}function m9(t,e){return typeof t>"u"?dv(hv):(typeof t=="string"&&(t=Object.assign(Object.assign({},dv(t0)),{message:t})),typeof e<"u"&&(t.data=e),Kx(t.code)&&(t=Wx(t.code)),t)}class v9{}class w9 extends v9{constructor(){super()}}class y9 extends w9{constructor(e){super()}}const b9="^https?:",_9="^wss?:";function E9(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function yv(t,e){const r=E9(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function bv(t){return yv(t,b9)}function _v(t){return yv(t,_9)}function A9(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Ev(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function s0(t){return Ev(t)&&"method"in t}function Zl(t){return Ev(t)&&(_i(t)||Mn(t))}function _i(t){return"result"in t}function Mn(t){return"error"in t}class qi extends y9{constructor(e){super(e),this.events=new Dr.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,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ta(e.method,e.params||[],e.id||Js().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(o){i(o)}this.events.on(`${e.id}`,o=>{Mn(o)?i(o.error):n(o.result)});try{await this.connection.send(e,r)}catch(o){i(o)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Zl(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 x9=()=>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"),I9=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Av=t=>t.split("?")[0],xv=10,S9=x9();class D9{constructor(e){if(this.url=e,this.events=new Dr.exports.EventEmitter,this.registering=!1,!_v(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Fi(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!_v(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),i(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),o=gv.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!A9(e)},c=new S9(e,[],o);I9()?c.onerror=l=>{const f=l;n(this.emitError(f.error))}:c.on("error",l=>{n(this.emitError(l))}),c.onopen=()=>{this.onOpen(c),r(c)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),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 r=typeof e.data=="string"?uc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),o=Ql(e,i);this.events.emit("payload",o)}parseError(e,r=this.url){return pv(e,Av(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>xv&&this.events.setMaxListeners(xv)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Av(this.url)}`));return this.events.emit("register_error",r),r}}var o0={exports:{}};(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,o=2,c=9007199254740991,l="[object Arguments]",f="[object Array]",h="[object AsyncFunction]",g="[object Boolean]",_="[object Date]",E="[object Error]",A="[object Function]",S="[object GeneratorFunction]",U="[object Map]",W="[object Number]",Y="[object Null]",B="[object Object]",z="[object Promise]",P="[object Proxy]",F="[object RegExp]",j="[object Set]",m="[object String]",T="[object Symbol]",te="[object Undefined]",ee="[object WeakMap]",ne="[object ArrayBuffer]",fe="[object DataView]",d="[object Float32Array]",p="[object Float64Array]",b="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",$="[object Uint8Array]",L="[object Uint8ClampedArray]",C="[object Uint16Array]",v="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,pe=/^(?:0|[1-9]\d*)$/,x={};x[d]=x[p]=x[b]=x[D]=x[O]=x[$]=x[L]=x[C]=x[v]=!0,x[l]=x[f]=x[ne]=x[g]=x[fe]=x[_]=x[E]=x[A]=x[U]=x[W]=x[B]=x[F]=x[j]=x[m]=x[ee]=!1;var re=typeof Fr=="object"&&Fr&&Fr.Object===Object&&Fr,q=typeof self=="object"&&self&&self.Object===Object&&self,H=re||q||Function("return this")(),V=e&&!e.nodeType&&e,w=V&&!0&&t&&!t.nodeType&&t,k=w&&w.exports===V,ie=k&&re.process,he=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),le=he&&he.isTypedArray;function Oe(K,Q){for(var de=-1,Ie=K==null?0:K.length,Vt=0,ot=[];++de<Ie;){var Zt=K[de];Q(Zt,de,K)&&(ot[Vt++]=Zt)}return ot}function Me(K,Q){for(var de=-1,Ie=Q.length,Vt=K.length;++de<Ie;)K[Vt+de]=Q[de];return K}function Se(K,Q){for(var de=-1,Ie=K==null?0:K.length;++de<Ie;)if(Q(K[de],de,K))return!0;return!1}function Pt(K,Q){for(var de=-1,Ie=Array(K);++de<K;)Ie[de]=Q(de);return Ie}function ze(K){return function(Q){return K(Q)}}function Ce(K,Q){return K.has(Q)}function Fe(K,Q){return K?.[Q]}function Ee(K){var Q=-1,de=Array(K.size);return K.forEach(function(Ie,Vt){de[++Q]=[Vt,Ie]}),de}function Ae(K,Q){return function(de){return K(Q(de))}}function Ge(K){var Q=-1,de=Array(K.size);return K.forEach(function(Ie){de[++Q]=Ie}),de}var ye=Array.prototype,xe=Function.prototype,Be=Object.prototype,be=H["__core-js_shared__"],Pe=xe.toString,je=Be.hasOwnProperty,Te=function(){var K=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return K?"Symbol(src)_1."+K:""}(),$e=Be.toString,lt=RegExp("^"+Pe.call(je).replace(N,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=k?H.Buffer:void 0,Ne=H.Symbol,nr=H.Uint8Array,dt=Be.propertyIsEnumerable,Et=ye.splice,ir=Ne?Ne.toStringTag:void 0,It=Object.getOwnPropertySymbols,Ot=Re?Re.isBuffer:void 0,Vr=Ae(Object.keys,Object),Ye=_n(H,"DataView"),He=_n(H,"Map"),Rt=_n(H,"Promise"),Je=_n(H,"Set"),Ve=_n(H,"WeakMap"),Mt=_n(Object,"create"),Xe=Gi(Ye),et=Gi(He),Lt=Gi(Rt),tt=Gi(Je),Qe=Gi(Ve),Ft=Ne?Ne.prototype:void 0,Ze=Ft?Ft.valueOf:void 0;function ke(K){var Q=-1,de=K==null?0:K.length;for(this.clear();++Q<de;){var Ie=K[Q];this.set(Ie[0],Ie[1])}}function Ht(){this.__data__=Mt?Mt(null):{},this.size=0}function rt(K){var Q=this.has(K)&&delete this.__data__[K];return this.size-=Q?1:0,Q}function jt(K){var Q=this.__data__;if(Mt){var de=Q[K];return de===n?void 0:de}return je.call(Q,K)?Q[K]:void 0}function ti(K){var Q=this.__data__;return Mt?Q[K]!==void 0:je.call(Q,K)}function kt(K,Q){var de=this.__data__;return this.size+=this.has(K)?0:1,de[K]=Mt&&Q===void 0?n:Q,this}ke.prototype.clear=Ht,ke.prototype.delete=rt,ke.prototype.get=jt,ke.prototype.has=ti,ke.prototype.set=kt;function vt(K){var Q=-1,de=K==null?0:K.length;for(this.clear();++Q<de;){var Ie=K[Q];this.set(Ie[0],Ie[1])}}function Ln(){this.__data__=[],this.size=0}function Bn(K){var Q=this.__data__,de=bo(Q,K);if(de<0)return!1;var Ie=Q.length-1;return de==Ie?Q.pop():Et.call(Q,de,1),--this.size,!0}function Un(K){var Q=this.__data__,de=bo(Q,K);return de<0?void 0:Q[de][1]}function Fn(K){return bo(this.__data__,K)>-1}function jn(K,Q){var de=this.__data__,Ie=bo(de,K);return Ie<0?(++this.size,de.push([K,Q])):de[Ie][1]=Q,this}vt.prototype.clear=Ln,vt.prototype.delete=Bn,vt.prototype.get=Un,vt.prototype.has=Fn,vt.prototype.set=jn;function xr(K){var Q=-1,de=K==null?0:K.length;for(this.clear();++Q<de;){var Ie=K[Q];this.set(Ie[0],Ie[1])}}function Di(){this.size=0,this.__data__={hash:new ke,map:new(He||vt),string:new ke}}function fo(K){var Q=Cs(this,K).delete(K);return this.size-=Q?1:0,Q}function Ci(K){return Cs(this,K).get(K)}function po(K){return Cs(this,K).has(K)}function go(K,Q){var de=Cs(this,K),Ie=de.size;return de.set(K,Q),this.size+=de.size==Ie?0:1,this}xr.prototype.clear=Di,xr.prototype.delete=fo,xr.prototype.get=Ci,xr.prototype.has=po,xr.prototype.set=go;function Oi(K){var Q=-1,de=K==null?0:K.length;for(this.__data__=new xr;++Q<de;)this.add(K[Q])}function Ss(K){return this.__data__.set(K,n),this}function Ds(K){return this.__data__.has(K)}Oi.prototype.add=Oi.prototype.push=Ss,Oi.prototype.has=Ds;function Gr(K){var Q=this.__data__=new vt(K);this.size=Q.size}function mo(){this.__data__=new vt,this.size=0}function vo(K){var Q=this.__data__,de=Q.delete(K);return this.size=Q.size,de}function wo(K){return this.__data__.get(K)}function yo(K){return this.__data__.has(K)}function Ru(K,Q){var de=this.__data__;if(de instanceof vt){var Ie=de.__data__;if(!He||Ie.length<r-1)return Ie.push([K,Q]),this.size=++de.size,this;de=this.__data__=new xr(Ie)}return de.set(K,Q),this.size=de.size,this}Gr.prototype.clear=mo,Gr.prototype.delete=vo,Gr.prototype.get=wo,Gr.prototype.has=yo,Gr.prototype.set=Ru;function Lu(K,Q){var de=Sa(K),Ie=!de&&Gu(K),Vt=!de&&!Ie&&Hc(K),ot=!de&&!Ie&&!Vt&&Qu(K),Zt=de||Ie||Vt||ot,gr=Zt?Pt(K.length,String):[],St=gr.length;for(var Gt in K)(Q||je.call(K,Gt))&&!(Zt&&(Gt=="length"||Vt&&(Gt=="offset"||Gt=="parent")||ot&&(Gt=="buffer"||Gt=="byteLength"||Gt=="byteOffset")||zu(Gt,St)))&&gr.push(Gt);return gr}function bo(K,Q){for(var de=K.length;de--;)if(Vu(K[de][0],Q))return de;return-1}function qc(K,Q,de){var Ie=Q(K);return Sa(K)?Ie:Me(Ie,de(K))}function _o(K){return K==null?K===void 0?te:Y:ir&&ir in Object(K)?ku(K):Ud(K)}function zc(K){return Ao(K)&&_o(K)==l}function Eo(K,Q,de,Ie,Vt){return K===Q?!0:K==null||Q==null||!Ao(K)&&!Ao(Q)?K!==K&&Q!==Q:Bu(K,Q,de,Ie,Eo,Vt)}function Bu(K,Q,de,Ie,Vt,ot){var Zt=Sa(K),gr=Sa(Q),St=Zt?f:Pi(K),Gt=gr?f:Pi(Q);St=St==l?B:St,Gt=Gt==l?B:Gt;var fr=St==B,ln=Gt==B,mr=St==Gt;if(mr&&Hc(K)){if(!Hc(Q))return!1;Zt=!0,fr=!1}if(mr&&!fr)return ot||(ot=new Gr),Zt||Qu(K)?xa(K,Q,de,Ie,Vt,ot):Bd(K,Q,St,de,Ie,Vt,ot);if(!(de&i)){var Xt=fr&&je.call(K,"__wrapped__"),Yr=ln&&je.call(Q,"__wrapped__");if(Xt||Yr){var ri=Xt?K.value():K,kn=Yr?Q.value():Q;return ot||(ot=new Gr),Vt(ri,kn,de,Ie,ot)}}return mr?(ot||(ot=new Gr),ju(K,Q,de,Ie,Vt,ot)):!1}function Ld(K){if(!Ju(K)||Ku(K))return!1;var Q=Da(K)?lt:oe;return Q.test(Gi(K))}function Uu(K){return Ao(K)&&Yu(K.length)&&!!x[_o(K)]}function Fu(K){if(!Wu(K))return Vr(K);var Q=[];for(var de in Object(K))je.call(K,de)&&de!="constructor"&&Q.push(de);return Q}function xa(K,Q,de,Ie,Vt,ot){var Zt=de&i,gr=K.length,St=Q.length;if(gr!=St&&!(Zt&&St>gr))return!1;var Gt=ot.get(K);if(Gt&&ot.get(Q))return Gt==Q;var fr=-1,ln=!0,mr=de&o?new Oi:void 0;for(ot.set(K,Q),ot.set(Q,K);++fr<gr;){var Xt=K[fr],Yr=Q[fr];if(Ie)var ri=Zt?Ie(Yr,Xt,fr,Q,K,ot):Ie(Xt,Yr,fr,K,Q,ot);if(ri!==void 0){if(ri)continue;ln=!1;break}if(mr){if(!Se(Q,function(kn,Mi){if(!Ce(mr,Mi)&&(Xt===kn||Vt(Xt,kn,de,Ie,ot)))return mr.push(Mi)})){ln=!1;break}}else if(!(Xt===Yr||Vt(Xt,Yr,de,Ie,ot))){ln=!1;break}}return ot.delete(K),ot.delete(Q),ln}function Bd(K,Q,de,Ie,Vt,ot,Zt){switch(de){case fe:if(K.byteLength!=Q.byteLength||K.byteOffset!=Q.byteOffset)return!1;K=K.buffer,Q=Q.buffer;case ne:return!(K.byteLength!=Q.byteLength||!ot(new nr(K),new nr(Q)));case g:case _:case W:return Vu(+K,+Q);case E:return K.name==Q.name&&K.message==Q.message;case F:case m:return K==Q+"";case U:var gr=Ee;case j:var St=Ie&i;if(gr||(gr=Ge),K.size!=Q.size&&!St)return!1;var Gt=Zt.get(K);if(Gt)return Gt==Q;Ie|=o,Zt.set(K,Q);var fr=xa(gr(K),gr(Q),Ie,Vt,ot,Zt);return Zt.delete(K),fr;case T:if(Ze)return Ze.call(K)==Ze.call(Q)}return!1}function ju(K,Q,de,Ie,Vt,ot){var Zt=de&i,gr=Ia(K),St=gr.length,Gt=Ia(Q),fr=Gt.length;if(St!=fr&&!Zt)return!1;for(var ln=St;ln--;){var mr=gr[ln];if(!(Zt?mr in Q:je.call(Q,mr)))return!1}var Xt=ot.get(K);if(Xt&&ot.get(Q))return Xt==Q;var Yr=!0;ot.set(K,Q),ot.set(Q,K);for(var ri=Zt;++ln<St;){mr=gr[ln];var kn=K[mr],Mi=Q[mr];if(Ie)var Kc=Zt?Ie(Mi,kn,mr,Q,K,ot):Ie(kn,Mi,mr,K,Q,ot);if(!(Kc===void 0?kn===Mi||Vt(kn,Mi,de,Ie,ot):Kc)){Yr=!1;break}ri||(ri=mr=="constructor")}if(Yr&&!ri){var xo=K.constructor,Ir=Q.constructor;xo!=Ir&&"constructor"in K&&"constructor"in Q&&!(typeof xo=="function"&&xo instanceof xo&&typeof Ir=="function"&&Ir instanceof Ir)&&(Yr=!1)}return ot.delete(K),ot.delete(Q),Yr}function Ia(K){return qc(K,kd,qu)}function Cs(K,Q){var de=K.__data__;return Hu(Q)?de[typeof Q=="string"?"string":"hash"]:de.map}function _n(K,Q){var de=Fe(K,Q);return Ld(de)?de:void 0}function ku(K){var Q=je.call(K,ir),de=K[ir];try{K[ir]=void 0;var Ie=!0}catch{}var Vt=$e.call(K);return Ie&&(Q?K[ir]=de:delete K[ir]),Vt}var qu=It?function(K){return K==null?[]:(K=Object(K),Oe(It(K),function(Q){return dt.call(K,Q)}))}:Wt,Pi=_o;(Ye&&Pi(new Ye(new ArrayBuffer(1)))!=fe||He&&Pi(new He)!=U||Rt&&Pi(Rt.resolve())!=z||Je&&Pi(new Je)!=j||Ve&&Pi(new Ve)!=ee)&&(Pi=function(K){var Q=_o(K),de=Q==B?K.constructor:void 0,Ie=de?Gi(de):"";if(Ie)switch(Ie){case Xe:return fe;case et:return U;case Lt:return z;case tt:return j;case Qe:return ee}return Q});function zu(K,Q){return Q=Q??c,!!Q&&(typeof K=="number"||pe.test(K))&&K>-1&&K%1==0&&K<Q}function Hu(K){var Q=typeof K;return Q=="string"||Q=="number"||Q=="symbol"||Q=="boolean"?K!=="__proto__":K===null}function Ku(K){return!!Te&&Te in K}function Wu(K){var Q=K&&K.constructor,de=typeof Q=="function"&&Q.prototype||Be;return K===de}function Ud(K){return $e.call(K)}function Gi(K){if(K!=null){try{return Pe.call(K)}catch{}try{return K+""}catch{}}return""}function Vu(K,Q){return K===Q||K!==K&&Q!==Q}var Gu=zc(function(){return arguments}())?zc:function(K){return Ao(K)&&je.call(K,"callee")&&!dt.call(K,"callee")},Sa=Array.isArray;function Fd(K){return K!=null&&Yu(K.length)&&!Da(K)}var Hc=Ot||Kt;function jd(K,Q){return Eo(K,Q)}function Da(K){if(!Ju(K))return!1;var Q=_o(K);return Q==A||Q==S||Q==h||Q==P}function Yu(K){return typeof K=="number"&&K>-1&&K%1==0&&K<=c}function Ju(K){var Q=typeof K;return K!=null&&(Q=="object"||Q=="function")}function Ao(K){return K!=null&&typeof K=="object"}var Qu=le?ze(le):Uu;function kd(K){return Fd(K)?Lu(K):Fu(K)}function Wt(){return[]}function Kt(){return!1}t.exports=jd})(o0,o0.exports);var C9=o0.exports;function O9(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],c=[],l={},f=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:f,headers:{keys:function(){return o},entries:function(){return c},get:function(g){return l[g.toLowerCase()]},has:function(g){return g.toLowerCase()in l}}}};for(var h in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(g,_,E){o.push(_=_.toLowerCase()),c.push([_,E]),l[_]=l[_]?l[_]+","+E:E}),r(f())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(h,e.headers[h]);i.send(e.body||null)})}var P9=Object.freeze({__proto__:null,default:O9}),Iv=$o(P9),M9=self.fetch||(self.fetch=Iv.default||Iv),T9=Object.defineProperty,Sv=Object.getOwnPropertySymbols,$9=Object.prototype.hasOwnProperty,N9=Object.prototype.propertyIsEnumerable,Dv=(t,e,r)=>e in t?T9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kr=(t,e)=>{for(var r in e||(e={}))$9.call(e,r)&&Dv(t,r,e[r]);if(Sv)for(var r of Sv(e))N9.call(e,r)&&Dv(t,r,e[r]);return t};function R9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),c=o.charCodeAt(0);if(r[c]!==255)throw new TypeError(o+" is ambiguous");r[c]=i}var l=t.length,f=t.charAt(0),h=Math.log(l)/Math.log(256),g=Math.log(256)/Math.log(l);function _(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var U=0,W=0,Y=0,B=S.length;Y!==B&&S[Y]===0;)Y++,U++;for(var z=(B-Y)*g+1>>>0,P=new Uint8Array(z);Y!==B;){for(var F=S[Y],j=0,m=z-1;(F!==0||j<W)&&m!==-1;m--,j++)F+=256*P[m]>>>0,P[m]=F%l>>>0,F=F/l>>>0;if(F!==0)throw new Error("Non-zero carry");W=j,Y++}for(var T=z-W;T!==z&&P[T]===0;)T++;for(var te=f.repeat(U);T<z;++T)te+=t.charAt(P[T]);return te}function E(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var U=0;if(S[U]!==" "){for(var W=0,Y=0;S[U]===f;)W++,U++;for(var B=(S.length-U)*h+1>>>0,z=new Uint8Array(B);S[U];){var P=r[S.charCodeAt(U)];if(P===255)return;for(var F=0,j=B-1;(P!==0||F<Y)&&j!==-1;j--,F++)P+=l*z[j]>>>0,z[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");Y=F,U++}if(S[U]!==" "){for(var m=B-Y;m!==B&&z[m]===0;)m++;for(var T=new Uint8Array(W+(B-m)),te=W;m!==B;)T[te++]=z[m++];return T}}}function A(S){var U=E(S);if(U)return U;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:A}}var L9=R9,B9=L9;const Cv=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},U9=t=>new TextEncoder().encode(t),F9=t=>new TextDecoder().decode(t);class j9{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class k9{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Ov(this,e)}}class q9{constructor(e){this.decoders=e}or(e){return Ov(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ov=(t,e)=>new q9(Kr(Kr({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class z9{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new j9(e,r,n),this.decoder=new k9(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xl=({name:t,prefix:e,encode:r,decode:n})=>new z9(t,e,r,n),yc=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=B9(r,e);return Xl({prefix:t,name:e,encode:n,decode:o=>Cv(i(o))})},H9=(t,e,r,n)=>{const i={};for(let g=0;g<e.length;++g)i[e[g]]=g;let o=t.length;for(;t[o-1]==="=";)--o;const c=new Uint8Array(o*r/8|0);let l=0,f=0,h=0;for(let g=0;g<o;++g){const _=i[t[g]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|_,l+=r,l>=8&&(l-=8,c[h++]=255&f>>l)}if(l>=r||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return c},K9=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let o="",c=0,l=0;for(let f=0;f<t.length;++f)for(l=l<<8|t[f],c+=8;c>r;)c-=r,o+=e[i&l>>c];if(c&&(o+=e[i&l<<r-c]),n)for(;o.length*r&7;)o+="=";return o},Mr=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Xl({prefix:e,name:t,encode(i){return K9(i,n,r)},decode(i){return H9(i,n,r,t)}}),W9=Xl({prefix:"\0",name:"identity",encode:t=>F9(t),decode:t=>U9(t)});var V9=Object.freeze({__proto__:null,identity:W9});const G9=Mr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Y9=Object.freeze({__proto__:null,base2:G9});const J9=Mr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Q9=Object.freeze({__proto__:null,base8:J9});const Z9=yc({prefix:"9",name:"base10",alphabet:"0123456789"});var X9=Object.freeze({__proto__:null,base10:Z9});const eI=Mr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tI=Mr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rI=Object.freeze({__proto__:null,base16:eI,base16upper:tI});const nI=Mr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iI=Mr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sI=Mr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oI=Mr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aI=Mr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cI=Mr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lI=Mr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),uI=Mr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hI=Mr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var fI=Object.freeze({__proto__:null,base32:nI,base32upper:iI,base32pad:sI,base32padupper:oI,base32hex:aI,base32hexupper:cI,base32hexpad:lI,base32hexpadupper:uI,base32z:hI});const dI=yc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pI=yc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var gI=Object.freeze({__proto__:null,base36:dI,base36upper:pI});const mI=yc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vI=yc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var wI=Object.freeze({__proto__:null,base58btc:mI,base58flickr:vI});const yI=Mr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bI=Mr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_I=Mr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EI=Mr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var AI=Object.freeze({__proto__:null,base64:yI,base64pad:bI,base64url:_I,base64urlpad:EI});const Pv=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}"),xI=Pv.reduce((t,e,r)=>(t[r]=e,t),[]),II=Pv.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function SI(t){return t.reduce((e,r)=>(e+=xI[r],e),"")}function DI(t){const e=[];for(const r of t){const n=II[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CI=Xl({prefix:"\u{1F680}",name:"base256emoji",encode:SI,decode:DI});var OI=Object.freeze({__proto__:null,base256emoji:CI}),PI=Tv,Mv=128,MI=127,TI=~MI,$I=Math.pow(2,31);function Tv(t,e,r){e=e||[],r=r||0;for(var n=r;t>=$I;)e[r++]=t&255|Mv,t/=128;for(;t&TI;)e[r++]=t&255|Mv,t>>>=7;return e[r]=t|0,Tv.bytes=r-n+1,e}var NI=a0,RI=128,$v=127;function a0(t,n){var r=0,n=n||0,i=0,o=n,c,l=t.length;do{if(o>=l)throw a0.bytes=0,new RangeError("Could not decode varint");c=t[o++],r+=i<28?(c&$v)<<i:(c&$v)*Math.pow(2,i),i+=7}while(c>=RI);return a0.bytes=o-n,r}var LI=Math.pow(2,7),BI=Math.pow(2,14),UI=Math.pow(2,21),FI=Math.pow(2,28),jI=Math.pow(2,35),kI=Math.pow(2,42),qI=Math.pow(2,49),zI=Math.pow(2,56),HI=Math.pow(2,63),KI=function(t){return t<LI?1:t<BI?2:t<UI?3:t<FI?4:t<jI?5:t<kI?6:t<qI?7:t<zI?8:t<HI?9:10},WI={encode:PI,decode:NI,encodingLength:KI},Nv=WI;const Rv=(t,e,r=0)=>(Nv.encode(t,e,r),e),Lv=t=>Nv.encodingLength(t),c0=(t,e)=>{const r=e.byteLength,n=Lv(t),i=n+Lv(r),o=new Uint8Array(i+r);return Rv(t,o,0),Rv(r,o,n),o.set(e,i),new VI(t,r,e,o)};class VI{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Bv=({name:t,code:e,encode:r})=>new GI(t,e,r);class GI{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?c0(this.code,r):r.then(n=>c0(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Uv=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),YI=Bv({name:"sha2-256",code:18,encode:Uv("SHA-256")}),JI=Bv({name:"sha2-512",code:19,encode:Uv("SHA-512")});var QI=Object.freeze({__proto__:null,sha256:YI,sha512:JI});const Fv=0,ZI="identity",jv=Cv;var XI=Object.freeze({__proto__:null,identity:{code:Fv,name:ZI,encode:jv,digest:t=>c0(Fv,jv(t))}});new TextEncoder,new TextDecoder;const kv=Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr({},V9),Y9),Q9),X9),rI),fI),gI),wI),AI),OI);Kr(Kr({},QI),XI);function qv(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function eS(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?qv(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function zv(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Hv=zv("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),l0=zv("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=eS(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),tS=Kr({utf8:Hv,"utf-8":Hv,hex:kv.base16,latin1:l0,ascii:l0,binary:l0},kv);function rS(t,e="utf8"){const r=tS[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?qv(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}const Kv="wc",nS=2,u0="core",hs=`${Kv}@2:${u0}:`,iS={name:u0,logger:"error"},sS={database:":memory:"},oS="crypto",Wv="client_ed25519_seed",aS=_e.ONE_DAY,cS="keychain",lS="0.3",uS="messages",hS="0.3",fS=_e.SIX_HOURS,dS="publisher",Vv="irn",pS="error",Gv="wss://relay.walletconnect.com",Yv="wss://relay.walletconnect.org",gS="relayer",wn={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"},mS="_subscription",Tn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},vS=_e.ONE_SECOND,wS="2.12.2",yS=1e4,bS="0.3",_S="WALLETCONNECT_CLIENT_ID",Ei={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},ES="subscription",AS="0.3",xS=_e.FIVE_SECONDS*1e3,IS="pairing",SS="0.3",bc={wc_pairingDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:0},res:{ttl:_e.ONE_DAY,prompt:!1,tag:0}}},ra={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},ei={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},DS="history",CS="0.3",OS="expirer",$n={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},PS="0.3",h0="verify-api",na="https://verify.walletconnect.com",f0="https://verify.walletconnect.org",MS=[na,f0],TS="echo",$S="https://echo.walletconnect.com";class NS{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=cS,this.version=lS,this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:o}=me("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(o)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=on(r,this.name)}get context(){return sn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,sg(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?og(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class RS{constructor(e,r,n){this.core=e,this.logger=r,this.name=oS,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),o=uv(i);return lv(o.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=UE();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const o=await this.getClientSeed(),c=uv(o),l=Bf();return await Fx(l,i,aS,c)},this.generateSharedKey=(i,o,c)=>{this.isInitialized();const l=this.getPrivateKey(i),f=FE(l,o);return this.setSymKey(f,c)},this.setSymKey=async(i,o)=>{this.isInitialized();const c=o||Rl(i);return await this.keychain.set(c,i),c},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,o,c)=>{this.isInitialized();const l=xm(c),f=Fi(o);if(Im(l)){const E=l.senderPublicKey,A=l.receiverPublicKey;i=await this.generateSharedKey(E,A)}const h=this.getSymKey(i),{type:g,senderPublicKey:_}=l;return kE({type:g,symKey:h,message:f,senderPublicKey:_})},this.decode=async(i,o,c)=>{this.isInitialized();const l=HE(o,c);if(Im(l)){const f=l.receiverPublicKey,h=l.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=qE({symKey:f,encoded:o});return uc(h)}catch(f){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(f)}},this.getPayloadType=i=>{const o=Ll(i);return sc(o.type)},this.getPayloadSenderPublicKey=i=>{const o=Ll(i);return o.senderPublicKey?jr(o.senderPublicKey,zr):void 0},this.core=e,this.logger=on(r,this.name),this.keychain=n||new NS(this.core,this.logger)}get context(){return sn(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Wv)}catch{e=Bf(),await this.keychain.set(Wv,e)}return rS(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class LS extends mx{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=uS,this.version=hS,this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const o=Ws(i);let c=this.messages.get(n);return typeof c>"u"&&(c={}),typeof c[o]<"u"||(c[o]=i,this.messages.set(n,c),await this.persist()),o},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const o=this.get(n),c=Ws(i);return typeof o[c]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=on(e,this.name),this.core=r}get context(){return sn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,sg(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?og(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class BS extends vx{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Dr.exports.EventEmitter,this.name=dS,this.queue=new Map,this.publishTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.failedPublishTimeout=_e.toMiliseconds(_e.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,o)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:o}});const l=o?.ttl||fS,f=Uf(o),h=o?.prompt||!1,g=o?.tag||0,_=o?.id||Js().toString(),E={topic:n,message:i,opts:{ttl:l,relay:f,prompt:h,tag:g,id:_}},A=`Failed to publish payload, please try again. id:${_} tag:${g}`,S=Date.now();let U,W=1;try{for(;U===void 0;){if(Date.now()-S>this.publishTimeout)throw new Error(A);this.logger.trace({id:_,attempts:W},`publisher.publish - attempt ${W}`),U=await await Ya(this.rpcPublish(n,i,l,f,h,g,_).catch(Y=>this.logger.warn(Y)),this.publishTimeout,A),W++,U||await new Promise(Y=>setTimeout(Y,this.failedPublishTimeout))}this.relayer.events.emit(wn.publish,E),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:_,topic:n,message:i,opts:o}})}catch(Y){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(Y),(c=o?.internal)!=null&&c.throwOnFailedPublish)throw Y;this.queue.set(_,E)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=on(r,this.name),this.registerEventListeners()}get context(){return sn(this.logger)}rpcPublish(e,r,n,i,o,c,l){var f,h,g,_;const E={method:Bl(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:o,tag:c},id:l};return Hr((f=E.params)==null?void 0:f.prompt)&&((h=E.params)==null||delete h.prompt),Hr((g=E.params)==null?void 0:g.tag)&&((_=E.params)==null||delete _.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:E}),this.relayer.request(E)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Zo.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(wn.connection_stalled);return}this.checkQueue()}),this.relayer.on(wn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class US{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(o=>o!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var FS=Object.defineProperty,jS=Object.defineProperties,kS=Object.getOwnPropertyDescriptors,Jv=Object.getOwnPropertySymbols,qS=Object.prototype.hasOwnProperty,zS=Object.prototype.propertyIsEnumerable,Qv=(t,e,r)=>e in t?FS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_c=(t,e)=>{for(var r in e||(e={}))qS.call(e,r)&&Qv(t,r,e[r]);if(Jv)for(var r of Jv(e))zS.call(e,r)&&Qv(t,r,e[r]);return t},d0=(t,e)=>jS(t,kS(e));class HS extends bx{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new US,this.events=new Dr.exports.EventEmitter,this.name=ES,this.version=AS,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hs,this.subscribeTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const o=Uf(i),c={topic:n,relay:o};this.pending.set(n,c);const l=await this.rpcSubscribe(n,o);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((o,c)=>{const l=new _e.Watch;l.start(i);const f=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(f),l.stop(i),o(!0)),l.elapsed(i)>=xS&&(clearInterval(f),l.stop(i),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.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=on(r,this.name),this.clientId=""}get context(){return sn(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,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=Uf(n);await this.rpcUnsubscribe(e,r,i);const o=Ut("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,o),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){const n={method:Bl(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Ya(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?Ws(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(wn.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:Bl(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Ya(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(wn.connection_stalled)}}rpcUnsubscribe(e,r,n){const i={method:Bl(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,d0(_c({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,_c({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,_c({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ei.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ei.deleted,d0(_c({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ei.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(Ei.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);wi(r)&&this.onBatchSubscribe(r.map((n,i)=>d0(_c({},e[i]),{id:n})))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Zo.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(Ei.created,async e=>{const r=Ei.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ei.deleted,async e=>{const r=Ei.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var KS=Object.defineProperty,Zv=Object.getOwnPropertySymbols,WS=Object.prototype.hasOwnProperty,VS=Object.prototype.propertyIsEnumerable,Xv=(t,e,r)=>e in t?KS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,GS=(t,e)=>{for(var r in e||(e={}))WS.call(e,r)&&Xv(t,r,e[r]);if(Zv)for(var r of Zv(e))VS.call(e,r)&&Xv(t,r,e[r]);return t};class YS extends wx{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Dr.exports.EventEmitter,this.name=gS,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=_e.toMiliseconds(_e.THIRTY_SECONDS+_e.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const o=r.id||Js().toString();await this.toEstablishConnection();try{const c=this.provider.request(r);this.requestsInFlight.set(o,{promise:c,request:r}),this.logger.trace({id:o,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const l=await new Promise(async(f,h)=>{const g=()=>{h(new Error(`relayer.request - publish interrupted, id: ${o}`))};this.provider.on(Tn.disconnect,g);const _=await c;this.provider.off(Tn.disconnect,g),f(_)});return this.logger.trace({id:o,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),l}catch(c){throw this.logger.debug(`Failed to Publish Request: ${o}`),c}finally{this.requestsInFlight.delete(o)}},this.resetPingTimeout=()=>{if(Va())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(wn.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(wn.error,r),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"?on(e.logger,this.name):yi(Gl({level:e.logger||pS})),this.messages=new LS(this.logger,e.core),this.subscriber=new HS(this,this.logger),this.publisher=new BS(this,this.logger),this.relayUrl=e?.relayUrl||Gv,this.projectId=e.projectId,this.bundleId=D_(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Yv}...`),await this.restartTransport(Yv)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},yS)}get context(){return sn(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",o;const c=l=>{l.topic===e&&(this.subscriber.off(Ei.created,c),o())};return await Promise.all([new Promise(l=>{o=l,this.subscriber.on(Ei.created,c)}),new Promise(async l=>{i=await this.subscriber.subscribe(e,r)||i,l()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async 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 Ya(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(r,n)=>{const i=()=>{this.provider.off(Tn.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Tn.disconnect,i),await Ya(this.provider.connect(),_e.toMiliseconds(_e.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{n(o)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Bm())throw new Error("No internet connection detected. Please restart your network and try again.")}startPingTimeout(){var e,r,n,i,o;if(Va())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((o=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||o.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(c){this.logger.warn(c)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new qi(new D9($_({sdkVersion:wS,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:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),s0(e)){if(!e.method.endsWith(mS))return;const r=e.params,{topic:n,message:i,publishedAt:o}=r.data,c={topic:n,message:i,publishedAt:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(GS({type:"event",event:r.id},c)),this.events.emit(r.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else Zl(e)&&this.events.emit(wn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(wn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Jl(e.id,!0);await this.provider.connection.send(r)}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)}async registerEventListeners(){let e=await Bm();NA(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.events.emit(wn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},_e.toMiliseconds(vS))}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var JS=Object.defineProperty,ew=Object.getOwnPropertySymbols,QS=Object.prototype.hasOwnProperty,ZS=Object.prototype.propertyIsEnumerable,tw=(t,e,r)=>e in t?JS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rw=(t,e)=>{for(var r in e||(e={}))QS.call(e,r)&&tw(t,r,e[r]);if(ew)for(var r of ew(e))ZS.call(e,r)&&tw(t,r,e[r]);return t};class Qs extends yx{constructor(e,r,n,i=hs,o=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=bS,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!Hr(c)?this.map.set(this.getKey(c),c):hA(c)?this.map.set(c.id,c):fA(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,l)=>{this.isInitialized(),this.map.has(c)?await this.update(c,l):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:l}),this.map.set(c,l),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(l=>Object.keys(c).every(f=>C9(l[f],c[f]))):this.values),this.update=async(c,l)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:l});const f=rw(rw({},this.getData(c)),l);this.map.set(c,f),await this.persist()},this.delete=async(c,l)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:l}),this.map.delete(c),this.addToRecentlyDeleted(c),await this.persist())},this.logger=on(r,this.name),this.storagePrefix=i,this.getKey=o}get context(){return sn(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 r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=me("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class XS{constructor(e,r){this.core=e,this.logger=r,this.name=IS,this.version=SS,this.events=new Dr.exports,this.initialized=!1,this.storagePrefix=hs,this.ignoredPayloadTypes=[ls],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=Bf(),o=await this.core.crypto.setSymKey(i),c=Nr(_e.FIVE_MINUTES),l={protocol:Vv},f={topic:o,expiry:c,relay:l,active:!1},h=tA({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:i,relay:l,expiryTimestamp:c,methods:n?.methods});return await this.pairings.set(o,f),await this.core.relayer.subscribe(o),this.core.expirer.set(o,c),{topic:o,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:o,relay:c,expiryTimestamp:l,methods:f}=Om(n.uri);let h;if(this.pairings.keys.includes(i)&&(h=this.pairings.get(i),h.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);const g=l||Nr(_e.FIVE_MINUTES),_={topic:i,relay:c,expiry:g,active:!1,methods:f};return await this.pairings.set(i,_),this.core.expirer.set(i,g),n.activatePairing&&await this.activate({topic:i}),this.events.emit(ra.create,_),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(o,i),await this.core.relayer.subscribe(i,{relay:c}),_},this.activate=async({topic:n})=>{this.isInitialized();const i=Nr(_e.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const o=await this.sendRequest(i,"wc_pairingPing",{}),{done:c,resolve:l,reject:f}=qs();this.events.once(wt("pairing_ping",o),({error:h})=>{h?f(h):l()}),await c()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Ut("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,o)=>{const c=ta(i,o),l=await this.core.crypto.encode(n,c),f=bc[i].req;return this.core.history.set(n,c),this.core.relayer.publish(n,l,f),c.id},this.sendResult=async(n,i,o)=>{const c=Jl(n,o),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=bc[f.request.method].res;await this.core.relayer.publish(i,l,h),await this.core.history.resolve(c)},this.sendError=async(n,i,o)=>{const c=Ql(n,o),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=bc[f.request.method]?bc[f.request.method].res:bc.unregistered_method.res;await this.core.relayer.publish(i,l,h),await this.core.history.resolve(c)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Ut("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ss(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:o}=n;switch(o.method){case"wc_pairingPing":return this.onPairingPingRequest(i,o);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,o);default:return this.onUnknownRpcMethodRequest(i,o)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:o}=n,c=(await this.core.history.get(i,o.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(i,o);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(n,i)=>{const{id:o}=i;try{this.isValidPing({topic:n}),await this.sendResult(o,n,!0),this.events.emit(ra.ping,{id:o,topic:n})}catch(c){await this.sendError(o,n,c),this.logger.error(c)}},this.onPairingPingResponse=(n,i)=>{const{id:o}=i;setTimeout(()=>{_i(i)?this.events.emit(wt("pairing_ping",o),{}):Mn(i)&&this.events.emit(wt("pairing_ping",o),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:o}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(ra.delete,{id:o,topic:n})}catch(c){await this.sendError(o,n,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:o,method:c}=i;try{if(this.registeredMethods.includes(c))return;const l=Ut("WC_METHOD_UNSUPPORTED",c);await this.sendError(o,n,l),this.logger.error(l)}catch(l){await this.sendError(o,n,l),this.logger.error(l)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Ut("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!rn(n)){const{message:c}=me("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!uA(n.uri)){const{message:c}=me("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const o=Om(n.uri);if(!((i=o?.relay)!=null&&i.protocol)){const{message:c}=me("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=me("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(c)}if(o!=null&&o.expiryTimestamp&&_e.toMiliseconds(o?.expiryTimestamp)<Date.now()){const{message:c}=me("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}},this.isValidPing=async n=>{if(!rn(n)){const{message:o}=me("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(o)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!rn(n)){const{message:o}=me("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(o)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ur(n,!1)){const{message:i}=me("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=me("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ss(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=me("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=on(r,this.name),this.pairings=new Qs(this.core,this.logger,this.name,this.storagePrefix)}get context(){return sn(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(wn.message,async e=>{const{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(r,n);try{s0(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Zl(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on($n.expired,async e=>{const{topic:r}=cg(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(ra.expire,{topic:r}))})}}class eD extends gx{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Dr.exports.EventEmitter,this.name=DS,this.version=CS,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,o)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:o}),this.records.has(i.id))return;const c={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:o,expiry:Nr(_e.THIRTY_DAYS)};this.records.set(c.id,c),this.persist(),this.events.emit(ei.created,c)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Mn(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(ei.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(o=>{if(o.topic===n){if(typeof i<"u"&&o.id!==i)return;this.records.delete(o.id),this.events.emit(ei.deleted,o)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=on(r,this.name)}get context(){return sn(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(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ta(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(ei.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(ei.created,e=>{const r=ei.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(ei.updated,e=>{const r=ei.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(ei.deleted,e=>{const r=ei.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(Zo.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{_e.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(ei.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class tD extends _x{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Dr.exports.EventEmitter,this.name=OS,this.version=PS,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const o=this.formatTarget(n),c={target:o,expiry:i};this.expirations.set(o,c),this.checkExpiry(o,c),this.events.emit($n.created,{target:o,expiration:c})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),o=this.getExpiration(i);this.expirations.delete(i),this.events.emit($n.deleted,{target:i,expiration:o})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=on(r,this.name)}get context(){return sn(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 N_(e);if(typeof e=="number")return R_(e);const{message:r}=me("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit($n.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;_e.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit($n.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Zo.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on($n.created,e=>{const r=$n.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on($n.expired,e=>{const r=$n.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on($n.deleted,e=>{const r=$n.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class rD extends Ex{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=h0,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||Uo()||!Fo())return;const i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(o){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(o)}if(!this.initialized){this.removeIframe(),this.verifyUrl=f0;try{await this.createIframe()}catch(o){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(o),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const i=this.getVerifyUrl(n?.verifyUrl);let o;try{o=await this.fetchAttestation(n.attestationId,i)}catch(c){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(c),o=await this.fetchAttestation(n.attestationId,f0)}return o},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const o=this.startAbortTimer(_e.ONE_SECOND*2),c=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const i=o=>{o.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(o=>{const c=document.getElementById(h0);if(c)return this.iframe=c,this.onInit(),o();window.addEventListener("message",i);const l=document.createElement("iframe");l.id=h0,l.src=`${this.verifyUrl}/${this.projectId}`,l.style.display="none",document.body.append(l),this.iframe=l,n=o}),new Promise((o,c)=>setTimeout(()=>{window.removeEventListener("message",i),c("verify iframe load timeout")},_e.toMiliseconds(_e.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||na;return MS.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${na}`),i=na),i},this.logger=on(r,this.name),this.verifyUrl=na,this.abortController=new AbortController,this.isDevEnv=Va()&&process.env.IS_VITEST}get context(){return sn(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),_e.toMiliseconds(e))}}class nD extends Ax{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=TS,this.registerDeviceToken=async n=>{const{clientId:i,token:o,notificationType:c,enableEncrypted:l=!1}=n,f=`${$S}/${this.projectId}/clients`;await M9(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:o,always_raw:l})})},this.logger=on(r,this.context)}}var iD=Object.defineProperty,nw=Object.getOwnPropertySymbols,sD=Object.prototype.hasOwnProperty,oD=Object.prototype.propertyIsEnumerable,iw=(t,e,r)=>e in t?iD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sw=(t,e)=>{for(var r in e||(e={}))sD.call(e,r)&&iw(t,r,e[r]);if(nw)for(var r of nw(e))oD.call(e,r)&&iw(t,r,e[r]);return t};class p0 extends px{constructor(e){var r;super(e),this.protocol=Kv,this.version=nS,this.name=u0,this.events=new Dr.exports.EventEmitter,this.initialized=!1,this.on=(c,l)=>this.events.on(c,l),this.once=(c,l)=>this.events.once(c,l),this.off=(c,l)=>this.events.off(c,l),this.removeListener=(c,l)=>this.events.removeListener(c,l),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Gv,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=Gl({level:typeof e?.logger=="string"&&e.logger?e.logger:iS.logger}),{logger:i,chunkLoggerController:o}=dx({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=o,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=on(i,this.name),this.heartbeat=new Zo.HeartBeat,this.crypto=new RS(this,this.logger,e?.keychain),this.history=new eD(this,this.logger),this.expirer=new tD(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new p7(sw(sw({},sS),e?.storageOptions)),this.relayer=new YS({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new XS(this,this.logger),this.verify=new rD(this.projectId||"",this.logger),this.echoClient=new nD(this.projectId||"",this.logger)}static async init(e){const r=new p0(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(_S,n),r}get context(){return sn(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 initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const aD=p0,ow="wc",aw=2,cw="client",g0=`${ow}@${aw}:${cw}:`,m0={name:cw,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},lw="WALLETCONNECT_DEEPLINK_CHOICE",cD="proposal",uw="Proposal expired",lD="session",ia=_e.SEVEN_DAYS,uD="engine",Nn={wc_sessionPropose:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1104},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1106},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1112},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1114},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:_e.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:_e.ONE_HOUR,prompt:!1,tag:1117}}},v0={min:_e.FIVE_MINUTES,max:_e.SEVEN_DAYS},zi={idle:"IDLE",active:"ACTIVE"},hD="request",fD=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],dD="wc",pD="auth",gD="authKeys",mD="pairingTopics",vD="requests",eu=`${dD}@${1.5}:${pD}:`,tu=`${eu}:PUB_KEY`;var wD=Object.defineProperty,yD=Object.defineProperties,bD=Object.getOwnPropertyDescriptors,hw=Object.getOwnPropertySymbols,_D=Object.prototype.hasOwnProperty,ED=Object.prototype.propertyIsEnumerable,fw=(t,e,r)=>e in t?wD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))_D.call(e,r)&&fw(t,r,e[r]);if(hw)for(var r of hw(e))ED.call(e,r)&&fw(t,r,e[r]);return t},sa=(t,e)=>yD(t,bD(e));class AD extends Ix{constructor(e){super(e),this.name=uD,this.events=new Dr.exports,this.initialized=!1,this.requestQueue={state:zi.idle,queue:[]},this.sessionRequestQueue={state:zi.idle,queue:[]},this.requestQueueDelay=_e.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Nn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const n=sa(Er({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:o,optionalNamespaces:c,sessionProperties:l,relays:f}=n;let h=i,g,_=!1;try{h&&(_=this.client.core.pairing.pairings.get(h).active)}catch(P){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),P}if(!h||!_){const{topic:P,uri:F}=await this.client.core.pairing.create();h=P,g=F}if(!h){const{message:P}=me("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(P)}const E=await this.client.core.crypto.generateKeyPair(),A=Nn.wc_sessionPropose.req.ttl||_e.FIVE_MINUTES,S=Nr(A),U=Er({requiredNamespaces:o,optionalNamespaces:c,relays:f??[{protocol:Vv}],proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:S},l&&{sessionProperties:l}),{reject:W,resolve:Y,done:B}=qs(A,uw);this.events.once(wt("session_connect"),async({error:P,session:F})=>{if(P)W(P);else if(F){F.self.publicKey=E;const j=sa(Er({},F),{requiredNamespaces:U.requiredNamespaces,optionalNamespaces:U.optionalNamespaces});await this.client.session.set(F.topic,j),await this.setExpiry(F.topic,F.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:F.peer.metadata}),Y(j)}});const z=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:U,throwOnFailedPublish:!0});return await this.setProposal(z,Er({id:z},U)),{uri:g,approval:B}},this.pair=async r=>{await this.isInitialized();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{await this.isInitialized();try{await this.isValidApprove(r)}catch(B){throw this.client.logger.error("approve() -> isValidApprove() failed"),B}const{id:n,relayProtocol:i,namespaces:o,sessionProperties:c,sessionConfig:l}=r;let f;try{f=this.client.proposal.get(n)}catch(B){throw this.client.logger.error(`approve() -> proposal.get(${n}) failed`),B}let{pairingTopic:h,proposer:g,requiredNamespaces:_,optionalNamespaces:E}=f;h=h||"";const A=await this.client.core.crypto.generateKeyPair(),S=g.publicKey,U=await this.client.core.crypto.generateSharedKey(A,S),W=Er(Er({relay:{protocol:i??"irn"},namespaces:o,pairingTopic:h,controller:{publicKey:A,metadata:this.client.metadata},expiry:Nr(ia)},c&&{sessionProperties:c}),l&&{sessionConfig:l});await this.client.core.relayer.subscribe(U);const Y=sa(Er({},W),{topic:U,requiredNamespaces:_,optionalNamespaces:E,pairingTopic:h,acknowledged:!1,self:W.controller,peer:{publicKey:g.publicKey,metadata:g.metadata},controller:A});await this.client.session.set(U,Y);try{await this.sendResult({id:n,topic:h,result:{relay:{protocol:i??"irn"},responderPublicKey:A},throwOnFailedPublish:!0}),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:W,throwOnFailedPublish:!0})}catch(B){throw this.client.logger.error(B),this.client.session.delete(U,Ut("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),B}return await this.client.core.pairing.updateMetadata({topic:h,metadata:g.metadata}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(U,Nr(ia)),{topic:U,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(U)),500))}},this.reject=async r=>{await this.isInitialized();try{await this.isValidReject(r)}catch(c){throw this.client.logger.error("reject() -> isValidReject() failed"),c}const{id:n,reason:i}=r;let o;try{o=this.client.proposal.get(n).pairingTopic}catch(c){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),c}o&&(await this.sendError({id:n,topic:o,error:i}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized();try{await this.isValidUpdate(r)}catch(_){throw this.client.logger.error("update() -> isValidUpdate() failed"),_}const{topic:n,namespaces:i}=r,{done:o,resolve:c,reject:l}=qs(),f=us(),h=Js().toString(),g=this.client.session.get(n).namespaces;return this.events.once(wt("session_update",f),({error:_})=>{_?l(_):c()}),await this.client.session.update(n,{namespaces:i}),this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:f,relayRpcId:h}).catch(_=>{this.client.logger.error(_),this.client.session.update(n,{namespaces:g}),l(_)}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized();try{await this.isValidExtend(r)}catch(f){throw this.client.logger.error("extend() -> isValidExtend() failed"),f}const{topic:n}=r,i=us(),{done:o,resolve:c,reject:l}=qs();return this.events.once(wt("session_extend",i),({error:f})=>{f?l(f):c()}),await this.setExpiry(n,Nr(ia)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(f=>{l(f)}),{acknowledged:o}},this.request=async r=>{await this.isInitialized();try{await this.isValidRequest(r)}catch(A){throw this.client.logger.error("request() -> isValidRequest() failed"),A}const{chainId:n,request:i,topic:o,expiry:c=Nn.wc_sessionRequest.req.ttl}=r,l=this.client.session.get(o),f=us(),h=Js().toString(),{done:g,resolve:_,reject:E}=qs(c,"Request expired. Please try again.");return this.events.once(wt("session_request",f),({error:A,result:S})=>{A?E(A):_(S)}),await Promise.all([new Promise(async A=>{await this.sendRequest({clientRpcId:f,relayRpcId:h,topic:o,method:"wc_sessionRequest",params:{request:sa(Er({},i),{expiryTimestamp:Nr(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(S=>E(S)),this.client.events.emit("session_request_sent",{topic:o,request:i,chainId:n,id:f}),A()}),new Promise(async A=>{var S;if(!((S=l.sessionConfig)!=null&&S.disableDeepLink)){const U=await B_(this.client.core.storage,lw);L_({id:f,topic:o,wcDeepLink:U})}A()}),g()]).then(A=>A[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:o}=i;_i(i)?await this.sendResult({id:o,topic:n,result:i.result,throwOnFailedPublish:!0}):Mn(i)&&await this.sendError({id:o,topic:n,error:i.error}),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=us(),o=Js().toString(),{done:c,resolve:l,reject:f}=qs();this.events.once(wt("session_ping",i),({error:h})=>{h?f(h):l()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:o}),c()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:i,chainId:o}=r,c=Js().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:o},throwOnFailedPublish:!0,relayRpcId:c})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Ut("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=me("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>cA(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async r=>{this.isInitialized(),this.isValidAuthenticate(r);const{chains:n,statement:i="",uri:o,domain:c,nonce:l,type:f,exp:h,nbf:g,methods:_=[]}=r,E=[...r.resources||[]],{topic:A,uri:S}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:A,uri:S}});const U=await this.client.core.crypto.generateKeyPair(),W=Rl(U);if(await Promise.all([this.client.auth.authKeys.set(tu,{responseTopic:W,publicKey:U}),this.client.auth.pairingTopics.set(W,{topic:W,pairingTopic:A})]),await this.client.core.relayer.subscribe(W),this.client.logger.info(`sending request to new pairing topic: ${A}`),_.length>0){const{namespace:fe}=wl(n[0]);let d=TE(fe,"request",_);Nl(E)&&(d=NE(d,E.pop())),E.push(d)}const Y=Nr(Nn.wc_sessionPropose.req.ttl),B={authPayload:{type:f??"caip122",chains:n,statement:i,aud:o,domain:c,version:"1",nonce:l,iat:new Date().toISOString(),exp:h,nbf:g,resources:E},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:Y},z={eip155:{chains:n,methods:[...new Set(["personal_sign",..._])],events:["chainChanged","accountsChanged"]}},P={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:Y},{done:F,resolve:j,reject:m}=qs(Nn.wc_sessionAuthenticate.req.ttl,"Request expired"),T=async({error:fe,session:d})=>{if(this.events.off(wt("session_request",ee),te),fe)m(fe);else if(d){d.self.publicKey=U,await this.client.session.set(d.topic,d),await this.setExpiry(d.topic,d.expiry),A&&await this.client.core.pairing.updateMetadata({topic:A,metadata:d.peer.metadata});const p=this.client.session.get(d.topic);j({session:p})}},te=async fe=>{if(fe.error){const L=Ut("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return fe.error.code===L.code?void 0:(this.events.off(wt("session_connect"),T),m(fe.error.message))}this.events.off(wt("session_connect"),T);const{cacaos:d,responder:p}=fe.result,b=[],D=[];for(const L of d){await mm({cacao:L,projectId:this.client.core.projectId})||(this.client.logger.error(L,"Signature verification failed"),m(Ut("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:C}=L,v=Nl(C.resources),N=[gm(C.iss)],oe=$l(C.iss);if(v){const pe=ym(v),x=bm(v);b.push(...pe),N.push(...x)}for(const pe of N)D.push(`${pe}:${oe}`)}const O=await this.client.core.crypto.generateSharedKey(U,p.publicKey);let $;b.length>0&&($={topic:O,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:p,controller:p.publicKey,expiry:Nr(ia),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:A,namespaces:Pm([...new Set(b)],[...new Set(D)])},await this.client.core.relayer.subscribe(O),await this.client.session.set(O,$),$=this.client.session.get(O)),j({auths:d,session:$})},ee=us(),ne=us();this.events.once(wt("session_connect"),T),this.events.once(wt("session_request",ee),te);try{await Promise.all([this.sendRequest({topic:A,method:"wc_sessionAuthenticate",params:B,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:ee}),this.sendRequest({topic:A,method:"wc_sessionPropose",params:P,expiry:Nn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:ne})])}catch(fe){throw this.events.off(wt("session_connect"),T),this.events.off(wt("session_request",ee),te),fe}return await this.setProposal(ne,Er({id:ne},P)),await this.client.auth.requests.set(ee,{authPayload:B.authPayload,requester:B.requester,expiryTimestamp:Y,id:ee,pairingTopic:A,verifyContext:{}}),{uri:S,response:F}},this.approveSessionAuthenticate=async r=>{this.isInitialized();const{id:n,auths:i}=r,o=this.getPendingAuthRequest(n);if(!o)throw new Error(`Could not find pending auth request with id ${n}`);const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=Rl(c),h={type:ls,receiverPublicKey:c,senderPublicKey:l},g=[],_=[];for(const S of i){if(!await mm({cacao:S,projectId:this.client.core.projectId})){const z=Ut("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:z,encodeOpts:h}),new Error(z.message)}const{p:U}=S,W=Nl(U.resources),Y=[gm(U.iss)],B=$l(U.iss);if(W){const z=ym(W),P=bm(W);g.push(...z),Y.push(...P)}for(const z of Y)_.push(`${z}:${B}`)}const E=await this.client.core.crypto.generateSharedKey(l,c);let A;return g?.length>0&&(A={topic:E,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Nr(ia),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:Pm([...new Set(g)],[...new Set(_)])},await this.client.core.relayer.subscribe(E),await this.client.session.set(E,A)),await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(n,{message:"fullfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),{session:A}},this.rejectSessionAuthenticate=async r=>{await this.isInitialized();const{id:n,reason:i}=r,o=this.getPendingAuthRequest(n);if(!o)throw new Error(`Could not find pending auth request with id ${n}`);const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=Rl(c),h={type:ls,receiverPublicKey:c,senderPublicKey:l};await this.sendError({id:n,topic:f,error:i,encodeOpts:h}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return vm(n,i)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(o=>{var c,l;return((c=o.peerMetadata)==null?void 0:c.url)&&((l=o.peerMetadata)==null?void 0:l.url)===r.peer.metadata.url&&o.topic&&o.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(o=>this.client.core.pairing.disconnect({topic:o.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{const{topic:n,expirerHasDeleted:i=!1,emitEvent:o=!0,id:c=0}=r,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Ut("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),i||this.client.core.expirer.del(n),this.client.core.storage.removeItem(lw).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===n&&this.deletePendingSessionRequest(f.id,Ut("USER_DISCONNECTED"))}),o&&this.client.events.emit("session_delete",{id:c,topic:n})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ut("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(o=>o.id!==r),i&&(this.sessionRequestQueue.state=zi.idle,this.client.events.emit("session_request_expire",{id:r}))},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,Nr(Nn.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:o,verifyContext:c}=r,l=o.request.expiryTimestamp||Nr(Nn.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(n,{id:n,topic:i,params:o,verifyContext:c}),l&&this.client.core.expirer.set(n,l)},this.sendRequest=async r=>{const{topic:n,method:i,params:o,expiry:c,relayRpcId:l,clientRpcId:f,throwOnFailedPublish:h}=r,g=ta(i,o,f);if(Fo()&&fD.includes(i)){const A=Ws(JSON.stringify(g));this.client.core.verify.register({attestationId:A})}let _;try{_=await this.client.core.crypto.encode(n,g)}catch(A){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),A}const E=Nn[i].req;return c&&(E.ttl=c),l&&(E.id=l),this.client.core.history.set(n,g),h?(E.internal=sa(Er({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,_,E)):this.client.core.relayer.publish(n,_,E).catch(A=>this.client.logger.error(A)),g.id},this.sendResult=async r=>{const{id:n,topic:i,result:o,throwOnFailedPublish:c,encodeOpts:l}=r,f=Jl(n,o);let h;try{h=await this.client.core.crypto.encode(i,f,l)}catch(E){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),E}let g;try{g=await this.client.core.history.get(i,n)}catch(E){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),E}const _=Nn[g.request.method].res;c?(_.internal=sa(Er({},_.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,h,_)):this.client.core.relayer.publish(i,h,_).catch(E=>this.client.logger.error(E)),await this.client.core.history.resolve(f)},this.sendError=async r=>{const{id:n,topic:i,error:o,encodeOpts:c}=r,l=Ql(n,o);let f;try{f=await this.client.core.crypto.encode(i,l,c)}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let h;try{h=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}const g=Nn[h.request.method].res;this.client.core.relayer.publish(i,f,g),await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let o=!1;ss(i.expiry)&&(o=!0),this.client.core.crypto.keychain.has(i.topic)||(o=!0),o&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ss(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===zi.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=zi.active;const r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=zi.idle},this.processRequest=r=>{const{topic:n,payload:i}=r,o=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:o}))switch(o){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${o}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=me("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,o=this.expectedPairingMethodMap.get(n);return!o||o.includes(i)?!1:!!(o.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(r,n)=>{const{params:i,id:o}=n;try{this.isValidConnect(Er({},n.params));const c=i.expiryTimestamp||Nr(Nn.wc_sessionPropose.req.ttl),l=Er({id:o,pairingTopic:r,expiryTimestamp:c},i);await this.setProposal(o,l);const f=Ws(JSON.stringify(n)),h=await this.getVerifyContext(f,l.proposer.metadata);this.client.events.emit("session_proposal",{id:o,params:l,verifyContext:h})}catch(c){await this.sendError({id:o,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionProposeResponse=async(r,n)=>{const{id:i}=n;if(_i(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const f=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const h=await this.client.core.crypto.generateSharedKey(l,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const g=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Mn(n)){await this.client.proposal.delete(i,Ut("USER_DISCONNECTED"));const o=wt("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(wt("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:o}=n;try{this.isValidSessionSettleRequest(o);const{relay:c,controller:l,expiry:f,namespaces:h,sessionProperties:g,pairingTopic:_,sessionConfig:E}=n.params,A=Er(Er({topic:r,relay:c,expiry:f,namespaces:h,acknowledged:!0,pairingTopic:_,requiredNamespaces:{},optionalNamespaces:{},controller:l.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:l.publicKey,metadata:l.metadata}},g&&{sessionProperties:g}),E&&{sessionConfig:E});await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0});const S=wt("session_connect");if(this.events.listenerCount(S)===0)throw new Error(`emitting ${S} without any listeners 997`);this.events.emit(wt("session_connect"),{session:A}),this.cleanupDuplicatePairings(A)}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;_i(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(wt("session_approve",i),{})):Mn(n)&&(await this.client.session.delete(r,Ut("USER_DISCONNECTED")),this.events.emit(wt("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:o}=n;try{const c=`${r}_session_update`,l=cc.get(c);if(l&&this.isRequestOutOfSync(l,o)){this.client.logger.info(`Discarding out of sync request - ${o}`),this.sendError({id:o,topic:r,error:Ut("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Er({topic:r},i));try{cc.set(c,o),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:o,topic:r,result:!0,throwOnFailedPublish:!0})}catch(f){throw cc.delete(c),f}this.client.events.emit("session_update",{id:o,topic:r,params:i})}catch(c){await this.sendError({id:o,topic:r,error:c}),this.client.logger.error(c)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,o=wt("session_update",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);_i(n)?this.events.emit(wt("session_update",i),{}):Mn(n)&&this.events.emit(wt("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Nr(ia)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,o=wt("session_extend",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);_i(n)?this.events.emit(wt("session_extend",i),{}):Mn(n)&&this.events.emit(wt("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,o=wt("session_ping",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);setTimeout(()=>{_i(n)?this.events.emit(wt("session_ping",i),{}):Mn(n)&&this.events.emit(wt("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(o=>{this.client.core.relayer.once(wn.publish,async()=>{o(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Ut("USER_DISCONNECTED")})])}catch(o){this.client.logger.error(o)}},this.onSessionRequest=async(r,n)=>{const{id:i,params:o}=n;try{await this.isValidRequest(Er({topic:r},o));const c=Ws(JSON.stringify(ta("wc_sessionRequest",o,i))),l=this.client.session.get(r),f=await this.getVerifyContext(c,l.peer.metadata),h={id:i,topic:r,params:o,verifyContext:f};await this.setPendingSessionRequest(h),this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue()}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,o=wt("session_request",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);_i(n)?this.events.emit(wt("session_request",i),{result:n.result}):Mn(n)&&this.events.emit(wt("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:o}=n;try{const c=`${r}_session_event_${o.event.name}`,l=cc.get(c);if(l&&this.isRequestOutOfSync(l,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Er({topic:r},o)),this.client.events.emit("session_event",{id:i,topic:r,params:o}),cc.set(c,i)}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),_i(n)?this.events.emit(wt("session_request",i),{result:n.result}):Mn(n)&&this.events.emit(wt("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async(r,n)=>{const{requester:i,authPayload:o,expiryTimestamp:c}=n.params,l=Ws(JSON.stringify(n)),f=await this.getVerifyContext(l,this.client.metadata),h={requester:i,pairingTopic:r,id:n.id,authPayload:o,verifyContext:f,expiryTimestamp:c};await this.client.auth.requests.set(n.id,h),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id})},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=zi.idle,this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(o=>o.topic===r&&o.request.method==="wc_sessionRequest").forEach(o=>{const c=o.request.id,l=wt("session_request",c);if(this.events.listenerCount(l)===0)throw new Error(`emitting ${l} without any listeners`);this.events.emit(wt("session_request",o.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===zi.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=zi.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,ta("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(f)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:o,sessionProperties:c,relays:l}=r;if(Hr(n)||await this.isValidPairingTopic(n),!bA(l,!0)){const{message:f}=me("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(f)}!Hr(i)&&ac(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Hr(o)&&ac(o)!==0&&this.validateNamespaces(o,"optionalNamespaces"),Hr(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=yA(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!rn(r))throw new Error(me("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:o,sessionProperties:c}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),f=kf(i,"approve()");if(f)throw new Error(f.message);const h=Rm(l.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!ur(o,!0)){const{message:g}=me("MISSING_OR_INVALID",`approve() relayProtocol: ${o}`);throw new Error(g)}Hr(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async r=>{if(!rn(r)){const{message:o}=me("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(o)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!EA(i)){const{message:o}=me("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(o)}},this.isValidSessionSettleRequest=r=>{if(!rn(r)){const{message:h}=me("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(h)}const{relay:n,controller:i,namespaces:o,expiry:c}=r;if(!$m(n)){const{message:h}=me("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const l=dA(i,"onSessionSettleRequest()");if(l)throw new Error(l.message);const f=kf(o,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(ss(c)){const{message:h}=me("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(f)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const o=this.client.session.get(n),c=kf(i,"update()");if(c)throw new Error(c.message);const l=Rm(o.requiredNamespaces,i,"update()");if(l)throw new Error(l.message)},this.isValidExtend=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(f)}const{topic:n,request:i,chainId:o,expiry:c}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:l}=this.client.session.get(n);if(!Nm(l,o)){const{message:f}=me("MISSING_OR_INVALID",`request() chainId: ${o}`);throw new Error(f)}if(!AA(i)){const{message:f}=me("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!SA(l,o,i.method)){const{message:f}=me("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!PA(c,v0)){const{message:f}=me("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${v0.min} and ${v0.max}`);throw new Error(f)}},this.isValidRespond=async r=>{var n;if(!rn(r)){const{message:c}=me("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(c)}const{topic:i,response:o}=r;try{await this.isValidSessionTopic(i)}catch(c){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),c}if(!xA(o)){const{message:c}=me("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(c)}},this.isValidPing=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!rn(r)){const{message:l}=me("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(l)}const{topic:n,event:i,chainId:o}=r;await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Nm(c,o)){const{message:l}=me("MISSING_OR_INVALID",`emit() chainId: ${o}`);throw new Error(l)}if(!IA(i)){const{message:l}=me("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}if(!DA(c,o,i.name)){const{message:l}=me("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}},this.isValidDisconnect=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:o,nonce:c}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!ur(i,!1))throw new Error("uri is required parameter");if(!ur(o,!1))throw new Error("domain is required parameter");if(!ur(c,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(f=>wl(f).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:l}=wl(n[0]);if(l!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(r,n)=>{const i={verified:{verifyUrl:n.verifyUrl||na,validation:"UNKNOWN",origin:n.url||""}};try{const o=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});o&&(i.verified.origin=o.origin,i.verified.isScam=o.isScam,i.verified.validation=o.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(o){this.client.logger.info(o)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!ur(i,!1)){const{message:o}=me("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(i)}`);throw new Error(o)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const o=this.recentlyDeletedLimit/2;for(const c of this.recentlyDeletedMap.keys()){if(i++>=o)break;this.recentlyDeletedMap.delete(c)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=me("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(wn.message,async e=>{const{topic:r,message:n}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(tu)?this.client.auth.authKeys.get(tu):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(r,n,{receiverPublicKey:i});try{s0(o)?(this.client.core.history.set(r,o),this.onRelayEventRequest({topic:r,payload:o})):Zl(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:r,payload:o}),this.client.core.history.delete(r,o.id)):this.onRelayEventUnknownPayload({topic:r,payload:o})}catch(c){this.client.logger.error(c)}})}registerExpirerEvents(){this.client.core.expirer.on($n.expired,async e=>{const{topic:r,id:n}=cg(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,me("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(ra.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(ra.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ur(e,!1)){const{message:r}=me("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ss(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=me("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!ur(e,!1)){const{message:r}=me("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ss(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=me("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=me("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}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(ur(e,!1)){const{message:r}=me("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=me("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!_A(e)){const{message:r}=me("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ss(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=me("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class xD extends Qs{constructor(e,r){super(e,r,cD,g0),this.core=e,this.logger=r}}class ID extends Qs{constructor(e,r){super(e,r,lD,g0),this.core=e,this.logger=r}}class SD extends Qs{constructor(e,r){super(e,r,hD,g0,n=>n.id),this.core=e,this.logger=r}}class DD extends Qs{constructor(e,r){super(e,r,gD,eu,()=>tu),this.core=e,this.logger=r}}class CD extends Qs{constructor(e,r){super(e,r,mD,eu),this.core=e,this.logger=r}}class OD extends Qs{constructor(e,r){super(e,r,vD,eu,n=>n.id),this.core=e,this.logger=r}}class PD{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new DD(this.core,this.logger),this.pairingTopics=new CD(this.core,this.logger),this.requests=new OD(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class w0 extends xx{constructor(e){super(e),this.protocol=ow,this.version=aw,this.name=m0.name,this.events=new Dr.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async n=>{try{return await this.engine.authenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||m0.name,this.metadata=e?.metadata||O_();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:yi(Gl({level:e?.logger||m0.logger}));this.core=e?.core||new aD(e),this.logger=on(r,this.name),this.session=new ID(this.core,this.logger),this.proposal=new xD(this.core,this.logger),this.pendingRequest=new SD(this.core,this.logger),this.engine=new AD(this),this.auth=new PD(this.core,this.logger)}static async init(e){const r=new w0(e);return await r.initialize(),r}get context(){return sn(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var y0={exports:{}};(function(t,e){var r=typeof self<"u"?self:Fr,n=function(){function o(){this.fetch=!1,this.DOMException=r.DOMException}return o.prototype=r,new o}();(function(o){(function(c){var l={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function f(p){return p&&DataView.prototype.isPrototypeOf(p)}if(l.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(p){return p&&h.indexOf(Object.prototype.toString.call(p))>-1};function _(p){if(typeof p!="string"&&(p=String(p)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(p))throw new TypeError("Invalid character in header field name");return p.toLowerCase()}function E(p){return typeof p!="string"&&(p=String(p)),p}function A(p){var b={next:function(){var D=p.shift();return{done:D===void 0,value:D}}};return l.iterable&&(b[Symbol.iterator]=function(){return b}),b}function S(p){this.map={},p instanceof S?p.forEach(function(b,D){this.append(D,b)},this):Array.isArray(p)?p.forEach(function(b){this.append(b[0],b[1])},this):p&&Object.getOwnPropertyNames(p).forEach(function(b){this.append(b,p[b])},this)}S.prototype.append=function(p,b){p=_(p),b=E(b);var D=this.map[p];this.map[p]=D?D+", "+b:b},S.prototype.delete=function(p){delete this.map[_(p)]},S.prototype.get=function(p){return p=_(p),this.has(p)?this.map[p]:null},S.prototype.has=function(p){return this.map.hasOwnProperty(_(p))},S.prototype.set=function(p,b){this.map[_(p)]=E(b)},S.prototype.forEach=function(p,b){for(var D in this.map)this.map.hasOwnProperty(D)&&p.call(b,this.map[D],D,this)},S.prototype.keys=function(){var p=[];return this.forEach(function(b,D){p.push(D)}),A(p)},S.prototype.values=function(){var p=[];return this.forEach(function(b){p.push(b)}),A(p)},S.prototype.entries=function(){var p=[];return this.forEach(function(b,D){p.push([D,b])}),A(p)},l.iterable&&(S.prototype[Symbol.iterator]=S.prototype.entries);function U(p){if(p.bodyUsed)return Promise.reject(new TypeError("Already read"));p.bodyUsed=!0}function W(p){return new Promise(function(b,D){p.onload=function(){b(p.result)},p.onerror=function(){D(p.error)}})}function Y(p){var b=new FileReader,D=W(b);return b.readAsArrayBuffer(p),D}function B(p){var b=new FileReader,D=W(b);return b.readAsText(p),D}function z(p){for(var b=new Uint8Array(p),D=new Array(b.length),O=0;O<b.length;O++)D[O]=String.fromCharCode(b[O]);return D.join("")}function P(p){if(p.slice)return p.slice(0);var b=new Uint8Array(p.byteLength);return b.set(new Uint8Array(p)),b.buffer}function F(){return this.bodyUsed=!1,this._initBody=function(p){this._bodyInit=p,p?typeof p=="string"?this._bodyText=p:l.blob&&Blob.prototype.isPrototypeOf(p)?this._bodyBlob=p:l.formData&&FormData.prototype.isPrototypeOf(p)?this._bodyFormData=p:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(p)?this._bodyText=p.toString():l.arrayBuffer&&l.blob&&f(p)?(this._bodyArrayBuffer=P(p.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(p)||g(p))?this._bodyArrayBuffer=P(p):this._bodyText=p=Object.prototype.toString.call(p):this._bodyText="",this.headers.get("content-type")||(typeof p=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(p)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var p=U(this);if(p)return p;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?U(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var p=U(this);if(p)return p;if(this._bodyBlob)return B(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(z(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(te)}),this.json=function(){return this.text().then(JSON.parse)},this}var j=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(p){var b=p.toUpperCase();return j.indexOf(b)>-1?b:p}function T(p,b){b=b||{};var D=b.body;if(p instanceof T){if(p.bodyUsed)throw new TypeError("Already read");this.url=p.url,this.credentials=p.credentials,b.headers||(this.headers=new S(p.headers)),this.method=p.method,this.mode=p.mode,this.signal=p.signal,!D&&p._bodyInit!=null&&(D=p._bodyInit,p.bodyUsed=!0)}else this.url=String(p);if(this.credentials=b.credentials||this.credentials||"same-origin",(b.headers||!this.headers)&&(this.headers=new S(b.headers)),this.method=m(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.signal=b.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}T.prototype.clone=function(){return new T(this,{body:this._bodyInit})};function te(p){var b=new FormData;return p.trim().split("&").forEach(function(D){if(D){var O=D.split("="),$=O.shift().replace(/\+/g," "),L=O.join("=").replace(/\+/g," ");b.append(decodeURIComponent($),decodeURIComponent(L))}}),b}function ee(p){var b=new S,D=p.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(O){var $=O.split(":"),L=$.shift().trim();if(L){var C=$.join(":").trim();b.append(L,C)}}),b}F.call(T.prototype);function ne(p,b){b||(b={}),this.type="default",this.status=b.status===void 0?200:b.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new S(b.headers),this.url=b.url||"",this._initBody(p)}F.call(ne.prototype),ne.prototype.clone=function(){return new ne(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new S(this.headers),url:this.url})},ne.error=function(){var p=new ne(null,{status:0,statusText:""});return p.type="error",p};var fe=[301,302,303,307,308];ne.redirect=function(p,b){if(fe.indexOf(b)===-1)throw new RangeError("Invalid status code");return new ne(null,{status:b,headers:{location:p}})},c.DOMException=o.DOMException;try{new c.DOMException}catch{c.DOMException=function(b,D){this.message=b,this.name=D;var O=Error(b);this.stack=O.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function d(p,b){return new Promise(function(D,O){var $=new T(p,b);if($.signal&&$.signal.aborted)return O(new c.DOMException("Aborted","AbortError"));var L=new XMLHttpRequest;function C(){L.abort()}L.onload=function(){var v={status:L.status,statusText:L.statusText,headers:ee(L.getAllResponseHeaders()||"")};v.url="responseURL"in L?L.responseURL:v.headers.get("X-Request-URL");var N="response"in L?L.response:L.responseText;D(new ne(N,v))},L.onerror=function(){O(new TypeError("Network request failed"))},L.ontimeout=function(){O(new TypeError("Network request failed"))},L.onabort=function(){O(new c.DOMException("Aborted","AbortError"))},L.open($.method,$.url,!0),$.credentials==="include"?L.withCredentials=!0:$.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&l.blob&&(L.responseType="blob"),$.headers.forEach(function(v,N){L.setRequestHeader(N,v)}),$.signal&&($.signal.addEventListener("abort",C),L.onreadystatechange=function(){L.readyState===4&&$.signal.removeEventListener("abort",C)}),L.send(typeof $._bodyInit>"u"?null:$._bodyInit)})}return d.polyfill=!0,o.fetch||(o.fetch=d,o.Headers=S,o.Request=T,o.Response=ne),c.Headers=S,c.Request=T,c.Response=ne,c.fetch=d,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(y0,y0.exports);var dw=e3(y0.exports);const pw={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},gw=10;class fs{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new Dr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!bv(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,r){this.isAvailable||await this.register();try{const n=Fi(e),o=await(await dw(this.url,Object.assign(Object.assign({},pw),{body:n}))).json();this.onPayload({data:o})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!bv(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),i(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Fi({id:1,jsonrpc:"2.0",method:"test",params:[]});await dw(e,Object.assign(Object.assign({},pw),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?uc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),o=Ql(e,i);this.events.emit("payload",o)}parseError(e,r=this.url){return pv(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>gw&&this.events.setMaxListeners(gw)}}const mw="error",MD="wss://relay.walletconnect.com",TD="wc",$D="universal_provider",vw=`${TD}@2:${$D}:`,ND="https://rpc.walletconnect.com/v1/",Hi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},b0={exports:{}};/**
70
57
  * @license
71
58
  * Lodash <https://lodash.com/>
72
59
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
73
60
  * Released under MIT license <https://lodash.com/license>
74
61
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
75
62
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
76
- */(function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",_=1,E=2,A=4,I=1,R=2,W=1,Y=2,F=4,z=8,$=16,j=32,P=64,g=128,C=256,Z=512,J=30,te="...",ae=800,p=16,d=1,b=2,D=3,M=1/0,N=9007199254740991,U=17976931348623157e292,O=0/0,v=4294967295,L=v-1,oe=v>>>1,de=[["ary",g],["bind",W],["bindKey",Y],["curry",z],["curryRight",$],["flip",Z],["partial",j],["partialRight",P],["rearg",C]],x="[object Arguments]",ne="[object Array]",q="[object AsyncFunction]",H="[object Boolean]",V="[object Date]",y="[object DOMException]",k="[object Error]",ie="[object Function]",fe="[object GeneratorFunction]",ue="[object Map]",Oe="[object Number]",Me="[object Null]",Ie="[object Object]",Pt="[object Promise]",ze="[object Proxy]",Ce="[object RegExp]",Fe="[object Set]",Ee="[object String]",Ae="[object Symbol]",Ge="[object Undefined]",we="[object WeakMap]",xe="[object WeakSet]",Be="[object ArrayBuffer]",be="[object DataView]",Pe="[object Float32Array]",je="[object Float64Array]",Te="[object Int8Array]",$e="[object Int16Array]",lt="[object Int32Array]",Re="[object Uint8Array]",Ne="[object Uint8ClampedArray]",nr="[object Uint16Array]",dt="[object Uint32Array]",Et=/\b__p \+= '';/g,ir=/\b(__p \+=) '' \+/g,St=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Vr=/[&<>"']/g,Ye=RegExp(Ot.source),He=RegExp(Vr.source),Rt=/<%-([\s\S]+?)%>/g,Je=/<%([\s\S]+?)%>/g,Ve=/<%=([\s\S]+?)%>/g,Mt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xe=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lt=/[\\^$.*+?()[\]{}|]/g,tt=RegExp(Lt.source),Qe=/^\s+/,Ft=/\s/,Ze=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ke=/\{\n\/\* \[wrapped with (.+)\] \*/,Ht=/,? & /,rt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jt=/[()=,{}\[\]\/\s]/,ri=/\\(\\)?/g,kt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,Bn=/^[-+]0x[0-9a-f]+$/i,Un=/^0b[01]+$/i,Fn=/^\[object .+?Constructor\]$/,jn=/^0o[0-7]+$/i,kn=/^(?:0|[1-9]\d*)$/,xr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ii=/($^)/,mo=/['\n\r\u2028\u2029\\]/g,Di="\\ud800-\\udfff",vo="\\u0300-\\u036f",yo="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",Is=vo+yo+Ci,Ds="\\u2700-\\u27bf",Gr="a-z\\xdf-\\xf6\\xf8-\\xff",wo="\\xac\\xb1\\xd7\\xf7",bo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",_o="\\u2000-\\u206f",Eo=" \\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",Tu="A-Z\\xc0-\\xd6\\xd8-\\xde",$u="\\ufe0e\\ufe0f",Ao=wo+bo+_o+Eo,qc="['\u2019]",xo="["+Di+"]",zc="["+Ao+"]",So="["+Is+"]",Nu="\\d+",Ld="["+Ds+"]",Ru="["+Gr+"]",Lu="[^"+Di+Ao+Nu+Ds+Gr+Tu+"]",xa="\\ud83c[\\udffb-\\udfff]",Bd="(?:"+So+"|"+xa+")",Bu="[^"+Di+"]",Sa="(?:\\ud83c[\\udde6-\\uddff]){2}",Cs="[\\ud800-\\udbff][\\udc00-\\udfff]",_n="["+Tu+"]",Uu="\\u200d",Fu="(?:"+Ru+"|"+Lu+")",Oi="(?:"+_n+"|"+Lu+")",ju="(?:"+qc+"(?:d|ll|m|re|s|t|ve))?",ku="(?:"+qc+"(?:D|LL|M|RE|S|T|VE))?",qu=Bd+"?",zu="["+$u+"]?",Ud="(?:"+Uu+"(?:"+[Bu,Sa,Cs].join("|")+")"+zu+qu+")*",Vi="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ku=zu+qu+Ud,Ia="(?:"+[Ld,Sa,Cs].join("|")+")"+Ku,Fd="(?:"+[Bu+So+"?",So,Sa,Cs,xo].join("|")+")",Hc=RegExp(qc,"g"),jd=RegExp(So,"g"),Da=RegExp(xa+"(?="+xa+")|"+Fd+Ku,"g"),Wu=RegExp([_n+"?"+Ru+"+"+ju+"(?="+[zc,_n,"$"].join("|")+")",Oi+"+"+ku+"(?="+[zc,_n+Fu,"$"].join("|")+")",_n+"?"+Fu+"+"+ju,_n+"+"+ku,Hu,Vi,Nu,Ia].join("|"),"g"),Vu=RegExp("["+Uu+Di+Is+$u+"]"),Io=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Gu=["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"],kd=-1,Wt={};Wt[Pe]=Wt[je]=Wt[Te]=Wt[$e]=Wt[lt]=Wt[Re]=Wt[Ne]=Wt[nr]=Wt[dt]=!0,Wt[x]=Wt[ne]=Wt[Be]=Wt[H]=Wt[be]=Wt[V]=Wt[k]=Wt[ie]=Wt[ue]=Wt[Oe]=Wt[Ie]=Wt[Ce]=Wt[Fe]=Wt[Ee]=Wt[we]=!1;var Kt={};Kt[x]=Kt[ne]=Kt[Be]=Kt[be]=Kt[H]=Kt[V]=Kt[Pe]=Kt[je]=Kt[Te]=Kt[$e]=Kt[lt]=Kt[ue]=Kt[Oe]=Kt[Ie]=Kt[Ce]=Kt[Fe]=Kt[Ee]=Kt[Ae]=Kt[Re]=Kt[Ne]=Kt[nr]=Kt[dt]=!0,Kt[k]=Kt[ie]=Kt[we]=!1;var K={\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"},X={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Se={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Vt=parseFloat,ot=parseInt,Zt=typeof Ec=="object"&&Ec&&Ec.Object===Object&&Ec,gr=typeof self=="object"&&self&&self.Object===Object&&self,It=Zt||gr||Function("return this")(),Gt=e&&!e.nodeType&&e,fr=Gt&&!0&&t&&!t.nodeType&&t,an=fr&&fr.exports===Gt,mr=an&&Zt.process,Xt=function(){try{var ee=fr&&fr.require&&fr.require("util").types;return ee||mr&&mr.binding&&mr.binding("util")}catch{}}(),Yr=Xt&&Xt.isArrayBuffer,ni=Xt&&Xt.isDate,qn=Xt&&Xt.isMap,Pi=Xt&&Xt.isRegExp,Kc=Xt&&Xt.isSet,Do=Xt&&Xt.isTypedArray;function Sr(ee,ce,se){switch(se.length){case 0:return ee.call(ce);case 1:return ee.call(ce,se[0]);case 2:return ee.call(ce,se[0],se[1]);case 3:return ee.call(ce,se[0],se[1],se[2])}return ee.apply(ce,se)}function s$(ee,ce,se,De){for(var it=-1,$t=ee==null?0:ee.length;++it<$t;){var yr=ee[it];ce(De,yr,se(yr),ee)}return De}function zn(ee,ce){for(var se=-1,De=ee==null?0:ee.length;++se<De&&ce(ee[se],se,ee)!==!1;);return ee}function o$(ee,ce){for(var se=ee==null?0:ee.length;se--&&ce(ee[se],se,ee)!==!1;);return ee}function o2(ee,ce){for(var se=-1,De=ee==null?0:ee.length;++se<De;)if(!ce(ee[se],se,ee))return!1;return!0}function Os(ee,ce){for(var se=-1,De=ee==null?0:ee.length,it=0,$t=[];++se<De;){var yr=ee[se];ce(yr,se,ee)&&($t[it++]=yr)}return $t}function Yu(ee,ce){var se=ee==null?0:ee.length;return!!se&&Ca(ee,ce,0)>-1}function qd(ee,ce,se){for(var De=-1,it=ee==null?0:ee.length;++De<it;)if(se(ce,ee[De]))return!0;return!1}function tr(ee,ce){for(var se=-1,De=ee==null?0:ee.length,it=Array(De);++se<De;)it[se]=ce(ee[se],se,ee);return it}function Ps(ee,ce){for(var se=-1,De=ce.length,it=ee.length;++se<De;)ee[it+se]=ce[se];return ee}function zd(ee,ce,se,De){var it=-1,$t=ee==null?0:ee.length;for(De&&$t&&(se=ee[++it]);++it<$t;)se=ce(se,ee[it],it,ee);return se}function a$(ee,ce,se,De){var it=ee==null?0:ee.length;for(De&&it&&(se=ee[--it]);it--;)se=ce(se,ee[it],it,ee);return se}function Hd(ee,ce){for(var se=-1,De=ee==null?0:ee.length;++se<De;)if(ce(ee[se],se,ee))return!0;return!1}var c$=Kd("length");function l$(ee){return ee.split("")}function u$(ee){return ee.match(rt)||[]}function a2(ee,ce,se){var De;return se(ee,function(it,$t,yr){if(ce(it,$t,yr))return De=$t,!1}),De}function Ju(ee,ce,se,De){for(var it=ee.length,$t=se+(De?1:-1);De?$t--:++$t<it;)if(ce(ee[$t],$t,ee))return $t;return-1}function Ca(ee,ce,se){return ce===ce?E$(ee,ce,se):Ju(ee,c2,se)}function h$(ee,ce,se,De){for(var it=se-1,$t=ee.length;++it<$t;)if(De(ee[it],ce))return it;return-1}function c2(ee){return ee!==ee}function l2(ee,ce){var se=ee==null?0:ee.length;return se?Vd(ee,ce)/se:O}function Kd(ee){return function(ce){return ce==null?r:ce[ee]}}function Wd(ee){return function(ce){return ee==null?r:ee[ce]}}function u2(ee,ce,se,De,it){return it(ee,function($t,yr,Yt){se=De?(De=!1,$t):ce(se,$t,yr,Yt)}),se}function f$(ee,ce){var se=ee.length;for(ee.sort(ce);se--;)ee[se]=ee[se].value;return ee}function Vd(ee,ce){for(var se,De=-1,it=ee.length;++De<it;){var $t=ce(ee[De]);$t!==r&&(se=se===r?$t:se+$t)}return se}function Gd(ee,ce){for(var se=-1,De=Array(ee);++se<ee;)De[se]=ce(se);return De}function d$(ee,ce){return tr(ce,function(se){return[se,ee[se]]})}function h2(ee){return ee&&ee.slice(0,g2(ee)+1).replace(Qe,"")}function En(ee){return function(ce){return ee(ce)}}function Yd(ee,ce){return tr(ce,function(se){return ee[se]})}function Wc(ee,ce){return ee.has(ce)}function f2(ee,ce){for(var se=-1,De=ee.length;++se<De&&Ca(ce,ee[se],0)>-1;);return se}function d2(ee,ce){for(var se=ee.length;se--&&Ca(ce,ee[se],0)>-1;);return se}function p$(ee,ce){for(var se=ee.length,De=0;se--;)ee[se]===ce&&++De;return De}var g$=Wd(K),m$=Wd(X);function v$(ee){return"\\"+Se[ee]}function y$(ee,ce){return ee==null?r:ee[ce]}function Oa(ee){return Vu.test(ee)}function w$(ee){return Io.test(ee)}function b$(ee){for(var ce,se=[];!(ce=ee.next()).done;)se.push(ce.value);return se}function Jd(ee){var ce=-1,se=Array(ee.size);return ee.forEach(function(De,it){se[++ce]=[it,De]}),se}function p2(ee,ce){return function(se){return ee(ce(se))}}function Ms(ee,ce){for(var se=-1,De=ee.length,it=0,$t=[];++se<De;){var yr=ee[se];(yr===ce||yr===m)&&(ee[se]=m,$t[it++]=se)}return $t}function Qu(ee){var ce=-1,se=Array(ee.size);return ee.forEach(function(De){se[++ce]=De}),se}function _$(ee){var ce=-1,se=Array(ee.size);return ee.forEach(function(De){se[++ce]=[De,De]}),se}function E$(ee,ce,se){for(var De=se-1,it=ee.length;++De<it;)if(ee[De]===ce)return De;return-1}function A$(ee,ce,se){for(var De=se+1;De--;)if(ee[De]===ce)return De;return De}function Pa(ee){return Oa(ee)?S$(ee):c$(ee)}function ii(ee){return Oa(ee)?I$(ee):l$(ee)}function g2(ee){for(var ce=ee.length;ce--&&Ft.test(ee.charAt(ce)););return ce}var x$=Wd(pe);function S$(ee){for(var ce=Da.lastIndex=0;Da.test(ee);)++ce;return ce}function I$(ee){return ee.match(Da)||[]}function D$(ee){return ee.match(Wu)||[]}var C$=function ee(ce){ce=ce==null?It:Ma.defaults(It.Object(),ce,Ma.pick(It,Gu));var se=ce.Array,De=ce.Date,it=ce.Error,$t=ce.Function,yr=ce.Math,Yt=ce.Object,Qd=ce.RegExp,O$=ce.String,Hn=ce.TypeError,Zu=se.prototype,P$=$t.prototype,Ta=Yt.prototype,Xu=ce["__core-js_shared__"],eh=P$.toString,qt=Ta.hasOwnProperty,M$=0,m2=function(){var o=/[^.]+$/.exec(Xu&&Xu.keys&&Xu.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),th=Ta.toString,T$=eh.call(Yt),$$=It._,N$=Qd("^"+eh.call(qt).replace(Lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rh=an?ce.Buffer:r,Ts=ce.Symbol,nh=ce.Uint8Array,v2=rh?rh.allocUnsafe:r,ih=p2(Yt.getPrototypeOf,Yt),y2=Yt.create,w2=Ta.propertyIsEnumerable,sh=Zu.splice,b2=Ts?Ts.isConcatSpreadable:r,Vc=Ts?Ts.iterator:r,Co=Ts?Ts.toStringTag:r,oh=function(){try{var o=$o(Yt,"defineProperty");return o({},"",{}),o}catch{}}(),R$=ce.clearTimeout!==It.clearTimeout&&ce.clearTimeout,L$=De&&De.now!==It.Date.now&&De.now,B$=ce.setTimeout!==It.setTimeout&&ce.setTimeout,ah=yr.ceil,ch=yr.floor,Zd=Yt.getOwnPropertySymbols,U$=rh?rh.isBuffer:r,_2=ce.isFinite,F$=Zu.join,j$=p2(Yt.keys,Yt),wr=yr.max,Br=yr.min,k$=De.now,q$=ce.parseInt,E2=yr.random,z$=Zu.reverse,Xd=$o(ce,"DataView"),Gc=$o(ce,"Map"),ep=$o(ce,"Promise"),$a=$o(ce,"Set"),Yc=$o(ce,"WeakMap"),Jc=$o(Yt,"create"),lh=Yc&&new Yc,Na={},H$=No(Xd),K$=No(Gc),W$=No(ep),V$=No($a),G$=No(Yc),uh=Ts?Ts.prototype:r,Qc=uh?uh.valueOf:r,A2=uh?uh.toString:r;function T(o){if(cr(o)&&!at(o)&&!(o instanceof At)){if(o instanceof Kn)return o;if(qt.call(o,"__wrapped__"))return xb(o)}return new Kn(o)}var Ra=function(){function o(){}return function(a){if(!sr(a))return{};if(y2)return y2(a);o.prototype=a;var u=new o;return o.prototype=r,u}}();function hh(){}function Kn(o,a){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=r}T.templateSettings={escape:Rt,evaluate:Je,interpolate:Ve,variable:"",imports:{_:T}},T.prototype=hh.prototype,T.prototype.constructor=T,Kn.prototype=Ra(hh.prototype),Kn.prototype.constructor=Kn;function At(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function Y$(){var o=new At(this.__wrapped__);return o.__actions__=cn(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=cn(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=cn(this.__views__),o}function J$(){if(this.__filtered__){var o=new At(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function Q$(){var o=this.__wrapped__.value(),a=this.__dir__,u=at(o),w=a<0,S=u?o.length:0,B=lR(0,S,this.__views__),G=B.start,Q=B.end,re=Q-G,le=w?Q:G-1,he=this.__iteratees__,ge=he.length,ye=0,Le=Br(re,this.__takeCount__);if(!u||!w&&S==re&&Le==re)return V2(o,this.__actions__);var Ke=[];e:for(;re--&&ye<Le;){le+=a;for(var pt=-1,We=o[le];++pt<ge;){var wt=he[pt],Dt=wt.iteratee,Sn=wt.type,Zr=Dt(We);if(Sn==b)We=Zr;else if(!Zr){if(Sn==d)continue e;break e}}Ke[ye++]=We}return Ke}At.prototype=Ra(hh.prototype),At.prototype.constructor=At;function Oo(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var w=o[a];this.set(w[0],w[1])}}function Z$(){this.__data__=Jc?Jc(null):{},this.size=0}function X$(o){var a=this.has(o)&&delete this.__data__[o];return this.size-=a?1:0,a}function eN(o){var a=this.__data__;if(Jc){var u=a[o];return u===f?r:u}return qt.call(a,o)?a[o]:r}function tN(o){var a=this.__data__;return Jc?a[o]!==r:qt.call(a,o)}function rN(o,a){var u=this.__data__;return this.size+=this.has(o)?0:1,u[o]=Jc&&a===r?f:a,this}Oo.prototype.clear=Z$,Oo.prototype.delete=X$,Oo.prototype.get=eN,Oo.prototype.has=tN,Oo.prototype.set=rN;function Gi(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var w=o[a];this.set(w[0],w[1])}}function nN(){this.__data__=[],this.size=0}function iN(o){var a=this.__data__,u=fh(a,o);if(u<0)return!1;var w=a.length-1;return u==w?a.pop():sh.call(a,u,1),--this.size,!0}function sN(o){var a=this.__data__,u=fh(a,o);return u<0?r:a[u][1]}function oN(o){return fh(this.__data__,o)>-1}function aN(o,a){var u=this.__data__,w=fh(u,o);return w<0?(++this.size,u.push([o,a])):u[w][1]=a,this}Gi.prototype.clear=nN,Gi.prototype.delete=iN,Gi.prototype.get=sN,Gi.prototype.has=oN,Gi.prototype.set=aN;function Yi(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var w=o[a];this.set(w[0],w[1])}}function cN(){this.size=0,this.__data__={hash:new Oo,map:new(Gc||Gi),string:new Oo}}function lN(o){var a=xh(this,o).delete(o);return this.size-=a?1:0,a}function uN(o){return xh(this,o).get(o)}function hN(o){return xh(this,o).has(o)}function fN(o,a){var u=xh(this,o),w=u.size;return u.set(o,a),this.size+=u.size==w?0:1,this}Yi.prototype.clear=cN,Yi.prototype.delete=lN,Yi.prototype.get=uN,Yi.prototype.has=hN,Yi.prototype.set=fN;function Po(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new Yi;++a<u;)this.add(o[a])}function dN(o){return this.__data__.set(o,f),this}function pN(o){return this.__data__.has(o)}Po.prototype.add=Po.prototype.push=dN,Po.prototype.has=pN;function si(o){var a=this.__data__=new Gi(o);this.size=a.size}function gN(){this.__data__=new Gi,this.size=0}function mN(o){var a=this.__data__,u=a.delete(o);return this.size=a.size,u}function vN(o){return this.__data__.get(o)}function yN(o){return this.__data__.has(o)}function wN(o,a){var u=this.__data__;if(u instanceof Gi){var w=u.__data__;if(!Gc||w.length<i-1)return w.push([o,a]),this.size=++u.size,this;u=this.__data__=new Yi(w)}return u.set(o,a),this.size=u.size,this}si.prototype.clear=gN,si.prototype.delete=mN,si.prototype.get=vN,si.prototype.has=yN,si.prototype.set=wN;function x2(o,a){var u=at(o),w=!u&&Ro(o),S=!u&&!w&&Bs(o),B=!u&&!w&&!S&&Fa(o),G=u||w||S||B,Q=G?Gd(o.length,O$):[],re=Q.length;for(var le in o)(a||qt.call(o,le))&&!(G&&(le=="length"||S&&(le=="offset"||le=="parent")||B&&(le=="buffer"||le=="byteLength"||le=="byteOffset")||Xi(le,re)))&&Q.push(le);return Q}function S2(o){var a=o.length;return a?o[hp(0,a-1)]:r}function bN(o,a){return Sh(cn(o),Mo(a,0,o.length))}function _N(o){return Sh(cn(o))}function tp(o,a,u){(u!==r&&!oi(o[a],u)||u===r&&!(a in o))&&Ji(o,a,u)}function Zc(o,a,u){var w=o[a];(!(qt.call(o,a)&&oi(w,u))||u===r&&!(a in o))&&Ji(o,a,u)}function fh(o,a){for(var u=o.length;u--;)if(oi(o[u][0],a))return u;return-1}function EN(o,a,u,w){return $s(o,function(S,B,G){a(w,S,u(S),G)}),w}function I2(o,a){return o&&Ti(a,Ir(a),o)}function AN(o,a){return o&&Ti(a,un(a),o)}function Ji(o,a,u){a=="__proto__"&&oh?oh(o,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):o[a]=u}function rp(o,a){for(var u=-1,w=a.length,S=se(w),B=o==null;++u<w;)S[u]=B?r:Lp(o,a[u]);return S}function Mo(o,a,u){return o===o&&(u!==r&&(o=o<=u?o:u),a!==r&&(o=o>=a?o:a)),o}function Wn(o,a,u,w,S,B){var G,Q=a&_,re=a&E,le=a&A;if(u&&(G=S?u(o,w,S,B):u(o)),G!==r)return G;if(!sr(o))return o;var he=at(o);if(he){if(G=hR(o),!Q)return cn(o,G)}else{var ge=Ur(o),ye=ge==ie||ge==fe;if(Bs(o))return J2(o,Q);if(ge==Ie||ge==x||ye&&!S){if(G=re||ye?{}:gb(o),!Q)return re?eR(o,AN(G,o)):XN(o,I2(G,o))}else{if(!Kt[ge])return S?o:{};G=fR(o,ge,Q)}}B||(B=new si);var Le=B.get(o);if(Le)return Le;B.set(o,G),Hb(o)?o.forEach(function(We){G.add(Wn(We,a,u,We,o,B))}):qb(o)&&o.forEach(function(We,wt){G.set(wt,Wn(We,a,u,wt,o,B))});var Ke=le?re?Ep:_p:re?un:Ir,pt=he?r:Ke(o);return zn(pt||o,function(We,wt){pt&&(wt=We,We=o[wt]),Zc(G,wt,Wn(We,a,u,wt,o,B))}),G}function xN(o){var a=Ir(o);return function(u){return D2(u,o,a)}}function D2(o,a,u){var w=u.length;if(o==null)return!w;for(o=Yt(o);w--;){var S=u[w],B=a[S],G=o[S];if(G===r&&!(S in o)||!B(G))return!1}return!0}function C2(o,a,u){if(typeof o!="function")throw new Hn(c);return sl(function(){o.apply(r,u)},a)}function Xc(o,a,u,w){var S=-1,B=Yu,G=!0,Q=o.length,re=[],le=a.length;if(!Q)return re;u&&(a=tr(a,En(u))),w?(B=qd,G=!1):a.length>=i&&(B=Wc,G=!1,a=new Po(a));e:for(;++S<Q;){var he=o[S],ge=u==null?he:u(he);if(he=w||he!==0?he:0,G&&ge===ge){for(var ye=le;ye--;)if(a[ye]===ge)continue e;re.push(he)}else B(a,ge,w)||re.push(he)}return re}var $s=tb(Mi),O2=tb(ip,!0);function SN(o,a){var u=!0;return $s(o,function(w,S,B){return u=!!a(w,S,B),u}),u}function dh(o,a,u){for(var w=-1,S=o.length;++w<S;){var B=o[w],G=a(B);if(G!=null&&(Q===r?G===G&&!xn(G):u(G,Q)))var Q=G,re=B}return re}function IN(o,a,u,w){var S=o.length;for(u=ft(u),u<0&&(u=-u>S?0:S+u),w=w===r||w>S?S:ft(w),w<0&&(w+=S),w=u>w?0:Wb(w);u<w;)o[u++]=a;return o}function P2(o,a){var u=[];return $s(o,function(w,S,B){a(w,S,B)&&u.push(w)}),u}function Tr(o,a,u,w,S){var B=-1,G=o.length;for(u||(u=pR),S||(S=[]);++B<G;){var Q=o[B];a>0&&u(Q)?a>1?Tr(Q,a-1,u,w,S):Ps(S,Q):w||(S[S.length]=Q)}return S}var np=rb(),M2=rb(!0);function Mi(o,a){return o&&np(o,a,Ir)}function ip(o,a){return o&&M2(o,a,Ir)}function ph(o,a){return Os(a,function(u){return es(o[u])})}function To(o,a){a=Rs(a,o);for(var u=0,w=a.length;o!=null&&u<w;)o=o[$i(a[u++])];return u&&u==w?o:r}function T2(o,a,u){var w=a(o);return at(o)?w:Ps(w,u(o))}function Jr(o){return o==null?o===r?Ge:Me:Co&&Co in Yt(o)?cR(o):_R(o)}function sp(o,a){return o>a}function DN(o,a){return o!=null&&qt.call(o,a)}function CN(o,a){return o!=null&&a in Yt(o)}function ON(o,a,u){return o>=Br(a,u)&&o<wr(a,u)}function op(o,a,u){for(var w=u?qd:Yu,S=o[0].length,B=o.length,G=B,Q=se(B),re=1/0,le=[];G--;){var he=o[G];G&&a&&(he=tr(he,En(a))),re=Br(he.length,re),Q[G]=!u&&(a||S>=120&&he.length>=120)?new Po(G&&he):r}he=o[0];var ge=-1,ye=Q[0];e:for(;++ge<S&&le.length<re;){var Le=he[ge],Ke=a?a(Le):Le;if(Le=u||Le!==0?Le:0,!(ye?Wc(ye,Ke):w(le,Ke,u))){for(G=B;--G;){var pt=Q[G];if(!(pt?Wc(pt,Ke):w(o[G],Ke,u)))continue e}ye&&ye.push(Ke),le.push(Le)}}return le}function PN(o,a,u,w){return Mi(o,function(S,B,G){a(w,u(S),B,G)}),w}function el(o,a,u){a=Rs(a,o),o=wb(o,a);var w=o==null?o:o[$i(Gn(a))];return w==null?r:Sr(w,o,u)}function $2(o){return cr(o)&&Jr(o)==x}function MN(o){return cr(o)&&Jr(o)==Be}function TN(o){return cr(o)&&Jr(o)==V}function tl(o,a,u,w,S){return o===a?!0:o==null||a==null||!cr(o)&&!cr(a)?o!==o&&a!==a:$N(o,a,u,w,tl,S)}function $N(o,a,u,w,S,B){var G=at(o),Q=at(a),re=G?ne:Ur(o),le=Q?ne:Ur(a);re=re==x?Ie:re,le=le==x?Ie:le;var he=re==Ie,ge=le==Ie,ye=re==le;if(ye&&Bs(o)){if(!Bs(a))return!1;G=!0,he=!1}if(ye&&!he)return B||(B=new si),G||Fa(o)?fb(o,a,u,w,S,B):oR(o,a,re,u,w,S,B);if(!(u&I)){var Le=he&&qt.call(o,"__wrapped__"),Ke=ge&&qt.call(a,"__wrapped__");if(Le||Ke){var pt=Le?o.value():o,We=Ke?a.value():a;return B||(B=new si),S(pt,We,u,w,B)}}return ye?(B||(B=new si),aR(o,a,u,w,S,B)):!1}function NN(o){return cr(o)&&Ur(o)==ue}function ap(o,a,u,w){var S=u.length,B=S,G=!w;if(o==null)return!B;for(o=Yt(o);S--;){var Q=u[S];if(G&&Q[2]?Q[1]!==o[Q[0]]:!(Q[0]in o))return!1}for(;++S<B;){Q=u[S];var re=Q[0],le=o[re],he=Q[1];if(G&&Q[2]){if(le===r&&!(re in o))return!1}else{var ge=new si;if(w)var ye=w(le,he,re,o,a,ge);if(!(ye===r?tl(he,le,I|R,w,ge):ye))return!1}}return!0}function N2(o){if(!sr(o)||mR(o))return!1;var a=es(o)?N$:Fn;return a.test(No(o))}function RN(o){return cr(o)&&Jr(o)==Ce}function LN(o){return cr(o)&&Ur(o)==Fe}function BN(o){return cr(o)&&Mh(o.length)&&!!Wt[Jr(o)]}function R2(o){return typeof o=="function"?o:o==null?hn:typeof o=="object"?at(o)?U2(o[0],o[1]):B2(o):n3(o)}function cp(o){if(!il(o))return j$(o);var a=[];for(var u in Yt(o))qt.call(o,u)&&u!="constructor"&&a.push(u);return a}function UN(o){if(!sr(o))return bR(o);var a=il(o),u=[];for(var w in o)w=="constructor"&&(a||!qt.call(o,w))||u.push(w);return u}function lp(o,a){return o<a}function L2(o,a){var u=-1,w=ln(o)?se(o.length):[];return $s(o,function(S,B,G){w[++u]=a(S,B,G)}),w}function B2(o){var a=xp(o);return a.length==1&&a[0][2]?vb(a[0][0],a[0][1]):function(u){return u===o||ap(u,o,a)}}function U2(o,a){return Ip(o)&&mb(a)?vb($i(o),a):function(u){var w=Lp(u,o);return w===r&&w===a?Bp(u,o):tl(a,w,I|R)}}function gh(o,a,u,w,S){o!==a&&np(a,function(B,G){if(S||(S=new si),sr(B))FN(o,a,G,u,gh,w,S);else{var Q=w?w(Cp(o,G),B,G+"",o,a,S):r;Q===r&&(Q=B),tp(o,G,Q)}},un)}function FN(o,a,u,w,S,B,G){var Q=Cp(o,u),re=Cp(a,u),le=G.get(re);if(le){tp(o,u,le);return}var he=B?B(Q,re,u+"",o,a,G):r,ge=he===r;if(ge){var ye=at(re),Le=!ye&&Bs(re),Ke=!ye&&!Le&&Fa(re);he=re,ye||Le||Ke?at(Q)?he=Q:dr(Q)?he=cn(Q):Le?(ge=!1,he=J2(re,!0)):Ke?(ge=!1,he=Q2(re,!0)):he=[]:ol(re)||Ro(re)?(he=Q,Ro(Q)?he=Vb(Q):(!sr(Q)||es(Q))&&(he=gb(re))):ge=!1}ge&&(G.set(re,he),S(he,re,w,B,G),G.delete(re)),tp(o,u,he)}function F2(o,a){var u=o.length;if(u)return a+=a<0?u:0,Xi(a,u)?o[a]:r}function j2(o,a,u){a.length?a=tr(a,function(B){return at(B)?function(G){return To(G,B.length===1?B[0]:B)}:B}):a=[hn];var w=-1;a=tr(a,En(qe()));var S=L2(o,function(B,G,Q){var re=tr(a,function(le){return le(B)});return{criteria:re,index:++w,value:B}});return f$(S,function(B,G){return ZN(B,G,u)})}function jN(o,a){return k2(o,a,function(u,w){return Bp(o,w)})}function k2(o,a,u){for(var w=-1,S=a.length,B={};++w<S;){var G=a[w],Q=To(o,G);u(Q,G)&&rl(B,Rs(G,o),Q)}return B}function kN(o){return function(a){return To(a,o)}}function up(o,a,u,w){var S=w?h$:Ca,B=-1,G=a.length,Q=o;for(o===a&&(a=cn(a)),u&&(Q=tr(o,En(u)));++B<G;)for(var re=0,le=a[B],he=u?u(le):le;(re=S(Q,he,re,w))>-1;)Q!==o&&sh.call(Q,re,1),sh.call(o,re,1);return o}function q2(o,a){for(var u=o?a.length:0,w=u-1;u--;){var S=a[u];if(u==w||S!==B){var B=S;Xi(S)?sh.call(o,S,1):pp(o,S)}}return o}function hp(o,a){return o+ch(E2()*(a-o+1))}function qN(o,a,u,w){for(var S=-1,B=wr(ah((a-o)/(u||1)),0),G=se(B);B--;)G[w?B:++S]=o,o+=u;return G}function fp(o,a){var u="";if(!o||a<1||a>N)return u;do a%2&&(u+=o),a=ch(a/2),a&&(o+=o);while(a);return u}function gt(o,a){return Op(yb(o,a,hn),o+"")}function zN(o){return S2(ja(o))}function HN(o,a){var u=ja(o);return Sh(u,Mo(a,0,u.length))}function rl(o,a,u,w){if(!sr(o))return o;a=Rs(a,o);for(var S=-1,B=a.length,G=B-1,Q=o;Q!=null&&++S<B;){var re=$i(a[S]),le=u;if(re==="__proto__"||re==="constructor"||re==="prototype")return o;if(S!=G){var he=Q[re];le=w?w(he,re,Q):r,le===r&&(le=sr(he)?he:Xi(a[S+1])?[]:{})}Zc(Q,re,le),Q=Q[re]}return o}var z2=lh?function(o,a){return lh.set(o,a),o}:hn,KN=oh?function(o,a){return oh(o,"toString",{configurable:!0,enumerable:!1,value:Fp(a),writable:!0})}:hn;function WN(o){return Sh(ja(o))}function Vn(o,a,u){var w=-1,S=o.length;a<0&&(a=-a>S?0:S+a),u=u>S?S:u,u<0&&(u+=S),S=a>u?0:u-a>>>0,a>>>=0;for(var B=se(S);++w<S;)B[w]=o[w+a];return B}function VN(o,a){var u;return $s(o,function(w,S,B){return u=a(w,S,B),!u}),!!u}function mh(o,a,u){var w=0,S=o==null?w:o.length;if(typeof a=="number"&&a===a&&S<=oe){for(;w<S;){var B=w+S>>>1,G=o[B];G!==null&&!xn(G)&&(u?G<=a:G<a)?w=B+1:S=B}return S}return dp(o,a,hn,u)}function dp(o,a,u,w){var S=0,B=o==null?0:o.length;if(B===0)return 0;a=u(a);for(var G=a!==a,Q=a===null,re=xn(a),le=a===r;S<B;){var he=ch((S+B)/2),ge=u(o[he]),ye=ge!==r,Le=ge===null,Ke=ge===ge,pt=xn(ge);if(G)var We=w||Ke;else le?We=Ke&&(w||ye):Q?We=Ke&&ye&&(w||!Le):re?We=Ke&&ye&&!Le&&(w||!pt):Le||pt?We=!1:We=w?ge<=a:ge<a;We?S=he+1:B=he}return Br(B,L)}function H2(o,a){for(var u=-1,w=o.length,S=0,B=[];++u<w;){var G=o[u],Q=a?a(G):G;if(!u||!oi(Q,re)){var re=Q;B[S++]=G===0?0:G}}return B}function K2(o){return typeof o=="number"?o:xn(o)?O:+o}function An(o){if(typeof o=="string")return o;if(at(o))return tr(o,An)+"";if(xn(o))return A2?A2.call(o):"";var a=o+"";return a=="0"&&1/o==-M?"-0":a}function Ns(o,a,u){var w=-1,S=Yu,B=o.length,G=!0,Q=[],re=Q;if(u)G=!1,S=qd;else if(B>=i){var le=a?null:iR(o);if(le)return Qu(le);G=!1,S=Wc,re=new Po}else re=a?[]:Q;e:for(;++w<B;){var he=o[w],ge=a?a(he):he;if(he=u||he!==0?he:0,G&&ge===ge){for(var ye=re.length;ye--;)if(re[ye]===ge)continue e;a&&re.push(ge),Q.push(he)}else S(re,ge,u)||(re!==Q&&re.push(ge),Q.push(he))}return Q}function pp(o,a){return a=Rs(a,o),o=wb(o,a),o==null||delete o[$i(Gn(a))]}function W2(o,a,u,w){return rl(o,a,u(To(o,a)),w)}function vh(o,a,u,w){for(var S=o.length,B=w?S:-1;(w?B--:++B<S)&&a(o[B],B,o););return u?Vn(o,w?0:B,w?B+1:S):Vn(o,w?B+1:0,w?S:B)}function V2(o,a){var u=o;return u instanceof At&&(u=u.value()),zd(a,function(w,S){return S.func.apply(S.thisArg,Ps([w],S.args))},u)}function gp(o,a,u){var w=o.length;if(w<2)return w?Ns(o[0]):[];for(var S=-1,B=se(w);++S<w;)for(var G=o[S],Q=-1;++Q<w;)Q!=S&&(B[S]=Xc(B[S]||G,o[Q],a,u));return Ns(Tr(B,1),a,u)}function G2(o,a,u){for(var w=-1,S=o.length,B=a.length,G={};++w<S;){var Q=w<B?a[w]:r;u(G,o[w],Q)}return G}function mp(o){return dr(o)?o:[]}function vp(o){return typeof o=="function"?o:hn}function Rs(o,a){return at(o)?o:Ip(o,a)?[o]:Ab(Bt(o))}var GN=gt;function Ls(o,a,u){var w=o.length;return u=u===r?w:u,!a&&u>=w?o:Vn(o,a,u)}var Y2=R$||function(o){return It.clearTimeout(o)};function J2(o,a){if(a)return o.slice();var u=o.length,w=v2?v2(u):new o.constructor(u);return o.copy(w),w}function yp(o){var a=new o.constructor(o.byteLength);return new nh(a).set(new nh(o)),a}function YN(o,a){var u=a?yp(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.byteLength)}function JN(o){var a=new o.constructor(o.source,vt.exec(o));return a.lastIndex=o.lastIndex,a}function QN(o){return Qc?Yt(Qc.call(o)):{}}function Q2(o,a){var u=a?yp(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.length)}function Z2(o,a){if(o!==a){var u=o!==r,w=o===null,S=o===o,B=xn(o),G=a!==r,Q=a===null,re=a===a,le=xn(a);if(!Q&&!le&&!B&&o>a||B&&G&&re&&!Q&&!le||w&&G&&re||!u&&re||!S)return 1;if(!w&&!B&&!le&&o<a||le&&u&&S&&!w&&!B||Q&&u&&S||!G&&S||!re)return-1}return 0}function ZN(o,a,u){for(var w=-1,S=o.criteria,B=a.criteria,G=S.length,Q=u.length;++w<G;){var re=Z2(S[w],B[w]);if(re){if(w>=Q)return re;var le=u[w];return re*(le=="desc"?-1:1)}}return o.index-a.index}function X2(o,a,u,w){for(var S=-1,B=o.length,G=u.length,Q=-1,re=a.length,le=wr(B-G,0),he=se(re+le),ge=!w;++Q<re;)he[Q]=a[Q];for(;++S<G;)(ge||S<B)&&(he[u[S]]=o[S]);for(;le--;)he[Q++]=o[S++];return he}function eb(o,a,u,w){for(var S=-1,B=o.length,G=-1,Q=u.length,re=-1,le=a.length,he=wr(B-Q,0),ge=se(he+le),ye=!w;++S<he;)ge[S]=o[S];for(var Le=S;++re<le;)ge[Le+re]=a[re];for(;++G<Q;)(ye||S<B)&&(ge[Le+u[G]]=o[S++]);return ge}function cn(o,a){var u=-1,w=o.length;for(a||(a=se(w));++u<w;)a[u]=o[u];return a}function Ti(o,a,u,w){var S=!u;u||(u={});for(var B=-1,G=a.length;++B<G;){var Q=a[B],re=w?w(u[Q],o[Q],Q,u,o):r;re===r&&(re=o[Q]),S?Ji(u,Q,re):Zc(u,Q,re)}return u}function XN(o,a){return Ti(o,Sp(o),a)}function eR(o,a){return Ti(o,db(o),a)}function yh(o,a){return function(u,w){var S=at(u)?s$:EN,B=a?a():{};return S(u,o,qe(w,2),B)}}function La(o){return gt(function(a,u){var w=-1,S=u.length,B=S>1?u[S-1]:r,G=S>2?u[2]:r;for(B=o.length>3&&typeof B=="function"?(S--,B):r,G&&Qr(u[0],u[1],G)&&(B=S<3?r:B,S=1),a=Yt(a);++w<S;){var Q=u[w];Q&&o(a,Q,w,B)}return a})}function tb(o,a){return function(u,w){if(u==null)return u;if(!ln(u))return o(u,w);for(var S=u.length,B=a?S:-1,G=Yt(u);(a?B--:++B<S)&&w(G[B],B,G)!==!1;);return u}}function rb(o){return function(a,u,w){for(var S=-1,B=Yt(a),G=w(a),Q=G.length;Q--;){var re=G[o?Q:++S];if(u(B[re],re,B)===!1)break}return a}}function tR(o,a,u){var w=a&W,S=nl(o);function B(){var G=this&&this!==It&&this instanceof B?S:o;return G.apply(w?u:this,arguments)}return B}function nb(o){return function(a){a=Bt(a);var u=Oa(a)?ii(a):r,w=u?u[0]:a.charAt(0),S=u?Ls(u,1).join(""):a.slice(1);return w[o]()+S}}function Ba(o){return function(a){return zd(t3(e3(a).replace(Hc,"")),o,"")}}function nl(o){return function(){var a=arguments;switch(a.length){case 0:return new o;case 1:return new o(a[0]);case 2:return new o(a[0],a[1]);case 3:return new o(a[0],a[1],a[2]);case 4:return new o(a[0],a[1],a[2],a[3]);case 5:return new o(a[0],a[1],a[2],a[3],a[4]);case 6:return new o(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new o(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var u=Ra(o.prototype),w=o.apply(u,a);return sr(w)?w:u}}function rR(o,a,u){var w=nl(o);function S(){for(var B=arguments.length,G=se(B),Q=B,re=Ua(S);Q--;)G[Q]=arguments[Q];var le=B<3&&G[0]!==re&&G[B-1]!==re?[]:Ms(G,re);if(B-=le.length,B<u)return cb(o,a,wh,S.placeholder,r,G,le,r,r,u-B);var he=this&&this!==It&&this instanceof S?w:o;return Sr(he,this,G)}return S}function ib(o){return function(a,u,w){var S=Yt(a);if(!ln(a)){var B=qe(u,3);a=Ir(a),u=function(Q){return B(S[Q],Q,S)}}var G=o(a,u,w);return G>-1?S[B?a[G]:G]:r}}function sb(o){return Zi(function(a){var u=a.length,w=u,S=Kn.prototype.thru;for(o&&a.reverse();w--;){var B=a[w];if(typeof B!="function")throw new Hn(c);if(S&&!G&&Ah(B)=="wrapper")var G=new Kn([],!0)}for(w=G?w:u;++w<u;){B=a[w];var Q=Ah(B),re=Q=="wrapper"?Ap(B):r;re&&Dp(re[0])&&re[1]==(g|z|j|C)&&!re[4].length&&re[9]==1?G=G[Ah(re[0])].apply(G,re[3]):G=B.length==1&&Dp(B)?G[Q]():G.thru(B)}return function(){var le=arguments,he=le[0];if(G&&le.length==1&&at(he))return G.plant(he).value();for(var ge=0,ye=u?a[ge].apply(this,le):he;++ge<u;)ye=a[ge].call(this,ye);return ye}})}function wh(o,a,u,w,S,B,G,Q,re,le){var he=a&g,ge=a&W,ye=a&Y,Le=a&(z|$),Ke=a&Z,pt=ye?r:nl(o);function We(){for(var wt=arguments.length,Dt=se(wt),Sn=wt;Sn--;)Dt[Sn]=arguments[Sn];if(Le)var Zr=Ua(We),In=p$(Dt,Zr);if(w&&(Dt=X2(Dt,w,S,Le)),B&&(Dt=eb(Dt,B,G,Le)),wt-=In,Le&&wt<le){var pr=Ms(Dt,Zr);return cb(o,a,wh,We.placeholder,u,Dt,pr,Q,re,le-wt)}var ai=ge?u:this,rs=ye?ai[o]:o;return wt=Dt.length,Q?Dt=ER(Dt,Q):Ke&&wt>1&&Dt.reverse(),he&&re<wt&&(Dt.length=re),this&&this!==It&&this instanceof We&&(rs=pt||nl(rs)),rs.apply(ai,Dt)}return We}function ob(o,a){return function(u,w){return PN(u,o,a(w),{})}}function bh(o,a){return function(u,w){var S;if(u===r&&w===r)return a;if(u!==r&&(S=u),w!==r){if(S===r)return w;typeof u=="string"||typeof w=="string"?(u=An(u),w=An(w)):(u=K2(u),w=K2(w)),S=o(u,w)}return S}}function wp(o){return Zi(function(a){return a=tr(a,En(qe())),gt(function(u){var w=this;return o(a,function(S){return Sr(S,w,u)})})})}function _h(o,a){a=a===r?" ":An(a);var u=a.length;if(u<2)return u?fp(a,o):a;var w=fp(a,ah(o/Pa(a)));return Oa(a)?Ls(ii(w),0,o).join(""):w.slice(0,o)}function nR(o,a,u,w){var S=a&W,B=nl(o);function G(){for(var Q=-1,re=arguments.length,le=-1,he=w.length,ge=se(he+re),ye=this&&this!==It&&this instanceof G?B:o;++le<he;)ge[le]=w[le];for(;re--;)ge[le++]=arguments[++Q];return Sr(ye,S?u:this,ge)}return G}function ab(o){return function(a,u,w){return w&&typeof w!="number"&&Qr(a,u,w)&&(u=w=r),a=ts(a),u===r?(u=a,a=0):u=ts(u),w=w===r?a<u?1:-1:ts(w),qN(a,u,w,o)}}function Eh(o){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=Yn(a),u=Yn(u)),o(a,u)}}function cb(o,a,u,w,S,B,G,Q,re,le){var he=a&z,ge=he?G:r,ye=he?r:G,Le=he?B:r,Ke=he?r:B;a|=he?j:P,a&=~(he?P:j),a&F||(a&=~(W|Y));var pt=[o,a,S,Le,ge,Ke,ye,Q,re,le],We=u.apply(r,pt);return Dp(o)&&bb(We,pt),We.placeholder=w,_b(We,o,a)}function bp(o){var a=yr[o];return function(u,w){if(u=Yn(u),w=w==null?0:Br(ft(w),292),w&&_2(u)){var S=(Bt(u)+"e").split("e"),B=a(S[0]+"e"+(+S[1]+w));return S=(Bt(B)+"e").split("e"),+(S[0]+"e"+(+S[1]-w))}return a(u)}}var iR=$a&&1/Qu(new $a([,-0]))[1]==M?function(o){return new $a(o)}:qp;function lb(o){return function(a){var u=Ur(a);return u==ue?Jd(a):u==Fe?_$(a):d$(a,o(a))}}function Qi(o,a,u,w,S,B,G,Q){var re=a&Y;if(!re&&typeof o!="function")throw new Hn(c);var le=w?w.length:0;if(le||(a&=~(j|P),w=S=r),G=G===r?G:wr(ft(G),0),Q=Q===r?Q:ft(Q),le-=S?S.length:0,a&P){var he=w,ge=S;w=S=r}var ye=re?r:Ap(o),Le=[o,a,u,w,S,he,ge,B,G,Q];if(ye&&wR(Le,ye),o=Le[0],a=Le[1],u=Le[2],w=Le[3],S=Le[4],Q=Le[9]=Le[9]===r?re?0:o.length:wr(Le[9]-le,0),!Q&&a&(z|$)&&(a&=~(z|$)),!a||a==W)var Ke=tR(o,a,u);else a==z||a==$?Ke=rR(o,a,Q):(a==j||a==(W|j))&&!S.length?Ke=nR(o,a,u,w):Ke=wh.apply(r,Le);var pt=ye?z2:bb;return _b(pt(Ke,Le),o,a)}function ub(o,a,u,w){return o===r||oi(o,Ta[u])&&!qt.call(w,u)?a:o}function hb(o,a,u,w,S,B){return sr(o)&&sr(a)&&(B.set(a,o),gh(o,a,r,hb,B),B.delete(a)),o}function sR(o){return ol(o)?r:o}function fb(o,a,u,w,S,B){var G=u&I,Q=o.length,re=a.length;if(Q!=re&&!(G&&re>Q))return!1;var le=B.get(o),he=B.get(a);if(le&&he)return le==a&&he==o;var ge=-1,ye=!0,Le=u&R?new Po:r;for(B.set(o,a),B.set(a,o);++ge<Q;){var Ke=o[ge],pt=a[ge];if(w)var We=G?w(pt,Ke,ge,a,o,B):w(Ke,pt,ge,o,a,B);if(We!==r){if(We)continue;ye=!1;break}if(Le){if(!Hd(a,function(wt,Dt){if(!Wc(Le,Dt)&&(Ke===wt||S(Ke,wt,u,w,B)))return Le.push(Dt)})){ye=!1;break}}else if(!(Ke===pt||S(Ke,pt,u,w,B))){ye=!1;break}}return B.delete(o),B.delete(a),ye}function oR(o,a,u,w,S,B,G){switch(u){case be:if(o.byteLength!=a.byteLength||o.byteOffset!=a.byteOffset)return!1;o=o.buffer,a=a.buffer;case Be:return!(o.byteLength!=a.byteLength||!B(new nh(o),new nh(a)));case H:case V:case Oe:return oi(+o,+a);case k:return o.name==a.name&&o.message==a.message;case Ce:case Ee:return o==a+"";case ue:var Q=Jd;case Fe:var re=w&I;if(Q||(Q=Qu),o.size!=a.size&&!re)return!1;var le=G.get(o);if(le)return le==a;w|=R,G.set(o,a);var he=fb(Q(o),Q(a),w,S,B,G);return G.delete(o),he;case Ae:if(Qc)return Qc.call(o)==Qc.call(a)}return!1}function aR(o,a,u,w,S,B){var G=u&I,Q=_p(o),re=Q.length,le=_p(a),he=le.length;if(re!=he&&!G)return!1;for(var ge=re;ge--;){var ye=Q[ge];if(!(G?ye in a:qt.call(a,ye)))return!1}var Le=B.get(o),Ke=B.get(a);if(Le&&Ke)return Le==a&&Ke==o;var pt=!0;B.set(o,a),B.set(a,o);for(var We=G;++ge<re;){ye=Q[ge];var wt=o[ye],Dt=a[ye];if(w)var Sn=G?w(Dt,wt,ye,a,o,B):w(wt,Dt,ye,o,a,B);if(!(Sn===r?wt===Dt||S(wt,Dt,u,w,B):Sn)){pt=!1;break}We||(We=ye=="constructor")}if(pt&&!We){var Zr=o.constructor,In=a.constructor;Zr!=In&&"constructor"in o&&"constructor"in a&&!(typeof Zr=="function"&&Zr instanceof Zr&&typeof In=="function"&&In instanceof In)&&(pt=!1)}return B.delete(o),B.delete(a),pt}function Zi(o){return Op(yb(o,r,Db),o+"")}function _p(o){return T2(o,Ir,Sp)}function Ep(o){return T2(o,un,db)}var Ap=lh?function(o){return lh.get(o)}:qp;function Ah(o){for(var a=o.name+"",u=Na[a],w=qt.call(Na,a)?u.length:0;w--;){var S=u[w],B=S.func;if(B==null||B==o)return S.name}return a}function Ua(o){var a=qt.call(T,"placeholder")?T:o;return a.placeholder}function qe(){var o=T.iteratee||jp;return o=o===jp?R2:o,arguments.length?o(arguments[0],arguments[1]):o}function xh(o,a){var u=o.__data__;return gR(a)?u[typeof a=="string"?"string":"hash"]:u.map}function xp(o){for(var a=Ir(o),u=a.length;u--;){var w=a[u],S=o[w];a[u]=[w,S,mb(S)]}return a}function $o(o,a){var u=y$(o,a);return N2(u)?u:r}function cR(o){var a=qt.call(o,Co),u=o[Co];try{o[Co]=r;var w=!0}catch{}var S=th.call(o);return w&&(a?o[Co]=u:delete o[Co]),S}var Sp=Zd?function(o){return o==null?[]:(o=Yt(o),Os(Zd(o),function(a){return w2.call(o,a)}))}:zp,db=Zd?function(o){for(var a=[];o;)Ps(a,Sp(o)),o=ih(o);return a}:zp,Ur=Jr;(Xd&&Ur(new Xd(new ArrayBuffer(1)))!=be||Gc&&Ur(new Gc)!=ue||ep&&Ur(ep.resolve())!=Pt||$a&&Ur(new $a)!=Fe||Yc&&Ur(new Yc)!=we)&&(Ur=function(o){var a=Jr(o),u=a==Ie?o.constructor:r,w=u?No(u):"";if(w)switch(w){case H$:return be;case K$:return ue;case W$:return Pt;case V$:return Fe;case G$:return we}return a});function lR(o,a,u){for(var w=-1,S=u.length;++w<S;){var B=u[w],G=B.size;switch(B.type){case"drop":o+=G;break;case"dropRight":a-=G;break;case"take":a=Br(a,o+G);break;case"takeRight":o=wr(o,a-G);break}}return{start:o,end:a}}function uR(o){var a=o.match(ke);return a?a[1].split(Ht):[]}function pb(o,a,u){a=Rs(a,o);for(var w=-1,S=a.length,B=!1;++w<S;){var G=$i(a[w]);if(!(B=o!=null&&u(o,G)))break;o=o[G]}return B||++w!=S?B:(S=o==null?0:o.length,!!S&&Mh(S)&&Xi(G,S)&&(at(o)||Ro(o)))}function hR(o){var a=o.length,u=new o.constructor(a);return a&&typeof o[0]=="string"&&qt.call(o,"index")&&(u.index=o.index,u.input=o.input),u}function gb(o){return typeof o.constructor=="function"&&!il(o)?Ra(ih(o)):{}}function fR(o,a,u){var w=o.constructor;switch(a){case Be:return yp(o);case H:case V:return new w(+o);case be:return YN(o,u);case Pe:case je:case Te:case $e:case lt:case Re:case Ne:case nr:case dt:return Q2(o,u);case ue:return new w;case Oe:case Ee:return new w(o);case Ce:return JN(o);case Fe:return new w;case Ae:return QN(o)}}function dR(o,a){var u=a.length;if(!u)return o;var w=u-1;return a[w]=(u>1?"& ":"")+a[w],a=a.join(u>2?", ":" "),o.replace(Ze,`{
63
+ */(function(t,e){(function(){var r,n="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,g="__lodash_placeholder__",_=1,E=2,A=4,S=1,U=2,W=1,Y=2,B=4,z=8,P=16,F=32,j=64,m=128,T=256,te=512,ee=30,ne="...",fe=800,d=16,p=1,b=2,D=3,O=1/0,$=9007199254740991,L=17976931348623157e292,C=0/0,v=4294967295,N=v-1,oe=v>>>1,pe=[["ary",m],["bind",W],["bindKey",Y],["curry",z],["curryRight",P],["flip",te],["partial",F],["partialRight",j],["rearg",T]],x="[object Arguments]",re="[object Array]",q="[object AsyncFunction]",H="[object Boolean]",V="[object Date]",w="[object DOMException]",k="[object Error]",ie="[object Function]",he="[object GeneratorFunction]",le="[object Map]",Oe="[object Number]",Me="[object Null]",Se="[object Object]",Pt="[object Promise]",ze="[object Proxy]",Ce="[object RegExp]",Fe="[object Set]",Ee="[object String]",Ae="[object Symbol]",Ge="[object Undefined]",ye="[object WeakMap]",xe="[object WeakSet]",Be="[object ArrayBuffer]",be="[object DataView]",Pe="[object Float32Array]",je="[object Float64Array]",Te="[object Int8Array]",$e="[object Int16Array]",lt="[object Int32Array]",Re="[object Uint8Array]",Ne="[object Uint8ClampedArray]",nr="[object Uint16Array]",dt="[object Uint32Array]",Et=/\b__p \+= '';/g,ir=/\b(__p \+=) '' \+/g,It=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Vr=/[&<>"']/g,Ye=RegExp(Ot.source),He=RegExp(Vr.source),Rt=/<%-([\s\S]+?)%>/g,Je=/<%([\s\S]+?)%>/g,Ve=/<%=([\s\S]+?)%>/g,Mt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xe=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lt=/[\\^$.*+?()[\]{}|]/g,tt=RegExp(Lt.source),Qe=/^\s+/,Ft=/\s/,Ze=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ke=/\{\n\/\* \[wrapped with (.+)\] \*/,Ht=/,? & /,rt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jt=/[()=,{}\[\]\/\s]/,ti=/\\(\\)?/g,kt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,Ln=/^[-+]0x[0-9a-f]+$/i,Bn=/^0b[01]+$/i,Un=/^\[object .+?Constructor\]$/,Fn=/^0o[0-7]+$/i,jn=/^(?:0|[1-9]\d*)$/,xr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Di=/($^)/,fo=/['\n\r\u2028\u2029\\]/g,Ci="\\ud800-\\udfff",po="\\u0300-\\u036f",go="\\ufe20-\\ufe2f",Oi="\\u20d0-\\u20ff",Ss=po+go+Oi,Ds="\\u2700-\\u27bf",Gr="a-z\\xdf-\\xf6\\xf8-\\xff",mo="\\xac\\xb1\\xd7\\xf7",vo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",wo="\\u2000-\\u206f",yo=" \\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",Ru="A-Z\\xc0-\\xd6\\xd8-\\xde",Lu="\\ufe0e\\ufe0f",bo=mo+vo+wo+yo,qc="['\u2019]",_o="["+Ci+"]",zc="["+bo+"]",Eo="["+Ss+"]",Bu="\\d+",Ld="["+Ds+"]",Uu="["+Gr+"]",Fu="[^"+Ci+bo+Bu+Ds+Gr+Ru+"]",xa="\\ud83c[\\udffb-\\udfff]",Bd="(?:"+Eo+"|"+xa+")",ju="[^"+Ci+"]",Ia="(?:\\ud83c[\\udde6-\\uddff]){2}",Cs="[\\ud800-\\udbff][\\udc00-\\udfff]",_n="["+Ru+"]",ku="\\u200d",qu="(?:"+Uu+"|"+Fu+")",Pi="(?:"+_n+"|"+Fu+")",zu="(?:"+qc+"(?:d|ll|m|re|s|t|ve))?",Hu="(?:"+qc+"(?:D|LL|M|RE|S|T|VE))?",Ku=Bd+"?",Wu="["+Lu+"]?",Ud="(?:"+ku+"(?:"+[ju,Ia,Cs].join("|")+")"+Wu+Ku+")*",Gi="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Gu=Wu+Ku+Ud,Sa="(?:"+[Ld,Ia,Cs].join("|")+")"+Gu,Fd="(?:"+[ju+Eo+"?",Eo,Ia,Cs,_o].join("|")+")",Hc=RegExp(qc,"g"),jd=RegExp(Eo,"g"),Da=RegExp(xa+"(?="+xa+")|"+Fd+Gu,"g"),Yu=RegExp([_n+"?"+Uu+"+"+zu+"(?="+[zc,_n,"$"].join("|")+")",Pi+"+"+Hu+"(?="+[zc,_n+qu,"$"].join("|")+")",_n+"?"+qu+"+"+zu,_n+"+"+Hu,Vu,Gi,Bu,Sa].join("|"),"g"),Ju=RegExp("["+ku+Ci+Ss+Lu+"]"),Ao=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qu=["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"],kd=-1,Wt={};Wt[Pe]=Wt[je]=Wt[Te]=Wt[$e]=Wt[lt]=Wt[Re]=Wt[Ne]=Wt[nr]=Wt[dt]=!0,Wt[x]=Wt[re]=Wt[Be]=Wt[H]=Wt[be]=Wt[V]=Wt[k]=Wt[ie]=Wt[le]=Wt[Oe]=Wt[Se]=Wt[Ce]=Wt[Fe]=Wt[Ee]=Wt[ye]=!1;var Kt={};Kt[x]=Kt[re]=Kt[Be]=Kt[be]=Kt[H]=Kt[V]=Kt[Pe]=Kt[je]=Kt[Te]=Kt[$e]=Kt[lt]=Kt[le]=Kt[Oe]=Kt[Se]=Kt[Ce]=Kt[Fe]=Kt[Ee]=Kt[Ae]=Kt[Re]=Kt[Ne]=Kt[nr]=Kt[dt]=!0,Kt[k]=Kt[ie]=Kt[ye]=!1;var K={\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"},Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},de={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Ie={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Vt=parseFloat,ot=parseInt,Zt=typeof Ec=="object"&&Ec&&Ec.Object===Object&&Ec,gr=typeof self=="object"&&self&&self.Object===Object&&self,St=Zt||gr||Function("return this")(),Gt=e&&!e.nodeType&&e,fr=Gt&&!0&&t&&!t.nodeType&&t,ln=fr&&fr.exports===Gt,mr=ln&&Zt.process,Xt=function(){try{var Z=fr&&fr.require&&fr.require("util").types;return Z||mr&&mr.binding&&mr.binding("util")}catch{}}(),Yr=Xt&&Xt.isArrayBuffer,ri=Xt&&Xt.isDate,kn=Xt&&Xt.isMap,Mi=Xt&&Xt.isRegExp,Kc=Xt&&Xt.isSet,xo=Xt&&Xt.isTypedArray;function Ir(Z,ae,se){switch(se.length){case 0:return Z.call(ae);case 1:return Z.call(ae,se[0]);case 2:return Z.call(ae,se[0],se[1]);case 3:return Z.call(ae,se[0],se[1],se[2])}return Z.apply(ae,se)}function HT(Z,ae,se,De){for(var it=-1,$t=Z==null?0:Z.length;++it<$t;){var wr=Z[it];ae(De,wr,se(wr),Z)}return De}function qn(Z,ae){for(var se=-1,De=Z==null?0:Z.length;++se<De&&ae(Z[se],se,Z)!==!1;);return Z}function KT(Z,ae){for(var se=Z==null?0:Z.length;se--&&ae(Z[se],se,Z)!==!1;);return Z}function t2(Z,ae){for(var se=-1,De=Z==null?0:Z.length;++se<De;)if(!ae(Z[se],se,Z))return!1;return!0}function Os(Z,ae){for(var se=-1,De=Z==null?0:Z.length,it=0,$t=[];++se<De;){var wr=Z[se];ae(wr,se,Z)&&($t[it++]=wr)}return $t}function Zu(Z,ae){var se=Z==null?0:Z.length;return!!se&&Ca(Z,ae,0)>-1}function qd(Z,ae,se){for(var De=-1,it=Z==null?0:Z.length;++De<it;)if(se(ae,Z[De]))return!0;return!1}function tr(Z,ae){for(var se=-1,De=Z==null?0:Z.length,it=Array(De);++se<De;)it[se]=ae(Z[se],se,Z);return it}function Ps(Z,ae){for(var se=-1,De=ae.length,it=Z.length;++se<De;)Z[it+se]=ae[se];return Z}function zd(Z,ae,se,De){var it=-1,$t=Z==null?0:Z.length;for(De&&$t&&(se=Z[++it]);++it<$t;)se=ae(se,Z[it],it,Z);return se}function WT(Z,ae,se,De){var it=Z==null?0:Z.length;for(De&&it&&(se=Z[--it]);it--;)se=ae(se,Z[it],it,Z);return se}function Hd(Z,ae){for(var se=-1,De=Z==null?0:Z.length;++se<De;)if(ae(Z[se],se,Z))return!0;return!1}var VT=Kd("length");function GT(Z){return Z.split("")}function YT(Z){return Z.match(rt)||[]}function r2(Z,ae,se){var De;return se(Z,function(it,$t,wr){if(ae(it,$t,wr))return De=$t,!1}),De}function Xu(Z,ae,se,De){for(var it=Z.length,$t=se+(De?1:-1);De?$t--:++$t<it;)if(ae(Z[$t],$t,Z))return $t;return-1}function Ca(Z,ae,se){return ae===ae?a$(Z,ae,se):Xu(Z,n2,se)}function JT(Z,ae,se,De){for(var it=se-1,$t=Z.length;++it<$t;)if(De(Z[it],ae))return it;return-1}function n2(Z){return Z!==Z}function i2(Z,ae){var se=Z==null?0:Z.length;return se?Vd(Z,ae)/se:C}function Kd(Z){return function(ae){return ae==null?r:ae[Z]}}function Wd(Z){return function(ae){return Z==null?r:Z[ae]}}function s2(Z,ae,se,De,it){return it(Z,function($t,wr,Yt){se=De?(De=!1,$t):ae(se,$t,wr,Yt)}),se}function QT(Z,ae){var se=Z.length;for(Z.sort(ae);se--;)Z[se]=Z[se].value;return Z}function Vd(Z,ae){for(var se,De=-1,it=Z.length;++De<it;){var $t=ae(Z[De]);$t!==r&&(se=se===r?$t:se+$t)}return se}function Gd(Z,ae){for(var se=-1,De=Array(Z);++se<Z;)De[se]=ae(se);return De}function ZT(Z,ae){return tr(ae,function(se){return[se,Z[se]]})}function o2(Z){return Z&&Z.slice(0,u2(Z)+1).replace(Qe,"")}function En(Z){return function(ae){return Z(ae)}}function Yd(Z,ae){return tr(ae,function(se){return Z[se]})}function Wc(Z,ae){return Z.has(ae)}function a2(Z,ae){for(var se=-1,De=Z.length;++se<De&&Ca(ae,Z[se],0)>-1;);return se}function c2(Z,ae){for(var se=Z.length;se--&&Ca(ae,Z[se],0)>-1;);return se}function XT(Z,ae){for(var se=Z.length,De=0;se--;)Z[se]===ae&&++De;return De}var e$=Wd(K),t$=Wd(Q);function r$(Z){return"\\"+Ie[Z]}function n$(Z,ae){return Z==null?r:Z[ae]}function Oa(Z){return Ju.test(Z)}function i$(Z){return Ao.test(Z)}function s$(Z){for(var ae,se=[];!(ae=Z.next()).done;)se.push(ae.value);return se}function Jd(Z){var ae=-1,se=Array(Z.size);return Z.forEach(function(De,it){se[++ae]=[it,De]}),se}function l2(Z,ae){return function(se){return Z(ae(se))}}function Ms(Z,ae){for(var se=-1,De=Z.length,it=0,$t=[];++se<De;){var wr=Z[se];(wr===ae||wr===g)&&(Z[se]=g,$t[it++]=se)}return $t}function eh(Z){var ae=-1,se=Array(Z.size);return Z.forEach(function(De){se[++ae]=De}),se}function o$(Z){var ae=-1,se=Array(Z.size);return Z.forEach(function(De){se[++ae]=[De,De]}),se}function a$(Z,ae,se){for(var De=se-1,it=Z.length;++De<it;)if(Z[De]===ae)return De;return-1}function c$(Z,ae,se){for(var De=se+1;De--;)if(Z[De]===ae)return De;return De}function Pa(Z){return Oa(Z)?u$(Z):VT(Z)}function ni(Z){return Oa(Z)?h$(Z):GT(Z)}function u2(Z){for(var ae=Z.length;ae--&&Ft.test(Z.charAt(ae)););return ae}var l$=Wd(de);function u$(Z){for(var ae=Da.lastIndex=0;Da.test(Z);)++ae;return ae}function h$(Z){return Z.match(Da)||[]}function f$(Z){return Z.match(Yu)||[]}var d$=function Z(ae){ae=ae==null?St:Ma.defaults(St.Object(),ae,Ma.pick(St,Qu));var se=ae.Array,De=ae.Date,it=ae.Error,$t=ae.Function,wr=ae.Math,Yt=ae.Object,Qd=ae.RegExp,p$=ae.String,zn=ae.TypeError,th=se.prototype,g$=$t.prototype,Ta=Yt.prototype,rh=ae["__core-js_shared__"],nh=g$.toString,qt=Ta.hasOwnProperty,m$=0,h2=function(){var s=/[^.]+$/.exec(rh&&rh.keys&&rh.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),ih=Ta.toString,v$=nh.call(Yt),w$=St._,y$=Qd("^"+nh.call(qt).replace(Lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sh=ln?ae.Buffer:r,Ts=ae.Symbol,oh=ae.Uint8Array,f2=sh?sh.allocUnsafe:r,ah=l2(Yt.getPrototypeOf,Yt),d2=Yt.create,p2=Ta.propertyIsEnumerable,ch=th.splice,g2=Ts?Ts.isConcatSpreadable:r,Vc=Ts?Ts.iterator:r,Io=Ts?Ts.toStringTag:r,lh=function(){try{var s=Po(Yt,"defineProperty");return s({},"",{}),s}catch{}}(),b$=ae.clearTimeout!==St.clearTimeout&&ae.clearTimeout,_$=De&&De.now!==St.Date.now&&De.now,E$=ae.setTimeout!==St.setTimeout&&ae.setTimeout,uh=wr.ceil,hh=wr.floor,Zd=Yt.getOwnPropertySymbols,A$=sh?sh.isBuffer:r,m2=ae.isFinite,x$=th.join,I$=l2(Yt.keys,Yt),yr=wr.max,Br=wr.min,S$=De.now,D$=ae.parseInt,v2=wr.random,C$=th.reverse,Xd=Po(ae,"DataView"),Gc=Po(ae,"Map"),ep=Po(ae,"Promise"),$a=Po(ae,"Set"),Yc=Po(ae,"WeakMap"),Jc=Po(Yt,"create"),fh=Yc&&new Yc,Na={},O$=Mo(Xd),P$=Mo(Gc),M$=Mo(ep),T$=Mo($a),$$=Mo(Yc),dh=Ts?Ts.prototype:r,Qc=dh?dh.valueOf:r,w2=dh?dh.toString:r;function M(s){if(cr(s)&&!at(s)&&!(s instanceof At)){if(s instanceof Hn)return s;if(qt.call(s,"__wrapped__"))return yb(s)}return new Hn(s)}var Ra=function(){function s(){}return function(a){if(!sr(a))return{};if(d2)return d2(a);s.prototype=a;var u=new s;return s.prototype=r,u}}();function ph(){}function Hn(s,a){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=r}M.templateSettings={escape:Rt,evaluate:Je,interpolate:Ve,variable:"",imports:{_:M}},M.prototype=ph.prototype,M.prototype.constructor=M,Hn.prototype=Ra(ph.prototype),Hn.prototype.constructor=Hn;function At(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function N$(){var s=new At(this.__wrapped__);return s.__actions__=un(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=un(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=un(this.__views__),s}function R$(){if(this.__filtered__){var s=new At(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function L$(){var s=this.__wrapped__.value(),a=this.__dir__,u=at(s),y=a<0,I=u?s.length:0,R=GN(0,I,this.__views__),G=R.start,J=R.end,X=J-G,ce=y?J:G-1,ue=this.__iteratees__,ge=ue.length,we=0,Le=Br(X,this.__takeCount__);if(!u||!y&&I==X&&Le==X)return q2(s,this.__actions__);var Ke=[];e:for(;X--&&we<Le;){ce+=a;for(var pt=-1,We=s[ce];++pt<ge;){var yt=ue[pt],Dt=yt.iteratee,In=yt.type,Zr=Dt(We);if(In==b)We=Zr;else if(!Zr){if(In==p)continue e;break e}}Ke[we++]=We}return Ke}At.prototype=Ra(ph.prototype),At.prototype.constructor=At;function So(s){var a=-1,u=s==null?0:s.length;for(this.clear();++a<u;){var y=s[a];this.set(y[0],y[1])}}function B$(){this.__data__=Jc?Jc(null):{},this.size=0}function U$(s){var a=this.has(s)&&delete this.__data__[s];return this.size-=a?1:0,a}function F$(s){var a=this.__data__;if(Jc){var u=a[s];return u===f?r:u}return qt.call(a,s)?a[s]:r}function j$(s){var a=this.__data__;return Jc?a[s]!==r:qt.call(a,s)}function k$(s,a){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=Jc&&a===r?f:a,this}So.prototype.clear=B$,So.prototype.delete=U$,So.prototype.get=F$,So.prototype.has=j$,So.prototype.set=k$;function Yi(s){var a=-1,u=s==null?0:s.length;for(this.clear();++a<u;){var y=s[a];this.set(y[0],y[1])}}function q$(){this.__data__=[],this.size=0}function z$(s){var a=this.__data__,u=gh(a,s);if(u<0)return!1;var y=a.length-1;return u==y?a.pop():ch.call(a,u,1),--this.size,!0}function H$(s){var a=this.__data__,u=gh(a,s);return u<0?r:a[u][1]}function K$(s){return gh(this.__data__,s)>-1}function W$(s,a){var u=this.__data__,y=gh(u,s);return y<0?(++this.size,u.push([s,a])):u[y][1]=a,this}Yi.prototype.clear=q$,Yi.prototype.delete=z$,Yi.prototype.get=H$,Yi.prototype.has=K$,Yi.prototype.set=W$;function Ji(s){var a=-1,u=s==null?0:s.length;for(this.clear();++a<u;){var y=s[a];this.set(y[0],y[1])}}function V$(){this.size=0,this.__data__={hash:new So,map:new(Gc||Yi),string:new So}}function G$(s){var a=Dh(this,s).delete(s);return this.size-=a?1:0,a}function Y$(s){return Dh(this,s).get(s)}function J$(s){return Dh(this,s).has(s)}function Q$(s,a){var u=Dh(this,s),y=u.size;return u.set(s,a),this.size+=u.size==y?0:1,this}Ji.prototype.clear=V$,Ji.prototype.delete=G$,Ji.prototype.get=Y$,Ji.prototype.has=J$,Ji.prototype.set=Q$;function Do(s){var a=-1,u=s==null?0:s.length;for(this.__data__=new Ji;++a<u;)this.add(s[a])}function Z$(s){return this.__data__.set(s,f),this}function X$(s){return this.__data__.has(s)}Do.prototype.add=Do.prototype.push=Z$,Do.prototype.has=X$;function ii(s){var a=this.__data__=new Yi(s);this.size=a.size}function eN(){this.__data__=new Yi,this.size=0}function tN(s){var a=this.__data__,u=a.delete(s);return this.size=a.size,u}function rN(s){return this.__data__.get(s)}function nN(s){return this.__data__.has(s)}function iN(s,a){var u=this.__data__;if(u instanceof Yi){var y=u.__data__;if(!Gc||y.length<i-1)return y.push([s,a]),this.size=++u.size,this;u=this.__data__=new Ji(y)}return u.set(s,a),this.size=u.size,this}ii.prototype.clear=eN,ii.prototype.delete=tN,ii.prototype.get=rN,ii.prototype.has=nN,ii.prototype.set=iN;function y2(s,a){var u=at(s),y=!u&&To(s),I=!u&&!y&&Bs(s),R=!u&&!y&&!I&&Fa(s),G=u||y||I||R,J=G?Gd(s.length,p$):[],X=J.length;for(var ce in s)(a||qt.call(s,ce))&&!(G&&(ce=="length"||I&&(ce=="offset"||ce=="parent")||R&&(ce=="buffer"||ce=="byteLength"||ce=="byteOffset")||es(ce,X)))&&J.push(ce);return J}function b2(s){var a=s.length;return a?s[hp(0,a-1)]:r}function sN(s,a){return Ch(un(s),Co(a,0,s.length))}function oN(s){return Ch(un(s))}function tp(s,a,u){(u!==r&&!si(s[a],u)||u===r&&!(a in s))&&Qi(s,a,u)}function Zc(s,a,u){var y=s[a];(!(qt.call(s,a)&&si(y,u))||u===r&&!(a in s))&&Qi(s,a,u)}function gh(s,a){for(var u=s.length;u--;)if(si(s[u][0],a))return u;return-1}function aN(s,a,u,y){return $s(s,function(I,R,G){a(y,I,u(I),G)}),y}function _2(s,a){return s&&$i(a,Sr(a),s)}function cN(s,a){return s&&$i(a,fn(a),s)}function Qi(s,a,u){a=="__proto__"&&lh?lh(s,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[a]=u}function rp(s,a){for(var u=-1,y=a.length,I=se(y),R=s==null;++u<y;)I[u]=R?r:Lp(s,a[u]);return I}function Co(s,a,u){return s===s&&(u!==r&&(s=s<=u?s:u),a!==r&&(s=s>=a?s:a)),s}function Kn(s,a,u,y,I,R){var G,J=a&_,X=a&E,ce=a&A;if(u&&(G=I?u(s,y,I,R):u(s)),G!==r)return G;if(!sr(s))return s;var ue=at(s);if(ue){if(G=JN(s),!J)return un(s,G)}else{var ge=Ur(s),we=ge==ie||ge==he;if(Bs(s))return K2(s,J);if(ge==Se||ge==x||we&&!I){if(G=X||we?{}:ub(s),!J)return X?FN(s,cN(G,s)):UN(s,_2(G,s))}else{if(!Kt[ge])return I?s:{};G=QN(s,ge,J)}}R||(R=new ii);var Le=R.get(s);if(Le)return Le;R.set(s,G),Fb(s)?s.forEach(function(We){G.add(Kn(We,a,u,We,s,R))}):Bb(s)&&s.forEach(function(We,yt){G.set(yt,Kn(We,a,u,yt,s,R))});var Ke=ce?X?Ep:_p:X?fn:Sr,pt=ue?r:Ke(s);return qn(pt||s,function(We,yt){pt&&(yt=We,We=s[yt]),Zc(G,yt,Kn(We,a,u,yt,s,R))}),G}function lN(s){var a=Sr(s);return function(u){return E2(u,s,a)}}function E2(s,a,u){var y=u.length;if(s==null)return!y;for(s=Yt(s);y--;){var I=u[y],R=a[I],G=s[I];if(G===r&&!(I in s)||!R(G))return!1}return!0}function A2(s,a,u){if(typeof s!="function")throw new zn(c);return sl(function(){s.apply(r,u)},a)}function Xc(s,a,u,y){var I=-1,R=Zu,G=!0,J=s.length,X=[],ce=a.length;if(!J)return X;u&&(a=tr(a,En(u))),y?(R=qd,G=!1):a.length>=i&&(R=Wc,G=!1,a=new Do(a));e:for(;++I<J;){var ue=s[I],ge=u==null?ue:u(ue);if(ue=y||ue!==0?ue:0,G&&ge===ge){for(var we=ce;we--;)if(a[we]===ge)continue e;X.push(ue)}else R(a,ge,y)||X.push(ue)}return X}var $s=J2(Ti),x2=J2(ip,!0);function uN(s,a){var u=!0;return $s(s,function(y,I,R){return u=!!a(y,I,R),u}),u}function mh(s,a,u){for(var y=-1,I=s.length;++y<I;){var R=s[y],G=a(R);if(G!=null&&(J===r?G===G&&!xn(G):u(G,J)))var J=G,X=R}return X}function hN(s,a,u,y){var I=s.length;for(u=ft(u),u<0&&(u=-u>I?0:I+u),y=y===r||y>I?I:ft(y),y<0&&(y+=I),y=u>y?0:kb(y);u<y;)s[u++]=a;return s}function I2(s,a){var u=[];return $s(s,function(y,I,R){a(y,I,R)&&u.push(y)}),u}function Tr(s,a,u,y,I){var R=-1,G=s.length;for(u||(u=XN),I||(I=[]);++R<G;){var J=s[R];a>0&&u(J)?a>1?Tr(J,a-1,u,y,I):Ps(I,J):y||(I[I.length]=J)}return I}var np=Q2(),S2=Q2(!0);function Ti(s,a){return s&&np(s,a,Sr)}function ip(s,a){return s&&S2(s,a,Sr)}function vh(s,a){return Os(a,function(u){return ts(s[u])})}function Oo(s,a){a=Rs(a,s);for(var u=0,y=a.length;s!=null&&u<y;)s=s[Ni(a[u++])];return u&&u==y?s:r}function D2(s,a,u){var y=a(s);return at(s)?y:Ps(y,u(s))}function Jr(s){return s==null?s===r?Ge:Me:Io&&Io in Yt(s)?VN(s):oR(s)}function sp(s,a){return s>a}function fN(s,a){return s!=null&&qt.call(s,a)}function dN(s,a){return s!=null&&a in Yt(s)}function pN(s,a,u){return s>=Br(a,u)&&s<yr(a,u)}function op(s,a,u){for(var y=u?qd:Zu,I=s[0].length,R=s.length,G=R,J=se(R),X=1/0,ce=[];G--;){var ue=s[G];G&&a&&(ue=tr(ue,En(a))),X=Br(ue.length,X),J[G]=!u&&(a||I>=120&&ue.length>=120)?new Do(G&&ue):r}ue=s[0];var ge=-1,we=J[0];e:for(;++ge<I&&ce.length<X;){var Le=ue[ge],Ke=a?a(Le):Le;if(Le=u||Le!==0?Le:0,!(we?Wc(we,Ke):y(ce,Ke,u))){for(G=R;--G;){var pt=J[G];if(!(pt?Wc(pt,Ke):y(s[G],Ke,u)))continue e}we&&we.push(Ke),ce.push(Le)}}return ce}function gN(s,a,u,y){return Ti(s,function(I,R,G){a(y,u(I),R,G)}),y}function el(s,a,u){a=Rs(a,s),s=pb(s,a);var y=s==null?s:s[Ni(Vn(a))];return y==null?r:Ir(y,s,u)}function C2(s){return cr(s)&&Jr(s)==x}function mN(s){return cr(s)&&Jr(s)==Be}function vN(s){return cr(s)&&Jr(s)==V}function tl(s,a,u,y,I){return s===a?!0:s==null||a==null||!cr(s)&&!cr(a)?s!==s&&a!==a:wN(s,a,u,y,tl,I)}function wN(s,a,u,y,I,R){var G=at(s),J=at(a),X=G?re:Ur(s),ce=J?re:Ur(a);X=X==x?Se:X,ce=ce==x?Se:ce;var ue=X==Se,ge=ce==Se,we=X==ce;if(we&&Bs(s)){if(!Bs(a))return!1;G=!0,ue=!1}if(we&&!ue)return R||(R=new ii),G||Fa(s)?ab(s,a,u,y,I,R):KN(s,a,X,u,y,I,R);if(!(u&S)){var Le=ue&&qt.call(s,"__wrapped__"),Ke=ge&&qt.call(a,"__wrapped__");if(Le||Ke){var pt=Le?s.value():s,We=Ke?a.value():a;return R||(R=new ii),I(pt,We,u,y,R)}}return we?(R||(R=new ii),WN(s,a,u,y,I,R)):!1}function yN(s){return cr(s)&&Ur(s)==le}function ap(s,a,u,y){var I=u.length,R=I,G=!y;if(s==null)return!R;for(s=Yt(s);I--;){var J=u[I];if(G&&J[2]?J[1]!==s[J[0]]:!(J[0]in s))return!1}for(;++I<R;){J=u[I];var X=J[0],ce=s[X],ue=J[1];if(G&&J[2]){if(ce===r&&!(X in s))return!1}else{var ge=new ii;if(y)var we=y(ce,ue,X,s,a,ge);if(!(we===r?tl(ue,ce,S|U,y,ge):we))return!1}}return!0}function O2(s){if(!sr(s)||tR(s))return!1;var a=ts(s)?y$:Un;return a.test(Mo(s))}function bN(s){return cr(s)&&Jr(s)==Ce}function _N(s){return cr(s)&&Ur(s)==Fe}function EN(s){return cr(s)&&Nh(s.length)&&!!Wt[Jr(s)]}function P2(s){return typeof s=="function"?s:s==null?dn:typeof s=="object"?at(s)?$2(s[0],s[1]):T2(s):Zb(s)}function cp(s){if(!il(s))return I$(s);var a=[];for(var u in Yt(s))qt.call(s,u)&&u!="constructor"&&a.push(u);return a}function AN(s){if(!sr(s))return sR(s);var a=il(s),u=[];for(var y in s)y=="constructor"&&(a||!qt.call(s,y))||u.push(y);return u}function lp(s,a){return s<a}function M2(s,a){var u=-1,y=hn(s)?se(s.length):[];return $s(s,function(I,R,G){y[++u]=a(I,R,G)}),y}function T2(s){var a=xp(s);return a.length==1&&a[0][2]?fb(a[0][0],a[0][1]):function(u){return u===s||ap(u,s,a)}}function $2(s,a){return Sp(s)&&hb(a)?fb(Ni(s),a):function(u){var y=Lp(u,s);return y===r&&y===a?Bp(u,s):tl(a,y,S|U)}}function wh(s,a,u,y,I){s!==a&&np(a,function(R,G){if(I||(I=new ii),sr(R))xN(s,a,G,u,wh,y,I);else{var J=y?y(Cp(s,G),R,G+"",s,a,I):r;J===r&&(J=R),tp(s,G,J)}},fn)}function xN(s,a,u,y,I,R,G){var J=Cp(s,u),X=Cp(a,u),ce=G.get(X);if(ce){tp(s,u,ce);return}var ue=R?R(J,X,u+"",s,a,G):r,ge=ue===r;if(ge){var we=at(X),Le=!we&&Bs(X),Ke=!we&&!Le&&Fa(X);ue=X,we||Le||Ke?at(J)?ue=J:dr(J)?ue=un(J):Le?(ge=!1,ue=K2(X,!0)):Ke?(ge=!1,ue=W2(X,!0)):ue=[]:ol(X)||To(X)?(ue=J,To(J)?ue=qb(J):(!sr(J)||ts(J))&&(ue=ub(X))):ge=!1}ge&&(G.set(X,ue),I(ue,X,y,R,G),G.delete(X)),tp(s,u,ue)}function N2(s,a){var u=s.length;if(u)return a+=a<0?u:0,es(a,u)?s[a]:r}function R2(s,a,u){a.length?a=tr(a,function(R){return at(R)?function(G){return Oo(G,R.length===1?R[0]:R)}:R}):a=[dn];var y=-1;a=tr(a,En(qe()));var I=M2(s,function(R,G,J){var X=tr(a,function(ce){return ce(R)});return{criteria:X,index:++y,value:R}});return QT(I,function(R,G){return BN(R,G,u)})}function IN(s,a){return L2(s,a,function(u,y){return Bp(s,y)})}function L2(s,a,u){for(var y=-1,I=a.length,R={};++y<I;){var G=a[y],J=Oo(s,G);u(J,G)&&rl(R,Rs(G,s),J)}return R}function SN(s){return function(a){return Oo(a,s)}}function up(s,a,u,y){var I=y?JT:Ca,R=-1,G=a.length,J=s;for(s===a&&(a=un(a)),u&&(J=tr(s,En(u)));++R<G;)for(var X=0,ce=a[R],ue=u?u(ce):ce;(X=I(J,ue,X,y))>-1;)J!==s&&ch.call(J,X,1),ch.call(s,X,1);return s}function B2(s,a){for(var u=s?a.length:0,y=u-1;u--;){var I=a[u];if(u==y||I!==R){var R=I;es(I)?ch.call(s,I,1):pp(s,I)}}return s}function hp(s,a){return s+hh(v2()*(a-s+1))}function DN(s,a,u,y){for(var I=-1,R=yr(uh((a-s)/(u||1)),0),G=se(R);R--;)G[y?R:++I]=s,s+=u;return G}function fp(s,a){var u="";if(!s||a<1||a>$)return u;do a%2&&(u+=s),a=hh(a/2),a&&(s+=s);while(a);return u}function gt(s,a){return Op(db(s,a,dn),s+"")}function CN(s){return b2(ja(s))}function ON(s,a){var u=ja(s);return Ch(u,Co(a,0,u.length))}function rl(s,a,u,y){if(!sr(s))return s;a=Rs(a,s);for(var I=-1,R=a.length,G=R-1,J=s;J!=null&&++I<R;){var X=Ni(a[I]),ce=u;if(X==="__proto__"||X==="constructor"||X==="prototype")return s;if(I!=G){var ue=J[X];ce=y?y(ue,X,J):r,ce===r&&(ce=sr(ue)?ue:es(a[I+1])?[]:{})}Zc(J,X,ce),J=J[X]}return s}var U2=fh?function(s,a){return fh.set(s,a),s}:dn,PN=lh?function(s,a){return lh(s,"toString",{configurable:!0,enumerable:!1,value:Fp(a),writable:!0})}:dn;function MN(s){return Ch(ja(s))}function Wn(s,a,u){var y=-1,I=s.length;a<0&&(a=-a>I?0:I+a),u=u>I?I:u,u<0&&(u+=I),I=a>u?0:u-a>>>0,a>>>=0;for(var R=se(I);++y<I;)R[y]=s[y+a];return R}function TN(s,a){var u;return $s(s,function(y,I,R){return u=a(y,I,R),!u}),!!u}function yh(s,a,u){var y=0,I=s==null?y:s.length;if(typeof a=="number"&&a===a&&I<=oe){for(;y<I;){var R=y+I>>>1,G=s[R];G!==null&&!xn(G)&&(u?G<=a:G<a)?y=R+1:I=R}return I}return dp(s,a,dn,u)}function dp(s,a,u,y){var I=0,R=s==null?0:s.length;if(R===0)return 0;a=u(a);for(var G=a!==a,J=a===null,X=xn(a),ce=a===r;I<R;){var ue=hh((I+R)/2),ge=u(s[ue]),we=ge!==r,Le=ge===null,Ke=ge===ge,pt=xn(ge);if(G)var We=y||Ke;else ce?We=Ke&&(y||we):J?We=Ke&&we&&(y||!Le):X?We=Ke&&we&&!Le&&(y||!pt):Le||pt?We=!1:We=y?ge<=a:ge<a;We?I=ue+1:R=ue}return Br(R,N)}function F2(s,a){for(var u=-1,y=s.length,I=0,R=[];++u<y;){var G=s[u],J=a?a(G):G;if(!u||!si(J,X)){var X=J;R[I++]=G===0?0:G}}return R}function j2(s){return typeof s=="number"?s:xn(s)?C:+s}function An(s){if(typeof s=="string")return s;if(at(s))return tr(s,An)+"";if(xn(s))return w2?w2.call(s):"";var a=s+"";return a=="0"&&1/s==-O?"-0":a}function Ns(s,a,u){var y=-1,I=Zu,R=s.length,G=!0,J=[],X=J;if(u)G=!1,I=qd;else if(R>=i){var ce=a?null:zN(s);if(ce)return eh(ce);G=!1,I=Wc,X=new Do}else X=a?[]:J;e:for(;++y<R;){var ue=s[y],ge=a?a(ue):ue;if(ue=u||ue!==0?ue:0,G&&ge===ge){for(var we=X.length;we--;)if(X[we]===ge)continue e;a&&X.push(ge),J.push(ue)}else I(X,ge,u)||(X!==J&&X.push(ge),J.push(ue))}return J}function pp(s,a){return a=Rs(a,s),s=pb(s,a),s==null||delete s[Ni(Vn(a))]}function k2(s,a,u,y){return rl(s,a,u(Oo(s,a)),y)}function bh(s,a,u,y){for(var I=s.length,R=y?I:-1;(y?R--:++R<I)&&a(s[R],R,s););return u?Wn(s,y?0:R,y?R+1:I):Wn(s,y?R+1:0,y?I:R)}function q2(s,a){var u=s;return u instanceof At&&(u=u.value()),zd(a,function(y,I){return I.func.apply(I.thisArg,Ps([y],I.args))},u)}function gp(s,a,u){var y=s.length;if(y<2)return y?Ns(s[0]):[];for(var I=-1,R=se(y);++I<y;)for(var G=s[I],J=-1;++J<y;)J!=I&&(R[I]=Xc(R[I]||G,s[J],a,u));return Ns(Tr(R,1),a,u)}function z2(s,a,u){for(var y=-1,I=s.length,R=a.length,G={};++y<I;){var J=y<R?a[y]:r;u(G,s[y],J)}return G}function mp(s){return dr(s)?s:[]}function vp(s){return typeof s=="function"?s:dn}function Rs(s,a){return at(s)?s:Sp(s,a)?[s]:wb(Bt(s))}var $N=gt;function Ls(s,a,u){var y=s.length;return u=u===r?y:u,!a&&u>=y?s:Wn(s,a,u)}var H2=b$||function(s){return St.clearTimeout(s)};function K2(s,a){if(a)return s.slice();var u=s.length,y=f2?f2(u):new s.constructor(u);return s.copy(y),y}function wp(s){var a=new s.constructor(s.byteLength);return new oh(a).set(new oh(s)),a}function NN(s,a){var u=a?wp(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function RN(s){var a=new s.constructor(s.source,vt.exec(s));return a.lastIndex=s.lastIndex,a}function LN(s){return Qc?Yt(Qc.call(s)):{}}function W2(s,a){var u=a?wp(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function V2(s,a){if(s!==a){var u=s!==r,y=s===null,I=s===s,R=xn(s),G=a!==r,J=a===null,X=a===a,ce=xn(a);if(!J&&!ce&&!R&&s>a||R&&G&&X&&!J&&!ce||y&&G&&X||!u&&X||!I)return 1;if(!y&&!R&&!ce&&s<a||ce&&u&&I&&!y&&!R||J&&u&&I||!G&&I||!X)return-1}return 0}function BN(s,a,u){for(var y=-1,I=s.criteria,R=a.criteria,G=I.length,J=u.length;++y<G;){var X=V2(I[y],R[y]);if(X){if(y>=J)return X;var ce=u[y];return X*(ce=="desc"?-1:1)}}return s.index-a.index}function G2(s,a,u,y){for(var I=-1,R=s.length,G=u.length,J=-1,X=a.length,ce=yr(R-G,0),ue=se(X+ce),ge=!y;++J<X;)ue[J]=a[J];for(;++I<G;)(ge||I<R)&&(ue[u[I]]=s[I]);for(;ce--;)ue[J++]=s[I++];return ue}function Y2(s,a,u,y){for(var I=-1,R=s.length,G=-1,J=u.length,X=-1,ce=a.length,ue=yr(R-J,0),ge=se(ue+ce),we=!y;++I<ue;)ge[I]=s[I];for(var Le=I;++X<ce;)ge[Le+X]=a[X];for(;++G<J;)(we||I<R)&&(ge[Le+u[G]]=s[I++]);return ge}function un(s,a){var u=-1,y=s.length;for(a||(a=se(y));++u<y;)a[u]=s[u];return a}function $i(s,a,u,y){var I=!u;u||(u={});for(var R=-1,G=a.length;++R<G;){var J=a[R],X=y?y(u[J],s[J],J,u,s):r;X===r&&(X=s[J]),I?Qi(u,J,X):Zc(u,J,X)}return u}function UN(s,a){return $i(s,Ip(s),a)}function FN(s,a){return $i(s,cb(s),a)}function _h(s,a){return function(u,y){var I=at(u)?HT:aN,R=a?a():{};return I(u,s,qe(y,2),R)}}function La(s){return gt(function(a,u){var y=-1,I=u.length,R=I>1?u[I-1]:r,G=I>2?u[2]:r;for(R=s.length>3&&typeof R=="function"?(I--,R):r,G&&Qr(u[0],u[1],G)&&(R=I<3?r:R,I=1),a=Yt(a);++y<I;){var J=u[y];J&&s(a,J,y,R)}return a})}function J2(s,a){return function(u,y){if(u==null)return u;if(!hn(u))return s(u,y);for(var I=u.length,R=a?I:-1,G=Yt(u);(a?R--:++R<I)&&y(G[R],R,G)!==!1;);return u}}function Q2(s){return function(a,u,y){for(var I=-1,R=Yt(a),G=y(a),J=G.length;J--;){var X=G[s?J:++I];if(u(R[X],X,R)===!1)break}return a}}function jN(s,a,u){var y=a&W,I=nl(s);function R(){var G=this&&this!==St&&this instanceof R?I:s;return G.apply(y?u:this,arguments)}return R}function Z2(s){return function(a){a=Bt(a);var u=Oa(a)?ni(a):r,y=u?u[0]:a.charAt(0),I=u?Ls(u,1).join(""):a.slice(1);return y[s]()+I}}function Ba(s){return function(a){return zd(Jb(Yb(a).replace(Hc,"")),s,"")}}function nl(s){return function(){var a=arguments;switch(a.length){case 0:return new s;case 1:return new s(a[0]);case 2:return new s(a[0],a[1]);case 3:return new s(a[0],a[1],a[2]);case 4:return new s(a[0],a[1],a[2],a[3]);case 5:return new s(a[0],a[1],a[2],a[3],a[4]);case 6:return new s(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new s(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var u=Ra(s.prototype),y=s.apply(u,a);return sr(y)?y:u}}function kN(s,a,u){var y=nl(s);function I(){for(var R=arguments.length,G=se(R),J=R,X=Ua(I);J--;)G[J]=arguments[J];var ce=R<3&&G[0]!==X&&G[R-1]!==X?[]:Ms(G,X);if(R-=ce.length,R<u)return nb(s,a,Eh,I.placeholder,r,G,ce,r,r,u-R);var ue=this&&this!==St&&this instanceof I?y:s;return Ir(ue,this,G)}return I}function X2(s){return function(a,u,y){var I=Yt(a);if(!hn(a)){var R=qe(u,3);a=Sr(a),u=function(J){return R(I[J],J,I)}}var G=s(a,u,y);return G>-1?I[R?a[G]:G]:r}}function eb(s){return Xi(function(a){var u=a.length,y=u,I=Hn.prototype.thru;for(s&&a.reverse();y--;){var R=a[y];if(typeof R!="function")throw new zn(c);if(I&&!G&&Sh(R)=="wrapper")var G=new Hn([],!0)}for(y=G?y:u;++y<u;){R=a[y];var J=Sh(R),X=J=="wrapper"?Ap(R):r;X&&Dp(X[0])&&X[1]==(m|z|F|T)&&!X[4].length&&X[9]==1?G=G[Sh(X[0])].apply(G,X[3]):G=R.length==1&&Dp(R)?G[J]():G.thru(R)}return function(){var ce=arguments,ue=ce[0];if(G&&ce.length==1&&at(ue))return G.plant(ue).value();for(var ge=0,we=u?a[ge].apply(this,ce):ue;++ge<u;)we=a[ge].call(this,we);return we}})}function Eh(s,a,u,y,I,R,G,J,X,ce){var ue=a&m,ge=a&W,we=a&Y,Le=a&(z|P),Ke=a&te,pt=we?r:nl(s);function We(){for(var yt=arguments.length,Dt=se(yt),In=yt;In--;)Dt[In]=arguments[In];if(Le)var Zr=Ua(We),Sn=XT(Dt,Zr);if(y&&(Dt=G2(Dt,y,I,Le)),R&&(Dt=Y2(Dt,R,G,Le)),yt-=Sn,Le&&yt<ce){var pr=Ms(Dt,Zr);return nb(s,a,Eh,We.placeholder,u,Dt,pr,J,X,ce-yt)}var oi=ge?u:this,ns=we?oi[s]:s;return yt=Dt.length,J?Dt=aR(Dt,J):Ke&&yt>1&&Dt.reverse(),ue&&X<yt&&(Dt.length=X),this&&this!==St&&this instanceof We&&(ns=pt||nl(ns)),ns.apply(oi,Dt)}return We}function tb(s,a){return function(u,y){return gN(u,s,a(y),{})}}function Ah(s,a){return function(u,y){var I;if(u===r&&y===r)return a;if(u!==r&&(I=u),y!==r){if(I===r)return y;typeof u=="string"||typeof y=="string"?(u=An(u),y=An(y)):(u=j2(u),y=j2(y)),I=s(u,y)}return I}}function yp(s){return Xi(function(a){return a=tr(a,En(qe())),gt(function(u){var y=this;return s(a,function(I){return Ir(I,y,u)})})})}function xh(s,a){a=a===r?" ":An(a);var u=a.length;if(u<2)return u?fp(a,s):a;var y=fp(a,uh(s/Pa(a)));return Oa(a)?Ls(ni(y),0,s).join(""):y.slice(0,s)}function qN(s,a,u,y){var I=a&W,R=nl(s);function G(){for(var J=-1,X=arguments.length,ce=-1,ue=y.length,ge=se(ue+X),we=this&&this!==St&&this instanceof G?R:s;++ce<ue;)ge[ce]=y[ce];for(;X--;)ge[ce++]=arguments[++J];return Ir(we,I?u:this,ge)}return G}function rb(s){return function(a,u,y){return y&&typeof y!="number"&&Qr(a,u,y)&&(u=y=r),a=rs(a),u===r?(u=a,a=0):u=rs(u),y=y===r?a<u?1:-1:rs(y),DN(a,u,y,s)}}function Ih(s){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=Gn(a),u=Gn(u)),s(a,u)}}function nb(s,a,u,y,I,R,G,J,X,ce){var ue=a&z,ge=ue?G:r,we=ue?r:G,Le=ue?R:r,Ke=ue?r:R;a|=ue?F:j,a&=~(ue?j:F),a&B||(a&=~(W|Y));var pt=[s,a,I,Le,ge,Ke,we,J,X,ce],We=u.apply(r,pt);return Dp(s)&&gb(We,pt),We.placeholder=y,mb(We,s,a)}function bp(s){var a=wr[s];return function(u,y){if(u=Gn(u),y=y==null?0:Br(ft(y),292),y&&m2(u)){var I=(Bt(u)+"e").split("e"),R=a(I[0]+"e"+(+I[1]+y));return I=(Bt(R)+"e").split("e"),+(I[0]+"e"+(+I[1]-y))}return a(u)}}var zN=$a&&1/eh(new $a([,-0]))[1]==O?function(s){return new $a(s)}:qp;function ib(s){return function(a){var u=Ur(a);return u==le?Jd(a):u==Fe?o$(a):ZT(a,s(a))}}function Zi(s,a,u,y,I,R,G,J){var X=a&Y;if(!X&&typeof s!="function")throw new zn(c);var ce=y?y.length:0;if(ce||(a&=~(F|j),y=I=r),G=G===r?G:yr(ft(G),0),J=J===r?J:ft(J),ce-=I?I.length:0,a&j){var ue=y,ge=I;y=I=r}var we=X?r:Ap(s),Le=[s,a,u,y,I,ue,ge,R,G,J];if(we&&iR(Le,we),s=Le[0],a=Le[1],u=Le[2],y=Le[3],I=Le[4],J=Le[9]=Le[9]===r?X?0:s.length:yr(Le[9]-ce,0),!J&&a&(z|P)&&(a&=~(z|P)),!a||a==W)var Ke=jN(s,a,u);else a==z||a==P?Ke=kN(s,a,J):(a==F||a==(W|F))&&!I.length?Ke=qN(s,a,u,y):Ke=Eh.apply(r,Le);var pt=we?U2:gb;return mb(pt(Ke,Le),s,a)}function sb(s,a,u,y){return s===r||si(s,Ta[u])&&!qt.call(y,u)?a:s}function ob(s,a,u,y,I,R){return sr(s)&&sr(a)&&(R.set(a,s),wh(s,a,r,ob,R),R.delete(a)),s}function HN(s){return ol(s)?r:s}function ab(s,a,u,y,I,R){var G=u&S,J=s.length,X=a.length;if(J!=X&&!(G&&X>J))return!1;var ce=R.get(s),ue=R.get(a);if(ce&&ue)return ce==a&&ue==s;var ge=-1,we=!0,Le=u&U?new Do:r;for(R.set(s,a),R.set(a,s);++ge<J;){var Ke=s[ge],pt=a[ge];if(y)var We=G?y(pt,Ke,ge,a,s,R):y(Ke,pt,ge,s,a,R);if(We!==r){if(We)continue;we=!1;break}if(Le){if(!Hd(a,function(yt,Dt){if(!Wc(Le,Dt)&&(Ke===yt||I(Ke,yt,u,y,R)))return Le.push(Dt)})){we=!1;break}}else if(!(Ke===pt||I(Ke,pt,u,y,R))){we=!1;break}}return R.delete(s),R.delete(a),we}function KN(s,a,u,y,I,R,G){switch(u){case be:if(s.byteLength!=a.byteLength||s.byteOffset!=a.byteOffset)return!1;s=s.buffer,a=a.buffer;case Be:return!(s.byteLength!=a.byteLength||!R(new oh(s),new oh(a)));case H:case V:case Oe:return si(+s,+a);case k:return s.name==a.name&&s.message==a.message;case Ce:case Ee:return s==a+"";case le:var J=Jd;case Fe:var X=y&S;if(J||(J=eh),s.size!=a.size&&!X)return!1;var ce=G.get(s);if(ce)return ce==a;y|=U,G.set(s,a);var ue=ab(J(s),J(a),y,I,R,G);return G.delete(s),ue;case Ae:if(Qc)return Qc.call(s)==Qc.call(a)}return!1}function WN(s,a,u,y,I,R){var G=u&S,J=_p(s),X=J.length,ce=_p(a),ue=ce.length;if(X!=ue&&!G)return!1;for(var ge=X;ge--;){var we=J[ge];if(!(G?we in a:qt.call(a,we)))return!1}var Le=R.get(s),Ke=R.get(a);if(Le&&Ke)return Le==a&&Ke==s;var pt=!0;R.set(s,a),R.set(a,s);for(var We=G;++ge<X;){we=J[ge];var yt=s[we],Dt=a[we];if(y)var In=G?y(Dt,yt,we,a,s,R):y(yt,Dt,we,s,a,R);if(!(In===r?yt===Dt||I(yt,Dt,u,y,R):In)){pt=!1;break}We||(We=we=="constructor")}if(pt&&!We){var Zr=s.constructor,Sn=a.constructor;Zr!=Sn&&"constructor"in s&&"constructor"in a&&!(typeof Zr=="function"&&Zr instanceof Zr&&typeof Sn=="function"&&Sn instanceof Sn)&&(pt=!1)}return R.delete(s),R.delete(a),pt}function Xi(s){return Op(db(s,r,Eb),s+"")}function _p(s){return D2(s,Sr,Ip)}function Ep(s){return D2(s,fn,cb)}var Ap=fh?function(s){return fh.get(s)}:qp;function Sh(s){for(var a=s.name+"",u=Na[a],y=qt.call(Na,a)?u.length:0;y--;){var I=u[y],R=I.func;if(R==null||R==s)return I.name}return a}function Ua(s){var a=qt.call(M,"placeholder")?M:s;return a.placeholder}function qe(){var s=M.iteratee||jp;return s=s===jp?P2:s,arguments.length?s(arguments[0],arguments[1]):s}function Dh(s,a){var u=s.__data__;return eR(a)?u[typeof a=="string"?"string":"hash"]:u.map}function xp(s){for(var a=Sr(s),u=a.length;u--;){var y=a[u],I=s[y];a[u]=[y,I,hb(I)]}return a}function Po(s,a){var u=n$(s,a);return O2(u)?u:r}function VN(s){var a=qt.call(s,Io),u=s[Io];try{s[Io]=r;var y=!0}catch{}var I=ih.call(s);return y&&(a?s[Io]=u:delete s[Io]),I}var Ip=Zd?function(s){return s==null?[]:(s=Yt(s),Os(Zd(s),function(a){return p2.call(s,a)}))}:zp,cb=Zd?function(s){for(var a=[];s;)Ps(a,Ip(s)),s=ah(s);return a}:zp,Ur=Jr;(Xd&&Ur(new Xd(new ArrayBuffer(1)))!=be||Gc&&Ur(new Gc)!=le||ep&&Ur(ep.resolve())!=Pt||$a&&Ur(new $a)!=Fe||Yc&&Ur(new Yc)!=ye)&&(Ur=function(s){var a=Jr(s),u=a==Se?s.constructor:r,y=u?Mo(u):"";if(y)switch(y){case O$:return be;case P$:return le;case M$:return Pt;case T$:return Fe;case $$:return ye}return a});function GN(s,a,u){for(var y=-1,I=u.length;++y<I;){var R=u[y],G=R.size;switch(R.type){case"drop":s+=G;break;case"dropRight":a-=G;break;case"take":a=Br(a,s+G);break;case"takeRight":s=yr(s,a-G);break}}return{start:s,end:a}}function YN(s){var a=s.match(ke);return a?a[1].split(Ht):[]}function lb(s,a,u){a=Rs(a,s);for(var y=-1,I=a.length,R=!1;++y<I;){var G=Ni(a[y]);if(!(R=s!=null&&u(s,G)))break;s=s[G]}return R||++y!=I?R:(I=s==null?0:s.length,!!I&&Nh(I)&&es(G,I)&&(at(s)||To(s)))}function JN(s){var a=s.length,u=new s.constructor(a);return a&&typeof s[0]=="string"&&qt.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function ub(s){return typeof s.constructor=="function"&&!il(s)?Ra(ah(s)):{}}function QN(s,a,u){var y=s.constructor;switch(a){case Be:return wp(s);case H:case V:return new y(+s);case be:return NN(s,u);case Pe:case je:case Te:case $e:case lt:case Re:case Ne:case nr:case dt:return W2(s,u);case le:return new y;case Oe:case Ee:return new y(s);case Ce:return RN(s);case Fe:return new y;case Ae:return LN(s)}}function ZN(s,a){var u=a.length;if(!u)return s;var y=u-1;return a[y]=(u>1?"& ":"")+a[y],a=a.join(u>2?", ":" "),s.replace(Ze,`{
77
64
  /* [wrapped with `+a+`] */
78
- `)}function pR(o){return at(o)||Ro(o)||!!(b2&&o&&o[b2])}function Xi(o,a){var u=typeof o;return a=a??N,!!a&&(u=="number"||u!="symbol"&&kn.test(o))&&o>-1&&o%1==0&&o<a}function Qr(o,a,u){if(!sr(u))return!1;var w=typeof a;return(w=="number"?ln(u)&&Xi(a,u.length):w=="string"&&a in u)?oi(u[a],o):!1}function Ip(o,a){if(at(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||xn(o)?!0:Xe.test(o)||!Mt.test(o)||a!=null&&o in Yt(a)}function gR(o){var a=typeof o;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?o!=="__proto__":o===null}function Dp(o){var a=Ah(o),u=T[a];if(typeof u!="function"||!(a in At.prototype))return!1;if(o===u)return!0;var w=Ap(u);return!!w&&o===w[0]}function mR(o){return!!m2&&m2 in o}var vR=Xu?es:Hp;function il(o){var a=o&&o.constructor,u=typeof a=="function"&&a.prototype||Ta;return o===u}function mb(o){return o===o&&!sr(o)}function vb(o,a){return function(u){return u==null?!1:u[o]===a&&(a!==r||o in Yt(u))}}function yR(o){var a=Oh(o,function(w){return u.size===h&&u.clear(),w}),u=a.cache;return a}function wR(o,a){var u=o[1],w=a[1],S=u|w,B=S<(W|Y|g),G=w==g&&u==z||w==g&&u==C&&o[7].length<=a[8]||w==(g|C)&&a[7].length<=a[8]&&u==z;if(!(B||G))return o;w&W&&(o[2]=a[2],S|=u&W?0:F);var Q=a[3];if(Q){var re=o[3];o[3]=re?X2(re,Q,a[4]):Q,o[4]=re?Ms(o[3],m):a[4]}return Q=a[5],Q&&(re=o[5],o[5]=re?eb(re,Q,a[6]):Q,o[6]=re?Ms(o[5],m):a[6]),Q=a[7],Q&&(o[7]=Q),w&g&&(o[8]=o[8]==null?a[8]:Br(o[8],a[8])),o[9]==null&&(o[9]=a[9]),o[0]=a[0],o[1]=S,o}function bR(o){var a=[];if(o!=null)for(var u in Yt(o))a.push(u);return a}function _R(o){return th.call(o)}function yb(o,a,u){return a=wr(a===r?o.length-1:a,0),function(){for(var w=arguments,S=-1,B=wr(w.length-a,0),G=se(B);++S<B;)G[S]=w[a+S];S=-1;for(var Q=se(a+1);++S<a;)Q[S]=w[S];return Q[a]=u(G),Sr(o,this,Q)}}function wb(o,a){return a.length<2?o:To(o,Vn(a,0,-1))}function ER(o,a){for(var u=o.length,w=Br(a.length,u),S=cn(o);w--;){var B=a[w];o[w]=Xi(B,u)?S[B]:r}return o}function Cp(o,a){if(!(a==="constructor"&&typeof o[a]=="function")&&a!="__proto__")return o[a]}var bb=Eb(z2),sl=B$||function(o,a){return It.setTimeout(o,a)},Op=Eb(KN);function _b(o,a,u){var w=a+"";return Op(o,dR(w,AR(uR(w),u)))}function Eb(o){var a=0,u=0;return function(){var w=k$(),S=p-(w-u);if(u=w,S>0){if(++a>=ae)return arguments[0]}else a=0;return o.apply(r,arguments)}}function Sh(o,a){var u=-1,w=o.length,S=w-1;for(a=a===r?w:a;++u<a;){var B=hp(u,S),G=o[B];o[B]=o[u],o[u]=G}return o.length=a,o}var Ab=yR(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(et,function(u,w,S,B){a.push(S?B.replace(ri,"$1"):w||u)}),a});function $i(o){if(typeof o=="string"||xn(o))return o;var a=o+"";return a=="0"&&1/o==-M?"-0":a}function No(o){if(o!=null){try{return eh.call(o)}catch{}try{return o+""}catch{}}return""}function AR(o,a){return zn(de,function(u){var w="_."+u[0];a&u[1]&&!Yu(o,w)&&o.push(w)}),o.sort()}function xb(o){if(o instanceof At)return o.clone();var a=new Kn(o.__wrapped__,o.__chain__);return a.__actions__=cn(o.__actions__),a.__index__=o.__index__,a.__values__=o.__values__,a}function xR(o,a,u){(u?Qr(o,a,u):a===r)?a=1:a=wr(ft(a),0);var w=o==null?0:o.length;if(!w||a<1)return[];for(var S=0,B=0,G=se(ah(w/a));S<w;)G[B++]=Vn(o,S,S+=a);return G}function SR(o){for(var a=-1,u=o==null?0:o.length,w=0,S=[];++a<u;){var B=o[a];B&&(S[w++]=B)}return S}function IR(){var o=arguments.length;if(!o)return[];for(var a=se(o-1),u=arguments[0],w=o;w--;)a[w-1]=arguments[w];return Ps(at(u)?cn(u):[u],Tr(a,1))}var DR=gt(function(o,a){return dr(o)?Xc(o,Tr(a,1,dr,!0)):[]}),CR=gt(function(o,a){var u=Gn(a);return dr(u)&&(u=r),dr(o)?Xc(o,Tr(a,1,dr,!0),qe(u,2)):[]}),OR=gt(function(o,a){var u=Gn(a);return dr(u)&&(u=r),dr(o)?Xc(o,Tr(a,1,dr,!0),r,u):[]});function PR(o,a,u){var w=o==null?0:o.length;return w?(a=u||a===r?1:ft(a),Vn(o,a<0?0:a,w)):[]}function MR(o,a,u){var w=o==null?0:o.length;return w?(a=u||a===r?1:ft(a),a=w-a,Vn(o,0,a<0?0:a)):[]}function TR(o,a){return o&&o.length?vh(o,qe(a,3),!0,!0):[]}function $R(o,a){return o&&o.length?vh(o,qe(a,3),!0):[]}function NR(o,a,u,w){var S=o==null?0:o.length;return S?(u&&typeof u!="number"&&Qr(o,a,u)&&(u=0,w=S),IN(o,a,u,w)):[]}function Sb(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=u==null?0:ft(u);return S<0&&(S=wr(w+S,0)),Ju(o,qe(a,3),S)}function Ib(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=w-1;return u!==r&&(S=ft(u),S=u<0?wr(w+S,0):Br(S,w-1)),Ju(o,qe(a,3),S,!0)}function Db(o){var a=o==null?0:o.length;return a?Tr(o,1):[]}function RR(o){var a=o==null?0:o.length;return a?Tr(o,M):[]}function LR(o,a){var u=o==null?0:o.length;return u?(a=a===r?1:ft(a),Tr(o,a)):[]}function BR(o){for(var a=-1,u=o==null?0:o.length,w={};++a<u;){var S=o[a];w[S[0]]=S[1]}return w}function Cb(o){return o&&o.length?o[0]:r}function UR(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=u==null?0:ft(u);return S<0&&(S=wr(w+S,0)),Ca(o,a,S)}function FR(o){var a=o==null?0:o.length;return a?Vn(o,0,-1):[]}var jR=gt(function(o){var a=tr(o,mp);return a.length&&a[0]===o[0]?op(a):[]}),kR=gt(function(o){var a=Gn(o),u=tr(o,mp);return a===Gn(u)?a=r:u.pop(),u.length&&u[0]===o[0]?op(u,qe(a,2)):[]}),qR=gt(function(o){var a=Gn(o),u=tr(o,mp);return a=typeof a=="function"?a:r,a&&u.pop(),u.length&&u[0]===o[0]?op(u,r,a):[]});function zR(o,a){return o==null?"":F$.call(o,a)}function Gn(o){var a=o==null?0:o.length;return a?o[a-1]:r}function HR(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=w;return u!==r&&(S=ft(u),S=S<0?wr(w+S,0):Br(S,w-1)),a===a?A$(o,a,S):Ju(o,c2,S,!0)}function KR(o,a){return o&&o.length?F2(o,ft(a)):r}var WR=gt(Ob);function Ob(o,a){return o&&o.length&&a&&a.length?up(o,a):o}function VR(o,a,u){return o&&o.length&&a&&a.length?up(o,a,qe(u,2)):o}function GR(o,a,u){return o&&o.length&&a&&a.length?up(o,a,r,u):o}var YR=Zi(function(o,a){var u=o==null?0:o.length,w=rp(o,a);return q2(o,tr(a,function(S){return Xi(S,u)?+S:S}).sort(Z2)),w});function JR(o,a){var u=[];if(!(o&&o.length))return u;var w=-1,S=[],B=o.length;for(a=qe(a,3);++w<B;){var G=o[w];a(G,w,o)&&(u.push(G),S.push(w))}return q2(o,S),u}function Pp(o){return o==null?o:z$.call(o)}function QR(o,a,u){var w=o==null?0:o.length;return w?(u&&typeof u!="number"&&Qr(o,a,u)?(a=0,u=w):(a=a==null?0:ft(a),u=u===r?w:ft(u)),Vn(o,a,u)):[]}function ZR(o,a){return mh(o,a)}function XR(o,a,u){return dp(o,a,qe(u,2))}function eL(o,a){var u=o==null?0:o.length;if(u){var w=mh(o,a);if(w<u&&oi(o[w],a))return w}return-1}function tL(o,a){return mh(o,a,!0)}function rL(o,a,u){return dp(o,a,qe(u,2),!0)}function nL(o,a){var u=o==null?0:o.length;if(u){var w=mh(o,a,!0)-1;if(oi(o[w],a))return w}return-1}function iL(o){return o&&o.length?H2(o):[]}function sL(o,a){return o&&o.length?H2(o,qe(a,2)):[]}function oL(o){var a=o==null?0:o.length;return a?Vn(o,1,a):[]}function aL(o,a,u){return o&&o.length?(a=u||a===r?1:ft(a),Vn(o,0,a<0?0:a)):[]}function cL(o,a,u){var w=o==null?0:o.length;return w?(a=u||a===r?1:ft(a),a=w-a,Vn(o,a<0?0:a,w)):[]}function lL(o,a){return o&&o.length?vh(o,qe(a,3),!1,!0):[]}function uL(o,a){return o&&o.length?vh(o,qe(a,3)):[]}var hL=gt(function(o){return Ns(Tr(o,1,dr,!0))}),fL=gt(function(o){var a=Gn(o);return dr(a)&&(a=r),Ns(Tr(o,1,dr,!0),qe(a,2))}),dL=gt(function(o){var a=Gn(o);return a=typeof a=="function"?a:r,Ns(Tr(o,1,dr,!0),r,a)});function pL(o){return o&&o.length?Ns(o):[]}function gL(o,a){return o&&o.length?Ns(o,qe(a,2)):[]}function mL(o,a){return a=typeof a=="function"?a:r,o&&o.length?Ns(o,r,a):[]}function Mp(o){if(!(o&&o.length))return[];var a=0;return o=Os(o,function(u){if(dr(u))return a=wr(u.length,a),!0}),Gd(a,function(u){return tr(o,Kd(u))})}function Pb(o,a){if(!(o&&o.length))return[];var u=Mp(o);return a==null?u:tr(u,function(w){return Sr(a,r,w)})}var vL=gt(function(o,a){return dr(o)?Xc(o,a):[]}),yL=gt(function(o){return gp(Os(o,dr))}),wL=gt(function(o){var a=Gn(o);return dr(a)&&(a=r),gp(Os(o,dr),qe(a,2))}),bL=gt(function(o){var a=Gn(o);return a=typeof a=="function"?a:r,gp(Os(o,dr),r,a)}),_L=gt(Mp);function EL(o,a){return G2(o||[],a||[],Zc)}function AL(o,a){return G2(o||[],a||[],rl)}var xL=gt(function(o){var a=o.length,u=a>1?o[a-1]:r;return u=typeof u=="function"?(o.pop(),u):r,Pb(o,u)});function Mb(o){var a=T(o);return a.__chain__=!0,a}function SL(o,a){return a(o),o}function Ih(o,a){return a(o)}var IL=Zi(function(o){var a=o.length,u=a?o[0]:0,w=this.__wrapped__,S=function(B){return rp(B,o)};return a>1||this.__actions__.length||!(w instanceof At)||!Xi(u)?this.thru(S):(w=w.slice(u,+u+(a?1:0)),w.__actions__.push({func:Ih,args:[S],thisArg:r}),new Kn(w,this.__chain__).thru(function(B){return a&&!B.length&&B.push(r),B}))});function DL(){return Mb(this)}function CL(){return new Kn(this.value(),this.__chain__)}function OL(){this.__values__===r&&(this.__values__=Kb(this.value()));var o=this.__index__>=this.__values__.length,a=o?r:this.__values__[this.__index__++];return{done:o,value:a}}function PL(){return this}function ML(o){for(var a,u=this;u instanceof hh;){var w=xb(u);w.__index__=0,w.__values__=r,a?S.__wrapped__=w:a=w;var S=w;u=u.__wrapped__}return S.__wrapped__=o,a}function TL(){var o=this.__wrapped__;if(o instanceof At){var a=o;return this.__actions__.length&&(a=new At(this)),a=a.reverse(),a.__actions__.push({func:Ih,args:[Pp],thisArg:r}),new Kn(a,this.__chain__)}return this.thru(Pp)}function $L(){return V2(this.__wrapped__,this.__actions__)}var NL=yh(function(o,a,u){qt.call(o,u)?++o[u]:Ji(o,u,1)});function RL(o,a,u){var w=at(o)?o2:SN;return u&&Qr(o,a,u)&&(a=r),w(o,qe(a,3))}function LL(o,a){var u=at(o)?Os:P2;return u(o,qe(a,3))}var BL=ib(Sb),UL=ib(Ib);function FL(o,a){return Tr(Dh(o,a),1)}function jL(o,a){return Tr(Dh(o,a),M)}function kL(o,a,u){return u=u===r?1:ft(u),Tr(Dh(o,a),u)}function Tb(o,a){var u=at(o)?zn:$s;return u(o,qe(a,3))}function $b(o,a){var u=at(o)?o$:O2;return u(o,qe(a,3))}var qL=yh(function(o,a,u){qt.call(o,u)?o[u].push(a):Ji(o,u,[a])});function zL(o,a,u,w){o=ln(o)?o:ja(o),u=u&&!w?ft(u):0;var S=o.length;return u<0&&(u=wr(S+u,0)),Th(o)?u<=S&&o.indexOf(a,u)>-1:!!S&&Ca(o,a,u)>-1}var HL=gt(function(o,a,u){var w=-1,S=typeof a=="function",B=ln(o)?se(o.length):[];return $s(o,function(G){B[++w]=S?Sr(a,G,u):el(G,a,u)}),B}),KL=yh(function(o,a,u){Ji(o,u,a)});function Dh(o,a){var u=at(o)?tr:L2;return u(o,qe(a,3))}function WL(o,a,u,w){return o==null?[]:(at(a)||(a=a==null?[]:[a]),u=w?r:u,at(u)||(u=u==null?[]:[u]),j2(o,a,u))}var VL=yh(function(o,a,u){o[u?0:1].push(a)},function(){return[[],[]]});function GL(o,a,u){var w=at(o)?zd:u2,S=arguments.length<3;return w(o,qe(a,4),u,S,$s)}function YL(o,a,u){var w=at(o)?a$:u2,S=arguments.length<3;return w(o,qe(a,4),u,S,O2)}function JL(o,a){var u=at(o)?Os:P2;return u(o,Ph(qe(a,3)))}function QL(o){var a=at(o)?S2:zN;return a(o)}function ZL(o,a,u){(u?Qr(o,a,u):a===r)?a=1:a=ft(a);var w=at(o)?bN:HN;return w(o,a)}function XL(o){var a=at(o)?_N:WN;return a(o)}function eB(o){if(o==null)return 0;if(ln(o))return Th(o)?Pa(o):o.length;var a=Ur(o);return a==ue||a==Fe?o.size:cp(o).length}function tB(o,a,u){var w=at(o)?Hd:VN;return u&&Qr(o,a,u)&&(a=r),w(o,qe(a,3))}var rB=gt(function(o,a){if(o==null)return[];var u=a.length;return u>1&&Qr(o,a[0],a[1])?a=[]:u>2&&Qr(a[0],a[1],a[2])&&(a=[a[0]]),j2(o,Tr(a,1),[])}),Ch=L$||function(){return It.Date.now()};function nB(o,a){if(typeof a!="function")throw new Hn(c);return o=ft(o),function(){if(--o<1)return a.apply(this,arguments)}}function Nb(o,a,u){return a=u?r:a,a=o&&a==null?o.length:a,Qi(o,g,r,r,r,r,a)}function Rb(o,a){var u;if(typeof a!="function")throw new Hn(c);return o=ft(o),function(){return--o>0&&(u=a.apply(this,arguments)),o<=1&&(a=r),u}}var Tp=gt(function(o,a,u){var w=W;if(u.length){var S=Ms(u,Ua(Tp));w|=j}return Qi(o,w,a,u,S)}),Lb=gt(function(o,a,u){var w=W|Y;if(u.length){var S=Ms(u,Ua(Lb));w|=j}return Qi(a,w,o,u,S)});function Bb(o,a,u){a=u?r:a;var w=Qi(o,z,r,r,r,r,r,a);return w.placeholder=Bb.placeholder,w}function Ub(o,a,u){a=u?r:a;var w=Qi(o,$,r,r,r,r,r,a);return w.placeholder=Ub.placeholder,w}function Fb(o,a,u){var w,S,B,G,Q,re,le=0,he=!1,ge=!1,ye=!0;if(typeof o!="function")throw new Hn(c);a=Yn(a)||0,sr(u)&&(he=!!u.leading,ge="maxWait"in u,B=ge?wr(Yn(u.maxWait)||0,a):B,ye="trailing"in u?!!u.trailing:ye);function Le(pr){var ai=w,rs=S;return w=S=r,le=pr,G=o.apply(rs,ai),G}function Ke(pr){return le=pr,Q=sl(wt,a),he?Le(pr):G}function pt(pr){var ai=pr-re,rs=pr-le,i3=a-ai;return ge?Br(i3,B-rs):i3}function We(pr){var ai=pr-re,rs=pr-le;return re===r||ai>=a||ai<0||ge&&rs>=B}function wt(){var pr=Ch();if(We(pr))return Dt(pr);Q=sl(wt,pt(pr))}function Dt(pr){return Q=r,ye&&w?Le(pr):(w=S=r,G)}function Sn(){Q!==r&&Y2(Q),le=0,w=re=S=Q=r}function Zr(){return Q===r?G:Dt(Ch())}function In(){var pr=Ch(),ai=We(pr);if(w=arguments,S=this,re=pr,ai){if(Q===r)return Ke(re);if(ge)return Y2(Q),Q=sl(wt,a),Le(re)}return Q===r&&(Q=sl(wt,a)),G}return In.cancel=Sn,In.flush=Zr,In}var iB=gt(function(o,a){return C2(o,1,a)}),sB=gt(function(o,a,u){return C2(o,Yn(a)||0,u)});function oB(o){return Qi(o,Z)}function Oh(o,a){if(typeof o!="function"||a!=null&&typeof a!="function")throw new Hn(c);var u=function(){var w=arguments,S=a?a.apply(this,w):w[0],B=u.cache;if(B.has(S))return B.get(S);var G=o.apply(this,w);return u.cache=B.set(S,G)||B,G};return u.cache=new(Oh.Cache||Yi),u}Oh.Cache=Yi;function Ph(o){if(typeof o!="function")throw new Hn(c);return function(){var a=arguments;switch(a.length){case 0:return!o.call(this);case 1:return!o.call(this,a[0]);case 2:return!o.call(this,a[0],a[1]);case 3:return!o.call(this,a[0],a[1],a[2])}return!o.apply(this,a)}}function aB(o){return Rb(2,o)}var cB=GN(function(o,a){a=a.length==1&&at(a[0])?tr(a[0],En(qe())):tr(Tr(a,1),En(qe()));var u=a.length;return gt(function(w){for(var S=-1,B=Br(w.length,u);++S<B;)w[S]=a[S].call(this,w[S]);return Sr(o,this,w)})}),$p=gt(function(o,a){var u=Ms(a,Ua($p));return Qi(o,j,r,a,u)}),jb=gt(function(o,a){var u=Ms(a,Ua(jb));return Qi(o,P,r,a,u)}),lB=Zi(function(o,a){return Qi(o,C,r,r,r,a)});function uB(o,a){if(typeof o!="function")throw new Hn(c);return a=a===r?a:ft(a),gt(o,a)}function hB(o,a){if(typeof o!="function")throw new Hn(c);return a=a==null?0:wr(ft(a),0),gt(function(u){var w=u[a],S=Ls(u,0,a);return w&&Ps(S,w),Sr(o,this,S)})}function fB(o,a,u){var w=!0,S=!0;if(typeof o!="function")throw new Hn(c);return sr(u)&&(w="leading"in u?!!u.leading:w,S="trailing"in u?!!u.trailing:S),Fb(o,a,{leading:w,maxWait:a,trailing:S})}function dB(o){return Nb(o,1)}function pB(o,a){return $p(vp(a),o)}function gB(){if(!arguments.length)return[];var o=arguments[0];return at(o)?o:[o]}function mB(o){return Wn(o,A)}function vB(o,a){return a=typeof a=="function"?a:r,Wn(o,A,a)}function yB(o){return Wn(o,_|A)}function wB(o,a){return a=typeof a=="function"?a:r,Wn(o,_|A,a)}function bB(o,a){return a==null||D2(o,a,Ir(a))}function oi(o,a){return o===a||o!==o&&a!==a}var _B=Eh(sp),EB=Eh(function(o,a){return o>=a}),Ro=$2(function(){return arguments}())?$2:function(o){return cr(o)&&qt.call(o,"callee")&&!w2.call(o,"callee")},at=se.isArray,AB=Yr?En(Yr):MN;function ln(o){return o!=null&&Mh(o.length)&&!es(o)}function dr(o){return cr(o)&&ln(o)}function xB(o){return o===!0||o===!1||cr(o)&&Jr(o)==H}var Bs=U$||Hp,SB=ni?En(ni):TN;function IB(o){return cr(o)&&o.nodeType===1&&!ol(o)}function DB(o){if(o==null)return!0;if(ln(o)&&(at(o)||typeof o=="string"||typeof o.splice=="function"||Bs(o)||Fa(o)||Ro(o)))return!o.length;var a=Ur(o);if(a==ue||a==Fe)return!o.size;if(il(o))return!cp(o).length;for(var u in o)if(qt.call(o,u))return!1;return!0}function CB(o,a){return tl(o,a)}function OB(o,a,u){u=typeof u=="function"?u:r;var w=u?u(o,a):r;return w===r?tl(o,a,r,u):!!w}function Np(o){if(!cr(o))return!1;var a=Jr(o);return a==k||a==y||typeof o.message=="string"&&typeof o.name=="string"&&!ol(o)}function PB(o){return typeof o=="number"&&_2(o)}function es(o){if(!sr(o))return!1;var a=Jr(o);return a==ie||a==fe||a==q||a==ze}function kb(o){return typeof o=="number"&&o==ft(o)}function Mh(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=N}function sr(o){var a=typeof o;return o!=null&&(a=="object"||a=="function")}function cr(o){return o!=null&&typeof o=="object"}var qb=qn?En(qn):NN;function MB(o,a){return o===a||ap(o,a,xp(a))}function TB(o,a,u){return u=typeof u=="function"?u:r,ap(o,a,xp(a),u)}function $B(o){return zb(o)&&o!=+o}function NB(o){if(vR(o))throw new it(s);return N2(o)}function RB(o){return o===null}function LB(o){return o==null}function zb(o){return typeof o=="number"||cr(o)&&Jr(o)==Oe}function ol(o){if(!cr(o)||Jr(o)!=Ie)return!1;var a=ih(o);if(a===null)return!0;var u=qt.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&eh.call(u)==T$}var Rp=Pi?En(Pi):RN;function BB(o){return kb(o)&&o>=-N&&o<=N}var Hb=Kc?En(Kc):LN;function Th(o){return typeof o=="string"||!at(o)&&cr(o)&&Jr(o)==Ee}function xn(o){return typeof o=="symbol"||cr(o)&&Jr(o)==Ae}var Fa=Do?En(Do):BN;function UB(o){return o===r}function FB(o){return cr(o)&&Ur(o)==we}function jB(o){return cr(o)&&Jr(o)==xe}var kB=Eh(lp),qB=Eh(function(o,a){return o<=a});function Kb(o){if(!o)return[];if(ln(o))return Th(o)?ii(o):cn(o);if(Vc&&o[Vc])return b$(o[Vc]());var a=Ur(o),u=a==ue?Jd:a==Fe?Qu:ja;return u(o)}function ts(o){if(!o)return o===0?o:0;if(o=Yn(o),o===M||o===-M){var a=o<0?-1:1;return a*U}return o===o?o:0}function ft(o){var a=ts(o),u=a%1;return a===a?u?a-u:a:0}function Wb(o){return o?Mo(ft(o),0,v):0}function Yn(o){if(typeof o=="number")return o;if(xn(o))return O;if(sr(o)){var a=typeof o.valueOf=="function"?o.valueOf():o;o=sr(a)?a+"":a}if(typeof o!="string")return o===0?o:+o;o=h2(o);var u=Un.test(o);return u||jn.test(o)?ot(o.slice(2),u?2:8):Bn.test(o)?O:+o}function Vb(o){return Ti(o,un(o))}function zB(o){return o?Mo(ft(o),-N,N):o===0?o:0}function Bt(o){return o==null?"":An(o)}var HB=La(function(o,a){if(il(a)||ln(a)){Ti(a,Ir(a),o);return}for(var u in a)qt.call(a,u)&&Zc(o,u,a[u])}),Gb=La(function(o,a){Ti(a,un(a),o)}),$h=La(function(o,a,u,w){Ti(a,un(a),o,w)}),KB=La(function(o,a,u,w){Ti(a,Ir(a),o,w)}),WB=Zi(rp);function VB(o,a){var u=Ra(o);return a==null?u:I2(u,a)}var GB=gt(function(o,a){o=Yt(o);var u=-1,w=a.length,S=w>2?a[2]:r;for(S&&Qr(a[0],a[1],S)&&(w=1);++u<w;)for(var B=a[u],G=un(B),Q=-1,re=G.length;++Q<re;){var le=G[Q],he=o[le];(he===r||oi(he,Ta[le])&&!qt.call(o,le))&&(o[le]=B[le])}return o}),YB=gt(function(o){return o.push(r,hb),Sr(Yb,r,o)});function JB(o,a){return a2(o,qe(a,3),Mi)}function QB(o,a){return a2(o,qe(a,3),ip)}function ZB(o,a){return o==null?o:np(o,qe(a,3),un)}function XB(o,a){return o==null?o:M2(o,qe(a,3),un)}function eU(o,a){return o&&Mi(o,qe(a,3))}function tU(o,a){return o&&ip(o,qe(a,3))}function rU(o){return o==null?[]:ph(o,Ir(o))}function nU(o){return o==null?[]:ph(o,un(o))}function Lp(o,a,u){var w=o==null?r:To(o,a);return w===r?u:w}function iU(o,a){return o!=null&&pb(o,a,DN)}function Bp(o,a){return o!=null&&pb(o,a,CN)}var sU=ob(function(o,a,u){a!=null&&typeof a.toString!="function"&&(a=th.call(a)),o[a]=u},Fp(hn)),oU=ob(function(o,a,u){a!=null&&typeof a.toString!="function"&&(a=th.call(a)),qt.call(o,a)?o[a].push(u):o[a]=[u]},qe),aU=gt(el);function Ir(o){return ln(o)?x2(o):cp(o)}function un(o){return ln(o)?x2(o,!0):UN(o)}function cU(o,a){var u={};return a=qe(a,3),Mi(o,function(w,S,B){Ji(u,a(w,S,B),w)}),u}function lU(o,a){var u={};return a=qe(a,3),Mi(o,function(w,S,B){Ji(u,S,a(w,S,B))}),u}var uU=La(function(o,a,u){gh(o,a,u)}),Yb=La(function(o,a,u,w){gh(o,a,u,w)}),hU=Zi(function(o,a){var u={};if(o==null)return u;var w=!1;a=tr(a,function(B){return B=Rs(B,o),w||(w=B.length>1),B}),Ti(o,Ep(o),u),w&&(u=Wn(u,_|E|A,sR));for(var S=a.length;S--;)pp(u,a[S]);return u});function fU(o,a){return Jb(o,Ph(qe(a)))}var dU=Zi(function(o,a){return o==null?{}:jN(o,a)});function Jb(o,a){if(o==null)return{};var u=tr(Ep(o),function(w){return[w]});return a=qe(a),k2(o,u,function(w,S){return a(w,S[0])})}function pU(o,a,u){a=Rs(a,o);var w=-1,S=a.length;for(S||(S=1,o=r);++w<S;){var B=o==null?r:o[$i(a[w])];B===r&&(w=S,B=u),o=es(B)?B.call(o):B}return o}function gU(o,a,u){return o==null?o:rl(o,a,u)}function mU(o,a,u,w){return w=typeof w=="function"?w:r,o==null?o:rl(o,a,u,w)}var Qb=lb(Ir),Zb=lb(un);function vU(o,a,u){var w=at(o),S=w||Bs(o)||Fa(o);if(a=qe(a,4),u==null){var B=o&&o.constructor;S?u=w?new B:[]:sr(o)?u=es(B)?Ra(ih(o)):{}:u={}}return(S?zn:Mi)(o,function(G,Q,re){return a(u,G,Q,re)}),u}function yU(o,a){return o==null?!0:pp(o,a)}function wU(o,a,u){return o==null?o:W2(o,a,vp(u))}function bU(o,a,u,w){return w=typeof w=="function"?w:r,o==null?o:W2(o,a,vp(u),w)}function ja(o){return o==null?[]:Yd(o,Ir(o))}function _U(o){return o==null?[]:Yd(o,un(o))}function EU(o,a,u){return u===r&&(u=a,a=r),u!==r&&(u=Yn(u),u=u===u?u:0),a!==r&&(a=Yn(a),a=a===a?a:0),Mo(Yn(o),a,u)}function AU(o,a,u){return a=ts(a),u===r?(u=a,a=0):u=ts(u),o=Yn(o),ON(o,a,u)}function xU(o,a,u){if(u&&typeof u!="boolean"&&Qr(o,a,u)&&(a=u=r),u===r&&(typeof a=="boolean"?(u=a,a=r):typeof o=="boolean"&&(u=o,o=r)),o===r&&a===r?(o=0,a=1):(o=ts(o),a===r?(a=o,o=0):a=ts(a)),o>a){var w=o;o=a,a=w}if(u||o%1||a%1){var S=E2();return Br(o+S*(a-o+Vt("1e-"+((S+"").length-1))),a)}return hp(o,a)}var SU=Ba(function(o,a,u){return a=a.toLowerCase(),o+(u?Xb(a):a)});function Xb(o){return Up(Bt(o).toLowerCase())}function e3(o){return o=Bt(o),o&&o.replace(xr,g$).replace(jd,"")}function IU(o,a,u){o=Bt(o),a=An(a);var w=o.length;u=u===r?w:Mo(ft(u),0,w);var S=u;return u-=a.length,u>=0&&o.slice(u,S)==a}function DU(o){return o=Bt(o),o&&He.test(o)?o.replace(Vr,m$):o}function CU(o){return o=Bt(o),o&&tt.test(o)?o.replace(Lt,"\\$&"):o}var OU=Ba(function(o,a,u){return o+(u?"-":"")+a.toLowerCase()}),PU=Ba(function(o,a,u){return o+(u?" ":"")+a.toLowerCase()}),MU=nb("toLowerCase");function TU(o,a,u){o=Bt(o),a=ft(a);var w=a?Pa(o):0;if(!a||w>=a)return o;var S=(a-w)/2;return _h(ch(S),u)+o+_h(ah(S),u)}function $U(o,a,u){o=Bt(o),a=ft(a);var w=a?Pa(o):0;return a&&w<a?o+_h(a-w,u):o}function NU(o,a,u){o=Bt(o),a=ft(a);var w=a?Pa(o):0;return a&&w<a?_h(a-w,u)+o:o}function RU(o,a,u){return u||a==null?a=0:a&&(a=+a),q$(Bt(o).replace(Qe,""),a||0)}function LU(o,a,u){return(u?Qr(o,a,u):a===r)?a=1:a=ft(a),fp(Bt(o),a)}function BU(){var o=arguments,a=Bt(o[0]);return o.length<3?a:a.replace(o[1],o[2])}var UU=Ba(function(o,a,u){return o+(u?"_":"")+a.toLowerCase()});function FU(o,a,u){return u&&typeof u!="number"&&Qr(o,a,u)&&(a=u=r),u=u===r?v:u>>>0,u?(o=Bt(o),o&&(typeof a=="string"||a!=null&&!Rp(a))&&(a=An(a),!a&&Oa(o))?Ls(ii(o),0,u):o.split(a,u)):[]}var jU=Ba(function(o,a,u){return o+(u?" ":"")+Up(a)});function kU(o,a,u){return o=Bt(o),u=u==null?0:Mo(ft(u),0,o.length),a=An(a),o.slice(u,u+a.length)==a}function qU(o,a,u){var w=T.templateSettings;u&&Qr(o,a,u)&&(a=r),o=Bt(o),a=$h({},a,w,ub);var S=$h({},a.imports,w.imports,ub),B=Ir(S),G=Yd(S,B),Q,re,le=0,he=a.interpolate||Ii,ge="__p += '",ye=Qd((a.escape||Ii).source+"|"+he.source+"|"+(he===Ve?kt:Ii).source+"|"+(a.evaluate||Ii).source+"|$","g"),Le="//# sourceURL="+(qt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++kd+"]")+`
79
- `;o.replace(ye,function(We,wt,Dt,Sn,Zr,In){return Dt||(Dt=Sn),ge+=o.slice(le,In).replace(mo,v$),wt&&(Q=!0,ge+=`' +
80
- __e(`+wt+`) +
81
- '`),Zr&&(re=!0,ge+=`';
65
+ `)}function XN(s){return at(s)||To(s)||!!(g2&&s&&s[g2])}function es(s,a){var u=typeof s;return a=a??$,!!a&&(u=="number"||u!="symbol"&&jn.test(s))&&s>-1&&s%1==0&&s<a}function Qr(s,a,u){if(!sr(u))return!1;var y=typeof a;return(y=="number"?hn(u)&&es(a,u.length):y=="string"&&a in u)?si(u[a],s):!1}function Sp(s,a){if(at(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||xn(s)?!0:Xe.test(s)||!Mt.test(s)||a!=null&&s in Yt(a)}function eR(s){var a=typeof s;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?s!=="__proto__":s===null}function Dp(s){var a=Sh(s),u=M[a];if(typeof u!="function"||!(a in At.prototype))return!1;if(s===u)return!0;var y=Ap(u);return!!y&&s===y[0]}function tR(s){return!!h2&&h2 in s}var rR=rh?ts:Hp;function il(s){var a=s&&s.constructor,u=typeof a=="function"&&a.prototype||Ta;return s===u}function hb(s){return s===s&&!sr(s)}function fb(s,a){return function(u){return u==null?!1:u[s]===a&&(a!==r||s in Yt(u))}}function nR(s){var a=Th(s,function(y){return u.size===h&&u.clear(),y}),u=a.cache;return a}function iR(s,a){var u=s[1],y=a[1],I=u|y,R=I<(W|Y|m),G=y==m&&u==z||y==m&&u==T&&s[7].length<=a[8]||y==(m|T)&&a[7].length<=a[8]&&u==z;if(!(R||G))return s;y&W&&(s[2]=a[2],I|=u&W?0:B);var J=a[3];if(J){var X=s[3];s[3]=X?G2(X,J,a[4]):J,s[4]=X?Ms(s[3],g):a[4]}return J=a[5],J&&(X=s[5],s[5]=X?Y2(X,J,a[6]):J,s[6]=X?Ms(s[5],g):a[6]),J=a[7],J&&(s[7]=J),y&m&&(s[8]=s[8]==null?a[8]:Br(s[8],a[8])),s[9]==null&&(s[9]=a[9]),s[0]=a[0],s[1]=I,s}function sR(s){var a=[];if(s!=null)for(var u in Yt(s))a.push(u);return a}function oR(s){return ih.call(s)}function db(s,a,u){return a=yr(a===r?s.length-1:a,0),function(){for(var y=arguments,I=-1,R=yr(y.length-a,0),G=se(R);++I<R;)G[I]=y[a+I];I=-1;for(var J=se(a+1);++I<a;)J[I]=y[I];return J[a]=u(G),Ir(s,this,J)}}function pb(s,a){return a.length<2?s:Oo(s,Wn(a,0,-1))}function aR(s,a){for(var u=s.length,y=Br(a.length,u),I=un(s);y--;){var R=a[y];s[y]=es(R,u)?I[R]:r}return s}function Cp(s,a){if(!(a==="constructor"&&typeof s[a]=="function")&&a!="__proto__")return s[a]}var gb=vb(U2),sl=E$||function(s,a){return St.setTimeout(s,a)},Op=vb(PN);function mb(s,a,u){var y=a+"";return Op(s,ZN(y,cR(YN(y),u)))}function vb(s){var a=0,u=0;return function(){var y=S$(),I=d-(y-u);if(u=y,I>0){if(++a>=fe)return arguments[0]}else a=0;return s.apply(r,arguments)}}function Ch(s,a){var u=-1,y=s.length,I=y-1;for(a=a===r?y:a;++u<a;){var R=hp(u,I),G=s[R];s[R]=s[u],s[u]=G}return s.length=a,s}var wb=nR(function(s){var a=[];return s.charCodeAt(0)===46&&a.push(""),s.replace(et,function(u,y,I,R){a.push(I?R.replace(ti,"$1"):y||u)}),a});function Ni(s){if(typeof s=="string"||xn(s))return s;var a=s+"";return a=="0"&&1/s==-O?"-0":a}function Mo(s){if(s!=null){try{return nh.call(s)}catch{}try{return s+""}catch{}}return""}function cR(s,a){return qn(pe,function(u){var y="_."+u[0];a&u[1]&&!Zu(s,y)&&s.push(y)}),s.sort()}function yb(s){if(s instanceof At)return s.clone();var a=new Hn(s.__wrapped__,s.__chain__);return a.__actions__=un(s.__actions__),a.__index__=s.__index__,a.__values__=s.__values__,a}function lR(s,a,u){(u?Qr(s,a,u):a===r)?a=1:a=yr(ft(a),0);var y=s==null?0:s.length;if(!y||a<1)return[];for(var I=0,R=0,G=se(uh(y/a));I<y;)G[R++]=Wn(s,I,I+=a);return G}function uR(s){for(var a=-1,u=s==null?0:s.length,y=0,I=[];++a<u;){var R=s[a];R&&(I[y++]=R)}return I}function hR(){var s=arguments.length;if(!s)return[];for(var a=se(s-1),u=arguments[0],y=s;y--;)a[y-1]=arguments[y];return Ps(at(u)?un(u):[u],Tr(a,1))}var fR=gt(function(s,a){return dr(s)?Xc(s,Tr(a,1,dr,!0)):[]}),dR=gt(function(s,a){var u=Vn(a);return dr(u)&&(u=r),dr(s)?Xc(s,Tr(a,1,dr,!0),qe(u,2)):[]}),pR=gt(function(s,a){var u=Vn(a);return dr(u)&&(u=r),dr(s)?Xc(s,Tr(a,1,dr,!0),r,u):[]});function gR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:ft(a),Wn(s,a<0?0:a,y)):[]}function mR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:ft(a),a=y-a,Wn(s,0,a<0?0:a)):[]}function vR(s,a){return s&&s.length?bh(s,qe(a,3),!0,!0):[]}function wR(s,a){return s&&s.length?bh(s,qe(a,3),!0):[]}function yR(s,a,u,y){var I=s==null?0:s.length;return I?(u&&typeof u!="number"&&Qr(s,a,u)&&(u=0,y=I),hN(s,a,u,y)):[]}function bb(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var I=u==null?0:ft(u);return I<0&&(I=yr(y+I,0)),Xu(s,qe(a,3),I)}function _b(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var I=y-1;return u!==r&&(I=ft(u),I=u<0?yr(y+I,0):Br(I,y-1)),Xu(s,qe(a,3),I,!0)}function Eb(s){var a=s==null?0:s.length;return a?Tr(s,1):[]}function bR(s){var a=s==null?0:s.length;return a?Tr(s,O):[]}function _R(s,a){var u=s==null?0:s.length;return u?(a=a===r?1:ft(a),Tr(s,a)):[]}function ER(s){for(var a=-1,u=s==null?0:s.length,y={};++a<u;){var I=s[a];y[I[0]]=I[1]}return y}function Ab(s){return s&&s.length?s[0]:r}function AR(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var I=u==null?0:ft(u);return I<0&&(I=yr(y+I,0)),Ca(s,a,I)}function xR(s){var a=s==null?0:s.length;return a?Wn(s,0,-1):[]}var IR=gt(function(s){var a=tr(s,mp);return a.length&&a[0]===s[0]?op(a):[]}),SR=gt(function(s){var a=Vn(s),u=tr(s,mp);return a===Vn(u)?a=r:u.pop(),u.length&&u[0]===s[0]?op(u,qe(a,2)):[]}),DR=gt(function(s){var a=Vn(s),u=tr(s,mp);return a=typeof a=="function"?a:r,a&&u.pop(),u.length&&u[0]===s[0]?op(u,r,a):[]});function CR(s,a){return s==null?"":x$.call(s,a)}function Vn(s){var a=s==null?0:s.length;return a?s[a-1]:r}function OR(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var I=y;return u!==r&&(I=ft(u),I=I<0?yr(y+I,0):Br(I,y-1)),a===a?c$(s,a,I):Xu(s,n2,I,!0)}function PR(s,a){return s&&s.length?N2(s,ft(a)):r}var MR=gt(xb);function xb(s,a){return s&&s.length&&a&&a.length?up(s,a):s}function TR(s,a,u){return s&&s.length&&a&&a.length?up(s,a,qe(u,2)):s}function $R(s,a,u){return s&&s.length&&a&&a.length?up(s,a,r,u):s}var NR=Xi(function(s,a){var u=s==null?0:s.length,y=rp(s,a);return B2(s,tr(a,function(I){return es(I,u)?+I:I}).sort(V2)),y});function RR(s,a){var u=[];if(!(s&&s.length))return u;var y=-1,I=[],R=s.length;for(a=qe(a,3);++y<R;){var G=s[y];a(G,y,s)&&(u.push(G),I.push(y))}return B2(s,I),u}function Pp(s){return s==null?s:C$.call(s)}function LR(s,a,u){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&Qr(s,a,u)?(a=0,u=y):(a=a==null?0:ft(a),u=u===r?y:ft(u)),Wn(s,a,u)):[]}function BR(s,a){return yh(s,a)}function UR(s,a,u){return dp(s,a,qe(u,2))}function FR(s,a){var u=s==null?0:s.length;if(u){var y=yh(s,a);if(y<u&&si(s[y],a))return y}return-1}function jR(s,a){return yh(s,a,!0)}function kR(s,a,u){return dp(s,a,qe(u,2),!0)}function qR(s,a){var u=s==null?0:s.length;if(u){var y=yh(s,a,!0)-1;if(si(s[y],a))return y}return-1}function zR(s){return s&&s.length?F2(s):[]}function HR(s,a){return s&&s.length?F2(s,qe(a,2)):[]}function KR(s){var a=s==null?0:s.length;return a?Wn(s,1,a):[]}function WR(s,a,u){return s&&s.length?(a=u||a===r?1:ft(a),Wn(s,0,a<0?0:a)):[]}function VR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:ft(a),a=y-a,Wn(s,a<0?0:a,y)):[]}function GR(s,a){return s&&s.length?bh(s,qe(a,3),!1,!0):[]}function YR(s,a){return s&&s.length?bh(s,qe(a,3)):[]}var JR=gt(function(s){return Ns(Tr(s,1,dr,!0))}),QR=gt(function(s){var a=Vn(s);return dr(a)&&(a=r),Ns(Tr(s,1,dr,!0),qe(a,2))}),ZR=gt(function(s){var a=Vn(s);return a=typeof a=="function"?a:r,Ns(Tr(s,1,dr,!0),r,a)});function XR(s){return s&&s.length?Ns(s):[]}function eL(s,a){return s&&s.length?Ns(s,qe(a,2)):[]}function tL(s,a){return a=typeof a=="function"?a:r,s&&s.length?Ns(s,r,a):[]}function Mp(s){if(!(s&&s.length))return[];var a=0;return s=Os(s,function(u){if(dr(u))return a=yr(u.length,a),!0}),Gd(a,function(u){return tr(s,Kd(u))})}function Ib(s,a){if(!(s&&s.length))return[];var u=Mp(s);return a==null?u:tr(u,function(y){return Ir(a,r,y)})}var rL=gt(function(s,a){return dr(s)?Xc(s,a):[]}),nL=gt(function(s){return gp(Os(s,dr))}),iL=gt(function(s){var a=Vn(s);return dr(a)&&(a=r),gp(Os(s,dr),qe(a,2))}),sL=gt(function(s){var a=Vn(s);return a=typeof a=="function"?a:r,gp(Os(s,dr),r,a)}),oL=gt(Mp);function aL(s,a){return z2(s||[],a||[],Zc)}function cL(s,a){return z2(s||[],a||[],rl)}var lL=gt(function(s){var a=s.length,u=a>1?s[a-1]:r;return u=typeof u=="function"?(s.pop(),u):r,Ib(s,u)});function Sb(s){var a=M(s);return a.__chain__=!0,a}function uL(s,a){return a(s),s}function Oh(s,a){return a(s)}var hL=Xi(function(s){var a=s.length,u=a?s[0]:0,y=this.__wrapped__,I=function(R){return rp(R,s)};return a>1||this.__actions__.length||!(y instanceof At)||!es(u)?this.thru(I):(y=y.slice(u,+u+(a?1:0)),y.__actions__.push({func:Oh,args:[I],thisArg:r}),new Hn(y,this.__chain__).thru(function(R){return a&&!R.length&&R.push(r),R}))});function fL(){return Sb(this)}function dL(){return new Hn(this.value(),this.__chain__)}function pL(){this.__values__===r&&(this.__values__=jb(this.value()));var s=this.__index__>=this.__values__.length,a=s?r:this.__values__[this.__index__++];return{done:s,value:a}}function gL(){return this}function mL(s){for(var a,u=this;u instanceof ph;){var y=yb(u);y.__index__=0,y.__values__=r,a?I.__wrapped__=y:a=y;var I=y;u=u.__wrapped__}return I.__wrapped__=s,a}function vL(){var s=this.__wrapped__;if(s instanceof At){var a=s;return this.__actions__.length&&(a=new At(this)),a=a.reverse(),a.__actions__.push({func:Oh,args:[Pp],thisArg:r}),new Hn(a,this.__chain__)}return this.thru(Pp)}function wL(){return q2(this.__wrapped__,this.__actions__)}var yL=_h(function(s,a,u){qt.call(s,u)?++s[u]:Qi(s,u,1)});function bL(s,a,u){var y=at(s)?t2:uN;return u&&Qr(s,a,u)&&(a=r),y(s,qe(a,3))}function _L(s,a){var u=at(s)?Os:I2;return u(s,qe(a,3))}var EL=X2(bb),AL=X2(_b);function xL(s,a){return Tr(Ph(s,a),1)}function IL(s,a){return Tr(Ph(s,a),O)}function SL(s,a,u){return u=u===r?1:ft(u),Tr(Ph(s,a),u)}function Db(s,a){var u=at(s)?qn:$s;return u(s,qe(a,3))}function Cb(s,a){var u=at(s)?KT:x2;return u(s,qe(a,3))}var DL=_h(function(s,a,u){qt.call(s,u)?s[u].push(a):Qi(s,u,[a])});function CL(s,a,u,y){s=hn(s)?s:ja(s),u=u&&!y?ft(u):0;var I=s.length;return u<0&&(u=yr(I+u,0)),Rh(s)?u<=I&&s.indexOf(a,u)>-1:!!I&&Ca(s,a,u)>-1}var OL=gt(function(s,a,u){var y=-1,I=typeof a=="function",R=hn(s)?se(s.length):[];return $s(s,function(G){R[++y]=I?Ir(a,G,u):el(G,a,u)}),R}),PL=_h(function(s,a,u){Qi(s,u,a)});function Ph(s,a){var u=at(s)?tr:M2;return u(s,qe(a,3))}function ML(s,a,u,y){return s==null?[]:(at(a)||(a=a==null?[]:[a]),u=y?r:u,at(u)||(u=u==null?[]:[u]),R2(s,a,u))}var TL=_h(function(s,a,u){s[u?0:1].push(a)},function(){return[[],[]]});function $L(s,a,u){var y=at(s)?zd:s2,I=arguments.length<3;return y(s,qe(a,4),u,I,$s)}function NL(s,a,u){var y=at(s)?WT:s2,I=arguments.length<3;return y(s,qe(a,4),u,I,x2)}function RL(s,a){var u=at(s)?Os:I2;return u(s,$h(qe(a,3)))}function LL(s){var a=at(s)?b2:CN;return a(s)}function BL(s,a,u){(u?Qr(s,a,u):a===r)?a=1:a=ft(a);var y=at(s)?sN:ON;return y(s,a)}function UL(s){var a=at(s)?oN:MN;return a(s)}function FL(s){if(s==null)return 0;if(hn(s))return Rh(s)?Pa(s):s.length;var a=Ur(s);return a==le||a==Fe?s.size:cp(s).length}function jL(s,a,u){var y=at(s)?Hd:TN;return u&&Qr(s,a,u)&&(a=r),y(s,qe(a,3))}var kL=gt(function(s,a){if(s==null)return[];var u=a.length;return u>1&&Qr(s,a[0],a[1])?a=[]:u>2&&Qr(a[0],a[1],a[2])&&(a=[a[0]]),R2(s,Tr(a,1),[])}),Mh=_$||function(){return St.Date.now()};function qL(s,a){if(typeof a!="function")throw new zn(c);return s=ft(s),function(){if(--s<1)return a.apply(this,arguments)}}function Ob(s,a,u){return a=u?r:a,a=s&&a==null?s.length:a,Zi(s,m,r,r,r,r,a)}function Pb(s,a){var u;if(typeof a!="function")throw new zn(c);return s=ft(s),function(){return--s>0&&(u=a.apply(this,arguments)),s<=1&&(a=r),u}}var Tp=gt(function(s,a,u){var y=W;if(u.length){var I=Ms(u,Ua(Tp));y|=F}return Zi(s,y,a,u,I)}),Mb=gt(function(s,a,u){var y=W|Y;if(u.length){var I=Ms(u,Ua(Mb));y|=F}return Zi(a,y,s,u,I)});function Tb(s,a,u){a=u?r:a;var y=Zi(s,z,r,r,r,r,r,a);return y.placeholder=Tb.placeholder,y}function $b(s,a,u){a=u?r:a;var y=Zi(s,P,r,r,r,r,r,a);return y.placeholder=$b.placeholder,y}function Nb(s,a,u){var y,I,R,G,J,X,ce=0,ue=!1,ge=!1,we=!0;if(typeof s!="function")throw new zn(c);a=Gn(a)||0,sr(u)&&(ue=!!u.leading,ge="maxWait"in u,R=ge?yr(Gn(u.maxWait)||0,a):R,we="trailing"in u?!!u.trailing:we);function Le(pr){var oi=y,ns=I;return y=I=r,ce=pr,G=s.apply(ns,oi),G}function Ke(pr){return ce=pr,J=sl(yt,a),ue?Le(pr):G}function pt(pr){var oi=pr-X,ns=pr-ce,Xb=a-oi;return ge?Br(Xb,R-ns):Xb}function We(pr){var oi=pr-X,ns=pr-ce;return X===r||oi>=a||oi<0||ge&&ns>=R}function yt(){var pr=Mh();if(We(pr))return Dt(pr);J=sl(yt,pt(pr))}function Dt(pr){return J=r,we&&y?Le(pr):(y=I=r,G)}function In(){J!==r&&H2(J),ce=0,y=X=I=J=r}function Zr(){return J===r?G:Dt(Mh())}function Sn(){var pr=Mh(),oi=We(pr);if(y=arguments,I=this,X=pr,oi){if(J===r)return Ke(X);if(ge)return H2(J),J=sl(yt,a),Le(X)}return J===r&&(J=sl(yt,a)),G}return Sn.cancel=In,Sn.flush=Zr,Sn}var zL=gt(function(s,a){return A2(s,1,a)}),HL=gt(function(s,a,u){return A2(s,Gn(a)||0,u)});function KL(s){return Zi(s,te)}function Th(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new zn(c);var u=function(){var y=arguments,I=a?a.apply(this,y):y[0],R=u.cache;if(R.has(I))return R.get(I);var G=s.apply(this,y);return u.cache=R.set(I,G)||R,G};return u.cache=new(Th.Cache||Ji),u}Th.Cache=Ji;function $h(s){if(typeof s!="function")throw new zn(c);return function(){var a=arguments;switch(a.length){case 0:return!s.call(this);case 1:return!s.call(this,a[0]);case 2:return!s.call(this,a[0],a[1]);case 3:return!s.call(this,a[0],a[1],a[2])}return!s.apply(this,a)}}function WL(s){return Pb(2,s)}var VL=$N(function(s,a){a=a.length==1&&at(a[0])?tr(a[0],En(qe())):tr(Tr(a,1),En(qe()));var u=a.length;return gt(function(y){for(var I=-1,R=Br(y.length,u);++I<R;)y[I]=a[I].call(this,y[I]);return Ir(s,this,y)})}),$p=gt(function(s,a){var u=Ms(a,Ua($p));return Zi(s,F,r,a,u)}),Rb=gt(function(s,a){var u=Ms(a,Ua(Rb));return Zi(s,j,r,a,u)}),GL=Xi(function(s,a){return Zi(s,T,r,r,r,a)});function YL(s,a){if(typeof s!="function")throw new zn(c);return a=a===r?a:ft(a),gt(s,a)}function JL(s,a){if(typeof s!="function")throw new zn(c);return a=a==null?0:yr(ft(a),0),gt(function(u){var y=u[a],I=Ls(u,0,a);return y&&Ps(I,y),Ir(s,this,I)})}function QL(s,a,u){var y=!0,I=!0;if(typeof s!="function")throw new zn(c);return sr(u)&&(y="leading"in u?!!u.leading:y,I="trailing"in u?!!u.trailing:I),Nb(s,a,{leading:y,maxWait:a,trailing:I})}function ZL(s){return Ob(s,1)}function XL(s,a){return $p(vp(a),s)}function eB(){if(!arguments.length)return[];var s=arguments[0];return at(s)?s:[s]}function tB(s){return Kn(s,A)}function rB(s,a){return a=typeof a=="function"?a:r,Kn(s,A,a)}function nB(s){return Kn(s,_|A)}function iB(s,a){return a=typeof a=="function"?a:r,Kn(s,_|A,a)}function sB(s,a){return a==null||E2(s,a,Sr(a))}function si(s,a){return s===a||s!==s&&a!==a}var oB=Ih(sp),aB=Ih(function(s,a){return s>=a}),To=C2(function(){return arguments}())?C2:function(s){return cr(s)&&qt.call(s,"callee")&&!p2.call(s,"callee")},at=se.isArray,cB=Yr?En(Yr):mN;function hn(s){return s!=null&&Nh(s.length)&&!ts(s)}function dr(s){return cr(s)&&hn(s)}function lB(s){return s===!0||s===!1||cr(s)&&Jr(s)==H}var Bs=A$||Hp,uB=ri?En(ri):vN;function hB(s){return cr(s)&&s.nodeType===1&&!ol(s)}function fB(s){if(s==null)return!0;if(hn(s)&&(at(s)||typeof s=="string"||typeof s.splice=="function"||Bs(s)||Fa(s)||To(s)))return!s.length;var a=Ur(s);if(a==le||a==Fe)return!s.size;if(il(s))return!cp(s).length;for(var u in s)if(qt.call(s,u))return!1;return!0}function dB(s,a){return tl(s,a)}function pB(s,a,u){u=typeof u=="function"?u:r;var y=u?u(s,a):r;return y===r?tl(s,a,r,u):!!y}function Np(s){if(!cr(s))return!1;var a=Jr(s);return a==k||a==w||typeof s.message=="string"&&typeof s.name=="string"&&!ol(s)}function gB(s){return typeof s=="number"&&m2(s)}function ts(s){if(!sr(s))return!1;var a=Jr(s);return a==ie||a==he||a==q||a==ze}function Lb(s){return typeof s=="number"&&s==ft(s)}function Nh(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=$}function sr(s){var a=typeof s;return s!=null&&(a=="object"||a=="function")}function cr(s){return s!=null&&typeof s=="object"}var Bb=kn?En(kn):yN;function mB(s,a){return s===a||ap(s,a,xp(a))}function vB(s,a,u){return u=typeof u=="function"?u:r,ap(s,a,xp(a),u)}function wB(s){return Ub(s)&&s!=+s}function yB(s){if(rR(s))throw new it(o);return O2(s)}function bB(s){return s===null}function _B(s){return s==null}function Ub(s){return typeof s=="number"||cr(s)&&Jr(s)==Oe}function ol(s){if(!cr(s)||Jr(s)!=Se)return!1;var a=ah(s);if(a===null)return!0;var u=qt.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&nh.call(u)==v$}var Rp=Mi?En(Mi):bN;function EB(s){return Lb(s)&&s>=-$&&s<=$}var Fb=Kc?En(Kc):_N;function Rh(s){return typeof s=="string"||!at(s)&&cr(s)&&Jr(s)==Ee}function xn(s){return typeof s=="symbol"||cr(s)&&Jr(s)==Ae}var Fa=xo?En(xo):EN;function AB(s){return s===r}function xB(s){return cr(s)&&Ur(s)==ye}function IB(s){return cr(s)&&Jr(s)==xe}var SB=Ih(lp),DB=Ih(function(s,a){return s<=a});function jb(s){if(!s)return[];if(hn(s))return Rh(s)?ni(s):un(s);if(Vc&&s[Vc])return s$(s[Vc]());var a=Ur(s),u=a==le?Jd:a==Fe?eh:ja;return u(s)}function rs(s){if(!s)return s===0?s:0;if(s=Gn(s),s===O||s===-O){var a=s<0?-1:1;return a*L}return s===s?s:0}function ft(s){var a=rs(s),u=a%1;return a===a?u?a-u:a:0}function kb(s){return s?Co(ft(s),0,v):0}function Gn(s){if(typeof s=="number")return s;if(xn(s))return C;if(sr(s)){var a=typeof s.valueOf=="function"?s.valueOf():s;s=sr(a)?a+"":a}if(typeof s!="string")return s===0?s:+s;s=o2(s);var u=Bn.test(s);return u||Fn.test(s)?ot(s.slice(2),u?2:8):Ln.test(s)?C:+s}function qb(s){return $i(s,fn(s))}function CB(s){return s?Co(ft(s),-$,$):s===0?s:0}function Bt(s){return s==null?"":An(s)}var OB=La(function(s,a){if(il(a)||hn(a)){$i(a,Sr(a),s);return}for(var u in a)qt.call(a,u)&&Zc(s,u,a[u])}),zb=La(function(s,a){$i(a,fn(a),s)}),Lh=La(function(s,a,u,y){$i(a,fn(a),s,y)}),PB=La(function(s,a,u,y){$i(a,Sr(a),s,y)}),MB=Xi(rp);function TB(s,a){var u=Ra(s);return a==null?u:_2(u,a)}var $B=gt(function(s,a){s=Yt(s);var u=-1,y=a.length,I=y>2?a[2]:r;for(I&&Qr(a[0],a[1],I)&&(y=1);++u<y;)for(var R=a[u],G=fn(R),J=-1,X=G.length;++J<X;){var ce=G[J],ue=s[ce];(ue===r||si(ue,Ta[ce])&&!qt.call(s,ce))&&(s[ce]=R[ce])}return s}),NB=gt(function(s){return s.push(r,ob),Ir(Hb,r,s)});function RB(s,a){return r2(s,qe(a,3),Ti)}function LB(s,a){return r2(s,qe(a,3),ip)}function BB(s,a){return s==null?s:np(s,qe(a,3),fn)}function UB(s,a){return s==null?s:S2(s,qe(a,3),fn)}function FB(s,a){return s&&Ti(s,qe(a,3))}function jB(s,a){return s&&ip(s,qe(a,3))}function kB(s){return s==null?[]:vh(s,Sr(s))}function qB(s){return s==null?[]:vh(s,fn(s))}function Lp(s,a,u){var y=s==null?r:Oo(s,a);return y===r?u:y}function zB(s,a){return s!=null&&lb(s,a,fN)}function Bp(s,a){return s!=null&&lb(s,a,dN)}var HB=tb(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=ih.call(a)),s[a]=u},Fp(dn)),KB=tb(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=ih.call(a)),qt.call(s,a)?s[a].push(u):s[a]=[u]},qe),WB=gt(el);function Sr(s){return hn(s)?y2(s):cp(s)}function fn(s){return hn(s)?y2(s,!0):AN(s)}function VB(s,a){var u={};return a=qe(a,3),Ti(s,function(y,I,R){Qi(u,a(y,I,R),y)}),u}function GB(s,a){var u={};return a=qe(a,3),Ti(s,function(y,I,R){Qi(u,I,a(y,I,R))}),u}var YB=La(function(s,a,u){wh(s,a,u)}),Hb=La(function(s,a,u,y){wh(s,a,u,y)}),JB=Xi(function(s,a){var u={};if(s==null)return u;var y=!1;a=tr(a,function(R){return R=Rs(R,s),y||(y=R.length>1),R}),$i(s,Ep(s),u),y&&(u=Kn(u,_|E|A,HN));for(var I=a.length;I--;)pp(u,a[I]);return u});function QB(s,a){return Kb(s,$h(qe(a)))}var ZB=Xi(function(s,a){return s==null?{}:IN(s,a)});function Kb(s,a){if(s==null)return{};var u=tr(Ep(s),function(y){return[y]});return a=qe(a),L2(s,u,function(y,I){return a(y,I[0])})}function XB(s,a,u){a=Rs(a,s);var y=-1,I=a.length;for(I||(I=1,s=r);++y<I;){var R=s==null?r:s[Ni(a[y])];R===r&&(y=I,R=u),s=ts(R)?R.call(s):R}return s}function eU(s,a,u){return s==null?s:rl(s,a,u)}function tU(s,a,u,y){return y=typeof y=="function"?y:r,s==null?s:rl(s,a,u,y)}var Wb=ib(Sr),Vb=ib(fn);function rU(s,a,u){var y=at(s),I=y||Bs(s)||Fa(s);if(a=qe(a,4),u==null){var R=s&&s.constructor;I?u=y?new R:[]:sr(s)?u=ts(R)?Ra(ah(s)):{}:u={}}return(I?qn:Ti)(s,function(G,J,X){return a(u,G,J,X)}),u}function nU(s,a){return s==null?!0:pp(s,a)}function iU(s,a,u){return s==null?s:k2(s,a,vp(u))}function sU(s,a,u,y){return y=typeof y=="function"?y:r,s==null?s:k2(s,a,vp(u),y)}function ja(s){return s==null?[]:Yd(s,Sr(s))}function oU(s){return s==null?[]:Yd(s,fn(s))}function aU(s,a,u){return u===r&&(u=a,a=r),u!==r&&(u=Gn(u),u=u===u?u:0),a!==r&&(a=Gn(a),a=a===a?a:0),Co(Gn(s),a,u)}function cU(s,a,u){return a=rs(a),u===r?(u=a,a=0):u=rs(u),s=Gn(s),pN(s,a,u)}function lU(s,a,u){if(u&&typeof u!="boolean"&&Qr(s,a,u)&&(a=u=r),u===r&&(typeof a=="boolean"?(u=a,a=r):typeof s=="boolean"&&(u=s,s=r)),s===r&&a===r?(s=0,a=1):(s=rs(s),a===r?(a=s,s=0):a=rs(a)),s>a){var y=s;s=a,a=y}if(u||s%1||a%1){var I=v2();return Br(s+I*(a-s+Vt("1e-"+((I+"").length-1))),a)}return hp(s,a)}var uU=Ba(function(s,a,u){return a=a.toLowerCase(),s+(u?Gb(a):a)});function Gb(s){return Up(Bt(s).toLowerCase())}function Yb(s){return s=Bt(s),s&&s.replace(xr,e$).replace(jd,"")}function hU(s,a,u){s=Bt(s),a=An(a);var y=s.length;u=u===r?y:Co(ft(u),0,y);var I=u;return u-=a.length,u>=0&&s.slice(u,I)==a}function fU(s){return s=Bt(s),s&&He.test(s)?s.replace(Vr,t$):s}function dU(s){return s=Bt(s),s&&tt.test(s)?s.replace(Lt,"\\$&"):s}var pU=Ba(function(s,a,u){return s+(u?"-":"")+a.toLowerCase()}),gU=Ba(function(s,a,u){return s+(u?" ":"")+a.toLowerCase()}),mU=Z2("toLowerCase");function vU(s,a,u){s=Bt(s),a=ft(a);var y=a?Pa(s):0;if(!a||y>=a)return s;var I=(a-y)/2;return xh(hh(I),u)+s+xh(uh(I),u)}function wU(s,a,u){s=Bt(s),a=ft(a);var y=a?Pa(s):0;return a&&y<a?s+xh(a-y,u):s}function yU(s,a,u){s=Bt(s),a=ft(a);var y=a?Pa(s):0;return a&&y<a?xh(a-y,u)+s:s}function bU(s,a,u){return u||a==null?a=0:a&&(a=+a),D$(Bt(s).replace(Qe,""),a||0)}function _U(s,a,u){return(u?Qr(s,a,u):a===r)?a=1:a=ft(a),fp(Bt(s),a)}function EU(){var s=arguments,a=Bt(s[0]);return s.length<3?a:a.replace(s[1],s[2])}var AU=Ba(function(s,a,u){return s+(u?"_":"")+a.toLowerCase()});function xU(s,a,u){return u&&typeof u!="number"&&Qr(s,a,u)&&(a=u=r),u=u===r?v:u>>>0,u?(s=Bt(s),s&&(typeof a=="string"||a!=null&&!Rp(a))&&(a=An(a),!a&&Oa(s))?Ls(ni(s),0,u):s.split(a,u)):[]}var IU=Ba(function(s,a,u){return s+(u?" ":"")+Up(a)});function SU(s,a,u){return s=Bt(s),u=u==null?0:Co(ft(u),0,s.length),a=An(a),s.slice(u,u+a.length)==a}function DU(s,a,u){var y=M.templateSettings;u&&Qr(s,a,u)&&(a=r),s=Bt(s),a=Lh({},a,y,sb);var I=Lh({},a.imports,y.imports,sb),R=Sr(I),G=Yd(I,R),J,X,ce=0,ue=a.interpolate||Di,ge="__p += '",we=Qd((a.escape||Di).source+"|"+ue.source+"|"+(ue===Ve?kt:Di).source+"|"+(a.evaluate||Di).source+"|$","g"),Le="//# sourceURL="+(qt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++kd+"]")+`
66
+ `;s.replace(we,function(We,yt,Dt,In,Zr,Sn){return Dt||(Dt=In),ge+=s.slice(ce,Sn).replace(fo,r$),yt&&(J=!0,ge+=`' +
67
+ __e(`+yt+`) +
68
+ '`),Zr&&(X=!0,ge+=`';
82
69
  `+Zr+`;
83
70
  __p += '`),Dt&&(ge+=`' +
84
71
  ((__t = (`+Dt+`)) == null ? '' : __t) +
85
- '`),le=In+We.length,We}),ge+=`';
72
+ '`),ce=Sn+We.length,We}),ge+=`';
86
73
  `;var Ke=qt.call(a,"variable")&&a.variable;if(!Ke)ge=`with (obj) {
87
74
  `+ge+`
88
75
  }
89
- `;else if(jt.test(Ke))throw new it(l);ge=(re?ge.replace(Et,""):ge).replace(ir,"$1").replace(St,"$1;"),ge="function("+(Ke||"obj")+`) {
76
+ `;else if(jt.test(Ke))throw new it(l);ge=(X?ge.replace(Et,""):ge).replace(ir,"$1").replace(It,"$1;"),ge="function("+(Ke||"obj")+`) {
90
77
  `+(Ke?"":`obj || (obj = {});
91
- `)+"var __t, __p = ''"+(Q?", __e = _.escape":"")+(re?`, __j = Array.prototype.join;
78
+ `)+"var __t, __p = ''"+(J?", __e = _.escape":"")+(X?`, __j = Array.prototype.join;
92
79
  function print() { __p += __j.call(arguments, '') }
93
80
  `:`;
94
81
  `)+ge+`return __p
95
- }`;var pt=r3(function(){return $t(B,Le+"return "+ge).apply(r,G)});if(pt.source=ge,Np(pt))throw pt;return pt}function zU(o){return Bt(o).toLowerCase()}function HU(o){return Bt(o).toUpperCase()}function KU(o,a,u){if(o=Bt(o),o&&(u||a===r))return h2(o);if(!o||!(a=An(a)))return o;var w=ii(o),S=ii(a),B=f2(w,S),G=d2(w,S)+1;return Ls(w,B,G).join("")}function WU(o,a,u){if(o=Bt(o),o&&(u||a===r))return o.slice(0,g2(o)+1);if(!o||!(a=An(a)))return o;var w=ii(o),S=d2(w,ii(a))+1;return Ls(w,0,S).join("")}function VU(o,a,u){if(o=Bt(o),o&&(u||a===r))return o.replace(Qe,"");if(!o||!(a=An(a)))return o;var w=ii(o),S=f2(w,ii(a));return Ls(w,S).join("")}function GU(o,a){var u=J,w=te;if(sr(a)){var S="separator"in a?a.separator:S;u="length"in a?ft(a.length):u,w="omission"in a?An(a.omission):w}o=Bt(o);var B=o.length;if(Oa(o)){var G=ii(o);B=G.length}if(u>=B)return o;var Q=u-Pa(w);if(Q<1)return w;var re=G?Ls(G,0,Q).join(""):o.slice(0,Q);if(S===r)return re+w;if(G&&(Q+=re.length-Q),Rp(S)){if(o.slice(Q).search(S)){var le,he=re;for(S.global||(S=Qd(S.source,Bt(vt.exec(S))+"g")),S.lastIndex=0;le=S.exec(he);)var ge=le.index;re=re.slice(0,ge===r?Q:ge)}}else if(o.indexOf(An(S),Q)!=Q){var ye=re.lastIndexOf(S);ye>-1&&(re=re.slice(0,ye))}return re+w}function YU(o){return o=Bt(o),o&&Ye.test(o)?o.replace(Ot,x$):o}var JU=Ba(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),Up=nb("toUpperCase");function t3(o,a,u){return o=Bt(o),a=u?r:a,a===r?w$(o)?D$(o):u$(o):o.match(a)||[]}var r3=gt(function(o,a){try{return Sr(o,r,a)}catch(u){return Np(u)?u:new it(u)}}),QU=Zi(function(o,a){return zn(a,function(u){u=$i(u),Ji(o,u,Tp(o[u],o))}),o});function ZU(o){var a=o==null?0:o.length,u=qe();return o=a?tr(o,function(w){if(typeof w[1]!="function")throw new Hn(c);return[u(w[0]),w[1]]}):[],gt(function(w){for(var S=-1;++S<a;){var B=o[S];if(Sr(B[0],this,w))return Sr(B[1],this,w)}})}function XU(o){return xN(Wn(o,_))}function Fp(o){return function(){return o}}function eF(o,a){return o==null||o!==o?a:o}var tF=sb(),rF=sb(!0);function hn(o){return o}function jp(o){return R2(typeof o=="function"?o:Wn(o,_))}function nF(o){return B2(Wn(o,_))}function iF(o,a){return U2(o,Wn(a,_))}var sF=gt(function(o,a){return function(u){return el(u,o,a)}}),oF=gt(function(o,a){return function(u){return el(o,u,a)}});function kp(o,a,u){var w=Ir(a),S=ph(a,w);u==null&&!(sr(a)&&(S.length||!w.length))&&(u=a,a=o,o=this,S=ph(a,Ir(a)));var B=!(sr(u)&&"chain"in u)||!!u.chain,G=es(o);return zn(S,function(Q){var re=a[Q];o[Q]=re,G&&(o.prototype[Q]=function(){var le=this.__chain__;if(B||le){var he=o(this.__wrapped__),ge=he.__actions__=cn(this.__actions__);return ge.push({func:re,args:arguments,thisArg:o}),he.__chain__=le,he}return re.apply(o,Ps([this.value()],arguments))})}),o}function aF(){return It._===this&&(It._=$$),this}function qp(){}function cF(o){return o=ft(o),gt(function(a){return F2(a,o)})}var lF=wp(tr),uF=wp(o2),hF=wp(Hd);function n3(o){return Ip(o)?Kd($i(o)):kN(o)}function fF(o){return function(a){return o==null?r:To(o,a)}}var dF=ab(),pF=ab(!0);function zp(){return[]}function Hp(){return!1}function gF(){return{}}function mF(){return""}function vF(){return!0}function yF(o,a){if(o=ft(o),o<1||o>N)return[];var u=v,w=Br(o,v);a=qe(a),o-=v;for(var S=Gd(w,a);++u<o;)a(u);return S}function wF(o){return at(o)?tr(o,$i):xn(o)?[o]:cn(Ab(Bt(o)))}function bF(o){var a=++M$;return Bt(o)+a}var _F=bh(function(o,a){return o+a},0),EF=bp("ceil"),AF=bh(function(o,a){return o/a},1),xF=bp("floor");function SF(o){return o&&o.length?dh(o,hn,sp):r}function IF(o,a){return o&&o.length?dh(o,qe(a,2),sp):r}function DF(o){return l2(o,hn)}function CF(o,a){return l2(o,qe(a,2))}function OF(o){return o&&o.length?dh(o,hn,lp):r}function PF(o,a){return o&&o.length?dh(o,qe(a,2),lp):r}var MF=bh(function(o,a){return o*a},1),TF=bp("round"),$F=bh(function(o,a){return o-a},0);function NF(o){return o&&o.length?Vd(o,hn):0}function RF(o,a){return o&&o.length?Vd(o,qe(a,2)):0}return T.after=nB,T.ary=Nb,T.assign=HB,T.assignIn=Gb,T.assignInWith=$h,T.assignWith=KB,T.at=WB,T.before=Rb,T.bind=Tp,T.bindAll=QU,T.bindKey=Lb,T.castArray=gB,T.chain=Mb,T.chunk=xR,T.compact=SR,T.concat=IR,T.cond=ZU,T.conforms=XU,T.constant=Fp,T.countBy=NL,T.create=VB,T.curry=Bb,T.curryRight=Ub,T.debounce=Fb,T.defaults=GB,T.defaultsDeep=YB,T.defer=iB,T.delay=sB,T.difference=DR,T.differenceBy=CR,T.differenceWith=OR,T.drop=PR,T.dropRight=MR,T.dropRightWhile=TR,T.dropWhile=$R,T.fill=NR,T.filter=LL,T.flatMap=FL,T.flatMapDeep=jL,T.flatMapDepth=kL,T.flatten=Db,T.flattenDeep=RR,T.flattenDepth=LR,T.flip=oB,T.flow=tF,T.flowRight=rF,T.fromPairs=BR,T.functions=rU,T.functionsIn=nU,T.groupBy=qL,T.initial=FR,T.intersection=jR,T.intersectionBy=kR,T.intersectionWith=qR,T.invert=sU,T.invertBy=oU,T.invokeMap=HL,T.iteratee=jp,T.keyBy=KL,T.keys=Ir,T.keysIn=un,T.map=Dh,T.mapKeys=cU,T.mapValues=lU,T.matches=nF,T.matchesProperty=iF,T.memoize=Oh,T.merge=uU,T.mergeWith=Yb,T.method=sF,T.methodOf=oF,T.mixin=kp,T.negate=Ph,T.nthArg=cF,T.omit=hU,T.omitBy=fU,T.once=aB,T.orderBy=WL,T.over=lF,T.overArgs=cB,T.overEvery=uF,T.overSome=hF,T.partial=$p,T.partialRight=jb,T.partition=VL,T.pick=dU,T.pickBy=Jb,T.property=n3,T.propertyOf=fF,T.pull=WR,T.pullAll=Ob,T.pullAllBy=VR,T.pullAllWith=GR,T.pullAt=YR,T.range=dF,T.rangeRight=pF,T.rearg=lB,T.reject=JL,T.remove=JR,T.rest=uB,T.reverse=Pp,T.sampleSize=ZL,T.set=gU,T.setWith=mU,T.shuffle=XL,T.slice=QR,T.sortBy=rB,T.sortedUniq=iL,T.sortedUniqBy=sL,T.split=FU,T.spread=hB,T.tail=oL,T.take=aL,T.takeRight=cL,T.takeRightWhile=lL,T.takeWhile=uL,T.tap=SL,T.throttle=fB,T.thru=Ih,T.toArray=Kb,T.toPairs=Qb,T.toPairsIn=Zb,T.toPath=wF,T.toPlainObject=Vb,T.transform=vU,T.unary=dB,T.union=hL,T.unionBy=fL,T.unionWith=dL,T.uniq=pL,T.uniqBy=gL,T.uniqWith=mL,T.unset=yU,T.unzip=Mp,T.unzipWith=Pb,T.update=wU,T.updateWith=bU,T.values=ja,T.valuesIn=_U,T.without=vL,T.words=t3,T.wrap=pB,T.xor=yL,T.xorBy=wL,T.xorWith=bL,T.zip=_L,T.zipObject=EL,T.zipObjectDeep=AL,T.zipWith=xL,T.entries=Qb,T.entriesIn=Zb,T.extend=Gb,T.extendWith=$h,kp(T,T),T.add=_F,T.attempt=r3,T.camelCase=SU,T.capitalize=Xb,T.ceil=EF,T.clamp=EU,T.clone=mB,T.cloneDeep=yB,T.cloneDeepWith=wB,T.cloneWith=vB,T.conformsTo=bB,T.deburr=e3,T.defaultTo=eF,T.divide=AF,T.endsWith=IU,T.eq=oi,T.escape=DU,T.escapeRegExp=CU,T.every=RL,T.find=BL,T.findIndex=Sb,T.findKey=JB,T.findLast=UL,T.findLastIndex=Ib,T.findLastKey=QB,T.floor=xF,T.forEach=Tb,T.forEachRight=$b,T.forIn=ZB,T.forInRight=XB,T.forOwn=eU,T.forOwnRight=tU,T.get=Lp,T.gt=_B,T.gte=EB,T.has=iU,T.hasIn=Bp,T.head=Cb,T.identity=hn,T.includes=zL,T.indexOf=UR,T.inRange=AU,T.invoke=aU,T.isArguments=Ro,T.isArray=at,T.isArrayBuffer=AB,T.isArrayLike=ln,T.isArrayLikeObject=dr,T.isBoolean=xB,T.isBuffer=Bs,T.isDate=SB,T.isElement=IB,T.isEmpty=DB,T.isEqual=CB,T.isEqualWith=OB,T.isError=Np,T.isFinite=PB,T.isFunction=es,T.isInteger=kb,T.isLength=Mh,T.isMap=qb,T.isMatch=MB,T.isMatchWith=TB,T.isNaN=$B,T.isNative=NB,T.isNil=LB,T.isNull=RB,T.isNumber=zb,T.isObject=sr,T.isObjectLike=cr,T.isPlainObject=ol,T.isRegExp=Rp,T.isSafeInteger=BB,T.isSet=Hb,T.isString=Th,T.isSymbol=xn,T.isTypedArray=Fa,T.isUndefined=UB,T.isWeakMap=FB,T.isWeakSet=jB,T.join=zR,T.kebabCase=OU,T.last=Gn,T.lastIndexOf=HR,T.lowerCase=PU,T.lowerFirst=MU,T.lt=kB,T.lte=qB,T.max=SF,T.maxBy=IF,T.mean=DF,T.meanBy=CF,T.min=OF,T.minBy=PF,T.stubArray=zp,T.stubFalse=Hp,T.stubObject=gF,T.stubString=mF,T.stubTrue=vF,T.multiply=MF,T.nth=KR,T.noConflict=aF,T.noop=qp,T.now=Ch,T.pad=TU,T.padEnd=$U,T.padStart=NU,T.parseInt=RU,T.random=xU,T.reduce=GL,T.reduceRight=YL,T.repeat=LU,T.replace=BU,T.result=pU,T.round=TF,T.runInContext=ee,T.sample=QL,T.size=eB,T.snakeCase=UU,T.some=tB,T.sortedIndex=ZR,T.sortedIndexBy=XR,T.sortedIndexOf=eL,T.sortedLastIndex=tL,T.sortedLastIndexBy=rL,T.sortedLastIndexOf=nL,T.startCase=jU,T.startsWith=kU,T.subtract=$F,T.sum=NF,T.sumBy=RF,T.template=qU,T.times=yF,T.toFinite=ts,T.toInteger=ft,T.toLength=Wb,T.toLower=zU,T.toNumber=Yn,T.toSafeInteger=zB,T.toString=Bt,T.toUpper=HU,T.trim=KU,T.trimEnd=WU,T.trimStart=VU,T.truncate=GU,T.unescape=YU,T.uniqueId=bF,T.upperCase=JU,T.upperFirst=Up,T.each=Tb,T.eachRight=$b,T.first=Cb,kp(T,function(){var o={};return Mi(T,function(a,u){qt.call(T.prototype,u)||(o[u]=a)}),o}(),{chain:!1}),T.VERSION=n,zn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){T[o].placeholder=T}),zn(["drop","take"],function(o,a){At.prototype[o]=function(u){u=u===r?1:wr(ft(u),0);var w=this.__filtered__&&!a?new At(this):this.clone();return w.__filtered__?w.__takeCount__=Br(u,w.__takeCount__):w.__views__.push({size:Br(u,v),type:o+(w.__dir__<0?"Right":"")}),w},At.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),zn(["filter","map","takeWhile"],function(o,a){var u=a+1,w=u==d||u==D;At.prototype[o]=function(S){var B=this.clone();return B.__iteratees__.push({iteratee:qe(S,3),type:u}),B.__filtered__=B.__filtered__||w,B}}),zn(["head","last"],function(o,a){var u="take"+(a?"Right":"");At.prototype[o]=function(){return this[u](1).value()[0]}}),zn(["initial","tail"],function(o,a){var u="drop"+(a?"":"Right");At.prototype[o]=function(){return this.__filtered__?new At(this):this[u](1)}}),At.prototype.compact=function(){return this.filter(hn)},At.prototype.find=function(o){return this.filter(o).head()},At.prototype.findLast=function(o){return this.reverse().find(o)},At.prototype.invokeMap=gt(function(o,a){return typeof o=="function"?new At(this):this.map(function(u){return el(u,o,a)})}),At.prototype.reject=function(o){return this.filter(Ph(qe(o)))},At.prototype.slice=function(o,a){o=ft(o);var u=this;return u.__filtered__&&(o>0||a<0)?new At(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==r&&(a=ft(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},At.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},At.prototype.toArray=function(){return this.take(v)},Mi(At.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),w=/^(?:head|last)$/.test(a),S=T[w?"take"+(a=="last"?"Right":""):a],B=w||/^find/.test(a);S&&(T.prototype[a]=function(){var G=this.__wrapped__,Q=w?[1]:arguments,re=G instanceof At,le=Q[0],he=re||at(G),ge=function(wt){var Dt=S.apply(T,Ps([wt],Q));return w&&ye?Dt[0]:Dt};he&&u&&typeof le=="function"&&le.length!=1&&(re=he=!1);var ye=this.__chain__,Le=!!this.__actions__.length,Ke=B&&!ye,pt=re&&!Le;if(!B&&he){G=pt?G:new At(this);var We=o.apply(G,Q);return We.__actions__.push({func:Ih,args:[ge],thisArg:r}),new Kn(We,ye)}return Ke&&pt?o.apply(this,Q):(We=this.thru(ge),Ke?w?We.value()[0]:We.value():We)})}),zn(["pop","push","shift","sort","splice","unshift"],function(o){var a=Zu[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",w=/^(?:pop|shift)$/.test(o);T.prototype[o]=function(){var S=arguments;if(w&&!this.__chain__){var B=this.value();return a.apply(at(B)?B:[],S)}return this[u](function(G){return a.apply(at(G)?G:[],S)})}}),Mi(At.prototype,function(o,a){var u=T[a];if(u){var w=u.name+"";qt.call(Na,w)||(Na[w]=[]),Na[w].push({name:a,func:u})}}),Na[wh(r,Y).name]=[{name:"wrapper",func:r}],At.prototype.clone=Y$,At.prototype.reverse=J$,At.prototype.value=Q$,T.prototype.at=IL,T.prototype.chain=DL,T.prototype.commit=CL,T.prototype.next=OL,T.prototype.plant=ML,T.prototype.reverse=TL,T.prototype.toJSON=T.prototype.valueOf=T.prototype.value=$L,T.prototype.first=T.prototype.head,Vc&&(T.prototype[Vc]=PL),T},Ma=C$();fr?((fr.exports=Ma)._=Ma,Gt._=Ma):It._=Ma}).call(Ec)})(b0,b0.exports);var JD=Object.defineProperty,QD=Object.defineProperties,ZD=Object.getOwnPropertyDescriptors,Ay=Object.getOwnPropertySymbols,XD=Object.prototype.hasOwnProperty,eC=Object.prototype.propertyIsEnumerable,xy=(t,e,r)=>e in t?JD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xl=(t,e)=>{for(var r in e||(e={}))XD.call(e,r)&&xy(t,r,e[r]);if(Ay)for(var r of Ay(e))eC.call(e,r)&&xy(t,r,e[r]);return t},tC=(t,e)=>QD(t,ZD(e));function ds(t,e,r){var n;const i=yl(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${YD}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function to(t){return t.includes(":")?t.split(":")[1]:t}function Sy(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function rC(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function _0(t={},e={}){const r=Iy(t),n=Iy(e);return b0.exports.merge(r,n)}function Iy(t){var e,r,n,i;const s={};if(!cc(t))return s;for(const[c,l]of Object.entries(t)){const f=Lf(c)?[c]:l.chains,h=l.methods||[],m=l.events||[],_=l.rpcMap||{},E=ac(c);s[E]=tC(Xl(Xl({},s[E]),l),{chains:wl(f,(e=s[E])==null?void 0:e.chains),methods:wl(h,(r=s[E])==null?void 0:r.methods),events:wl(m,(n=s[E])==null?void 0:n.events),rpcMap:Xl(Xl({},_),(i=s[E])==null?void 0:i.rpcMap)})}return s}function nC(t){return t.includes(":")?t.split(":")[2]:t}function Dy(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],c=n.accounts||[],l=Lf(r)?[r]:n.chains?n.chains:Sy(n.accounts);e[r]={chains:l,methods:i,events:s,accounts:c}}return e}function E0(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const Cy={},er=t=>Cy[t],A0=(t,e)=>{Cy[t]=e};class iC{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class sC{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=er("events"),this.client=er("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())}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,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(zi.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,r){const n=r||ds(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(to(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,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:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[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}`)}}class oC{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class aC{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class cC{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=to(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class lC{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class uC{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class hC{constructor(e){this.name="near",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||ds(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace);return typeof n>"u"?void 0:new ki(new fs(n,er("disableProviderPing")))}}var fC=Object.defineProperty,dC=Object.defineProperties,pC=Object.getOwnPropertyDescriptors,Oy=Object.getOwnPropertySymbols,gC=Object.prototype.hasOwnProperty,mC=Object.prototype.propertyIsEnumerable,Py=(t,e,r)=>e in t?fC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eu=(t,e)=>{for(var r in e||(e={}))gC.call(e,r)&&Py(t,r,e[r]);if(Oy)for(var r of Oy(e))mC.call(e,r)&&Py(t,r,e[r]);return t},x0=(t,e)=>dC(t,pC(e));class S0{constructor(e){this.events=new Dr.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:Xs.pino(Xs.getDefaultLoggerOptions({level:e?.logger||_y})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const r=new S0(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:eu({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(c=>r(null,Vl(s,c))).catch(c=>r(c,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:Ut("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){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:r,response:n}=await this.client.authenticate(e);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();if(this.session=i.session,this.session){const s=Dy(this.session.namespaces);this.namespaces=_0(this.namespaces,s),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const c=Dy(s.namespaces);this.namespaces=_0(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==gy)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e);this.getProvider(n).setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(wi(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.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 y0.init({logger:this.providerOpts.logger||_y,relayUrl:this.providerOpts.relayUrl||WD,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),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(r=>ac(r)))];A0("client",this.client),A0("events",this.events),A0("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=rC(r,this.session),i=Sy(n),s=_0(this.namespaces,this.optionalNamespaces),c=x0(eu({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new sC({namespace:c});break;case"solana":this.rpcProviders[r]=new oC({namespace:c});break;case"cosmos":this.rpcProviders[r]=new aC({namespace:c});break;case"polkadot":this.rpcProviders[r]=new iC({namespace:c});break;case"cip34":this.rpcProviders[r]=new cC({namespace:c});break;case"elrond":this.rpcProviders[r]=new lC({namespace:c});break;case"multiversx":this.rpcProviders[r]=new uC({namespace:c});break;case"near":this.rpcProviders[r]=new hC({namespace:c});break}})}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:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&wi(i)&&this.events.emit("accountsChanged",i.map(nC))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,c=ac(i),l=E0(i)!==E0(s)?`${c}:${E0(s)}`:i;this.onChainChanged(l)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=x0(eu({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",x0(eu({},Ut("USER_DISCONNECTED")),{data:e.topic}))}),this.on(zi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(c=>ac(c)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=ac(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}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,r){this.client.core.storage.setItem(`${Ey}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${Ey}/${e}`)}}const vC=S0,yC="wc",wC="ethereum_provider",bC=`${yC}@2:${wC}:`,_C="https://rpc.walletconnect.com/v1/",tu=["eth_sendTransaction","personal_sign"],My=["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"],ru=["chainChanged","accountsChanged"],Ty=["chainChanged","accountsChanged","message","disconnect","connect"];var EC=Object.defineProperty,AC=Object.defineProperties,xC=Object.getOwnPropertyDescriptors,$y=Object.getOwnPropertySymbols,SC=Object.prototype.hasOwnProperty,IC=Object.prototype.propertyIsEnumerable,Ny=(t,e,r)=>e in t?EC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oa=(t,e)=>{for(var r in e||(e={}))SC.call(e,r)&&Ny(t,r,e[r]);if($y)for(var r of $y(e))IC.call(e,r)&&Ny(t,r,e[r]);return t},I0=(t,e)=>AC(t,xC(e));function nu(t){return Number(t[0].split(":")[1])}function iu(t){return`0x${t.toString(16)}`}function DC(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:c,rpcMap:l}=t;if(!wi(e))throw new Error("Invalid chains");const f={chains:e,methods:n||tu,events:s||ru,rpcMap:oa({},e.length?{[nu(e)]:l[nu(e)]}:{})},h=s?.filter(A=>!ru.includes(A)),m=n?.filter(A=>!tu.includes(A));if(!r&&!c&&!i&&!(h!=null&&h.length)&&!(m!=null&&m.length))return{required:e.length?f:void 0};const _=h?.length&&m?.length||!r,E={chains:[...new Set(_?f.chains.concat(r||[]):r)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:My))],events:[...new Set(f.events.concat(c!=null&&c.length?c:Ty))],rpcMap:l};return{required:e.length?f:void 0,optional:r.length?E:void 0}}class su{constructor(){this.events=new Dr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=bC,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new su;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}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:r,optional:n}=DC(this.rpc);try{const i=await new Promise(async(c,l)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(I0(oa({namespaces:oa({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then(h=>{c(h)}).catch(h=>{l(new Error(h.message))})});if(!i)return;const s=eg(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:iu(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const r=await new Promise(async(i,s)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),s(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(I0(oa({},e),{chains:this.rpc.chains})).then(l=>{i(l)}).catch(l=>{s(new Error(l.message))})}),n=r.session;if(n){const i=eg(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:i),this.setAccounts(i),this.events.emit("connect",{chainId:iu(this.chainId)})}return r}catch(r){throw this.signer.logger.error(r),r}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:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",iu(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",I0(oa({},Ut("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.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 r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",iu(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e?.chains)!=null?r:[],s=(n=e?.optionalChains)!=null?n:[],c=i.concat(s);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=i.length?e?.methods||tu:[],f=i.length?e?.events||ru:[],h=e?.optionalMethods||[],m=e?.optionalEvents||[],_=e?.rpcMap||this.buildRpcMap(c,e.projectId),E=e?.qrModalOptions||void 0;return{chains:i?.map(A=>this.formatChainId(A)),optionalChains:s.map(A=>this.formatChainId(A)),methods:l,events:f,optionalMethods:h,optionalEvents:m,rpcMap:_,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:E,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?nu(this.rpc.chains):nu(this.rpc.optionalChains),this.signer=await vC.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await Promise.resolve().then(function(){return JC});r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(oa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&wi(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=i?.[s]||this.getRpcUrl(s)})),n&&wi(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=i?.[s]||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${_C}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r?.accounts),this.setAccounts(r?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}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(r=>this.parseAccount(r))}}const CC=su,OC=Symbol(),Ry=Object.getPrototypeOf,D0=new WeakMap,PC=t=>t&&(D0.has(t)?D0.get(t):Ry(t)===Object.prototype||Ry(t)===Array.prototype),MC=t=>PC(t)&&t[OC]||null,Ly=(t,e=!0)=>{D0.set(t,e)},C0=t=>typeof t=="object"&&t!==null,ps=new WeakMap,ou=new WeakSet,TC=(t=Object.is,e=(h,m)=>new Proxy(h,m),r=h=>C0(h)&&!ou.has(h)&&(Array.isArray(h)||!(Symbol.iterator in h))&&!(h instanceof WeakMap)&&!(h instanceof WeakSet)&&!(h instanceof Error)&&!(h instanceof Number)&&!(h instanceof Date)&&!(h instanceof String)&&!(h instanceof RegExp)&&!(h instanceof ArrayBuffer),n=h=>{switch(h.status){case"fulfilled":return h.value;case"rejected":throw h.reason;default:throw h}},i=new WeakMap,s=(h,m,_=n)=>{const E=i.get(h);if(E?.[0]===m)return E[1];const A=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return Ly(A,!0),i.set(h,[m,A]),Reflect.ownKeys(h).forEach(I=>{if(Object.getOwnPropertyDescriptor(A,I))return;const R=Reflect.get(h,I),W={value:R,enumerable:!0,configurable:!0};if(ou.has(R))Ly(R,!1);else if(R instanceof Promise)delete W.value,W.get=()=>_(R);else if(ps.has(R)){const[Y,F]=ps.get(R);W.value=s(Y,F(),_)}Object.defineProperty(A,I,W)}),Object.preventExtensions(A)},c=new WeakMap,l=[1,1],f=h=>{if(!C0(h))throw new Error("object required");const m=c.get(h);if(m)return m;let _=l[0];const E=new Set,A=(Z,J=++l[0])=>{_!==J&&(_=J,E.forEach(te=>te(Z,J)))};let I=l[1];const R=(Z=++l[1])=>(I!==Z&&!E.size&&(I=Z,Y.forEach(([J])=>{const te=J[1](Z);te>_&&(_=te)})),_),W=Z=>(J,te)=>{const ae=[...J];ae[1]=[Z,...ae[1]],A(ae,te)},Y=new Map,F=(Z,J)=>{if(Y.has(Z))throw new Error("prop listener already exists");if(E.size){const te=J[3](W(Z));Y.set(Z,[J,te])}else Y.set(Z,[J])},z=Z=>{var J;const te=Y.get(Z);te&&(Y.delete(Z),(J=te[1])==null||J.call(te))},$=Z=>(E.add(Z),E.size===1&&Y.forEach(([te,ae],p)=>{if(ae)throw new Error("remove already exists");const d=te[3](W(p));Y.set(p,[te,d])}),()=>{E.delete(Z),E.size===0&&Y.forEach(([te,ae],p)=>{ae&&(ae(),Y.set(p,[te]))})}),j=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),g=e(j,{deleteProperty(Z,J){const te=Reflect.get(Z,J);z(J);const ae=Reflect.deleteProperty(Z,J);return ae&&A(["delete",[J],te]),ae},set(Z,J,te,ae){const p=Reflect.has(Z,J),d=Reflect.get(Z,J,ae);if(p&&(t(d,te)||c.has(te)&&t(d,c.get(te))))return!0;z(J),C0(te)&&(te=MC(te)||te);let b=te;if(te instanceof Promise)te.then(D=>{te.status="fulfilled",te.value=D,A(["resolve",[J],D])}).catch(D=>{te.status="rejected",te.reason=D,A(["reject",[J],D])});else{!ps.has(te)&&r(te)&&(b=f(te));const D=!ou.has(b)&&ps.get(b);D&&F(J,D)}return Reflect.set(Z,J,b,ae),A(["set",[J],te,d]),!0}});c.set(h,g);const C=[j,R,s,$];return ps.set(g,C),Reflect.ownKeys(h).forEach(Z=>{const J=Object.getOwnPropertyDescriptor(h,Z);"value"in J&&(g[Z]=h[Z],delete J.value,delete J.writable),Object.defineProperty(j,Z,J)}),g})=>[f,ps,ou,t,e,r,n,i,s,c,l],[$C]=TC();function gs(t={}){return $C(t)}function ro(t,e,r){const n=ps.get(t);n||console.warn("Please use proxy object");let i;const s=[],c=n[3];let l=!1;const h=c(m=>{if(s.push(m),r){e(s.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,l&&e(s.splice(0))}))});return l=!0,()=>{l=!1,h()}}function NC(t,e){const r=ps.get(t);r||console.warn("Please use proxy object");const[n,i,s]=r;return s(n,i(),e)}const Ar=gs({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),rr={state:Ar,subscribe(t){return ro(Ar,()=>t(Ar))},push(t,e){t!==Ar.view&&(Ar.view=t,e&&(Ar.data=e),Ar.history.push(t))},reset(t){Ar.view=t,Ar.history=[t]},replace(t){Ar.history.length>1&&(Ar.history[Ar.history.length-1]=t,Ar.view=t)},goBack(){if(Ar.history.length>1){Ar.history.pop();const[t]=Ar.history.slice(-1);Ar.view=t}},setData(t){Ar.data=t}},Ue={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 Ue.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const t=navigator.userAgent.toLowerCase();return Ue.isMobile()&&(t.includes("iphone")||t.includes("ipad"))},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},isArray(t){return Array.isArray(t)&&t.length>0},formatNativeUrl(t,e,r){if(Ue.isHttpUrl(t))return this.formatUniversalUrl(t,e,r);let n=t;n.includes("://")||(n=t.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},formatUniversalUrl(t,e,r){if(!Ue.isHttpUrl(t))return this.formatNativeUrl(t,e,r);let n=t;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},async wait(t){return new Promise(e=>{setTimeout(e,t)})},openHref(t,e){window.open(t,e,"noreferrer noopener")},setWalletConnectDeepLink(t,e){try{localStorage.setItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(t){try{const[e]=t.split("?");localStorage.setItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(Ue.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var t;const e=(t=rr.state.data)==null?void 0:t.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},RC=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Lr=gs({enabled:RC,userSessionId:"",events:[],connectedWalletId:void 0}),By={state:Lr,subscribe(t){return ro(Lr.events,()=>t(NC(Lr.events[Lr.events.length-1])))},initialize(){Lr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Lr.userSessionId=crypto.randomUUID())},setConnectedWalletId(t){Lr.connectedWalletId=t},click(t){if(Lr.enabled){const e={type:"CLICK",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}},track(t){if(Lr.enabled){const e={type:"TRACK",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}},view(t){if(Lr.enabled){const e={type:"VIEW",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}}},Ei=gs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),hr={state:Ei,subscribe(t){return ro(Ei,()=>t(Ei))},setChains(t){Ei.chains=t},setWalletConnectUri(t){Ei.walletConnectUri=t},setIsCustomDesktop(t){Ei.isCustomDesktop=t},setIsCustomMobile(t){Ei.isCustomMobile=t},setIsDataLoaded(t){Ei.isDataLoaded=t},setIsUiLoaded(t){Ei.isUiLoaded=t},setIsAuth(t){Ei.isAuth=t}},au=gs({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}),wn={state:au,subscribe(t){return ro(au,()=>t(au))},setConfig(t){var e,r;By.initialize(),hr.setChains(t.chains),hr.setIsAuth(!!t.enableAuthMode),hr.setIsCustomMobile(!!((e=t.mobileWallets)!=null&&e.length)),hr.setIsCustomDesktop(!!((r=t.desktopWallets)!=null&&r.length)),Ue.setModalVersionInStorage(),Object.assign(au,t)}};var LC=Object.defineProperty,Uy=Object.getOwnPropertySymbols,BC=Object.prototype.hasOwnProperty,UC=Object.prototype.propertyIsEnumerable,Fy=(t,e,r)=>e in t?LC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,FC=(t,e)=>{for(var r in e||(e={}))BC.call(e,r)&&Fy(t,r,e[r]);if(Uy)for(var r of Uy(e))UC.call(e,r)&&Fy(t,r,e[r]);return t};const O0="https://explorer-api.walletconnect.com",P0="wcm",M0="js-2.6.2";async function cu(t,e){const r=FC({sdkType:P0,sdkVersion:M0},e),n=new URL(t,O0);return n.searchParams.append("projectId",wn.state.projectId),Object.entries(r).forEach(([i,s])=>{s&&n.searchParams.append(i,String(s))}),(await fetch(n)).json()}const no={async getDesktopListings(t){return cu("/w3m/v1/getDesktopListings",t)},async getMobileListings(t){return cu("/w3m/v1/getMobileListings",t)},async getInjectedListings(t){return cu("/w3m/v1/getInjectedListings",t)},async getAllListings(t){return cu("/w3m/v1/getAllListings",t)},getWalletImageUrl(t){return`${O0}/w3m/v1/getWalletImage/${t}?projectId=${wn.state.projectId}&sdkType=${P0}&sdkVersion=${M0}`},getAssetImageUrl(t){return`${O0}/w3m/v1/getAssetImage/${t}?projectId=${wn.state.projectId}&sdkType=${P0}&sdkVersion=${M0}`}};var jC=Object.defineProperty,jy=Object.getOwnPropertySymbols,kC=Object.prototype.hasOwnProperty,qC=Object.prototype.propertyIsEnumerable,ky=(t,e,r)=>e in t?jC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zC=(t,e)=>{for(var r in e||(e={}))kC.call(e,r)&&ky(t,r,e[r]);if(jy)for(var r of jy(e))qC.call(e,r)&&ky(t,r,e[r]);return t};const qy=Ue.isMobile(),Ai=gs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),sn={state:Ai,async getRecomendedWallets(){const{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:e}=wn.state;if(t==="NONE"||e==="ALL"&&!t)return Ai.recomendedWallets;if(Ue.isArray(t)){const r={recommendedIds:t.join(",")},{listings:n}=await no.getAllListings(r),i=Object.values(n);i.sort((s,c)=>{const l=t.indexOf(s.id),f=t.indexOf(c.id);return l-f}),Ai.recomendedWallets=i}else{const{chains:r,isAuth:n}=hr.state,i=r?.join(","),s=Ue.isArray(e),c={page:1,sdks:n?"auth_v1":void 0,entries:Ue.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:s?e.join(","):void 0},{listings:l}=qy?await no.getMobileListings(c):await no.getDesktopListings(c);Ai.recomendedWallets=Object.values(l)}return Ai.recomendedWallets},async getWallets(t){const e=zC({},t),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=wn.state,{recomendedWallets:i}=Ai;if(n==="ALL")return Ai.wallets;i.length?e.excludedIds=i.map(_=>_.id).join(","):Ue.isArray(r)&&(e.excludedIds=r.join(",")),Ue.isArray(n)&&(e.excludedIds=[e.excludedIds,n].filter(Boolean).join(",")),hr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:c}=t,{listings:l,total:f}=qy?await no.getMobileListings(e):await no.getDesktopListings(e),h=Object.values(l),m=c?"search":"wallets";return Ai[m]={listings:[...Ai[m].listings,...h],total:f,page:s??1},{listings:h,total:f}},getWalletImageUrl(t){return no.getWalletImageUrl(t)},getAssetImageUrl(t){return no.getAssetImageUrl(t)},resetSearch(){Ai.search={listings:[],total:0,page:1}}},aa=gs({open:!1}),io={state:aa,subscribe(t){return ro(aa,()=>t(aa))},async open(t){return new Promise(e=>{const{isUiLoaded:r,isDataLoaded:n}=hr.state;if(Ue.removeWalletConnectDeepLink(),hr.setWalletConnectUri(t?.uri),hr.setChains(t?.chains),rr.reset("ConnectWallet"),r&&n)aa.open=!0,e();else{const i=setInterval(()=>{const s=hr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(i),aa.open=!0,e())},200)}})},close(){aa.open=!1}};var HC=Object.defineProperty,zy=Object.getOwnPropertySymbols,KC=Object.prototype.hasOwnProperty,WC=Object.prototype.propertyIsEnumerable,Hy=(t,e,r)=>e in t?HC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VC=(t,e)=>{for(var r in e||(e={}))KC.call(e,r)&&Hy(t,r,e[r]);if(zy)for(var r of zy(e))WC.call(e,r)&&Hy(t,r,e[r]);return t};function GC(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const Ac=gs({themeMode:GC()?"dark":"light"}),ms={state:Ac,subscribe(t){return ro(Ac,()=>t(Ac))},setThemeConfig(t){const{themeMode:e,themeVariables:r}=t;e&&(Ac.themeMode=e),r&&(Ac.themeVariables=VC({},r))}},so=gs({open:!1,message:"",variant:"success"}),vs={state:so,subscribe(t){return ro(so,()=>t(so))},openToast(t,e){so.open=!0,so.message=t,so.variant=e},closeToast(){so.open=!1}};class YC{constructor(e){this.openModal=io.open,this.closeModal=io.close,this.subscribeModal=io.subscribe,this.setTheme=ms.setThemeConfig,ms.setThemeConfig(e),wn.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return i$});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),hr.setIsUiLoaded(!0)}}}var JC=Object.freeze({__proto__:null,WalletConnectModal:YC});/**
82
+ }`;var pt=Qb(function(){return $t(R,Le+"return "+ge).apply(r,G)});if(pt.source=ge,Np(pt))throw pt;return pt}function CU(s){return Bt(s).toLowerCase()}function OU(s){return Bt(s).toUpperCase()}function PU(s,a,u){if(s=Bt(s),s&&(u||a===r))return o2(s);if(!s||!(a=An(a)))return s;var y=ni(s),I=ni(a),R=a2(y,I),G=c2(y,I)+1;return Ls(y,R,G).join("")}function MU(s,a,u){if(s=Bt(s),s&&(u||a===r))return s.slice(0,u2(s)+1);if(!s||!(a=An(a)))return s;var y=ni(s),I=c2(y,ni(a))+1;return Ls(y,0,I).join("")}function TU(s,a,u){if(s=Bt(s),s&&(u||a===r))return s.replace(Qe,"");if(!s||!(a=An(a)))return s;var y=ni(s),I=a2(y,ni(a));return Ls(y,I).join("")}function $U(s,a){var u=ee,y=ne;if(sr(a)){var I="separator"in a?a.separator:I;u="length"in a?ft(a.length):u,y="omission"in a?An(a.omission):y}s=Bt(s);var R=s.length;if(Oa(s)){var G=ni(s);R=G.length}if(u>=R)return s;var J=u-Pa(y);if(J<1)return y;var X=G?Ls(G,0,J).join(""):s.slice(0,J);if(I===r)return X+y;if(G&&(J+=X.length-J),Rp(I)){if(s.slice(J).search(I)){var ce,ue=X;for(I.global||(I=Qd(I.source,Bt(vt.exec(I))+"g")),I.lastIndex=0;ce=I.exec(ue);)var ge=ce.index;X=X.slice(0,ge===r?J:ge)}}else if(s.indexOf(An(I),J)!=J){var we=X.lastIndexOf(I);we>-1&&(X=X.slice(0,we))}return X+y}function NU(s){return s=Bt(s),s&&Ye.test(s)?s.replace(Ot,l$):s}var RU=Ba(function(s,a,u){return s+(u?" ":"")+a.toUpperCase()}),Up=Z2("toUpperCase");function Jb(s,a,u){return s=Bt(s),a=u?r:a,a===r?i$(s)?f$(s):YT(s):s.match(a)||[]}var Qb=gt(function(s,a){try{return Ir(s,r,a)}catch(u){return Np(u)?u:new it(u)}}),LU=Xi(function(s,a){return qn(a,function(u){u=Ni(u),Qi(s,u,Tp(s[u],s))}),s});function BU(s){var a=s==null?0:s.length,u=qe();return s=a?tr(s,function(y){if(typeof y[1]!="function")throw new zn(c);return[u(y[0]),y[1]]}):[],gt(function(y){for(var I=-1;++I<a;){var R=s[I];if(Ir(R[0],this,y))return Ir(R[1],this,y)}})}function UU(s){return lN(Kn(s,_))}function Fp(s){return function(){return s}}function FU(s,a){return s==null||s!==s?a:s}var jU=eb(),kU=eb(!0);function dn(s){return s}function jp(s){return P2(typeof s=="function"?s:Kn(s,_))}function qU(s){return T2(Kn(s,_))}function zU(s,a){return $2(s,Kn(a,_))}var HU=gt(function(s,a){return function(u){return el(u,s,a)}}),KU=gt(function(s,a){return function(u){return el(s,u,a)}});function kp(s,a,u){var y=Sr(a),I=vh(a,y);u==null&&!(sr(a)&&(I.length||!y.length))&&(u=a,a=s,s=this,I=vh(a,Sr(a)));var R=!(sr(u)&&"chain"in u)||!!u.chain,G=ts(s);return qn(I,function(J){var X=a[J];s[J]=X,G&&(s.prototype[J]=function(){var ce=this.__chain__;if(R||ce){var ue=s(this.__wrapped__),ge=ue.__actions__=un(this.__actions__);return ge.push({func:X,args:arguments,thisArg:s}),ue.__chain__=ce,ue}return X.apply(s,Ps([this.value()],arguments))})}),s}function WU(){return St._===this&&(St._=w$),this}function qp(){}function VU(s){return s=ft(s),gt(function(a){return N2(a,s)})}var GU=yp(tr),YU=yp(t2),JU=yp(Hd);function Zb(s){return Sp(s)?Kd(Ni(s)):SN(s)}function QU(s){return function(a){return s==null?r:Oo(s,a)}}var ZU=rb(),XU=rb(!0);function zp(){return[]}function Hp(){return!1}function eF(){return{}}function tF(){return""}function rF(){return!0}function nF(s,a){if(s=ft(s),s<1||s>$)return[];var u=v,y=Br(s,v);a=qe(a),s-=v;for(var I=Gd(y,a);++u<s;)a(u);return I}function iF(s){return at(s)?tr(s,Ni):xn(s)?[s]:un(wb(Bt(s)))}function sF(s){var a=++m$;return Bt(s)+a}var oF=Ah(function(s,a){return s+a},0),aF=bp("ceil"),cF=Ah(function(s,a){return s/a},1),lF=bp("floor");function uF(s){return s&&s.length?mh(s,dn,sp):r}function hF(s,a){return s&&s.length?mh(s,qe(a,2),sp):r}function fF(s){return i2(s,dn)}function dF(s,a){return i2(s,qe(a,2))}function pF(s){return s&&s.length?mh(s,dn,lp):r}function gF(s,a){return s&&s.length?mh(s,qe(a,2),lp):r}var mF=Ah(function(s,a){return s*a},1),vF=bp("round"),wF=Ah(function(s,a){return s-a},0);function yF(s){return s&&s.length?Vd(s,dn):0}function bF(s,a){return s&&s.length?Vd(s,qe(a,2)):0}return M.after=qL,M.ary=Ob,M.assign=OB,M.assignIn=zb,M.assignInWith=Lh,M.assignWith=PB,M.at=MB,M.before=Pb,M.bind=Tp,M.bindAll=LU,M.bindKey=Mb,M.castArray=eB,M.chain=Sb,M.chunk=lR,M.compact=uR,M.concat=hR,M.cond=BU,M.conforms=UU,M.constant=Fp,M.countBy=yL,M.create=TB,M.curry=Tb,M.curryRight=$b,M.debounce=Nb,M.defaults=$B,M.defaultsDeep=NB,M.defer=zL,M.delay=HL,M.difference=fR,M.differenceBy=dR,M.differenceWith=pR,M.drop=gR,M.dropRight=mR,M.dropRightWhile=vR,M.dropWhile=wR,M.fill=yR,M.filter=_L,M.flatMap=xL,M.flatMapDeep=IL,M.flatMapDepth=SL,M.flatten=Eb,M.flattenDeep=bR,M.flattenDepth=_R,M.flip=KL,M.flow=jU,M.flowRight=kU,M.fromPairs=ER,M.functions=kB,M.functionsIn=qB,M.groupBy=DL,M.initial=xR,M.intersection=IR,M.intersectionBy=SR,M.intersectionWith=DR,M.invert=HB,M.invertBy=KB,M.invokeMap=OL,M.iteratee=jp,M.keyBy=PL,M.keys=Sr,M.keysIn=fn,M.map=Ph,M.mapKeys=VB,M.mapValues=GB,M.matches=qU,M.matchesProperty=zU,M.memoize=Th,M.merge=YB,M.mergeWith=Hb,M.method=HU,M.methodOf=KU,M.mixin=kp,M.negate=$h,M.nthArg=VU,M.omit=JB,M.omitBy=QB,M.once=WL,M.orderBy=ML,M.over=GU,M.overArgs=VL,M.overEvery=YU,M.overSome=JU,M.partial=$p,M.partialRight=Rb,M.partition=TL,M.pick=ZB,M.pickBy=Kb,M.property=Zb,M.propertyOf=QU,M.pull=MR,M.pullAll=xb,M.pullAllBy=TR,M.pullAllWith=$R,M.pullAt=NR,M.range=ZU,M.rangeRight=XU,M.rearg=GL,M.reject=RL,M.remove=RR,M.rest=YL,M.reverse=Pp,M.sampleSize=BL,M.set=eU,M.setWith=tU,M.shuffle=UL,M.slice=LR,M.sortBy=kL,M.sortedUniq=zR,M.sortedUniqBy=HR,M.split=xU,M.spread=JL,M.tail=KR,M.take=WR,M.takeRight=VR,M.takeRightWhile=GR,M.takeWhile=YR,M.tap=uL,M.throttle=QL,M.thru=Oh,M.toArray=jb,M.toPairs=Wb,M.toPairsIn=Vb,M.toPath=iF,M.toPlainObject=qb,M.transform=rU,M.unary=ZL,M.union=JR,M.unionBy=QR,M.unionWith=ZR,M.uniq=XR,M.uniqBy=eL,M.uniqWith=tL,M.unset=nU,M.unzip=Mp,M.unzipWith=Ib,M.update=iU,M.updateWith=sU,M.values=ja,M.valuesIn=oU,M.without=rL,M.words=Jb,M.wrap=XL,M.xor=nL,M.xorBy=iL,M.xorWith=sL,M.zip=oL,M.zipObject=aL,M.zipObjectDeep=cL,M.zipWith=lL,M.entries=Wb,M.entriesIn=Vb,M.extend=zb,M.extendWith=Lh,kp(M,M),M.add=oF,M.attempt=Qb,M.camelCase=uU,M.capitalize=Gb,M.ceil=aF,M.clamp=aU,M.clone=tB,M.cloneDeep=nB,M.cloneDeepWith=iB,M.cloneWith=rB,M.conformsTo=sB,M.deburr=Yb,M.defaultTo=FU,M.divide=cF,M.endsWith=hU,M.eq=si,M.escape=fU,M.escapeRegExp=dU,M.every=bL,M.find=EL,M.findIndex=bb,M.findKey=RB,M.findLast=AL,M.findLastIndex=_b,M.findLastKey=LB,M.floor=lF,M.forEach=Db,M.forEachRight=Cb,M.forIn=BB,M.forInRight=UB,M.forOwn=FB,M.forOwnRight=jB,M.get=Lp,M.gt=oB,M.gte=aB,M.has=zB,M.hasIn=Bp,M.head=Ab,M.identity=dn,M.includes=CL,M.indexOf=AR,M.inRange=cU,M.invoke=WB,M.isArguments=To,M.isArray=at,M.isArrayBuffer=cB,M.isArrayLike=hn,M.isArrayLikeObject=dr,M.isBoolean=lB,M.isBuffer=Bs,M.isDate=uB,M.isElement=hB,M.isEmpty=fB,M.isEqual=dB,M.isEqualWith=pB,M.isError=Np,M.isFinite=gB,M.isFunction=ts,M.isInteger=Lb,M.isLength=Nh,M.isMap=Bb,M.isMatch=mB,M.isMatchWith=vB,M.isNaN=wB,M.isNative=yB,M.isNil=_B,M.isNull=bB,M.isNumber=Ub,M.isObject=sr,M.isObjectLike=cr,M.isPlainObject=ol,M.isRegExp=Rp,M.isSafeInteger=EB,M.isSet=Fb,M.isString=Rh,M.isSymbol=xn,M.isTypedArray=Fa,M.isUndefined=AB,M.isWeakMap=xB,M.isWeakSet=IB,M.join=CR,M.kebabCase=pU,M.last=Vn,M.lastIndexOf=OR,M.lowerCase=gU,M.lowerFirst=mU,M.lt=SB,M.lte=DB,M.max=uF,M.maxBy=hF,M.mean=fF,M.meanBy=dF,M.min=pF,M.minBy=gF,M.stubArray=zp,M.stubFalse=Hp,M.stubObject=eF,M.stubString=tF,M.stubTrue=rF,M.multiply=mF,M.nth=PR,M.noConflict=WU,M.noop=qp,M.now=Mh,M.pad=vU,M.padEnd=wU,M.padStart=yU,M.parseInt=bU,M.random=lU,M.reduce=$L,M.reduceRight=NL,M.repeat=_U,M.replace=EU,M.result=XB,M.round=vF,M.runInContext=Z,M.sample=LL,M.size=FL,M.snakeCase=AU,M.some=jL,M.sortedIndex=BR,M.sortedIndexBy=UR,M.sortedIndexOf=FR,M.sortedLastIndex=jR,M.sortedLastIndexBy=kR,M.sortedLastIndexOf=qR,M.startCase=IU,M.startsWith=SU,M.subtract=wF,M.sum=yF,M.sumBy=bF,M.template=DU,M.times=nF,M.toFinite=rs,M.toInteger=ft,M.toLength=kb,M.toLower=CU,M.toNumber=Gn,M.toSafeInteger=CB,M.toString=Bt,M.toUpper=OU,M.trim=PU,M.trimEnd=MU,M.trimStart=TU,M.truncate=$U,M.unescape=NU,M.uniqueId=sF,M.upperCase=RU,M.upperFirst=Up,M.each=Db,M.eachRight=Cb,M.first=Ab,kp(M,function(){var s={};return Ti(M,function(a,u){qt.call(M.prototype,u)||(s[u]=a)}),s}(),{chain:!1}),M.VERSION=n,qn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){M[s].placeholder=M}),qn(["drop","take"],function(s,a){At.prototype[s]=function(u){u=u===r?1:yr(ft(u),0);var y=this.__filtered__&&!a?new At(this):this.clone();return y.__filtered__?y.__takeCount__=Br(u,y.__takeCount__):y.__views__.push({size:Br(u,v),type:s+(y.__dir__<0?"Right":"")}),y},At.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),qn(["filter","map","takeWhile"],function(s,a){var u=a+1,y=u==p||u==D;At.prototype[s]=function(I){var R=this.clone();return R.__iteratees__.push({iteratee:qe(I,3),type:u}),R.__filtered__=R.__filtered__||y,R}}),qn(["head","last"],function(s,a){var u="take"+(a?"Right":"");At.prototype[s]=function(){return this[u](1).value()[0]}}),qn(["initial","tail"],function(s,a){var u="drop"+(a?"":"Right");At.prototype[s]=function(){return this.__filtered__?new At(this):this[u](1)}}),At.prototype.compact=function(){return this.filter(dn)},At.prototype.find=function(s){return this.filter(s).head()},At.prototype.findLast=function(s){return this.reverse().find(s)},At.prototype.invokeMap=gt(function(s,a){return typeof s=="function"?new At(this):this.map(function(u){return el(u,s,a)})}),At.prototype.reject=function(s){return this.filter($h(qe(s)))},At.prototype.slice=function(s,a){s=ft(s);var u=this;return u.__filtered__&&(s>0||a<0)?new At(u):(s<0?u=u.takeRight(-s):s&&(u=u.drop(s)),a!==r&&(a=ft(a),u=a<0?u.dropRight(-a):u.take(a-s)),u)},At.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},At.prototype.toArray=function(){return this.take(v)},Ti(At.prototype,function(s,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),y=/^(?:head|last)$/.test(a),I=M[y?"take"+(a=="last"?"Right":""):a],R=y||/^find/.test(a);I&&(M.prototype[a]=function(){var G=this.__wrapped__,J=y?[1]:arguments,X=G instanceof At,ce=J[0],ue=X||at(G),ge=function(yt){var Dt=I.apply(M,Ps([yt],J));return y&&we?Dt[0]:Dt};ue&&u&&typeof ce=="function"&&ce.length!=1&&(X=ue=!1);var we=this.__chain__,Le=!!this.__actions__.length,Ke=R&&!we,pt=X&&!Le;if(!R&&ue){G=pt?G:new At(this);var We=s.apply(G,J);return We.__actions__.push({func:Oh,args:[ge],thisArg:r}),new Hn(We,we)}return Ke&&pt?s.apply(this,J):(We=this.thru(ge),Ke?y?We.value()[0]:We.value():We)})}),qn(["pop","push","shift","sort","splice","unshift"],function(s){var a=th[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",y=/^(?:pop|shift)$/.test(s);M.prototype[s]=function(){var I=arguments;if(y&&!this.__chain__){var R=this.value();return a.apply(at(R)?R:[],I)}return this[u](function(G){return a.apply(at(G)?G:[],I)})}}),Ti(At.prototype,function(s,a){var u=M[a];if(u){var y=u.name+"";qt.call(Na,y)||(Na[y]=[]),Na[y].push({name:a,func:u})}}),Na[Eh(r,Y).name]=[{name:"wrapper",func:r}],At.prototype.clone=N$,At.prototype.reverse=R$,At.prototype.value=L$,M.prototype.at=hL,M.prototype.chain=fL,M.prototype.commit=dL,M.prototype.next=pL,M.prototype.plant=mL,M.prototype.reverse=vL,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=wL,M.prototype.first=M.prototype.head,Vc&&(M.prototype[Vc]=gL),M},Ma=d$();fr?((fr.exports=Ma)._=Ma,Gt._=Ma):St._=Ma}).call(Ec)})(b0,b0.exports);var RD=Object.defineProperty,LD=Object.defineProperties,BD=Object.getOwnPropertyDescriptors,ww=Object.getOwnPropertySymbols,UD=Object.prototype.hasOwnProperty,FD=Object.prototype.propertyIsEnumerable,yw=(t,e,r)=>e in t?RD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ru=(t,e)=>{for(var r in e||(e={}))UD.call(e,r)&&yw(t,r,e[r]);if(ww)for(var r of ww(e))FD.call(e,r)&&yw(t,r,e[r]);return t},jD=(t,e)=>LD(t,BD(e));function ds(t,e,r){var n;const i=wl(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${ND}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Zs(t){return t.includes(":")?t.split(":")[1]:t}function bw(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function kD(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const o=e.namespaces[i].accounts;n.push(...o)}),n}function _0(t={},e={}){const r=_w(t),n=_w(e);return b0.exports.merge(r,n)}function _w(t){var e,r,n,i;const o={};if(!ac(t))return o;for(const[c,l]of Object.entries(t)){const f=Ff(c)?[c]:l.chains,h=l.methods||[],g=l.events||[],_=l.rpcMap||{},E=oc(c);o[E]=jD(ru(ru({},o[E]),l),{chains:yl(f,(e=o[E])==null?void 0:e.chains),methods:yl(h,(r=o[E])==null?void 0:r.methods),events:yl(g,(n=o[E])==null?void 0:n.events),rpcMap:ru(ru({},_),(i=o[E])==null?void 0:i.rpcMap)})}return o}function qD(t){return t.includes(":")?t.split(":")[2]:t}function Ew(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],o=n.events||[],c=n.accounts||[],l=Ff(r)?[r]:n.chains?n.chains:bw(n.accounts);e[r]={chains:l,methods:i,events:o,accounts:c}}return e}function E0(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const Aw={},er=t=>Aw[t],A0=(t,e)=>{Aw[t]=e};class zD{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qi(new fs(n,er("disableProviderPing")))}}class HD{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=er("events"),this.client=er("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())}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,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Hi.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,r){const n=r||ds(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qi(new fs(n,er("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Zs(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const o=parseInt(i,16);if(this.isChainApproved(o))this.setDefaultChain(`${o}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${o}`);else throw new Error(`Failed to switch to chain 'eip155:${o}'. 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}`)}}class KD{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qi(new fs(n,er("disableProviderPing")))}}class WD{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qi(new fs(n,er("disableProviderPing")))}}class VD{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Zs(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qi(new fs(n,er("disableProviderPing")))}}class GD{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qi(new fs(n,er("disableProviderPing")))}}class YD{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qi(new fs(n,er("disableProviderPing")))}}class JD{constructor(e){this.name="near",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||ds(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Hi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace);return typeof n>"u"?void 0:new qi(new fs(n,er("disableProviderPing")))}}var QD=Object.defineProperty,ZD=Object.defineProperties,XD=Object.getOwnPropertyDescriptors,xw=Object.getOwnPropertySymbols,eC=Object.prototype.hasOwnProperty,tC=Object.prototype.propertyIsEnumerable,Iw=(t,e,r)=>e in t?QD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nu=(t,e)=>{for(var r in e||(e={}))eC.call(e,r)&&Iw(t,r,e[r]);if(xw)for(var r of xw(e))tC.call(e,r)&&Iw(t,r,e[r]);return t},x0=(t,e)=>ZD(t,XD(e));class I0{constructor(e){this.events=new Dr.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:yi(Gl({level:e?.logger||mw})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const r=new I0(e);return await r.initialize(),r}async request(e,r,n){const[i,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:nu({},e),chainId:`${i}:${o}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const o=new Date().getTime();this.request(e,n,i).then(c=>r(null,Jl(o,c))).catch(c=>r(c,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:Ut("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){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:r,response:n}=await this.client.authenticate(e);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();if(this.session=i.session,this.session){const o=Ew(this.session.namespaces);this.namespaces=_0(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(o=>{this.session=o;const c=Ew(o.namespaces);this.namespaces=_0(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==uw)throw o;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e);this.getProvider(n).setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(wi(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.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 w0.init({logger:this.providerOpts.logger||mw,relayUrl:this.providerOpts.relayUrl||MD,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),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(r=>oc(r)))];A0("client",this.client),A0("events",this.events),A0("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=kD(r,this.session),i=bw(n),o=_0(this.namespaces,this.optionalNamespaces),c=x0(nu({},o[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new HD({namespace:c});break;case"solana":this.rpcProviders[r]=new KD({namespace:c});break;case"cosmos":this.rpcProviders[r]=new WD({namespace:c});break;case"polkadot":this.rpcProviders[r]=new zD({namespace:c});break;case"cip34":this.rpcProviders[r]=new VD({namespace:c});break;case"elrond":this.rpcProviders[r]=new GD({namespace:c});break;case"multiversx":this.rpcProviders[r]=new YD({namespace:c});break;case"near":this.rpcProviders[r]=new JD({namespace:c});break}})}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:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&wi(i)&&this.events.emit("accountsChanged",i.map(qD))}else if(n.name==="chainChanged"){const i=r.chainId,o=r.event.data,c=oc(i),l=E0(i)!==E0(o)?`${c}:${E0(o)}`:i;this.onChainChanged(l)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,o=(n=this.client)==null?void 0:n.session.get(e);this.session=x0(nu({},o),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",x0(nu({},Ut("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Hi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(c=>oc(c)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=oc(Object.keys(this.namespaces)[0]),o=this.rpcProviders[i].getDefaultChain();return[i,o]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}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,r){this.client.core.storage.setItem(`${vw}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${vw}/${e}`)}}const rC=I0,nC="wc",iC="ethereum_provider",sC=`${nC}@2:${iC}:`,oC="https://rpc.walletconnect.com/v1/",iu=["eth_sendTransaction","personal_sign"],Sw=["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"],su=["chainChanged","accountsChanged"],Dw=["chainChanged","accountsChanged","message","disconnect","connect"];var aC=Object.defineProperty,cC=Object.defineProperties,lC=Object.getOwnPropertyDescriptors,Cw=Object.getOwnPropertySymbols,uC=Object.prototype.hasOwnProperty,hC=Object.prototype.propertyIsEnumerable,Ow=(t,e,r)=>e in t?aC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oa=(t,e)=>{for(var r in e||(e={}))uC.call(e,r)&&Ow(t,r,e[r]);if(Cw)for(var r of Cw(e))hC.call(e,r)&&Ow(t,r,e[r]);return t},S0=(t,e)=>cC(t,lC(e));function ou(t){return Number(t[0].split(":")[1])}function au(t){return`0x${t.toString(16)}`}function fC(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:o,optionalEvents:c,rpcMap:l}=t;if(!wi(e))throw new Error("Invalid chains");const f={chains:e,methods:n||iu,events:o||su,rpcMap:oa({},e.length?{[ou(e)]:l[ou(e)]}:{})},h=o?.filter(A=>!su.includes(A)),g=n?.filter(A=>!iu.includes(A));if(!r&&!c&&!i&&!(h!=null&&h.length)&&!(g!=null&&g.length))return{required:e.length?f:void 0};const _=h?.length&&g?.length||!r,E={chains:[...new Set(_?f.chains.concat(r||[]):r)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:Sw))],events:[...new Set(f.events.concat(c!=null&&c.length?c:Dw))],rpcMap:l};return{required:e.length?f:void 0,optional:r.length?E:void 0}}class cu{constructor(){this.events=new Dr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=sC,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new cu;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}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:r,optional:n}=fC(this.rpc);try{const i=await new Promise(async(c,l)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(S0(oa({namespaces:oa({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then(h=>{c(h)}).catch(h=>{l(new Error(h.message))})});if(!i)return;const o=eg(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:au(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const r=await new Promise(async(i,o)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(S0(oa({},e),{chains:this.rpc.chains})).then(l=>{i(l)}).catch(l=>{o(new Error(l.message))})}),n=r.session;if(n){const i=eg(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:i),this.setAccounts(i),this.events.emit("connect",{chainId:au(this.chainId)})}return r}catch(r){throw this.signer.logger.error(r),r}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:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",au(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",S0(oa({},Ut("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.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 r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",au(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e?.chains)!=null?r:[],o=(n=e?.optionalChains)!=null?n:[],c=i.concat(o);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=i.length?e?.methods||iu:[],f=i.length?e?.events||su:[],h=e?.optionalMethods||[],g=e?.optionalEvents||[],_=e?.rpcMap||this.buildRpcMap(c,e.projectId),E=e?.qrModalOptions||void 0;return{chains:i?.map(A=>this.formatChainId(A)),optionalChains:o.map(A=>this.formatChainId(A)),methods:l,events:f,optionalMethods:h,optionalEvents:g,rpcMap:_,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:E,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?ou(this.rpc.chains):ou(this.rpc.optionalChains),this.signer=await rC.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await Promise.resolve().then(function(){return RC});r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(oa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&wi(r)&&(this.rpc.chains=r.map(o=>this.formatChainId(o)),r.forEach(o=>{this.rpc.rpcMap[o]=i?.[o]||this.getRpcUrl(o)})),n&&wi(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map(o=>this.formatChainId(o)),n.forEach(o=>{this.rpc.rpcMap[o]=i?.[o]||this.getRpcUrl(o)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${oC}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r?.accounts),this.setAccounts(r?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}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(r=>this.parseAccount(r))}}const dC=cu,pC=Symbol(),Pw=Object.getPrototypeOf,D0=new WeakMap,gC=t=>t&&(D0.has(t)?D0.get(t):Pw(t)===Object.prototype||Pw(t)===Array.prototype),mC=t=>gC(t)&&t[pC]||null,Mw=(t,e=!0)=>{D0.set(t,e)},C0=t=>typeof t=="object"&&t!==null,ps=new WeakMap,lu=new WeakSet,vC=(t=Object.is,e=(h,g)=>new Proxy(h,g),r=h=>C0(h)&&!lu.has(h)&&(Array.isArray(h)||!(Symbol.iterator in h))&&!(h instanceof WeakMap)&&!(h instanceof WeakSet)&&!(h instanceof Error)&&!(h instanceof Number)&&!(h instanceof Date)&&!(h instanceof String)&&!(h instanceof RegExp)&&!(h instanceof ArrayBuffer),n=h=>{switch(h.status){case"fulfilled":return h.value;case"rejected":throw h.reason;default:throw h}},i=new WeakMap,o=(h,g,_=n)=>{const E=i.get(h);if(E?.[0]===g)return E[1];const A=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return Mw(A,!0),i.set(h,[g,A]),Reflect.ownKeys(h).forEach(S=>{if(Object.getOwnPropertyDescriptor(A,S))return;const U=Reflect.get(h,S),W={value:U,enumerable:!0,configurable:!0};if(lu.has(U))Mw(U,!1);else if(U instanceof Promise)delete W.value,W.get=()=>_(U);else if(ps.has(U)){const[Y,B]=ps.get(U);W.value=o(Y,B(),_)}Object.defineProperty(A,S,W)}),Object.preventExtensions(A)},c=new WeakMap,l=[1,1],f=h=>{if(!C0(h))throw new Error("object required");const g=c.get(h);if(g)return g;let _=l[0];const E=new Set,A=(te,ee=++l[0])=>{_!==ee&&(_=ee,E.forEach(ne=>ne(te,ee)))};let S=l[1];const U=(te=++l[1])=>(S!==te&&!E.size&&(S=te,Y.forEach(([ee])=>{const ne=ee[1](te);ne>_&&(_=ne)})),_),W=te=>(ee,ne)=>{const fe=[...ee];fe[1]=[te,...fe[1]],A(fe,ne)},Y=new Map,B=(te,ee)=>{if(Y.has(te))throw new Error("prop listener already exists");if(E.size){const ne=ee[3](W(te));Y.set(te,[ee,ne])}else Y.set(te,[ee])},z=te=>{var ee;const ne=Y.get(te);ne&&(Y.delete(te),(ee=ne[1])==null||ee.call(ne))},P=te=>(E.add(te),E.size===1&&Y.forEach(([ne,fe],d)=>{if(fe)throw new Error("remove already exists");const p=ne[3](W(d));Y.set(d,[ne,p])}),()=>{E.delete(te),E.size===0&&Y.forEach(([ne,fe],d)=>{fe&&(fe(),Y.set(d,[ne]))})}),F=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),m=e(F,{deleteProperty(te,ee){const ne=Reflect.get(te,ee);z(ee);const fe=Reflect.deleteProperty(te,ee);return fe&&A(["delete",[ee],ne]),fe},set(te,ee,ne,fe){const d=Reflect.has(te,ee),p=Reflect.get(te,ee,fe);if(d&&(t(p,ne)||c.has(ne)&&t(p,c.get(ne))))return!0;z(ee),C0(ne)&&(ne=mC(ne)||ne);let b=ne;if(ne instanceof Promise)ne.then(D=>{ne.status="fulfilled",ne.value=D,A(["resolve",[ee],D])}).catch(D=>{ne.status="rejected",ne.reason=D,A(["reject",[ee],D])});else{!ps.has(ne)&&r(ne)&&(b=f(ne));const D=!lu.has(b)&&ps.get(b);D&&B(ee,D)}return Reflect.set(te,ee,b,fe),A(["set",[ee],ne,p]),!0}});c.set(h,m);const T=[F,U,o,P];return ps.set(m,T),Reflect.ownKeys(h).forEach(te=>{const ee=Object.getOwnPropertyDescriptor(h,te);"value"in ee&&(m[te]=h[te],delete ee.value,delete ee.writable),Object.defineProperty(F,te,ee)}),m})=>[f,ps,lu,t,e,r,n,i,o,c,l],[wC]=vC();function gs(t={}){return wC(t)}function Xs(t,e,r){const n=ps.get(t);n||console.warn("Please use proxy object");let i;const o=[],c=n[3];let l=!1;const h=c(g=>{if(o.push(g),r){e(o.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,l&&e(o.splice(0))}))});return l=!0,()=>{l=!1,h()}}function yC(t,e){const r=ps.get(t);r||console.warn("Please use proxy object");const[n,i,o]=r;return o(n,i(),e)}const Ar=gs({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),rr={state:Ar,subscribe(t){return Xs(Ar,()=>t(Ar))},push(t,e){t!==Ar.view&&(Ar.view=t,e&&(Ar.data=e),Ar.history.push(t))},reset(t){Ar.view=t,Ar.history=[t]},replace(t){Ar.history.length>1&&(Ar.history[Ar.history.length-1]=t,Ar.view=t)},goBack(){if(Ar.history.length>1){Ar.history.pop();const[t]=Ar.history.slice(-1);Ar.view=t}},setData(t){Ar.data=t}},Ue={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 Ue.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const t=navigator.userAgent.toLowerCase();return Ue.isMobile()&&(t.includes("iphone")||t.includes("ipad"))},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},isArray(t){return Array.isArray(t)&&t.length>0},formatNativeUrl(t,e,r){if(Ue.isHttpUrl(t))return this.formatUniversalUrl(t,e,r);let n=t;n.includes("://")||(n=t.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},formatUniversalUrl(t,e,r){if(!Ue.isHttpUrl(t))return this.formatNativeUrl(t,e,r);let n=t;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},async wait(t){return new Promise(e=>{setTimeout(e,t)})},openHref(t,e){window.open(t,e,"noreferrer noopener")},setWalletConnectDeepLink(t,e){try{localStorage.setItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(t){try{const[e]=t.split("?");localStorage.setItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(Ue.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var t;const e=(t=rr.state.data)==null?void 0:t.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},bC=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Lr=gs({enabled:bC,userSessionId:"",events:[],connectedWalletId:void 0}),Tw={state:Lr,subscribe(t){return Xs(Lr.events,()=>t(yC(Lr.events[Lr.events.length-1])))},initialize(){Lr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Lr.userSessionId=crypto.randomUUID())},setConnectedWalletId(t){Lr.connectedWalletId=t},click(t){if(Lr.enabled){const e={type:"CLICK",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}},track(t){if(Lr.enabled){const e={type:"TRACK",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}},view(t){if(Lr.enabled){const e={type:"VIEW",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}}},Ai=gs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),hr={state:Ai,subscribe(t){return Xs(Ai,()=>t(Ai))},setChains(t){Ai.chains=t},setWalletConnectUri(t){Ai.walletConnectUri=t},setIsCustomDesktop(t){Ai.isCustomDesktop=t},setIsCustomMobile(t){Ai.isCustomMobile=t},setIsDataLoaded(t){Ai.isDataLoaded=t},setIsUiLoaded(t){Ai.isUiLoaded=t},setIsAuth(t){Ai.isAuth=t}},uu=gs({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}),yn={state:uu,subscribe(t){return Xs(uu,()=>t(uu))},setConfig(t){var e,r;Tw.initialize(),hr.setChains(t.chains),hr.setIsAuth(!!t.enableAuthMode),hr.setIsCustomMobile(!!((e=t.mobileWallets)!=null&&e.length)),hr.setIsCustomDesktop(!!((r=t.desktopWallets)!=null&&r.length)),Ue.setModalVersionInStorage(),Object.assign(uu,t)}};var _C=Object.defineProperty,$w=Object.getOwnPropertySymbols,EC=Object.prototype.hasOwnProperty,AC=Object.prototype.propertyIsEnumerable,Nw=(t,e,r)=>e in t?_C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xC=(t,e)=>{for(var r in e||(e={}))EC.call(e,r)&&Nw(t,r,e[r]);if($w)for(var r of $w(e))AC.call(e,r)&&Nw(t,r,e[r]);return t};const O0="https://explorer-api.walletconnect.com",P0="wcm",M0="js-2.6.2";async function hu(t,e){const r=xC({sdkType:P0,sdkVersion:M0},e),n=new URL(t,O0);return n.searchParams.append("projectId",yn.state.projectId),Object.entries(r).forEach(([i,o])=>{o&&n.searchParams.append(i,String(o))}),(await fetch(n)).json()}const eo={async getDesktopListings(t){return hu("/w3m/v1/getDesktopListings",t)},async getMobileListings(t){return hu("/w3m/v1/getMobileListings",t)},async getInjectedListings(t){return hu("/w3m/v1/getInjectedListings",t)},async getAllListings(t){return hu("/w3m/v1/getAllListings",t)},getWalletImageUrl(t){return`${O0}/w3m/v1/getWalletImage/${t}?projectId=${yn.state.projectId}&sdkType=${P0}&sdkVersion=${M0}`},getAssetImageUrl(t){return`${O0}/w3m/v1/getAssetImage/${t}?projectId=${yn.state.projectId}&sdkType=${P0}&sdkVersion=${M0}`}};var IC=Object.defineProperty,Rw=Object.getOwnPropertySymbols,SC=Object.prototype.hasOwnProperty,DC=Object.prototype.propertyIsEnumerable,Lw=(t,e,r)=>e in t?IC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CC=(t,e)=>{for(var r in e||(e={}))SC.call(e,r)&&Lw(t,r,e[r]);if(Rw)for(var r of Rw(e))DC.call(e,r)&&Lw(t,r,e[r]);return t};const Bw=Ue.isMobile(),xi=gs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),an={state:xi,async getRecomendedWallets(){const{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:e}=yn.state;if(t==="NONE"||e==="ALL"&&!t)return xi.recomendedWallets;if(Ue.isArray(t)){const r={recommendedIds:t.join(",")},{listings:n}=await eo.getAllListings(r),i=Object.values(n);i.sort((o,c)=>{const l=t.indexOf(o.id),f=t.indexOf(c.id);return l-f}),xi.recomendedWallets=i}else{const{chains:r,isAuth:n}=hr.state,i=r?.join(","),o=Ue.isArray(e),c={page:1,sdks:n?"auth_v1":void 0,entries:Ue.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:o?e.join(","):void 0},{listings:l}=Bw?await eo.getMobileListings(c):await eo.getDesktopListings(c);xi.recomendedWallets=Object.values(l)}return xi.recomendedWallets},async getWallets(t){const e=CC({},t),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=yn.state,{recomendedWallets:i}=xi;if(n==="ALL")return xi.wallets;i.length?e.excludedIds=i.map(_=>_.id).join(","):Ue.isArray(r)&&(e.excludedIds=r.join(",")),Ue.isArray(n)&&(e.excludedIds=[e.excludedIds,n].filter(Boolean).join(",")),hr.state.isAuth&&(e.sdks="auth_v1");const{page:o,search:c}=t,{listings:l,total:f}=Bw?await eo.getMobileListings(e):await eo.getDesktopListings(e),h=Object.values(l),g=c?"search":"wallets";return xi[g]={listings:[...xi[g].listings,...h],total:f,page:o??1},{listings:h,total:f}},getWalletImageUrl(t){return eo.getWalletImageUrl(t)},getAssetImageUrl(t){return eo.getAssetImageUrl(t)},resetSearch(){xi.search={listings:[],total:0,page:1}}},aa=gs({open:!1}),to={state:aa,subscribe(t){return Xs(aa,()=>t(aa))},async open(t){return new Promise(e=>{const{isUiLoaded:r,isDataLoaded:n}=hr.state;if(Ue.removeWalletConnectDeepLink(),hr.setWalletConnectUri(t?.uri),hr.setChains(t?.chains),rr.reset("ConnectWallet"),r&&n)aa.open=!0,e();else{const i=setInterval(()=>{const o=hr.state;o.isUiLoaded&&o.isDataLoaded&&(clearInterval(i),aa.open=!0,e())},200)}})},close(){aa.open=!1}};var OC=Object.defineProperty,Uw=Object.getOwnPropertySymbols,PC=Object.prototype.hasOwnProperty,MC=Object.prototype.propertyIsEnumerable,Fw=(t,e,r)=>e in t?OC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,TC=(t,e)=>{for(var r in e||(e={}))PC.call(e,r)&&Fw(t,r,e[r]);if(Uw)for(var r of Uw(e))MC.call(e,r)&&Fw(t,r,e[r]);return t};function $C(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const Ac=gs({themeMode:$C()?"dark":"light"}),ms={state:Ac,subscribe(t){return Xs(Ac,()=>t(Ac))},setThemeConfig(t){const{themeMode:e,themeVariables:r}=t;e&&(Ac.themeMode=e),r&&(Ac.themeVariables=TC({},r))}},ro=gs({open:!1,message:"",variant:"success"}),vs={state:ro,subscribe(t){return Xs(ro,()=>t(ro))},openToast(t,e){ro.open=!0,ro.message=t,ro.variant=e},closeToast(){ro.open=!1}};class NC{constructor(e){this.openModal=to.open,this.closeModal=to.close,this.subscribeModal=to.subscribe,this.setTheme=ms.setThemeConfig,ms.setThemeConfig(e),yn.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return zT});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),hr.setIsUiLoaded(!0)}}}var RC=Object.freeze({__proto__:null,WalletConnectModal:NC});/**
96
83
  * @license
97
84
  * Copyright 2019 Google LLC
98
85
  * SPDX-License-Identifier: BSD-3-Clause
99
- */const lu=window,T0=lu.ShadowRoot&&(lu.ShadyCSS===void 0||lu.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$0=Symbol(),Ky=new WeakMap;class Wy{constructor(e,r,n){if(this._$cssResult$=!0,n!==$0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(T0&&e===void 0){const n=r!==void 0&&r.length===1;n&&(e=Ky.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ky.set(r,e))}return e}toString(){return this.cssText}}const QC=t=>new Wy(typeof t=="string"?t:t+"",void 0,$0),Tt=(t,...e)=>{const r=t.length===1?t[0]:e.reduce((n,i,s)=>n+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new Wy(r,t,$0)},ZC=(t,e)=>{T0?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{const n=document.createElement("style"),i=lu.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)})},Vy=T0?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(const n of e.cssRules)r+=n.cssText;return QC(r)})(t):t;/**
86
+ */const fu=window,T0=fu.ShadowRoot&&(fu.ShadyCSS===void 0||fu.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$0=Symbol(),jw=new WeakMap;class kw{constructor(e,r,n){if(this._$cssResult$=!0,n!==$0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(T0&&e===void 0){const n=r!==void 0&&r.length===1;n&&(e=jw.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&jw.set(r,e))}return e}toString(){return this.cssText}}const LC=t=>new kw(typeof t=="string"?t:t+"",void 0,$0),Tt=(t,...e)=>{const r=t.length===1?t[0]:e.reduce((n,i,o)=>n+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new kw(r,t,$0)},BC=(t,e)=>{T0?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{const n=document.createElement("style"),i=fu.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)})},qw=T0?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(const n of e.cssRules)r+=n.cssText;return LC(r)})(t):t;/**
100
87
  * @license
101
88
  * Copyright 2017 Google LLC
102
89
  * SPDX-License-Identifier: BSD-3-Clause
103
- */var N0;const uu=window,Gy=uu.trustedTypes,XC=Gy?Gy.emptyScript:"",Yy=uu.reactiveElementPolyfillSupport,R0={toAttribute(t,e){switch(e){case Boolean:t=t?XC:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},Jy=(t,e)=>e!==t&&(e==e||t==t),L0={attribute:!0,type:String,converter:R0,reflect:!1,hasChanged:Jy},B0="finalized";class ca extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((r,n)=>{const i=this._$Ep(n,r);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,r=L0){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){const n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,r,n){return{get(){return this[r]},set(i){const s=this[e];this[r]=i,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||L0}static finalize(){if(this.hasOwnProperty(B0))return!1;this[B0]=!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 r=this.properties,n=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(const i of n)this.createProperty(i,r[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)r.unshift(Vy(i))}else e!==void 0&&r.push(Vy(e));return r}static _$Ep(e,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(r=>r(this))}addController(e){var r,n;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var e;const r=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return ZC(r,this.constructor.elementStyles),r}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostConnected)===null||n===void 0?void 0:n.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostDisconnected)===null||n===void 0?void 0:n.call(r)})}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$EO(e,r,n=L0){var i;const s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){const c=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:R0).toAttribute(r,n.type);this._$El=e,c==null?this.removeAttribute(s):this.setAttribute(s,c),this._$El=null}}_$AK(e,r){var n;const i=this.constructor,s=i._$Ev.get(e);if(s!==void 0&&this._$El!==s){const c=i.getPropertyOptions(s),l=typeof c.converter=="function"?{fromAttribute:c.converter}:((n=c.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?c.converter:R0;this._$El=s,this[s]=l.fromAttribute(r,c.type),this._$El=null}}requestUpdate(e,r,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Jy)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(r){Promise.reject(r)}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((i,s)=>this[s]=i),this._$Ei=void 0);let r=!1;const n=this._$AL;try{r=this.shouldUpdate(n),r?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdate)===null||s===void 0?void 0:s.call(i)}),this.update(n)):this._$Ek()}catch(i){throw r=!1,this._$Ek(),i}r&&this._$AE(n)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),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((r,n)=>this._$EO(n,this[n],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}ca[B0]=!0,ca.elementProperties=new Map,ca.elementStyles=[],ca.shadowRootOptions={mode:"open"},Yy?.({ReactiveElement:ca}),((N0=uu.reactiveElementVersions)!==null&&N0!==void 0?N0:uu.reactiveElementVersions=[]).push("1.6.3");/**
90
+ */var N0;const du=window,zw=du.trustedTypes,UC=zw?zw.emptyScript:"",Hw=du.reactiveElementPolyfillSupport,R0={toAttribute(t,e){switch(e){case Boolean:t=t?UC:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},Kw=(t,e)=>e!==t&&(e==e||t==t),L0={attribute:!0,type:String,converter:R0,reflect:!1,hasChanged:Kw},B0="finalized";class ca extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((r,n)=>{const i=this._$Ep(n,r);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,r=L0){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){const n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,r,n){return{get(){return this[r]},set(i){const o=this[e];this[r]=i,this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||L0}static finalize(){if(this.hasOwnProperty(B0))return!1;this[B0]=!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 r=this.properties,n=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(const i of n)this.createProperty(i,r[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)r.unshift(qw(i))}else e!==void 0&&r.push(qw(e));return r}static _$Ep(e,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(r=>r(this))}addController(e){var r,n;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var e;const r=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return BC(r,this.constructor.elementStyles),r}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostConnected)===null||n===void 0?void 0:n.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostDisconnected)===null||n===void 0?void 0:n.call(r)})}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$EO(e,r,n=L0){var i;const o=this.constructor._$Ep(e,n);if(o!==void 0&&n.reflect===!0){const c=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:R0).toAttribute(r,n.type);this._$El=e,c==null?this.removeAttribute(o):this.setAttribute(o,c),this._$El=null}}_$AK(e,r){var n;const i=this.constructor,o=i._$Ev.get(e);if(o!==void 0&&this._$El!==o){const c=i.getPropertyOptions(o),l=typeof c.converter=="function"?{fromAttribute:c.converter}:((n=c.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?c.converter:R0;this._$El=o,this[o]=l.fromAttribute(r,c.type),this._$El=null}}requestUpdate(e,r,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Kw)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(r){Promise.reject(r)}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((i,o)=>this[o]=i),this._$Ei=void 0);let r=!1;const n=this._$AL;try{r=this.shouldUpdate(n),r?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var o;return(o=i.hostUpdate)===null||o===void 0?void 0:o.call(i)}),this.update(n)):this._$Ek()}catch(i){throw r=!1,this._$Ek(),i}r&&this._$AE(n)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),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((r,n)=>this._$EO(n,this[n],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}ca[B0]=!0,ca.elementProperties=new Map,ca.elementStyles=[],ca.shadowRootOptions={mode:"open"},Hw?.({ReactiveElement:ca}),((N0=du.reactiveElementVersions)!==null&&N0!==void 0?N0:du.reactiveElementVersions=[]).push("1.6.3");/**
104
91
  * @license
105
92
  * Copyright 2017 Google LLC
106
93
  * SPDX-License-Identifier: BSD-3-Clause
107
- */var U0;const hu=window,la=hu.trustedTypes,Qy=la?la.createPolicy("lit-html",{createHTML:t=>t}):void 0,F0="$lit$",ys=`lit$${(Math.random()+"").slice(9)}$`,Zy="?"+ys,eO=`<${Zy}>`,oo=document,xc=()=>oo.createComment(""),Sc=t=>t===null||typeof t!="object"&&typeof t!="function",Xy=Array.isArray,tO=t=>Xy(t)||typeof t?.[Symbol.iterator]=="function",j0=`[
108
- \f\r]`,Ic=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ew=/-->/g,tw=/>/g,ao=RegExp(`>|${j0}(?:([^\\s"'>=/]+)(${j0}*=${j0}*(?:[^
109
- \f\r"'\`<>=]|("|')|))|$)`,"g"),rw=/'/g,nw=/"/g,iw=/^(?:script|style|textarea|title)$/i,sw=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),ve=sw(1),ar=sw(2),co=Symbol.for("lit-noChange"),vr=Symbol.for("lit-nothing"),ow=new WeakMap,lo=oo.createTreeWalker(oo,129,null,!1);function aw(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qy!==void 0?Qy.createHTML(e):e}const rO=(t,e)=>{const r=t.length-1,n=[];let i,s=e===2?"<svg>":"",c=Ic;for(let l=0;l<r;l++){const f=t[l];let h,m,_=-1,E=0;for(;E<f.length&&(c.lastIndex=E,m=c.exec(f),m!==null);)E=c.lastIndex,c===Ic?m[1]==="!--"?c=ew:m[1]!==void 0?c=tw:m[2]!==void 0?(iw.test(m[2])&&(i=RegExp("</"+m[2],"g")),c=ao):m[3]!==void 0&&(c=ao):c===ao?m[0]===">"?(c=i??Ic,_=-1):m[1]===void 0?_=-2:(_=c.lastIndex-m[2].length,h=m[1],c=m[3]===void 0?ao:m[3]==='"'?nw:rw):c===nw||c===rw?c=ao:c===ew||c===tw?c=Ic:(c=ao,i=void 0);const A=c===ao&&t[l+1].startsWith("/>")?" ":"";s+=c===Ic?f+eO:_>=0?(n.push(h),f.slice(0,_)+F0+f.slice(_)+ys+A):f+ys+(_===-2?(n.push(void 0),l):A)}return[aw(t,s+(t[r]||"<?>")+(e===2?"</svg>":"")),n]};class Dc{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let s=0,c=0;const l=e.length-1,f=this.parts,[h,m]=rO(e,r);if(this.el=Dc.createElement(h,n),lo.currentNode=this.el.content,r===2){const _=this.el.content,E=_.firstChild;E.remove(),_.append(...E.childNodes)}for(;(i=lo.nextNode())!==null&&f.length<l;){if(i.nodeType===1){if(i.hasAttributes()){const _=[];for(const E of i.getAttributeNames())if(E.endsWith(F0)||E.startsWith(ys)){const A=m[c++];if(_.push(E),A!==void 0){const I=i.getAttribute(A.toLowerCase()+F0).split(ys),R=/([.?@])?(.*)/.exec(A);f.push({type:1,index:s,name:R[2],strings:I,ctor:R[1]==="."?iO:R[1]==="?"?oO:R[1]==="@"?aO:fu})}else f.push({type:6,index:s})}for(const E of _)i.removeAttribute(E)}if(iw.test(i.tagName)){const _=i.textContent.split(ys),E=_.length-1;if(E>0){i.textContent=la?la.emptyScript:"";for(let A=0;A<E;A++)i.append(_[A],xc()),lo.nextNode(),f.push({type:2,index:++s});i.append(_[E],xc())}}}else if(i.nodeType===8)if(i.data===Zy)f.push({type:2,index:s});else{let _=-1;for(;(_=i.data.indexOf(ys,_+1))!==-1;)f.push({type:7,index:s}),_+=ys.length-1}s++}}static createElement(e,r){const n=oo.createElement("template");return n.innerHTML=e,n}}function ua(t,e,r=t,n){var i,s,c,l;if(e===co)return e;let f=n!==void 0?(i=r._$Co)===null||i===void 0?void 0:i[n]:r._$Cl;const h=Sc(e)?void 0:e._$litDirective$;return f?.constructor!==h&&((s=f?._$AO)===null||s===void 0||s.call(f,!1),h===void 0?f=void 0:(f=new h(t),f._$AT(t,r,n)),n!==void 0?((c=(l=r)._$Co)!==null&&c!==void 0?c:l._$Co=[])[n]=f:r._$Cl=f),f!==void 0&&(e=ua(t,f._$AS(t,e.values),f,n)),e}class nO{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var r;const{el:{content:n},parts:i}=this._$AD,s=((r=e?.creationScope)!==null&&r!==void 0?r:oo).importNode(n,!0);lo.currentNode=s;let c=lo.nextNode(),l=0,f=0,h=i[0];for(;h!==void 0;){if(l===h.index){let m;h.type===2?m=new Cc(c,c.nextSibling,this,e):h.type===1?m=new h.ctor(c,h.name,h.strings,this,e):h.type===6&&(m=new cO(c,this,e)),this._$AV.push(m),h=i[++f]}l!==h?.index&&(c=lo.nextNode(),l++)}return lo.currentNode=oo,s}v(e){let r=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}}class Cc{constructor(e,r,n,i){var s;this.type=2,this._$AH=vr,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=i,this._$Cp=(s=i?.isConnected)===null||s===void 0||s}get _$AU(){var e,r;return(r=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=ua(this,e,r),Sc(e)?e===vr||e==null||e===""?(this._$AH!==vr&&this._$AR(),this._$AH=vr):e!==this._$AH&&e!==co&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):tO(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!==vr&&Sc(this._$AH)?this._$AA.nextSibling.data=e:this.$(oo.createTextNode(e)),this._$AH=e}g(e){var r;const{values:n,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Dc.createElement(aw(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===s)this._$AH.v(n);else{const c=new nO(s,this),l=c.u(this.options);c.v(n),this.$(l),this._$AH=c}}_$AC(e){let r=ow.get(e.strings);return r===void 0&&ow.set(e.strings,r=new Dc(e)),r}T(e){Xy(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,i=0;for(const s of e)i===r.length?r.push(n=new Cc(this.k(xc()),this.k(xc()),this,this.options)):n=r[i],n._$AI(s),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(e=this._$AA.nextSibling,r){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,r);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}}class fu{constructor(e,r,n,i,s){this.type=1,this._$AH=vr,this._$AN=void 0,this.element=e,this.name=r,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=vr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,r=this,n,i){const s=this.strings;let c=!1;if(s===void 0)e=ua(this,e,r,0),c=!Sc(e)||e!==this._$AH&&e!==co,c&&(this._$AH=e);else{const l=e;let f,h;for(e=s[0],f=0;f<s.length-1;f++)h=ua(this,l[n+f],r,f),h===co&&(h=this._$AH[f]),c||(c=!Sc(h)||h!==this._$AH[f]),h===vr?e=vr:e!==vr&&(e+=(h??"")+s[f+1]),this._$AH[f]=h}c&&!i&&this.j(e)}j(e){e===vr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class iO extends fu{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===vr?void 0:e}}const sO=la?la.emptyScript:"";class oO extends fu{constructor(){super(...arguments),this.type=4}j(e){e&&e!==vr?this.element.setAttribute(this.name,sO):this.element.removeAttribute(this.name)}}class aO extends fu{constructor(e,r,n,i,s){super(e,r,n,i,s),this.type=5}_$AI(e,r=this){var n;if((e=(n=ua(this,e,r,0))!==null&&n!==void 0?n:vr)===co)return;const i=this._$AH,s=e===vr&&i!==vr||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,c=e!==vr&&(i===vr||s);s&&this.element.removeEventListener(this.name,this,i),c&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r,n;typeof this._$AH=="function"?this._$AH.call((n=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}}class cO{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ua(this,e)}}const cw=hu.litHtmlPolyfillSupport;cw?.(Dc,Cc),((U0=hu.litHtmlVersions)!==null&&U0!==void 0?U0:hu.litHtmlVersions=[]).push("2.8.0");const lO=(t,e,r)=>{var n,i;const s=(n=r?.renderBefore)!==null&&n!==void 0?n:e;let c=s._$litPart$;if(c===void 0){const l=(i=r?.renderBefore)!==null&&i!==void 0?i:null;s._$litPart$=c=new Cc(e.insertBefore(xc(),l),l,void 0,r??{})}return c._$AI(t),c};/**
94
+ */var U0;const pu=window,la=pu.trustedTypes,Ww=la?la.createPolicy("lit-html",{createHTML:t=>t}):void 0,F0="$lit$",ws=`lit$${(Math.random()+"").slice(9)}$`,Vw="?"+ws,FC=`<${Vw}>`,no=document,xc=()=>no.createComment(""),Ic=t=>t===null||typeof t!="object"&&typeof t!="function",Gw=Array.isArray,jC=t=>Gw(t)||typeof t?.[Symbol.iterator]=="function",j0=`[
95
+ \f\r]`,Sc=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Yw=/-->/g,Jw=/>/g,io=RegExp(`>|${j0}(?:([^\\s"'>=/]+)(${j0}*=${j0}*(?:[^
96
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Qw=/'/g,Zw=/"/g,Xw=/^(?:script|style|textarea|title)$/i,ey=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),ve=ey(1),ar=ey(2),so=Symbol.for("lit-noChange"),vr=Symbol.for("lit-nothing"),ty=new WeakMap,oo=no.createTreeWalker(no,129,null,!1);function ry(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ww!==void 0?Ww.createHTML(e):e}const kC=(t,e)=>{const r=t.length-1,n=[];let i,o=e===2?"<svg>":"",c=Sc;for(let l=0;l<r;l++){const f=t[l];let h,g,_=-1,E=0;for(;E<f.length&&(c.lastIndex=E,g=c.exec(f),g!==null);)E=c.lastIndex,c===Sc?g[1]==="!--"?c=Yw:g[1]!==void 0?c=Jw:g[2]!==void 0?(Xw.test(g[2])&&(i=RegExp("</"+g[2],"g")),c=io):g[3]!==void 0&&(c=io):c===io?g[0]===">"?(c=i??Sc,_=-1):g[1]===void 0?_=-2:(_=c.lastIndex-g[2].length,h=g[1],c=g[3]===void 0?io:g[3]==='"'?Zw:Qw):c===Zw||c===Qw?c=io:c===Yw||c===Jw?c=Sc:(c=io,i=void 0);const A=c===io&&t[l+1].startsWith("/>")?" ":"";o+=c===Sc?f+FC:_>=0?(n.push(h),f.slice(0,_)+F0+f.slice(_)+ws+A):f+ws+(_===-2?(n.push(void 0),l):A)}return[ry(t,o+(t[r]||"<?>")+(e===2?"</svg>":"")),n]};class Dc{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let o=0,c=0;const l=e.length-1,f=this.parts,[h,g]=kC(e,r);if(this.el=Dc.createElement(h,n),oo.currentNode=this.el.content,r===2){const _=this.el.content,E=_.firstChild;E.remove(),_.append(...E.childNodes)}for(;(i=oo.nextNode())!==null&&f.length<l;){if(i.nodeType===1){if(i.hasAttributes()){const _=[];for(const E of i.getAttributeNames())if(E.endsWith(F0)||E.startsWith(ws)){const A=g[c++];if(_.push(E),A!==void 0){const S=i.getAttribute(A.toLowerCase()+F0).split(ws),U=/([.?@])?(.*)/.exec(A);f.push({type:1,index:o,name:U[2],strings:S,ctor:U[1]==="."?zC:U[1]==="?"?KC:U[1]==="@"?WC:gu})}else f.push({type:6,index:o})}for(const E of _)i.removeAttribute(E)}if(Xw.test(i.tagName)){const _=i.textContent.split(ws),E=_.length-1;if(E>0){i.textContent=la?la.emptyScript:"";for(let A=0;A<E;A++)i.append(_[A],xc()),oo.nextNode(),f.push({type:2,index:++o});i.append(_[E],xc())}}}else if(i.nodeType===8)if(i.data===Vw)f.push({type:2,index:o});else{let _=-1;for(;(_=i.data.indexOf(ws,_+1))!==-1;)f.push({type:7,index:o}),_+=ws.length-1}o++}}static createElement(e,r){const n=no.createElement("template");return n.innerHTML=e,n}}function ua(t,e,r=t,n){var i,o,c,l;if(e===so)return e;let f=n!==void 0?(i=r._$Co)===null||i===void 0?void 0:i[n]:r._$Cl;const h=Ic(e)?void 0:e._$litDirective$;return f?.constructor!==h&&((o=f?._$AO)===null||o===void 0||o.call(f,!1),h===void 0?f=void 0:(f=new h(t),f._$AT(t,r,n)),n!==void 0?((c=(l=r)._$Co)!==null&&c!==void 0?c:l._$Co=[])[n]=f:r._$Cl=f),f!==void 0&&(e=ua(t,f._$AS(t,e.values),f,n)),e}class qC{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var r;const{el:{content:n},parts:i}=this._$AD,o=((r=e?.creationScope)!==null&&r!==void 0?r:no).importNode(n,!0);oo.currentNode=o;let c=oo.nextNode(),l=0,f=0,h=i[0];for(;h!==void 0;){if(l===h.index){let g;h.type===2?g=new Cc(c,c.nextSibling,this,e):h.type===1?g=new h.ctor(c,h.name,h.strings,this,e):h.type===6&&(g=new VC(c,this,e)),this._$AV.push(g),h=i[++f]}l!==h?.index&&(c=oo.nextNode(),l++)}return oo.currentNode=no,o}v(e){let r=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}}class Cc{constructor(e,r,n,i){var o;this.type=2,this._$AH=vr,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=i,this._$Cp=(o=i?.isConnected)===null||o===void 0||o}get _$AU(){var e,r;return(r=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=ua(this,e,r),Ic(e)?e===vr||e==null||e===""?(this._$AH!==vr&&this._$AR(),this._$AH=vr):e!==this._$AH&&e!==so&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):jC(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!==vr&&Ic(this._$AH)?this._$AA.nextSibling.data=e:this.$(no.createTextNode(e)),this._$AH=e}g(e){var r;const{values:n,_$litType$:i}=e,o=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Dc.createElement(ry(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===o)this._$AH.v(n);else{const c=new qC(o,this),l=c.u(this.options);c.v(n),this.$(l),this._$AH=c}}_$AC(e){let r=ty.get(e.strings);return r===void 0&&ty.set(e.strings,r=new Dc(e)),r}T(e){Gw(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,i=0;for(const o of e)i===r.length?r.push(n=new Cc(this.k(xc()),this.k(xc()),this,this.options)):n=r[i],n._$AI(o),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(e=this._$AA.nextSibling,r){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,r);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}}class gu{constructor(e,r,n,i,o){this.type=1,this._$AH=vr,this._$AN=void 0,this.element=e,this.name=r,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=vr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,r=this,n,i){const o=this.strings;let c=!1;if(o===void 0)e=ua(this,e,r,0),c=!Ic(e)||e!==this._$AH&&e!==so,c&&(this._$AH=e);else{const l=e;let f,h;for(e=o[0],f=0;f<o.length-1;f++)h=ua(this,l[n+f],r,f),h===so&&(h=this._$AH[f]),c||(c=!Ic(h)||h!==this._$AH[f]),h===vr?e=vr:e!==vr&&(e+=(h??"")+o[f+1]),this._$AH[f]=h}c&&!i&&this.j(e)}j(e){e===vr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class zC extends gu{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===vr?void 0:e}}const HC=la?la.emptyScript:"";class KC extends gu{constructor(){super(...arguments),this.type=4}j(e){e&&e!==vr?this.element.setAttribute(this.name,HC):this.element.removeAttribute(this.name)}}class WC extends gu{constructor(e,r,n,i,o){super(e,r,n,i,o),this.type=5}_$AI(e,r=this){var n;if((e=(n=ua(this,e,r,0))!==null&&n!==void 0?n:vr)===so)return;const i=this._$AH,o=e===vr&&i!==vr||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,c=e!==vr&&(i===vr||o);o&&this.element.removeEventListener(this.name,this,i),c&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r,n;typeof this._$AH=="function"?this._$AH.call((n=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}}class VC{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ua(this,e)}}const ny=pu.litHtmlPolyfillSupport;ny?.(Dc,Cc),((U0=pu.litHtmlVersions)!==null&&U0!==void 0?U0:pu.litHtmlVersions=[]).push("2.8.0");const GC=(t,e,r)=>{var n,i;const o=(n=r?.renderBefore)!==null&&n!==void 0?n:e;let c=o._$litPart$;if(c===void 0){const l=(i=r?.renderBefore)!==null&&i!==void 0?i:null;o._$litPart$=c=new Cc(e.insertBefore(xc(),l),l,void 0,r??{})}return c._$AI(t),c};/**
110
97
  * @license
111
98
  * Copyright 2017 Google LLC
112
99
  * SPDX-License-Identifier: BSD-3-Clause
113
- */var k0,q0;class mt extends ca{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;const n=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=n.firstChild),n}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=lO(r,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 co}}mt.finalized=!0,mt._$litElement$=!0,(k0=globalThis.litElementHydrateSupport)===null||k0===void 0||k0.call(globalThis,{LitElement:mt});const lw=globalThis.litElementPolyfillSupport;lw?.({LitElement:mt}),((q0=globalThis.litElementVersions)!==null&&q0!==void 0?q0:globalThis.litElementVersions=[]).push("3.3.3");/**
100
+ */var k0,q0;class mt extends ca{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;const n=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=n.firstChild),n}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=GC(r,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 so}}mt.finalized=!0,mt._$litElement$=!0,(k0=globalThis.litElementHydrateSupport)===null||k0===void 0||k0.call(globalThis,{LitElement:mt});const iy=globalThis.litElementPolyfillSupport;iy?.({LitElement:mt}),((q0=globalThis.litElementVersions)!==null&&q0!==void 0?q0:globalThis.litElementVersions=[]).push("3.3.3");/**
114
101
  * @license
115
102
  * Copyright 2017 Google LLC
116
103
  * SPDX-License-Identifier: BSD-3-Clause
117
- */const Ct=t=>e=>typeof e=="function"?((r,n)=>(customElements.define(r,n),n))(t,e):((r,n)=>{const{kind:i,elements:s}=n;return{kind:i,elements:s,finisher(c){customElements.define(r,c)}}})(t,e);/**
104
+ */const Ct=t=>e=>typeof e=="function"?((r,n)=>(customElements.define(r,n),n))(t,e):((r,n)=>{const{kind:i,elements:o}=n;return{kind:i,elements:o,finisher(c){customElements.define(r,c)}}})(t,e);/**
118
105
  * @license
119
106
  * Copyright 2017 Google LLC
120
107
  * SPDX-License-Identifier: BSD-3-Clause
121
- */const uO=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}},hO=(t,e,r)=>{e.constructor.createProperty(r,t)};function ht(t){return(e,r)=>r!==void 0?hO(t,e,r):uO(t,e)}/**
108
+ */const YC=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}},JC=(t,e,r)=>{e.constructor.createProperty(r,t)};function ht(t){return(e,r)=>r!==void 0?JC(t,e,r):YC(t,e)}/**
122
109
  * @license
123
110
  * Copyright 2017 Google LLC
124
111
  * SPDX-License-Identifier: BSD-3-Clause
125
- */function on(t){return ht({...t,state:!0})}/**
112
+ */function cn(t){return ht({...t,state:!0})}/**
126
113
  * @license
127
114
  * Copyright 2021 Google LLC
128
115
  * SPDX-License-Identifier: BSD-3-Clause
@@ -130,20 +117,20 @@ function print() { __p += __j.call(arguments, '') }
130
117
  * @license
131
118
  * Copyright 2017 Google LLC
132
119
  * SPDX-License-Identifier: BSD-3-Clause
133
- */const fO={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},dO=t=>(...e)=>({_$litDirective$:t,values:e});class pO{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,n){this._$Ct=e,this._$AM=r,this._$Ci=n}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}}/**
120
+ */const QC={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ZC=t=>(...e)=>({_$litDirective$:t,values:e});class XC{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,n){this._$Ct=e,this._$AM=r,this._$Ci=n}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}}/**
134
121
  * @license
135
122
  * Copyright 2018 Google LLC
136
123
  * SPDX-License-Identifier: BSD-3-Clause
137
- */const Hi=dO(class extends pO{constructor(t){var e;if(super(t),t.type!==fO.ATTRIBUTE||t.name!=="class"||((e=t.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(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var r,n;if(this.it===void 0){this.it=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((r=this.nt)===null||r===void 0)&&r.has(s))&&this.it.add(s);return this.render(e)}const i=t.element.classList;this.it.forEach(s=>{s in e||(i.remove(s),this.it.delete(s))});for(const s in e){const c=!!e[s];c===this.it.has(s)||!((n=this.nt)===null||n===void 0)&&n.has(s)||(c?(i.add(s),this.it.add(s)):(i.remove(s),this.it.delete(s)))}return co}});function gO(t,e){t.indexOf(e)===-1&&t.push(e)}const uw=(t,e,r)=>Math.min(Math.max(r,t),e),Ln={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},du=t=>typeof t=="number",ha=t=>Array.isArray(t)&&!du(t[0]),mO=(t,e,r)=>{const n=e-t;return((r-t)%n+n)%n+t};function vO(t,e){return ha(t)?t[mO(0,t.length,e)]:t}const hw=(t,e,r)=>-r*t+r*e+t,fw=()=>{},ws=t=>t,H0=(t,e,r)=>e-t===0?1:(r-t)/(e-t);function dw(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=H0(0,e,n);t.push(hw(r,1,i))}}function yO(t){const e=[0];return dw(e,t-1),e}function wO(t,e=yO(t.length),r=ws){const n=t.length,i=n-e.length;return i>0&&dw(e,i),s=>{let c=0;for(;c<n-2&&!(s<e[c+1]);c++);let l=uw(0,1,H0(e[c],e[c+1],s));return l=vO(r,c)(l),hw(t[c],t[c+1],l)}}const pw=t=>Array.isArray(t)&&du(t[0]),K0=t=>typeof t=="object"&&!!t.createAnimation,uo=t=>typeof t=="function",bO=t=>typeof t=="string",Oc={ms:t=>t*1e3,s:t=>t/1e3},gw=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,_O=1e-7,EO=12;function AO(t,e,r,n,i){let s,c,l=0;do c=e+(r-e)/2,s=gw(c,n,i)-t,s>0?r=c:e=c;while(Math.abs(s)>_O&&++l<EO);return c}function Pc(t,e,r,n){if(t===e&&r===n)return ws;const i=s=>AO(s,0,1,t,r);return s=>s===0||s===1?s:gw(i(s),e,n)}const xO=(t,e="end")=>r=>{r=e==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*t,i=e==="end"?Math.floor(n):Math.ceil(n);return uw(0,1,i/t)},mw={ease:Pc(.25,.1,.25,1),"ease-in":Pc(.42,0,1,1),"ease-in-out":Pc(.42,0,.58,1),"ease-out":Pc(0,0,.58,1)},SO=/\((.*?)\)/;function vw(t){if(uo(t))return t;if(pw(t))return Pc(...t);if(mw[t])return mw[t];if(t.startsWith("steps")){const e=SO.exec(t);if(e){const r=e[1].split(",");return xO(parseFloat(r[0]),r[1].trim())}}return ws}class yw{constructor(e,r=[0,1],{easing:n,duration:i=Ln.duration,delay:s=Ln.delay,endDelay:c=Ln.endDelay,repeat:l=Ln.repeat,offset:f,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=ws,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((_,E)=>{this.resolve=_,this.reject=E}),n=n||Ln.easing,K0(n)){const _=n.createAnimation(r);n=_.easing,r=_.keyframes||r,i=_.duration||i}this.repeat=l,this.easing=ha(n)?ws:vw(n),this.updateDuration(i);const m=wO(r,f,ha(n)?n.map(vw):ws);this.tick=_=>{var E;s=s;let A=0;this.pauseTime!==void 0?A=this.pauseTime:A=(_-this.startTime)*this.rate,this.t=A,A/=1e3,A=Math.max(A-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(A=this.totalDuration);const I=A/this.duration;let R=Math.floor(I),W=I%1;!W&&I>=1&&(W=1),W===1&&R--;const Y=R%2;(h==="reverse"||h==="alternate"&&Y||h==="alternate-reverse"&&!Y)&&(W=1-W);const F=A>=this.totalDuration?1:Math.min(W,1),z=m(this.easing(F));e(z),this.pauseTime===void 0&&(this.playState==="finished"||A>=this.totalDuration+c)?(this.playState="finished",(E=this.resolve)===null||E===void 0||E.call(this,z)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},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 W0=function(){};process.env.NODE_ENV!=="production"&&(W0=function(t,e){if(!t)throw new Error(e)});class IO{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const V0=new WeakMap;function ww(t){return V0.has(t)||V0.set(t,{transforms:[],values:new Map}),V0.get(t)}function DO(t,e){return t.has(e)||t.set(e,new IO),t.get(e)}const CO=["","X","Y","Z"],OO=["translate","scale","rotate","skew"],pu={x:"translateX",y:"translateY",z:"translateZ"},bw={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},PO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:bw,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:ws},skew:bw},Mc=new Map,G0=t=>`--motion-${t}`,gu=["x","y","z"];OO.forEach(t=>{CO.forEach(e=>{gu.push(t+e),Mc.set(G0(t+e),PO[t])})});const MO=(t,e)=>gu.indexOf(t)-gu.indexOf(e),TO=new Set(gu),_w=t=>TO.has(t),$O=(t,e)=>{pu[e]&&(e=pu[e]);const{transforms:r}=ww(t);gO(r,e),t.style.transform=NO(r)},NO=t=>t.sort(MO).reduce(RO,"").trim(),RO=(t,e)=>`${t} ${e}(var(${G0(e)}))`,Y0=t=>t.startsWith("--"),Ew=new Set;function LO(t){if(!Ew.has(t)){Ew.add(t);try{const{syntax:e,initialValue:r}=Mc.has(t)?Mc.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:r})}catch{}}}const J0=(t,e)=>document.createElement("div").animate(t,e),Aw={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{J0({opacity:[1]})}catch{return!1}return!0},finished:()=>!!J0({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{J0({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Q0={},fa={};for(const t in Aw)fa[t]=()=>(Q0[t]===void 0&&(Q0[t]=Aw[t]()),Q0[t]);const BO=.015,UO=(t,e)=>{let r="";const n=Math.round(e/BO);for(let i=0;i<n;i++)r+=t(H0(0,n-1,i))+", ";return r.substring(0,r.length-2)},xw=(t,e)=>uo(t)?fa.linearEasing()?`linear(${UO(t,e)})`:Ln.easing:pw(t)?FO(t):t,FO=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`;function jO(t,e){for(let r=0;r<t.length;r++)t[r]===null&&(t[r]=r?t[r-1]:e());return t}const kO=t=>Array.isArray(t)?t:[t];function Z0(t){return pu[t]&&(t=pu[t]),_w(t)?G0(t):t}const mu={get:(t,e)=>{e=Z0(e);let r=Y0(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!r&&r!==0){const n=Mc.get(e);n&&(r=n.initialValue)}return r},set:(t,e,r)=>{e=Z0(e),Y0(e)?t.style.setProperty(e,r):t.style[e]=r}};function Sw(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch{}}function qO(t,e){var r;let n=e?.toDefaultUnit||ws;const i=t[t.length-1];if(bO(i)){const s=((r=i.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";s&&(n=c=>c+s)}return n}function zO(){return window.__MOTION_DEV_TOOLS_RECORD}function HO(t,e,r,n={},i){const s=zO(),c=n.record!==!1&&s;let l,{duration:f=Ln.duration,delay:h=Ln.delay,endDelay:m=Ln.endDelay,repeat:_=Ln.repeat,easing:E=Ln.easing,persist:A=!1,direction:I,offset:R,allowWebkitAcceleration:W=!1}=n;const Y=ww(t),F=_w(e);let z=fa.waapi();F&&$O(t,e);const $=Z0(e),j=DO(Y.values,$),P=Mc.get($);return Sw(j.animation,!(K0(E)&&j.generator)&&n.record!==!1),()=>{const g=()=>{var J,te;return(te=(J=mu.get(t,$))!==null&&J!==void 0?J:P?.initialValue)!==null&&te!==void 0?te:0};let C=jO(kO(r),g);const Z=qO(C,P);if(K0(E)){const J=E.createAnimation(C,e!=="opacity",g,$,j);E=J.easing,C=J.keyframes||C,f=J.duration||f}if(Y0($)&&(fa.cssRegisterProperty()?LO($):z=!1),F&&!fa.linearEasing()&&(uo(E)||ha(E)&&E.some(uo))&&(z=!1),z){P&&(C=C.map(ae=>du(ae)?P.toDefaultUnit(ae):ae)),C.length===1&&(!fa.partialKeyframes()||c)&&C.unshift(g());const J={delay:Oc.ms(h),duration:Oc.ms(f),endDelay:Oc.ms(m),easing:ha(E)?void 0:xw(E,f),direction:I,iterations:_+1,fill:"both"};l=t.animate({[$]:C,offset:R,easing:ha(E)?E.map(ae=>xw(ae,f)):void 0},J),l.finished||(l.finished=new Promise((ae,p)=>{l.onfinish=ae,l.oncancel=p}));const te=C[C.length-1];l.finished.then(()=>{A||(mu.set(t,$,te),l.cancel())}).catch(fw),W||(l.playbackRate=1.000001)}else if(i&&F)C=C.map(J=>typeof J=="string"?parseFloat(J):J),C.length===1&&C.unshift(parseFloat(g())),l=new i(J=>{mu.set(t,$,Z?Z(J):J)},C,Object.assign(Object.assign({},n),{duration:f,easing:E}));else{const J=C[C.length-1];mu.set(t,$,P&&du(J)?P.toDefaultUnit(J):J)}return c&&s(t,e,C,{duration:f,delay:h,easing:E,repeat:_,offset:R},"motion-one"),j.setAnimation(l),l}}const KO=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function Iw(t,e){var r;return typeof t=="string"?e?((r=e[t])!==null&&r!==void 0||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const WO=t=>t(),Dw=(t,e,r=Ln.duration)=>new Proxy({animations:t.map(WO).filter(Boolean),duration:r,options:e},GO),VO=t=>t.animations[0],GO={get:(t,e)=>{const r=VO(t);switch(e){case"duration":return t.duration;case"currentTime":return Oc.s(r?.[e]||0);case"playbackRate":case"playState":return r?.[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(YO)).catch(fw)),t.finished;case"stop":return()=>{t.animations.forEach(n=>Sw(n))};case"forEachNative":return n=>{t.animations.forEach(i=>n(i,t))};default:return typeof r?.[e]>"u"?void 0:()=>t.animations.forEach(n=>n[e]())}},set:(t,e,r)=>{switch(e){case"currentTime":r=Oc.ms(r);case"playbackRate":for(let n=0;n<t.animations.length;n++)t.animations[n][e]=r;return!0}return!1}},YO=t=>t.finished;function JO(t,e,r){return uo(t)?t(e,r):t}function QO(t){return function(r,n,i={}){r=Iw(r);const s=r.length;W0(!!s,"No valid element provided."),W0(!!n,"No keyframes defined.");const c=[];for(let l=0;l<s;l++){const f=r[l];for(const h in n){const m=KO(i,h);m.delay=JO(m.delay,l,s);const _=HO(f,h,n[h],m,t);c.push(_)}}return Dw(c,i,i.duration)}}const ZO=QO(yw);function XO(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}typeof SuppressedError=="function"&&SuppressedError;const eP={any:0,all:1};function tP(t,e,{root:r,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=Iw(t),c=new WeakMap,l=h=>{h.forEach(m=>{const _=c.get(m.target);if(m.isIntersecting!==!!_)if(m.isIntersecting){const E=e(m);uo(E)?c.set(m.target,E):f.unobserve(m.target)}else _&&(_(m),c.delete(m.target))})},f=new IntersectionObserver(l,{root:r,rootMargin:n,threshold:typeof i=="number"?i:eP[i]});return s.forEach(h=>f.observe(h)),()=>f.disconnect()}function X0(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:r}}))}function Cw(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:r}}))}const rP={isActive:t=>!!t.inView,subscribe:(t,{enable:e,disable:r},{inViewOptions:n={}})=>{const{once:i}=n,s=XO(n,["once"]);return tP(t,c=>{if(e(),Cw(t,"viewenter",c),!i)return l=>{r(),Cw(t,"viewleave",l)}},s)}},Ow=(t,e,r)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(r(),X0(t,e,n))};[...Object.keys({inView:rP,hover:{isActive:t=>!!t.hover,subscribe:(t,{enable:e,disable:r})=>{const n=Ow(t,"hoverstart",e),i=Ow(t,"hoverend",r);return t.addEventListener("pointerenter",n),t.addEventListener("pointerleave",i),()=>{t.removeEventListener("pointerenter",n),t.removeEventListener("pointerleave",i)}}},press:{isActive:t=>!!t.press,subscribe:(t,{enable:e,disable:r})=>{const n=s=>{r(),X0(t,"pressend",s),window.removeEventListener("pointerup",n)},i=s=>{e(),X0(t,"pressstart",s),window.addEventListener("pointerup",n)};return t.addEventListener("pointerdown",i),()=>{t.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function nP(t,e={}){return Dw([()=>{const r=new yw(t,[0,1],e);return r.finished.catch(()=>{}),r}],e,e.duration)}function ho(t,e,r){return(uo(t)?nP:ZO)(t,e,r)}/**
124
+ */const Ki=ZC(class extends XC{constructor(t){var e;if(super(t),t.type!==QC.ATTRIBUTE||t.name!=="class"||((e=t.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(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var r,n;if(this.it===void 0){this.it=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(const o in e)e[o]&&!(!((r=this.nt)===null||r===void 0)&&r.has(o))&&this.it.add(o);return this.render(e)}const i=t.element.classList;this.it.forEach(o=>{o in e||(i.remove(o),this.it.delete(o))});for(const o in e){const c=!!e[o];c===this.it.has(o)||!((n=this.nt)===null||n===void 0)&&n.has(o)||(c?(i.add(o),this.it.add(o)):(i.remove(o),this.it.delete(o)))}return so}});function eO(t,e){t.indexOf(e)===-1&&t.push(e)}const sy=(t,e,r)=>Math.min(Math.max(r,t),e),Rn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},mu=t=>typeof t=="number",ha=t=>Array.isArray(t)&&!mu(t[0]),tO=(t,e,r)=>{const n=e-t;return((r-t)%n+n)%n+t};function rO(t,e){return ha(t)?t[tO(0,t.length,e)]:t}const oy=(t,e,r)=>-r*t+r*e+t,ay=()=>{},ys=t=>t,H0=(t,e,r)=>e-t===0?1:(r-t)/(e-t);function cy(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=H0(0,e,n);t.push(oy(r,1,i))}}function nO(t){const e=[0];return cy(e,t-1),e}function iO(t,e=nO(t.length),r=ys){const n=t.length,i=n-e.length;return i>0&&cy(e,i),o=>{let c=0;for(;c<n-2&&!(o<e[c+1]);c++);let l=sy(0,1,H0(e[c],e[c+1],o));return l=rO(r,c)(l),oy(t[c],t[c+1],l)}}const ly=t=>Array.isArray(t)&&mu(t[0]),K0=t=>typeof t=="object"&&!!t.createAnimation,ao=t=>typeof t=="function",sO=t=>typeof t=="string",Oc={ms:t=>t*1e3,s:t=>t/1e3},uy=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,oO=1e-7,aO=12;function cO(t,e,r,n,i){let o,c,l=0;do c=e+(r-e)/2,o=uy(c,n,i)-t,o>0?r=c:e=c;while(Math.abs(o)>oO&&++l<aO);return c}function Pc(t,e,r,n){if(t===e&&r===n)return ys;const i=o=>cO(o,0,1,t,r);return o=>o===0||o===1?o:uy(i(o),e,n)}const lO=(t,e="end")=>r=>{r=e==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*t,i=e==="end"?Math.floor(n):Math.ceil(n);return sy(0,1,i/t)},hy={ease:Pc(.25,.1,.25,1),"ease-in":Pc(.42,0,1,1),"ease-in-out":Pc(.42,0,.58,1),"ease-out":Pc(0,0,.58,1)},uO=/\((.*?)\)/;function fy(t){if(ao(t))return t;if(ly(t))return Pc(...t);if(hy[t])return hy[t];if(t.startsWith("steps")){const e=uO.exec(t);if(e){const r=e[1].split(",");return lO(parseFloat(r[0]),r[1].trim())}}return ys}class dy{constructor(e,r=[0,1],{easing:n,duration:i=Rn.duration,delay:o=Rn.delay,endDelay:c=Rn.endDelay,repeat:l=Rn.repeat,offset:f,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=ys,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((_,E)=>{this.resolve=_,this.reject=E}),n=n||Rn.easing,K0(n)){const _=n.createAnimation(r);n=_.easing,r=_.keyframes||r,i=_.duration||i}this.repeat=l,this.easing=ha(n)?ys:fy(n),this.updateDuration(i);const g=iO(r,f,ha(n)?n.map(fy):ys);this.tick=_=>{var E;o=o;let A=0;this.pauseTime!==void 0?A=this.pauseTime:A=(_-this.startTime)*this.rate,this.t=A,A/=1e3,A=Math.max(A-o,0),this.playState==="finished"&&this.pauseTime===void 0&&(A=this.totalDuration);const S=A/this.duration;let U=Math.floor(S),W=S%1;!W&&S>=1&&(W=1),W===1&&U--;const Y=U%2;(h==="reverse"||h==="alternate"&&Y||h==="alternate-reverse"&&!Y)&&(W=1-W);const B=A>=this.totalDuration?1:Math.min(W,1),z=g(this.easing(B));e(z),this.pauseTime===void 0&&(this.playState==="finished"||A>=this.totalDuration+c)?(this.playState="finished",(E=this.resolve)===null||E===void 0||E.call(this,z)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},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 W0=function(){};process.env.NODE_ENV!=="production"&&(W0=function(t,e){if(!t)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 V0=new WeakMap;function py(t){return V0.has(t)||V0.set(t,{transforms:[],values:new Map}),V0.get(t)}function fO(t,e){return t.has(e)||t.set(e,new hO),t.get(e)}const dO=["","X","Y","Z"],pO=["translate","scale","rotate","skew"],vu={x:"translateX",y:"translateY",z:"translateZ"},gy={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},gO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:gy,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:ys},skew:gy},Mc=new Map,G0=t=>`--motion-${t}`,wu=["x","y","z"];pO.forEach(t=>{dO.forEach(e=>{wu.push(t+e),Mc.set(G0(t+e),gO[t])})});const mO=(t,e)=>wu.indexOf(t)-wu.indexOf(e),vO=new Set(wu),my=t=>vO.has(t),wO=(t,e)=>{vu[e]&&(e=vu[e]);const{transforms:r}=py(t);eO(r,e),t.style.transform=yO(r)},yO=t=>t.sort(mO).reduce(bO,"").trim(),bO=(t,e)=>`${t} ${e}(var(${G0(e)}))`,Y0=t=>t.startsWith("--"),vy=new Set;function _O(t){if(!vy.has(t)){vy.add(t);try{const{syntax:e,initialValue:r}=Mc.has(t)?Mc.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:r})}catch{}}}const J0=(t,e)=>document.createElement("div").animate(t,e),wy={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{J0({opacity:[1]})}catch{return!1}return!0},finished:()=>!!J0({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{J0({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Q0={},fa={};for(const t in wy)fa[t]=()=>(Q0[t]===void 0&&(Q0[t]=wy[t]()),Q0[t]);const EO=.015,AO=(t,e)=>{let r="";const n=Math.round(e/EO);for(let i=0;i<n;i++)r+=t(H0(0,n-1,i))+", ";return r.substring(0,r.length-2)},yy=(t,e)=>ao(t)?fa.linearEasing()?`linear(${AO(t,e)})`:Rn.easing:ly(t)?xO(t):t,xO=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`;function IO(t,e){for(let r=0;r<t.length;r++)t[r]===null&&(t[r]=r?t[r-1]:e());return t}const SO=t=>Array.isArray(t)?t:[t];function Z0(t){return vu[t]&&(t=vu[t]),my(t)?G0(t):t}const yu={get:(t,e)=>{e=Z0(e);let r=Y0(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!r&&r!==0){const n=Mc.get(e);n&&(r=n.initialValue)}return r},set:(t,e,r)=>{e=Z0(e),Y0(e)?t.style.setProperty(e,r):t.style[e]=r}};function by(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch{}}function DO(t,e){var r;let n=e?.toDefaultUnit||ys;const i=t[t.length-1];if(sO(i)){const o=((r=i.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";o&&(n=c=>c+o)}return n}function CO(){return window.__MOTION_DEV_TOOLS_RECORD}function OO(t,e,r,n={},i){const o=CO(),c=n.record!==!1&&o;let l,{duration:f=Rn.duration,delay:h=Rn.delay,endDelay:g=Rn.endDelay,repeat:_=Rn.repeat,easing:E=Rn.easing,persist:A=!1,direction:S,offset:U,allowWebkitAcceleration:W=!1}=n;const Y=py(t),B=my(e);let z=fa.waapi();B&&wO(t,e);const P=Z0(e),F=fO(Y.values,P),j=Mc.get(P);return by(F.animation,!(K0(E)&&F.generator)&&n.record!==!1),()=>{const m=()=>{var ee,ne;return(ne=(ee=yu.get(t,P))!==null&&ee!==void 0?ee:j?.initialValue)!==null&&ne!==void 0?ne:0};let T=IO(SO(r),m);const te=DO(T,j);if(K0(E)){const ee=E.createAnimation(T,e!=="opacity",m,P,F);E=ee.easing,T=ee.keyframes||T,f=ee.duration||f}if(Y0(P)&&(fa.cssRegisterProperty()?_O(P):z=!1),B&&!fa.linearEasing()&&(ao(E)||ha(E)&&E.some(ao))&&(z=!1),z){j&&(T=T.map(fe=>mu(fe)?j.toDefaultUnit(fe):fe)),T.length===1&&(!fa.partialKeyframes()||c)&&T.unshift(m());const ee={delay:Oc.ms(h),duration:Oc.ms(f),endDelay:Oc.ms(g),easing:ha(E)?void 0:yy(E,f),direction:S,iterations:_+1,fill:"both"};l=t.animate({[P]:T,offset:U,easing:ha(E)?E.map(fe=>yy(fe,f)):void 0},ee),l.finished||(l.finished=new Promise((fe,d)=>{l.onfinish=fe,l.oncancel=d}));const ne=T[T.length-1];l.finished.then(()=>{A||(yu.set(t,P,ne),l.cancel())}).catch(ay),W||(l.playbackRate=1.000001)}else if(i&&B)T=T.map(ee=>typeof ee=="string"?parseFloat(ee):ee),T.length===1&&T.unshift(parseFloat(m())),l=new i(ee=>{yu.set(t,P,te?te(ee):ee)},T,Object.assign(Object.assign({},n),{duration:f,easing:E}));else{const ee=T[T.length-1];yu.set(t,P,j&&mu(ee)?j.toDefaultUnit(ee):ee)}return c&&o(t,e,T,{duration:f,delay:h,easing:E,repeat:_,offset:U},"motion-one"),F.setAnimation(l),l}}const PO=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function _y(t,e){var r;return typeof t=="string"?e?((r=e[t])!==null&&r!==void 0||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const MO=t=>t(),Ey=(t,e,r=Rn.duration)=>new Proxy({animations:t.map(MO).filter(Boolean),duration:r,options:e},$O),TO=t=>t.animations[0],$O={get:(t,e)=>{const r=TO(t);switch(e){case"duration":return t.duration;case"currentTime":return Oc.s(r?.[e]||0);case"playbackRate":case"playState":return r?.[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(NO)).catch(ay)),t.finished;case"stop":return()=>{t.animations.forEach(n=>by(n))};case"forEachNative":return n=>{t.animations.forEach(i=>n(i,t))};default:return typeof r?.[e]>"u"?void 0:()=>t.animations.forEach(n=>n[e]())}},set:(t,e,r)=>{switch(e){case"currentTime":r=Oc.ms(r);case"playbackRate":for(let n=0;n<t.animations.length;n++)t.animations[n][e]=r;return!0}return!1}},NO=t=>t.finished;function RO(t,e,r){return ao(t)?t(e,r):t}function LO(t){return function(r,n,i={}){r=_y(r);const o=r.length;W0(!!o,"No valid element provided."),W0(!!n,"No keyframes defined.");const c=[];for(let l=0;l<o;l++){const f=r[l];for(const h in n){const g=PO(i,h);g.delay=RO(g.delay,l,o);const _=OO(f,h,n[h],g,t);c.push(_)}}return Ey(c,i,i.duration)}}const BO=LO(dy);function UO(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}typeof SuppressedError=="function"&&SuppressedError;const FO={any:0,all:1};function jO(t,e,{root:r,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const o=_y(t),c=new WeakMap,l=h=>{h.forEach(g=>{const _=c.get(g.target);if(g.isIntersecting!==!!_)if(g.isIntersecting){const E=e(g);ao(E)?c.set(g.target,E):f.unobserve(g.target)}else _&&(_(g),c.delete(g.target))})},f=new IntersectionObserver(l,{root:r,rootMargin:n,threshold:typeof i=="number"?i:FO[i]});return o.forEach(h=>f.observe(h)),()=>f.disconnect()}function X0(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:r}}))}function Ay(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:r}}))}const kO={isActive:t=>!!t.inView,subscribe:(t,{enable:e,disable:r},{inViewOptions:n={}})=>{const{once:i}=n,o=UO(n,["once"]);return jO(t,c=>{if(e(),Ay(t,"viewenter",c),!i)return l=>{r(),Ay(t,"viewleave",l)}},o)}},xy=(t,e,r)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(r(),X0(t,e,n))};[...Object.keys({inView:kO,hover:{isActive:t=>!!t.hover,subscribe:(t,{enable:e,disable:r})=>{const n=xy(t,"hoverstart",e),i=xy(t,"hoverend",r);return t.addEventListener("pointerenter",n),t.addEventListener("pointerleave",i),()=>{t.removeEventListener("pointerenter",n),t.removeEventListener("pointerleave",i)}}},press:{isActive:t=>!!t.press,subscribe:(t,{enable:e,disable:r})=>{const n=o=>{r(),X0(t,"pressend",o),window.removeEventListener("pointerup",n)},i=o=>{e(),X0(t,"pressstart",o),window.addEventListener("pointerup",n)};return t.addEventListener("pointerdown",i),()=>{t.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function qO(t,e={}){return Ey([()=>{const r=new dy(t,[0,1],e);return r.finished.catch(()=>{}),r}],e,e.duration)}function co(t,e,r){return(ao(t)?qO:BO)(t,e,r)}/**
138
125
  * @license
139
126
  * Copyright 2018 Google LLC
140
127
  * SPDX-License-Identifier: BSD-3-Clause
141
- */const Wr=t=>t??vr;var Tc={},iP=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Pw={},bn={};let ed;const sP=[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];bn.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},bn.getSymbolTotalCodewords=function(e){return sP[e]},bn.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e},bn.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ed=e},bn.isKanjiModeEnabled=function(){return typeof ed<"u"},bn.toSJIS=function(e){return ed(e)};var vu={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},t.from=function(n,i){if(t.isValid(n))return n;try{return e(n)}catch{return i}}})(vu);function Mw(){this.buffer=[],this.length=0}Mw.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var oP=Mw;function $c(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}$c.prototype.set=function(t,e,r,n){const i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)},$c.prototype.get=function(t,e){return this.data[t*this.size+e]},$c.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},$c.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var aP=$c,Tw={};(function(t){const e=bn.getSymbolSize;t.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,s=e(n),c=s===145?26:Math.ceil((s-13)/(2*i-2))*2,l=[s-7];for(let f=1;f<i-1;f++)l[f]=l[f-1]-c;return l.push(6),l.reverse()},t.getPositions=function(n){const i=[],s=t.getRowColCoords(n),c=s.length;for(let l=0;l<c;l++)for(let f=0;f<c;f++)l===0&&f===0||l===0&&f===c-1||l===c-1&&f===0||i.push([s[l],s[f]]);return i}})(Tw);var $w={};const cP=bn.getSymbolSize,Nw=7;$w.getPositions=function(e){const r=cP(e);return[[0,0],[r-Nw,0],[0,r-Nw]]};var Rw={};(function(t){t.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};t.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},t.from=function(i){return t.isValid(i)?parseInt(i,10):void 0},t.getPenaltyN1=function(i){const s=i.size;let c=0,l=0,f=0,h=null,m=null;for(let _=0;_<s;_++){l=f=0,h=m=null;for(let E=0;E<s;E++){let A=i.get(_,E);A===h?l++:(l>=5&&(c+=e.N1+(l-5)),h=A,l=1),A=i.get(E,_),A===m?f++:(f>=5&&(c+=e.N1+(f-5)),m=A,f=1)}l>=5&&(c+=e.N1+(l-5)),f>=5&&(c+=e.N1+(f-5))}return c},t.getPenaltyN2=function(i){const s=i.size;let c=0;for(let l=0;l<s-1;l++)for(let f=0;f<s-1;f++){const h=i.get(l,f)+i.get(l,f+1)+i.get(l+1,f)+i.get(l+1,f+1);(h===4||h===0)&&c++}return c*e.N2},t.getPenaltyN3=function(i){const s=i.size;let c=0,l=0,f=0;for(let h=0;h<s;h++){l=f=0;for(let m=0;m<s;m++)l=l<<1&2047|i.get(h,m),m>=10&&(l===1488||l===93)&&c++,f=f<<1&2047|i.get(m,h),m>=10&&(f===1488||f===93)&&c++}return c*e.N3},t.getPenaltyN4=function(i){let s=0;const c=i.data.length;for(let f=0;f<c;f++)s+=i.data[f];return Math.abs(Math.ceil(s*100/c/5)-10)*e.N4};function r(n,i,s){switch(n){case t.Patterns.PATTERN000:return(i+s)%2===0;case t.Patterns.PATTERN001:return i%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(i+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return i*s%2+i*s%3===0;case t.Patterns.PATTERN110:return(i*s%2+i*s%3)%2===0;case t.Patterns.PATTERN111:return(i*s%3+(i+s)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}t.applyMask=function(i,s){const c=s.size;for(let l=0;l<c;l++)for(let f=0;f<c;f++)s.isReserved(f,l)||s.xor(f,l,r(i,f,l))},t.getBestMask=function(i,s){const c=Object.keys(t.Patterns).length;let l=0,f=1/0;for(let h=0;h<c;h++){s(h),t.applyMask(h,i);const m=t.getPenaltyN1(i)+t.getPenaltyN2(i)+t.getPenaltyN3(i)+t.getPenaltyN4(i);t.applyMask(h,i),m<f&&(f=m,l=h)}return l}})(Rw);var yu={};const bs=vu,wu=[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],bu=[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];yu.getBlocksCount=function(e,r){switch(r){case bs.L:return wu[(e-1)*4+0];case bs.M:return wu[(e-1)*4+1];case bs.Q:return wu[(e-1)*4+2];case bs.H:return wu[(e-1)*4+3];default:return}},yu.getTotalCodewordsCount=function(e,r){switch(r){case bs.L:return bu[(e-1)*4+0];case bs.M:return bu[(e-1)*4+1];case bs.Q:return bu[(e-1)*4+2];case bs.H:return bu[(e-1)*4+3];default:return}};var Lw={},_u={};const Nc=new Uint8Array(512),Eu=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Nc[r]=e,Eu[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Nc[r]=Nc[r-255]})(),_u.log=function(e){if(e<1)throw new Error("log("+e+")");return Eu[e]},_u.exp=function(e){return Nc[e]},_u.mul=function(e,r){return e===0||r===0?0:Nc[Eu[e]+Eu[r]]},function(t){const e=_u;t.mul=function(n,i){const s=new Uint8Array(n.length+i.length-1);for(let c=0;c<n.length;c++)for(let l=0;l<i.length;l++)s[c+l]^=e.mul(n[c],i[l]);return s},t.mod=function(n,i){let s=new Uint8Array(n);for(;s.length-i.length>=0;){const c=s[0];for(let f=0;f<i.length;f++)s[f]^=e.mul(i[f],c);let l=0;for(;l<s.length&&s[l]===0;)l++;s=s.slice(l)}return s},t.generateECPolynomial=function(n){let i=new Uint8Array([1]);for(let s=0;s<n;s++)i=t.mul(i,new Uint8Array([1,e.exp(s)]));return i}}(Lw);const Bw=Lw;function td(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}td.prototype.initialize=function(e){this.degree=e,this.genPoly=Bw.generateECPolynomial(this.degree)},td.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(e.length+this.degree);r.set(e);const n=Bw.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){const s=new Uint8Array(this.degree);return s.set(n,i),s}return n};var lP=td,Uw={},_s={},rd={};rd.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var xi={};const Fw="[0-9]+",uP="[A-Z $%*+\\-./:]+";let Rc="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Rc=Rc.replace(/u/g,"\\u");const hP="(?:(?![A-Z0-9 $%*+\\-./:]|"+Rc+`)(?:.|[\r
142
- ]))+`;xi.KANJI=new RegExp(Rc,"g"),xi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),xi.BYTE=new RegExp(hP,"g"),xi.NUMERIC=new RegExp(Fw,"g"),xi.ALPHANUMERIC=new RegExp(uP,"g");const fP=new RegExp("^"+Rc+"$"),dP=new RegExp("^"+Fw+"$"),pP=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");xi.testKanji=function(e){return fP.test(e)},xi.testNumeric=function(e){return dP.test(e)},xi.testAlphanumeric=function(e){return pP.test(e)},function(t){const e=rd,r=xi;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,c){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?s.ccBits[0]:c<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+i)}}t.from=function(s,c){if(t.isValid(s))return s;try{return n(s)}catch{return c}}}(_s),function(t){const e=bn,r=yu,n=vu,i=_s,s=rd,c=7973,l=e.getBCHDigit(c);function f(E,A,I){for(let R=1;R<=40;R++)if(A<=t.getCapacity(R,I,E))return R}function h(E,A){return i.getCharCountIndicator(E,A)+4}function m(E,A){let I=0;return E.forEach(function(R){const W=h(R.mode,A);I+=W+R.getBitsLength()}),I}function _(E,A){for(let I=1;I<=40;I++)if(m(E,I)<=t.getCapacity(I,A,i.MIXED))return I}t.from=function(A,I){return s.isValid(A)?parseInt(A,10):I},t.getCapacity=function(A,I,R){if(!s.isValid(A))throw new Error("Invalid QR Code version");typeof R>"u"&&(R=i.BYTE);const W=e.getSymbolTotalCodewords(A),Y=r.getTotalCodewordsCount(A,I),F=(W-Y)*8;if(R===i.MIXED)return F;const z=F-h(R,A);switch(R){case i.NUMERIC:return Math.floor(z/10*3);case i.ALPHANUMERIC:return Math.floor(z/11*2);case i.KANJI:return Math.floor(z/13);case i.BYTE:default:return Math.floor(z/8)}},t.getBestVersionForData=function(A,I){let R;const W=n.from(I,n.M);if(Array.isArray(A)){if(A.length>1)return _(A,W);if(A.length===0)return 1;R=A[0]}else R=A;return f(R.mode,R.getLength(),W)},t.getEncodedBits=function(A){if(!s.isValid(A)||A<7)throw new Error("Invalid QR Code version");let I=A<<12;for(;e.getBCHDigit(I)-l>=0;)I^=c<<e.getBCHDigit(I)-l;return A<<12|I}}(Uw);var jw={};const nd=bn,kw=1335,gP=21522,qw=nd.getBCHDigit(kw);jw.getEncodedBits=function(e,r){const n=e.bit<<3|r;let i=n<<10;for(;nd.getBCHDigit(i)-qw>=0;)i^=kw<<nd.getBCHDigit(i)-qw;return(n<<10|i)^gP};var zw={};const mP=_s;function da(t){this.mode=mP.NUMERIC,this.data=t.toString()}da.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},da.prototype.getLength=function(){return this.data.length},da.prototype.getBitsLength=function(){return da.getBitsLength(this.data.length)},da.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);const s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};var vP=da;const yP=_s,id=["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 pa(t){this.mode=yP.ALPHANUMERIC,this.data=t}pa.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},pa.prototype.getLength=function(){return this.data.length},pa.prototype.getBitsLength=function(){return pa.getBitsLength(this.data.length)},pa.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=id.indexOf(this.data[r])*45;n+=id.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(id.indexOf(this.data[r]),6)};var wP=pa,bP=function(e){for(var r=[],n=e.length,i=0;i<n;i++){var s=e.charCodeAt(i);if(s>=55296&&s<=56319&&n>i+1){var c=e.charCodeAt(i+1);c>=56320&&c<=57343&&(s=(s-55296)*1024+c-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer};const _P=bP,EP=_s;function ga(t){this.mode=EP.BYTE,typeof t=="string"&&(t=_P(t)),this.data=new Uint8Array(t)}ga.getBitsLength=function(e){return e*8},ga.prototype.getLength=function(){return this.data.length},ga.prototype.getBitsLength=function(){return ga.getBitsLength(this.data.length)},ga.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var AP=ga;const xP=_s,SP=bn;function ma(t){this.mode=xP.KANJI,this.data=t}ma.getBitsLength=function(e){return e*13},ma.prototype.getLength=function(){return this.data.length},ma.prototype.getBitsLength=function(){return ma.getBitsLength(this.data.length)},ma.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=SP.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
143
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var IP=ma,Hw={exports:{}};(function(t){var e={single_source_shortest_paths:function(r,n,i){var s={},c={};c[n]=0;var l=e.PriorityQueue.make();l.push(n,0);for(var f,h,m,_,E,A,I,R,W;!l.empty();){f=l.pop(),h=f.value,_=f.cost,E=r[h]||{};for(m in E)E.hasOwnProperty(m)&&(A=E[m],I=_+A,R=c[m],W=typeof c[m]>"u",(W||R>I)&&(c[m]=I,l.push(m,I),s[m]=h))}if(typeof i<"u"&&typeof c[i]>"u"){var Y=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(Y)}return s},extract_shortest_path_from_predecessor_list:function(r,n){for(var i=[],s=n;s;)i.push(s),r[s],s=r[s];return i.reverse(),i},find_path:function(r,n,i){var s=e.single_source_shortest_paths(r,n,i);return e.extract_shortest_path_from_predecessor_list(s,i)},PriorityQueue:{make:function(r){var n=e.PriorityQueue,i={},s;r=r||{};for(s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);return i.queue=[],i.sorter=r.sorter||n.default_sorter,i},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var i={value:r,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(Hw),function(t){const e=_s,r=vP,n=wP,i=AP,s=IP,c=xi,l=bn,f=Hw.exports;function h(Y){return unescape(encodeURIComponent(Y)).length}function m(Y,F,z){const $=[];let j;for(;(j=Y.exec(z))!==null;)$.push({data:j[0],index:j.index,mode:F,length:j[0].length});return $}function _(Y){const F=m(c.NUMERIC,e.NUMERIC,Y),z=m(c.ALPHANUMERIC,e.ALPHANUMERIC,Y);let $,j;return l.isKanjiModeEnabled()?($=m(c.BYTE,e.BYTE,Y),j=m(c.KANJI,e.KANJI,Y)):($=m(c.BYTE_KANJI,e.BYTE,Y),j=[]),F.concat(z,$,j).sort(function(g,C){return g.index-C.index}).map(function(g){return{data:g.data,mode:g.mode,length:g.length}})}function E(Y,F){switch(F){case e.NUMERIC:return r.getBitsLength(Y);case e.ALPHANUMERIC:return n.getBitsLength(Y);case e.KANJI:return s.getBitsLength(Y);case e.BYTE:return i.getBitsLength(Y)}}function A(Y){return Y.reduce(function(F,z){const $=F.length-1>=0?F[F.length-1]:null;return $&&$.mode===z.mode?(F[F.length-1].data+=z.data,F):(F.push(z),F)},[])}function I(Y){const F=[];for(let z=0;z<Y.length;z++){const $=Y[z];switch($.mode){case e.NUMERIC:F.push([$,{data:$.data,mode:e.ALPHANUMERIC,length:$.length},{data:$.data,mode:e.BYTE,length:$.length}]);break;case e.ALPHANUMERIC:F.push([$,{data:$.data,mode:e.BYTE,length:$.length}]);break;case e.KANJI:F.push([$,{data:$.data,mode:e.BYTE,length:h($.data)}]);break;case e.BYTE:F.push([{data:$.data,mode:e.BYTE,length:h($.data)}])}}return F}function R(Y,F){const z={},$={start:{}};let j=["start"];for(let P=0;P<Y.length;P++){const g=Y[P],C=[];for(let Z=0;Z<g.length;Z++){const J=g[Z],te=""+P+Z;C.push(te),z[te]={node:J,lastCount:0},$[te]={};for(let ae=0;ae<j.length;ae++){const p=j[ae];z[p]&&z[p].node.mode===J.mode?($[p][te]=E(z[p].lastCount+J.length,J.mode)-E(z[p].lastCount,J.mode),z[p].lastCount+=J.length):(z[p]&&(z[p].lastCount=J.length),$[p][te]=E(J.length,J.mode)+4+e.getCharCountIndicator(J.mode,F))}}j=C}for(let P=0;P<j.length;P++)$[j[P]].end=0;return{map:$,table:z}}function W(Y,F){let z;const $=e.getBestModeForData(Y);if(z=e.from(F,$),z!==e.BYTE&&z.bit<$.bit)throw new Error('"'+Y+'" cannot be encoded with mode '+e.toString(z)+`.
144
- Suggested mode is: `+e.toString($));switch(z===e.KANJI&&!l.isKanjiModeEnabled()&&(z=e.BYTE),z){case e.NUMERIC:return new r(Y);case e.ALPHANUMERIC:return new n(Y);case e.KANJI:return new s(Y);case e.BYTE:return new i(Y)}}t.fromArray=function(F){return F.reduce(function(z,$){return typeof $=="string"?z.push(W($,null)):$.data&&z.push(W($.data,$.mode)),z},[])},t.fromString=function(F,z){const $=_(F,l.isKanjiModeEnabled()),j=I($),P=R(j,z),g=f.find_path(P.map,"start","end"),C=[];for(let Z=1;Z<g.length-1;Z++)C.push(P.table[g[Z]].node);return t.fromArray(A(C))},t.rawSplit=function(F){return t.fromArray(_(F,l.isKanjiModeEnabled()))}}(zw);const Au=bn,sd=vu,DP=oP,CP=aP,OP=Tw,PP=$w,od=Rw,ad=yu,MP=lP,xu=Uw,TP=jw,$P=_s,cd=zw;function NP(t,e){const r=t.size,n=PP.getPositions(e);for(let i=0;i<n.length;i++){const s=n[i][0],c=n[i][1];for(let l=-1;l<=7;l++)if(!(s+l<=-1||r<=s+l))for(let f=-1;f<=7;f++)c+f<=-1||r<=c+f||(l>=0&&l<=6&&(f===0||f===6)||f>=0&&f<=6&&(l===0||l===6)||l>=2&&l<=4&&f>=2&&f<=4?t.set(s+l,c+f,!0,!0):t.set(s+l,c+f,!1,!0))}}function RP(t){const e=t.size;for(let r=8;r<e-8;r++){const n=r%2===0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}function LP(t,e){const r=OP.getPositions(e);for(let n=0;n<r.length;n++){const i=r[n][0],s=r[n][1];for(let c=-2;c<=2;c++)for(let l=-2;l<=2;l++)c===-2||c===2||l===-2||l===2||c===0&&l===0?t.set(i+c,s+l,!0,!0):t.set(i+c,s+l,!1,!0)}}function BP(t,e){const r=t.size,n=xu.getEncodedBits(e);let i,s,c;for(let l=0;l<18;l++)i=Math.floor(l/3),s=l%3+r-8-3,c=(n>>l&1)===1,t.set(i,s,c,!0),t.set(s,i,c,!0)}function ld(t,e,r){const n=t.size,i=TP.getEncodedBits(e,r);let s,c;for(s=0;s<15;s++)c=(i>>s&1)===1,s<6?t.set(s,8,c,!0):s<8?t.set(s+1,8,c,!0):t.set(n-15+s,8,c,!0),s<8?t.set(8,n-s-1,c,!0):s<9?t.set(8,15-s-1+1,c,!0):t.set(8,15-s-1,c,!0);t.set(n-8,8,1,!0)}function UP(t,e){const r=t.size;let n=-1,i=r-1,s=7,c=0;for(let l=r-1;l>0;l-=2)for(l===6&&l--;;){for(let f=0;f<2;f++)if(!t.isReserved(i,l-f)){let h=!1;c<e.length&&(h=(e[c]>>>s&1)===1),t.set(i,l-f,h),s--,s===-1&&(c++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function FP(t,e,r){const n=new DP;r.forEach(function(f){n.put(f.mode.bit,4),n.put(f.getLength(),$P.getCharCountIndicator(f.mode,t)),f.write(n)});const i=Au.getSymbolTotalCodewords(t),s=ad.getTotalCodewordsCount(t,e),c=(i-s)*8;for(n.getLengthInBits()+4<=c&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);const l=(c-n.getLengthInBits())/8;for(let f=0;f<l;f++)n.put(f%2?17:236,8);return jP(n,t,e)}function jP(t,e,r){const n=Au.getSymbolTotalCodewords(e),i=ad.getTotalCodewordsCount(e,r),s=n-i,c=ad.getBlocksCount(e,r),l=n%c,f=c-l,h=Math.floor(n/c),m=Math.floor(s/c),_=m+1,E=h-m,A=new MP(E);let I=0;const R=new Array(c),W=new Array(c);let Y=0;const F=new Uint8Array(t.buffer);for(let g=0;g<c;g++){const C=g<f?m:_;R[g]=F.slice(I,I+C),W[g]=A.encode(R[g]),I+=C,Y=Math.max(Y,C)}const z=new Uint8Array(n);let $=0,j,P;for(j=0;j<Y;j++)for(P=0;P<c;P++)j<R[P].length&&(z[$++]=R[P][j]);for(j=0;j<E;j++)for(P=0;P<c;P++)z[$++]=W[P][j];return z}function kP(t,e,r,n){let i;if(Array.isArray(t))i=cd.fromArray(t);else if(typeof t=="string"){let h=e;if(!h){const m=cd.rawSplit(t);h=xu.getBestVersionForData(m,r)}i=cd.fromString(t,h||40)}else throw new Error("Invalid data");const s=xu.getBestVersionForData(i,r);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(`
128
+ */const Wr=t=>t??vr;var Tc={},zO=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Iy={},bn={};let ed;const HO=[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];bn.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},bn.getSymbolTotalCodewords=function(e){return HO[e]},bn.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e},bn.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ed=e},bn.isKanjiModeEnabled=function(){return typeof ed<"u"},bn.toSJIS=function(e){return ed(e)};var bu={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},t.from=function(n,i){if(t.isValid(n))return n;try{return e(n)}catch{return i}}})(bu);function Sy(){this.buffer=[],this.length=0}Sy.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var KO=Sy;function $c(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}$c.prototype.set=function(t,e,r,n){const i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)},$c.prototype.get=function(t,e){return this.data[t*this.size+e]},$c.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},$c.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var WO=$c,Dy={};(function(t){const e=bn.getSymbolSize;t.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,o=e(n),c=o===145?26:Math.ceil((o-13)/(2*i-2))*2,l=[o-7];for(let f=1;f<i-1;f++)l[f]=l[f-1]-c;return l.push(6),l.reverse()},t.getPositions=function(n){const i=[],o=t.getRowColCoords(n),c=o.length;for(let l=0;l<c;l++)for(let f=0;f<c;f++)l===0&&f===0||l===0&&f===c-1||l===c-1&&f===0||i.push([o[l],o[f]]);return i}})(Dy);var Cy={};const VO=bn.getSymbolSize,Oy=7;Cy.getPositions=function(e){const r=VO(e);return[[0,0],[r-Oy,0],[0,r-Oy]]};var Py={};(function(t){t.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};t.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},t.from=function(i){return t.isValid(i)?parseInt(i,10):void 0},t.getPenaltyN1=function(i){const o=i.size;let c=0,l=0,f=0,h=null,g=null;for(let _=0;_<o;_++){l=f=0,h=g=null;for(let E=0;E<o;E++){let A=i.get(_,E);A===h?l++:(l>=5&&(c+=e.N1+(l-5)),h=A,l=1),A=i.get(E,_),A===g?f++:(f>=5&&(c+=e.N1+(f-5)),g=A,f=1)}l>=5&&(c+=e.N1+(l-5)),f>=5&&(c+=e.N1+(f-5))}return c},t.getPenaltyN2=function(i){const o=i.size;let c=0;for(let l=0;l<o-1;l++)for(let f=0;f<o-1;f++){const h=i.get(l,f)+i.get(l,f+1)+i.get(l+1,f)+i.get(l+1,f+1);(h===4||h===0)&&c++}return c*e.N2},t.getPenaltyN3=function(i){const o=i.size;let c=0,l=0,f=0;for(let h=0;h<o;h++){l=f=0;for(let g=0;g<o;g++)l=l<<1&2047|i.get(h,g),g>=10&&(l===1488||l===93)&&c++,f=f<<1&2047|i.get(g,h),g>=10&&(f===1488||f===93)&&c++}return c*e.N3},t.getPenaltyN4=function(i){let o=0;const c=i.data.length;for(let f=0;f<c;f++)o+=i.data[f];return Math.abs(Math.ceil(o*100/c/5)-10)*e.N4};function r(n,i,o){switch(n){case t.Patterns.PATTERN000:return(i+o)%2===0;case t.Patterns.PATTERN001:return i%2===0;case t.Patterns.PATTERN010:return o%3===0;case t.Patterns.PATTERN011:return(i+o)%3===0;case t.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(o/3))%2===0;case t.Patterns.PATTERN101:return i*o%2+i*o%3===0;case t.Patterns.PATTERN110:return(i*o%2+i*o%3)%2===0;case t.Patterns.PATTERN111:return(i*o%3+(i+o)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}t.applyMask=function(i,o){const c=o.size;for(let l=0;l<c;l++)for(let f=0;f<c;f++)o.isReserved(f,l)||o.xor(f,l,r(i,f,l))},t.getBestMask=function(i,o){const c=Object.keys(t.Patterns).length;let l=0,f=1/0;for(let h=0;h<c;h++){o(h),t.applyMask(h,i);const g=t.getPenaltyN1(i)+t.getPenaltyN2(i)+t.getPenaltyN3(i)+t.getPenaltyN4(i);t.applyMask(h,i),g<f&&(f=g,l=h)}return l}})(Py);var _u={};const bs=bu,Eu=[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],Au=[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];_u.getBlocksCount=function(e,r){switch(r){case bs.L:return Eu[(e-1)*4+0];case bs.M:return Eu[(e-1)*4+1];case bs.Q:return Eu[(e-1)*4+2];case bs.H:return Eu[(e-1)*4+3];default:return}},_u.getTotalCodewordsCount=function(e,r){switch(r){case bs.L:return Au[(e-1)*4+0];case bs.M:return Au[(e-1)*4+1];case bs.Q:return Au[(e-1)*4+2];case bs.H:return Au[(e-1)*4+3];default:return}};var My={},xu={};const Nc=new Uint8Array(512),Iu=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Nc[r]=e,Iu[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Nc[r]=Nc[r-255]})(),xu.log=function(e){if(e<1)throw new Error("log("+e+")");return Iu[e]},xu.exp=function(e){return Nc[e]},xu.mul=function(e,r){return e===0||r===0?0:Nc[Iu[e]+Iu[r]]},function(t){const e=xu;t.mul=function(n,i){const o=new Uint8Array(n.length+i.length-1);for(let c=0;c<n.length;c++)for(let l=0;l<i.length;l++)o[c+l]^=e.mul(n[c],i[l]);return o},t.mod=function(n,i){let o=new Uint8Array(n);for(;o.length-i.length>=0;){const c=o[0];for(let f=0;f<i.length;f++)o[f]^=e.mul(i[f],c);let l=0;for(;l<o.length&&o[l]===0;)l++;o=o.slice(l)}return o},t.generateECPolynomial=function(n){let i=new Uint8Array([1]);for(let o=0;o<n;o++)i=t.mul(i,new Uint8Array([1,e.exp(o)]));return i}}(My);const Ty=My;function td(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}td.prototype.initialize=function(e){this.degree=e,this.genPoly=Ty.generateECPolynomial(this.degree)},td.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(e.length+this.degree);r.set(e);const n=Ty.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){const o=new Uint8Array(this.degree);return o.set(n,i),o}return n};var GO=td,$y={},_s={},rd={};rd.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Ii={};const Ny="[0-9]+",YO="[A-Z $%*+\\-./:]+";let Rc="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Rc=Rc.replace(/u/g,"\\u");const JO="(?:(?![A-Z0-9 $%*+\\-./:]|"+Rc+`)(?:.|[\r
129
+ ]))+`;Ii.KANJI=new RegExp(Rc,"g"),Ii.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ii.BYTE=new RegExp(JO,"g"),Ii.NUMERIC=new RegExp(Ny,"g"),Ii.ALPHANUMERIC=new RegExp(YO,"g");const QO=new RegExp("^"+Rc+"$"),ZO=new RegExp("^"+Ny+"$"),XO=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Ii.testKanji=function(e){return QO.test(e)},Ii.testNumeric=function(e){return ZO.test(e)},Ii.testAlphanumeric=function(e){return XO.test(e)},function(t){const e=rd,r=Ii;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(o,c){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!e.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?o.ccBits[0]:c<27?o.ccBits[1]:o.ccBits[2]},t.getBestModeForData=function(o){return r.testNumeric(o)?t.NUMERIC:r.testAlphanumeric(o)?t.ALPHANUMERIC:r.testKanji(o)?t.KANJI:t.BYTE},t.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},t.isValid=function(o){return o&&o.bit&&o.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+i)}}t.from=function(o,c){if(t.isValid(o))return o;try{return n(o)}catch{return c}}}(_s),function(t){const e=bn,r=_u,n=bu,i=_s,o=rd,c=7973,l=e.getBCHDigit(c);function f(E,A,S){for(let U=1;U<=40;U++)if(A<=t.getCapacity(U,S,E))return U}function h(E,A){return i.getCharCountIndicator(E,A)+4}function g(E,A){let S=0;return E.forEach(function(U){const W=h(U.mode,A);S+=W+U.getBitsLength()}),S}function _(E,A){for(let S=1;S<=40;S++)if(g(E,S)<=t.getCapacity(S,A,i.MIXED))return S}t.from=function(A,S){return o.isValid(A)?parseInt(A,10):S},t.getCapacity=function(A,S,U){if(!o.isValid(A))throw new Error("Invalid QR Code version");typeof U>"u"&&(U=i.BYTE);const W=e.getSymbolTotalCodewords(A),Y=r.getTotalCodewordsCount(A,S),B=(W-Y)*8;if(U===i.MIXED)return B;const z=B-h(U,A);switch(U){case i.NUMERIC:return Math.floor(z/10*3);case i.ALPHANUMERIC:return Math.floor(z/11*2);case i.KANJI:return Math.floor(z/13);case i.BYTE:default:return Math.floor(z/8)}},t.getBestVersionForData=function(A,S){let U;const W=n.from(S,n.M);if(Array.isArray(A)){if(A.length>1)return _(A,W);if(A.length===0)return 1;U=A[0]}else U=A;return f(U.mode,U.getLength(),W)},t.getEncodedBits=function(A){if(!o.isValid(A)||A<7)throw new Error("Invalid QR Code version");let S=A<<12;for(;e.getBCHDigit(S)-l>=0;)S^=c<<e.getBCHDigit(S)-l;return A<<12|S}}($y);var Ry={};const nd=bn,Ly=1335,eP=21522,By=nd.getBCHDigit(Ly);Ry.getEncodedBits=function(e,r){const n=e.bit<<3|r;let i=n<<10;for(;nd.getBCHDigit(i)-By>=0;)i^=Ly<<nd.getBCHDigit(i)-By;return(n<<10|i)^eP};var Uy={};const tP=_s;function da(t){this.mode=tP.NUMERIC,this.data=t.toString()}da.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},da.prototype.getLength=function(){return this.data.length},da.prototype.getBitsLength=function(){return da.getBitsLength(this.data.length)},da.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);const o=this.data.length-r;o>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,o*3+1))};var rP=da;const nP=_s,id=["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 pa(t){this.mode=nP.ALPHANUMERIC,this.data=t}pa.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},pa.prototype.getLength=function(){return this.data.length},pa.prototype.getBitsLength=function(){return pa.getBitsLength(this.data.length)},pa.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=id.indexOf(this.data[r])*45;n+=id.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(id.indexOf(this.data[r]),6)};var iP=pa,sP=function(e){for(var r=[],n=e.length,i=0;i<n;i++){var o=e.charCodeAt(i);if(o>=55296&&o<=56319&&n>i+1){var c=e.charCodeAt(i+1);c>=56320&&c<=57343&&(o=(o-55296)*1024+c-56320+65536,i+=1)}if(o<128){r.push(o);continue}if(o<2048){r.push(o>>6|192),r.push(o&63|128);continue}if(o<55296||o>=57344&&o<65536){r.push(o>>12|224),r.push(o>>6&63|128),r.push(o&63|128);continue}if(o>=65536&&o<=1114111){r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer};const oP=sP,aP=_s;function ga(t){this.mode=aP.BYTE,typeof t=="string"&&(t=oP(t)),this.data=new Uint8Array(t)}ga.getBitsLength=function(e){return e*8},ga.prototype.getLength=function(){return this.data.length},ga.prototype.getBitsLength=function(){return ga.getBitsLength(this.data.length)},ga.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var cP=ga;const lP=_s,uP=bn;function ma(t){this.mode=lP.KANJI,this.data=t}ma.getBitsLength=function(e){return e*13},ma.prototype.getLength=function(){return this.data.length},ma.prototype.getBitsLength=function(){return ma.getBitsLength(this.data.length)},ma.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=uP.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
130
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var hP=ma,Fy={exports:{}};(function(t){var e={single_source_shortest_paths:function(r,n,i){var o={},c={};c[n]=0;var l=e.PriorityQueue.make();l.push(n,0);for(var f,h,g,_,E,A,S,U,W;!l.empty();){f=l.pop(),h=f.value,_=f.cost,E=r[h]||{};for(g in E)E.hasOwnProperty(g)&&(A=E[g],S=_+A,U=c[g],W=typeof c[g]>"u",(W||U>S)&&(c[g]=S,l.push(g,S),o[g]=h))}if(typeof i<"u"&&typeof c[i]>"u"){var Y=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(Y)}return o},extract_shortest_path_from_predecessor_list:function(r,n){for(var i=[],o=n;o;)i.push(o),r[o],o=r[o];return i.reverse(),i},find_path:function(r,n,i){var o=e.single_source_shortest_paths(r,n,i);return e.extract_shortest_path_from_predecessor_list(o,i)},PriorityQueue:{make:function(r){var n=e.PriorityQueue,i={},o;r=r||{};for(o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);return i.queue=[],i.sorter=r.sorter||n.default_sorter,i},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var i={value:r,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(Fy),function(t){const e=_s,r=rP,n=iP,i=cP,o=hP,c=Ii,l=bn,f=Fy.exports;function h(Y){return unescape(encodeURIComponent(Y)).length}function g(Y,B,z){const P=[];let F;for(;(F=Y.exec(z))!==null;)P.push({data:F[0],index:F.index,mode:B,length:F[0].length});return P}function _(Y){const B=g(c.NUMERIC,e.NUMERIC,Y),z=g(c.ALPHANUMERIC,e.ALPHANUMERIC,Y);let P,F;return l.isKanjiModeEnabled()?(P=g(c.BYTE,e.BYTE,Y),F=g(c.KANJI,e.KANJI,Y)):(P=g(c.BYTE_KANJI,e.BYTE,Y),F=[]),B.concat(z,P,F).sort(function(m,T){return m.index-T.index}).map(function(m){return{data:m.data,mode:m.mode,length:m.length}})}function E(Y,B){switch(B){case e.NUMERIC:return r.getBitsLength(Y);case e.ALPHANUMERIC:return n.getBitsLength(Y);case e.KANJI:return o.getBitsLength(Y);case e.BYTE:return i.getBitsLength(Y)}}function A(Y){return Y.reduce(function(B,z){const P=B.length-1>=0?B[B.length-1]:null;return P&&P.mode===z.mode?(B[B.length-1].data+=z.data,B):(B.push(z),B)},[])}function S(Y){const B=[];for(let z=0;z<Y.length;z++){const P=Y[z];switch(P.mode){case e.NUMERIC:B.push([P,{data:P.data,mode:e.ALPHANUMERIC,length:P.length},{data:P.data,mode:e.BYTE,length:P.length}]);break;case e.ALPHANUMERIC:B.push([P,{data:P.data,mode:e.BYTE,length:P.length}]);break;case e.KANJI:B.push([P,{data:P.data,mode:e.BYTE,length:h(P.data)}]);break;case e.BYTE:B.push([{data:P.data,mode:e.BYTE,length:h(P.data)}])}}return B}function U(Y,B){const z={},P={start:{}};let F=["start"];for(let j=0;j<Y.length;j++){const m=Y[j],T=[];for(let te=0;te<m.length;te++){const ee=m[te],ne=""+j+te;T.push(ne),z[ne]={node:ee,lastCount:0},P[ne]={};for(let fe=0;fe<F.length;fe++){const d=F[fe];z[d]&&z[d].node.mode===ee.mode?(P[d][ne]=E(z[d].lastCount+ee.length,ee.mode)-E(z[d].lastCount,ee.mode),z[d].lastCount+=ee.length):(z[d]&&(z[d].lastCount=ee.length),P[d][ne]=E(ee.length,ee.mode)+4+e.getCharCountIndicator(ee.mode,B))}}F=T}for(let j=0;j<F.length;j++)P[F[j]].end=0;return{map:P,table:z}}function W(Y,B){let z;const P=e.getBestModeForData(Y);if(z=e.from(B,P),z!==e.BYTE&&z.bit<P.bit)throw new Error('"'+Y+'" cannot be encoded with mode '+e.toString(z)+`.
131
+ Suggested mode is: `+e.toString(P));switch(z===e.KANJI&&!l.isKanjiModeEnabled()&&(z=e.BYTE),z){case e.NUMERIC:return new r(Y);case e.ALPHANUMERIC:return new n(Y);case e.KANJI:return new o(Y);case e.BYTE:return new i(Y)}}t.fromArray=function(B){return B.reduce(function(z,P){return typeof P=="string"?z.push(W(P,null)):P.data&&z.push(W(P.data,P.mode)),z},[])},t.fromString=function(B,z){const P=_(B,l.isKanjiModeEnabled()),F=S(P),j=U(F,z),m=f.find_path(j.map,"start","end"),T=[];for(let te=1;te<m.length-1;te++)T.push(j.table[m[te]].node);return t.fromArray(A(T))},t.rawSplit=function(B){return t.fromArray(_(B,l.isKanjiModeEnabled()))}}(Uy);const Su=bn,sd=bu,fP=KO,dP=WO,pP=Dy,gP=Cy,od=Py,ad=_u,mP=GO,Du=$y,vP=Ry,wP=_s,cd=Uy;function yP(t,e){const r=t.size,n=gP.getPositions(e);for(let i=0;i<n.length;i++){const o=n[i][0],c=n[i][1];for(let l=-1;l<=7;l++)if(!(o+l<=-1||r<=o+l))for(let f=-1;f<=7;f++)c+f<=-1||r<=c+f||(l>=0&&l<=6&&(f===0||f===6)||f>=0&&f<=6&&(l===0||l===6)||l>=2&&l<=4&&f>=2&&f<=4?t.set(o+l,c+f,!0,!0):t.set(o+l,c+f,!1,!0))}}function bP(t){const e=t.size;for(let r=8;r<e-8;r++){const n=r%2===0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}function _P(t,e){const r=pP.getPositions(e);for(let n=0;n<r.length;n++){const i=r[n][0],o=r[n][1];for(let c=-2;c<=2;c++)for(let l=-2;l<=2;l++)c===-2||c===2||l===-2||l===2||c===0&&l===0?t.set(i+c,o+l,!0,!0):t.set(i+c,o+l,!1,!0)}}function EP(t,e){const r=t.size,n=Du.getEncodedBits(e);let i,o,c;for(let l=0;l<18;l++)i=Math.floor(l/3),o=l%3+r-8-3,c=(n>>l&1)===1,t.set(i,o,c,!0),t.set(o,i,c,!0)}function ld(t,e,r){const n=t.size,i=vP.getEncodedBits(e,r);let o,c;for(o=0;o<15;o++)c=(i>>o&1)===1,o<6?t.set(o,8,c,!0):o<8?t.set(o+1,8,c,!0):t.set(n-15+o,8,c,!0),o<8?t.set(8,n-o-1,c,!0):o<9?t.set(8,15-o-1+1,c,!0):t.set(8,15-o-1,c,!0);t.set(n-8,8,1,!0)}function AP(t,e){const r=t.size;let n=-1,i=r-1,o=7,c=0;for(let l=r-1;l>0;l-=2)for(l===6&&l--;;){for(let f=0;f<2;f++)if(!t.isReserved(i,l-f)){let h=!1;c<e.length&&(h=(e[c]>>>o&1)===1),t.set(i,l-f,h),o--,o===-1&&(c++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function xP(t,e,r){const n=new fP;r.forEach(function(f){n.put(f.mode.bit,4),n.put(f.getLength(),wP.getCharCountIndicator(f.mode,t)),f.write(n)});const i=Su.getSymbolTotalCodewords(t),o=ad.getTotalCodewordsCount(t,e),c=(i-o)*8;for(n.getLengthInBits()+4<=c&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);const l=(c-n.getLengthInBits())/8;for(let f=0;f<l;f++)n.put(f%2?17:236,8);return IP(n,t,e)}function IP(t,e,r){const n=Su.getSymbolTotalCodewords(e),i=ad.getTotalCodewordsCount(e,r),o=n-i,c=ad.getBlocksCount(e,r),l=n%c,f=c-l,h=Math.floor(n/c),g=Math.floor(o/c),_=g+1,E=h-g,A=new mP(E);let S=0;const U=new Array(c),W=new Array(c);let Y=0;const B=new Uint8Array(t.buffer);for(let m=0;m<c;m++){const T=m<f?g:_;U[m]=B.slice(S,S+T),W[m]=A.encode(U[m]),S+=T,Y=Math.max(Y,T)}const z=new Uint8Array(n);let P=0,F,j;for(F=0;F<Y;F++)for(j=0;j<c;j++)F<U[j].length&&(z[P++]=U[j][F]);for(F=0;F<E;F++)for(j=0;j<c;j++)z[P++]=W[j][F];return z}function SP(t,e,r,n){let i;if(Array.isArray(t))i=cd.fromArray(t);else if(typeof t=="string"){let h=e;if(!h){const g=cd.rawSplit(t);h=Du.getBestVersionForData(g,r)}i=cd.fromString(t,h||40)}else throw new Error("Invalid data");const o=Du.getBestVersionForData(i,r);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=o;else if(e<o)throw new Error(`
145
132
  The chosen QR Code version cannot contain this amount of data.
146
- Minimum version required to store current data is: `+s+`.
147
- `);const c=FP(e,r,i),l=Au.getSymbolSize(e),f=new CP(l);return NP(f,e),RP(f),LP(f,e),ld(f,r,0),e>=7&&BP(f,e),UP(f,c),isNaN(n)&&(n=od.getBestMask(f,ld.bind(null,f,r))),od.applyMask(n,f),ld(f,r,n),{modules:f,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}Pw.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=sd.M,i,s;return typeof r<"u"&&(n=sd.from(r.errorCorrectionLevel,sd.M),i=xu.from(r.version),s=od.from(r.maskPattern),r.toSJISFunc&&Au.setToSJISFunction(r.toSJISFunc)),kP(e,i,n,s)};var Kw={},ud={};(function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(s){return[s,s]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,s=n.width&&n.width>=21?n.width:void 0,c=n.scale||4;return{width:s,scale:s?4:c,margin:i,color:{dark:e(n.color.dark||"#000000ff"),light:e(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},t.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},t.getImageWidth=function(n,i){const s=t.getScale(n,i);return Math.floor((n+i.margin*2)*s)},t.qrToImageData=function(n,i,s){const c=i.modules.size,l=i.modules.data,f=t.getScale(c,s),h=Math.floor((c+s.margin*2)*f),m=s.margin*f,_=[s.color.light,s.color.dark];for(let E=0;E<h;E++)for(let A=0;A<h;A++){let I=(E*h+A)*4,R=s.color.light;if(E>=m&&A>=m&&E<h-m&&A<h-m){const W=Math.floor((E-m)/f),Y=Math.floor((A-m)/f);R=_[l[W*c+Y]?1:0]}n[I++]=R.r,n[I++]=R.g,n[I++]=R.b,n[I]=R.a}}})(ud),function(t){const e=ud;function r(i,s,c){i.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=c,s.width=c,s.style.height=c+"px",s.style.width=c+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(s,c,l){let f=l,h=c;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),c||(h=n()),f=e.getOptions(f);const m=e.getImageWidth(s.modules.size,f),_=h.getContext("2d"),E=_.createImageData(m,m);return e.qrToImageData(E.data,s,f),r(_,h,m),_.putImageData(E,0,0),h},t.renderToDataURL=function(s,c,l){let f=l;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),f||(f={});const h=t.render(s,c,f),m=f.type||"image/png",_=f.rendererOpts||{};return h.toDataURL(m,_.quality)}}(Kw);var Ww={};const qP=ud;function Vw(t,e){const r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function hd(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function zP(t,e,r){let n="",i=0,s=!1,c=0;for(let l=0;l<t.length;l++){const f=Math.floor(l%e),h=Math.floor(l/e);!f&&!s&&(s=!0),t[l]?(c++,l>0&&f>0&&t[l-1]||(n+=s?hd("M",f+r,.5+h+r):hd("m",i,0),i=0,s=!1),f+1<e&&t[l+1]||(n+=hd("h",c),c=0)):i++}return n}Ww.render=function(e,r,n){const i=qP.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+i.margin*2,f=i.color.light.a?"<path "+Vw(i.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+Vw(i.color.dark,"stroke")+' d="'+zP(c,s,i.margin)+'"/>',m='viewBox="0 0 '+l+" "+l+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+m+' shape-rendering="crispEdges">'+f+h+`</svg>
148
- `;return typeof n=="function"&&n(null,E),E};const HP=iP,fd=Pw,Gw=Kw,KP=Ww;function dd(t,e,r,n,i){const s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]=="function";if(!l&&!HP())throw new Error("Callback required as last argument");if(l){if(c<2)throw new Error("Too few arguments provided");c===2?(i=r,r=e,e=n=void 0):c===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(r=e,e=n=void 0):c===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(f,h){try{const m=fd.create(r,n);f(t(m,e,n))}catch(m){h(m)}})}try{const f=fd.create(r,n);i(null,t(f,e,n))}catch(f){i(f)}}Tc.create=fd.create,Tc.toCanvas=dd.bind(null,Gw.render),Tc.toDataURL=dd.bind(null,Gw.renderToDataURL),Tc.toString=dd.bind(null,function(t,e,r){return KP.render(t,r)});var WP=Object.defineProperty,Yw=Object.getOwnPropertySymbols,VP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,Jw=(t,e,r)=>e in t?WP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pd=(t,e)=>{for(var r in e||(e={}))VP.call(e,r)&&Jw(t,r,e[r]);if(Yw)for(var r of Yw(e))GP.call(e,r)&&Jw(t,r,e[r]);return t};function YP(){var t;const e=(t=ms.state.themeMode)!=null?t:"dark",r={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":r.foreground[1],"--wcm-color-fg-2":r.foreground[2],"--wcm-color-fg-3":r.foreground[3],"--wcm-color-bg-1":r.background[1],"--wcm-color-bg-2":r.background[2],"--wcm-color-bg-3":r.background[3],"--wcm-color-overlay":r.overlay}}function Qw(){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 xt={getPreset(t){return Qw()[t]},setTheme(){const t=document.querySelector(":root"),{themeVariables:e}=ms.state;if(t){const r=pd(pd(pd({},YP()),Qw()),e);Object.entries(r).forEach(([n,i])=>t.style.setProperty(n,i))}},globalCss:Tt`*,::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)}`},JP=Tt`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 QP=Object.defineProperty,ZP=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?ZP(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&QP(e,r,i),i};let Es=class extends mt{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const t={"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"),ve`<button class="${Hi(t)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};Es.styles=[xt.globalCss,JP],va([ht({type:Boolean})],Es.prototype,"disabled",2),va([ht()],Es.prototype,"iconLeft",2),va([ht()],Es.prototype,"iconRight",2),va([ht()],Es.prototype,"onClick",2),va([ht()],Es.prototype,"variant",2),Es=va([Ct("wcm-button")],Es);const XP=Tt`: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 eM=Object.defineProperty,tM=Object.getOwnPropertyDescriptor,gd=(t,e,r,n)=>{for(var i=n>1?void 0:n?tM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&eM(e,r,i),i};let Lc=class extends mt{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const t={"wcm-secondary":this.variant==="secondary"};return ve`<button ?disabled="${this.disabled}" class="${Hi(t)}"><slot></slot></button>`}};Lc.styles=[xt.globalCss,XP],gd([ht({type:Boolean})],Lc.prototype,"disabled",2),gd([ht()],Lc.prototype,"variant",2),Lc=gd([Ct("wcm-button-big")],Lc);const rM=Tt`: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 nM=Object.defineProperty,iM=Object.getOwnPropertyDescriptor,sM=(t,e,r,n)=>{for(var i=n>1?void 0:n?iM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&nM(e,r,i),i};let md=class extends mt{render(){return ve`<div><slot></slot></div>`}};md.styles=[xt.globalCss,rM],md=sM([Ct("wcm-info-footer")],md);const Nt={CROSS_ICON:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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>`},oM=Tt`.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 aM=Object.defineProperty,cM=Object.getOwnPropertyDescriptor,lM=(t,e,r,n)=>{for(var i=n>1?void 0:n?cM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&aM(e,r,i),i};let vd=class extends mt{render(){return ve`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Nt.WALLET_CONNECT_LOGO} <button @click="${io.close}">${Nt.CROSS_ICON}</button></div>`}};vd.styles=[xt.globalCss,oM],vd=lM([Ct("wcm-modal-backcard")],vd);const uM=Tt`main{padding:20px;padding-top:0;width:100%}`;var hM=Object.defineProperty,fM=Object.getOwnPropertyDescriptor,dM=(t,e,r,n)=>{for(var i=n>1?void 0:n?fM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&hM(e,r,i),i};let yd=class extends mt{render(){return ve`<main><slot></slot></main>`}};yd.styles=[xt.globalCss,uM],yd=dM([Ct("wcm-modal-content")],yd);const pM=Tt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var gM=Object.defineProperty,mM=Object.getOwnPropertyDescriptor,vM=(t,e,r,n)=>{for(var i=n>1?void 0:n?mM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&gM(e,r,i),i};let wd=class extends mt{render(){return ve`<footer><slot></slot></footer>`}};wd.styles=[xt.globalCss,pM],wd=vM([Ct("wcm-modal-footer")],wd);const yM=Tt`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 wM=Object.defineProperty,bM=Object.getOwnPropertyDescriptor,Bc=(t,e,r,n)=>{for(var i=n>1?void 0:n?bM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&wM(e,r,i),i};let fo=class extends mt{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return ve`<button class="wcm-back-btn" @click="${rr.goBack}">${Nt.BACK_ICON}</button>`}actionBtnTemplate(){return ve`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const t={"wcm-border":this.border},e=rr.state.history.length>1,r=this.title?ve`<wcm-text variant="big-bold">${this.title}</wcm-text>`:ve`<slot></slot>`;return ve`<header class="${Hi(t)}">${e?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};fo.styles=[xt.globalCss,yM],Bc([ht()],fo.prototype,"title",2),Bc([ht()],fo.prototype,"onAction",2),Bc([ht()],fo.prototype,"actionIcon",2),Bc([ht({type:Boolean})],fo.prototype,"border",2),fo=Bc([Ct("wcm-modal-header")],fo);const nt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(t,e){const r=t.renderRoot.querySelector(e);if(!r)throw new Error(`${e} not found`);return r},getWalletIcon({id:t,image_id:e}){const{walletImages:r}=wn.state;return r!=null&&r[t]?r[t]:e?sn.getWalletImageUrl(e):""},getWalletName(t,e=!1){return e&&t.length>8?`${t.substring(0,8)}..`:t},isMobileAnimation(){return window.innerWidth<=nt.MOBILE_BREAKPOINT},async preloadImage(t){const e=new Promise((r,n)=>{const i=new Image;i.onload=r,i.onerror=n,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,Ue.wait(3e3)])},getErrorMessage(t){return t instanceof Error?t.message:"Unknown Error"},debounce(t,e=500){let r;return(...n)=>{function i(){t(...n)}r&&clearTimeout(r),r=setTimeout(i,e)}},handleMobileLinking(t){const{walletConnectUri:e}=hr.state,{mobile:r,name:n}=t,i=r?.native,s=r?.universal;nt.setRecentWallet(t);function c(l){let f="";i?f=Ue.formatUniversalUrl(i,l,n):s&&(f=Ue.formatNativeUrl(s,l,n)),Ue.openHref(f,"_self")}e&&c(e)},handleAndroidLinking(){const{walletConnectUri:t}=hr.state;t&&(Ue.setWalletConnectAndroidDeepLink(t),Ue.openHref(t,"_self"))},async handleUriCopy(){const{walletConnectUri:t}=hr.state;if(t)try{await navigator.clipboard.writeText(t),vs.openToast("Link copied","success")}catch{vs.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:t}=wn.state,e=Object.values(t??{});return Object.values(e)},truncate(t,e=8){return t.length<=e?t:`${t.substring(0,4)}...${t.substring(t.length-4)}`},setRecentWallet(t){try{localStorage.setItem(nt.WCM_RECENT_WALLET_DATA,JSON.stringify(t))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const t=localStorage.getItem(nt.WCM_RECENT_WALLET_DATA);return t?JSON.parse(t):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(t,e){return t.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){Ue.openHref(nt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:t,mobile:e}=Ue.getWalletRouterData(),r=!!t?.native,n=!!t?.universal,i=!!e?.native||!!e?.universal;return{isDesktop:r,isMobile:i,isWeb:n}},goToConnectingView(t){rr.setData({Wallet:t});const e=Ue.isMobile(),{isDesktop:r,isWeb:n,isMobile:i}=nt.getCachedRouterWalletPlatforms();e?i?rr.push("MobileConnecting"):n?rr.push("WebConnecting"):rr.push("InstallWallet"):r?rr.push("DesktopConnecting"):n?rr.push("WebConnecting"):i?rr.push("MobileQrcodeConnecting"):rr.push("InstallWallet")}},_M=Tt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var EM=Object.defineProperty,AM=Object.getOwnPropertyDescriptor,bd=(t,e,r,n)=>{for(var i=n>1?void 0:n?AM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&EM(e,r,i),i};let Uc=class extends mt{constructor(){super(),this.view=rr.state.view,this.prevView=rr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=rr.subscribe(t=>{this.view!==t.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([t])=>{const e=`${t.contentRect.height}px`;this.oldHeight!=="0px"&&ho(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var t,e;(t=this.unsubscribe)==null||t.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return nt.getShadowRootElement(this,".wcm-router")}get contentEl(){return nt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return ve`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return ve`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return ve`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return ve`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return ve`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return ve`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return ve`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return ve`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return ve`<div>Not Found</div>`}}async onChangeRoute(){await ho(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=rr.state.view,ho(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return ve`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Uc.styles=[xt.globalCss,_M],bd([on()],Uc.prototype,"view",2),bd([on()],Uc.prototype,"prevView",2),Uc=bd([Ct("wcm-modal-router")],Uc);const xM=Tt`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 SM=Object.defineProperty,IM=Object.getOwnPropertyDescriptor,Zw=(t,e,r,n)=>{for(var i=n>1?void 0:n?IM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&SM(e,r,i),i};let Su=class extends mt{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=vs.subscribe(t=>{t.open?(this.open=!0,this.timeout=setTimeout(()=>vs.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var t;(t=this.unsubscribe)==null||t.call(this),clearTimeout(this.timeout),vs.closeToast()}render(){const{message:t,variant:e}=vs.state,r={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?ve`<div class="${Hi(r)}">${e==="success"?Nt.CHECKMARK_ICON:null} ${e==="error"?Nt.CROSS_ICON:null}<wcm-text variant="small-regular">${t}</wcm-text></div>`:null}};Su.styles=[xt.globalCss,xM],Zw([on()],Su.prototype,"open",2),Su=Zw([Ct("wcm-modal-toast")],Su);const DM=.1,Xw=2.5,Ki=7;function _d(t,e,r){return t===e?!1:(t-e<0?e-t:t-e)<=r+DM}function CM(t,e){const r=Array.prototype.slice.call(Tc.create(t,{errorCorrectionLevel:e}).modules.data,0),n=Math.sqrt(r.length);return r.reduce((i,s,c)=>(c%n===0?i.push([s]):i[i.length-1].push(s))&&i,[])}const OM={generate(t,e,r){const n="#141414",i="#ffffff",s=[],c=CM(t,"Q"),l=e/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:I,y:R})=>{const W=(c.length-Ki)*l*I,Y=(c.length-Ki)*l*R,F=.45;for(let z=0;z<f.length;z+=1){const $=l*(Ki-z*2);s.push(ar`<rect fill="${z%2===0?n:i}" height="${$}" rx="${$*F}" ry="${$*F}" width="${$}" x="${W+l*z}" y="${Y+l*z}">`)}});const h=Math.floor((r+25)/l),m=c.length/2-h/2,_=c.length/2+h/2-1,E=[];c.forEach((I,R)=>{I.forEach((W,Y)=>{if(c[R][Y]&&!(R<Ki&&Y<Ki||R>c.length-(Ki+1)&&Y<Ki||R<Ki&&Y>c.length-(Ki+1))&&!(R>m&&R<_&&Y>m&&Y<_)){const F=R*l+l/2,z=Y*l+l/2;E.push([F,z])}})});const A={};return E.forEach(([I,R])=>{A[I]?A[I].push(R):A[I]=[R]}),Object.entries(A).map(([I,R])=>{const W=R.filter(Y=>R.every(F=>!_d(Y,F,l)));return[Number(I),W]}).forEach(([I,R])=>{R.forEach(W=>{s.push(ar`<circle cx="${I}" cy="${W}" fill="${n}" r="${l/Xw}">`)})}),Object.entries(A).filter(([I,R])=>R.length>1).map(([I,R])=>{const W=R.filter(Y=>R.some(F=>_d(Y,F,l)));return[Number(I),W]}).map(([I,R])=>{R.sort((Y,F)=>Y<F?-1:1);const W=[];for(const Y of R){const F=W.find(z=>z.some($=>_d(Y,$,l)));F?F.push(Y):W.push([Y])}return[I,W.map(Y=>[Y[0],Y[Y.length-1]])]}).forEach(([I,R])=>{R.forEach(([W,Y])=>{s.push(ar`<line x1="${I}" x2="${I}" y1="${W}" y2="${Y}" stroke="${n}" stroke-width="${l/(Xw/2)}" stroke-linecap="round">`)})}),s}},PM=Tt`@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 MM=Object.defineProperty,TM=Object.getOwnPropertyDescriptor,ya=(t,e,r,n)=>{for(var i=n>1?void 0:n?TM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&MM(e,r,i),i};let Wi=class extends mt{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const t=ms.state.themeMode==="light"?this.size:this.size-36;return ar`<svg height="${t}" width="${t}">${OM.generate(this.uri,t,t/4)}</svg>`}render(){const t={"wcm-dark":ms.state.themeMode==="dark"};return ve`<div style="${`width: ${this.size}px`}" class="${Hi(t)}">${this.walletId||this.imageUrl?ve`<wcm-wallet-image walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}" imageUrl="${Wr(this.imageUrl)}"></wcm-wallet-image>`:Nt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Wi.styles=[xt.globalCss,PM],ya([ht()],Wi.prototype,"uri",2),ya([ht({type:Number})],Wi.prototype,"size",2),ya([ht()],Wi.prototype,"imageId",2),ya([ht()],Wi.prototype,"walletId",2),ya([ht()],Wi.prototype,"imageUrl",2),Wi=ya([Ct("wcm-qrcode")],Wi);const $M=Tt`: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 NM=Object.defineProperty,RM=Object.getOwnPropertyDescriptor,e2=(t,e,r,n)=>{for(var i=n>1?void 0:n?RM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&NM(e,r,i),i};let Iu=class extends mt{constructor(){super(...arguments),this.onChange=()=>null}render(){return ve`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Nt.SEARCH_ICON}`}};Iu.styles=[xt.globalCss,$M],e2([ht()],Iu.prototype,"onChange",2),Iu=e2([Ct("wcm-search-input")],Iu);const LM=Tt`@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 BM=Object.defineProperty,UM=Object.getOwnPropertyDescriptor,FM=(t,e,r,n)=>{for(var i=n>1?void 0:n?UM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&BM(e,r,i),i};let Ed=class extends mt{render(){return ve`<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>`}};Ed.styles=[xt.globalCss,LM],Ed=FM([Ct("wcm-spinner")],Ed);const jM=Tt`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 kM=Object.defineProperty,qM=Object.getOwnPropertyDescriptor,Ad=(t,e,r,n)=>{for(var i=n>1?void 0:n?qM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&kM(e,r,i),i};let Fc=class extends mt{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const t={"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 ve`<span><slot class="${Hi(t)}"></slot></span>`}};Fc.styles=[xt.globalCss,jM],Ad([ht()],Fc.prototype,"variant",2),Ad([ht()],Fc.prototype,"color",2),Fc=Ad([Ct("wcm-text")],Fc);const zM=Tt`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 HM=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,As=(t,e,r,n)=>{for(var i=n>1?void 0:n?KM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&HM(e,r,i),i};let Si=class extends mt{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?ve`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?ve`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){By.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var t;return ve`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${Wr(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(t=this.label)!=null?t:nt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};Si.styles=[xt.globalCss,zM],As([ht()],Si.prototype,"onClick",2),As([ht()],Si.prototype,"name",2),As([ht()],Si.prototype,"walletId",2),As([ht()],Si.prototype,"label",2),As([ht()],Si.prototype,"imageId",2),As([ht({type:Boolean})],Si.prototype,"installed",2),As([ht({type:Boolean})],Si.prototype,"recent",2),Si=As([Ct("wcm-wallet-button")],Si);const WM=Tt`: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 VM=Object.defineProperty,GM=Object.getOwnPropertyDescriptor,Du=(t,e,r,n)=>{for(var i=n>1?void 0:n?GM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&VM(e,r,i),i};let wa=class extends mt{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var t;const e=(t=this.imageUrl)!=null&&t.length?this.imageUrl:nt.getWalletIcon({id:this.walletId,image_id:this.imageId});return ve`${e.length?ve`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Nt.WALLET_PLACEHOLDER}`}};wa.styles=[xt.globalCss,WM],Du([ht()],wa.prototype,"walletId",2),Du([ht()],wa.prototype,"imageId",2),Du([ht()],wa.prototype,"imageUrl",2),wa=Du([Ct("wcm-wallet-image")],wa);var YM=Object.defineProperty,JM=Object.getOwnPropertyDescriptor,t2=(t,e,r,n)=>{for(var i=n>1?void 0:n?JM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&YM(e,r,i),i};let xd=class extends mt{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(t){try{t!=null&&t.length&&await Promise.all(t.map(async e=>nt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",t)}}async preloadListings(){if(wn.state.enableExplorer){await sn.getRecomendedWallets(),hr.setIsDataLoaded(!0);const{recomendedWallets:t}=sn.state,e=t.map(r=>nt.getWalletIcon(r));await this.loadImages(e)}else hr.setIsDataLoaded(!0)}async preloadCustomImages(){const t=nt.getCustomImageUrls();await this.loadImages(t)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(t){console.error(t),vs.openToast("Failed preloading","error")}}};t2([on()],xd.prototype,"preload",2),xd=t2([Ct("wcm-explorer-context")],xd);var QM=Object.defineProperty,ZM=Object.getOwnPropertyDescriptor,XM=(t,e,r,n)=>{for(var i=n>1?void 0:n?ZM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&QM(e,r,i),i};let r2=class extends mt{constructor(){super(),this.unsubscribeTheme=void 0,xt.setTheme(),this.unsubscribeTheme=ms.subscribe(xt.setTheme)}disconnectedCallback(){var t;(t=this.unsubscribeTheme)==null||t.call(this)}};r2=XM([Ct("wcm-theme-context")],r2);const eT=Tt`@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 tT=Object.defineProperty,rT=Object.getOwnPropertyDescriptor,nT=(t,e,r,n)=>{for(var i=n>1?void 0:n?rT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&tT(e,r,i),i};let Sd=class extends mt{onGoToQrcode(){rr.push("Qrcode")}render(){const{recomendedWallets:t}=sn.state,e=[...t,...t],r=Ue.RECOMMENDED_WALLET_AMOUNT*2;return ve`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Nt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Nt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(r)].map((n,i)=>{const s=e[i%e.length];return s?ve`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Nt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${nt.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>`}};Sd.styles=[xt.globalCss,eT],Sd=nT([Ct("wcm-android-wallet-selection")],Sd);const iT=Tt`@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 sT=Object.defineProperty,oT=Object.getOwnPropertyDescriptor,ba=(t,e,r,n)=>{for(var i=n>1?void 0:n?oT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&sT(e,r,i),i};let xs=class extends mt{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var t,e;const r=(e=(t=ms.state.themeVariables)==null?void 0:t["--wcm-wallet-icon-large-border-radius"])!=null?e:xt.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;r.includes("%")?n=88/100*parseInt(r,10):n=parseInt(r,10),n*=1.17;const i=317-n*1.57,s=425-n*1.8;return ve`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${n}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${i}" stroke-dashoffset="${s}"></use></svg>`}render(){const t={"wcm-error":this.isError,"wcm-stale":this.isStale};return ve`<div class="${Hi(t)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};xs.styles=[xt.globalCss,iT],ba([ht()],xs.prototype,"walletId",2),ba([ht()],xs.prototype,"imageId",2),ba([ht({type:Boolean})],xs.prototype,"isError",2),ba([ht({type:Boolean})],xs.prototype,"isStale",2),ba([ht()],xs.prototype,"label",2),xs=ba([Ct("wcm-connector-waiting")],xs);const _a={manualWallets(){var t,e;const{mobileWallets:r,desktopWallets:n}=wn.state,i=(t=_a.recentWallet())==null?void 0:t.id,s=Ue.isMobile()?r:n,c=s?.filter(l=>i!==l.id);return(e=Ue.isMobile()?c?.map(({id:l,name:f,links:h})=>({id:l,name:f,mobile:h,links:h})):c?.map(({id:l,name:f,links:h})=>({id:l,name:f,desktop:h,links:h})))!=null?e:[]},recentWallet(){return nt.getRecentWallet()},recomendedWallets(t=!1){var e;const r=t||(e=_a.recentWallet())==null?void 0:e.id,{recomendedWallets:n}=sn.state;return n.filter(i=>r!==i.id)}},Ss={onConnecting(t){nt.goToConnectingView(t)},manualWalletsTemplate(){return _a.manualWallets().map(t=>ve`<wcm-wallet-button walletId="${t.id}" name="${t.name}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(t=!1){return _a.recomendedWallets(t).map(e=>ve`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const t=_a.recentWallet();if(t)return ve`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${Wr(t.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`}},aT=Tt`.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 cT=Object.defineProperty,lT=Object.getOwnPropertyDescriptor,uT=(t,e,r,n)=>{for(var i=n>1?void 0:n?lT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&cT(e,r,i),i};let Id=class extends mt{render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=wn.state,r=t!=="ALL"&&e,n=Ss.manualWalletsTemplate(),i=Ss.recomendedWalletsTemplate();let s=[Ss.recentWalletTemplate(),...n,...i];s=s.filter(Boolean);const c=s.length>4||r;let l=[];c?l=s.slice(0,3):l=s;const f=!!l.length;return ve`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Nt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Nt.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>${f?ve`<wcm-modal-footer><div class="wcm-desktop-title">${Nt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${l} ${c?ve`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Id.styles=[xt.globalCss,aT],Id=uT([Ct("wcm-desktop-wallet-selection")],Id);const hT=Tt`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 fT=Object.defineProperty,dT=Object.getOwnPropertyDescriptor,pT=(t,e,r,n)=>{for(var i=n>1?void 0:n?dT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&fT(e,r,i),i};let Dd=class extends mt{render(){const{termsOfServiceUrl:t,privacyPolicyUrl:e}=wn.state;return t??e?ve`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${t?ve`<a href="${t}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${t&&e?"and":null} ${e?ve`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Dd.styles=[xt.globalCss,hT],Dd=pT([Ct("wcm-legal-notice")],Dd);const gT=Tt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var mT=Object.defineProperty,vT=Object.getOwnPropertyDescriptor,yT=(t,e,r,n)=>{for(var i=n>1?void 0:n?vT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&mT(e,r,i),i};let Cd=class extends mt{onQrcode(){rr.push("Qrcode")}render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=wn.state,r=t!=="ALL"&&e,n=Ss.manualWalletsTemplate(),i=Ss.recomendedWalletsTemplate();let s=[Ss.recentWalletTemplate(),...n,...i];s=s.filter(Boolean);const c=s.length>8||r;let l=[];c?l=s.slice(0,7):l=s;const f=!!l.length;return ve`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Nt.QRCODE_ICON}"></wcm-modal-header>${f?ve`<wcm-modal-content><div>${l} ${c?ve`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Cd.styles=[xt.globalCss,gT],Cd=yT([Ct("wcm-mobile-wallet-selection")],Cd);const wT=Tt`: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 bT=Object.defineProperty,_T=Object.getOwnPropertyDescriptor,Od=(t,e,r,n)=>{for(var i=n>1?void 0:n?_T(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&bT(e,r,i),i};let Ea=class extends mt{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=io.subscribe(t=>{t.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var t;(t=this.unsubscribeModal)==null||t.call(this)}get overlayEl(){return nt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return nt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(t){document.querySelector("body")&&(t?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(t){t.target===t.currentTarget&&io.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const t=nt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,r=.2;await Promise.all([ho(this.overlayEl,{opacity:[0,1]},{delay:e,duration:r}).finished,ho(this.containerEl,t,{delay:e,duration:r}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const t=nt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([ho(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,ho(this.containerEl,t,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",t=>{var e;t.key==="Escape"?io.close():t.key==="Tab"&&((e=t.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}render(){const t={"wcm-overlay":!0,"wcm-active":this.active};return ve`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Hi(t)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?ve`<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>`}};Ea.styles=[xt.globalCss,wT],Od([on()],Ea.prototype,"open",2),Od([on()],Ea.prototype,"active",2),Ea=Od([Ct("wcm-modal")],Ea);const ET=Tt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var AT=Object.defineProperty,xT=Object.getOwnPropertyDescriptor,jc=(t,e,r,n)=>{for(var i=n>1?void 0:n?xT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&AT(e,r,i),i};let po=class extends mt{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){Ue.isMobile()?rr.replace("MobileConnecting"):rr.replace("MobileQrcodeConnecting")}onDesktop(){rr.replace("DesktopConnecting")}onWeb(){rr.replace("WebConnecting")}render(){return ve`<div>${this.isRetry?ve`<slot></slot>`:null} ${this.isMobile?ve`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Nt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?ve`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Nt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?ve`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Nt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};po.styles=[xt.globalCss,ET],jc([ht({type:Boolean})],po.prototype,"isMobile",2),jc([ht({type:Boolean})],po.prototype,"isDesktop",2),jc([ht({type:Boolean})],po.prototype,"isWeb",2),jc([ht({type:Boolean})],po.prototype,"isRetry",2),po=jc([Ct("wcm-platform-selection")],po);const ST=Tt`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 IT=Object.defineProperty,DT=Object.getOwnPropertyDescriptor,CT=(t,e,r,n)=>{for(var i=n>1?void 0:n?DT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&IT(e,r,i),i};let Pd=class extends mt{onClick(){rr.push("WalletExplorer")}render(){const{recomendedWallets:t}=sn.state,e=_a.manualWallets(),r=[...t,...e].reverse().slice(0,4);return ve`<button @click="${this.onClick}"><div class="wcm-icons">${r.map(n=>{const i=nt.getWalletIcon(n);if(i)return ve`<img crossorigin="anonymous" src="${i}">`;const s=nt.getWalletIcon({id:n.id});return s?ve`<img crossorigin="anonymous" src="${s}">`:Nt.WALLET_PLACEHOLDER})} ${[...Array(4-r.length)].map(()=>Nt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Pd.styles=[xt.globalCss,ST],Pd=CT([Ct("wcm-view-all-wallets-button")],Pd);const OT=Tt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var PT=Object.defineProperty,MT=Object.getOwnPropertyDescriptor,Cu=(t,e,r,n)=>{for(var i=n>1?void 0:n?MT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&PT(e,r,i),i};let Aa=class extends mt{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:t}=hr.state;this.uri=t},0)}get overlayEl(){return nt.getShadowRootElement(this,".wcm-qr-container")}render(){return ve`<div class="wcm-qr-container">${this.uri?ve`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}"></wcm-qrcode>`:ve`<wcm-spinner></wcm-spinner>`}</div>`}};Aa.styles=[xt.globalCss,OT],Cu([ht()],Aa.prototype,"walletId",2),Cu([ht()],Aa.prototype,"imageId",2),Cu([on()],Aa.prototype,"uri",2),Aa=Cu([Ct("wcm-walletconnect-qr")],Aa);var TT=Object.defineProperty,$T=Object.getOwnPropertyDescriptor,NT=(t,e,r,n)=>{for(var i=n>1?void 0:n?$T(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&TT(e,r,i),i};let Md=class extends mt{viewTemplate(){return Ue.isAndroid()?ve`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:Ue.isMobile()?ve`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:ve`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return ve`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Md.styles=[xt.globalCss],Md=NT([Ct("wcm-connect-wallet-view")],Md);const RT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var LT=Object.defineProperty,BT=Object.getOwnPropertyDescriptor,n2=(t,e,r,n)=>{for(var i=n>1?void 0:n?BT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&LT(e,r,i),i};let Ou=class extends mt{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(t){const{desktop:e,name:r}=Ue.getWalletRouterData(),n=e?.native;if(n){const i=Ue.formatNativeUrl(n,t,r);Ue.openHref(i,"_self")}}openDesktopApp(){const{walletConnectUri:t}=hr.state,e=Ue.getWalletRouterData();nt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isMobile:n,isWeb:i}=nt.getCachedRouterWalletPlatforms();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${t} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Ou.styles=[xt.globalCss,RT],n2([on()],Ou.prototype,"isError",2),Ou=n2([Ct("wcm-desktop-connecting-view")],Ou);const UT=Tt`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 FT=Object.defineProperty,jT=Object.getOwnPropertyDescriptor,kT=(t,e,r,n)=>{for(var i=n>1?void 0:n?jT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&FT(e,r,i),i};let Td=class extends mt{onInstall(t){t&&Ue.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,homepage:n}=Ue.getWalletRouterData();return ve`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${t} to continue. If multiple browser extensions are installed, disable non ${t} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${Nt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};Td.styles=[xt.globalCss,UT],Td=kT([Ct("wcm-install-wallet-view")],Td);const qT=Tt`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 zT=Object.defineProperty,HT=Object.getOwnPropertyDescriptor,i2=(t,e,r,n)=>{for(var i=n>1?void 0:n?HT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&zT(e,r,i),i};let Pu=class extends mt{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(t,e=!1){const{mobile:r,name:n}=Ue.getWalletRouterData(),i=r?.native,s=r?.universal;if(i&&!e){const c=Ue.formatNativeUrl(i,t,n);Ue.openHref(c,"_self")}else if(s){const c=Ue.formatUniversalUrl(s,t,n);Ue.openHref(c,"_self")}}openMobileApp(t=!1){const{walletConnectUri:e}=hr.state,r=Ue.getWalletRouterData();nt.setRecentWallet(r),e&&this.onFormatAndRedirect(e,t)}onGoToAppStore(t){t&&Ue.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,app:n,mobile:i}=Ue.getWalletRouterData(),{isWeb:s}=nt.getCachedRouterWalletPlatforms(),c=n?.ios,l=i?.universal;return ve`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" 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="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${l?ve`<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="${Wr(r)}"></wcm-wallet-image><wcm-text>${`Get ${t}`}</wcm-text></div><wcm-button .iconRight="${Nt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(c)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Pu.styles=[xt.globalCss,qT],i2([on()],Pu.prototype,"isError",2),Pu=i2([Ct("wcm-mobile-connecting-view")],Pu);const KT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var WT=Object.defineProperty,VT=Object.getOwnPropertyDescriptor,GT=(t,e,r,n)=>{for(var i=n>1?void 0:n?VT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&WT(e,r,i),i};let $d=class extends mt{render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isDesktop:n,isWeb:i}=nt.getCachedRouterWalletPlatforms();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${Wr(r)}"></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 ${t} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};$d.styles=[xt.globalCss,KT],$d=GT([Ct("wcm-mobile-qr-connecting-view")],$d);var YT=Object.defineProperty,JT=Object.getOwnPropertyDescriptor,QT=(t,e,r,n)=>{for(var i=n>1?void 0:n?JT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&YT(e,r,i),i};let Nd=class extends mt{render(){return ve`<wcm-modal-header title="Scan the code" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Nd.styles=[xt.globalCss],Nd=QT([Ct("wcm-qrcode-view")],Nd);const ZT=Tt`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 XT=Object.defineProperty,e$=Object.getOwnPropertyDescriptor,kc=(t,e,r,n)=>{for(var i=n>1?void 0:n?e$(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&XT(e,r,i),i};const Rd=40;let go=class extends mt{constructor(){super(...arguments),this.loading=!sn.state.wallets.listings.length,this.firstFetch=!sn.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=nt.debounce(t=>{t.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=t,sn.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),sn.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect()}get placeholderEl(){return nt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([t])=>{t.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:t,search:e}=sn.state,{listings:r,total:n}=this.search?e:t;return n<=Rd||r.length>=n}async fetchWallets(){var t;const{wallets:e,search:r}=sn.state,{listings:n,total:i,page:s}=this.search?r:e;if(!this.endReached&&(this.firstFetch||i>Rd&&n.length<i))try{this.loading=!0;const c=(t=hr.state.chains)==null?void 0:t.join(","),{listings:l}=await sn.getWallets({page:this.firstFetch?1:s+1,entries:Rd,search:this.search,version:2,chains:c}),f=l.map(h=>nt.getWalletIcon(h));await Promise.all([...f.map(async h=>nt.preloadImage(h)),Ue.wait(300)]),this.endReached=this.isLastPage()}catch(c){console.error(c),vs.openToast(nt.getErrorMessage(c),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(t){Ue.isAndroid()?nt.handleMobileLinking(t):nt.goToConnectingView(t)}onSearchChange(t){const{value:e}=t.target;this.searchDebounce(e)}render(){const{wallets:t,search:e}=sn.state,{listings:r}=this.search?e:t,n=this.loading&&!r.length,i=this.search.length>=3;let s=Ss.manualWalletsTemplate(),c=Ss.recomendedWalletsTemplate(!0);i&&(s=s.filter(({values:h})=>nt.caseSafeIncludes(h[0],this.search)),c=c.filter(({values:h})=>nt.caseSafeIncludes(h[0],this.search)));const l=!this.loading&&!r.length&&!c.length,f={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":l};return ve`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Hi(f)}"><div class="wcm-grid">${n?null:s} ${n?null:c} ${n?null:r.map(h=>ve`${h?ve`<wcm-wallet-button imageId="${h.image_id}" name="${h.name}" walletId="${h.id}" .onClick="${()=>this.onConnect(h)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${l?ve`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!l&&this.loading?ve`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};go.styles=[xt.globalCss,ZT],kc([on()],go.prototype,"loading",2),kc([on()],go.prototype,"firstFetch",2),kc([on()],go.prototype,"search",2),kc([on()],go.prototype,"endReached",2),go=kc([Ct("wcm-wallet-explorer-view")],go);const t$=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var r$=Object.defineProperty,n$=Object.getOwnPropertyDescriptor,s2=(t,e,r,n)=>{for(var i=n>1?void 0:n?n$(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&r$(e,r,i),i};let Mu=class extends mt{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(t){const{desktop:e,name:r}=Ue.getWalletRouterData(),n=e?.universal;if(n){const i=Ue.formatUniversalUrl(n,t,r);Ue.openHref(i,"_blank")}}openWebWallet(){const{walletConnectUri:t}=hr.state,e=Ue.getWalletRouterData();nt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isMobile:n,isDesktop:i}=nt.getCachedRouterWalletPlatforms(),s=Ue.isMobile();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${t} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${s?!1:i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Mu.styles=[xt.globalCss,t$],s2([on()],Mu.prototype,"isError",2),Mu=s2([Ct("wcm-web-connecting-view")],Mu);var i$=Object.freeze({__proto__:null,get WcmModal(){return Ea},get WcmQrCode(){return Wi}});Dn.EthereumProvider=CC,Dn.OPTIONAL_EVENTS=Ty,Dn.OPTIONAL_METHODS=My,Dn.REQUIRED_EVENTS=ru,Dn.REQUIRED_METHODS=tu,Dn.default=su,Object.defineProperty(Dn,"__esModule",{value:!0})});
133
+ Minimum version required to store current data is: `+o+`.
134
+ `);const c=xP(e,r,i),l=Su.getSymbolSize(e),f=new dP(l);return yP(f,e),bP(f),_P(f,e),ld(f,r,0),e>=7&&EP(f,e),AP(f,c),isNaN(n)&&(n=od.getBestMask(f,ld.bind(null,f,r))),od.applyMask(n,f),ld(f,r,n),{modules:f,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}Iy.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=sd.M,i,o;return typeof r<"u"&&(n=sd.from(r.errorCorrectionLevel,sd.M),i=Du.from(r.version),o=od.from(r.maskPattern),r.toSJISFunc&&Su.setToSJISFunction(r.toSJISFunc)),SP(e,i,n,o)};var jy={},ud={};(function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(o){return[o,o]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,o=n.width&&n.width>=21?n.width:void 0,c=n.scale||4;return{width:o,scale:o?4:c,margin:i,color:{dark:e(n.color.dark||"#000000ff"),light:e(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},t.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},t.getImageWidth=function(n,i){const o=t.getScale(n,i);return Math.floor((n+i.margin*2)*o)},t.qrToImageData=function(n,i,o){const c=i.modules.size,l=i.modules.data,f=t.getScale(c,o),h=Math.floor((c+o.margin*2)*f),g=o.margin*f,_=[o.color.light,o.color.dark];for(let E=0;E<h;E++)for(let A=0;A<h;A++){let S=(E*h+A)*4,U=o.color.light;if(E>=g&&A>=g&&E<h-g&&A<h-g){const W=Math.floor((E-g)/f),Y=Math.floor((A-g)/f);U=_[l[W*c+Y]?1:0]}n[S++]=U.r,n[S++]=U.g,n[S++]=U.b,n[S]=U.a}}})(ud),function(t){const e=ud;function r(i,o,c){i.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=c,o.width=c,o.style.height=c+"px",o.style.width=c+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(o,c,l){let f=l,h=c;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),c||(h=n()),f=e.getOptions(f);const g=e.getImageWidth(o.modules.size,f),_=h.getContext("2d"),E=_.createImageData(g,g);return e.qrToImageData(E.data,o,f),r(_,h,g),_.putImageData(E,0,0),h},t.renderToDataURL=function(o,c,l){let f=l;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),f||(f={});const h=t.render(o,c,f),g=f.type||"image/png",_=f.rendererOpts||{};return h.toDataURL(g,_.quality)}}(jy);var ky={};const DP=ud;function qy(t,e){const r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function hd(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function CP(t,e,r){let n="",i=0,o=!1,c=0;for(let l=0;l<t.length;l++){const f=Math.floor(l%e),h=Math.floor(l/e);!f&&!o&&(o=!0),t[l]?(c++,l>0&&f>0&&t[l-1]||(n+=o?hd("M",f+r,.5+h+r):hd("m",i,0),i=0,o=!1),f+1<e&&t[l+1]||(n+=hd("h",c),c=0)):i++}return n}ky.render=function(e,r,n){const i=DP.getOptions(r),o=e.modules.size,c=e.modules.data,l=o+i.margin*2,f=i.color.light.a?"<path "+qy(i.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+qy(i.color.dark,"stroke")+' d="'+CP(c,o,i.margin)+'"/>',g='viewBox="0 0 '+l+" "+l+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+g+' shape-rendering="crispEdges">'+f+h+`</svg>
135
+ `;return typeof n=="function"&&n(null,E),E};const OP=zO,fd=Iy,zy=jy,PP=ky;function dd(t,e,r,n,i){const o=[].slice.call(arguments,1),c=o.length,l=typeof o[c-1]=="function";if(!l&&!OP())throw new Error("Callback required as last argument");if(l){if(c<2)throw new Error("Too few arguments provided");c===2?(i=r,r=e,e=n=void 0):c===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(r=e,e=n=void 0):c===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(f,h){try{const g=fd.create(r,n);f(t(g,e,n))}catch(g){h(g)}})}try{const f=fd.create(r,n);i(null,t(f,e,n))}catch(f){i(f)}}Tc.create=fd.create,Tc.toCanvas=dd.bind(null,zy.render),Tc.toDataURL=dd.bind(null,zy.renderToDataURL),Tc.toString=dd.bind(null,function(t,e,r){return PP.render(t,r)});var MP=Object.defineProperty,Hy=Object.getOwnPropertySymbols,TP=Object.prototype.hasOwnProperty,$P=Object.prototype.propertyIsEnumerable,Ky=(t,e,r)=>e in t?MP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pd=(t,e)=>{for(var r in e||(e={}))TP.call(e,r)&&Ky(t,r,e[r]);if(Hy)for(var r of Hy(e))$P.call(e,r)&&Ky(t,r,e[r]);return t};function NP(){var t;const e=(t=ms.state.themeMode)!=null?t:"dark",r={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":r.foreground[1],"--wcm-color-fg-2":r.foreground[2],"--wcm-color-fg-3":r.foreground[3],"--wcm-color-bg-1":r.background[1],"--wcm-color-bg-2":r.background[2],"--wcm-color-bg-3":r.background[3],"--wcm-color-overlay":r.overlay}}function Wy(){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 xt={getPreset(t){return Wy()[t]},setTheme(){const t=document.querySelector(":root"),{themeVariables:e}=ms.state;if(t){const r=pd(pd(pd({},NP()),Wy()),e);Object.entries(r).forEach(([n,i])=>t.style.setProperty(n,i))}},globalCss:Tt`*,::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)}`},RP=Tt`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 LP=Object.defineProperty,BP=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?BP(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&LP(e,r,i),i};let Es=class extends mt{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const t={"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"),ve`<button class="${Ki(t)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};Es.styles=[xt.globalCss,RP],va([ht({type:Boolean})],Es.prototype,"disabled",2),va([ht()],Es.prototype,"iconLeft",2),va([ht()],Es.prototype,"iconRight",2),va([ht()],Es.prototype,"onClick",2),va([ht()],Es.prototype,"variant",2),Es=va([Ct("wcm-button")],Es);const UP=Tt`: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 FP=Object.defineProperty,jP=Object.getOwnPropertyDescriptor,gd=(t,e,r,n)=>{for(var i=n>1?void 0:n?jP(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&FP(e,r,i),i};let Lc=class extends mt{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const t={"wcm-secondary":this.variant==="secondary"};return ve`<button ?disabled="${this.disabled}" class="${Ki(t)}"><slot></slot></button>`}};Lc.styles=[xt.globalCss,UP],gd([ht({type:Boolean})],Lc.prototype,"disabled",2),gd([ht()],Lc.prototype,"variant",2),Lc=gd([Ct("wcm-button-big")],Lc);const kP=Tt`: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 qP=Object.defineProperty,zP=Object.getOwnPropertyDescriptor,HP=(t,e,r,n)=>{for(var i=n>1?void 0:n?zP(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&qP(e,r,i),i};let md=class extends mt{render(){return ve`<div><slot></slot></div>`}};md.styles=[xt.globalCss,kP],md=HP([Ct("wcm-info-footer")],md);const Nt={CROSS_ICON:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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:ar`<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>`},KP=Tt`.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 WP=Object.defineProperty,VP=Object.getOwnPropertyDescriptor,GP=(t,e,r,n)=>{for(var i=n>1?void 0:n?VP(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&WP(e,r,i),i};let vd=class extends mt{render(){return ve`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Nt.WALLET_CONNECT_LOGO} <button @click="${to.close}">${Nt.CROSS_ICON}</button></div>`}};vd.styles=[xt.globalCss,KP],vd=GP([Ct("wcm-modal-backcard")],vd);const YP=Tt`main{padding:20px;padding-top:0;width:100%}`;var JP=Object.defineProperty,QP=Object.getOwnPropertyDescriptor,ZP=(t,e,r,n)=>{for(var i=n>1?void 0:n?QP(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&JP(e,r,i),i};let wd=class extends mt{render(){return ve`<main><slot></slot></main>`}};wd.styles=[xt.globalCss,YP],wd=ZP([Ct("wcm-modal-content")],wd);const XP=Tt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var eM=Object.defineProperty,tM=Object.getOwnPropertyDescriptor,rM=(t,e,r,n)=>{for(var i=n>1?void 0:n?tM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&eM(e,r,i),i};let yd=class extends mt{render(){return ve`<footer><slot></slot></footer>`}};yd.styles=[xt.globalCss,XP],yd=rM([Ct("wcm-modal-footer")],yd);const nM=Tt`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 iM=Object.defineProperty,sM=Object.getOwnPropertyDescriptor,Bc=(t,e,r,n)=>{for(var i=n>1?void 0:n?sM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&iM(e,r,i),i};let lo=class extends mt{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return ve`<button class="wcm-back-btn" @click="${rr.goBack}">${Nt.BACK_ICON}</button>`}actionBtnTemplate(){return ve`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const t={"wcm-border":this.border},e=rr.state.history.length>1,r=this.title?ve`<wcm-text variant="big-bold">${this.title}</wcm-text>`:ve`<slot></slot>`;return ve`<header class="${Ki(t)}">${e?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};lo.styles=[xt.globalCss,nM],Bc([ht()],lo.prototype,"title",2),Bc([ht()],lo.prototype,"onAction",2),Bc([ht()],lo.prototype,"actionIcon",2),Bc([ht({type:Boolean})],lo.prototype,"border",2),lo=Bc([Ct("wcm-modal-header")],lo);const nt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(t,e){const r=t.renderRoot.querySelector(e);if(!r)throw new Error(`${e} not found`);return r},getWalletIcon({id:t,image_id:e}){const{walletImages:r}=yn.state;return r!=null&&r[t]?r[t]:e?an.getWalletImageUrl(e):""},getWalletName(t,e=!1){return e&&t.length>8?`${t.substring(0,8)}..`:t},isMobileAnimation(){return window.innerWidth<=nt.MOBILE_BREAKPOINT},async preloadImage(t){const e=new Promise((r,n)=>{const i=new Image;i.onload=r,i.onerror=n,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,Ue.wait(3e3)])},getErrorMessage(t){return t instanceof Error?t.message:"Unknown Error"},debounce(t,e=500){let r;return(...n)=>{function i(){t(...n)}r&&clearTimeout(r),r=setTimeout(i,e)}},handleMobileLinking(t){const{walletConnectUri:e}=hr.state,{mobile:r,name:n}=t,i=r?.native,o=r?.universal;nt.setRecentWallet(t);function c(l){let f="";i?f=Ue.formatUniversalUrl(i,l,n):o&&(f=Ue.formatNativeUrl(o,l,n)),Ue.openHref(f,"_self")}e&&c(e)},handleAndroidLinking(){const{walletConnectUri:t}=hr.state;t&&(Ue.setWalletConnectAndroidDeepLink(t),Ue.openHref(t,"_self"))},async handleUriCopy(){const{walletConnectUri:t}=hr.state;if(t)try{await navigator.clipboard.writeText(t),vs.openToast("Link copied","success")}catch{vs.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:t}=yn.state,e=Object.values(t??{});return Object.values(e)},truncate(t,e=8){return t.length<=e?t:`${t.substring(0,4)}...${t.substring(t.length-4)}`},setRecentWallet(t){try{localStorage.setItem(nt.WCM_RECENT_WALLET_DATA,JSON.stringify(t))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const t=localStorage.getItem(nt.WCM_RECENT_WALLET_DATA);return t?JSON.parse(t):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(t,e){return t.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){Ue.openHref(nt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:t,mobile:e}=Ue.getWalletRouterData(),r=!!t?.native,n=!!t?.universal,i=!!e?.native||!!e?.universal;return{isDesktop:r,isMobile:i,isWeb:n}},goToConnectingView(t){rr.setData({Wallet:t});const e=Ue.isMobile(),{isDesktop:r,isWeb:n,isMobile:i}=nt.getCachedRouterWalletPlatforms();e?i?rr.push("MobileConnecting"):n?rr.push("WebConnecting"):rr.push("InstallWallet"):r?rr.push("DesktopConnecting"):n?rr.push("WebConnecting"):i?rr.push("MobileQrcodeConnecting"):rr.push("InstallWallet")}},oM=Tt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var aM=Object.defineProperty,cM=Object.getOwnPropertyDescriptor,bd=(t,e,r,n)=>{for(var i=n>1?void 0:n?cM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&aM(e,r,i),i};let Uc=class extends mt{constructor(){super(),this.view=rr.state.view,this.prevView=rr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=rr.subscribe(t=>{this.view!==t.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([t])=>{const e=`${t.contentRect.height}px`;this.oldHeight!=="0px"&&co(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var t,e;(t=this.unsubscribe)==null||t.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return nt.getShadowRootElement(this,".wcm-router")}get contentEl(){return nt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return ve`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return ve`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return ve`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return ve`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return ve`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return ve`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return ve`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return ve`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return ve`<div>Not Found</div>`}}async onChangeRoute(){await co(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=rr.state.view,co(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return ve`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Uc.styles=[xt.globalCss,oM],bd([cn()],Uc.prototype,"view",2),bd([cn()],Uc.prototype,"prevView",2),Uc=bd([Ct("wcm-modal-router")],Uc);const lM=Tt`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 uM=Object.defineProperty,hM=Object.getOwnPropertyDescriptor,Vy=(t,e,r,n)=>{for(var i=n>1?void 0:n?hM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&uM(e,r,i),i};let Cu=class extends mt{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=vs.subscribe(t=>{t.open?(this.open=!0,this.timeout=setTimeout(()=>vs.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var t;(t=this.unsubscribe)==null||t.call(this),clearTimeout(this.timeout),vs.closeToast()}render(){const{message:t,variant:e}=vs.state,r={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?ve`<div class="${Ki(r)}">${e==="success"?Nt.CHECKMARK_ICON:null} ${e==="error"?Nt.CROSS_ICON:null}<wcm-text variant="small-regular">${t}</wcm-text></div>`:null}};Cu.styles=[xt.globalCss,lM],Vy([cn()],Cu.prototype,"open",2),Cu=Vy([Ct("wcm-modal-toast")],Cu);const fM=.1,Gy=2.5,Wi=7;function _d(t,e,r){return t===e?!1:(t-e<0?e-t:t-e)<=r+fM}function dM(t,e){const r=Array.prototype.slice.call(Tc.create(t,{errorCorrectionLevel:e}).modules.data,0),n=Math.sqrt(r.length);return r.reduce((i,o,c)=>(c%n===0?i.push([o]):i[i.length-1].push(o))&&i,[])}const pM={generate(t,e,r){const n="#141414",i="#ffffff",o=[],c=dM(t,"Q"),l=e/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:S,y:U})=>{const W=(c.length-Wi)*l*S,Y=(c.length-Wi)*l*U,B=.45;for(let z=0;z<f.length;z+=1){const P=l*(Wi-z*2);o.push(ar`<rect fill="${z%2===0?n:i}" height="${P}" rx="${P*B}" ry="${P*B}" width="${P}" x="${W+l*z}" y="${Y+l*z}">`)}});const h=Math.floor((r+25)/l),g=c.length/2-h/2,_=c.length/2+h/2-1,E=[];c.forEach((S,U)=>{S.forEach((W,Y)=>{if(c[U][Y]&&!(U<Wi&&Y<Wi||U>c.length-(Wi+1)&&Y<Wi||U<Wi&&Y>c.length-(Wi+1))&&!(U>g&&U<_&&Y>g&&Y<_)){const B=U*l+l/2,z=Y*l+l/2;E.push([B,z])}})});const A={};return E.forEach(([S,U])=>{A[S]?A[S].push(U):A[S]=[U]}),Object.entries(A).map(([S,U])=>{const W=U.filter(Y=>U.every(B=>!_d(Y,B,l)));return[Number(S),W]}).forEach(([S,U])=>{U.forEach(W=>{o.push(ar`<circle cx="${S}" cy="${W}" fill="${n}" r="${l/Gy}">`)})}),Object.entries(A).filter(([S,U])=>U.length>1).map(([S,U])=>{const W=U.filter(Y=>U.some(B=>_d(Y,B,l)));return[Number(S),W]}).map(([S,U])=>{U.sort((Y,B)=>Y<B?-1:1);const W=[];for(const Y of U){const B=W.find(z=>z.some(P=>_d(Y,P,l)));B?B.push(Y):W.push([Y])}return[S,W.map(Y=>[Y[0],Y[Y.length-1]])]}).forEach(([S,U])=>{U.forEach(([W,Y])=>{o.push(ar`<line x1="${S}" x2="${S}" y1="${W}" y2="${Y}" stroke="${n}" stroke-width="${l/(Gy/2)}" stroke-linecap="round">`)})}),o}},gM=Tt`@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 mM=Object.defineProperty,vM=Object.getOwnPropertyDescriptor,wa=(t,e,r,n)=>{for(var i=n>1?void 0:n?vM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&mM(e,r,i),i};let Vi=class extends mt{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const t=ms.state.themeMode==="light"?this.size:this.size-36;return ar`<svg height="${t}" width="${t}">${pM.generate(this.uri,t,t/4)}</svg>`}render(){const t={"wcm-dark":ms.state.themeMode==="dark"};return ve`<div style="${`width: ${this.size}px`}" class="${Ki(t)}">${this.walletId||this.imageUrl?ve`<wcm-wallet-image walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}" imageUrl="${Wr(this.imageUrl)}"></wcm-wallet-image>`:Nt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Vi.styles=[xt.globalCss,gM],wa([ht()],Vi.prototype,"uri",2),wa([ht({type:Number})],Vi.prototype,"size",2),wa([ht()],Vi.prototype,"imageId",2),wa([ht()],Vi.prototype,"walletId",2),wa([ht()],Vi.prototype,"imageUrl",2),Vi=wa([Ct("wcm-qrcode")],Vi);const wM=Tt`: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 yM=Object.defineProperty,bM=Object.getOwnPropertyDescriptor,Yy=(t,e,r,n)=>{for(var i=n>1?void 0:n?bM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&yM(e,r,i),i};let Ou=class extends mt{constructor(){super(...arguments),this.onChange=()=>null}render(){return ve`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Nt.SEARCH_ICON}`}};Ou.styles=[xt.globalCss,wM],Yy([ht()],Ou.prototype,"onChange",2),Ou=Yy([Ct("wcm-search-input")],Ou);const _M=Tt`@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 EM=Object.defineProperty,AM=Object.getOwnPropertyDescriptor,xM=(t,e,r,n)=>{for(var i=n>1?void 0:n?AM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&EM(e,r,i),i};let Ed=class extends mt{render(){return ve`<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>`}};Ed.styles=[xt.globalCss,_M],Ed=xM([Ct("wcm-spinner")],Ed);const IM=Tt`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 SM=Object.defineProperty,DM=Object.getOwnPropertyDescriptor,Ad=(t,e,r,n)=>{for(var i=n>1?void 0:n?DM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&SM(e,r,i),i};let Fc=class extends mt{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const t={"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 ve`<span><slot class="${Ki(t)}"></slot></span>`}};Fc.styles=[xt.globalCss,IM],Ad([ht()],Fc.prototype,"variant",2),Ad([ht()],Fc.prototype,"color",2),Fc=Ad([Ct("wcm-text")],Fc);const CM=Tt`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 OM=Object.defineProperty,PM=Object.getOwnPropertyDescriptor,As=(t,e,r,n)=>{for(var i=n>1?void 0:n?PM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&OM(e,r,i),i};let Si=class extends mt{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?ve`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?ve`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){Tw.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var t;return ve`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${Wr(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(t=this.label)!=null?t:nt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};Si.styles=[xt.globalCss,CM],As([ht()],Si.prototype,"onClick",2),As([ht()],Si.prototype,"name",2),As([ht()],Si.prototype,"walletId",2),As([ht()],Si.prototype,"label",2),As([ht()],Si.prototype,"imageId",2),As([ht({type:Boolean})],Si.prototype,"installed",2),As([ht({type:Boolean})],Si.prototype,"recent",2),Si=As([Ct("wcm-wallet-button")],Si);const MM=Tt`: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 TM=Object.defineProperty,$M=Object.getOwnPropertyDescriptor,Pu=(t,e,r,n)=>{for(var i=n>1?void 0:n?$M(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&TM(e,r,i),i};let ya=class extends mt{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var t;const e=(t=this.imageUrl)!=null&&t.length?this.imageUrl:nt.getWalletIcon({id:this.walletId,image_id:this.imageId});return ve`${e.length?ve`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Nt.WALLET_PLACEHOLDER}`}};ya.styles=[xt.globalCss,MM],Pu([ht()],ya.prototype,"walletId",2),Pu([ht()],ya.prototype,"imageId",2),Pu([ht()],ya.prototype,"imageUrl",2),ya=Pu([Ct("wcm-wallet-image")],ya);var NM=Object.defineProperty,RM=Object.getOwnPropertyDescriptor,Jy=(t,e,r,n)=>{for(var i=n>1?void 0:n?RM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&NM(e,r,i),i};let xd=class extends mt{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(t){try{t!=null&&t.length&&await Promise.all(t.map(async e=>nt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",t)}}async preloadListings(){if(yn.state.enableExplorer){await an.getRecomendedWallets(),hr.setIsDataLoaded(!0);const{recomendedWallets:t}=an.state,e=t.map(r=>nt.getWalletIcon(r));await this.loadImages(e)}else hr.setIsDataLoaded(!0)}async preloadCustomImages(){const t=nt.getCustomImageUrls();await this.loadImages(t)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(t){console.error(t),vs.openToast("Failed preloading","error")}}};Jy([cn()],xd.prototype,"preload",2),xd=Jy([Ct("wcm-explorer-context")],xd);var LM=Object.defineProperty,BM=Object.getOwnPropertyDescriptor,UM=(t,e,r,n)=>{for(var i=n>1?void 0:n?BM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&LM(e,r,i),i};let Qy=class extends mt{constructor(){super(),this.unsubscribeTheme=void 0,xt.setTheme(),this.unsubscribeTheme=ms.subscribe(xt.setTheme)}disconnectedCallback(){var t;(t=this.unsubscribeTheme)==null||t.call(this)}};Qy=UM([Ct("wcm-theme-context")],Qy);const FM=Tt`@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 jM=Object.defineProperty,kM=Object.getOwnPropertyDescriptor,qM=(t,e,r,n)=>{for(var i=n>1?void 0:n?kM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&jM(e,r,i),i};let Id=class extends mt{onGoToQrcode(){rr.push("Qrcode")}render(){const{recomendedWallets:t}=an.state,e=[...t,...t],r=Ue.RECOMMENDED_WALLET_AMOUNT*2;return ve`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Nt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Nt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(r)].map((n,i)=>{const o=e[i%e.length];return o?ve`<wcm-wallet-image walletId="${o.id}" imageId="${o.image_id}"></wcm-wallet-image>`:Nt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${nt.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>`}};Id.styles=[xt.globalCss,FM],Id=qM([Ct("wcm-android-wallet-selection")],Id);const zM=Tt`@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 HM=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,ba=(t,e,r,n)=>{for(var i=n>1?void 0:n?KM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&HM(e,r,i),i};let xs=class extends mt{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var t,e;const r=(e=(t=ms.state.themeVariables)==null?void 0:t["--wcm-wallet-icon-large-border-radius"])!=null?e:xt.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;r.includes("%")?n=88/100*parseInt(r,10):n=parseInt(r,10),n*=1.17;const i=317-n*1.57,o=425-n*1.8;return ve`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${n}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${i}" stroke-dashoffset="${o}"></use></svg>`}render(){const t={"wcm-error":this.isError,"wcm-stale":this.isStale};return ve`<div class="${Ki(t)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};xs.styles=[xt.globalCss,zM],ba([ht()],xs.prototype,"walletId",2),ba([ht()],xs.prototype,"imageId",2),ba([ht({type:Boolean})],xs.prototype,"isError",2),ba([ht({type:Boolean})],xs.prototype,"isStale",2),ba([ht()],xs.prototype,"label",2),xs=ba([Ct("wcm-connector-waiting")],xs);const _a={manualWallets(){var t,e;const{mobileWallets:r,desktopWallets:n}=yn.state,i=(t=_a.recentWallet())==null?void 0:t.id,o=Ue.isMobile()?r:n,c=o?.filter(l=>i!==l.id);return(e=Ue.isMobile()?c?.map(({id:l,name:f,links:h})=>({id:l,name:f,mobile:h,links:h})):c?.map(({id:l,name:f,links:h})=>({id:l,name:f,desktop:h,links:h})))!=null?e:[]},recentWallet(){return nt.getRecentWallet()},recomendedWallets(t=!1){var e;const r=t||(e=_a.recentWallet())==null?void 0:e.id,{recomendedWallets:n}=an.state;return n.filter(i=>r!==i.id)}},Is={onConnecting(t){nt.goToConnectingView(t)},manualWalletsTemplate(){return _a.manualWallets().map(t=>ve`<wcm-wallet-button walletId="${t.id}" name="${t.name}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(t=!1){return _a.recomendedWallets(t).map(e=>ve`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const t=_a.recentWallet();if(t)return ve`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${Wr(t.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`}},WM=Tt`.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 VM=Object.defineProperty,GM=Object.getOwnPropertyDescriptor,YM=(t,e,r,n)=>{for(var i=n>1?void 0:n?GM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&VM(e,r,i),i};let Sd=class extends mt{render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=yn.state,r=t!=="ALL"&&e,n=Is.manualWalletsTemplate(),i=Is.recomendedWalletsTemplate();let o=[Is.recentWalletTemplate(),...n,...i];o=o.filter(Boolean);const c=o.length>4||r;let l=[];c?l=o.slice(0,3):l=o;const f=!!l.length;return ve`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Nt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Nt.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>${f?ve`<wcm-modal-footer><div class="wcm-desktop-title">${Nt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${l} ${c?ve`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Sd.styles=[xt.globalCss,WM],Sd=YM([Ct("wcm-desktop-wallet-selection")],Sd);const JM=Tt`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 QM=Object.defineProperty,ZM=Object.getOwnPropertyDescriptor,XM=(t,e,r,n)=>{for(var i=n>1?void 0:n?ZM(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&QM(e,r,i),i};let Dd=class extends mt{render(){const{termsOfServiceUrl:t,privacyPolicyUrl:e}=yn.state;return t??e?ve`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${t?ve`<a href="${t}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${t&&e?"and":null} ${e?ve`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Dd.styles=[xt.globalCss,JM],Dd=XM([Ct("wcm-legal-notice")],Dd);const eT=Tt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var tT=Object.defineProperty,rT=Object.getOwnPropertyDescriptor,nT=(t,e,r,n)=>{for(var i=n>1?void 0:n?rT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&tT(e,r,i),i};let Cd=class extends mt{onQrcode(){rr.push("Qrcode")}render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=yn.state,r=t!=="ALL"&&e,n=Is.manualWalletsTemplate(),i=Is.recomendedWalletsTemplate();let o=[Is.recentWalletTemplate(),...n,...i];o=o.filter(Boolean);const c=o.length>8||r;let l=[];c?l=o.slice(0,7):l=o;const f=!!l.length;return ve`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Nt.QRCODE_ICON}"></wcm-modal-header>${f?ve`<wcm-modal-content><div>${l} ${c?ve`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Cd.styles=[xt.globalCss,eT],Cd=nT([Ct("wcm-mobile-wallet-selection")],Cd);const iT=Tt`: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 sT=Object.defineProperty,oT=Object.getOwnPropertyDescriptor,Od=(t,e,r,n)=>{for(var i=n>1?void 0:n?oT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&sT(e,r,i),i};let Ea=class extends mt{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=to.subscribe(t=>{t.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var t;(t=this.unsubscribeModal)==null||t.call(this)}get overlayEl(){return nt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return nt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(t){document.querySelector("body")&&(t?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(t){t.target===t.currentTarget&&to.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const t=nt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,r=.2;await Promise.all([co(this.overlayEl,{opacity:[0,1]},{delay:e,duration:r}).finished,co(this.containerEl,t,{delay:e,duration:r}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const t=nt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([co(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,co(this.containerEl,t,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",t=>{var e;t.key==="Escape"?to.close():t.key==="Tab"&&((e=t.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}render(){const t={"wcm-overlay":!0,"wcm-active":this.active};return ve`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Ki(t)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?ve`<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>`}};Ea.styles=[xt.globalCss,iT],Od([cn()],Ea.prototype,"open",2),Od([cn()],Ea.prototype,"active",2),Ea=Od([Ct("wcm-modal")],Ea);const aT=Tt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var cT=Object.defineProperty,lT=Object.getOwnPropertyDescriptor,jc=(t,e,r,n)=>{for(var i=n>1?void 0:n?lT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&cT(e,r,i),i};let uo=class extends mt{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){Ue.isMobile()?rr.replace("MobileConnecting"):rr.replace("MobileQrcodeConnecting")}onDesktop(){rr.replace("DesktopConnecting")}onWeb(){rr.replace("WebConnecting")}render(){return ve`<div>${this.isRetry?ve`<slot></slot>`:null} ${this.isMobile?ve`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Nt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?ve`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Nt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?ve`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Nt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};uo.styles=[xt.globalCss,aT],jc([ht({type:Boolean})],uo.prototype,"isMobile",2),jc([ht({type:Boolean})],uo.prototype,"isDesktop",2),jc([ht({type:Boolean})],uo.prototype,"isWeb",2),jc([ht({type:Boolean})],uo.prototype,"isRetry",2),uo=jc([Ct("wcm-platform-selection")],uo);const uT=Tt`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 hT=Object.defineProperty,fT=Object.getOwnPropertyDescriptor,dT=(t,e,r,n)=>{for(var i=n>1?void 0:n?fT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&hT(e,r,i),i};let Pd=class extends mt{onClick(){rr.push("WalletExplorer")}render(){const{recomendedWallets:t}=an.state,e=_a.manualWallets(),r=[...t,...e].reverse().slice(0,4);return ve`<button @click="${this.onClick}"><div class="wcm-icons">${r.map(n=>{const i=nt.getWalletIcon(n);if(i)return ve`<img crossorigin="anonymous" src="${i}">`;const o=nt.getWalletIcon({id:n.id});return o?ve`<img crossorigin="anonymous" src="${o}">`:Nt.WALLET_PLACEHOLDER})} ${[...Array(4-r.length)].map(()=>Nt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Pd.styles=[xt.globalCss,uT],Pd=dT([Ct("wcm-view-all-wallets-button")],Pd);const pT=Tt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var gT=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,Mu=(t,e,r,n)=>{for(var i=n>1?void 0:n?mT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&gT(e,r,i),i};let Aa=class extends mt{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:t}=hr.state;this.uri=t},0)}get overlayEl(){return nt.getShadowRootElement(this,".wcm-qr-container")}render(){return ve`<div class="wcm-qr-container">${this.uri?ve`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}"></wcm-qrcode>`:ve`<wcm-spinner></wcm-spinner>`}</div>`}};Aa.styles=[xt.globalCss,pT],Mu([ht()],Aa.prototype,"walletId",2),Mu([ht()],Aa.prototype,"imageId",2),Mu([cn()],Aa.prototype,"uri",2),Aa=Mu([Ct("wcm-walletconnect-qr")],Aa);var vT=Object.defineProperty,wT=Object.getOwnPropertyDescriptor,yT=(t,e,r,n)=>{for(var i=n>1?void 0:n?wT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&vT(e,r,i),i};let Md=class extends mt{viewTemplate(){return Ue.isAndroid()?ve`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:Ue.isMobile()?ve`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:ve`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return ve`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Md.styles=[xt.globalCss],Md=yT([Ct("wcm-connect-wallet-view")],Md);const bT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var _T=Object.defineProperty,ET=Object.getOwnPropertyDescriptor,Zy=(t,e,r,n)=>{for(var i=n>1?void 0:n?ET(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&_T(e,r,i),i};let Tu=class extends mt{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(t){const{desktop:e,name:r}=Ue.getWalletRouterData(),n=e?.native;if(n){const i=Ue.formatNativeUrl(n,t,r);Ue.openHref(i,"_self")}}openDesktopApp(){const{walletConnectUri:t}=hr.state,e=Ue.getWalletRouterData();nt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isMobile:n,isWeb:i}=nt.getCachedRouterWalletPlatforms();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${t} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Tu.styles=[xt.globalCss,bT],Zy([cn()],Tu.prototype,"isError",2),Tu=Zy([Ct("wcm-desktop-connecting-view")],Tu);const AT=Tt`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 xT=Object.defineProperty,IT=Object.getOwnPropertyDescriptor,ST=(t,e,r,n)=>{for(var i=n>1?void 0:n?IT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&xT(e,r,i),i};let Td=class extends mt{onInstall(t){t&&Ue.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,homepage:n}=Ue.getWalletRouterData();return ve`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${t} to continue. If multiple browser extensions are installed, disable non ${t} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${Nt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};Td.styles=[xt.globalCss,AT],Td=ST([Ct("wcm-install-wallet-view")],Td);const DT=Tt`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 CT=Object.defineProperty,OT=Object.getOwnPropertyDescriptor,Xy=(t,e,r,n)=>{for(var i=n>1?void 0:n?OT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&CT(e,r,i),i};let $u=class extends mt{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(t,e=!1){const{mobile:r,name:n}=Ue.getWalletRouterData(),i=r?.native,o=r?.universal;if(i&&!e){const c=Ue.formatNativeUrl(i,t,n);Ue.openHref(c,"_self")}else if(o){const c=Ue.formatUniversalUrl(o,t,n);Ue.openHref(c,"_self")}}openMobileApp(t=!1){const{walletConnectUri:e}=hr.state,r=Ue.getWalletRouterData();nt.setRecentWallet(r),e&&this.onFormatAndRedirect(e,t)}onGoToAppStore(t){t&&Ue.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,app:n,mobile:i}=Ue.getWalletRouterData(),{isWeb:o}=nt.getCachedRouterWalletPlatforms(),c=n?.ios,l=i?.universal;return ve`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${o}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${l?ve`<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="${Wr(r)}"></wcm-wallet-image><wcm-text>${`Get ${t}`}</wcm-text></div><wcm-button .iconRight="${Nt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(c)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};$u.styles=[xt.globalCss,DT],Xy([cn()],$u.prototype,"isError",2),$u=Xy([Ct("wcm-mobile-connecting-view")],$u);const PT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var MT=Object.defineProperty,TT=Object.getOwnPropertyDescriptor,$T=(t,e,r,n)=>{for(var i=n>1?void 0:n?TT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&MT(e,r,i),i};let $d=class extends mt{render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isDesktop:n,isWeb:i}=nt.getCachedRouterWalletPlatforms();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${Wr(r)}"></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 ${t} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};$d.styles=[xt.globalCss,PT],$d=$T([Ct("wcm-mobile-qr-connecting-view")],$d);var NT=Object.defineProperty,RT=Object.getOwnPropertyDescriptor,LT=(t,e,r,n)=>{for(var i=n>1?void 0:n?RT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&NT(e,r,i),i};let Nd=class extends mt{render(){return ve`<wcm-modal-header title="Scan the code" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Nd.styles=[xt.globalCss],Nd=LT([Ct("wcm-qrcode-view")],Nd);const BT=Tt`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 UT=Object.defineProperty,FT=Object.getOwnPropertyDescriptor,kc=(t,e,r,n)=>{for(var i=n>1?void 0:n?FT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&UT(e,r,i),i};const Rd=40;let ho=class extends mt{constructor(){super(...arguments),this.loading=!an.state.wallets.listings.length,this.firstFetch=!an.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=nt.debounce(t=>{t.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=t,an.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),an.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect()}get placeholderEl(){return nt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([t])=>{t.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:t,search:e}=an.state,{listings:r,total:n}=this.search?e:t;return n<=Rd||r.length>=n}async fetchWallets(){var t;const{wallets:e,search:r}=an.state,{listings:n,total:i,page:o}=this.search?r:e;if(!this.endReached&&(this.firstFetch||i>Rd&&n.length<i))try{this.loading=!0;const c=(t=hr.state.chains)==null?void 0:t.join(","),{listings:l}=await an.getWallets({page:this.firstFetch?1:o+1,entries:Rd,search:this.search,version:2,chains:c}),f=l.map(h=>nt.getWalletIcon(h));await Promise.all([...f.map(async h=>nt.preloadImage(h)),Ue.wait(300)]),this.endReached=this.isLastPage()}catch(c){console.error(c),vs.openToast(nt.getErrorMessage(c),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(t){Ue.isAndroid()?nt.handleMobileLinking(t):nt.goToConnectingView(t)}onSearchChange(t){const{value:e}=t.target;this.searchDebounce(e)}render(){const{wallets:t,search:e}=an.state,{listings:r}=this.search?e:t,n=this.loading&&!r.length,i=this.search.length>=3;let o=Is.manualWalletsTemplate(),c=Is.recomendedWalletsTemplate(!0);i&&(o=o.filter(({values:h})=>nt.caseSafeIncludes(h[0],this.search)),c=c.filter(({values:h})=>nt.caseSafeIncludes(h[0],this.search)));const l=!this.loading&&!r.length&&!c.length,f={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":l};return ve`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Ki(f)}"><div class="wcm-grid">${n?null:o} ${n?null:c} ${n?null:r.map(h=>ve`${h?ve`<wcm-wallet-button imageId="${h.image_id}" name="${h.name}" walletId="${h.id}" .onClick="${()=>this.onConnect(h)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${l?ve`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!l&&this.loading?ve`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ho.styles=[xt.globalCss,BT],kc([cn()],ho.prototype,"loading",2),kc([cn()],ho.prototype,"firstFetch",2),kc([cn()],ho.prototype,"search",2),kc([cn()],ho.prototype,"endReached",2),ho=kc([Ct("wcm-wallet-explorer-view")],ho);const jT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var kT=Object.defineProperty,qT=Object.getOwnPropertyDescriptor,e2=(t,e,r,n)=>{for(var i=n>1?void 0:n?qT(e,r):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&kT(e,r,i),i};let Nu=class extends mt{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(t){const{desktop:e,name:r}=Ue.getWalletRouterData(),n=e?.universal;if(n){const i=Ue.formatUniversalUrl(n,t,r);Ue.openHref(i,"_blank")}}openWebWallet(){const{walletConnectUri:t}=hr.state,e=Ue.getWalletRouterData();nt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isMobile:n,isDesktop:i}=nt.getCachedRouterWalletPlatforms(),o=Ue.isMobile();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${t} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${o?!1:i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Nu.styles=[xt.globalCss,jT],e2([cn()],Nu.prototype,"isError",2),Nu=e2([Ct("wcm-web-connecting-view")],Nu);var zT=Object.freeze({__proto__:null,get WcmModal(){return Ea},get WcmQrCode(){return Vi}});Yn.EthereumProvider=dC,Yn.OPTIONAL_EVENTS=Dw,Yn.OPTIONAL_METHODS=Sw,Yn.REQUIRED_EVENTS=su,Yn.REQUIRED_METHODS=iu,Yn.default=cu,Object.defineProperty(Yn,"__esModule",{value:!0})});
149
136
  //# sourceMappingURL=index.umd.js.map