@walletconnect/ethereum-provider 2.13.3 → 2.14.0-2040e092
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.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +42 -42
- package/dist/index.umd.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/EthereumProvider.d.ts +4 -4
- package/dist/types/EthereumProvider.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(Vn,jr){typeof exports=="object"&&typeof module<"u"?jr(exports):typeof define=="function"&&define.amd?define(["exports"],jr):(Vn=typeof globalThis<"u"?globalThis:Vn||self,jr(Vn["@walletconnect/ethereum-provider"]={}))})(this,function(Vn){"use strict";var jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function t3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function il(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:{}},To=typeof Reflect=="object"?Reflect:null,jp=To&&typeof To.apply=="function"?To.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},sl;To&&typeof To.ownKeys=="function"?sl=To.ownKeys:Object.getOwnPropertySymbols?sl=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:sl=function(e){return Object.getOwnPropertyNames(e)};function r3(t){console&&console.warn&&console.warn(t)}var kp=Number.isNaN||function(e){return e!==e};function zt(){zt.init.call(this)}Dr.exports=zt,Dr.exports.once=o3,zt.EventEmitter=zt,zt.prototype._events=void 0,zt.prototype._eventsCount=0,zt.prototype._maxListeners=void 0;var qp=10;function ol(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 qp},set:function(t){if(typeof t!="number"||t<0||kp(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");qp=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||kp(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 zp(t){return t._maxListeners===void 0?zt.defaultMaxListeners:t._maxListeners}zt.prototype.getMaxListeners=function(){return zp(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")jp(f,this,r);else for(var h=f.length,g=Gp(f,h),n=0;n<h;++n)jp(g[n],this,r);return!0};function Hp(t,e,r,n){var i,o,c;if(ol(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=zp(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,r3(l)}return t}zt.prototype.addListener=function(e,r){return Hp(this,e,r,!1)},zt.prototype.on=zt.prototype.addListener,zt.prototype.prependListener=function(e,r){return Hp(this,e,r,!0)};function n3(){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 Kp(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=n3.bind(n);return i.listener=r,n.wrapFn=i,i}zt.prototype.once=function(e,r){return ol(r),this.on(e,Kp(this,e,r)),this},zt.prototype.prependOnceListener=function(e,r){return ol(r),this.prependListener(e,Kp(this,e,r)),this},zt.prototype.removeListener=function(e,r){var n,i,o,c,l;if(ol(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():i3(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 Wp(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?s3(i):Gp(i,i.length)}zt.prototype.listeners=function(e){return Wp(this,e,!0)},zt.prototype.rawListeners=function(e){return Wp(this,e,!1)},zt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Vp.call(t,e)},zt.prototype.listenerCount=Vp;function Vp(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?sl(this._events):[]};function Gp(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function i3(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function s3(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function o3(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))}Yp(t,e,o,{once:!0}),e!=="error"&&a3(t,i,{once:!0})})}function a3(t,e,r){typeof t.on=="function"&&Yp(t,"error",e,r)}function Yp(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 Qp=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))},c3=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),l3=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),u3=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}(),h3=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),f3=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),d3=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,p3=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Jp=3,g3=[["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",d3]],Zp=[["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 m3(t){return t?Xp(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new f3:typeof navigator<"u"?Xp(navigator.userAgent):y3()}function v3(t){return t!==""&&g3.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 Xp(t){var e=v3(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new h3;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<Jp&&(i=Qp(Qp([],i,!0),b3(Jp-i.length),!0)):i=[];var o=i.join("."),c=w3(t),l=p3.exec(t);return l&&l[1]?new u3(r,o,c,l[1]):new c3(r,o,c)}function w3(t){for(var e=0,r=Zp.length;e<r;e++){var n=Zp[e],i=n[0],o=n[1],c=o.exec(t);if(c)return i}return null}function y3(){var t=typeof process<"u"&&process.version;return t?new l3(process.version.slice(1)):null}function b3(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var ye={};/*! *****************************************************************************
|
|
1
|
+
(function(Vn,jr){typeof exports=="object"&&typeof module<"u"?jr(exports):typeof define=="function"&&define.amd?define(["exports"],jr):(Vn=typeof globalThis<"u"?globalThis:Vn||self,jr(Vn["@walletconnect/ethereum-provider"]={}))})(this,function(Vn){"use strict";var jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function n3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ol(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var Cr={exports:{}},No=typeof Reflect=="object"?Reflect:null,kp=No&&typeof No.apply=="function"?No.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},al;No&&typeof No.ownKeys=="function"?al=No.ownKeys:Object.getOwnPropertySymbols?al=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:al=function(t){return Object.getOwnPropertyNames(t)};function i3(e){console&&console.warn&&console.warn(e)}var qp=Number.isNaN||function(t){return t!==t};function ze(){ze.init.call(this)}Cr.exports=ze,Cr.exports.once=c3,ze.EventEmitter=ze,ze.prototype._events=void 0,ze.prototype._eventsCount=0,ze.prototype._maxListeners=void 0;var zp=10;function cl(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(ze,"defaultMaxListeners",{enumerable:!0,get:function(){return zp},set:function(e){if(typeof e!="number"||e<0||qp(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");zp=e}}),ze.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},ze.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||qp(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Hp(e){return e._maxListeners===void 0?ze.defaultMaxListeners:e._maxListeners}ze.prototype.getMaxListeners=function(){return Hp(this)},ze.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=t==="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[t];if(f===void 0)return!1;if(typeof f=="function")kp(f,this,r);else for(var h=f.length,g=Yp(f,h),n=0;n<h;++n)kp(g[n],this,r);return!0};function Kp(e,t,r,n){var i,o,c;if(cl(r),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),c=o[t]),c===void 0)c=o[t]=r,++e._eventsCount;else if(typeof c=="function"?c=o[t]=n?[r,c]:[c,r]:n?c.unshift(r):c.push(r),i=Hp(e),i>0&&c.length>i&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=c.length,i3(l)}return e}ze.prototype.addListener=function(t,r){return Kp(this,t,r,!1)},ze.prototype.on=ze.prototype.addListener,ze.prototype.prependListener=function(t,r){return Kp(this,t,r,!0)};function s3(){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 Wp(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=s3.bind(n);return i.listener=r,n.wrapFn=i,i}ze.prototype.once=function(t,r){return cl(r),this.on(t,Wp(this,t,r)),this},ze.prototype.prependOnceListener=function(t,r){return cl(r),this.prependListener(t,Wp(this,t,r)),this},ze.prototype.removeListener=function(t,r){var n,i,o,c,l;if(cl(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,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():o3(n,o),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,l||r)}return this},ze.prototype.off=ze.prototype.removeListener,ze.prototype.removeAllListeners=function(t){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[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),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[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(t,r[i]);return this};function Vp(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?a3(i):Yp(i,i.length)}ze.prototype.listeners=function(t){return Vp(this,t,!0)},ze.prototype.rawListeners=function(t){return Vp(this,t,!1)},ze.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Gp.call(e,t)},ze.prototype.listenerCount=Gp;function Gp(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ze.prototype.eventNames=function(){return this._eventsCount>0?al(this._events):[]};function Yp(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function o3(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function a3(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function c3(e,t){return new Promise(function(r,n){function i(c){e.removeListener(t,o),n(c)}function o(){typeof e.removeListener=="function"&&e.removeListener("error",i),r([].slice.call(arguments))}Qp(e,t,o,{once:!0}),t!=="error"&&l3(e,i,{once:!0})})}function l3(e,t,r){typeof e.on=="function"&&Qp(e,"error",t,r)}function Qp(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function i(o){n.once&&e.removeEventListener(t,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}const u3=/"(?:_|\\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*:/,h3=/"(?: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*:/,f3=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function d3(e,t){if(e==="__proto__"||e==="constructor"&&t&&typeof t=="object"&&"prototype"in t){p3(e);return}return t}function p3(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function ll(e,t={}){if(typeof e!="string")return e;const r=e.trim();if(e[0]==='"'&&e.at(-1)==='"'&&!e.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(!f3.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(u3.test(e)||h3.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,d3)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}function g3(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function _r(e,...t){try{return g3(e(...t))}catch(r){return Promise.reject(r)}}function m3(e){const t=typeof e;return e===null||t!=="object"&&t!=="function"}function v3(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function ul(e){if(m3(e))return String(e);if(v3(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return ul(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Jp(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const Th="base64:";function w3(e){if(typeof e=="string")return e;Jp();const t=Buffer.from(e).toString("base64");return Th+t}function y3(e){return typeof e!="string"||!e.startsWith(Th)?e:(Jp(),Buffer.from(e.slice(Th.length),"base64"))}function Xr(e){return e?e.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function b3(...e){return Xr(e.join(":"))}function hl(e){return e=Xr(e),e?e+":":""}function mF(e){return e}const _3="memory",E3=()=>{const e=new Map;return{name:_3,options:{},hasItem(t){return e.has(t)},getItem(t){return e.get(t)||null},getItemRaw(t){return e.get(t)||null},setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys(){return Array.from(e.keys())},clear(){e.clear()},dispose(){e.clear()}}};function A3(e={}){const t={mounts:{"":e.driver||E3()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=h=>{for(const g of t.mountpoints)if(h.startsWith(g))return{base:g,relativeKey:h.slice(g.length),driver:t.mounts[g]};return{base:"",relativeKey:h,driver:t.mounts[""]}},n=(h,g)=>t.mountpoints.filter(_=>_.startsWith(h)||g&&h.startsWith(_)).map(_=>({relativeBase:h.length>_.length?h.slice(_.length):void 0,mountpoint:_,driver:t.mounts[_]})),i=(h,g)=>{if(t.watching){g=Xr(g);for(const _ of t.watchListeners)_(h,g)}},o=async()=>{if(!t.watching){t.watching=!0;for(const h in t.mounts)t.unwatch[h]=await Zp(t.mounts[h],i,h)}},c=async()=>{if(t.watching){for(const h in t.unwatch)await t.unwatch[h]();t.unwatch={},t.watching=!1}},l=(h,g,_)=>{const E=new Map,x=I=>{let F=E.get(I.base);return F||(F={driver:I.driver,base:I.base,items:[]},E.set(I.base,F)),F};for(const I of h){const F=typeof I=="string",W=Xr(F?I:I.key),Y=F?void 0:I.value,B=F||!I.options?g:{...g,...I.options},z=r(W);x(z).items.push({key:W,value:Y,relativeKey:z.relativeKey,options:B})}return Promise.all([...E.values()].map(I=>_(I))).then(I=>I.flat())},f={hasItem(h,g={}){h=Xr(h);const{relativeKey:_,driver:E}=r(h);return _r(E.hasItem,_,g)},getItem(h,g={}){h=Xr(h);const{relativeKey:_,driver:E}=r(h);return _r(E.getItem,_,g).then(x=>ll(x))},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(x=>({key:b3(_.base,x.key),value:ll(x.value)}))):Promise.all(_.items.map(E=>_r(_.driver.getItem,E.relativeKey,E.options).then(x=>({key:E.key,value:ll(x)})))))},getItemRaw(h,g={}){h=Xr(h);const{relativeKey:_,driver:E}=r(h);return E.getItemRaw?_r(E.getItemRaw,_,g):_r(E.getItem,_,g).then(x=>y3(x))},async setItem(h,g,_={}){if(g===void 0)return f.removeItem(h);h=Xr(h);const{relativeKey:E,driver:x}=r(h);x.setItem&&(await _r(x.setItem,E,ul(g),_),x.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:ul(E.value),options:E.options})),g),_.driver.setItem&&await Promise.all(_.items.map(E=>_r(_.driver.setItem,E.relativeKey,ul(E.value),E.options)))})},async setItemRaw(h,g,_={}){if(g===void 0)return f.removeItem(h,_);h=Xr(h);const{relativeKey:E,driver:x}=r(h);if(x.setItemRaw)await _r(x.setItemRaw,E,g,_);else if(x.setItem)await _r(x.setItem,E,w3(g),_);else return;x.watch||i("update",h)},async removeItem(h,g={}){typeof g=="boolean"&&(g={removeMeta:g}),h=Xr(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=Xr(h);const{relativeKey:_,driver:E}=r(h),x=Object.create(null);if(E.getMeta&&Object.assign(x,await _r(E.getMeta,_,g)),!g.nativeOnly){const I=await _r(E.getItem,_+"$",g).then(F=>ll(F));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(x,I))}return x},setMeta(h,g,_={}){return this.setItem(h+"$",g,_)},removeMeta(h,g={}){return this.removeItem(h+"$",g)},async getKeys(h,g={}){h=hl(h);const _=n(h,!0);let E=[];const x=[];for(const I of _){const W=(await _r(I.driver.getKeys,I.relativeBase,g)).map(Y=>I.mountpoint+Xr(Y)).filter(Y=>!E.some(B=>Y.startsWith(B)));x.push(...W),E=[I.mountpoint,...E.filter(Y=>!Y.startsWith(I.mountpoint))]}return h?x.filter(I=>I.startsWith(h)&&!I.endsWith("$")):x.filter(I=>!I.endsWith("$"))},async clear(h,g={}){h=hl(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(x=>_.driver.removeItem(x,g)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(h=>Xp(h)))},async watch(h){return await o(),t.watchListeners.push(h),async()=>{t.watchListeners=t.watchListeners.filter(g=>g!==h),t.watchListeners.length===0&&await c()}},async unwatch(){t.watchListeners=[],await c()},mount(h,g){if(h=hl(h),h&&t.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(t.mountpoints.push(h),t.mountpoints.sort((_,E)=>E.length-_.length)),t.mounts[h]=g,t.watching&&Promise.resolve(Zp(g,i,h)).then(_=>{t.unwatch[h]=_}).catch(console.error),f},async unmount(h,g=!0){h=hl(h),!(!h||!t.mounts[h])&&(t.watching&&h in t.unwatch&&(t.unwatch[h](),delete t.unwatch[h]),g&&await Xp(t.mounts[h]),t.mountpoints=t.mountpoints.filter(_=>_!==h),delete t.mounts[h])},getMount(h=""){h=Xr(h)+":";const g=r(h);return{driver:g.driver,base:g.base}},getMounts(h="",g={}){return h=Xr(h),n(h,g.parents).map(E=>({driver:E.driver,base:E.mountpoint}))}};return f}function Zp(e,t,r){return e.watch?e.watch((n,i)=>t(n,r+i)):()=>{}}async function Xp(e){typeof e.dispose=="function"&&await _r(e.dispose)}function Us(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function t1(e,t){const r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);const n=Us(r);return(i,o)=>n.then(c=>o(c.transaction(t,i).objectStore(t)))}let Rh;function ja(){return Rh||(Rh=t1("keyval-store","keyval")),Rh}function e1(e,t=ja()){return t("readonly",r=>Us(r.get(e)))}function x3(e,t,r=ja()){return r("readwrite",n=>(n.put(t,e),Us(n.transaction)))}function I3(e,t=ja()){return t("readwrite",r=>(r.delete(e),Us(r.transaction)))}function S3(e=ja()){return e("readwrite",t=>(t.clear(),Us(t.transaction)))}function C3(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Us(e.transaction)}function D3(e=ja()){return e("readonly",t=>{if(t.getAllKeys)return Us(t.getAllKeys());const r=[];return C3(t,n=>r.push(n.key)).then(()=>r)})}const O3=e=>JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString()+"n":r),P3=e=>{const t=/([\[:])?(\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=e.replace(t,'$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 ka(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return P3(e)}catch{return e}}function Ui(e){return typeof e=="string"?e:O3(e)||""}const M3="idb-keyval";var $3=(e={})=>{const t=e.base&&e.base.length>0?`${e.base}:`:"",r=i=>t+i;let n;return e.dbName&&e.storeName&&(n=t1(e.dbName,e.storeName)),{name:M3,options:e,async hasItem(i){return!(typeof await e1(r(i),n)>"u")},async getItem(i){return await e1(r(i),n)??null},setItem(i,o){return x3(r(i),o,n)},removeItem(i){return I3(r(i),n)},getKeys(){return D3(n)},clear(){return S3(n)}}};const N3="WALLET_CONNECT_V2_INDEXED_DB",T3="keyvaluestorage";class R3{constructor(){this.indexedDb=A3({driver:$3({dbName:N3,storeName:T3})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const r=await this.indexedDb.getItem(t);if(r!==null)return r}async setItem(t,r){await this.indexedDb.setItem(t,Ui(r))}async removeItem(t){await this.indexedDb.removeItem(t)}}var Lh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},fl={exports:{}};(function(){let e;function t(){}e=t,e.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},e.prototype.setItem=function(r,n){this[r]=String(n)},e.prototype.removeItem=function(r){delete this[r]},e.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},e.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Lh<"u"&&Lh.localStorage?fl.exports=Lh.localStorage:typeof window<"u"&&window.localStorage?fl.exports=window.localStorage:fl.exports=new t})();function L3(e){var t;return[e[0],ka((t=e[1])!=null?t:"")]}class B3{constructor(){this.localStorage=fl.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(L3)}async getItem(t){const r=this.localStorage.getItem(t);if(r!==null)return ka(r)}async setItem(t,r){this.localStorage.setItem(t,Ui(r))}async removeItem(t){this.localStorage.removeItem(t)}}const U3="wc_storage_version",r1=1,F3=async(e,t,r)=>{const n=U3,i=await t.getItem(n);if(i&&i>=r1){r(t);return}const o=await e.getKeys();if(!o.length){r(t);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 e.getItem(l);await t.setItem(l,h),c.push(l)}}await t.setItem(n,r1),r(t),j3(e,c)},j3=async(e,t)=>{t.length&&t.forEach(async r=>{await e.removeItem(r)})};class k3{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const t=new B3;this.storage=t;try{const r=new R3;F3(t,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(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,r){return await this.initialize(),this.storage.setItem(t,r)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),t())},20)})}}var yt={};/*! *****************************************************************************
|
|
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 Th=function(t,e){return Th=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])},Th(t,e)};function _3(t,e){Th(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Nh=function(){return Nh=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},Nh.apply(this,arguments)};function E3(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 A3(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 x3(t,e){return function(r,n){e(r,n,t)}}function S3(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 D3(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 C3(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function O3(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Rh(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 e1(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 M3(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(e1(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 ja(t){return this instanceof ja?(this.v=t,this):new ja(t)}function $3(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(x){return new Promise(function(I,k){o.push([E,x,I,k])>1||l(E,x)})})}function l(E,x){try{f(n[E](x))}catch(I){_(o[0][3],I)}}function f(E){E.value instanceof ja?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,x){E(x),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:ja(t[i](c)),done:i==="return"}:o?o(c):c}:o}}function N3(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 Rh=="function"?Rh(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 R3(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function L3(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 B3(t){return t&&t.__esModule?t:{default:t}}function U3(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function F3(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 j3=Object.freeze({__proto__:null,__extends:_3,get __assign(){return Nh},__rest:E3,__decorate:A3,__param:x3,__metadata:S3,__awaiter:I3,__generator:D3,__createBinding:C3,__exportStar:O3,__values:Rh,__read:e1,__spread:M3,__spreadArrays:P3,__await:ja,__asyncGenerator:$3,__asyncDelegator:T3,__asyncValues:N3,__makeTemplateObject:R3,__importStar:L3,__importDefault:B3,__classPrivateFieldGet:U3,__classPrivateFieldSet:F3}),al=il(j3),Lh={},ka={},t1;function k3(){if(t1)return ka;t1=1,Object.defineProperty(ka,"__esModule",{value:!0}),ka.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return ka.delay=t,ka}var Us={},Bh={},Fs={},r1;function q3(){return r1||(r1=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 Uh={},n1;function z3(){return n1||(n1=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}(Uh)),Uh}var i1;function s1(){return i1||(i1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=al;e.__exportStar(q3(),t),e.__exportStar(z3(),t)}(Bh)),Bh}var o1;function H3(){if(o1)return Us;o1=1,Object.defineProperty(Us,"__esModule",{value:!0}),Us.fromMiliseconds=Us.toMiliseconds=void 0;const t=s1();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 a1;function K3(){return a1||(a1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=al;e.__exportStar(k3(),t),e.__exportStar(H3(),t)}(Lh)),Lh}var No={},c1;function W3(){if(c1)return No;c1=1,Object.defineProperty(No,"__esModule",{value:!0}),No.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 No.Watch=t,No.default=t,No}var Fh={},qa={},l1;function V3(){if(l1)return qa;l1=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.IWatch=void 0;class t{}return qa.IWatch=t,qa}var u1;function G3(){return u1||(u1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),al.__exportStar(V3(),t)}(Fh)),Fh}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=al;e.__exportStar(K3(),t),e.__exportStar(W3(),t),e.__exportStar(G3(),t),e.__exportStar(s1(),t)})(ye);var Qt={};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.getLocalStorage=Qt.getLocalStorageOrThrow=Qt.getCrypto=Qt.getCryptoOrThrow=h1=Qt.getLocation=Qt.getLocationOrThrow=kh=Qt.getNavigator=Qt.getNavigatorOrThrow=jh=Qt.getDocument=Qt.getDocumentOrThrow=Qt.getFromWindowOrThrow=Qt.getFromWindow=void 0;function js(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Qt.getFromWindow=js;function Ro(t){const e=js(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Qt.getFromWindowOrThrow=Ro;function Y3(){return Ro("document")}Qt.getDocumentOrThrow=Y3;function Q3(){return js("document")}var jh=Qt.getDocument=Q3;function J3(){return Ro("navigator")}Qt.getNavigatorOrThrow=J3;function Z3(){return js("navigator")}var kh=Qt.getNavigator=Z3;function X3(){return Ro("location")}Qt.getLocationOrThrow=X3;function e6(){return js("location")}var h1=Qt.getLocation=e6;function t6(){return Ro("crypto")}Qt.getCryptoOrThrow=t6;function r6(){return js("crypto")}Qt.getCrypto=r6;function n6(){return Ro("localStorage")}Qt.getLocalStorageOrThrow=n6;function i6(){return js("localStorage")}Qt.getLocalStorage=i6;var qh={};Object.defineProperty(qh,"__esModule",{value:!0});var f1=qh.getWindowMetadata=void 0;const d1=Qt;function s6(){let t,e;try{t=d1.getDocumentOrThrow(),e=d1.getLocationOrThrow()}catch{return null}function r(){const _=t.getElementsByTagName("link"),E=[];for(let x=0;x<_.length;x++){const I=_[x],k=I.getAttribute("rel");if(k&&k.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 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 x=0;x<E.length;x++){const I=E[x],k=["itemprop","property","name"].map(W=>I.getAttribute(W)).filter(W=>W?_.includes(W):!1);if(k.length&&k){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 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}}f1=qh.getWindowMetadata=s6;var za={},o6=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),p1="%[a-f0-9]{2}",g1=new RegExp("("+p1+")|([^%]+?)","gi"),m1=new RegExp("("+p1+")+","gi");function zh(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([],zh(r),zh(n))}function a6(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(g1)||[],r=1;r<e.length;r++)t=zh(e,r).join(""),e=t.match(g1)||[];return t}}function c6(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=m1.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=a6(r[0]);n!==r[0]&&(e[r[0]]=n)}r=m1.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 l6=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 c6(t)}},u6=(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)]},h6=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=o6,r=l6,n=u6,i=h6,o=B=>B==null,c=Symbol("encodeFragmentIdentifier");function l(B){switch(B.arrayFormat){case"index":return z=>(M,U)=>{const F=M.length;return U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?M:U===null?[...M,[g(z,B),"[",F,"]"].join("")]:[...M,[g(z,B),"[",g(F,B),"]=",g(U,B)].join("")]};case"bracket":return z=>(M,U)=>U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?M:U===null?[...M,[g(z,B),"[]"].join("")]:[...M,[g(z,B),"[]=",g(U,B)].join("")];case"colon-list-separator":return z=>(M,U)=>U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?M:U===null?[...M,[g(z,B),":list="].join("")]:[...M,[g(z,B),":list=",g(U,B)].join("")];case"comma":case"separator":case"bracket-separator":{const z=B.arrayFormat==="bracket-separator"?"[]=":"=";return M=>(U,F)=>F===void 0||B.skipNull&&F===null||B.skipEmptyString&&F===""?U:(F=F===null?"":F,U.length===0?[[g(M,B),z,g(F,B)].join("")]:[[U,g(F,B)].join(B.arrayFormatSeparator)])}default:return z=>(M,U)=>U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?M:U===null?[...M,g(z,B)]:[...M,[g(z,B),"=",g(U,B)].join("")]}}function f(B){let z;switch(B.arrayFormat){case"index":return(M,U,F)=>{if(z=/\[(\d*)\]$/.exec(M),M=M.replace(/\[\d*\]$/,""),!z){F[M]=U;return}F[M]===void 0&&(F[M]={}),F[M][z[1]]=U};case"bracket":return(M,U,F)=>{if(z=/(\[\])$/.exec(M),M=M.replace(/\[\]$/,""),!z){F[M]=U;return}if(F[M]===void 0){F[M]=[U];return}F[M]=[].concat(F[M],U)};case"colon-list-separator":return(M,U,F)=>{if(z=/(:list)$/.exec(M),M=M.replace(/:list$/,""),!z){F[M]=U;return}if(F[M]===void 0){F[M]=[U];return}F[M]=[].concat(F[M],U)};case"comma":case"separator":return(M,U,F)=>{const m=typeof U=="string"&&U.includes(B.arrayFormatSeparator),$=typeof U=="string"&&!m&&_(U,B).includes(B.arrayFormatSeparator);U=$?_(U,B):U;const te=m||$?U.split(B.arrayFormatSeparator).map(ee=>_(ee,B)):U===null?U:_(U,B);F[M]=te};case"bracket-separator":return(M,U,F)=>{const m=/(\[\])$/.test(M);if(M=M.replace(/\[\]$/,""),!m){F[M]=U&&_(U,B);return}const $=U===null?[]:U.split(B.arrayFormatSeparator).map(te=>_(te,B));if(F[M]===void 0){F[M]=$;return}F[M]=[].concat(F[M],$)};default:return(M,U,F)=>{if(F[M]===void 0){F[M]=U;return}F[M]=[].concat(F[M],U)}}}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,M)=>Number(z)-Number(M)).map(z=>B[z]):B}function x(B){const z=B.indexOf("#");return z!==-1&&(B=B.slice(0,z)),B}function I(B){let z="";const M=B.indexOf("#");return M!==-1&&(z=B.slice(M)),z}function k(B){B=x(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 M=f(z),U=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return U;for(const F of B.split("&")){if(F==="")continue;let[m,$]=n(z.decode?F.replace(/\+/g," "):F,"=");$=$===void 0?null:["comma","separator","bracket-separator"].includes(z.arrayFormat)?$:_($,z),M(_(m,z),$,U)}for(const F of Object.keys(U)){const m=U[F];if(typeof m=="object"&&m!==null)for(const $ of Object.keys(m))m[$]=W(m[$],z);else U[F]=W(m,z)}return z.sort===!1?U:(z.sort===!0?Object.keys(U).sort():Object.keys(U).sort(z.sort)).reduce((F,m)=>{const $=U[m];return $&&typeof $=="object"&&!Array.isArray($)?F[m]=E($):F[m]=$,F},Object.create(null))}t.extract=k,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 M=$=>z.skipNull&&o(B[$])||z.skipEmptyString&&B[$]==="",U=l(z),F={};for(const $ of Object.keys(B))M($)||(F[$]=B[$]);const m=Object.keys(F);return z.sort!==!1&&m.sort(z.sort),m.map($=>{const te=B[$];return te===void 0?"":te===null?g($,z):Array.isArray(te)?te.length===0&&z.arrayFormat==="bracket-separator"?g($,z)+"[]":te.reduce(U($),[]).join("&"):g($,z)+"="+g(te,z)}).filter($=>$.length>0).join("&")},t.parseUrl=(B,z)=>{z=Object.assign({decode:!0},z);const[M,U]=n(B,"#");return Object.assign({url:M.split("?")[0]||"",query:Y(k(B),z)},z&&z.parseFragmentIdentifier&&U?{fragmentIdentifier:_(U,z)}:{})},t.stringifyUrl=(B,z)=>{z=Object.assign({encode:!0,strict:!0,[c]:!0},z);const M=x(B.url).split("?")[0]||"",U=t.extract(B.url),F=t.parse(U,{sort:!1}),m=Object.assign(F,B.query);let $=t.stringify(m,z);$&&($=`?${$}`);let te=I(B.url);return B.fragmentIdentifier&&(te=`#${z[c]?g(B.fragmentIdentifier,z):B.fragmentIdentifier}`),`${M}${$}${te}`},t.pick=(B,z,M)=>{M=Object.assign({parseFragmentIdentifier:!0,[c]:!1},M);const{url:U,query:F,fragmentIdentifier:m}=t.parseUrl(B,M);return t.stringifyUrl({url:U,query:i(F,z),fragmentIdentifier:m},M)},t.exclude=(B,z,M)=>{const U=Array.isArray(z)?F=>!z.includes(F):(F,m)=>!z(F,m);return t.pick(B,U,M)}})(za);var Hh={},cl={},ct={},v1={};(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}})(v1),Object.defineProperty(ct,"__esModule",{value:!0});var w1=v1;function f6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}ct.readInt16BE=f6;function d6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}ct.readUint16BE=d6;function p6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}ct.readInt16LE=p6;function g6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}ct.readUint16LE=g6;function y1(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=y1,ct.writeInt16BE=y1;function b1(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=b1,ct.writeInt16LE=b1;function Kh(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}ct.readInt32BE=Kh;function Wh(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=Wh;function Vh(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}ct.readInt32LE=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])>>>0}ct.readUint32LE=Gh;function ll(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=ll,ct.writeInt32BE=ll;function ul(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=ul,ct.writeInt32LE=ul;function m6(t,e){e===void 0&&(e=0);var r=Kh(t,e),n=Kh(t,e+4);return r*4294967296+n-(n>>31)*4294967296}ct.readInt64BE=m6;function v6(t,e){e===void 0&&(e=0);var r=Wh(t,e),n=Wh(t,e+4);return r*4294967296+n}ct.readUint64BE=v6;function w6(t,e){e===void 0&&(e=0);var r=Vh(t,e),n=Vh(t,e+4);return n*4294967296+r-(r>>31)*4294967296}ct.readInt64LE=w6;function y6(t,e){e===void 0&&(e=0);var r=Gh(t,e),n=Gh(t,e+4);return n*4294967296+r}ct.readUint64LE=y6;function _1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ll(t/4294967296>>>0,e,r),ll(t>>>0,e,r+4),e}ct.writeUint64BE=_1,ct.writeInt64BE=_1;function E1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ul(t>>>0,e,r),ul(t/4294967296>>>0,e,r+4),e}ct.writeUint64LE=E1,ct.writeInt64LE=E1;function b6(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=b6;function _6(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=_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("writeUintBE supports only bitLengths divisible by 8");if(!w1.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=E6;function A6(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(!w1.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=A6;function x6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}ct.readFloat32BE=x6;function S6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}ct.readFloat32LE=S6;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 D6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}ct.readFloat64LE=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),e}ct.writeFloat32BE=C6;function O6(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=O6;function M6(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=M6;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 $6(t){for(var e=0;e<t.length;e++)t[e]=0;return t}pn.wipe=$6,Object.defineProperty(cl,"__esModule",{value:!0});var Rr=ct,Yh=pn,T6=20;function N6(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],x=r[27]<<24|r[26]<<16|r[25]<<8|r[24],I=r[31]<<24|r[30]<<16|r[29]<<8|r[28],k=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,M=i,U=o,F=c,m=l,$=f,te=h,ee=g,ne=_,de=E,d=x,p=I,b=k,D=W,O=Y,T=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,M=M+$|0,D^=M,D=D>>>32-16|D<<16,de=de+D|0,$^=de,$=$>>>32-12|$<<12,U=U+te|0,O^=U,O=O>>>32-16|O<<16,d=d+O|0,te^=d,te=te>>>32-12|te<<12,F=F+ee|0,T^=F,T=T>>>32-16|T<<16,p=p+T|0,ee^=p,ee=ee>>>32-12|ee<<12,U=U+te|0,O^=U,O=O>>>32-8|O<<8,d=d+O|0,te^=d,te=te>>>32-7|te<<7,F=F+ee|0,T^=F,T=T>>>32-8|T<<8,p=p+T|0,ee^=p,ee=ee>>>32-7|ee<<7,M=M+$|0,D^=M,D=D>>>32-8|D<<8,de=de+D|0,$^=de,$=$>>>32-7|$<<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+$|0,T^=z,T=T>>>32-16|T<<16,d=d+T|0,$^=d,$=$>>>32-12|$<<12,M=M+te|0,b^=M,b=b>>>32-16|b<<16,p=p+b|0,te^=p,te=te>>>32-12|te<<12,U=U+ee|0,D^=U,D=D>>>32-16|D<<16,ne=ne+D|0,ee^=ne,ee=ee>>>32-12|ee<<12,F=F+m|0,O^=F,O=O>>>32-16|O<<16,de=de+O|0,m^=de,m=m>>>32-12|m<<12,U=U+ee|0,D^=U,D=D>>>32-8|D<<8,ne=ne+D|0,ee^=ne,ee=ee>>>32-7|ee<<7,F=F+m|0,O^=F,O=O>>>32-8|O<<8,de=de+O|0,m^=de,m=m>>>32-7|m<<7,M=M+te|0,b^=M,b=b>>>32-8|b<<8,p=p+b|0,te^=p,te=te>>>32-7|te<<7,z=z+$|0,T^=z,T=T>>>32-8|T<<8,d=d+T|0,$^=d,$=$>>>32-7|$<<7;Rr.writeUint32LE(z+n|0,t,0),Rr.writeUint32LE(M+i|0,t,4),Rr.writeUint32LE(U+o|0,t,8),Rr.writeUint32LE(F+c|0,t,12),Rr.writeUint32LE(m+l|0,t,16),Rr.writeUint32LE($+f|0,t,20),Rr.writeUint32LE(te+h|0,t,24),Rr.writeUint32LE(ee+g|0,t,28),Rr.writeUint32LE(ne+_|0,t,32),Rr.writeUint32LE(de+E|0,t,36),Rr.writeUint32LE(d+x|0,t,40),Rr.writeUint32LE(p+I|0,t,44),Rr.writeUint32LE(b+k|0,t,48),Rr.writeUint32LE(D+W|0,t,52),Rr.writeUint32LE(O+Y|0,t,56),Rr.writeUint32LE(T+B|0,t,60)}function A1(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){N6(l,o,t);for(var h=f;h<f+64&&h<r.length;h++)n[h]=r[h]^l[h-f];L6(o,0,c)}return Yh.wipe(l),i===0&&Yh.wipe(o),n}cl.streamXOR=A1;function R6(t,e,r,n){return n===void 0&&(n=0),Yh.wipe(r),A1(t,e,r,r,n)}cl.stream=R6;function L6(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 x1={},ss={};Object.defineProperty(ss,"__esModule",{value:!0});function B6(t,e,r){return~(t-1)&e|t-1&r}ss.select=B6;function U6(t,e){return(t|0)-(e|0)-1>>>31&1}ss.lessOrEqual=U6;function S1(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}ss.compare=S1;function F6(t,e){return t.length===0||e.length===0?!1:S1(t,e)!==0}ss.equal=F6,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ss,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 x=l[10]|l[11]<<8;this._r[6]=(E>>>14|x<<2)&8191;var I=l[12]|l[13]<<8;this._r[7]=(x>>>11|I<<5)&8065;var k=l[14]|l[15]<<8;this._r[8]=(I>>>8|k<<8)&8191,this._r[9]=k>>>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],x=this._h[2],I=this._h[3],k=this._h[4],W=this._h[5],Y=this._h[6],B=this._h[7],z=this._h[8],M=this._h[9],U=this._r[0],F=this._r[1],m=this._r[2],$=this._r[3],te=this._r[4],ee=this._r[5],ne=this._r[6],de=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;x+=(D>>>10|O<<6)&8191;var T=l[f+6]|l[f+7]<<8;I+=(O>>>7|T<<9)&8191;var L=l[f+8]|l[f+9]<<8;k+=(T>>>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,M+=N>>>5|g;var oe=0,pe=oe;pe+=_*U,pe+=E*(5*p),pe+=x*(5*d),pe+=I*(5*de),pe+=k*(5*ne),oe=pe>>>13,pe&=8191,pe+=W*(5*ee),pe+=Y*(5*te),pe+=B*(5*$),pe+=z*(5*m),pe+=M*(5*F),oe+=pe>>>13,pe&=8191;var A=oe;A+=_*F,A+=E*U,A+=x*(5*p),A+=I*(5*d),A+=k*(5*de),oe=A>>>13,A&=8191,A+=W*(5*ne),A+=Y*(5*ee),A+=B*(5*te),A+=z*(5*$),A+=M*(5*m),oe+=A>>>13,A&=8191;var re=oe;re+=_*m,re+=E*F,re+=x*U,re+=I*(5*p),re+=k*(5*d),oe=re>>>13,re&=8191,re+=W*(5*de),re+=Y*(5*ne),re+=B*(5*ee),re+=z*(5*te),re+=M*(5*$),oe+=re>>>13,re&=8191;var q=oe;q+=_*$,q+=E*m,q+=x*F,q+=I*U,q+=k*(5*p),oe=q>>>13,q&=8191,q+=W*(5*d),q+=Y*(5*de),q+=B*(5*ne),q+=z*(5*ee),q+=M*(5*te),oe+=q>>>13,q&=8191;var H=oe;H+=_*te,H+=E*$,H+=x*m,H+=I*F,H+=k*U,oe=H>>>13,H&=8191,H+=W*(5*p),H+=Y*(5*d),H+=B*(5*de),H+=z*(5*ne),H+=M*(5*ee),oe+=H>>>13,H&=8191;var V=oe;V+=_*ee,V+=E*te,V+=x*$,V+=I*m,V+=k*F,oe=V>>>13,V&=8191,V+=W*U,V+=Y*(5*p),V+=B*(5*d),V+=z*(5*de),V+=M*(5*ne),oe+=V>>>13,V&=8191;var w=oe;w+=_*ne,w+=E*ee,w+=x*te,w+=I*$,w+=k*m,oe=w>>>13,w&=8191,w+=W*F,w+=Y*U,w+=B*(5*p),w+=z*(5*d),w+=M*(5*de),oe+=w>>>13,w&=8191;var j=oe;j+=_*de,j+=E*ne,j+=x*ee,j+=I*te,j+=k*$,oe=j>>>13,j&=8191,j+=W*m,j+=Y*F,j+=B*U,j+=z*(5*p),j+=M*(5*d),oe+=j>>>13,j&=8191;var ie=oe;ie+=_*d,ie+=E*de,ie+=x*ne,ie+=I*ee,ie+=k*te,oe=ie>>>13,ie&=8191,ie+=W*$,ie+=Y*m,ie+=B*F,ie+=z*U,ie+=M*(5*p),oe+=ie>>>13,ie&=8191;var he=oe;he+=_*p,he+=E*d,he+=x*de,he+=I*ne,he+=k*ee,oe=he>>>13,he&=8191,he+=W*te,he+=Y*$,he+=B*m,he+=z*F,he+=M*U,oe+=he>>>13,he&=8191,oe=(oe<<2)+oe|0,oe=oe+pe|0,pe=oe&8191,oe=oe>>>13,A+=oe,_=pe,E=A,x=re,I=q,k=H,W=V,Y=w,B=j,z=ie,M=he,f+=16,h-=16}this._h[0]=_,this._h[1]=E,this._h[2]=x,this._h[3]=I,this._h[4]=k,this._h[5]=W,this._h[6]=Y,this._h[7]=B,this._h[8]=z,this._h[9]=M},c.prototype.finish=function(l,f){f===void 0&&(f=0);var h=new Uint16Array(10),g,_,E,x;if(this._leftover){for(x=this._leftover,this._buffer[x++]=1;x<16;x++)this._buffer[x]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(g=this._h[1]>>>13,this._h[1]&=8191,x=2;x<10;x++)this._h[x]+=g,g=this._h[x]>>>13,this._h[x]&=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,x=1;x<10;x++)h[x]=this._h[x]+g,g=h[x]>>>13,h[x]&=8191;for(h[9]-=8192,_=(g^1)-1,x=0;x<10;x++)h[x]&=_;for(_=~_,x=0;x<10;x++)this._h[x]=this._h[x]&_|h[x];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,x=1;x<8;x++)E=(this._h[x]+this._pad[x]|0)+(E>>>16)|0,this._h[x]=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}(x1),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=cl,r=x1,n=pn,i=ct,o=ss;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 x=new Uint8Array(16);x.set(h,x.length-h.length);var I=new Uint8Array(32);e.stream(this._key,x,I,4);var k=g.length+this.tagLength,W;if(E){if(E.length!==k)throw new Error("ChaCha20Poly1305: incorrect destination length");W=E}else W=new Uint8Array(k);return e.streamXOR(this._key,x,g,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),I,W.subarray(0,W.length-this.tagLength),_),n.wipe(x),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 x=new Uint8Array(16);x.set(h,x.length-h.length);var I=new Uint8Array(32);e.stream(this._key,x,I,4);var k=new Uint8Array(this.tagLength);if(this._authenticate(k,I,g.subarray(0,g.length-this.tagLength),_),!o.equal(k,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,x,g.subarray(0,g.length-this.tagLength),Y,4),n.wipe(x),Y},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,g,_,E){var x=new r.Poly1305(g);E&&(x.update(E),E.length%16>0&&x.update(c.subarray(E.length%16))),x.update(_),_.length%16>0&&x.update(c.subarray(_.length%16));var I=new Uint8Array(8);E&&i.writeUint64LE(E.length,I),x.update(I),i.writeUint64LE(_.length,I),x.update(I);for(var k=x.digest(),W=0;W<k.length;W++)h[W]=k[W];x.clean(),n.wipe(k),n.wipe(I)},f}();t.ChaCha20Poly1305=l}(Hh);var I1={},Ha={},Qh={};Object.defineProperty(Qh,"__esModule",{value:!0});function j6(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Qh.isSerializableHash=j6,Object.defineProperty(Ha,"__esModule",{value:!0});var ai=Qh,k6=ss,q6=pn,D1=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()),q6.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}();Ha.HMAC=D1;function z6(t,e,r){var n=new D1(t,e);n.update(r);var i=n.digest();return n.clean(),i}Ha.hmac=z6,Ha.equal=k6.equal,Object.defineProperty(I1,"__esModule",{value:!0});var C1=Ha,O1=pn,H6=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=C1.hmac(this._hash,n,r);this._hmac=new C1.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(),O1.wipe(this._buffer),O1.wipe(this._counter),this._bufpos=0},t}(),K6=I1.HKDF=H6,Lo={},hl={},fl={};Object.defineProperty(fl,"__esModule",{value:!0}),fl.BrowserRandomSource=void 0;const M1=65536;class W6{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+=M1)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,M1)));return r}}fl.BrowserRandomSource=W6;function V6(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 dl={},G6={},Y6=Object.freeze({__proto__:null,default:G6}),Q6=il(Y6);Object.defineProperty(dl,"__esModule",{value:!0}),dl.NodeRandomSource=void 0;const J6=pn;class Z6{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof V6<"u"){const e=Q6;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}}dl.NodeRandomSource=Z6,Object.defineProperty(hl,"__esModule",{value:!0}),hl.SystemRandomSource=void 0;const X6=fl,e5=dl;class t5{constructor(){if(this.isAvailable=!1,this.name="",this._source=new X6.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new e5.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)}}hl.SystemRandomSource=t5,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=hl,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 x=g.length,I=256-256%x;for(;h>0;){const k=i(Math.ceil(h*256/I),_);for(let W=0;W<k.length&&h>0;W++){const Y=k[W];Y<I&&(E+=g.charAt(Y%x),h--)}(0,n.wipe)(k)}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}(Lo);var pl={};(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,x=h%64<56?64:128;this._buffer[g]=128;for(var I=g+1;I<x-8;I++)this._buffer[I]=0;e.writeUint32BE(_,this._buffer,x-8),e.writeUint32BE(E,this._buffer,x-4),o(this._temp,this._state,this._buffer,0,x),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 o(l,f,h,g,_){for(;_>=64;){for(var E=f[0],x=f[1],I=f[2],k=f[3],W=f[4],Y=f[5],B=f[6],z=f[7],M=0;M<16;M++){var U=g+M*4;l[M]=e.readUint32BE(h,U)}for(var M=16;M<64;M++){var F=l[M-2],m=(F>>>17|F<<32-17)^(F>>>19|F<<32-19)^F>>>10;F=l[M-15];var $=(F>>>7|F<<32-7)^(F>>>18|F<<32-18)^F>>>3;l[M]=(m+l[M-7]|0)+($+l[M-16]|0)}for(var M=0;M<64;M++){var m=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&Y^~W&B)|0)+(z+(i[M]+l[M]|0)|0)|0,$=((E>>>2|E<<32-2)^(E>>>13|E<<32-13)^(E>>>22|E<<32-22))+(E&x^E&I^x&I)|0;z=B,B=Y,Y=W,W=k+m|0,k=I,I=x,x=E,E=m+$|0}f[0]+=E,f[1]+=x,f[2]+=I,f[3]+=k,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})(pl);var Jh={};(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=Lo,r=pn;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(M){const U=new Float64Array(16);if(M)for(let F=0;F<M.length;F++)U[F]=M[F];return U}const i=new Uint8Array(32);i[0]=9;const o=n([56129,1]);function c(M){let U=1;for(let F=0;F<16;F++){let m=M[F]+U+65535;U=Math.floor(m/65536),M[F]=m-U*65536}M[0]+=U-1+37*(U-1)}function l(M,U,F){const m=~(F-1);for(let $=0;$<16;$++){const te=m&(M[$]^U[$]);M[$]^=te,U[$]^=te}}function f(M,U){const F=n(),m=n();for(let $=0;$<16;$++)m[$]=U[$];c(m),c(m),c(m);for(let $=0;$<2;$++){F[0]=m[0]-65517;for(let ee=1;ee<15;ee++)F[ee]=m[ee]-65535-(F[ee-1]>>16&1),F[ee-1]&=65535;F[15]=m[15]-32767-(F[14]>>16&1);const te=F[15]>>16&1;F[14]&=65535,l(m,F,1-te)}for(let $=0;$<16;$++)M[2*$]=m[$]&255,M[2*$+1]=m[$]>>8}function h(M,U){for(let F=0;F<16;F++)M[F]=U[2*F]+(U[2*F+1]<<8);M[15]&=32767}function g(M,U,F){for(let m=0;m<16;m++)M[m]=U[m]+F[m]}function _(M,U,F){for(let m=0;m<16;m++)M[m]=U[m]-F[m]}function E(M,U,F){let m,$,te=0,ee=0,ne=0,de=0,d=0,p=0,b=0,D=0,O=0,T=0,L=0,C=0,v=0,N=0,oe=0,pe=0,A=0,re=0,q=0,H=0,V=0,w=0,j=0,ie=0,he=0,le=0,Oe=0,Pe=0,Ie=0,Mt=0,ze=0,Ce=F[0],Fe=F[1],Ee=F[2],Ae=F[3],Ge=F[4],be=F[5],xe=F[6],Be=F[7],_e=F[8],Me=F[9],je=F[10],$e=F[11],Te=F[12],lt=F[13],Re=F[14],Ne=F[15];m=U[0],te+=m*Ce,ee+=m*Fe,ne+=m*Ee,de+=m*Ae,d+=m*Ge,p+=m*be,b+=m*xe,D+=m*Be,O+=m*_e,T+=m*Me,L+=m*je,C+=m*$e,v+=m*Te,N+=m*lt,oe+=m*Re,pe+=m*Ne,m=U[1],ee+=m*Ce,ne+=m*Fe,de+=m*Ee,d+=m*Ae,p+=m*Ge,b+=m*be,D+=m*xe,O+=m*Be,T+=m*_e,L+=m*Me,C+=m*je,v+=m*$e,N+=m*Te,oe+=m*lt,pe+=m*Re,A+=m*Ne,m=U[2],ne+=m*Ce,de+=m*Fe,d+=m*Ee,p+=m*Ae,b+=m*Ge,D+=m*be,O+=m*xe,T+=m*Be,L+=m*_e,C+=m*Me,v+=m*je,N+=m*$e,oe+=m*Te,pe+=m*lt,A+=m*Re,re+=m*Ne,m=U[3],de+=m*Ce,d+=m*Fe,p+=m*Ee,b+=m*Ae,D+=m*Ge,O+=m*be,T+=m*xe,L+=m*Be,C+=m*_e,v+=m*Me,N+=m*je,oe+=m*$e,pe+=m*Te,A+=m*lt,re+=m*Re,q+=m*Ne,m=U[4],d+=m*Ce,p+=m*Fe,b+=m*Ee,D+=m*Ae,O+=m*Ge,T+=m*be,L+=m*xe,C+=m*Be,v+=m*_e,N+=m*Me,oe+=m*je,pe+=m*$e,A+=m*Te,re+=m*lt,q+=m*Re,H+=m*Ne,m=U[5],p+=m*Ce,b+=m*Fe,D+=m*Ee,O+=m*Ae,T+=m*Ge,L+=m*be,C+=m*xe,v+=m*Be,N+=m*_e,oe+=m*Me,pe+=m*je,A+=m*$e,re+=m*Te,q+=m*lt,H+=m*Re,V+=m*Ne,m=U[6],b+=m*Ce,D+=m*Fe,O+=m*Ee,T+=m*Ae,L+=m*Ge,C+=m*be,v+=m*xe,N+=m*Be,oe+=m*_e,pe+=m*Me,A+=m*je,re+=m*$e,q+=m*Te,H+=m*lt,V+=m*Re,w+=m*Ne,m=U[7],D+=m*Ce,O+=m*Fe,T+=m*Ee,L+=m*Ae,C+=m*Ge,v+=m*be,N+=m*xe,oe+=m*Be,pe+=m*_e,A+=m*Me,re+=m*je,q+=m*$e,H+=m*Te,V+=m*lt,w+=m*Re,j+=m*Ne,m=U[8],O+=m*Ce,T+=m*Fe,L+=m*Ee,C+=m*Ae,v+=m*Ge,N+=m*be,oe+=m*xe,pe+=m*Be,A+=m*_e,re+=m*Me,q+=m*je,H+=m*$e,V+=m*Te,w+=m*lt,j+=m*Re,ie+=m*Ne,m=U[9],T+=m*Ce,L+=m*Fe,C+=m*Ee,v+=m*Ae,N+=m*Ge,oe+=m*be,pe+=m*xe,A+=m*Be,re+=m*_e,q+=m*Me,H+=m*je,V+=m*$e,w+=m*Te,j+=m*lt,ie+=m*Re,he+=m*Ne,m=U[10],L+=m*Ce,C+=m*Fe,v+=m*Ee,N+=m*Ae,oe+=m*Ge,pe+=m*be,A+=m*xe,re+=m*Be,q+=m*_e,H+=m*Me,V+=m*je,w+=m*$e,j+=m*Te,ie+=m*lt,he+=m*Re,le+=m*Ne,m=U[11],C+=m*Ce,v+=m*Fe,N+=m*Ee,oe+=m*Ae,pe+=m*Ge,A+=m*be,re+=m*xe,q+=m*Be,H+=m*_e,V+=m*Me,w+=m*je,j+=m*$e,ie+=m*Te,he+=m*lt,le+=m*Re,Oe+=m*Ne,m=U[12],v+=m*Ce,N+=m*Fe,oe+=m*Ee,pe+=m*Ae,A+=m*Ge,re+=m*be,q+=m*xe,H+=m*Be,V+=m*_e,w+=m*Me,j+=m*je,ie+=m*$e,he+=m*Te,le+=m*lt,Oe+=m*Re,Pe+=m*Ne,m=U[13],N+=m*Ce,oe+=m*Fe,pe+=m*Ee,A+=m*Ae,re+=m*Ge,q+=m*be,H+=m*xe,V+=m*Be,w+=m*_e,j+=m*Me,ie+=m*je,he+=m*$e,le+=m*Te,Oe+=m*lt,Pe+=m*Re,Ie+=m*Ne,m=U[14],oe+=m*Ce,pe+=m*Fe,A+=m*Ee,re+=m*Ae,q+=m*Ge,H+=m*be,V+=m*xe,w+=m*Be,j+=m*_e,ie+=m*Me,he+=m*je,le+=m*$e,Oe+=m*Te,Pe+=m*lt,Ie+=m*Re,Mt+=m*Ne,m=U[15],pe+=m*Ce,A+=m*Fe,re+=m*Ee,q+=m*Ae,H+=m*Ge,V+=m*be,w+=m*xe,j+=m*Be,ie+=m*_e,he+=m*Me,le+=m*je,Oe+=m*$e,Pe+=m*Te,Ie+=m*lt,Mt+=m*Re,ze+=m*Ne,te+=38*A,ee+=38*re,ne+=38*q,de+=38*H,d+=38*V,p+=38*w,b+=38*j,D+=38*ie,O+=38*he,T+=38*le,L+=38*Oe,C+=38*Pe,v+=38*Ie,N+=38*Mt,oe+=38*ze,$=1,m=te+$+65535,$=Math.floor(m/65536),te=m-$*65536,m=ee+$+65535,$=Math.floor(m/65536),ee=m-$*65536,m=ne+$+65535,$=Math.floor(m/65536),ne=m-$*65536,m=de+$+65535,$=Math.floor(m/65536),de=m-$*65536,m=d+$+65535,$=Math.floor(m/65536),d=m-$*65536,m=p+$+65535,$=Math.floor(m/65536),p=m-$*65536,m=b+$+65535,$=Math.floor(m/65536),b=m-$*65536,m=D+$+65535,$=Math.floor(m/65536),D=m-$*65536,m=O+$+65535,$=Math.floor(m/65536),O=m-$*65536,m=T+$+65535,$=Math.floor(m/65536),T=m-$*65536,m=L+$+65535,$=Math.floor(m/65536),L=m-$*65536,m=C+$+65535,$=Math.floor(m/65536),C=m-$*65536,m=v+$+65535,$=Math.floor(m/65536),v=m-$*65536,m=N+$+65535,$=Math.floor(m/65536),N=m-$*65536,m=oe+$+65535,$=Math.floor(m/65536),oe=m-$*65536,m=pe+$+65535,$=Math.floor(m/65536),pe=m-$*65536,te+=$-1+37*($-1),$=1,m=te+$+65535,$=Math.floor(m/65536),te=m-$*65536,m=ee+$+65535,$=Math.floor(m/65536),ee=m-$*65536,m=ne+$+65535,$=Math.floor(m/65536),ne=m-$*65536,m=de+$+65535,$=Math.floor(m/65536),de=m-$*65536,m=d+$+65535,$=Math.floor(m/65536),d=m-$*65536,m=p+$+65535,$=Math.floor(m/65536),p=m-$*65536,m=b+$+65535,$=Math.floor(m/65536),b=m-$*65536,m=D+$+65535,$=Math.floor(m/65536),D=m-$*65536,m=O+$+65535,$=Math.floor(m/65536),O=m-$*65536,m=T+$+65535,$=Math.floor(m/65536),T=m-$*65536,m=L+$+65535,$=Math.floor(m/65536),L=m-$*65536,m=C+$+65535,$=Math.floor(m/65536),C=m-$*65536,m=v+$+65535,$=Math.floor(m/65536),v=m-$*65536,m=N+$+65535,$=Math.floor(m/65536),N=m-$*65536,m=oe+$+65535,$=Math.floor(m/65536),oe=m-$*65536,m=pe+$+65535,$=Math.floor(m/65536),pe=m-$*65536,te+=$-1+37*($-1),M[0]=te,M[1]=ee,M[2]=ne,M[3]=de,M[4]=d,M[5]=p,M[6]=b,M[7]=D,M[8]=O,M[9]=T,M[10]=L,M[11]=C,M[12]=v,M[13]=N,M[14]=oe,M[15]=pe}function x(M,U){E(M,U,U)}function I(M,U){const F=n();for(let m=0;m<16;m++)F[m]=U[m];for(let m=253;m>=0;m--)x(F,F),m!==2&&m!==4&&E(F,F,U);for(let m=0;m<16;m++)M[m]=F[m]}function k(M,U){const F=new Uint8Array(32),m=new Float64Array(80),$=n(),te=n(),ee=n(),ne=n(),de=n(),d=n();for(let O=0;O<31;O++)F[O]=M[O];F[31]=M[31]&127|64,F[0]&=248,h(m,U);for(let O=0;O<16;O++)te[O]=m[O];$[0]=ne[0]=1;for(let O=254;O>=0;--O){const T=F[O>>>3]>>>(O&7)&1;l($,te,T),l(ee,ne,T),g(de,$,ee),_($,$,ee),g(ee,te,ne),_(te,te,ne),x(ne,de),x(d,$),E($,ee,$),E(ee,te,de),g(de,$,ee),_($,$,ee),x(te,$),_(ee,ne,d),E($,ee,o),g($,$,ne),E(ee,ee,$),E($,ne,d),E(ne,te,m),x(te,de),l($,te,T),l(ee,ne,T)}for(let O=0;O<16;O++)m[O+16]=$[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);I(p,p),E(b,b,p);const D=new Uint8Array(32);return f(D,b),D}t.scalarMult=k;function W(M){return k(M,i)}t.scalarMultBase=W;function Y(M){if(M.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const U=new Uint8Array(M);return{publicKey:W(U),secretKey:U}}t.generateKeyPairFromSeed=Y;function B(M){const U=(0,e.randomBytes)(32,M),F=Y(U);return(0,r.wipe)(U),F}t.generateKeyPair=B;function z(M,U,F=!1){if(M.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const m=k(M,U);if(F){let $=0;for(let te=0;te<m.length;te++)$|=m[te];if($===0)throw new Error("X25519: invalid shared key")}return m}t.sharedKey=z})(Jh);function P1(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function $1(t,e){e||(e=t.reduce((i,o)=>i+o.length,0));const r=P1(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function r5(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 _(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 k=0,W=0,Y=0,B=I.length;Y!==B&&I[Y]===0;)Y++,k++;for(var z=(B-Y)*g+1>>>0,M=new Uint8Array(z);Y!==B;){for(var U=I[Y],F=0,m=z-1;(U!==0||F<W)&&m!==-1;m--,F++)U+=256*M[m]>>>0,M[m]=U%l>>>0,U=U/l>>>0;if(U!==0)throw new Error("Non-zero carry");W=F,Y++}for(var $=z-W;$!==z&&M[$]===0;)$++;for(var te=f.repeat(k);$<z;++$)te+=t.charAt(M[$]);return te}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var k=0;if(I[k]!==" "){for(var W=0,Y=0;I[k]===f;)W++,k++;for(var B=(I.length-k)*h+1>>>0,z=new Uint8Array(B);I[k];){var M=r[I.charCodeAt(k)];if(M===255)return;for(var U=0,F=B-1;(M!==0||U<Y)&&F!==-1;F--,U++)M+=l*z[F]>>>0,z[F]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");Y=U,k++}if(I[k]!==" "){for(var m=B-Y;m!==B&&z[m]===0;)m++;for(var $=new Uint8Array(W+(B-m)),te=W;m!==B;)$[te++]=z[m++];return $}}}function x(I){var k=E(I);if(k)return k;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:x}}var n5=r5,i5=n5;const T1=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")},s5=t=>new TextEncoder().encode(t),o5=t=>new TextDecoder().decode(t);class a5{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 c5{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 N1(this,e)}}class l5{constructor(e){this.decoders=e}or(e){return N1(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 N1=(t,e)=>new l5({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class u5{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new a5(e,r,n),this.decoder=new c5(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gl=({name:t,prefix:e,encode:r,decode:n})=>new u5(t,e,r,n),Ka=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=i5(r,e);return gl({prefix:t,name:e,encode:n,decode:o=>T1(i(o))})},h5=(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},f5=(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})=>gl({prefix:e,name:t,encode(i){return f5(i,n,r)},decode(i){return h5(i,n,r,t)}}),d5=gl({prefix:"\0",name:"identity",encode:t=>o5(t),decode:t=>s5(t)});var p5=Object.freeze({__proto__:null,identity:d5});const g5=Cr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var m5=Object.freeze({__proto__:null,base2:g5});const v5=Cr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var w5=Object.freeze({__proto__:null,base8:v5});const y5=Ka({prefix:"9",name:"base10",alphabet:"0123456789"});var b5=Object.freeze({__proto__:null,base10:y5});const _5=Cr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),E5=Cr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var A5=Object.freeze({__proto__:null,base16:_5,base16upper:E5});const x5=Cr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),S5=Cr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),I5=Cr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),D5=Cr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),C5=Cr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),O5=Cr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),M5=Cr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),P5=Cr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$5=Cr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var T5=Object.freeze({__proto__:null,base32:x5,base32upper:S5,base32pad:I5,base32padupper:D5,base32hex:C5,base32hexupper:O5,base32hexpad:M5,base32hexpadupper:P5,base32z:$5});const N5=Ka({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),R5=Ka({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var L5=Object.freeze({__proto__:null,base36:N5,base36upper:R5});const B5=Ka({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),U5=Ka({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var F5=Object.freeze({__proto__:null,base58btc:B5,base58flickr:U5});const j5=Cr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),k5=Cr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),q5=Cr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),z5=Cr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var H5=Object.freeze({__proto__:null,base64:j5,base64pad:k5,base64url:q5,base64urlpad:z5});const R1=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}"),K5=R1.reduce((t,e,r)=>(t[r]=e,t),[]),W5=R1.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function V5(t){return t.reduce((e,r)=>(e+=K5[r],e),"")}function G5(t){const e=[];for(const r of t){const n=W5[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Y5=gl({prefix:"\u{1F680}",name:"base256emoji",encode:V5,decode:G5});var Q5=Object.freeze({__proto__:null,base256emoji:Y5}),J5=B1,L1=128,Z5=127,X5=~Z5,e8=Math.pow(2,31);function B1(t,e,r){e=e||[],r=r||0;for(var n=r;t>=e8;)e[r++]=t&255|L1,t/=128;for(;t&X5;)e[r++]=t&255|L1,t>>>=7;return e[r]=t|0,B1.bytes=r-n+1,e}var t8=Zh,r8=128,U1=127;function Zh(t,n){var r=0,n=n||0,i=0,o=n,c,l=t.length;do{if(o>=l)throw Zh.bytes=0,new RangeError("Could not decode varint");c=t[o++],r+=i<28?(c&U1)<<i:(c&U1)*Math.pow(2,i),i+=7}while(c>=r8);return Zh.bytes=o-n,r}var n8=Math.pow(2,7),i8=Math.pow(2,14),s8=Math.pow(2,21),o8=Math.pow(2,28),a8=Math.pow(2,35),c8=Math.pow(2,42),l8=Math.pow(2,49),u8=Math.pow(2,56),h8=Math.pow(2,63),f8=function(t){return t<n8?1:t<i8?2:t<s8?3:t<o8?4:t<a8?5:t<c8?6:t<l8?7:t<u8?8:t<h8?9:10},d8={encode:J5,decode:t8,encodingLength:f8},F1=d8;const j1=(t,e,r=0)=>(F1.encode(t,e,r),e),k1=t=>F1.encodingLength(t),Xh=(t,e)=>{const r=e.byteLength,n=k1(t),i=n+k1(r),o=new Uint8Array(i+r);return j1(t,o,0),j1(r,o,n),o.set(e,i),new p8(t,r,e,o)};class p8{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const q1=({name:t,code:e,encode:r})=>new g8(t,e,r);class g8{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?Xh(this.code,r):r.then(n=>Xh(this.code,n))}else throw Error("Unknown type, must be binary type")}}const z1=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),m8=q1({name:"sha2-256",code:18,encode:z1("SHA-256")}),v8=q1({name:"sha2-512",code:19,encode:z1("SHA-512")});var w8=Object.freeze({__proto__:null,sha256:m8,sha512:v8});const H1=0,y8="identity",K1=T1;var b8=Object.freeze({__proto__:null,identity:{code:H1,name:y8,encode:K1,digest:t=>Xh(H1,K1(t))}});new TextEncoder,new TextDecoder;const Bo={...p5,...m5,...w5,...b5,...A5,...T5,...L5,...F5,...H5,...Q5};({...w8,...b8});function W1(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const V1=W1("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ef=W1("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=P1(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),G1={utf8:V1,"utf-8":V1,hex:Bo.base16,latin1:ef,ascii:ef,binary:ef,...Bo};function Gn(t,e="utf8"){const r=G1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function Yn(t,e="utf8"){const r=G1[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 _8={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},E8=":";function ml(t){const[e,r]=t.split(E8);return{namespace:e,reference:r}}function Y1(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 Q1(t,e){return t.includes(":")?[t]:e.chains||[]}var A8=Object.defineProperty,J1=Object.getOwnPropertySymbols,x8=Object.prototype.hasOwnProperty,S8=Object.prototype.propertyIsEnumerable,Z1=(t,e,r)=>e in t?A8(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X1=(t,e)=>{for(var r in e||(e={}))x8.call(e,r)&&Z1(t,r,e[r]);if(J1)for(var r of J1(e))S8.call(e,r)&&Z1(t,r,e[r]);return t};const I8="ReactNative",gn={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},D8="js";function Wa(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Uo(){return!jh()&&!!kh()&&navigator.product===I8}function Fo(){return!Wa()&&!!kh()&&!!jh()}function Va(){return Uo()?gn.reactNative:Wa()?gn.node:Fo()?gn.browser:gn.unknown}function C8(){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 O8(t,e){let r=za.parse(t);return r=X1(X1({},r),e),t=za.stringify(r),t}function M8(){return f1()||{name:"",description:"",url:"",icons:[""]}}function P8(){if(Va()===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=m3();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 $8(){var t;const e=Va();return e===gn.browser?[e,((t=h1())==null?void 0:t.host)||"unknown"].join(":"):e}function T8(t,e,r){const n=P8(),i=$8();return[[t,e].join("-"),[D8,r].join("-"),n,i].join("/")}function N8({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:o,useOnCloseEvent:c,bundleId:l}){const f=r.split("?"),h=T8(t,e,n),g={auth:i,ua:h,projectId:o,useOnCloseEvent:c||void 0,origin:l||void 0},_=O8(f[1]||"",g);return f[0]+"?"+_}function ks(t,e){return t.filter(r=>e.includes(r)).length===t.length}function eg(t){return Object.fromEntries(t.entries())}function tg(t){return new Map(Object.entries(t))}function qs(t=ye.FIVE_MINUTES,e){const r=ye.toMiliseconds(t||ye.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 jo(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 rg(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 R8(t){return rg("topic",t)}function L8(t){return rg("id",t)}function ng(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 Or(t,e){return ye.fromMiliseconds((e||Date.now())+ye.toMiliseconds(t))}function os(t){return Date.now()>=ye.toMiliseconds(t)}function wt(t,e){return`${t}${e?`:${e}`:""}`}function vl(t=[],e=[]){return[...new Set([...t,...e])]}async function B8({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=Va();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 U8(t,e){try{return await t.getItem(e)||(Fo()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var ig=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function F8(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 sg={exports:{}};/**
|
|
14
|
+
***************************************************************************** */var Bh=function(e,t){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(e,t)};function q3(e,t){Bh(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Uh=function(){return Uh=Object.assign||function(t){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)&&(t[o]=r[o])}return t},Uh.apply(this,arguments)};function z3(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function H3(e,t,r,n){var i=arguments.length,o=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(o=(i<3?c(o):i>3?c(t,r,o):c(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function K3(e,t){return function(r,n){t(r,n,e)}}function W3(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function V3(e,t,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(e,t||[])).next())})}function G3(e,t){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=t.call(e,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 Y3(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}function Q3(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&(t[r]=e[r])}function Fh(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function n1(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],c;try{for(;(t===void 0||t-- >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 J3(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n1(arguments[t]));return e}function Z3(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],c=0,l=o.length;c<l;c++,i++)n[i]=o[c];return n}function qa(e){return this instanceof qa?(this.v=e,this):new qa(e)}function X3(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),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(x){return new Promise(function(I,F){o.push([E,x,I,F])>1||l(E,x)})})}function l(E,x){try{f(n[E](x))}catch(I){_(o[0][3],I)}}function f(E){E.value instanceof qa?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,x){E(x),o.shift(),o.length&&l(o[0][0],o[0][1])}}function t6(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(c){return(r=!r)?{value:qa(e[i](c)),done:i==="return"}:o?o(c):c}:o}}function e6(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Fh=="function"?Fh(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(c){return new Promise(function(l,f){c=e[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 r6(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function n6(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i6(e){return e&&e.__esModule?e:{default:e}}function s6(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function o6(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}var a6=Object.freeze({__proto__:null,__extends:q3,get __assign(){return Uh},__rest:z3,__decorate:H3,__param:K3,__metadata:W3,__awaiter:V3,__generator:G3,__createBinding:Y3,__exportStar:Q3,__values:Fh,__read:n1,__spread:J3,__spreadArrays:Z3,__await:qa,__asyncGenerator:X3,__asyncDelegator:t6,__asyncValues:e6,__makeTemplateObject:r6,__importStar:n6,__importDefault:i6,__classPrivateFieldGet:s6,__classPrivateFieldSet:o6}),dl=ol(a6),jh={},za={},i1;function c6(){if(i1)return za;i1=1,Object.defineProperty(za,"__esModule",{value:!0}),za.delay=void 0;function e(t){return new Promise(r=>{setTimeout(()=>{r(!0)},t)})}return za.delay=e,za}var Fs={},kh={},js={},s1;function l6(){return s1||(s1=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 qh={},o1;function u6(){return o1||(o1=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=e.ONE_MINUTE*5,e.TEN_MINUTES=e.ONE_MINUTE*10,e.THIRTY_MINUTES=e.ONE_MINUTE*30,e.SIXTY_MINUTES=e.ONE_MINUTE*60,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=e.ONE_HOUR*3,e.SIX_HOURS=e.ONE_HOUR*6,e.TWELVE_HOURS=e.ONE_HOUR*12,e.TWENTY_FOUR_HOURS=e.ONE_HOUR*24,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=e.ONE_DAY*3,e.FIVE_DAYS=e.ONE_DAY*5,e.SEVEN_DAYS=e.ONE_DAY*7,e.THIRTY_DAYS=e.ONE_DAY*30,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=e.ONE_WEEK*2,e.THREE_WEEKS=e.ONE_WEEK*3,e.FOUR_WEEKS=e.ONE_WEEK*4,e.ONE_YEAR=e.ONE_DAY*365}(qh)),qh}var a1;function c1(){return a1||(a1=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=dl;t.__exportStar(l6(),e),t.__exportStar(u6(),e)}(kh)),kh}var l1;function h6(){if(l1)return Fs;l1=1,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.fromMiliseconds=Fs.toMiliseconds=void 0;const e=c1();function t(n){return n*e.ONE_THOUSAND}Fs.toMiliseconds=t;function r(n){return Math.floor(n/e.ONE_THOUSAND)}return Fs.fromMiliseconds=r,Fs}var u1;function f6(){return u1||(u1=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=dl;t.__exportStar(c6(),e),t.__exportStar(h6(),e)}(jh)),jh}var To={},h1;function d6(){if(h1)return To;h1=1,Object.defineProperty(To,"__esModule",{value:!0}),To.Watch=void 0;class e{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 To.Watch=e,To.default=e,To}var zh={},Ha={},f1;function p6(){if(f1)return Ha;f1=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.IWatch=void 0;class e{}return Ha.IWatch=e,Ha}var d1;function g6(){return d1||(d1=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),dl.__exportStar(p6(),e)}(zh)),zh}(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=dl;t.__exportStar(f6(),e),t.__exportStar(d6(),e),t.__exportStar(g6(),e),t.__exportStar(c1(),e)})(yt);class ks{}class m6 extends ks{constructor(t){super()}}const p1=yt.FIVE_SECONDS,Ka={pulse:"heartbeat_pulse"};class Hh extends m6{constructor(t){super(t),this.events=new Cr.exports.EventEmitter,this.interval=p1,this.interval=t?.interval||p1}static async init(t){const r=new Hh(t);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),yt.toMiliseconds(this.interval))}pulse(){this.events.emit(Ka.pulse)}}function v6(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var w6=y6;function y6(e,t,r){var n=r&&r.stringify||v6,i=1;if(typeof e=="object"&&e!==null){var o=t.length+i;if(o===1)return e;var c=new Array(o);c[0]=n(e);for(var l=1;l<o;l++)c[l]=n(t[l]);return c.join(" ")}if(typeof e!="string")return e;var f=t.length;if(f===0)return e;for(var h="",g=1-i,_=-1,E=e&&e.length||0,x=0;x<E;){if(e.charCodeAt(x)===37&&x+1<E){switch(_=_>-1?_:0,e.charCodeAt(x+1)){case 100:case 102:if(g>=f||t[g]==null)break;_<x&&(h+=e.slice(_,x)),h+=Number(t[g]),_=x+2,x++;break;case 105:if(g>=f||t[g]==null)break;_<x&&(h+=e.slice(_,x)),h+=Math.floor(Number(t[g])),_=x+2,x++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;_<x&&(h+=e.slice(_,x));var I=typeof t[g];if(I==="string"){h+="'"+t[g]+"'",_=x+2,x++;break}if(I==="function"){h+=t[g].name||"<anonymous>",_=x+2,x++;break}h+=n(t[g]),_=x+2,x++;break;case 115:if(g>=f)break;_<x&&(h+=e.slice(_,x)),h+=String(t[g]),_=x+2,x++;break;case 37:_<x&&(h+=e.slice(_,x)),h+="%",_=x+2,x++,g--;break}++g}++x}return _===-1?e:(_<E&&(h+=e.slice(_)),h)}const g1=w6;var ai=ci;const Wa=O6().console||{},b6={mapHttpRequest:gl,mapHttpResponse:gl,wrapRequestSerializer:Wh,wrapResponseSerializer:Wh,wrapErrorSerializer:Wh,req:gl,res:gl,err:I6};function _6(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function ci(e){e=e||{},e.browser=e.browser||{};const t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||Wa;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},i=_6(e.browser.serialize,n);let o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.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),e.enabled===!1&&(e.level="silent");const l=e.level||"info",f=Object.create(r);f.log||(f.log=Va),Object.defineProperty(f,"levelVal",{get:g}),Object.defineProperty(f,"level",{get:_,set:E});const h={transmit:t,serialize:i,asObject:e.browser.asObject,levels:c,timestamp:S6(e)};f.levels=ci.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=Va,f.serializers=n,f._serialize=i,f._stdErrSerialize=o,f.child=x,t&&(f._logEvent=Kh());function g(){return this.level==="silent"?1/0:this.levels.values[this.level]}function _(){return this._level}function E(I){if(I!=="silent"&&!this.levels.values[I])throw Error("unknown level "+I);this._level=I,Ro(h,f,"error","log"),Ro(h,f,"fatal","error"),Ro(h,f,"warn","error"),Ro(h,f,"info","log"),Ro(h,f,"debug","log"),Ro(h,f,"trace","log")}function x(I,F){if(!I)throw new Error("missing bindings for child Pino");F=F||{},i&&I.serializers&&(F.serializers=I.serializers);const W=F.serializers;if(i&&W){var Y=Object.assign({},n,W),B=e.browser.serialize===!0?Object.keys(Y):i;delete I.serializers,pl([I],B,Y,this._stdErrSerialize)}function z(P){this._childLevel=(P._childLevel|0)+1,this.error=Lo(P,I,"error"),this.fatal=Lo(P,I,"fatal"),this.warn=Lo(P,I,"warn"),this.info=Lo(P,I,"info"),this.debug=Lo(P,I,"debug"),this.trace=Lo(P,I,"trace"),Y&&(this.serializers=Y,this._serialize=B),t&&(this._logEvent=Kh([].concat(P._logEvent.bindings,I)))}return z.prototype=this,new z(this)}return f}ci.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"}},ci.stdSerializers=b6,ci.stdTimeFunctions=Object.assign({},{nullTime:m1,epochTime:v1,unixTime:C6,isoTime:D6});function Ro(e,t,r,n){const i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?Va:i[r]?i[r]:Wa[r]||Wa[n]||Va,E6(e,t,r)}function E6(e,t,r){!e.transmit&&t[r]===Va||(t[r]=function(n){return function(){const o=e.timestamp(),c=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Wa?Wa:this;for(var f=0;f<c.length;f++)c[f]=arguments[f];if(e.serialize&&!e.asObject&&pl(c,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(l,A6(this,r,c,o)):n.apply(l,c),e.transmit){const h=e.transmit.level||t.level,g=ci.levels.values[h],_=ci.levels.values[r];if(_<g)return;x6(this,{ts:o,methodLevel:r,methodValue:_,transmitLevel:h,transmitValue:ci.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},c)}}}(t[r]))}function A6(e,t,r,n){e._serialize&&pl(r,e._serialize,e.serializers,e._stdErrSerialize);const i=r.slice();let o=i[0];const c={};n&&(c.time=n),c.level=ci.levels.values[t];let l=(e._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?g1(i.shift(),i):void 0}else typeof o=="string"&&(o=g1(i.shift(),i));return o!==void 0&&(c.msg=o),c}function pl(e,t,r,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=ci.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i]))for(const o in e[i])t&&t.indexOf(o)>-1&&o in r&&(e[i][o]=r[o](e[i][o]))}function Lo(e,t,r){return function(){const n=new Array(1+arguments.length);n[0]=t;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return e[r].apply(this,n)}}function x6(e,t,r){const n=t.send,i=t.ts,o=t.methodLevel,c=t.methodValue,l=t.val,f=e._logEvent.bindings;pl(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(h){return f.indexOf(h)===-1}),e._logEvent.level.label=o,e._logEvent.level.value=c,n(o,e._logEvent,l),e._logEvent=Kh(f)}function Kh(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function I6(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)t[r]===void 0&&(t[r]=e[r]);return t}function S6(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?m1:v1}function gl(){return{}}function Wh(e){return e}function Va(){}function m1(){return!1}function v1(){return Date.now()}function C6(){return Math.round(Date.now()/1e3)}function D6(){return new Date(Date.now()).toISOString()}function O6(){function e(t){return typeof t<"u"&&t}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 e(self)||e(window)||e(this)||{}}}const P6={level:"info"},Ga="custom_context",Vh=1e3*1024;class M6{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class w1{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const r=new M6(t);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} 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 t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let r=this.head;for(;r!==null;)t.push(r.value),r=r.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const r=t.value;return t=t.next,{done:!1,value:r}}}}}class y1{constructor(t,r=Vh){this.level=t??"error",this.levelValue=ai.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new w1(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,r){r===ai.levels.values.error?console.error(t):r===ai.levels.values.warn?console.warn(t):r===ai.levels.values.debug?console.debug(t):r===ai.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Ui({timestamp:new Date().toISOString(),log:t}));const r=typeof t=="string"?JSON.parse(t).level:t.level;r>=this.levelValue&&this.forwardToConsole(t,r)}getLogs(){return this.logs}clearLogs(){this.logs=new w1(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const r=this.getLogArray();return r.push(Ui({extraMetadata:t})),new Blob(r,{type:"application/json"})}}class $6{constructor(t,r=Vh){this.baseChunkLogger=new y1(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const r=URL.createObjectURL(this.logsToBlob(t)),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 N6{constructor(t,r=Vh){this.baseChunkLogger=new y1(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}}var T6=Object.defineProperty,R6=Object.defineProperties,L6=Object.getOwnPropertyDescriptors,b1=Object.getOwnPropertySymbols,B6=Object.prototype.hasOwnProperty,U6=Object.prototype.propertyIsEnumerable,_1=(e,t,r)=>t in e?T6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ml=(e,t)=>{for(var r in t||(t={}))B6.call(t,r)&&_1(e,r,t[r]);if(b1)for(var r of b1(t))U6.call(t,r)&&_1(e,r,t[r]);return e},vl=(e,t)=>R6(e,L6(t));function wl(e){return vl(ml({},e),{level:e?.level||P6.level})}function F6(e,t=Ga){return e[t]||""}function j6(e,t,r=Ga){return e[r]=t,e}function tn(e,t=Ga){let r="";return typeof e.bindings>"u"?r=F6(e,t):r=e.bindings().context||"",r}function k6(e,t,r=Ga){const n=tn(e,r);return n.trim()?`${n}/${t}`:t}function en(e,t,r=Ga){const n=k6(e,t,r),i=e.child({context:n});return j6(i,n,r)}function q6(e){var t,r;const n=new $6((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:ai(vl(ml({},e.opts),{level:"trace",browser:vl(ml({},(r=e.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function z6(e){var t;const r=new N6((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:ai(vl(ml({},e.opts),{level:"trace"})),chunkLoggerController:r}}function H6(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?q6(e):z6(e)}class K6 extends ks{constructor(t){super(),this.opts=t,this.protocol="wc",this.version=2}}class W6 extends ks{constructor(t,r){super(),this.core=t,this.logger=r,this.records=new Map}}class V6{constructor(t,r){this.logger=t,this.core=r}}class G6 extends ks{constructor(t,r){super(),this.relayer=t,this.logger=r}}class Y6 extends ks{constructor(t){super()}}class Q6{constructor(t,r,n,i){this.core=t,this.logger=r,this.name=n}}class J6 extends ks{constructor(t,r){super(),this.relayer=t,this.logger=r}}class Z6 extends ks{constructor(t,r){super(),this.core=t,this.logger=r}}class X6{constructor(t,r){this.projectId=t,this.logger=r}}class t5{constructor(t,r){this.projectId=t,this.logger=r}}class e5{constructor(t){this.opts=t,this.protocol="wc",this.version=2}}class r5{constructor(t){this.client=t}}var Gh={},Bo={},yl={},bl={};Object.defineProperty(bl,"__esModule",{value:!0}),bl.BrowserRandomSource=void 0;const E1=65536;class n5{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t=typeof self<"u"?self.crypto||self.msCrypto:null;t&&t.getRandomValues!==void 0&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(t);for(let n=0;n<r.length;n+=E1)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,E1)));return r}}bl.BrowserRandomSource=n5;function i5(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _l={},pn={};Object.defineProperty(pn,"__esModule",{value:!0});function s5(e){for(var t=0;t<e.length;t++)e[t]=0;return e}pn.wipe=s5;var o5={},a5=Object.freeze({__proto__:null,default:o5}),c5=ol(a5);Object.defineProperty(_l,"__esModule",{value:!0}),_l.NodeRandomSource=void 0;const l5=pn;class u5{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof i5<"u"){const t=c5;t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(t);if(r.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(t);for(let i=0;i<n.length;i++)n[i]=r[i];return(0,l5.wipe)(r),n}}_l.NodeRandomSource=u5,Object.defineProperty(yl,"__esModule",{value:!0}),yl.SystemRandomSource=void 0;const h5=bl,f5=_l;class d5{constructor(){if(this.isAvailable=!1,this.name="",this._source=new h5.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new f5.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}yl.SystemRandomSource=d5;var ce={},A1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(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}e.mul=Math.imul||t;function r(l,f){return l+f|0}e.add=r;function n(l,f){return l-f|0}e.sub=n;function i(l,f){return l<<f|l>>>32-f}e.rotl=i;function o(l,f){return l<<32-f|l>>>f}e.rotr=o;function c(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}e.isInteger=Number.isInteger||c,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(l){return e.isInteger(l)&&l>=-e.MAX_SAFE_INTEGER&&l<=e.MAX_SAFE_INTEGER}})(A1),Object.defineProperty(ce,"__esModule",{value:!0});var x1=A1;function p5(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}ce.readInt16BE=p5;function g5(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])>>>0}ce.readUint16BE=g5;function m5(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])<<16>>16}ce.readInt16LE=m5;function v5(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])>>>0}ce.readUint16LE=v5;function I1(e,t,r){return t===void 0&&(t=new Uint8Array(2)),r===void 0&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}ce.writeUint16BE=I1,ce.writeInt16BE=I1;function S1(e,t,r){return t===void 0&&(t=new Uint8Array(2)),r===void 0&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}ce.writeUint16LE=S1,ce.writeInt16LE=S1;function Yh(e,t){return t===void 0&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}ce.readInt32BE=Yh;function Qh(e,t){return t===void 0&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}ce.readUint32BE=Qh;function Jh(e,t){return t===void 0&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}ce.readInt32LE=Jh;function Zh(e,t){return t===void 0&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}ce.readUint32LE=Zh;function El(e,t,r){return t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}ce.writeUint32BE=El,ce.writeInt32BE=El;function Al(e,t,r){return t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}ce.writeUint32LE=Al,ce.writeInt32LE=Al;function w5(e,t){t===void 0&&(t=0);var r=Yh(e,t),n=Yh(e,t+4);return r*4294967296+n-(n>>31)*4294967296}ce.readInt64BE=w5;function y5(e,t){t===void 0&&(t=0);var r=Qh(e,t),n=Qh(e,t+4);return r*4294967296+n}ce.readUint64BE=y5;function b5(e,t){t===void 0&&(t=0);var r=Jh(e,t),n=Jh(e,t+4);return n*4294967296+r-(r>>31)*4294967296}ce.readInt64LE=b5;function _5(e,t){t===void 0&&(t=0);var r=Zh(e,t),n=Zh(e,t+4);return n*4294967296+r}ce.readUint64LE=_5;function C1(e,t,r){return t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0),El(e/4294967296>>>0,t,r),El(e>>>0,t,r+4),t}ce.writeUint64BE=C1,ce.writeInt64BE=C1;function D1(e,t,r){return t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0),Al(e>>>0,t,r),Al(e/4294967296>>>0,t,r+4),t}ce.writeUint64LE=D1,ce.writeInt64LE=D1;function E5(e,t,r){if(r===void 0&&(r=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n}ce.readUintBE=E5;function A5(e,t,r){if(r===void 0&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o<r+e/8;o++)n+=t[o]*i,i*=256;return n}ce.readUintLE=A5;function x5(e,t,r,n){if(r===void 0&&(r=new Uint8Array(e/8)),n===void 0&&(n=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!x1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var i=1,o=e/8+n-1;o>=n;o--)r[o]=t/i&255,i*=256;return r}ce.writeUintBE=x5;function I5(e,t,r,n){if(r===void 0&&(r=new Uint8Array(e/8)),n===void 0&&(n=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!x1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,o=n;o<n+e/8;o++)r[o]=t/i&255,i*=256;return r}ce.writeUintLE=I5;function S5(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat32(t)}ce.readFloat32BE=S5;function C5(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat32(t,!0)}ce.readFloat32LE=C5;function D5(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat64(t)}ce.readFloat64BE=D5;function O5(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat64(t,!0)}ce.readFloat64LE=O5;function P5(e,t,r){t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(r,e),t}ce.writeFloat32BE=P5;function M5(e,t,r){t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(r,e,!0),t}ce.writeFloat32LE=M5;function $5(e,t,r){t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(r,e),t}ce.writeFloat64BE=$5;function N5(e,t,r){t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(r,e,!0),t}ce.writeFloat64LE=N5,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=yl,r=ce,n=pn;e.defaultRandomSource=new t.SystemRandomSource;function i(h,g=e.defaultRandomSource){return g.randomBytes(h)}e.randomBytes=i;function o(h=e.defaultRandomSource){const g=i(4,h),_=(0,r.readUint32LE)(g);return(0,n.wipe)(g),_}e.randomUint32=o;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(h,g=c,_=e.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 x=g.length,I=256-256%x;for(;h>0;){const F=i(Math.ceil(h*256/I),_);for(let W=0;W<F.length&&h>0;W++){const Y=F[W];Y<I&&(E+=g.charAt(Y%x),h--)}(0,n.wipe)(F)}return E}e.randomString=l;function f(h,g=c,_=e.defaultRandomSource){const E=Math.ceil(h/(Math.log(g.length)/Math.LN2));return l(E,g,_)}e.randomStringForEntropy=f}(Bo);var O1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ce,r=pn;e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var n=function(){function l(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.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<e.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,x=h%128<112?128:256;this._buffer[g]=128;for(var I=g+1;I<x-8;I++)this._buffer[I]=0;t.writeUint32BE(_,this._buffer,x-8),t.writeUint32BE(E,this._buffer,x-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,x),this._finished=!0}for(var I=0;I<this.digestLength/8;I++)t.writeUint32BE(this._stateHi[I],f,I*8),t.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}();e.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,x){for(var I=h[0],F=h[1],W=h[2],Y=h[3],B=h[4],z=h[5],P=h[6],U=h[7],j=g[0],m=g[1],$=g[2],et=g[3],tt=g[4],nt=g[5],dt=g[6],d=g[7],p,b,C,O,N,L,D,v;x>=128;){for(var T=0;T<16;T++){var ot=8*T+E;l[T]=t.readUint32BE(_,ot),f[T]=t.readUint32BE(_,ot+4)}for(var T=0;T<80;T++){var pt=I,A=F,rt=W,q=Y,H=B,V=z,w=P,k=U,it=j,ht=m,lt=$,Ot=et,Mt=tt,St=nt,Pe=dt,zt=d;if(p=U,b=d,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=(B>>>14|tt<<32-14)^(B>>>18|tt<<32-18)^(tt>>>41-32|B<<32-(41-32)),b=(tt>>>14|B<<32-14)^(tt>>>18|B<<32-18)^(B>>>41-32|tt<<32-(41-32)),N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,p=B&z^~B&P,b=tt&nt^~tt&dt,N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,p=i[T*2],b=i[T*2+1],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,p=l[T%16],b=f[T%16],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,C=D&65535|v<<16,O=N&65535|L<<16,p=C,b=O,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=(I>>>28|j<<32-28)^(j>>>34-32|I<<32-(34-32))^(j>>>39-32|I<<32-(39-32)),b=(j>>>28|I<<32-28)^(I>>>34-32|j<<32-(34-32))^(I>>>39-32|j<<32-(39-32)),N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,p=I&F^I&W^F&W,b=j&m^j&$^m&$,N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,k=D&65535|v<<16,zt=N&65535|L<<16,p=q,b=Ot,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=C,b=O,N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,q=D&65535|v<<16,Ot=N&65535|L<<16,F=pt,W=A,Y=rt,B=q,z=H,P=V,U=w,I=k,m=it,$=ht,et=lt,tt=Ot,nt=Mt,dt=St,d=Pe,j=zt,T%16===15)for(var ot=0;ot<16;ot++)p=l[ot],b=f[ot],N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=l[(ot+9)%16],b=f[(ot+9)%16],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,C=l[(ot+1)%16],O=f[(ot+1)%16],p=(C>>>1|O<<32-1)^(C>>>8|O<<32-8)^C>>>7,b=(O>>>1|C<<32-1)^(O>>>8|C<<32-8)^(O>>>7|C<<32-7),N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,C=l[(ot+14)%16],O=f[(ot+14)%16],p=(C>>>19|O<<32-19)^(O>>>61-32|C<<32-(61-32))^C>>>6,b=(O>>>19|C<<32-19)^(C>>>61-32|O<<32-(61-32))^(O>>>6|C<<32-6),N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,l[ot]=D&65535|v<<16,f[ot]=N&65535|L<<16}p=I,b=j,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[0],b=g[0],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[0]=I=D&65535|v<<16,g[0]=j=N&65535|L<<16,p=F,b=m,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[1],b=g[1],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[1]=F=D&65535|v<<16,g[1]=m=N&65535|L<<16,p=W,b=$,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[2],b=g[2],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[2]=W=D&65535|v<<16,g[2]=$=N&65535|L<<16,p=Y,b=et,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[3],b=g[3],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[3]=Y=D&65535|v<<16,g[3]=et=N&65535|L<<16,p=B,b=tt,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[4],b=g[4],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[4]=B=D&65535|v<<16,g[4]=tt=N&65535|L<<16,p=z,b=nt,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[5],b=g[5],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[5]=z=D&65535|v<<16,g[5]=nt=N&65535|L<<16,p=P,b=dt,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[6],b=g[6],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[6]=P=D&65535|v<<16,g[6]=dt=N&65535|L<<16,p=U,b=d,N=b&65535,L=b>>>16,D=p&65535,v=p>>>16,p=h[7],b=g[7],N+=b&65535,L+=b>>>16,D+=p&65535,v+=p>>>16,L+=N>>>16,D+=L>>>16,v+=D>>>16,h[7]=U=D&65535|v<<16,g[7]=d=N&65535|L<<16,E+=128,x-=128}return E}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}e.hash=c})(O1),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.convertSecretKeyToX25519=e.convertPublicKeyToX25519=e.verify=e.sign=e.extractPublicKeyFromSecretKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.SEED_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=e.SIGNATURE_LENGTH=void 0;const t=Bo,r=O1,n=pn;e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.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 x(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 w=q[V]+H+65535;H=Math.floor(w/65536),q[V]=w-H*65536}q[0]+=H-1+37*(H-1)}function F(q,H,V){const w=~(V-1);for(let k=0;k<16;k++){const it=w&(q[k]^H[k]);q[k]^=it,H[k]^=it}}function W(q,H){const V=i(),w=i();for(let k=0;k<16;k++)w[k]=H[k];I(w),I(w),I(w);for(let k=0;k<2;k++){V[0]=w[0]-65517;for(let ht=1;ht<15;ht++)V[ht]=w[ht]-65535-(V[ht-1]>>16&1),V[ht-1]&=65535;V[15]=w[15]-32767-(V[14]>>16&1);const it=V[15]>>16&1;V[14]&=65535,F(w,V,1-it)}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 U(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,it=0,ht=0,lt=0,Ot=0,Mt=0,St=0,Pe=0,zt=0,Dt=0,Ft=0,Et=0,At=0,Gt=0,bt=0,xt=0,Bt=0,_t=0,Pt=0,jt=0,$t=0,Nt=0,le=0,Rt=0,Tt=0,nr=0,de=0,Ee=0,ir=0,Ie=0,Oe=0,Vr=0,Yt=V[0],Ht=V[1],Re=V[2],Qt=V[3],Vt=V[4],Me=V[5],Xt=V[6],te=V[7],Le=V[8],ee=V[9],Jt=V[10],Fe=V[11],Zt=V[12],kt=V[13],He=V[14],re=V[15];w=H[0],it+=w*Yt,ht+=w*Ht,lt+=w*Re,Ot+=w*Qt,Mt+=w*Vt,St+=w*Me,Pe+=w*Xt,zt+=w*te,Dt+=w*Le,Ft+=w*ee,Et+=w*Jt,At+=w*Fe,Gt+=w*Zt,bt+=w*kt,xt+=w*He,Bt+=w*re,w=H[1],ht+=w*Yt,lt+=w*Ht,Ot+=w*Re,Mt+=w*Qt,St+=w*Vt,Pe+=w*Me,zt+=w*Xt,Dt+=w*te,Ft+=w*Le,Et+=w*ee,At+=w*Jt,Gt+=w*Fe,bt+=w*Zt,xt+=w*kt,Bt+=w*He,_t+=w*re,w=H[2],lt+=w*Yt,Ot+=w*Ht,Mt+=w*Re,St+=w*Qt,Pe+=w*Vt,zt+=w*Me,Dt+=w*Xt,Ft+=w*te,Et+=w*Le,At+=w*ee,Gt+=w*Jt,bt+=w*Fe,xt+=w*Zt,Bt+=w*kt,_t+=w*He,Pt+=w*re,w=H[3],Ot+=w*Yt,Mt+=w*Ht,St+=w*Re,Pe+=w*Qt,zt+=w*Vt,Dt+=w*Me,Ft+=w*Xt,Et+=w*te,At+=w*Le,Gt+=w*ee,bt+=w*Jt,xt+=w*Fe,Bt+=w*Zt,_t+=w*kt,Pt+=w*He,jt+=w*re,w=H[4],Mt+=w*Yt,St+=w*Ht,Pe+=w*Re,zt+=w*Qt,Dt+=w*Vt,Ft+=w*Me,Et+=w*Xt,At+=w*te,Gt+=w*Le,bt+=w*ee,xt+=w*Jt,Bt+=w*Fe,_t+=w*Zt,Pt+=w*kt,jt+=w*He,$t+=w*re,w=H[5],St+=w*Yt,Pe+=w*Ht,zt+=w*Re,Dt+=w*Qt,Ft+=w*Vt,Et+=w*Me,At+=w*Xt,Gt+=w*te,bt+=w*Le,xt+=w*ee,Bt+=w*Jt,_t+=w*Fe,Pt+=w*Zt,jt+=w*kt,$t+=w*He,Nt+=w*re,w=H[6],Pe+=w*Yt,zt+=w*Ht,Dt+=w*Re,Ft+=w*Qt,Et+=w*Vt,At+=w*Me,Gt+=w*Xt,bt+=w*te,xt+=w*Le,Bt+=w*ee,_t+=w*Jt,Pt+=w*Fe,jt+=w*Zt,$t+=w*kt,Nt+=w*He,le+=w*re,w=H[7],zt+=w*Yt,Dt+=w*Ht,Ft+=w*Re,Et+=w*Qt,At+=w*Vt,Gt+=w*Me,bt+=w*Xt,xt+=w*te,Bt+=w*Le,_t+=w*ee,Pt+=w*Jt,jt+=w*Fe,$t+=w*Zt,Nt+=w*kt,le+=w*He,Rt+=w*re,w=H[8],Dt+=w*Yt,Ft+=w*Ht,Et+=w*Re,At+=w*Qt,Gt+=w*Vt,bt+=w*Me,xt+=w*Xt,Bt+=w*te,_t+=w*Le,Pt+=w*ee,jt+=w*Jt,$t+=w*Fe,Nt+=w*Zt,le+=w*kt,Rt+=w*He,Tt+=w*re,w=H[9],Ft+=w*Yt,Et+=w*Ht,At+=w*Re,Gt+=w*Qt,bt+=w*Vt,xt+=w*Me,Bt+=w*Xt,_t+=w*te,Pt+=w*Le,jt+=w*ee,$t+=w*Jt,Nt+=w*Fe,le+=w*Zt,Rt+=w*kt,Tt+=w*He,nr+=w*re,w=H[10],Et+=w*Yt,At+=w*Ht,Gt+=w*Re,bt+=w*Qt,xt+=w*Vt,Bt+=w*Me,_t+=w*Xt,Pt+=w*te,jt+=w*Le,$t+=w*ee,Nt+=w*Jt,le+=w*Fe,Rt+=w*Zt,Tt+=w*kt,nr+=w*He,de+=w*re,w=H[11],At+=w*Yt,Gt+=w*Ht,bt+=w*Re,xt+=w*Qt,Bt+=w*Vt,_t+=w*Me,Pt+=w*Xt,jt+=w*te,$t+=w*Le,Nt+=w*ee,le+=w*Jt,Rt+=w*Fe,Tt+=w*Zt,nr+=w*kt,de+=w*He,Ee+=w*re,w=H[12],Gt+=w*Yt,bt+=w*Ht,xt+=w*Re,Bt+=w*Qt,_t+=w*Vt,Pt+=w*Me,jt+=w*Xt,$t+=w*te,Nt+=w*Le,le+=w*ee,Rt+=w*Jt,Tt+=w*Fe,nr+=w*Zt,de+=w*kt,Ee+=w*He,ir+=w*re,w=H[13],bt+=w*Yt,xt+=w*Ht,Bt+=w*Re,_t+=w*Qt,Pt+=w*Vt,jt+=w*Me,$t+=w*Xt,Nt+=w*te,le+=w*Le,Rt+=w*ee,Tt+=w*Jt,nr+=w*Fe,de+=w*Zt,Ee+=w*kt,ir+=w*He,Ie+=w*re,w=H[14],xt+=w*Yt,Bt+=w*Ht,_t+=w*Re,Pt+=w*Qt,jt+=w*Vt,$t+=w*Me,Nt+=w*Xt,le+=w*te,Rt+=w*Le,Tt+=w*ee,nr+=w*Jt,de+=w*Fe,Ee+=w*Zt,ir+=w*kt,Ie+=w*He,Oe+=w*re,w=H[15],Bt+=w*Yt,_t+=w*Ht,Pt+=w*Re,jt+=w*Qt,$t+=w*Vt,Nt+=w*Me,le+=w*Xt,Rt+=w*te,Tt+=w*Le,nr+=w*ee,de+=w*Jt,Ee+=w*Fe,ir+=w*Zt,Ie+=w*kt,Oe+=w*He,Vr+=w*re,it+=38*_t,ht+=38*Pt,lt+=38*jt,Ot+=38*$t,Mt+=38*Nt,St+=38*le,Pe+=38*Rt,zt+=38*Tt,Dt+=38*nr,Ft+=38*de,Et+=38*Ee,At+=38*ir,Gt+=38*Ie,bt+=38*Oe,xt+=38*Vr,k=1,w=it+k+65535,k=Math.floor(w/65536),it=w-k*65536,w=ht+k+65535,k=Math.floor(w/65536),ht=w-k*65536,w=lt+k+65535,k=Math.floor(w/65536),lt=w-k*65536,w=Ot+k+65535,k=Math.floor(w/65536),Ot=w-k*65536,w=Mt+k+65535,k=Math.floor(w/65536),Mt=w-k*65536,w=St+k+65535,k=Math.floor(w/65536),St=w-k*65536,w=Pe+k+65535,k=Math.floor(w/65536),Pe=w-k*65536,w=zt+k+65535,k=Math.floor(w/65536),zt=w-k*65536,w=Dt+k+65535,k=Math.floor(w/65536),Dt=w-k*65536,w=Ft+k+65535,k=Math.floor(w/65536),Ft=w-k*65536,w=Et+k+65535,k=Math.floor(w/65536),Et=w-k*65536,w=At+k+65535,k=Math.floor(w/65536),At=w-k*65536,w=Gt+k+65535,k=Math.floor(w/65536),Gt=w-k*65536,w=bt+k+65535,k=Math.floor(w/65536),bt=w-k*65536,w=xt+k+65535,k=Math.floor(w/65536),xt=w-k*65536,w=Bt+k+65535,k=Math.floor(w/65536),Bt=w-k*65536,it+=k-1+37*(k-1),k=1,w=it+k+65535,k=Math.floor(w/65536),it=w-k*65536,w=ht+k+65535,k=Math.floor(w/65536),ht=w-k*65536,w=lt+k+65535,k=Math.floor(w/65536),lt=w-k*65536,w=Ot+k+65535,k=Math.floor(w/65536),Ot=w-k*65536,w=Mt+k+65535,k=Math.floor(w/65536),Mt=w-k*65536,w=St+k+65535,k=Math.floor(w/65536),St=w-k*65536,w=Pe+k+65535,k=Math.floor(w/65536),Pe=w-k*65536,w=zt+k+65535,k=Math.floor(w/65536),zt=w-k*65536,w=Dt+k+65535,k=Math.floor(w/65536),Dt=w-k*65536,w=Ft+k+65535,k=Math.floor(w/65536),Ft=w-k*65536,w=Et+k+65535,k=Math.floor(w/65536),Et=w-k*65536,w=At+k+65535,k=Math.floor(w/65536),At=w-k*65536,w=Gt+k+65535,k=Math.floor(w/65536),Gt=w-k*65536,w=bt+k+65535,k=Math.floor(w/65536),bt=w-k*65536,w=xt+k+65535,k=Math.floor(w/65536),xt=w-k*65536,w=Bt+k+65535,k=Math.floor(w/65536),Bt=w-k*65536,it+=k-1+37*(k-1),q[0]=it,q[1]=ht,q[2]=lt,q[3]=Ot,q[4]=Mt,q[5]=St,q[6]=Pe,q[7]=zt,q[8]=Dt,q[9]=Ft,q[10]=Et,q[11]=At,q[12]=Gt,q[13]=bt,q[14]=xt,q[15]=Bt}function $(q,H){m(q,H,H)}function et(q,H){const V=i();let w;for(w=0;w<16;w++)V[w]=H[w];for(w=253;w>=0;w--)$(V,V),w!==2&&w!==4&&m(V,V,H);for(w=0;w<16;w++)q[w]=V[w]}function tt(q,H){const V=i();let w;for(w=0;w<16;w++)V[w]=H[w];for(w=250;w>=0;w--)$(V,V),w!==1&&m(V,V,H);for(w=0;w<16;w++)q[w]=V[w]}function nt(q,H){const V=i(),w=i(),k=i(),it=i(),ht=i(),lt=i(),Ot=i(),Mt=i(),St=i();j(V,q[1],q[0]),j(St,H[1],H[0]),m(V,V,St),U(w,q[0],q[1]),U(St,H[0],H[1]),m(w,w,St),m(k,q[3],H[3]),m(k,k,h),m(it,q[2],H[2]),U(it,it,it),j(ht,w,V),j(lt,it,k),U(Ot,it,k),U(Mt,w,V),m(q[0],ht,lt),m(q[1],Mt,Ot),m(q[2],Ot,lt),m(q[3],ht,Mt)}function dt(q,H,V){for(let w=0;w<4;w++)F(q[w],H[w],V)}function d(q,H){const V=i(),w=i(),k=i();et(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){x(q[0],c),x(q[1],l),x(q[2],l),x(q[3],c);for(let w=255;w>=0;--w){const k=V[w/8|0]>>(w&7)&1;dt(q,H,k),nt(H,q),nt(q,q),dt(q,H,k)}}function b(q,H){const V=[i(),i(),i(),i()];x(V[0],g),x(V[1],_),x(V[2],l),m(V[3],g,_),p(q,V,H)}function C(q){if(q.length!==e.SEED_LENGTH)throw new Error(`ed25519: seed must be ${e.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}}e.generateKeyPairFromSeed=C;function O(q){const H=(0,t.randomBytes)(32,q),V=C(H);return(0,n.wipe)(H),V}e.generateKeyPair=O;function N(q){if(q.length!==e.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(q.subarray(32))}e.extractPublicKeyFromSecretKey=N;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 D(q,H){let V,w,k,it;for(w=63;w>=32;--w){for(V=0,k=w-32,it=w-12;k<it;++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;D(q,H)}function T(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 it=new Uint8Array(64);it.set(k.subarray(32),32);const ht=new r.SHA512;ht.update(it.subarray(32)),ht.update(H);const lt=ht.digest();ht.clean(),v(lt),b(w,lt),d(it,w),ht.reset(),ht.update(it.subarray(0,32)),ht.update(q.subarray(32)),ht.update(H);const Ot=ht.digest();v(Ot);for(let Mt=0;Mt<32;Mt++)V[Mt]=lt[Mt];for(let Mt=0;Mt<32;Mt++)for(let St=0;St<32;St++)V[Mt+St]+=Ot[Mt]*k[St];return D(it.subarray(32),V),it}e.sign=T;function ot(q,H){const V=i(),w=i(),k=i(),it=i(),ht=i(),lt=i(),Ot=i();return x(q[2],l),P(q[1],H),$(k,q[1]),m(it,k,f),j(k,k,q[2]),U(it,q[2],it),$(ht,it),$(lt,ht),m(Ot,lt,ht),m(V,Ot,k),m(V,V,it),tt(V,V),m(V,V,k),m(V,V,it),m(V,V,it),m(q[0],V,it),$(w,q[0]),m(w,w,it),B(w,k)&&m(q[0],q[0],E),$(w,q[0]),m(w,w,it),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 pt(q,H,V){const w=new Uint8Array(32),k=[i(),i(),i(),i()],it=[i(),i(),i(),i()];if(V.length!==e.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);if(ot(it,q))return!1;const ht=new r.SHA512;ht.update(V.subarray(0,32)),ht.update(q),ht.update(H);const lt=ht.digest();return v(lt),p(k,it,lt),b(it,V.subarray(32)),nt(k,it),d(w,k),!Y(V,w)}e.verify=pt;function A(q){let H=[i(),i(),i(),i()];if(ot(H,q))throw new Error("Ed25519: invalid public key");let V=i(),w=i(),k=H[1];U(V,l,k),j(w,l,k),et(w,w),m(V,V,w);let it=new Uint8Array(32);return W(it,V),it}e.convertPublicKeyToX25519=A;function rt(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}e.convertSecretKeyToX25519=rt}(Gh);const T5="EdDSA",R5="JWT",P1=".",M1="base64url",L5="utf8",B5="utf8",U5=":",F5="did",j5="key",$1="base58btc",k5="z",q5="K36",z5=32;function Xh(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function N1(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Xh(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function H5(e,t){t||(t=e.reduce((i,o)=>i+o.length,0));const r=N1(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return Xh(r)}function K5(e,t){if(e.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<e.length;i++){var o=e.charAt(i),c=o.charCodeAt(0);if(r[c]!==255)throw new TypeError(o+" is ambiguous");r[c]=i}var l=e.length,f=e.charAt(0),h=Math.log(l)/Math.log(256),g=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 F=0,W=0,Y=0,B=I.length;Y!==B&&I[Y]===0;)Y++,F++;for(var z=(B-Y)*g+1>>>0,P=new Uint8Array(z);Y!==B;){for(var U=I[Y],j=0,m=z-1;(U!==0||j<W)&&m!==-1;m--,j++)U+=256*P[m]>>>0,P[m]=U%l>>>0,U=U/l>>>0;if(U!==0)throw new Error("Non-zero carry");W=j,Y++}for(var $=z-W;$!==z&&P[$]===0;)$++;for(var et=f.repeat(F);$<z;++$)et+=e.charAt(P[$]);return et}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var F=0;if(I[F]!==" "){for(var W=0,Y=0;I[F]===f;)W++,F++;for(var B=(I.length-F)*h+1>>>0,z=new Uint8Array(B);I[F];){var P=r[I.charCodeAt(F)];if(P===255)return;for(var U=0,j=B-1;(P!==0||U<Y)&&j!==-1;j--,U++)P+=l*z[j]>>>0,z[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");Y=U,F++}if(I[F]!==" "){for(var m=B-Y;m!==B&&z[m]===0;)m++;for(var $=new Uint8Array(W+(B-m)),et=W;m!==B;)$[et++]=z[m++];return $}}}function x(I){var F=E(I);if(F)return F;throw new Error(`Non-${t} character`)}return{encode:_,decodeUnsafe:E,decode:x}}var W5=K5,V5=W5;const T1=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},G5=e=>new TextEncoder().encode(e),Y5=e=>new TextDecoder().decode(e);class Q5{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class J5{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return R1(this,t)}}class Z5{constructor(t){this.decoders=t}or(t){return R1(this,t)}decode(t){const r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const R1=(e,t)=>new Z5({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class X5{constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Q5(t,r,n),this.decoder=new J5(t,r,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const xl=({name:e,prefix:t,encode:r,decode:n})=>new X5(e,t,r,n),Ya=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:i}=V5(r,t);return xl({prefix:e,name:t,encode:n,decode:o=>T1(i(o))})},t8=(e,t,r,n)=>{const i={};for(let g=0;g<t.length;++g)i[t[g]]=g;let o=e.length;for(;e[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[e[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},e8=(e,t,r)=>{const n=t[t.length-1]==="=",i=(1<<r)-1;let o="",c=0,l=0;for(let f=0;f<e.length;++f)for(l=l<<8|e[f],c+=8;c>r;)c-=r,o+=t[i&l>>c];if(c&&(o+=t[i&l<<r-c]),n)for(;o.length*r&7;)o+="=";return o},Dr=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>xl({prefix:t,name:e,encode(i){return e8(i,n,r)},decode(i){return t8(i,n,r,e)}}),r8=xl({prefix:"\0",name:"identity",encode:e=>Y5(e),decode:e=>G5(e)});var n8=Object.freeze({__proto__:null,identity:r8});const i8=Dr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var s8=Object.freeze({__proto__:null,base2:i8});const o8=Dr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var a8=Object.freeze({__proto__:null,base8:o8});const c8=Ya({prefix:"9",name:"base10",alphabet:"0123456789"});var l8=Object.freeze({__proto__:null,base10:c8});const u8=Dr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),h8=Dr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var f8=Object.freeze({__proto__:null,base16:u8,base16upper:h8});const d8=Dr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),p8=Dr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),g8=Dr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),m8=Dr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),v8=Dr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),w8=Dr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),y8=Dr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),b8=Dr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_8=Dr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var E8=Object.freeze({__proto__:null,base32:d8,base32upper:p8,base32pad:g8,base32padupper:m8,base32hex:v8,base32hexupper:w8,base32hexpad:y8,base32hexpadupper:b8,base32z:_8});const A8=Ya({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),x8=Ya({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var I8=Object.freeze({__proto__:null,base36:A8,base36upper:x8});const S8=Ya({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),C8=Ya({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var D8=Object.freeze({__proto__:null,base58btc:S8,base58flickr:C8});const O8=Dr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),P8=Dr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),M8=Dr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$8=Dr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var N8=Object.freeze({__proto__:null,base64:O8,base64pad:P8,base64url:M8,base64urlpad:$8});const L1=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}"),T8=L1.reduce((e,t,r)=>(e[r]=t,e),[]),R8=L1.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function L8(e){return e.reduce((t,r)=>(t+=T8[r],t),"")}function B8(e){const t=[];for(const r of e){const n=R8[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}const U8=xl({prefix:"\u{1F680}",name:"base256emoji",encode:L8,decode:B8});var F8=Object.freeze({__proto__:null,base256emoji:U8}),j8=U1,B1=128,k8=127,q8=~k8,z8=Math.pow(2,31);function U1(e,t,r){t=t||[],r=r||0;for(var n=r;e>=z8;)t[r++]=e&255|B1,e/=128;for(;e&q8;)t[r++]=e&255|B1,e>>>=7;return t[r]=e|0,U1.bytes=r-n+1,t}var H8=tf,K8=128,F1=127;function tf(e,n){var r=0,n=n||0,i=0,o=n,c,l=e.length;do{if(o>=l)throw tf.bytes=0,new RangeError("Could not decode varint");c=e[o++],r+=i<28?(c&F1)<<i:(c&F1)*Math.pow(2,i),i+=7}while(c>=K8);return tf.bytes=o-n,r}var W8=Math.pow(2,7),V8=Math.pow(2,14),G8=Math.pow(2,21),Y8=Math.pow(2,28),Q8=Math.pow(2,35),J8=Math.pow(2,42),Z8=Math.pow(2,49),X8=Math.pow(2,56),t_=Math.pow(2,63),e_=function(e){return e<W8?1:e<V8?2:e<G8?3:e<Y8?4:e<Q8?5:e<J8?6:e<Z8?7:e<X8?8:e<t_?9:10},r_={encode:j8,decode:H8,encodingLength:e_},j1=r_;const k1=(e,t,r=0)=>(j1.encode(e,t,r),t),q1=e=>j1.encodingLength(e),ef=(e,t)=>{const r=t.byteLength,n=q1(e),i=n+q1(r),o=new Uint8Array(i+r);return k1(e,o,0),k1(r,o,n),o.set(t,i),new n_(e,r,t,o)};class n_{constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}}const z1=({name:e,code:t,encode:r})=>new i_(e,t,r);class i_{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){const r=this.encode(t);return r instanceof Uint8Array?ef(this.code,r):r.then(n=>ef(this.code,n))}else throw Error("Unknown type, must be binary type")}}const H1=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),s_=z1({name:"sha2-256",code:18,encode:H1("SHA-256")}),o_=z1({name:"sha2-512",code:19,encode:H1("SHA-512")});var a_=Object.freeze({__proto__:null,sha256:s_,sha512:o_});const K1=0,c_="identity",W1=T1;var l_=Object.freeze({__proto__:null,identity:{code:K1,name:c_,encode:W1,digest:e=>ef(K1,W1(e))}});new TextEncoder,new TextDecoder;const Uo={...n8,...s8,...a8,...l8,...f8,...E8,...I8,...D8,...N8,...F8};({...a_,...l_});function V1(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const G1=V1("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),rf=V1("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);const t=N1(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),Y1={utf8:G1,"utf-8":G1,hex:Uo.base16,latin1:rf,ascii:rf,binary:rf,...Uo};function nf(e,t="utf8"){const r=Y1[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}function sf(e,t="utf8"){const r=Y1[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xh(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}function Il(e){return nf(sf(Ui(e),L5),M1)}function Q1(e){const t=sf(q5,$1),r=k5+nf(H5([t,e]),$1);return[F5,j5,r].join(U5)}function u_(e){return nf(e,M1)}function h_(e){return sf([Il(e.header),Il(e.payload)].join(P1),B5)}function f_(e){return[Il(e.header),Il(e.payload),u_(e.signature)].join(P1)}function J1(e=Bo.randomBytes(z5)){return Gh.generateKeyPairFromSeed(e)}async function d_(e,t,r,n,i=yt.fromMiliseconds(Date.now())){const o={alg:T5,typ:R5},c=Q1(n.publicKey),l=i+r,f={iss:c,sub:e,aud:t,iat:i,exp:l},h=h_({header:o,payload:f}),g=Gh.sign(n.secretKey,h);return f_({header:o,payload:f,signature:g})}var Z1=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},p_=function(){function e(t,r,n){this.name=t,this.version=r,this.os=n,this.type="browser"}return e}(),g_=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),m_=function(){function e(t,r,n,i){this.name=t,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return e}(),v_=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),w_=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),y_=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,b_=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,X1=3,__=[["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",y_]],tg=[["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 E_(e){return e?eg(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new w_:typeof navigator<"u"?eg(navigator.userAgent):I_()}function A_(e){return e!==""&&__.reduce(function(t,r){var n=r[0],i=r[1];if(t)return t;var o=i.exec(e);return!!o&&[n,o]},!1)}function eg(e){var t=A_(e);if(!t)return null;var r=t[0],n=t[1];if(r==="searchbot")return new v_;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<X1&&(i=Z1(Z1([],i,!0),S_(X1-i.length),!0)):i=[];var o=i.join("."),c=x_(e),l=b_.exec(e);return l&&l[1]?new m_(r,o,c,l[1]):new p_(r,o,c)}function x_(e){for(var t=0,r=tg.length;t<r;t++){var n=tg[t],i=n[0],o=n[1],c=o.exec(e);if(c)return i}return null}function I_(){var e=typeof process<"u"&&process.version;return e?new g_(process.version.slice(1)):null}function S_(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}var Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.getLocalStorage=Je.getLocalStorageOrThrow=Je.getCrypto=Je.getCryptoOrThrow=rg=Je.getLocation=Je.getLocationOrThrow=af=Je.getNavigator=Je.getNavigatorOrThrow=of=Je.getDocument=Je.getDocumentOrThrow=Je.getFromWindowOrThrow=Je.getFromWindow=void 0;function qs(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}Je.getFromWindow=qs;function Fo(e){const t=qs(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Je.getFromWindowOrThrow=Fo;function C_(){return Fo("document")}Je.getDocumentOrThrow=C_;function D_(){return qs("document")}var of=Je.getDocument=D_;function O_(){return Fo("navigator")}Je.getNavigatorOrThrow=O_;function P_(){return qs("navigator")}var af=Je.getNavigator=P_;function M_(){return Fo("location")}Je.getLocationOrThrow=M_;function $_(){return qs("location")}var rg=Je.getLocation=$_;function N_(){return Fo("crypto")}Je.getCryptoOrThrow=N_;function T_(){return qs("crypto")}Je.getCrypto=T_;function R_(){return Fo("localStorage")}Je.getLocalStorageOrThrow=R_;function L_(){return qs("localStorage")}Je.getLocalStorage=L_;var cf={};Object.defineProperty(cf,"__esModule",{value:!0});var ng=cf.getWindowMetadata=void 0;const ig=Je;function B_(){let e,t;try{e=ig.getDocumentOrThrow(),t=ig.getLocationOrThrow()}catch{return null}function r(){const _=e.getElementsByTagName("link"),E=[];for(let x=0;x<_.length;x++){const I=_[x],F=I.getAttribute("rel");if(F&&F.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=t.protocol+"//"+t.host;if(W.indexOf("/")===0)Y+=W;else{const B=t.pathname.split("/");B.pop();const z=B.join("/");Y+=z+"/"+W}E.push(Y)}else if(W.indexOf("//")===0){const Y=t.protocol+W;E.push(Y)}else E.push(W)}}return E}function n(..._){const E=e.getElementsByTagName("meta");for(let x=0;x<E.length;x++){const I=E[x],F=["itemprop","property","name"].map(W=>I.getAttribute(W)).filter(W=>W?_.includes(W):!1);if(F.length&&F){const W=I.getAttribute("content");if(W)return W}}return""}function i(){let _=n("name","og:site_name","og:title","twitter:title");return _||(_=e.title),_}function o(){return n("description","og:description","twitter:description","keywords")}const c=i(),l=o(),f=t.origin,h=r();return{description:l,url:f,icons:h,name:c}}ng=cf.getWindowMetadata=B_;var Qa={},U_=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),sg="%[a-f0-9]{2}",og=new RegExp("("+sg+")|([^%]+?)","gi"),ag=new RegExp("("+sg+")+","gi");function lf(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],lf(r),lf(n))}function F_(e){try{return decodeURIComponent(e)}catch{for(var t=e.match(og)||[],r=1;r<t.length;r++)e=lf(t,r).join(""),t=e.match(og)||[];return e}}function j_(e){for(var t={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=ag.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{var n=F_(r[0]);n!==r[0]&&(t[r[0]]=n)}r=ag.exec(e)}t["%C2"]="\uFFFD";for(var i=Object.keys(t),o=0;o<i.length;o++){var c=i[o];e=e.replace(new RegExp(c,"g"),t[c])}return e}var k_=function(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch{return j_(e)}},q_=(e,t)=>{if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[e];const r=e.indexOf(t);return r===-1?[e]:[e.slice(0,r),e.slice(r+t.length)]},z_=function(e,t){for(var r={},n=Object.keys(e),i=Array.isArray(t),o=0;o<n.length;o++){var c=n[o],l=e[c];(i?t.indexOf(c)!==-1:t(c,l,e))&&(r[c]=l)}return r};(function(e){const t=U_,r=k_,n=q_,i=z_,o=B=>B==null,c=Symbol("encodeFragmentIdentifier");function l(B){switch(B.arrayFormat){case"index":return z=>(P,U)=>{const j=P.length;return U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?P:U===null?[...P,[g(z,B),"[",j,"]"].join("")]:[...P,[g(z,B),"[",g(j,B),"]=",g(U,B)].join("")]};case"bracket":return z=>(P,U)=>U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?P:U===null?[...P,[g(z,B),"[]"].join("")]:[...P,[g(z,B),"[]=",g(U,B)].join("")];case"colon-list-separator":return z=>(P,U)=>U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?P:U===null?[...P,[g(z,B),":list="].join("")]:[...P,[g(z,B),":list=",g(U,B)].join("")];case"comma":case"separator":case"bracket-separator":{const z=B.arrayFormat==="bracket-separator"?"[]=":"=";return P=>(U,j)=>j===void 0||B.skipNull&&j===null||B.skipEmptyString&&j===""?U:(j=j===null?"":j,U.length===0?[[g(P,B),z,g(j,B)].join("")]:[[U,g(j,B)].join(B.arrayFormatSeparator)])}default:return z=>(P,U)=>U===void 0||B.skipNull&&U===null||B.skipEmptyString&&U===""?P:U===null?[...P,g(z,B)]:[...P,[g(z,B),"=",g(U,B)].join("")]}}function f(B){let z;switch(B.arrayFormat){case"index":return(P,U,j)=>{if(z=/\[(\d*)\]$/.exec(P),P=P.replace(/\[\d*\]$/,""),!z){j[P]=U;return}j[P]===void 0&&(j[P]={}),j[P][z[1]]=U};case"bracket":return(P,U,j)=>{if(z=/(\[\])$/.exec(P),P=P.replace(/\[\]$/,""),!z){j[P]=U;return}if(j[P]===void 0){j[P]=[U];return}j[P]=[].concat(j[P],U)};case"colon-list-separator":return(P,U,j)=>{if(z=/(:list)$/.exec(P),P=P.replace(/:list$/,""),!z){j[P]=U;return}if(j[P]===void 0){j[P]=[U];return}j[P]=[].concat(j[P],U)};case"comma":case"separator":return(P,U,j)=>{const m=typeof U=="string"&&U.includes(B.arrayFormatSeparator),$=typeof U=="string"&&!m&&_(U,B).includes(B.arrayFormatSeparator);U=$?_(U,B):U;const et=m||$?U.split(B.arrayFormatSeparator).map(tt=>_(tt,B)):U===null?U:_(U,B);j[P]=et};case"bracket-separator":return(P,U,j)=>{const m=/(\[\])$/.test(P);if(P=P.replace(/\[\]$/,""),!m){j[P]=U&&_(U,B);return}const $=U===null?[]:U.split(B.arrayFormatSeparator).map(et=>_(et,B));if(j[P]===void 0){j[P]=$;return}j[P]=[].concat(j[P],$)};default:return(P,U,j)=>{if(j[P]===void 0){j[P]=U;return}j[P]=[].concat(j[P],U)}}}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?t(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 x(B){const z=B.indexOf("#");return z!==-1&&(B=B.slice(0,z)),B}function I(B){let z="";const P=B.indexOf("#");return P!==-1&&(z=B.slice(P)),z}function F(B){B=x(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),U=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return U;for(const j of B.split("&")){if(j==="")continue;let[m,$]=n(z.decode?j.replace(/\+/g," "):j,"=");$=$===void 0?null:["comma","separator","bracket-separator"].includes(z.arrayFormat)?$:_($,z),P(_(m,z),$,U)}for(const j of Object.keys(U)){const m=U[j];if(typeof m=="object"&&m!==null)for(const $ of Object.keys(m))m[$]=W(m[$],z);else U[j]=W(m,z)}return z.sort===!1?U:(z.sort===!0?Object.keys(U).sort():Object.keys(U).sort(z.sort)).reduce((j,m)=>{const $=U[m];return $&&typeof $=="object"&&!Array.isArray($)?j[m]=E($):j[m]=$,j},Object.create(null))}e.extract=F,e.parse=Y,e.stringify=(B,z)=>{if(!B)return"";z=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},z),h(z.arrayFormatSeparator);const P=$=>z.skipNull&&o(B[$])||z.skipEmptyString&&B[$]==="",U=l(z),j={};for(const $ of Object.keys(B))P($)||(j[$]=B[$]);const m=Object.keys(j);return z.sort!==!1&&m.sort(z.sort),m.map($=>{const et=B[$];return et===void 0?"":et===null?g($,z):Array.isArray(et)?et.length===0&&z.arrayFormat==="bracket-separator"?g($,z)+"[]":et.reduce(U($),[]).join("&"):g($,z)+"="+g(et,z)}).filter($=>$.length>0).join("&")},e.parseUrl=(B,z)=>{z=Object.assign({decode:!0},z);const[P,U]=n(B,"#");return Object.assign({url:P.split("?")[0]||"",query:Y(F(B),z)},z&&z.parseFragmentIdentifier&&U?{fragmentIdentifier:_(U,z)}:{})},e.stringifyUrl=(B,z)=>{z=Object.assign({encode:!0,strict:!0,[c]:!0},z);const P=x(B.url).split("?")[0]||"",U=e.extract(B.url),j=e.parse(U,{sort:!1}),m=Object.assign(j,B.query);let $=e.stringify(m,z);$&&($=`?${$}`);let et=I(B.url);return B.fragmentIdentifier&&(et=`#${z[c]?g(B.fragmentIdentifier,z):B.fragmentIdentifier}`),`${P}${$}${et}`},e.pick=(B,z,P)=>{P=Object.assign({parseFragmentIdentifier:!0,[c]:!1},P);const{url:U,query:j,fragmentIdentifier:m}=e.parseUrl(B,P);return e.stringifyUrl({url:U,query:i(j,z),fragmentIdentifier:m},P)},e.exclude=(B,z,P)=>{const U=Array.isArray(z)?j=>!z.includes(j):(j,m)=>!z(j,m);return e.pick(B,U,P)}})(Qa);var uf={},Sl={};Object.defineProperty(Sl,"__esModule",{value:!0});var Rr=ce,hf=pn,H_=20;function K_(e,t,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],x=r[27]<<24|r[26]<<16|r[25]<<8|r[24],I=r[31]<<24|r[30]<<16|r[29]<<8|r[28],F=t[3]<<24|t[2]<<16|t[1]<<8|t[0],W=t[7]<<24|t[6]<<16|t[5]<<8|t[4],Y=t[11]<<24|t[10]<<16|t[9]<<8|t[8],B=t[15]<<24|t[14]<<16|t[13]<<8|t[12],z=n,P=i,U=o,j=c,m=l,$=f,et=h,tt=g,nt=_,dt=E,d=x,p=I,b=F,C=W,O=Y,N=B,L=0;L<H_;L+=2)z=z+m|0,b^=z,b=b>>>32-16|b<<16,nt=nt+b|0,m^=nt,m=m>>>32-12|m<<12,P=P+$|0,C^=P,C=C>>>32-16|C<<16,dt=dt+C|0,$^=dt,$=$>>>32-12|$<<12,U=U+et|0,O^=U,O=O>>>32-16|O<<16,d=d+O|0,et^=d,et=et>>>32-12|et<<12,j=j+tt|0,N^=j,N=N>>>32-16|N<<16,p=p+N|0,tt^=p,tt=tt>>>32-12|tt<<12,U=U+et|0,O^=U,O=O>>>32-8|O<<8,d=d+O|0,et^=d,et=et>>>32-7|et<<7,j=j+tt|0,N^=j,N=N>>>32-8|N<<8,p=p+N|0,tt^=p,tt=tt>>>32-7|tt<<7,P=P+$|0,C^=P,C=C>>>32-8|C<<8,dt=dt+C|0,$^=dt,$=$>>>32-7|$<<7,z=z+m|0,b^=z,b=b>>>32-8|b<<8,nt=nt+b|0,m^=nt,m=m>>>32-7|m<<7,z=z+$|0,N^=z,N=N>>>32-16|N<<16,d=d+N|0,$^=d,$=$>>>32-12|$<<12,P=P+et|0,b^=P,b=b>>>32-16|b<<16,p=p+b|0,et^=p,et=et>>>32-12|et<<12,U=U+tt|0,C^=U,C=C>>>32-16|C<<16,nt=nt+C|0,tt^=nt,tt=tt>>>32-12|tt<<12,j=j+m|0,O^=j,O=O>>>32-16|O<<16,dt=dt+O|0,m^=dt,m=m>>>32-12|m<<12,U=U+tt|0,C^=U,C=C>>>32-8|C<<8,nt=nt+C|0,tt^=nt,tt=tt>>>32-7|tt<<7,j=j+m|0,O^=j,O=O>>>32-8|O<<8,dt=dt+O|0,m^=dt,m=m>>>32-7|m<<7,P=P+et|0,b^=P,b=b>>>32-8|b<<8,p=p+b|0,et^=p,et=et>>>32-7|et<<7,z=z+$|0,N^=z,N=N>>>32-8|N<<8,d=d+N|0,$^=d,$=$>>>32-7|$<<7;Rr.writeUint32LE(z+n|0,e,0),Rr.writeUint32LE(P+i|0,e,4),Rr.writeUint32LE(U+o|0,e,8),Rr.writeUint32LE(j+c|0,e,12),Rr.writeUint32LE(m+l|0,e,16),Rr.writeUint32LE($+f|0,e,20),Rr.writeUint32LE(et+h|0,e,24),Rr.writeUint32LE(tt+g|0,e,28),Rr.writeUint32LE(nt+_|0,e,32),Rr.writeUint32LE(dt+E|0,e,36),Rr.writeUint32LE(d+x|0,e,40),Rr.writeUint32LE(p+I|0,e,44),Rr.writeUint32LE(b+F|0,e,48),Rr.writeUint32LE(C+W|0,e,52),Rr.writeUint32LE(O+Y|0,e,56),Rr.writeUint32LE(N+B|0,e,60)}function cg(e,t,r,n,i){if(i===void 0&&(i=0),e.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(t.length!==8&&t.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");o=new Uint8Array(16),c=o.length-t.length,o.set(t,c)}else{if(t.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");o=t,c=i}for(var l=new Uint8Array(64),f=0;f<r.length;f+=64){K_(l,o,e);for(var h=f;h<f+64&&h<r.length;h++)n[h]=r[h]^l[h-f];V_(o,0,c)}return hf.wipe(l),i===0&&hf.wipe(o),n}Sl.streamXOR=cg;function W_(e,t,r,n){return n===void 0&&(n=0),hf.wipe(r),cg(e,t,r,r,n)}Sl.stream=W_;function V_(e,t,r){for(var n=1;r--;)n=n+(e[t]&255)|0,e[t]=n&255,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}var lg={},as={};Object.defineProperty(as,"__esModule",{value:!0});function G_(e,t,r){return~(e-1)&t|e-1&r}as.select=G_;function Y_(e,t){return(e|0)-(t|0)-1>>>31&1}as.lessOrEqual=Y_;function ug(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 1&r-1>>>8}as.compare=ug;function Q_(e,t){return e.length===0||t.length===0?!1:ug(e,t)!==0}as.equal=Q_,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=as,r=pn;e.DIGEST_LENGTH=16;var n=function(){function c(l){this.digestLength=e.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 x=l[10]|l[11]<<8;this._r[6]=(E>>>14|x<<2)&8191;var I=l[12]|l[13]<<8;this._r[7]=(x>>>11|I<<5)&8065;var F=l[14]|l[15]<<8;this._r[8]=(I>>>8|F<<8)&8191,this._r[9]=F>>>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],x=this._h[2],I=this._h[3],F=this._h[4],W=this._h[5],Y=this._h[6],B=this._h[7],z=this._h[8],P=this._h[9],U=this._r[0],j=this._r[1],m=this._r[2],$=this._r[3],et=this._r[4],tt=this._r[5],nt=this._r[6],dt=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 C=l[f+2]|l[f+3]<<8;E+=(b>>>13|C<<3)&8191;var O=l[f+4]|l[f+5]<<8;x+=(C>>>10|O<<6)&8191;var N=l[f+6]|l[f+7]<<8;I+=(O>>>7|N<<9)&8191;var L=l[f+8]|l[f+9]<<8;F+=(N>>>4|L<<12)&8191,W+=L>>>1&8191;var D=l[f+10]|l[f+11]<<8;Y+=(L>>>14|D<<2)&8191;var v=l[f+12]|l[f+13]<<8;B+=(D>>>11|v<<5)&8191;var T=l[f+14]|l[f+15]<<8;z+=(v>>>8|T<<8)&8191,P+=T>>>5|g;var ot=0,pt=ot;pt+=_*U,pt+=E*(5*p),pt+=x*(5*d),pt+=I*(5*dt),pt+=F*(5*nt),ot=pt>>>13,pt&=8191,pt+=W*(5*tt),pt+=Y*(5*et),pt+=B*(5*$),pt+=z*(5*m),pt+=P*(5*j),ot+=pt>>>13,pt&=8191;var A=ot;A+=_*j,A+=E*U,A+=x*(5*p),A+=I*(5*d),A+=F*(5*dt),ot=A>>>13,A&=8191,A+=W*(5*nt),A+=Y*(5*tt),A+=B*(5*et),A+=z*(5*$),A+=P*(5*m),ot+=A>>>13,A&=8191;var rt=ot;rt+=_*m,rt+=E*j,rt+=x*U,rt+=I*(5*p),rt+=F*(5*d),ot=rt>>>13,rt&=8191,rt+=W*(5*dt),rt+=Y*(5*nt),rt+=B*(5*tt),rt+=z*(5*et),rt+=P*(5*$),ot+=rt>>>13,rt&=8191;var q=ot;q+=_*$,q+=E*m,q+=x*j,q+=I*U,q+=F*(5*p),ot=q>>>13,q&=8191,q+=W*(5*d),q+=Y*(5*dt),q+=B*(5*nt),q+=z*(5*tt),q+=P*(5*et),ot+=q>>>13,q&=8191;var H=ot;H+=_*et,H+=E*$,H+=x*m,H+=I*j,H+=F*U,ot=H>>>13,H&=8191,H+=W*(5*p),H+=Y*(5*d),H+=B*(5*dt),H+=z*(5*nt),H+=P*(5*tt),ot+=H>>>13,H&=8191;var V=ot;V+=_*tt,V+=E*et,V+=x*$,V+=I*m,V+=F*j,ot=V>>>13,V&=8191,V+=W*U,V+=Y*(5*p),V+=B*(5*d),V+=z*(5*dt),V+=P*(5*nt),ot+=V>>>13,V&=8191;var w=ot;w+=_*nt,w+=E*tt,w+=x*et,w+=I*$,w+=F*m,ot=w>>>13,w&=8191,w+=W*j,w+=Y*U,w+=B*(5*p),w+=z*(5*d),w+=P*(5*dt),ot+=w>>>13,w&=8191;var k=ot;k+=_*dt,k+=E*nt,k+=x*tt,k+=I*et,k+=F*$,ot=k>>>13,k&=8191,k+=W*m,k+=Y*j,k+=B*U,k+=z*(5*p),k+=P*(5*d),ot+=k>>>13,k&=8191;var it=ot;it+=_*d,it+=E*dt,it+=x*nt,it+=I*tt,it+=F*et,ot=it>>>13,it&=8191,it+=W*$,it+=Y*m,it+=B*j,it+=z*U,it+=P*(5*p),ot+=it>>>13,it&=8191;var ht=ot;ht+=_*p,ht+=E*d,ht+=x*dt,ht+=I*nt,ht+=F*tt,ot=ht>>>13,ht&=8191,ht+=W*et,ht+=Y*$,ht+=B*m,ht+=z*j,ht+=P*U,ot+=ht>>>13,ht&=8191,ot=(ot<<2)+ot|0,ot=ot+pt|0,pt=ot&8191,ot=ot>>>13,A+=ot,_=pt,E=A,x=rt,I=q,F=H,W=V,Y=w,B=k,z=it,P=ht,f+=16,h-=16}this._h[0]=_,this._h[1]=E,this._h[2]=x,this._h[3]=I,this._h[4]=F,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,x;if(this._leftover){for(x=this._leftover,this._buffer[x++]=1;x<16;x++)this._buffer[x]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(g=this._h[1]>>>13,this._h[1]&=8191,x=2;x<10;x++)this._h[x]+=g,g=this._h[x]>>>13,this._h[x]&=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,x=1;x<10;x++)h[x]=this._h[x]+g,g=h[x]>>>13,h[x]&=8191;for(h[9]-=8192,_=(g^1)-1,x=0;x<10;x++)h[x]&=_;for(_=~_,x=0;x<10;x++)this._h[x]=this._h[x]&_|h[x];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,x=1;x<8;x++)E=(this._h[x]+this._pad[x]|0)+(E>>>16)|0,this._h[x]=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}();e.Poly1305=n;function i(c,l){var f=new n(c);f.update(l);var h=f.digest();return f.clean(),h}e.oneTimeAuth=i;function o(c,l){return c.length!==e.DIGEST_LENGTH||l.length!==e.DIGEST_LENGTH?!1:t.equal(c,l)}e.equal=o}(lg),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Sl,r=lg,n=pn,i=ce,o=as;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var c=new Uint8Array(16),l=function(){function f(h){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,h.length!==e.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 x=new Uint8Array(16);x.set(h,x.length-h.length);var I=new Uint8Array(32);t.stream(this._key,x,I,4);var F=g.length+this.tagLength,W;if(E){if(E.length!==F)throw new Error("ChaCha20Poly1305: incorrect destination length");W=E}else W=new Uint8Array(F);return t.streamXOR(this._key,x,g,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),I,W.subarray(0,W.length-this.tagLength),_),n.wipe(x),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 x=new Uint8Array(16);x.set(h,x.length-h.length);var I=new Uint8Array(32);t.stream(this._key,x,I,4);var F=new Uint8Array(this.tagLength);if(this._authenticate(F,I,g.subarray(0,g.length-this.tagLength),_),!o.equal(F,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 t.streamXOR(this._key,x,g.subarray(0,g.length-this.tagLength),Y,4),n.wipe(x),Y},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,g,_,E){var x=new r.Poly1305(g);E&&(x.update(E),E.length%16>0&&x.update(c.subarray(E.length%16))),x.update(_),_.length%16>0&&x.update(c.subarray(_.length%16));var I=new Uint8Array(8);E&&i.writeUint64LE(E.length,I),x.update(I),i.writeUint64LE(_.length,I),x.update(I);for(var F=x.digest(),W=0;W<F.length;W++)h[W]=F[W];x.clean(),n.wipe(F),n.wipe(I)},f}();e.ChaCha20Poly1305=l}(uf);var hg={},Ja={},ff={};Object.defineProperty(ff,"__esModule",{value:!0});function J_(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}ff.isSerializableHash=J_,Object.defineProperty(Ja,"__esModule",{value:!0});var li=ff,Z_=as,X_=pn,fg=function(){function e(t,r){this._finished=!1,this._inner=new t,this._outer=new t,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),li.isSerializableHash(this._inner)&&li.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),X_.wipe(n)}return e.prototype.reset=function(){if(!li.isSerializableHash(this._inner)||!li.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){li.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),li.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(t){return this._inner.update(t),this},e.prototype.finish=function(t){return this._finished?(this._outer.finish(t),this):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0,this)},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype.saveState=function(){if(!li.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(t){if(!li.isSerializableHash(this._inner)||!li.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(t){if(!li.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},e}();Ja.HMAC=fg;function t4(e,t,r){var n=new fg(e,t);n.update(r);var i=n.digest();return n.clean(),i}Ja.hmac=t4,Ja.equal=Z_.equal,Object.defineProperty(hg,"__esModule",{value:!0});var dg=Ja,pg=pn,e4=function(){function e(t,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=i;var o=dg.hmac(this._hash,n,r);this._hmac=new dg.HMAC(t,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(t===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(t){for(var r=new Uint8Array(t),n=0;n<r.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[n]=this._buffer[this._bufpos++];return r},e.prototype.clean=function(){this._hmac.clean(),pg.wipe(this._buffer),pg.wipe(this._counter),this._bufpos=0},e}(),r4=hg.HKDF=e4,Cl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ce,r=pn;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var n=function(){function l(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.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,x=h%64<56?64:128;this._buffer[g]=128;for(var I=g+1;I<x-8;I++)this._buffer[I]=0;t.writeUint32BE(_,this._buffer,x-8),t.writeUint32BE(E,this._buffer,x-4),o(this._temp,this._state,this._buffer,0,x),this._finished=!0}for(var I=0;I<this.digestLength/4;I++)t.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}();e.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],x=f[1],I=f[2],F=f[3],W=f[4],Y=f[5],B=f[6],z=f[7],P=0;P<16;P++){var U=g+P*4;l[P]=t.readUint32BE(h,U)}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 $=(j>>>7|j<<32-7)^(j>>>18|j<<32-18)^j>>>3;l[P]=(m+l[P-7]|0)+($+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,$=((E>>>2|E<<32-2)^(E>>>13|E<<32-13)^(E>>>22|E<<32-22))+(E&x^E&I^x&I)|0;z=B,B=Y,Y=W,W=F+m|0,F=I,I=x,x=E,E=m+$|0}f[0]+=E,f[1]+=x,f[2]+=I,f[3]+=F,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}e.hash=c})(Cl);var df={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=Bo,r=pn;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function n(P){const U=new Float64Array(16);if(P)for(let j=0;j<P.length;j++)U[j]=P[j];return U}const i=new Uint8Array(32);i[0]=9;const o=n([56129,1]);function c(P){let U=1;for(let j=0;j<16;j++){let m=P[j]+U+65535;U=Math.floor(m/65536),P[j]=m-U*65536}P[0]+=U-1+37*(U-1)}function l(P,U,j){const m=~(j-1);for(let $=0;$<16;$++){const et=m&(P[$]^U[$]);P[$]^=et,U[$]^=et}}function f(P,U){const j=n(),m=n();for(let $=0;$<16;$++)m[$]=U[$];c(m),c(m),c(m);for(let $=0;$<2;$++){j[0]=m[0]-65517;for(let tt=1;tt<15;tt++)j[tt]=m[tt]-65535-(j[tt-1]>>16&1),j[tt-1]&=65535;j[15]=m[15]-32767-(j[14]>>16&1);const et=j[15]>>16&1;j[14]&=65535,l(m,j,1-et)}for(let $=0;$<16;$++)P[2*$]=m[$]&255,P[2*$+1]=m[$]>>8}function h(P,U){for(let j=0;j<16;j++)P[j]=U[2*j]+(U[2*j+1]<<8);P[15]&=32767}function g(P,U,j){for(let m=0;m<16;m++)P[m]=U[m]+j[m]}function _(P,U,j){for(let m=0;m<16;m++)P[m]=U[m]-j[m]}function E(P,U,j){let m,$,et=0,tt=0,nt=0,dt=0,d=0,p=0,b=0,C=0,O=0,N=0,L=0,D=0,v=0,T=0,ot=0,pt=0,A=0,rt=0,q=0,H=0,V=0,w=0,k=0,it=0,ht=0,lt=0,Ot=0,Mt=0,St=0,Pe=0,zt=0,Dt=j[0],Ft=j[1],Et=j[2],At=j[3],Gt=j[4],bt=j[5],xt=j[6],Bt=j[7],_t=j[8],Pt=j[9],jt=j[10],$t=j[11],Nt=j[12],le=j[13],Rt=j[14],Tt=j[15];m=U[0],et+=m*Dt,tt+=m*Ft,nt+=m*Et,dt+=m*At,d+=m*Gt,p+=m*bt,b+=m*xt,C+=m*Bt,O+=m*_t,N+=m*Pt,L+=m*jt,D+=m*$t,v+=m*Nt,T+=m*le,ot+=m*Rt,pt+=m*Tt,m=U[1],tt+=m*Dt,nt+=m*Ft,dt+=m*Et,d+=m*At,p+=m*Gt,b+=m*bt,C+=m*xt,O+=m*Bt,N+=m*_t,L+=m*Pt,D+=m*jt,v+=m*$t,T+=m*Nt,ot+=m*le,pt+=m*Rt,A+=m*Tt,m=U[2],nt+=m*Dt,dt+=m*Ft,d+=m*Et,p+=m*At,b+=m*Gt,C+=m*bt,O+=m*xt,N+=m*Bt,L+=m*_t,D+=m*Pt,v+=m*jt,T+=m*$t,ot+=m*Nt,pt+=m*le,A+=m*Rt,rt+=m*Tt,m=U[3],dt+=m*Dt,d+=m*Ft,p+=m*Et,b+=m*At,C+=m*Gt,O+=m*bt,N+=m*xt,L+=m*Bt,D+=m*_t,v+=m*Pt,T+=m*jt,ot+=m*$t,pt+=m*Nt,A+=m*le,rt+=m*Rt,q+=m*Tt,m=U[4],d+=m*Dt,p+=m*Ft,b+=m*Et,C+=m*At,O+=m*Gt,N+=m*bt,L+=m*xt,D+=m*Bt,v+=m*_t,T+=m*Pt,ot+=m*jt,pt+=m*$t,A+=m*Nt,rt+=m*le,q+=m*Rt,H+=m*Tt,m=U[5],p+=m*Dt,b+=m*Ft,C+=m*Et,O+=m*At,N+=m*Gt,L+=m*bt,D+=m*xt,v+=m*Bt,T+=m*_t,ot+=m*Pt,pt+=m*jt,A+=m*$t,rt+=m*Nt,q+=m*le,H+=m*Rt,V+=m*Tt,m=U[6],b+=m*Dt,C+=m*Ft,O+=m*Et,N+=m*At,L+=m*Gt,D+=m*bt,v+=m*xt,T+=m*Bt,ot+=m*_t,pt+=m*Pt,A+=m*jt,rt+=m*$t,q+=m*Nt,H+=m*le,V+=m*Rt,w+=m*Tt,m=U[7],C+=m*Dt,O+=m*Ft,N+=m*Et,L+=m*At,D+=m*Gt,v+=m*bt,T+=m*xt,ot+=m*Bt,pt+=m*_t,A+=m*Pt,rt+=m*jt,q+=m*$t,H+=m*Nt,V+=m*le,w+=m*Rt,k+=m*Tt,m=U[8],O+=m*Dt,N+=m*Ft,L+=m*Et,D+=m*At,v+=m*Gt,T+=m*bt,ot+=m*xt,pt+=m*Bt,A+=m*_t,rt+=m*Pt,q+=m*jt,H+=m*$t,V+=m*Nt,w+=m*le,k+=m*Rt,it+=m*Tt,m=U[9],N+=m*Dt,L+=m*Ft,D+=m*Et,v+=m*At,T+=m*Gt,ot+=m*bt,pt+=m*xt,A+=m*Bt,rt+=m*_t,q+=m*Pt,H+=m*jt,V+=m*$t,w+=m*Nt,k+=m*le,it+=m*Rt,ht+=m*Tt,m=U[10],L+=m*Dt,D+=m*Ft,v+=m*Et,T+=m*At,ot+=m*Gt,pt+=m*bt,A+=m*xt,rt+=m*Bt,q+=m*_t,H+=m*Pt,V+=m*jt,w+=m*$t,k+=m*Nt,it+=m*le,ht+=m*Rt,lt+=m*Tt,m=U[11],D+=m*Dt,v+=m*Ft,T+=m*Et,ot+=m*At,pt+=m*Gt,A+=m*bt,rt+=m*xt,q+=m*Bt,H+=m*_t,V+=m*Pt,w+=m*jt,k+=m*$t,it+=m*Nt,ht+=m*le,lt+=m*Rt,Ot+=m*Tt,m=U[12],v+=m*Dt,T+=m*Ft,ot+=m*Et,pt+=m*At,A+=m*Gt,rt+=m*bt,q+=m*xt,H+=m*Bt,V+=m*_t,w+=m*Pt,k+=m*jt,it+=m*$t,ht+=m*Nt,lt+=m*le,Ot+=m*Rt,Mt+=m*Tt,m=U[13],T+=m*Dt,ot+=m*Ft,pt+=m*Et,A+=m*At,rt+=m*Gt,q+=m*bt,H+=m*xt,V+=m*Bt,w+=m*_t,k+=m*Pt,it+=m*jt,ht+=m*$t,lt+=m*Nt,Ot+=m*le,Mt+=m*Rt,St+=m*Tt,m=U[14],ot+=m*Dt,pt+=m*Ft,A+=m*Et,rt+=m*At,q+=m*Gt,H+=m*bt,V+=m*xt,w+=m*Bt,k+=m*_t,it+=m*Pt,ht+=m*jt,lt+=m*$t,Ot+=m*Nt,Mt+=m*le,St+=m*Rt,Pe+=m*Tt,m=U[15],pt+=m*Dt,A+=m*Ft,rt+=m*Et,q+=m*At,H+=m*Gt,V+=m*bt,w+=m*xt,k+=m*Bt,it+=m*_t,ht+=m*Pt,lt+=m*jt,Ot+=m*$t,Mt+=m*Nt,St+=m*le,Pe+=m*Rt,zt+=m*Tt,et+=38*A,tt+=38*rt,nt+=38*q,dt+=38*H,d+=38*V,p+=38*w,b+=38*k,C+=38*it,O+=38*ht,N+=38*lt,L+=38*Ot,D+=38*Mt,v+=38*St,T+=38*Pe,ot+=38*zt,$=1,m=et+$+65535,$=Math.floor(m/65536),et=m-$*65536,m=tt+$+65535,$=Math.floor(m/65536),tt=m-$*65536,m=nt+$+65535,$=Math.floor(m/65536),nt=m-$*65536,m=dt+$+65535,$=Math.floor(m/65536),dt=m-$*65536,m=d+$+65535,$=Math.floor(m/65536),d=m-$*65536,m=p+$+65535,$=Math.floor(m/65536),p=m-$*65536,m=b+$+65535,$=Math.floor(m/65536),b=m-$*65536,m=C+$+65535,$=Math.floor(m/65536),C=m-$*65536,m=O+$+65535,$=Math.floor(m/65536),O=m-$*65536,m=N+$+65535,$=Math.floor(m/65536),N=m-$*65536,m=L+$+65535,$=Math.floor(m/65536),L=m-$*65536,m=D+$+65535,$=Math.floor(m/65536),D=m-$*65536,m=v+$+65535,$=Math.floor(m/65536),v=m-$*65536,m=T+$+65535,$=Math.floor(m/65536),T=m-$*65536,m=ot+$+65535,$=Math.floor(m/65536),ot=m-$*65536,m=pt+$+65535,$=Math.floor(m/65536),pt=m-$*65536,et+=$-1+37*($-1),$=1,m=et+$+65535,$=Math.floor(m/65536),et=m-$*65536,m=tt+$+65535,$=Math.floor(m/65536),tt=m-$*65536,m=nt+$+65535,$=Math.floor(m/65536),nt=m-$*65536,m=dt+$+65535,$=Math.floor(m/65536),dt=m-$*65536,m=d+$+65535,$=Math.floor(m/65536),d=m-$*65536,m=p+$+65535,$=Math.floor(m/65536),p=m-$*65536,m=b+$+65535,$=Math.floor(m/65536),b=m-$*65536,m=C+$+65535,$=Math.floor(m/65536),C=m-$*65536,m=O+$+65535,$=Math.floor(m/65536),O=m-$*65536,m=N+$+65535,$=Math.floor(m/65536),N=m-$*65536,m=L+$+65535,$=Math.floor(m/65536),L=m-$*65536,m=D+$+65535,$=Math.floor(m/65536),D=m-$*65536,m=v+$+65535,$=Math.floor(m/65536),v=m-$*65536,m=T+$+65535,$=Math.floor(m/65536),T=m-$*65536,m=ot+$+65535,$=Math.floor(m/65536),ot=m-$*65536,m=pt+$+65535,$=Math.floor(m/65536),pt=m-$*65536,et+=$-1+37*($-1),P[0]=et,P[1]=tt,P[2]=nt,P[3]=dt,P[4]=d,P[5]=p,P[6]=b,P[7]=C,P[8]=O,P[9]=N,P[10]=L,P[11]=D,P[12]=v,P[13]=T,P[14]=ot,P[15]=pt}function x(P,U){E(P,U,U)}function I(P,U){const j=n();for(let m=0;m<16;m++)j[m]=U[m];for(let m=253;m>=0;m--)x(j,j),m!==2&&m!==4&&E(j,j,U);for(let m=0;m<16;m++)P[m]=j[m]}function F(P,U){const j=new Uint8Array(32),m=new Float64Array(80),$=n(),et=n(),tt=n(),nt=n(),dt=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,U);for(let O=0;O<16;O++)et[O]=m[O];$[0]=nt[0]=1;for(let O=254;O>=0;--O){const N=j[O>>>3]>>>(O&7)&1;l($,et,N),l(tt,nt,N),g(dt,$,tt),_($,$,tt),g(tt,et,nt),_(et,et,nt),x(nt,dt),x(d,$),E($,tt,$),E(tt,et,dt),g(dt,$,tt),_($,$,tt),x(et,$),_(tt,nt,d),E($,tt,o),g($,$,nt),E(tt,tt,$),E($,nt,d),E(nt,et,m),x(et,dt),l($,et,N),l(tt,nt,N)}for(let O=0;O<16;O++)m[O+16]=$[O],m[O+32]=tt[O],m[O+48]=et[O],m[O+64]=nt[O];const p=m.subarray(32),b=m.subarray(16);I(p,p),E(b,b,p);const C=new Uint8Array(32);return f(C,b),C}e.scalarMult=F;function W(P){return F(P,i)}e.scalarMultBase=W;function Y(P){if(P.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const U=new Uint8Array(P);return{publicKey:W(U),secretKey:U}}e.generateKeyPairFromSeed=Y;function B(P){const U=(0,t.randomBytes)(32,P),j=Y(U);return(0,r.wipe)(U),j}e.generateKeyPair=B;function z(P,U,j=!1){if(P.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(U.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const m=F(P,U);if(j){let $=0;for(let et=0;et<m.length;et++)$|=m[et];if($===0)throw new Error("X25519: invalid shared key")}return m}e.sharedKey=z})(df);function gg(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function mg(e,t){t||(t=e.reduce((i,o)=>i+o.length,0));const r=gg(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}function vg(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const wg=vg("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),pf=vg("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);const t=gg(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),yg={utf8:wg,"utf-8":wg,hex:Uo.base16,latin1:pf,ascii:pf,binary:pf,...Uo};function Gn(e,t="utf8"){const r=yg[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}function Yn(e,t="utf8"){const r=yg[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}const n4={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},i4=":";function Za(e){const[t,r]=e.split(i4);return{namespace:t,reference:r}}function bg(e,t=[]){const r=[];return Object.keys(e).forEach(n=>{if(t.length&&!t.includes(n))return;const i=e[n];r.push(...i.accounts)}),r}function _g(e,t){return e.includes(":")?[e]:t.chains||[]}var s4=Object.defineProperty,Eg=Object.getOwnPropertySymbols,o4=Object.prototype.hasOwnProperty,a4=Object.prototype.propertyIsEnumerable,Ag=(e,t,r)=>t in e?s4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xg=(e,t)=>{for(var r in t||(t={}))o4.call(t,r)&&Ag(e,r,t[r]);if(Eg)for(var r of Eg(t))a4.call(t,r)&&Ag(e,r,t[r]);return e};const c4="ReactNative",gn={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},l4="js";function Xa(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function jo(){return!of()&&!!af()&&navigator.product===c4}function ko(){return!Xa()&&!!af()&&!!of()}function tc(){return jo()?gn.reactNative:Xa()?gn.node:ko()?gn.browser:gn.unknown}function u4(){var e;try{return jo()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function h4(e,t){let r=Qa.parse(e);return r=xg(xg({},r),t),e=Qa.stringify(r),e}function f4(){return ng()||{name:"",description:"",url:"",icons:[""]}}function d4(){if(tc()===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 e=E_();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function p4(){var e;const t=tc();return t===gn.browser?[t,((e=rg())==null?void 0:e.host)||"unknown"].join(":"):t}function g4(e,t,r){const n=d4(),i=p4();return[[e,t].join("-"),[l4,r].join("-"),n,i].join("/")}function m4({protocol:e,version:t,relayUrl:r,sdkVersion:n,auth:i,projectId:o,useOnCloseEvent:c,bundleId:l}){const f=r.split("?"),h=g4(e,t,n),g={auth:i,ua:h,projectId:o,useOnCloseEvent:c||void 0,origin:l||void 0},_=h4(f[1]||"",g);return f[0]+"?"+_}function zs(e,t){return e.filter(r=>t.includes(r)).length===e.length}function Ig(e){return Object.fromEntries(e.entries())}function Sg(e){return new Map(Object.entries(e))}function Hs(e=yt.FIVE_MINUTES,t){const r=yt.toMiliseconds(e||yt.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(t))},r),n=c,i=l})}}function qo(e,t,r){return new Promise(async(n,i)=>{const o=setTimeout(()=>i(new Error(r)),t);try{const c=await e;n(c)}catch(c){i(c)}clearTimeout(o)})}function Cg(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function v4(e){return Cg("topic",e)}function w4(e){return Cg("id",e)}function Dg(e){const[t,r]=e.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof r=="string")n.topic=r;else if(t==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return n}function Or(e,t){return yt.fromMiliseconds((t||Date.now())+yt.toMiliseconds(e))}function cs(e){return Date.now()>=yt.toMiliseconds(e)}function we(e,t){return`${e}${t?`:${t}`:""}`}function Dl(e=[],t=[]){return[...new Set([...e,...t])]}async function y4({id:e,topic:t,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=${e}&sessionTopic=${t}`,c=tc();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 b4(e,t){try{return await e.getItem(t)||(ko()?localStorage.getItem(t):void 0)}catch(r){console.error(r)}}var Og=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _4(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var Pg={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 o=!n&&typeof self=="object",c=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;c?i=ig: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],x=[6,1536,393216,100663296],I=[0,8,16,24],k=[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(A){return Object.prototype.toString.call(A)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(A){return typeof A=="object"&&A.buffer&&A.buffer.constructor===ArrayBuffer});for(var M=function(A,re,q){return function(H){return new N(A,re,A).update(H)[q]()}},U=function(A,re,q){return function(H,V){return new N(A,re,V).update(H)[q]()}},F=function(A,re,q){return function(H,V,w,j){return p["cshake"+A].update(H,V,w,j)[q]()}},m=function(A,re,q){return function(H,V,w,j){return p["kmac"+A].update(H,V,w,j)[q]()}},$=function(A,re,q,H){for(var V=0;V<B.length;++V){var w=B[V];A[w]=re(q,H,w)}return A},te=function(A,re){var q=M(A,re,"hex");return q.create=function(){return new N(A,re,A)},q.update=function(H){return q.create().update(H)},$(q,M,A,re)},ee=function(A,re){var q=U(A,re,"hex");return q.create=function(H){return new N(A,re,H)},q.update=function(H,V){return q.create(V).update(H)},$(q,U,A,re)},ne=function(A,re){var q=z[A],H=F(A,re,"hex");return H.create=function(V,w,j){return!w&&!j?p["shake"+A].create(V):new N(A,re,V).bytepad([w,j],q)},H.update=function(V,w,j,ie){return H.create(w,j,ie).update(V)},$(H,F,A,re)},de=function(A,re){var q=z[A],H=m(A,re,"hex");return H.create=function(V,w,j){return new oe(A,re,w).bytepad(["KMAC",j],q).bytepad([V],q)},H.update=function(V,w,j,ie){return H.create(V,j,ie).update(w)},$(H,m,A,re)},d=[{name:"keccak",padding:E,bits:W,createMethod:te},{name:"sha3",padding:x,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:de}],p={},b=[],D=0;D<d.length;++D)for(var O=d[D],T=O.bits,L=0;L<T.length;++L){var C=O.name+"_"+T[L];if(b.push(C),p[C]=O.createMethod(T[L],O.padding),O.name!=="sha3"){var v=O.name+T[L];b.push(v),p[v]=p[C]}}function N(A,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-(A<<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(A){if(this.finalized)throw new Error(r);var re,q=typeof A;if(q!=="string"){if(q==="object"){if(A===null)throw new Error(e);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(e)}else throw new Error(e);re=!0}for(var H=this.blocks,V=this.byteCount,w=A.length,j=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<j+1;++le)H[le]=0;if(re)for(le=this.start;ie<w&&le<V;++ie)H[le>>2]|=A[ie]<<I[le++&3];else for(le=this.start;ie<w&&le<V;++ie)Oe=A.charCodeAt(ie),Oe<128?H[le>>2]|=Oe<<I[le++&3]:Oe<2048?(H[le>>2]|=(192|Oe>>6)<<I[le++&3],H[le>>2]|=(128|Oe&63)<<I[le++&3]):Oe<55296||Oe>=57344?(H[le>>2]|=(224|Oe>>12)<<I[le++&3],H[le>>2]|=(128|Oe>>6&63)<<I[le++&3],H[le>>2]|=(128|Oe&63)<<I[le++&3]):(Oe=65536+((Oe&1023)<<10|A.charCodeAt(++ie)&1023),H[le>>2]|=(240|Oe>>18)<<I[le++&3],H[le>>2]|=(128|Oe>>12&63)<<I[le++&3],H[le>>2]|=(128|Oe>>6&63)<<I[le++&3],H[le>>2]|=(128|Oe&63)<<I[le++&3]);if(this.lastByteIndex=le,le>=V){for(this.start=le-V,this.block=H[j],le=0;le<j;++le)he[le]^=H[le];pe(he),this.reset=!0}else this.start=le}return this},N.prototype.encode=function(A,re){var q=A&255,H=1,V=[q];for(A=A>>8,q=A&255;q>0;)V.unshift(q),A=A>>8,q=A&255,++H;return re?V.push(H):V.unshift(H),this.update(V),V.length},N.prototype.encodeString=function(A){var re,q=typeof A;if(q!=="string"){if(q==="object"){if(A===null)throw new Error(e);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(e)}else throw new Error(e);re=!0}var H=0,V=A.length;if(re)H=V;else for(var w=0;w<A.length;++w){var j=A.charCodeAt(w);j<128?H+=1:j<2048?H+=2:j<55296||j>=57344?H+=3:(j=65536+((j&1023)<<10|A.charCodeAt(++w)&1023),H+=4)}return H+=this.encode(H*8),this.update(A),H},N.prototype.bytepad=function(A,re){for(var q=this.encode(re),H=0;H<A.length;++H)q+=this.encodeString(A[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 A=this.blocks,re=this.lastByteIndex,q=this.blockCount,H=this.s;if(A[re>>2]|=this.padding[re&3],this.lastByteIndex===this.byteCount)for(A[0]=A[q],re=1;re<q+1;++re)A[re]=0;for(A[q-1]|=2147483648,re=0;re<q;++re)H[re]^=A[re];pe(H)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var A=this.blockCount,re=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,j="",ie;w<q;){for(V=0;V<A&&w<q;++V,++w)ie=re[V],j+=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%A===0&&(pe(re),V=0)}return H&&(ie=re[V],j+=h[ie>>4&15]+h[ie&15],H>1&&(j+=h[ie>>12&15]+h[ie>>8&15]),H>2&&(j+=h[ie>>20&15]+h[ie>>16&15])),j},N.prototype.arrayBuffer=function(){this.finalize();var A=this.blockCount,re=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,j=this.outputBits>>3,ie;H?ie=new ArrayBuffer(q+1<<2):ie=new ArrayBuffer(j);for(var he=new Uint32Array(ie);w<q;){for(V=0;V<A&&w<q;++V,++w)he[w]=re[V];w%A===0&&pe(re)}return H&&(he[V]=re[V],ie=ie.slice(0,j)),ie},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var A=this.blockCount,re=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,j=[],ie,he;w<q;){for(V=0;V<A&&w<q;++V,++w)ie=w<<2,he=re[V],j[ie]=he&255,j[ie+1]=he>>8&255,j[ie+2]=he>>16&255,j[ie+3]=he>>24&255;w%A===0&&pe(re)}return H&&(ie=w<<2,he=re[V],j[ie]=he&255,H>1&&(j[ie+1]=he>>8&255),H>2&&(j[ie+2]=he>>16&255)),j};function oe(A,re,q){N.call(this,A,re,q)}oe.prototype=new N,oe.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var pe=function(A){var re,q,H,V,w,j,ie,he,le,Oe,Pe,Ie,Mt,ze,Ce,Fe,Ee,Ae,Ge,be,xe,Be,_e,Me,je,$e,Te,lt,Re,Ne,nr,dt,Et,ir,St,Ot,Vr,Ye,He,Rt,Qe,Ve,Pt,Xe,et,Lt,tt,Je,Ft,Ze,ke,Ht,rt,jt,ti,kt,vt,Nn,Rn,Ln,Bn,Un,xr;for(H=0;H<48;H+=2)V=A[0]^A[10]^A[20]^A[30]^A[40],w=A[1]^A[11]^A[21]^A[31]^A[41],j=A[2]^A[12]^A[22]^A[32]^A[42],ie=A[3]^A[13]^A[23]^A[33]^A[43],he=A[4]^A[14]^A[24]^A[34]^A[44],le=A[5]^A[15]^A[25]^A[35]^A[45],Oe=A[6]^A[16]^A[26]^A[36]^A[46],Pe=A[7]^A[17]^A[27]^A[37]^A[47],Ie=A[8]^A[18]^A[28]^A[38]^A[48],Mt=A[9]^A[19]^A[29]^A[39]^A[49],re=Ie^(j<<1|ie>>>31),q=Mt^(ie<<1|j>>>31),A[0]^=re,A[1]^=q,A[10]^=re,A[11]^=q,A[20]^=re,A[21]^=q,A[30]^=re,A[31]^=q,A[40]^=re,A[41]^=q,re=V^(he<<1|le>>>31),q=w^(le<<1|he>>>31),A[2]^=re,A[3]^=q,A[12]^=re,A[13]^=q,A[22]^=re,A[23]^=q,A[32]^=re,A[33]^=q,A[42]^=re,A[43]^=q,re=j^(Oe<<1|Pe>>>31),q=ie^(Pe<<1|Oe>>>31),A[4]^=re,A[5]^=q,A[14]^=re,A[15]^=q,A[24]^=re,A[25]^=q,A[34]^=re,A[35]^=q,A[44]^=re,A[45]^=q,re=he^(Ie<<1|Mt>>>31),q=le^(Mt<<1|Ie>>>31),A[6]^=re,A[7]^=q,A[16]^=re,A[17]^=q,A[26]^=re,A[27]^=q,A[36]^=re,A[37]^=q,A[46]^=re,A[47]^=q,re=Oe^(V<<1|w>>>31),q=Pe^(w<<1|V>>>31),A[8]^=re,A[9]^=q,A[18]^=re,A[19]^=q,A[28]^=re,A[29]^=q,A[38]^=re,A[39]^=q,A[48]^=re,A[49]^=q,ze=A[0],Ce=A[1],Lt=A[11]<<4|A[10]>>>28,tt=A[10]<<4|A[11]>>>28,lt=A[20]<<3|A[21]>>>29,Re=A[21]<<3|A[20]>>>29,Ln=A[31]<<9|A[30]>>>23,Bn=A[30]<<9|A[31]>>>23,Ve=A[40]<<18|A[41]>>>14,Pt=A[41]<<18|A[40]>>>14,ir=A[2]<<1|A[3]>>>31,St=A[3]<<1|A[2]>>>31,Fe=A[13]<<12|A[12]>>>20,Ee=A[12]<<12|A[13]>>>20,Je=A[22]<<10|A[23]>>>22,Ft=A[23]<<10|A[22]>>>22,Ne=A[33]<<13|A[32]>>>19,nr=A[32]<<13|A[33]>>>19,Un=A[42]<<2|A[43]>>>30,xr=A[43]<<2|A[42]>>>30,jt=A[5]<<30|A[4]>>>2,ti=A[4]<<30|A[5]>>>2,Ot=A[14]<<6|A[15]>>>26,Vr=A[15]<<6|A[14]>>>26,Ae=A[25]<<11|A[24]>>>21,Ge=A[24]<<11|A[25]>>>21,Ze=A[34]<<15|A[35]>>>17,ke=A[35]<<15|A[34]>>>17,dt=A[45]<<29|A[44]>>>3,Et=A[44]<<29|A[45]>>>3,Me=A[6]<<28|A[7]>>>4,je=A[7]<<28|A[6]>>>4,kt=A[17]<<23|A[16]>>>9,vt=A[16]<<23|A[17]>>>9,Ye=A[26]<<25|A[27]>>>7,He=A[27]<<25|A[26]>>>7,be=A[36]<<21|A[37]>>>11,xe=A[37]<<21|A[36]>>>11,Ht=A[47]<<24|A[46]>>>8,rt=A[46]<<24|A[47]>>>8,Xe=A[8]<<27|A[9]>>>5,et=A[9]<<27|A[8]>>>5,$e=A[18]<<20|A[19]>>>12,Te=A[19]<<20|A[18]>>>12,Nn=A[29]<<7|A[28]>>>25,Rn=A[28]<<7|A[29]>>>25,Rt=A[38]<<8|A[39]>>>24,Qe=A[39]<<8|A[38]>>>24,Be=A[48]<<14|A[49]>>>18,_e=A[49]<<14|A[48]>>>18,A[0]=ze^~Fe&Ae,A[1]=Ce^~Ee&Ge,A[10]=Me^~$e<,A[11]=je^~Te&Re,A[20]=ir^~Ot&Ye,A[21]=St^~Vr&He,A[30]=Xe^~Lt&Je,A[31]=et^~tt&Ft,A[40]=jt^~kt&Nn,A[41]=ti^~vt&Rn,A[2]=Fe^~Ae&be,A[3]=Ee^~Ge&xe,A[12]=$e^~lt&Ne,A[13]=Te^~Re&nr,A[22]=Ot^~Ye&Rt,A[23]=Vr^~He&Qe,A[32]=Lt^~Je&Ze,A[33]=tt^~Ft&ke,A[42]=kt^~Nn&Ln,A[43]=vt^~Rn&Bn,A[4]=Ae^~be&Be,A[5]=Ge^~xe&_e,A[14]=lt^~Ne&dt,A[15]=Re^~nr&Et,A[24]=Ye^~Rt&Ve,A[25]=He^~Qe&Pt,A[34]=Je^~Ze&Ht,A[35]=Ft^~ke&rt,A[44]=Nn^~Ln&Un,A[45]=Rn^~Bn&xr,A[6]=be^~Be&ze,A[7]=xe^~_e&Ce,A[16]=Ne^~dt&Me,A[17]=nr^~Et&je,A[26]=Rt^~Ve&ir,A[27]=Qe^~Pt&St,A[36]=Ze^~Ht&Xe,A[37]=ke^~rt&et,A[46]=Ln^~Un&jt,A[47]=Bn^~xr&ti,A[8]=Be^~ze&Fe,A[9]=_e^~Ce&Ee,A[18]=dt^~Me&$e,A[19]=Et^~je&Te,A[28]=Ve^~ir&Ot,A[29]=Pt^~St&Vr,A[38]=Ht^~Xe&Lt,A[39]=rt^~et&tt,A[48]=Un^~jt&kt,A[49]=xr^~ti&vt,A[0]^=k[H],A[1]^=k[H+1]};if(l)t.exports=p;else for(D=0;D<b.length;++D)i[b[D]]=p[b[D]]})()})(sg);var j8=sg.exports;const k8="logger/5.7.0";let og=!1,ag=!1;const wl={debug:1,default:2,info:2,warning:3,error:4,off:5};let cg=wl.default,tf=null;function q8(){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 lg=q8();var rf;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(rf||(rf={}));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 ug="0123456789abcdef";class ut{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();wl[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(cg>wl[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(ag)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+=ug[h[_]>>4],g+=ug[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 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=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){lg&&this.throwError("platform missing String.prototype.normalize",ut.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:lg})}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 tf||(tf=new ut(k8)),tf}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),og){if(!e)return;this.globalLogger().throwError("error censorship permanent",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ag=!!e,og=!!r}static setLogLevel(e){const r=wl[e.toLowerCase()];if(r==null){ut.globalLogger().warn("invalid log level - "+e);return}cg=r}static from(e){return new ut(e)}}ut.errors=Qn,ut.levels=rf;const z8="bytes/5.7.0",lr=new ut(z8);function hg(t){return!!t.toHexString}function ko(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return ko(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function H8(t){return mn(t)&&!(t.length%2)||qo(t)}function fg(t){return typeof t=="number"&&t==t&&t%1===0}function qo(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!fg(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!fg(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),ko(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),hg(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 ko(new Uint8Array(n))}return qo(t)?ko(new Uint8Array(t)):lr.throwArgumentError("invalid arrayify value","value",t)}function K8(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),ko(n)}function W8(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),ko(r)}function mn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const nf="0123456789abcdef";function kr(t,e){if(e||(e={}),typeof t=="number"){lr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=nf[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),hg(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(qo(t)){let r="0x";for(let n=0;n<t.length;n++){let i=t[n];r+=nf[(i&240)>>4]+nf[i&15]}return r}return lr.throwArgumentError("invalid hexlify value","value",t)}function V8(t){if(typeof t!="string")t=kr(t);else if(!mn(t)||t.length%2)return null;return(t.length-2)/2}function dg(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 pg(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(H8(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=W8(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 sf(t){return"0x"+j8.keccak_256(or(t))}var gg={exports:{}},G8={},Y8=Object.freeze({__proto__:null,default:G8}),Q8=F8(Y8);(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=Q8.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,T,L=0;if(b==="be")for(D=d.length-1,O=0;D>=0;D-=3)T=d[D]|d[D-1]<<8|d[D-2]<<16,this.words[O]|=T<<L&67108863,this.words[O+1]=T>>>26-L&67108863,L+=24,L>=26&&(L-=26,O++);else if(b==="le")for(D=0,O=0;D<d.length;D+=3)T=d[D]|d[D+1]<<8|d[D+2]<<16,this.words[O]|=T<<L&67108863,this.words[O+1]=T>>>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,T=0,L;if(b==="be")for(D=d.length-1;D>=p;D-=2)L=f(d,p,D)<<O,this.words[T]|=L&67108863,O>=18?(O-=18,T+=1,this.words[T]|=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[T]|=L&67108863,O>=18?(O-=18,T+=1,this.words[T]|=L>>>26):O+=8}this._strip()};function h(d,p,b,D){for(var O=0,T=0,L=Math.min(d.length,b),C=p;C<L;C++){var v=d.charCodeAt(C)-48;O*=D,v>=49?T=v-49+10:v>=17?T=v-17+10:T=v,n(v>=0&&T<D,"Invalid character"),O+=T}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 T=d.length-b,L=T%D,C=Math.min(T,T-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"],x=[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];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,T=0;T<this.length;T++){var L=this.words[T],C=((L<<D|O)&16777215).toString(16);O=L>>>24-D&16777215,D+=2,D>=26&&(D-=26,T--),O!==0||T!==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=x[d],N=I[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 k=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 T=k(d,O),L=p==="le"?"LE":"BE";return this["_toArrayLike"+L](T,D),T},o.prototype._toArrayLikeLE=function(d,p){for(var b=0,D=0,O=0,T=0;O<this.length;O++){var L=this.words[O]<<T|D;d[b++]=L&255,b<d.length&&(d[b++]=L>>8&255),b<d.length&&(d[b++]=L>>16&255),T===6?(b<d.length&&(d[b++]=L>>24&255),D=0,T=0):(D=L>>>24,T+=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,T=0;O<this.length;O++){var L=this.words[O]<<T|D;d[b--]=L&255,b>=0&&(d[b--]=L>>8&255),b>=0&&(d[b--]=L>>16&255),T===6?(b>=0&&(d[b--]=L>>24&255),D=0,T=0):(D=L>>>24,T+=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,T=0;T<D.length;T++)p=(b.words[T]|0)+(D.words[T]|0)+O,this.words[T]=p&67108863,O=p>>>26;for(;O!==0&&T<b.length;T++)p=(b.words[T]|0)+O,this.words[T]=p&67108863,O=p>>>26;if(this.length=b.length,O!==0)this.words[this.length]=O,this.length++;else if(b!==this)for(;T<b.length;T++)this.words[T]=b.words[T];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 T=0,L=0;L<O.length;L++)p=(D.words[L]|0)-(O.words[L]|0)+T,T=p>>26,this.words[L]=p&67108863;for(;T!==0&&L<D.length;L++)p=(D.words[L]|0)+T,T=p>>26,this.words[L]=p&67108863;if(T===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,T=p.words[0]|0,L=O*T,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,A=Math.min(N,p.length-1),re=Math.max(0,N-d.length+1);re<=A;re++){var q=N-re|0;O=d.words[q]|0,T=p.words[re]|0,L=O*T+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,T=b.words,L=0,C,v,N,oe=D[0]|0,pe=oe&8191,A=oe>>>13,re=D[1]|0,q=re&8191,H=re>>>13,V=D[2]|0,w=V&8191,j=V>>>13,ie=D[3]|0,he=ie&8191,le=ie>>>13,Oe=D[4]|0,Pe=Oe&8191,Ie=Oe>>>13,Mt=D[5]|0,ze=Mt&8191,Ce=Mt>>>13,Fe=D[6]|0,Ee=Fe&8191,Ae=Fe>>>13,Ge=D[7]|0,be=Ge&8191,xe=Ge>>>13,Be=D[8]|0,_e=Be&8191,Me=Be>>>13,je=D[9]|0,$e=je&8191,Te=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,St=ir&8191,Ot=ir>>>13,Vr=O[3]|0,Ye=Vr&8191,He=Vr>>>13,Rt=O[4]|0,Qe=Rt&8191,Ve=Rt>>>13,Pt=O[5]|0,Xe=Pt&8191,et=Pt>>>13,Lt=O[6]|0,tt=Lt&8191,Je=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(A,Re)|0,N=Math.imul(A,Ne);var Nn=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Nn>>>26)|0,Nn&=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(A,dt)|0,N=N+Math.imul(A,Et)|0;var Rn=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,C=Math.imul(w,Re),v=Math.imul(w,Ne),v=v+Math.imul(j,Re)|0,N=Math.imul(j,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,St)|0,v=v+Math.imul(pe,Ot)|0,v=v+Math.imul(A,St)|0,N=N+Math.imul(A,Ot)|0;var Ln=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Ln>>>26)|0,Ln&=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(j,dt)|0,N=N+Math.imul(j,Et)|0,C=C+Math.imul(q,St)|0,v=v+Math.imul(q,Ot)|0,v=v+Math.imul(H,St)|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(A,Ye)|0,N=N+Math.imul(A,He)|0;var Bn=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,C=Math.imul(Pe,Re),v=Math.imul(Pe,Ne),v=v+Math.imul(Ie,Re)|0,N=Math.imul(Ie,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,St)|0,v=v+Math.imul(w,Ot)|0,v=v+Math.imul(j,St)|0,N=N+Math.imul(j,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,Qe)|0,v=v+Math.imul(pe,Ve)|0,v=v+Math.imul(A,Qe)|0,N=N+Math.imul(A,Ve)|0;var Un=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Un>>>26)|0,Un&=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(Pe,dt)|0,v=v+Math.imul(Pe,Et)|0,v=v+Math.imul(Ie,dt)|0,N=N+Math.imul(Ie,Et)|0,C=C+Math.imul(he,St)|0,v=v+Math.imul(he,Ot)|0,v=v+Math.imul(le,St)|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(j,Ye)|0,N=N+Math.imul(j,He)|0,C=C+Math.imul(q,Qe)|0,v=v+Math.imul(q,Ve)|0,v=v+Math.imul(H,Qe)|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(A,Xe)|0,N=N+Math.imul(A,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(Pe,St)|0,v=v+Math.imul(Pe,Ot)|0,v=v+Math.imul(Ie,St)|0,N=N+Math.imul(Ie,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,Qe)|0,v=v+Math.imul(w,Ve)|0,v=v+Math.imul(j,Qe)|0,N=N+Math.imul(j,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,Je)|0,v=v+Math.imul(A,tt)|0,N=N+Math.imul(A,Je)|0;var Ci=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,C=Math.imul(be,Re),v=Math.imul(be,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,St)|0,v=v+Math.imul(ze,Ot)|0,v=v+Math.imul(Ce,St)|0,N=N+Math.imul(Ce,Ot)|0,C=C+Math.imul(Pe,Ye)|0,v=v+Math.imul(Pe,He)|0,v=v+Math.imul(Ie,Ye)|0,N=N+Math.imul(Ie,He)|0,C=C+Math.imul(he,Qe)|0,v=v+Math.imul(he,Ve)|0,v=v+Math.imul(le,Qe)|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(j,Xe)|0,N=N+Math.imul(j,et)|0,C=C+Math.imul(q,tt)|0,v=v+Math.imul(q,Je)|0,v=v+Math.imul(H,tt)|0,N=N+Math.imul(H,Je)|0,C=C+Math.imul(pe,Ze)|0,v=v+Math.imul(pe,ke)|0,v=v+Math.imul(A,Ze)|0,N=N+Math.imul(A,ke)|0;var fo=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(fo>>>26)|0,fo&=67108863,C=Math.imul(_e,Re),v=Math.imul(_e,Ne),v=v+Math.imul(Me,Re)|0,N=Math.imul(Me,Ne),C=C+Math.imul(be,dt)|0,v=v+Math.imul(be,Et)|0,v=v+Math.imul(xe,dt)|0,N=N+Math.imul(xe,Et)|0,C=C+Math.imul(Ee,St)|0,v=v+Math.imul(Ee,Ot)|0,v=v+Math.imul(Ae,St)|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(Pe,Qe)|0,v=v+Math.imul(Pe,Ve)|0,v=v+Math.imul(Ie,Qe)|0,N=N+Math.imul(Ie,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,Je)|0,v=v+Math.imul(j,tt)|0,N=N+Math.imul(j,Je)|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(A,rt)|0,N=N+Math.imul(A,jt)|0;var Oi=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,C=Math.imul($e,Re),v=Math.imul($e,Ne),v=v+Math.imul(Te,Re)|0,N=Math.imul(Te,Ne),C=C+Math.imul(_e,dt)|0,v=v+Math.imul(_e,Et)|0,v=v+Math.imul(Me,dt)|0,N=N+Math.imul(Me,Et)|0,C=C+Math.imul(be,St)|0,v=v+Math.imul(be,Ot)|0,v=v+Math.imul(xe,St)|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,Qe)|0,v=v+Math.imul(ze,Ve)|0,v=v+Math.imul(Ce,Qe)|0,N=N+Math.imul(Ce,Ve)|0,C=C+Math.imul(Pe,Xe)|0,v=v+Math.imul(Pe,et)|0,v=v+Math.imul(Ie,Xe)|0,N=N+Math.imul(Ie,et)|0,C=C+Math.imul(he,tt)|0,v=v+Math.imul(he,Je)|0,v=v+Math.imul(le,tt)|0,N=N+Math.imul(le,Je)|0,C=C+Math.imul(w,Ze)|0,v=v+Math.imul(w,ke)|0,v=v+Math.imul(j,Ze)|0,N=N+Math.imul(j,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(A,kt)|0,N=N+Math.imul(A,vt)|0;var po=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(po>>>26)|0,po&=67108863,C=Math.imul($e,dt),v=Math.imul($e,Et),v=v+Math.imul(Te,dt)|0,N=Math.imul(Te,Et),C=C+Math.imul(_e,St)|0,v=v+Math.imul(_e,Ot)|0,v=v+Math.imul(Me,St)|0,N=N+Math.imul(Me,Ot)|0,C=C+Math.imul(be,Ye)|0,v=v+Math.imul(be,He)|0,v=v+Math.imul(xe,Ye)|0,N=N+Math.imul(xe,He)|0,C=C+Math.imul(Ee,Qe)|0,v=v+Math.imul(Ee,Ve)|0,v=v+Math.imul(Ae,Qe)|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(Pe,tt)|0,v=v+Math.imul(Pe,Je)|0,v=v+Math.imul(Ie,tt)|0,N=N+Math.imul(Ie,Je)|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(j,rt)|0,N=N+Math.imul(j,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($e,St),v=Math.imul($e,Ot),v=v+Math.imul(Te,St)|0,N=Math.imul(Te,Ot),C=C+Math.imul(_e,Ye)|0,v=v+Math.imul(_e,He)|0,v=v+Math.imul(Me,Ye)|0,N=N+Math.imul(Me,He)|0,C=C+Math.imul(be,Qe)|0,v=v+Math.imul(be,Ve)|0,v=v+Math.imul(xe,Qe)|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,Je)|0,v=v+Math.imul(Ce,tt)|0,N=N+Math.imul(Ce,Je)|0,C=C+Math.imul(Pe,Ze)|0,v=v+Math.imul(Pe,ke)|0,v=v+Math.imul(Ie,Ze)|0,N=N+Math.imul(Ie,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(j,kt)|0,N=N+Math.imul(j,vt)|0;var Mi=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,C=Math.imul($e,Ye),v=Math.imul($e,He),v=v+Math.imul(Te,Ye)|0,N=Math.imul(Te,He),C=C+Math.imul(_e,Qe)|0,v=v+Math.imul(_e,Ve)|0,v=v+Math.imul(Me,Qe)|0,N=N+Math.imul(Me,Ve)|0,C=C+Math.imul(be,Xe)|0,v=v+Math.imul(be,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,Je)|0,v=v+Math.imul(Ae,tt)|0,N=N+Math.imul(Ae,Je)|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(Pe,rt)|0,v=v+Math.imul(Pe,jt)|0,v=v+Math.imul(Ie,rt)|0,N=N+Math.imul(Ie,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 Is=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Is>>>26)|0,Is&=67108863,C=Math.imul($e,Qe),v=Math.imul($e,Ve),v=v+Math.imul(Te,Qe)|0,N=Math.imul(Te,Ve),C=C+Math.imul(_e,Xe)|0,v=v+Math.imul(_e,et)|0,v=v+Math.imul(Me,Xe)|0,N=N+Math.imul(Me,et)|0,C=C+Math.imul(be,tt)|0,v=v+Math.imul(be,Je)|0,v=v+Math.imul(xe,tt)|0,N=N+Math.imul(xe,Je)|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(Pe,kt)|0,v=v+Math.imul(Pe,vt)|0,v=v+Math.imul(Ie,kt)|0,N=N+Math.imul(Ie,vt)|0;var Ds=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(Ds>>>26)|0,Ds&=67108863,C=Math.imul($e,Xe),v=Math.imul($e,et),v=v+Math.imul(Te,Xe)|0,N=Math.imul(Te,et),C=C+Math.imul(_e,tt)|0,v=v+Math.imul(_e,Je)|0,v=v+Math.imul(Me,tt)|0,N=N+Math.imul(Me,Je)|0,C=C+Math.imul(be,Ze)|0,v=v+Math.imul(be,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($e,tt),v=Math.imul($e,Je),v=v+Math.imul(Te,tt)|0,N=Math.imul(Te,Je),C=C+Math.imul(_e,Ze)|0,v=v+Math.imul(_e,ke)|0,v=v+Math.imul(Me,Ze)|0,N=N+Math.imul(Me,ke)|0,C=C+Math.imul(be,rt)|0,v=v+Math.imul(be,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($e,Ze),v=Math.imul($e,ke),v=v+Math.imul(Te,Ze)|0,N=Math.imul(Te,ke),C=C+Math.imul(_e,rt)|0,v=v+Math.imul(_e,jt)|0,v=v+Math.imul(Me,rt)|0,N=N+Math.imul(Me,jt)|0,C=C+Math.imul(be,kt)|0,v=v+Math.imul(be,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($e,rt),v=Math.imul($e,jt),v=v+Math.imul(Te,rt)|0,N=Math.imul(Te,jt),C=C+Math.imul(_e,kt)|0,v=v+Math.imul(_e,vt)|0,v=v+Math.imul(Me,kt)|0,N=N+Math.imul(Me,vt)|0;var wo=(L+C|0)+((v&8191)<<13)|0;L=(N+(v>>>13)|0)+(wo>>>26)|0,wo&=67108863,C=Math.imul($e,kt),v=Math.imul($e,vt),v=v+Math.imul(Te,kt)|0,N=Math.imul(Te,vt);var yo=(L+C|0)+((v&8191)<<13)|0;return L=(N+(v>>>13)|0)+(yo>>>26)|0,yo&=67108863,T[0]=Nn,T[1]=Rn,T[2]=Ln,T[3]=Bn,T[4]=Un,T[5]=xr,T[6]=Ci,T[7]=fo,T[8]=Oi,T[9]=po,T[10]=go,T[11]=Mi,T[12]=Is,T[13]=Ds,T[14]=Gr,T[15]=mo,T[16]=vo,T[17]=wo,T[18]=yo,L!==0&&(T[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,T=0;T<b.length-1;T++){var L=O;O=0;for(var C=D&67108863,v=Math.min(T,p.length-1),N=Math.max(0,T-d.length+1);N<=v;N++){var oe=T-N,pe=d.words[oe]|0,A=p.words[N]|0,re=pe*A,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[T]=C,D=L,L=O}return D!==0?b.words[T]=D:b.length--,b._strip()}function M(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=M(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),M(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,T=(O&67108863)+(b&67108863);b>>=26,b+=O/67108864|0,b+=T>>>26,this.words[D]=T&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 T=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|T,T=L>>>26-p}T&&(this.words[O]=T,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,T=Math.min((d-O)/26,this.length),L=67108863^67108863>>>O<<O,C=b;if(D-=T,D=Math.max(0,D),C){for(var v=0;v<T;v++)C.words[v]=this.words[v];C.length=T}if(T!==0)if(this.length>T)for(this.length-=T,v=0;v<this.length;v++)this.words[v]=this.words[v+T];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 T,L=0;for(O=0;O<d.length;O++){T=(this.words[O+b]|0)+L;var C=(d.words[O]|0)*p;T-=C&67108863,L=(T>>26)-(C/67108864|0),this.words[O+b]=T&67108863}for(;O<this.length-b;O++)T=(this.words[O+b]|0)+L,L=T>>26,this.words[O+b]=T&67108863;if(L===0)return this._strip();for(n(L===-1),L=0,O=0;O<this.length;O++)T=-(this.words[O]|0)+L,L=T>>26,this.words[O]=T&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,p){var b=this.length-d.length,D=this.clone(),O=d,T=O.words[O.length-1]|0,L=this._countBits(T);b=26-L,b!==0&&(O=O.ushln(b),D.iushln(b),T=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 A=(D.words[O.length+pe]|0)*67108864+(D.words[O.length+pe-1]|0);for(A=Math.min(A/T|0,67108863),D._ishlnsubmul(O,A,pe);D.negative!==0;)A--,D.negative=0,D._ishlnsubmul(O,1,pe),D.isZero()||(D.negative^=1);v&&(v.words[pe]=A)}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,T;return this.negative!==0&&d.negative===0?(T=this.neg().divmod(d,p),p!=="mod"&&(D=T.div.neg()),p!=="div"&&(O=T.mod.neg(),b&&O.negative!==0&&O.iadd(d)),{div:D,mod:O}):this.negative===0&&d.negative!==0?(T=this.divmod(d.neg(),p),p!=="mod"&&(D=T.div.neg()),{div:D,mod:T.mod}):this.negative&d.negative?(T=this.neg().divmod(d.neg(),p),p!=="div"&&(O=T.mod.neg(),b&&O.negative!==0&&O.isub(d)),{div:T.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),T=b.cmp(D);return T<0||O===1&&T===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),T=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 A=0,re=1;!(b.words[0]&re)&&A<26;++A,re<<=1);if(A>0)for(b.iushrn(A);A-- >0;)(T.isOdd()||L.isOdd())&&(T.iadd(v),L.isub(N)),T.iushrn(1),L.iushrn(1);p.cmp(b)>=0?(p.isub(b),D.isub(T),O.isub(L)):(b.isub(p),T.isub(D),L.isub(O))}return{a:T,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),T=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(T),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(T),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 T=p;p=b,b=T}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,T=b;O!==0&&T<this.length;T++){var L=this.words[T]|0;L+=O,O=L>>>26,L&=67108863,this.words[T]=L}return O!==0&&(this.words[T]=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 U={k256:null,p224:null,p192:null,p25519:null};function F(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()}F.prototype._tmp=function(){var d=new o(null);return d.words=new Array(Math.ceil(this.n/13)),d},F.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},F.prototype.split=function(d,p){d.iushrn(this.n,0,p)},F.prototype.imulK=function(d){return d.imul(this.k)};function m(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(m,F),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 T=d.words[9];for(p.words[p.length++]=T&b,O=10;O<d.length;O++){var L=d.words[O]|0;d.words[O-10]=(L&b)<<4|T>>>22,T=L}T>>>=22,d.words[O-10]=T,T===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 $(){F.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i($,F);function te(){F.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(te,F);function ee(){F.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ee,F),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(U[d])return U[d];var p;if(d==="k256")p=new m;else if(d==="p224")p=new $;else if(d==="p192")p=new te;else if(d==="p25519")p=new ee;else throw new Error("Unknown prime "+d);return U[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 T=new o(1).toRed(this),L=T.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),A=O;pe.cmp(T)!==0;){for(var re=pe,q=0;re.cmp(T)!==0;q++)re=re.redSqr();n(q<A);var H=this.pow(N,new o(1).iushln(A-q-1));oe=oe.redMul(H),N=H.redSqr(),pe=pe.redMul(N),A=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 T=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(T!==D[0]&&(T=this.sqr(T)),pe===0&&L===0){C=0;continue}L<<=1,L|=pe,C++,!(C!==b&&(O!==0||oe!==0))&&(T=this.mul(T,D[L]),C=0,L=0)}v=26}return T},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 de(d)};function de(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(de,ne),de.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},de.prototype.convertFrom=function(d){var p=this.imod(d.mul(this.rinv));return p.red=null,p},de.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),T=O;return O.cmp(this.m)>=0?T=O.isub(this.m):O.cmpn(0)<0&&(T=O.iadd(this.m)),T._forceRed(this)},de.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),T=O;return O.cmp(this.m)>=0?T=O.isub(this.m):O.cmpn(0)<0&&(T=O.iadd(this.m)),T._forceRed(this)},de.prototype.invm=function(d){var p=this.imod(d._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,ig)})(gg);var st=gg.exports;const mg="bignumber/5.7.0";var yl=st.BN;const Li=new ut(mg),of={},vg=9007199254740991;function J8(t){return t!=null&&(Jt.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||mn(t)||typeof t=="bigint"||qo(t))}let wg=!1;class Jt{constructor(e,r){e!==of&&Li.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 Xr(bt(this).fromTwos(e))}toTwos(e){return Xr(bt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Jt.from(this._hex.substring(1)):this}add(e){return Xr(bt(this).add(bt(e)))}sub(e){return Xr(bt(this).sub(bt(e)))}div(e){return Jt.from(e).isZero()&&In("division-by-zero","div"),Xr(bt(this).div(bt(e)))}mul(e){return Xr(bt(this).mul(bt(e)))}mod(e){const r=bt(e);return r.isNeg()&&In("division-by-zero","mod"),Xr(bt(this).umod(r))}pow(e){const r=bt(e);return r.isNeg()&&In("negative-power","pow"),Xr(bt(this).pow(r))}and(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&In("unbound-bitwise-result","and"),Xr(bt(this).and(r))}or(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&In("unbound-bitwise-result","or"),Xr(bt(this).or(r))}xor(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&In("unbound-bitwise-result","xor"),Xr(bt(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&In("negative-width","mask"),Xr(bt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&In("negative-width","shl"),Xr(bt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&In("negative-width","shr"),Xr(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{In("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Li.throwError("this platform does not support BigInt",ut.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?wg||(wg=!0,Li.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Li.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ut.errors.UNEXPECTED_ARGUMENT,{}):Li.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 Jt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Jt(of,Ga(e)):e.match(/^-?[0-9]+$/)?new Jt(of,Ga(new yl(e))):Li.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&In("underflow","BigNumber.from",e),(e>=vg||e<=-vg)&&In("overflow","BigNumber.from",e),Jt.from(String(e));const r=e;if(typeof r=="bigint")return Jt.from(r.toString());if(qo(r))return Jt.from(kr(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Jt.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 Jt.from(n)}return Li.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Ga(t){if(typeof t!="string")return Ga(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Li.throwArgumentError("invalid hex","value",t),t=Ga(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 Xr(t){return Jt.from(Ga(t))}function bt(t){const e=Jt.from(t).toHexString();return e[0]==="-"?new yl("-"+e.substring(3),16):new yl(e.substring(2),16)}function In(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),Li.throwError(t,ut.errors.NUMERIC_FAULT,n)}function Z8(t){return new yl(t,36).toString(16)}const qr=new ut(mg),Ya={},yg=Jt.from(0),bg=Jt.from(-1);function _g(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 Qa="0";for(;Qa.length<256;)Qa+=Qa;function af(t){if(typeof t!="number")try{t=Jt.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Qa.substring(0,t):qr.throwArgumentError("invalid decimal size","decimals",t)}function cf(t,e){e==null&&(e=0);const r=af(e);t=Jt.from(t);const n=t.lt(yg);n&&(t=t.mul(bg));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 Bi(t,e){e==null&&(e=0);const r=af(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&&_g("fractional component exceeds decimals","underflow","parseFixed"),c===""&&(c="0");c.length<r.length-1;)c+="0";const l=Jt.from(o),f=Jt.from(c);let h=l.mul(r).add(f);return n&&(h=h.mul(bg)),h}class zo{constructor(e,r,n,i){e!==Ya&&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=af(i),Object.freeze(this)}static from(e){if(e instanceof zo)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 zo(Ya,r,n,i)}}class Mr{constructor(e,r,n,i){e!==Ya&&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=Bi(this._value,this.format.decimals),n=Bi(e._value,e.format.decimals);return Mr.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Bi(this._value,this.format.decimals),n=Bi(e._value,e.format.decimals);return Mr.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Bi(this._value,this.format.decimals),n=Bi(e._value,e.format.decimals);return Mr.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Bi(this._value,this.format.decimals),n=Bi(e._value,e.format.decimals);return Mr.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=Mr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Eg.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Mr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Eg.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=Mr.from("1"+Qa.substring(0,e),this.format),i=X8.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=Jt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return ci(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Mr.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!J8(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),Mr.fromString(cf(e,r),zo.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=zo.from(r),i=Bi(e,n.decimals);!n.signed&&i.lt(yg)&&_g("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=cf(i,n.decimals);return new Mr(Ya,o,c,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=zo.from(r);if(or(e).length>n.width/8)throw new Error("overflow");let i=Jt.from(e);n.signed&&(i=i.fromTwos(n.width));const o=i.toTwos((n.signed?0:1)+n.width).toHexString(),c=cf(i,n.decimals);return new Mr(Ya,o,c,n)}static from(e,r){if(typeof e=="string")return Mr.fromString(e,r);if(qo(e))return Mr.fromBytes(e,r);try{return Mr.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 Eg=Mr.from(1),X8=Mr.from("0.5"),e4="strings/5.7.0",Ag=new ut(e4);var bl;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bl||(bl={}));var Ho;(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"})(Ho||(Ho={}));function t4(t,e,r,n,i){return Ag.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function xg(t,e,r,n,i){if(t===Ho.BAD_PREFIX||t===Ho.UNEXPECTED_CONTINUE){let o=0;for(let c=e+1;c<r.length&&r[c]>>6===2;c++)o++;return o}return t===Ho.OVERRUN?r.length-e-1:0}function r4(t,e,r,n,i){return t===Ho.OVERLONG?(n.push(i),0):(n.push(65533),xg(t,e,r))}Object.freeze({error:t4,ignore:xg,replace:r4});function lf(t,e=bl.current){e!=bl.current&&(Ag.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 n4(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 uf(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 Sg(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}})}Sg("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)),uf("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"),uf("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"),uf("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",n4),Sg("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 Ig="hash/5.7.0";function i4(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return or(e)}function Dg(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 s4(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[n[0]]=n[1]}return e}function o4(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let U=1;U<n;U++)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,_),x=E>>>1,I=x>>1,k=E-1;let W=0;for(let U=0;U<_;U++)W=W<<1|g();let Y=[],B=0,z=E;for(;;){let U=Math.floor(((W-B+1)*i-1)/z),F=0,m=n;for(;m-F>1;){let ee=F+m>>>1;U<o[ee]?m=ee:F=ee}if(F==0)break;Y.push(F);let $=B+Math.floor(z*o[F]/i),te=B+Math.floor(z*o[F+1]/i)-1;for(;!(($^te)&x);)W=W<<1&k|g(),$=$<<1&k,te=te<<1&k|1;for(;$&~te&I;)W=W&x|W<<1&k>>>1|g(),$=$<<1^x,te=(te^x)<<1|x|1;B=$,z=1+te-$}let M=n-4;return Y.map(U=>{switch(U-M){case 3:return M+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return M+256+(t[l++]<<8|t[l++]);case 1:return M+t[l++];default:return U-1}})}function a4(t){let e=0;return()=>t[e++]}function c4(t){return a4(o4(t))}function l4(t){return t&1?~t>>1:t>>1}function u4(t,e){let r=Array(t);for(let n=0;n<t;n++)r[n]=1+e();return r}function Cg(t,e){let r=Array(t);for(let n=0,i=-1;n<t;n++)r[n]=i+=1+e();return r}function h4(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=l4(e());return r}function _l(t,e){let r=Cg(t(),t),n=t(),i=Cg(n,t),o=u4(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 f4(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(p4(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(g4(r,t))}return s4(Dg(e))}function d4(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Og(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;i<e;i++)h4(t,r).forEach((o,c)=>n[c].push(o));return n}function p4(t,e){let r=1+e(),n=e(),i=d4(e),o=Og(i.length,1+t,e);return Dg(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(x=>x+E)]})}))}function g4(t,e){let r=1+e();return Og(r,1+t,e).map(n=>[n[0],n.slice(1)])}function m4(t){let e=_l(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let h=_l(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 v4(){return c4(i4("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 El=v4();new Set(_l(El)),new Set(_l(El)),f4(El),m4(El),new ut(Ig),new Uint8Array(32).fill(0);const w4=`Ethereum Signed Message:
|
|
22
|
-
`;function Mg(t){return typeof t=="string"&&(t=lf(t)),sf(K8([lf(w4),lf(String(t.length)),t]))}const y4="rlp/5.7.0";new ut(y4);const b4="address/5.7.0",Ja=new ut(b4);function Pg(t){mn(t,20)||Ja.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(sf(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 _4=9007199254740991;function E4(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const hf={};for(let t=0;t<10;t++)hf[String(t)]=String(t);for(let t=0;t<26;t++)hf[String.fromCharCode(65+t)]=String(10+t);const $g=Math.floor(E4(_4));function A4(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>hf[n]).join("");for(;e.length>=$g;){let n=e.substring(0,$g);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 x4(t){let e=null;if(typeof t!="string"&&Ja.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Pg(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ja.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)!==A4(t)&&Ja.throwArgumentError("bad icap checksum","address",t),e=Z8(t.substring(4));e.length<40;)e="0"+e;e=Pg("0x"+e)}else Ja.throwArgumentError("invalid address","address",t);return e}const S4="properties/5.7.0";new ut(S4);function Za(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new ut(Ig),new Uint8Array(32).fill(0),Jt.from(-1);const I4=Jt.from(0),D4=Jt.from(1);Jt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),ci(D4.toHexString(),32),ci(I4.toHexString(),32);var li={},_t={},Xa=Tg;function Tg(t,e){if(!t)throw new Error(e||"Assertion failed")}Tg.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var ff={exports:{}};typeof Object.create=="function"?ff.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:ff.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 C4=Xa,O4=ff.exports;_t.inherits=O4;function M4(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function P4(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):M4(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=P4;function $4(t){for(var e="",r=0;r<t.length;r++)e+=Rg(t[r].toString(16));return e}_t.toHex=$4;function Ng(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}_t.htonl=Ng;function T4(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];e==="little"&&(i=Ng(i)),r+=Lg(i.toString(16))}return r}_t.toHex32=T4;function Rg(t){return t.length===1?"0"+t:t}_t.zero2=Rg;function Lg(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=Lg;function N4(t,e,r,n){var i=r-e;C4(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=N4;function R4(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=R4;function L4(t,e){return t>>>e|t<<32-e}_t.rotr32=L4;function B4(t,e){return t<<e|t>>>32-e}_t.rotl32=B4;function U4(t,e){return t+e>>>0}_t.sum32=U4;function F4(t,e,r){return t+e+r>>>0}_t.sum32_3=F4;function j4(t,e,r,n){return t+e+r+n>>>0}_t.sum32_4=j4;function k4(t,e,r,n,i){return t+e+r+n+i>>>0}_t.sum32_5=k4;function q4(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=q4;function z4(t,e,r,n){var i=e+n>>>0,o=(i<e?1:0)+t+r;return o>>>0}_t.sum64_hi=z4;function H4(t,e,r,n){var i=e+n;return i>>>0}_t.sum64_lo=H4;function K4(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=K4;function W4(t,e,r,n,i,o,c,l){var f=e+n+o+l;return f>>>0}_t.sum64_4_lo=W4;function V4(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=V4;function G4(t,e,r,n,i,o,c,l,f,h){var g=e+n+o+l+h;return g>>>0}_t.sum64_5_lo=G4;function Y4(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}_t.rotr64_hi=Y4;function Q4(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.rotr64_lo=Q4;function J4(t,e,r){return t>>>r}_t.shr64_hi=J4;function Z4(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.shr64_lo=Z4;var Ko={},Bg=_t,X4=Xa;function Al(){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}Ko.BlockHash=Al,Al.prototype.update=function(t,e){if(t=Bg.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=Bg.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},Al.prototype.digest=function(t){return this.update(this._pad()),X4(this.pending===null),this._digest(t)},Al.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 Wo={},ui={},e_=_t,hi=e_.rotr32;function t_(t,e,r,n){if(t===0)return Ug(e,r,n);if(t===1||t===3)return jg(e,r,n);if(t===2)return Fg(e,r,n)}ui.ft_1=t_;function Ug(t,e,r){return t&e^~t&r}ui.ch32=Ug;function Fg(t,e,r){return t&e^t&r^e&r}ui.maj32=Fg;function jg(t,e,r){return t^e^r}ui.p32=jg;function r_(t){return hi(t,2)^hi(t,13)^hi(t,22)}ui.s0_256=r_;function n_(t){return hi(t,6)^hi(t,11)^hi(t,25)}ui.s1_256=n_;function i_(t){return hi(t,7)^hi(t,18)^t>>>3}ui.g0_256=i_;function s_(t){return hi(t,17)^hi(t,19)^t>>>10}ui.g1_256=s_;var Vo=_t,o_=Ko,a_=ui,df=Vo.rotl32,ec=Vo.sum32,c_=Vo.sum32_5,l_=a_.ft_1,kg=o_.BlockHash,u_=[1518500249,1859775393,2400959708,3395469782];function fi(){if(!(this instanceof fi))return new fi;kg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Vo.inherits(fi,kg);var h_=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]=df(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=c_(df(i,5),l_(h,o,c,l),f,r[n],u_[h]);f=l,l=c,c=df(o,30),o=i,i=g}this.h[0]=ec(this.h[0],i),this.h[1]=ec(this.h[1],o),this.h[2]=ec(this.h[2],c),this.h[3]=ec(this.h[3],l),this.h[4]=ec(this.h[4],f)},fi.prototype._digest=function(t){return t==="hex"?Vo.toHex32(this.h,"big"):Vo.split32(this.h,"big")};var Go=_t,f_=Ko,Yo=ui,d_=Xa,Jn=Go.sum32,p_=Go.sum32_4,g_=Go.sum32_5,m_=Yo.ch32,v_=Yo.maj32,w_=Yo.s0_256,y_=Yo.s1_256,b_=Yo.g0_256,__=Yo.g1_256,qg=f_.BlockHash,E_=[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;qg.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E_,this.W=new Array(64)}Go.inherits(di,qg);var zg=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]=p_(__(r[n-2]),r[n-7],b_(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(d_(this.k.length===r.length),n=0;n<r.length;n++){var E=g_(_,y_(f),m_(f,h,g),this.k[n],r[n]),x=Jn(w_(i),v_(i,o,c));_=g,g=h,h=f,f=Jn(l,E),l=c,c=o,o=i,i=Jn(E,x)}this.h[0]=Jn(this.h[0],i),this.h[1]=Jn(this.h[1],o),this.h[2]=Jn(this.h[2],c),this.h[3]=Jn(this.h[3],l),this.h[4]=Jn(this.h[4],f),this.h[5]=Jn(this.h[5],h),this.h[6]=Jn(this.h[6],g),this.h[7]=Jn(this.h[7],_)},di.prototype._digest=function(t){return t==="hex"?Go.toHex32(this.h,"big"):Go.split32(this.h,"big")};var pf=_t,Hg=zg;function Ui(){if(!(this instanceof Ui))return new Ui;Hg.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}pf.inherits(Ui,Hg);var A_=Ui;Ui.blockSize=512,Ui.outSize=224,Ui.hmacStrength=192,Ui.padLength=64,Ui.prototype._digest=function(t){return t==="hex"?pf.toHex32(this.h.slice(0,7),"big"):pf.split32(this.h.slice(0,7),"big")};var en=_t,x_=Ko,S_=Xa,pi=en.rotr64_hi,gi=en.rotr64_lo,Kg=en.shr64_hi,Wg=en.shr64_lo,as=en.sum64,gf=en.sum64_hi,mf=en.sum64_lo,I_=en.sum64_4_hi,D_=en.sum64_4_lo,C_=en.sum64_5_hi,O_=en.sum64_5_lo,Vg=x_.BlockHash,M_=[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;Vg.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=M_,this.W=new Array(160)}en.inherits(Zn,Vg);var Gg=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=k_(r[n-4],r[n-3]),o=q_(r[n-4],r[n-3]),c=r[n-14],l=r[n-13],f=F_(r[n-30],r[n-29]),h=j_(r[n-30],r[n-29]),g=r[n-32],_=r[n-31];r[n]=I_(i,o,c,l,f,h,g,_),r[n+1]=D_(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],x=this.h[10],I=this.h[11],k=this.h[12],W=this.h[13],Y=this.h[14],B=this.h[15];S_(this.k.length===r.length);for(var z=0;z<r.length;z+=2){var M=Y,U=B,F=B_(_,E),m=U_(_,E),$=P_(_,E,x,I,k),te=$_(_,E,x,I,k,W),ee=this.k[z],ne=this.k[z+1],de=r[z],d=r[z+1],p=C_(M,U,F,m,$,te,ee,ne,de,d),b=O_(M,U,F,m,$,te,ee,ne,de,d);M=R_(n,i),U=L_(n,i),F=T_(n,i,o,c,l),m=N_(n,i,o,c,l,f);var D=gf(M,U,F,m),O=mf(M,U,F,m);Y=k,B=W,k=x,W=I,x=_,I=E,_=gf(h,g,p,b),E=mf(g,g,p,b),h=l,g=f,l=o,f=c,o=n,c=i,n=gf(p,b,D,O),i=mf(p,b,D,O)}as(this.h,0,n,i),as(this.h,2,o,c),as(this.h,4,l,f),as(this.h,6,h,g),as(this.h,8,_,E),as(this.h,10,x,I),as(this.h,12,k,W),as(this.h,14,Y,B)},Zn.prototype._digest=function(t){return t==="hex"?en.toHex32(this.h,"big"):en.split32(this.h,"big")};function P_(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function $_(t,e,r,n,i,o){var c=e&n^~e&o;return c<0&&(c+=4294967296),c}function T_(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function N_(t,e,r,n,i,o){var c=e&n^e&o^n&o;return c<0&&(c+=4294967296),c}function R_(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 L_(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 B_(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 U_(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 F_(t,e){var r=pi(t,e,1),n=pi(t,e,8),i=Kg(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function j_(t,e){var r=gi(t,e,1),n=gi(t,e,8),i=Wg(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function k_(t,e){var r=pi(t,e,19),n=pi(e,t,29),i=Kg(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}function q_(t,e){var r=gi(t,e,19),n=gi(e,t,29),i=Wg(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}var vf=_t,Yg=Gg;function Fi(){if(!(this instanceof Fi))return new Fi;Yg.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}vf.inherits(Fi,Yg);var z_=Fi;Fi.blockSize=1024,Fi.outSize=384,Fi.hmacStrength=192,Fi.padLength=128,Fi.prototype._digest=function(t){return t==="hex"?vf.toHex32(this.h.slice(0,12),"big"):vf.split32(this.h.slice(0,12),"big")},Wo.sha1=h_,Wo.sha224=A_,Wo.sha256=zg,Wo.sha384=z_,Wo.sha512=Gg;var Qg={},zs=_t,H_=Ko,xl=zs.rotl32,Jg=zs.sum32,tc=zs.sum32_3,Zg=zs.sum32_4,Xg=H_.BlockHash;function mi(){if(!(this instanceof mi))return new mi;Xg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}zs.inherits(mi,Xg),Qg.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 x=Jg(xl(Zg(r,em(E,n,i,o),t[V_[E]+e],K_(E)),Y_[E]),c);r=c,c=o,o=xl(i,10),i=n,n=x,x=Jg(xl(Zg(l,em(79-E,f,h,g),t[G_[E]+e],W_(E)),Q_[E]),_),l=_,_=g,g=xl(h,10),h=f,f=x}x=tc(this.h[1],i,g),this.h[1]=tc(this.h[2],o,_),this.h[2]=tc(this.h[3],c,l),this.h[3]=tc(this.h[4],r,f),this.h[4]=tc(this.h[0],n,h),this.h[0]=x},mi.prototype._digest=function(t){return t==="hex"?zs.toHex32(this.h,"little"):zs.split32(this.h,"little")};function em(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 K_(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function W_(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var V_=[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],G_=[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],Y_=[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],Q_=[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],J_=_t,Z_=Xa;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(J_.toArray(e,r))}var X_=Qo;Qo.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),Z_(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=Ko,e.sha=Wo,e.ripemd=Qg,e.hmac=X_,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 eE(n,i??r.path)}},t(r,r.exports),r.exports}function eE(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var wf=tm;function tm(t,e){if(!t)throw new Error(e||"Assertion failed")}tm.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=wf,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,x=f.clone(),I=0;I<_.length;I++){var k,W=x.andln(E-1);x.isOdd()?(W>(E>>1)-1?k=(E>>1)-W:k=W,x.isubn(k)):k=0,_[I]=k,x.iushrn(1)}return _}r.getNAF=n;function i(f,h){var g=[[],[]];f=f.clone(),h=h.clone();for(var _=0,E=0,x;f.cmpn(-_)>0||h.cmpn(-E)>0;){var I=f.andln(3)+_&3,k=h.andln(3)+E&3;I===3&&(I=-1),k===3&&(k=-1);var W;I&1?(x=f.andln(7)+_&7,(x===3||x===5)&&k===2?W=-I:W=I):W=0,g[0].push(W);var Y;k&1?(x=h.andln(7)+E&7,(x===3||x===5)&&I===2?Y=-k:Y=k):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}),Sl=vn.getNAF,tE=vn.getJSF,Il=vn.assert;function cs(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=cs;cs.prototype.point=function(){throw new Error("Not implemented")},cs.prototype.validate=function(){throw new Error("Not implemented")},cs.prototype._fixedNafMul=function(t,e){Il(t.precomputed);var r=t._getDoubles(),n=Sl(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()},cs.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Sl(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];Il(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},cs.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 x=h-1,I=h;if(o[x]!==1||o[I]!==1){l[x]=Sl(r[x],o[x],this._bitLength),l[I]=Sl(r[I],o[I],this._bitLength),f=Math.max(l[x].length,f),f=Math.max(l[I].length,f);continue}var k=[e[x],null,null,e[I]];e[x].y.cmp(e[I].y)===0?(k[1]=e[x].add(e[I]),k[2]=e[x].toJ().mixedAdd(e[I].neg())):e[x].y.cmp(e[I].y.redNeg())===0?(k[1]=e[x].toJ().mixedAdd(e[I]),k[2]=e[x].add(e[I].neg())):(k[1]=e[x].toJ().mixedAdd(e[I]),k[2]=e[x].toJ().mixedAdd(e[I].neg()));var W=[-3,-1,-5,-7,0,7,5,1,3],Y=tE(r[x],r[I]);for(f=Math.max(Y[0].length,f),l[x]=new Array(f),l[I]=new Array(f),g=0;g<f;g++){var B=Y[0][g]|0,z=Y[1][g]|0;l[x][g]=W[(B+1)*3+(z+1)],l[I][g]=0,c[x]=k}}var M=this.jpoint(null,null,null),U=this._wnafT4;for(h=f;h>=0;h--){for(var F=0;h>=0;){var m=!0;for(g=0;g<n;g++)U[g]=l[g][h]|0,U[g]!==0&&(m=!1);if(!m)break;F++,h--}if(h>=0&&F++,M=M.dblp(F),h<0)break;for(g=0;g<n;g++){var $=U[g];$!==0&&($>0?_=c[g][$-1>>1]:$<0&&(_=c[g][-$-1>>1].neg()),_.type==="affine"?M=M.mixedAdd(_):M=M.add(_))}}for(h=0;h<n;h++)c[h]=null;return i?M:M.toP()};function Dn(t,e){this.curve=t,this.type=e,this.precomputed=null}cs.BasePoint=Dn,Dn.prototype.eq=function(){throw new Error("Not implemented")},Dn.prototype.validate=function(){return this.curve.validate(this)},cs.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?Il(t[t.length-1]%2===0):t[0]===7&&Il(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")},Dn.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Dn.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))},Dn.prototype.encode=function(t,e){return vn.encode(this._encode(e),t)},Dn.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},Dn.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},Dn.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}},Dn.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}},Dn.prototype._getBeta=function(){return null},Dn.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var yf=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}}}),rE=vn.assert;function Cn(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)}yf(Cn,Hs);var nE=Cn;Cn.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],rE(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}}},Cn.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]},Cn.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,x,I,k=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=I.neg(),h=i,g=W.neg(),_=Y;else if(g&&++k===2)break;I=W,n=r,r=W,c=i,i=Y,l=o,o=z}E=W.neg(),x=Y;var M=g.sqr().add(_.sqr()),U=E.sqr().add(x.sqr());return U.cmp(M)>=0&&(E=f,x=h),g.negative&&(g=g.neg(),_=_.neg()),E.negative&&(E=E.neg(),x=x.neg()),[{a:g,b:_},{a:E,b:x}]},Cn.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:_}},Cn.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)},Cn.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},Cn.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 _r(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)}yf(_r,Hs.BasePoint),Cn.prototype.point=function(t,e,r){return new _r(this,t,e,r)},Cn.prototype.pointFromJSON=function(t,e){return _r.fromJSON(this,t,e)},_r.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}},_r.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]},_r.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},_r.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)+">"},_r.prototype.isInfinity=function(){return this.inf},_r.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)},_r.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)},_r.prototype.getX=function(){return this.x.fromRed()},_r.prototype.getY=function(){return this.y.fromRed()},_r.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)},_r.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)},_r.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)},_r.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)},_r.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},_r.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}yf(Pr,Hs.BasePoint),Cn.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(_),x=f.redMul(_.redISub(E)).redISub(o.redMul(g)),I=this.z.redMul(t.z).redMul(l);return this.curve.jpoint(E,x,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,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)),x=this.z.redMul(c);return this.curve.jpoint(_,E,x)},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(),x=g.redAdd(g).redIAdd(g).redIAdd(n.redMul(f)),I=o.redMul(_),k=x.redSqr().redISub(I.redAdd(I)),W=I.redISub(k),Y=x.redMul(W);Y=Y.redIAdd(Y).redISub(E);var B=h.redMul(l);e+1<t&&(f=f.redMul(E)),o=k,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(),x=this.x.redAdd(_).redSqr().redISub(g).redISub(E);x=x.redIAdd(x);var I=g.redAdd(g).redIAdd(g),k=I.redSqr(),W=E.redIAdd(E);W=W.redIAdd(W),W=W.redIAdd(W),t=k.redISub(x).redISub(x),e=I.redMul(x.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(_),x=this.x.redSub(g).redMul(this.x.redAdd(g));x=x.redAdd(x).redIAdd(x);var I=E.redIAdd(E);I=I.redIAdd(I);var k=I.redAdd(I);t=x.redSqr().redISub(k),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=x.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(),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 x=l.redMul(_).redISub(E),I=r.redAdd(r).redMul(n);return this.curve.jpoint(g,x,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),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 x=this.z.redAdd(c).redSqr().redISub(r).redISub(l);return this.curve.jpoint(_,E,x)},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 Dl=Jo(function(t,e){var r=e;r.base=Hs,r.short=nE,r.mont=null,r.edwards=null}),Cl=Jo(function(t,e){var r=e,n=vn.assert;function i(l){l.type==="short"?this.curve=new Dl.short(l):l.type==="edwards"?this.curve=new Dl.edwards(l):this.curve=new Dl.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 ls(t){if(!(this instanceof ls))return new ls(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");wf(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var rm=ls;ls.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},ls.prototype._hmac=function(){return new li.hmac(this.hash,this.K)},ls.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())},ls.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),wf(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},ls.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 bf=vn.assert;function Lr(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 _f=Lr;Lr.fromPublic=function(t,e,r){return e instanceof Lr?e:new Lr(t,{pub:e,pubEnc:r})},Lr.fromPrivate=function(t,e,r){return e instanceof Lr?e:new Lr(t,{priv:e,privEnc:r})},Lr.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"}},Lr.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},Lr.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv},Lr.prototype._importPrivate=function(t,e){this.priv=new st(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Lr.prototype._importPublic=function(t,e){if(t.x||t.y){this.ec.curve.type==="mont"?bf(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&bf(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)},Lr.prototype.derive=function(t){return t.validate()||bf(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Lr.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Lr.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Lr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var iE=vn.assert;function Ol(t,e){if(t instanceof Ol)return t;this._importDER(t,e)||(iE(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 Ml=Ol;function sE(){this.place=0}function Ef(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 nm(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)}Ol.prototype._importDER=function(t,e){t=vn.toArray(t,e);var r=new sE;if(t[r.place++]!==48)return!1;var n=Ef(t,r);if(n===!1||n+r.place!==t.length||t[r.place++]!==2)return!1;var i=Ef(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=Ef(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 Af(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)}Ol.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=nm(e),r=nm(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];Af(n,e.length),n=n.concat(e),n.push(2),Af(n,r.length);var i=n.concat(r),o=[48];return Af(o,i.length),o=o.concat(i),vn.encode(o,t)};var oE=function(){throw new Error("unsupported")},im=vn.assert;function On(t){if(!(this instanceof On))return new On(t);typeof t=="string"&&(im(Object.prototype.hasOwnProperty.call(Cl,t),"Unknown curve "+t),t=Cl[t]),t instanceof Cl.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 aE=On;On.prototype.keyPair=function(t){return new _f(this,t)},On.prototype.keyFromPrivate=function(t,e){return _f.fromPrivate(this,t,e)},On.prototype.keyFromPublic=function(t,e){return _f.fromPublic(this,t,e)},On.prototype.genKeyPair=function(t){t||(t={});for(var e=new rm({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||oE(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)}},On.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},On.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 rm({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(),x=E.umod(this.n);if(x.cmpn(0)!==0){var I=g.invm(this.n).mul(x.mul(e.getPrivate()).iadd(t));if(I=I.umod(this.n),I.cmpn(0)!==0){var k=(_.getY().isOdd()?1:0)|(E.cmp(x)!==0?2:0);return n.canonical&&I.cmp(this.nh)>0&&(I=this.n.sub(I),k^=1),new Ml({r:x,s:I,recoveryParam:k})}}}}}},On.prototype.verify=function(t,e,r,n){t=this._truncateToN(new st(t,16)),r=this.keyFromPublic(r,n),e=new Ml(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)},On.prototype.recoverPubKey=function(t,e,r,n){im((3&r)===r,"The recovery param is more than two bits"),e=new Ml(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)},On.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Ml(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 cE=Jo(function(t,e){var r=e;r.version="6.5.4",r.utils=vn,r.rand=function(){throw new Error("unsupported")},r.curve=Dl,r.curves=Cl,r.ec=aE,r.eddsa=null}),lE=cE.ec;const uE="signing-key/5.7.0",xf=new ut(uE);let Sf=null;function vi(){return Sf||(Sf=new lE("secp256k1")),Sf}class hE{constructor(e){Za(this,"curve","secp256k1"),Za(this,"privateKey",kr(e)),V8(this.privateKey)!==32&&xf.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=vi().keyFromPrivate(or(this.privateKey));Za(this,"publicKey","0x"+r.getPublic(!1,"hex")),Za(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),Za(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&&xf.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return pg({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(sm(e)));return ci("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function fE(t,e){const r=pg(e),n={r:or(r.r),s:or(r.s)};return"0x"+vi().recoverPubKey(or(t),n,r.recoveryParam).encode("hex",!1)}function sm(t,e){const r=or(t);if(r.length===32){const n=new hE(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 xf.throwArgumentError("invalid public or private key","key","[REDACTED]")}const dE="transactions/5.7.0";new ut(dE);var om;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(om||(om={}));function pE(t){const e=sm(t);return x4(dg(sf(dg(e,1)),12))}function gE(t,e){return pE(fE(or(t),e))}const mE="https://rpc.walletconnect.com/v1";async function vE(t,e,r,n,i,o){switch(r.t){case"eip191":return wE(t,e,r.s);case"eip1271":return await yE(t,e,r.s,n,i,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function wE(t,e,r){return gE(Mg(e),r).toLowerCase()===t.toLowerCase()}async function yE(t,e,r,n,i,o){try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",f="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),g=Mg(e).substring(2),_=c+g+l+f+h,E=await fetch(`${o||mE}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:bE(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:_},"latest"]})}),{result:x}=await E.json();return x?x.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function bE(){return Date.now()+Math.floor(Math.random()*1e3)}var _E=Object.defineProperty,EE=Object.defineProperties,AE=Object.getOwnPropertyDescriptors,am=Object.getOwnPropertySymbols,xE=Object.prototype.hasOwnProperty,SE=Object.prototype.propertyIsEnumerable,cm=(t,e,r)=>e in t?_E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,IE=(t,e)=>{for(var r in e||(e={}))xE.call(e,r)&&cm(t,r,e[r]);if(am)for(var r of am(e))SE.call(e,r)&&cm(t,r,e[r]);return t},DE=(t,e)=>EE(t,AE(e));const CE="did:pkh:",If=t=>t?.split(":"),lm=t=>{const e=t&&If(t);if(e)return t.includes(CE)?e[3]:e[1]},um=t=>{const e=t&&If(t);if(e)return e[2]+":"+e[3]},Pl=t=>{const e=t&&If(t);if(e)return e.pop()};async function hm(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,o=fm(i,i.iss),c=Pl(i.iss);return await vE(c,o,n,lm(i.iss),r)}const fm=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=Pl(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: ${lm(e)}`,f=`Nonce: ${t.nonce}`,h=`Issued At: ${t.iat}`,g=t.resources?`Resources:${t.resources.map(E=>`
|
|
23
|
-
- ${
|
|
24
|
-
`)};function OE(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function ME(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]:$E(e,r,n)}}}function $E(t,e,r={}){e=e?.sort((i,o)=>i.localeCompare(o));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function dm(t){return Ks(t),`urn:recap:${OE(t).replace(/=/g,"")}`}function rc(t){const e=ME(t.replace("urn:recap:",""));return Ks(e),e}function TE(t,e,r){const n=PE(t,e,r);return dm(n)}function NE(t){return t&&t.includes("urn:recap:")}function RE(t,e){const r=rc(t),n=rc(e),i=LE(r,n);return dm(i)}function LE(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]=DE(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 BE(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 pm(t){var e;const r=rc(t);Ks(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function gm(t){const e=rc(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 $l(t){if(!t)return;const e=t?.[t.length-1];return NE(e)?e:void 0}const mm="base10",zr="base16",Df="base64pad",Cf="utf8",vm=0,ji=1,UE=0,wm=1,Of=12,Mf=32;function FE(){const t=Jh.generateKeyPair();return{privateKey:Yn(t.secretKey,zr),publicKey:Yn(t.publicKey,zr)}}function Pf(){const t=Lo.randomBytes(Mf);return Yn(t,zr)}function jE(t,e){const r=Jh.sharedKey(Gn(t,zr),Gn(e,zr),!0),n=new K6(pl.SHA256,r).expand(Mf);return Yn(n,zr)}function Tl(t){const e=pl.hash(Gn(t,zr));return Yn(e,zr)}function Ws(t){const e=pl.hash(Gn(t,Cf));return Yn(e,zr)}function kE(t){return Gn(`${t}`,mm)}function nc(t){return Number(Yn(t,mm))}function qE(t){const e=kE(typeof t.type<"u"?t.type:vm);if(nc(e)===ji&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Gn(t.senderPublicKey,zr):void 0,n=typeof t.iv<"u"?Gn(t.iv,zr):Lo.randomBytes(Of),i=new Hh.ChaCha20Poly1305(Gn(t.symKey,zr)).seal(n,Gn(t.message,Cf));return HE({type:e,sealed:i,iv:n,senderPublicKey:r})}function zE(t){const e=new Hh.ChaCha20Poly1305(Gn(t.symKey,zr)),{sealed:r,iv:n}=Nl(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Yn(i,Cf)}function HE(t){if(nc(t.type)===ji){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Yn($1([t.type,t.senderPublicKey,t.iv,t.sealed]),Df)}return Yn($1([t.type,t.iv,t.sealed]),Df)}function Nl(t){const e=Gn(t,Df),r=e.slice(UE,wm),n=wm;if(nc(r)===ji){const l=n+Mf,f=l+Of,h=e.slice(n,l),g=e.slice(l,f),_=e.slice(f);return{type:r,sealed:_,iv:g,senderPublicKey:h}}const i=n+Of,o=e.slice(n,i),c=e.slice(i);return{type:r,sealed:c,iv:o}}function KE(t,e){const r=Nl(t);return ym({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Yn(r.senderPublicKey,zr):void 0,receiverPublicKey:e?.receiverPublicKey})}function ym(t){const e=t?.type||vm;if(e===ji){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 bm(t){return t.type===ji&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}const WE="irn";function $f(t){return t?.relay||{protocol:WE}}function ic(t){const e=_8[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var VE=Object.defineProperty,GE=Object.defineProperties,YE=Object.getOwnPropertyDescriptors,_m=Object.getOwnPropertySymbols,QE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,Em=(t,e,r)=>e in t?VE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Am=(t,e)=>{for(var r in e||(e={}))QE.call(e,r)&&Em(t,r,e[r]);if(_m)for(var r of _m(e))JE.call(e,r)&&Em(t,r,e[r]);return t},ZE=(t,e)=>GE(t,YE(e));function XE(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 xm(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=za.parse(o),l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:eA(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:XE(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function eA(t){return t.startsWith("//")?t.substring(2):t}function tA(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 rA(t){return`${t.protocol}:${t.topic}@${t.version}?`+za.stringify(Am(ZE(Am({symKey:t.symKey},tA(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Zo(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function nA(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Zo(r.accounts))}),e}function iA(t,e){const r=[];return Object.values(t).forEach(n=>{Zo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function sA(t,e){const r=[];return Object.values(t).forEach(n=>{Zo(n.accounts).includes(e)&&r.push(...n.events)}),r}function Tf(t){return t.includes(":")}function sc(t){return Tf(t)?t.split(":")[0]:t}function oA(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 Sm(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=oA(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=vl(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const aA={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}},cA={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}=cA[t];return{message:e?`${r} ${e}`:r,code:n}}function Ut(t,e){const{message:r,code:n}=aA[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 oc(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 Nf(t,e){return e&&Hr(t)?!0:typeof t=="number"&&!isNaN(t)}function lA(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=Zo(l),_=r[c];(!ks(Q1(c,_),g)||!ks(_.methods,f)||!ks(_.events,h))&&(o=!1)}),o):!1}function Rl(t){return ur(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function uA(t){if(ur(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Rl(r)}}return!1}function hA(t){if(ur(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function fA(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function dA(t){return t?.topic}function pA(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 Im(t){let e=!0;return wi(t)?t.length&&(e=t.every(r=>ur(r,!1))):e=!1,e}function gA(t,e,r){let n=null;return wi(e)&&e.length?e.forEach(i=>{n||Rl(i)||(n=Ut("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Rl(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 mA(t,e,r){let n=null;return Object.entries(t).forEach(([i,o])=>{if(n)return;const c=gA(i,Q1(i,o),`${e} ${r}`);c&&(n=c)}),n}function vA(t,e){let r=null;return wi(t)?t.forEach(n=>{r||uA(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 wA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=vA(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function yA(t,e){let r=null;return Im(t?.methods)?Im(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 Dm(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=yA(n,`${e}, namespace`);i&&(r=i)}),r}function bA(t,e,r){let n=null;if(t&&oc(t)){const i=Dm(t,e);i&&(n=i);const o=mA(t,e,r);o&&(n=o)}else n=me("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function Rf(t,e){let r=null;if(t&&oc(t)){const n=Dm(t,e);n&&(r=n);const i=wA(t,e);i&&(r=i)}else r=me("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Cm(t){return ur(t.protocol,!0)}function _A(t,e){let r=!1;return e&&!t?r=!0:t&&wi(t)&&t.length&&t.forEach(n=>{r=Cm(n)}),r}function EA(t){return typeof t=="number"}function tn(t){return typeof t<"u"&&typeof t!==null}function AA(t){return!(!t||typeof t!="object"||!t.code||!Nf(t.code,!1)||!t.message||!ur(t.message,!1))}function xA(t){return!(Hr(t)||!ur(t.method,!1))}function SA(t){return!(Hr(t)||Hr(t.result)&&Hr(t.error)||!Nf(t.id,!1)||!ur(t.jsonrpc,!1))}function IA(t){return!(Hr(t)||!ur(t.name,!1))}function Om(t,e){return!(!Rl(e)||!nA(t).includes(e))}function DA(t,e,r){return ur(r,!1)?iA(t,e).includes(r):!1}function CA(t,e,r){return ur(r,!1)?sA(t,e).includes(r):!1}function Mm(t,e,r){let n=null;const i=OA(t),o=MA(e),c=Object.keys(i),l=Object.keys(o),f=Pm(Object.keys(t)),h=Pm(Object.keys(e)),g=f.filter(_=>!h.includes(_));return g.length&&(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
|
|
21
|
+
*/(function(e){(function(){var t="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=Og:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&e.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],x=[6,1536,393216,100663296],I=[0,8,16,24],F=[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(A){return Object.prototype.toString.call(A)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(A){return typeof A=="object"&&A.buffer&&A.buffer.constructor===ArrayBuffer});for(var P=function(A,rt,q){return function(H){return new T(A,rt,A).update(H)[q]()}},U=function(A,rt,q){return function(H,V){return new T(A,rt,V).update(H)[q]()}},j=function(A,rt,q){return function(H,V,w,k){return p["cshake"+A].update(H,V,w,k)[q]()}},m=function(A,rt,q){return function(H,V,w,k){return p["kmac"+A].update(H,V,w,k)[q]()}},$=function(A,rt,q,H){for(var V=0;V<B.length;++V){var w=B[V];A[w]=rt(q,H,w)}return A},et=function(A,rt){var q=P(A,rt,"hex");return q.create=function(){return new T(A,rt,A)},q.update=function(H){return q.create().update(H)},$(q,P,A,rt)},tt=function(A,rt){var q=U(A,rt,"hex");return q.create=function(H){return new T(A,rt,H)},q.update=function(H,V){return q.create(V).update(H)},$(q,U,A,rt)},nt=function(A,rt){var q=z[A],H=j(A,rt,"hex");return H.create=function(V,w,k){return!w&&!k?p["shake"+A].create(V):new T(A,rt,V).bytepad([w,k],q)},H.update=function(V,w,k,it){return H.create(w,k,it).update(V)},$(H,j,A,rt)},dt=function(A,rt){var q=z[A],H=m(A,rt,"hex");return H.create=function(V,w,k){return new ot(A,rt,w).bytepad(["KMAC",k],q).bytepad([V],q)},H.update=function(V,w,k,it){return H.create(V,k,it).update(w)},$(H,m,A,rt)},d=[{name:"keccak",padding:E,bits:W,createMethod:et},{name:"sha3",padding:x,bits:W,createMethod:et},{name:"shake",padding:g,bits:Y,createMethod:tt},{name:"cshake",padding:_,bits:Y,createMethod:nt},{name:"kmac",padding:_,bits:Y,createMethod:dt}],p={},b=[],C=0;C<d.length;++C)for(var O=d[C],N=O.bits,L=0;L<N.length;++L){var D=O.name+"_"+N[L];if(b.push(D),p[D]=O.createMethod(N[L],O.padding),O.name!=="sha3"){var v=O.name+N[L];b.push(v),p[v]=p[D]}}function T(A,rt,q){this.blocks=[],this.s=[],this.padding=rt,this.outputBits=q,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(A<<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}T.prototype.update=function(A){if(this.finalized)throw new Error(r);var rt,q=typeof A;if(q!=="string"){if(q==="object"){if(A===null)throw new Error(t);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(t)}else throw new Error(t);rt=!0}for(var H=this.blocks,V=this.byteCount,w=A.length,k=this.blockCount,it=0,ht=this.s,lt,Ot;it<w;){if(this.reset)for(this.reset=!1,H[0]=this.block,lt=1;lt<k+1;++lt)H[lt]=0;if(rt)for(lt=this.start;it<w&<<V;++it)H[lt>>2]|=A[it]<<I[lt++&3];else for(lt=this.start;it<w&<<V;++it)Ot=A.charCodeAt(it),Ot<128?H[lt>>2]|=Ot<<I[lt++&3]:Ot<2048?(H[lt>>2]|=(192|Ot>>6)<<I[lt++&3],H[lt>>2]|=(128|Ot&63)<<I[lt++&3]):Ot<55296||Ot>=57344?(H[lt>>2]|=(224|Ot>>12)<<I[lt++&3],H[lt>>2]|=(128|Ot>>6&63)<<I[lt++&3],H[lt>>2]|=(128|Ot&63)<<I[lt++&3]):(Ot=65536+((Ot&1023)<<10|A.charCodeAt(++it)&1023),H[lt>>2]|=(240|Ot>>18)<<I[lt++&3],H[lt>>2]|=(128|Ot>>12&63)<<I[lt++&3],H[lt>>2]|=(128|Ot>>6&63)<<I[lt++&3],H[lt>>2]|=(128|Ot&63)<<I[lt++&3]);if(this.lastByteIndex=lt,lt>=V){for(this.start=lt-V,this.block=H[k],lt=0;lt<k;++lt)ht[lt]^=H[lt];pt(ht),this.reset=!0}else this.start=lt}return this},T.prototype.encode=function(A,rt){var q=A&255,H=1,V=[q];for(A=A>>8,q=A&255;q>0;)V.unshift(q),A=A>>8,q=A&255,++H;return rt?V.push(H):V.unshift(H),this.update(V),V.length},T.prototype.encodeString=function(A){var rt,q=typeof A;if(q!=="string"){if(q==="object"){if(A===null)throw new Error(t);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(t)}else throw new Error(t);rt=!0}var H=0,V=A.length;if(rt)H=V;else for(var w=0;w<A.length;++w){var k=A.charCodeAt(w);k<128?H+=1:k<2048?H+=2:k<55296||k>=57344?H+=3:(k=65536+((k&1023)<<10|A.charCodeAt(++w)&1023),H+=4)}return H+=this.encode(H*8),this.update(A),H},T.prototype.bytepad=function(A,rt){for(var q=this.encode(rt),H=0;H<A.length;++H)q+=this.encodeString(A[H]);var V=rt-q%rt,w=[];return w.length=V,this.update(w),this},T.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var A=this.blocks,rt=this.lastByteIndex,q=this.blockCount,H=this.s;if(A[rt>>2]|=this.padding[rt&3],this.lastByteIndex===this.byteCount)for(A[0]=A[q],rt=1;rt<q+1;++rt)A[rt]=0;for(A[q-1]|=2147483648,rt=0;rt<q;++rt)H[rt]^=A[rt];pt(H)}},T.prototype.toString=T.prototype.hex=function(){this.finalize();for(var A=this.blockCount,rt=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,k="",it;w<q;){for(V=0;V<A&&w<q;++V,++w)it=rt[V],k+=h[it>>4&15]+h[it&15]+h[it>>12&15]+h[it>>8&15]+h[it>>20&15]+h[it>>16&15]+h[it>>28&15]+h[it>>24&15];w%A===0&&(pt(rt),V=0)}return H&&(it=rt[V],k+=h[it>>4&15]+h[it&15],H>1&&(k+=h[it>>12&15]+h[it>>8&15]),H>2&&(k+=h[it>>20&15]+h[it>>16&15])),k},T.prototype.arrayBuffer=function(){this.finalize();var A=this.blockCount,rt=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,k=this.outputBits>>3,it;H?it=new ArrayBuffer(q+1<<2):it=new ArrayBuffer(k);for(var ht=new Uint32Array(it);w<q;){for(V=0;V<A&&w<q;++V,++w)ht[w]=rt[V];w%A===0&&pt(rt)}return H&&(ht[V]=rt[V],it=it.slice(0,k)),it},T.prototype.buffer=T.prototype.arrayBuffer,T.prototype.digest=T.prototype.array=function(){this.finalize();for(var A=this.blockCount,rt=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,w=0,k=[],it,ht;w<q;){for(V=0;V<A&&w<q;++V,++w)it=w<<2,ht=rt[V],k[it]=ht&255,k[it+1]=ht>>8&255,k[it+2]=ht>>16&255,k[it+3]=ht>>24&255;w%A===0&&pt(rt)}return H&&(it=w<<2,ht=rt[V],k[it]=ht&255,H>1&&(k[it+1]=ht>>8&255),H>2&&(k[it+2]=ht>>16&255)),k};function ot(A,rt,q){T.call(this,A,rt,q)}ot.prototype=new T,ot.prototype.finalize=function(){return this.encode(this.outputBits,!0),T.prototype.finalize.call(this)};var pt=function(A){var rt,q,H,V,w,k,it,ht,lt,Ot,Mt,St,Pe,zt,Dt,Ft,Et,At,Gt,bt,xt,Bt,_t,Pt,jt,$t,Nt,le,Rt,Tt,nr,de,Ee,ir,Ie,Oe,Vr,Yt,Ht,Re,Qt,Vt,Me,Xt,te,Le,ee,Jt,Fe,Zt,kt,He,re,je,ei,ke,ve,Tn,Rn,Ln,Bn,Un,xr;for(H=0;H<48;H+=2)V=A[0]^A[10]^A[20]^A[30]^A[40],w=A[1]^A[11]^A[21]^A[31]^A[41],k=A[2]^A[12]^A[22]^A[32]^A[42],it=A[3]^A[13]^A[23]^A[33]^A[43],ht=A[4]^A[14]^A[24]^A[34]^A[44],lt=A[5]^A[15]^A[25]^A[35]^A[45],Ot=A[6]^A[16]^A[26]^A[36]^A[46],Mt=A[7]^A[17]^A[27]^A[37]^A[47],St=A[8]^A[18]^A[28]^A[38]^A[48],Pe=A[9]^A[19]^A[29]^A[39]^A[49],rt=St^(k<<1|it>>>31),q=Pe^(it<<1|k>>>31),A[0]^=rt,A[1]^=q,A[10]^=rt,A[11]^=q,A[20]^=rt,A[21]^=q,A[30]^=rt,A[31]^=q,A[40]^=rt,A[41]^=q,rt=V^(ht<<1|lt>>>31),q=w^(lt<<1|ht>>>31),A[2]^=rt,A[3]^=q,A[12]^=rt,A[13]^=q,A[22]^=rt,A[23]^=q,A[32]^=rt,A[33]^=q,A[42]^=rt,A[43]^=q,rt=k^(Ot<<1|Mt>>>31),q=it^(Mt<<1|Ot>>>31),A[4]^=rt,A[5]^=q,A[14]^=rt,A[15]^=q,A[24]^=rt,A[25]^=q,A[34]^=rt,A[35]^=q,A[44]^=rt,A[45]^=q,rt=ht^(St<<1|Pe>>>31),q=lt^(Pe<<1|St>>>31),A[6]^=rt,A[7]^=q,A[16]^=rt,A[17]^=q,A[26]^=rt,A[27]^=q,A[36]^=rt,A[37]^=q,A[46]^=rt,A[47]^=q,rt=Ot^(V<<1|w>>>31),q=Mt^(w<<1|V>>>31),A[8]^=rt,A[9]^=q,A[18]^=rt,A[19]^=q,A[28]^=rt,A[29]^=q,A[38]^=rt,A[39]^=q,A[48]^=rt,A[49]^=q,zt=A[0],Dt=A[1],Le=A[11]<<4|A[10]>>>28,ee=A[10]<<4|A[11]>>>28,le=A[20]<<3|A[21]>>>29,Rt=A[21]<<3|A[20]>>>29,Ln=A[31]<<9|A[30]>>>23,Bn=A[30]<<9|A[31]>>>23,Vt=A[40]<<18|A[41]>>>14,Me=A[41]<<18|A[40]>>>14,ir=A[2]<<1|A[3]>>>31,Ie=A[3]<<1|A[2]>>>31,Ft=A[13]<<12|A[12]>>>20,Et=A[12]<<12|A[13]>>>20,Jt=A[22]<<10|A[23]>>>22,Fe=A[23]<<10|A[22]>>>22,Tt=A[33]<<13|A[32]>>>19,nr=A[32]<<13|A[33]>>>19,Un=A[42]<<2|A[43]>>>30,xr=A[43]<<2|A[42]>>>30,je=A[5]<<30|A[4]>>>2,ei=A[4]<<30|A[5]>>>2,Oe=A[14]<<6|A[15]>>>26,Vr=A[15]<<6|A[14]>>>26,At=A[25]<<11|A[24]>>>21,Gt=A[24]<<11|A[25]>>>21,Zt=A[34]<<15|A[35]>>>17,kt=A[35]<<15|A[34]>>>17,de=A[45]<<29|A[44]>>>3,Ee=A[44]<<29|A[45]>>>3,Pt=A[6]<<28|A[7]>>>4,jt=A[7]<<28|A[6]>>>4,ke=A[17]<<23|A[16]>>>9,ve=A[16]<<23|A[17]>>>9,Yt=A[26]<<25|A[27]>>>7,Ht=A[27]<<25|A[26]>>>7,bt=A[36]<<21|A[37]>>>11,xt=A[37]<<21|A[36]>>>11,He=A[47]<<24|A[46]>>>8,re=A[46]<<24|A[47]>>>8,Xt=A[8]<<27|A[9]>>>5,te=A[9]<<27|A[8]>>>5,$t=A[18]<<20|A[19]>>>12,Nt=A[19]<<20|A[18]>>>12,Tn=A[29]<<7|A[28]>>>25,Rn=A[28]<<7|A[29]>>>25,Re=A[38]<<8|A[39]>>>24,Qt=A[39]<<8|A[38]>>>24,Bt=A[48]<<14|A[49]>>>18,_t=A[49]<<14|A[48]>>>18,A[0]=zt^~Ft&At,A[1]=Dt^~Et&Gt,A[10]=Pt^~$t&le,A[11]=jt^~Nt&Rt,A[20]=ir^~Oe&Yt,A[21]=Ie^~Vr&Ht,A[30]=Xt^~Le&Jt,A[31]=te^~ee&Fe,A[40]=je^~ke&Tn,A[41]=ei^~ve&Rn,A[2]=Ft^~At&bt,A[3]=Et^~Gt&xt,A[12]=$t^~le&Tt,A[13]=Nt^~Rt&nr,A[22]=Oe^~Yt&Re,A[23]=Vr^~Ht&Qt,A[32]=Le^~Jt&Zt,A[33]=ee^~Fe&kt,A[42]=ke^~Tn&Ln,A[43]=ve^~Rn&Bn,A[4]=At^~bt&Bt,A[5]=Gt^~xt&_t,A[14]=le^~Tt&de,A[15]=Rt^~nr&Ee,A[24]=Yt^~Re&Vt,A[25]=Ht^~Qt&Me,A[34]=Jt^~Zt&He,A[35]=Fe^~kt&re,A[44]=Tn^~Ln&Un,A[45]=Rn^~Bn&xr,A[6]=bt^~Bt&zt,A[7]=xt^~_t&Dt,A[16]=Tt^~de&Pt,A[17]=nr^~Ee&jt,A[26]=Re^~Vt&ir,A[27]=Qt^~Me&Ie,A[36]=Zt^~He&Xt,A[37]=kt^~re&te,A[46]=Ln^~Un&je,A[47]=Bn^~xr&ei,A[8]=Bt^~zt&Ft,A[9]=_t^~Dt&Et,A[18]=de^~Pt&$t,A[19]=Ee^~jt&Nt,A[28]=Vt^~ir&Oe,A[29]=Me^~Ie&Vr,A[38]=He^~Xt&Le,A[39]=re^~te&ee,A[48]=Un^~je&ke,A[49]=xr^~ei&ve,A[0]^=F[H],A[1]^=F[H+1]};if(l)e.exports=p;else for(C=0;C<b.length;++C)i[b[C]]=p[b[C]]})()})(Pg);var E4=Pg.exports;const A4="logger/5.7.0";let Mg=!1,$g=!1;const Ol={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ng=Ol.default,gf=null;function x4(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}const Tg=x4();var mf;(function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"})(mf||(mf={}));var Qn;(function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"})(Qn||(Qn={}));const Rg="0123456789abcdef";class ue{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,r){const n=t.toLowerCase();Ol[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(Ng>Ol[n])&&console.log.apply(console,r)}debug(...t){this._log(ue.levels.DEBUG,t)}info(...t){this._log(ue.levels.INFO,t)}warn(...t){this._log(ue.levels.WARNING,t)}makeError(t,r,n){if($g)return this.makeError("censored error",r,{});r||(r=ue.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+=Rg[h[_]>>4],g+=Rg[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=t;let c="";switch(r){case Qn.NUMERIC_FAULT:{c="NUMERIC_FAULT";const f=t;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&&(t+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const l=new Error(t);return l.reason=o,l.code=r,Object.keys(n).forEach(function(f){l[f]=n[f]}),l}throwError(t,r,n){throw this.makeError(t,r,n)}throwArgumentError(t,r,n){return this.throwError(t,ue.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(t,r,n,i){t||this.throwError(r,n,i)}assertArgument(t,r,n,i){t||this.throwArgumentError(r,n,i)}checkNormalize(t){Tg&&this.throwError("platform missing String.prototype.normalize",ue.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Tg})}checkSafeUint53(t,r){typeof t=="number"&&(r==null&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,ue.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,ue.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n?n=": "+n:n="",t<r&&this.throwError("missing argument"+n,ue.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,ue.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){(t===Object||t==null)&&this.throwError("missing new",ue.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",ue.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",ue.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return gf||(gf=new ue(A4)),gf}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",ue.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Mg){if(!t)return;this.globalLogger().throwError("error censorship permanent",ue.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}$g=!!t,Mg=!!r}static setLogLevel(t){const r=Ol[t.toLowerCase()];if(r==null){ue.globalLogger().warn("invalid log level - "+t);return}Ng=r}static from(t){return new ue(t)}}ue.errors=Qn,ue.levels=mf;const I4="bytes/5.7.0",lr=new ue(I4);function Lg(e){return!!e.toHexString}function zo(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return zo(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function S4(e){return mn(e)&&!(e.length%2)||Ho(e)}function Bg(e){return typeof e=="number"&&e==e&&e%1===0}function Ho(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!Bg(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Bg(r)||r<0||r>=256)return!1}return!0}function or(e,t){if(t||(t={}),typeof e=="number"){lr.checkSafeUint53(e,"invalid arrayify value");const r=[];for(;e;)r.unshift(e&255),e=parseInt(String(e/256));return r.length===0&&r.push(0),zo(new Uint8Array(r))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),Lg(e)&&(e=e.toHexString()),mn(e)){let r=e.substring(2);r.length%2&&(t.hexPad==="left"?r="0"+r:t.hexPad==="right"?r+="0":lr.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return zo(new Uint8Array(n))}return Ho(e)?zo(new Uint8Array(e)):lr.throwArgumentError("invalid arrayify value","value",e)}function C4(e){const t=e.map(i=>or(i)),r=t.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return t.reduce((i,o)=>(n.set(o,i),i+o.length),0),zo(n)}function D4(e,t){e=or(e),e.length>t&&lr.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),zo(r)}function mn(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}const vf="0123456789abcdef";function kr(e,t){if(t||(t={}),typeof e=="number"){lr.checkSafeUint53(e,"invalid hexlify value");let r="";for(;e;)r=vf[e&15]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof e=="bigint")return e=e.toString(16),e.length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),Lg(e))return e.toHexString();if(mn(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":lr.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Ho(e)){let r="0x";for(let n=0;n<e.length;n++){let i=e[n];r+=vf[(i&240)>>4]+vf[i&15]}return r}return lr.throwArgumentError("invalid hexlify value","value",e)}function O4(e){if(typeof e!="string")e=kr(e);else if(!mn(e)||e.length%2)return null;return(e.length-2)/2}function Ug(e,t,r){return typeof e!="string"?e=kr(e):(!mn(e)||e.length%2)&&lr.throwArgumentError("invalid hexData","value",e),t=2+2*t,r!=null?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function ui(e,t){for(typeof e!="string"?e=kr(e):mn(e)||lr.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&lr.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Fg(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(S4(e)){let r=or(e);r.length===64?(t.v=27+(r[32]>>7),r[32]&=127,t.r=kr(r.slice(0,32)),t.s=kr(r.slice(32,64))):r.length===65?(t.r=kr(r.slice(0,32)),t.s=kr(r.slice(32,64)),t.v=r[64]):lr.throwArgumentError("invalid signature string","signature",e),t.v<27&&(t.v===0||t.v===1?t.v+=27:lr.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=kr(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,t._vs!=null){const i=D4(or(t._vs),32);t._vs=kr(i);const o=i[0]>=128?1:0;t.recoveryParam==null?t.recoveryParam=o:t.recoveryParam!==o&&lr.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),i[0]&=127;const c=kr(i);t.s==null?t.s=c:t.s!==c&&lr.throwArgumentError("signature v mismatch _vs","signature",e)}if(t.recoveryParam==null)t.v==null?lr.throwArgumentError("signature missing v and recoveryParam","signature",e):t.v===0||t.v===1?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(t.v==null)t.v=27+t.recoveryParam;else{const i=t.v===0||t.v===1?t.v:1-t.v%2;t.recoveryParam!==i&&lr.throwArgumentError("signature recoveryParam mismatch v","signature",e)}t.r==null||!mn(t.r)?lr.throwArgumentError("signature missing or invalid r","signature",e):t.r=ui(t.r,32),t.s==null||!mn(t.s)?lr.throwArgumentError("signature missing or invalid s","signature",e):t.s=ui(t.s,32);const r=or(t.s);r[0]>=128&&lr.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=kr(r);t._vs&&(mn(t._vs)||lr.throwArgumentError("signature invalid _vs","signature",e),t._vs=ui(t._vs,32)),t._vs==null?t._vs=n:t._vs!==n&&lr.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function wf(e){return"0x"+E4.keccak_256(or(e))}var jg={exports:{}},P4={},M4=Object.freeze({__proto__:null,default:P4}),$4=_4(M4);(function(e){(function(t,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 t=="object"?t.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=$4.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 C=0;d[0]==="-"&&(C++,this.negative=1),C<d.length&&(p===16?this._parseHex(d,C,b):(this._parseBase(d,p,C),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 C=0;C<this.length;C++)this.words[C]=0;var O,N,L=0;if(b==="be")for(C=d.length-1,O=0;C>=0;C-=3)N=d[C]|d[C-1]<<8|d[C-2]<<16,this.words[O]|=N<<L&67108863,this.words[O+1]=N>>>26-L&67108863,L+=24,L>=26&&(L-=26,O++);else if(b==="le")for(C=0,O=0;C<d.length;C+=3)N=d[C]|d[C+1]<<8|d[C+2]<<16,this.words[O]|=N<<L&67108863,this.words[O+1]=N>>>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 C=l(d,b);return b-1>=p&&(C|=l(d,b-1)<<4),C}o.prototype._parseHex=function(d,p,b){this.length=Math.ceil((d.length-p)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var O=0,N=0,L;if(b==="be")for(C=d.length-1;C>=p;C-=2)L=f(d,p,C)<<O,this.words[N]|=L&67108863,O>=18?(O-=18,N+=1,this.words[N]|=L>>>26):O+=8;else{var D=d.length-p;for(C=D%2===0?p+1:p;C<d.length;C+=2)L=f(d,p,C)<<O,this.words[N]|=L&67108863,O>=18?(O-=18,N+=1,this.words[N]|=L>>>26):O+=8}this._strip()};function h(d,p,b,C){for(var O=0,N=0,L=Math.min(d.length,b),D=p;D<L;D++){var v=d.charCodeAt(D)-48;O*=C,v>=49?N=v-49+10:v>=17?N=v-17+10:N=v,n(v>=0&&N<C,"Invalid character"),O+=N}return O}o.prototype._parseBase=function(d,p,b){this.words=[0],this.length=1;for(var C=0,O=1;O<=67108863;O*=p)C++;C--,O=O/p|0;for(var N=d.length-b,L=N%C,D=Math.min(N,N-L)+b,v=0,T=b;T<D;T+=C)v=h(d,T,T+C,p),this.imuln(O),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(L!==0){var ot=1;for(v=h(d,T,d.length,p),T=0;T<L;T++)ot*=p;this.imuln(ot),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"],x=[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];o.prototype.toString=function(d,p){d=d||10,p=p|0||1;var b;if(d===16||d==="hex"){b="";for(var C=0,O=0,N=0;N<this.length;N++){var L=this.words[N],D=((L<<C|O)&16777215).toString(16);O=L>>>24-C&16777215,C+=2,C>=26&&(C-=26,N--),O!==0||N!==this.length-1?b=E[6-D.length]+D+b:b=D+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=x[d],T=I[d];b="";var ot=this.clone();for(ot.negative=0;!ot.isZero();){var pt=ot.modrn(T).toString(d);ot=ot.idivn(T),ot.isZero()?b=pt+b:b=E[v-pt.length]+pt+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 F=function(d,p){return d.allocUnsafe?d.allocUnsafe(p):new d(p)};o.prototype.toArrayLike=function(d,p,b){this._strip();var C=this.byteLength(),O=b||Math.max(1,C);n(C<=O,"byte array longer than desired length"),n(O>0,"Requested array length <= 0");var N=F(d,O),L=p==="le"?"LE":"BE";return this["_toArrayLike"+L](N,C),N},o.prototype._toArrayLikeLE=function(d,p){for(var b=0,C=0,O=0,N=0;O<this.length;O++){var L=this.words[O]<<N|C;d[b++]=L&255,b<d.length&&(d[b++]=L>>8&255),b<d.length&&(d[b++]=L>>16&255),N===6?(b<d.length&&(d[b++]=L>>24&255),C=0,N=0):(C=L>>>24,N+=2)}if(b<d.length)for(d[b++]=C;b<d.length;)d[b++]=0},o.prototype._toArrayLikeBE=function(d,p){for(var b=d.length-1,C=0,O=0,N=0;O<this.length;O++){var L=this.words[O]<<N|C;d[b--]=L&255,b>=0&&(d[b--]=L>>8&255),b>=0&&(d[b--]=L>>16&255),N===6?(b>=0&&(d[b--]=L>>24&255),C=0,N=0):(C=L>>>24,N+=2)}if(b>=0)for(d[b--]=C;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 C=b/26|0,O=b%26;p[b]=d.words[C]>>>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 C=0;C<b.length;C++)this.words[C]=p.words[C]^b.words[C];if(this!==p)for(;C<p.length;C++)this.words[C]=p.words[C];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 C=0;C<p;C++)this.words[C]=~this.words[C]&67108863;return b>0&&(this.words[C]=~this.words[C]&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,C=d%26;return this._expand(b+1),p?this.words[b]=this.words[b]|1<<C:this.words[b]=this.words[b]&~(1<<C),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,C;this.length>d.length?(b=this,C=d):(b=d,C=this);for(var O=0,N=0;N<C.length;N++)p=(b.words[N]|0)+(C.words[N]|0)+O,this.words[N]=p&67108863,O=p>>>26;for(;O!==0&&N<b.length;N++)p=(b.words[N]|0)+O,this.words[N]=p&67108863,O=p>>>26;if(this.length=b.length,O!==0)this.words[this.length]=O,this.length++;else if(b!==this)for(;N<b.length;N++)this.words[N]=b.words[N];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 C,O;b>0?(C=this,O=d):(C=d,O=this);for(var N=0,L=0;L<O.length;L++)p=(C.words[L]|0)-(O.words[L]|0)+N,N=p>>26,this.words[L]=p&67108863;for(;N!==0&&L<C.length;L++)p=(C.words[L]|0)+N,N=p>>26,this.words[L]=p&67108863;if(N===0&&L<C.length&&C!==this)for(;L<C.length;L++)this.words[L]=C.words[L];return this.length=Math.max(this.length,L),C!==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 C=d.length+p.length|0;b.length=C,C=C-1|0;var O=d.words[0]|0,N=p.words[0]|0,L=O*N,D=L&67108863,v=L/67108864|0;b.words[0]=D;for(var T=1;T<C;T++){for(var ot=v>>>26,pt=v&67108863,A=Math.min(T,p.length-1),rt=Math.max(0,T-d.length+1);rt<=A;rt++){var q=T-rt|0;O=d.words[q]|0,N=p.words[rt]|0,L=O*N+pt,ot+=L/67108864|0,pt=L&67108863}b.words[T]=pt|0,v=ot|0}return v!==0?b.words[T]=v|0:b.length--,b._strip()}var B=function(d,p,b){var C=d.words,O=p.words,N=b.words,L=0,D,v,T,ot=C[0]|0,pt=ot&8191,A=ot>>>13,rt=C[1]|0,q=rt&8191,H=rt>>>13,V=C[2]|0,w=V&8191,k=V>>>13,it=C[3]|0,ht=it&8191,lt=it>>>13,Ot=C[4]|0,Mt=Ot&8191,St=Ot>>>13,Pe=C[5]|0,zt=Pe&8191,Dt=Pe>>>13,Ft=C[6]|0,Et=Ft&8191,At=Ft>>>13,Gt=C[7]|0,bt=Gt&8191,xt=Gt>>>13,Bt=C[8]|0,_t=Bt&8191,Pt=Bt>>>13,jt=C[9]|0,$t=jt&8191,Nt=jt>>>13,le=O[0]|0,Rt=le&8191,Tt=le>>>13,nr=O[1]|0,de=nr&8191,Ee=nr>>>13,ir=O[2]|0,Ie=ir&8191,Oe=ir>>>13,Vr=O[3]|0,Yt=Vr&8191,Ht=Vr>>>13,Re=O[4]|0,Qt=Re&8191,Vt=Re>>>13,Me=O[5]|0,Xt=Me&8191,te=Me>>>13,Le=O[6]|0,ee=Le&8191,Jt=Le>>>13,Fe=O[7]|0,Zt=Fe&8191,kt=Fe>>>13,He=O[8]|0,re=He&8191,je=He>>>13,ei=O[9]|0,ke=ei&8191,ve=ei>>>13;b.negative=d.negative^p.negative,b.length=19,D=Math.imul(pt,Rt),v=Math.imul(pt,Tt),v=v+Math.imul(A,Rt)|0,T=Math.imul(A,Tt);var Tn=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,D=Math.imul(q,Rt),v=Math.imul(q,Tt),v=v+Math.imul(H,Rt)|0,T=Math.imul(H,Tt),D=D+Math.imul(pt,de)|0,v=v+Math.imul(pt,Ee)|0,v=v+Math.imul(A,de)|0,T=T+Math.imul(A,Ee)|0;var Rn=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,D=Math.imul(w,Rt),v=Math.imul(w,Tt),v=v+Math.imul(k,Rt)|0,T=Math.imul(k,Tt),D=D+Math.imul(q,de)|0,v=v+Math.imul(q,Ee)|0,v=v+Math.imul(H,de)|0,T=T+Math.imul(H,Ee)|0,D=D+Math.imul(pt,Ie)|0,v=v+Math.imul(pt,Oe)|0,v=v+Math.imul(A,Ie)|0,T=T+Math.imul(A,Oe)|0;var Ln=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,D=Math.imul(ht,Rt),v=Math.imul(ht,Tt),v=v+Math.imul(lt,Rt)|0,T=Math.imul(lt,Tt),D=D+Math.imul(w,de)|0,v=v+Math.imul(w,Ee)|0,v=v+Math.imul(k,de)|0,T=T+Math.imul(k,Ee)|0,D=D+Math.imul(q,Ie)|0,v=v+Math.imul(q,Oe)|0,v=v+Math.imul(H,Ie)|0,T=T+Math.imul(H,Oe)|0,D=D+Math.imul(pt,Yt)|0,v=v+Math.imul(pt,Ht)|0,v=v+Math.imul(A,Yt)|0,T=T+Math.imul(A,Ht)|0;var Bn=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,D=Math.imul(Mt,Rt),v=Math.imul(Mt,Tt),v=v+Math.imul(St,Rt)|0,T=Math.imul(St,Tt),D=D+Math.imul(ht,de)|0,v=v+Math.imul(ht,Ee)|0,v=v+Math.imul(lt,de)|0,T=T+Math.imul(lt,Ee)|0,D=D+Math.imul(w,Ie)|0,v=v+Math.imul(w,Oe)|0,v=v+Math.imul(k,Ie)|0,T=T+Math.imul(k,Oe)|0,D=D+Math.imul(q,Yt)|0,v=v+Math.imul(q,Ht)|0,v=v+Math.imul(H,Yt)|0,T=T+Math.imul(H,Ht)|0,D=D+Math.imul(pt,Qt)|0,v=v+Math.imul(pt,Vt)|0,v=v+Math.imul(A,Qt)|0,T=T+Math.imul(A,Vt)|0;var Un=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Un>>>26)|0,Un&=67108863,D=Math.imul(zt,Rt),v=Math.imul(zt,Tt),v=v+Math.imul(Dt,Rt)|0,T=Math.imul(Dt,Tt),D=D+Math.imul(Mt,de)|0,v=v+Math.imul(Mt,Ee)|0,v=v+Math.imul(St,de)|0,T=T+Math.imul(St,Ee)|0,D=D+Math.imul(ht,Ie)|0,v=v+Math.imul(ht,Oe)|0,v=v+Math.imul(lt,Ie)|0,T=T+Math.imul(lt,Oe)|0,D=D+Math.imul(w,Yt)|0,v=v+Math.imul(w,Ht)|0,v=v+Math.imul(k,Yt)|0,T=T+Math.imul(k,Ht)|0,D=D+Math.imul(q,Qt)|0,v=v+Math.imul(q,Vt)|0,v=v+Math.imul(H,Qt)|0,T=T+Math.imul(H,Vt)|0,D=D+Math.imul(pt,Xt)|0,v=v+Math.imul(pt,te)|0,v=v+Math.imul(A,Xt)|0,T=T+Math.imul(A,te)|0;var xr=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(xr>>>26)|0,xr&=67108863,D=Math.imul(Et,Rt),v=Math.imul(Et,Tt),v=v+Math.imul(At,Rt)|0,T=Math.imul(At,Tt),D=D+Math.imul(zt,de)|0,v=v+Math.imul(zt,Ee)|0,v=v+Math.imul(Dt,de)|0,T=T+Math.imul(Dt,Ee)|0,D=D+Math.imul(Mt,Ie)|0,v=v+Math.imul(Mt,Oe)|0,v=v+Math.imul(St,Ie)|0,T=T+Math.imul(St,Oe)|0,D=D+Math.imul(ht,Yt)|0,v=v+Math.imul(ht,Ht)|0,v=v+Math.imul(lt,Yt)|0,T=T+Math.imul(lt,Ht)|0,D=D+Math.imul(w,Qt)|0,v=v+Math.imul(w,Vt)|0,v=v+Math.imul(k,Qt)|0,T=T+Math.imul(k,Vt)|0,D=D+Math.imul(q,Xt)|0,v=v+Math.imul(q,te)|0,v=v+Math.imul(H,Xt)|0,T=T+Math.imul(H,te)|0,D=D+Math.imul(pt,ee)|0,v=v+Math.imul(pt,Jt)|0,v=v+Math.imul(A,ee)|0,T=T+Math.imul(A,Jt)|0;var Pi=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,D=Math.imul(bt,Rt),v=Math.imul(bt,Tt),v=v+Math.imul(xt,Rt)|0,T=Math.imul(xt,Tt),D=D+Math.imul(Et,de)|0,v=v+Math.imul(Et,Ee)|0,v=v+Math.imul(At,de)|0,T=T+Math.imul(At,Ee)|0,D=D+Math.imul(zt,Ie)|0,v=v+Math.imul(zt,Oe)|0,v=v+Math.imul(Dt,Ie)|0,T=T+Math.imul(Dt,Oe)|0,D=D+Math.imul(Mt,Yt)|0,v=v+Math.imul(Mt,Ht)|0,v=v+Math.imul(St,Yt)|0,T=T+Math.imul(St,Ht)|0,D=D+Math.imul(ht,Qt)|0,v=v+Math.imul(ht,Vt)|0,v=v+Math.imul(lt,Qt)|0,T=T+Math.imul(lt,Vt)|0,D=D+Math.imul(w,Xt)|0,v=v+Math.imul(w,te)|0,v=v+Math.imul(k,Xt)|0,T=T+Math.imul(k,te)|0,D=D+Math.imul(q,ee)|0,v=v+Math.imul(q,Jt)|0,v=v+Math.imul(H,ee)|0,T=T+Math.imul(H,Jt)|0,D=D+Math.imul(pt,Zt)|0,v=v+Math.imul(pt,kt)|0,v=v+Math.imul(A,Zt)|0,T=T+Math.imul(A,kt)|0;var fo=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(fo>>>26)|0,fo&=67108863,D=Math.imul(_t,Rt),v=Math.imul(_t,Tt),v=v+Math.imul(Pt,Rt)|0,T=Math.imul(Pt,Tt),D=D+Math.imul(bt,de)|0,v=v+Math.imul(bt,Ee)|0,v=v+Math.imul(xt,de)|0,T=T+Math.imul(xt,Ee)|0,D=D+Math.imul(Et,Ie)|0,v=v+Math.imul(Et,Oe)|0,v=v+Math.imul(At,Ie)|0,T=T+Math.imul(At,Oe)|0,D=D+Math.imul(zt,Yt)|0,v=v+Math.imul(zt,Ht)|0,v=v+Math.imul(Dt,Yt)|0,T=T+Math.imul(Dt,Ht)|0,D=D+Math.imul(Mt,Qt)|0,v=v+Math.imul(Mt,Vt)|0,v=v+Math.imul(St,Qt)|0,T=T+Math.imul(St,Vt)|0,D=D+Math.imul(ht,Xt)|0,v=v+Math.imul(ht,te)|0,v=v+Math.imul(lt,Xt)|0,T=T+Math.imul(lt,te)|0,D=D+Math.imul(w,ee)|0,v=v+Math.imul(w,Jt)|0,v=v+Math.imul(k,ee)|0,T=T+Math.imul(k,Jt)|0,D=D+Math.imul(q,Zt)|0,v=v+Math.imul(q,kt)|0,v=v+Math.imul(H,Zt)|0,T=T+Math.imul(H,kt)|0,D=D+Math.imul(pt,re)|0,v=v+Math.imul(pt,je)|0,v=v+Math.imul(A,re)|0,T=T+Math.imul(A,je)|0;var Mi=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,D=Math.imul($t,Rt),v=Math.imul($t,Tt),v=v+Math.imul(Nt,Rt)|0,T=Math.imul(Nt,Tt),D=D+Math.imul(_t,de)|0,v=v+Math.imul(_t,Ee)|0,v=v+Math.imul(Pt,de)|0,T=T+Math.imul(Pt,Ee)|0,D=D+Math.imul(bt,Ie)|0,v=v+Math.imul(bt,Oe)|0,v=v+Math.imul(xt,Ie)|0,T=T+Math.imul(xt,Oe)|0,D=D+Math.imul(Et,Yt)|0,v=v+Math.imul(Et,Ht)|0,v=v+Math.imul(At,Yt)|0,T=T+Math.imul(At,Ht)|0,D=D+Math.imul(zt,Qt)|0,v=v+Math.imul(zt,Vt)|0,v=v+Math.imul(Dt,Qt)|0,T=T+Math.imul(Dt,Vt)|0,D=D+Math.imul(Mt,Xt)|0,v=v+Math.imul(Mt,te)|0,v=v+Math.imul(St,Xt)|0,T=T+Math.imul(St,te)|0,D=D+Math.imul(ht,ee)|0,v=v+Math.imul(ht,Jt)|0,v=v+Math.imul(lt,ee)|0,T=T+Math.imul(lt,Jt)|0,D=D+Math.imul(w,Zt)|0,v=v+Math.imul(w,kt)|0,v=v+Math.imul(k,Zt)|0,T=T+Math.imul(k,kt)|0,D=D+Math.imul(q,re)|0,v=v+Math.imul(q,je)|0,v=v+Math.imul(H,re)|0,T=T+Math.imul(H,je)|0,D=D+Math.imul(pt,ke)|0,v=v+Math.imul(pt,ve)|0,v=v+Math.imul(A,ke)|0,T=T+Math.imul(A,ve)|0;var po=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(po>>>26)|0,po&=67108863,D=Math.imul($t,de),v=Math.imul($t,Ee),v=v+Math.imul(Nt,de)|0,T=Math.imul(Nt,Ee),D=D+Math.imul(_t,Ie)|0,v=v+Math.imul(_t,Oe)|0,v=v+Math.imul(Pt,Ie)|0,T=T+Math.imul(Pt,Oe)|0,D=D+Math.imul(bt,Yt)|0,v=v+Math.imul(bt,Ht)|0,v=v+Math.imul(xt,Yt)|0,T=T+Math.imul(xt,Ht)|0,D=D+Math.imul(Et,Qt)|0,v=v+Math.imul(Et,Vt)|0,v=v+Math.imul(At,Qt)|0,T=T+Math.imul(At,Vt)|0,D=D+Math.imul(zt,Xt)|0,v=v+Math.imul(zt,te)|0,v=v+Math.imul(Dt,Xt)|0,T=T+Math.imul(Dt,te)|0,D=D+Math.imul(Mt,ee)|0,v=v+Math.imul(Mt,Jt)|0,v=v+Math.imul(St,ee)|0,T=T+Math.imul(St,Jt)|0,D=D+Math.imul(ht,Zt)|0,v=v+Math.imul(ht,kt)|0,v=v+Math.imul(lt,Zt)|0,T=T+Math.imul(lt,kt)|0,D=D+Math.imul(w,re)|0,v=v+Math.imul(w,je)|0,v=v+Math.imul(k,re)|0,T=T+Math.imul(k,je)|0,D=D+Math.imul(q,ke)|0,v=v+Math.imul(q,ve)|0,v=v+Math.imul(H,ke)|0,T=T+Math.imul(H,ve)|0;var go=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(go>>>26)|0,go&=67108863,D=Math.imul($t,Ie),v=Math.imul($t,Oe),v=v+Math.imul(Nt,Ie)|0,T=Math.imul(Nt,Oe),D=D+Math.imul(_t,Yt)|0,v=v+Math.imul(_t,Ht)|0,v=v+Math.imul(Pt,Yt)|0,T=T+Math.imul(Pt,Ht)|0,D=D+Math.imul(bt,Qt)|0,v=v+Math.imul(bt,Vt)|0,v=v+Math.imul(xt,Qt)|0,T=T+Math.imul(xt,Vt)|0,D=D+Math.imul(Et,Xt)|0,v=v+Math.imul(Et,te)|0,v=v+Math.imul(At,Xt)|0,T=T+Math.imul(At,te)|0,D=D+Math.imul(zt,ee)|0,v=v+Math.imul(zt,Jt)|0,v=v+Math.imul(Dt,ee)|0,T=T+Math.imul(Dt,Jt)|0,D=D+Math.imul(Mt,Zt)|0,v=v+Math.imul(Mt,kt)|0,v=v+Math.imul(St,Zt)|0,T=T+Math.imul(St,kt)|0,D=D+Math.imul(ht,re)|0,v=v+Math.imul(ht,je)|0,v=v+Math.imul(lt,re)|0,T=T+Math.imul(lt,je)|0,D=D+Math.imul(w,ke)|0,v=v+Math.imul(w,ve)|0,v=v+Math.imul(k,ke)|0,T=T+Math.imul(k,ve)|0;var $i=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+($i>>>26)|0,$i&=67108863,D=Math.imul($t,Yt),v=Math.imul($t,Ht),v=v+Math.imul(Nt,Yt)|0,T=Math.imul(Nt,Ht),D=D+Math.imul(_t,Qt)|0,v=v+Math.imul(_t,Vt)|0,v=v+Math.imul(Pt,Qt)|0,T=T+Math.imul(Pt,Vt)|0,D=D+Math.imul(bt,Xt)|0,v=v+Math.imul(bt,te)|0,v=v+Math.imul(xt,Xt)|0,T=T+Math.imul(xt,te)|0,D=D+Math.imul(Et,ee)|0,v=v+Math.imul(Et,Jt)|0,v=v+Math.imul(At,ee)|0,T=T+Math.imul(At,Jt)|0,D=D+Math.imul(zt,Zt)|0,v=v+Math.imul(zt,kt)|0,v=v+Math.imul(Dt,Zt)|0,T=T+Math.imul(Dt,kt)|0,D=D+Math.imul(Mt,re)|0,v=v+Math.imul(Mt,je)|0,v=v+Math.imul(St,re)|0,T=T+Math.imul(St,je)|0,D=D+Math.imul(ht,ke)|0,v=v+Math.imul(ht,ve)|0,v=v+Math.imul(lt,ke)|0,T=T+Math.imul(lt,ve)|0;var Ss=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Ss>>>26)|0,Ss&=67108863,D=Math.imul($t,Qt),v=Math.imul($t,Vt),v=v+Math.imul(Nt,Qt)|0,T=Math.imul(Nt,Vt),D=D+Math.imul(_t,Xt)|0,v=v+Math.imul(_t,te)|0,v=v+Math.imul(Pt,Xt)|0,T=T+Math.imul(Pt,te)|0,D=D+Math.imul(bt,ee)|0,v=v+Math.imul(bt,Jt)|0,v=v+Math.imul(xt,ee)|0,T=T+Math.imul(xt,Jt)|0,D=D+Math.imul(Et,Zt)|0,v=v+Math.imul(Et,kt)|0,v=v+Math.imul(At,Zt)|0,T=T+Math.imul(At,kt)|0,D=D+Math.imul(zt,re)|0,v=v+Math.imul(zt,je)|0,v=v+Math.imul(Dt,re)|0,T=T+Math.imul(Dt,je)|0,D=D+Math.imul(Mt,ke)|0,v=v+Math.imul(Mt,ve)|0,v=v+Math.imul(St,ke)|0,T=T+Math.imul(St,ve)|0;var Cs=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Cs>>>26)|0,Cs&=67108863,D=Math.imul($t,Xt),v=Math.imul($t,te),v=v+Math.imul(Nt,Xt)|0,T=Math.imul(Nt,te),D=D+Math.imul(_t,ee)|0,v=v+Math.imul(_t,Jt)|0,v=v+Math.imul(Pt,ee)|0,T=T+Math.imul(Pt,Jt)|0,D=D+Math.imul(bt,Zt)|0,v=v+Math.imul(bt,kt)|0,v=v+Math.imul(xt,Zt)|0,T=T+Math.imul(xt,kt)|0,D=D+Math.imul(Et,re)|0,v=v+Math.imul(Et,je)|0,v=v+Math.imul(At,re)|0,T=T+Math.imul(At,je)|0,D=D+Math.imul(zt,ke)|0,v=v+Math.imul(zt,ve)|0,v=v+Math.imul(Dt,ke)|0,T=T+Math.imul(Dt,ve)|0;var Gr=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,D=Math.imul($t,ee),v=Math.imul($t,Jt),v=v+Math.imul(Nt,ee)|0,T=Math.imul(Nt,Jt),D=D+Math.imul(_t,Zt)|0,v=v+Math.imul(_t,kt)|0,v=v+Math.imul(Pt,Zt)|0,T=T+Math.imul(Pt,kt)|0,D=D+Math.imul(bt,re)|0,v=v+Math.imul(bt,je)|0,v=v+Math.imul(xt,re)|0,T=T+Math.imul(xt,je)|0,D=D+Math.imul(Et,ke)|0,v=v+Math.imul(Et,ve)|0,v=v+Math.imul(At,ke)|0,T=T+Math.imul(At,ve)|0;var mo=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(mo>>>26)|0,mo&=67108863,D=Math.imul($t,Zt),v=Math.imul($t,kt),v=v+Math.imul(Nt,Zt)|0,T=Math.imul(Nt,kt),D=D+Math.imul(_t,re)|0,v=v+Math.imul(_t,je)|0,v=v+Math.imul(Pt,re)|0,T=T+Math.imul(Pt,je)|0,D=D+Math.imul(bt,ke)|0,v=v+Math.imul(bt,ve)|0,v=v+Math.imul(xt,ke)|0,T=T+Math.imul(xt,ve)|0;var vo=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(vo>>>26)|0,vo&=67108863,D=Math.imul($t,re),v=Math.imul($t,je),v=v+Math.imul(Nt,re)|0,T=Math.imul(Nt,je),D=D+Math.imul(_t,ke)|0,v=v+Math.imul(_t,ve)|0,v=v+Math.imul(Pt,ke)|0,T=T+Math.imul(Pt,ve)|0;var wo=(L+D|0)+((v&8191)<<13)|0;L=(T+(v>>>13)|0)+(wo>>>26)|0,wo&=67108863,D=Math.imul($t,ke),v=Math.imul($t,ve),v=v+Math.imul(Nt,ke)|0,T=Math.imul(Nt,ve);var yo=(L+D|0)+((v&8191)<<13)|0;return L=(T+(v>>>13)|0)+(yo>>>26)|0,yo&=67108863,N[0]=Tn,N[1]=Rn,N[2]=Ln,N[3]=Bn,N[4]=Un,N[5]=xr,N[6]=Pi,N[7]=fo,N[8]=Mi,N[9]=po,N[10]=go,N[11]=$i,N[12]=Ss,N[13]=Cs,N[14]=Gr,N[15]=mo,N[16]=vo,N[17]=wo,N[18]=yo,L!==0&&(N[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 C=0,O=0,N=0;N<b.length-1;N++){var L=O;O=0;for(var D=C&67108863,v=Math.min(N,p.length-1),T=Math.max(0,N-d.length+1);T<=v;T++){var ot=N-T,pt=d.words[ot]|0,A=p.words[T]|0,rt=pt*A,q=rt&67108863;L=L+(rt/67108864|0)|0,q=q+D|0,D=q&67108863,L=L+(q>>>26)|0,O+=L>>>26,L&=67108863}b.words[N]=D,C=L,L=O}return C!==0?b.words[N]=C:b.length--,b._strip()}function P(d,p,b){return z(d,p,b)}o.prototype.mulTo=function(d,p){var b,C=this.length+d.length;return this.length===10&&d.length===10?b=B(this,d,p):C<63?b=Y(this,d,p):C<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,C=0;C<this.length;C++){var O=(this.words[C]|0)*d,N=(O&67108863)+(b&67108863);b>>=26,b+=O/67108864|0,b+=N>>>26,this.words[C]=N&67108863}return b!==0&&(this.words[C]=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,C=0;C<p.length&&p[C]===0;C++,b=b.sqr());if(++C<p.length)for(var O=b.sqr();C<p.length;C++,O=O.sqr())p[C]!==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,C=67108863>>>26-p<<26-p,O;if(p!==0){var N=0;for(O=0;O<this.length;O++){var L=this.words[O]&C,D=(this.words[O]|0)-L<<p;this.words[O]=D|N,N=L>>>26-p}N&&(this.words[O]=N,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 C;p?C=(p-p%26)/26:C=0;var O=d%26,N=Math.min((d-O)/26,this.length),L=67108863^67108863>>>O<<O,D=b;if(C-=N,C=Math.max(0,C),D){for(var v=0;v<N;v++)D.words[v]=this.words[v];D.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 T=0;for(v=this.length-1;v>=0&&(T!==0||v>=C);v--){var ot=this.words[v]|0;this.words[v]=T<<26-O|ot>>>O,T=ot&L}return D&&T!==0&&(D.words[D.length++]=T),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,C=1<<p;if(this.length<=b)return!1;var O=this.words[b];return!!(O&C)},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 C=67108863^67108863>>>p<<p;this.words[this.length-1]&=C}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 C=d.length+b,O;this._expand(C);var N,L=0;for(O=0;O<d.length;O++){N=(this.words[O+b]|0)+L;var D=(d.words[O]|0)*p;N-=D&67108863,L=(N>>26)-(D/67108864|0),this.words[O+b]=N&67108863}for(;O<this.length-b;O++)N=(this.words[O+b]|0)+L,L=N>>26,this.words[O+b]=N&67108863;if(L===0)return this._strip();for(n(L===-1),L=0,O=0;O<this.length;O++)N=-(this.words[O]|0)+L,L=N>>26,this.words[O]=N&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,p){var b=this.length-d.length,C=this.clone(),O=d,N=O.words[O.length-1]|0,L=this._countBits(N);b=26-L,b!==0&&(O=O.ushln(b),C.iushln(b),N=O.words[O.length-1]|0);var D=C.length-O.length,v;if(p!=="mod"){v=new o(null),v.length=D+1,v.words=new Array(v.length);for(var T=0;T<v.length;T++)v.words[T]=0}var ot=C.clone()._ishlnsubmul(O,1,D);ot.negative===0&&(C=ot,v&&(v.words[D]=1));for(var pt=D-1;pt>=0;pt--){var A=(C.words[O.length+pt]|0)*67108864+(C.words[O.length+pt-1]|0);for(A=Math.min(A/N|0,67108863),C._ishlnsubmul(O,A,pt);C.negative!==0;)A--,C.negative=0,C._ishlnsubmul(O,1,pt),C.isZero()||(C.negative^=1);v&&(v.words[pt]=A)}return v&&v._strip(),C._strip(),p!=="div"&&b!==0&&C.iushrn(b),{div:v||null,mod:C}},o.prototype.divmod=function(d,p,b){if(n(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var C,O,N;return this.negative!==0&&d.negative===0?(N=this.neg().divmod(d,p),p!=="mod"&&(C=N.div.neg()),p!=="div"&&(O=N.mod.neg(),b&&O.negative!==0&&O.iadd(d)),{div:C,mod:O}):this.negative===0&&d.negative!==0?(N=this.divmod(d.neg(),p),p!=="mod"&&(C=N.div.neg()),{div:C,mod:N.mod}):this.negative&d.negative?(N=this.neg().divmod(d.neg(),p),p!=="div"&&(O=N.mod.neg(),b&&O.negative!==0&&O.isub(d)),{div:N.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,C=d.ushrn(1),O=d.andln(1),N=b.cmp(C);return N<0||O===1&&N===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,C=0,O=this.length-1;O>=0;O--)C=(b*C+(this.words[O]|0))%d;return p?-C:C},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,C=this.length-1;C>=0;C--){var O=(this.words[C]|0)+b*67108864;this.words[C]=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 C=new o(1),O=new o(0),N=new o(0),L=new o(1),D=0;p.isEven()&&b.isEven();)p.iushrn(1),b.iushrn(1),++D;for(var v=b.clone(),T=p.clone();!p.isZero();){for(var ot=0,pt=1;!(p.words[0]&pt)&&ot<26;++ot,pt<<=1);if(ot>0)for(p.iushrn(ot);ot-- >0;)(C.isOdd()||O.isOdd())&&(C.iadd(v),O.isub(T)),C.iushrn(1),O.iushrn(1);for(var A=0,rt=1;!(b.words[0]&rt)&&A<26;++A,rt<<=1);if(A>0)for(b.iushrn(A);A-- >0;)(N.isOdd()||L.isOdd())&&(N.iadd(v),L.isub(T)),N.iushrn(1),L.iushrn(1);p.cmp(b)>=0?(p.isub(b),C.isub(N),O.isub(L)):(b.isub(p),N.isub(C),L.isub(O))}return{a:N,b:L,gcd:b.iushln(D)}},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 C=new o(1),O=new o(0),N=b.clone();p.cmpn(1)>0&&b.cmpn(1)>0;){for(var L=0,D=1;!(p.words[0]&D)&&L<26;++L,D<<=1);if(L>0)for(p.iushrn(L);L-- >0;)C.isOdd()&&C.iadd(N),C.iushrn(1);for(var v=0,T=1;!(b.words[0]&T)&&v<26;++v,T<<=1);if(v>0)for(b.iushrn(v);v-- >0;)O.isOdd()&&O.iadd(N),O.iushrn(1);p.cmp(b)>=0?(p.isub(b),C.isub(O)):(b.isub(p),O.isub(C))}var ot;return p.cmpn(1)===0?ot=C:ot=O,ot.cmpn(0)<0&&ot.iadd(d),ot},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 C=0;p.isEven()&&b.isEven();C++)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 N=p;p=b,b=N}else if(O===0||b.cmpn(1)===0)break;p.isub(b)}while(!0);return b.iushln(C)},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,C=1<<p;if(this.length<=b)return this._expand(b+1),this.words[b]|=C,this;for(var O=C,N=b;O!==0&&N<this.length;N++){var L=this.words[N]|0;L+=O,O=L>>>26,L&=67108863,this.words[N]=L}return O!==0&&(this.words[N]=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 C=this.words[0]|0;b=C===d?0:C<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 C=this.words[b]|0,O=d.words[b]|0;if(C!==O){C<O?p=-1:C>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 nt(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 U={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 C=b<this.n?-1:p.ucmp(this.p);return C===0?(p.words[0]=0,p.length=1):C>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,C=Math.min(d.length,9),O=0;O<C;O++)p.words[O]=d.words[O];if(p.length=C,d.length<=9){d.words[0]=0,d.length=1;return}var N=d.words[9];for(p.words[p.length++]=N&b,O=10;O<d.length;O++){var L=d.words[O]|0;d.words[O-10]=(L&b)<<4|N>>>22,N=L}N>>>=22,d.words[O-10]=N,N===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 C=d.words[b]|0;p+=C*977,d.words[b]=p&67108863,p=C*64+(p/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function $(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i($,j);function et(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(et,j);function tt(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(tt,j),tt.prototype.imulK=function(d){for(var p=0,b=0;b<d.length;b++){var C=(d.words[b]|0)*19+p,O=C&67108863;C>>>=26,d.words[b]=O,p=C}return p!==0&&(d.words[d.length++]=p),d},o._prime=function(d){if(U[d])return U[d];var p;if(d==="k256")p=new m;else if(d==="p224")p=new $;else if(d==="p192")p=new et;else if(d==="p25519")p=new tt;else throw new Error("Unknown prime "+d);return U[d]=p,p};function nt(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}nt.prototype._verify1=function(d){n(d.negative===0,"red works only with positives"),n(d.red,"red works only with red numbers")},nt.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")},nt.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(g(d,d.umod(this.m)._forceRed(this)),d)},nt.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},nt.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)},nt.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},nt.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)},nt.prototype.isub=function(d,p){this._verify2(d,p);var b=d.isub(p);return b.cmpn(0)<0&&b.iadd(this.m),b},nt.prototype.shl=function(d,p){return this._verify1(d),this.imod(d.ushln(p))},nt.prototype.imul=function(d,p){return this._verify2(d,p),this.imod(d.imul(p))},nt.prototype.mul=function(d,p){return this._verify2(d,p),this.imod(d.mul(p))},nt.prototype.isqr=function(d){return this.imul(d,d.clone())},nt.prototype.sqr=function(d){return this.mul(d,d)},nt.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 C=this.m.subn(1),O=0;!C.isZero()&&C.andln(1)===0;)O++,C.iushrn(1);n(!C.isZero());var N=new o(1).toRed(this),L=N.redNeg(),D=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new o(2*v*v).toRed(this);this.pow(v,D).cmp(L)!==0;)v.redIAdd(L);for(var T=this.pow(v,C),ot=this.pow(d,C.addn(1).iushrn(1)),pt=this.pow(d,C),A=O;pt.cmp(N)!==0;){for(var rt=pt,q=0;rt.cmp(N)!==0;q++)rt=rt.redSqr();n(q<A);var H=this.pow(T,new o(1).iushln(A-q-1));ot=ot.redMul(H),T=H.redSqr(),pt=pt.redMul(T),A=q}return ot},nt.prototype.invm=function(d){var p=d._invmp(this.m);return p.negative!==0?(p.negative=0,this.imod(p).redNeg()):this.imod(p)},nt.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,C=new Array(1<<b);C[0]=new o(1).toRed(this),C[1]=d;for(var O=2;O<C.length;O++)C[O]=this.mul(C[O-1],d);var N=C[0],L=0,D=0,v=p.bitLength()%26;for(v===0&&(v=26),O=p.length-1;O>=0;O--){for(var T=p.words[O],ot=v-1;ot>=0;ot--){var pt=T>>ot&1;if(N!==C[0]&&(N=this.sqr(N)),pt===0&&L===0){D=0;continue}L<<=1,L|=pt,D++,!(D!==b&&(O!==0||ot!==0))&&(N=this.mul(N,C[L]),D=0,L=0)}v=26}return N},nt.prototype.convertTo=function(d){var p=d.umod(this.m);return p===d?p.clone():p},nt.prototype.convertFrom=function(d){var p=d.clone();return p.red=null,p},o.mont=function(d){return new dt(d)};function dt(d){nt.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(dt,nt),dt.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},dt.prototype.convertFrom=function(d){var p=this.imod(d.mul(this.rinv));return p.red=null,p},dt.prototype.imul=function(d,p){if(d.isZero()||p.isZero())return d.words[0]=0,d.length=1,d;var b=d.imul(p),C=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=b.isub(C).iushrn(this.shift),N=O;return O.cmp(this.m)>=0?N=O.isub(this.m):O.cmpn(0)<0&&(N=O.iadd(this.m)),N._forceRed(this)},dt.prototype.mul=function(d,p){if(d.isZero()||p.isZero())return new o(0)._forceRed(this);var b=d.mul(p),C=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=b.isub(C).iushrn(this.shift),N=O;return O.cmp(this.m)>=0?N=O.isub(this.m):O.cmpn(0)<0&&(N=O.iadd(this.m)),N._forceRed(this)},dt.prototype.invm=function(d){var p=this.imod(d._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(e,Og)})(jg);var se=jg.exports;const kg="bignumber/5.7.0";var Pl=se.BN;const Fi=new ue(kg),yf={},qg=9007199254740991;function N4(e){return e!=null&&(Ze.isBigNumber(e)||typeof e=="number"&&e%1===0||typeof e=="string"&&!!e.match(/^-?[0-9]+$/)||mn(e)||typeof e=="bigint"||Ho(e))}let zg=!1;class Ze{constructor(t,r){t!==yf&&Fi.throwError("cannot call constructor directly; use BigNumber.from",ue.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return rn(be(this).fromTwos(t))}toTwos(t){return rn(be(this).toTwos(t))}abs(){return this._hex[0]==="-"?Ze.from(this._hex.substring(1)):this}add(t){return rn(be(this).add(be(t)))}sub(t){return rn(be(this).sub(be(t)))}div(t){return Ze.from(t).isZero()&&Sn("division-by-zero","div"),rn(be(this).div(be(t)))}mul(t){return rn(be(this).mul(be(t)))}mod(t){const r=be(t);return r.isNeg()&&Sn("division-by-zero","mod"),rn(be(this).umod(r))}pow(t){const r=be(t);return r.isNeg()&&Sn("negative-power","pow"),rn(be(this).pow(r))}and(t){const r=be(t);return(this.isNegative()||r.isNeg())&&Sn("unbound-bitwise-result","and"),rn(be(this).and(r))}or(t){const r=be(t);return(this.isNegative()||r.isNeg())&&Sn("unbound-bitwise-result","or"),rn(be(this).or(r))}xor(t){const r=be(t);return(this.isNegative()||r.isNeg())&&Sn("unbound-bitwise-result","xor"),rn(be(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&Sn("negative-width","mask"),rn(be(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Sn("negative-width","shl"),rn(be(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Sn("negative-width","shr"),rn(be(this).shrn(t))}eq(t){return be(this).eq(be(t))}lt(t){return be(this).lt(be(t))}lte(t){return be(this).lte(be(t))}gt(t){return be(this).gt(be(t))}gte(t){return be(this).gte(be(t))}isNegative(){return this._hex[0]==="-"}isZero(){return be(this).isZero()}toNumber(){try{return be(this).toNumber()}catch{Sn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Fi.throwError("this platform does not support BigInt",ue.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?zg||(zg=!0,Fi.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Fi.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ue.errors.UNEXPECTED_ARGUMENT,{}):Fi.throwError("BigNumber.toString does not accept parameters",ue.errors.UNEXPECTED_ARGUMENT,{})),be(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ze)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new Ze(yf,ec(t)):t.match(/^-?[0-9]+$/)?new Ze(yf,ec(new Pl(t))):Fi.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&Sn("underflow","BigNumber.from",t),(t>=qg||t<=-qg)&&Sn("overflow","BigNumber.from",t),Ze.from(String(t));const r=t;if(typeof r=="bigint")return Ze.from(r.toString());if(Ho(r))return Ze.from(kr(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Ze.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 Ze.from(n)}return Fi.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}}function ec(e){if(typeof e!="string")return ec(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&Fi.throwArgumentError("invalid hex","value",e),e=ec(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function rn(e){return Ze.from(ec(e))}function be(e){const t=Ze.from(e).toHexString();return t[0]==="-"?new Pl("-"+t.substring(3),16):new Pl(t.substring(2),16)}function Sn(e,t,r){const n={fault:e,operation:t};return r!=null&&(n.value=r),Fi.throwError(e,ue.errors.NUMERIC_FAULT,n)}function T4(e){return new Pl(e,36).toString(16)}const qr=new ue(kg),rc={},Hg=Ze.from(0),Kg=Ze.from(-1);function Wg(e,t,r,n){const i={fault:t,operation:r};return n!==void 0&&(i.value=n),qr.throwError(e,ue.errors.NUMERIC_FAULT,i)}let nc="0";for(;nc.length<256;)nc+=nc;function bf(e){if(typeof e!="number")try{e=Ze.from(e).toNumber()}catch{}return typeof e=="number"&&e>=0&&e<=256&&!(e%1)?"1"+nc.substring(0,e):qr.throwArgumentError("invalid decimal size","decimals",e)}function _f(e,t){t==null&&(t=0);const r=bf(t);e=Ze.from(e);const n=e.lt(Hg);n&&(e=e.mul(Kg));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=e.div(r).toString();return r.length===1?e=o:e=o+"."+i,n&&(e="-"+e),e}function ji(e,t){t==null&&(t=0);const r=bf(t);(typeof e!="string"||!e.match(/^-?[0-9.]+$/))&&qr.throwArgumentError("invalid decimal value","value",e);const n=e.substring(0,1)==="-";n&&(e=e.substring(1)),e==="."&&qr.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&qr.throwArgumentError("too many decimal points","value",e);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&&Wg("fractional component exceeds decimals","underflow","parseFixed"),c===""&&(c="0");c.length<r.length-1;)c+="0";const l=Ze.from(o),f=Ze.from(c);let h=l.mul(r).add(f);return n&&(h=h.mul(Kg)),h}class Ko{constructor(t,r,n,i){t!==rc&&qr.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ue.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=bf(i),Object.freeze(this)}static from(t){if(t instanceof Ko)return t;typeof t=="number"&&(t=`fixed128x${t}`);let r=!0,n=128,i=18;if(typeof t=="string"){if(t!=="fixed")if(t==="ufixed")r=!1;else{const o=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||qr.throwArgumentError("invalid fixed format","format",t),r=o[1]!=="u",n=parseInt(o[2]),i=parseInt(o[3])}}else if(t){const o=(c,l,f)=>t[c]==null?f:(typeof t[c]!==l&&qr.throwArgumentError("invalid fixed format ("+c+" not "+l+")","format."+c,t[c]),t[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 Ko(rc,r,n,i)}}class Pr{constructor(t,r,n,i){t!==rc&&qr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ue.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&qr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const r=ji(this._value,this.format.decimals),n=ji(t._value,t.format.decimals);return Pr.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=ji(this._value,this.format.decimals),n=ji(t._value,t.format.decimals);return Pr.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=ji(this._value,this.format.decimals),n=ji(t._value,t.format.decimals);return Pr.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=ji(this._value,this.format.decimals),n=ji(t._value,t.format.decimals);return Pr.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");t.length===1&&t.push("0");let r=Pr.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Vg.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");t.length===1&&t.push("0");let r=Pr.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Vg.toFormat(r.format))),r}round(t){t==null&&(t=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(t<0||t>80||t%1)&&qr.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=Pr.from("1"+nc.substring(0,t),this.format),i=R4.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(t){if(t==null)return this._hex;t%8&&qr.throwArgumentError("invalid byte width","width",t);const r=Ze.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return ui(r,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return Pr.fromString(this._value,t)}static fromValue(t,r,n){return n==null&&r!=null&&!N4(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),Pr.fromString(_f(t,r),Ko.from(n))}static fromString(t,r){r==null&&(r="fixed");const n=Ko.from(r),i=ji(t,n.decimals);!n.signed&&i.lt(Hg)&&Wg("unsigned value cannot be negative","overflow","value",t);let o=null;n.signed?o=i.toTwos(n.width).toHexString():(o=i.toHexString(),o=ui(o,n.width/8));const c=_f(i,n.decimals);return new Pr(rc,o,c,n)}static fromBytes(t,r){r==null&&(r="fixed");const n=Ko.from(r);if(or(t).length>n.width/8)throw new Error("overflow");let i=Ze.from(t);n.signed&&(i=i.fromTwos(n.width));const o=i.toTwos((n.signed?0:1)+n.width).toHexString(),c=_f(i,n.decimals);return new Pr(rc,o,c,n)}static from(t,r){if(typeof t=="string")return Pr.fromString(t,r);if(Ho(t))return Pr.fromBytes(t,r);try{return Pr.fromValue(t,0,r)}catch(n){if(n.code!==ue.errors.INVALID_ARGUMENT)throw n}return qr.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!!(t&&t._isFixedNumber)}}const Vg=Pr.from(1),R4=Pr.from("0.5"),L4="strings/5.7.0",Gg=new ue(L4);var Ml;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(Ml||(Ml={}));var Wo;(function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"})(Wo||(Wo={}));function B4(e,t,r,n,i){return Gg.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function Yg(e,t,r,n,i){if(e===Wo.BAD_PREFIX||e===Wo.UNEXPECTED_CONTINUE){let o=0;for(let c=t+1;c<r.length&&r[c]>>6===2;c++)o++;return o}return e===Wo.OVERRUN?r.length-t-1:0}function U4(e,t,r,n,i){return e===Wo.OVERLONG?(n.push(i),0):(n.push(65533),Yg(e,t,r))}Object.freeze({error:B4,ignore:Yg,replace:U4});function Ef(e,t=Ml.current){t!=Ml.current&&(Gg.checkNormalize(),e=e.normalize(t));let r=[];for(let n=0;n<e.length;n++){const i=e.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=e.charCodeAt(n);if(n>=e.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 F4(e){if(e.length%4!==0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function Af(e,t){t||(t=function(i){return[parseInt(i,16)]});let r=0,n={};return e.split(",").forEach(i=>{let o=i.split(":");r+=parseInt(o[0],16),n[r]=t(o[1])}),n}function Qg(e){let t=0;return e.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=t+parseInt(n[0],16);return t=parseInt(n[1],16),{l:i,h:t}})}Qg("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(e=>parseInt(e,16)),Af("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"),Af("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"),Af("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",F4),Qg("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 Jg="hash/5.7.0";function j4(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return or(t)}function Zg(e,t){t==null&&(t=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(e,t),r}function k4(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}function q4(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let U=1;U<n;U++)o.push(i+=r());let c=r(),l=t;t+=c;let f=0,h=0;function g(){return f==0&&(h=h<<8|e[t++],f=8),h>>--f&1}const _=31,E=Math.pow(2,_),x=E>>>1,I=x>>1,F=E-1;let W=0;for(let U=0;U<_;U++)W=W<<1|g();let Y=[],B=0,z=E;for(;;){let U=Math.floor(((W-B+1)*i-1)/z),j=0,m=n;for(;m-j>1;){let tt=j+m>>>1;U<o[tt]?m=tt:j=tt}if(j==0)break;Y.push(j);let $=B+Math.floor(z*o[j]/i),et=B+Math.floor(z*o[j+1]/i)-1;for(;!(($^et)&x);)W=W<<1&F|g(),$=$<<1&F,et=et<<1&F|1;for(;$&~et&I;)W=W&x|W<<1&F>>>1|g(),$=$<<1^x,et=(et^x)<<1|x|1;B=$,z=1+et-$}let P=n-4;return Y.map(U=>{switch(U-P){case 3:return P+65792+(e[l++]<<16|e[l++]<<8|e[l++]);case 2:return P+256+(e[l++]<<8|e[l++]);case 1:return P+e[l++];default:return U-1}})}function z4(e){let t=0;return()=>e[t++]}function H4(e){return z4(q4(e))}function K4(e){return e&1?~e>>1:e>>1}function W4(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}function Xg(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function V4(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=K4(t());return r}function $l(e,t){let r=Xg(e(),e),n=e(),i=Xg(n,e),o=W4(n,e);for(let c=0;c<n;c++)for(let l=0;l<o[c];l++)r.push(i[c]+l);return t?r.map(c=>t[c]):r}function G4(e){let t=[];for(;;){let r=e();if(r==0)break;t.push(Q4(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(J4(r,e))}return k4(Zg(t))}function Y4(e){let t=[];for(;;){let r=e();if(r==0)break;t.push(r)}return t}function tm(e,t,r){let n=Array(e).fill(void 0).map(()=>[]);for(let i=0;i<t;i++)V4(e,r).forEach((o,c)=>n[c].push(o));return n}function Q4(e,t){let r=1+t(),n=t(),i=Y4(t),o=tm(i.length,1+e,t);return Zg(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(x=>x+E)]})}))}function J4(e,t){let r=1+t();return tm(r,1+e,t).map(n=>[n[0],n.slice(1)])}function Z4(e){let t=$l(e).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let h=$l(e,t);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=e(),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 X4(){return H4(j4("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 Nl=X4();new Set($l(Nl)),new Set($l(Nl)),G4(Nl),Z4(Nl),new ue(Jg),new Uint8Array(32).fill(0);const tE=`Ethereum Signed Message:
|
|
22
|
+
`;function em(e){return typeof e=="string"&&(e=Ef(e)),wf(C4([Ef(tE),Ef(String(e.length)),e]))}const eE="rlp/5.7.0";new ue(eE);const rE="address/5.7.0",ic=new ue(rE);function rm(e){mn(e,20)||ic.throwArgumentError("invalid address","address",e),e=e.toLowerCase();const t=e.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=t[i].charCodeAt(0);const n=or(wf(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(n[i>>1]&15)>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}const nE=9007199254740991;function iE(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const xf={};for(let e=0;e<10;e++)xf[String(e)]=String(e);for(let e=0;e<26;e++)xf[String.fromCharCode(65+e)]=String(10+e);const nm=Math.floor(iE(nE));function sE(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let t=e.split("").map(n=>xf[n]).join("");for(;t.length>=nm;){let n=t.substring(0,nm);t=parseInt(n,10)%97+t.substring(n.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function oE(e){let t=null;if(typeof e!="string"&&ic.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))e.substring(0,2)!=="0x"&&(e="0x"+e),t=rm(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&ic.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==sE(e)&&ic.throwArgumentError("bad icap checksum","address",e),t=T4(e.substring(4));t.length<40;)t="0"+t;t=rm("0x"+t)}else ic.throwArgumentError("invalid address","address",e);return t}const aE="properties/5.7.0";new ue(aE);function sc(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}new ue(Jg),new Uint8Array(32).fill(0),Ze.from(-1);const cE=Ze.from(0),lE=Ze.from(1);Ze.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),ui(lE.toHexString(),32),ui(cE.toHexString(),32);var hi={},_e={},oc=im;function im(e,t){if(!e)throw new Error(t||"Assertion failed")}im.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var If={exports:{}};typeof Object.create=="function"?If.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:If.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var uE=oc,hE=If.exports;_e.inherits=hE;function fE(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function dE(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):fE(e,i)?(o=65536+((o&1023)<<10)+(e.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<e.length;i++)r[i]=e[i]|0;return r}_e.toArray=dE;function pE(e){for(var t="",r=0;r<e.length;r++)t+=om(e[r].toString(16));return t}_e.toHex=pE;function sm(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}_e.htonl=sm;function gE(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];t==="little"&&(i=sm(i)),r+=am(i.toString(16))}return r}_e.toHex32=gE;function om(e){return e.length===1?"0"+e:e}_e.zero2=om;function am(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}_e.zero8=am;function mE(e,t,r,n){var i=r-t;uE(i%4===0);for(var o=new Array(i/4),c=0,l=t;c<o.length;c++,l+=4){var f;n==="big"?f=e[l]<<24|e[l+1]<<16|e[l+2]<<8|e[l+3]:f=e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l],o[c]=f>>>0}return o}_e.join32=mE;function vE(e,t){for(var r=new Array(e.length*4),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];t==="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}_e.split32=vE;function wE(e,t){return e>>>t|e<<32-t}_e.rotr32=wE;function yE(e,t){return e<<t|e>>>32-t}_e.rotl32=yE;function bE(e,t){return e+t>>>0}_e.sum32=bE;function _E(e,t,r){return e+t+r>>>0}_e.sum32_3=_E;function EE(e,t,r,n){return e+t+r+n>>>0}_e.sum32_4=EE;function AE(e,t,r,n,i){return e+t+r+n+i>>>0}_e.sum32_5=AE;function xE(e,t,r,n){var i=e[t],o=e[t+1],c=n+o>>>0,l=(c<n?1:0)+r+i;e[t]=l>>>0,e[t+1]=c}_e.sum64=xE;function IE(e,t,r,n){var i=t+n>>>0,o=(i<t?1:0)+e+r;return o>>>0}_e.sum64_hi=IE;function SE(e,t,r,n){var i=t+n;return i>>>0}_e.sum64_lo=SE;function CE(e,t,r,n,i,o,c,l){var f=0,h=t;h=h+n>>>0,f+=h<t?1:0,h=h+o>>>0,f+=h<o?1:0,h=h+l>>>0,f+=h<l?1:0;var g=e+r+i+c+f;return g>>>0}_e.sum64_4_hi=CE;function DE(e,t,r,n,i,o,c,l){var f=t+n+o+l;return f>>>0}_e.sum64_4_lo=DE;function OE(e,t,r,n,i,o,c,l,f,h){var g=0,_=t;_=_+n>>>0,g+=_<t?1:0,_=_+o>>>0,g+=_<o?1:0,_=_+l>>>0,g+=_<l?1:0,_=_+h>>>0,g+=_<h?1:0;var E=e+r+i+c+f+g;return E>>>0}_e.sum64_5_hi=OE;function PE(e,t,r,n,i,o,c,l,f,h){var g=t+n+o+l+h;return g>>>0}_e.sum64_5_lo=PE;function ME(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}_e.rotr64_hi=ME;function $E(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}_e.rotr64_lo=$E;function NE(e,t,r){return e>>>r}_e.shr64_hi=NE;function TE(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}_e.shr64_lo=TE;var Vo={},cm=_e,RE=oc;function Tl(){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}Vo.BlockHash=Tl,Tl.prototype.update=function(e,t){if(e=cm.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=cm.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},Tl.prototype.digest=function(e){return this.update(this._pad()),RE(this.pending===null),this._digest(e)},Tl.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=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++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=e&255}else for(n[i++]=e&255,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>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 Go={},fi={},LE=_e,di=LE.rotr32;function BE(e,t,r,n){if(e===0)return lm(t,r,n);if(e===1||e===3)return hm(t,r,n);if(e===2)return um(t,r,n)}fi.ft_1=BE;function lm(e,t,r){return e&t^~e&r}fi.ch32=lm;function um(e,t,r){return e&t^e&r^t&r}fi.maj32=um;function hm(e,t,r){return e^t^r}fi.p32=hm;function UE(e){return di(e,2)^di(e,13)^di(e,22)}fi.s0_256=UE;function FE(e){return di(e,6)^di(e,11)^di(e,25)}fi.s1_256=FE;function jE(e){return di(e,7)^di(e,18)^e>>>3}fi.g0_256=jE;function kE(e){return di(e,17)^di(e,19)^e>>>10}fi.g1_256=kE;var Yo=_e,qE=Vo,zE=fi,Sf=Yo.rotl32,ac=Yo.sum32,HE=Yo.sum32_5,KE=zE.ft_1,fm=qE.BlockHash,WE=[1518500249,1859775393,2400959708,3395469782];function pi(){if(!(this instanceof pi))return new pi;fm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Yo.inherits(pi,fm);var VE=pi;pi.blockSize=512,pi.outSize=160,pi.hmacStrength=80,pi.padLength=64,pi.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Sf(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=HE(Sf(i,5),KE(h,o,c,l),f,r[n],WE[h]);f=l,l=c,c=Sf(o,30),o=i,i=g}this.h[0]=ac(this.h[0],i),this.h[1]=ac(this.h[1],o),this.h[2]=ac(this.h[2],c),this.h[3]=ac(this.h[3],l),this.h[4]=ac(this.h[4],f)},pi.prototype._digest=function(e){return e==="hex"?Yo.toHex32(this.h,"big"):Yo.split32(this.h,"big")};var Qo=_e,GE=Vo,Jo=fi,YE=oc,Jn=Qo.sum32,QE=Qo.sum32_4,JE=Qo.sum32_5,ZE=Jo.ch32,XE=Jo.maj32,tA=Jo.s0_256,eA=Jo.s1_256,rA=Jo.g0_256,nA=Jo.g1_256,dm=GE.BlockHash,iA=[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 gi(){if(!(this instanceof gi))return new gi;dm.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=iA,this.W=new Array(64)}Qo.inherits(gi,dm);var pm=gi;gi.blockSize=512,gi.outSize=256,gi.hmacStrength=192,gi.padLength=64,gi.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=QE(nA(r[n-2]),r[n-7],rA(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(YE(this.k.length===r.length),n=0;n<r.length;n++){var E=JE(_,eA(f),ZE(f,h,g),this.k[n],r[n]),x=Jn(tA(i),XE(i,o,c));_=g,g=h,h=f,f=Jn(l,E),l=c,c=o,o=i,i=Jn(E,x)}this.h[0]=Jn(this.h[0],i),this.h[1]=Jn(this.h[1],o),this.h[2]=Jn(this.h[2],c),this.h[3]=Jn(this.h[3],l),this.h[4]=Jn(this.h[4],f),this.h[5]=Jn(this.h[5],h),this.h[6]=Jn(this.h[6],g),this.h[7]=Jn(this.h[7],_)},gi.prototype._digest=function(e){return e==="hex"?Qo.toHex32(this.h,"big"):Qo.split32(this.h,"big")};var Cf=_e,gm=pm;function ki(){if(!(this instanceof ki))return new ki;gm.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Cf.inherits(ki,gm);var sA=ki;ki.blockSize=512,ki.outSize=224,ki.hmacStrength=192,ki.padLength=64,ki.prototype._digest=function(e){return e==="hex"?Cf.toHex32(this.h.slice(0,7),"big"):Cf.split32(this.h.slice(0,7),"big")};var nn=_e,oA=Vo,aA=oc,mi=nn.rotr64_hi,vi=nn.rotr64_lo,mm=nn.shr64_hi,vm=nn.shr64_lo,ls=nn.sum64,Df=nn.sum64_hi,Of=nn.sum64_lo,cA=nn.sum64_4_hi,lA=nn.sum64_4_lo,uA=nn.sum64_5_hi,hA=nn.sum64_5_lo,wm=oA.BlockHash,fA=[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;wm.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=fA,this.W=new Array(160)}nn.inherits(Zn,wm);var ym=Zn;Zn.blockSize=1024,Zn.outSize=512,Zn.hmacStrength=192,Zn.padLength=128,Zn.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=AA(r[n-4],r[n-3]),o=xA(r[n-4],r[n-3]),c=r[n-14],l=r[n-13],f=_A(r[n-30],r[n-29]),h=EA(r[n-30],r[n-29]),g=r[n-32],_=r[n-31];r[n]=cA(i,o,c,l,f,h,g,_),r[n+1]=lA(i,o,c,l,f,h,g,_)}},Zn.prototype._update=function(e,t){this._prepareBlock(e,t);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],x=this.h[10],I=this.h[11],F=this.h[12],W=this.h[13],Y=this.h[14],B=this.h[15];aA(this.k.length===r.length);for(var z=0;z<r.length;z+=2){var P=Y,U=B,j=yA(_,E),m=bA(_,E),$=dA(_,E,x,I,F),et=pA(_,E,x,I,F,W),tt=this.k[z],nt=this.k[z+1],dt=r[z],d=r[z+1],p=uA(P,U,j,m,$,et,tt,nt,dt,d),b=hA(P,U,j,m,$,et,tt,nt,dt,d);P=vA(n,i),U=wA(n,i),j=gA(n,i,o,c,l),m=mA(n,i,o,c,l,f);var C=Df(P,U,j,m),O=Of(P,U,j,m);Y=F,B=W,F=x,W=I,x=_,I=E,_=Df(h,g,p,b),E=Of(g,g,p,b),h=l,g=f,l=o,f=c,o=n,c=i,n=Df(p,b,C,O),i=Of(p,b,C,O)}ls(this.h,0,n,i),ls(this.h,2,o,c),ls(this.h,4,l,f),ls(this.h,6,h,g),ls(this.h,8,_,E),ls(this.h,10,x,I),ls(this.h,12,F,W),ls(this.h,14,Y,B)},Zn.prototype._digest=function(e){return e==="hex"?nn.toHex32(this.h,"big"):nn.split32(this.h,"big")};function dA(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function pA(e,t,r,n,i,o){var c=t&n^~t&o;return c<0&&(c+=4294967296),c}function gA(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function mA(e,t,r,n,i,o){var c=t&n^t&o^n&o;return c<0&&(c+=4294967296),c}function vA(e,t){var r=mi(e,t,28),n=mi(t,e,2),i=mi(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function wA(e,t){var r=vi(e,t,28),n=vi(t,e,2),i=vi(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function yA(e,t){var r=mi(e,t,14),n=mi(e,t,18),i=mi(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function bA(e,t){var r=vi(e,t,14),n=vi(e,t,18),i=vi(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function _A(e,t){var r=mi(e,t,1),n=mi(e,t,8),i=mm(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function EA(e,t){var r=vi(e,t,1),n=vi(e,t,8),i=vm(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function AA(e,t){var r=mi(e,t,19),n=mi(t,e,29),i=mm(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}function xA(e,t){var r=vi(e,t,19),n=vi(t,e,29),i=vm(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}var Pf=_e,bm=ym;function qi(){if(!(this instanceof qi))return new qi;bm.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Pf.inherits(qi,bm);var IA=qi;qi.blockSize=1024,qi.outSize=384,qi.hmacStrength=192,qi.padLength=128,qi.prototype._digest=function(e){return e==="hex"?Pf.toHex32(this.h.slice(0,12),"big"):Pf.split32(this.h.slice(0,12),"big")},Go.sha1=VE,Go.sha224=sA,Go.sha256=pm,Go.sha384=IA,Go.sha512=ym;var _m={},Ks=_e,SA=Vo,Rl=Ks.rotl32,Em=Ks.sum32,cc=Ks.sum32_3,Am=Ks.sum32_4,xm=SA.BlockHash;function wi(){if(!(this instanceof wi))return new wi;xm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Ks.inherits(wi,xm),_m.ripemd160=wi,wi.blockSize=512,wi.outSize=160,wi.hmacStrength=192,wi.padLength=64,wi.prototype._update=function(e,t){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 x=Em(Rl(Am(r,Im(E,n,i,o),e[OA[E]+t],CA(E)),MA[E]),c);r=c,c=o,o=Rl(i,10),i=n,n=x,x=Em(Rl(Am(l,Im(79-E,f,h,g),e[PA[E]+t],DA(E)),$A[E]),_),l=_,_=g,g=Rl(h,10),h=f,f=x}x=cc(this.h[1],i,g),this.h[1]=cc(this.h[2],o,_),this.h[2]=cc(this.h[3],c,l),this.h[3]=cc(this.h[4],r,f),this.h[4]=cc(this.h[0],n,h),this.h[0]=x},wi.prototype._digest=function(e){return e==="hex"?Ks.toHex32(this.h,"little"):Ks.split32(this.h,"little")};function Im(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function CA(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function DA(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var OA=[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],PA=[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],MA=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],$A=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],NA=_e,TA=oc;function Zo(e,t,r){if(!(this instanceof Zo))return new Zo(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(NA.toArray(t,r))}var RA=Zo;Zo.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),TA(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Zo.prototype.update=function(e,t){return this.inner.update(e,t),this},Zo.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=_e,t.common=Vo,t.sha=Go,t.ripemd=_m,t.hmac=RA,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(hi);function Xo(e,t,r){return r={path:t,exports:{},require:function(n,i){return LA(n,i??r.path)}},e(r,r.exports),r.exports}function LA(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Mf=Sm;function Sm(e,t){if(!e)throw new Error(t||"Assertion failed")}Sm.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Xn=Xo(function(e,t){var r=t;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=Xo(function(e,t){var r=t;r.assert=Mf,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,x=f.clone(),I=0;I<_.length;I++){var F,W=x.andln(E-1);x.isOdd()?(W>(E>>1)-1?F=(E>>1)-W:F=W,x.isubn(F)):F=0,_[I]=F,x.iushrn(1)}return _}r.getNAF=n;function i(f,h){var g=[[],[]];f=f.clone(),h=h.clone();for(var _=0,E=0,x;f.cmpn(-_)>0||h.cmpn(-E)>0;){var I=f.andln(3)+_&3,F=h.andln(3)+E&3;I===3&&(I=-1),F===3&&(F=-1);var W;I&1?(x=f.andln(7)+_&7,(x===3||x===5)&&F===2?W=-I:W=I):W=0,g[0].push(W);var Y;F&1?(x=h.andln(7)+E&7,(x===3||x===5)&&I===2?Y=-F:Y=F):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 se(f,"hex","le")}r.intFromLE=l}),Ll=vn.getNAF,BA=vn.getJSF,Bl=vn.assert;function us(e,t){this.type=e,this.p=new se(t.p,16),this.red=t.prime?se.red(t.prime):se.mont(this.p),this.zero=new se(0).toRed(this.red),this.one=new se(1).toRed(this.red),this.two=new se(2).toRed(this.red),this.n=t.n&&new se(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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 Ws=us;us.prototype.point=function(){throw new Error("Not implemented")},us.prototype.validate=function(){throw new Error("Not implemented")},us.prototype._fixedNafMul=function(e,t){Bl(e.precomputed);var r=e._getDoubles(),n=Ll(t,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()},us.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Ll(t,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];Bl(h!==0),e.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 e.type==="affine"?c.toP():c},us.prototype._wnafMulAdd=function(e,t,r,n,i){var o=this._wnafT1,c=this._wnafT2,l=this._wnafT3,f=0,h,g,_;for(h=0;h<n;h++){_=t[h];var E=_._getNAFPoints(e);o[h]=E.wnd,c[h]=E.points}for(h=n-1;h>=1;h-=2){var x=h-1,I=h;if(o[x]!==1||o[I]!==1){l[x]=Ll(r[x],o[x],this._bitLength),l[I]=Ll(r[I],o[I],this._bitLength),f=Math.max(l[x].length,f),f=Math.max(l[I].length,f);continue}var F=[t[x],null,null,t[I]];t[x].y.cmp(t[I].y)===0?(F[1]=t[x].add(t[I]),F[2]=t[x].toJ().mixedAdd(t[I].neg())):t[x].y.cmp(t[I].y.redNeg())===0?(F[1]=t[x].toJ().mixedAdd(t[I]),F[2]=t[x].add(t[I].neg())):(F[1]=t[x].toJ().mixedAdd(t[I]),F[2]=t[x].toJ().mixedAdd(t[I].neg()));var W=[-3,-1,-5,-7,0,7,5,1,3],Y=BA(r[x],r[I]);for(f=Math.max(Y[0].length,f),l[x]=new Array(f),l[I]=new Array(f),g=0;g<f;g++){var B=Y[0][g]|0,z=Y[1][g]|0;l[x][g]=W[(B+1)*3+(z+1)],l[I][g]=0,c[x]=F}}var P=this.jpoint(null,null,null),U=this._wnafT4;for(h=f;h>=0;h--){for(var j=0;h>=0;){var m=!0;for(g=0;g<n;g++)U[g]=l[g][h]|0,U[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 $=U[g];$!==0&&($>0?_=c[g][$-1>>1]:$<0&&(_=c[g][-$-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(e,t){this.curve=e,this.type=t,this.precomputed=null}us.BasePoint=Cn,Cn.prototype.eq=function(){throw new Error("Not implemented")},Cn.prototype.validate=function(){return this.curve.validate(this)},us.prototype.decodePoint=function(e,t){e=vn.toArray(e,t);var r=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*r){e[0]===6?Bl(e[e.length-1]%2===0):e[0]===7&&Bl(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));return n}else if((e[0]===2||e[0]===3)&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),e[0]===3);throw new Error("Unknown point format")},Cn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Cn.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Cn.prototype.encode=function(e,t){return vn.encode(this._encode(t),e)},Cn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Cn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Cn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},Cn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=r===1?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},Cn.prototype._getBeta=function(){return null},Cn.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var $f=Xo(function(e){typeof Object.create=="function"?e.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}}),UA=vn.assert;function Dn(e){Ws.call(this,"short",e),this.a=new se(e.a,16).toRed(this.red),this.b=new se(e.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(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}$f(Dn,Ws);var FA=Dn;Dn.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,r;if(e.beta)t=new se(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)r=new se(e.lambda,16);else{var i=this._getEndoRoots(this.n);this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))===0?r=i[0]:(r=i[1],UA(this.g.mul(r).x.cmp(this.g.x.redMul(t))===0))}var o;return e.basis?o=e.basis.map(function(c){return{a:new se(c.a,16),b:new se(c.b,16)}}):o=this._getEndoBasis(r),{beta:t,lambda:r,basis:o}}},Dn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:se.mont(e),r=new se(2).toRed(t).redInvm(),n=r.redNeg(),i=new se(3).toRed(t).redNeg().redSqrt().redMul(r),o=n.redAdd(i).fromRed(),c=n.redSub(i).fromRed();return[o,c]},Dn.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),r=e,n=this.n.clone(),i=new se(1),o=new se(0),c=new se(0),l=new se(1),f,h,g,_,E,x,I,F=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(t)<0)f=I.neg(),h=i,g=W.neg(),_=Y;else if(g&&++F===2)break;I=W,n=r,r=W,c=i,i=Y,l=o,o=z}E=W.neg(),x=Y;var P=g.sqr().add(_.sqr()),U=E.sqr().add(x.sqr());return U.cmp(P)>=0&&(E=f,x=h),g.negative&&(g=g.neg(),_=_.neg()),E.negative&&(E=E.neg(),x=x.neg()),[{a:g,b:_},{a:E,b:x}]},Dn.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),c=i.mul(r.a),l=o.mul(n.a),f=i.mul(r.b),h=o.mul(n.b),g=e.sub(c).sub(l),_=f.add(h).neg();return{k1:g,k2:_}},Dn.prototype.pointFromX=function(e,t){e=new se(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.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(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},Dn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Dn.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var c=this._endoSplit(t[o]),l=e[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 Er(e,t,r,n){Ws.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new se(t,16),this.y=new se(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)}$f(Er,Ws.BasePoint),Dn.prototype.point=function(e,t,r){return new Er(this,e,t,r)},Dn.prototype.pointFromJSON=function(e,t){return Er.fromJSON(this,e,t)},Er.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(i){return r.point(i.x.redMul(r.endo.beta),i.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Er.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]},Er.fromJSON=function(e,t,r){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(c){return e.point(c[0],c[1],r)}var o=t[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},Er.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)+">"},Er.prototype.isInfinity=function(){return this.inf},Er.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Er.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).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)},Er.prototype.getX=function(){return this.x.fromRed()},Er.prototype.getY=function(){return this.y.fromRed()},Er.prototype.mul=function(e){return e=new se(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Er.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Er.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Er.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Er.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};t.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 t},Er.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Mr(e,t,r,n){Ws.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new se(0)):(this.x=new se(t,16),this.y=new se(r,16),this.z=new se(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}$f(Mr,Ws.BasePoint),Dn.prototype.jpoint=function(e,t,r){return new Mr(this,e,t,r)},Mr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Mr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Mr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),c=e.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(_),x=f.redMul(_.redISub(E)).redISub(o.redMul(g)),I=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(E,x,I)},Mr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).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)),x=this.z.redMul(c);return this.curve.jpoint(_,E,x)},Mr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)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(t=0;t<e;t++){var g=o.redSqr(),_=h.redSqr(),E=_.redSqr(),x=g.redAdd(g).redIAdd(g).redIAdd(n.redMul(f)),I=o.redMul(_),F=x.redSqr().redISub(I.redAdd(I)),W=I.redISub(F),Y=x.redMul(W);Y=Y.redIAdd(Y).redISub(E);var B=h.redMul(l);t+1<e&&(f=f.redMul(E)),o=F,l=B,h=Y}return this.curve.jpoint(o,h.redMul(i),l)},Mr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Mr.prototype._zeroDbl=function(){var e,t,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),e=f,t=l.redMul(c.redISub(f)).redISub(h),r=this.y.redAdd(this.y)}else{var g=this.x.redSqr(),_=this.y.redSqr(),E=_.redSqr(),x=this.x.redAdd(_).redSqr().redISub(g).redISub(E);x=x.redIAdd(x);var I=g.redAdd(g).redIAdd(g),F=I.redSqr(),W=E.redIAdd(E);W=W.redIAdd(W),W=W.redIAdd(W),e=F.redISub(x).redISub(x),t=I.redMul(x.redISub(e)).redISub(W),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(e,t,r)},Mr.prototype._threeDbl=function(){var e,t,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);e=f;var h=o.redIAdd(o);h=h.redIAdd(h),h=h.redIAdd(h),t=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(_),x=this.x.redSub(g).redMul(this.x.redAdd(g));x=x.redAdd(x).redIAdd(x);var I=E.redIAdd(E);I=I.redIAdd(I);var F=I.redAdd(I);e=x.redSqr().redISub(F),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),t=x.redMul(I.redISub(e)).redISub(W)}return this.curve.jpoint(e,t,r)},Mr.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),c=r.redSqr(),l=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),f=t.redAdd(t);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 x=l.redMul(_).redISub(E),I=r.redAdd(r).redMul(n);return this.curve.jpoint(g,x,I)},Mr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),c=this.x.redAdd(t).redSqr().redISub(e).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=t.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 x=this.z.redAdd(c).redSqr().redISub(r).redISub(l);return this.curve.jpoint(_,E,x)},Mr.prototype.mul=function(e,t){return e=new se(e,t),this.curve._wnafMul(this,e)},Mr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)===0},Mr.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){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}},Mr.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)+">"},Mr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ul=Xo(function(e,t){var r=t;r.base=Ws,r.short=FA,r.mont=null,r.edwards=null}),Fl=Xo(function(e,t){var r=t,n=vn.assert;function i(l){l.type==="short"?this.curve=new Ul.short(l):l.type==="edwards"?this.curve=new Ul.edwards(l):this.curve=new Ul.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:hi.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:hi.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:hi.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:hi.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:hi.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:hi.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:hi.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:hi.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function hs(e){if(!(this instanceof hs))return new hs(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Xn.toArray(e.entropy,e.entropyEnc||"hex"),r=Xn.toArray(e.nonce,e.nonceEnc||"hex"),n=Xn.toArray(e.pers,e.persEnc||"hex");Mf(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Cm=hs;hs.prototype._init=function(e,t,r){var n=e.concat(t).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},hs.prototype._hmac=function(){return new hi.hmac(this.hash,this.K)},hs.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},hs.prototype.reseed=function(e,t,r,n){typeof t!="string"&&(n=r,r=t,t=null),e=Xn.toArray(e,t),r=Xn.toArray(r,n),Mf(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},hs.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=r,r=t,t=null),r&&(r=Xn.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(r),this._reseed++,Xn.encode(o,t)};var Nf=vn.assert;function Lr(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Tf=Lr;Lr.fromPublic=function(e,t,r){return t instanceof Lr?t:new Lr(e,{pub:t,pubEnc:r})},Lr.fromPrivate=function(e,t,r){return t instanceof Lr?t:new Lr(e,{priv:t,privEnc:r})},Lr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Lr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Lr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Lr.prototype._importPrivate=function(e,t){this.priv=new se(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Lr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Nf(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Nf(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Lr.prototype.derive=function(e){return e.validate()||Nf(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Lr.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},Lr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Lr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var jA=vn.assert;function jl(e,t){if(e instanceof jl)return e;this._importDER(e,t)||(jA(e.r&&e.s,"Signature without r or s"),this.r=new se(e.r,16),this.s=new se(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var kl=jl;function kA(){this.place=0}function Rf(e,t){var r=e[t.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,c=t.place;o<n;o++,c++)i<<=8,i|=e[c],i>>>=0;return i<=127?!1:(t.place=c,i)}function Dm(e){for(var t=0,r=e.length-1;!e[t]&&!(e[t+1]&128)&&t<r;)t++;return t===0?e:e.slice(t)}jl.prototype._importDER=function(e,t){e=vn.toArray(e,t);var r=new kA;if(e[r.place++]!==48)return!1;var n=Rf(e,r);if(n===!1||n+r.place!==e.length||e[r.place++]!==2)return!1;var i=Rf(e,r);if(i===!1)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,e[r.place++]!==2)return!1;var c=Rf(e,r);if(c===!1||e.length!==c+r.place)return!1;var l=e.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 se(o),this.s=new se(l),this.recoveryParam=null,!0};function Lf(e,t){if(t<128){e.push(t);return}var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(r|128);--r;)e.push(t>>>(r<<3)&255);e.push(t)}jl.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),r[0]&128&&(r=[0].concat(r)),t=Dm(t),r=Dm(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];Lf(n,t.length),n=n.concat(t),n.push(2),Lf(n,r.length);var i=n.concat(r),o=[48];return Lf(o,i.length),o=o.concat(i),vn.encode(o,e)};var qA=function(){throw new Error("unsupported")},Om=vn.assert;function On(e){if(!(this instanceof On))return new On(e);typeof e=="string"&&(Om(Object.prototype.hasOwnProperty.call(Fl,e),"Unknown curve "+e),e=Fl[e]),e instanceof Fl.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var zA=On;On.prototype.keyPair=function(e){return new Tf(this,e)},On.prototype.keyFromPrivate=function(e,t){return Tf.fromPrivate(this,e,t)},On.prototype.keyFromPublic=function(e,t){return Tf.fromPublic(this,e,t)},On.prototype.genKeyPair=function(e){e||(e={});for(var t=new Cm({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qA(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new se(2));;){var i=new se(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},On.prototype._truncateToN=function(e,t){var r=e.byteLength()*8-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},On.prototype.sign=function(e,t,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new se(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),c=e.toArray("be",i),l=new Cm({hash:this.hash,entropy:o,nonce:c,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new se(1)),h=0;;h++){var g=n.k?n.k(h):new se(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(),x=E.umod(this.n);if(x.cmpn(0)!==0){var I=g.invm(this.n).mul(x.mul(t.getPrivate()).iadd(e));if(I=I.umod(this.n),I.cmpn(0)!==0){var F=(_.getY().isOdd()?1:0)|(E.cmp(x)!==0?2:0);return n.canonical&&I.cmp(this.nh)>0&&(I=this.n.sub(I),F^=1),new kl({r:x,s:I,recoveryParam:F})}}}}}},On.prototype.verify=function(e,t,r,n){e=this._truncateToN(new se(e,16)),r=this.keyFromPublic(r,n),t=new kl(t,"hex");var i=t.r,o=t.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(e).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)},On.prototype.recoverPubKey=function(e,t,r,n){Om((3&r)===r,"The recovery param is more than two bits"),t=new kl(t,n);var i=this.n,o=new se(e),c=t.r,l=t.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=t.r.invm(i),_=i.sub(o).mul(g).umod(i),E=l.mul(g).umod(i);return this.g.mulAdd(_,c,E)},On.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new kl(t,n),t.recoveryParam!==null)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var HA=Xo(function(e,t){var r=t;r.version="6.5.4",r.utils=vn,r.rand=function(){throw new Error("unsupported")},r.curve=Ul,r.curves=Fl,r.ec=zA,r.eddsa=null}),KA=HA.ec;const WA="signing-key/5.7.0",Bf=new ue(WA);let Uf=null;function yi(){return Uf||(Uf=new KA("secp256k1")),Uf}class VA{constructor(t){sc(this,"curve","secp256k1"),sc(this,"privateKey",kr(t)),O4(this.privateKey)!==32&&Bf.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=yi().keyFromPrivate(or(this.privateKey));sc(this,"publicKey","0x"+r.getPublic(!1,"hex")),sc(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),sc(this,"_isSigningKey",!0)}_addPoint(t){const r=yi().keyFromPublic(or(this.publicKey)),n=yi().keyFromPublic(or(t));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const r=yi().keyFromPrivate(or(this.privateKey)),n=or(t);n.length!==32&&Bf.throwArgumentError("bad digest length","digest",t);const i=r.sign(n,{canonical:!0});return Fg({recoveryParam:i.recoveryParam,r:ui("0x"+i.r.toString(16),32),s:ui("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const r=yi().keyFromPrivate(or(this.privateKey)),n=yi().keyFromPublic(or(Pm(t)));return ui("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!!(t&&t._isSigningKey)}}function GA(e,t){const r=Fg(t),n={r:or(r.r),s:or(r.s)};return"0x"+yi().recoverPubKey(or(e),n,r.recoveryParam).encode("hex",!1)}function Pm(e,t){const r=or(e);if(r.length===32){const n=new VA(r);return t?"0x"+yi().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return t?kr(r):"0x"+yi().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return t?"0x"+yi().keyFromPublic(r).getPublic(!0,"hex"):kr(r)}return Bf.throwArgumentError("invalid public or private key","key","[REDACTED]")}const YA="transactions/5.7.0";new ue(YA);var Mm;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(Mm||(Mm={}));function QA(e){const t=Pm(e);return oE(Ug(wf(Ug(t,1)),12))}function JA(e,t){return QA(GA(or(e),t))}const ZA="https://rpc.walletconnect.com/v1";async function XA(e,t,r,n,i,o){switch(r.t){case"eip191":return t7(e,t,r.s);case"eip1271":return await e7(e,t,r.s,n,i,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function t7(e,t,r){return JA(em(t),r).toLowerCase()===e.toLowerCase()}async function e7(e,t,r,n,i,o){try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",f="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),g=em(t).substring(2),_=c+g+l+f+h,E=await fetch(`${o||ZA}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:r7(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:_},"latest"]})}),{result:x}=await E.json();return x?x.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function r7(){return Date.now()+Math.floor(Math.random()*1e3)}var n7=Object.defineProperty,i7=Object.defineProperties,s7=Object.getOwnPropertyDescriptors,$m=Object.getOwnPropertySymbols,o7=Object.prototype.hasOwnProperty,a7=Object.prototype.propertyIsEnumerable,Nm=(e,t,r)=>t in e?n7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c7=(e,t)=>{for(var r in t||(t={}))o7.call(t,r)&&Nm(e,r,t[r]);if($m)for(var r of $m(t))a7.call(t,r)&&Nm(e,r,t[r]);return e},l7=(e,t)=>i7(e,s7(t));const u7="did:pkh:",Ff=e=>e?.split(":"),Tm=e=>{const t=e&&Ff(e);if(t)return e.includes(u7)?t[3]:t[1]},Rm=e=>{const t=e&&Ff(e);if(t)return t[2]+":"+t[3]},ql=e=>{const t=e&&Ff(e);if(t)return t.pop()};async function Lm(e){const{cacao:t,projectId:r}=e,{s:n,p:i}=t,o=Bm(i,i.iss),c=ql(i.iss);return await XA(c,o,n,Tm(i.iss),r)}const Bm=(e,t)=>{const r=`${e.domain} wants you to sign in with your Ethereum account:`,n=ql(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=e.statement||void 0;const o=`URI: ${e.aud||e.uri}`,c=`Version: ${e.version}`,l=`Chain ID: ${Tm(t)}`,f=`Nonce: ${e.nonce}`,h=`Issued At: ${e.iat}`,g=e.exp?`Expiration Time: ${e.exp}`:void 0,_=e.nbf?`Not Before: ${e.nbf}`:void 0,E=e.requestId?`Request ID: ${e.requestId}`:void 0,x=e.resources?`Resources:${e.resources.map(F=>`
|
|
23
|
+
- ${F}`).join("")}`:void 0,I=zl(e.resources);if(I){const F=lc(I);i=y7(i,F)}return[r,n,"",i,"",o,c,l,f,h,g,_,E,x].filter(F=>F!=null).join(`
|
|
24
|
+
`)};function h7(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function f7(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function Vs(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(r=>{const n=e.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 d7(e,t,r,n={}){return r?.sort((i,o)=>i.localeCompare(o)),{att:{[e]:p7(t,r,n)}}}function p7(e,t,r={}){t=t?.sort((i,o)=>i.localeCompare(o));const n=t.map(i=>({[`${e}/${i}`]:[r]}));return Object.assign({},...n)}function Um(e){return Vs(e),`urn:recap:${h7(e).replace(/=/g,"")}`}function lc(e){const t=f7(e.replace("urn:recap:",""));return Vs(t),t}function g7(e,t,r){const n=d7(e,t,r);return Um(n)}function m7(e){return e&&e.includes("urn:recap:")}function v7(e,t){const r=lc(e),n=lc(t),i=w7(r,n);return Um(i)}function w7(e,t){Vs(e),Vs(t);const r=Object.keys(e.att).concat(Object.keys(t.att)).sort((i,o)=>i.localeCompare(o)),n={att:{}};return r.forEach(i=>{var o,c;Object.keys(((o=e.att)==null?void 0:o[i])||{}).concat(Object.keys(((c=t.att)==null?void 0:c[i])||{})).sort((l,f)=>l.localeCompare(f)).forEach(l=>{var f,h;n.att[i]=l7(c7({},n.att[i]),{[l]:((f=e.att[i])==null?void 0:f[l])||((h=t.att[i])==null?void 0:h[l])})})}),n}function y7(e="",t){Vs(t);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;const n=[];let i=0;Object.keys(t.att).forEach(l=>{const f=Object.keys(t.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`${e?e+" ":""}${c}`}function Fm(e){var t;const r=lc(e);Vs(r);const n=(t=r.att)==null?void 0:t.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function jm(e){const t=lc(e);Vs(t);const r=[];return Object.values(t.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 zl(e){if(!e)return;const t=e?.[e.length-1];return m7(t)?t:void 0}const km="base10",zr="base16",jf="base64pad",kf="utf8",qm=0,zi=1,b7=0,zm=1,qf=12,zf=32;function _7(){const e=df.generateKeyPair();return{privateKey:Yn(e.secretKey,zr),publicKey:Yn(e.publicKey,zr)}}function Hf(){const e=Bo.randomBytes(zf);return Yn(e,zr)}function E7(e,t){const r=df.sharedKey(Gn(e,zr),Gn(t,zr),!0),n=new r4(Cl.SHA256,r).expand(zf);return Yn(n,zr)}function Hl(e){const t=Cl.hash(Gn(e,zr));return Yn(t,zr)}function Gs(e){const t=Cl.hash(Gn(e,kf));return Yn(t,zr)}function A7(e){return Gn(`${e}`,km)}function uc(e){return Number(Yn(e,km))}function x7(e){const t=A7(typeof e.type<"u"?e.type:qm);if(uc(t)===zi&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof e.senderPublicKey<"u"?Gn(e.senderPublicKey,zr):void 0,n=typeof e.iv<"u"?Gn(e.iv,zr):Bo.randomBytes(qf),i=new uf.ChaCha20Poly1305(Gn(e.symKey,zr)).seal(n,Gn(e.message,kf));return S7({type:t,sealed:i,iv:n,senderPublicKey:r})}function I7(e){const t=new uf.ChaCha20Poly1305(Gn(e.symKey,zr)),{sealed:r,iv:n}=Kl(e.encoded),i=t.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Yn(i,kf)}function S7(e){if(uc(e.type)===zi){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Yn(mg([e.type,e.senderPublicKey,e.iv,e.sealed]),jf)}return Yn(mg([e.type,e.iv,e.sealed]),jf)}function Kl(e){const t=Gn(e,jf),r=t.slice(b7,zm),n=zm;if(uc(r)===zi){const l=n+zf,f=l+qf,h=t.slice(n,l),g=t.slice(l,f),_=t.slice(f);return{type:r,sealed:_,iv:g,senderPublicKey:h}}const i=n+qf,o=t.slice(n,i),c=t.slice(i);return{type:r,sealed:c,iv:o}}function C7(e,t){const r=Kl(e);return Hm({type:uc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Yn(r.senderPublicKey,zr):void 0,receiverPublicKey:t?.receiverPublicKey})}function Hm(e){const t=e?.type||qm;if(t===zi){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function Km(e){return e.type===zi&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}const D7="irn";function Kf(e){return e?.relay||{protocol:D7}}function hc(e){const t=n4[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var O7=Object.defineProperty,P7=Object.defineProperties,M7=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,$7=Object.prototype.hasOwnProperty,N7=Object.prototype.propertyIsEnumerable,Vm=(e,t,r)=>t in e?O7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Gm=(e,t)=>{for(var r in t||(t={}))$7.call(t,r)&&Vm(e,r,t[r]);if(Wm)for(var r of Wm(t))N7.call(t,r)&&Vm(e,r,t[r]);return e},T7=(e,t)=>P7(e,M7(t));function R7(e,t="-"){const r={},n="relay"+t;return Object.keys(e).forEach(i=>{if(i.startsWith(n)){const o=i.replace(n,""),c=e[i];r[o]=c}}),r}function Ym(e){e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),r=e.indexOf("?")!==-1?e.indexOf("?"):void 0,n=e.substring(0,t),i=e.substring(t+1,r).split("@"),o=typeof r<"u"?e.substring(r):"",c=Qa.parse(o),l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:L7(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:R7(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function L7(e){return e.startsWith("//")?e.substring(2):e}function B7(e,t="-"){const r="relay",n={};return Object.keys(e).forEach(i=>{const o=r+t+i;e[i]&&(n[o]=e[i])}),n}function U7(e){return`${e.protocol}:${e.topic}@${e.version}?`+Qa.stringify(Gm(T7(Gm({symKey:e.symKey},B7(e.relay)),{expiryTimestamp:e.expiryTimestamp}),e.methods?{methods:e.methods.join(",")}:{}))}function ta(e){const t=[];return e.forEach(r=>{const[n,i]=r.split(":");t.push(`${n}:${i}`)}),t}function F7(e){const t=[];return Object.values(e).forEach(r=>{t.push(...ta(r.accounts))}),t}function j7(e,t){const r=[];return Object.values(e).forEach(n=>{ta(n.accounts).includes(t)&&r.push(...n.methods)}),r}function k7(e,t){const r=[];return Object.values(e).forEach(n=>{ta(n.accounts).includes(t)&&r.push(...n.events)}),r}function Wf(e){return e.includes(":")}function fc(e){return Wf(e)?e.split(":")[0]:e}function q7(e){const t={};return e?.forEach(r=>{const[n,i]=r.split(":");t[n]||(t[n]={accounts:[],chains:[],events:[]}),t[n].accounts.push(r),t[n].chains.push(`${n}:${i}`)}),t}function Qm(e,t){t=t.map(n=>n.replace("did:pkh:",""));const r=q7(t);for(const[n,i]of Object.entries(r))i.methods?i.methods=Dl(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return r}const z7={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}},H7={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 mt(e,t){const{message:r,code:n}=H7[e];return{message:t?`${r} ${t}`:r,code:n}}function Ue(e,t){const{message:r,code:n}=z7[e];return{message:t?`${r} ${t}`:r,code:n}}function bi(e,t){return Array.isArray(e)?typeof t<"u"&&e.length?e.every(t):!0:!1}function dc(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Hr(e){return typeof e>"u"}function ur(e,t){return t&&Hr(e)?!0:typeof e=="string"&&!!e.trim().length}function Vf(e,t){return t&&Hr(e)?!0:typeof e=="number"&&!isNaN(e)}function K7(e,t){const{requiredNamespaces:r}=t,n=Object.keys(e.namespaces),i=Object.keys(r);let o=!0;return zs(i,n)?(n.forEach(c=>{const{accounts:l,methods:f,events:h}=e.namespaces[c],g=ta(l),_=r[c];(!zs(_g(c,_),g)||!zs(_.methods,f)||!zs(_.events,h))&&(o=!1)}),o):!1}function Wl(e){return ur(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function W7(e){if(ur(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const r=t[0]+":"+t[1];return!!t[2]&&Wl(r)}}return!1}function V7(e){if(ur(e,!1))try{return typeof new URL(e)<"u"}catch{return!1}return!1}function G7(e){var t;return(t=e?.proposer)==null?void 0:t.publicKey}function Y7(e){return e?.topic}function Q7(e,t){let r=null;return ur(e?.publicKey,!1)||(r=mt("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}function Jm(e){let t=!0;return bi(e)?e.length&&(t=e.every(r=>ur(r,!1))):t=!1,t}function J7(e,t,r){let n=null;return bi(t)&&t.length?t.forEach(i=>{n||Wl(i)||(n=Ue("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Wl(e)||(n=Ue("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 Z7(e,t,r){let n=null;return Object.entries(e).forEach(([i,o])=>{if(n)return;const c=J7(i,_g(i,o),`${t} ${r}`);c&&(n=c)}),n}function X7(e,t){let r=null;return bi(e)?e.forEach(n=>{r||W7(n)||(r=Ue("UNSUPPORTED_ACCOUNTS",`${t}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ue("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function tx(e,t){let r=null;return Object.values(e).forEach(n=>{if(r)return;const i=X7(n?.accounts,`${t} namespace`);i&&(r=i)}),r}function ex(e,t){let r=null;return Jm(e?.methods)?Jm(e?.events)||(r=Ue("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=Ue("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}function Zm(e,t){let r=null;return Object.values(e).forEach(n=>{if(r)return;const i=ex(n,`${t}, namespace`);i&&(r=i)}),r}function rx(e,t,r){let n=null;if(e&&dc(e)){const i=Zm(e,t);i&&(n=i);const o=Z7(e,t,r);o&&(n=o)}else n=mt("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return n}function Gf(e,t){let r=null;if(e&&dc(e)){const n=Zm(e,t);n&&(r=n);const i=tx(e,t);i&&(r=i)}else r=mt("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function Xm(e){return ur(e.protocol,!0)}function nx(e,t){let r=!1;return t&&!e?r=!0:e&&bi(e)&&e.length&&e.forEach(n=>{r=Xm(n)}),r}function ix(e){return typeof e=="number"}function sn(e){return typeof e<"u"&&typeof e!==null}function sx(e){return!(!e||typeof e!="object"||!e.code||!Vf(e.code,!1)||!e.message||!ur(e.message,!1))}function ox(e){return!(Hr(e)||!ur(e.method,!1))}function ax(e){return!(Hr(e)||Hr(e.result)&&Hr(e.error)||!Vf(e.id,!1)||!ur(e.jsonrpc,!1))}function tv(e){return!(Hr(e)||!ur(e.name,!1))}function Yf(e,t){return!(!Wl(t)||!F7(e).includes(t))}function cx(e,t,r){return ur(r,!1)?j7(e,t).includes(r):!1}function ev(e,t,r){return ur(r,!1)?k7(e,t).includes(r):!1}function rv(e,t,r){let n=null;const i=lx(e),o=ux(t),c=Object.keys(i),l=Object.keys(o),f=nv(Object.keys(e)),h=nv(Object.keys(t)),g=f.filter(_=>!h.includes(_));return g.length&&(n=mt("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
|
|
25
25
|
Required: ${g.toString()}
|
|
26
|
-
Received: ${Object.keys(
|
|
26
|
+
Received: ${Object.keys(t).toString()}`)),zs(c,l)||(n=mt("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
|
|
27
27
|
Required: ${c.toString()}
|
|
28
|
-
Approved: ${l.toString()}`)),Object.keys(
|
|
28
|
+
Approved: ${l.toString()}`)),Object.keys(t).forEach(_=>{if(!_.includes(":")||n)return;const E=ta(t[_].accounts);E.includes(_)||(n=mt("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${_}
|
|
29
29
|
Required: ${_}
|
|
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 OA(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 Pm(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function MA(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Zo(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 Nf(t,!1)&&t<=e.max&&t>=e.min}function $m(){const t=Va();return new Promise(e=>{switch(t){case gn.browser:e($A());break;case gn.reactNative:e(TA());break;case gn.node:e(NA());break;default:e(!0)}})}function $A(){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 NA(){return!0}function RA(t){switch(Va()){case gn.browser:LA(t);break;case gn.reactNative:BA(t);break}}function LA(t){!Uo()&&Fo()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function BA(t){Uo()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const Lf={};class ac{static get(e){return Lf[e]}static set(e,r){Lf[e]=r}static delete(e){delete Lf[e]}}const UA=/"(?:_|\\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*:/,FA=/"(?: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*:/,jA=/^\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){qA(t);return}return e}function qA(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Ll(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(!jA.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(UA.test(t)||FA.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 zA(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Er(t,...e){try{return zA(t(...e))}catch(r){return Promise.reject(r)}}function HA(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function KA(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Bl(t){if(HA(t))return String(t);if(KA(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Bl(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Tm(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const Bf="base64:";function WA(t){if(typeof t=="string")return t;Tm();const e=Buffer.from(t).toString("base64");return Bf+e}function VA(t){return typeof t!="string"||!t.startsWith(Bf)?t:(Tm(),Buffer.from(t.slice(Bf.length),"base64"))}function rn(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function GA(...t){return rn(t.join(":"))}function Ul(t){return t=rn(t),t?t+":":""}function wF(t){return t}const YA="memory",QA=()=>{const t=new Map;return{name:YA,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||QA()},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=rn(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 Nm(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,x=I=>{let k=E.get(I.base);return k||(k={driver:I.driver,base:I.base,items:[]},E.set(I.base,k)),k};for(const I of h){const k=typeof I=="string",W=rn(k?I:I.key),Y=k?void 0:I.value,B=k||!I.options?g:{...g,...I.options},z=r(W);x(z).items.push({key:W,value:Y,relativeKey:z.relativeKey,options:B})}return Promise.all([...E.values()].map(I=>_(I))).then(I=>I.flat())},f={hasItem(h,g={}){h=rn(h);const{relativeKey:_,driver:E}=r(h);return Er(E.hasItem,_,g)},getItem(h,g={}){h=rn(h);const{relativeKey:_,driver:E}=r(h);return Er(E.getItem,_,g).then(x=>Ll(x))},getItems(h,g){return l(h,g,_=>_.driver.getItems?Er(_.driver.getItems,_.items.map(E=>({key:E.relativeKey,options:E.options})),g).then(E=>E.map(x=>({key:GA(_.base,x.key),value:Ll(x.value)}))):Promise.all(_.items.map(E=>Er(_.driver.getItem,E.relativeKey,E.options).then(x=>({key:E.key,value:Ll(x)})))))},getItemRaw(h,g={}){h=rn(h);const{relativeKey:_,driver:E}=r(h);return E.getItemRaw?Er(E.getItemRaw,_,g):Er(E.getItem,_,g).then(x=>VA(x))},async setItem(h,g,_={}){if(g===void 0)return f.removeItem(h);h=rn(h);const{relativeKey:E,driver:x}=r(h);x.setItem&&(await Er(x.setItem,E,Bl(g),_),x.watch||i("update",h))},async setItems(h,g){await l(h,g,async _=>{_.driver.setItems&&await Er(_.driver.setItems,_.items.map(E=>({key:E.relativeKey,value:Bl(E.value),options:E.options})),g),_.driver.setItem&&await Promise.all(_.items.map(E=>Er(_.driver.setItem,E.relativeKey,Bl(E.value),E.options)))})},async setItemRaw(h,g,_={}){if(g===void 0)return f.removeItem(h,_);h=rn(h);const{relativeKey:E,driver:x}=r(h);if(x.setItemRaw)await Er(x.setItemRaw,E,g,_);else if(x.setItem)await Er(x.setItem,E,WA(g),_);else return;x.watch||i("update",h)},async removeItem(h,g={}){typeof g=="boolean"&&(g={removeMeta:g}),h=rn(h);const{relativeKey:_,driver:E}=r(h);E.removeItem&&(await Er(E.removeItem,_,g),(g.removeMeta||g.removeMata)&&await Er(E.removeItem,_+"$",g),E.watch||i("remove",h))},async getMeta(h,g={}){typeof g=="boolean"&&(g={nativeOnly:g}),h=rn(h);const{relativeKey:_,driver:E}=r(h),x=Object.create(null);if(E.getMeta&&Object.assign(x,await Er(E.getMeta,_,g)),!g.nativeOnly){const I=await Er(E.getItem,_+"$",g).then(k=>Ll(k));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(x,I))}return x},setMeta(h,g,_={}){return this.setItem(h+"$",g,_)},removeMeta(h,g={}){return this.removeItem(h+"$",g)},async getKeys(h,g={}){h=Ul(h);const _=n(h,!0);let E=[];const x=[];for(const I of _){const W=(await Er(I.driver.getKeys,I.relativeBase,g)).map(Y=>I.mountpoint+rn(Y)).filter(Y=>!E.some(B=>Y.startsWith(B)));x.push(...W),E=[I.mountpoint,...E.filter(Y=>!Y.startsWith(I.mountpoint))]}return h?x.filter(I=>I.startsWith(h)&&!I.endsWith("$")):x.filter(I=>!I.endsWith("$"))},async clear(h,g={}){h=Ul(h),await Promise.all(n(h,!1).map(async _=>{if(_.driver.clear)return Er(_.driver.clear,_.relativeBase,g);if(_.driver.removeItem){const E=await _.driver.getKeys(_.relativeBase||"",g);return Promise.all(E.map(x=>_.driver.removeItem(x,g)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>Rm(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=Ul(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(Nm(g,i,h)).then(_=>{e.unwatch[h]=_}).catch(console.error),f},async unmount(h,g=!0){h=Ul(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),g&&await Rm(e.mounts[h]),e.mountpoints=e.mountpoints.filter(_=>_!==h),delete e.mounts[h])},getMount(h=""){h=rn(h)+":";const g=r(h);return{driver:g.driver,base:g.base}},getMounts(h="",g={}){return h=rn(h),n(h,g.parents).map(E=>({driver:E.driver,base:E.mountpoint}))}};return f}function Nm(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function Rm(t){typeof t.dispose=="function"&&await Er(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 Lm(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 Uf;function cc(){return Uf||(Uf=Lm("keyval-store","keyval")),Uf}function Bm(t,e=cc()){return e("readonly",r=>Vs(r.get(t)))}function ZA(t,e,r=cc()){return r("readwrite",n=>(n.put(e,t),Vs(n.transaction)))}function XA(t,e=cc()){return e("readwrite",r=>(r.delete(t),Vs(r.transaction)))}function e7(t=cc()){return t("readwrite",e=>(e.clear(),Vs(e.transaction)))}function t7(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Vs(t.transaction)}function r7(t=cc()){return t("readonly",e=>{if(e.getAllKeys)return Vs(e.getAllKeys());const r=[];return t7(e,n=>r.push(n.key)).then(()=>r)})}const n7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),i7=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 lc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return i7(t)}catch{return t}}function ki(t){return typeof t=="string"?t:n7(t)||""}const s7="idb-keyval";var o7=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=Lm(t.dbName,t.storeName)),{name:s7,options:t,async hasItem(i){return!(typeof await Bm(r(i),n)>"u")},async getItem(i){return await Bm(r(i),n)??null},setItem(i,o){return ZA(r(i),o,n)},removeItem(i){return XA(r(i),n)},getKeys(){return r7(n)},clear(){return e7(n)}}};const a7="WALLET_CONNECT_V2_INDEXED_DB",c7="keyvaluestorage";class l7{constructor(){this.indexedDb=JA({driver:o7({dbName:a7,storeName:c7})})}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,ki(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var Ff=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Fl={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 Ff<"u"&&Ff.localStorage?Fl.exports=Ff.localStorage:typeof window<"u"&&window.localStorage?Fl.exports=window.localStorage:Fl.exports=new e})();function u7(t){var e;return[t[0],lc((e=t[1])!=null?e:"")]}class h7{constructor(){this.localStorage=Fl.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(u7)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return lc(r)}async setItem(e,r){this.localStorage.setItem(e,ki(r))}async removeItem(e){this.localStorage.removeItem(e)}}const f7="wc_storage_version",Um=1,d7=async(t,e,r)=>{const n=f7,i=await e.getItem(n);if(i&&i>=Um){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,Um),r(e),p7(t,c)},p7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class g7{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new h7;this.storage=e;try{const r=new l7;d7(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)})}}class Gs{}class m7 extends Gs{constructor(e){super()}}const Fm=ye.FIVE_SECONDS,uc={pulse:"heartbeat_pulse"};class jf extends m7{constructor(e){super(e),this.events=new Dr.exports.EventEmitter,this.interval=Fm,this.interval=e?.interval||Fm}static async init(e){const r=new jf(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}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 initialize(){this.intervalRef=setInterval(()=>this.pulse(),ye.toMiliseconds(this.interval))}pulse(){this.events.emit(uc.pulse)}}function v7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var w7=y7;function y7(t,e,r){var n=r&&r.stringify||v7,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,x=0;x<E;){if(t.charCodeAt(x)===37&&x+1<E){switch(_=_>-1?_:0,t.charCodeAt(x+1)){case 100:case 102:if(g>=f||e[g]==null)break;_<x&&(h+=t.slice(_,x)),h+=Number(e[g]),_=x+2,x++;break;case 105:if(g>=f||e[g]==null)break;_<x&&(h+=t.slice(_,x)),h+=Math.floor(Number(e[g])),_=x+2,x++;break;case 79:case 111:case 106:if(g>=f||e[g]===void 0)break;_<x&&(h+=t.slice(_,x));var I=typeof e[g];if(I==="string"){h+="'"+e[g]+"'",_=x+2,x++;break}if(I==="function"){h+=e[g].name||"<anonymous>",_=x+2,x++;break}h+=n(e[g]),_=x+2,x++;break;case 115:if(g>=f)break;_<x&&(h+=t.slice(_,x)),h+=String(e[g]),_=x+2,x++;break;case 37:_<x&&(h+=t.slice(_,x)),h+="%",_=x+2,x++,g--;break}++g}++x}return _===-1?t:(_<E&&(h+=t.slice(_)),h)}const jm=w7;var yi=bi;const hc=O7().console||{},b7={mapHttpRequest:kl,mapHttpResponse:kl,wrapRequestSerializer:qf,wrapResponseSerializer:qf,wrapErrorSerializer:qf,req:kl,res:kl,err:S7};function _7(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||hc;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=_7(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=fc),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:I7(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=fc,f.serializers=n,f._serialize=i,f._stdErrSerialize=o,f.child=x,e&&(f._logEvent=kf());function g(){return this.level==="silent"?1/0:this.levels.values[this.level]}function _(){return this._level}function E(I){if(I!=="silent"&&!this.levels.values[I])throw Error("unknown level "+I);this._level=I,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 x(I,k){if(!I)throw new Error("missing bindings for child Pino");k=k||{},i&&I.serializers&&(k.serializers=I.serializers);const W=k.serializers;if(i&&W){var Y=Object.assign({},n,W),B=t.browser.serialize===!0?Object.keys(Y):i;delete I.serializers,jl([I],B,Y,this._stdErrSerialize)}function z(M){this._childLevel=(M._childLevel|0)+1,this.error=ea(M,I,"error"),this.fatal=ea(M,I,"fatal"),this.warn=ea(M,I,"warn"),this.info=ea(M,I,"info"),this.debug=ea(M,I,"debug"),this.trace=ea(M,I,"trace"),Y&&(this.serializers=Y,this._serialize=B),e&&(this._logEvent=kf([].concat(M._logEvent.bindings,I)))}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=b7,bi.stdTimeFunctions=Object.assign({},{nullTime:km,epochTime:qm,unixTime:D7,isoTime:C7});function Xo(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?fc:i[r]?i[r]:hc[r]||hc[n]||fc,E7(t,e,r)}function E7(t,e,r){!t.transmit&&e[r]===fc||(e[r]=function(n){return function(){const o=t.timestamp(),c=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===hc?hc:this;for(var f=0;f<c.length;f++)c[f]=arguments[f];if(t.serialize&&!t.asObject&&jl(c,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(l,A7(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;x7(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 A7(t,e,r,n){t._serialize&&jl(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?jm(i.shift(),i):void 0}else typeof o=="string"&&(o=jm(i.shift(),i));return o!==void 0&&(c.msg=o),c}function jl(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 x7(t,e,r){const n=e.send,i=e.ts,o=e.methodLevel,c=e.methodValue,l=e.val,f=t._logEvent.bindings;jl(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=kf(f)}function kf(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function S7(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 I7(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?km:qm}function kl(){return{}}function qf(t){return t}function fc(){}function km(){return!1}function qm(){return Date.now()}function D7(){return Math.round(Date.now()/1e3)}function C7(){return new Date(Date.now()).toISOString()}function O7(){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 M7={level:"info"},dc="custom_context",zf=1e3*1024;class P7{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 zm{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new P7(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 Hm{constructor(e,r=zf){this.level=e??"error",this.levelValue=yi.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new zm(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(ki({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 zm(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(ki({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class $7{constructor(e,r=zf){this.baseChunkLogger=new Hm(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 T7{constructor(e,r=zf){this.baseChunkLogger=new Hm(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 N7=Object.defineProperty,R7=Object.defineProperties,L7=Object.getOwnPropertyDescriptors,Km=Object.getOwnPropertySymbols,B7=Object.prototype.hasOwnProperty,U7=Object.prototype.propertyIsEnumerable,Wm=(t,e,r)=>e in t?N7(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ql=(t,e)=>{for(var r in e||(e={}))B7.call(e,r)&&Wm(t,r,e[r]);if(Km)for(var r of Km(e))U7.call(e,r)&&Wm(t,r,e[r]);return t},zl=(t,e)=>R7(t,L7(e));function Hl(t){return zl(ql({},t),{level:t?.level||M7.level})}function F7(t,e=dc){return t[e]||""}function j7(t,e,r=dc){return t[r]=e,t}function nn(t,e=dc){let r="";return typeof t.bindings>"u"?r=F7(t,e):r=t.bindings().context||"",r}function k7(t,e,r=dc){const n=nn(t,r);return n.trim()?`${n}/${e}`:e}function sn(t,e,r=dc){const n=k7(t,e,r),i=t.child({context:n});return j7(i,n,r)}function q7(t){var e,r;const n=new $7((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:yi(zl(ql({},t.opts),{level:"trace",browser:zl(ql({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function z7(t){var e;const r=new T7((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:yi(zl(ql({},t.opts),{level:"trace"})),chunkLoggerController:r}}function H7(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?q7(t):z7(t)}class K7 extends Gs{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class W7 extends Gs{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class V7{constructor(e,r){this.logger=e,this.core=r}}class G7 extends Gs{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Y7 extends Gs{constructor(e){super()}}class Q7{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class J7 extends Gs{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Z7 extends Gs{constructor(e,r){super(),this.core=e,this.logger=r}}class X7{constructor(e,r){this.projectId=e,this.logger=r}}class ex{constructor(e,r){this.projectId=e,this.logger=r}}class tx{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class rx{constructor(e){this.client=e}}var Hf={},Vm={};(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,x=h%128<112?128:256;this._buffer[g]=128;for(var I=g+1;I<x-8;I++)this._buffer[I]=0;e.writeUint32BE(_,this._buffer,x-8),e.writeUint32BE(E,this._buffer,x-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,x),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 o(l,f,h,g,_,E,x){for(var I=h[0],k=h[1],W=h[2],Y=h[3],B=h[4],z=h[5],M=h[6],U=h[7],F=g[0],m=g[1],$=g[2],te=g[3],ee=g[4],ne=g[5],de=g[6],d=g[7],p,b,D,O,T,L,C,v;x>=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=I,A=k,re=W,q=Y,H=B,V=z,w=M,j=U,ie=F,he=m,le=$,Oe=te,Pe=ee,Ie=ne,Mt=de,ze=d;if(p=U,b=d,T=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)),T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=B&z^~B&M,b=ee&ne^~ee&de,T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=i[N*2],b=i[N*2+1],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=l[N%16],b=f[N%16],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,D=C&65535|v<<16,O=T&65535|L<<16,p=D,b=O,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=(I>>>28|F<<32-28)^(F>>>34-32|I<<32-(34-32))^(F>>>39-32|I<<32-(39-32)),b=(F>>>28|I<<32-28)^(I>>>34-32|F<<32-(34-32))^(I>>>39-32|F<<32-(39-32)),T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,p=I&k^I&W^k&W,b=F&m^F&$^m&$,T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,j=C&65535|v<<16,ze=T&65535|L<<16,p=q,b=Oe,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=D,b=O,T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,q=C&65535|v<<16,Oe=T&65535|L<<16,k=pe,W=A,Y=re,B=q,z=H,M=V,U=w,I=j,m=ie,$=he,te=le,ee=Oe,ne=Pe,de=Ie,d=Mt,F=ze,N%16===15)for(var oe=0;oe<16;oe++)p=l[oe],b=f[oe],T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=l[(oe+9)%16],b=f[(oe+9)%16],T+=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),T+=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),T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,l[oe]=C&65535|v<<16,f[oe]=T&65535|L<<16}p=I,b=F,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[0],b=g[0],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[0]=I=C&65535|v<<16,g[0]=F=T&65535|L<<16,p=k,b=m,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[1],b=g[1],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[1]=k=C&65535|v<<16,g[1]=m=T&65535|L<<16,p=W,b=$,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[2],b=g[2],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[2]=W=C&65535|v<<16,g[2]=$=T&65535|L<<16,p=Y,b=te,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[3],b=g[3],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[3]=Y=C&65535|v<<16,g[3]=te=T&65535|L<<16,p=B,b=ee,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[4],b=g[4],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[4]=B=C&65535|v<<16,g[4]=ee=T&65535|L<<16,p=z,b=ne,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[5],b=g[5],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[5]=z=C&65535|v<<16,g[5]=ne=T&65535|L<<16,p=M,b=de,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[6],b=g[6],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[6]=M=C&65535|v<<16,g[6]=de=T&65535|L<<16,p=U,b=d,T=b&65535,L=b>>>16,C=p&65535,v=p>>>16,p=h[7],b=g[7],T+=b&65535,L+=b>>>16,C+=p&65535,v+=p>>>16,L+=T>>>16,C+=L>>>16,v+=C>>>16,h[7]=U=C&65535|v<<16,g[7]=d=T&65535|L<<16,E+=128,x-=128}return E}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}t.hash=c})(Vm),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=Lo,r=Vm,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 x(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 w=q[V]+H+65535;H=Math.floor(w/65536),q[V]=w-H*65536}q[0]+=H-1+37*(H-1)}function k(q,H,V){const w=~(V-1);for(let j=0;j<16;j++){const ie=w&(q[j]^H[j]);q[j]^=ie,H[j]^=ie}}function W(q,H){const V=i(),w=i();for(let j=0;j<16;j++)w[j]=H[j];I(w),I(w),I(w);for(let j=0;j<2;j++){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,k(w,V,1-ie)}for(let j=0;j<16;j++)q[2*j]=w[j]&255,q[2*j+1]=w[j]>>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 M(q,H){for(let V=0;V<16;V++)q[V]=H[2*V]+(H[2*V+1]<<8);q[15]&=32767}function U(q,H,V){for(let w=0;w<16;w++)q[w]=H[w]+V[w]}function F(q,H,V){for(let w=0;w<16;w++)q[w]=H[w]-V[w]}function m(q,H,V){let w,j,ie=0,he=0,le=0,Oe=0,Pe=0,Ie=0,Mt=0,ze=0,Ce=0,Fe=0,Ee=0,Ae=0,Ge=0,be=0,xe=0,Be=0,_e=0,Me=0,je=0,$e=0,Te=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],Qe=V[3],Ve=V[4],Pt=V[5],Xe=V[6],et=V[7],Lt=V[8],tt=V[9],Je=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*Qe,Pe+=w*Ve,Ie+=w*Pt,Mt+=w*Xe,ze+=w*et,Ce+=w*Lt,Fe+=w*tt,Ee+=w*Je,Ae+=w*Ft,Ge+=w*Ze,be+=w*ke,xe+=w*Ht,Be+=w*rt,w=H[1],he+=w*Ye,le+=w*He,Oe+=w*Rt,Pe+=w*Qe,Ie+=w*Ve,Mt+=w*Pt,ze+=w*Xe,Ce+=w*et,Fe+=w*Lt,Ee+=w*tt,Ae+=w*Je,Ge+=w*Ft,be+=w*Ze,xe+=w*ke,Be+=w*Ht,_e+=w*rt,w=H[2],le+=w*Ye,Oe+=w*He,Pe+=w*Rt,Ie+=w*Qe,Mt+=w*Ve,ze+=w*Pt,Ce+=w*Xe,Fe+=w*et,Ee+=w*Lt,Ae+=w*tt,Ge+=w*Je,be+=w*Ft,xe+=w*Ze,Be+=w*ke,_e+=w*Ht,Me+=w*rt,w=H[3],Oe+=w*Ye,Pe+=w*He,Ie+=w*Rt,Mt+=w*Qe,ze+=w*Ve,Ce+=w*Pt,Fe+=w*Xe,Ee+=w*et,Ae+=w*Lt,Ge+=w*tt,be+=w*Je,xe+=w*Ft,Be+=w*Ze,_e+=w*ke,Me+=w*Ht,je+=w*rt,w=H[4],Pe+=w*Ye,Ie+=w*He,Mt+=w*Rt,ze+=w*Qe,Ce+=w*Ve,Fe+=w*Pt,Ee+=w*Xe,Ae+=w*et,Ge+=w*Lt,be+=w*tt,xe+=w*Je,Be+=w*Ft,_e+=w*Ze,Me+=w*ke,je+=w*Ht,$e+=w*rt,w=H[5],Ie+=w*Ye,Mt+=w*He,ze+=w*Rt,Ce+=w*Qe,Fe+=w*Ve,Ee+=w*Pt,Ae+=w*Xe,Ge+=w*et,be+=w*Lt,xe+=w*tt,Be+=w*Je,_e+=w*Ft,Me+=w*Ze,je+=w*ke,$e+=w*Ht,Te+=w*rt,w=H[6],Mt+=w*Ye,ze+=w*He,Ce+=w*Rt,Fe+=w*Qe,Ee+=w*Ve,Ae+=w*Pt,Ge+=w*Xe,be+=w*et,xe+=w*Lt,Be+=w*tt,_e+=w*Je,Me+=w*Ft,je+=w*Ze,$e+=w*ke,Te+=w*Ht,lt+=w*rt,w=H[7],ze+=w*Ye,Ce+=w*He,Fe+=w*Rt,Ee+=w*Qe,Ae+=w*Ve,Ge+=w*Pt,be+=w*Xe,xe+=w*et,Be+=w*Lt,_e+=w*tt,Me+=w*Je,je+=w*Ft,$e+=w*Ze,Te+=w*ke,lt+=w*Ht,Re+=w*rt,w=H[8],Ce+=w*Ye,Fe+=w*He,Ee+=w*Rt,Ae+=w*Qe,Ge+=w*Ve,be+=w*Pt,xe+=w*Xe,Be+=w*et,_e+=w*Lt,Me+=w*tt,je+=w*Je,$e+=w*Ft,Te+=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*Qe,be+=w*Ve,xe+=w*Pt,Be+=w*Xe,_e+=w*et,Me+=w*Lt,je+=w*tt,$e+=w*Je,Te+=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,be+=w*Qe,xe+=w*Ve,Be+=w*Pt,_e+=w*Xe,Me+=w*et,je+=w*Lt,$e+=w*tt,Te+=w*Je,lt+=w*Ft,Re+=w*Ze,Ne+=w*ke,nr+=w*Ht,dt+=w*rt,w=H[11],Ae+=w*Ye,Ge+=w*He,be+=w*Rt,xe+=w*Qe,Be+=w*Ve,_e+=w*Pt,Me+=w*Xe,je+=w*et,$e+=w*Lt,Te+=w*tt,lt+=w*Je,Re+=w*Ft,Ne+=w*Ze,nr+=w*ke,dt+=w*Ht,Et+=w*rt,w=H[12],Ge+=w*Ye,be+=w*He,xe+=w*Rt,Be+=w*Qe,_e+=w*Ve,Me+=w*Pt,je+=w*Xe,$e+=w*et,Te+=w*Lt,lt+=w*tt,Re+=w*Je,Ne+=w*Ft,nr+=w*Ze,dt+=w*ke,Et+=w*Ht,ir+=w*rt,w=H[13],be+=w*Ye,xe+=w*He,Be+=w*Rt,_e+=w*Qe,Me+=w*Ve,je+=w*Pt,$e+=w*Xe,Te+=w*et,lt+=w*Lt,Re+=w*tt,Ne+=w*Je,nr+=w*Ft,dt+=w*Ze,Et+=w*ke,ir+=w*Ht,St+=w*rt,w=H[14],xe+=w*Ye,Be+=w*He,_e+=w*Rt,Me+=w*Qe,je+=w*Ve,$e+=w*Pt,Te+=w*Xe,lt+=w*et,Re+=w*Lt,Ne+=w*tt,nr+=w*Je,dt+=w*Ft,Et+=w*Ze,ir+=w*ke,St+=w*Ht,Ot+=w*rt,w=H[15],Be+=w*Ye,_e+=w*He,Me+=w*Rt,je+=w*Qe,$e+=w*Ve,Te+=w*Pt,lt+=w*Xe,Re+=w*et,Ne+=w*Lt,nr+=w*tt,dt+=w*Je,Et+=w*Ft,ir+=w*Ze,St+=w*ke,Ot+=w*Ht,Vr+=w*rt,ie+=38*_e,he+=38*Me,le+=38*je,Oe+=38*$e,Pe+=38*Te,Ie+=38*lt,Mt+=38*Re,ze+=38*Ne,Ce+=38*nr,Fe+=38*dt,Ee+=38*Et,Ae+=38*ir,Ge+=38*St,be+=38*Ot,xe+=38*Vr,j=1,w=ie+j+65535,j=Math.floor(w/65536),ie=w-j*65536,w=he+j+65535,j=Math.floor(w/65536),he=w-j*65536,w=le+j+65535,j=Math.floor(w/65536),le=w-j*65536,w=Oe+j+65535,j=Math.floor(w/65536),Oe=w-j*65536,w=Pe+j+65535,j=Math.floor(w/65536),Pe=w-j*65536,w=Ie+j+65535,j=Math.floor(w/65536),Ie=w-j*65536,w=Mt+j+65535,j=Math.floor(w/65536),Mt=w-j*65536,w=ze+j+65535,j=Math.floor(w/65536),ze=w-j*65536,w=Ce+j+65535,j=Math.floor(w/65536),Ce=w-j*65536,w=Fe+j+65535,j=Math.floor(w/65536),Fe=w-j*65536,w=Ee+j+65535,j=Math.floor(w/65536),Ee=w-j*65536,w=Ae+j+65535,j=Math.floor(w/65536),Ae=w-j*65536,w=Ge+j+65535,j=Math.floor(w/65536),Ge=w-j*65536,w=be+j+65535,j=Math.floor(w/65536),be=w-j*65536,w=xe+j+65535,j=Math.floor(w/65536),xe=w-j*65536,w=Be+j+65535,j=Math.floor(w/65536),Be=w-j*65536,ie+=j-1+37*(j-1),j=1,w=ie+j+65535,j=Math.floor(w/65536),ie=w-j*65536,w=he+j+65535,j=Math.floor(w/65536),he=w-j*65536,w=le+j+65535,j=Math.floor(w/65536),le=w-j*65536,w=Oe+j+65535,j=Math.floor(w/65536),Oe=w-j*65536,w=Pe+j+65535,j=Math.floor(w/65536),Pe=w-j*65536,w=Ie+j+65535,j=Math.floor(w/65536),Ie=w-j*65536,w=Mt+j+65535,j=Math.floor(w/65536),Mt=w-j*65536,w=ze+j+65535,j=Math.floor(w/65536),ze=w-j*65536,w=Ce+j+65535,j=Math.floor(w/65536),Ce=w-j*65536,w=Fe+j+65535,j=Math.floor(w/65536),Fe=w-j*65536,w=Ee+j+65535,j=Math.floor(w/65536),Ee=w-j*65536,w=Ae+j+65535,j=Math.floor(w/65536),Ae=w-j*65536,w=Ge+j+65535,j=Math.floor(w/65536),Ge=w-j*65536,w=be+j+65535,j=Math.floor(w/65536),be=w-j*65536,w=xe+j+65535,j=Math.floor(w/65536),xe=w-j*65536,w=Be+j+65535,j=Math.floor(w/65536),Be=w-j*65536,ie+=j-1+37*(j-1),q[0]=ie,q[1]=he,q[2]=le,q[3]=Oe,q[4]=Pe,q[5]=Ie,q[6]=Mt,q[7]=ze,q[8]=Ce,q[9]=Fe,q[10]=Ee,q[11]=Ae,q[12]=Ge,q[13]=be,q[14]=xe,q[15]=Be}function $(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--)$(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--)$(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(),j=i(),ie=i(),he=i(),le=i(),Oe=i(),Pe=i(),Ie=i();F(V,q[1],q[0]),F(Ie,H[1],H[0]),m(V,V,Ie),U(w,q[0],q[1]),U(Ie,H[0],H[1]),m(w,w,Ie),m(j,q[3],H[3]),m(j,j,h),m(ie,q[2],H[2]),U(ie,ie,ie),F(he,w,V),F(le,ie,j),U(Oe,ie,j),U(Pe,w,V),m(q[0],he,le),m(q[1],Pe,Oe),m(q[2],Oe,le),m(q[3],he,Pe)}function de(q,H,V){for(let w=0;w<4;w++)k(q[w],H[w],V)}function d(q,H){const V=i(),w=i(),j=i();te(j,H[2]),m(V,H[0],j),m(w,H[1],j),W(q,w),q[31]^=z(V)<<7}function p(q,H,V){x(q[0],c),x(q[1],l),x(q[2],l),x(q[3],c);for(let w=255;w>=0;--w){const j=V[w/8|0]>>(w&7)&1;de(q,H,j),ne(H,q),ne(q,q),de(q,H,j)}}function b(q,H){const V=[i(),i(),i(),i()];x(V[0],g),x(V[1],_),x(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 j=new Uint8Array(64);return j.set(q),j.set(V,32),{publicKey:V,secretKey:j}}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 T(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=T;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,j,ie;for(w=63;w>=32;--w){for(V=0,j=w-32,ie=w-12;j<ie;++j)H[j]+=V-16*H[w]*L[j-(w-32)],V=Math.floor((H[j]+128)/256),H[j]-=V*256;H[j]+=V,H[w]=0}for(V=0,j=0;j<32;j++)H[j]+=V-(H[31]>>4)*L[j],V=H[j]>>8,H[j]&=255;for(j=0;j<32;j++)H[j]-=V*L[j];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()],j=(0,r.hash)(q.subarray(0,32));j[0]&=248,j[31]&=127,j[31]|=64;const ie=new Uint8Array(64);ie.set(j.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 Pe=0;Pe<32;Pe++)V[Pe]=le[Pe];for(let Pe=0;Pe<32;Pe++)for(let Ie=0;Ie<32;Ie++)V[Pe+Ie]+=Oe[Pe]*j[Ie];return C(ie.subarray(32),V),ie}t.sign=N;function oe(q,H){const V=i(),w=i(),j=i(),ie=i(),he=i(),le=i(),Oe=i();return x(q[2],l),M(q[1],H),$(j,q[1]),m(ie,j,f),F(j,j,q[2]),U(ie,q[2],ie),$(he,ie),$(le,he),m(Oe,le,he),m(V,Oe,j),m(V,V,ie),ee(V,V),m(V,V,j),m(V,V,ie),m(V,V,ie),m(q[0],V,ie),$(w,q[0]),m(w,w,ie),B(w,j)&&m(q[0],q[0],E),$(w,q[0]),m(w,w,ie),B(w,j)?-1:(z(q[0])===H[31]>>7&&F(q[0],c,q[0]),m(q[3],q[0],q[1]),0)}function pe(q,H,V){const w=new Uint8Array(32),j=[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(j,ie,le),b(ie,V.subarray(32)),ne(j,ie),d(w,j),!Y(V,w)}t.verify=pe;function A(q){let H=[i(),i(),i(),i()];if(oe(H,q))throw new Error("Ed25519: invalid public key");let V=i(),w=i(),j=H[1];U(V,l,j),F(w,l,j),te(w,w),m(V,V,w);let ie=new Uint8Array(32);return W(ie,V),ie}t.convertPublicKeyToX25519=A;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}(Hf);const nx="EdDSA",ix="JWT",Gm=".",Ym="base64url",sx="utf8",ox="utf8",ax=":",cx="did",lx="key",Qm="base58btc",ux="z",hx="K36",fx=32;function Kf(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Jm(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Kf(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function dx(t,e){e||(e=t.reduce((i,o)=>i+o.length,0));const r=Jm(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return Kf(r)}function Zm(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Xm=Zm("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Wf=Zm("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=Jm(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),ev={utf8:Xm,"utf-8":Xm,hex:Bo.base16,latin1:Wf,ascii:Wf,binary:Wf,...Bo};function Vf(t,e="utf8"){const r=ev[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)}function Gf(t,e="utf8"){const r=ev[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Kf(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Kl(t){return Vf(Gf(ki(t),sx),Ym)}function tv(t){const e=Gf(hx,Qm),r=ux+Vf(dx([e,t]),Qm);return[cx,lx,r].join(ax)}function px(t){return Vf(t,Ym)}function gx(t){return Gf([Kl(t.header),Kl(t.payload)].join(Gm),ox)}function mx(t){return[Kl(t.header),Kl(t.payload),px(t.signature)].join(Gm)}function rv(t=Lo.randomBytes(fx)){return Hf.generateKeyPairFromSeed(t)}async function vx(t,e,r,n,i=ye.fromMiliseconds(Date.now())){const o={alg:nx,typ:ix},c=tv(n.publicKey),l=i+r,f={iss:c,sub:t,aud:e,iat:i,exp:l},h=gx({header:o,payload:f}),g=Hf.sign(n.secretKey,h);return mx({header:o,payload:f,signature:g})}function wx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function nv(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const iv=nv("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Yf=nv("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=wx(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),yx={utf8:iv,"utf-8":iv,hex:Bo.base16,latin1:Yf,ascii:Yf,binary:Yf,...Bo};function bx(t,e="utf8"){const r=yx[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 _x="PARSE_ERROR",Ex="INVALID_REQUEST",Ax="METHOD_NOT_FOUND",xx="INVALID_PARAMS",sv="INTERNAL_ERROR",Qf="SERVER_ERROR",Sx=[-32700,-32600,-32601,-32602,-32603],pc={[_x]:{code:-32700,message:"Parse error"},[Ex]:{code:-32600,message:"Invalid Request"},[Ax]:{code:-32601,message:"Method not found"},[xx]:{code:-32602,message:"Invalid params"},[sv]:{code:-32603,message:"Internal error"},[Qf]:{code:-32e3,message:"Server error"}},ov=Qf;function Ix(t){return Sx.includes(t)}function av(t){return Object.keys(pc).includes(t)?pc[t]:pc[ov]}function Dx(t){const e=Object.values(pc).find(r=>r.code===t);return e||pc[ov]}function cv(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var lv={};/*! *****************************************************************************
|
|
30
|
+
Approved: ${E.toString()}`))}),c.forEach(_=>{n||(zs(i[_].methods,o[_].methods)?zs(i[_].events,o[_].events)||(n=mt("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${_}`)):n=mt("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${_}`))}),n}function lx(e){const t={};return Object.keys(e).forEach(r=>{var n;r.includes(":")?t[r]=e[r]:(n=e[r].chains)==null||n.forEach(i=>{t[i]={methods:e[r].methods,events:e[r].events}})}),t}function nv(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}function ux(e){const t={};return Object.keys(e).forEach(r=>{if(r.includes(":"))t[r]=e[r];else{const n=ta(e[r].accounts);n?.forEach(i=>{t[i]={accounts:e[r].accounts.filter(o=>o.includes(`${i}:`)),methods:e[r].methods,events:e[r].events}})}}),t}function hx(e,t){return Vf(e,!1)&&e<=t.max&&e>=t.min}function iv(){const e=tc();return new Promise(t=>{switch(e){case gn.browser:t(fx());break;case gn.reactNative:t(dx());break;case gn.node:t(px());break;default:t(!0)}})}function fx(){return ko()&&navigator?.onLine}async function dx(){if(jo()&&typeof global<"u"&&global!=null&&global.NetInfo){const e=await(global==null?void 0:global.NetInfo.fetch());return e?.isConnected}return!0}function px(){return!0}function gx(e){switch(tc()){case gn.browser:mx(e);break;case gn.reactNative:vx(e);break}}function mx(e){!jo()&&ko()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function vx(e){jo()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(t=>e(t?.isConnected))}const Qf={};class pc{static get(t){return Qf[t]}static set(t,r){Qf[t]=r}static delete(t){delete Qf[t]}}function wx(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function sv(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const ov=sv("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),Jf=sv("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);const t=wx(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),yx={utf8:ov,"utf-8":ov,hex:Uo.base16,latin1:Jf,ascii:Jf,binary:Jf,...Uo};function bx(e,t="utf8"){const r=yx[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}const _x="PARSE_ERROR",Ex="INVALID_REQUEST",Ax="METHOD_NOT_FOUND",xx="INVALID_PARAMS",av="INTERNAL_ERROR",Zf="SERVER_ERROR",Ix=[-32700,-32600,-32601,-32602,-32603],gc={[_x]:{code:-32700,message:"Parse error"},[Ex]:{code:-32600,message:"Invalid Request"},[Ax]:{code:-32601,message:"Method not found"},[xx]:{code:-32602,message:"Invalid params"},[av]:{code:-32603,message:"Internal error"},[Zf]:{code:-32e3,message:"Server error"}},cv=Zf;function Sx(e){return Ix.includes(e)}function lv(e){return Object.keys(gc).includes(e)?gc[e]:gc[cv]}function Cx(e){const t=Object.values(gc).find(r=>r.code===e);return t||gc[cv]}function uv(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${t}`):e}var hv={};/*! *****************************************************************************
|
|
31
31
|
Copyright (c) Microsoft Corporation.
|
|
32
32
|
|
|
33
33
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -40,84 +40,84 @@
|
|
|
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 Jf=function(t,e){return Jf=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])},Jf(t,e)};function Cx(t,e){Jf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Zf=function(){return Zf=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},Zf.apply(this,arguments)};function Ox(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 Mx(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 Px(t,e){return function(r,n){e(r,n,t)}}function $x(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Tx(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 Nx(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 Rx(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Lx(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Xf(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 uv(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 Bx(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(uv(arguments[e]));return t}function Ux(){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 gc(t){return this instanceof gc?(this.v=t,this):new gc(t)}function Fx(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(x){return new Promise(function(I,k){o.push([E,x,I,k])>1||l(E,x)})})}function l(E,x){try{f(n[E](x))}catch(I){_(o[0][3],I)}}function f(E){E.value instanceof gc?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,x){E(x),o.shift(),o.length&&l(o[0][0],o[0][1])}}function jx(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:gc(t[i](c)),done:i==="return"}:o?o(c):c}:o}}function kx(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 Xf=="function"?Xf(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 qx(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function zx(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 Hx(t){return t&&t.__esModule?t:{default:t}}function Kx(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Wx(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 Vx=Object.freeze({__proto__:null,__extends:Cx,get __assign(){return Zf},__rest:Ox,__decorate:Mx,__param:Px,__metadata:$x,__awaiter:Tx,__generator:Nx,__createBinding:Rx,__exportStar:Lx,__values:Xf,__read:uv,__spread:Bx,__spreadArrays:Ux,__await:gc,__asyncGenerator:Fx,__asyncDelegator:jx,__asyncValues:kx,__makeTemplateObject:qx,__importStar:zx,__importDefault:Hx,__classPrivateFieldGet:Kx,__classPrivateFieldSet:Wx}),Gx=il(Vx),qi={},hv;function Yx(){if(hv)return qi;hv=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.isBrowserCryptoAvailable=qi.getSubtleCrypto=qi.getBrowerCrypto=void 0;function t(){return jr?.crypto||jr?.msCrypto||{}}qi.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}qi.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return qi.isBrowserCryptoAvailable=r,qi}var zi={},fv;function Qx(){if(fv)return zi;fv=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.isBrowser=zi.isNode=zi.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zi.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}zi.isNode=e;function r(){return!t()&&!e()}return zi.isBrowser=r,zi}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Gx;e.__exportStar(Yx(),t),e.__exportStar(Qx(),t)})(lv);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 Ys(t=6){return BigInt(us(t))}function ta(t,e,r){return{id:r||us(),jsonrpc:"2.0",method:t,params:e}}function Wl(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Vl(t,e,r){return{id:t,jsonrpc:"2.0",error:Jx(e,r)}}function Jx(t,e){return typeof t>"u"?av(sv):(typeof t=="string"&&(t=Object.assign(Object.assign({},av(Qf)),{message:t})),typeof e<"u"&&(t.data=e),Ix(t.code)&&(t=Dx(t.code)),t)}class Zx{}class Xx extends Zx{constructor(){super()}}class e9 extends Xx{constructor(e){super()}}const t9="^https?:",r9="^wss?:";function n9(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function dv(t,e){const r=n9(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function pv(t){return dv(t,t9)}function gv(t){return dv(t,r9)}function i9(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function mv(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function e0(t){return mv(t)&&"method"in t}function Gl(t){return mv(t)&&(_i(t)||Mn(t))}function _i(t){return"result"in t}function Mn(t){return"error"in t}class Hi extends e9{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||Ys().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),Gl(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 s9=()=>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"),o9=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",vv=t=>t.split("?")[0],wv=10,a9=s9();class c9{constructor(e){if(this.url=e,this.events=new Dr.exports.EventEmitter,this.registering=!1,!gv(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(ki(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!gv(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=lv.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!i9(e)},c=new a9(e,[],o);o9()?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"?lc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),o=Vl(e,i);this.events.emit("payload",o)}parseError(e,r=this.url){return cv(e,vv(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>wv&&this.events.setMaxListeners(wv)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${vv(this.url)}`));return this.events.emit("register_error",r),r}}var t0={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]",x="[object Function]",I="[object GeneratorFunction]",k="[object Map]",W="[object Number]",Y="[object Null]",B="[object Object]",z="[object Promise]",M="[object Proxy]",U="[object RegExp]",F="[object Set]",m="[object String]",$="[object Symbol]",te="[object Undefined]",ee="[object WeakMap]",ne="[object ArrayBuffer]",de="[object DataView]",d="[object Float32Array]",p="[object Float64Array]",b="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",L="[object Uint8ClampedArray]",C="[object Uint16Array]",v="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,pe=/^(?:0|[1-9]\d*)$/,A={};A[d]=A[p]=A[b]=A[D]=A[O]=A[T]=A[L]=A[C]=A[v]=!0,A[l]=A[f]=A[ne]=A[g]=A[de]=A[_]=A[E]=A[x]=A[k]=A[W]=A[B]=A[U]=A[F]=A[m]=A[ee]=!1;var re=typeof jr=="object"&&jr&&jr.Object===Object&&jr,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,j=w&&w.exports===V,ie=j&&re.process,he=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),le=he&&he.isTypedArray;function Oe(K,J){for(var fe=-1,Se=K==null?0:K.length,Vt=0,ot=[];++fe<Se;){var Zt=K[fe];J(Zt,fe,K)&&(ot[Vt++]=Zt)}return ot}function Pe(K,J){for(var fe=-1,Se=J.length,Vt=K.length;++fe<Se;)K[Vt+fe]=J[fe];return K}function Ie(K,J){for(var fe=-1,Se=K==null?0:K.length;++fe<Se;)if(J(K[fe],fe,K))return!0;return!1}function Mt(K,J){for(var fe=-1,Se=Array(K);++fe<K;)Se[fe]=J(fe);return Se}function ze(K){return function(J){return K(J)}}function Ce(K,J){return K.has(J)}function Fe(K,J){return K?.[J]}function Ee(K){var J=-1,fe=Array(K.size);return K.forEach(function(Se,Vt){fe[++J]=[Vt,Se]}),fe}function Ae(K,J){return function(fe){return K(J(fe))}}function Ge(K){var J=-1,fe=Array(K.size);return K.forEach(function(Se){fe[++J]=Se}),fe}var be=Array.prototype,xe=Function.prototype,Be=Object.prototype,_e=H["__core-js_shared__"],Me=xe.toString,je=Be.hasOwnProperty,$e=function(){var K=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||"");return K?"Symbol(src)_1."+K:""}(),Te=Be.toString,lt=RegExp("^"+Me.call(je).replace(N,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=j?H.Buffer:void 0,Ne=H.Symbol,nr=H.Uint8Array,dt=Be.propertyIsEnumerable,Et=be.splice,ir=Ne?Ne.toStringTag:void 0,St=Object.getOwnPropertySymbols,Ot=Re?Re.isBuffer:void 0,Vr=Ae(Object.keys,Object),Ye=bn(H,"DataView"),He=bn(H,"Map"),Rt=bn(H,"Promise"),Qe=bn(H,"Set"),Ve=bn(H,"WeakMap"),Pt=bn(Object,"create"),Xe=Yi(Ye),et=Yi(He),Lt=Yi(Rt),tt=Yi(Qe),Je=Yi(Ve),Ft=Ne?Ne.prototype:void 0,Ze=Ft?Ft.valueOf:void 0;function ke(K){var J=-1,fe=K==null?0:K.length;for(this.clear();++J<fe;){var Se=K[J];this.set(Se[0],Se[1])}}function Ht(){this.__data__=Pt?Pt(null):{},this.size=0}function rt(K){var J=this.has(K)&&delete this.__data__[K];return this.size-=J?1:0,J}function jt(K){var J=this.__data__;if(Pt){var fe=J[K];return fe===n?void 0:fe}return je.call(J,K)?J[K]:void 0}function ti(K){var J=this.__data__;return Pt?J[K]!==void 0:je.call(J,K)}function kt(K,J){var fe=this.__data__;return this.size+=this.has(K)?0:1,fe[K]=Pt&&J===void 0?n:J,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 J=-1,fe=K==null?0:K.length;for(this.clear();++J<fe;){var Se=K[J];this.set(Se[0],Se[1])}}function Nn(){this.__data__=[],this.size=0}function Rn(K){var J=this.__data__,fe=bo(J,K);if(fe<0)return!1;var Se=J.length-1;return fe==Se?J.pop():Et.call(J,fe,1),--this.size,!0}function Ln(K){var J=this.__data__,fe=bo(J,K);return fe<0?void 0:J[fe][1]}function Bn(K){return bo(this.__data__,K)>-1}function Un(K,J){var fe=this.__data__,Se=bo(fe,K);return Se<0?(++this.size,fe.push([K,J])):fe[Se][1]=J,this}vt.prototype.clear=Nn,vt.prototype.delete=Rn,vt.prototype.get=Ln,vt.prototype.has=Bn,vt.prototype.set=Un;function xr(K){var J=-1,fe=K==null?0:K.length;for(this.clear();++J<fe;){var Se=K[J];this.set(Se[0],Se[1])}}function Ci(){this.size=0,this.__data__={hash:new ke,map:new(He||vt),string:new ke}}function fo(K){var J=Cs(this,K).delete(K);return this.size-=J?1:0,J}function Oi(K){return Cs(this,K).get(K)}function po(K){return Cs(this,K).has(K)}function go(K,J){var fe=Cs(this,K),Se=fe.size;return fe.set(K,J),this.size+=fe.size==Se?0:1,this}xr.prototype.clear=Ci,xr.prototype.delete=fo,xr.prototype.get=Oi,xr.prototype.has=po,xr.prototype.set=go;function Mi(K){var J=-1,fe=K==null?0:K.length;for(this.__data__=new xr;++J<fe;)this.add(K[J])}function Is(K){return this.__data__.set(K,n),this}function Ds(K){return this.__data__.has(K)}Mi.prototype.add=Mi.prototype.push=Is,Mi.prototype.has=Ds;function Gr(K){var J=this.__data__=new vt(K);this.size=J.size}function mo(){this.__data__=new vt,this.size=0}function vo(K){var J=this.__data__,fe=J.delete(K);return this.size=J.size,fe}function wo(K){return this.__data__.get(K)}function yo(K){return this.__data__.has(K)}function Pu(K,J){var fe=this.__data__;if(fe instanceof vt){var Se=fe.__data__;if(!He||Se.length<r-1)return Se.push([K,J]),this.size=++fe.size,this;fe=this.__data__=new xr(Se)}return fe.set(K,J),this.size=fe.size,this}Gr.prototype.clear=mo,Gr.prototype.delete=vo,Gr.prototype.get=wo,Gr.prototype.has=yo,Gr.prototype.set=Pu;function $u(K,J){var fe=Sa(K),Se=!fe&&Hu(K),Vt=!fe&&!Se&&kc(K),ot=!fe&&!Se&&!Vt&&Vu(K),Zt=fe||Se||Vt||ot,gr=Zt?Mt(K.length,String):[],It=gr.length;for(var Gt in K)(J||je.call(K,Gt))&&!(Zt&&(Gt=="length"||Vt&&(Gt=="offset"||Gt=="parent")||ot&&(Gt=="buffer"||Gt=="byteLength"||Gt=="byteOffset")||Fu(Gt,It)))&&gr.push(Gt);return gr}function bo(K,J){for(var fe=K.length;fe--;)if(zu(K[fe][0],J))return fe;return-1}function Fc(K,J,fe){var Se=J(K);return Sa(K)?Se:Pe(Se,fe(K))}function _o(K){return K==null?K===void 0?te:Y:ir&&ir in Object(K)?Bu(K):Td(K)}function jc(K){return Ao(K)&&_o(K)==l}function Eo(K,J,fe,Se,Vt){return K===J?!0:K==null||J==null||!Ao(K)&&!Ao(J)?K!==K&&J!==J:Tu(K,J,fe,Se,Eo,Vt)}function Tu(K,J,fe,Se,Vt,ot){var Zt=Sa(K),gr=Sa(J),It=Zt?f:Pi(K),Gt=gr?f:Pi(J);It=It==l?B:It,Gt=Gt==l?B:Gt;var fr=It==B,ln=Gt==B,mr=It==Gt;if(mr&&kc(K)){if(!kc(J))return!1;Zt=!0,fr=!1}if(mr&&!fr)return ot||(ot=new Gr),Zt||Vu(K)?Aa(K,J,fe,Se,Vt,ot):$d(K,J,It,fe,Se,Vt,ot);if(!(fe&i)){var Xt=fr&&je.call(K,"__wrapped__"),Yr=ln&&je.call(J,"__wrapped__");if(Xt||Yr){var ri=Xt?K.value():K,Fn=Yr?J.value():J;return ot||(ot=new Gr),Vt(ri,Fn,fe,Se,ot)}}return mr?(ot||(ot=new Gr),Lu(K,J,fe,Se,Vt,ot)):!1}function Pd(K){if(!Wu(K)||ku(K))return!1;var J=Ia(K)?lt:oe;return J.test(Yi(K))}function Nu(K){return Ao(K)&&Ku(K.length)&&!!A[_o(K)]}function Ru(K){if(!qu(K))return Vr(K);var J=[];for(var fe in Object(K))je.call(K,fe)&&fe!="constructor"&&J.push(fe);return J}function Aa(K,J,fe,Se,Vt,ot){var Zt=fe&i,gr=K.length,It=J.length;if(gr!=It&&!(Zt&&It>gr))return!1;var Gt=ot.get(K);if(Gt&&ot.get(J))return Gt==J;var fr=-1,ln=!0,mr=fe&o?new Mi:void 0;for(ot.set(K,J),ot.set(J,K);++fr<gr;){var Xt=K[fr],Yr=J[fr];if(Se)var ri=Zt?Se(Yr,Xt,fr,J,K,ot):Se(Xt,Yr,fr,K,J,ot);if(ri!==void 0){if(ri)continue;ln=!1;break}if(mr){if(!Ie(J,function(Fn,$i){if(!Ce(mr,$i)&&(Xt===Fn||Vt(Xt,Fn,fe,Se,ot)))return mr.push($i)})){ln=!1;break}}else if(!(Xt===Yr||Vt(Xt,Yr,fe,Se,ot))){ln=!1;break}}return ot.delete(K),ot.delete(J),ln}function $d(K,J,fe,Se,Vt,ot,Zt){switch(fe){case de:if(K.byteLength!=J.byteLength||K.byteOffset!=J.byteOffset)return!1;K=K.buffer,J=J.buffer;case ne:return!(K.byteLength!=J.byteLength||!ot(new nr(K),new nr(J)));case g:case _:case W:return zu(+K,+J);case E:return K.name==J.name&&K.message==J.message;case U:case m:return K==J+"";case k:var gr=Ee;case F:var It=Se&i;if(gr||(gr=Ge),K.size!=J.size&&!It)return!1;var Gt=Zt.get(K);if(Gt)return Gt==J;Se|=o,Zt.set(K,J);var fr=Aa(gr(K),gr(J),Se,Vt,ot,Zt);return Zt.delete(K),fr;case $:if(Ze)return Ze.call(K)==Ze.call(J)}return!1}function Lu(K,J,fe,Se,Vt,ot){var Zt=fe&i,gr=xa(K),It=gr.length,Gt=xa(J),fr=Gt.length;if(It!=fr&&!Zt)return!1;for(var ln=It;ln--;){var mr=gr[ln];if(!(Zt?mr in J:je.call(J,mr)))return!1}var Xt=ot.get(K);if(Xt&&ot.get(J))return Xt==J;var Yr=!0;ot.set(K,J),ot.set(J,K);for(var ri=Zt;++ln<It;){mr=gr[ln];var Fn=K[mr],$i=J[mr];if(Se)var qc=Zt?Se($i,Fn,mr,J,K,ot):Se(Fn,$i,mr,K,J,ot);if(!(qc===void 0?Fn===$i||Vt(Fn,$i,fe,Se,ot):qc)){Yr=!1;break}ri||(ri=mr=="constructor")}if(Yr&&!ri){var xo=K.constructor,Sr=J.constructor;xo!=Sr&&"constructor"in K&&"constructor"in J&&!(typeof xo=="function"&&xo instanceof xo&&typeof Sr=="function"&&Sr instanceof Sr)&&(Yr=!1)}return ot.delete(K),ot.delete(J),Yr}function xa(K){return Fc(K,Ld,Uu)}function Cs(K,J){var fe=K.__data__;return ju(J)?fe[typeof J=="string"?"string":"hash"]:fe.map}function bn(K,J){var fe=Fe(K,J);return Pd(fe)?fe:void 0}function Bu(K){var J=je.call(K,ir),fe=K[ir];try{K[ir]=void 0;var Se=!0}catch{}var Vt=Te.call(K);return Se&&(J?K[ir]=fe:delete K[ir]),Vt}var Uu=St?function(K){return K==null?[]:(K=Object(K),Oe(St(K),function(J){return dt.call(K,J)}))}:Wt,Pi=_o;(Ye&&Pi(new Ye(new ArrayBuffer(1)))!=de||He&&Pi(new He)!=k||Rt&&Pi(Rt.resolve())!=z||Qe&&Pi(new Qe)!=F||Ve&&Pi(new Ve)!=ee)&&(Pi=function(K){var J=_o(K),fe=J==B?K.constructor:void 0,Se=fe?Yi(fe):"";if(Se)switch(Se){case Xe:return de;case et:return k;case Lt:return z;case tt:return F;case Je:return ee}return J});function Fu(K,J){return J=J??c,!!J&&(typeof K=="number"||pe.test(K))&&K>-1&&K%1==0&&K<J}function ju(K){var J=typeof K;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?K!=="__proto__":K===null}function ku(K){return!!$e&&$e in K}function qu(K){var J=K&&K.constructor,fe=typeof J=="function"&&J.prototype||Be;return K===fe}function Td(K){return Te.call(K)}function Yi(K){if(K!=null){try{return Me.call(K)}catch{}try{return K+""}catch{}}return""}function zu(K,J){return K===J||K!==K&&J!==J}var Hu=jc(function(){return arguments}())?jc:function(K){return Ao(K)&&je.call(K,"callee")&&!dt.call(K,"callee")},Sa=Array.isArray;function Nd(K){return K!=null&&Ku(K.length)&&!Ia(K)}var kc=Ot||Kt;function Rd(K,J){return Eo(K,J)}function Ia(K){if(!Wu(K))return!1;var J=_o(K);return J==x||J==I||J==h||J==M}function Ku(K){return typeof K=="number"&&K>-1&&K%1==0&&K<=c}function Wu(K){var J=typeof K;return K!=null&&(J=="object"||J=="function")}function Ao(K){return K!=null&&typeof K=="object"}var Vu=le?ze(le):Nu;function Ld(K){return Nd(K)?$u(K):Ru(K)}function Wt(){return[]}function Kt(){return!1}t.exports=Rd})(t0,t0.exports);var l9=t0.exports;function u9(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 h9=Object.freeze({__proto__:null,default:u9}),yv=il(h9),f9=self.fetch||(self.fetch=yv.default||yv),d9=Object.defineProperty,bv=Object.getOwnPropertySymbols,p9=Object.prototype.hasOwnProperty,g9=Object.prototype.propertyIsEnumerable,_v=(t,e,r)=>e in t?d9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kr=(t,e)=>{for(var r in e||(e={}))p9.call(e,r)&&_v(t,r,e[r]);if(bv)for(var r of bv(e))g9.call(e,r)&&_v(t,r,e[r]);return t};function m9(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 _(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 k=0,W=0,Y=0,B=I.length;Y!==B&&I[Y]===0;)Y++,k++;for(var z=(B-Y)*g+1>>>0,M=new Uint8Array(z);Y!==B;){for(var U=I[Y],F=0,m=z-1;(U!==0||F<W)&&m!==-1;m--,F++)U+=256*M[m]>>>0,M[m]=U%l>>>0,U=U/l>>>0;if(U!==0)throw new Error("Non-zero carry");W=F,Y++}for(var $=z-W;$!==z&&M[$]===0;)$++;for(var te=f.repeat(k);$<z;++$)te+=t.charAt(M[$]);return te}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var k=0;if(I[k]!==" "){for(var W=0,Y=0;I[k]===f;)W++,k++;for(var B=(I.length-k)*h+1>>>0,z=new Uint8Array(B);I[k];){var M=r[I.charCodeAt(k)];if(M===255)return;for(var U=0,F=B-1;(M!==0||U<Y)&&F!==-1;F--,U++)M+=l*z[F]>>>0,z[F]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");Y=U,k++}if(I[k]!==" "){for(var m=B-Y;m!==B&&z[m]===0;)m++;for(var $=new Uint8Array(W+(B-m)),te=W;m!==B;)$[te++]=z[m++];return $}}}function x(I){var k=E(I);if(k)return k;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:x}}var v9=m9,w9=v9;const Ev=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")},y9=t=>new TextEncoder().encode(t),b9=t=>new TextDecoder().decode(t);class _9{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 E9{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 Av(this,e)}}class A9{constructor(e){this.decoders=e}or(e){return Av(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 Av=(t,e)=>new A9(Kr(Kr({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class x9{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new _9(e,r,n),this.decoder=new E9(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Yl=({name:t,prefix:e,encode:r,decode:n})=>new x9(t,e,r,n),mc=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=w9(r,e);return Yl({prefix:t,name:e,encode:n,decode:o=>Ev(i(o))})},S9=(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},I9=(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},$r=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Yl({prefix:e,name:t,encode(i){return I9(i,n,r)},decode(i){return S9(i,n,r,t)}}),D9=Yl({prefix:"\0",name:"identity",encode:t=>b9(t),decode:t=>y9(t)});var C9=Object.freeze({__proto__:null,identity:D9});const O9=$r({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var M9=Object.freeze({__proto__:null,base2:O9});const P9=$r({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $9=Object.freeze({__proto__:null,base8:P9});const T9=mc({prefix:"9",name:"base10",alphabet:"0123456789"});var N9=Object.freeze({__proto__:null,base10:T9});const R9=$r({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),L9=$r({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var B9=Object.freeze({__proto__:null,base16:R9,base16upper:L9});const U9=$r({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),F9=$r({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),j9=$r({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),k9=$r({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q9=$r({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),z9=$r({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),H9=$r({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),K9=$r({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),W9=$r({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var V9=Object.freeze({__proto__:null,base32:U9,base32upper:F9,base32pad:j9,base32padupper:k9,base32hex:q9,base32hexupper:z9,base32hexpad:H9,base32hexpadupper:K9,base32z:W9});const G9=mc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Y9=mc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Q9=Object.freeze({__proto__:null,base36:G9,base36upper:Y9});const J9=mc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Z9=mc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var X9=Object.freeze({__proto__:null,base58btc:J9,base58flickr:Z9});const eS=$r({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),tS=$r({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),rS=$r({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nS=$r({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var iS=Object.freeze({__proto__:null,base64:eS,base64pad:tS,base64url:rS,base64urlpad:nS});const xv=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}"),sS=xv.reduce((t,e,r)=>(t[r]=e,t),[]),oS=xv.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function aS(t){return t.reduce((e,r)=>(e+=sS[r],e),"")}function cS(t){const e=[];for(const r of t){const n=oS[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const lS=Yl({prefix:"\u{1F680}",name:"base256emoji",encode:aS,decode:cS});var uS=Object.freeze({__proto__:null,base256emoji:lS}),hS=Iv,Sv=128,fS=127,dS=~fS,pS=Math.pow(2,31);function Iv(t,e,r){e=e||[],r=r||0;for(var n=r;t>=pS;)e[r++]=t&255|Sv,t/=128;for(;t&dS;)e[r++]=t&255|Sv,t>>>=7;return e[r]=t|0,Iv.bytes=r-n+1,e}var gS=r0,mS=128,Dv=127;function r0(t,n){var r=0,n=n||0,i=0,o=n,c,l=t.length;do{if(o>=l)throw r0.bytes=0,new RangeError("Could not decode varint");c=t[o++],r+=i<28?(c&Dv)<<i:(c&Dv)*Math.pow(2,i),i+=7}while(c>=mS);return r0.bytes=o-n,r}var vS=Math.pow(2,7),wS=Math.pow(2,14),yS=Math.pow(2,21),bS=Math.pow(2,28),_S=Math.pow(2,35),ES=Math.pow(2,42),AS=Math.pow(2,49),xS=Math.pow(2,56),SS=Math.pow(2,63),IS=function(t){return t<vS?1:t<wS?2:t<yS?3:t<bS?4:t<_S?5:t<ES?6:t<AS?7:t<xS?8:t<SS?9:10},DS={encode:hS,decode:gS,encodingLength:IS},Cv=DS;const Ov=(t,e,r=0)=>(Cv.encode(t,e,r),e),Mv=t=>Cv.encodingLength(t),n0=(t,e)=>{const r=e.byteLength,n=Mv(t),i=n+Mv(r),o=new Uint8Array(i+r);return Ov(t,o,0),Ov(r,o,n),o.set(e,i),new CS(t,r,e,o)};class CS{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Pv=({name:t,code:e,encode:r})=>new OS(t,e,r);class OS{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?n0(this.code,r):r.then(n=>n0(this.code,n))}else throw Error("Unknown type, must be binary type")}}const $v=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),MS=Pv({name:"sha2-256",code:18,encode:$v("SHA-256")}),PS=Pv({name:"sha2-512",code:19,encode:$v("SHA-512")});var $S=Object.freeze({__proto__:null,sha256:MS,sha512:PS});const Tv=0,TS="identity",Nv=Ev;var NS=Object.freeze({__proto__:null,identity:{code:Tv,name:TS,encode:Nv,digest:t=>n0(Tv,Nv(t))}});new TextEncoder,new TextDecoder;const Rv=Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr({},C9),M9),$9),N9),B9),V9),Q9),X9),iS),uS);Kr(Kr({},$S),NS);function RS(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Lv(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Bv=Lv("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),i0=Lv("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=RS(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),LS=Kr({utf8:Bv,"utf-8":Bv,hex:Rv.base16,latin1:i0,ascii:i0,binary:i0},Rv);function BS(t,e="utf8"){const r=LS[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}const Uv="wc",US=2,s0="core",hs=`${Uv}@2:${s0}:`,FS={name:s0,logger:"error"},jS={database:":memory:"},kS="crypto",Fv="client_ed25519_seed",qS=ye.ONE_DAY,zS="keychain",HS="0.3",KS="messages",WS="0.3",VS=ye.SIX_HOURS,GS="publisher",jv="irn",YS="error",kv="wss://relay.walletconnect.com",qv="wss://relay.walletconnect.org",QS="relayer",on={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"},JS="_subscription",Pn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ZS=ye.ONE_SECOND,XS="2.13.3",eI=1e4,tI="0.3",rI="WALLETCONNECT_CLIENT_ID",Ei={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},nI="subscription",iI="0.3",sI=ye.FIVE_SECONDS*1e3,oI="pairing",aI="0.3",vc={wc_pairingDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:0},res:{ttl:ye.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"},cI="history",lI="0.3",uI="expirer",$n={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},hI="0.3",o0="verify-api",na="https://verify.walletconnect.com",a0="https://verify.walletconnect.org",fI=[na,a0],dI="echo",pI="https://echo.walletconnect.com";class gI{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=zS,this.version=HS,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=sn(r,this.name)}get context(){return nn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,eg(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?tg(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 mI{constructor(e,r,n){this.core=e,this.logger=r,this.name=kS,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=rv(i);return tv(o.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=FE();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const o=await this.getClientSeed(),c=rv(o),l=Pf();return await vx(l,i,qS,c)},this.generateSharedKey=(i,o,c)=>{this.isInitialized();const l=this.getPrivateKey(i),f=jE(l,o);return this.setSymKey(f,c)},this.setSymKey=async(i,o)=>{this.isInitialized();const c=o||Tl(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=ym(c),f=ki(o);if(bm(l)){const E=l.senderPublicKey,x=l.receiverPublicKey;i=await this.generateSharedKey(E,x)}const h=this.getSymKey(i),{type:g,senderPublicKey:_}=l;return qE({type:g,symKey:h,message:f,senderPublicKey:_})},this.decode=async(i,o,c)=>{this.isInitialized();const l=KE(o,c);if(bm(l)){const f=l.receiverPublicKey,h=l.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=zE({symKey:f,encoded:o});return lc(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=Nl(i);return nc(o.type)},this.getPayloadSenderPublicKey=i=>{const o=Nl(i);return o.senderPublicKey?bx(o.senderPublicKey,zr):void 0},this.core=e,this.logger=sn(r,this.name),this.keychain=n||new gI(this.core,this.logger)}get context(){return nn(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(Fv)}catch{e=Pf(),await this.keychain.set(Fv,e)}return BS(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 vI extends V7{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=KS,this.version=WS,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=sn(e,this.name),this.core=r}get context(){return nn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,eg(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?tg(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 wI extends G7{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Dr.exports.EventEmitter,this.name=GS,this.queue=new Map,this.publishTimeout=ye.toMiliseconds(ye.ONE_MINUTE),this.failedPublishTimeout=ye.toMiliseconds(ye.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||VS,f=$f(o),h=o?.prompt||!1,g=o?.tag||0,_=o?.id||Ys().toString(),E={topic:n,message:i,opts:{ttl:l,relay:f,prompt:h,tag:g,id:_}},x=`Failed to publish payload, please try again. id:${_} tag:${g}`,I=Date.now();let k,W=1;try{for(;k===void 0;){if(Date.now()-I>this.publishTimeout)throw new Error(x);this.logger.trace({id:_,attempts:W},`publisher.publish - attempt ${W}`),k=await await jo(this.rpcPublish(n,i,l,f,h,g,_).catch(Y=>this.logger.warn(Y)),this.publishTimeout,x),W++,k||await new Promise(Y=>setTimeout(Y,this.failedPublishTimeout))}this.relayer.events.emit(on.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=sn(r,this.name),this.registerEventListeners()}get context(){return nn(this.logger)}rpcPublish(e,r,n,i,o,c,l){var f,h,g,_;const E={method:ic(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(uc.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(on.connection_stalled);return}this.checkQueue()}),this.relayer.on(on.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class yI{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 bI=Object.defineProperty,_I=Object.defineProperties,EI=Object.getOwnPropertyDescriptors,zv=Object.getOwnPropertySymbols,AI=Object.prototype.hasOwnProperty,xI=Object.prototype.propertyIsEnumerable,Hv=(t,e,r)=>e in t?bI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wc=(t,e)=>{for(var r in e||(e={}))AI.call(e,r)&&Hv(t,r,e[r]);if(zv)for(var r of zv(e))xI.call(e,r)&&Hv(t,r,e[r]);return t},c0=(t,e)=>_I(t,EI(e));class SI extends J7{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new yI,this.events=new Dr.exports.EventEmitter,this.name=nI,this.version=iI,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hs,this.subscribeTimeout=ye.toMiliseconds(ye.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},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=$f(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 ye.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)>=sI&&(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=sn(r,this.name),this.clientId=""}get context(){return nn(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=$f(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:ic(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 jo(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(on.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:ic(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 jo(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(on.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:ic(r.protocol).batchFetchMessages,params:{topics:e.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await jo(this.relayer.request(n).catch(o=>this.logger.warn(o)),this.subscribeTimeout)}catch{this.relayer.events.emit(on.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:ic(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,c0(wc({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,wc({},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,wc({},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,c0(wc({},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.batchFetchMessages(n),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)=>c0(wc({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(uc.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 II=Object.defineProperty,Kv=Object.getOwnPropertySymbols,DI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,Wv=(t,e,r)=>e in t?II(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,OI=(t,e)=>{for(var r in e||(e={}))DI.call(e,r)&&Wv(t,r,e[r]);if(Kv)for(var r of Kv(e))CI.call(e,r)&&Wv(t,r,e[r]);return t};class MI extends Y7{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Dr.exports.EventEmitter,this.name=QS,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=ye.toMiliseconds(ye.THIRTY_SECONDS+ye.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const o=r.id||Ys().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(Pn.disconnect,g);const _=await c;this.provider.off(Pn.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(Wa())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(on.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(on.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Pn.payload,this.onPayloadHandler),this.provider.on(Pn.connect,this.onConnectHandler),this.provider.on(Pn.disconnect,this.onDisconnectHandler),this.provider.on(Pn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?sn(e.logger,this.name):yi(Hl({level:e.logger||YS})),this.messages=new vI(this.logger,e.core),this.subscriber=new SI(this,this.logger),this.publisher=new wI(this,this.logger),this.relayUrl=e?.relayUrl||kv,this.projectId=e.projectId,this.bundleId=C8(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),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 ${qv}...`),await this.restartTransport(qv)}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)},eI)}get context(){return nn(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 jo(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(Pn.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Pn.disconnect,i),await jo(this.provider.connect(),ye.toMiliseconds(ye.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.hasExperiencedNetworkDisruption=!0,!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.transportOpen())}async confirmOnlineStateOrThrow(){if(!await $m())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}startPingTimeout(){var e,r,n,i,o;if(Wa())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 Hi(new c9(N8({sdkVersion:XS,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}),e0(e)){if(!e.method.endsWith(JS))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(OI({type:"event",event:r.id},c)),this.events.emit(r.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else Gl(e)&&this.events.emit(on.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(on.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Wl(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Pn.payload,this.onPayloadHandler),this.provider.off(Pn.connect,this.onConnectHandler),this.provider.off(Pn.disconnect,this.onDisconnectHandler),this.provider.off(Pn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await $m();RA(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.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(on.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},ye.toMiliseconds(ZS))}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 PI=Object.defineProperty,Vv=Object.getOwnPropertySymbols,$I=Object.prototype.hasOwnProperty,TI=Object.prototype.propertyIsEnumerable,Gv=(t,e,r)=>e in t?PI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Yv=(t,e)=>{for(var r in e||(e={}))$I.call(e,r)&&Gv(t,r,e[r]);if(Vv)for(var r of Vv(e))TI.call(e,r)&&Gv(t,r,e[r]);return t};class Qs extends Q7{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=tI,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):fA(c)?this.map.set(c.id,c):dA(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=>l9(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=Yv(Yv({},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=sn(r,this.name),this.storagePrefix=i,this.getKey=o}get context(){return nn(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 NI{constructor(e,r){this.core=e,this.logger=r,this.name=oI,this.version=aI,this.events=new Dr.exports,this.initialized=!1,this.storagePrefix=hs,this.ignoredPayloadTypes=[ji],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=Pf(),o=await this.core.crypto.setSymKey(i),c=Or(ye.FIVE_MINUTES),l={protocol:jv},f={topic:o,expiry:c,relay:l,active:!1},h=rA({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:i,relay:l,expiryTimestamp:c,methods:n?.methods});return this.core.expirer.set(o,c),await this.pairings.set(o,f),await this.core.relayer.subscribe(o),{topic:o,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:o,relay:c,expiryTimestamp:l,methods:f}=xm(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||Or(ye.FIVE_MINUTES),_={topic:i,relay:c,expiry:g,active:!1,methods:f};return this.core.expirer.set(i,g),await this.pairings.set(i,_),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=Or(ye.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry: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=vc[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=Wl(n,o),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=vc[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=Vl(n,o),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=vc[f.request.method]?vc[f.request.method].res:vc.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=>os(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(!tn(n)){const{message:c}=me("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!hA(n.uri)){const{message:c}=me("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const o=xm(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&&ye.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(!tn(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(!tn(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(os(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=sn(r,this.name),this.pairings=new Qs(this.core,this.logger,this.name,this.storagePrefix)}get context(){return nn(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(on.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{e0(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Gl(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}=ng(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(ra.expire,{topic:r}))})}}class RI extends W7{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Dr.exports.EventEmitter,this.name=cI,this.version=lI,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:Or(ye.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=sn(r,this.name)}get context(){return nn(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(uc.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{ye.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 LI extends Z7{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Dr.exports.EventEmitter,this.name=uI,this.version=hI,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=sn(r,this.name)}get context(){return nn(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 R8(e);if(typeof e=="number")return L8(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;ye.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(uc.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 BI extends X7{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=o0,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=a0;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,a0)}return o},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const o=this.startAbortTimer(ye.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(o0);if(c)return this.iframe=c,this.onInit(),o();window.addEventListener("message",i);const l=document.createElement("iframe");l.id=o0,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")},ye.toMiliseconds(ye.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 fI.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${na}`),i=na),i},this.logger=sn(r,this.name),this.verifyUrl=na,this.abortController=new AbortController,this.isDevEnv=Wa()&&process.env.IS_VITEST}get context(){return nn(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ye.toMiliseconds(e))}}class UI extends ex{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=dI,this.registerDeviceToken=async n=>{const{clientId:i,token:o,notificationType:c,enableEncrypted:l=!1}=n,f=`${pI}/${this.projectId}/clients`;await f9(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:o,always_raw:l})})},this.logger=sn(r,this.context)}}var FI=Object.defineProperty,Qv=Object.getOwnPropertySymbols,jI=Object.prototype.hasOwnProperty,kI=Object.prototype.propertyIsEnumerable,Jv=(t,e,r)=>e in t?FI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zv=(t,e)=>{for(var r in e||(e={}))jI.call(e,r)&&Jv(t,r,e[r]);if(Qv)for(var r of Qv(e))kI.call(e,r)&&Jv(t,r,e[r]);return t};class l0 extends K7{constructor(e){var r;super(e),this.protocol=Uv,this.version=US,this.name=s0,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||kv,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=Hl({level:typeof e?.logger=="string"&&e.logger?e.logger:FS.logger}),{logger:i,chunkLoggerController:o}=H7({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=sn(i,this.name),this.heartbeat=new jf,this.crypto=new mI(this,this.logger,e?.keychain),this.history=new RI(this,this.logger),this.expirer=new LI(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new g7(Zv(Zv({},jS),e?.storageOptions)),this.relayer=new MI({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new NI(this,this.logger),this.verify=new BI(this.projectId||"",this.logger),this.echoClient=new UI(this.projectId||"",this.logger)}static async init(e){const r=new l0(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(rI,n),r}get context(){return nn(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 qI=l0,Xv="wc",ew=2,tw="client",u0=`${Xv}@${ew}:${tw}:`,h0={name:tw,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},rw="WALLETCONNECT_DEEPLINK_CHOICE",zI="proposal",nw="Proposal expired",HI="session",ia=ye.SEVEN_DAYS,KI="engine",Tr={wc_sessionPropose:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1114},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:ye.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:ye.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1119}}},f0={min:ye.FIVE_MINUTES,max:ye.SEVEN_DAYS},Ai={idle:"IDLE",active:"ACTIVE"},WI="request",VI=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],GI="wc",YI="auth",QI="authKeys",JI="pairingTopics",ZI="requests",Ql=`${GI}@${1.5}:${YI}:`,Jl=`${Ql}:PUB_KEY`;var XI=Object.defineProperty,eD=Object.defineProperties,tD=Object.getOwnPropertyDescriptors,iw=Object.getOwnPropertySymbols,rD=Object.prototype.hasOwnProperty,nD=Object.prototype.propertyIsEnumerable,sw=(t,e,r)=>e in t?XI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vr=(t,e)=>{for(var r in e||(e={}))rD.call(e,r)&&sw(t,r,e[r]);if(iw)for(var r of iw(e))nD.call(e,r)&&sw(t,r,e[r]);return t},Js=(t,e)=>eD(t,tD(e));class iD extends rx{constructor(e){super(e),this.name=KI,this.events=new Dr.exports,this.initialized=!1,this.requestQueue={state:Ai.idle,queue:[]},this.sessionRequestQueue={state:Ai.idle,queue:[]},this.requestQueueDelay=ye.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(Tr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const n=Js(vr({},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(M){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),M}if(!h||!_){const{topic:M,uri:U}=await this.client.core.pairing.create();h=M,g=U}if(!h){const{message:M}=me("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(M)}const E=await this.client.core.crypto.generateKeyPair(),x=Tr.wc_sessionPropose.req.ttl||ye.FIVE_MINUTES,I=Or(x),k=vr({requiredNamespaces:o,optionalNamespaces:c,relays:f??[{protocol:jv}],proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:I,pairingTopic:h},l&&{sessionProperties:l}),{reject:W,resolve:Y,done:B}=qs(x,nw);this.events.once(wt("session_connect"),async({error:M,session:U})=>{if(M)W(M);else if(U){U.self.publicKey=E;const F=Js(vr({},U),{pairingTopic:k.pairingTopic,requiredNamespaces:k.requiredNamespaces,optionalNamespaces:k.optionalNamespaces});await this.client.session.set(U.topic,F),await this.setExpiry(U.topic,U.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:U.peer.metadata}),this.cleanupDuplicatePairings(F),Y(F)}});const z=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:k,throwOnFailedPublish:!0});return await this.setProposal(z,vr({id:z},k)),{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}const{pairingTopic:h,proposer:g,requiredNamespaces:_,optionalNamespaces:E}=f,x=await this.client.core.crypto.generateKeyPair(),I=g.publicKey,k=await this.client.core.crypto.generateSharedKey(x,I),W=vr(vr({relay:{protocol:i??"irn"},namespaces:o,controller:{publicKey:x,metadata:this.client.metadata},expiry:Or(ia)},c&&{sessionProperties:c}),l&&{sessionConfig:l});await this.client.core.relayer.subscribe(k);const Y=Js(vr({},W),{topic:k,requiredNamespaces:_,optionalNamespaces:E,pairingTopic:h,acknowledged:!1,self:W.controller,peer:{publicKey:g.publicKey,metadata:g.metadata},controller:x});await this.client.session.set(k,Y);try{await this.sendResult({id:n,topic:h,result:{relay:{protocol:i??"irn"},responderPublicKey:x},throwOnFailedPublish:!0}),await this.sendRequest({topic:k,method:"wc_sessionSettle",params:W,throwOnFailedPublish:!0})}catch(B){throw this.client.logger.error(B),this.client.session.delete(k,Ut("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(k),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(k,Or(ia)),{topic:k,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(k)),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,rpcOpts:Tr.wc_sessionPropose.reject}),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=Ys().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}),await 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,Or(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(x){throw this.client.logger.error("request() -> isValidRequest() failed"),x}const{chainId:n,request:i,topic:o,expiry:c=Tr.wc_sessionRequest.req.ttl}=r,l=this.client.session.get(o),f=us(),h=Ys().toString(),{done:g,resolve:_,reject:E}=qs(c,"Request expired. Please try again.");return this.events.once(wt("session_request",f),({error:x,result:I})=>{x?E(x):_(I)}),await Promise.all([new Promise(async x=>{await this.sendRequest({clientRpcId:f,relayRpcId:h,topic:o,method:"wc_sessionRequest",params:{request:Js(vr({},i),{expiryTimestamp:Or(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(I=>E(I)),this.client.events.emit("session_request_sent",{topic:o,request:i,chainId:n,id:f}),x()}),new Promise(async x=>{var I;if(!((I=l.sessionConfig)!=null&&I.disableDeepLink)){const k=await U8(this.client.core.storage,rw);B8({id:f,topic:o,wcDeepLink:k})}x()}),g()]).then(x=>x[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=Ys().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=Ys().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=>lA(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:_=[],expiry:E}=r,x=[...r.resources||[]],{topic:I,uri:k}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:I,uri:k}});const W=await this.client.core.crypto.generateKeyPair(),Y=Tl(W);if(await Promise.all([this.client.auth.authKeys.set(Jl,{responseTopic:Y,publicKey:W}),this.client.auth.pairingTopics.set(Y,{topic:Y,pairingTopic:I})]),await this.client.core.relayer.subscribe(Y),this.client.logger.info(`sending request to new pairing topic: ${I}`),_.length>0){const{namespace:d}=ml(n[0]);let p=TE(d,"request",_);$l(x)&&(p=RE(p,x.pop())),x.push(p)}const B=E&&E>Tr.wc_sessionAuthenticate.req.ttl?E:Tr.wc_sessionAuthenticate.req.ttl,z={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:x},requester:{publicKey:W,metadata:this.client.metadata},expiryTimestamp:Or(B)},M={eip155:{chains:n,methods:[...new Set(["personal_sign",..._])],events:["chainChanged","accountsChanged"]}},U={requiredNamespaces:{},optionalNamespaces:M,relays:[{protocol:"irn"}],pairingTopic:I,proposer:{publicKey:W,metadata:this.client.metadata},expiryTimestamp:Or(Tr.wc_sessionPropose.req.ttl)},{done:F,resolve:m,reject:$}=qs(B,"Request expired"),te=async({error:d,session:p})=>{if(this.events.off(wt("session_request",ne),ee),d)$(d);else if(p){p.self.publicKey=W,await this.client.session.set(p.topic,p),await this.setExpiry(p.topic,p.expiry),I&&await this.client.core.pairing.updateMetadata({topic:I,metadata:p.peer.metadata});const b=this.client.session.get(p.topic);await this.deleteProposal(de),m({session:b})}},ee=async d=>{if(await this.deletePendingAuthRequest(ne,{message:"fulfilled",code:0}),d.error){const C=Ut("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return d.error.code===C.code?void 0:(this.events.off(wt("session_connect"),te),$(d.error.message))}await this.deleteProposal(de),this.events.off(wt("session_connect"),te);const{cacaos:p,responder:b}=d.result,D=[],O=[];for(const C of p){await hm({cacao:C,projectId:this.client.core.projectId})||(this.client.logger.error(C,"Signature verification failed"),$(Ut("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:v}=C,N=$l(v.resources),oe=[um(v.iss)],pe=Pl(v.iss);if(N){const A=pm(N),re=gm(N);D.push(...A),oe.push(...re)}for(const A of oe)O.push(`${A}:${pe}`)}const T=await this.client.core.crypto.generateSharedKey(W,b.publicKey);let L;D.length>0&&(L={topic:T,acknowledged:!0,self:{publicKey:W,metadata:this.client.metadata},peer:b,controller:b.publicKey,expiry:Or(ia),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:I,namespaces:Sm([...new Set(D)],[...new Set(O)])},await this.client.core.relayer.subscribe(T),await this.client.session.set(T,L),L=this.client.session.get(T)),m({auths:p,session:L})},ne=us(),de=us();this.events.once(wt("session_connect"),te),this.events.once(wt("session_request",ne),ee);try{await Promise.all([this.sendRequest({topic:I,method:"wc_sessionAuthenticate",params:z,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:ne}),this.sendRequest({topic:I,method:"wc_sessionPropose",params:U,expiry:Tr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:de})])}catch(d){throw this.events.off(wt("session_connect"),te),this.events.off(wt("session_request",ne),ee),d}return await this.setProposal(de,vr({id:de},U)),await this.setAuthRequest(ne,{request:Js(vr({},z),{verifyContext:{}}),pairingTopic:I}),{uri:k,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=Tl(c),h={type:ji,receiverPublicKey:c,senderPublicKey:l},g=[],_=[];for(const I of i){if(!await hm({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:k}=I,W=$l(k.resources),Y=[um(k.iss)],B=Pl(k.iss);if(W){const z=pm(W),M=gm(W);g.push(...z),Y.push(...M)}for(const z of Y)_.push(`${z}:${B}`)}const E=await this.client.core.crypto.generateSharedKey(l,c);let x;return g?.length>0&&(x={topic:E,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Or(ia),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:Sm([...new Set(g)],[...new Set(_)])},await this.client.core.relayer.subscribe(E),await this.client.session.set(E,x)),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:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),{session:x}},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=Tl(c),h={type:ji,receiverPublicKey:c,senderPublicKey:l};await this.sendError({id:n,topic:f,error:i,encodeOpts:h,rpcOpts:Tr.wc_sessionAuthenticate.reject}),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 fm(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=>{var n;const{topic:i,expirerHasDeleted:o=!1,emitEvent:c=!0,id:l=0}=r,{self:f}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Ut("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(f.publicKey)&&await this.client.core.crypto.deleteKeyPair(f.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),o||this.client.core.expirer.del(i),this.client.core.storage.removeItem(rw).catch(h=>this.client.logger.warn(h)),this.getPendingSessionRequests().forEach(h=>{h.topic===i&&this.deletePendingSessionRequest(h.id,Ut("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Ai.idle),c&&this.client.events.emit("session_delete",{id:l,topic:i})},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=Ai.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,Or(Tr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:o}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:o,verifyContext:i.verifyContext})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:o,verifyContext:c}=r,l=o.request.expiryTimestamp||Or(Tr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,l),await this.client.pendingRequest.set(n,{id:n,topic:i,params:o,verifyContext:c})},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()&&VI.includes(i)){const x=Ws(JSON.stringify(g));this.client.core.verify.register({attestationId:x})}let _;try{_=await this.client.core.crypto.encode(n,g)}catch(x){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),x}const E=Tr[i].req;return c&&(E.ttl=c),l&&(E.id=l),this.client.core.history.set(n,g),h?(E.internal=Js(vr({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,_,E)):this.client.core.relayer.publish(n,_,E).catch(x=>this.client.logger.error(x)),g.id},this.sendResult=async r=>{const{id:n,topic:i,result:o,throwOnFailedPublish:c,encodeOpts:l}=r,f=Wl(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 _=Tr[g.request.method].res;c?(_.internal=Js(vr({},_.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,rpcOpts:l}=r,f=Vl(n,o);let h;try{h=await this.client.core.crypto.encode(i,f,c)}catch(E){throw await this.cleanup(),this.client.logger.error(`sendError() -> 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(`sendError() -> history.get(${i}, ${n}) failed`),E}const _=l||Tr[g.request.method].res;this.client.core.relayer.publish(i,h,_),await this.client.core.history.resolve(f)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let o=!1;os(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=>{os(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===Ai.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=Ai.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=Ai.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(vr({},n.params));const c=i.expiryTimestamp||Or(Tr.wc_sessionPropose.req.ttl),l=vr({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,rpcOpts:Tr.wc_sessionPropose.autoReject}),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,sessionConfig:_}=n.params,E=vr(vr({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}),_&&{sessionConfig:_});await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0});const x=wt("session_connect");if(this.events.listenerCount(x)===0)throw new Error(`emitting ${x} without any listeners 997`);this.events.emit(wt("session_connect"),{session:E})}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=ac.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(vr({topic:r},i));try{ac.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 ac.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,Or(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(on.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)=>{var i;const{id:o,params:c}=n;try{await this.isValidRequest(vr({topic:r},c));const l=Ws(JSON.stringify(ta("wc_sessionRequest",c,o))),f=this.client.session.get(r),h=await this.getVerifyContext(l,f.peer.metadata),g={id:o,topic:r,params:c,verifyContext:h};await this.setPendingSessionRequest(g),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(g):(this.addSessionRequestToSessionRequestQueue(g),this.processSessionRequestQueue())}catch(l){await this.sendError({id:o,topic:r,error:l}),this.client.logger.error(l)}},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=ac.get(c);if(l&&this.isRequestOutOfSync(l,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(vr({topic:r},o)),this.client.events.emit("session_event",{id:i,topic:r,params:o}),ac.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)=>{try{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.setAuthRequest(n.id,{request:h,pairingTopic:r}),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id})}catch(i){this.client.logger.error(i);const o=n.params.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l={type:ji,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n.id,topic:r,error:i,encodeOpts:l,rpcOpts:Tr.wc_sessionAuthenticate.autoReject})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Ai.idle,this.processSessionRequestQueue()},ye.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===Ai.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=Ai.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},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(!tn(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),!_A(l,!0)){const{message:f}=me("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(f)}!Hr(i)&&oc(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Hr(o)&&oc(o)!==0&&this.validateNamespaces(o,"optionalNamespaces"),Hr(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=bA(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!tn(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=Rf(i,"approve()");if(f)throw new Error(f.message);const h=Mm(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(!tn(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),!AA(i)){const{message:o}=me("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(o)}},this.isValidSessionSettleRequest=r=>{if(!tn(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(!Cm(n)){const{message:h}=me("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const l=pA(i,"onSessionSettleRequest()");if(l)throw new Error(l.message);const f=Rf(o,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(os(c)){const{message:h}=me("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async r=>{if(!tn(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=Rf(i,"update()");if(c)throw new Error(c.message);const l=Mm(o.requiredNamespaces,i,"update()");if(l)throw new Error(l.message)},this.isValidExtend=async r=>{if(!tn(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(!tn(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(!Om(l,o)){const{message:f}=me("MISSING_OR_INVALID",`request() chainId: ${o}`);throw new Error(f)}if(!xA(i)){const{message:f}=me("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!DA(l,o,i.method)){const{message:f}=me("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!PA(c,f0)){const{message:f}=me("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${f0.min} and ${f0.max}`);throw new Error(f)}},this.isValidRespond=async r=>{var n;if(!tn(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(!SA(o)){const{message:c}=me("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(c)}},this.isValidPing=async r=>{if(!tn(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(!tn(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(!Om(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(!CA(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(!tn(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=>ml(f).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:l}=ml(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(on.message,async e=>{const{topic:r,message:n}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(Jl)?this.client.auth.authKeys.get(Jl):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(r,n,{receiverPublicKey:i});try{e0(o)?(this.client.core.history.set(r,o),this.onRelayEventRequest({topic:r,payload:o})):Gl(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}=ng(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,me("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(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(os(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(os(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(!EA(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(os(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=me("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class sD extends Qs{constructor(e,r){super(e,r,zI,u0),this.core=e,this.logger=r}}class oD extends Qs{constructor(e,r){super(e,r,HI,u0),this.core=e,this.logger=r}}class aD extends Qs{constructor(e,r){super(e,r,WI,u0,n=>n.id),this.core=e,this.logger=r}}class cD extends Qs{constructor(e,r){super(e,r,QI,Ql,()=>Jl),this.core=e,this.logger=r}}class lD extends Qs{constructor(e,r){super(e,r,JI,Ql),this.core=e,this.logger=r}}class uD extends Qs{constructor(e,r){super(e,r,ZI,Ql,n=>n.id),this.core=e,this.logger=r}}class hD{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new cD(this.core,this.logger),this.pairingTopics=new lD(this.core,this.logger),this.requests=new uD(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class d0 extends tx{constructor(e){super(e),this.protocol=Xv,this.version=ew,this.name=h0.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||h0.name,this.metadata=e?.metadata||M8(),this.signConfig=e?.signConfig;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:yi(Hl({level:e?.logger||h0.logger}));this.core=e?.core||new qI(e),this.logger=sn(r,this.name),this.session=new oD(this.core,this.logger),this.proposal=new sD(this.core,this.logger),this.pendingRequest=new aD(this.core,this.logger),this.engine=new iD(this),this.auth=new hD(this.core,this.logger)}static async init(e){const r=new d0(e);return await r.initialize(),r}get context(){return nn(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 p0={exports:{}};(function(t,e){var r=typeof self<"u"?self:jr,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 x(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 I(p){this.map={},p instanceof I?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)}I.prototype.append=function(p,b){p=_(p),b=E(b);var D=this.map[p];this.map[p]=D?D+", "+b:b},I.prototype.delete=function(p){delete this.map[_(p)]},I.prototype.get=function(p){return p=_(p),this.has(p)?this.map[p]:null},I.prototype.has=function(p){return this.map.hasOwnProperty(_(p))},I.prototype.set=function(p,b){this.map[_(p)]=E(b)},I.prototype.forEach=function(p,b){for(var D in this.map)this.map.hasOwnProperty(D)&&p.call(b,this.map[D],D,this)},I.prototype.keys=function(){var p=[];return this.forEach(function(b,D){p.push(D)}),x(p)},I.prototype.values=function(){var p=[];return this.forEach(function(b){p.push(b)}),x(p)},I.prototype.entries=function(){var p=[];return this.forEach(function(b,D){p.push([D,b])}),x(p)},l.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function k(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 M(p){if(p.slice)return p.slice(0);var b=new Uint8Array(p.byteLength);return b.set(new Uint8Array(p)),b.buffer}function U(){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=M(p.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(p)||g(p))?this._bodyArrayBuffer=M(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=k(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?k(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var p=k(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 F=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(p){var b=p.toUpperCase();return F.indexOf(b)>-1?b:p}function $(p,b){b=b||{};var D=b.body;if(p instanceof $){if(p.bodyUsed)throw new TypeError("Already read");this.url=p.url,this.credentials=p.credentials,b.headers||(this.headers=new I(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 I(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)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function te(p){var b=new FormData;return p.trim().split("&").forEach(function(D){if(D){var O=D.split("="),T=O.shift().replace(/\+/g," "),L=O.join("=").replace(/\+/g," ");b.append(decodeURIComponent(T),decodeURIComponent(L))}}),b}function ee(p){var b=new I,D=p.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(O){var T=O.split(":"),L=T.shift().trim();if(L){var C=T.join(":").trim();b.append(L,C)}}),b}U.call($.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 I(b.headers),this.url=b.url||"",this._initBody(p)}U.call(ne.prototype),ne.prototype.clone=function(){return new ne(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},ne.error=function(){var p=new ne(null,{status:0,statusText:""});return p.type="error",p};var de=[301,302,303,307,308];ne.redirect=function(p,b){if(de.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 T=new $(p,b);if(T.signal&&T.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(T.method,T.url,!0),T.credentials==="include"?L.withCredentials=!0:T.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&l.blob&&(L.responseType="blob"),T.headers.forEach(function(v,N){L.setRequestHeader(N,v)}),T.signal&&(T.signal.addEventListener("abort",C),L.onreadystatechange=function(){L.readyState===4&&T.signal.removeEventListener("abort",C)}),L.send(typeof T._bodyInit>"u"?null:T._bodyInit)})}return d.polyfill=!0,o.fetch||(o.fetch=d,o.Headers=I,o.Request=$,o.Response=ne),c.Headers=I,c.Request=$,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})(p0,p0.exports);var ow=t3(p0.exports),fD=Object.defineProperty,dD=Object.defineProperties,pD=Object.getOwnPropertyDescriptors,aw=Object.getOwnPropertySymbols,gD=Object.prototype.hasOwnProperty,mD=Object.prototype.propertyIsEnumerable,cw=(t,e,r)=>e in t?fD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lw=(t,e)=>{for(var r in e||(e={}))gD.call(e,r)&&cw(t,r,e[r]);if(aw)for(var r of aw(e))mD.call(e,r)&&cw(t,r,e[r]);return t},uw=(t,e)=>dD(t,pD(e));const vD={Accept:"application/json","Content-Type":"application/json"},wD="POST",hw={headers:vD,method:wD},fw=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,!pv(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){this.isAvailable||await this.register();try{const r=ki(e),n=await(await ow(this.url,uw(lw({},hw),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!pv(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=ki({id:1,jsonrpc:"2.0",method:"test",params:[]});await ow(e,uw(lw({},hw),{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"?lc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),o=Vl(e,i);this.events.emit("payload",o)}parseError(e,r=this.url){return cv(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>fw&&this.events.setMaxListeners(fw)}}const dw="error",yD="wss://relay.walletconnect.com",bD="wc",_D="universal_provider",pw=`${bD}@2:${_D}:`,ED="https://rpc.walletconnect.com/v1/",Ki={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var yc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},g0={exports:{}};/**
|
|
43
|
+
***************************************************************************** */var Xf=function(e,t){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(e,t)};function Dx(e,t){Xf(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var t0=function(){return t0=Object.assign||function(t){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)&&(t[o]=r[o])}return t},t0.apply(this,arguments)};function Ox(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Px(e,t,r,n){var i=arguments.length,o=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(o=(i<3?c(o):i>3?c(t,r,o):c(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function Mx(e,t){return function(r,n){t(r,n,e)}}function $x(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Nx(e,t,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(e,t||[])).next())})}function Tx(e,t){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=t.call(e,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 Rx(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}function Lx(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&(t[r]=e[r])}function e0(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function fv(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],c;try{for(;(t===void 0||t-- >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 Bx(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(fv(arguments[t]));return e}function Ux(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],c=0,l=o.length;c<l;c++,i++)n[i]=o[c];return n}function mc(e){return this instanceof mc?(this.v=e,this):new mc(e)}function Fx(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),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(x){return new Promise(function(I,F){o.push([E,x,I,F])>1||l(E,x)})})}function l(E,x){try{f(n[E](x))}catch(I){_(o[0][3],I)}}function f(E){E.value instanceof mc?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,x){E(x),o.shift(),o.length&&l(o[0][0],o[0][1])}}function jx(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(c){return(r=!r)?{value:mc(e[i](c)),done:i==="return"}:o?o(c):c}:o}}function kx(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof e0=="function"?e0(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(c){return new Promise(function(l,f){c=e[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 qx(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function zx(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function Hx(e){return e&&e.__esModule?e:{default:e}}function Kx(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function Wx(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}var Vx=Object.freeze({__proto__:null,__extends:Dx,get __assign(){return t0},__rest:Ox,__decorate:Px,__param:Mx,__metadata:$x,__awaiter:Nx,__generator:Tx,__createBinding:Rx,__exportStar:Lx,__values:e0,__read:fv,__spread:Bx,__spreadArrays:Ux,__await:mc,__asyncGenerator:Fx,__asyncDelegator:jx,__asyncValues:kx,__makeTemplateObject:qx,__importStar:zx,__importDefault:Hx,__classPrivateFieldGet:Kx,__classPrivateFieldSet:Wx}),Gx=ol(Vx),Hi={},dv;function Yx(){if(dv)return Hi;dv=1,Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.isBrowserCryptoAvailable=Hi.getSubtleCrypto=Hi.getBrowerCrypto=void 0;function e(){return jr?.crypto||jr?.msCrypto||{}}Hi.getBrowerCrypto=e;function t(){const n=e();return n.subtle||n.webkitSubtle}Hi.getSubtleCrypto=t;function r(){return!!e()&&!!t()}return Hi.isBrowserCryptoAvailable=r,Hi}var Ki={},pv;function Qx(){if(pv)return Ki;pv=1,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.isBrowser=Ki.isNode=Ki.isReactNative=void 0;function e(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ki.isReactNative=e;function t(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ki.isNode=t;function r(){return!e()&&!t()}return Ki.isBrowser=r,Ki}(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Gx;t.__exportStar(Yx(),e),t.__exportStar(Qx(),e)})(hv);function fs(e=3){const t=Date.now()*Math.pow(10,e),r=Math.floor(Math.random()*Math.pow(10,e));return t+r}function Ys(e=6){return BigInt(fs(e))}function ea(e,t,r){return{id:r||fs(),jsonrpc:"2.0",method:e,params:t}}function Vl(e,t){return{id:e,jsonrpc:"2.0",result:t}}function Gl(e,t,r){return{id:e,jsonrpc:"2.0",error:Jx(t,r)}}function Jx(e,t){return typeof e>"u"?lv(av):(typeof e=="string"&&(e=Object.assign(Object.assign({},lv(Zf)),{message:e})),typeof t<"u"&&(e.data=t),Sx(e.code)&&(e=Cx(e.code)),e)}class Zx{}class Xx extends Zx{constructor(){super()}}class t9 extends Xx{constructor(t){super()}}const e9="^https?:",r9="^wss?:";function n9(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(!(!t||!t.length))return t[0]}function gv(e,t){const r=n9(e);return typeof r>"u"?!1:new RegExp(t).test(r)}function mv(e){return gv(e,e9)}function vv(e){return gv(e,r9)}function i9(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function wv(e){return typeof e=="object"&&"id"in e&&"jsonrpc"in e&&e.jsonrpc==="2.0"}function r0(e){return wv(e)&&"method"in e}function Yl(e){return wv(e)&&(_i(e)||Pn(e))}function _i(e){return"result"in e}function Pn(e){return"error"in e}class Ei extends t9{constructor(t){super(t),this.events=new Cr.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async request(t,r){return this.requestStrict(ea(t.method,t.params||[],t.id||Ys().toString()),r)}async requestStrict(t,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(o){i(o)}this.events.on(`${t.id}`,o=>{Pn(o)?i(o.error):n(o.result)});try{await this.connection.send(t,r)}catch(o){i(o)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),Yl(t)?this.events.emit(`${t.id}`,t):this.events.emit("message",{type:t.method,data:t.params})}onClose(t){t&&t.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${t.code} ${t.reason?`(${t.reason})`:""}`)),this.events.emit("disconnect")}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),typeof t=="string"&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",t=>this.onClose(t)),this.connection.on("error",t=>this.events.emit("error",t)),this.connection.on("register_error",t=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const s9=()=>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"),o9=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",yv=e=>e.split("?")[0],bv=10,a9=s9();class c9{constructor(t){if(this.url=t,this.events=new Cr.exports.EventEmitter,this.registering=!1,!vv(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);this.url=t}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async open(t=this.url){await this.register(t)}async close(){return new Promise((t,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),t()},this.socket.close()})}async send(t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ui(t))}catch(r){this.onError(t.id,r)}}register(t=this.url){if(!vv(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);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=t,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(t).get("origin"),o=hv.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!i9(t)},c=new a9(t,[],o);o9()?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(t){t.onmessage=r=>this.onPayload(r),t.onclose=r=>this.onClose(r),this.socket=t,this.registering=!1,this.events.emit("open")}onClose(t){this.socket=void 0,this.registering=!1,this.events.emit("close",t)}onPayload(t){if(typeof t.data>"u")return;const r=typeof t.data=="string"?ka(t.data):t.data;this.events.emit("payload",r)}onError(t,r){const n=this.parseError(r),i=n.message||n.toString(),o=Gl(t,i);this.events.emit("payload",o)}parseError(t,r=this.url){return uv(t,yv(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>bv&&this.events.setMaxListeners(bv)}emitError(t){const r=this.parseError(new Error(t?.message||`WebSocket connection failed for host: ${yv(this.url)}`));return this.events.emit("register_error",r),r}}var n0={exports:{}};(function(e,t){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]",x="[object Function]",I="[object GeneratorFunction]",F="[object Map]",W="[object Number]",Y="[object Null]",B="[object Object]",z="[object Promise]",P="[object Proxy]",U="[object RegExp]",j="[object Set]",m="[object String]",$="[object Symbol]",et="[object Undefined]",tt="[object WeakMap]",nt="[object ArrayBuffer]",dt="[object DataView]",d="[object Float32Array]",p="[object Float64Array]",b="[object Int8Array]",C="[object Int16Array]",O="[object Int32Array]",N="[object Uint8Array]",L="[object Uint8ClampedArray]",D="[object Uint16Array]",v="[object Uint32Array]",T=/[\\^$.*+?()[\]{}|]/g,ot=/^\[object .+?Constructor\]$/,pt=/^(?:0|[1-9]\d*)$/,A={};A[d]=A[p]=A[b]=A[C]=A[O]=A[N]=A[L]=A[D]=A[v]=!0,A[l]=A[f]=A[nt]=A[g]=A[dt]=A[_]=A[E]=A[x]=A[F]=A[W]=A[B]=A[U]=A[j]=A[m]=A[tt]=!1;var rt=typeof jr=="object"&&jr&&jr.Object===Object&&jr,q=typeof self=="object"&&self&&self.Object===Object&&self,H=rt||q||Function("return this")(),V=t&&!t.nodeType&&t,w=V&&!0&&e&&!e.nodeType&&e,k=w&&w.exports===V,it=k&&rt.process,ht=function(){try{return it&&it.binding&&it.binding("util")}catch{}}(),lt=ht&&ht.isTypedArray;function Ot(K,J){for(var ft=-1,It=K==null?0:K.length,Ge=0,oe=[];++ft<It;){var Xe=K[ft];J(Xe,ft,K)&&(oe[Ge++]=Xe)}return oe}function Mt(K,J){for(var ft=-1,It=J.length,Ge=K.length;++ft<It;)K[Ge+ft]=J[ft];return K}function St(K,J){for(var ft=-1,It=K==null?0:K.length;++ft<It;)if(J(K[ft],ft,K))return!0;return!1}function Pe(K,J){for(var ft=-1,It=Array(K);++ft<K;)It[ft]=J(ft);return It}function zt(K){return function(J){return K(J)}}function Dt(K,J){return K.has(J)}function Ft(K,J){return K?.[J]}function Et(K){var J=-1,ft=Array(K.size);return K.forEach(function(It,Ge){ft[++J]=[Ge,It]}),ft}function At(K,J){return function(ft){return K(J(ft))}}function Gt(K){var J=-1,ft=Array(K.size);return K.forEach(function(It){ft[++J]=It}),ft}var bt=Array.prototype,xt=Function.prototype,Bt=Object.prototype,_t=H["__core-js_shared__"],Pt=xt.toString,jt=Bt.hasOwnProperty,$t=function(){var K=/[^.]+$/.exec(_t&&_t.keys&&_t.keys.IE_PROTO||"");return K?"Symbol(src)_1."+K:""}(),Nt=Bt.toString,le=RegExp("^"+Pt.call(jt).replace(T,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rt=k?H.Buffer:void 0,Tt=H.Symbol,nr=H.Uint8Array,de=Bt.propertyIsEnumerable,Ee=bt.splice,ir=Tt?Tt.toStringTag:void 0,Ie=Object.getOwnPropertySymbols,Oe=Rt?Rt.isBuffer:void 0,Vr=At(Object.keys,Object),Yt=bn(H,"DataView"),Ht=bn(H,"Map"),Re=bn(H,"Promise"),Qt=bn(H,"Set"),Vt=bn(H,"WeakMap"),Me=bn(Object,"create"),Xt=Ji(Yt),te=Ji(Ht),Le=Ji(Re),ee=Ji(Qt),Jt=Ji(Vt),Fe=Tt?Tt.prototype:void 0,Zt=Fe?Fe.valueOf:void 0;function kt(K){var J=-1,ft=K==null?0:K.length;for(this.clear();++J<ft;){var It=K[J];this.set(It[0],It[1])}}function He(){this.__data__=Me?Me(null):{},this.size=0}function re(K){var J=this.has(K)&&delete this.__data__[K];return this.size-=J?1:0,J}function je(K){var J=this.__data__;if(Me){var ft=J[K];return ft===n?void 0:ft}return jt.call(J,K)?J[K]:void 0}function ei(K){var J=this.__data__;return Me?J[K]!==void 0:jt.call(J,K)}function ke(K,J){var ft=this.__data__;return this.size+=this.has(K)?0:1,ft[K]=Me&&J===void 0?n:J,this}kt.prototype.clear=He,kt.prototype.delete=re,kt.prototype.get=je,kt.prototype.has=ei,kt.prototype.set=ke;function ve(K){var J=-1,ft=K==null?0:K.length;for(this.clear();++J<ft;){var It=K[J];this.set(It[0],It[1])}}function Tn(){this.__data__=[],this.size=0}function Rn(K){var J=this.__data__,ft=bo(J,K);if(ft<0)return!1;var It=J.length-1;return ft==It?J.pop():Ee.call(J,ft,1),--this.size,!0}function Ln(K){var J=this.__data__,ft=bo(J,K);return ft<0?void 0:J[ft][1]}function Bn(K){return bo(this.__data__,K)>-1}function Un(K,J){var ft=this.__data__,It=bo(ft,K);return It<0?(++this.size,ft.push([K,J])):ft[It][1]=J,this}ve.prototype.clear=Tn,ve.prototype.delete=Rn,ve.prototype.get=Ln,ve.prototype.has=Bn,ve.prototype.set=Un;function xr(K){var J=-1,ft=K==null?0:K.length;for(this.clear();++J<ft;){var It=K[J];this.set(It[0],It[1])}}function Pi(){this.size=0,this.__data__={hash:new kt,map:new(Ht||ve),string:new kt}}function fo(K){var J=Ds(this,K).delete(K);return this.size-=J?1:0,J}function Mi(K){return Ds(this,K).get(K)}function po(K){return Ds(this,K).has(K)}function go(K,J){var ft=Ds(this,K),It=ft.size;return ft.set(K,J),this.size+=ft.size==It?0:1,this}xr.prototype.clear=Pi,xr.prototype.delete=fo,xr.prototype.get=Mi,xr.prototype.has=po,xr.prototype.set=go;function $i(K){var J=-1,ft=K==null?0:K.length;for(this.__data__=new xr;++J<ft;)this.add(K[J])}function Ss(K){return this.__data__.set(K,n),this}function Cs(K){return this.__data__.has(K)}$i.prototype.add=$i.prototype.push=Ss,$i.prototype.has=Cs;function Gr(K){var J=this.__data__=new ve(K);this.size=J.size}function mo(){this.__data__=new ve,this.size=0}function vo(K){var J=this.__data__,ft=J.delete(K);return this.size=J.size,ft}function wo(K){return this.__data__.get(K)}function yo(K){return this.__data__.has(K)}function $u(K,J){var ft=this.__data__;if(ft instanceof ve){var It=ft.__data__;if(!Ht||It.length<r-1)return It.push([K,J]),this.size=++ft.size,this;ft=this.__data__=new xr(It)}return ft.set(K,J),this.size=ft.size,this}Gr.prototype.clear=mo,Gr.prototype.delete=vo,Gr.prototype.get=wo,Gr.prototype.has=yo,Gr.prototype.set=$u;function Nu(K,J){var ft=Ia(K),It=!ft&&Ku(K),Ge=!ft&&!It&&zc(K),oe=!ft&&!It&&!Ge&&Gu(K),Xe=ft||It||Ge||oe,gr=Xe?Pe(K.length,String):[],Se=gr.length;for(var Ye in K)(J||jt.call(K,Ye))&&!(Xe&&(Ye=="length"||Ge&&(Ye=="offset"||Ye=="parent")||oe&&(Ye=="buffer"||Ye=="byteLength"||Ye=="byteOffset")||ju(Ye,Se)))&&gr.push(Ye);return gr}function bo(K,J){for(var ft=K.length;ft--;)if(Hu(K[ft][0],J))return ft;return-1}function kc(K,J,ft){var It=J(K);return Ia(K)?It:Mt(It,ft(K))}function _o(K){return K==null?K===void 0?et:Y:ir&&ir in Object(K)?Uu(K):Td(K)}function qc(K){return Ao(K)&&_o(K)==l}function Eo(K,J,ft,It,Ge){return K===J?!0:K==null||J==null||!Ao(K)&&!Ao(J)?K!==K&&J!==J:Tu(K,J,ft,It,Eo,Ge)}function Tu(K,J,ft,It,Ge,oe){var Xe=Ia(K),gr=Ia(J),Se=Xe?f:Ni(K),Ye=gr?f:Ni(J);Se=Se==l?B:Se,Ye=Ye==l?B:Ye;var fr=Se==B,ln=Ye==B,mr=Se==Ye;if(mr&&zc(K)){if(!zc(J))return!1;Xe=!0,fr=!1}if(mr&&!fr)return oe||(oe=new Gr),Xe||Gu(K)?Aa(K,J,ft,It,Ge,oe):Nd(K,J,Se,ft,It,Ge,oe);if(!(ft&i)){var tr=fr&&jt.call(K,"__wrapped__"),Yr=ln&&jt.call(J,"__wrapped__");if(tr||Yr){var ri=tr?K.value():K,Fn=Yr?J.value():J;return oe||(oe=new Gr),Ge(ri,Fn,ft,It,oe)}}return mr?(oe||(oe=new Gr),Bu(K,J,ft,It,Ge,oe)):!1}function $d(K){if(!Vu(K)||qu(K))return!1;var J=Sa(K)?le:ot;return J.test(Ji(K))}function Ru(K){return Ao(K)&&Wu(K.length)&&!!A[_o(K)]}function Lu(K){if(!zu(K))return Vr(K);var J=[];for(var ft in Object(K))jt.call(K,ft)&&ft!="constructor"&&J.push(ft);return J}function Aa(K,J,ft,It,Ge,oe){var Xe=ft&i,gr=K.length,Se=J.length;if(gr!=Se&&!(Xe&&Se>gr))return!1;var Ye=oe.get(K);if(Ye&&oe.get(J))return Ye==J;var fr=-1,ln=!0,mr=ft&o?new $i:void 0;for(oe.set(K,J),oe.set(J,K);++fr<gr;){var tr=K[fr],Yr=J[fr];if(It)var ri=Xe?It(Yr,tr,fr,J,K,oe):It(tr,Yr,fr,K,J,oe);if(ri!==void 0){if(ri)continue;ln=!1;break}if(mr){if(!St(J,function(Fn,Ti){if(!Dt(mr,Ti)&&(tr===Fn||Ge(tr,Fn,ft,It,oe)))return mr.push(Ti)})){ln=!1;break}}else if(!(tr===Yr||Ge(tr,Yr,ft,It,oe))){ln=!1;break}}return oe.delete(K),oe.delete(J),ln}function Nd(K,J,ft,It,Ge,oe,Xe){switch(ft){case dt:if(K.byteLength!=J.byteLength||K.byteOffset!=J.byteOffset)return!1;K=K.buffer,J=J.buffer;case nt:return!(K.byteLength!=J.byteLength||!oe(new nr(K),new nr(J)));case g:case _:case W:return Hu(+K,+J);case E:return K.name==J.name&&K.message==J.message;case U:case m:return K==J+"";case F:var gr=Et;case j:var Se=It&i;if(gr||(gr=Gt),K.size!=J.size&&!Se)return!1;var Ye=Xe.get(K);if(Ye)return Ye==J;It|=o,Xe.set(K,J);var fr=Aa(gr(K),gr(J),It,Ge,oe,Xe);return Xe.delete(K),fr;case $:if(Zt)return Zt.call(K)==Zt.call(J)}return!1}function Bu(K,J,ft,It,Ge,oe){var Xe=ft&i,gr=xa(K),Se=gr.length,Ye=xa(J),fr=Ye.length;if(Se!=fr&&!Xe)return!1;for(var ln=Se;ln--;){var mr=gr[ln];if(!(Xe?mr in J:jt.call(J,mr)))return!1}var tr=oe.get(K);if(tr&&oe.get(J))return tr==J;var Yr=!0;oe.set(K,J),oe.set(J,K);for(var ri=Xe;++ln<Se;){mr=gr[ln];var Fn=K[mr],Ti=J[mr];if(It)var Hc=Xe?It(Ti,Fn,mr,J,K,oe):It(Fn,Ti,mr,K,J,oe);if(!(Hc===void 0?Fn===Ti||Ge(Fn,Ti,ft,It,oe):Hc)){Yr=!1;break}ri||(ri=mr=="constructor")}if(Yr&&!ri){var xo=K.constructor,Ir=J.constructor;xo!=Ir&&"constructor"in K&&"constructor"in J&&!(typeof xo=="function"&&xo instanceof xo&&typeof Ir=="function"&&Ir instanceof Ir)&&(Yr=!1)}return oe.delete(K),oe.delete(J),Yr}function xa(K){return kc(K,Bd,Fu)}function Ds(K,J){var ft=K.__data__;return ku(J)?ft[typeof J=="string"?"string":"hash"]:ft.map}function bn(K,J){var ft=Ft(K,J);return $d(ft)?ft:void 0}function Uu(K){var J=jt.call(K,ir),ft=K[ir];try{K[ir]=void 0;var It=!0}catch{}var Ge=Nt.call(K);return It&&(J?K[ir]=ft:delete K[ir]),Ge}var Fu=Ie?function(K){return K==null?[]:(K=Object(K),Ot(Ie(K),function(J){return de.call(K,J)}))}:Ve,Ni=_o;(Yt&&Ni(new Yt(new ArrayBuffer(1)))!=dt||Ht&&Ni(new Ht)!=F||Re&&Ni(Re.resolve())!=z||Qt&&Ni(new Qt)!=j||Vt&&Ni(new Vt)!=tt)&&(Ni=function(K){var J=_o(K),ft=J==B?K.constructor:void 0,It=ft?Ji(ft):"";if(It)switch(It){case Xt:return dt;case te:return F;case Le:return z;case ee:return j;case Jt:return tt}return J});function ju(K,J){return J=J??c,!!J&&(typeof K=="number"||pt.test(K))&&K>-1&&K%1==0&&K<J}function ku(K){var J=typeof K;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?K!=="__proto__":K===null}function qu(K){return!!$t&&$t in K}function zu(K){var J=K&&K.constructor,ft=typeof J=="function"&&J.prototype||Bt;return K===ft}function Td(K){return Nt.call(K)}function Ji(K){if(K!=null){try{return Pt.call(K)}catch{}try{return K+""}catch{}}return""}function Hu(K,J){return K===J||K!==K&&J!==J}var Ku=qc(function(){return arguments}())?qc:function(K){return Ao(K)&&jt.call(K,"callee")&&!de.call(K,"callee")},Ia=Array.isArray;function Rd(K){return K!=null&&Wu(K.length)&&!Sa(K)}var zc=Oe||Ke;function Ld(K,J){return Eo(K,J)}function Sa(K){if(!Vu(K))return!1;var J=_o(K);return J==x||J==I||J==h||J==P}function Wu(K){return typeof K=="number"&&K>-1&&K%1==0&&K<=c}function Vu(K){var J=typeof K;return K!=null&&(J=="object"||J=="function")}function Ao(K){return K!=null&&typeof K=="object"}var Gu=lt?zt(lt):Ru;function Bd(K){return Rd(K)?Nu(K):Lu(K)}function Ve(){return[]}function Ke(){return!1}e.exports=Ld})(n0,n0.exports);var l9=n0.exports;function u9(e,t){return t=t||{},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(t.method||"get",e,!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=t.credentials=="include",t.headers)i.setRequestHeader(h,t.headers[h]);i.send(t.body||null)})}var h9=Object.freeze({__proto__:null,default:u9}),_v=ol(h9),f9=self.fetch||(self.fetch=_v.default||_v),d9=Object.defineProperty,Ev=Object.getOwnPropertySymbols,p9=Object.prototype.hasOwnProperty,g9=Object.prototype.propertyIsEnumerable,Av=(e,t,r)=>t in e?d9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Kr=(e,t)=>{for(var r in t||(t={}))p9.call(t,r)&&Av(e,r,t[r]);if(Ev)for(var r of Ev(t))g9.call(t,r)&&Av(e,r,t[r]);return e};function m9(e,t){if(e.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<e.length;i++){var o=e.charAt(i),c=o.charCodeAt(0);if(r[c]!==255)throw new TypeError(o+" is ambiguous");r[c]=i}var l=e.length,f=e.charAt(0),h=Math.log(l)/Math.log(256),g=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 F=0,W=0,Y=0,B=I.length;Y!==B&&I[Y]===0;)Y++,F++;for(var z=(B-Y)*g+1>>>0,P=new Uint8Array(z);Y!==B;){for(var U=I[Y],j=0,m=z-1;(U!==0||j<W)&&m!==-1;m--,j++)U+=256*P[m]>>>0,P[m]=U%l>>>0,U=U/l>>>0;if(U!==0)throw new Error("Non-zero carry");W=j,Y++}for(var $=z-W;$!==z&&P[$]===0;)$++;for(var et=f.repeat(F);$<z;++$)et+=e.charAt(P[$]);return et}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var F=0;if(I[F]!==" "){for(var W=0,Y=0;I[F]===f;)W++,F++;for(var B=(I.length-F)*h+1>>>0,z=new Uint8Array(B);I[F];){var P=r[I.charCodeAt(F)];if(P===255)return;for(var U=0,j=B-1;(P!==0||U<Y)&&j!==-1;j--,U++)P+=l*z[j]>>>0,z[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");Y=U,F++}if(I[F]!==" "){for(var m=B-Y;m!==B&&z[m]===0;)m++;for(var $=new Uint8Array(W+(B-m)),et=W;m!==B;)$[et++]=z[m++];return $}}}function x(I){var F=E(I);if(F)return F;throw new Error(`Non-${t} character`)}return{encode:_,decodeUnsafe:E,decode:x}}var v9=m9,w9=v9;const xv=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},y9=e=>new TextEncoder().encode(e),b9=e=>new TextDecoder().decode(e);class _9{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class E9{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Iv(this,t)}}class A9{constructor(t){this.decoders=t}or(t){return Iv(this,t)}decode(t){const r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Iv=(e,t)=>new A9(Kr(Kr({},e.decoders||{[e.prefix]:e}),t.decoders||{[t.prefix]:t}));class x9{constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new _9(t,r,n),this.decoder=new E9(t,r,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const Ql=({name:e,prefix:t,encode:r,decode:n})=>new x9(e,t,r,n),vc=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:i}=w9(r,t);return Ql({prefix:e,name:t,encode:n,decode:o=>xv(i(o))})},I9=(e,t,r,n)=>{const i={};for(let g=0;g<t.length;++g)i[t[g]]=g;let o=e.length;for(;e[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[e[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},S9=(e,t,r)=>{const n=t[t.length-1]==="=",i=(1<<r)-1;let o="",c=0,l=0;for(let f=0;f<e.length;++f)for(l=l<<8|e[f],c+=8;c>r;)c-=r,o+=t[i&l>>c];if(c&&(o+=t[i&l<<r-c]),n)for(;o.length*r&7;)o+="=";return o},$r=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>Ql({prefix:t,name:e,encode(i){return S9(i,n,r)},decode(i){return I9(i,n,r,e)}}),C9=Ql({prefix:"\0",name:"identity",encode:e=>b9(e),decode:e=>y9(e)});var D9=Object.freeze({__proto__:null,identity:C9});const O9=$r({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var P9=Object.freeze({__proto__:null,base2:O9});const M9=$r({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $9=Object.freeze({__proto__:null,base8:M9});const N9=vc({prefix:"9",name:"base10",alphabet:"0123456789"});var T9=Object.freeze({__proto__:null,base10:N9});const R9=$r({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),L9=$r({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var B9=Object.freeze({__proto__:null,base16:R9,base16upper:L9});const U9=$r({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),F9=$r({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),j9=$r({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),k9=$r({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q9=$r({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),z9=$r({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),H9=$r({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),K9=$r({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),W9=$r({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var V9=Object.freeze({__proto__:null,base32:U9,base32upper:F9,base32pad:j9,base32padupper:k9,base32hex:q9,base32hexupper:z9,base32hexpad:H9,base32hexpadupper:K9,base32z:W9});const G9=vc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Y9=vc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Q9=Object.freeze({__proto__:null,base36:G9,base36upper:Y9});const J9=vc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Z9=vc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var X9=Object.freeze({__proto__:null,base58btc:J9,base58flickr:Z9});const tI=$r({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),eI=$r({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),rI=$r({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nI=$r({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var iI=Object.freeze({__proto__:null,base64:tI,base64pad:eI,base64url:rI,base64urlpad:nI});const Sv=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}"),sI=Sv.reduce((e,t,r)=>(e[r]=t,e),[]),oI=Sv.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function aI(e){return e.reduce((t,r)=>(t+=sI[r],t),"")}function cI(e){const t=[];for(const r of e){const n=oI[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}const lI=Ql({prefix:"\u{1F680}",name:"base256emoji",encode:aI,decode:cI});var uI=Object.freeze({__proto__:null,base256emoji:lI}),hI=Dv,Cv=128,fI=127,dI=~fI,pI=Math.pow(2,31);function Dv(e,t,r){t=t||[],r=r||0;for(var n=r;e>=pI;)t[r++]=e&255|Cv,e/=128;for(;e&dI;)t[r++]=e&255|Cv,e>>>=7;return t[r]=e|0,Dv.bytes=r-n+1,t}var gI=i0,mI=128,Ov=127;function i0(e,n){var r=0,n=n||0,i=0,o=n,c,l=e.length;do{if(o>=l)throw i0.bytes=0,new RangeError("Could not decode varint");c=e[o++],r+=i<28?(c&Ov)<<i:(c&Ov)*Math.pow(2,i),i+=7}while(c>=mI);return i0.bytes=o-n,r}var vI=Math.pow(2,7),wI=Math.pow(2,14),yI=Math.pow(2,21),bI=Math.pow(2,28),_I=Math.pow(2,35),EI=Math.pow(2,42),AI=Math.pow(2,49),xI=Math.pow(2,56),II=Math.pow(2,63),SI=function(e){return e<vI?1:e<wI?2:e<yI?3:e<bI?4:e<_I?5:e<EI?6:e<AI?7:e<xI?8:e<II?9:10},CI={encode:hI,decode:gI,encodingLength:SI},Pv=CI;const Mv=(e,t,r=0)=>(Pv.encode(e,t,r),t),$v=e=>Pv.encodingLength(e),s0=(e,t)=>{const r=t.byteLength,n=$v(e),i=n+$v(r),o=new Uint8Array(i+r);return Mv(e,o,0),Mv(r,o,n),o.set(t,i),new DI(e,r,t,o)};class DI{constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}}const Nv=({name:e,code:t,encode:r})=>new OI(e,t,r);class OI{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){const r=this.encode(t);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 Tv=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),PI=Nv({name:"sha2-256",code:18,encode:Tv("SHA-256")}),MI=Nv({name:"sha2-512",code:19,encode:Tv("SHA-512")});var $I=Object.freeze({__proto__:null,sha256:PI,sha512:MI});const Rv=0,NI="identity",Lv=xv;var TI=Object.freeze({__proto__:null,identity:{code:Rv,name:NI,encode:Lv,digest:e=>s0(Rv,Lv(e))}});new TextEncoder,new TextDecoder;const Bv=Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr(Kr({},D9),P9),$9),T9),B9),V9),Q9),X9),iI),uI);Kr(Kr({},$I),TI);function RI(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function Uv(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const Fv=Uv("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),o0=Uv("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);const t=RI(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),LI=Kr({utf8:Fv,"utf-8":Fv,hex:Bv.base16,latin1:o0,ascii:o0,binary:o0},Bv);function BI(e,t="utf8"){const r=LI[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}const jv="wc",UI=2,a0="core",ds=`${jv}@2:${a0}:`,FI={name:a0,logger:"error"},jI={database:":memory:"},kI="crypto",kv="client_ed25519_seed",qI=yt.ONE_DAY,zI="keychain",HI="0.3",KI="messages",WI="0.3",VI=yt.SIX_HOURS,GI="publisher",qv="irn",YI="error",zv="wss://relay.walletconnect.org",QI="relayer",on={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"},JI="_subscription",Mn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ZI=.1,XI="2.14.0",tS=1e4,eS="0.3",rS="WALLETCONNECT_CLIENT_ID",Ai={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},nS="subscription",iS="0.3",sS=yt.FIVE_SECONDS*1e3,oS="pairing",aS="0.3",wc={wc_pairingDelete:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:yt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:yt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:0},res:{ttl:yt.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"},cS="history",lS="0.3",uS="expirer",$n={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},hS="0.3",c0="verify-api",fS="https://verify.walletconnect.com",Hv="https://verify.walletconnect.org",yc=Hv,dS=[fS,Hv],pS="echo",gS="https://echo.walletconnect.com";class mS{constructor(t,r){this.core=t,this.logger=r,this.keychain=new Map,this.name=zI,this.version=HI,this.initialized=!1,this.storagePrefix=ds,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}=mt("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=t,this.logger=en(r,this.name)}get context(){return tn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Ig(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Sg(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class vS{constructor(t,r,n){this.core=t,this.logger=r,this.name=kI,this.randomSessionIdentifier=Hf(),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=J1(i);return Q1(o.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=_7();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const o=await this.getClientSeed(),c=J1(o),l=this.randomSessionIdentifier;return await d_(l,i,qI,c)},this.generateSharedKey=(i,o,c)=>{this.isInitialized();const l=this.getPrivateKey(i),f=E7(l,o);return this.setSymKey(f,c)},this.setSymKey=async(i,o)=>{this.isInitialized();const c=o||Hl(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=Hm(c),f=Ui(o);if(Km(l)){const E=l.senderPublicKey,x=l.receiverPublicKey;i=await this.generateSharedKey(E,x)}const h=this.getSymKey(i),{type:g,senderPublicKey:_}=l;return x7({type:g,symKey:h,message:f,senderPublicKey:_})},this.decode=async(i,o,c)=>{this.isInitialized();const l=C7(o,c);if(Km(l)){const f=l.receiverPublicKey,h=l.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=I7({symKey:f,encoded:o});return ka(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=Kl(i);return uc(o.type)},this.getPayloadSenderPublicKey=i=>{const o=Kl(i);return o.senderPublicKey?bx(o.senderPublicKey,zr):void 0},this.core=t,this.logger=en(r,this.name),this.keychain=n||new mS(this.core,this.logger)}get context(){return tn(this.logger)}async setPrivateKey(t,r){return await this.keychain.set(t,r),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(kv)}catch{t=Hf(),await this.keychain.set(kv,t)}return BI(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class wS extends V6{constructor(t,r){super(t,r),this.logger=t,this.core=r,this.messages=new Map,this.name=KI,this.version=WI,this.initialized=!1,this.storagePrefix=ds,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=Gs(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=Gs(i);return typeof o[c]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=en(t,this.name),this.core=r}get context(){return tn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Ig(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Sg(t):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class yS extends G6{constructor(t,r){super(t,r),this.relayer=t,this.logger=r,this.events=new Cr.exports.EventEmitter,this.name=GI,this.queue=new Map,this.publishTimeout=yt.toMiliseconds(yt.ONE_MINUTE),this.failedPublishTimeout=yt.toMiliseconds(yt.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||VI,f=Kf(o),h=o?.prompt||!1,g=o?.tag||0,_=o?.id||Ys().toString(),E={topic:n,message:i,opts:{ttl:l,relay:f,prompt:h,tag:g,id:_}},x=`Failed to publish payload, please try again. id:${_} tag:${g}`,I=Date.now();let F,W=1;try{for(;F===void 0;){if(Date.now()-I>this.publishTimeout)throw new Error(x);this.logger.trace({id:_,attempts:W},`publisher.publish - attempt ${W}`),F=await await qo(this.rpcPublish(n,i,l,f,h,g,_).catch(Y=>this.logger.warn(Y)),this.publishTimeout,x),W++,F||await new Promise(Y=>setTimeout(Y,this.failedPublishTimeout))}this.relayer.events.emit(on.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=t,this.logger=en(r,this.name),this.registerEventListeners()}get context(){return tn(this.logger)}rpcPublish(t,r,n,i,o,c,l){var f,h,g,_;const E={method:hc(i.protocol).publish,params:{topic:t,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(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async t=>{const{topic:r,message:n,opts:i}=t;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ka.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(on.connection_stalled);return}this.checkQueue()}),this.relayer.on(on.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}class bS{constructor(){this.map=new Map,this.set=(t,r)=>{const n=this.get(t);this.exists(t,r)||this.map.set(t,[...n,r])},this.get=t=>this.map.get(t)||[],this.exists=(t,r)=>this.get(t).includes(r),this.delete=(t,r)=>{if(typeof r>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const n=this.get(t);if(!this.exists(t,r))return;const i=n.filter(o=>o!==r);if(!i.length){this.map.delete(t);return}this.map.set(t,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var _S=Object.defineProperty,ES=Object.defineProperties,AS=Object.getOwnPropertyDescriptors,Kv=Object.getOwnPropertySymbols,xS=Object.prototype.hasOwnProperty,IS=Object.prototype.propertyIsEnumerable,Wv=(e,t,r)=>t in e?_S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bc=(e,t)=>{for(var r in t||(t={}))xS.call(t,r)&&Wv(e,r,t[r]);if(Kv)for(var r of Kv(t))IS.call(t,r)&&Wv(e,r,t[r]);return e},l0=(e,t)=>ES(e,AS(t));class SS extends J6{constructor(t,r){super(t,r),this.relayer=t,this.logger=r,this.subscriptions=new Map,this.topicMap=new bS,this.events=new Cr.exports.EventEmitter,this.name=nS,this.version=iS,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ds,this.subscribeTimeout=yt.toMiliseconds(yt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},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=Kf(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 yt.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)>=sS&&(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=t,this.logger=en(r,this.name),this.clientId=""}get context(){return tn(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(t,r){let n=!1;try{n=this.getSubscription(t).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,r){const n=this.topicMap.get(t);await Promise.all(n.map(async i=>await this.unsubscribeById(t,i,r)))}async unsubscribeById(t,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:r,opts:n}});try{const i=Kf(n);await this.rpcUnsubscribe(t,r,i);const o=Ue("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,r,o),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(t,r){const n={method:hc(r.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await qo(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?Gs(t+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(on.connection_stalled)}return null}async rpcBatchSubscribe(t){if(!t.length)return;const r=t[0].relay,n={method:hc(r.protocol).batchSubscribe,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await qo(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(on.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const r=t[0].relay,n={method:hc(r.protocol).batchFetchMessages,params:{topics:t.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await qo(this.relayer.request(n).catch(o=>this.logger.warn(o)),this.subscribeTimeout)}catch{this.relayer.events.emit(on.connection_stalled)}return i}rpcUnsubscribe(t,r,n){const i={method:hc(n.protocol).unsubscribe,params:{topic:t,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,r){this.setSubscription(t,l0(bc({},r),{id:t})),this.pending.delete(r.topic)}onBatchSubscribe(t){t.length&&t.forEach(r=>{this.setSubscription(r.id,bc({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(t,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,t)&&this.deleteSubscription(r,n),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:r}),this.addSubscription(t,r)}addSubscription(t,r){this.subscriptions.set(t,bc({},r)),this.topicMap.set(r.topic,t),this.events.emit(Ai.created,r)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const r=this.subscriptions.get(t);if(!r){const{message:n}=mt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return r}deleteSubscription(t,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:r});const n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(Ai.deleted,l0(bc({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ai.sync)}async reset(){if(this.cached.length){const t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<t;r++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(n),await this.batchSubscribe(n)}}this.events.emit(Ai.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size){const{message:r}=mt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){if(!t.length)return;const r=await this.rpcBatchSubscribe(t);bi(r)&&this.onBatchSubscribe(r.map((n,i)=>l0(bc({},t[i]),{id:n})))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const r=await this.rpcBatchFetchMessages(t);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const t=[];this.pending.forEach(r=>{t.push(r)}),await this.batchSubscribe(t),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Ka.pulse,async()=>{await this.checkPending()}),this.events.on(Ai.created,async t=>{const r=Ai.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),await this.persist()}),this.events.on(Ai.deleted,async t=>{const r=Ai.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(){this.restartInProgress&&await new Promise(t=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),t())},this.pollingInterval)})}}var CS=Object.defineProperty,Vv=Object.getOwnPropertySymbols,DS=Object.prototype.hasOwnProperty,OS=Object.prototype.propertyIsEnumerable,Gv=(e,t,r)=>t in e?CS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,PS=(e,t)=>{for(var r in t||(t={}))DS.call(t,r)&&Gv(e,r,t[r]);if(Vv)for(var r of Vv(t))OS.call(t,r)&&Gv(e,r,t[r]);return e};class MS extends Y6{constructor(t){super(t),this.protocol="wc",this.version=2,this.events=new Cr.exports.EventEmitter,this.name=QI,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=yt.toMiliseconds(yt.THIRTY_SECONDS+yt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const o=r.id||Ys().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(Mn.disconnect,g);const _=await c;this.provider.off(Mn.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(Xa())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.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(on.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(on.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Mn.payload,this.onPayloadHandler),this.provider.on(Mn.connect,this.onConnectHandler),this.provider.on(Mn.disconnect,this.onDisconnectHandler),this.provider.on(Mn.error,this.onProviderErrorHandler)},this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?en(t.logger,this.name):ai(wl({level:t.logger||YI})),this.messages=new wS(this.logger,t.core),this.subscriber=new SS(this,this.logger),this.publisher=new yS(this,this.logger),this.relayUrl=t?.relayUrl||zv,this.projectId=t.projectId,this.bundleId=u4(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),await this.transportOpen(),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)},tS)}get context(){return tn(this.logger)}get connected(){var t,r,n;return((n=(r=(t=this.provider)==null?void 0:t.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var t,r,n;return((n=(r=(t=this.provider)==null?void 0:t.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(t,r,n){this.isInitialized(),await this.publisher.publish(t,r,n),await this.recordMessageEvent({topic:t,message:r,publishedAt:Date.now()})}async subscribe(t,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(t))==null?void 0:n[0])||"",o;const c=l=>{l.topic===t&&(this.subscriber.off(Ai.created,c),o())};return await Promise.all([new Promise(l=>{o=l,this.subscriber.on(Ai.created,c)}),new Promise(async l=>{i=await this.subscriber.subscribe(t,r)||i,l()})]),i}async unsubscribe(t,r){this.isInitialized(),await this.subscriber.unsubscribe(t,r)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(t=>t.promise))}catch(t){this.logger.warn(t)}this.hasExperiencedNetworkDisruption||this.connected?await qo(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Mn.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Mn.disconnect,i),await qo(this.provider.connect(),yt.toMiliseconds(yt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{n(o)}),this.subscriber.start().catch(o=>{this.logger.error(o),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(t){this.connectionAttemptInProgress||(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await iv())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if(t?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=t.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}startPingTimeout(){var t,r,n,i,o;if(Xa())try{(r=(t=this.provider)==null?void 0:t.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(t){return this.staleConnectionErrors.some(r=>t.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ei(new c9(m4({sdkVersion:XI,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(t){const{topic:r,message:n}=t;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(t){const{topic:r,message:n}=t;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(t){if(console.log({onProviderPayload:t}),this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),r0(t)){if(!t.method.endsWith(JI))return;const r=t.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(PS({type:"event",event:r.id},c)),this.events.emit(r.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else Yl(t)&&this.events.emit(on.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(this.events.emit(on.message,t),await this.recordMessageEvent(t))}async acknowledgePayload(t){const r=Vl(t.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Mn.payload,this.onPayloadHandler),this.provider.off(Mn.connect,this.onConnectHandler),this.provider.off(Mn.disconnect,this.onDisconnectHandler),this.provider.off(Mn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await iv();gx(async r=>{t!==r&&(t=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.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(on.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t))},yt.toMiliseconds(ZI))}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(t=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),t())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var $S=Object.defineProperty,Yv=Object.getOwnPropertySymbols,NS=Object.prototype.hasOwnProperty,TS=Object.prototype.propertyIsEnumerable,Qv=(e,t,r)=>t in e?$S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Jv=(e,t)=>{for(var r in t||(t={}))NS.call(t,r)&&Qv(e,r,t[r]);if(Yv)for(var r of Yv(t))TS.call(t,r)&&Qv(e,r,t[r]);return e};class Qs extends Q6{constructor(t,r,n,i=ds,o=void 0){super(t,r,n,i),this.core=t,this.logger=r,this.name=n,this.map=new Map,this.version=eS,this.cached=[],this.initialized=!1,this.storagePrefix=ds,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):G7(c)?this.map.set(c.id,c):Y7(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=>l9(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=Jv(Jv({},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=en(r,this.name),this.storagePrefix=i,this.getKey=o}get context(){return tn(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(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const r=this.map.get(t);if(!r){if(this.recentlyDeleted.includes(t)){const{message:i}=mt("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}const{message:n}=mt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:r}=mt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class RS{constructor(t,r){this.core=t,this.logger=r,this.name=oS,this.version=aS,this.events=new Cr.exports,this.initialized=!1,this.storagePrefix=ds,this.ignoredPayloadTypes=[zi],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=Hf(),o=await this.core.crypto.setSymKey(i),c=Or(yt.FIVE_MINUTES),l={protocol:qv},f={topic:o,expiry:c,relay:l,active:!1},h=U7({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:i,relay:l,expiryTimestamp:c,methods:n?.methods});return this.core.expirer.set(o,c),await this.pairings.set(o,f),await this.core.relayer.subscribe(o),{topic:o,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:o,relay:c,expiryTimestamp:l,methods:f}=Ym(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||Or(yt.FIVE_MINUTES),_={topic:i,relay:c,expiry:g,active:!1,methods:f};return this.core.expirer.set(i,g),await this.pairings.set(i,_),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=Or(yt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry: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}=Hs();this.events.once(we("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",Ue("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,o)=>{const c=ea(i,o),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,o)=>{const c=Vl(n,o),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,o)=>{const c=Gl(n,o),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,Ue("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=>cs(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(we("pairing_ping",o),{}):Pn(i)&&this.events.emit(we("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=Ue("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(Ue("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!sn(n)){const{message:c}=mt("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!V7(n.uri)){const{message:c}=mt("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const o=Ym(n.uri);if(!((i=o?.relay)!=null&&i.protocol)){const{message:c}=mt("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=mt("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(c)}if(o!=null&&o.expiryTimestamp&&yt.toMiliseconds(o?.expiryTimestamp)<Date.now()){const{message:c}=mt("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}},this.isValidPing=async n=>{if(!sn(n)){const{message:o}=mt("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(o)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!sn(n)){const{message:o}=mt("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}=mt("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=mt("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(cs(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=mt("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=t,this.logger=en(r,this.name),this.pairings=new Qs(this.core,this.logger,this.name,this.storagePrefix)}get context(){return tn(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(on.message,async t=>{const{topic:r,message:n}=t;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(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on($n.expired,async t=>{const{topic:r}=Dg(t.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(ra.expire,{topic:r}))})}}class LS extends W6{constructor(t,r){super(t,r),this.core=t,this.logger=r,this.records=new Map,this.events=new Cr.exports.EventEmitter,this.name=cS,this.version=lS,this.cached=[],this.initialized=!1,this.storagePrefix=ds,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:Or(yt.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=Pn(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(o=>{if(o.topic===n){if(typeof i<"u"&&o.id!==i)return;this.records.delete(o.id),this.events.emit(ti.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=en(r,this.name)}get context(){return tn(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 t=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ea(r.request.method,r.request.params,r.id),chainId:r.chainId};return t.push(n)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const r=this.records.get(t);if(!r){const{message:n}=mt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(ti.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:r}=mt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(ti.created,t=>{const r=ti.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:t})}),this.events.on(ti.updated,t=>{const r=ti.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:t})}),this.events.on(ti.deleted,t=>{const r=ti.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:t})}),this.core.heartbeat.on(Ka.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(r=>{yt.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),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class BS extends Z6{constructor(t,r){super(t,r),this.core=t,this.logger=r,this.expirations=new Map,this.events=new Cr.exports.EventEmitter,this.name=uS,this.version=hS,this.cached=[],this.initialized=!1,this.storagePrefix=ds,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=en(r,this.name)}get context(){return tn(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(t){if(typeof t=="string")return v4(t);if(typeof t=="number")return w4(t);const{message:r}=mt("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(r)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}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 t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:r}=mt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const r=this.expirations.get(t);if(!r){const{message:n}=mt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(t,r){const{expiry:n}=r;yt.toMiliseconds(n)-Date.now()<=0&&this.expire(t,r)}expire(t,r){this.expirations.delete(t),this.events.emit($n.expired,{target:t,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,r)=>this.checkExpiry(r,t))}registerEventListeners(){this.core.heartbeat.on(Ka.pulse,()=>this.checkExpirations()),this.events.on($n.created,t=>{const r=$n.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),this.persist()}),this.events.on($n.expired,t=>{const r=$n.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),this.persist()}),this.events.on($n.deleted,t=>{const r=$n.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class US extends X6{constructor(t,r){super(t,r),this.projectId=t,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(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);return this.fetchAttestation(n.attestationId,i)},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const o=this.startAbortTimer(yt.ONE_SECOND*5),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(c0);if(c)return this.iframe=c,this.onInit(),o();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=o}),new Promise((o,c)=>setTimeout(()=>{window.removeEventListener("message",i),c("verify iframe load timeout")},yt.toMiliseconds(yt.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||yc;return dS.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${yc}`),i=yc),i},this.logger=en(r,this.name),this.verifyUrl=yc,this.abortController=new AbortController,this.isDevEnv=Xa()&&process.env.IS_VITEST}get context(){return tn(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),yt.toMiliseconds(t))}}class FS extends t5{constructor(t,r){super(t,r),this.projectId=t,this.logger=r,this.context=pS,this.registerDeviceToken=async n=>{const{clientId:i,token:o,notificationType:c,enableEncrypted:l=!1}=n,f=`${gS}/${this.projectId}/clients`;await f9(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:o,always_raw:l})})},this.logger=en(r,this.context)}}var jS=Object.defineProperty,Zv=Object.getOwnPropertySymbols,kS=Object.prototype.hasOwnProperty,qS=Object.prototype.propertyIsEnumerable,Xv=(e,t,r)=>t in e?jS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tw=(e,t)=>{for(var r in t||(t={}))kS.call(t,r)&&Xv(e,r,t[r]);if(Zv)for(var r of Zv(t))qS.call(t,r)&&Xv(e,r,t[r]);return e};class u0 extends K6{constructor(t){var r;super(t),this.protocol=jv,this.version=UI,this.name=a0,this.events=new Cr.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=t?.projectId,this.relayUrl=t?.relayUrl||zv,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const n=wl({level:typeof t?.logger=="string"&&t.logger?t.logger:FI.logger}),{logger:i,chunkLoggerController:o}=H6({opts:n,maxSizeInBytes:t?.maxLogBlobSizeInBytes,loggerOverride:t?.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=en(i,this.name),this.heartbeat=new Hh,this.crypto=new vS(this,this.logger,t?.keychain),this.history=new LS(this,this.logger),this.expirer=new BS(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new k3(tw(tw({},jI),t?.storageOptions)),this.relayer=new MS({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new RS(this,this.logger),this.verify=new US(this.projectId||"",this.logger),this.echoClient=new FS(this.projectId||"",this.logger)}static async init(t){const r=new u0(t);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(rS,n),r}get context(){return tn(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.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(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}}const zS=u0,ew="wc",rw=2,nw="client",h0=`${ew}@${rw}:${nw}:`,f0={name:nw,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},iw="WALLETCONNECT_DEEPLINK_CHOICE",HS="proposal",sw="Proposal expired",KS="session",na=yt.SEVEN_DAYS,WS="engine",Nr={wc_sessionPropose:{req:{ttl:yt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:yt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:yt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:yt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:yt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1119}}},d0={min:yt.FIVE_MINUTES,max:yt.SEVEN_DAYS},xi={idle:"IDLE",active:"ACTIVE"},VS="request",GS=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],YS="wc",QS="auth",JS="authKeys",ZS="pairingTopics",XS="requests",Jl=`${YS}@${1.5}:${QS}:`,Zl=`${Jl}:PUB_KEY`;var tC=Object.defineProperty,eC=Object.defineProperties,rC=Object.getOwnPropertyDescriptors,ow=Object.getOwnPropertySymbols,nC=Object.prototype.hasOwnProperty,iC=Object.prototype.propertyIsEnumerable,aw=(e,t,r)=>t in e?tC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vr=(e,t)=>{for(var r in t||(t={}))nC.call(t,r)&&aw(e,r,t[r]);if(ow)for(var r of ow(t))iC.call(t,r)&&aw(e,r,t[r]);return e},Js=(e,t)=>eC(e,rC(t));class sC extends r5{constructor(t){super(t),this.name=WS,this.events=new Cr.exports,this.initialized=!1,this.requestQueue={state:xi.idle,queue:[]},this.sessionRequestQueue={state:xi.idle,queue:[]},this.requestQueueDelay=yt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Nr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},yt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const n=Js(vr({},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:U}=await this.client.core.pairing.create();h=P,g=U}if(!h){const{message:P}=mt("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(P)}const E=await this.client.core.crypto.generateKeyPair(),x=Nr.wc_sessionPropose.req.ttl||yt.FIVE_MINUTES,I=Or(x),F=vr({requiredNamespaces:o,optionalNamespaces:c,relays:f??[{protocol:qv}],proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:I,pairingTopic:h},l&&{sessionProperties:l}),{reject:W,resolve:Y,done:B}=Hs(x,sw);this.events.once(we("session_connect"),async({error:P,session:U})=>{if(P)W(P);else if(U){U.self.publicKey=E;const j=Js(vr({},U),{pairingTopic:F.pairingTopic,requiredNamespaces:F.requiredNamespaces,optionalNamespaces:F.optionalNamespaces});await this.client.session.set(U.topic,j),await this.setExpiry(U.topic,U.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:U.peer.metadata}),this.cleanupDuplicatePairings(j),Y(j)}});const z=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:F,throwOnFailedPublish:!0});return await this.setProposal(z,vr({id:z},F)),{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}const{pairingTopic:h,proposer:g,requiredNamespaces:_,optionalNamespaces:E}=f,x=await this.client.core.crypto.generateKeyPair(),I=g.publicKey,F=await this.client.core.crypto.generateSharedKey(x,I),W=vr(vr({relay:{protocol:i??"irn"},namespaces:o,controller:{publicKey:x,metadata:this.client.metadata},expiry:Or(na)},c&&{sessionProperties:c}),l&&{sessionConfig:l});await this.client.core.relayer.subscribe(F);const Y=Js(vr({},W),{topic:F,requiredNamespaces:_,optionalNamespaces:E,pairingTopic:h,acknowledged:!1,self:W.controller,peer:{publicKey:g.publicKey,metadata:g.metadata},controller:x});await this.client.session.set(F,Y);try{await this.sendResult({id:n,topic:h,result:{relay:{protocol:i??"irn"},responderPublicKey:x},throwOnFailedPublish:!0}),await this.sendRequest({topic:F,method:"wc_sessionSettle",params:W,throwOnFailedPublish:!0})}catch(B){throw this.client.logger.error(B),this.client.session.delete(F,Ue("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(F),B}return await this.client.core.pairing.updateMetadata({topic:h,metadata:g.metadata}),await this.client.proposal.delete(n,Ue("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(F,Or(na)),{topic:F,acknowledged:()=>Promise.resolve(this.client.session.get(F))}},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,rpcOpts:Nr.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Ue("USER_DISCONNECTED")))},this.update=async r=>{console.log({update: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}=Hs(),f=fs(),h=Ys().toString(),g=this.client.session.get(n).namespaces;return this.events.once(we("session_update",f),({error:_})=>{_?l(_):c()}),await this.client.session.update(n,{namespaces:i}),await 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=fs(),{done:o,resolve:c,reject:l}=Hs();return this.events.once(we("session_extend",i),({error:f})=>{f?l(f):c()}),await this.setExpiry(n,Or(na)),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(x){throw this.client.logger.error("request() -> isValidRequest() failed"),x}const{chainId:n,request:i,topic:o,expiry:c=Nr.wc_sessionRequest.req.ttl}=r,l=this.client.session.get(o),f=fs(),h=Ys().toString(),{done:g,resolve:_,reject:E}=Hs(c,"Request expired. Please try again.");return this.events.once(we("session_request",f),({error:x,result:I})=>{x?E(x):_(I)}),await Promise.all([new Promise(async x=>{await this.sendRequest({clientRpcId:f,relayRpcId:h,topic:o,method:"wc_sessionRequest",params:{request:Js(vr({},i),{expiryTimestamp:Or(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(I=>E(I)),this.client.events.emit("session_request_sent",{topic:o,request:i,chainId:n,id:f}),x()}),new Promise(async x=>{var I;if(!((I=l.sessionConfig)!=null&&I.disableDeepLink)){const F=await b4(this.client.core.storage,iw);console.log("handleDeeplinkRedirect",r),y4({id:f,topic:o,wcDeepLink:F})}x()}),g()]).then(x=>x[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}):Pn(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=fs(),o=Ys().toString(),{done:c,resolve:l,reject:f}=Hs();this.events.once(we("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=Ys().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:Ue("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}=mt("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>K7(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:_=[],expiry:E}=r,x=[...r.resources||[]],{topic:I,uri:F}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:I,uri:F}});const W=await this.client.core.crypto.generateKeyPair(),Y=Hl(W);if(await Promise.all([this.client.auth.authKeys.set(Zl,{responseTopic:Y,publicKey:W}),this.client.auth.pairingTopics.set(Y,{topic:Y,pairingTopic:I})]),await this.client.core.relayer.subscribe(Y),this.client.logger.info(`sending request to new pairing topic: ${I}`),_.length>0){const{namespace:d}=Za(n[0]);let p=g7(d,"request",_);zl(x)&&(p=v7(p,x.pop())),x.push(p)}const B=E&&E>Nr.wc_sessionAuthenticate.req.ttl?E:Nr.wc_sessionAuthenticate.req.ttl,z={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:x},requester:{publicKey:W,metadata:this.client.metadata},expiryTimestamp:Or(B)},P={eip155:{chains:n,methods:[...new Set(["personal_sign",..._])],events:["chainChanged","accountsChanged"]}},U={requiredNamespaces:{},optionalNamespaces:P,relays:[{protocol:"irn"}],pairingTopic:I,proposer:{publicKey:W,metadata:this.client.metadata},expiryTimestamp:Or(Nr.wc_sessionPropose.req.ttl)},{done:j,resolve:m,reject:$}=Hs(B,"Request expired"),et=async({error:d,session:p})=>{if(this.events.off(we("session_request",nt),tt),d)$(d);else if(p){p.self.publicKey=W,await this.client.session.set(p.topic,p),await this.setExpiry(p.topic,p.expiry),I&&await this.client.core.pairing.updateMetadata({topic:I,metadata:p.peer.metadata});const b=this.client.session.get(p.topic);await this.deleteProposal(dt),m({session:b})}},tt=async d=>{if(await this.deletePendingAuthRequest(nt,{message:"fulfilled",code:0}),d.error){const D=Ue("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return d.error.code===D.code?void 0:(this.events.off(we("session_connect"),et),$(d.error.message))}await this.deleteProposal(dt),this.events.off(we("session_connect"),et);const{cacaos:p,responder:b}=d.result,C=[],O=[];for(const D of p){await Lm({cacao:D,projectId:this.client.core.projectId})||(this.client.logger.error(D,"Signature verification failed"),$(Ue("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:v}=D,T=zl(v.resources),ot=[Rm(v.iss)],pt=ql(v.iss);if(T){const A=Fm(T),rt=jm(T);C.push(...A),ot.push(...rt)}for(const A of ot)O.push(`${A}:${pt}`)}const N=await this.client.core.crypto.generateSharedKey(W,b.publicKey);let L;C.length>0&&(L={topic:N,acknowledged:!0,self:{publicKey:W,metadata:this.client.metadata},peer:b,controller:b.publicKey,expiry:Or(na),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:I,namespaces:Qm([...new Set(C)],[...new Set(O)])},await this.client.core.relayer.subscribe(N),await this.client.session.set(N,L),I&&await this.client.core.pairing.updateMetadata({topic:I,metadata:b.metadata}),L=this.client.session.get(N)),m({auths:p,session:L})},nt=fs(),dt=fs();this.events.once(we("session_connect"),et),this.events.once(we("session_request",nt),tt);try{await Promise.all([this.sendRequest({topic:I,method:"wc_sessionAuthenticate",params:z,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:nt}),this.sendRequest({topic:I,method:"wc_sessionPropose",params:U,expiry:Nr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:dt})])}catch(d){throw this.events.off(we("session_connect"),et),this.events.off(we("session_request",nt),tt),d}return await this.setProposal(dt,vr({id:dt},U)),await this.setAuthRequest(nt,{request:Js(vr({},z),{verifyContext:{}}),pairingTopic:I}),{uri:F,response:j}},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=Hl(c),h={type:zi,receiverPublicKey:c,senderPublicKey:l},g=[],_=[];for(const I of i){if(!await Lm({cacao:I,projectId:this.client.core.projectId})){const z=Ue("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:z,encodeOpts:h}),new Error(z.message)}const{p:F}=I,W=zl(F.resources),Y=[Rm(F.iss)],B=ql(F.iss);if(W){const z=Fm(W),P=jm(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 x;return g?.length>0&&(x={topic:E,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Or(na),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Qm([...new Set(g)],[...new Set(_)])},await this.client.core.relayer.subscribe(E),await this.client.session.set(E,x),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})),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:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),{session:x}},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=Hl(c),h={type:zi,receiverPublicKey:c,senderPublicKey:l};await this.sendError({id:n,topic:f,error:i,encodeOpts:h,rpcOpts:Nr.wc_sessionAuthenticate.reject}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Ue("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return Bm(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},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=>{var n;const{topic:i,expirerHasDeleted:o=!1,emitEvent:c=!0,id:l=0}=r,{self:f}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Ue("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(f.publicKey)&&await this.client.core.crypto.deleteKeyPair(f.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),o||this.client.core.expirer.del(i),this.client.core.storage.removeItem(iw).catch(h=>this.client.logger.warn(h)),this.getPendingSessionRequests().forEach(h=>{h.topic===i&&this.deletePendingSessionRequest(h.id,Ue("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=xi.idle),c&&this.client.events.emit("session_delete",{id:l,topic:i})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ue("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=xi.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,Or(Nr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:o}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:o,verifyContext:i.verifyContext})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:o,verifyContext:c}=r,l=o.request.expiryTimestamp||Or(Nr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,l),await this.client.pendingRequest.set(n,{id:n,topic:i,params:o,verifyContext:c})},this.sendRequest=async r=>{const{topic:n,method:i,params:o,expiry:c,relayRpcId:l,clientRpcId:f,throwOnFailedPublish:h}=r,g=ea(i,o,f);if(ko()&&GS.includes(i)){const x=Gs(JSON.stringify(g));this.client.core.verify.register({attestationId:x})}let _;try{_=await this.client.core.crypto.encode(n,g)}catch(x){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),x}const E=Nr[i].req;return c&&(E.ttl=c),l&&(E.id=l),this.client.core.history.set(n,g),h?(E.internal=Js(vr({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,_,E)):this.client.core.relayer.publish(n,_,E).catch(x=>this.client.logger.error(x)),g.id},this.sendResult=async r=>{const{id:n,topic:i,result:o,throwOnFailedPublish:c,encodeOpts:l}=r,f=Vl(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 _=Nr[g.request.method].res;c?(_.internal=Js(vr({},_.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,rpcOpts:l}=r,f=Gl(n,o);let h;try{h=await this.client.core.crypto.encode(i,f,c)}catch(E){throw await this.cleanup(),this.client.logger.error(`sendError() -> 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(`sendError() -> history.get(${i}, ${n}) failed`),E}const _=l||Nr[g.request.method].res;this.client.core.relayer.publish(i,h,_),await this.client.core.history.resolve(f)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let o=!1;cs(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=>{cs(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===xi.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=xi.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=xi.idle},this.processRequest=async r=>{const{topic:n,payload:i}=r,o=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:o}))switch(o){case"wc_sessionPropose":return await this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest(n,i);case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await 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}=mt("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(vr({},n.params));const c=i.expiryTimestamp||Or(Nr.wc_sessionPropose.req.ttl),l=vr({id:o,pairingTopic:r,expiryTimestamp:c},i);await this.setProposal(o,l);const f=Gs(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,rpcOpts:Nr.wc_sessionPropose.autoReject}),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(Pn(n)){await this.client.proposal.delete(i,Ue("USER_DISCONNECTED"));const o=we("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(we("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,sessionConfig:_}=n.params,E=vr(vr({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}),_&&{sessionConfig:_});await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0});const x=we("session_connect");if(this.events.listenerCount(x)===0)throw new Error(`emitting ${x} without any listeners 997`);this.events.emit(we("session_connect"),{session:E})}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(we("session_approve",i),{})):Pn(n)&&(await this.client.session.delete(r,Ue("USER_DISCONNECTED")),this.events.emit(we("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:o}=n;try{const c=`${r}_session_update`,l=pc.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:Ue("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(vr({topic:r},i));try{pc.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 pc.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=we("session_update",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);_i(n)?this.events.emit(we("session_update",i),{}):Pn(n)&&this.events.emit(we("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Or(na)),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=we("session_extend",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);_i(n)?this.events.emit(we("session_extend",i),{}):Pn(n)&&this.events.emit(we("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=we("session_ping",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);setTimeout(()=>{_i(n)?this.events.emit(we("session_ping",i),{}):Pn(n)&&this.events.emit(we("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(on.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:Ue("USER_DISCONNECTED")})])}catch(o){this.client.logger.error(o)}},this.onSessionRequest=async(r,n)=>{var i;const{id:o,params:c}=n;try{await this.isValidRequest(vr({topic:r},c));const l=Gs(JSON.stringify(ea("wc_sessionRequest",c,o))),f=this.client.session.get(r),h=await this.getVerifyContext(l,f.peer.metadata),g={id:o,topic:r,params:c,verifyContext:h};await this.setPendingSessionRequest(g),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(g):(this.addSessionRequestToSessionRequestQueue(g),this.processSessionRequestQueue())}catch(l){await this.sendError({id:o,topic:r,error:l}),this.client.logger.error(l)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,o=we("session_request",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);_i(n)?this.events.emit(we("session_request",i),{result:n.result}):Pn(n)&&this.events.emit(we("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=pc.get(c);if(l&&this.isRequestOutOfSync(l,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(vr({topic:r},o)),this.client.events.emit("session_event",{id:i,topic:r,params:o}),pc.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(we("session_request",i),{result:n.result}):Pn(n)&&this.events.emit(we("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async(r,n)=>{try{const{requester:i,authPayload:o,expiryTimestamp:c}=n.params,l=Gs(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.setAuthRequest(n.id,{request:h,pairingTopic:r}),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id,verifyContext:f})}catch(i){this.client.logger.error(i);const o=n.params.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l={type:zi,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n.id,topic:r,error:i,encodeOpts:l,rpcOpts:Nr.wc_sessionAuthenticate.autoReject})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=xi.idle,this.processSessionRequestQueue()},yt.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=we("session_request",c);if(this.events.listenerCount(l)===0)throw new Error(`emitting ${l} without any listeners`);this.events.emit(we("session_request",o.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===xi.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=xi.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},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,ea("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!sn(r)){const{message:f}=mt("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),!nx(l,!0)){const{message:f}=mt("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(f)}!Hr(i)&&dc(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Hr(o)&&dc(o)!==0&&this.validateNamespaces(o,"optionalNamespaces"),Hr(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=rx(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!sn(r))throw new Error(mt("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=Gf(i,"approve()");if(f)throw new Error(f.message);const h=rv(l.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!ur(o,!0)){const{message:g}=mt("MISSING_OR_INVALID",`approve() relayProtocol: ${o}`);throw new Error(g)}Hr(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async r=>{if(!sn(r)){const{message:o}=mt("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(o)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!sx(i)){const{message:o}=mt("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(o)}},this.isValidSessionSettleRequest=r=>{if(!sn(r)){const{message:h}=mt("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(h)}const{relay:n,controller:i,namespaces:o,expiry:c}=r;if(!Xm(n)){const{message:h}=mt("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const l=Q7(i,"onSessionSettleRequest()");if(l)throw new Error(l.message);const f=Gf(o,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(cs(c)){const{message:h}=mt("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async r=>{if(!sn(r)){const{message:f}=mt("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=Gf(i,"update()");if(c)throw new Error(c.message);const l=rv(o.requiredNamespaces,i,"update()");if(l)throw new Error(l.message)},this.isValidExtend=async r=>{if(!sn(r)){const{message:i}=mt("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(!sn(r)){const{message:f}=mt("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(!Yf(l,o)){const{message:f}=mt("MISSING_OR_INVALID",`request() chainId: ${o}`);throw new Error(f)}if(!ox(i)){const{message:f}=mt("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!cx(l,o,i.method)){const{message:f}=mt("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!hx(c,d0)){const{message:f}=mt("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${d0.min} and ${d0.max}`);throw new Error(f)}},this.isValidRespond=async r=>{var n;if(!sn(r)){const{message:c}=mt("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(!ax(o)){const{message:c}=mt("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(c)}},this.isValidPing=async r=>{if(!sn(r)){const{message:i}=mt("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!sn(r)){const{message:l}=mt("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(console.log({isValidNamespacesChainId:Yf(c,o),namespaces:c,event:i}),!Yf(c,o)){const{message:l}=mt("MISSING_OR_INVALID",`emit() chainId: ${o}`);throw new Error(l)}if(console.log({isValidEvent:tv(i),event:i}),!tv(i)){const{message:l}=mt("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}if(console.log({isValidNamespacesEvent:ev(c,o,i.name),namespaces:c,chainId:o,event:i}),!ev(c,o,i.name)){const{message:l}=mt("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}},this.isValidDisconnect=async r=>{if(!sn(r)){const{message:i}=mt("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=>Za(f).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:l}=Za(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||yc,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}=mt("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}=mt("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){const{message:t}=mt("NOT_INITIALIZED",this.name);throw new Error(t)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(on.message,t=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(t):this.onRelayMessage(t)})}async onRelayMessage(t){const{topic:r,message:n}=t,{publicKey:i}=this.client.auth.authKeys.keys.includes(Zl)?this.client.auth.authKeys.get(Zl):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(r,n,{receiverPublicKey:i});try{r0(o)?(this.client.core.history.set(r,o),this.onRelayEventRequest({topic:r,payload:o})):Yl(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 t=>{const{topic:r,id:n}=Dg(t.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,mt("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,mt("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,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(ra.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!ur(t,!1)){const{message:r}=mt("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:r}=mt("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(r)}if(cs(this.client.core.pairing.pairings.get(t).expiry)){const{message:r}=mt("EXPIRED",`pairing topic: ${t}`);throw new Error(r)}}async isValidSessionTopic(t){if(!ur(t,!1)){const{message:r}=mt("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(r)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:r}=mt("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(r)}if(cs(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:r}=mt("EXPIRED",`session topic: ${t}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(t)){const{message:r}=mt("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(r)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(ur(t,!1)){const{message:r}=mt("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(r)}else{const{message:r}=mt("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(r)}}async isValidProposalId(t){if(!ix(t)){const{message:r}=mt("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(r)}if(!this.client.proposal.keys.includes(t)){const{message:r}=mt("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(r)}if(cs(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:r}=mt("EXPIRED",`proposal id: ${t}`);throw new Error(r)}}}class oC extends Qs{constructor(t,r){super(t,r,HS,h0),this.core=t,this.logger=r}}class aC extends Qs{constructor(t,r){super(t,r,KS,h0),this.core=t,this.logger=r}}class cC extends Qs{constructor(t,r){super(t,r,VS,h0,n=>n.id),this.core=t,this.logger=r}}class lC extends Qs{constructor(t,r){super(t,r,JS,Jl,()=>Zl),this.core=t,this.logger=r}}class uC extends Qs{constructor(t,r){super(t,r,ZS,Jl),this.core=t,this.logger=r}}class hC extends Qs{constructor(t,r){super(t,r,XS,Jl,n=>n.id),this.core=t,this.logger=r}}class fC{constructor(t,r){this.core=t,this.logger=r,this.authKeys=new lC(this.core,this.logger),this.pairingTopics=new uC(this.core,this.logger),this.requests=new hC(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class p0 extends e5{constructor(t){super(t),this.protocol=ew,this.version=rw,this.name=f0.name,this.events=new Cr.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=t?.name||f0.name,this.metadata=t?.metadata||f4(),this.signConfig=t?.signConfig;const r=typeof t?.logger<"u"&&typeof t?.logger!="string"?t.logger:ai(wl({level:t?.logger||f0.logger}));this.core=t?.core||new zS(t),this.logger=en(r,this.name),this.session=new aC(this.core,this.logger),this.proposal=new oC(this.core,this.logger),this.pendingRequest=new cC(this.core,this.logger),this.engine=new sC(this),this.auth=new fC(this.core,this.logger)}static async init(t){const r=new p0(t);return await r.initialize(),r}get context(){return tn(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"),this.engine.processRelayMessageCache()}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}var g0={exports:{}};(function(e,t){var r=typeof self<"u"?self:jr,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 x(p){var b={next:function(){var C=p.shift();return{done:C===void 0,value:C}}};return l.iterable&&(b[Symbol.iterator]=function(){return b}),b}function I(p){this.map={},p instanceof I?p.forEach(function(b,C){this.append(C,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)}I.prototype.append=function(p,b){p=_(p),b=E(b);var C=this.map[p];this.map[p]=C?C+", "+b:b},I.prototype.delete=function(p){delete this.map[_(p)]},I.prototype.get=function(p){return p=_(p),this.has(p)?this.map[p]:null},I.prototype.has=function(p){return this.map.hasOwnProperty(_(p))},I.prototype.set=function(p,b){this.map[_(p)]=E(b)},I.prototype.forEach=function(p,b){for(var C in this.map)this.map.hasOwnProperty(C)&&p.call(b,this.map[C],C,this)},I.prototype.keys=function(){var p=[];return this.forEach(function(b,C){p.push(C)}),x(p)},I.prototype.values=function(){var p=[];return this.forEach(function(b){p.push(b)}),x(p)},I.prototype.entries=function(){var p=[];return this.forEach(function(b,C){p.push([C,b])}),x(p)},l.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function F(p){if(p.bodyUsed)return Promise.reject(new TypeError("Already read"));p.bodyUsed=!0}function W(p){return new Promise(function(b,C){p.onload=function(){b(p.result)},p.onerror=function(){C(p.error)}})}function Y(p){var b=new FileReader,C=W(b);return b.readAsArrayBuffer(p),C}function B(p){var b=new FileReader,C=W(b);return b.readAsText(p),C}function z(p){for(var b=new Uint8Array(p),C=new Array(b.length),O=0;O<b.length;O++)C[O]=String.fromCharCode(b[O]);return C.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 U(){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=F(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?F(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var p=F(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(et)}),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 $(p,b){b=b||{};var C=b.body;if(p instanceof $){if(p.bodyUsed)throw new TypeError("Already read");this.url=p.url,this.credentials=p.credentials,b.headers||(this.headers=new I(p.headers)),this.method=p.method,this.mode=p.mode,this.signal=p.signal,!C&&p._bodyInit!=null&&(C=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 I(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")&&C)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(C)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function et(p){var b=new FormData;return p.trim().split("&").forEach(function(C){if(C){var O=C.split("="),N=O.shift().replace(/\+/g," "),L=O.join("=").replace(/\+/g," ");b.append(decodeURIComponent(N),decodeURIComponent(L))}}),b}function tt(p){var b=new I,C=p.replace(/\r?\n[\t ]+/g," ");return C.split(/\r?\n/).forEach(function(O){var N=O.split(":"),L=N.shift().trim();if(L){var D=N.join(":").trim();b.append(L,D)}}),b}U.call($.prototype);function nt(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 I(b.headers),this.url=b.url||"",this._initBody(p)}U.call(nt.prototype),nt.prototype.clone=function(){return new nt(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},nt.error=function(){var p=new nt(null,{status:0,statusText:""});return p.type="error",p};var dt=[301,302,303,307,308];nt.redirect=function(p,b){if(dt.indexOf(b)===-1)throw new RangeError("Invalid status code");return new nt(null,{status:b,headers:{location:p}})},c.DOMException=o.DOMException;try{new c.DOMException}catch{c.DOMException=function(b,C){this.message=b,this.name=C;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(C,O){var N=new $(p,b);if(N.signal&&N.signal.aborted)return O(new c.DOMException("Aborted","AbortError"));var L=new XMLHttpRequest;function D(){L.abort()}L.onload=function(){var v={status:L.status,statusText:L.statusText,headers:tt(L.getAllResponseHeaders()||"")};v.url="responseURL"in L?L.responseURL:v.headers.get("X-Request-URL");var T="response"in L?L.response:L.responseText;C(new nt(T,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(N.method,N.url,!0),N.credentials==="include"?L.withCredentials=!0:N.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&l.blob&&(L.responseType="blob"),N.headers.forEach(function(v,T){L.setRequestHeader(T,v)}),N.signal&&(N.signal.addEventListener("abort",D),L.onreadystatechange=function(){L.readyState===4&&N.signal.removeEventListener("abort",D)}),L.send(typeof N._bodyInit>"u"?null:N._bodyInit)})}return d.polyfill=!0,o.fetch||(o.fetch=d,o.Headers=I,o.Request=$,o.Response=nt),c.Headers=I,c.Request=$,c.Response=nt,c.fetch=d,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t})(g0,g0.exports);var cw=n3(g0.exports),dC=Object.defineProperty,pC=Object.defineProperties,gC=Object.getOwnPropertyDescriptors,lw=Object.getOwnPropertySymbols,mC=Object.prototype.hasOwnProperty,vC=Object.prototype.propertyIsEnumerable,uw=(e,t,r)=>t in e?dC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hw=(e,t)=>{for(var r in t||(t={}))mC.call(t,r)&&uw(e,r,t[r]);if(lw)for(var r of lw(t))vC.call(t,r)&&uw(e,r,t[r]);return e},fw=(e,t)=>pC(e,gC(t));const wC={Accept:"application/json","Content-Type":"application/json"},yC="POST",dw={headers:wC,method:yC},pw=10;class Wi{constructor(t,r=!1){if(this.url=t,this.disableProviderPing=r,this.events=new Cr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!mv(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);this.url=t,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t){this.isAvailable||await this.register();try{const r=Ui(t),n=await(await cw(this.url,fw(hw({},dw),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(t.id,r)}}async register(t=this.url){if(!mv(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);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=t,this.registering=!0;try{if(!this.disableProviderPing){const r=Ui({id:1,jsonrpc:"2.0",method:"test",params:[]});await cw(t,fw(hw({},dw),{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(t){if(typeof t.data>"u")return;const r=typeof t.data=="string"?ka(t.data):t.data;this.events.emit("payload",r)}onError(t,r){const n=this.parseError(r),i=n.message||n.toString(),o=Gl(t,i);this.events.emit("payload",o)}parseError(t,r=this.url){return uv(t,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>pw&&this.events.setMaxListeners(pw)}}const gw="error",bC="wss://relay.walletconnect.com",_C="wc",EC="universal_provider",mw=`${_C}@2:${EC}:`,AC="https://rpc.walletconnect.com/v1/",ia="generic",Ii={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var _c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},m0={exports:{}};/**
|
|
44
44
|
* @license
|
|
45
45
|
* Lodash <https://lodash.com/>
|
|
46
46
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
47
47
|
* Released under MIT license <https://lodash.com/license>
|
|
48
48
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
49
49
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
50
|
-
*/(function(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,x=4,I=1,k=2,W=1,Y=2,B=4,z=8,M=16,U=32,F=64,m=128,$=256,te=512,ee=30,ne="...",de=800,d=16,p=1,b=2,D=3,O=1/0,T=9007199254740991,L=17976931348623157e292,C=0/0,v=4294967295,N=v-1,oe=v>>>1,pe=[["ary",m],["bind",W],["bindKey",Y],["curry",z],["curryRight",M],["flip",te],["partial",U],["partialRight",F],["rearg",$]],A="[object Arguments]",re="[object Array]",q="[object AsyncFunction]",H="[object Boolean]",V="[object Date]",w="[object DOMException]",j="[object Error]",ie="[object Function]",he="[object GeneratorFunction]",le="[object Map]",Oe="[object Number]",Pe="[object Null]",Ie="[object Object]",Mt="[object Promise]",ze="[object Proxy]",Ce="[object RegExp]",Fe="[object Set]",Ee="[object String]",Ae="[object Symbol]",Ge="[object Undefined]",be="[object WeakMap]",xe="[object WeakSet]",Be="[object ArrayBuffer]",_e="[object DataView]",Me="[object Float32Array]",je="[object Float64Array]",$e="[object Int8Array]",Te="[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,Qe=/<%([\s\S]+?)%>/g,Ve=/<%=([\s\S]+?)%>/g,Pt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xe=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lt=/[\\^$.*+?()[\]{}|]/g,tt=RegExp(Lt.source),Je=/^\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*$/,Nn=/^[-+]0x[0-9a-f]+$/i,Rn=/^0b[01]+$/i,Ln=/^\[object .+?Constructor\]$/,Bn=/^0o[0-7]+$/i,Un=/^(?:0|[1-9]\d*)$/,xr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ci=/($^)/,fo=/['\n\r\u2028\u2029\\]/g,Oi="\\ud800-\\udfff",po="\\u0300-\\u036f",go="\\ufe20-\\ufe2f",Mi="\\u20d0-\\u20ff",Is=po+go+Mi,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",Pu="A-Z\\xc0-\\xd6\\xd8-\\xde",$u="\\ufe0e\\ufe0f",bo=mo+vo+wo+yo,Fc="['\u2019]",_o="["+Oi+"]",jc="["+bo+"]",Eo="["+Is+"]",Tu="\\d+",Pd="["+Ds+"]",Nu="["+Gr+"]",Ru="[^"+Oi+bo+Tu+Ds+Gr+Pu+"]",Aa="\\ud83c[\\udffb-\\udfff]",$d="(?:"+Eo+"|"+Aa+")",Lu="[^"+Oi+"]",xa="(?:\\ud83c[\\udde6-\\uddff]){2}",Cs="[\\ud800-\\udbff][\\udc00-\\udfff]",bn="["+Pu+"]",Bu="\\u200d",Uu="(?:"+Nu+"|"+Ru+")",Pi="(?:"+bn+"|"+Ru+")",Fu="(?:"+Fc+"(?:d|ll|m|re|s|t|ve))?",ju="(?:"+Fc+"(?:D|LL|M|RE|S|T|VE))?",ku=$d+"?",qu="["+$u+"]?",Td="(?:"+Bu+"(?:"+[Lu,xa,Cs].join("|")+")"+qu+ku+")*",Yi="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",zu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Hu=qu+ku+Td,Sa="(?:"+[Pd,xa,Cs].join("|")+")"+Hu,Nd="(?:"+[Lu+Eo+"?",Eo,xa,Cs,_o].join("|")+")",kc=RegExp(Fc,"g"),Rd=RegExp(Eo,"g"),Ia=RegExp(Aa+"(?="+Aa+")|"+Nd+Hu,"g"),Ku=RegExp([bn+"?"+Nu+"+"+Fu+"(?="+[jc,bn,"$"].join("|")+")",Pi+"+"+ju+"(?="+[jc,bn+Uu,"$"].join("|")+")",bn+"?"+Uu+"+"+Fu,bn+"+"+ju,zu,Yi,Tu,Sa].join("|"),"g"),Wu=RegExp("["+Bu+Oi+Is+$u+"]"),Ao=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Vu=["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"],Ld=-1,Wt={};Wt[Me]=Wt[je]=Wt[$e]=Wt[Te]=Wt[lt]=Wt[Re]=Wt[Ne]=Wt[nr]=Wt[dt]=!0,Wt[A]=Wt[re]=Wt[Be]=Wt[H]=Wt[_e]=Wt[V]=Wt[j]=Wt[ie]=Wt[le]=Wt[Oe]=Wt[Ie]=Wt[Ce]=Wt[Fe]=Wt[Ee]=Wt[be]=!1;var Kt={};Kt[A]=Kt[re]=Kt[Be]=Kt[_e]=Kt[H]=Kt[V]=Kt[Me]=Kt[je]=Kt[$e]=Kt[Te]=Kt[lt]=Kt[le]=Kt[Oe]=Kt[Ie]=Kt[Ce]=Kt[Fe]=Kt[Ee]=Kt[Ae]=Kt[Re]=Kt[Ne]=Kt[nr]=Kt[dt]=!0,Kt[j]=Kt[ie]=Kt[be]=!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"},J={"&":"&","<":"<",">":">",'"':""","'":"'"},fe={"&":"&","<":"<",">":">",""":'"',"'":"'"},Se={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Vt=parseFloat,ot=parseInt,Zt=typeof yc=="object"&&yc&&yc.Object===Object&&yc,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,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,Fn=Xt&&Xt.isMap,$i=Xt&&Xt.isRegExp,qc=Xt&&Xt.isSet,xo=Xt&&Xt.isTypedArray;function Sr(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 B$(Z,ae,se,De){for(var it=-1,Tt=Z==null?0:Z.length;++it<Tt;){var yr=Z[it];ae(De,yr,se(yr),Z)}return De}function jn(Z,ae){for(var se=-1,De=Z==null?0:Z.length;++se<De&&ae(Z[se],se,Z)!==!1;);return Z}function U$(Z,ae){for(var se=Z==null?0:Z.length;se--&&ae(Z[se],se,Z)!==!1;);return Z}function ry(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,Tt=[];++se<De;){var yr=Z[se];ae(yr,se,Z)&&(Tt[it++]=yr)}return Tt}function Gu(Z,ae){var se=Z==null?0:Z.length;return!!se&&Da(Z,ae,0)>-1}function Bd(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 Ms(Z,ae){for(var se=-1,De=ae.length,it=Z.length;++se<De;)Z[it+se]=ae[se];return Z}function Ud(Z,ae,se,De){var it=-1,Tt=Z==null?0:Z.length;for(De&&Tt&&(se=Z[++it]);++it<Tt;)se=ae(se,Z[it],it,Z);return se}function F$(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 Fd(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 j$=jd("length");function k$(Z){return Z.split("")}function q$(Z){return Z.match(rt)||[]}function ny(Z,ae,se){var De;return se(Z,function(it,Tt,yr){if(ae(it,Tt,yr))return De=Tt,!1}),De}function Yu(Z,ae,se,De){for(var it=Z.length,Tt=se+(De?1:-1);De?Tt--:++Tt<it;)if(ae(Z[Tt],Tt,Z))return Tt;return-1}function Da(Z,ae,se){return ae===ae?eT(Z,ae,se):Yu(Z,iy,se)}function z$(Z,ae,se,De){for(var it=se-1,Tt=Z.length;++it<Tt;)if(De(Z[it],ae))return it;return-1}function iy(Z){return Z!==Z}function sy(Z,ae){var se=Z==null?0:Z.length;return se?qd(Z,ae)/se:C}function jd(Z){return function(ae){return ae==null?r:ae[Z]}}function kd(Z){return function(ae){return Z==null?r:Z[ae]}}function oy(Z,ae,se,De,it){return it(Z,function(Tt,yr,Yt){se=De?(De=!1,Tt):ae(se,Tt,yr,Yt)}),se}function H$(Z,ae){var se=Z.length;for(Z.sort(ae);se--;)Z[se]=Z[se].value;return Z}function qd(Z,ae){for(var se,De=-1,it=Z.length;++De<it;){var Tt=ae(Z[De]);Tt!==r&&(se=se===r?Tt:se+Tt)}return se}function zd(Z,ae){for(var se=-1,De=Array(Z);++se<Z;)De[se]=ae(se);return De}function K$(Z,ae){return tr(ae,function(se){return[se,Z[se]]})}function ay(Z){return Z&&Z.slice(0,hy(Z)+1).replace(Je,"")}function _n(Z){return function(ae){return Z(ae)}}function Hd(Z,ae){return tr(ae,function(se){return Z[se]})}function zc(Z,ae){return Z.has(ae)}function cy(Z,ae){for(var se=-1,De=Z.length;++se<De&&Da(ae,Z[se],0)>-1;);return se}function ly(Z,ae){for(var se=Z.length;se--&&Da(ae,Z[se],0)>-1;);return se}function W$(Z,ae){for(var se=Z.length,De=0;se--;)Z[se]===ae&&++De;return De}var V$=kd(K),G$=kd(J);function Y$(Z){return"\\"+Se[Z]}function Q$(Z,ae){return Z==null?r:Z[ae]}function Ca(Z){return Wu.test(Z)}function J$(Z){return Ao.test(Z)}function Z$(Z){for(var ae,se=[];!(ae=Z.next()).done;)se.push(ae.value);return se}function Kd(Z){var ae=-1,se=Array(Z.size);return Z.forEach(function(De,it){se[++ae]=[it,De]}),se}function uy(Z,ae){return function(se){return Z(ae(se))}}function Ps(Z,ae){for(var se=-1,De=Z.length,it=0,Tt=[];++se<De;){var yr=Z[se];(yr===ae||yr===g)&&(Z[se]=g,Tt[it++]=se)}return Tt}function Qu(Z){var ae=-1,se=Array(Z.size);return Z.forEach(function(De){se[++ae]=De}),se}function X$(Z){var ae=-1,se=Array(Z.size);return Z.forEach(function(De){se[++ae]=[De,De]}),se}function eT(Z,ae,se){for(var De=se-1,it=Z.length;++De<it;)if(Z[De]===ae)return De;return-1}function tT(Z,ae,se){for(var De=se+1;De--;)if(Z[De]===ae)return De;return De}function Oa(Z){return Ca(Z)?nT(Z):j$(Z)}function ni(Z){return Ca(Z)?iT(Z):k$(Z)}function hy(Z){for(var ae=Z.length;ae--&&Ft.test(Z.charAt(ae)););return ae}var rT=kd(fe);function nT(Z){for(var ae=Ia.lastIndex=0;Ia.test(Z);)++ae;return ae}function iT(Z){return Z.match(Ia)||[]}function sT(Z){return Z.match(Ku)||[]}var oT=function Z(ae){ae=ae==null?It:Ma.defaults(It.Object(),ae,Ma.pick(It,Vu));var se=ae.Array,De=ae.Date,it=ae.Error,Tt=ae.Function,yr=ae.Math,Yt=ae.Object,Wd=ae.RegExp,aT=ae.String,kn=ae.TypeError,Ju=se.prototype,cT=Tt.prototype,Pa=Yt.prototype,Zu=ae["__core-js_shared__"],Xu=cT.toString,qt=Pa.hasOwnProperty,lT=0,fy=function(){var s=/[^.]+$/.exec(Zu&&Zu.keys&&Zu.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),eh=Pa.toString,uT=Xu.call(Yt),hT=It._,fT=Wd("^"+Xu.call(qt).replace(Lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),th=ln?ae.Buffer:r,$s=ae.Symbol,rh=ae.Uint8Array,dy=th?th.allocUnsafe:r,nh=uy(Yt.getPrototypeOf,Yt),py=Yt.create,gy=Pa.propertyIsEnumerable,ih=Ju.splice,my=$s?$s.isConcatSpreadable:r,Hc=$s?$s.iterator:r,So=$s?$s.toStringTag:r,sh=function(){try{var s=Mo(Yt,"defineProperty");return s({},"",{}),s}catch{}}(),dT=ae.clearTimeout!==It.clearTimeout&&ae.clearTimeout,pT=De&&De.now!==It.Date.now&&De.now,gT=ae.setTimeout!==It.setTimeout&&ae.setTimeout,oh=yr.ceil,ah=yr.floor,Vd=Yt.getOwnPropertySymbols,mT=th?th.isBuffer:r,vy=ae.isFinite,vT=Ju.join,wT=uy(Yt.keys,Yt),br=yr.max,Ur=yr.min,yT=De.now,bT=ae.parseInt,wy=yr.random,_T=Ju.reverse,Gd=Mo(ae,"DataView"),Kc=Mo(ae,"Map"),Yd=Mo(ae,"Promise"),$a=Mo(ae,"Set"),Wc=Mo(ae,"WeakMap"),Vc=Mo(Yt,"create"),ch=Wc&&new Wc,Ta={},ET=Po(Gd),AT=Po(Kc),xT=Po(Yd),ST=Po($a),IT=Po(Wc),lh=$s?$s.prototype:r,Gc=lh?lh.valueOf:r,yy=lh?lh.toString:r;function P(s){if(cr(s)&&!at(s)&&!(s instanceof At)){if(s instanceof qn)return s;if(qt.call(s,"__wrapped__"))return bb(s)}return new qn(s)}var Na=function(){function s(){}return function(a){if(!sr(a))return{};if(py)return py(a);s.prototype=a;var u=new s;return s.prototype=r,u}}();function uh(){}function qn(s,a){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=r}P.templateSettings={escape:Rt,evaluate:Qe,interpolate:Ve,variable:"",imports:{_:P}},P.prototype=uh.prototype,P.prototype.constructor=P,qn.prototype=Na(uh.prototype),qn.prototype.constructor=qn;function At(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function DT(){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 CT(){if(this.__filtered__){var s=new At(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function OT(){var s=this.__wrapped__.value(),a=this.__dir__,u=at(s),y=a<0,S=u?s.length:0,R=kN(0,S,this.__views__),G=R.start,Q=R.end,X=Q-G,ce=y?Q:G-1,ue=this.__iteratees__,ge=ue.length,we=0,Le=Ur(X,this.__takeCount__);if(!u||!y&&S==X&&Le==X)return zy(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,xn=yt.type,Zr=Dt(We);if(xn==b)We=Zr;else if(!Zr){if(xn==p)continue e;break e}}Ke[we++]=We}return Ke}At.prototype=Na(uh.prototype),At.prototype.constructor=At;function Io(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 MT(){this.__data__=Vc?Vc(null):{},this.size=0}function PT(s){var a=this.has(s)&&delete this.__data__[s];return this.size-=a?1:0,a}function $T(s){var a=this.__data__;if(Vc){var u=a[s];return u===f?r:u}return qt.call(a,s)?a[s]:r}function TT(s){var a=this.__data__;return Vc?a[s]!==r:qt.call(a,s)}function NT(s,a){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=Vc&&a===r?f:a,this}Io.prototype.clear=MT,Io.prototype.delete=PT,Io.prototype.get=$T,Io.prototype.has=TT,Io.prototype.set=NT;function Qi(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 RT(){this.__data__=[],this.size=0}function LT(s){var a=this.__data__,u=hh(a,s);if(u<0)return!1;var y=a.length-1;return u==y?a.pop():ih.call(a,u,1),--this.size,!0}function BT(s){var a=this.__data__,u=hh(a,s);return u<0?r:a[u][1]}function UT(s){return hh(this.__data__,s)>-1}function FT(s,a){var u=this.__data__,y=hh(u,s);return y<0?(++this.size,u.push([s,a])):u[y][1]=a,this}Qi.prototype.clear=RT,Qi.prototype.delete=LT,Qi.prototype.get=BT,Qi.prototype.has=UT,Qi.prototype.set=FT;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 jT(){this.size=0,this.__data__={hash:new Io,map:new(Kc||Qi),string:new Io}}function kT(s){var a=Ah(this,s).delete(s);return this.size-=a?1:0,a}function qT(s){return Ah(this,s).get(s)}function zT(s){return Ah(this,s).has(s)}function HT(s,a){var u=Ah(this,s),y=u.size;return u.set(s,a),this.size+=u.size==y?0:1,this}Ji.prototype.clear=jT,Ji.prototype.delete=kT,Ji.prototype.get=qT,Ji.prototype.has=zT,Ji.prototype.set=HT;function Do(s){var a=-1,u=s==null?0:s.length;for(this.__data__=new Ji;++a<u;)this.add(s[a])}function KT(s){return this.__data__.set(s,f),this}function WT(s){return this.__data__.has(s)}Do.prototype.add=Do.prototype.push=KT,Do.prototype.has=WT;function ii(s){var a=this.__data__=new Qi(s);this.size=a.size}function VT(){this.__data__=new Qi,this.size=0}function GT(s){var a=this.__data__,u=a.delete(s);return this.size=a.size,u}function YT(s){return this.__data__.get(s)}function QT(s){return this.__data__.has(s)}function JT(s,a){var u=this.__data__;if(u instanceof Qi){var y=u.__data__;if(!Kc||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=VT,ii.prototype.delete=GT,ii.prototype.get=YT,ii.prototype.has=QT,ii.prototype.set=JT;function by(s,a){var u=at(s),y=!u&&$o(s),S=!u&&!y&&Bs(s),R=!u&&!y&&!S&&Ua(s),G=u||y||S||R,Q=G?zd(s.length,aT):[],X=Q.length;for(var ce in s)(a||qt.call(s,ce))&&!(G&&(ce=="length"||S&&(ce=="offset"||ce=="parent")||R&&(ce=="buffer"||ce=="byteLength"||ce=="byteOffset")||ts(ce,X)))&&Q.push(ce);return Q}function _y(s){var a=s.length;return a?s[op(0,a-1)]:r}function ZT(s,a){return xh(un(s),Co(a,0,s.length))}function XT(s){return xh(un(s))}function Qd(s,a,u){(u!==r&&!si(s[a],u)||u===r&&!(a in s))&&Zi(s,a,u)}function Yc(s,a,u){var y=s[a];(!(qt.call(s,a)&&si(y,u))||u===r&&!(a in s))&&Zi(s,a,u)}function hh(s,a){for(var u=s.length;u--;)if(si(s[u][0],a))return u;return-1}function eN(s,a,u,y){return Ts(s,function(S,R,G){a(y,S,u(S),G)}),y}function Ey(s,a){return s&&Ni(a,Ir(a),s)}function tN(s,a){return s&&Ni(a,fn(a),s)}function Zi(s,a,u){a=="__proto__"&&sh?sh(s,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[a]=u}function Jd(s,a){for(var u=-1,y=a.length,S=se(y),R=s==null;++u<y;)S[u]=R?r:Pp(s,a[u]);return S}function Co(s,a,u){return s===s&&(u!==r&&(s=s<=u?s:u),a!==r&&(s=s>=a?s:a)),s}function zn(s,a,u,y,S,R){var G,Q=a&_,X=a&E,ce=a&x;if(u&&(G=S?u(s,y,S,R):u(s)),G!==r)return G;if(!sr(s))return s;var ue=at(s);if(ue){if(G=zN(s),!Q)return un(s,G)}else{var ge=Fr(s),we=ge==ie||ge==he;if(Bs(s))return Wy(s,Q);if(ge==Ie||ge==A||we&&!S){if(G=X||we?{}:hb(s),!Q)return X?$N(s,tN(G,s)):PN(s,Ey(G,s))}else{if(!Kt[ge])return S?s:{};G=HN(s,ge,Q)}}R||(R=new ii);var Le=R.get(s);if(Le)return Le;R.set(s,G),jb(s)?s.forEach(function(We){G.add(zn(We,a,u,We,s,R))}):Ub(s)&&s.forEach(function(We,yt){G.set(yt,zn(We,a,u,yt,s,R))});var Ke=ce?X?vp:mp:X?fn:Ir,pt=ue?r:Ke(s);return jn(pt||s,function(We,yt){pt&&(yt=We,We=s[yt]),Yc(G,yt,zn(We,a,u,yt,s,R))}),G}function rN(s){var a=Ir(s);return function(u){return Ay(u,s,a)}}function Ay(s,a,u){var y=u.length;if(s==null)return!y;for(s=Yt(s);y--;){var S=u[y],R=a[S],G=s[S];if(G===r&&!(S in s)||!R(G))return!1}return!0}function xy(s,a,u){if(typeof s!="function")throw new kn(c);return rl(function(){s.apply(r,u)},a)}function Qc(s,a,u,y){var S=-1,R=Gu,G=!0,Q=s.length,X=[],ce=a.length;if(!Q)return X;u&&(a=tr(a,_n(u))),y?(R=Bd,G=!1):a.length>=i&&(R=zc,G=!1,a=new Do(a));e:for(;++S<Q;){var ue=s[S],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 Ts=Jy(Ti),Sy=Jy(Xd,!0);function nN(s,a){var u=!0;return Ts(s,function(y,S,R){return u=!!a(y,S,R),u}),u}function fh(s,a,u){for(var y=-1,S=s.length;++y<S;){var R=s[y],G=a(R);if(G!=null&&(Q===r?G===G&&!An(G):u(G,Q)))var Q=G,X=R}return X}function iN(s,a,u,y){var S=s.length;for(u=ft(u),u<0&&(u=-u>S?0:S+u),y=y===r||y>S?S:ft(y),y<0&&(y+=S),y=u>y?0:qb(y);u<y;)s[u++]=a;return s}function Iy(s,a){var u=[];return Ts(s,function(y,S,R){a(y,S,R)&&u.push(y)}),u}function Nr(s,a,u,y,S){var R=-1,G=s.length;for(u||(u=WN),S||(S=[]);++R<G;){var Q=s[R];a>0&&u(Q)?a>1?Nr(Q,a-1,u,y,S):Ms(S,Q):y||(S[S.length]=Q)}return S}var Zd=Zy(),Dy=Zy(!0);function Ti(s,a){return s&&Zd(s,a,Ir)}function Xd(s,a){return s&&Dy(s,a,Ir)}function dh(s,a){return Os(a,function(u){return rs(s[u])})}function Oo(s,a){a=Rs(a,s);for(var u=0,y=a.length;s!=null&&u<y;)s=s[Ri(a[u++])];return u&&u==y?s:r}function Cy(s,a,u){var y=a(s);return at(s)?y:Ms(y,u(s))}function Qr(s){return s==null?s===r?Ge:Pe:So&&So in Yt(s)?jN(s):XN(s)}function ep(s,a){return s>a}function sN(s,a){return s!=null&&qt.call(s,a)}function oN(s,a){return s!=null&&a in Yt(s)}function aN(s,a,u){return s>=Ur(a,u)&&s<br(a,u)}function tp(s,a,u){for(var y=u?Bd:Gu,S=s[0].length,R=s.length,G=R,Q=se(R),X=1/0,ce=[];G--;){var ue=s[G];G&&a&&(ue=tr(ue,_n(a))),X=Ur(ue.length,X),Q[G]=!u&&(a||S>=120&&ue.length>=120)?new Do(G&&ue):r}ue=s[0];var ge=-1,we=Q[0];e:for(;++ge<S&&ce.length<X;){var Le=ue[ge],Ke=a?a(Le):Le;if(Le=u||Le!==0?Le:0,!(we?zc(we,Ke):y(ce,Ke,u))){for(G=R;--G;){var pt=Q[G];if(!(pt?zc(pt,Ke):y(s[G],Ke,u)))continue e}we&&we.push(Ke),ce.push(Le)}}return ce}function cN(s,a,u,y){return Ti(s,function(S,R,G){a(y,u(S),R,G)}),y}function Jc(s,a,u){a=Rs(a,s),s=gb(s,a);var y=s==null?s:s[Ri(Kn(a))];return y==null?r:Sr(y,s,u)}function Oy(s){return cr(s)&&Qr(s)==A}function lN(s){return cr(s)&&Qr(s)==Be}function uN(s){return cr(s)&&Qr(s)==V}function Zc(s,a,u,y,S){return s===a?!0:s==null||a==null||!cr(s)&&!cr(a)?s!==s&&a!==a:hN(s,a,u,y,Zc,S)}function hN(s,a,u,y,S,R){var G=at(s),Q=at(a),X=G?re:Fr(s),ce=Q?re:Fr(a);X=X==A?Ie:X,ce=ce==A?Ie:ce;var ue=X==Ie,ge=ce==Ie,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||Ua(s)?cb(s,a,u,y,S,R):UN(s,a,X,u,y,S,R);if(!(u&I)){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),S(pt,We,u,y,R)}}return we?(R||(R=new ii),FN(s,a,u,y,S,R)):!1}function fN(s){return cr(s)&&Fr(s)==le}function rp(s,a,u,y){var S=u.length,R=S,G=!y;if(s==null)return!R;for(s=Yt(s);S--;){var Q=u[S];if(G&&Q[2]?Q[1]!==s[Q[0]]:!(Q[0]in s))return!1}for(;++S<R;){Q=u[S];var X=Q[0],ce=s[X],ue=Q[1];if(G&&Q[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?Zc(ue,ce,I|k,y,ge):we))return!1}}return!0}function My(s){if(!sr(s)||GN(s))return!1;var a=rs(s)?fT:Ln;return a.test(Po(s))}function dN(s){return cr(s)&&Qr(s)==Ce}function pN(s){return cr(s)&&Fr(s)==Fe}function gN(s){return cr(s)&&Mh(s.length)&&!!Wt[Qr(s)]}function Py(s){return typeof s=="function"?s:s==null?dn:typeof s=="object"?at(s)?Ny(s[0],s[1]):Ty(s):Xb(s)}function np(s){if(!tl(s))return wT(s);var a=[];for(var u in Yt(s))qt.call(s,u)&&u!="constructor"&&a.push(u);return a}function mN(s){if(!sr(s))return ZN(s);var a=tl(s),u=[];for(var y in s)y=="constructor"&&(a||!qt.call(s,y))||u.push(y);return u}function ip(s,a){return s<a}function $y(s,a){var u=-1,y=hn(s)?se(s.length):[];return Ts(s,function(S,R,G){y[++u]=a(S,R,G)}),y}function Ty(s){var a=yp(s);return a.length==1&&a[0][2]?db(a[0][0],a[0][1]):function(u){return u===s||rp(u,s,a)}}function Ny(s,a){return _p(s)&&fb(a)?db(Ri(s),a):function(u){var y=Pp(u,s);return y===r&&y===a?$p(u,s):Zc(a,y,I|k)}}function ph(s,a,u,y,S){s!==a&&Zd(a,function(R,G){if(S||(S=new ii),sr(R))vN(s,a,G,u,ph,y,S);else{var Q=y?y(Ap(s,G),R,G+"",s,a,S):r;Q===r&&(Q=R),Qd(s,G,Q)}},fn)}function vN(s,a,u,y,S,R,G){var Q=Ap(s,u),X=Ap(a,u),ce=G.get(X);if(ce){Qd(s,u,ce);return}var ue=R?R(Q,X,u+"",s,a,G):r,ge=ue===r;if(ge){var we=at(X),Le=!we&&Bs(X),Ke=!we&&!Le&&Ua(X);ue=X,we||Le||Ke?at(Q)?ue=Q:dr(Q)?ue=un(Q):Le?(ge=!1,ue=Wy(X,!0)):Ke?(ge=!1,ue=Vy(X,!0)):ue=[]:nl(X)||$o(X)?(ue=Q,$o(Q)?ue=zb(Q):(!sr(Q)||rs(Q))&&(ue=hb(X))):ge=!1}ge&&(G.set(X,ue),S(ue,X,y,R,G),G.delete(X)),Qd(s,u,ue)}function Ry(s,a){var u=s.length;if(u)return a+=a<0?u:0,ts(a,u)?s[a]:r}function Ly(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,_n(qe()));var S=$y(s,function(R,G,Q){var X=tr(a,function(ce){return ce(R)});return{criteria:X,index:++y,value:R}});return H$(S,function(R,G){return MN(R,G,u)})}function wN(s,a){return By(s,a,function(u,y){return $p(s,y)})}function By(s,a,u){for(var y=-1,S=a.length,R={};++y<S;){var G=a[y],Q=Oo(s,G);u(Q,G)&&Xc(R,Rs(G,s),Q)}return R}function yN(s){return function(a){return Oo(a,s)}}function sp(s,a,u,y){var S=y?z$:Da,R=-1,G=a.length,Q=s;for(s===a&&(a=un(a)),u&&(Q=tr(s,_n(u)));++R<G;)for(var X=0,ce=a[R],ue=u?u(ce):ce;(X=S(Q,ue,X,y))>-1;)Q!==s&&ih.call(Q,X,1),ih.call(s,X,1);return s}function Uy(s,a){for(var u=s?a.length:0,y=u-1;u--;){var S=a[u];if(u==y||S!==R){var R=S;ts(S)?ih.call(s,S,1):lp(s,S)}}return s}function op(s,a){return s+ah(wy()*(a-s+1))}function bN(s,a,u,y){for(var S=-1,R=br(oh((a-s)/(u||1)),0),G=se(R);R--;)G[y?R:++S]=s,s+=u;return G}function ap(s,a){var u="";if(!s||a<1||a>T)return u;do a%2&&(u+=s),a=ah(a/2),a&&(s+=s);while(a);return u}function gt(s,a){return xp(pb(s,a,dn),s+"")}function _N(s){return _y(Fa(s))}function EN(s,a){var u=Fa(s);return xh(u,Co(a,0,u.length))}function Xc(s,a,u,y){if(!sr(s))return s;a=Rs(a,s);for(var S=-1,R=a.length,G=R-1,Q=s;Q!=null&&++S<R;){var X=Ri(a[S]),ce=u;if(X==="__proto__"||X==="constructor"||X==="prototype")return s;if(S!=G){var ue=Q[X];ce=y?y(ue,X,Q):r,ce===r&&(ce=sr(ue)?ue:ts(a[S+1])?[]:{})}Yc(Q,X,ce),Q=Q[X]}return s}var Fy=ch?function(s,a){return ch.set(s,a),s}:dn,AN=sh?function(s,a){return sh(s,"toString",{configurable:!0,enumerable:!1,value:Np(a),writable:!0})}:dn;function xN(s){return xh(Fa(s))}function Hn(s,a,u){var y=-1,S=s.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 R=se(S);++y<S;)R[y]=s[y+a];return R}function SN(s,a){var u;return Ts(s,function(y,S,R){return u=a(y,S,R),!u}),!!u}function gh(s,a,u){var y=0,S=s==null?y:s.length;if(typeof a=="number"&&a===a&&S<=oe){for(;y<S;){var R=y+S>>>1,G=s[R];G!==null&&!An(G)&&(u?G<=a:G<a)?y=R+1:S=R}return S}return cp(s,a,dn,u)}function cp(s,a,u,y){var S=0,R=s==null?0:s.length;if(R===0)return 0;a=u(a);for(var G=a!==a,Q=a===null,X=An(a),ce=a===r;S<R;){var ue=ah((S+R)/2),ge=u(s[ue]),we=ge!==r,Le=ge===null,Ke=ge===ge,pt=An(ge);if(G)var We=y||Ke;else ce?We=Ke&&(y||we):Q?We=Ke&&we&&(y||!Le):X?We=Ke&&we&&!Le&&(y||!pt):Le||pt?We=!1:We=y?ge<=a:ge<a;We?S=ue+1:R=ue}return Ur(R,N)}function jy(s,a){for(var u=-1,y=s.length,S=0,R=[];++u<y;){var G=s[u],Q=a?a(G):G;if(!u||!si(Q,X)){var X=Q;R[S++]=G===0?0:G}}return R}function ky(s){return typeof s=="number"?s:An(s)?C:+s}function En(s){if(typeof s=="string")return s;if(at(s))return tr(s,En)+"";if(An(s))return yy?yy.call(s):"";var a=s+"";return a=="0"&&1/s==-O?"-0":a}function Ns(s,a,u){var y=-1,S=Gu,R=s.length,G=!0,Q=[],X=Q;if(u)G=!1,S=Bd;else if(R>=i){var ce=a?null:LN(s);if(ce)return Qu(ce);G=!1,S=zc,X=new Do}else X=a?[]:Q;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),Q.push(ue)}else S(X,ge,u)||(X!==Q&&X.push(ge),Q.push(ue))}return Q}function lp(s,a){return a=Rs(a,s),s=gb(s,a),s==null||delete s[Ri(Kn(a))]}function qy(s,a,u,y){return Xc(s,a,u(Oo(s,a)),y)}function mh(s,a,u,y){for(var S=s.length,R=y?S:-1;(y?R--:++R<S)&&a(s[R],R,s););return u?Hn(s,y?0:R,y?R+1:S):Hn(s,y?R+1:0,y?S:R)}function zy(s,a){var u=s;return u instanceof At&&(u=u.value()),Ud(a,function(y,S){return S.func.apply(S.thisArg,Ms([y],S.args))},u)}function up(s,a,u){var y=s.length;if(y<2)return y?Ns(s[0]):[];for(var S=-1,R=se(y);++S<y;)for(var G=s[S],Q=-1;++Q<y;)Q!=S&&(R[S]=Qc(R[S]||G,s[Q],a,u));return Ns(Nr(R,1),a,u)}function Hy(s,a,u){for(var y=-1,S=s.length,R=a.length,G={};++y<S;){var Q=y<R?a[y]:r;u(G,s[y],Q)}return G}function hp(s){return dr(s)?s:[]}function fp(s){return typeof s=="function"?s:dn}function Rs(s,a){return at(s)?s:_p(s,a)?[s]:yb(Bt(s))}var IN=gt;function Ls(s,a,u){var y=s.length;return u=u===r?y:u,!a&&u>=y?s:Hn(s,a,u)}var Ky=dT||function(s){return It.clearTimeout(s)};function Wy(s,a){if(a)return s.slice();var u=s.length,y=dy?dy(u):new s.constructor(u);return s.copy(y),y}function dp(s){var a=new s.constructor(s.byteLength);return new rh(a).set(new rh(s)),a}function DN(s,a){var u=a?dp(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function CN(s){var a=new s.constructor(s.source,vt.exec(s));return a.lastIndex=s.lastIndex,a}function ON(s){return Gc?Yt(Gc.call(s)):{}}function Vy(s,a){var u=a?dp(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function Gy(s,a){if(s!==a){var u=s!==r,y=s===null,S=s===s,R=An(s),G=a!==r,Q=a===null,X=a===a,ce=An(a);if(!Q&&!ce&&!R&&s>a||R&&G&&X&&!Q&&!ce||y&&G&&X||!u&&X||!S)return 1;if(!y&&!R&&!ce&&s<a||ce&&u&&S&&!y&&!R||Q&&u&&S||!G&&S||!X)return-1}return 0}function MN(s,a,u){for(var y=-1,S=s.criteria,R=a.criteria,G=S.length,Q=u.length;++y<G;){var X=Gy(S[y],R[y]);if(X){if(y>=Q)return X;var ce=u[y];return X*(ce=="desc"?-1:1)}}return s.index-a.index}function Yy(s,a,u,y){for(var S=-1,R=s.length,G=u.length,Q=-1,X=a.length,ce=br(R-G,0),ue=se(X+ce),ge=!y;++Q<X;)ue[Q]=a[Q];for(;++S<G;)(ge||S<R)&&(ue[u[S]]=s[S]);for(;ce--;)ue[Q++]=s[S++];return ue}function Qy(s,a,u,y){for(var S=-1,R=s.length,G=-1,Q=u.length,X=-1,ce=a.length,ue=br(R-Q,0),ge=se(ue+ce),we=!y;++S<ue;)ge[S]=s[S];for(var Le=S;++X<ce;)ge[Le+X]=a[X];for(;++G<Q;)(we||S<R)&&(ge[Le+u[G]]=s[S++]);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 Ni(s,a,u,y){var S=!u;u||(u={});for(var R=-1,G=a.length;++R<G;){var Q=a[R],X=y?y(u[Q],s[Q],Q,u,s):r;X===r&&(X=s[Q]),S?Zi(u,Q,X):Yc(u,Q,X)}return u}function PN(s,a){return Ni(s,bp(s),a)}function $N(s,a){return Ni(s,lb(s),a)}function vh(s,a){return function(u,y){var S=at(u)?B$:eN,R=a?a():{};return S(u,s,qe(y,2),R)}}function Ra(s){return gt(function(a,u){var y=-1,S=u.length,R=S>1?u[S-1]:r,G=S>2?u[2]:r;for(R=s.length>3&&typeof R=="function"?(S--,R):r,G&&Jr(u[0],u[1],G)&&(R=S<3?r:R,S=1),a=Yt(a);++y<S;){var Q=u[y];Q&&s(a,Q,y,R)}return a})}function Jy(s,a){return function(u,y){if(u==null)return u;if(!hn(u))return s(u,y);for(var S=u.length,R=a?S:-1,G=Yt(u);(a?R--:++R<S)&&y(G[R],R,G)!==!1;);return u}}function Zy(s){return function(a,u,y){for(var S=-1,R=Yt(a),G=y(a),Q=G.length;Q--;){var X=G[s?Q:++S];if(u(R[X],X,R)===!1)break}return a}}function TN(s,a,u){var y=a&W,S=el(s);function R(){var G=this&&this!==It&&this instanceof R?S:s;return G.apply(y?u:this,arguments)}return R}function Xy(s){return function(a){a=Bt(a);var u=Ca(a)?ni(a):r,y=u?u[0]:a.charAt(0),S=u?Ls(u,1).join(""):a.slice(1);return y[s]()+S}}function La(s){return function(a){return Ud(Jb(Qb(a).replace(kc,"")),s,"")}}function el(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=Na(s.prototype),y=s.apply(u,a);return sr(y)?y:u}}function NN(s,a,u){var y=el(s);function S(){for(var R=arguments.length,G=se(R),Q=R,X=Ba(S);Q--;)G[Q]=arguments[Q];var ce=R<3&&G[0]!==X&&G[R-1]!==X?[]:Ps(G,X);if(R-=ce.length,R<u)return ib(s,a,wh,S.placeholder,r,G,ce,r,r,u-R);var ue=this&&this!==It&&this instanceof S?y:s;return Sr(ue,this,G)}return S}function eb(s){return function(a,u,y){var S=Yt(a);if(!hn(a)){var R=qe(u,3);a=Ir(a),u=function(Q){return R(S[Q],Q,S)}}var G=s(a,u,y);return G>-1?S[R?a[G]:G]:r}}function tb(s){return es(function(a){var u=a.length,y=u,S=qn.prototype.thru;for(s&&a.reverse();y--;){var R=a[y];if(typeof R!="function")throw new kn(c);if(S&&!G&&Eh(R)=="wrapper")var G=new qn([],!0)}for(y=G?y:u;++y<u;){R=a[y];var Q=Eh(R),X=Q=="wrapper"?wp(R):r;X&&Ep(X[0])&&X[1]==(m|z|U|$)&&!X[4].length&&X[9]==1?G=G[Eh(X[0])].apply(G,X[3]):G=R.length==1&&Ep(R)?G[Q]():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 wh(s,a,u,y,S,R,G,Q,X,ce){var ue=a&m,ge=a&W,we=a&Y,Le=a&(z|M),Ke=a&te,pt=we?r:el(s);function We(){for(var yt=arguments.length,Dt=se(yt),xn=yt;xn--;)Dt[xn]=arguments[xn];if(Le)var Zr=Ba(We),Sn=W$(Dt,Zr);if(y&&(Dt=Yy(Dt,y,S,Le)),R&&(Dt=Qy(Dt,R,G,Le)),yt-=Sn,Le&&yt<ce){var pr=Ps(Dt,Zr);return ib(s,a,wh,We.placeholder,u,Dt,pr,Q,X,ce-yt)}var oi=ge?u:this,is=we?oi[s]:s;return yt=Dt.length,Q?Dt=eR(Dt,Q):Ke&&yt>1&&Dt.reverse(),ue&&X<yt&&(Dt.length=X),this&&this!==It&&this instanceof We&&(is=pt||el(is)),is.apply(oi,Dt)}return We}function rb(s,a){return function(u,y){return cN(u,s,a(y),{})}}function yh(s,a){return function(u,y){var S;if(u===r&&y===r)return a;if(u!==r&&(S=u),y!==r){if(S===r)return y;typeof u=="string"||typeof y=="string"?(u=En(u),y=En(y)):(u=ky(u),y=ky(y)),S=s(u,y)}return S}}function pp(s){return es(function(a){return a=tr(a,_n(qe())),gt(function(u){var y=this;return s(a,function(S){return Sr(S,y,u)})})})}function bh(s,a){a=a===r?" ":En(a);var u=a.length;if(u<2)return u?ap(a,s):a;var y=ap(a,oh(s/Oa(a)));return Ca(a)?Ls(ni(y),0,s).join(""):y.slice(0,s)}function RN(s,a,u,y){var S=a&W,R=el(s);function G(){for(var Q=-1,X=arguments.length,ce=-1,ue=y.length,ge=se(ue+X),we=this&&this!==It&&this instanceof G?R:s;++ce<ue;)ge[ce]=y[ce];for(;X--;)ge[ce++]=arguments[++Q];return Sr(we,S?u:this,ge)}return G}function nb(s){return function(a,u,y){return y&&typeof y!="number"&&Jr(a,u,y)&&(u=y=r),a=ns(a),u===r?(u=a,a=0):u=ns(u),y=y===r?a<u?1:-1:ns(y),bN(a,u,y,s)}}function _h(s){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=Wn(a),u=Wn(u)),s(a,u)}}function ib(s,a,u,y,S,R,G,Q,X,ce){var ue=a&z,ge=ue?G:r,we=ue?r:G,Le=ue?R:r,Ke=ue?r:R;a|=ue?U:F,a&=~(ue?F:U),a&B||(a&=~(W|Y));var pt=[s,a,S,Le,ge,Ke,we,Q,X,ce],We=u.apply(r,pt);return Ep(s)&&mb(We,pt),We.placeholder=y,vb(We,s,a)}function gp(s){var a=yr[s];return function(u,y){if(u=Wn(u),y=y==null?0:Ur(ft(y),292),y&&vy(u)){var S=(Bt(u)+"e").split("e"),R=a(S[0]+"e"+(+S[1]+y));return S=(Bt(R)+"e").split("e"),+(S[0]+"e"+(+S[1]-y))}return a(u)}}var LN=$a&&1/Qu(new $a([,-0]))[1]==O?function(s){return new $a(s)}:Bp;function sb(s){return function(a){var u=Fr(a);return u==le?Kd(a):u==Fe?X$(a):K$(a,s(a))}}function Xi(s,a,u,y,S,R,G,Q){var X=a&Y;if(!X&&typeof s!="function")throw new kn(c);var ce=y?y.length:0;if(ce||(a&=~(U|F),y=S=r),G=G===r?G:br(ft(G),0),Q=Q===r?Q:ft(Q),ce-=S?S.length:0,a&F){var ue=y,ge=S;y=S=r}var we=X?r:wp(s),Le=[s,a,u,y,S,ue,ge,R,G,Q];if(we&&JN(Le,we),s=Le[0],a=Le[1],u=Le[2],y=Le[3],S=Le[4],Q=Le[9]=Le[9]===r?X?0:s.length:br(Le[9]-ce,0),!Q&&a&(z|M)&&(a&=~(z|M)),!a||a==W)var Ke=TN(s,a,u);else a==z||a==M?Ke=NN(s,a,Q):(a==U||a==(W|U))&&!S.length?Ke=RN(s,a,u,y):Ke=wh.apply(r,Le);var pt=we?Fy:mb;return vb(pt(Ke,Le),s,a)}function ob(s,a,u,y){return s===r||si(s,Pa[u])&&!qt.call(y,u)?a:s}function ab(s,a,u,y,S,R){return sr(s)&&sr(a)&&(R.set(a,s),ph(s,a,r,ab,R),R.delete(a)),s}function BN(s){return nl(s)?r:s}function cb(s,a,u,y,S,R){var G=u&I,Q=s.length,X=a.length;if(Q!=X&&!(G&&X>Q))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&k?new Do:r;for(R.set(s,a),R.set(a,s);++ge<Q;){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(!Fd(a,function(yt,Dt){if(!zc(Le,Dt)&&(Ke===yt||S(Ke,yt,u,y,R)))return Le.push(Dt)})){we=!1;break}}else if(!(Ke===pt||S(Ke,pt,u,y,R))){we=!1;break}}return R.delete(s),R.delete(a),we}function UN(s,a,u,y,S,R,G){switch(u){case _e: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 rh(s),new rh(a)));case H:case V:case Oe:return si(+s,+a);case j:return s.name==a.name&&s.message==a.message;case Ce:case Ee:return s==a+"";case le:var Q=Kd;case Fe:var X=y&I;if(Q||(Q=Qu),s.size!=a.size&&!X)return!1;var ce=G.get(s);if(ce)return ce==a;y|=k,G.set(s,a);var ue=cb(Q(s),Q(a),y,S,R,G);return G.delete(s),ue;case Ae:if(Gc)return Gc.call(s)==Gc.call(a)}return!1}function FN(s,a,u,y,S,R){var G=u&I,Q=mp(s),X=Q.length,ce=mp(a),ue=ce.length;if(X!=ue&&!G)return!1;for(var ge=X;ge--;){var we=Q[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=Q[ge];var yt=s[we],Dt=a[we];if(y)var xn=G?y(Dt,yt,we,a,s,R):y(yt,Dt,we,s,a,R);if(!(xn===r?yt===Dt||S(yt,Dt,u,y,R):xn)){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 es(s){return xp(pb(s,r,Ab),s+"")}function mp(s){return Cy(s,Ir,bp)}function vp(s){return Cy(s,fn,lb)}var wp=ch?function(s){return ch.get(s)}:Bp;function Eh(s){for(var a=s.name+"",u=Ta[a],y=qt.call(Ta,a)?u.length:0;y--;){var S=u[y],R=S.func;if(R==null||R==s)return S.name}return a}function Ba(s){var a=qt.call(P,"placeholder")?P:s;return a.placeholder}function qe(){var s=P.iteratee||Rp;return s=s===Rp?Py:s,arguments.length?s(arguments[0],arguments[1]):s}function Ah(s,a){var u=s.__data__;return VN(a)?u[typeof a=="string"?"string":"hash"]:u.map}function yp(s){for(var a=Ir(s),u=a.length;u--;){var y=a[u],S=s[y];a[u]=[y,S,fb(S)]}return a}function Mo(s,a){var u=Q$(s,a);return My(u)?u:r}function jN(s){var a=qt.call(s,So),u=s[So];try{s[So]=r;var y=!0}catch{}var S=eh.call(s);return y&&(a?s[So]=u:delete s[So]),S}var bp=Vd?function(s){return s==null?[]:(s=Yt(s),Os(Vd(s),function(a){return gy.call(s,a)}))}:Up,lb=Vd?function(s){for(var a=[];s;)Ms(a,bp(s)),s=nh(s);return a}:Up,Fr=Qr;(Gd&&Fr(new Gd(new ArrayBuffer(1)))!=_e||Kc&&Fr(new Kc)!=le||Yd&&Fr(Yd.resolve())!=Mt||$a&&Fr(new $a)!=Fe||Wc&&Fr(new Wc)!=be)&&(Fr=function(s){var a=Qr(s),u=a==Ie?s.constructor:r,y=u?Po(u):"";if(y)switch(y){case ET:return _e;case AT:return le;case xT:return Mt;case ST:return Fe;case IT:return be}return a});function kN(s,a,u){for(var y=-1,S=u.length;++y<S;){var R=u[y],G=R.size;switch(R.type){case"drop":s+=G;break;case"dropRight":a-=G;break;case"take":a=Ur(a,s+G);break;case"takeRight":s=br(s,a-G);break}}return{start:s,end:a}}function qN(s){var a=s.match(ke);return a?a[1].split(Ht):[]}function ub(s,a,u){a=Rs(a,s);for(var y=-1,S=a.length,R=!1;++y<S;){var G=Ri(a[y]);if(!(R=s!=null&&u(s,G)))break;s=s[G]}return R||++y!=S?R:(S=s==null?0:s.length,!!S&&Mh(S)&&ts(G,S)&&(at(s)||$o(s)))}function zN(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 hb(s){return typeof s.constructor=="function"&&!tl(s)?Na(nh(s)):{}}function HN(s,a,u){var y=s.constructor;switch(a){case Be:return dp(s);case H:case V:return new y(+s);case _e:return DN(s,u);case Me:case je:case $e:case Te:case lt:case Re:case Ne:case nr:case dt:return Vy(s,u);case le:return new y;case Oe:case Ee:return new y(s);case Ce:return CN(s);case Fe:return new y;case Ae:return ON(s)}}function KN(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,`{
|
|
50
|
+
*/(function(e,t){(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,x=4,I=1,F=2,W=1,Y=2,B=4,z=8,P=16,U=32,j=64,m=128,$=256,et=512,tt=30,nt="...",dt=800,d=16,p=1,b=2,C=3,O=1/0,N=9007199254740991,L=17976931348623157e292,D=0/0,v=4294967295,T=v-1,ot=v>>>1,pt=[["ary",m],["bind",W],["bindKey",Y],["curry",z],["curryRight",P],["flip",et],["partial",U],["partialRight",j],["rearg",$]],A="[object Arguments]",rt="[object Array]",q="[object AsyncFunction]",H="[object Boolean]",V="[object Date]",w="[object DOMException]",k="[object Error]",it="[object Function]",ht="[object GeneratorFunction]",lt="[object Map]",Ot="[object Number]",Mt="[object Null]",St="[object Object]",Pe="[object Promise]",zt="[object Proxy]",Dt="[object RegExp]",Ft="[object Set]",Et="[object String]",At="[object Symbol]",Gt="[object Undefined]",bt="[object WeakMap]",xt="[object WeakSet]",Bt="[object ArrayBuffer]",_t="[object DataView]",Pt="[object Float32Array]",jt="[object Float64Array]",$t="[object Int8Array]",Nt="[object Int16Array]",le="[object Int32Array]",Rt="[object Uint8Array]",Tt="[object Uint8ClampedArray]",nr="[object Uint16Array]",de="[object Uint32Array]",Ee=/\b__p \+= '';/g,ir=/\b(__p \+=) '' \+/g,Ie=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Oe=/&(?:amp|lt|gt|quot|#39);/g,Vr=/[&<>"']/g,Yt=RegExp(Oe.source),Ht=RegExp(Vr.source),Re=/<%-([\s\S]+?)%>/g,Qt=/<%([\s\S]+?)%>/g,Vt=/<%=([\s\S]+?)%>/g,Me=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xt=/^\w*$/,te=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Le=/[\\^$.*+?()[\]{}|]/g,ee=RegExp(Le.source),Jt=/^\s+/,Fe=/\s/,Zt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,kt=/\{\n\/\* \[wrapped with (.+)\] \*/,He=/,? & /,re=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,je=/[()=,{}\[\]\/\s]/,ei=/\\(\\)?/g,ke=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ve=/\w*$/,Tn=/^[-+]0x[0-9a-f]+$/i,Rn=/^0b[01]+$/i,Ln=/^\[object .+?Constructor\]$/,Bn=/^0o[0-7]+$/i,Un=/^(?:0|[1-9]\d*)$/,xr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Pi=/($^)/,fo=/['\n\r\u2028\u2029\\]/g,Mi="\\ud800-\\udfff",po="\\u0300-\\u036f",go="\\ufe20-\\ufe2f",$i="\\u20d0-\\u20ff",Ss=po+go+$i,Cs="\\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",$u="A-Z\\xc0-\\xd6\\xd8-\\xde",Nu="\\ufe0e\\ufe0f",bo=mo+vo+wo+yo,kc="['\u2019]",_o="["+Mi+"]",qc="["+bo+"]",Eo="["+Ss+"]",Tu="\\d+",$d="["+Cs+"]",Ru="["+Gr+"]",Lu="[^"+Mi+bo+Tu+Cs+Gr+$u+"]",Aa="\\ud83c[\\udffb-\\udfff]",Nd="(?:"+Eo+"|"+Aa+")",Bu="[^"+Mi+"]",xa="(?:\\ud83c[\\udde6-\\uddff]){2}",Ds="[\\ud800-\\udbff][\\udc00-\\udfff]",bn="["+$u+"]",Uu="\\u200d",Fu="(?:"+Ru+"|"+Lu+")",Ni="(?:"+bn+"|"+Lu+")",ju="(?:"+kc+"(?:d|ll|m|re|s|t|ve))?",ku="(?:"+kc+"(?:D|LL|M|RE|S|T|VE))?",qu=Nd+"?",zu="["+Nu+"]?",Td="(?:"+Uu+"(?:"+[Bu,xa,Ds].join("|")+")"+zu+qu+")*",Ji="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ku=zu+qu+Td,Ia="(?:"+[$d,xa,Ds].join("|")+")"+Ku,Rd="(?:"+[Bu+Eo+"?",Eo,xa,Ds,_o].join("|")+")",zc=RegExp(kc,"g"),Ld=RegExp(Eo,"g"),Sa=RegExp(Aa+"(?="+Aa+")|"+Rd+Ku,"g"),Wu=RegExp([bn+"?"+Ru+"+"+ju+"(?="+[qc,bn,"$"].join("|")+")",Ni+"+"+ku+"(?="+[qc,bn+Fu,"$"].join("|")+")",bn+"?"+Fu+"+"+ju,bn+"+"+ku,Hu,Ji,Tu,Ia].join("|"),"g"),Vu=RegExp("["+Uu+Mi+Ss+Nu+"]"),Ao=/[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"],Bd=-1,Ve={};Ve[Pt]=Ve[jt]=Ve[$t]=Ve[Nt]=Ve[le]=Ve[Rt]=Ve[Tt]=Ve[nr]=Ve[de]=!0,Ve[A]=Ve[rt]=Ve[Bt]=Ve[H]=Ve[_t]=Ve[V]=Ve[k]=Ve[it]=Ve[lt]=Ve[Ot]=Ve[St]=Ve[Dt]=Ve[Ft]=Ve[Et]=Ve[bt]=!1;var Ke={};Ke[A]=Ke[rt]=Ke[Bt]=Ke[_t]=Ke[H]=Ke[V]=Ke[Pt]=Ke[jt]=Ke[$t]=Ke[Nt]=Ke[le]=Ke[lt]=Ke[Ot]=Ke[St]=Ke[Dt]=Ke[Ft]=Ke[Et]=Ke[At]=Ke[Rt]=Ke[Tt]=Ke[nr]=Ke[de]=!0,Ke[k]=Ke[it]=Ke[bt]=!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"},J={"&":"&","<":"<",">":">",'"':""","'":"'"},ft={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ge=parseFloat,oe=parseInt,Xe=typeof _c=="object"&&_c&&_c.Object===Object&&_c,gr=typeof self=="object"&&self&&self.Object===Object&&self,Se=Xe||gr||Function("return this")(),Ye=t&&!t.nodeType&&t,fr=Ye&&!0&&e&&!e.nodeType&&e,ln=fr&&fr.exports===Ye,mr=ln&&Xe.process,tr=function(){try{var Z=fr&&fr.require&&fr.require("util").types;return Z||mr&&mr.binding&&mr.binding("util")}catch{}}(),Yr=tr&&tr.isArrayBuffer,ri=tr&&tr.isDate,Fn=tr&&tr.isMap,Ti=tr&&tr.isRegExp,Hc=tr&&tr.isSet,xo=tr&&tr.isTypedArray;function Ir(Z,at,st){switch(st.length){case 0:return Z.call(at);case 1:return Z.call(at,st[0]);case 2:return Z.call(at,st[0],st[1]);case 3:return Z.call(at,st[0],st[1],st[2])}return Z.apply(at,st)}function F$(Z,at,st,Ct){for(var ie=-1,Ne=Z==null?0:Z.length;++ie<Ne;){var yr=Z[ie];at(Ct,yr,st(yr),Z)}return Ct}function jn(Z,at){for(var st=-1,Ct=Z==null?0:Z.length;++st<Ct&&at(Z[st],st,Z)!==!1;);return Z}function j$(Z,at){for(var st=Z==null?0:Z.length;st--&&at(Z[st],st,Z)!==!1;);return Z}function iy(Z,at){for(var st=-1,Ct=Z==null?0:Z.length;++st<Ct;)if(!at(Z[st],st,Z))return!1;return!0}function Os(Z,at){for(var st=-1,Ct=Z==null?0:Z.length,ie=0,Ne=[];++st<Ct;){var yr=Z[st];at(yr,st,Z)&&(Ne[ie++]=yr)}return Ne}function Yu(Z,at){var st=Z==null?0:Z.length;return!!st&&Ca(Z,at,0)>-1}function Ud(Z,at,st){for(var Ct=-1,ie=Z==null?0:Z.length;++Ct<ie;)if(st(at,Z[Ct]))return!0;return!1}function er(Z,at){for(var st=-1,Ct=Z==null?0:Z.length,ie=Array(Ct);++st<Ct;)ie[st]=at(Z[st],st,Z);return ie}function Ps(Z,at){for(var st=-1,Ct=at.length,ie=Z.length;++st<Ct;)Z[ie+st]=at[st];return Z}function Fd(Z,at,st,Ct){var ie=-1,Ne=Z==null?0:Z.length;for(Ct&&Ne&&(st=Z[++ie]);++ie<Ne;)st=at(st,Z[ie],ie,Z);return st}function k$(Z,at,st,Ct){var ie=Z==null?0:Z.length;for(Ct&&ie&&(st=Z[--ie]);ie--;)st=at(st,Z[ie],ie,Z);return st}function jd(Z,at){for(var st=-1,Ct=Z==null?0:Z.length;++st<Ct;)if(at(Z[st],st,Z))return!0;return!1}var q$=kd("length");function z$(Z){return Z.split("")}function H$(Z){return Z.match(re)||[]}function sy(Z,at,st){var Ct;return st(Z,function(ie,Ne,yr){if(at(ie,Ne,yr))return Ct=Ne,!1}),Ct}function Qu(Z,at,st,Ct){for(var ie=Z.length,Ne=st+(Ct?1:-1);Ct?Ne--:++Ne<ie;)if(at(Z[Ne],Ne,Z))return Ne;return-1}function Ca(Z,at,st){return at===at?rN(Z,at,st):Qu(Z,oy,st)}function K$(Z,at,st,Ct){for(var ie=st-1,Ne=Z.length;++ie<Ne;)if(Ct(Z[ie],at))return ie;return-1}function oy(Z){return Z!==Z}function ay(Z,at){var st=Z==null?0:Z.length;return st?zd(Z,at)/st:D}function kd(Z){return function(at){return at==null?r:at[Z]}}function qd(Z){return function(at){return Z==null?r:Z[at]}}function cy(Z,at,st,Ct,ie){return ie(Z,function(Ne,yr,Qe){st=Ct?(Ct=!1,Ne):at(st,Ne,yr,Qe)}),st}function W$(Z,at){var st=Z.length;for(Z.sort(at);st--;)Z[st]=Z[st].value;return Z}function zd(Z,at){for(var st,Ct=-1,ie=Z.length;++Ct<ie;){var Ne=at(Z[Ct]);Ne!==r&&(st=st===r?Ne:st+Ne)}return st}function Hd(Z,at){for(var st=-1,Ct=Array(Z);++st<Z;)Ct[st]=at(st);return Ct}function V$(Z,at){return er(at,function(st){return[st,Z[st]]})}function ly(Z){return Z&&Z.slice(0,dy(Z)+1).replace(Jt,"")}function _n(Z){return function(at){return Z(at)}}function Kd(Z,at){return er(at,function(st){return Z[st]})}function Kc(Z,at){return Z.has(at)}function uy(Z,at){for(var st=-1,Ct=Z.length;++st<Ct&&Ca(at,Z[st],0)>-1;);return st}function hy(Z,at){for(var st=Z.length;st--&&Ca(at,Z[st],0)>-1;);return st}function G$(Z,at){for(var st=Z.length,Ct=0;st--;)Z[st]===at&&++Ct;return Ct}var Y$=qd(K),Q$=qd(J);function J$(Z){return"\\"+It[Z]}function Z$(Z,at){return Z==null?r:Z[at]}function Da(Z){return Vu.test(Z)}function X$(Z){return Ao.test(Z)}function tN(Z){for(var at,st=[];!(at=Z.next()).done;)st.push(at.value);return st}function Wd(Z){var at=-1,st=Array(Z.size);return Z.forEach(function(Ct,ie){st[++at]=[ie,Ct]}),st}function fy(Z,at){return function(st){return Z(at(st))}}function Ms(Z,at){for(var st=-1,Ct=Z.length,ie=0,Ne=[];++st<Ct;){var yr=Z[st];(yr===at||yr===g)&&(Z[st]=g,Ne[ie++]=st)}return Ne}function Ju(Z){var at=-1,st=Array(Z.size);return Z.forEach(function(Ct){st[++at]=Ct}),st}function eN(Z){var at=-1,st=Array(Z.size);return Z.forEach(function(Ct){st[++at]=[Ct,Ct]}),st}function rN(Z,at,st){for(var Ct=st-1,ie=Z.length;++Ct<ie;)if(Z[Ct]===at)return Ct;return-1}function nN(Z,at,st){for(var Ct=st+1;Ct--;)if(Z[Ct]===at)return Ct;return Ct}function Oa(Z){return Da(Z)?sN(Z):q$(Z)}function ni(Z){return Da(Z)?oN(Z):z$(Z)}function dy(Z){for(var at=Z.length;at--&&Fe.test(Z.charAt(at)););return at}var iN=qd(ft);function sN(Z){for(var at=Sa.lastIndex=0;Sa.test(Z);)++at;return at}function oN(Z){return Z.match(Sa)||[]}function aN(Z){return Z.match(Wu)||[]}var cN=function Z(at){at=at==null?Se:Pa.defaults(Se.Object(),at,Pa.pick(Se,Gu));var st=at.Array,Ct=at.Date,ie=at.Error,Ne=at.Function,yr=at.Math,Qe=at.Object,Vd=at.RegExp,lN=at.String,kn=at.TypeError,Zu=st.prototype,uN=Ne.prototype,Ma=Qe.prototype,Xu=at["__core-js_shared__"],th=uN.toString,qe=Ma.hasOwnProperty,hN=0,py=function(){var s=/[^.]+$/.exec(Xu&&Xu.keys&&Xu.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),eh=Ma.toString,fN=th.call(Qe),dN=Se._,pN=Vd("^"+th.call(qe).replace(Le,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rh=ln?at.Buffer:r,$s=at.Symbol,nh=at.Uint8Array,gy=rh?rh.allocUnsafe:r,ih=fy(Qe.getPrototypeOf,Qe),my=Qe.create,vy=Ma.propertyIsEnumerable,sh=Zu.splice,wy=$s?$s.isConcatSpreadable:r,Wc=$s?$s.iterator:r,Io=$s?$s.toStringTag:r,oh=function(){try{var s=Po(Qe,"defineProperty");return s({},"",{}),s}catch{}}(),gN=at.clearTimeout!==Se.clearTimeout&&at.clearTimeout,mN=Ct&&Ct.now!==Se.Date.now&&Ct.now,vN=at.setTimeout!==Se.setTimeout&&at.setTimeout,ah=yr.ceil,ch=yr.floor,Gd=Qe.getOwnPropertySymbols,wN=rh?rh.isBuffer:r,yy=at.isFinite,yN=Zu.join,bN=fy(Qe.keys,Qe),br=yr.max,Ur=yr.min,_N=Ct.now,EN=at.parseInt,by=yr.random,AN=Zu.reverse,Yd=Po(at,"DataView"),Vc=Po(at,"Map"),Qd=Po(at,"Promise"),$a=Po(at,"Set"),Gc=Po(at,"WeakMap"),Yc=Po(Qe,"create"),lh=Gc&&new Gc,Na={},xN=Mo(Yd),IN=Mo(Vc),SN=Mo(Qd),CN=Mo($a),DN=Mo(Gc),uh=$s?$s.prototype:r,Qc=uh?uh.valueOf:r,_y=uh?uh.toString:r;function M(s){if(cr(s)&&!ae(s)&&!(s instanceof Ae)){if(s instanceof qn)return s;if(qe.call(s,"__wrapped__"))return Eb(s)}return new qn(s)}var Ta=function(){function s(){}return function(a){if(!sr(a))return{};if(my)return my(a);s.prototype=a;var u=new s;return s.prototype=r,u}}();function hh(){}function qn(s,a){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=r}M.templateSettings={escape:Re,evaluate:Qt,interpolate:Vt,variable:"",imports:{_:M}},M.prototype=hh.prototype,M.prototype.constructor=M,qn.prototype=Ta(hh.prototype),qn.prototype.constructor=qn;function Ae(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function ON(){var s=new Ae(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 PN(){if(this.__filtered__){var s=new Ae(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function MN(){var s=this.__wrapped__.value(),a=this.__dir__,u=ae(s),y=a<0,S=u?s.length:0,R=zT(0,S,this.__views__),G=R.start,Q=R.end,X=Q-G,ct=y?Q:G-1,ut=this.__iteratees__,gt=ut.length,wt=0,Lt=Ur(X,this.__takeCount__);if(!u||!y&&S==X&&Lt==X)return Ky(s,this.__actions__);var Kt=[];t:for(;X--&&wt<Lt;){ct+=a;for(var pe=-1,Wt=s[ct];++pe<gt;){var ye=ut[pe],Ce=ye.iteratee,xn=ye.type,Zr=Ce(Wt);if(xn==b)Wt=Zr;else if(!Zr){if(xn==p)continue t;break t}}Kt[wt++]=Wt}return Kt}Ae.prototype=Ta(hh.prototype),Ae.prototype.constructor=Ae;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 $N(){this.__data__=Yc?Yc(null):{},this.size=0}function NN(s){var a=this.has(s)&&delete this.__data__[s];return this.size-=a?1:0,a}function TN(s){var a=this.__data__;if(Yc){var u=a[s];return u===f?r:u}return qe.call(a,s)?a[s]:r}function RN(s){var a=this.__data__;return Yc?a[s]!==r:qe.call(a,s)}function LN(s,a){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=Yc&&a===r?f:a,this}So.prototype.clear=$N,So.prototype.delete=NN,So.prototype.get=TN,So.prototype.has=RN,So.prototype.set=LN;function Zi(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 BN(){this.__data__=[],this.size=0}function UN(s){var a=this.__data__,u=fh(a,s);if(u<0)return!1;var y=a.length-1;return u==y?a.pop():sh.call(a,u,1),--this.size,!0}function FN(s){var a=this.__data__,u=fh(a,s);return u<0?r:a[u][1]}function jN(s){return fh(this.__data__,s)>-1}function kN(s,a){var u=this.__data__,y=fh(u,s);return y<0?(++this.size,u.push([s,a])):u[y][1]=a,this}Zi.prototype.clear=BN,Zi.prototype.delete=UN,Zi.prototype.get=FN,Zi.prototype.has=jN,Zi.prototype.set=kN;function Xi(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 qN(){this.size=0,this.__data__={hash:new So,map:new(Vc||Zi),string:new So}}function zN(s){var a=xh(this,s).delete(s);return this.size-=a?1:0,a}function HN(s){return xh(this,s).get(s)}function KN(s){return xh(this,s).has(s)}function WN(s,a){var u=xh(this,s),y=u.size;return u.set(s,a),this.size+=u.size==y?0:1,this}Xi.prototype.clear=qN,Xi.prototype.delete=zN,Xi.prototype.get=HN,Xi.prototype.has=KN,Xi.prototype.set=WN;function Co(s){var a=-1,u=s==null?0:s.length;for(this.__data__=new Xi;++a<u;)this.add(s[a])}function VN(s){return this.__data__.set(s,f),this}function GN(s){return this.__data__.has(s)}Co.prototype.add=Co.prototype.push=VN,Co.prototype.has=GN;function ii(s){var a=this.__data__=new Zi(s);this.size=a.size}function YN(){this.__data__=new Zi,this.size=0}function QN(s){var a=this.__data__,u=a.delete(s);return this.size=a.size,u}function JN(s){return this.__data__.get(s)}function ZN(s){return this.__data__.has(s)}function XN(s,a){var u=this.__data__;if(u instanceof Zi){var y=u.__data__;if(!Vc||y.length<i-1)return y.push([s,a]),this.size=++u.size,this;u=this.__data__=new Xi(y)}return u.set(s,a),this.size=u.size,this}ii.prototype.clear=YN,ii.prototype.delete=QN,ii.prototype.get=JN,ii.prototype.has=ZN,ii.prototype.set=XN;function Ey(s,a){var u=ae(s),y=!u&&$o(s),S=!u&&!y&&Bs(s),R=!u&&!y&&!S&&Ua(s),G=u||y||S||R,Q=G?Hd(s.length,lN):[],X=Q.length;for(var ct in s)(a||qe.call(s,ct))&&!(G&&(ct=="length"||S&&(ct=="offset"||ct=="parent")||R&&(ct=="buffer"||ct=="byteLength"||ct=="byteOffset")||ns(ct,X)))&&Q.push(ct);return Q}function Ay(s){var a=s.length;return a?s[ap(0,a-1)]:r}function tT(s,a){return Ih(un(s),Do(a,0,s.length))}function eT(s){return Ih(un(s))}function Jd(s,a,u){(u!==r&&!si(s[a],u)||u===r&&!(a in s))&&ts(s,a,u)}function Jc(s,a,u){var y=s[a];(!(qe.call(s,a)&&si(y,u))||u===r&&!(a in s))&&ts(s,a,u)}function fh(s,a){for(var u=s.length;u--;)if(si(s[u][0],a))return u;return-1}function rT(s,a,u,y){return Ns(s,function(S,R,G){a(y,S,u(S),G)}),y}function xy(s,a){return s&&Li(a,Sr(a),s)}function nT(s,a){return s&&Li(a,fn(a),s)}function ts(s,a,u){a=="__proto__"&&oh?oh(s,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[a]=u}function Zd(s,a){for(var u=-1,y=a.length,S=st(y),R=s==null;++u<y;)S[u]=R?r:$p(s,a[u]);return S}function Do(s,a,u){return s===s&&(u!==r&&(s=s<=u?s:u),a!==r&&(s=s>=a?s:a)),s}function zn(s,a,u,y,S,R){var G,Q=a&_,X=a&E,ct=a&x;if(u&&(G=S?u(s,y,S,R):u(s)),G!==r)return G;if(!sr(s))return s;var ut=ae(s);if(ut){if(G=KT(s),!Q)return un(s,G)}else{var gt=Fr(s),wt=gt==it||gt==ht;if(Bs(s))return Gy(s,Q);if(gt==St||gt==A||wt&&!S){if(G=X||wt?{}:db(s),!Q)return X?TT(s,nT(G,s)):NT(s,xy(G,s))}else{if(!Ke[gt])return S?s:{};G=WT(s,gt,Q)}}R||(R=new ii);var Lt=R.get(s);if(Lt)return Lt;R.set(s,G),qb(s)?s.forEach(function(Wt){G.add(zn(Wt,a,u,Wt,s,R))}):jb(s)&&s.forEach(function(Wt,ye){G.set(ye,zn(Wt,a,u,ye,s,R))});var Kt=ct?X?wp:vp:X?fn:Sr,pe=ut?r:Kt(s);return jn(pe||s,function(Wt,ye){pe&&(ye=Wt,Wt=s[ye]),Jc(G,ye,zn(Wt,a,u,ye,s,R))}),G}function iT(s){var a=Sr(s);return function(u){return Iy(u,s,a)}}function Iy(s,a,u){var y=u.length;if(s==null)return!y;for(s=Qe(s);y--;){var S=u[y],R=a[S],G=s[S];if(G===r&&!(S in s)||!R(G))return!1}return!0}function Sy(s,a,u){if(typeof s!="function")throw new kn(c);return il(function(){s.apply(r,u)},a)}function Zc(s,a,u,y){var S=-1,R=Yu,G=!0,Q=s.length,X=[],ct=a.length;if(!Q)return X;u&&(a=er(a,_n(u))),y?(R=Ud,G=!1):a.length>=i&&(R=Kc,G=!1,a=new Co(a));t:for(;++S<Q;){var ut=s[S],gt=u==null?ut:u(ut);if(ut=y||ut!==0?ut:0,G&>===gt){for(var wt=ct;wt--;)if(a[wt]===gt)continue t;X.push(ut)}else R(a,gt,y)||X.push(ut)}return X}var Ns=Xy(Ri),Cy=Xy(tp,!0);function sT(s,a){var u=!0;return Ns(s,function(y,S,R){return u=!!a(y,S,R),u}),u}function dh(s,a,u){for(var y=-1,S=s.length;++y<S;){var R=s[y],G=a(R);if(G!=null&&(Q===r?G===G&&!An(G):u(G,Q)))var Q=G,X=R}return X}function oT(s,a,u,y){var S=s.length;for(u=fe(u),u<0&&(u=-u>S?0:S+u),y=y===r||y>S?S:fe(y),y<0&&(y+=S),y=u>y?0:Hb(y);u<y;)s[u++]=a;return s}function Dy(s,a){var u=[];return Ns(s,function(y,S,R){a(y,S,R)&&u.push(y)}),u}function Tr(s,a,u,y,S){var R=-1,G=s.length;for(u||(u=GT),S||(S=[]);++R<G;){var Q=s[R];a>0&&u(Q)?a>1?Tr(Q,a-1,u,y,S):Ps(S,Q):y||(S[S.length]=Q)}return S}var Xd=tb(),Oy=tb(!0);function Ri(s,a){return s&&Xd(s,a,Sr)}function tp(s,a){return s&&Oy(s,a,Sr)}function ph(s,a){return Os(a,function(u){return is(s[u])})}function Oo(s,a){a=Rs(a,s);for(var u=0,y=a.length;s!=null&&u<y;)s=s[Bi(a[u++])];return u&&u==y?s:r}function Py(s,a,u){var y=a(s);return ae(s)?y:Ps(y,u(s))}function Qr(s){return s==null?s===r?Gt:Mt:Io&&Io in Qe(s)?qT(s):eR(s)}function ep(s,a){return s>a}function aT(s,a){return s!=null&&qe.call(s,a)}function cT(s,a){return s!=null&&a in Qe(s)}function lT(s,a,u){return s>=Ur(a,u)&&s<br(a,u)}function rp(s,a,u){for(var y=u?Ud:Yu,S=s[0].length,R=s.length,G=R,Q=st(R),X=1/0,ct=[];G--;){var ut=s[G];G&&a&&(ut=er(ut,_n(a))),X=Ur(ut.length,X),Q[G]=!u&&(a||S>=120&&ut.length>=120)?new Co(G&&ut):r}ut=s[0];var gt=-1,wt=Q[0];t:for(;++gt<S&&ct.length<X;){var Lt=ut[gt],Kt=a?a(Lt):Lt;if(Lt=u||Lt!==0?Lt:0,!(wt?Kc(wt,Kt):y(ct,Kt,u))){for(G=R;--G;){var pe=Q[G];if(!(pe?Kc(pe,Kt):y(s[G],Kt,u)))continue t}wt&&wt.push(Kt),ct.push(Lt)}}return ct}function uT(s,a,u,y){return Ri(s,function(S,R,G){a(y,u(S),R,G)}),y}function Xc(s,a,u){a=Rs(a,s),s=vb(s,a);var y=s==null?s:s[Bi(Kn(a))];return y==null?r:Ir(y,s,u)}function My(s){return cr(s)&&Qr(s)==A}function hT(s){return cr(s)&&Qr(s)==Bt}function fT(s){return cr(s)&&Qr(s)==V}function tl(s,a,u,y,S){return s===a?!0:s==null||a==null||!cr(s)&&!cr(a)?s!==s&&a!==a:dT(s,a,u,y,tl,S)}function dT(s,a,u,y,S,R){var G=ae(s),Q=ae(a),X=G?rt:Fr(s),ct=Q?rt:Fr(a);X=X==A?St:X,ct=ct==A?St:ct;var ut=X==St,gt=ct==St,wt=X==ct;if(wt&&Bs(s)){if(!Bs(a))return!1;G=!0,ut=!1}if(wt&&!ut)return R||(R=new ii),G||Ua(s)?ub(s,a,u,y,S,R):jT(s,a,X,u,y,S,R);if(!(u&I)){var Lt=ut&&qe.call(s,"__wrapped__"),Kt=gt&&qe.call(a,"__wrapped__");if(Lt||Kt){var pe=Lt?s.value():s,Wt=Kt?a.value():a;return R||(R=new ii),S(pe,Wt,u,y,R)}}return wt?(R||(R=new ii),kT(s,a,u,y,S,R)):!1}function pT(s){return cr(s)&&Fr(s)==lt}function np(s,a,u,y){var S=u.length,R=S,G=!y;if(s==null)return!R;for(s=Qe(s);S--;){var Q=u[S];if(G&&Q[2]?Q[1]!==s[Q[0]]:!(Q[0]in s))return!1}for(;++S<R;){Q=u[S];var X=Q[0],ct=s[X],ut=Q[1];if(G&&Q[2]){if(ct===r&&!(X in s))return!1}else{var gt=new ii;if(y)var wt=y(ct,ut,X,s,a,gt);if(!(wt===r?tl(ut,ct,I|F,y,gt):wt))return!1}}return!0}function $y(s){if(!sr(s)||QT(s))return!1;var a=is(s)?pN:Ln;return a.test(Mo(s))}function gT(s){return cr(s)&&Qr(s)==Dt}function mT(s){return cr(s)&&Fr(s)==Ft}function vT(s){return cr(s)&&Mh(s.length)&&!!Ve[Qr(s)]}function Ny(s){return typeof s=="function"?s:s==null?dn:typeof s=="object"?ae(s)?Ly(s[0],s[1]):Ry(s):e3(s)}function ip(s){if(!nl(s))return bN(s);var a=[];for(var u in Qe(s))qe.call(s,u)&&u!="constructor"&&a.push(u);return a}function wT(s){if(!sr(s))return tR(s);var a=nl(s),u=[];for(var y in s)y=="constructor"&&(a||!qe.call(s,y))||u.push(y);return u}function sp(s,a){return s<a}function Ty(s,a){var u=-1,y=hn(s)?st(s.length):[];return Ns(s,function(S,R,G){y[++u]=a(S,R,G)}),y}function Ry(s){var a=bp(s);return a.length==1&&a[0][2]?gb(a[0][0],a[0][1]):function(u){return u===s||np(u,s,a)}}function Ly(s,a){return Ep(s)&&pb(a)?gb(Bi(s),a):function(u){var y=$p(u,s);return y===r&&y===a?Np(u,s):tl(a,y,I|F)}}function gh(s,a,u,y,S){s!==a&&Xd(a,function(R,G){if(S||(S=new ii),sr(R))yT(s,a,G,u,gh,y,S);else{var Q=y?y(xp(s,G),R,G+"",s,a,S):r;Q===r&&(Q=R),Jd(s,G,Q)}},fn)}function yT(s,a,u,y,S,R,G){var Q=xp(s,u),X=xp(a,u),ct=G.get(X);if(ct){Jd(s,u,ct);return}var ut=R?R(Q,X,u+"",s,a,G):r,gt=ut===r;if(gt){var wt=ae(X),Lt=!wt&&Bs(X),Kt=!wt&&!Lt&&Ua(X);ut=X,wt||Lt||Kt?ae(Q)?ut=Q:dr(Q)?ut=un(Q):Lt?(gt=!1,ut=Gy(X,!0)):Kt?(gt=!1,ut=Yy(X,!0)):ut=[]:sl(X)||$o(X)?(ut=Q,$o(Q)?ut=Kb(Q):(!sr(Q)||is(Q))&&(ut=db(X))):gt=!1}gt&&(G.set(X,ut),S(ut,X,y,R,G),G.delete(X)),Jd(s,u,ut)}function By(s,a){var u=s.length;if(u)return a+=a<0?u:0,ns(a,u)?s[a]:r}function Uy(s,a,u){a.length?a=er(a,function(R){return ae(R)?function(G){return Oo(G,R.length===1?R[0]:R)}:R}):a=[dn];var y=-1;a=er(a,_n(qt()));var S=Ty(s,function(R,G,Q){var X=er(a,function(ct){return ct(R)});return{criteria:X,index:++y,value:R}});return W$(S,function(R,G){return $T(R,G,u)})}function bT(s,a){return Fy(s,a,function(u,y){return Np(s,y)})}function Fy(s,a,u){for(var y=-1,S=a.length,R={};++y<S;){var G=a[y],Q=Oo(s,G);u(Q,G)&&el(R,Rs(G,s),Q)}return R}function _T(s){return function(a){return Oo(a,s)}}function op(s,a,u,y){var S=y?K$:Ca,R=-1,G=a.length,Q=s;for(s===a&&(a=un(a)),u&&(Q=er(s,_n(u)));++R<G;)for(var X=0,ct=a[R],ut=u?u(ct):ct;(X=S(Q,ut,X,y))>-1;)Q!==s&&sh.call(Q,X,1),sh.call(s,X,1);return s}function jy(s,a){for(var u=s?a.length:0,y=u-1;u--;){var S=a[u];if(u==y||S!==R){var R=S;ns(S)?sh.call(s,S,1):up(s,S)}}return s}function ap(s,a){return s+ch(by()*(a-s+1))}function ET(s,a,u,y){for(var S=-1,R=br(ah((a-s)/(u||1)),0),G=st(R);R--;)G[y?R:++S]=s,s+=u;return G}function cp(s,a){var u="";if(!s||a<1||a>N)return u;do a%2&&(u+=s),a=ch(a/2),a&&(s+=s);while(a);return u}function ge(s,a){return Ip(mb(s,a,dn),s+"")}function AT(s){return Ay(Fa(s))}function xT(s,a){var u=Fa(s);return Ih(u,Do(a,0,u.length))}function el(s,a,u,y){if(!sr(s))return s;a=Rs(a,s);for(var S=-1,R=a.length,G=R-1,Q=s;Q!=null&&++S<R;){var X=Bi(a[S]),ct=u;if(X==="__proto__"||X==="constructor"||X==="prototype")return s;if(S!=G){var ut=Q[X];ct=y?y(ut,X,Q):r,ct===r&&(ct=sr(ut)?ut:ns(a[S+1])?[]:{})}Jc(Q,X,ct),Q=Q[X]}return s}var ky=lh?function(s,a){return lh.set(s,a),s}:dn,IT=oh?function(s,a){return oh(s,"toString",{configurable:!0,enumerable:!1,value:Rp(a),writable:!0})}:dn;function ST(s){return Ih(Fa(s))}function Hn(s,a,u){var y=-1,S=s.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 R=st(S);++y<S;)R[y]=s[y+a];return R}function CT(s,a){var u;return Ns(s,function(y,S,R){return u=a(y,S,R),!u}),!!u}function mh(s,a,u){var y=0,S=s==null?y:s.length;if(typeof a=="number"&&a===a&&S<=ot){for(;y<S;){var R=y+S>>>1,G=s[R];G!==null&&!An(G)&&(u?G<=a:G<a)?y=R+1:S=R}return S}return lp(s,a,dn,u)}function lp(s,a,u,y){var S=0,R=s==null?0:s.length;if(R===0)return 0;a=u(a);for(var G=a!==a,Q=a===null,X=An(a),ct=a===r;S<R;){var ut=ch((S+R)/2),gt=u(s[ut]),wt=gt!==r,Lt=gt===null,Kt=gt===gt,pe=An(gt);if(G)var Wt=y||Kt;else ct?Wt=Kt&&(y||wt):Q?Wt=Kt&&wt&&(y||!Lt):X?Wt=Kt&&wt&&!Lt&&(y||!pe):Lt||pe?Wt=!1:Wt=y?gt<=a:gt<a;Wt?S=ut+1:R=ut}return Ur(R,T)}function qy(s,a){for(var u=-1,y=s.length,S=0,R=[];++u<y;){var G=s[u],Q=a?a(G):G;if(!u||!si(Q,X)){var X=Q;R[S++]=G===0?0:G}}return R}function zy(s){return typeof s=="number"?s:An(s)?D:+s}function En(s){if(typeof s=="string")return s;if(ae(s))return er(s,En)+"";if(An(s))return _y?_y.call(s):"";var a=s+"";return a=="0"&&1/s==-O?"-0":a}function Ts(s,a,u){var y=-1,S=Yu,R=s.length,G=!0,Q=[],X=Q;if(u)G=!1,S=Ud;else if(R>=i){var ct=a?null:UT(s);if(ct)return Ju(ct);G=!1,S=Kc,X=new Co}else X=a?[]:Q;t:for(;++y<R;){var ut=s[y],gt=a?a(ut):ut;if(ut=u||ut!==0?ut:0,G&>===gt){for(var wt=X.length;wt--;)if(X[wt]===gt)continue t;a&&X.push(gt),Q.push(ut)}else S(X,gt,u)||(X!==Q&&X.push(gt),Q.push(ut))}return Q}function up(s,a){return a=Rs(a,s),s=vb(s,a),s==null||delete s[Bi(Kn(a))]}function Hy(s,a,u,y){return el(s,a,u(Oo(s,a)),y)}function vh(s,a,u,y){for(var S=s.length,R=y?S:-1;(y?R--:++R<S)&&a(s[R],R,s););return u?Hn(s,y?0:R,y?R+1:S):Hn(s,y?R+1:0,y?S:R)}function Ky(s,a){var u=s;return u instanceof Ae&&(u=u.value()),Fd(a,function(y,S){return S.func.apply(S.thisArg,Ps([y],S.args))},u)}function hp(s,a,u){var y=s.length;if(y<2)return y?Ts(s[0]):[];for(var S=-1,R=st(y);++S<y;)for(var G=s[S],Q=-1;++Q<y;)Q!=S&&(R[S]=Zc(R[S]||G,s[Q],a,u));return Ts(Tr(R,1),a,u)}function Wy(s,a,u){for(var y=-1,S=s.length,R=a.length,G={};++y<S;){var Q=y<R?a[y]:r;u(G,s[y],Q)}return G}function fp(s){return dr(s)?s:[]}function dp(s){return typeof s=="function"?s:dn}function Rs(s,a){return ae(s)?s:Ep(s,a)?[s]:_b(Be(s))}var DT=ge;function Ls(s,a,u){var y=s.length;return u=u===r?y:u,!a&&u>=y?s:Hn(s,a,u)}var Vy=gN||function(s){return Se.clearTimeout(s)};function Gy(s,a){if(a)return s.slice();var u=s.length,y=gy?gy(u):new s.constructor(u);return s.copy(y),y}function pp(s){var a=new s.constructor(s.byteLength);return new nh(a).set(new nh(s)),a}function OT(s,a){var u=a?pp(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function PT(s){var a=new s.constructor(s.source,ve.exec(s));return a.lastIndex=s.lastIndex,a}function MT(s){return Qc?Qe(Qc.call(s)):{}}function Yy(s,a){var u=a?pp(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function Qy(s,a){if(s!==a){var u=s!==r,y=s===null,S=s===s,R=An(s),G=a!==r,Q=a===null,X=a===a,ct=An(a);if(!Q&&!ct&&!R&&s>a||R&&G&&X&&!Q&&!ct||y&&G&&X||!u&&X||!S)return 1;if(!y&&!R&&!ct&&s<a||ct&&u&&S&&!y&&!R||Q&&u&&S||!G&&S||!X)return-1}return 0}function $T(s,a,u){for(var y=-1,S=s.criteria,R=a.criteria,G=S.length,Q=u.length;++y<G;){var X=Qy(S[y],R[y]);if(X){if(y>=Q)return X;var ct=u[y];return X*(ct=="desc"?-1:1)}}return s.index-a.index}function Jy(s,a,u,y){for(var S=-1,R=s.length,G=u.length,Q=-1,X=a.length,ct=br(R-G,0),ut=st(X+ct),gt=!y;++Q<X;)ut[Q]=a[Q];for(;++S<G;)(gt||S<R)&&(ut[u[S]]=s[S]);for(;ct--;)ut[Q++]=s[S++];return ut}function Zy(s,a,u,y){for(var S=-1,R=s.length,G=-1,Q=u.length,X=-1,ct=a.length,ut=br(R-Q,0),gt=st(ut+ct),wt=!y;++S<ut;)gt[S]=s[S];for(var Lt=S;++X<ct;)gt[Lt+X]=a[X];for(;++G<Q;)(wt||S<R)&&(gt[Lt+u[G]]=s[S++]);return gt}function un(s,a){var u=-1,y=s.length;for(a||(a=st(y));++u<y;)a[u]=s[u];return a}function Li(s,a,u,y){var S=!u;u||(u={});for(var R=-1,G=a.length;++R<G;){var Q=a[R],X=y?y(u[Q],s[Q],Q,u,s):r;X===r&&(X=s[Q]),S?ts(u,Q,X):Jc(u,Q,X)}return u}function NT(s,a){return Li(s,_p(s),a)}function TT(s,a){return Li(s,hb(s),a)}function wh(s,a){return function(u,y){var S=ae(u)?F$:rT,R=a?a():{};return S(u,s,qt(y,2),R)}}function Ra(s){return ge(function(a,u){var y=-1,S=u.length,R=S>1?u[S-1]:r,G=S>2?u[2]:r;for(R=s.length>3&&typeof R=="function"?(S--,R):r,G&&Jr(u[0],u[1],G)&&(R=S<3?r:R,S=1),a=Qe(a);++y<S;){var Q=u[y];Q&&s(a,Q,y,R)}return a})}function Xy(s,a){return function(u,y){if(u==null)return u;if(!hn(u))return s(u,y);for(var S=u.length,R=a?S:-1,G=Qe(u);(a?R--:++R<S)&&y(G[R],R,G)!==!1;);return u}}function tb(s){return function(a,u,y){for(var S=-1,R=Qe(a),G=y(a),Q=G.length;Q--;){var X=G[s?Q:++S];if(u(R[X],X,R)===!1)break}return a}}function RT(s,a,u){var y=a&W,S=rl(s);function R(){var G=this&&this!==Se&&this instanceof R?S:s;return G.apply(y?u:this,arguments)}return R}function eb(s){return function(a){a=Be(a);var u=Da(a)?ni(a):r,y=u?u[0]:a.charAt(0),S=u?Ls(u,1).join(""):a.slice(1);return y[s]()+S}}function La(s){return function(a){return Fd(Xb(Zb(a).replace(zc,"")),s,"")}}function rl(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=Ta(s.prototype),y=s.apply(u,a);return sr(y)?y:u}}function LT(s,a,u){var y=rl(s);function S(){for(var R=arguments.length,G=st(R),Q=R,X=Ba(S);Q--;)G[Q]=arguments[Q];var ct=R<3&&G[0]!==X&&G[R-1]!==X?[]:Ms(G,X);if(R-=ct.length,R<u)return ob(s,a,yh,S.placeholder,r,G,ct,r,r,u-R);var ut=this&&this!==Se&&this instanceof S?y:s;return Ir(ut,this,G)}return S}function rb(s){return function(a,u,y){var S=Qe(a);if(!hn(a)){var R=qt(u,3);a=Sr(a),u=function(Q){return R(S[Q],Q,S)}}var G=s(a,u,y);return G>-1?S[R?a[G]:G]:r}}function nb(s){return rs(function(a){var u=a.length,y=u,S=qn.prototype.thru;for(s&&a.reverse();y--;){var R=a[y];if(typeof R!="function")throw new kn(c);if(S&&!G&&Ah(R)=="wrapper")var G=new qn([],!0)}for(y=G?y:u;++y<u;){R=a[y];var Q=Ah(R),X=Q=="wrapper"?yp(R):r;X&&Ap(X[0])&&X[1]==(m|z|U|$)&&!X[4].length&&X[9]==1?G=G[Ah(X[0])].apply(G,X[3]):G=R.length==1&&Ap(R)?G[Q]():G.thru(R)}return function(){var ct=arguments,ut=ct[0];if(G&&ct.length==1&&ae(ut))return G.plant(ut).value();for(var gt=0,wt=u?a[gt].apply(this,ct):ut;++gt<u;)wt=a[gt].call(this,wt);return wt}})}function yh(s,a,u,y,S,R,G,Q,X,ct){var ut=a&m,gt=a&W,wt=a&Y,Lt=a&(z|P),Kt=a&et,pe=wt?r:rl(s);function Wt(){for(var ye=arguments.length,Ce=st(ye),xn=ye;xn--;)Ce[xn]=arguments[xn];if(Lt)var Zr=Ba(Wt),In=G$(Ce,Zr);if(y&&(Ce=Jy(Ce,y,S,Lt)),R&&(Ce=Zy(Ce,R,G,Lt)),ye-=In,Lt&&ye<ct){var pr=Ms(Ce,Zr);return ob(s,a,yh,Wt.placeholder,u,Ce,pr,Q,X,ct-ye)}var oi=gt?u:this,os=wt?oi[s]:s;return ye=Ce.length,Q?Ce=rR(Ce,Q):Kt&&ye>1&&Ce.reverse(),ut&&X<ye&&(Ce.length=X),this&&this!==Se&&this instanceof Wt&&(os=pe||rl(os)),os.apply(oi,Ce)}return Wt}function ib(s,a){return function(u,y){return uT(u,s,a(y),{})}}function bh(s,a){return function(u,y){var S;if(u===r&&y===r)return a;if(u!==r&&(S=u),y!==r){if(S===r)return y;typeof u=="string"||typeof y=="string"?(u=En(u),y=En(y)):(u=zy(u),y=zy(y)),S=s(u,y)}return S}}function gp(s){return rs(function(a){return a=er(a,_n(qt())),ge(function(u){var y=this;return s(a,function(S){return Ir(S,y,u)})})})}function _h(s,a){a=a===r?" ":En(a);var u=a.length;if(u<2)return u?cp(a,s):a;var y=cp(a,ah(s/Oa(a)));return Da(a)?Ls(ni(y),0,s).join(""):y.slice(0,s)}function BT(s,a,u,y){var S=a&W,R=rl(s);function G(){for(var Q=-1,X=arguments.length,ct=-1,ut=y.length,gt=st(ut+X),wt=this&&this!==Se&&this instanceof G?R:s;++ct<ut;)gt[ct]=y[ct];for(;X--;)gt[ct++]=arguments[++Q];return Ir(wt,S?u:this,gt)}return G}function sb(s){return function(a,u,y){return y&&typeof y!="number"&&Jr(a,u,y)&&(u=y=r),a=ss(a),u===r?(u=a,a=0):u=ss(u),y=y===r?a<u?1:-1:ss(y),ET(a,u,y,s)}}function Eh(s){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=Wn(a),u=Wn(u)),s(a,u)}}function ob(s,a,u,y,S,R,G,Q,X,ct){var ut=a&z,gt=ut?G:r,wt=ut?r:G,Lt=ut?R:r,Kt=ut?r:R;a|=ut?U:j,a&=~(ut?j:U),a&B||(a&=~(W|Y));var pe=[s,a,S,Lt,gt,Kt,wt,Q,X,ct],Wt=u.apply(r,pe);return Ap(s)&&wb(Wt,pe),Wt.placeholder=y,yb(Wt,s,a)}function mp(s){var a=yr[s];return function(u,y){if(u=Wn(u),y=y==null?0:Ur(fe(y),292),y&&yy(u)){var S=(Be(u)+"e").split("e"),R=a(S[0]+"e"+(+S[1]+y));return S=(Be(R)+"e").split("e"),+(S[0]+"e"+(+S[1]-y))}return a(u)}}var UT=$a&&1/Ju(new $a([,-0]))[1]==O?function(s){return new $a(s)}:Up;function ab(s){return function(a){var u=Fr(a);return u==lt?Wd(a):u==Ft?eN(a):V$(a,s(a))}}function es(s,a,u,y,S,R,G,Q){var X=a&Y;if(!X&&typeof s!="function")throw new kn(c);var ct=y?y.length:0;if(ct||(a&=~(U|j),y=S=r),G=G===r?G:br(fe(G),0),Q=Q===r?Q:fe(Q),ct-=S?S.length:0,a&j){var ut=y,gt=S;y=S=r}var wt=X?r:yp(s),Lt=[s,a,u,y,S,ut,gt,R,G,Q];if(wt&&XT(Lt,wt),s=Lt[0],a=Lt[1],u=Lt[2],y=Lt[3],S=Lt[4],Q=Lt[9]=Lt[9]===r?X?0:s.length:br(Lt[9]-ct,0),!Q&&a&(z|P)&&(a&=~(z|P)),!a||a==W)var Kt=RT(s,a,u);else a==z||a==P?Kt=LT(s,a,Q):(a==U||a==(W|U))&&!S.length?Kt=BT(s,a,u,y):Kt=yh.apply(r,Lt);var pe=wt?ky:wb;return yb(pe(Kt,Lt),s,a)}function cb(s,a,u,y){return s===r||si(s,Ma[u])&&!qe.call(y,u)?a:s}function lb(s,a,u,y,S,R){return sr(s)&&sr(a)&&(R.set(a,s),gh(s,a,r,lb,R),R.delete(a)),s}function FT(s){return sl(s)?r:s}function ub(s,a,u,y,S,R){var G=u&I,Q=s.length,X=a.length;if(Q!=X&&!(G&&X>Q))return!1;var ct=R.get(s),ut=R.get(a);if(ct&&ut)return ct==a&&ut==s;var gt=-1,wt=!0,Lt=u&F?new Co:r;for(R.set(s,a),R.set(a,s);++gt<Q;){var Kt=s[gt],pe=a[gt];if(y)var Wt=G?y(pe,Kt,gt,a,s,R):y(Kt,pe,gt,s,a,R);if(Wt!==r){if(Wt)continue;wt=!1;break}if(Lt){if(!jd(a,function(ye,Ce){if(!Kc(Lt,Ce)&&(Kt===ye||S(Kt,ye,u,y,R)))return Lt.push(Ce)})){wt=!1;break}}else if(!(Kt===pe||S(Kt,pe,u,y,R))){wt=!1;break}}return R.delete(s),R.delete(a),wt}function jT(s,a,u,y,S,R,G){switch(u){case _t:if(s.byteLength!=a.byteLength||s.byteOffset!=a.byteOffset)return!1;s=s.buffer,a=a.buffer;case Bt:return!(s.byteLength!=a.byteLength||!R(new nh(s),new nh(a)));case H:case V:case Ot:return si(+s,+a);case k:return s.name==a.name&&s.message==a.message;case Dt:case Et:return s==a+"";case lt:var Q=Wd;case Ft:var X=y&I;if(Q||(Q=Ju),s.size!=a.size&&!X)return!1;var ct=G.get(s);if(ct)return ct==a;y|=F,G.set(s,a);var ut=ub(Q(s),Q(a),y,S,R,G);return G.delete(s),ut;case At:if(Qc)return Qc.call(s)==Qc.call(a)}return!1}function kT(s,a,u,y,S,R){var G=u&I,Q=vp(s),X=Q.length,ct=vp(a),ut=ct.length;if(X!=ut&&!G)return!1;for(var gt=X;gt--;){var wt=Q[gt];if(!(G?wt in a:qe.call(a,wt)))return!1}var Lt=R.get(s),Kt=R.get(a);if(Lt&&Kt)return Lt==a&&Kt==s;var pe=!0;R.set(s,a),R.set(a,s);for(var Wt=G;++gt<X;){wt=Q[gt];var ye=s[wt],Ce=a[wt];if(y)var xn=G?y(Ce,ye,wt,a,s,R):y(ye,Ce,wt,s,a,R);if(!(xn===r?ye===Ce||S(ye,Ce,u,y,R):xn)){pe=!1;break}Wt||(Wt=wt=="constructor")}if(pe&&!Wt){var Zr=s.constructor,In=a.constructor;Zr!=In&&"constructor"in s&&"constructor"in a&&!(typeof Zr=="function"&&Zr instanceof Zr&&typeof In=="function"&&In instanceof In)&&(pe=!1)}return R.delete(s),R.delete(a),pe}function rs(s){return Ip(mb(s,r,Ib),s+"")}function vp(s){return Py(s,Sr,_p)}function wp(s){return Py(s,fn,hb)}var yp=lh?function(s){return lh.get(s)}:Up;function Ah(s){for(var a=s.name+"",u=Na[a],y=qe.call(Na,a)?u.length:0;y--;){var S=u[y],R=S.func;if(R==null||R==s)return S.name}return a}function Ba(s){var a=qe.call(M,"placeholder")?M:s;return a.placeholder}function qt(){var s=M.iteratee||Lp;return s=s===Lp?Ny:s,arguments.length?s(arguments[0],arguments[1]):s}function xh(s,a){var u=s.__data__;return YT(a)?u[typeof a=="string"?"string":"hash"]:u.map}function bp(s){for(var a=Sr(s),u=a.length;u--;){var y=a[u],S=s[y];a[u]=[y,S,pb(S)]}return a}function Po(s,a){var u=Z$(s,a);return $y(u)?u:r}function qT(s){var a=qe.call(s,Io),u=s[Io];try{s[Io]=r;var y=!0}catch{}var S=eh.call(s);return y&&(a?s[Io]=u:delete s[Io]),S}var _p=Gd?function(s){return s==null?[]:(s=Qe(s),Os(Gd(s),function(a){return vy.call(s,a)}))}:Fp,hb=Gd?function(s){for(var a=[];s;)Ps(a,_p(s)),s=ih(s);return a}:Fp,Fr=Qr;(Yd&&Fr(new Yd(new ArrayBuffer(1)))!=_t||Vc&&Fr(new Vc)!=lt||Qd&&Fr(Qd.resolve())!=Pe||$a&&Fr(new $a)!=Ft||Gc&&Fr(new Gc)!=bt)&&(Fr=function(s){var a=Qr(s),u=a==St?s.constructor:r,y=u?Mo(u):"";if(y)switch(y){case xN:return _t;case IN:return lt;case SN:return Pe;case CN:return Ft;case DN:return bt}return a});function zT(s,a,u){for(var y=-1,S=u.length;++y<S;){var R=u[y],G=R.size;switch(R.type){case"drop":s+=G;break;case"dropRight":a-=G;break;case"take":a=Ur(a,s+G);break;case"takeRight":s=br(s,a-G);break}}return{start:s,end:a}}function HT(s){var a=s.match(kt);return a?a[1].split(He):[]}function fb(s,a,u){a=Rs(a,s);for(var y=-1,S=a.length,R=!1;++y<S;){var G=Bi(a[y]);if(!(R=s!=null&&u(s,G)))break;s=s[G]}return R||++y!=S?R:(S=s==null?0:s.length,!!S&&Mh(S)&&ns(G,S)&&(ae(s)||$o(s)))}function KT(s){var a=s.length,u=new s.constructor(a);return a&&typeof s[0]=="string"&&qe.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function db(s){return typeof s.constructor=="function"&&!nl(s)?Ta(ih(s)):{}}function WT(s,a,u){var y=s.constructor;switch(a){case Bt:return pp(s);case H:case V:return new y(+s);case _t:return OT(s,u);case Pt:case jt:case $t:case Nt:case le:case Rt:case Tt:case nr:case de:return Yy(s,u);case lt:return new y;case Ot:case Et:return new y(s);case Dt:return PT(s);case Ft:return new y;case At:return MT(s)}}function VT(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(Zt,`{
|
|
51
51
|
/* [wrapped with `+a+`] */
|
|
52
|
-
`)}function WN(s){return at(s)||$o(s)||!!(my&&s&&s[my])}function ts(s,a){var u=typeof s;return a=a??T,!!a&&(u=="number"||u!="symbol"&&Un.test(s))&&s>-1&&s%1==0&&s<a}function Jr(s,a,u){if(!sr(u))return!1;var y=typeof a;return(y=="number"?hn(u)&&ts(a,u.length):y=="string"&&a in u)?si(u[a],s):!1}function _p(s,a){if(at(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||An(s)?!0:Xe.test(s)||!Pt.test(s)||a!=null&&s in Yt(a)}function VN(s){var a=typeof s;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?s!=="__proto__":s===null}function Ep(s){var a=Eh(s),u=P[a];if(typeof u!="function"||!(a in At.prototype))return!1;if(s===u)return!0;var y=wp(u);return!!y&&s===y[0]}function GN(s){return!!fy&&fy in s}var YN=Zu?rs:Fp;function tl(s){var a=s&&s.constructor,u=typeof a=="function"&&a.prototype||Pa;return s===u}function fb(s){return s===s&&!sr(s)}function db(s,a){return function(u){return u==null?!1:u[s]===a&&(a!==r||s in Yt(u))}}function QN(s){var a=Ch(s,function(y){return u.size===h&&u.clear(),y}),u=a.cache;return a}function JN(s,a){var u=s[1],y=a[1],S=u|y,R=S<(W|Y|m),G=y==m&&u==z||y==m&&u==$&&s[7].length<=a[8]||y==(m|$)&&a[7].length<=a[8]&&u==z;if(!(R||G))return s;y&W&&(s[2]=a[2],S|=u&W?0:B);var Q=a[3];if(Q){var X=s[3];s[3]=X?Yy(X,Q,a[4]):Q,s[4]=X?Ps(s[3],g):a[4]}return Q=a[5],Q&&(X=s[5],s[5]=X?Qy(X,Q,a[6]):Q,s[6]=X?Ps(s[5],g):a[6]),Q=a[7],Q&&(s[7]=Q),y&m&&(s[8]=s[8]==null?a[8]:Ur(s[8],a[8])),s[9]==null&&(s[9]=a[9]),s[0]=a[0],s[1]=S,s}function ZN(s){var a=[];if(s!=null)for(var u in Yt(s))a.push(u);return a}function XN(s){return eh.call(s)}function pb(s,a,u){return a=br(a===r?s.length-1:a,0),function(){for(var y=arguments,S=-1,R=br(y.length-a,0),G=se(R);++S<R;)G[S]=y[a+S];S=-1;for(var Q=se(a+1);++S<a;)Q[S]=y[S];return Q[a]=u(G),Sr(s,this,Q)}}function gb(s,a){return a.length<2?s:Oo(s,Hn(a,0,-1))}function eR(s,a){for(var u=s.length,y=Ur(a.length,u),S=un(s);y--;){var R=a[y];s[y]=ts(R,u)?S[R]:r}return s}function Ap(s,a){if(!(a==="constructor"&&typeof s[a]=="function")&&a!="__proto__")return s[a]}var mb=wb(Fy),rl=gT||function(s,a){return It.setTimeout(s,a)},xp=wb(AN);function vb(s,a,u){var y=a+"";return xp(s,KN(y,tR(qN(y),u)))}function wb(s){var a=0,u=0;return function(){var y=yT(),S=d-(y-u);if(u=y,S>0){if(++a>=de)return arguments[0]}else a=0;return s.apply(r,arguments)}}function xh(s,a){var u=-1,y=s.length,S=y-1;for(a=a===r?y:a;++u<a;){var R=op(u,S),G=s[R];s[R]=s[u],s[u]=G}return s.length=a,s}var yb=QN(function(s){var a=[];return s.charCodeAt(0)===46&&a.push(""),s.replace(et,function(u,y,S,R){a.push(S?R.replace(ti,"$1"):y||u)}),a});function Ri(s){if(typeof s=="string"||An(s))return s;var a=s+"";return a=="0"&&1/s==-O?"-0":a}function Po(s){if(s!=null){try{return Xu.call(s)}catch{}try{return s+""}catch{}}return""}function tR(s,a){return jn(pe,function(u){var y="_."+u[0];a&u[1]&&!Gu(s,y)&&s.push(y)}),s.sort()}function bb(s){if(s instanceof At)return s.clone();var a=new qn(s.__wrapped__,s.__chain__);return a.__actions__=un(s.__actions__),a.__index__=s.__index__,a.__values__=s.__values__,a}function rR(s,a,u){(u?Jr(s,a,u):a===r)?a=1:a=br(ft(a),0);var y=s==null?0:s.length;if(!y||a<1)return[];for(var S=0,R=0,G=se(oh(y/a));S<y;)G[R++]=Hn(s,S,S+=a);return G}function nR(s){for(var a=-1,u=s==null?0:s.length,y=0,S=[];++a<u;){var R=s[a];R&&(S[y++]=R)}return S}function iR(){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 Ms(at(u)?un(u):[u],Nr(a,1))}var sR=gt(function(s,a){return dr(s)?Qc(s,Nr(a,1,dr,!0)):[]}),oR=gt(function(s,a){var u=Kn(a);return dr(u)&&(u=r),dr(s)?Qc(s,Nr(a,1,dr,!0),qe(u,2)):[]}),aR=gt(function(s,a){var u=Kn(a);return dr(u)&&(u=r),dr(s)?Qc(s,Nr(a,1,dr,!0),r,u):[]});function cR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:ft(a),Hn(s,a<0?0:a,y)):[]}function lR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:ft(a),a=y-a,Hn(s,0,a<0?0:a)):[]}function uR(s,a){return s&&s.length?mh(s,qe(a,3),!0,!0):[]}function hR(s,a){return s&&s.length?mh(s,qe(a,3),!0):[]}function fR(s,a,u,y){var S=s==null?0:s.length;return S?(u&&typeof u!="number"&&Jr(s,a,u)&&(u=0,y=S),iN(s,a,u,y)):[]}function _b(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=u==null?0:ft(u);return S<0&&(S=br(y+S,0)),Yu(s,qe(a,3),S)}function Eb(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=y-1;return u!==r&&(S=ft(u),S=u<0?br(y+S,0):Ur(S,y-1)),Yu(s,qe(a,3),S,!0)}function Ab(s){var a=s==null?0:s.length;return a?Nr(s,1):[]}function dR(s){var a=s==null?0:s.length;return a?Nr(s,O):[]}function pR(s,a){var u=s==null?0:s.length;return u?(a=a===r?1:ft(a),Nr(s,a)):[]}function gR(s){for(var a=-1,u=s==null?0:s.length,y={};++a<u;){var S=s[a];y[S[0]]=S[1]}return y}function xb(s){return s&&s.length?s[0]:r}function mR(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=u==null?0:ft(u);return S<0&&(S=br(y+S,0)),Da(s,a,S)}function vR(s){var a=s==null?0:s.length;return a?Hn(s,0,-1):[]}var wR=gt(function(s){var a=tr(s,hp);return a.length&&a[0]===s[0]?tp(a):[]}),yR=gt(function(s){var a=Kn(s),u=tr(s,hp);return a===Kn(u)?a=r:u.pop(),u.length&&u[0]===s[0]?tp(u,qe(a,2)):[]}),bR=gt(function(s){var a=Kn(s),u=tr(s,hp);return a=typeof a=="function"?a:r,a&&u.pop(),u.length&&u[0]===s[0]?tp(u,r,a):[]});function _R(s,a){return s==null?"":vT.call(s,a)}function Kn(s){var a=s==null?0:s.length;return a?s[a-1]:r}function ER(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=y;return u!==r&&(S=ft(u),S=S<0?br(y+S,0):Ur(S,y-1)),a===a?tT(s,a,S):Yu(s,iy,S,!0)}function AR(s,a){return s&&s.length?Ry(s,ft(a)):r}var xR=gt(Sb);function Sb(s,a){return s&&s.length&&a&&a.length?sp(s,a):s}function SR(s,a,u){return s&&s.length&&a&&a.length?sp(s,a,qe(u,2)):s}function IR(s,a,u){return s&&s.length&&a&&a.length?sp(s,a,r,u):s}var DR=es(function(s,a){var u=s==null?0:s.length,y=Jd(s,a);return Uy(s,tr(a,function(S){return ts(S,u)?+S:S}).sort(Gy)),y});function CR(s,a){var u=[];if(!(s&&s.length))return u;var y=-1,S=[],R=s.length;for(a=qe(a,3);++y<R;){var G=s[y];a(G,y,s)&&(u.push(G),S.push(y))}return Uy(s,S),u}function Sp(s){return s==null?s:_T.call(s)}function OR(s,a,u){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&Jr(s,a,u)?(a=0,u=y):(a=a==null?0:ft(a),u=u===r?y:ft(u)),Hn(s,a,u)):[]}function MR(s,a){return gh(s,a)}function PR(s,a,u){return cp(s,a,qe(u,2))}function $R(s,a){var u=s==null?0:s.length;if(u){var y=gh(s,a);if(y<u&&si(s[y],a))return y}return-1}function TR(s,a){return gh(s,a,!0)}function NR(s,a,u){return cp(s,a,qe(u,2),!0)}function RR(s,a){var u=s==null?0:s.length;if(u){var y=gh(s,a,!0)-1;if(si(s[y],a))return y}return-1}function LR(s){return s&&s.length?jy(s):[]}function BR(s,a){return s&&s.length?jy(s,qe(a,2)):[]}function UR(s){var a=s==null?0:s.length;return a?Hn(s,1,a):[]}function FR(s,a,u){return s&&s.length?(a=u||a===r?1:ft(a),Hn(s,0,a<0?0:a)):[]}function jR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:ft(a),a=y-a,Hn(s,a<0?0:a,y)):[]}function kR(s,a){return s&&s.length?mh(s,qe(a,3),!1,!0):[]}function qR(s,a){return s&&s.length?mh(s,qe(a,3)):[]}var zR=gt(function(s){return Ns(Nr(s,1,dr,!0))}),HR=gt(function(s){var a=Kn(s);return dr(a)&&(a=r),Ns(Nr(s,1,dr,!0),qe(a,2))}),KR=gt(function(s){var a=Kn(s);return a=typeof a=="function"?a:r,Ns(Nr(s,1,dr,!0),r,a)});function WR(s){return s&&s.length?Ns(s):[]}function VR(s,a){return s&&s.length?Ns(s,qe(a,2)):[]}function GR(s,a){return a=typeof a=="function"?a:r,s&&s.length?Ns(s,r,a):[]}function Ip(s){if(!(s&&s.length))return[];var a=0;return s=Os(s,function(u){if(dr(u))return a=br(u.length,a),!0}),zd(a,function(u){return tr(s,jd(u))})}function Ib(s,a){if(!(s&&s.length))return[];var u=Ip(s);return a==null?u:tr(u,function(y){return Sr(a,r,y)})}var YR=gt(function(s,a){return dr(s)?Qc(s,a):[]}),QR=gt(function(s){return up(Os(s,dr))}),JR=gt(function(s){var a=Kn(s);return dr(a)&&(a=r),up(Os(s,dr),qe(a,2))}),ZR=gt(function(s){var a=Kn(s);return a=typeof a=="function"?a:r,up(Os(s,dr),r,a)}),XR=gt(Ip);function eL(s,a){return Hy(s||[],a||[],Yc)}function tL(s,a){return Hy(s||[],a||[],Xc)}var rL=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 Db(s){var a=P(s);return a.__chain__=!0,a}function nL(s,a){return a(s),s}function Sh(s,a){return a(s)}var iL=es(function(s){var a=s.length,u=a?s[0]:0,y=this.__wrapped__,S=function(R){return Jd(R,s)};return a>1||this.__actions__.length||!(y instanceof At)||!ts(u)?this.thru(S):(y=y.slice(u,+u+(a?1:0)),y.__actions__.push({func:Sh,args:[S],thisArg:r}),new qn(y,this.__chain__).thru(function(R){return a&&!R.length&&R.push(r),R}))});function sL(){return Db(this)}function oL(){return new qn(this.value(),this.__chain__)}function aL(){this.__values__===r&&(this.__values__=kb(this.value()));var s=this.__index__>=this.__values__.length,a=s?r:this.__values__[this.__index__++];return{done:s,value:a}}function cL(){return this}function lL(s){for(var a,u=this;u instanceof uh;){var y=bb(u);y.__index__=0,y.__values__=r,a?S.__wrapped__=y:a=y;var S=y;u=u.__wrapped__}return S.__wrapped__=s,a}function uL(){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:Sh,args:[Sp],thisArg:r}),new qn(a,this.__chain__)}return this.thru(Sp)}function hL(){return zy(this.__wrapped__,this.__actions__)}var fL=vh(function(s,a,u){qt.call(s,u)?++s[u]:Zi(s,u,1)});function dL(s,a,u){var y=at(s)?ry:nN;return u&&Jr(s,a,u)&&(a=r),y(s,qe(a,3))}function pL(s,a){var u=at(s)?Os:Iy;return u(s,qe(a,3))}var gL=eb(_b),mL=eb(Eb);function vL(s,a){return Nr(Ih(s,a),1)}function wL(s,a){return Nr(Ih(s,a),O)}function yL(s,a,u){return u=u===r?1:ft(u),Nr(Ih(s,a),u)}function Cb(s,a){var u=at(s)?jn:Ts;return u(s,qe(a,3))}function Ob(s,a){var u=at(s)?U$:Sy;return u(s,qe(a,3))}var bL=vh(function(s,a,u){qt.call(s,u)?s[u].push(a):Zi(s,u,[a])});function _L(s,a,u,y){s=hn(s)?s:Fa(s),u=u&&!y?ft(u):0;var S=s.length;return u<0&&(u=br(S+u,0)),Ph(s)?u<=S&&s.indexOf(a,u)>-1:!!S&&Da(s,a,u)>-1}var EL=gt(function(s,a,u){var y=-1,S=typeof a=="function",R=hn(s)?se(s.length):[];return Ts(s,function(G){R[++y]=S?Sr(a,G,u):Jc(G,a,u)}),R}),AL=vh(function(s,a,u){Zi(s,u,a)});function Ih(s,a){var u=at(s)?tr:$y;return u(s,qe(a,3))}function xL(s,a,u,y){return s==null?[]:(at(a)||(a=a==null?[]:[a]),u=y?r:u,at(u)||(u=u==null?[]:[u]),Ly(s,a,u))}var SL=vh(function(s,a,u){s[u?0:1].push(a)},function(){return[[],[]]});function IL(s,a,u){var y=at(s)?Ud:oy,S=arguments.length<3;return y(s,qe(a,4),u,S,Ts)}function DL(s,a,u){var y=at(s)?F$:oy,S=arguments.length<3;return y(s,qe(a,4),u,S,Sy)}function CL(s,a){var u=at(s)?Os:Iy;return u(s,Oh(qe(a,3)))}function OL(s){var a=at(s)?_y:_N;return a(s)}function ML(s,a,u){(u?Jr(s,a,u):a===r)?a=1:a=ft(a);var y=at(s)?ZT:EN;return y(s,a)}function PL(s){var a=at(s)?XT:xN;return a(s)}function $L(s){if(s==null)return 0;if(hn(s))return Ph(s)?Oa(s):s.length;var a=Fr(s);return a==le||a==Fe?s.size:np(s).length}function TL(s,a,u){var y=at(s)?Fd:SN;return u&&Jr(s,a,u)&&(a=r),y(s,qe(a,3))}var NL=gt(function(s,a){if(s==null)return[];var u=a.length;return u>1&&Jr(s,a[0],a[1])?a=[]:u>2&&Jr(a[0],a[1],a[2])&&(a=[a[0]]),Ly(s,Nr(a,1),[])}),Dh=pT||function(){return It.Date.now()};function RL(s,a){if(typeof a!="function")throw new kn(c);return s=ft(s),function(){if(--s<1)return a.apply(this,arguments)}}function Mb(s,a,u){return a=u?r:a,a=s&&a==null?s.length:a,Xi(s,m,r,r,r,r,a)}function Pb(s,a){var u;if(typeof a!="function")throw new kn(c);return s=ft(s),function(){return--s>0&&(u=a.apply(this,arguments)),s<=1&&(a=r),u}}var Dp=gt(function(s,a,u){var y=W;if(u.length){var S=Ps(u,Ba(Dp));y|=U}return Xi(s,y,a,u,S)}),$b=gt(function(s,a,u){var y=W|Y;if(u.length){var S=Ps(u,Ba($b));y|=U}return Xi(a,y,s,u,S)});function Tb(s,a,u){a=u?r:a;var y=Xi(s,z,r,r,r,r,r,a);return y.placeholder=Tb.placeholder,y}function Nb(s,a,u){a=u?r:a;var y=Xi(s,M,r,r,r,r,r,a);return y.placeholder=Nb.placeholder,y}function Rb(s,a,u){var y,S,R,G,Q,X,ce=0,ue=!1,ge=!1,we=!0;if(typeof s!="function")throw new kn(c);a=Wn(a)||0,sr(u)&&(ue=!!u.leading,ge="maxWait"in u,R=ge?br(Wn(u.maxWait)||0,a):R,we="trailing"in u?!!u.trailing:we);function Le(pr){var oi=y,is=S;return y=S=r,ce=pr,G=s.apply(is,oi),G}function Ke(pr){return ce=pr,Q=rl(yt,a),ue?Le(pr):G}function pt(pr){var oi=pr-X,is=pr-ce,e3=a-oi;return ge?Ur(e3,R-is):e3}function We(pr){var oi=pr-X,is=pr-ce;return X===r||oi>=a||oi<0||ge&&is>=R}function yt(){var pr=Dh();if(We(pr))return Dt(pr);Q=rl(yt,pt(pr))}function Dt(pr){return Q=r,we&&y?Le(pr):(y=S=r,G)}function xn(){Q!==r&&Ky(Q),ce=0,y=X=S=Q=r}function Zr(){return Q===r?G:Dt(Dh())}function Sn(){var pr=Dh(),oi=We(pr);if(y=arguments,S=this,X=pr,oi){if(Q===r)return Ke(X);if(ge)return Ky(Q),Q=rl(yt,a),Le(X)}return Q===r&&(Q=rl(yt,a)),G}return Sn.cancel=xn,Sn.flush=Zr,Sn}var LL=gt(function(s,a){return xy(s,1,a)}),BL=gt(function(s,a,u){return xy(s,Wn(a)||0,u)});function UL(s){return Xi(s,te)}function Ch(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new kn(c);var u=function(){var y=arguments,S=a?a.apply(this,y):y[0],R=u.cache;if(R.has(S))return R.get(S);var G=s.apply(this,y);return u.cache=R.set(S,G)||R,G};return u.cache=new(Ch.Cache||Ji),u}Ch.Cache=Ji;function Oh(s){if(typeof s!="function")throw new kn(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 FL(s){return Pb(2,s)}var jL=IN(function(s,a){a=a.length==1&&at(a[0])?tr(a[0],_n(qe())):tr(Nr(a,1),_n(qe()));var u=a.length;return gt(function(y){for(var S=-1,R=Ur(y.length,u);++S<R;)y[S]=a[S].call(this,y[S]);return Sr(s,this,y)})}),Cp=gt(function(s,a){var u=Ps(a,Ba(Cp));return Xi(s,U,r,a,u)}),Lb=gt(function(s,a){var u=Ps(a,Ba(Lb));return Xi(s,F,r,a,u)}),kL=es(function(s,a){return Xi(s,$,r,r,r,a)});function qL(s,a){if(typeof s!="function")throw new kn(c);return a=a===r?a:ft(a),gt(s,a)}function zL(s,a){if(typeof s!="function")throw new kn(c);return a=a==null?0:br(ft(a),0),gt(function(u){var y=u[a],S=Ls(u,0,a);return y&&Ms(S,y),Sr(s,this,S)})}function HL(s,a,u){var y=!0,S=!0;if(typeof s!="function")throw new kn(c);return sr(u)&&(y="leading"in u?!!u.leading:y,S="trailing"in u?!!u.trailing:S),Rb(s,a,{leading:y,maxWait:a,trailing:S})}function KL(s){return Mb(s,1)}function WL(s,a){return Cp(fp(a),s)}function VL(){if(!arguments.length)return[];var s=arguments[0];return at(s)?s:[s]}function GL(s){return zn(s,x)}function YL(s,a){return a=typeof a=="function"?a:r,zn(s,x,a)}function QL(s){return zn(s,_|x)}function JL(s,a){return a=typeof a=="function"?a:r,zn(s,_|x,a)}function ZL(s,a){return a==null||Ay(s,a,Ir(a))}function si(s,a){return s===a||s!==s&&a!==a}var XL=_h(ep),eB=_h(function(s,a){return s>=a}),$o=Oy(function(){return arguments}())?Oy:function(s){return cr(s)&&qt.call(s,"callee")&&!gy.call(s,"callee")},at=se.isArray,tB=Yr?_n(Yr):lN;function hn(s){return s!=null&&Mh(s.length)&&!rs(s)}function dr(s){return cr(s)&&hn(s)}function rB(s){return s===!0||s===!1||cr(s)&&Qr(s)==H}var Bs=mT||Fp,nB=ri?_n(ri):uN;function iB(s){return cr(s)&&s.nodeType===1&&!nl(s)}function sB(s){if(s==null)return!0;if(hn(s)&&(at(s)||typeof s=="string"||typeof s.splice=="function"||Bs(s)||Ua(s)||$o(s)))return!s.length;var a=Fr(s);if(a==le||a==Fe)return!s.size;if(tl(s))return!np(s).length;for(var u in s)if(qt.call(s,u))return!1;return!0}function oB(s,a){return Zc(s,a)}function aB(s,a,u){u=typeof u=="function"?u:r;var y=u?u(s,a):r;return y===r?Zc(s,a,r,u):!!y}function Op(s){if(!cr(s))return!1;var a=Qr(s);return a==j||a==w||typeof s.message=="string"&&typeof s.name=="string"&&!nl(s)}function cB(s){return typeof s=="number"&&vy(s)}function rs(s){if(!sr(s))return!1;var a=Qr(s);return a==ie||a==he||a==q||a==ze}function Bb(s){return typeof s=="number"&&s==ft(s)}function Mh(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=T}function sr(s){var a=typeof s;return s!=null&&(a=="object"||a=="function")}function cr(s){return s!=null&&typeof s=="object"}var Ub=Fn?_n(Fn):fN;function lB(s,a){return s===a||rp(s,a,yp(a))}function uB(s,a,u){return u=typeof u=="function"?u:r,rp(s,a,yp(a),u)}function hB(s){return Fb(s)&&s!=+s}function fB(s){if(YN(s))throw new it(o);return My(s)}function dB(s){return s===null}function pB(s){return s==null}function Fb(s){return typeof s=="number"||cr(s)&&Qr(s)==Oe}function nl(s){if(!cr(s)||Qr(s)!=Ie)return!1;var a=nh(s);if(a===null)return!0;var u=qt.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&Xu.call(u)==uT}var Mp=$i?_n($i):dN;function gB(s){return Bb(s)&&s>=-T&&s<=T}var jb=qc?_n(qc):pN;function Ph(s){return typeof s=="string"||!at(s)&&cr(s)&&Qr(s)==Ee}function An(s){return typeof s=="symbol"||cr(s)&&Qr(s)==Ae}var Ua=xo?_n(xo):gN;function mB(s){return s===r}function vB(s){return cr(s)&&Fr(s)==be}function wB(s){return cr(s)&&Qr(s)==xe}var yB=_h(ip),bB=_h(function(s,a){return s<=a});function kb(s){if(!s)return[];if(hn(s))return Ph(s)?ni(s):un(s);if(Hc&&s[Hc])return Z$(s[Hc]());var a=Fr(s),u=a==le?Kd:a==Fe?Qu:Fa;return u(s)}function ns(s){if(!s)return s===0?s:0;if(s=Wn(s),s===O||s===-O){var a=s<0?-1:1;return a*L}return s===s?s:0}function ft(s){var a=ns(s),u=a%1;return a===a?u?a-u:a:0}function qb(s){return s?Co(ft(s),0,v):0}function Wn(s){if(typeof s=="number")return s;if(An(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=ay(s);var u=Rn.test(s);return u||Bn.test(s)?ot(s.slice(2),u?2:8):Nn.test(s)?C:+s}function zb(s){return Ni(s,fn(s))}function _B(s){return s?Co(ft(s),-T,T):s===0?s:0}function Bt(s){return s==null?"":En(s)}var EB=Ra(function(s,a){if(tl(a)||hn(a)){Ni(a,Ir(a),s);return}for(var u in a)qt.call(a,u)&&Yc(s,u,a[u])}),Hb=Ra(function(s,a){Ni(a,fn(a),s)}),$h=Ra(function(s,a,u,y){Ni(a,fn(a),s,y)}),AB=Ra(function(s,a,u,y){Ni(a,Ir(a),s,y)}),xB=es(Jd);function SB(s,a){var u=Na(s);return a==null?u:Ey(u,a)}var IB=gt(function(s,a){s=Yt(s);var u=-1,y=a.length,S=y>2?a[2]:r;for(S&&Jr(a[0],a[1],S)&&(y=1);++u<y;)for(var R=a[u],G=fn(R),Q=-1,X=G.length;++Q<X;){var ce=G[Q],ue=s[ce];(ue===r||si(ue,Pa[ce])&&!qt.call(s,ce))&&(s[ce]=R[ce])}return s}),DB=gt(function(s){return s.push(r,ab),Sr(Kb,r,s)});function CB(s,a){return ny(s,qe(a,3),Ti)}function OB(s,a){return ny(s,qe(a,3),Xd)}function MB(s,a){return s==null?s:Zd(s,qe(a,3),fn)}function PB(s,a){return s==null?s:Dy(s,qe(a,3),fn)}function $B(s,a){return s&&Ti(s,qe(a,3))}function TB(s,a){return s&&Xd(s,qe(a,3))}function NB(s){return s==null?[]:dh(s,Ir(s))}function RB(s){return s==null?[]:dh(s,fn(s))}function Pp(s,a,u){var y=s==null?r:Oo(s,a);return y===r?u:y}function LB(s,a){return s!=null&&ub(s,a,sN)}function $p(s,a){return s!=null&&ub(s,a,oN)}var BB=rb(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=eh.call(a)),s[a]=u},Np(dn)),UB=rb(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=eh.call(a)),qt.call(s,a)?s[a].push(u):s[a]=[u]},qe),FB=gt(Jc);function Ir(s){return hn(s)?by(s):np(s)}function fn(s){return hn(s)?by(s,!0):mN(s)}function jB(s,a){var u={};return a=qe(a,3),Ti(s,function(y,S,R){Zi(u,a(y,S,R),y)}),u}function kB(s,a){var u={};return a=qe(a,3),Ti(s,function(y,S,R){Zi(u,S,a(y,S,R))}),u}var qB=Ra(function(s,a,u){ph(s,a,u)}),Kb=Ra(function(s,a,u,y){ph(s,a,u,y)}),zB=es(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}),Ni(s,vp(s),u),y&&(u=zn(u,_|E|x,BN));for(var S=a.length;S--;)lp(u,a[S]);return u});function HB(s,a){return Wb(s,Oh(qe(a)))}var KB=es(function(s,a){return s==null?{}:wN(s,a)});function Wb(s,a){if(s==null)return{};var u=tr(vp(s),function(y){return[y]});return a=qe(a),By(s,u,function(y,S){return a(y,S[0])})}function WB(s,a,u){a=Rs(a,s);var y=-1,S=a.length;for(S||(S=1,s=r);++y<S;){var R=s==null?r:s[Ri(a[y])];R===r&&(y=S,R=u),s=rs(R)?R.call(s):R}return s}function VB(s,a,u){return s==null?s:Xc(s,a,u)}function GB(s,a,u,y){return y=typeof y=="function"?y:r,s==null?s:Xc(s,a,u,y)}var Vb=sb(Ir),Gb=sb(fn);function YB(s,a,u){var y=at(s),S=y||Bs(s)||Ua(s);if(a=qe(a,4),u==null){var R=s&&s.constructor;S?u=y?new R:[]:sr(s)?u=rs(R)?Na(nh(s)):{}:u={}}return(S?jn:Ti)(s,function(G,Q,X){return a(u,G,Q,X)}),u}function QB(s,a){return s==null?!0:lp(s,a)}function JB(s,a,u){return s==null?s:qy(s,a,fp(u))}function ZB(s,a,u,y){return y=typeof y=="function"?y:r,s==null?s:qy(s,a,fp(u),y)}function Fa(s){return s==null?[]:Hd(s,Ir(s))}function XB(s){return s==null?[]:Hd(s,fn(s))}function eU(s,a,u){return u===r&&(u=a,a=r),u!==r&&(u=Wn(u),u=u===u?u:0),a!==r&&(a=Wn(a),a=a===a?a:0),Co(Wn(s),a,u)}function tU(s,a,u){return a=ns(a),u===r?(u=a,a=0):u=ns(u),s=Wn(s),aN(s,a,u)}function rU(s,a,u){if(u&&typeof u!="boolean"&&Jr(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=ns(s),a===r?(a=s,s=0):a=ns(a)),s>a){var y=s;s=a,a=y}if(u||s%1||a%1){var S=wy();return Ur(s+S*(a-s+Vt("1e-"+((S+"").length-1))),a)}return op(s,a)}var nU=La(function(s,a,u){return a=a.toLowerCase(),s+(u?Yb(a):a)});function Yb(s){return Tp(Bt(s).toLowerCase())}function Qb(s){return s=Bt(s),s&&s.replace(xr,V$).replace(Rd,"")}function iU(s,a,u){s=Bt(s),a=En(a);var y=s.length;u=u===r?y:Co(ft(u),0,y);var S=u;return u-=a.length,u>=0&&s.slice(u,S)==a}function sU(s){return s=Bt(s),s&&He.test(s)?s.replace(Vr,G$):s}function oU(s){return s=Bt(s),s&&tt.test(s)?s.replace(Lt,"\\$&"):s}var aU=La(function(s,a,u){return s+(u?"-":"")+a.toLowerCase()}),cU=La(function(s,a,u){return s+(u?" ":"")+a.toLowerCase()}),lU=Xy("toLowerCase");function uU(s,a,u){s=Bt(s),a=ft(a);var y=a?Oa(s):0;if(!a||y>=a)return s;var S=(a-y)/2;return bh(ah(S),u)+s+bh(oh(S),u)}function hU(s,a,u){s=Bt(s),a=ft(a);var y=a?Oa(s):0;return a&&y<a?s+bh(a-y,u):s}function fU(s,a,u){s=Bt(s),a=ft(a);var y=a?Oa(s):0;return a&&y<a?bh(a-y,u)+s:s}function dU(s,a,u){return u||a==null?a=0:a&&(a=+a),bT(Bt(s).replace(Je,""),a||0)}function pU(s,a,u){return(u?Jr(s,a,u):a===r)?a=1:a=ft(a),ap(Bt(s),a)}function gU(){var s=arguments,a=Bt(s[0]);return s.length<3?a:a.replace(s[1],s[2])}var mU=La(function(s,a,u){return s+(u?"_":"")+a.toLowerCase()});function vU(s,a,u){return u&&typeof u!="number"&&Jr(s,a,u)&&(a=u=r),u=u===r?v:u>>>0,u?(s=Bt(s),s&&(typeof a=="string"||a!=null&&!Mp(a))&&(a=En(a),!a&&Ca(s))?Ls(ni(s),0,u):s.split(a,u)):[]}var wU=La(function(s,a,u){return s+(u?" ":"")+Tp(a)});function yU(s,a,u){return s=Bt(s),u=u==null?0:Co(ft(u),0,s.length),a=En(a),s.slice(u,u+a.length)==a}function bU(s,a,u){var y=P.templateSettings;u&&Jr(s,a,u)&&(a=r),s=Bt(s),a=$h({},a,y,ob);var S=$h({},a.imports,y.imports,ob),R=Ir(S),G=Hd(S,R),Q,X,ce=0,ue=a.interpolate||Ci,ge="__p += '",we=Wd((a.escape||Ci).source+"|"+ue.source+"|"+(ue===Ve?kt:Ci).source+"|"+(a.evaluate||Ci).source+"|$","g"),Le="//# sourceURL="+(qt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ld+"]")+`
|
|
53
|
-
`;s.replace(
|
|
54
|
-
__e(`+
|
|
55
|
-
'`),Zr&&(X=!0,
|
|
52
|
+
`)}function GT(s){return ae(s)||$o(s)||!!(wy&&s&&s[wy])}function ns(s,a){var u=typeof s;return a=a??N,!!a&&(u=="number"||u!="symbol"&&Un.test(s))&&s>-1&&s%1==0&&s<a}function Jr(s,a,u){if(!sr(u))return!1;var y=typeof a;return(y=="number"?hn(u)&&ns(a,u.length):y=="string"&&a in u)?si(u[a],s):!1}function Ep(s,a){if(ae(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||An(s)?!0:Xt.test(s)||!Me.test(s)||a!=null&&s in Qe(a)}function YT(s){var a=typeof s;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?s!=="__proto__":s===null}function Ap(s){var a=Ah(s),u=M[a];if(typeof u!="function"||!(a in Ae.prototype))return!1;if(s===u)return!0;var y=yp(u);return!!y&&s===y[0]}function QT(s){return!!py&&py in s}var JT=Xu?is:jp;function nl(s){var a=s&&s.constructor,u=typeof a=="function"&&a.prototype||Ma;return s===u}function pb(s){return s===s&&!sr(s)}function gb(s,a){return function(u){return u==null?!1:u[s]===a&&(a!==r||s in Qe(u))}}function ZT(s){var a=Oh(s,function(y){return u.size===h&&u.clear(),y}),u=a.cache;return a}function XT(s,a){var u=s[1],y=a[1],S=u|y,R=S<(W|Y|m),G=y==m&&u==z||y==m&&u==$&&s[7].length<=a[8]||y==(m|$)&&a[7].length<=a[8]&&u==z;if(!(R||G))return s;y&W&&(s[2]=a[2],S|=u&W?0:B);var Q=a[3];if(Q){var X=s[3];s[3]=X?Jy(X,Q,a[4]):Q,s[4]=X?Ms(s[3],g):a[4]}return Q=a[5],Q&&(X=s[5],s[5]=X?Zy(X,Q,a[6]):Q,s[6]=X?Ms(s[5],g):a[6]),Q=a[7],Q&&(s[7]=Q),y&m&&(s[8]=s[8]==null?a[8]:Ur(s[8],a[8])),s[9]==null&&(s[9]=a[9]),s[0]=a[0],s[1]=S,s}function tR(s){var a=[];if(s!=null)for(var u in Qe(s))a.push(u);return a}function eR(s){return eh.call(s)}function mb(s,a,u){return a=br(a===r?s.length-1:a,0),function(){for(var y=arguments,S=-1,R=br(y.length-a,0),G=st(R);++S<R;)G[S]=y[a+S];S=-1;for(var Q=st(a+1);++S<a;)Q[S]=y[S];return Q[a]=u(G),Ir(s,this,Q)}}function vb(s,a){return a.length<2?s:Oo(s,Hn(a,0,-1))}function rR(s,a){for(var u=s.length,y=Ur(a.length,u),S=un(s);y--;){var R=a[y];s[y]=ns(R,u)?S[R]:r}return s}function xp(s,a){if(!(a==="constructor"&&typeof s[a]=="function")&&a!="__proto__")return s[a]}var wb=bb(ky),il=vN||function(s,a){return Se.setTimeout(s,a)},Ip=bb(IT);function yb(s,a,u){var y=a+"";return Ip(s,VT(y,nR(HT(y),u)))}function bb(s){var a=0,u=0;return function(){var y=_N(),S=d-(y-u);if(u=y,S>0){if(++a>=dt)return arguments[0]}else a=0;return s.apply(r,arguments)}}function Ih(s,a){var u=-1,y=s.length,S=y-1;for(a=a===r?y:a;++u<a;){var R=ap(u,S),G=s[R];s[R]=s[u],s[u]=G}return s.length=a,s}var _b=ZT(function(s){var a=[];return s.charCodeAt(0)===46&&a.push(""),s.replace(te,function(u,y,S,R){a.push(S?R.replace(ei,"$1"):y||u)}),a});function Bi(s){if(typeof s=="string"||An(s))return s;var a=s+"";return a=="0"&&1/s==-O?"-0":a}function Mo(s){if(s!=null){try{return th.call(s)}catch{}try{return s+""}catch{}}return""}function nR(s,a){return jn(pt,function(u){var y="_."+u[0];a&u[1]&&!Yu(s,y)&&s.push(y)}),s.sort()}function Eb(s){if(s instanceof Ae)return s.clone();var a=new qn(s.__wrapped__,s.__chain__);return a.__actions__=un(s.__actions__),a.__index__=s.__index__,a.__values__=s.__values__,a}function iR(s,a,u){(u?Jr(s,a,u):a===r)?a=1:a=br(fe(a),0);var y=s==null?0:s.length;if(!y||a<1)return[];for(var S=0,R=0,G=st(ah(y/a));S<y;)G[R++]=Hn(s,S,S+=a);return G}function sR(s){for(var a=-1,u=s==null?0:s.length,y=0,S=[];++a<u;){var R=s[a];R&&(S[y++]=R)}return S}function oR(){var s=arguments.length;if(!s)return[];for(var a=st(s-1),u=arguments[0],y=s;y--;)a[y-1]=arguments[y];return Ps(ae(u)?un(u):[u],Tr(a,1))}var aR=ge(function(s,a){return dr(s)?Zc(s,Tr(a,1,dr,!0)):[]}),cR=ge(function(s,a){var u=Kn(a);return dr(u)&&(u=r),dr(s)?Zc(s,Tr(a,1,dr,!0),qt(u,2)):[]}),lR=ge(function(s,a){var u=Kn(a);return dr(u)&&(u=r),dr(s)?Zc(s,Tr(a,1,dr,!0),r,u):[]});function uR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:fe(a),Hn(s,a<0?0:a,y)):[]}function hR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:fe(a),a=y-a,Hn(s,0,a<0?0:a)):[]}function fR(s,a){return s&&s.length?vh(s,qt(a,3),!0,!0):[]}function dR(s,a){return s&&s.length?vh(s,qt(a,3),!0):[]}function pR(s,a,u,y){var S=s==null?0:s.length;return S?(u&&typeof u!="number"&&Jr(s,a,u)&&(u=0,y=S),oT(s,a,u,y)):[]}function Ab(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=u==null?0:fe(u);return S<0&&(S=br(y+S,0)),Qu(s,qt(a,3),S)}function xb(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=y-1;return u!==r&&(S=fe(u),S=u<0?br(y+S,0):Ur(S,y-1)),Qu(s,qt(a,3),S,!0)}function Ib(s){var a=s==null?0:s.length;return a?Tr(s,1):[]}function gR(s){var a=s==null?0:s.length;return a?Tr(s,O):[]}function mR(s,a){var u=s==null?0:s.length;return u?(a=a===r?1:fe(a),Tr(s,a)):[]}function vR(s){for(var a=-1,u=s==null?0:s.length,y={};++a<u;){var S=s[a];y[S[0]]=S[1]}return y}function Sb(s){return s&&s.length?s[0]:r}function wR(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=u==null?0:fe(u);return S<0&&(S=br(y+S,0)),Ca(s,a,S)}function yR(s){var a=s==null?0:s.length;return a?Hn(s,0,-1):[]}var bR=ge(function(s){var a=er(s,fp);return a.length&&a[0]===s[0]?rp(a):[]}),_R=ge(function(s){var a=Kn(s),u=er(s,fp);return a===Kn(u)?a=r:u.pop(),u.length&&u[0]===s[0]?rp(u,qt(a,2)):[]}),ER=ge(function(s){var a=Kn(s),u=er(s,fp);return a=typeof a=="function"?a:r,a&&u.pop(),u.length&&u[0]===s[0]?rp(u,r,a):[]});function AR(s,a){return s==null?"":yN.call(s,a)}function Kn(s){var a=s==null?0:s.length;return a?s[a-1]:r}function xR(s,a,u){var y=s==null?0:s.length;if(!y)return-1;var S=y;return u!==r&&(S=fe(u),S=S<0?br(y+S,0):Ur(S,y-1)),a===a?nN(s,a,S):Qu(s,oy,S,!0)}function IR(s,a){return s&&s.length?By(s,fe(a)):r}var SR=ge(Cb);function Cb(s,a){return s&&s.length&&a&&a.length?op(s,a):s}function CR(s,a,u){return s&&s.length&&a&&a.length?op(s,a,qt(u,2)):s}function DR(s,a,u){return s&&s.length&&a&&a.length?op(s,a,r,u):s}var OR=rs(function(s,a){var u=s==null?0:s.length,y=Zd(s,a);return jy(s,er(a,function(S){return ns(S,u)?+S:S}).sort(Qy)),y});function PR(s,a){var u=[];if(!(s&&s.length))return u;var y=-1,S=[],R=s.length;for(a=qt(a,3);++y<R;){var G=s[y];a(G,y,s)&&(u.push(G),S.push(y))}return jy(s,S),u}function Sp(s){return s==null?s:AN.call(s)}function MR(s,a,u){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&Jr(s,a,u)?(a=0,u=y):(a=a==null?0:fe(a),u=u===r?y:fe(u)),Hn(s,a,u)):[]}function $R(s,a){return mh(s,a)}function NR(s,a,u){return lp(s,a,qt(u,2))}function TR(s,a){var u=s==null?0:s.length;if(u){var y=mh(s,a);if(y<u&&si(s[y],a))return y}return-1}function RR(s,a){return mh(s,a,!0)}function LR(s,a,u){return lp(s,a,qt(u,2),!0)}function BR(s,a){var u=s==null?0:s.length;if(u){var y=mh(s,a,!0)-1;if(si(s[y],a))return y}return-1}function UR(s){return s&&s.length?qy(s):[]}function FR(s,a){return s&&s.length?qy(s,qt(a,2)):[]}function jR(s){var a=s==null?0:s.length;return a?Hn(s,1,a):[]}function kR(s,a,u){return s&&s.length?(a=u||a===r?1:fe(a),Hn(s,0,a<0?0:a)):[]}function qR(s,a,u){var y=s==null?0:s.length;return y?(a=u||a===r?1:fe(a),a=y-a,Hn(s,a<0?0:a,y)):[]}function zR(s,a){return s&&s.length?vh(s,qt(a,3),!1,!0):[]}function HR(s,a){return s&&s.length?vh(s,qt(a,3)):[]}var KR=ge(function(s){return Ts(Tr(s,1,dr,!0))}),WR=ge(function(s){var a=Kn(s);return dr(a)&&(a=r),Ts(Tr(s,1,dr,!0),qt(a,2))}),VR=ge(function(s){var a=Kn(s);return a=typeof a=="function"?a:r,Ts(Tr(s,1,dr,!0),r,a)});function GR(s){return s&&s.length?Ts(s):[]}function YR(s,a){return s&&s.length?Ts(s,qt(a,2)):[]}function QR(s,a){return a=typeof a=="function"?a:r,s&&s.length?Ts(s,r,a):[]}function Cp(s){if(!(s&&s.length))return[];var a=0;return s=Os(s,function(u){if(dr(u))return a=br(u.length,a),!0}),Hd(a,function(u){return er(s,kd(u))})}function Db(s,a){if(!(s&&s.length))return[];var u=Cp(s);return a==null?u:er(u,function(y){return Ir(a,r,y)})}var JR=ge(function(s,a){return dr(s)?Zc(s,a):[]}),ZR=ge(function(s){return hp(Os(s,dr))}),XR=ge(function(s){var a=Kn(s);return dr(a)&&(a=r),hp(Os(s,dr),qt(a,2))}),tL=ge(function(s){var a=Kn(s);return a=typeof a=="function"?a:r,hp(Os(s,dr),r,a)}),eL=ge(Cp);function rL(s,a){return Wy(s||[],a||[],Jc)}function nL(s,a){return Wy(s||[],a||[],el)}var iL=ge(function(s){var a=s.length,u=a>1?s[a-1]:r;return u=typeof u=="function"?(s.pop(),u):r,Db(s,u)});function Ob(s){var a=M(s);return a.__chain__=!0,a}function sL(s,a){return a(s),s}function Sh(s,a){return a(s)}var oL=rs(function(s){var a=s.length,u=a?s[0]:0,y=this.__wrapped__,S=function(R){return Zd(R,s)};return a>1||this.__actions__.length||!(y instanceof Ae)||!ns(u)?this.thru(S):(y=y.slice(u,+u+(a?1:0)),y.__actions__.push({func:Sh,args:[S],thisArg:r}),new qn(y,this.__chain__).thru(function(R){return a&&!R.length&&R.push(r),R}))});function aL(){return Ob(this)}function cL(){return new qn(this.value(),this.__chain__)}function lL(){this.__values__===r&&(this.__values__=zb(this.value()));var s=this.__index__>=this.__values__.length,a=s?r:this.__values__[this.__index__++];return{done:s,value:a}}function uL(){return this}function hL(s){for(var a,u=this;u instanceof hh;){var y=Eb(u);y.__index__=0,y.__values__=r,a?S.__wrapped__=y:a=y;var S=y;u=u.__wrapped__}return S.__wrapped__=s,a}function fL(){var s=this.__wrapped__;if(s instanceof Ae){var a=s;return this.__actions__.length&&(a=new Ae(this)),a=a.reverse(),a.__actions__.push({func:Sh,args:[Sp],thisArg:r}),new qn(a,this.__chain__)}return this.thru(Sp)}function dL(){return Ky(this.__wrapped__,this.__actions__)}var pL=wh(function(s,a,u){qe.call(s,u)?++s[u]:ts(s,u,1)});function gL(s,a,u){var y=ae(s)?iy:sT;return u&&Jr(s,a,u)&&(a=r),y(s,qt(a,3))}function mL(s,a){var u=ae(s)?Os:Dy;return u(s,qt(a,3))}var vL=rb(Ab),wL=rb(xb);function yL(s,a){return Tr(Ch(s,a),1)}function bL(s,a){return Tr(Ch(s,a),O)}function _L(s,a,u){return u=u===r?1:fe(u),Tr(Ch(s,a),u)}function Pb(s,a){var u=ae(s)?jn:Ns;return u(s,qt(a,3))}function Mb(s,a){var u=ae(s)?j$:Cy;return u(s,qt(a,3))}var EL=wh(function(s,a,u){qe.call(s,u)?s[u].push(a):ts(s,u,[a])});function AL(s,a,u,y){s=hn(s)?s:Fa(s),u=u&&!y?fe(u):0;var S=s.length;return u<0&&(u=br(S+u,0)),$h(s)?u<=S&&s.indexOf(a,u)>-1:!!S&&Ca(s,a,u)>-1}var xL=ge(function(s,a,u){var y=-1,S=typeof a=="function",R=hn(s)?st(s.length):[];return Ns(s,function(G){R[++y]=S?Ir(a,G,u):Xc(G,a,u)}),R}),IL=wh(function(s,a,u){ts(s,u,a)});function Ch(s,a){var u=ae(s)?er:Ty;return u(s,qt(a,3))}function SL(s,a,u,y){return s==null?[]:(ae(a)||(a=a==null?[]:[a]),u=y?r:u,ae(u)||(u=u==null?[]:[u]),Uy(s,a,u))}var CL=wh(function(s,a,u){s[u?0:1].push(a)},function(){return[[],[]]});function DL(s,a,u){var y=ae(s)?Fd:cy,S=arguments.length<3;return y(s,qt(a,4),u,S,Ns)}function OL(s,a,u){var y=ae(s)?k$:cy,S=arguments.length<3;return y(s,qt(a,4),u,S,Cy)}function PL(s,a){var u=ae(s)?Os:Dy;return u(s,Ph(qt(a,3)))}function ML(s){var a=ae(s)?Ay:AT;return a(s)}function $L(s,a,u){(u?Jr(s,a,u):a===r)?a=1:a=fe(a);var y=ae(s)?tT:xT;return y(s,a)}function NL(s){var a=ae(s)?eT:ST;return a(s)}function TL(s){if(s==null)return 0;if(hn(s))return $h(s)?Oa(s):s.length;var a=Fr(s);return a==lt||a==Ft?s.size:ip(s).length}function RL(s,a,u){var y=ae(s)?jd:CT;return u&&Jr(s,a,u)&&(a=r),y(s,qt(a,3))}var LL=ge(function(s,a){if(s==null)return[];var u=a.length;return u>1&&Jr(s,a[0],a[1])?a=[]:u>2&&Jr(a[0],a[1],a[2])&&(a=[a[0]]),Uy(s,Tr(a,1),[])}),Dh=mN||function(){return Se.Date.now()};function BL(s,a){if(typeof a!="function")throw new kn(c);return s=fe(s),function(){if(--s<1)return a.apply(this,arguments)}}function $b(s,a,u){return a=u?r:a,a=s&&a==null?s.length:a,es(s,m,r,r,r,r,a)}function Nb(s,a){var u;if(typeof a!="function")throw new kn(c);return s=fe(s),function(){return--s>0&&(u=a.apply(this,arguments)),s<=1&&(a=r),u}}var Dp=ge(function(s,a,u){var y=W;if(u.length){var S=Ms(u,Ba(Dp));y|=U}return es(s,y,a,u,S)}),Tb=ge(function(s,a,u){var y=W|Y;if(u.length){var S=Ms(u,Ba(Tb));y|=U}return es(a,y,s,u,S)});function Rb(s,a,u){a=u?r:a;var y=es(s,z,r,r,r,r,r,a);return y.placeholder=Rb.placeholder,y}function Lb(s,a,u){a=u?r:a;var y=es(s,P,r,r,r,r,r,a);return y.placeholder=Lb.placeholder,y}function Bb(s,a,u){var y,S,R,G,Q,X,ct=0,ut=!1,gt=!1,wt=!0;if(typeof s!="function")throw new kn(c);a=Wn(a)||0,sr(u)&&(ut=!!u.leading,gt="maxWait"in u,R=gt?br(Wn(u.maxWait)||0,a):R,wt="trailing"in u?!!u.trailing:wt);function Lt(pr){var oi=y,os=S;return y=S=r,ct=pr,G=s.apply(os,oi),G}function Kt(pr){return ct=pr,Q=il(ye,a),ut?Lt(pr):G}function pe(pr){var oi=pr-X,os=pr-ct,r3=a-oi;return gt?Ur(r3,R-os):r3}function Wt(pr){var oi=pr-X,os=pr-ct;return X===r||oi>=a||oi<0||gt&&os>=R}function ye(){var pr=Dh();if(Wt(pr))return Ce(pr);Q=il(ye,pe(pr))}function Ce(pr){return Q=r,wt&&y?Lt(pr):(y=S=r,G)}function xn(){Q!==r&&Vy(Q),ct=0,y=X=S=Q=r}function Zr(){return Q===r?G:Ce(Dh())}function In(){var pr=Dh(),oi=Wt(pr);if(y=arguments,S=this,X=pr,oi){if(Q===r)return Kt(X);if(gt)return Vy(Q),Q=il(ye,a),Lt(X)}return Q===r&&(Q=il(ye,a)),G}return In.cancel=xn,In.flush=Zr,In}var UL=ge(function(s,a){return Sy(s,1,a)}),FL=ge(function(s,a,u){return Sy(s,Wn(a)||0,u)});function jL(s){return es(s,et)}function Oh(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new kn(c);var u=function(){var y=arguments,S=a?a.apply(this,y):y[0],R=u.cache;if(R.has(S))return R.get(S);var G=s.apply(this,y);return u.cache=R.set(S,G)||R,G};return u.cache=new(Oh.Cache||Xi),u}Oh.Cache=Xi;function Ph(s){if(typeof s!="function")throw new kn(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 kL(s){return Nb(2,s)}var qL=DT(function(s,a){a=a.length==1&&ae(a[0])?er(a[0],_n(qt())):er(Tr(a,1),_n(qt()));var u=a.length;return ge(function(y){for(var S=-1,R=Ur(y.length,u);++S<R;)y[S]=a[S].call(this,y[S]);return Ir(s,this,y)})}),Op=ge(function(s,a){var u=Ms(a,Ba(Op));return es(s,U,r,a,u)}),Ub=ge(function(s,a){var u=Ms(a,Ba(Ub));return es(s,j,r,a,u)}),zL=rs(function(s,a){return es(s,$,r,r,r,a)});function HL(s,a){if(typeof s!="function")throw new kn(c);return a=a===r?a:fe(a),ge(s,a)}function KL(s,a){if(typeof s!="function")throw new kn(c);return a=a==null?0:br(fe(a),0),ge(function(u){var y=u[a],S=Ls(u,0,a);return y&&Ps(S,y),Ir(s,this,S)})}function WL(s,a,u){var y=!0,S=!0;if(typeof s!="function")throw new kn(c);return sr(u)&&(y="leading"in u?!!u.leading:y,S="trailing"in u?!!u.trailing:S),Bb(s,a,{leading:y,maxWait:a,trailing:S})}function VL(s){return $b(s,1)}function GL(s,a){return Op(dp(a),s)}function YL(){if(!arguments.length)return[];var s=arguments[0];return ae(s)?s:[s]}function QL(s){return zn(s,x)}function JL(s,a){return a=typeof a=="function"?a:r,zn(s,x,a)}function ZL(s){return zn(s,_|x)}function XL(s,a){return a=typeof a=="function"?a:r,zn(s,_|x,a)}function tB(s,a){return a==null||Iy(s,a,Sr(a))}function si(s,a){return s===a||s!==s&&a!==a}var eB=Eh(ep),rB=Eh(function(s,a){return s>=a}),$o=My(function(){return arguments}())?My:function(s){return cr(s)&&qe.call(s,"callee")&&!vy.call(s,"callee")},ae=st.isArray,nB=Yr?_n(Yr):hT;function hn(s){return s!=null&&Mh(s.length)&&!is(s)}function dr(s){return cr(s)&&hn(s)}function iB(s){return s===!0||s===!1||cr(s)&&Qr(s)==H}var Bs=wN||jp,sB=ri?_n(ri):fT;function oB(s){return cr(s)&&s.nodeType===1&&!sl(s)}function aB(s){if(s==null)return!0;if(hn(s)&&(ae(s)||typeof s=="string"||typeof s.splice=="function"||Bs(s)||Ua(s)||$o(s)))return!s.length;var a=Fr(s);if(a==lt||a==Ft)return!s.size;if(nl(s))return!ip(s).length;for(var u in s)if(qe.call(s,u))return!1;return!0}function cB(s,a){return tl(s,a)}function lB(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 Pp(s){if(!cr(s))return!1;var a=Qr(s);return a==k||a==w||typeof s.message=="string"&&typeof s.name=="string"&&!sl(s)}function uB(s){return typeof s=="number"&&yy(s)}function is(s){if(!sr(s))return!1;var a=Qr(s);return a==it||a==ht||a==q||a==zt}function Fb(s){return typeof s=="number"&&s==fe(s)}function Mh(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=N}function sr(s){var a=typeof s;return s!=null&&(a=="object"||a=="function")}function cr(s){return s!=null&&typeof s=="object"}var jb=Fn?_n(Fn):pT;function hB(s,a){return s===a||np(s,a,bp(a))}function fB(s,a,u){return u=typeof u=="function"?u:r,np(s,a,bp(a),u)}function dB(s){return kb(s)&&s!=+s}function pB(s){if(JT(s))throw new ie(o);return $y(s)}function gB(s){return s===null}function mB(s){return s==null}function kb(s){return typeof s=="number"||cr(s)&&Qr(s)==Ot}function sl(s){if(!cr(s)||Qr(s)!=St)return!1;var a=ih(s);if(a===null)return!0;var u=qe.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&th.call(u)==fN}var Mp=Ti?_n(Ti):gT;function vB(s){return Fb(s)&&s>=-N&&s<=N}var qb=Hc?_n(Hc):mT;function $h(s){return typeof s=="string"||!ae(s)&&cr(s)&&Qr(s)==Et}function An(s){return typeof s=="symbol"||cr(s)&&Qr(s)==At}var Ua=xo?_n(xo):vT;function wB(s){return s===r}function yB(s){return cr(s)&&Fr(s)==bt}function bB(s){return cr(s)&&Qr(s)==xt}var _B=Eh(sp),EB=Eh(function(s,a){return s<=a});function zb(s){if(!s)return[];if(hn(s))return $h(s)?ni(s):un(s);if(Wc&&s[Wc])return tN(s[Wc]());var a=Fr(s),u=a==lt?Wd:a==Ft?Ju:Fa;return u(s)}function ss(s){if(!s)return s===0?s:0;if(s=Wn(s),s===O||s===-O){var a=s<0?-1:1;return a*L}return s===s?s:0}function fe(s){var a=ss(s),u=a%1;return a===a?u?a-u:a:0}function Hb(s){return s?Do(fe(s),0,v):0}function Wn(s){if(typeof s=="number")return s;if(An(s))return D;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=ly(s);var u=Rn.test(s);return u||Bn.test(s)?oe(s.slice(2),u?2:8):Tn.test(s)?D:+s}function Kb(s){return Li(s,fn(s))}function AB(s){return s?Do(fe(s),-N,N):s===0?s:0}function Be(s){return s==null?"":En(s)}var xB=Ra(function(s,a){if(nl(a)||hn(a)){Li(a,Sr(a),s);return}for(var u in a)qe.call(a,u)&&Jc(s,u,a[u])}),Wb=Ra(function(s,a){Li(a,fn(a),s)}),Nh=Ra(function(s,a,u,y){Li(a,fn(a),s,y)}),IB=Ra(function(s,a,u,y){Li(a,Sr(a),s,y)}),SB=rs(Zd);function CB(s,a){var u=Ta(s);return a==null?u:xy(u,a)}var DB=ge(function(s,a){s=Qe(s);var u=-1,y=a.length,S=y>2?a[2]:r;for(S&&Jr(a[0],a[1],S)&&(y=1);++u<y;)for(var R=a[u],G=fn(R),Q=-1,X=G.length;++Q<X;){var ct=G[Q],ut=s[ct];(ut===r||si(ut,Ma[ct])&&!qe.call(s,ct))&&(s[ct]=R[ct])}return s}),OB=ge(function(s){return s.push(r,lb),Ir(Vb,r,s)});function PB(s,a){return sy(s,qt(a,3),Ri)}function MB(s,a){return sy(s,qt(a,3),tp)}function $B(s,a){return s==null?s:Xd(s,qt(a,3),fn)}function NB(s,a){return s==null?s:Oy(s,qt(a,3),fn)}function TB(s,a){return s&&Ri(s,qt(a,3))}function RB(s,a){return s&&tp(s,qt(a,3))}function LB(s){return s==null?[]:ph(s,Sr(s))}function BB(s){return s==null?[]:ph(s,fn(s))}function $p(s,a,u){var y=s==null?r:Oo(s,a);return y===r?u:y}function UB(s,a){return s!=null&&fb(s,a,aT)}function Np(s,a){return s!=null&&fb(s,a,cT)}var FB=ib(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=eh.call(a)),s[a]=u},Rp(dn)),jB=ib(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=eh.call(a)),qe.call(s,a)?s[a].push(u):s[a]=[u]},qt),kB=ge(Xc);function Sr(s){return hn(s)?Ey(s):ip(s)}function fn(s){return hn(s)?Ey(s,!0):wT(s)}function qB(s,a){var u={};return a=qt(a,3),Ri(s,function(y,S,R){ts(u,a(y,S,R),y)}),u}function zB(s,a){var u={};return a=qt(a,3),Ri(s,function(y,S,R){ts(u,S,a(y,S,R))}),u}var HB=Ra(function(s,a,u){gh(s,a,u)}),Vb=Ra(function(s,a,u,y){gh(s,a,u,y)}),KB=rs(function(s,a){var u={};if(s==null)return u;var y=!1;a=er(a,function(R){return R=Rs(R,s),y||(y=R.length>1),R}),Li(s,wp(s),u),y&&(u=zn(u,_|E|x,FT));for(var S=a.length;S--;)up(u,a[S]);return u});function WB(s,a){return Gb(s,Ph(qt(a)))}var VB=rs(function(s,a){return s==null?{}:bT(s,a)});function Gb(s,a){if(s==null)return{};var u=er(wp(s),function(y){return[y]});return a=qt(a),Fy(s,u,function(y,S){return a(y,S[0])})}function GB(s,a,u){a=Rs(a,s);var y=-1,S=a.length;for(S||(S=1,s=r);++y<S;){var R=s==null?r:s[Bi(a[y])];R===r&&(y=S,R=u),s=is(R)?R.call(s):R}return s}function YB(s,a,u){return s==null?s:el(s,a,u)}function QB(s,a,u,y){return y=typeof y=="function"?y:r,s==null?s:el(s,a,u,y)}var Yb=ab(Sr),Qb=ab(fn);function JB(s,a,u){var y=ae(s),S=y||Bs(s)||Ua(s);if(a=qt(a,4),u==null){var R=s&&s.constructor;S?u=y?new R:[]:sr(s)?u=is(R)?Ta(ih(s)):{}:u={}}return(S?jn:Ri)(s,function(G,Q,X){return a(u,G,Q,X)}),u}function ZB(s,a){return s==null?!0:up(s,a)}function XB(s,a,u){return s==null?s:Hy(s,a,dp(u))}function tU(s,a,u,y){return y=typeof y=="function"?y:r,s==null?s:Hy(s,a,dp(u),y)}function Fa(s){return s==null?[]:Kd(s,Sr(s))}function eU(s){return s==null?[]:Kd(s,fn(s))}function rU(s,a,u){return u===r&&(u=a,a=r),u!==r&&(u=Wn(u),u=u===u?u:0),a!==r&&(a=Wn(a),a=a===a?a:0),Do(Wn(s),a,u)}function nU(s,a,u){return a=ss(a),u===r?(u=a,a=0):u=ss(u),s=Wn(s),lT(s,a,u)}function iU(s,a,u){if(u&&typeof u!="boolean"&&Jr(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=ss(s),a===r?(a=s,s=0):a=ss(a)),s>a){var y=s;s=a,a=y}if(u||s%1||a%1){var S=by();return Ur(s+S*(a-s+Ge("1e-"+((S+"").length-1))),a)}return ap(s,a)}var sU=La(function(s,a,u){return a=a.toLowerCase(),s+(u?Jb(a):a)});function Jb(s){return Tp(Be(s).toLowerCase())}function Zb(s){return s=Be(s),s&&s.replace(xr,Y$).replace(Ld,"")}function oU(s,a,u){s=Be(s),a=En(a);var y=s.length;u=u===r?y:Do(fe(u),0,y);var S=u;return u-=a.length,u>=0&&s.slice(u,S)==a}function aU(s){return s=Be(s),s&&Ht.test(s)?s.replace(Vr,Q$):s}function cU(s){return s=Be(s),s&&ee.test(s)?s.replace(Le,"\\$&"):s}var lU=La(function(s,a,u){return s+(u?"-":"")+a.toLowerCase()}),uU=La(function(s,a,u){return s+(u?" ":"")+a.toLowerCase()}),hU=eb("toLowerCase");function fU(s,a,u){s=Be(s),a=fe(a);var y=a?Oa(s):0;if(!a||y>=a)return s;var S=(a-y)/2;return _h(ch(S),u)+s+_h(ah(S),u)}function dU(s,a,u){s=Be(s),a=fe(a);var y=a?Oa(s):0;return a&&y<a?s+_h(a-y,u):s}function pU(s,a,u){s=Be(s),a=fe(a);var y=a?Oa(s):0;return a&&y<a?_h(a-y,u)+s:s}function gU(s,a,u){return u||a==null?a=0:a&&(a=+a),EN(Be(s).replace(Jt,""),a||0)}function mU(s,a,u){return(u?Jr(s,a,u):a===r)?a=1:a=fe(a),cp(Be(s),a)}function vU(){var s=arguments,a=Be(s[0]);return s.length<3?a:a.replace(s[1],s[2])}var wU=La(function(s,a,u){return s+(u?"_":"")+a.toLowerCase()});function yU(s,a,u){return u&&typeof u!="number"&&Jr(s,a,u)&&(a=u=r),u=u===r?v:u>>>0,u?(s=Be(s),s&&(typeof a=="string"||a!=null&&!Mp(a))&&(a=En(a),!a&&Da(s))?Ls(ni(s),0,u):s.split(a,u)):[]}var bU=La(function(s,a,u){return s+(u?" ":"")+Tp(a)});function _U(s,a,u){return s=Be(s),u=u==null?0:Do(fe(u),0,s.length),a=En(a),s.slice(u,u+a.length)==a}function EU(s,a,u){var y=M.templateSettings;u&&Jr(s,a,u)&&(a=r),s=Be(s),a=Nh({},a,y,cb);var S=Nh({},a.imports,y.imports,cb),R=Sr(S),G=Kd(S,R),Q,X,ct=0,ut=a.interpolate||Pi,gt="__p += '",wt=Vd((a.escape||Pi).source+"|"+ut.source+"|"+(ut===Vt?ke:Pi).source+"|"+(a.evaluate||Pi).source+"|$","g"),Lt="//# sourceURL="+(qe.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Bd+"]")+`
|
|
53
|
+
`;s.replace(wt,function(Wt,ye,Ce,xn,Zr,In){return Ce||(Ce=xn),gt+=s.slice(ct,In).replace(fo,J$),ye&&(Q=!0,gt+=`' +
|
|
54
|
+
__e(`+ye+`) +
|
|
55
|
+
'`),Zr&&(X=!0,gt+=`';
|
|
56
56
|
`+Zr+`;
|
|
57
|
-
__p += '`),
|
|
58
|
-
((__t = (`+
|
|
59
|
-
'`),
|
|
60
|
-
`;var
|
|
61
|
-
`+
|
|
57
|
+
__p += '`),Ce&&(gt+=`' +
|
|
58
|
+
((__t = (`+Ce+`)) == null ? '' : __t) +
|
|
59
|
+
'`),ct=In+Wt.length,Wt}),gt+=`';
|
|
60
|
+
`;var Kt=qe.call(a,"variable")&&a.variable;if(!Kt)gt=`with (obj) {
|
|
61
|
+
`+gt+`
|
|
62
62
|
}
|
|
63
|
-
`;else if(
|
|
64
|
-
`+(
|
|
63
|
+
`;else if(je.test(Kt))throw new ie(l);gt=(X?gt.replace(Ee,""):gt).replace(ir,"$1").replace(Ie,"$1;"),gt="function("+(Kt||"obj")+`) {
|
|
64
|
+
`+(Kt?"":`obj || (obj = {});
|
|
65
65
|
`)+"var __t, __p = ''"+(Q?", __e = _.escape":"")+(X?`, __j = Array.prototype.join;
|
|
66
66
|
function print() { __p += __j.call(arguments, '') }
|
|
67
67
|
`:`;
|
|
68
|
-
`)+
|
|
69
|
-
}`;var pt=Zb(function(){return Tt(R,Le+"return "+ge).apply(r,G)});if(pt.source=ge,Op(pt))throw pt;return pt}function _U(s){return Bt(s).toLowerCase()}function EU(s){return Bt(s).toUpperCase()}function AU(s,a,u){if(s=Bt(s),s&&(u||a===r))return ay(s);if(!s||!(a=En(a)))return s;var y=ni(s),S=ni(a),R=cy(y,S),G=ly(y,S)+1;return Ls(y,R,G).join("")}function xU(s,a,u){if(s=Bt(s),s&&(u||a===r))return s.slice(0,hy(s)+1);if(!s||!(a=En(a)))return s;var y=ni(s),S=ly(y,ni(a))+1;return Ls(y,0,S).join("")}function SU(s,a,u){if(s=Bt(s),s&&(u||a===r))return s.replace(Je,"");if(!s||!(a=En(a)))return s;var y=ni(s),S=cy(y,ni(a));return Ls(y,S).join("")}function IU(s,a){var u=ee,y=ne;if(sr(a)){var S="separator"in a?a.separator:S;u="length"in a?ft(a.length):u,y="omission"in a?En(a.omission):y}s=Bt(s);var R=s.length;if(Ca(s)){var G=ni(s);R=G.length}if(u>=R)return s;var Q=u-Oa(y);if(Q<1)return y;var X=G?Ls(G,0,Q).join(""):s.slice(0,Q);if(S===r)return X+y;if(G&&(Q+=X.length-Q),Mp(S)){if(s.slice(Q).search(S)){var ce,ue=X;for(S.global||(S=Wd(S.source,Bt(vt.exec(S))+"g")),S.lastIndex=0;ce=S.exec(ue);)var ge=ce.index;X=X.slice(0,ge===r?Q:ge)}}else if(s.indexOf(En(S),Q)!=Q){var we=X.lastIndexOf(S);we>-1&&(X=X.slice(0,we))}return X+y}function DU(s){return s=Bt(s),s&&Ye.test(s)?s.replace(Ot,rT):s}var CU=La(function(s,a,u){return s+(u?" ":"")+a.toUpperCase()}),Tp=Xy("toUpperCase");function Jb(s,a,u){return s=Bt(s),a=u?r:a,a===r?J$(s)?sT(s):q$(s):s.match(a)||[]}var Zb=gt(function(s,a){try{return Sr(s,r,a)}catch(u){return Op(u)?u:new it(u)}}),OU=es(function(s,a){return jn(a,function(u){u=Ri(u),Zi(s,u,Dp(s[u],s))}),s});function MU(s){var a=s==null?0:s.length,u=qe();return s=a?tr(s,function(y){if(typeof y[1]!="function")throw new kn(c);return[u(y[0]),y[1]]}):[],gt(function(y){for(var S=-1;++S<a;){var R=s[S];if(Sr(R[0],this,y))return Sr(R[1],this,y)}})}function PU(s){return rN(zn(s,_))}function Np(s){return function(){return s}}function $U(s,a){return s==null||s!==s?a:s}var TU=tb(),NU=tb(!0);function dn(s){return s}function Rp(s){return Py(typeof s=="function"?s:zn(s,_))}function RU(s){return Ty(zn(s,_))}function LU(s,a){return Ny(s,zn(a,_))}var BU=gt(function(s,a){return function(u){return Jc(u,s,a)}}),UU=gt(function(s,a){return function(u){return Jc(s,u,a)}});function Lp(s,a,u){var y=Ir(a),S=dh(a,y);u==null&&!(sr(a)&&(S.length||!y.length))&&(u=a,a=s,s=this,S=dh(a,Ir(a)));var R=!(sr(u)&&"chain"in u)||!!u.chain,G=rs(s);return jn(S,function(Q){var X=a[Q];s[Q]=X,G&&(s.prototype[Q]=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,Ms([this.value()],arguments))})}),s}function FU(){return It._===this&&(It._=hT),this}function Bp(){}function jU(s){return s=ft(s),gt(function(a){return Ry(a,s)})}var kU=pp(tr),qU=pp(ry),zU=pp(Fd);function Xb(s){return _p(s)?jd(Ri(s)):yN(s)}function HU(s){return function(a){return s==null?r:Oo(s,a)}}var KU=nb(),WU=nb(!0);function Up(){return[]}function Fp(){return!1}function VU(){return{}}function GU(){return""}function YU(){return!0}function QU(s,a){if(s=ft(s),s<1||s>T)return[];var u=v,y=Ur(s,v);a=qe(a),s-=v;for(var S=zd(y,a);++u<s;)a(u);return S}function JU(s){return at(s)?tr(s,Ri):An(s)?[s]:un(yb(Bt(s)))}function ZU(s){var a=++lT;return Bt(s)+a}var XU=yh(function(s,a){return s+a},0),eF=gp("ceil"),tF=yh(function(s,a){return s/a},1),rF=gp("floor");function nF(s){return s&&s.length?fh(s,dn,ep):r}function iF(s,a){return s&&s.length?fh(s,qe(a,2),ep):r}function sF(s){return sy(s,dn)}function oF(s,a){return sy(s,qe(a,2))}function aF(s){return s&&s.length?fh(s,dn,ip):r}function cF(s,a){return s&&s.length?fh(s,qe(a,2),ip):r}var lF=yh(function(s,a){return s*a},1),uF=gp("round"),hF=yh(function(s,a){return s-a},0);function fF(s){return s&&s.length?qd(s,dn):0}function dF(s,a){return s&&s.length?qd(s,qe(a,2)):0}return P.after=RL,P.ary=Mb,P.assign=EB,P.assignIn=Hb,P.assignInWith=$h,P.assignWith=AB,P.at=xB,P.before=Pb,P.bind=Dp,P.bindAll=OU,P.bindKey=$b,P.castArray=VL,P.chain=Db,P.chunk=rR,P.compact=nR,P.concat=iR,P.cond=MU,P.conforms=PU,P.constant=Np,P.countBy=fL,P.create=SB,P.curry=Tb,P.curryRight=Nb,P.debounce=Rb,P.defaults=IB,P.defaultsDeep=DB,P.defer=LL,P.delay=BL,P.difference=sR,P.differenceBy=oR,P.differenceWith=aR,P.drop=cR,P.dropRight=lR,P.dropRightWhile=uR,P.dropWhile=hR,P.fill=fR,P.filter=pL,P.flatMap=vL,P.flatMapDeep=wL,P.flatMapDepth=yL,P.flatten=Ab,P.flattenDeep=dR,P.flattenDepth=pR,P.flip=UL,P.flow=TU,P.flowRight=NU,P.fromPairs=gR,P.functions=NB,P.functionsIn=RB,P.groupBy=bL,P.initial=vR,P.intersection=wR,P.intersectionBy=yR,P.intersectionWith=bR,P.invert=BB,P.invertBy=UB,P.invokeMap=EL,P.iteratee=Rp,P.keyBy=AL,P.keys=Ir,P.keysIn=fn,P.map=Ih,P.mapKeys=jB,P.mapValues=kB,P.matches=RU,P.matchesProperty=LU,P.memoize=Ch,P.merge=qB,P.mergeWith=Kb,P.method=BU,P.methodOf=UU,P.mixin=Lp,P.negate=Oh,P.nthArg=jU,P.omit=zB,P.omitBy=HB,P.once=FL,P.orderBy=xL,P.over=kU,P.overArgs=jL,P.overEvery=qU,P.overSome=zU,P.partial=Cp,P.partialRight=Lb,P.partition=SL,P.pick=KB,P.pickBy=Wb,P.property=Xb,P.propertyOf=HU,P.pull=xR,P.pullAll=Sb,P.pullAllBy=SR,P.pullAllWith=IR,P.pullAt=DR,P.range=KU,P.rangeRight=WU,P.rearg=kL,P.reject=CL,P.remove=CR,P.rest=qL,P.reverse=Sp,P.sampleSize=ML,P.set=VB,P.setWith=GB,P.shuffle=PL,P.slice=OR,P.sortBy=NL,P.sortedUniq=LR,P.sortedUniqBy=BR,P.split=vU,P.spread=zL,P.tail=UR,P.take=FR,P.takeRight=jR,P.takeRightWhile=kR,P.takeWhile=qR,P.tap=nL,P.throttle=HL,P.thru=Sh,P.toArray=kb,P.toPairs=Vb,P.toPairsIn=Gb,P.toPath=JU,P.toPlainObject=zb,P.transform=YB,P.unary=KL,P.union=zR,P.unionBy=HR,P.unionWith=KR,P.uniq=WR,P.uniqBy=VR,P.uniqWith=GR,P.unset=QB,P.unzip=Ip,P.unzipWith=Ib,P.update=JB,P.updateWith=ZB,P.values=Fa,P.valuesIn=XB,P.without=YR,P.words=Jb,P.wrap=WL,P.xor=QR,P.xorBy=JR,P.xorWith=ZR,P.zip=XR,P.zipObject=eL,P.zipObjectDeep=tL,P.zipWith=rL,P.entries=Vb,P.entriesIn=Gb,P.extend=Hb,P.extendWith=$h,Lp(P,P),P.add=XU,P.attempt=Zb,P.camelCase=nU,P.capitalize=Yb,P.ceil=eF,P.clamp=eU,P.clone=GL,P.cloneDeep=QL,P.cloneDeepWith=JL,P.cloneWith=YL,P.conformsTo=ZL,P.deburr=Qb,P.defaultTo=$U,P.divide=tF,P.endsWith=iU,P.eq=si,P.escape=sU,P.escapeRegExp=oU,P.every=dL,P.find=gL,P.findIndex=_b,P.findKey=CB,P.findLast=mL,P.findLastIndex=Eb,P.findLastKey=OB,P.floor=rF,P.forEach=Cb,P.forEachRight=Ob,P.forIn=MB,P.forInRight=PB,P.forOwn=$B,P.forOwnRight=TB,P.get=Pp,P.gt=XL,P.gte=eB,P.has=LB,P.hasIn=$p,P.head=xb,P.identity=dn,P.includes=_L,P.indexOf=mR,P.inRange=tU,P.invoke=FB,P.isArguments=$o,P.isArray=at,P.isArrayBuffer=tB,P.isArrayLike=hn,P.isArrayLikeObject=dr,P.isBoolean=rB,P.isBuffer=Bs,P.isDate=nB,P.isElement=iB,P.isEmpty=sB,P.isEqual=oB,P.isEqualWith=aB,P.isError=Op,P.isFinite=cB,P.isFunction=rs,P.isInteger=Bb,P.isLength=Mh,P.isMap=Ub,P.isMatch=lB,P.isMatchWith=uB,P.isNaN=hB,P.isNative=fB,P.isNil=pB,P.isNull=dB,P.isNumber=Fb,P.isObject=sr,P.isObjectLike=cr,P.isPlainObject=nl,P.isRegExp=Mp,P.isSafeInteger=gB,P.isSet=jb,P.isString=Ph,P.isSymbol=An,P.isTypedArray=Ua,P.isUndefined=mB,P.isWeakMap=vB,P.isWeakSet=wB,P.join=_R,P.kebabCase=aU,P.last=Kn,P.lastIndexOf=ER,P.lowerCase=cU,P.lowerFirst=lU,P.lt=yB,P.lte=bB,P.max=nF,P.maxBy=iF,P.mean=sF,P.meanBy=oF,P.min=aF,P.minBy=cF,P.stubArray=Up,P.stubFalse=Fp,P.stubObject=VU,P.stubString=GU,P.stubTrue=YU,P.multiply=lF,P.nth=AR,P.noConflict=FU,P.noop=Bp,P.now=Dh,P.pad=uU,P.padEnd=hU,P.padStart=fU,P.parseInt=dU,P.random=rU,P.reduce=IL,P.reduceRight=DL,P.repeat=pU,P.replace=gU,P.result=WB,P.round=uF,P.runInContext=Z,P.sample=OL,P.size=$L,P.snakeCase=mU,P.some=TL,P.sortedIndex=MR,P.sortedIndexBy=PR,P.sortedIndexOf=$R,P.sortedLastIndex=TR,P.sortedLastIndexBy=NR,P.sortedLastIndexOf=RR,P.startCase=wU,P.startsWith=yU,P.subtract=hF,P.sum=fF,P.sumBy=dF,P.template=bU,P.times=QU,P.toFinite=ns,P.toInteger=ft,P.toLength=qb,P.toLower=_U,P.toNumber=Wn,P.toSafeInteger=_B,P.toString=Bt,P.toUpper=EU,P.trim=AU,P.trimEnd=xU,P.trimStart=SU,P.truncate=IU,P.unescape=DU,P.uniqueId=ZU,P.upperCase=CU,P.upperFirst=Tp,P.each=Cb,P.eachRight=Ob,P.first=xb,Lp(P,function(){var s={};return Ti(P,function(a,u){qt.call(P.prototype,u)||(s[u]=a)}),s}(),{chain:!1}),P.VERSION=n,jn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){P[s].placeholder=P}),jn(["drop","take"],function(s,a){At.prototype[s]=function(u){u=u===r?1:br(ft(u),0);var y=this.__filtered__&&!a?new At(this):this.clone();return y.__filtered__?y.__takeCount__=Ur(u,y.__takeCount__):y.__views__.push({size:Ur(u,v),type:s+(y.__dir__<0?"Right":"")}),y},At.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),jn(["filter","map","takeWhile"],function(s,a){var u=a+1,y=u==p||u==D;At.prototype[s]=function(S){var R=this.clone();return R.__iteratees__.push({iteratee:qe(S,3),type:u}),R.__filtered__=R.__filtered__||y,R}}),jn(["head","last"],function(s,a){var u="take"+(a?"Right":"");At.prototype[s]=function(){return this[u](1).value()[0]}}),jn(["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 Jc(u,s,a)})}),At.prototype.reject=function(s){return this.filter(Oh(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),S=P[y?"take"+(a=="last"?"Right":""):a],R=y||/^find/.test(a);S&&(P.prototype[a]=function(){var G=this.__wrapped__,Q=y?[1]:arguments,X=G instanceof At,ce=Q[0],ue=X||at(G),ge=function(yt){var Dt=S.apply(P,Ms([yt],Q));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,Q);return We.__actions__.push({func:Sh,args:[ge],thisArg:r}),new qn(We,we)}return Ke&&pt?s.apply(this,Q):(We=this.thru(ge),Ke?y?We.value()[0]:We.value():We)})}),jn(["pop","push","shift","sort","splice","unshift"],function(s){var a=Ju[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",y=/^(?:pop|shift)$/.test(s);P.prototype[s]=function(){var S=arguments;if(y&&!this.__chain__){var R=this.value();return a.apply(at(R)?R:[],S)}return this[u](function(G){return a.apply(at(G)?G:[],S)})}}),Ti(At.prototype,function(s,a){var u=P[a];if(u){var y=u.name+"";qt.call(Ta,y)||(Ta[y]=[]),Ta[y].push({name:a,func:u})}}),Ta[wh(r,Y).name]=[{name:"wrapper",func:r}],At.prototype.clone=DT,At.prototype.reverse=CT,At.prototype.value=OT,P.prototype.at=iL,P.prototype.chain=sL,P.prototype.commit=oL,P.prototype.next=aL,P.prototype.plant=lL,P.prototype.reverse=uL,P.prototype.toJSON=P.prototype.valueOf=P.prototype.value=hL,P.prototype.first=P.prototype.head,Hc&&(P.prototype[Hc]=cL),P},Ma=oT();fr?((fr.exports=Ma)._=Ma,Gt._=Ma):It._=Ma}).call(yc)})(g0,g0.exports);var AD=Object.defineProperty,xD=Object.defineProperties,SD=Object.getOwnPropertyDescriptors,gw=Object.getOwnPropertySymbols,ID=Object.prototype.hasOwnProperty,DD=Object.prototype.propertyIsEnumerable,mw=(t,e,r)=>e in t?AD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zl=(t,e)=>{for(var r in e||(e={}))ID.call(e,r)&&mw(t,r,e[r]);if(gw)for(var r of gw(e))DD.call(e,r)&&mw(t,r,e[r]);return t},CD=(t,e)=>xD(t,SD(e));function ds(t,e,r){var n;const i=ml(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${ED}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Zs(t){return t.includes(":")?t.split(":")[1]:t}function vw(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function OD(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 m0(t={},e={}){const r=ww(t),n=ww(e);return g0.exports.merge(r,n)}function ww(t){var e,r,n,i;const o={};if(!oc(t))return o;for(const[c,l]of Object.entries(t)){const f=Tf(c)?[c]:l.chains,h=l.methods||[],g=l.events||[],_=l.rpcMap||{},E=sc(c);o[E]=CD(Zl(Zl({},o[E]),l),{chains:vl(f,(e=o[E])==null?void 0:e.chains),methods:vl(h,(r=o[E])==null?void 0:r.methods),events:vl(g,(n=o[E])==null?void 0:n.events),rpcMap:Zl(Zl({},_),(i=o[E])==null?void 0:i.rpcMap)})}return o}function MD(t){return t.includes(":")?t.split(":")[2]:t}function yw(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],o=n.events||[],c=n.accounts||[],l=Tf(r)?[r]:n.chains?n.chains:vw(n.accounts);e[r]={chains:l,methods:i,events:o,accounts:c}}return e}function v0(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 bw={},er=t=>bw[t],w0=(t,e)=>{bw[t]=e};class PD{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(Ki.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 Hi(new fs(n,er("disableProviderPing")))}}var $D=Object.defineProperty,TD=Object.defineProperties,ND=Object.getOwnPropertyDescriptors,_w=Object.getOwnPropertySymbols,RD=Object.prototype.hasOwnProperty,LD=Object.prototype.propertyIsEnumerable,Ew=(t,e,r)=>e in t?$D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Aw=(t,e)=>{for(var r in e||(e={}))RD.call(e,r)&&Ew(t,r,e[r]);if(_w)for(var r of _w(e))LD.call(e,r)&&Ew(t,r,e[r]);return t},xw=(t,e)=>TD(t,ND(e));class BD{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());case"wallet_getCapabilities":return await this.getCapabilities(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Ki.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 Hi(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}`)}async getCapabilities(e){var r,n,i;const o=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(e.topic),l=((i=c?.sessionProperties)==null?void 0:i.capabilities)||{};if(l!=null&&l[o])return l?.[o];const f=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:xw(Aw({},c.sessionProperties||{}),{capabilities:xw(Aw({},l||{}),{[o]:f})})})}catch(h){console.warn("Failed to update session with capabilities",h)}return f}}class UD{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(Ki.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 Hi(new fs(n,er("disableProviderPing")))}}class FD{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(Ki.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 Hi(new fs(n,er("disableProviderPing")))}}class jD{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(Ki.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 Hi(new fs(n,er("disableProviderPing")))}}class kD{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(Ki.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 Hi(new fs(n,er("disableProviderPing")))}}class qD{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(Ki.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 Hi(new fs(n,er("disableProviderPing")))}}class zD{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(Ki.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 Hi(new fs(n,er("disableProviderPing")))}}var HD=Object.defineProperty,KD=Object.defineProperties,WD=Object.getOwnPropertyDescriptors,Sw=Object.getOwnPropertySymbols,VD=Object.prototype.hasOwnProperty,GD=Object.prototype.propertyIsEnumerable,Iw=(t,e,r)=>e in t?HD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xl=(t,e)=>{for(var r in e||(e={}))VD.call(e,r)&&Iw(t,r,e[r]);if(Sw)for(var r of Sw(e))GD.call(e,r)&&Iw(t,r,e[r]);return t},y0=(t,e)=>KD(t,WD(e));class b0{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(Hl({level:e?.logger||dw})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const r=new b0(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:Xl({},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,Wl(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=yw(this.session.namespaces);this.namespaces=m0(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=yw(o.namespaces);this.namespaces=m0(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==nw)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 d0.init({logger:this.providerOpts.logger||dw,relayUrl:this.providerOpts.relayUrl||yD,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=>sc(r)))];w0("client",this.client),w0("events",this.events),w0("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=OD(r,this.session),i=vw(n),o=m0(this.namespaces,this.optionalNamespaces),c=y0(Xl({},o[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new BD({namespace:c});break;case"solana":this.rpcProviders[r]=new UD({namespace:c});break;case"cosmos":this.rpcProviders[r]=new FD({namespace:c});break;case"polkadot":this.rpcProviders[r]=new PD({namespace:c});break;case"cip34":this.rpcProviders[r]=new jD({namespace:c});break;case"elrond":this.rpcProviders[r]=new kD({namespace:c});break;case"multiversx":this.rpcProviders[r]=new qD({namespace:c});break;case"near":this.rpcProviders[r]=new zD({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(MD))}else if(n.name==="chainChanged"){const i=r.chainId,o=r.event.data,c=sc(i),l=v0(i)!==v0(o)?`${c}:${v0(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=y0(Xl({},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",y0(Xl({},Ut("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Ki.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=>sc(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=sc(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(`${pw}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${pw}/${e}`)}}const YD=b0,QD="wc",JD="ethereum_provider",ZD=`${QD}@2:${JD}:`,XD="https://rpc.walletconnect.com/v1/",eu=["eth_sendTransaction","personal_sign"],Dw=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],tu=["chainChanged","accountsChanged"],Cw=["chainChanged","accountsChanged","message","disconnect","connect"];var eC=Object.defineProperty,tC=Object.defineProperties,rC=Object.getOwnPropertyDescriptors,Ow=Object.getOwnPropertySymbols,nC=Object.prototype.hasOwnProperty,iC=Object.prototype.propertyIsEnumerable,Mw=(t,e,r)=>e in t?eC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sa=(t,e)=>{for(var r in e||(e={}))nC.call(e,r)&&Mw(t,r,e[r]);if(Ow)for(var r of Ow(e))iC.call(e,r)&&Mw(t,r,e[r]);return t},_0=(t,e)=>tC(t,rC(e));function ru(t){return Number(t[0].split(":")[1])}function nu(t){return`0x${t.toString(16)}`}function sC(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||eu,events:o||tu,rpcMap:sa({},e.length?{[ru(e)]:l[ru(e)]}:{})},h=o?.filter(x=>!tu.includes(x)),g=n?.filter(x=>!eu.includes(x));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:Dw))],events:[...new Set(f.events.concat(c!=null&&c.length?c:Cw))],rpcMap:l};return{required:e.length?f:void 0,optional:r.length?E:void 0}}class iu{constructor(){this.events=new Dr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=ZD,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 iu;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}=sC(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(_0(sa({namespaces:sa({},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=Y1(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:nu(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(_0(sa({},e),{chains:this.rpc.chains})).then(l=>{i(l)}).catch(l=>{o(new Error(l.message))})}),n=r.session;if(n){const i=Y1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:i),this.setAccounts(i),this.events.emit("connect",{chainId:nu(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",nu(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",_0(sa({},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",nu(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||eu:[],f=i.length?e?.events||tu:[],h=e?.optionalMethods||[],g=e?.optionalEvents||[],_=e?.rpcMap||this.buildRpcMap(c,e.projectId),E=e?.qrModalOptions||void 0;return{chains:i?.map(x=>this.formatChainId(x)),optionalChains:o.map(x=>this.formatChainId(x)),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?ru(this.rpc.chains):ru(this.rpc.optionalChains),this.signer=await YD.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 CC});r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(sa({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])||`${XD}?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 oC=iu,aC=Symbol(),Pw=Object.getPrototypeOf,E0=new WeakMap,cC=t=>t&&(E0.has(t)?E0.get(t):Pw(t)===Object.prototype||Pw(t)===Array.prototype),lC=t=>cC(t)&&t[aC]||null,$w=(t,e=!0)=>{E0.set(t,e)},A0=t=>typeof t=="object"&&t!==null,ps=new WeakMap,su=new WeakSet,uC=(t=Object.is,e=(h,g)=>new Proxy(h,g),r=h=>A0(h)&&!su.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 x=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return $w(x,!0),i.set(h,[g,x]),Reflect.ownKeys(h).forEach(I=>{if(Object.getOwnPropertyDescriptor(x,I))return;const k=Reflect.get(h,I),W={value:k,enumerable:!0,configurable:!0};if(su.has(k))$w(k,!1);else if(k instanceof Promise)delete W.value,W.get=()=>_(k);else if(ps.has(k)){const[Y,B]=ps.get(k);W.value=o(Y,B(),_)}Object.defineProperty(x,I,W)}),Object.preventExtensions(x)},c=new WeakMap,l=[1,1],f=h=>{if(!A0(h))throw new Error("object required");const g=c.get(h);if(g)return g;let _=l[0];const E=new Set,x=(te,ee=++l[0])=>{_!==ee&&(_=ee,E.forEach(ne=>ne(te,ee)))};let I=l[1];const k=(te=++l[1])=>(I!==te&&!E.size&&(I=te,Y.forEach(([ee])=>{const ne=ee[1](te);ne>_&&(_=ne)})),_),W=te=>(ee,ne)=>{const de=[...ee];de[1]=[te,...de[1]],x(de,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))},M=te=>(E.add(te),E.size===1&&Y.forEach(([ne,de],d)=>{if(de)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,de],d)=>{de&&(de(),Y.set(d,[ne]))})}),U=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),m=e(U,{deleteProperty(te,ee){const ne=Reflect.get(te,ee);z(ee);const de=Reflect.deleteProperty(te,ee);return de&&x(["delete",[ee],ne]),de},set(te,ee,ne,de){const d=Reflect.has(te,ee),p=Reflect.get(te,ee,de);if(d&&(t(p,ne)||c.has(ne)&&t(p,c.get(ne))))return!0;z(ee),A0(ne)&&(ne=lC(ne)||ne);let b=ne;if(ne instanceof Promise)ne.then(D=>{ne.status="fulfilled",ne.value=D,x(["resolve",[ee],D])}).catch(D=>{ne.status="rejected",ne.reason=D,x(["reject",[ee],D])});else{!ps.has(ne)&&r(ne)&&(b=f(ne));const D=!su.has(b)&&ps.get(b);D&&B(ee,D)}return Reflect.set(te,ee,b,de),x(["set",[ee],ne,p]),!0}});c.set(h,m);const $=[U,k,o,M];return ps.set(m,$),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(U,te,ee)}),m})=>[f,ps,su,t,e,r,n,i,o,c,l],[hC]=uC();function gs(t={}){return hC(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 fC(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}},dC=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Br=gs({enabled:dC,userSessionId:"",events:[],connectedWalletId:void 0}),Tw={state:Br,subscribe(t){return Xs(Br.events,()=>t(fC(Br.events[Br.events.length-1])))},initialize(){Br.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Br.userSessionId=crypto.randomUUID())},setConnectedWalletId(t){Br.connectedWalletId=t},click(t){if(Br.enabled){const e={type:"CLICK",name:t.name,userSessionId:Br.userSessionId,timestamp:Date.now(),data:t};Br.events.push(e)}},track(t){if(Br.enabled){const e={type:"TRACK",name:t.name,userSessionId:Br.userSessionId,timestamp:Date.now(),data:t};Br.events.push(e)}},view(t){if(Br.enabled){const e={type:"VIEW",name:t.name,userSessionId:Br.userSessionId,timestamp:Date.now(),data:t};Br.events.push(e)}}},xi=gs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),hr={state:xi,subscribe(t){return Xs(xi,()=>t(xi))},setChains(t){xi.chains=t},setWalletConnectUri(t){xi.walletConnectUri=t},setIsCustomDesktop(t){xi.isCustomDesktop=t},setIsCustomMobile(t){xi.isCustomMobile=t},setIsDataLoaded(t){xi.isDataLoaded=t},setIsUiLoaded(t){xi.isUiLoaded=t},setIsAuth(t){xi.isAuth=t}},ou=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:ou,subscribe(t){return Xs(ou,()=>t(ou))},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(ou,t)}};var pC=Object.defineProperty,Nw=Object.getOwnPropertySymbols,gC=Object.prototype.hasOwnProperty,mC=Object.prototype.propertyIsEnumerable,Rw=(t,e,r)=>e in t?pC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vC=(t,e)=>{for(var r in e||(e={}))gC.call(e,r)&&Rw(t,r,e[r]);if(Nw)for(var r of Nw(e))mC.call(e,r)&&Rw(t,r,e[r]);return t};const x0="https://explorer-api.walletconnect.com",S0="wcm",I0="js-2.6.2";async function au(t,e){const r=vC({sdkType:S0,sdkVersion:I0},e),n=new URL(t,x0);return n.searchParams.append("projectId",wn.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 au("/w3m/v1/getDesktopListings",t)},async getMobileListings(t){return au("/w3m/v1/getMobileListings",t)},async getInjectedListings(t){return au("/w3m/v1/getInjectedListings",t)},async getAllListings(t){return au("/w3m/v1/getAllListings",t)},getWalletImageUrl(t){return`${x0}/w3m/v1/getWalletImage/${t}?projectId=${wn.state.projectId}&sdkType=${S0}&sdkVersion=${I0}`},getAssetImageUrl(t){return`${x0}/w3m/v1/getAssetImage/${t}?projectId=${wn.state.projectId}&sdkType=${S0}&sdkVersion=${I0}`}};var wC=Object.defineProperty,Lw=Object.getOwnPropertySymbols,yC=Object.prototype.hasOwnProperty,bC=Object.prototype.propertyIsEnumerable,Bw=(t,e,r)=>e in t?wC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_C=(t,e)=>{for(var r in e||(e={}))yC.call(e,r)&&Bw(t,r,e[r]);if(Lw)for(var r of Lw(e))bC.call(e,r)&&Bw(t,r,e[r]);return t};const Uw=Ue.isMobile(),Si=gs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),an={state:Si,async getRecomendedWallets(){const{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:e}=wn.state;if(t==="NONE"||e==="ALL"&&!t)return Si.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}),Si.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}=Uw?await eo.getMobileListings(c):await eo.getDesktopListings(c);Si.recomendedWallets=Object.values(l)}return Si.recomendedWallets},async getWallets(t){const e=_C({},t),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=wn.state,{recomendedWallets:i}=Si;if(n==="ALL")return Si.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}=Uw?await eo.getMobileListings(e):await eo.getDesktopListings(e),h=Object.values(l),g=c?"search":"wallets";return Si[g]={listings:[...Si[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(){Si.search={listings:[],total:0,page:1}}},oa=gs({open:!1}),to={state:oa,subscribe(t){return Xs(oa,()=>t(oa))},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)oa.open=!0,e();else{const i=setInterval(()=>{const o=hr.state;o.isUiLoaded&&o.isDataLoaded&&(clearInterval(i),oa.open=!0,e())},200)}})},close(){oa.open=!1}};var EC=Object.defineProperty,Fw=Object.getOwnPropertySymbols,AC=Object.prototype.hasOwnProperty,xC=Object.prototype.propertyIsEnumerable,jw=(t,e,r)=>e in t?EC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,SC=(t,e)=>{for(var r in e||(e={}))AC.call(e,r)&&jw(t,r,e[r]);if(Fw)for(var r of Fw(e))xC.call(e,r)&&jw(t,r,e[r]);return t};function IC(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const bc=gs({themeMode:IC()?"dark":"light"}),ms={state:bc,subscribe(t){return Xs(bc,()=>t(bc))},setThemeConfig(t){const{themeMode:e,themeVariables:r}=t;e&&(bc.themeMode=e),r&&(bc.themeVariables=SC({},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 DC{constructor(e){this.openModal=to.open,this.closeModal=to.close,this.subscribeModal=to.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 L$});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),hr.setIsUiLoaded(!0)}}}var CC=Object.freeze({__proto__:null,WalletConnectModal:DC});/**
|
|
68
|
+
`)+gt+`return __p
|
|
69
|
+
}`;var pe=t3(function(){return Ne(R,Lt+"return "+gt).apply(r,G)});if(pe.source=gt,Pp(pe))throw pe;return pe}function AU(s){return Be(s).toLowerCase()}function xU(s){return Be(s).toUpperCase()}function IU(s,a,u){if(s=Be(s),s&&(u||a===r))return ly(s);if(!s||!(a=En(a)))return s;var y=ni(s),S=ni(a),R=uy(y,S),G=hy(y,S)+1;return Ls(y,R,G).join("")}function SU(s,a,u){if(s=Be(s),s&&(u||a===r))return s.slice(0,dy(s)+1);if(!s||!(a=En(a)))return s;var y=ni(s),S=hy(y,ni(a))+1;return Ls(y,0,S).join("")}function CU(s,a,u){if(s=Be(s),s&&(u||a===r))return s.replace(Jt,"");if(!s||!(a=En(a)))return s;var y=ni(s),S=uy(y,ni(a));return Ls(y,S).join("")}function DU(s,a){var u=tt,y=nt;if(sr(a)){var S="separator"in a?a.separator:S;u="length"in a?fe(a.length):u,y="omission"in a?En(a.omission):y}s=Be(s);var R=s.length;if(Da(s)){var G=ni(s);R=G.length}if(u>=R)return s;var Q=u-Oa(y);if(Q<1)return y;var X=G?Ls(G,0,Q).join(""):s.slice(0,Q);if(S===r)return X+y;if(G&&(Q+=X.length-Q),Mp(S)){if(s.slice(Q).search(S)){var ct,ut=X;for(S.global||(S=Vd(S.source,Be(ve.exec(S))+"g")),S.lastIndex=0;ct=S.exec(ut);)var gt=ct.index;X=X.slice(0,gt===r?Q:gt)}}else if(s.indexOf(En(S),Q)!=Q){var wt=X.lastIndexOf(S);wt>-1&&(X=X.slice(0,wt))}return X+y}function OU(s){return s=Be(s),s&&Yt.test(s)?s.replace(Oe,iN):s}var PU=La(function(s,a,u){return s+(u?" ":"")+a.toUpperCase()}),Tp=eb("toUpperCase");function Xb(s,a,u){return s=Be(s),a=u?r:a,a===r?X$(s)?aN(s):H$(s):s.match(a)||[]}var t3=ge(function(s,a){try{return Ir(s,r,a)}catch(u){return Pp(u)?u:new ie(u)}}),MU=rs(function(s,a){return jn(a,function(u){u=Bi(u),ts(s,u,Dp(s[u],s))}),s});function $U(s){var a=s==null?0:s.length,u=qt();return s=a?er(s,function(y){if(typeof y[1]!="function")throw new kn(c);return[u(y[0]),y[1]]}):[],ge(function(y){for(var S=-1;++S<a;){var R=s[S];if(Ir(R[0],this,y))return Ir(R[1],this,y)}})}function NU(s){return iT(zn(s,_))}function Rp(s){return function(){return s}}function TU(s,a){return s==null||s!==s?a:s}var RU=nb(),LU=nb(!0);function dn(s){return s}function Lp(s){return Ny(typeof s=="function"?s:zn(s,_))}function BU(s){return Ry(zn(s,_))}function UU(s,a){return Ly(s,zn(a,_))}var FU=ge(function(s,a){return function(u){return Xc(u,s,a)}}),jU=ge(function(s,a){return function(u){return Xc(s,u,a)}});function Bp(s,a,u){var y=Sr(a),S=ph(a,y);u==null&&!(sr(a)&&(S.length||!y.length))&&(u=a,a=s,s=this,S=ph(a,Sr(a)));var R=!(sr(u)&&"chain"in u)||!!u.chain,G=is(s);return jn(S,function(Q){var X=a[Q];s[Q]=X,G&&(s.prototype[Q]=function(){var ct=this.__chain__;if(R||ct){var ut=s(this.__wrapped__),gt=ut.__actions__=un(this.__actions__);return gt.push({func:X,args:arguments,thisArg:s}),ut.__chain__=ct,ut}return X.apply(s,Ps([this.value()],arguments))})}),s}function kU(){return Se._===this&&(Se._=dN),this}function Up(){}function qU(s){return s=fe(s),ge(function(a){return By(a,s)})}var zU=gp(er),HU=gp(iy),KU=gp(jd);function e3(s){return Ep(s)?kd(Bi(s)):_T(s)}function WU(s){return function(a){return s==null?r:Oo(s,a)}}var VU=sb(),GU=sb(!0);function Fp(){return[]}function jp(){return!1}function YU(){return{}}function QU(){return""}function JU(){return!0}function ZU(s,a){if(s=fe(s),s<1||s>N)return[];var u=v,y=Ur(s,v);a=qt(a),s-=v;for(var S=Hd(y,a);++u<s;)a(u);return S}function XU(s){return ae(s)?er(s,Bi):An(s)?[s]:un(_b(Be(s)))}function tF(s){var a=++hN;return Be(s)+a}var eF=bh(function(s,a){return s+a},0),rF=mp("ceil"),nF=bh(function(s,a){return s/a},1),iF=mp("floor");function sF(s){return s&&s.length?dh(s,dn,ep):r}function oF(s,a){return s&&s.length?dh(s,qt(a,2),ep):r}function aF(s){return ay(s,dn)}function cF(s,a){return ay(s,qt(a,2))}function lF(s){return s&&s.length?dh(s,dn,sp):r}function uF(s,a){return s&&s.length?dh(s,qt(a,2),sp):r}var hF=bh(function(s,a){return s*a},1),fF=mp("round"),dF=bh(function(s,a){return s-a},0);function pF(s){return s&&s.length?zd(s,dn):0}function gF(s,a){return s&&s.length?zd(s,qt(a,2)):0}return M.after=BL,M.ary=$b,M.assign=xB,M.assignIn=Wb,M.assignInWith=Nh,M.assignWith=IB,M.at=SB,M.before=Nb,M.bind=Dp,M.bindAll=MU,M.bindKey=Tb,M.castArray=YL,M.chain=Ob,M.chunk=iR,M.compact=sR,M.concat=oR,M.cond=$U,M.conforms=NU,M.constant=Rp,M.countBy=pL,M.create=CB,M.curry=Rb,M.curryRight=Lb,M.debounce=Bb,M.defaults=DB,M.defaultsDeep=OB,M.defer=UL,M.delay=FL,M.difference=aR,M.differenceBy=cR,M.differenceWith=lR,M.drop=uR,M.dropRight=hR,M.dropRightWhile=fR,M.dropWhile=dR,M.fill=pR,M.filter=mL,M.flatMap=yL,M.flatMapDeep=bL,M.flatMapDepth=_L,M.flatten=Ib,M.flattenDeep=gR,M.flattenDepth=mR,M.flip=jL,M.flow=RU,M.flowRight=LU,M.fromPairs=vR,M.functions=LB,M.functionsIn=BB,M.groupBy=EL,M.initial=yR,M.intersection=bR,M.intersectionBy=_R,M.intersectionWith=ER,M.invert=FB,M.invertBy=jB,M.invokeMap=xL,M.iteratee=Lp,M.keyBy=IL,M.keys=Sr,M.keysIn=fn,M.map=Ch,M.mapKeys=qB,M.mapValues=zB,M.matches=BU,M.matchesProperty=UU,M.memoize=Oh,M.merge=HB,M.mergeWith=Vb,M.method=FU,M.methodOf=jU,M.mixin=Bp,M.negate=Ph,M.nthArg=qU,M.omit=KB,M.omitBy=WB,M.once=kL,M.orderBy=SL,M.over=zU,M.overArgs=qL,M.overEvery=HU,M.overSome=KU,M.partial=Op,M.partialRight=Ub,M.partition=CL,M.pick=VB,M.pickBy=Gb,M.property=e3,M.propertyOf=WU,M.pull=SR,M.pullAll=Cb,M.pullAllBy=CR,M.pullAllWith=DR,M.pullAt=OR,M.range=VU,M.rangeRight=GU,M.rearg=zL,M.reject=PL,M.remove=PR,M.rest=HL,M.reverse=Sp,M.sampleSize=$L,M.set=YB,M.setWith=QB,M.shuffle=NL,M.slice=MR,M.sortBy=LL,M.sortedUniq=UR,M.sortedUniqBy=FR,M.split=yU,M.spread=KL,M.tail=jR,M.take=kR,M.takeRight=qR,M.takeRightWhile=zR,M.takeWhile=HR,M.tap=sL,M.throttle=WL,M.thru=Sh,M.toArray=zb,M.toPairs=Yb,M.toPairsIn=Qb,M.toPath=XU,M.toPlainObject=Kb,M.transform=JB,M.unary=VL,M.union=KR,M.unionBy=WR,M.unionWith=VR,M.uniq=GR,M.uniqBy=YR,M.uniqWith=QR,M.unset=ZB,M.unzip=Cp,M.unzipWith=Db,M.update=XB,M.updateWith=tU,M.values=Fa,M.valuesIn=eU,M.without=JR,M.words=Xb,M.wrap=GL,M.xor=ZR,M.xorBy=XR,M.xorWith=tL,M.zip=eL,M.zipObject=rL,M.zipObjectDeep=nL,M.zipWith=iL,M.entries=Yb,M.entriesIn=Qb,M.extend=Wb,M.extendWith=Nh,Bp(M,M),M.add=eF,M.attempt=t3,M.camelCase=sU,M.capitalize=Jb,M.ceil=rF,M.clamp=rU,M.clone=QL,M.cloneDeep=ZL,M.cloneDeepWith=XL,M.cloneWith=JL,M.conformsTo=tB,M.deburr=Zb,M.defaultTo=TU,M.divide=nF,M.endsWith=oU,M.eq=si,M.escape=aU,M.escapeRegExp=cU,M.every=gL,M.find=vL,M.findIndex=Ab,M.findKey=PB,M.findLast=wL,M.findLastIndex=xb,M.findLastKey=MB,M.floor=iF,M.forEach=Pb,M.forEachRight=Mb,M.forIn=$B,M.forInRight=NB,M.forOwn=TB,M.forOwnRight=RB,M.get=$p,M.gt=eB,M.gte=rB,M.has=UB,M.hasIn=Np,M.head=Sb,M.identity=dn,M.includes=AL,M.indexOf=wR,M.inRange=nU,M.invoke=kB,M.isArguments=$o,M.isArray=ae,M.isArrayBuffer=nB,M.isArrayLike=hn,M.isArrayLikeObject=dr,M.isBoolean=iB,M.isBuffer=Bs,M.isDate=sB,M.isElement=oB,M.isEmpty=aB,M.isEqual=cB,M.isEqualWith=lB,M.isError=Pp,M.isFinite=uB,M.isFunction=is,M.isInteger=Fb,M.isLength=Mh,M.isMap=jb,M.isMatch=hB,M.isMatchWith=fB,M.isNaN=dB,M.isNative=pB,M.isNil=mB,M.isNull=gB,M.isNumber=kb,M.isObject=sr,M.isObjectLike=cr,M.isPlainObject=sl,M.isRegExp=Mp,M.isSafeInteger=vB,M.isSet=qb,M.isString=$h,M.isSymbol=An,M.isTypedArray=Ua,M.isUndefined=wB,M.isWeakMap=yB,M.isWeakSet=bB,M.join=AR,M.kebabCase=lU,M.last=Kn,M.lastIndexOf=xR,M.lowerCase=uU,M.lowerFirst=hU,M.lt=_B,M.lte=EB,M.max=sF,M.maxBy=oF,M.mean=aF,M.meanBy=cF,M.min=lF,M.minBy=uF,M.stubArray=Fp,M.stubFalse=jp,M.stubObject=YU,M.stubString=QU,M.stubTrue=JU,M.multiply=hF,M.nth=IR,M.noConflict=kU,M.noop=Up,M.now=Dh,M.pad=fU,M.padEnd=dU,M.padStart=pU,M.parseInt=gU,M.random=iU,M.reduce=DL,M.reduceRight=OL,M.repeat=mU,M.replace=vU,M.result=GB,M.round=fF,M.runInContext=Z,M.sample=ML,M.size=TL,M.snakeCase=wU,M.some=RL,M.sortedIndex=$R,M.sortedIndexBy=NR,M.sortedIndexOf=TR,M.sortedLastIndex=RR,M.sortedLastIndexBy=LR,M.sortedLastIndexOf=BR,M.startCase=bU,M.startsWith=_U,M.subtract=dF,M.sum=pF,M.sumBy=gF,M.template=EU,M.times=ZU,M.toFinite=ss,M.toInteger=fe,M.toLength=Hb,M.toLower=AU,M.toNumber=Wn,M.toSafeInteger=AB,M.toString=Be,M.toUpper=xU,M.trim=IU,M.trimEnd=SU,M.trimStart=CU,M.truncate=DU,M.unescape=OU,M.uniqueId=tF,M.upperCase=PU,M.upperFirst=Tp,M.each=Pb,M.eachRight=Mb,M.first=Sb,Bp(M,function(){var s={};return Ri(M,function(a,u){qe.call(M.prototype,u)||(s[u]=a)}),s}(),{chain:!1}),M.VERSION=n,jn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){M[s].placeholder=M}),jn(["drop","take"],function(s,a){Ae.prototype[s]=function(u){u=u===r?1:br(fe(u),0);var y=this.__filtered__&&!a?new Ae(this):this.clone();return y.__filtered__?y.__takeCount__=Ur(u,y.__takeCount__):y.__views__.push({size:Ur(u,v),type:s+(y.__dir__<0?"Right":"")}),y},Ae.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),jn(["filter","map","takeWhile"],function(s,a){var u=a+1,y=u==p||u==C;Ae.prototype[s]=function(S){var R=this.clone();return R.__iteratees__.push({iteratee:qt(S,3),type:u}),R.__filtered__=R.__filtered__||y,R}}),jn(["head","last"],function(s,a){var u="take"+(a?"Right":"");Ae.prototype[s]=function(){return this[u](1).value()[0]}}),jn(["initial","tail"],function(s,a){var u="drop"+(a?"":"Right");Ae.prototype[s]=function(){return this.__filtered__?new Ae(this):this[u](1)}}),Ae.prototype.compact=function(){return this.filter(dn)},Ae.prototype.find=function(s){return this.filter(s).head()},Ae.prototype.findLast=function(s){return this.reverse().find(s)},Ae.prototype.invokeMap=ge(function(s,a){return typeof s=="function"?new Ae(this):this.map(function(u){return Xc(u,s,a)})}),Ae.prototype.reject=function(s){return this.filter(Ph(qt(s)))},Ae.prototype.slice=function(s,a){s=fe(s);var u=this;return u.__filtered__&&(s>0||a<0)?new Ae(u):(s<0?u=u.takeRight(-s):s&&(u=u.drop(s)),a!==r&&(a=fe(a),u=a<0?u.dropRight(-a):u.take(a-s)),u)},Ae.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Ae.prototype.toArray=function(){return this.take(v)},Ri(Ae.prototype,function(s,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),y=/^(?:head|last)$/.test(a),S=M[y?"take"+(a=="last"?"Right":""):a],R=y||/^find/.test(a);S&&(M.prototype[a]=function(){var G=this.__wrapped__,Q=y?[1]:arguments,X=G instanceof Ae,ct=Q[0],ut=X||ae(G),gt=function(ye){var Ce=S.apply(M,Ps([ye],Q));return y&&wt?Ce[0]:Ce};ut&&u&&typeof ct=="function"&&ct.length!=1&&(X=ut=!1);var wt=this.__chain__,Lt=!!this.__actions__.length,Kt=R&&!wt,pe=X&&!Lt;if(!R&&ut){G=pe?G:new Ae(this);var Wt=s.apply(G,Q);return Wt.__actions__.push({func:Sh,args:[gt],thisArg:r}),new qn(Wt,wt)}return Kt&&pe?s.apply(this,Q):(Wt=this.thru(gt),Kt?y?Wt.value()[0]:Wt.value():Wt)})}),jn(["pop","push","shift","sort","splice","unshift"],function(s){var a=Zu[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",y=/^(?:pop|shift)$/.test(s);M.prototype[s]=function(){var S=arguments;if(y&&!this.__chain__){var R=this.value();return a.apply(ae(R)?R:[],S)}return this[u](function(G){return a.apply(ae(G)?G:[],S)})}}),Ri(Ae.prototype,function(s,a){var u=M[a];if(u){var y=u.name+"";qe.call(Na,y)||(Na[y]=[]),Na[y].push({name:a,func:u})}}),Na[yh(r,Y).name]=[{name:"wrapper",func:r}],Ae.prototype.clone=ON,Ae.prototype.reverse=PN,Ae.prototype.value=MN,M.prototype.at=oL,M.prototype.chain=aL,M.prototype.commit=cL,M.prototype.next=lL,M.prototype.plant=hL,M.prototype.reverse=fL,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=dL,M.prototype.first=M.prototype.head,Wc&&(M.prototype[Wc]=uL),M},Pa=cN();fr?((fr.exports=Pa)._=Pa,Ye._=Pa):Se._=Pa}).call(_c)})(m0,m0.exports);var xC=Object.defineProperty,IC=Object.defineProperties,SC=Object.getOwnPropertyDescriptors,vw=Object.getOwnPropertySymbols,CC=Object.prototype.hasOwnProperty,DC=Object.prototype.propertyIsEnumerable,ww=(e,t,r)=>t in e?xC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xl=(e,t)=>{for(var r in t||(t={}))CC.call(t,r)&&ww(e,r,t[r]);if(vw)for(var r of vw(t))DC.call(t,r)&&ww(e,r,t[r]);return e},OC=(e,t)=>IC(e,SC(t));function Vi(e,t,r){var n;const i=Za(e);return((n=t.rpcMap)==null?void 0:n[i.reference])||`${AC}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Zs(e){return e.includes(":")?e.split(":")[1]:e}function yw(e){return e.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function PC(e,t){const r=Object.keys(t.namespaces).filter(i=>i.includes(e));if(!r.length)return[];const n=[];return r.forEach(i=>{const o=t.namespaces[i].accounts;n.push(...o)}),n}function v0(e={},t={}){const r=bw(e),n=bw(t);return m0.exports.merge(r,n)}function bw(e){var t,r,n,i;const o={};if(!dc(e))return o;for(const[c,l]of Object.entries(e)){const f=Wf(c)?[c]:l.chains,h=l.methods||[],g=l.events||[],_=l.rpcMap||{},E=fc(c);o[E]=OC(Xl(Xl({},o[E]),l),{chains:Dl(f,(t=o[E])==null?void 0:t.chains),methods:Dl(h,(r=o[E])==null?void 0:r.methods),events:Dl(g,(n=o[E])==null?void 0:n.events),rpcMap:Xl(Xl({},_),(i=o[E])==null?void 0:i.rpcMap)})}return o}function MC(e){return e.includes(":")?e.split(":")[2]:e}function _w(e){const t={};for(const[r,n]of Object.entries(e)){const i=n.methods||[],o=n.events||[],c=n.accounts||[],l=Wf(r)?[r]:n.chains?n.chains:yw(n.accounts);t[r]={chains:l,methods:i,events:o,accounts:c}}return t}function w0(e){return typeof e=="number"?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const Ew={},We=e=>Ew[e],y0=(e,t)=>{Ew[e]=t};class $C{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Vi(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}}var NC=Object.defineProperty,TC=Object.defineProperties,RC=Object.getOwnPropertyDescriptors,Aw=Object.getOwnPropertySymbols,LC=Object.prototype.hasOwnProperty,BC=Object.prototype.propertyIsEnumerable,xw=(e,t,r)=>t in e?NC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Iw=(e,t)=>{for(var r in t||(t={}))LC.call(t,r)&&xw(e,r,t[r]);if(Aw)for(var r of Aw(t))BC.call(t,r)&&xw(e,r,t[r]);return e},Sw=(e,t)=>TC(e,RC(t));class UC{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const n=r||Vi(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Zs(r));t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,n;let i=t.request.params?(r=t.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:t.topic,request:{method:t.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(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var r,n,i;const o=(n=(r=t.request)==null?void 0:r.params)==null?void 0:n[0];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(t.topic),l=((i=c?.sessionProperties)==null?void 0:i.capabilities)||{};if(l!=null&&l[o])return l?.[o];const f=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:Sw(Iw({},c.sessionProperties||{}),{capabilities:Sw(Iw({},l||{}),{[o]:f})})})}catch(h){console.warn("Failed to update session with capabilities",h)}return f}}class FC{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Vi(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}}class jC{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Vi(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}}class kC{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Zs(r);t[i]=this.createHttpProvider(i,n)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||this.getCardanoRPCUrl(t);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}}class qC{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Vi(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}}class zC{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=Zs(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Vi(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}}class HC{constructor(t){this.name="near",this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const n=r||Vi(`${this.name}:${t}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;t[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Vi(t,this.namespace);return typeof n>"u"?void 0:new Ei(new Wi(n,We("disableProviderPing")))}}class KC{constructor(t){this.name=ia,this.namespace=t.namespace,this.events=We("events"),this.client=We("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var t,r;const n={};return(r=(t=this.namespace)==null?void 0:t.accounts)==null||r.forEach(i=>{const o=Za(i);n[`${o.namespace}:${o.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(t){const r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Vi(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ei(new Wi(n,We("disableProviderPing")))}}var WC=Object.defineProperty,VC=Object.defineProperties,GC=Object.getOwnPropertyDescriptors,Cw=Object.getOwnPropertySymbols,YC=Object.prototype.hasOwnProperty,QC=Object.prototype.propertyIsEnumerable,Dw=(e,t,r)=>t in e?WC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tu=(e,t)=>{for(var r in t||(t={}))YC.call(t,r)&&Dw(e,r,t[r]);if(Cw)for(var r of Cw(t))QC.call(t,r)&&Dw(e,r,t[r]);return e},b0=(e,t)=>VC(e,GC(t));class _0{constructor(t){this.events=new Cr.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof t?.logger<"u"&&typeof t?.logger!="string"?t.logger:ai(wl({level:t?.logger||gw})),this.disableProviderPing=t?.disableProviderPing||!1}static async init(t){const r=new _0(t);return await r.initialize(),r}async request(t,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:tu({},t),chainId:`${i}:${o}`,topic:this.session.topic,expiry:n})}sendAsync(t,r,n,i){const o=new Date().getTime();this.request(t,n,i).then(c=>r(null,Vl(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 t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Ue("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:r,response:n}=await this.client.authenticate(t);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();if(this.session=i.session,this.session){const o=_w(this.session.namespaces);this.namespaces=v0(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){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:t,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=_w(o.namespaces);this.namespaces=v0(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==sw)throw o;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[n,i]=this.validateChain(t),o=this.getProvider(n);o.name===ia?o.setDefaultChain(`${n}:${i}`,r):o.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(bi(r)){for(const n of r)t.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 t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await p0.init({logger:this.providerOpts.logger||gw,relayUrl:this.providerOpts.relayUrl||bC,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 t=[...new Set(Object.keys(this.session.namespaces).map(r=>fc(r)))];y0("client",this.client),y0("events",this.events),y0("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const n=PC(r,this.session),i=yw(n),o=v0(this.namespaces,this.optionalNamespaces),c=b0(tu({},o[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new UC({namespace:c});break;case"solana":this.rpcProviders[r]=new FC({namespace:c});break;case"cosmos":this.rpcProviders[r]=new jC({namespace:c});break;case"polkadot":this.rpcProviders[r]=new $C({namespace:c});break;case"cip34":this.rpcProviders[r]=new kC({namespace:c});break;case"elrond":this.rpcProviders[r]=new qC({namespace:c});break;case"multiversx":this.rpcProviders[r]=new zC({namespace:c});break;case"near":this.rpcProviders[r]=new HC({namespace:c});break;default:this.rpcProviders[ia]?this.rpcProviders[ia].updateNamespace(c):this.rpcProviders[ia]=new KC({namespace:c})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&bi(i)&&this.events.emit("accountsChanged",i.map(MC))}else if(n.name==="chainChanged"){const i=r.chainId,o=r.event.data,c=fc(i),l=w0(i)!==w0(o)?`${c}:${w0(o)}`:i;this.onChainChanged(l)}else this.events.emit(n.name,n.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var n;const{namespaces:i}=r,o=(n=this.client)==null?void 0:n.session.get(t);this.session=b0(tu({},o),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",b0(tu({},Ue("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Ii.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[ia]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=t;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(t){const[r,n]=t?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(c=>fc(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=fc(Object.keys(this.namespaces)[0]),o=this.rpcProviders[i].getDefaultChain();return[i,o]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(t);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(t,r){this.client.core.storage.setItem(`${mw}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${mw}/${t}`)}}const JC=_0,ZC="wc",XC="ethereum_provider",tD=`${ZC}@2:${XC}:`,eD="https://rpc.walletconnect.com/v1/",eu=["eth_sendTransaction","personal_sign"],Ow=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],ru=["chainChanged","accountsChanged"],Pw=["chainChanged","accountsChanged","message","disconnect","connect"];var rD=Object.defineProperty,nD=Object.defineProperties,iD=Object.getOwnPropertyDescriptors,Mw=Object.getOwnPropertySymbols,sD=Object.prototype.hasOwnProperty,oD=Object.prototype.propertyIsEnumerable,$w=(e,t,r)=>t in e?rD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sa=(e,t)=>{for(var r in t||(t={}))sD.call(t,r)&&$w(e,r,t[r]);if(Mw)for(var r of Mw(t))oD.call(t,r)&&$w(e,r,t[r]);return e},E0=(e,t)=>nD(e,iD(t));function nu(e){return Number(e[0].split(":")[1])}function iu(e){return`0x${e.toString(16)}`}function aD(e){const{chains:t,optionalChains:r,methods:n,optionalMethods:i,events:o,optionalEvents:c,rpcMap:l}=e;if(!bi(t))throw new Error("Invalid chains");const f={chains:t,methods:n||eu,events:o||ru,rpcMap:sa({},t.length?{[nu(t)]:l[nu(t)]}:{})},h=o?.filter(x=>!ru.includes(x)),g=n?.filter(x=>!eu.includes(x));if(!r&&!c&&!i&&!(h!=null&&h.length)&&!(g!=null&&g.length))return{required:t.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:Ow))],events:[...new Set(f.events.concat(c!=null&&c.length?c:Pw))],rpcMap:l};return{required:t.length?f:void 0,optional:r.length?E:void 0}}class su{constructor(){this.events=new Cr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=tD,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new su;return await r.initialize(t),r}async request(t,r){return await this.signer.request(t,this.formatChainId(this.chainId),r)}sendAsync(t,r,n){this.signer.sendAsync(t,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(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:n}=aD(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(E0(sa({namespaces:sa({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:t?.pairingTopic})).then(h=>{c(h)}).catch(h=>{l(new Error(h.message))})});if(!i)return;const o=bg(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),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(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t?.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(E0(sa({},t),{chains:this.rpc.chains})).then(l=>{i(l)}).catch(l=>{o(new Error(l.message))})}),n=r.session;if(n){const i=bg(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",t=>{console.log({session_event:"session_event",payload:t});const{params:r}=t,{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",t)}),this.signer.on("chainChanged",t=>{console.log({chainChanged:"chainChanged",chainId:t});const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",iu(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{console.log({session_update:"session_event",payload:t}),this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",E0(sa({},Ue("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.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(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,n,i]=t.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,n;const i=(r=t?.chains)!=null?r:[],o=(n=t?.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?t?.methods||eu:[],f=i.length?t?.events||ru:[],h=t?.optionalMethods||[],g=t?.optionalEvents||[],_=t?.rpcMap||this.buildRpcMap(c,t.projectId),E=t?.qrModalOptions||void 0;return{chains:i?.map(x=>this.formatChainId(x)),optionalChains:o.map(x=>this.formatChainId(x)),methods:l,events:f,optionalMethods:h,optionalEvents:g,rpcMap:_,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:E,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const n={};return t.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?nu(this.rpc.chains):nu(this.rpc.optionalChains),this.signer=await JC.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await Promise.resolve().then(function(){return PD});r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(sa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:n,rpcMap:i}=t;r&&bi(r)&&(this.rpc.chains=r.map(o=>this.formatChainId(o)),r.forEach(o=>{this.rpc.rpcMap[o]=i?.[o]||this.getRpcUrl(o)})),n&&bi(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(t,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[t])||`${eD}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r?.accounts),this.setAccounts(r?.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),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(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const cD=su,lD=Symbol(),Nw=Object.getPrototypeOf,A0=new WeakMap,uD=e=>e&&(A0.has(e)?A0.get(e):Nw(e)===Object.prototype||Nw(e)===Array.prototype),hD=e=>uD(e)&&e[lD]||null,Tw=(e,t=!0)=>{A0.set(e,t)},x0=e=>typeof e=="object"&&e!==null,ps=new WeakMap,ou=new WeakSet,fD=(e=Object.is,t=(h,g)=>new Proxy(h,g),r=h=>x0(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,o=(h,g,_=n)=>{const E=i.get(h);if(E?.[0]===g)return E[1];const x=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return Tw(x,!0),i.set(h,[g,x]),Reflect.ownKeys(h).forEach(I=>{if(Object.getOwnPropertyDescriptor(x,I))return;const F=Reflect.get(h,I),W={value:F,enumerable:!0,configurable:!0};if(ou.has(F))Tw(F,!1);else if(F instanceof Promise)delete W.value,W.get=()=>_(F);else if(ps.has(F)){const[Y,B]=ps.get(F);W.value=o(Y,B(),_)}Object.defineProperty(x,I,W)}),Object.preventExtensions(x)},c=new WeakMap,l=[1,1],f=h=>{if(!x0(h))throw new Error("object required");const g=c.get(h);if(g)return g;let _=l[0];const E=new Set,x=(et,tt=++l[0])=>{_!==tt&&(_=tt,E.forEach(nt=>nt(et,tt)))};let I=l[1];const F=(et=++l[1])=>(I!==et&&!E.size&&(I=et,Y.forEach(([tt])=>{const nt=tt[1](et);nt>_&&(_=nt)})),_),W=et=>(tt,nt)=>{const dt=[...tt];dt[1]=[et,...dt[1]],x(dt,nt)},Y=new Map,B=(et,tt)=>{if(Y.has(et))throw new Error("prop listener already exists");if(E.size){const nt=tt[3](W(et));Y.set(et,[tt,nt])}else Y.set(et,[tt])},z=et=>{var tt;const nt=Y.get(et);nt&&(Y.delete(et),(tt=nt[1])==null||tt.call(nt))},P=et=>(E.add(et),E.size===1&&Y.forEach(([nt,dt],d)=>{if(dt)throw new Error("remove already exists");const p=nt[3](W(d));Y.set(d,[nt,p])}),()=>{E.delete(et),E.size===0&&Y.forEach(([nt,dt],d)=>{dt&&(dt(),Y.set(d,[nt]))})}),U=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),m=t(U,{deleteProperty(et,tt){const nt=Reflect.get(et,tt);z(tt);const dt=Reflect.deleteProperty(et,tt);return dt&&x(["delete",[tt],nt]),dt},set(et,tt,nt,dt){const d=Reflect.has(et,tt),p=Reflect.get(et,tt,dt);if(d&&(e(p,nt)||c.has(nt)&&e(p,c.get(nt))))return!0;z(tt),x0(nt)&&(nt=hD(nt)||nt);let b=nt;if(nt instanceof Promise)nt.then(C=>{nt.status="fulfilled",nt.value=C,x(["resolve",[tt],C])}).catch(C=>{nt.status="rejected",nt.reason=C,x(["reject",[tt],C])});else{!ps.has(nt)&&r(nt)&&(b=f(nt));const C=!ou.has(b)&&ps.get(b);C&&B(tt,C)}return Reflect.set(et,tt,b,dt),x(["set",[tt],nt,p]),!0}});c.set(h,m);const $=[U,F,o,P];return ps.set(m,$),Reflect.ownKeys(h).forEach(et=>{const tt=Object.getOwnPropertyDescriptor(h,et);"value"in tt&&(m[et]=h[et],delete tt.value,delete tt.writable),Object.defineProperty(U,et,tt)}),m})=>[f,ps,ou,e,t,r,n,i,o,c,l],[dD]=fD();function gs(e={}){return dD(e)}function Xs(e,t,r){const n=ps.get(e);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){t(o.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,l&&t(o.splice(0))}))});return l=!0,()=>{l=!1,h()}}function pD(e,t){const r=ps.get(e);r||console.warn("Please use proxy object");const[n,i,o]=r;return o(n,i(),t)}const Ar=gs({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),rr={state:Ar,subscribe(e){return Xs(Ar,()=>e(Ar))},push(e,t){e!==Ar.view&&(Ar.view=e,t&&(Ar.data=t),Ar.history.push(e))},reset(e){Ar.view=e,Ar.history=[e]},replace(e){Ar.history.length>1&&(Ar.history[Ar.history.length-1]=e,Ar.view=e)},goBack(){if(Ar.history.length>1){Ar.history.pop();const[e]=Ar.history.slice(-1);Ar.view=e}},setData(e){Ar.data=e}},Ut={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 Ut.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return Ut.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,r){if(Ut.isHttpUrl(e))return this.formatUniversalUrl(e,t,r);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(t);return`${n}wc?uri=${i}`},formatUniversalUrl(e,t,r){if(!Ut.isHttpUrl(e))return this.formatNativeUrl(e,t,r);let n=e;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(t);return`${n}wc?uri=${i}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(Ut.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(Ut.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(Ut.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(Ut.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=rr.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},gD=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Br=gs({enabled:gD,userSessionId:"",events:[],connectedWalletId:void 0}),Rw={state:Br,subscribe(e){return Xs(Br.events,()=>e(pD(Br.events[Br.events.length-1])))},initialize(){Br.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Br.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){Br.connectedWalletId=e},click(e){if(Br.enabled){const t={type:"CLICK",name:e.name,userSessionId:Br.userSessionId,timestamp:Date.now(),data:e};Br.events.push(t)}},track(e){if(Br.enabled){const t={type:"TRACK",name:e.name,userSessionId:Br.userSessionId,timestamp:Date.now(),data:e};Br.events.push(t)}},view(e){if(Br.enabled){const t={type:"VIEW",name:e.name,userSessionId:Br.userSessionId,timestamp:Date.now(),data:e};Br.events.push(t)}}},Si=gs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),hr={state:Si,subscribe(e){return Xs(Si,()=>e(Si))},setChains(e){Si.chains=e},setWalletConnectUri(e){Si.walletConnectUri=e},setIsCustomDesktop(e){Si.isCustomDesktop=e},setIsCustomMobile(e){Si.isCustomMobile=e},setIsDataLoaded(e){Si.isDataLoaded=e},setIsUiLoaded(e){Si.isUiLoaded=e},setIsAuth(e){Si.isAuth=e}},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(e){return Xs(au,()=>e(au))},setConfig(e){var t,r;Rw.initialize(),hr.setChains(e.chains),hr.setIsAuth(!!e.enableAuthMode),hr.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),hr.setIsCustomDesktop(!!((r=e.desktopWallets)!=null&&r.length)),Ut.setModalVersionInStorage(),Object.assign(au,e)}};var mD=Object.defineProperty,Lw=Object.getOwnPropertySymbols,vD=Object.prototype.hasOwnProperty,wD=Object.prototype.propertyIsEnumerable,Bw=(e,t,r)=>t in e?mD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yD=(e,t)=>{for(var r in t||(t={}))vD.call(t,r)&&Bw(e,r,t[r]);if(Lw)for(var r of Lw(t))wD.call(t,r)&&Bw(e,r,t[r]);return e};const I0="https://explorer-api.walletconnect.com",S0="wcm",C0="js-2.6.2";async function cu(e,t){const r=yD({sdkType:S0,sdkVersion:C0},t),n=new URL(e,I0);return n.searchParams.append("projectId",wn.state.projectId),Object.entries(r).forEach(([i,o])=>{o&&n.searchParams.append(i,String(o))}),(await fetch(n)).json()}const to={async getDesktopListings(e){return cu("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return cu("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return cu("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return cu("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${I0}/w3m/v1/getWalletImage/${e}?projectId=${wn.state.projectId}&sdkType=${S0}&sdkVersion=${C0}`},getAssetImageUrl(e){return`${I0}/w3m/v1/getAssetImage/${e}?projectId=${wn.state.projectId}&sdkType=${S0}&sdkVersion=${C0}`}};var bD=Object.defineProperty,Uw=Object.getOwnPropertySymbols,_D=Object.prototype.hasOwnProperty,ED=Object.prototype.propertyIsEnumerable,Fw=(e,t,r)=>t in e?bD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,AD=(e,t)=>{for(var r in t||(t={}))_D.call(t,r)&&Fw(e,r,t[r]);if(Uw)for(var r of Uw(t))ED.call(t,r)&&Fw(e,r,t[r]);return e};const jw=Ut.isMobile(),Ci=gs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),an={state:Ci,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=wn.state;if(e==="NONE"||t==="ALL"&&!e)return Ci.recomendedWallets;if(Ut.isArray(e)){const r={recommendedIds:e.join(",")},{listings:n}=await to.getAllListings(r),i=Object.values(n);i.sort((o,c)=>{const l=e.indexOf(o.id),f=e.indexOf(c.id);return l-f}),Ci.recomendedWallets=i}else{const{chains:r,isAuth:n}=hr.state,i=r?.join(","),o=Ut.isArray(t),c={page:1,sdks:n?"auth_v1":void 0,entries:Ut.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:o?t.join(","):void 0},{listings:l}=jw?await to.getMobileListings(c):await to.getDesktopListings(c);Ci.recomendedWallets=Object.values(l)}return Ci.recomendedWallets},async getWallets(e){const t=AD({},e),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=wn.state,{recomendedWallets:i}=Ci;if(n==="ALL")return Ci.wallets;i.length?t.excludedIds=i.map(_=>_.id).join(","):Ut.isArray(r)&&(t.excludedIds=r.join(",")),Ut.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),hr.state.isAuth&&(t.sdks="auth_v1");const{page:o,search:c}=e,{listings:l,total:f}=jw?await to.getMobileListings(t):await to.getDesktopListings(t),h=Object.values(l),g=c?"search":"wallets";return Ci[g]={listings:[...Ci[g].listings,...h],total:f,page:o??1},{listings:h,total:f}},getWalletImageUrl(e){return to.getWalletImageUrl(e)},getAssetImageUrl(e){return to.getAssetImageUrl(e)},resetSearch(){Ci.search={listings:[],total:0,page:1}}},oa=gs({open:!1}),eo={state:oa,subscribe(e){return Xs(oa,()=>e(oa))},async open(e){return new Promise(t=>{const{isUiLoaded:r,isDataLoaded:n}=hr.state;if(Ut.removeWalletConnectDeepLink(),hr.setWalletConnectUri(e?.uri),hr.setChains(e?.chains),rr.reset("ConnectWallet"),r&&n)oa.open=!0,t();else{const i=setInterval(()=>{const o=hr.state;o.isUiLoaded&&o.isDataLoaded&&(clearInterval(i),oa.open=!0,t())},200)}})},close(){oa.open=!1}};var xD=Object.defineProperty,kw=Object.getOwnPropertySymbols,ID=Object.prototype.hasOwnProperty,SD=Object.prototype.propertyIsEnumerable,qw=(e,t,r)=>t in e?xD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,CD=(e,t)=>{for(var r in t||(t={}))ID.call(t,r)&&qw(e,r,t[r]);if(kw)for(var r of kw(t))SD.call(t,r)&&qw(e,r,t[r]);return e};function DD(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const Ec=gs({themeMode:DD()?"dark":"light"}),ms={state:Ec,subscribe(e){return Xs(Ec,()=>e(Ec))},setThemeConfig(e){const{themeMode:t,themeVariables:r}=e;t&&(Ec.themeMode=t),r&&(Ec.themeVariables=CD({},r))}},ro=gs({open:!1,message:"",variant:"success"}),vs={state:ro,subscribe(e){return Xs(ro,()=>e(ro))},openToast(e,t){ro.open=!0,ro.message=e,ro.variant=t},closeToast(){ro.open=!1}};class OD{constructor(t){this.openModal=eo.open,this.closeModal=eo.close,this.subscribeModal=eo.subscribe,this.setTheme=ms.setThemeConfig,ms.setThemeConfig(t),wn.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return U$});const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),hr.setIsUiLoaded(!0)}}}var PD=Object.freeze({__proto__:null,WalletConnectModal:OD});/**
|
|
70
70
|
* @license
|
|
71
71
|
* Copyright 2019 Google LLC
|
|
72
72
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
73
|
-
*/const
|
|
73
|
+
*/const lu=window,D0=lu.ShadowRoot&&(lu.ShadyCSS===void 0||lu.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,O0=Symbol(),zw=new WeakMap;class Hw{constructor(t,r,n){if(this._$cssResult$=!0,n!==O0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o;const r=this.t;if(D0&&t===void 0){const n=r!==void 0&&r.length===1;n&&(t=zw.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&zw.set(r,t))}return t}toString(){return this.cssText}}const MD=e=>new Hw(typeof e=="string"?e:e+"",void 0,O0),$e=(e,...t)=>{const r=e.length===1?e[0]:t.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)+e[o+1],e[0]);return new Hw(r,e,O0)},$D=(e,t)=>{D0?e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):t.forEach(r=>{const n=document.createElement("style"),i=lu.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,e.appendChild(n)})},Kw=D0?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(const n of t.cssRules)r+=n.cssText;return MD(r)})(e):e;/**
|
|
74
74
|
* @license
|
|
75
75
|
* Copyright 2017 Google LLC
|
|
76
76
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
77
|
-
*/var
|
|
77
|
+
*/var P0;const uu=window,Ww=uu.trustedTypes,ND=Ww?Ww.emptyScript:"",Vw=uu.reactiveElementPolyfillSupport,M0={toAttribute(e,t){switch(t){case Boolean:e=e?ND:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Gw=(e,t)=>t!==e&&(t==t||e==e),$0={attribute:!0,type:String,converter:M0,reflect:!1,hasChanged:Gw},N0="finalized";class aa extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((r,n)=>{const i=this._$Ep(n,r);i!==void 0&&(this._$Ev.set(i,n),t.push(i))}),t}static createProperty(t,r=$0){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(t,r),!r.noAccessor&&!this.prototype.hasOwnProperty(t)){const n=typeof t=="symbol"?Symbol():"__"+t,i=this.getPropertyDescriptor(t,n,r);i!==void 0&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,r,n){return{get(){return this[r]},set(i){const o=this[t];this[r]=i,this.requestUpdate(t,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||$0}static finalize(){if(this.hasOwnProperty(N0))return!1;this[N0]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.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(t){const r=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const i of n)r.unshift(Kw(i))}else t!==void 0&&r.push(Kw(t));return r}static _$Ep(t,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(r=>r(this))}addController(t){var r,n;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)===null||n===void 0||n.call(t))}removeController(t){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var t;const r=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return $D(r,this.constructor.elementStyles),r}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostConnected)===null||n===void 0?void 0:n.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostDisconnected)===null||n===void 0?void 0:n.call(r)})}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$EO(t,r,n=$0){var i;const o=this.constructor._$Ep(t,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:M0).toAttribute(r,n.type);this._$El=t,c==null?this.removeAttribute(o):this.setAttribute(o,c),this._$El=null}}_$AK(t,r){var n;const i=this.constructor,o=i._$Ev.get(t);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:M0;this._$El=o,this[o]=l.fromAttribute(r,c.type),this._$El=null}}requestUpdate(t,r,n){let i=!0;t!==void 0&&(((n=n||this.constructor.getPropertyOptions(t)).hasChanged||Gw)(this[t],r)?(this._$AL.has(t)||this._$AL.set(t,r),n.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,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 t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;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),(t=this._$ES)===null||t===void 0||t.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(t){}_$AE(t){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(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((r,n)=>this._$EO(n,this[n],r)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}aa[N0]=!0,aa.elementProperties=new Map,aa.elementStyles=[],aa.shadowRootOptions={mode:"open"},Vw?.({ReactiveElement:aa}),((P0=uu.reactiveElementVersions)!==null&&P0!==void 0?P0:uu.reactiveElementVersions=[]).push("1.6.3");/**
|
|
78
78
|
* @license
|
|
79
79
|
* Copyright 2017 Google LLC
|
|
80
80
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
81
|
-
*/var T0;const
|
|
82
|
-
\f\r]`,
|
|
83
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
81
|
+
*/var T0;const hu=window,ca=hu.trustedTypes,Yw=ca?ca.createPolicy("lit-html",{createHTML:e=>e}):void 0,R0="$lit$",ws=`lit$${(Math.random()+"").slice(9)}$`,Qw="?"+ws,TD=`<${Qw}>`,no=document,Ac=()=>no.createComment(""),xc=e=>e===null||typeof e!="object"&&typeof e!="function",Jw=Array.isArray,RD=e=>Jw(e)||typeof e?.[Symbol.iterator]=="function",L0=`[
|
|
82
|
+
\f\r]`,Ic=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zw=/-->/g,Xw=/>/g,io=RegExp(`>|${L0}(?:([^\\s"'>=/]+)(${L0}*=${L0}*(?:[^
|
|
83
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),t2=/'/g,e2=/"/g,r2=/^(?:script|style|textarea|title)$/i,n2=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),vt=n2(1),ar=n2(2),so=Symbol.for("lit-noChange"),wr=Symbol.for("lit-nothing"),i2=new WeakMap,oo=no.createTreeWalker(no,129,null,!1);function s2(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Yw!==void 0?Yw.createHTML(t):t}const LD=(e,t)=>{const r=e.length-1,n=[];let i,o=t===2?"<svg>":"",c=Ic;for(let l=0;l<r;l++){const f=e[l];let h,g,_=-1,E=0;for(;E<f.length&&(c.lastIndex=E,g=c.exec(f),g!==null);)E=c.lastIndex,c===Ic?g[1]==="!--"?c=Zw:g[1]!==void 0?c=Xw:g[2]!==void 0?(r2.test(g[2])&&(i=RegExp("</"+g[2],"g")),c=io):g[3]!==void 0&&(c=io):c===io?g[0]===">"?(c=i??Ic,_=-1):g[1]===void 0?_=-2:(_=c.lastIndex-g[2].length,h=g[1],c=g[3]===void 0?io:g[3]==='"'?e2:t2):c===e2||c===t2?c=io:c===Zw||c===Xw?c=Ic:(c=io,i=void 0);const x=c===io&&e[l+1].startsWith("/>")?" ":"";o+=c===Ic?f+TD:_>=0?(n.push(h),f.slice(0,_)+R0+f.slice(_)+ws+x):f+ws+(_===-2?(n.push(void 0),l):x)}return[s2(e,o+(e[r]||"<?>")+(t===2?"</svg>":"")),n]};class Sc{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let o=0,c=0;const l=t.length-1,f=this.parts,[h,g]=LD(t,r);if(this.el=Sc.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(R0)||E.startsWith(ws)){const x=g[c++];if(_.push(E),x!==void 0){const I=i.getAttribute(x.toLowerCase()+R0).split(ws),F=/([.?@])?(.*)/.exec(x);f.push({type:1,index:o,name:F[2],strings:I,ctor:F[1]==="."?UD:F[1]==="?"?jD:F[1]==="@"?kD:fu})}else f.push({type:6,index:o})}for(const E of _)i.removeAttribute(E)}if(r2.test(i.tagName)){const _=i.textContent.split(ws),E=_.length-1;if(E>0){i.textContent=ca?ca.emptyScript:"";for(let x=0;x<E;x++)i.append(_[x],Ac()),oo.nextNode(),f.push({type:2,index:++o});i.append(_[E],Ac())}}}else if(i.nodeType===8)if(i.data===Qw)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(t,r){const n=no.createElement("template");return n.innerHTML=t,n}}function la(e,t,r=e,n){var i,o,c,l;if(t===so)return t;let f=n!==void 0?(i=r._$Co)===null||i===void 0?void 0:i[n]:r._$Cl;const h=xc(t)?void 0:t._$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(e),f._$AT(e,r,n)),n!==void 0?((c=(l=r)._$Co)!==null&&c!==void 0?c:l._$Co=[])[n]=f:r._$Cl=f),f!==void 0&&(t=la(e,f._$AS(e,t.values),f,n)),t}class BD{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var r;const{el:{content:n},parts:i}=this._$AD,o=((r=t?.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,t):h.type===1?g=new h.ctor(c,h.name,h.strings,this,t):h.type===6&&(g=new qD(c,this,t)),this._$AV.push(g),h=i[++f]}l!==h?.index&&(c=oo.nextNode(),l++)}return oo.currentNode=no,o}v(t){let r=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,r),r+=n.strings.length-2):n._$AI(t[r])),r++}}class Cc{constructor(t,r,n,i){var o;this.type=2,this._$AH=wr,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=i,this._$Cp=(o=i?.isConnected)===null||o===void 0||o}get _$AU(){var t,r;return(r=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=la(this,t,r),xc(t)?t===wr||t==null||t===""?(this._$AH!==wr&&this._$AR(),this._$AH=wr):t!==this._$AH&&t!==so&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):RD(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==wr&&xc(this._$AH)?this._$AA.nextSibling.data=t:this.$(no.createTextNode(t)),this._$AH=t}g(t){var r;const{values:n,_$litType$:i}=t,o=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Sc.createElement(s2(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 BD(o,this),l=c.u(this.options);c.v(n),this.$(l),this._$AH=c}}_$AC(t){let r=i2.get(t.strings);return r===void 0&&i2.set(t.strings,r=new Sc(t)),r}T(t){Jw(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,i=0;for(const o of t)i===r.length?r.push(n=new Cc(this.k(Ac()),this.k(Ac()),this,this.options)):n=r[i],n._$AI(o),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(t=this._$AA.nextSibling,r){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,r);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var r;this._$AM===void 0&&(this._$Cp=t,(r=this._$AP)===null||r===void 0||r.call(this,t))}}class fu{constructor(t,r,n,i,o){this.type=1,this._$AH=wr,this._$AN=void 0,this.element=t,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=wr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,r=this,n,i){const o=this.strings;let c=!1;if(o===void 0)t=la(this,t,r,0),c=!xc(t)||t!==this._$AH&&t!==so,c&&(this._$AH=t);else{const l=t;let f,h;for(t=o[0],f=0;f<o.length-1;f++)h=la(this,l[n+f],r,f),h===so&&(h=this._$AH[f]),c||(c=!xc(h)||h!==this._$AH[f]),h===wr?t=wr:t!==wr&&(t+=(h??"")+o[f+1]),this._$AH[f]=h}c&&!i&&this.j(t)}j(t){t===wr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class UD extends fu{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wr?void 0:t}}const FD=ca?ca.emptyScript:"";class jD extends fu{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wr?this.element.setAttribute(this.name,FD):this.element.removeAttribute(this.name)}}class kD extends fu{constructor(t,r,n,i,o){super(t,r,n,i,o),this.type=5}_$AI(t,r=this){var n;if((t=(n=la(this,t,r,0))!==null&&n!==void 0?n:wr)===so)return;const i=this._$AH,o=t===wr&&i!==wr||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,c=t!==wr&&(i===wr||o);o&&this.element.removeEventListener(this.name,this,i),c&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){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,t):this._$AH.handleEvent(t)}}class qD{constructor(t,r,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){la(this,t)}}const o2=hu.litHtmlPolyfillSupport;o2?.(Sc,Cc),((T0=hu.litHtmlVersions)!==null&&T0!==void 0?T0:hu.litHtmlVersions=[]).push("2.8.0");const zD=(e,t,r)=>{var n,i;const o=(n=r?.renderBefore)!==null&&n!==void 0?n:t;let c=o._$litPart$;if(c===void 0){const l=(i=r?.renderBefore)!==null&&i!==void 0?i:null;o._$litPart$=c=new Cc(t.insertBefore(Ac(),l),l,void 0,r??{})}return c._$AI(e),c};/**
|
|
84
84
|
* @license
|
|
85
85
|
* Copyright 2017 Google LLC
|
|
86
86
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
87
|
-
*/var
|
|
87
|
+
*/var B0,U0;class me extends aa{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,r;const n=super.createRenderRoot();return(t=(r=this.renderOptions).renderBefore)!==null&&t!==void 0||(r.renderBefore=n.firstChild),n}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=zD(r,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return so}}me.finalized=!0,me._$litElement$=!0,(B0=globalThis.litElementHydrateSupport)===null||B0===void 0||B0.call(globalThis,{LitElement:me});const a2=globalThis.litElementPolyfillSupport;a2?.({LitElement:me}),((U0=globalThis.litElementVersions)!==null&&U0!==void 0?U0:globalThis.litElementVersions=[]).push("3.3.3");/**
|
|
88
88
|
* @license
|
|
89
89
|
* Copyright 2017 Google LLC
|
|
90
90
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
91
|
-
*/const
|
|
91
|
+
*/const De=e=>t=>typeof t=="function"?((r,n)=>(customElements.define(r,n),n))(e,t):((r,n)=>{const{kind:i,elements:o}=n;return{kind:i,elements:o,finisher(c){customElements.define(r,c)}}})(e,t);/**
|
|
92
92
|
* @license
|
|
93
93
|
* Copyright 2017 Google LLC
|
|
94
94
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
95
|
-
*/const
|
|
95
|
+
*/const HD=(e,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(r){r.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(r){r.createProperty(t.key,e)}},KD=(e,t,r)=>{t.constructor.createProperty(r,e)};function he(e){return(t,r)=>r!==void 0?KD(e,t,r):HD(e,t)}/**
|
|
96
96
|
* @license
|
|
97
97
|
* Copyright 2017 Google LLC
|
|
98
98
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
99
|
-
*/function cn(
|
|
99
|
+
*/function cn(e){return he({...e,state:!0})}/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright 2021 Google LLC
|
|
102
102
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
103
|
-
*/var
|
|
103
|
+
*/var F0;((F0=window.HTMLSlotElement)===null||F0===void 0?void 0:F0.prototype.assignedElements)!=null;/**
|
|
104
104
|
* @license
|
|
105
105
|
* Copyright 2017 Google LLC
|
|
106
106
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
107
|
-
*/const
|
|
107
|
+
*/const WD={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},VD=e=>(...t)=>({_$litDirective$:e,values:t});class GD{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,n){this._$Ct=t,this._$AM=r,this._$Ci=n}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}}/**
|
|
108
108
|
* @license
|
|
109
109
|
* Copyright 2018 Google LLC
|
|
110
110
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
111
|
-
*/const Wi=KC(class extends WC{constructor(t){var e;if(super(t),t.type!==HC.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 VC(t,e){t.indexOf(e)===-1&&t.push(e)}const o2=(t,e,r)=>Math.min(Math.max(r,t),e),Tn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},fu=t=>typeof t=="number",ua=t=>Array.isArray(t)&&!fu(t[0]),GC=(t,e,r)=>{const n=e-t;return((r-t)%n+n)%n+t};function YC(t,e){return ua(t)?t[GC(0,t.length,e)]:t}const a2=(t,e,r)=>-r*t+r*e+t,c2=()=>{},ys=t=>t,F0=(t,e,r)=>e-t===0?1:(r-t)/(e-t);function l2(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=F0(0,e,n);t.push(a2(r,1,i))}}function QC(t){const e=[0];return l2(e,t-1),e}function JC(t,e=QC(t.length),r=ys){const n=t.length,i=n-e.length;return i>0&&l2(e,i),o=>{let c=0;for(;c<n-2&&!(o<e[c+1]);c++);let l=o2(0,1,F0(e[c],e[c+1],o));return l=YC(r,c)(l),a2(t[c],t[c+1],l)}}const u2=t=>Array.isArray(t)&&fu(t[0]),j0=t=>typeof t=="object"&&!!t.createAnimation,ao=t=>typeof t=="function",ZC=t=>typeof t=="string",Ic={ms:t=>t*1e3,s:t=>t/1e3},h2=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XC=1e-7,eO=12;function tO(t,e,r,n,i){let o,c,l=0;do c=e+(r-e)/2,o=h2(c,n,i)-t,o>0?r=c:e=c;while(Math.abs(o)>XC&&++l<eO);return c}function Dc(t,e,r,n){if(t===e&&r===n)return ys;const i=o=>tO(o,0,1,t,r);return o=>o===0||o===1?o:h2(i(o),e,n)}const rO=(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 o2(0,1,i/t)},f2={ease:Dc(.25,.1,.25,1),"ease-in":Dc(.42,0,1,1),"ease-in-out":Dc(.42,0,.58,1),"ease-out":Dc(0,0,.58,1)},nO=/\((.*?)\)/;function d2(t){if(ao(t))return t;if(u2(t))return Dc(...t);if(f2[t])return f2[t];if(t.startsWith("steps")){const e=nO.exec(t);if(e){const r=e[1].split(",");return rO(parseFloat(r[0]),r[1].trim())}}return ys}class p2{constructor(e,r=[0,1],{easing:n,duration:i=Tn.duration,delay:o=Tn.delay,endDelay:c=Tn.endDelay,repeat:l=Tn.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||Tn.easing,j0(n)){const _=n.createAnimation(r);n=_.easing,r=_.keyframes||r,i=_.duration||i}this.repeat=l,this.easing=ua(n)?ys:d2(n),this.updateDuration(i);const g=JC(r,f,ua(n)?n.map(d2):ys);this.tick=_=>{var E;o=o;let x=0;this.pauseTime!==void 0?x=this.pauseTime:x=(_-this.startTime)*this.rate,this.t=x,x/=1e3,x=Math.max(x-o,0),this.playState==="finished"&&this.pauseTime===void 0&&(x=this.totalDuration);const I=x/this.duration;let k=Math.floor(I),W=I%1;!W&&I>=1&&(W=1),W===1&&k--;const Y=k%2;(h==="reverse"||h==="alternate"&&Y||h==="alternate-reverse"&&!Y)&&(W=1-W);const B=x>=this.totalDuration?1:Math.min(W,1),z=g(this.easing(B));e(z),this.pauseTime===void 0&&(this.playState==="finished"||x>=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 k0=function(){};process.env.NODE_ENV!=="production"&&(k0=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 q0=new WeakMap;function g2(t){return q0.has(t)||q0.set(t,{transforms:[],values:new Map}),q0.get(t)}function sO(t,e){return t.has(e)||t.set(e,new iO),t.get(e)}const oO=["","X","Y","Z"],aO=["translate","scale","rotate","skew"],du={x:"translateX",y:"translateY",z:"translateZ"},m2={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},cO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:m2,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:ys},skew:m2},Cc=new Map,z0=t=>`--motion-${t}`,pu=["x","y","z"];aO.forEach(t=>{oO.forEach(e=>{pu.push(t+e),Cc.set(z0(t+e),cO[t])})});const lO=(t,e)=>pu.indexOf(t)-pu.indexOf(e),uO=new Set(pu),v2=t=>uO.has(t),hO=(t,e)=>{du[e]&&(e=du[e]);const{transforms:r}=g2(t);VC(r,e),t.style.transform=fO(r)},fO=t=>t.sort(lO).reduce(dO,"").trim(),dO=(t,e)=>`${t} ${e}(var(${z0(e)}))`,H0=t=>t.startsWith("--"),w2=new Set;function pO(t){if(!w2.has(t)){w2.add(t);try{const{syntax:e,initialValue:r}=Cc.has(t)?Cc.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:r})}catch{}}}const K0=(t,e)=>document.createElement("div").animate(t,e),y2={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{K0({opacity:[1]})}catch{return!1}return!0},finished:()=>!!K0({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{K0({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},W0={},ha={};for(const t in y2)ha[t]=()=>(W0[t]===void 0&&(W0[t]=y2[t]()),W0[t]);const gO=.015,mO=(t,e)=>{let r="";const n=Math.round(e/gO);for(let i=0;i<n;i++)r+=t(F0(0,n-1,i))+", ";return r.substring(0,r.length-2)},b2=(t,e)=>ao(t)?ha.linearEasing()?`linear(${mO(t,e)})`:Tn.easing:u2(t)?vO(t):t,vO=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`;function wO(t,e){for(let r=0;r<t.length;r++)t[r]===null&&(t[r]=r?t[r-1]:e());return t}const yO=t=>Array.isArray(t)?t:[t];function V0(t){return du[t]&&(t=du[t]),v2(t)?z0(t):t}const gu={get:(t,e)=>{e=V0(e);let r=H0(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!r&&r!==0){const n=Cc.get(e);n&&(r=n.initialValue)}return r},set:(t,e,r)=>{e=V0(e),H0(e)?t.style.setProperty(e,r):t.style[e]=r}};function _2(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch{}}function bO(t,e){var r;let n=e?.toDefaultUnit||ys;const i=t[t.length-1];if(ZC(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 _O(){return window.__MOTION_DEV_TOOLS_RECORD}function EO(t,e,r,n={},i){const o=_O(),c=n.record!==!1&&o;let l,{duration:f=Tn.duration,delay:h=Tn.delay,endDelay:g=Tn.endDelay,repeat:_=Tn.repeat,easing:E=Tn.easing,persist:x=!1,direction:I,offset:k,allowWebkitAcceleration:W=!1}=n;const Y=g2(t),B=v2(e);let z=ha.waapi();B&&hO(t,e);const M=V0(e),U=sO(Y.values,M),F=Cc.get(M);return _2(U.animation,!(j0(E)&&U.generator)&&n.record!==!1),()=>{const m=()=>{var ee,ne;return(ne=(ee=gu.get(t,M))!==null&&ee!==void 0?ee:F?.initialValue)!==null&&ne!==void 0?ne:0};let $=wO(yO(r),m);const te=bO($,F);if(j0(E)){const ee=E.createAnimation($,e!=="opacity",m,M,U);E=ee.easing,$=ee.keyframes||$,f=ee.duration||f}if(H0(M)&&(ha.cssRegisterProperty()?pO(M):z=!1),B&&!ha.linearEasing()&&(ao(E)||ua(E)&&E.some(ao))&&(z=!1),z){F&&($=$.map(de=>fu(de)?F.toDefaultUnit(de):de)),$.length===1&&(!ha.partialKeyframes()||c)&&$.unshift(m());const ee={delay:Ic.ms(h),duration:Ic.ms(f),endDelay:Ic.ms(g),easing:ua(E)?void 0:b2(E,f),direction:I,iterations:_+1,fill:"both"};l=t.animate({[M]:$,offset:k,easing:ua(E)?E.map(de=>b2(de,f)):void 0},ee),l.finished||(l.finished=new Promise((de,d)=>{l.onfinish=de,l.oncancel=d}));const ne=$[$.length-1];l.finished.then(()=>{x||(gu.set(t,M,ne),l.cancel())}).catch(c2),W||(l.playbackRate=1.000001)}else if(i&&B)$=$.map(ee=>typeof ee=="string"?parseFloat(ee):ee),$.length===1&&$.unshift(parseFloat(m())),l=new i(ee=>{gu.set(t,M,te?te(ee):ee)},$,Object.assign(Object.assign({},n),{duration:f,easing:E}));else{const ee=$[$.length-1];gu.set(t,M,F&&fu(ee)?F.toDefaultUnit(ee):ee)}return c&&o(t,e,$,{duration:f,delay:h,easing:E,repeat:_,offset:k},"motion-one"),U.setAnimation(l),l}}const AO=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function E2(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 xO=t=>t(),A2=(t,e,r=Tn.duration)=>new Proxy({animations:t.map(xO).filter(Boolean),duration:r,options:e},IO),SO=t=>t.animations[0],IO={get:(t,e)=>{const r=SO(t);switch(e){case"duration":return t.duration;case"currentTime":return Ic.s(r?.[e]||0);case"playbackRate":case"playState":return r?.[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(DO)).catch(c2)),t.finished;case"stop":return()=>{t.animations.forEach(n=>_2(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=Ic.ms(r);case"playbackRate":for(let n=0;n<t.animations.length;n++)t.animations[n][e]=r;return!0}return!1}},DO=t=>t.finished;function CO(t,e,r){return ao(t)?t(e,r):t}function OO(t){return function(r,n,i={}){r=E2(r);const o=r.length;k0(!!o,"No valid element provided."),k0(!!n,"No keyframes defined.");const c=[];for(let l=0;l<o;l++){const f=r[l];for(const h in n){const g=AO(i,h);g.delay=CO(g.delay,l,o);const _=EO(f,h,n[h],g,t);c.push(_)}}return A2(c,i,i.duration)}}const MO=OO(p2);function PO(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 $O={any:0,all:1};function TO(t,e,{root:r,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const o=E2(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:$O[i]});return o.forEach(h=>f.observe(h)),()=>f.disconnect()}function G0(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:r}}))}function x2(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:r}}))}const NO={isActive:t=>!!t.inView,subscribe:(t,{enable:e,disable:r},{inViewOptions:n={}})=>{const{once:i}=n,o=PO(n,["once"]);return TO(t,c=>{if(e(),x2(t,"viewenter",c),!i)return l=>{r(),x2(t,"viewleave",l)}},o)}},S2=(t,e,r)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(r(),G0(t,e,n))};[...Object.keys({inView:NO,hover:{isActive:t=>!!t.hover,subscribe:(t,{enable:e,disable:r})=>{const n=S2(t,"hoverstart",e),i=S2(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(),G0(t,"pressend",o),window.removeEventListener("pointerup",n)},i=o=>{e(),G0(t,"pressstart",o),window.addEventListener("pointerup",n)};return t.addEventListener("pointerdown",i),()=>{t.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function RO(t,e={}){return A2([()=>{const r=new p2(t,[0,1],e);return r.finished.catch(()=>{}),r}],e,e.duration)}function co(t,e,r){return(ao(t)?RO:MO)(t,e,r)}/**
|
|
111
|
+
*/const Gi=VD(class extends GD{constructor(e){var t;if(super(e),e.type!==WD.ATTRIBUTE||e.name!=="class"||((t=e.strings)===null||t===void 0?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){var r,n;if(this.it===void 0){this.it=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(const o in t)t[o]&&!(!((r=this.nt)===null||r===void 0)&&r.has(o))&&this.it.add(o);return this.render(t)}const i=e.element.classList;this.it.forEach(o=>{o in t||(i.remove(o),this.it.delete(o))});for(const o in t){const c=!!t[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 YD(e,t){e.indexOf(t)===-1&&e.push(t)}const c2=(e,t,r)=>Math.min(Math.max(r,e),t),Nn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},du=e=>typeof e=="number",ua=e=>Array.isArray(e)&&!du(e[0]),QD=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function JD(e,t){return ua(e)?e[QD(0,e.length,t)]:e}const l2=(e,t,r)=>-r*e+r*t+e,u2=()=>{},ys=e=>e,j0=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function h2(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const i=j0(0,t,n);e.push(l2(r,1,i))}}function ZD(e){const t=[0];return h2(t,e-1),t}function XD(e,t=ZD(e.length),r=ys){const n=e.length,i=n-t.length;return i>0&&h2(t,i),o=>{let c=0;for(;c<n-2&&!(o<t[c+1]);c++);let l=c2(0,1,j0(t[c],t[c+1],o));return l=JD(r,c)(l),l2(e[c],e[c+1],l)}}const f2=e=>Array.isArray(e)&&du(e[0]),k0=e=>typeof e=="object"&&!!e.createAnimation,ao=e=>typeof e=="function",tO=e=>typeof e=="string",Dc={ms:e=>e*1e3,s:e=>e/1e3},d2=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,eO=1e-7,rO=12;function nO(e,t,r,n,i){let o,c,l=0;do c=t+(r-t)/2,o=d2(c,n,i)-e,o>0?r=c:t=c;while(Math.abs(o)>eO&&++l<rO);return c}function Oc(e,t,r,n){if(e===t&&r===n)return ys;const i=o=>nO(o,0,1,e,r);return o=>o===0||o===1?o:d2(i(o),t,n)}const iO=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,i=t==="end"?Math.floor(n):Math.ceil(n);return c2(0,1,i/e)},p2={ease:Oc(.25,.1,.25,1),"ease-in":Oc(.42,0,1,1),"ease-in-out":Oc(.42,0,.58,1),"ease-out":Oc(0,0,.58,1)},sO=/\((.*?)\)/;function g2(e){if(ao(e))return e;if(f2(e))return Oc(...e);if(p2[e])return p2[e];if(e.startsWith("steps")){const t=sO.exec(e);if(t){const r=t[1].split(",");return iO(parseFloat(r[0]),r[1].trim())}}return ys}class m2{constructor(t,r=[0,1],{easing:n,duration:i=Nn.duration,delay:o=Nn.delay,endDelay:c=Nn.endDelay,repeat:l=Nn.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||Nn.easing,k0(n)){const _=n.createAnimation(r);n=_.easing,r=_.keyframes||r,i=_.duration||i}this.repeat=l,this.easing=ua(n)?ys:g2(n),this.updateDuration(i);const g=XD(r,f,ua(n)?n.map(g2):ys);this.tick=_=>{var E;o=o;let x=0;this.pauseTime!==void 0?x=this.pauseTime:x=(_-this.startTime)*this.rate,this.t=x,x/=1e3,x=Math.max(x-o,0),this.playState==="finished"&&this.pauseTime===void 0&&(x=this.totalDuration);const I=x/this.duration;let F=Math.floor(I),W=I%1;!W&&I>=1&&(W=1),W===1&&F--;const Y=F%2;(h==="reverse"||h==="alternate"&&Y||h==="alternate-reverse"&&!Y)&&(W=1-W);const B=x>=this.totalDuration?1:Math.min(W,1),z=g(this.easing(B));t(z),this.pauseTime===void 0&&(this.playState==="finished"||x>=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 t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),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 t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}var q0=function(){};process.env.NODE_ENV!=="production"&&(q0=function(e,t){if(!e)throw new Error(t)});class oO{setAnimation(t){this.animation=t,t?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const z0=new WeakMap;function v2(e){return z0.has(e)||z0.set(e,{transforms:[],values:new Map}),z0.get(e)}function aO(e,t){return e.has(t)||e.set(t,new oO),e.get(t)}const cO=["","X","Y","Z"],lO=["translate","scale","rotate","skew"],pu={x:"translateX",y:"translateY",z:"translateZ"},w2={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:e=>e+"deg"},uO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:e=>e+"px"},rotate:w2,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:ys},skew:w2},Pc=new Map,H0=e=>`--motion-${e}`,gu=["x","y","z"];lO.forEach(e=>{cO.forEach(t=>{gu.push(e+t),Pc.set(H0(e+t),uO[e])})});const hO=(e,t)=>gu.indexOf(e)-gu.indexOf(t),fO=new Set(gu),y2=e=>fO.has(e),dO=(e,t)=>{pu[t]&&(t=pu[t]);const{transforms:r}=v2(e);YD(r,t),e.style.transform=pO(r)},pO=e=>e.sort(hO).reduce(gO,"").trim(),gO=(e,t)=>`${e} ${t}(var(${H0(t)}))`,K0=e=>e.startsWith("--"),b2=new Set;function mO(e){if(!b2.has(e)){b2.add(e);try{const{syntax:t,initialValue:r}=Pc.has(e)?Pc.get(e):{};CSS.registerProperty({name:e,inherits:!1,syntax:t,initialValue:r})}catch{}}}const W0=(e,t)=>document.createElement("div").animate(e,t),_2={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{W0({opacity:[1]})}catch{return!1}return!0},finished:()=>!!W0({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{W0({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},V0={},ha={};for(const e in _2)ha[e]=()=>(V0[e]===void 0&&(V0[e]=_2[e]()),V0[e]);const vO=.015,wO=(e,t)=>{let r="";const n=Math.round(t/vO);for(let i=0;i<n;i++)r+=e(j0(0,n-1,i))+", ";return r.substring(0,r.length-2)},E2=(e,t)=>ao(e)?ha.linearEasing()?`linear(${wO(e,t)})`:Nn.easing:f2(e)?yO(e):e,yO=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`;function bO(e,t){for(let r=0;r<e.length;r++)e[r]===null&&(e[r]=r?e[r-1]:t());return e}const _O=e=>Array.isArray(e)?e:[e];function G0(e){return pu[e]&&(e=pu[e]),y2(e)?H0(e):e}const mu={get:(e,t)=>{t=G0(t);let r=K0(t)?e.style.getPropertyValue(t):getComputedStyle(e)[t];if(!r&&r!==0){const n=Pc.get(t);n&&(r=n.initialValue)}return r},set:(e,t,r)=>{t=G0(t),K0(t)?e.style.setProperty(t,r):e.style[t]=r}};function A2(e,t=!0){if(!(!e||e.playState==="finished"))try{e.stop?e.stop():(t&&e.commitStyles(),e.cancel())}catch{}}function EO(e,t){var r;let n=t?.toDefaultUnit||ys;const i=e[e.length-1];if(tO(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 AO(){return window.__MOTION_DEV_TOOLS_RECORD}function xO(e,t,r,n={},i){const o=AO(),c=n.record!==!1&&o;let l,{duration:f=Nn.duration,delay:h=Nn.delay,endDelay:g=Nn.endDelay,repeat:_=Nn.repeat,easing:E=Nn.easing,persist:x=!1,direction:I,offset:F,allowWebkitAcceleration:W=!1}=n;const Y=v2(e),B=y2(t);let z=ha.waapi();B&&dO(e,t);const P=G0(t),U=aO(Y.values,P),j=Pc.get(P);return A2(U.animation,!(k0(E)&&U.generator)&&n.record!==!1),()=>{const m=()=>{var tt,nt;return(nt=(tt=mu.get(e,P))!==null&&tt!==void 0?tt:j?.initialValue)!==null&&nt!==void 0?nt:0};let $=bO(_O(r),m);const et=EO($,j);if(k0(E)){const tt=E.createAnimation($,t!=="opacity",m,P,U);E=tt.easing,$=tt.keyframes||$,f=tt.duration||f}if(K0(P)&&(ha.cssRegisterProperty()?mO(P):z=!1),B&&!ha.linearEasing()&&(ao(E)||ua(E)&&E.some(ao))&&(z=!1),z){j&&($=$.map(dt=>du(dt)?j.toDefaultUnit(dt):dt)),$.length===1&&(!ha.partialKeyframes()||c)&&$.unshift(m());const tt={delay:Dc.ms(h),duration:Dc.ms(f),endDelay:Dc.ms(g),easing:ua(E)?void 0:E2(E,f),direction:I,iterations:_+1,fill:"both"};l=e.animate({[P]:$,offset:F,easing:ua(E)?E.map(dt=>E2(dt,f)):void 0},tt),l.finished||(l.finished=new Promise((dt,d)=>{l.onfinish=dt,l.oncancel=d}));const nt=$[$.length-1];l.finished.then(()=>{x||(mu.set(e,P,nt),l.cancel())}).catch(u2),W||(l.playbackRate=1.000001)}else if(i&&B)$=$.map(tt=>typeof tt=="string"?parseFloat(tt):tt),$.length===1&&$.unshift(parseFloat(m())),l=new i(tt=>{mu.set(e,P,et?et(tt):tt)},$,Object.assign(Object.assign({},n),{duration:f,easing:E}));else{const tt=$[$.length-1];mu.set(e,P,j&&du(tt)?j.toDefaultUnit(tt):tt)}return c&&o(e,t,$,{duration:f,delay:h,easing:E,repeat:_,offset:F},"motion-one"),U.setAnimation(l),l}}const IO=(e,t)=>e[t]?Object.assign(Object.assign({},e),e[t]):Object.assign({},e);function x2(e,t){var r;return typeof e=="string"?t?((r=t[e])!==null&&r!==void 0||(t[e]=document.querySelectorAll(e)),e=t[e]):e=document.querySelectorAll(e):e instanceof Element&&(e=[e]),Array.from(e||[])}const SO=e=>e(),I2=(e,t,r=Nn.duration)=>new Proxy({animations:e.map(SO).filter(Boolean),duration:r,options:t},DO),CO=e=>e.animations[0],DO={get:(e,t)=>{const r=CO(e);switch(t){case"duration":return e.duration;case"currentTime":return Dc.s(r?.[t]||0);case"playbackRate":case"playState":return r?.[t];case"finished":return e.finished||(e.finished=Promise.all(e.animations.map(OO)).catch(u2)),e.finished;case"stop":return()=>{e.animations.forEach(n=>A2(n))};case"forEachNative":return n=>{e.animations.forEach(i=>n(i,e))};default:return typeof r?.[t]>"u"?void 0:()=>e.animations.forEach(n=>n[t]())}},set:(e,t,r)=>{switch(t){case"currentTime":r=Dc.ms(r);case"playbackRate":for(let n=0;n<e.animations.length;n++)e.animations[n][t]=r;return!0}return!1}},OO=e=>e.finished;function PO(e,t,r){return ao(e)?e(t,r):e}function MO(e){return function(r,n,i={}){r=x2(r);const o=r.length;q0(!!o,"No valid element provided."),q0(!!n,"No keyframes defined.");const c=[];for(let l=0;l<o;l++){const f=r[l];for(const h in n){const g=IO(i,h);g.delay=PO(g.delay,l,o);const _=xO(f,h,n[h],g,e);c.push(_)}}return I2(c,i,i.duration)}}const $O=MO(m2);function NO(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}typeof SuppressedError=="function"&&SuppressedError;const TO={any:0,all:1};function RO(e,t,{root:r,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const o=x2(e),c=new WeakMap,l=h=>{h.forEach(g=>{const _=c.get(g.target);if(g.isIntersecting!==!!_)if(g.isIntersecting){const E=t(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:TO[i]});return o.forEach(h=>f.observe(h)),()=>f.disconnect()}function Y0(e,t,r){e.dispatchEvent(new CustomEvent(t,{detail:{originalEvent:r}}))}function S2(e,t,r){e.dispatchEvent(new CustomEvent(t,{detail:{originalEntry:r}}))}const LO={isActive:e=>!!e.inView,subscribe:(e,{enable:t,disable:r},{inViewOptions:n={}})=>{const{once:i}=n,o=NO(n,["once"]);return RO(e,c=>{if(t(),S2(e,"viewenter",c),!i)return l=>{r(),S2(e,"viewleave",l)}},o)}},C2=(e,t,r)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(r(),Y0(e,t,n))};[...Object.keys({inView:LO,hover:{isActive:e=>!!e.hover,subscribe:(e,{enable:t,disable:r})=>{const n=C2(e,"hoverstart",t),i=C2(e,"hoverend",r);return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",i),()=>{e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",i)}}},press:{isActive:e=>!!e.press,subscribe:(e,{enable:t,disable:r})=>{const n=o=>{r(),Y0(e,"pressend",o),window.removeEventListener("pointerup",n)},i=o=>{t(),Y0(e,"pressstart",o),window.addEventListener("pointerup",n)};return e.addEventListener("pointerdown",i),()=>{e.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function BO(e,t={}){return I2([()=>{const r=new m2(e,[0,1],t);return r.finished.catch(()=>{}),r}],t,t.duration)}function co(e,t,r){return(ao(e)?BO:$O)(e,t,r)}/**
|
|
112
112
|
* @license
|
|
113
113
|
* Copyright 2018 Google LLC
|
|
114
114
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
115
|
-
*/const Wr=
|
|
116
|
-
]))+`;
|
|
117
|
-
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),
|
|
118
|
-
Suggested mode is: `+
|
|
115
|
+
*/const Wr=e=>e??wr;var Mc={},UO=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},D2={},yn={};let Q0;const FO=[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];yn.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17},yn.getSymbolTotalCodewords=function(t){return FO[t]},yn.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},yn.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');Q0=t},yn.isKanjiModeEnabled=function(){return typeof Q0<"u"},yn.toSJIS=function(t){return Q0(t)};var vu={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,i){if(e.isValid(n))return n;try{return t(n)}catch{return i}}})(vu);function O2(){this.buffer=[],this.length=0}O2.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var jO=O2;function $c(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}$c.prototype.set=function(e,t,r,n){const i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)},$c.prototype.get=function(e,t){return this.data[e*this.size+t]},$c.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},$c.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var kO=$c,P2={};(function(e){const t=yn.getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,o=t(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()},e.getPositions=function(n){const i=[],o=e.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}})(P2);var M2={};const qO=yn.getSymbolSize,$2=7;M2.getPositions=function(t){const r=qO(t);return[[0,0],[r-$2,0],[0,r-$2]]};var N2={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},e.from=function(i){return e.isValid(i)?parseInt(i,10):void 0},e.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 x=i.get(_,E);x===h?l++:(l>=5&&(c+=t.N1+(l-5)),h=x,l=1),x=i.get(E,_),x===g?f++:(f>=5&&(c+=t.N1+(f-5)),g=x,f=1)}l>=5&&(c+=t.N1+(l-5)),f>=5&&(c+=t.N1+(f-5))}return c},e.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*t.N2},e.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*t.N3},e.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)*t.N4};function r(n,i,o){switch(n){case e.Patterns.PATTERN000:return(i+o)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return o%3===0;case e.Patterns.PATTERN011:return(i+o)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(o/3))%2===0;case e.Patterns.PATTERN101:return i*o%2+i*o%3===0;case e.Patterns.PATTERN110:return(i*o%2+i*o%3)%2===0;case e.Patterns.PATTERN111:return(i*o%3+(i+o)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.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))},e.getBestMask=function(i,o){const c=Object.keys(e.Patterns).length;let l=0,f=1/0;for(let h=0;h<c;h++){o(h),e.applyMask(h,i);const g=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(h,i),g<f&&(f=g,l=h)}return l}})(N2);var wu={};const bs=vu,yu=[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];wu.getBlocksCount=function(t,r){switch(r){case bs.L:return yu[(t-1)*4+0];case bs.M:return yu[(t-1)*4+1];case bs.Q:return yu[(t-1)*4+2];case bs.H:return yu[(t-1)*4+3];default:return}},wu.getTotalCodewordsCount=function(t,r){switch(r){case bs.L:return bu[(t-1)*4+0];case bs.M:return bu[(t-1)*4+1];case bs.Q:return bu[(t-1)*4+2];case bs.H:return bu[(t-1)*4+3];default:return}};var T2={},_u={};const Nc=new Uint8Array(512),Eu=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)Nc[r]=t,Eu[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)Nc[r]=Nc[r-255]})(),_u.log=function(t){if(t<1)throw new Error("log("+t+")");return Eu[t]},_u.exp=function(t){return Nc[t]},_u.mul=function(t,r){return t===0||r===0?0:Nc[Eu[t]+Eu[r]]},function(e){const t=_u;e.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]^=t.mul(n[c],i[l]);return o},e.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]^=t.mul(i[f],c);let l=0;for(;l<o.length&&o[l]===0;)l++;o=o.slice(l)}return o},e.generateECPolynomial=function(n){let i=new Uint8Array([1]);for(let o=0;o<n;o++)i=e.mul(i,new Uint8Array([1,t.exp(o)]));return i}}(T2);const R2=T2;function J0(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}J0.prototype.initialize=function(t){this.degree=t,this.genPoly=R2.generateECPolynomial(this.degree)},J0.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(t.length+this.degree);r.set(t);const n=R2.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 zO=J0,L2={},_s={},Z0={};Z0.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var Di={};const B2="[0-9]+",HO="[A-Z $%*+\\-./:]+";let Tc="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Tc=Tc.replace(/u/g,"\\u");const KO="(?:(?![A-Z0-9 $%*+\\-./:]|"+Tc+`)(?:.|[\r
|
|
116
|
+
]))+`;Di.KANJI=new RegExp(Tc,"g"),Di.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Di.BYTE=new RegExp(KO,"g"),Di.NUMERIC=new RegExp(B2,"g"),Di.ALPHANUMERIC=new RegExp(HO,"g");const WO=new RegExp("^"+Tc+"$"),VO=new RegExp("^"+B2+"$"),GO=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Di.testKanji=function(t){return WO.test(t)},Di.testNumeric=function(t){return VO.test(t)},Di.testAlphanumeric=function(t){return GO.test(t)},function(e){const t=Z0,r=Di;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,c){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?o.ccBits[0]:c<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return r.testNumeric(o)?e.NUMERIC:r.testAlphanumeric(o)?e.ALPHANUMERIC:r.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.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 e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+i)}}e.from=function(o,c){if(e.isValid(o))return o;try{return n(o)}catch{return c}}}(_s),function(e){const t=yn,r=wu,n=vu,i=_s,o=Z0,c=7973,l=t.getBCHDigit(c);function f(E,x,I){for(let F=1;F<=40;F++)if(x<=e.getCapacity(F,I,E))return F}function h(E,x){return i.getCharCountIndicator(E,x)+4}function g(E,x){let I=0;return E.forEach(function(F){const W=h(F.mode,x);I+=W+F.getBitsLength()}),I}function _(E,x){for(let I=1;I<=40;I++)if(g(E,I)<=e.getCapacity(I,x,i.MIXED))return I}e.from=function(x,I){return o.isValid(x)?parseInt(x,10):I},e.getCapacity=function(x,I,F){if(!o.isValid(x))throw new Error("Invalid QR Code version");typeof F>"u"&&(F=i.BYTE);const W=t.getSymbolTotalCodewords(x),Y=r.getTotalCodewordsCount(x,I),B=(W-Y)*8;if(F===i.MIXED)return B;const z=B-h(F,x);switch(F){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)}},e.getBestVersionForData=function(x,I){let F;const W=n.from(I,n.M);if(Array.isArray(x)){if(x.length>1)return _(x,W);if(x.length===0)return 1;F=x[0]}else F=x;return f(F.mode,F.getLength(),W)},e.getEncodedBits=function(x){if(!o.isValid(x)||x<7)throw new Error("Invalid QR Code version");let I=x<<12;for(;t.getBCHDigit(I)-l>=0;)I^=c<<t.getBCHDigit(I)-l;return x<<12|I}}(L2);var U2={};const X0=yn,F2=1335,YO=21522,j2=X0.getBCHDigit(F2);U2.getEncodedBits=function(t,r){const n=t.bit<<3|r;let i=n<<10;for(;X0.getBCHDigit(i)-j2>=0;)i^=F2<<X0.getBCHDigit(i)-j2;return(n<<10|i)^YO};var k2={};const QO=_s;function fa(e){this.mode=QO.NUMERIC,this.data=e.toString()}fa.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},fa.prototype.getLength=function(){return this.data.length},fa.prototype.getBitsLength=function(){return fa.getBitsLength(this.data.length)},fa.prototype.write=function(t){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),t.put(i,10);const o=this.data.length-r;o>0&&(n=this.data.substr(r),i=parseInt(n,10),t.put(i,o*3+1))};var JO=fa;const ZO=_s,td=["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 da(e){this.mode=ZO.ALPHANUMERIC,this.data=e}da.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},da.prototype.getLength=function(){return this.data.length},da.prototype.getBitsLength=function(){return da.getBitsLength(this.data.length)},da.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=td.indexOf(this.data[r])*45;n+=td.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(td.indexOf(this.data[r]),6)};var XO=da,tP=function(t){for(var r=[],n=t.length,i=0;i<n;i++){var o=t.charCodeAt(i);if(o>=55296&&o<=56319&&n>i+1){var c=t.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 eP=tP,rP=_s;function pa(e){this.mode=rP.BYTE,typeof e=="string"&&(e=eP(e)),this.data=new Uint8Array(e)}pa.getBitsLength=function(t){return t*8},pa.prototype.getLength=function(){return this.data.length},pa.prototype.getBitsLength=function(){return pa.getBitsLength(this.data.length)},pa.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};var nP=pa;const iP=_s,sP=yn;function ga(e){this.mode=iP.KANJI,this.data=e}ga.getBitsLength=function(t){return t*13},ga.prototype.getLength=function(){return this.data.length},ga.prototype.getBitsLength=function(){return ga.getBitsLength(this.data.length)},ga.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=sP.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
117
|
+
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};var oP=ga,q2={exports:{}};(function(e){var t={single_source_shortest_paths:function(r,n,i){var o={},c={};c[n]=0;var l=t.PriorityQueue.make();l.push(n,0);for(var f,h,g,_,E,x,I,F,W;!l.empty();){f=l.pop(),h=f.value,_=f.cost,E=r[h]||{};for(g in E)E.hasOwnProperty(g)&&(x=E[g],I=_+x,F=c[g],W=typeof c[g]>"u",(W||F>I)&&(c[g]=I,l.push(g,I),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=t.single_source_shortest_paths(r,n,i);return t.extract_shortest_path_from_predecessor_list(o,i)},PriorityQueue:{make:function(r){var n=t.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}}};e.exports=t})(q2),function(e){const t=_s,r=JO,n=XO,i=nP,o=oP,c=Di,l=yn,f=q2.exports;function h(Y){return unescape(encodeURIComponent(Y)).length}function g(Y,B,z){const P=[];let U;for(;(U=Y.exec(z))!==null;)P.push({data:U[0],index:U.index,mode:B,length:U[0].length});return P}function _(Y){const B=g(c.NUMERIC,t.NUMERIC,Y),z=g(c.ALPHANUMERIC,t.ALPHANUMERIC,Y);let P,U;return l.isKanjiModeEnabled()?(P=g(c.BYTE,t.BYTE,Y),U=g(c.KANJI,t.KANJI,Y)):(P=g(c.BYTE_KANJI,t.BYTE,Y),U=[]),B.concat(z,P,U).sort(function(m,$){return m.index-$.index}).map(function(m){return{data:m.data,mode:m.mode,length:m.length}})}function E(Y,B){switch(B){case t.NUMERIC:return r.getBitsLength(Y);case t.ALPHANUMERIC:return n.getBitsLength(Y);case t.KANJI:return o.getBitsLength(Y);case t.BYTE:return i.getBitsLength(Y)}}function x(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 I(Y){const B=[];for(let z=0;z<Y.length;z++){const P=Y[z];switch(P.mode){case t.NUMERIC:B.push([P,{data:P.data,mode:t.ALPHANUMERIC,length:P.length},{data:P.data,mode:t.BYTE,length:P.length}]);break;case t.ALPHANUMERIC:B.push([P,{data:P.data,mode:t.BYTE,length:P.length}]);break;case t.KANJI:B.push([P,{data:P.data,mode:t.BYTE,length:h(P.data)}]);break;case t.BYTE:B.push([{data:P.data,mode:t.BYTE,length:h(P.data)}])}}return B}function F(Y,B){const z={},P={start:{}};let U=["start"];for(let j=0;j<Y.length;j++){const m=Y[j],$=[];for(let et=0;et<m.length;et++){const tt=m[et],nt=""+j+et;$.push(nt),z[nt]={node:tt,lastCount:0},P[nt]={};for(let dt=0;dt<U.length;dt++){const d=U[dt];z[d]&&z[d].node.mode===tt.mode?(P[d][nt]=E(z[d].lastCount+tt.length,tt.mode)-E(z[d].lastCount,tt.mode),z[d].lastCount+=tt.length):(z[d]&&(z[d].lastCount=tt.length),P[d][nt]=E(tt.length,tt.mode)+4+t.getCharCountIndicator(tt.mode,B))}}U=$}for(let j=0;j<U.length;j++)P[U[j]].end=0;return{map:P,table:z}}function W(Y,B){let z;const P=t.getBestModeForData(Y);if(z=t.from(B,P),z!==t.BYTE&&z.bit<P.bit)throw new Error('"'+Y+'" cannot be encoded with mode '+t.toString(z)+`.
|
|
118
|
+
Suggested mode is: `+t.toString(P));switch(z===t.KANJI&&!l.isKanjiModeEnabled()&&(z=t.BYTE),z){case t.NUMERIC:return new r(Y);case t.ALPHANUMERIC:return new n(Y);case t.KANJI:return new o(Y);case t.BYTE:return new i(Y)}}e.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},[])},e.fromString=function(B,z){const P=_(B,l.isKanjiModeEnabled()),U=I(P),j=F(U,z),m=f.find_path(j.map,"start","end"),$=[];for(let et=1;et<m.length-1;et++)$.push(j.table[m[et]].node);return e.fromArray(x($))},e.rawSplit=function(B){return e.fromArray(_(B,l.isKanjiModeEnabled()))}}(k2);const Au=yn,ed=vu,aP=jO,cP=kO,lP=P2,uP=M2,rd=N2,nd=wu,hP=zO,xu=L2,fP=U2,dP=_s,id=k2;function pP(e,t){const r=e.size,n=uP.getPositions(t);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?e.set(o+l,c+f,!0,!0):e.set(o+l,c+f,!1,!0))}}function gP(e){const t=e.size;for(let r=8;r<t-8;r++){const n=r%2===0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function mP(e,t){const r=lP.getPositions(t);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?e.set(i+c,o+l,!0,!0):e.set(i+c,o+l,!1,!0)}}function vP(e,t){const r=e.size,n=xu.getEncodedBits(t);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,e.set(i,o,c,!0),e.set(o,i,c,!0)}function sd(e,t,r){const n=e.size,i=fP.getEncodedBits(t,r);let o,c;for(o=0;o<15;o++)c=(i>>o&1)===1,o<6?e.set(o,8,c,!0):o<8?e.set(o+1,8,c,!0):e.set(n-15+o,8,c,!0),o<8?e.set(8,n-o-1,c,!0):o<9?e.set(8,15-o-1+1,c,!0):e.set(8,15-o-1,c,!0);e.set(n-8,8,1,!0)}function wP(e,t){const r=e.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(!e.isReserved(i,l-f)){let h=!1;c<t.length&&(h=(t[c]>>>o&1)===1),e.set(i,l-f,h),o--,o===-1&&(c++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function yP(e,t,r){const n=new aP;r.forEach(function(f){n.put(f.mode.bit,4),n.put(f.getLength(),dP.getCharCountIndicator(f.mode,e)),f.write(n)});const i=Au.getSymbolTotalCodewords(e),o=nd.getTotalCodewordsCount(e,t),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 bP(n,e,t)}function bP(e,t,r){const n=Au.getSymbolTotalCodewords(t),i=nd.getTotalCodewordsCount(t,r),o=n-i,c=nd.getBlocksCount(t,r),l=n%c,f=c-l,h=Math.floor(n/c),g=Math.floor(o/c),_=g+1,E=h-g,x=new hP(E);let I=0;const F=new Array(c),W=new Array(c);let Y=0;const B=new Uint8Array(e.buffer);for(let m=0;m<c;m++){const $=m<f?g:_;F[m]=B.slice(I,I+$),W[m]=x.encode(F[m]),I+=$,Y=Math.max(Y,$)}const z=new Uint8Array(n);let P=0,U,j;for(U=0;U<Y;U++)for(j=0;j<c;j++)U<F[j].length&&(z[P++]=F[j][U]);for(U=0;U<E;U++)for(j=0;j<c;j++)z[P++]=W[j][U];return z}function _P(e,t,r,n){let i;if(Array.isArray(e))i=id.fromArray(e);else if(typeof e=="string"){let h=t;if(!h){const g=id.rawSplit(e);h=xu.getBestVersionForData(g,r)}i=id.fromString(e,h||40)}else throw new Error("Invalid data");const o=xu.getBestVersionForData(i,r);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=o;else if(t<o)throw new Error(`
|
|
119
119
|
The chosen QR Code version cannot contain this amount of data.
|
|
120
120
|
Minimum version required to store current data is: `+o+`.
|
|
121
|
-
`);const c=
|
|
122
|
-
`;return typeof n=="function"&&n(null,E),E};const EM=LO,ad=I2,H2=k2,AM=q2;function cd(t,e,r,n,i){const o=[].slice.call(arguments,1),c=o.length,l=typeof o[c-1]=="function";if(!l&&!EM())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=ad.create(r,n);f(t(g,e,n))}catch(g){h(g)}})}try{const f=ad.create(r,n);i(null,t(f,e,n))}catch(f){i(f)}}Oc.create=ad.create,Oc.toCanvas=cd.bind(null,H2.render),Oc.toDataURL=cd.bind(null,H2.renderToDataURL),Oc.toString=cd.bind(null,function(t,e,r){return AM.render(t,r)});var xM=Object.defineProperty,K2=Object.getOwnPropertySymbols,SM=Object.prototype.hasOwnProperty,IM=Object.prototype.propertyIsEnumerable,W2=(t,e,r)=>e in t?xM(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ld=(t,e)=>{for(var r in e||(e={}))SM.call(e,r)&&W2(t,r,e[r]);if(K2)for(var r of K2(e))IM.call(e,r)&&W2(t,r,e[r]);return t};function DM(){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 V2(){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 V2()[t]},setTheme(){const t=document.querySelector(":root"),{themeVariables:e}=ms.state;if(t){const r=ld(ld(ld({},DM()),V2()),e);Object.entries(r).forEach(([n,i])=>t.style.setProperty(n,i))}},globalCss:$t`*,::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)}`},CM=$t`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 OM=Object.defineProperty,MM=Object.getOwnPropertyDescriptor,ma=(t,e,r,n)=>{for(var i=n>1?void 0:n?MM(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 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="${Wi(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,CM],ma([ht({type:Boolean})],Es.prototype,"disabled",2),ma([ht()],Es.prototype,"iconLeft",2),ma([ht()],Es.prototype,"iconRight",2),ma([ht()],Es.prototype,"onClick",2),ma([ht()],Es.prototype,"variant",2),Es=ma([Ct("wcm-button")],Es);const PM=$t`: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 $M=Object.defineProperty,TM=Object.getOwnPropertyDescriptor,ud=(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&&$M(e,r,i),i};let Tc=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="${Wi(t)}"><slot></slot></button>`}};Tc.styles=[xt.globalCss,PM],ud([ht({type:Boolean})],Tc.prototype,"disabled",2),ud([ht()],Tc.prototype,"variant",2),Tc=ud([Ct("wcm-button-big")],Tc);const NM=$t`: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 RM=Object.defineProperty,LM=Object.getOwnPropertyDescriptor,BM=(t,e,r,n)=>{for(var i=n>1?void 0:n?LM(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&&RM(e,r,i),i};let hd=class extends mt{render(){return ve`<div><slot></slot></div>`}};hd.styles=[xt.globalCss,NM],hd=BM([Ct("wcm-info-footer")],hd);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>`},UM=$t`.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 FM=Object.defineProperty,jM=Object.getOwnPropertyDescriptor,kM=(t,e,r,n)=>{for(var i=n>1?void 0:n?jM(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&&FM(e,r,i),i};let fd=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>`}};fd.styles=[xt.globalCss,UM],fd=kM([Ct("wcm-modal-backcard")],fd);const qM=$t`main{padding:20px;padding-top:0;width:100%}`;var zM=Object.defineProperty,HM=Object.getOwnPropertyDescriptor,KM=(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&&zM(e,r,i),i};let dd=class extends mt{render(){return ve`<main><slot></slot></main>`}};dd.styles=[xt.globalCss,qM],dd=KM([Ct("wcm-modal-content")],dd);const WM=$t`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;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 pd=class extends mt{render(){return ve`<footer><slot></slot></footer>`}};pd.styles=[xt.globalCss,WM],pd=YM([Ct("wcm-modal-footer")],pd);const QM=$t`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 JM=Object.defineProperty,ZM=Object.getOwnPropertyDescriptor,Nc=(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&&JM(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="${Wi(t)}">${e?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};lo.styles=[xt.globalCss,QM],Nc([ht()],lo.prototype,"title",2),Nc([ht()],lo.prototype,"onAction",2),Nc([ht()],lo.prototype,"actionIcon",2),Nc([ht({type:Boolean})],lo.prototype,"border",2),lo=Nc([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}=wn.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}=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")}},XM=$t`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var eP=Object.defineProperty,tP=Object.getOwnPropertyDescriptor,gd=(t,e,r,n)=>{for(var i=n>1?void 0:n?tP(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&&eP(e,r,i),i};let Rc=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>`}};Rc.styles=[xt.globalCss,XM],gd([cn()],Rc.prototype,"view",2),gd([cn()],Rc.prototype,"prevView",2),Rc=gd([Ct("wcm-modal-router")],Rc);const rP=$t`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 nP=Object.defineProperty,iP=Object.getOwnPropertyDescriptor,G2=(t,e,r,n)=>{for(var i=n>1?void 0:n?iP(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&&nP(e,r,i),i};let xu=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="${Wi(r)}">${e==="success"?Nt.CHECKMARK_ICON:null} ${e==="error"?Nt.CROSS_ICON:null}<wcm-text variant="small-regular">${t}</wcm-text></div>`:null}};xu.styles=[xt.globalCss,rP],G2([cn()],xu.prototype,"open",2),xu=G2([Ct("wcm-modal-toast")],xu);const sP=.1,Y2=2.5,Vi=7;function md(t,e,r){return t===e?!1:(t-e<0?e-t:t-e)<=r+sP}function oP(t,e){const r=Array.prototype.slice.call(Oc.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 aP={generate(t,e,r){const n="#141414",i="#ffffff",o=[],c=oP(t,"Q"),l=e/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:I,y:k})=>{const W=(c.length-Vi)*l*I,Y=(c.length-Vi)*l*k,B=.45;for(let z=0;z<f.length;z+=1){const M=l*(Vi-z*2);o.push(ar`<rect fill="${z%2===0?n:i}" height="${M}" rx="${M*B}" ry="${M*B}" width="${M}" 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((I,k)=>{I.forEach((W,Y)=>{if(c[k][Y]&&!(k<Vi&&Y<Vi||k>c.length-(Vi+1)&&Y<Vi||k<Vi&&Y>c.length-(Vi+1))&&!(k>g&&k<_&&Y>g&&Y<_)){const B=k*l+l/2,z=Y*l+l/2;E.push([B,z])}})});const x={};return E.forEach(([I,k])=>{x[I]?x[I].push(k):x[I]=[k]}),Object.entries(x).map(([I,k])=>{const W=k.filter(Y=>k.every(B=>!md(Y,B,l)));return[Number(I),W]}).forEach(([I,k])=>{k.forEach(W=>{o.push(ar`<circle cx="${I}" cy="${W}" fill="${n}" r="${l/Y2}">`)})}),Object.entries(x).filter(([I,k])=>k.length>1).map(([I,k])=>{const W=k.filter(Y=>k.some(B=>md(Y,B,l)));return[Number(I),W]}).map(([I,k])=>{k.sort((Y,B)=>Y<B?-1:1);const W=[];for(const Y of k){const B=W.find(z=>z.some(M=>md(Y,M,l)));B?B.push(Y):W.push([Y])}return[I,W.map(Y=>[Y[0],Y[Y.length-1]])]}).forEach(([I,k])=>{k.forEach(([W,Y])=>{o.push(ar`<line x1="${I}" x2="${I}" y1="${W}" y2="${Y}" stroke="${n}" stroke-width="${l/(Y2/2)}" stroke-linecap="round">`)})}),o}},cP=$t`@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 lP=Object.defineProperty,uP=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?uP(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 Gi=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}">${aP.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="${Wi(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>`}};Gi.styles=[xt.globalCss,cP],va([ht()],Gi.prototype,"uri",2),va([ht({type:Number})],Gi.prototype,"size",2),va([ht()],Gi.prototype,"imageId",2),va([ht()],Gi.prototype,"walletId",2),va([ht()],Gi.prototype,"imageUrl",2),Gi=va([Ct("wcm-qrcode")],Gi);const hP=$t`: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 fP=Object.defineProperty,dP=Object.getOwnPropertyDescriptor,Q2=(t,e,r,n)=>{for(var i=n>1?void 0:n?dP(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 Su=class extends mt{constructor(){super(...arguments),this.onChange=()=>null}render(){return ve`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Nt.SEARCH_ICON}`}};Su.styles=[xt.globalCss,hP],Q2([ht()],Su.prototype,"onChange",2),Su=Q2([Ct("wcm-search-input")],Su);const pP=$t`@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 gP=Object.defineProperty,mP=Object.getOwnPropertyDescriptor,vP=(t,e,r,n)=>{for(var i=n>1?void 0:n?mP(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&&gP(e,r,i),i};let vd=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>`}};vd.styles=[xt.globalCss,pP],vd=vP([Ct("wcm-spinner")],vd);const wP=$t`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 yP=Object.defineProperty,bP=Object.getOwnPropertyDescriptor,wd=(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&&yP(e,r,i),i};let Lc=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="${Wi(t)}"></slot></span>`}};Lc.styles=[xt.globalCss,wP],wd([ht()],Lc.prototype,"variant",2),wd([ht()],Lc.prototype,"color",2),Lc=wd([Ct("wcm-text")],Lc);const _P=$t`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 EP=Object.defineProperty,AP=Object.getOwnPropertyDescriptor,As=(t,e,r,n)=>{for(var i=n>1?void 0:n?AP(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&&EP(e,r,i),i};let Di=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>`}};Di.styles=[xt.globalCss,_P],As([ht()],Di.prototype,"onClick",2),As([ht()],Di.prototype,"name",2),As([ht()],Di.prototype,"walletId",2),As([ht()],Di.prototype,"label",2),As([ht()],Di.prototype,"imageId",2),As([ht({type:Boolean})],Di.prototype,"installed",2),As([ht({type:Boolean})],Di.prototype,"recent",2),Di=As([Ct("wcm-wallet-button")],Di);const xP=$t`: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 SP=Object.defineProperty,IP=Object.getOwnPropertyDescriptor,Iu=(t,e,r,n)=>{for(var i=n>1?void 0:n?IP(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&&SP(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,xP],Iu([ht()],wa.prototype,"walletId",2),Iu([ht()],wa.prototype,"imageId",2),Iu([ht()],wa.prototype,"imageUrl",2),wa=Iu([Ct("wcm-wallet-image")],wa);var DP=Object.defineProperty,CP=Object.getOwnPropertyDescriptor,J2=(t,e,r,n)=>{for(var i=n>1?void 0:n?CP(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&&DP(e,r,i),i};let yd=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 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")}}};J2([cn()],yd.prototype,"preload",2),yd=J2([Ct("wcm-explorer-context")],yd);var OP=Object.defineProperty,MP=Object.getOwnPropertyDescriptor,PP=(t,e,r,n)=>{for(var i=n>1?void 0:n?MP(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&&OP(e,r,i),i};let Z2=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)}};Z2=PP([Ct("wcm-theme-context")],Z2);const $P=$t`@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 TP=Object.defineProperty,NP=Object.getOwnPropertyDescriptor,RP=(t,e,r,n)=>{for(var i=n>1?void 0:n?NP(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&&TP(e,r,i),i};let bd=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>`}};bd.styles=[xt.globalCss,$P],bd=RP([Ct("wcm-android-wallet-selection")],bd);const LP=$t`@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 BP=Object.defineProperty,UP=Object.getOwnPropertyDescriptor,ya=(t,e,r,n)=>{for(var i=n>1?void 0:n?UP(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&&BP(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="${Wi(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,LP],ya([ht()],xs.prototype,"walletId",2),ya([ht()],xs.prototype,"imageId",2),ya([ht({type:Boolean})],xs.prototype,"isError",2),ya([ht({type:Boolean})],xs.prototype,"isStale",2),ya([ht()],xs.prototype,"label",2),xs=ya([Ct("wcm-connector-waiting")],xs);const ba={manualWallets(){var t,e;const{mobileWallets:r,desktopWallets:n}=wn.state,i=(t=ba.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=ba.recentWallet())==null?void 0:e.id,{recomendedWallets:n}=an.state;return n.filter(i=>r!==i.id)}},Ss={onConnecting(t){nt.goToConnectingView(t)},manualWalletsTemplate(){return ba.manualWallets().map(t=>ve`<wcm-wallet-button walletId="${t.id}" name="${t.name}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(t=!1){return ba.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=ba.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>`}},FP=$t`.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 jP=Object.defineProperty,kP=Object.getOwnPropertyDescriptor,qP=(t,e,r,n)=>{for(var i=n>1?void 0:n?kP(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 _d=class extends mt{render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=wn.state,r=t!=="ALL"&&e,n=Ss.manualWalletsTemplate(),i=Ss.recomendedWalletsTemplate();let o=[Ss.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}`}};_d.styles=[xt.globalCss,FP],_d=qP([Ct("wcm-desktop-wallet-selection")],_d);const zP=$t`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 HP=Object.defineProperty,KP=Object.getOwnPropertyDescriptor,WP=(t,e,r,n)=>{for(var i=n>1?void 0:n?KP(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&&HP(e,r,i),i};let Ed=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}};Ed.styles=[xt.globalCss,zP],Ed=WP([Ct("wcm-legal-notice")],Ed);const VP=$t`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var GP=Object.defineProperty,YP=Object.getOwnPropertyDescriptor,QP=(t,e,r,n)=>{for(var i=n>1?void 0:n?YP(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&&GP(e,r,i),i};let Ad=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 o=[Ss.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}`}};Ad.styles=[xt.globalCss,VP],Ad=QP([Ct("wcm-mobile-wallet-selection")],Ad);const JP=$t`: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 ZP=Object.defineProperty,XP=Object.getOwnPropertyDescriptor,xd=(t,e,r,n)=>{for(var i=n>1?void 0:n?XP(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&&ZP(e,r,i),i};let _a=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="${Wi(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>`}};_a.styles=[xt.globalCss,JP],xd([cn()],_a.prototype,"open",2),xd([cn()],_a.prototype,"active",2),_a=xd([Ct("wcm-modal")],_a);const e$=$t`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var t$=Object.defineProperty,r$=Object.getOwnPropertyDescriptor,Bc=(t,e,r,n)=>{for(var i=n>1?void 0:n?r$(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 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,e$],Bc([ht({type:Boolean})],uo.prototype,"isMobile",2),Bc([ht({type:Boolean})],uo.prototype,"isDesktop",2),Bc([ht({type:Boolean})],uo.prototype,"isWeb",2),Bc([ht({type:Boolean})],uo.prototype,"isRetry",2),uo=Bc([Ct("wcm-platform-selection")],uo);const n$=$t`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 i$=Object.defineProperty,s$=Object.getOwnPropertyDescriptor,o$=(t,e,r,n)=>{for(var i=n>1?void 0:n?s$(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&&i$(e,r,i),i};let Sd=class extends mt{onClick(){rr.push("WalletExplorer")}render(){const{recomendedWallets:t}=an.state,e=ba.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>`}};Sd.styles=[xt.globalCss,n$],Sd=o$([Ct("wcm-view-all-wallets-button")],Sd);const a$=$t`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var c$=Object.defineProperty,l$=Object.getOwnPropertyDescriptor,Du=(t,e,r,n)=>{for(var i=n>1?void 0:n?l$(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&&c$(e,r,i),i};let Ea=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>`}};Ea.styles=[xt.globalCss,a$],Du([ht()],Ea.prototype,"walletId",2),Du([ht()],Ea.prototype,"imageId",2),Du([cn()],Ea.prototype,"uri",2),Ea=Du([Ct("wcm-walletconnect-qr")],Ea);var u$=Object.defineProperty,h$=Object.getOwnPropertyDescriptor,f$=(t,e,r,n)=>{for(var i=n>1?void 0:n?h$(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&&u$(e,r,i),i};let Id=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>`}};Id.styles=[xt.globalCss],Id=f$([Ct("wcm-connect-wallet-view")],Id);const d$=$t`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var p$=Object.defineProperty,g$=Object.getOwnPropertyDescriptor,X2=(t,e,r,n)=>{for(var i=n>1?void 0:n?g$(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&&p$(e,r,i),i};let Cu=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>`}};Cu.styles=[xt.globalCss,d$],X2([cn()],Cu.prototype,"isError",2),Cu=X2([Ct("wcm-desktop-connecting-view")],Cu);const m$=$t`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 v$=Object.defineProperty,w$=Object.getOwnPropertyDescriptor,y$=(t,e,r,n)=>{for(var i=n>1?void 0:n?w$(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&&v$(e,r,i),i};let Dd=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>`}};Dd.styles=[xt.globalCss,m$],Dd=y$([Ct("wcm-install-wallet-view")],Dd);const b$=$t`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 _$=Object.defineProperty,E$=Object.getOwnPropertyDescriptor,ey=(t,e,r,n)=>{for(var i=n>1?void 0:n?E$(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&&_$(e,r,i),i};let Ou=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>`}};Ou.styles=[xt.globalCss,b$],ey([cn()],Ou.prototype,"isError",2),Ou=ey([Ct("wcm-mobile-connecting-view")],Ou);const A$=$t`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var x$=Object.defineProperty,S$=Object.getOwnPropertyDescriptor,I$=(t,e,r,n)=>{for(var i=n>1?void 0:n?S$(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&&x$(e,r,i),i};let Cd=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>`}};Cd.styles=[xt.globalCss,A$],Cd=I$([Ct("wcm-mobile-qr-connecting-view")],Cd);var D$=Object.defineProperty,C$=Object.getOwnPropertyDescriptor,O$=(t,e,r,n)=>{for(var i=n>1?void 0:n?C$(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&&D$(e,r,i),i};let Od=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>`}};Od.styles=[xt.globalCss],Od=O$([Ct("wcm-qrcode-view")],Od);const M$=$t`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 P$=Object.defineProperty,$$=Object.getOwnPropertyDescriptor,Uc=(t,e,r,n)=>{for(var i=n>1?void 0:n?$$(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&&P$(e,r,i),i};const Md=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<=Md||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>Md&&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:Md,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=Ss.manualWalletsTemplate(),c=Ss.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="${Wi(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,M$],Uc([cn()],ho.prototype,"loading",2),Uc([cn()],ho.prototype,"firstFetch",2),Uc([cn()],ho.prototype,"search",2),Uc([cn()],ho.prototype,"endReached",2),ho=Uc([Ct("wcm-wallet-explorer-view")],ho);const T$=$t`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var N$=Object.defineProperty,R$=Object.getOwnPropertyDescriptor,ty=(t,e,r,n)=>{for(var i=n>1?void 0:n?R$(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&&N$(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(),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>`}};Mu.styles=[xt.globalCss,T$],ty([cn()],Mu.prototype,"isError",2),Mu=ty([Ct("wcm-web-connecting-view")],Mu);var L$=Object.freeze({__proto__:null,get WcmModal(){return _a},get WcmQrCode(){return Gi}});Vn.EthereumProvider=oC,Vn.OPTIONAL_EVENTS=Cw,Vn.OPTIONAL_METHODS=Dw,Vn.REQUIRED_EVENTS=tu,Vn.REQUIRED_METHODS=eu,Vn.default=iu,Object.defineProperty(Vn,"__esModule",{value:!0})});
|
|
121
|
+
`);const c=yP(t,r,i),l=Au.getSymbolSize(t),f=new cP(l);return pP(f,t),gP(f),mP(f,t),sd(f,r,0),t>=7&&vP(f,t),wP(f,c),isNaN(n)&&(n=rd.getBestMask(f,sd.bind(null,f,r))),rd.applyMask(n,f),sd(f,r,n),{modules:f,version:t,errorCorrectionLevel:r,maskPattern:n,segments:i}}D2.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=ed.M,i,o;return typeof r<"u"&&(n=ed.from(r.errorCorrectionLevel,ed.M),i=xu.from(r.version),o=rd.from(r.maskPattern),r.toSJISFunc&&Au.setToSJISFunction(r.toSJISFunc)),_P(t,i,n,o)};var z2={},od={};(function(e){function t(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("")}}e.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:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},e.getImageWidth=function(n,i){const o=e.getScale(n,i);return Math.floor((n+i.margin*2)*o)},e.qrToImageData=function(n,i,o){const c=i.modules.size,l=i.modules.data,f=e.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 x=0;x<h;x++){let I=(E*h+x)*4,F=o.color.light;if(E>=g&&x>=g&&E<h-g&&x<h-g){const W=Math.floor((E-g)/f),Y=Math.floor((x-g)/f);F=_[l[W*c+Y]?1:0]}n[I++]=F.r,n[I++]=F.g,n[I++]=F.b,n[I]=F.a}}})(od),function(e){const t=od;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")}}e.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=t.getOptions(f);const g=t.getImageWidth(o.modules.size,f),_=h.getContext("2d"),E=_.createImageData(g,g);return t.qrToImageData(E.data,o,f),r(_,h,g),_.putImageData(E,0,0),h},e.renderToDataURL=function(o,c,l){let f=l;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),f||(f={});const h=e.render(o,c,f),g=f.type||"image/png",_=f.rendererOpts||{};return h.toDataURL(g,_.quality)}}(z2);var H2={};const EP=od;function K2(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function ad(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function AP(e,t,r){let n="",i=0,o=!1,c=0;for(let l=0;l<e.length;l++){const f=Math.floor(l%t),h=Math.floor(l/t);!f&&!o&&(o=!0),e[l]?(c++,l>0&&f>0&&e[l-1]||(n+=o?ad("M",f+r,.5+h+r):ad("m",i,0),i=0,o=!1),f+1<t&&e[l+1]||(n+=ad("h",c),c=0)):i++}return n}H2.render=function(t,r,n){const i=EP.getOptions(r),o=t.modules.size,c=t.modules.data,l=o+i.margin*2,f=i.color.light.a?"<path "+K2(i.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+K2(i.color.dark,"stroke")+' d="'+AP(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>
|
|
122
|
+
`;return typeof n=="function"&&n(null,E),E};const xP=UO,cd=D2,W2=z2,IP=H2;function ld(e,t,r,n,i){const o=[].slice.call(arguments,1),c=o.length,l=typeof o[c-1]=="function";if(!l&&!xP())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=t,t=n=void 0):c===3&&(t.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=t,t=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(r=t,t=n=void 0):c===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(f,h){try{const g=cd.create(r,n);f(e(g,t,n))}catch(g){h(g)}})}try{const f=cd.create(r,n);i(null,e(f,t,n))}catch(f){i(f)}}Mc.create=cd.create,Mc.toCanvas=ld.bind(null,W2.render),Mc.toDataURL=ld.bind(null,W2.renderToDataURL),Mc.toString=ld.bind(null,function(e,t,r){return IP.render(e,r)});var SP=Object.defineProperty,V2=Object.getOwnPropertySymbols,CP=Object.prototype.hasOwnProperty,DP=Object.prototype.propertyIsEnumerable,G2=(e,t,r)=>t in e?SP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ud=(e,t)=>{for(var r in t||(t={}))CP.call(t,r)&&G2(e,r,t[r]);if(V2)for(var r of V2(t))DP.call(t,r)&&G2(e,r,t[r]);return e};function OP(){var e;const t=(e=ms.state.themeMode)!=null?e:"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)"}}[t];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 Y2(){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 xe={getPreset(e){return Y2()[e]},setTheme(){const e=document.querySelector(":root"),{themeVariables:t}=ms.state;if(e){const r=ud(ud(ud({},OP()),Y2()),t);Object.entries(r).forEach(([n,i])=>e.style.setProperty(n,i))}},globalCss:$e`*,::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)}`},PP=$e`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 MP=Object.defineProperty,$P=Object.getOwnPropertyDescriptor,ma=(e,t,r,n)=>{for(var i=n>1?void 0:n?$P(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&MP(t,r,i),i};let Es=class extends me{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const e={"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 t="inverse";return this.variant==="ghost"&&(t="secondary"),this.variant==="outline"&&(t="accent"),vt`<button class="${Gi(e)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${t}"><slot></slot></wcm-text>${this.iconRight}</button>`}};Es.styles=[xe.globalCss,PP],ma([he({type:Boolean})],Es.prototype,"disabled",2),ma([he()],Es.prototype,"iconLeft",2),ma([he()],Es.prototype,"iconRight",2),ma([he()],Es.prototype,"onClick",2),ma([he()],Es.prototype,"variant",2),Es=ma([De("wcm-button")],Es);const NP=$e`: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 TP=Object.defineProperty,RP=Object.getOwnPropertyDescriptor,hd=(e,t,r,n)=>{for(var i=n>1?void 0:n?RP(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&TP(t,r,i),i};let Rc=class extends me{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":this.variant==="secondary"};return vt`<button ?disabled="${this.disabled}" class="${Gi(e)}"><slot></slot></button>`}};Rc.styles=[xe.globalCss,NP],hd([he({type:Boolean})],Rc.prototype,"disabled",2),hd([he()],Rc.prototype,"variant",2),Rc=hd([De("wcm-button-big")],Rc);const LP=$e`: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 BP=Object.defineProperty,UP=Object.getOwnPropertyDescriptor,FP=(e,t,r,n)=>{for(var i=n>1?void 0:n?UP(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&BP(t,r,i),i};let fd=class extends me{render(){return vt`<div><slot></slot></div>`}};fd.styles=[xe.globalCss,LP],fd=FP([De("wcm-info-footer")],fd);const Te={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>`},jP=$e`.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 kP=Object.defineProperty,qP=Object.getOwnPropertyDescriptor,zP=(e,t,r,n)=>{for(var i=n>1?void 0:n?qP(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&kP(t,r,i),i};let dd=class extends me{render(){return vt`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Te.WALLET_CONNECT_LOGO} <button @click="${eo.close}">${Te.CROSS_ICON}</button></div>`}};dd.styles=[xe.globalCss,jP],dd=zP([De("wcm-modal-backcard")],dd);const HP=$e`main{padding:20px;padding-top:0;width:100%}`;var KP=Object.defineProperty,WP=Object.getOwnPropertyDescriptor,VP=(e,t,r,n)=>{for(var i=n>1?void 0:n?WP(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&KP(t,r,i),i};let pd=class extends me{render(){return vt`<main><slot></slot></main>`}};pd.styles=[xe.globalCss,HP],pd=VP([De("wcm-modal-content")],pd);const GP=$e`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var YP=Object.defineProperty,QP=Object.getOwnPropertyDescriptor,JP=(e,t,r,n)=>{for(var i=n>1?void 0:n?QP(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&YP(t,r,i),i};let gd=class extends me{render(){return vt`<footer><slot></slot></footer>`}};gd.styles=[xe.globalCss,GP],gd=JP([De("wcm-modal-footer")],gd);const ZP=$e`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 XP=Object.defineProperty,tM=Object.getOwnPropertyDescriptor,Lc=(e,t,r,n)=>{for(var i=n>1?void 0:n?tM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&XP(t,r,i),i};let lo=class extends me{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return vt`<button class="wcm-back-btn" @click="${rr.goBack}">${Te.BACK_ICON}</button>`}actionBtnTemplate(){return vt`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const e={"wcm-border":this.border},t=rr.state.history.length>1,r=this.title?vt`<wcm-text variant="big-bold">${this.title}</wcm-text>`:vt`<slot></slot>`;return vt`<header class="${Gi(e)}">${t?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};lo.styles=[xe.globalCss,ZP],Lc([he()],lo.prototype,"title",2),Lc([he()],lo.prototype,"onAction",2),Lc([he()],lo.prototype,"actionIcon",2),Lc([he({type:Boolean})],lo.prototype,"border",2),lo=Lc([De("wcm-modal-header")],lo);const ne={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(e,t){const r=e.renderRoot.querySelector(t);if(!r)throw new Error(`${t} not found`);return r},getWalletIcon({id:e,image_id:t}){const{walletImages:r}=wn.state;return r!=null&&r[e]?r[e]:t?an.getWalletImageUrl(t):""},getWalletName(e,t=!1){return t&&e.length>8?`${e.substring(0,8)}..`:e},isMobileAnimation(){return window.innerWidth<=ne.MOBILE_BREAKPOINT},async preloadImage(e){const t=new Promise((r,n)=>{const i=new Image;i.onload=r,i.onerror=n,i.crossOrigin="anonymous",i.src=e});return Promise.race([t,Ut.wait(3e3)])},getErrorMessage(e){return e instanceof Error?e.message:"Unknown Error"},debounce(e,t=500){let r;return(...n)=>{function i(){e(...n)}r&&clearTimeout(r),r=setTimeout(i,t)}},handleMobileLinking(e){const{walletConnectUri:t}=hr.state,{mobile:r,name:n}=e,i=r?.native,o=r?.universal;ne.setRecentWallet(e);function c(l){let f="";i?f=Ut.formatUniversalUrl(i,l,n):o&&(f=Ut.formatNativeUrl(o,l,n)),Ut.openHref(f,"_self")}t&&c(t)},handleAndroidLinking(){const{walletConnectUri:e}=hr.state;e&&(Ut.setWalletConnectAndroidDeepLink(e),Ut.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=hr.state;if(e)try{await navigator.clipboard.writeText(e),vs.openToast("Link copied","success")}catch{vs.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=wn.state,t=Object.values(e??{});return Object.values(t)},truncate(e,t=8){return e.length<=t?e:`${e.substring(0,4)}...${e.substring(e.length-4)}`},setRecentWallet(e){try{localStorage.setItem(ne.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(ne.WCM_RECENT_WALLET_DATA);return e?JSON.parse(e):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(e,t){return e.toUpperCase().includes(t.toUpperCase())},openWalletExplorerUrl(){Ut.openHref(ne.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=Ut.getWalletRouterData(),r=!!e?.native,n=!!e?.universal,i=!!t?.native||!!t?.universal;return{isDesktop:r,isMobile:i,isWeb:n}},goToConnectingView(e){rr.setData({Wallet:e});const t=Ut.isMobile(),{isDesktop:r,isWeb:n,isMobile:i}=ne.getCachedRouterWalletPlatforms();t?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")}},eM=$e`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var rM=Object.defineProperty,nM=Object.getOwnPropertyDescriptor,md=(e,t,r,n)=>{for(var i=n>1?void 0:n?nM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&rM(t,r,i),i};let Bc=class extends me{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(e=>{this.view!==e.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([e])=>{const t=`${e.contentRect.height}px`;this.oldHeight!=="0px"&&co(this.routerEl,{height:[this.oldHeight,t]},{duration:.2}),this.oldHeight=t}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var e,t;(e=this.unsubscribe)==null||e.call(this),(t=this.resizeObserver)==null||t.disconnect()}get routerEl(){return ne.getShadowRootElement(this,".wcm-router")}get contentEl(){return ne.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return vt`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return vt`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return vt`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return vt`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return vt`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return vt`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return vt`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return vt`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return vt`<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 vt`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Bc.styles=[xe.globalCss,eM],md([cn()],Bc.prototype,"view",2),md([cn()],Bc.prototype,"prevView",2),Bc=md([De("wcm-modal-router")],Bc);const iM=$e`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,oM=Object.getOwnPropertyDescriptor,Q2=(e,t,r,n)=>{for(var i=n>1?void 0:n?oM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&sM(t,r,i),i};let Iu=class extends me{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=vs.subscribe(e=>{e.open?(this.open=!0,this.timeout=setTimeout(()=>vs.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var e;(e=this.unsubscribe)==null||e.call(this),clearTimeout(this.timeout),vs.closeToast()}render(){const{message:e,variant:t}=vs.state,r={"wcm-success":t==="success","wcm-error":t==="error"};return this.open?vt`<div class="${Gi(r)}">${t==="success"?Te.CHECKMARK_ICON:null} ${t==="error"?Te.CROSS_ICON:null}<wcm-text variant="small-regular">${e}</wcm-text></div>`:null}};Iu.styles=[xe.globalCss,iM],Q2([cn()],Iu.prototype,"open",2),Iu=Q2([De("wcm-modal-toast")],Iu);const aM=.1,J2=2.5,Yi=7;function vd(e,t,r){return e===t?!1:(e-t<0?t-e:e-t)<=r+aM}function cM(e,t){const r=Array.prototype.slice.call(Mc.create(e,{errorCorrectionLevel:t}).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 lM={generate(e,t,r){const n="#141414",i="#ffffff",o=[],c=cM(e,"Q"),l=t/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:I,y:F})=>{const W=(c.length-Yi)*l*I,Y=(c.length-Yi)*l*F,B=.45;for(let z=0;z<f.length;z+=1){const P=l*(Yi-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((I,F)=>{I.forEach((W,Y)=>{if(c[F][Y]&&!(F<Yi&&Y<Yi||F>c.length-(Yi+1)&&Y<Yi||F<Yi&&Y>c.length-(Yi+1))&&!(F>g&&F<_&&Y>g&&Y<_)){const B=F*l+l/2,z=Y*l+l/2;E.push([B,z])}})});const x={};return E.forEach(([I,F])=>{x[I]?x[I].push(F):x[I]=[F]}),Object.entries(x).map(([I,F])=>{const W=F.filter(Y=>F.every(B=>!vd(Y,B,l)));return[Number(I),W]}).forEach(([I,F])=>{F.forEach(W=>{o.push(ar`<circle cx="${I}" cy="${W}" fill="${n}" r="${l/J2}">`)})}),Object.entries(x).filter(([I,F])=>F.length>1).map(([I,F])=>{const W=F.filter(Y=>F.some(B=>vd(Y,B,l)));return[Number(I),W]}).map(([I,F])=>{F.sort((Y,B)=>Y<B?-1:1);const W=[];for(const Y of F){const B=W.find(z=>z.some(P=>vd(Y,P,l)));B?B.push(Y):W.push([Y])}return[I,W.map(Y=>[Y[0],Y[Y.length-1]])]}).forEach(([I,F])=>{F.forEach(([W,Y])=>{o.push(ar`<line x1="${I}" x2="${I}" y1="${W}" y2="${Y}" stroke="${n}" stroke-width="${l/(J2/2)}" stroke-linecap="round">`)})}),o}},uM=$e`@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 hM=Object.defineProperty,fM=Object.getOwnPropertyDescriptor,va=(e,t,r,n)=>{for(var i=n>1?void 0:n?fM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&hM(t,r,i),i};let Qi=class extends me{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e=ms.state.themeMode==="light"?this.size:this.size-36;return ar`<svg height="${e}" width="${e}">${lM.generate(this.uri,e,e/4)}</svg>`}render(){const e={"wcm-dark":ms.state.themeMode==="dark"};return vt`<div style="${`width: ${this.size}px`}" class="${Gi(e)}">${this.walletId||this.imageUrl?vt`<wcm-wallet-image walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}" imageUrl="${Wr(this.imageUrl)}"></wcm-wallet-image>`:Te.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Qi.styles=[xe.globalCss,uM],va([he()],Qi.prototype,"uri",2),va([he({type:Number})],Qi.prototype,"size",2),va([he()],Qi.prototype,"imageId",2),va([he()],Qi.prototype,"walletId",2),va([he()],Qi.prototype,"imageUrl",2),Qi=va([De("wcm-qrcode")],Qi);const dM=$e`: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 pM=Object.defineProperty,gM=Object.getOwnPropertyDescriptor,Z2=(e,t,r,n)=>{for(var i=n>1?void 0:n?gM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&pM(t,r,i),i};let Su=class extends me{constructor(){super(...arguments),this.onChange=()=>null}render(){return vt`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Te.SEARCH_ICON}`}};Su.styles=[xe.globalCss,dM],Z2([he()],Su.prototype,"onChange",2),Su=Z2([De("wcm-search-input")],Su);const mM=$e`@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 vM=Object.defineProperty,wM=Object.getOwnPropertyDescriptor,yM=(e,t,r,n)=>{for(var i=n>1?void 0:n?wM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&vM(t,r,i),i};let wd=class extends me{render(){return vt`<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>`}};wd.styles=[xe.globalCss,mM],wd=yM([De("wcm-spinner")],wd);const bM=$e`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 _M=Object.defineProperty,EM=Object.getOwnPropertyDescriptor,yd=(e,t,r,n)=>{for(var i=n>1?void 0:n?EM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&_M(t,r,i),i};let Uc=class extends me{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const e={"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 vt`<span><slot class="${Gi(e)}"></slot></span>`}};Uc.styles=[xe.globalCss,bM],yd([he()],Uc.prototype,"variant",2),yd([he()],Uc.prototype,"color",2),Uc=yd([De("wcm-text")],Uc);const AM=$e`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 xM=Object.defineProperty,IM=Object.getOwnPropertyDescriptor,As=(e,t,r,n)=>{for(var i=n>1?void 0:n?IM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&xM(t,r,i),i};let Oi=class extends me{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?vt`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?vt`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){Rw.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return vt`<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">${(e=this.label)!=null?e:ne.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};Oi.styles=[xe.globalCss,AM],As([he()],Oi.prototype,"onClick",2),As([he()],Oi.prototype,"name",2),As([he()],Oi.prototype,"walletId",2),As([he()],Oi.prototype,"label",2),As([he()],Oi.prototype,"imageId",2),As([he({type:Boolean})],Oi.prototype,"installed",2),As([he({type:Boolean})],Oi.prototype,"recent",2),Oi=As([De("wcm-wallet-button")],Oi);const SM=$e`: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 CM=Object.defineProperty,DM=Object.getOwnPropertyDescriptor,Cu=(e,t,r,n)=>{for(var i=n>1?void 0:n?DM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&CM(t,r,i),i};let wa=class extends me{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var e;const t=(e=this.imageUrl)!=null&&e.length?this.imageUrl:ne.getWalletIcon({id:this.walletId,image_id:this.imageId});return vt`${t.length?vt`<div><img crossorigin="anonymous" src="${t}" alt="${this.id}"></div>`:Te.WALLET_PLACEHOLDER}`}};wa.styles=[xe.globalCss,SM],Cu([he()],wa.prototype,"walletId",2),Cu([he()],wa.prototype,"imageId",2),Cu([he()],wa.prototype,"imageUrl",2),wa=Cu([De("wcm-wallet-image")],wa);var OM=Object.defineProperty,PM=Object.getOwnPropertyDescriptor,X2=(e,t,r,n)=>{for(var i=n>1?void 0:n?PM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&OM(t,r,i),i};let bd=class extends me{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{e!=null&&e.length&&await Promise.all(e.map(async t=>ne.preloadImage(t)))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(wn.state.enableExplorer){await an.getRecomendedWallets(),hr.setIsDataLoaded(!0);const{recomendedWallets:e}=an.state,t=e.map(r=>ne.getWalletIcon(r));await this.loadImages(t)}else hr.setIsDataLoaded(!0)}async preloadCustomImages(){const e=ne.getCustomImageUrls();await this.loadImages(e)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(e){console.error(e),vs.openToast("Failed preloading","error")}}};X2([cn()],bd.prototype,"preload",2),bd=X2([De("wcm-explorer-context")],bd);var MM=Object.defineProperty,$M=Object.getOwnPropertyDescriptor,NM=(e,t,r,n)=>{for(var i=n>1?void 0:n?$M(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&MM(t,r,i),i};let ty=class extends me{constructor(){super(),this.unsubscribeTheme=void 0,xe.setTheme(),this.unsubscribeTheme=ms.subscribe(xe.setTheme)}disconnectedCallback(){var e;(e=this.unsubscribeTheme)==null||e.call(this)}};ty=NM([De("wcm-theme-context")],ty);const TM=$e`@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 RM=Object.defineProperty,LM=Object.getOwnPropertyDescriptor,BM=(e,t,r,n)=>{for(var i=n>1?void 0:n?LM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&RM(t,r,i),i};let _d=class extends me{onGoToQrcode(){rr.push("Qrcode")}render(){const{recomendedWallets:e}=an.state,t=[...e,...e],r=Ut.RECOMMENDED_WALLET_AMOUNT*2;return vt`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Te.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Te.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=t[i%t.length];return o?vt`<wcm-wallet-image walletId="${o.id}" imageId="${o.image_id}"></wcm-wallet-image>`:Te.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${ne.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>`}};_d.styles=[xe.globalCss,TM],_d=BM([De("wcm-android-wallet-selection")],_d);const UM=$e`@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 FM=Object.defineProperty,jM=Object.getOwnPropertyDescriptor,ya=(e,t,r,n)=>{for(var i=n>1?void 0:n?jM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&FM(t,r,i),i};let xs=class extends me{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var e,t;const r=(t=(e=ms.state.themeVariables)==null?void 0:e["--wcm-wallet-icon-large-border-radius"])!=null?t:xe.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 vt`<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 e={"wcm-error":this.isError,"wcm-stale":this.isStale};return vt`<div class="${Gi(e)}">${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=[xe.globalCss,UM],ya([he()],xs.prototype,"walletId",2),ya([he()],xs.prototype,"imageId",2),ya([he({type:Boolean})],xs.prototype,"isError",2),ya([he({type:Boolean})],xs.prototype,"isStale",2),ya([he()],xs.prototype,"label",2),xs=ya([De("wcm-connector-waiting")],xs);const ba={manualWallets(){var e,t;const{mobileWallets:r,desktopWallets:n}=wn.state,i=(e=ba.recentWallet())==null?void 0:e.id,o=Ut.isMobile()?r:n,c=o?.filter(l=>i!==l.id);return(t=Ut.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?t:[]},recentWallet(){return ne.getRecentWallet()},recomendedWallets(e=!1){var t;const r=e||(t=ba.recentWallet())==null?void 0:t.id,{recomendedWallets:n}=an.state;return n.filter(i=>r!==i.id)}},Is={onConnecting(e){ne.goToConnectingView(e)},manualWalletsTemplate(){return ba.manualWallets().map(e=>vt`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(e=!1){return ba.recomendedWallets(e).map(t=>vt`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${t.image_id}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recentWalletTemplate(){const e=ba.recentWallet();if(e)return vt`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${Wr(e.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`}},kM=$e`.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 qM=Object.defineProperty,zM=Object.getOwnPropertyDescriptor,HM=(e,t,r,n)=>{for(var i=n>1?void 0:n?zM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&qM(t,r,i),i};let Ed=class extends me{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=wn.state,r=e!=="ALL"&&t,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 vt`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${ne.handleUriCopy}" .actionIcon="${Te.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Te.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Te.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?vt`<wcm-modal-footer><div class="wcm-desktop-title">${Te.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${l} ${c?vt`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Ed.styles=[xe.globalCss,kM],Ed=HM([De("wcm-desktop-wallet-selection")],Ed);const KM=$e`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 WM=Object.defineProperty,VM=Object.getOwnPropertyDescriptor,GM=(e,t,r,n)=>{for(var i=n>1?void 0:n?VM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&WM(t,r,i),i};let Ad=class extends me{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=wn.state;return e??t?vt`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${e?vt`<a href="${e}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${e&&t?"and":null} ${t?vt`<a href="${t}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Ad.styles=[xe.globalCss,KM],Ad=GM([De("wcm-legal-notice")],Ad);const YM=$e`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var QM=Object.defineProperty,JM=Object.getOwnPropertyDescriptor,ZM=(e,t,r,n)=>{for(var i=n>1?void 0:n?JM(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&QM(t,r,i),i};let xd=class extends me{onQrcode(){rr.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=wn.state,r=e!=="ALL"&&t,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 vt`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Te.QRCODE_ICON}"></wcm-modal-header>${f?vt`<wcm-modal-content><div>${l} ${c?vt`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};xd.styles=[xe.globalCss,YM],xd=ZM([De("wcm-mobile-wallet-selection")],xd);const XM=$e`: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 t$=Object.defineProperty,e$=Object.getOwnPropertyDescriptor,Id=(e,t,r,n)=>{for(var i=n>1?void 0:n?e$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&t$(t,r,i),i};let _a=class extends me{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=eo.subscribe(e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var e;(e=this.unsubscribeModal)==null||e.call(this)}get overlayEl(){return ne.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return ne.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(e){document.querySelector("body")&&(e?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(e){e.target===e.currentTarget&&eo.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const e=ne.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},t=.1,r=.2;await Promise.all([co(this.overlayEl,{opacity:[0,1]},{delay:t,duration:r}).finished,co(this.containerEl,e,{delay:t,duration:r}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=ne.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},t=.2;await Promise.all([co(this.overlayEl,{opacity:[1,0]},{duration:t}).finished,co(this.containerEl,e,{duration:t}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",e=>{var t;e.key==="Escape"?eo.close():e.key==="Tab"&&((t=e.target)!=null&&t.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var e;(e=this.abortController)==null||e.abort(),this.abortController=void 0}render(){const e={"wcm-overlay":!0,"wcm-active":this.active};return vt`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Gi(e)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?vt`<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>`}};_a.styles=[xe.globalCss,XM],Id([cn()],_a.prototype,"open",2),Id([cn()],_a.prototype,"active",2),_a=Id([De("wcm-modal")],_a);const r$=$e`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var n$=Object.defineProperty,i$=Object.getOwnPropertyDescriptor,Fc=(e,t,r,n)=>{for(var i=n>1?void 0:n?i$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&n$(t,r,i),i};let uo=class extends me{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){Ut.isMobile()?rr.replace("MobileConnecting"):rr.replace("MobileQrcodeConnecting")}onDesktop(){rr.replace("DesktopConnecting")}onWeb(){rr.replace("WebConnecting")}render(){return vt`<div>${this.isRetry?vt`<slot></slot>`:null} ${this.isMobile?vt`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Te.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?vt`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Te.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?vt`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Te.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};uo.styles=[xe.globalCss,r$],Fc([he({type:Boolean})],uo.prototype,"isMobile",2),Fc([he({type:Boolean})],uo.prototype,"isDesktop",2),Fc([he({type:Boolean})],uo.prototype,"isWeb",2),Fc([he({type:Boolean})],uo.prototype,"isRetry",2),uo=Fc([De("wcm-platform-selection")],uo);const s$=$e`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 o$=Object.defineProperty,a$=Object.getOwnPropertyDescriptor,c$=(e,t,r,n)=>{for(var i=n>1?void 0:n?a$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&o$(t,r,i),i};let Sd=class extends me{onClick(){rr.push("WalletExplorer")}render(){const{recomendedWallets:e}=an.state,t=ba.manualWallets(),r=[...e,...t].reverse().slice(0,4);return vt`<button @click="${this.onClick}"><div class="wcm-icons">${r.map(n=>{const i=ne.getWalletIcon(n);if(i)return vt`<img crossorigin="anonymous" src="${i}">`;const o=ne.getWalletIcon({id:n.id});return o?vt`<img crossorigin="anonymous" src="${o}">`:Te.WALLET_PLACEHOLDER})} ${[...Array(4-r.length)].map(()=>Te.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Sd.styles=[xe.globalCss,s$],Sd=c$([De("wcm-view-all-wallets-button")],Sd);const l$=$e`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var u$=Object.defineProperty,h$=Object.getOwnPropertyDescriptor,Du=(e,t,r,n)=>{for(var i=n>1?void 0:n?h$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&u$(t,r,i),i};let Ea=class extends me{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:e}=hr.state;this.uri=e},0)}get overlayEl(){return ne.getShadowRootElement(this,".wcm-qr-container")}render(){return vt`<div class="wcm-qr-container">${this.uri?vt`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}"></wcm-qrcode>`:vt`<wcm-spinner></wcm-spinner>`}</div>`}};Ea.styles=[xe.globalCss,l$],Du([he()],Ea.prototype,"walletId",2),Du([he()],Ea.prototype,"imageId",2),Du([cn()],Ea.prototype,"uri",2),Ea=Du([De("wcm-walletconnect-qr")],Ea);var f$=Object.defineProperty,d$=Object.getOwnPropertyDescriptor,p$=(e,t,r,n)=>{for(var i=n>1?void 0:n?d$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&f$(t,r,i),i};let Cd=class extends me{viewTemplate(){return Ut.isAndroid()?vt`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:Ut.isMobile()?vt`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:vt`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return vt`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Cd.styles=[xe.globalCss],Cd=p$([De("wcm-connect-wallet-view")],Cd);const g$=$e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var m$=Object.defineProperty,v$=Object.getOwnPropertyDescriptor,ey=(e,t,r,n)=>{for(var i=n>1?void 0:n?v$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&m$(t,r,i),i};let Ou=class extends me{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:r}=Ut.getWalletRouterData(),n=t?.native;if(n){const i=Ut.formatNativeUrl(n,e,r);Ut.openHref(i,"_self")}}openDesktopApp(){const{walletConnectUri:e}=hr.state,t=Ut.getWalletRouterData();ne.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=Ut.getWalletRouterData(),{isMobile:n,isWeb:i}=ne.getCachedRouterWalletPlatforms();return vt`<wcm-modal-header title="${e}" .onAction="${ne.handleUriCopy}" .actionIcon="${Te.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${Wr(r)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${e} 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="${Te.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Ou.styles=[xe.globalCss,g$],ey([cn()],Ou.prototype,"isError",2),Ou=ey([De("wcm-desktop-connecting-view")],Ou);const w$=$e`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 y$=Object.defineProperty,b$=Object.getOwnPropertyDescriptor,_$=(e,t,r,n)=>{for(var i=n>1?void 0:n?b$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&y$(t,r,i),i};let Dd=class extends me{onInstall(e){e&&Ut.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,homepage:n}=Ut.getWalletRouterData();return vt`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" 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 ${e} to continue. If multiple browser extensions are installed, disable non ${e} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${Te.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};Dd.styles=[xe.globalCss,w$],Dd=_$([De("wcm-install-wallet-view")],Dd);const E$=$e`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 A$=Object.defineProperty,x$=Object.getOwnPropertyDescriptor,ry=(e,t,r,n)=>{for(var i=n>1?void 0:n?x$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&A$(t,r,i),i};let Pu=class extends me{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:r,name:n}=Ut.getWalletRouterData(),i=r?.native,o=r?.universal;if(i&&!t){const c=Ut.formatNativeUrl(i,e,n);Ut.openHref(c,"_self")}else if(o){const c=Ut.formatUniversalUrl(o,e,n);Ut.openHref(c,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=hr.state,r=Ut.getWalletRouterData();ne.setRecentWallet(r),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&Ut.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,app:n,mobile:i}=Ut.getWalletRouterData(),{isWeb:o}=ne.getCachedRouterWalletPlatforms(),c=n?.ios,l=i?.universal;return vt`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" 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="${Te.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${l?vt`<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="${t}" imageId="${Wr(r)}"></wcm-wallet-image><wcm-text>${`Get ${e}`}</wcm-text></div><wcm-button .iconRight="${Te.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(c)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Pu.styles=[xe.globalCss,E$],ry([cn()],Pu.prototype,"isError",2),Pu=ry([De("wcm-mobile-connecting-view")],Pu);const I$=$e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var S$=Object.defineProperty,C$=Object.getOwnPropertyDescriptor,D$=(e,t,r,n)=>{for(var i=n>1?void 0:n?C$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&S$(t,r,i),i};let Od=class extends me{render(){const{name:e,id:t,image_id:r}=Ut.getWalletRouterData(),{isDesktop:n,isWeb:i}=ne.getCachedRouterWalletPlatforms();return vt`<wcm-modal-header title="${e}" .onAction="${ne.handleUriCopy}" .actionIcon="${Te.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${t}" 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 ${e} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};Od.styles=[xe.globalCss,I$],Od=D$([De("wcm-mobile-qr-connecting-view")],Od);var O$=Object.defineProperty,P$=Object.getOwnPropertyDescriptor,M$=(e,t,r,n)=>{for(var i=n>1?void 0:n?P$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&O$(t,r,i),i};let Pd=class extends me{render(){return vt`<wcm-modal-header title="Scan the code" .onAction="${ne.handleUriCopy}" .actionIcon="${Te.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Pd.styles=[xe.globalCss],Pd=M$([De("wcm-qrcode-view")],Pd);const $$=$e`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 N$=Object.defineProperty,T$=Object.getOwnPropertyDescriptor,jc=(e,t,r,n)=>{for(var i=n>1?void 0:n?T$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&N$(t,r,i),i};const Md=40;let ho=class extends me{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=ne.debounce(e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,an.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),an.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;(e=this.intersectionObserver)==null||e.disconnect()}get placeholderEl(){return ne.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([e])=>{e.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:e,search:t}=an.state,{listings:r,total:n}=this.search?t:e;return n<=Md||r.length>=n}async fetchWallets(){var e;const{wallets:t,search:r}=an.state,{listings:n,total:i,page:o}=this.search?r:t;if(!this.endReached&&(this.firstFetch||i>Md&&n.length<i))try{this.loading=!0;const c=(e=hr.state.chains)==null?void 0:e.join(","),{listings:l}=await an.getWallets({page:this.firstFetch?1:o+1,entries:Md,search:this.search,version:2,chains:c}),f=l.map(h=>ne.getWalletIcon(h));await Promise.all([...f.map(async h=>ne.preloadImage(h)),Ut.wait(300)]),this.endReached=this.isLastPage()}catch(c){console.error(c),vs.openToast(ne.getErrorMessage(c),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){Ut.isAndroid()?ne.handleMobileLinking(e):ne.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=an.state,{listings:r}=this.search?t:e,n=this.loading&&!r.length,i=this.search.length>=3;let o=Is.manualWalletsTemplate(),c=Is.recomendedWalletsTemplate(!0);i&&(o=o.filter(({values:h})=>ne.caseSafeIncludes(h[0],this.search)),c=c.filter(({values:h})=>ne.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 vt`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Gi(f)}"><div class="wcm-grid">${n?null:o} ${n?null:c} ${n?null:r.map(h=>vt`${h?vt`<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?vt`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!l&&this.loading?vt`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ho.styles=[xe.globalCss,$$],jc([cn()],ho.prototype,"loading",2),jc([cn()],ho.prototype,"firstFetch",2),jc([cn()],ho.prototype,"search",2),jc([cn()],ho.prototype,"endReached",2),ho=jc([De("wcm-wallet-explorer-view")],ho);const R$=$e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var L$=Object.defineProperty,B$=Object.getOwnPropertyDescriptor,ny=(e,t,r,n)=>{for(var i=n>1?void 0:n?B$(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&L$(t,r,i),i};let Mu=class extends me{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:r}=Ut.getWalletRouterData(),n=t?.universal;if(n){const i=Ut.formatUniversalUrl(n,e,r);Ut.openHref(i,"_blank")}}openWebWallet(){const{walletConnectUri:e}=hr.state,t=Ut.getWalletRouterData();ne.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=Ut.getWalletRouterData(),{isMobile:n,isDesktop:i}=ne.getCachedRouterWalletPlatforms(),o=Ut.isMobile();return vt`<wcm-modal-header title="${e}" .onAction="${ne.handleUriCopy}" .actionIcon="${Te.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${Wr(r)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${e} 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="${Te.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Mu.styles=[xe.globalCss,R$],ny([cn()],Mu.prototype,"isError",2),Mu=ny([De("wcm-web-connecting-view")],Mu);var U$=Object.freeze({__proto__:null,get WcmModal(){return _a},get WcmQrCode(){return Qi}});Vn.EthereumProvider=cD,Vn.OPTIONAL_EVENTS=Pw,Vn.OPTIONAL_METHODS=Ow,Vn.REQUIRED_EVENTS=ru,Vn.REQUIRED_METHODS=eu,Vn.default=su,Object.defineProperty(Vn,"__esModule",{value:!0})});
|
|
123
123
|
//# sourceMappingURL=index.umd.js.map
|