@dcl/vesting-dashboard 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{fortmatic-32cfb198.js → fortmatic-e0c32184.js} +1 -1
- package/assets/index-1d8346ff.js +1 -0
- package/assets/index-7058a6d1.js +7 -0
- package/assets/{index-b105dcf7.js → index-82a5f67d.js} +1 -1
- package/assets/{index-6f7d51ea.js → index-9ab4b2f8.js} +184 -176
- package/assets/index-b90c7536.js +54 -0
- package/assets/{index-5f97c874.js → index-ca7be960.js} +1 -1
- package/assets/{index-811eeb1a.css → index-d326c9c7.css} +7 -7
- package/assets/{index-a27404b0.js → index-f3bb1efd.js} +1 -1
- package/assets/index.es-548f3f57.js +49 -0
- package/index.html +4 -4
- package/package.json +3 -3
- package/assets/index-9dead77a.js +0 -1
- package/assets/index-ac1d8a3b.js +0 -54
- package/assets/index-f83f2de0.js +0 -7
- package/assets/index.es-46c6b03a.js +0 -56
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import{t as fh,k as j2,c as k2,p as Ei,g as W2,a as V2,r as G2,b as J2,d as wr,m as Y2,u as X2,i as eu,h as Rp,e as Tp,f as Z2,j as ht,B as ci,l as Q2,n as hi,o as Np,q as tu,s as Il,_ as e6}from"./index-9ab4b2f8.js";const t6=`Ethereum Signed Message:
|
|
2
|
+
`;function $p(r){return typeof r=="string"&&(r=fh(r)),j2(k2([fh(t6),fh(String(r.length)),r]))}var Dl=globalThis&&globalThis.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},r6=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),i6=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=Ei.platform}return r}(),n6=function(){function r(e,t,n,a){this.name=e,this.version=t,this.os=n,this.bot=a,this.type="bot-device"}return r}(),s6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),a6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),o6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,c6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Al=3,f6=[["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",o6]],Ml=[["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 h6(r){return r?Pl(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new a6:typeof navigator<"u"?Pl(navigator.userAgent):l6()}function u6(r){return r!==""&&f6.reduce(function(e,t){var n=t[0],a=t[1];if(e)return e;var o=a.exec(r);return!!o&&[n,o]},!1)}function Pl(r){var e=u6(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new s6;var a=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);a?a.length<Al&&(a=Dl(Dl([],a,!0),p6(Al-a.length),!0)):a=[];var o=a.join("."),f=d6(r),h=c6.exec(r);return h&&h[1]?new n6(t,o,f,h[1]):new r6(t,o,f)}function d6(r){for(var e=0,t=Ml.length;e<t;e++){var n=Ml[e],a=n[0],o=n[1],f=o.exec(r);if(f)return a}return null}function l6(){var r=typeof Ei<"u"&&Ei.version;return r?new i6(Ei.version.slice(1)):null}function p6(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var be={};/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */var Th=function(r,e){return Th=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var a in n)n.hasOwnProperty(a)&&(t[a]=n[a])},Th(r,e)};function g6(r,e){Th(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Nh=function(){return Nh=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Nh.apply(this,arguments)};function b6(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(r);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(r,n[a])&&(t[n[a]]=r[n[a]]);return t}function v6(r,e,t,n){var a=arguments.length,o=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var h=r.length-1;h>=0;h--)(f=r[h])&&(o=(a<3?f(o):a>3?f(e,t,o):f(e,t))||o);return a>3&&o&&Object.defineProperty(e,t,o),o}function m6(r,e){return function(t,n){e(t,n,r)}}function y6(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function w6(r,e,t,n){function a(o){return o instanceof t?o:new t(function(f){f(o)})}return new(t||(t=Promise))(function(o,f){function h(m){try{l(n.next(m))}catch(_){f(_)}}function p(m){try{l(n.throw(m))}catch(_){f(_)}}function l(m){m.done?o(m.value):a(m.value).then(h,p)}l((n=n.apply(r,e||[])).next())})}function _6(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,a,o,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(l){return function(m){return p([l,m])}}function p(l){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,a&&(o=l[0]&2?a.return:l[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,l[1])).done)return o;switch(a=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,a=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){t.label=l[1];break}if(l[0]===6&&t.label<o[1]){t.label=o[1],o=l;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(l);break}o[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(m){l=[6,m],a=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function E6(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function S6(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function $h(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],f;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(h){f={error:h}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(f)throw f.error}}return o}function x6(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Lp(arguments[e]));return r}function I6(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),a=0,e=0;e<t;e++)for(var o=arguments[e],f=0,h=o.length;f<h;f++,a++)n[a]=o[f];return n}function Ca(r){return this instanceof Ca?(this.v=r,this):new Ca(r)}function D6(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),a,o=[];return a={},f("next"),f("throw"),f("return"),a[Symbol.asyncIterator]=function(){return this},a;function f(M){n[M]&&(a[M]=function(I){return new Promise(function(P,H){o.push([M,I,P,H])>1||h(M,I)})})}function h(M,I){try{p(n[M](I))}catch(P){_(o[0][3],P)}}function p(M){M.value instanceof Ca?Promise.resolve(M.value.v).then(l,m):_(o[0][2],M)}function l(M){h("next",M)}function m(M){h("throw",M)}function _(M,I){M(I),o.shift(),o.length&&h(o[0][0],o[0][1])}}function A6(r){var e,t;return e={},n("next"),n("throw",function(a){throw a}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(a,o){e[a]=r[a]?function(f){return(t=!t)?{value:Ca(r[a](f)),done:a==="return"}:o?o(f):f}:o}}function M6(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof $h=="function"?$h(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=r[o]&&function(f){return new Promise(function(h,p){f=r[o](f),a(h,p,f.done,f.value)})}}function a(o,f,h,p){Promise.resolve(p).then(function(l){o({value:l,done:h})},f)}}function P6(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function O6(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function C6(r){return r&&r.__esModule?r:{default:r}}function R6(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function T6(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}const N6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Nh},__asyncDelegator:A6,__asyncGenerator:D6,__asyncValues:M6,__await:Ca,__awaiter:w6,__classPrivateFieldGet:R6,__classPrivateFieldSet:T6,__createBinding:E6,__decorate:v6,__exportStar:S6,__extends:g6,__generator:_6,__importDefault:C6,__importStar:O6,__makeTemplateObject:P6,__metadata:y6,__param:m6,__read:Lp,__rest:b6,__spread:x6,__spreadArrays:I6,__values:$h},Symbol.toStringTag,{value:"Module"})),qa=W2(N6);var hh={},ma={},Ol;function $6(){if(Ol)return ma;Ol=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return ma.delay=r,ma}var Zn={},uh={},Qn={},Cl;function L6(){return Cl||(Cl=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.ONE_THOUSAND=Qn.ONE_HUNDRED=void 0,Qn.ONE_HUNDRED=100,Qn.ONE_THOUSAND=1e3),Qn}var dh={},Rl;function F6(){return Rl||(Rl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(dh)),dh}var Tl;function Fp(){return Tl||(Tl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=qa;e.__exportStar(L6(),r),e.__exportStar(F6(),r)}(uh)),uh}var Nl;function q6(){if(Nl)return Zn;Nl=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.fromMiliseconds=Zn.toMiliseconds=void 0;const r=Fp();function e(n){return n*r.ONE_THOUSAND}Zn.toMiliseconds=e;function t(n){return Math.floor(n/r.ONE_THOUSAND)}return Zn.fromMiliseconds=t,Zn}var $l;function U6(){return $l||($l=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=qa;e.__exportStar($6(),r),e.__exportStar(q6(),r)}(hh)),hh}var $s={},Ll;function B6(){if(Ll)return $s;Ll=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const n=this.get(t);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const a=Date.now()-n.started;this.timestamps.set(t,{started:n.started,elapsed:a})}get(t){const n=this.timestamps.get(t);if(typeof n>"u")throw new Error(`No timestamp found for label: ${t}`);return n}elapsed(t){const n=this.get(t);return n.elapsed||Date.now()-n.started}}return $s.Watch=r,$s.default=r,$s}var lh={},ya={},Fl;function z6(){if(Fl)return ya;Fl=1,Object.defineProperty(ya,"__esModule",{value:!0}),ya.IWatch=void 0;class r{}return ya.IWatch=r,ya}var ql;function H6(){return ql||(ql=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),qa.__exportStar(z6(),r)}(lh)),lh}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=qa;e.__exportStar(U6(),r),e.__exportStar(B6(),r),e.__exportStar(H6(),r),e.__exportStar(Fp(),r)})(be);var $t={};Object.defineProperty($t,"__esModule",{value:!0});$t.getLocalStorage=$t.getLocalStorageOrThrow=$t.getCrypto=$t.getCryptoOrThrow=qp=$t.getLocation=$t.getLocationOrThrow=ru=$t.getNavigator=$t.getNavigatorOrThrow=Ua=$t.getDocument=$t.getDocumentOrThrow=$t.getFromWindowOrThrow=$t.getFromWindow=void 0;function us(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}$t.getFromWindow=us;function Ws(r){const e=us(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}$t.getFromWindowOrThrow=Ws;function K6(){return Ws("document")}$t.getDocumentOrThrow=K6;function j6(){return us("document")}var Ua=$t.getDocument=j6;function k6(){return Ws("navigator")}$t.getNavigatorOrThrow=k6;function W6(){return us("navigator")}var ru=$t.getNavigator=W6;function V6(){return Ws("location")}$t.getLocationOrThrow=V6;function G6(){return us("location")}var qp=$t.getLocation=G6;function J6(){return Ws("crypto")}$t.getCryptoOrThrow=J6;function Y6(){return us("crypto")}$t.getCrypto=Y6;function X6(){return Ws("localStorage")}$t.getLocalStorageOrThrow=X6;function Z6(){return us("localStorage")}$t.getLocalStorage=Z6;var iu={};Object.defineProperty(iu,"__esModule",{value:!0});var Up=iu.getWindowMetadata=void 0;const Ul=$t;function Q6(){let r,e;try{r=Ul.getDocumentOrThrow(),e=Ul.getLocationOrThrow()}catch{return null}function t(){const _=r.getElementsByTagName("link"),M=[];for(let I=0;I<_.length;I++){const P=_[I],H=P.getAttribute("rel");if(H&&H.toLowerCase().indexOf("icon")>-1){const W=P.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let J=e.protocol+"//"+e.host;if(W.indexOf("/")===0)J+=W;else{const q=e.pathname.split("/");q.pop();const V=q.join("/");J+=V+"/"+W}M.push(J)}else if(W.indexOf("//")===0){const J=e.protocol+W;M.push(J)}else M.push(W)}}return M}function n(..._){const M=r.getElementsByTagName("meta");for(let I=0;I<M.length;I++){const P=M[I],H=["itemprop","property","name"].map(W=>P.getAttribute(W)).filter(W=>W?_.includes(W):!1);if(H.length&&H){const W=P.getAttribute("content");if(W)return W}}return""}function a(){let _=n("name","og:site_name","og:title","twitter:title");return _||(_=r.title),_}function o(){return n("description","og:description","twitter:description","keywords")}const f=a(),h=o(),p=e.origin,l=t();return{description:h,url:p,icons:l,name:f}}Up=iu.getWindowMetadata=Q6;var Ra={},ew=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Bp="%[a-f0-9]{2}",Bl=new RegExp("("+Bp+")|([^%]+?)","gi"),zl=new RegExp("("+Bp+")+","gi");function Lh(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],Lh(t),Lh(n))}function tw(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Bl)||[],t=1;t<e.length;t++)r=Lh(e,t).join(""),e=r.match(Bl)||[];return r}}function rw(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=zl.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var n=tw(t[0]);n!==t[0]&&(e[t[0]]=n)}t=zl.exec(r)}e["%C2"]="�";for(var a=Object.keys(e),o=0;o<a.length;o++){var f=a[o];r=r.replace(new RegExp(f,"g"),e[f])}return r}var iw=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return rw(r)}},nw=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},sw=function(r,e){for(var t={},n=Object.keys(r),a=Array.isArray(e),o=0;o<n.length;o++){var f=n[o],h=r[f];(a?e.indexOf(f)!==-1:e(f,h,r))&&(t[f]=h)}return t};(function(r){const e=ew,t=iw,n=nw,a=sw,o=q=>q==null,f=Symbol("encodeFragmentIdentifier");function h(q){switch(q.arrayFormat){case"index":return V=>(L,U)=>{const z=L.length;return U===void 0||q.skipNull&&U===null||q.skipEmptyString&&U===""?L:U===null?[...L,[m(V,q),"[",z,"]"].join("")]:[...L,[m(V,q),"[",m(z,q),"]=",m(U,q)].join("")]};case"bracket":return V=>(L,U)=>U===void 0||q.skipNull&&U===null||q.skipEmptyString&&U===""?L:U===null?[...L,[m(V,q),"[]"].join("")]:[...L,[m(V,q),"[]=",m(U,q)].join("")];case"colon-list-separator":return V=>(L,U)=>U===void 0||q.skipNull&&U===null||q.skipEmptyString&&U===""?L:U===null?[...L,[m(V,q),":list="].join("")]:[...L,[m(V,q),":list=",m(U,q)].join("")];case"comma":case"separator":case"bracket-separator":{const V=q.arrayFormat==="bracket-separator"?"[]=":"=";return L=>(U,z)=>z===void 0||q.skipNull&&z===null||q.skipEmptyString&&z===""?U:(z=z===null?"":z,U.length===0?[[m(L,q),V,m(z,q)].join("")]:[[U,m(z,q)].join(q.arrayFormatSeparator)])}default:return V=>(L,U)=>U===void 0||q.skipNull&&U===null||q.skipEmptyString&&U===""?L:U===null?[...L,m(V,q)]:[...L,[m(V,q),"=",m(U,q)].join("")]}}function p(q){let V;switch(q.arrayFormat){case"index":return(L,U,z)=>{if(V=/\[(\d*)\]$/.exec(L),L=L.replace(/\[\d*\]$/,""),!V){z[L]=U;return}z[L]===void 0&&(z[L]={}),z[L][V[1]]=U};case"bracket":return(L,U,z)=>{if(V=/(\[\])$/.exec(L),L=L.replace(/\[\]$/,""),!V){z[L]=U;return}if(z[L]===void 0){z[L]=[U];return}z[L]=[].concat(z[L],U)};case"colon-list-separator":return(L,U,z)=>{if(V=/(:list)$/.exec(L),L=L.replace(/:list$/,""),!V){z[L]=U;return}if(z[L]===void 0){z[L]=[U];return}z[L]=[].concat(z[L],U)};case"comma":case"separator":return(L,U,z)=>{const b=typeof U=="string"&&U.includes(q.arrayFormatSeparator),T=typeof U=="string"&&!b&&_(U,q).includes(q.arrayFormatSeparator);U=T?_(U,q):U;const re=b||T?U.split(q.arrayFormatSeparator).map(de=>_(de,q)):U===null?U:_(U,q);z[L]=re};case"bracket-separator":return(L,U,z)=>{const b=/(\[\])$/.test(L);if(L=L.replace(/\[\]$/,""),!b){z[L]=U&&_(U,q);return}const T=U===null?[]:U.split(q.arrayFormatSeparator).map(re=>_(re,q));if(z[L]===void 0){z[L]=T;return}z[L]=[].concat(z[L],T)};default:return(L,U,z)=>{if(z[L]===void 0){z[L]=U;return}z[L]=[].concat(z[L],U)}}}function l(q){if(typeof q!="string"||q.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(q,V){return V.encode?V.strict?e(q):encodeURIComponent(q):q}function _(q,V){return V.decode?t(q):q}function M(q){return Array.isArray(q)?q.sort():typeof q=="object"?M(Object.keys(q)).sort((V,L)=>Number(V)-Number(L)).map(V=>q[V]):q}function I(q){const V=q.indexOf("#");return V!==-1&&(q=q.slice(0,V)),q}function P(q){let V="";const L=q.indexOf("#");return L!==-1&&(V=q.slice(L)),V}function H(q){q=I(q);const V=q.indexOf("?");return V===-1?"":q.slice(V+1)}function W(q,V){return V.parseNumbers&&!Number.isNaN(Number(q))&&typeof q=="string"&&q.trim()!==""?q=Number(q):V.parseBooleans&&q!==null&&(q.toLowerCase()==="true"||q.toLowerCase()==="false")&&(q=q.toLowerCase()==="true"),q}function J(q,V){V=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},V),l(V.arrayFormatSeparator);const L=p(V),U=Object.create(null);if(typeof q!="string"||(q=q.trim().replace(/^[?#&]/,""),!q))return U;for(const z of q.split("&")){if(z==="")continue;let[b,T]=n(V.decode?z.replace(/\+/g," "):z,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(V.arrayFormat)?T:_(T,V),L(_(b,V),T,U)}for(const z of Object.keys(U)){const b=U[z];if(typeof b=="object"&&b!==null)for(const T of Object.keys(b))b[T]=W(b[T],V);else U[z]=W(b,V)}return V.sort===!1?U:(V.sort===!0?Object.keys(U).sort():Object.keys(U).sort(V.sort)).reduce((z,b)=>{const T=U[b];return T&&typeof T=="object"&&!Array.isArray(T)?z[b]=M(T):z[b]=T,z},Object.create(null))}r.extract=H,r.parse=J,r.stringify=(q,V)=>{if(!q)return"";V=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},V),l(V.arrayFormatSeparator);const L=T=>V.skipNull&&o(q[T])||V.skipEmptyString&&q[T]==="",U=h(V),z={};for(const T of Object.keys(q))L(T)||(z[T]=q[T]);const b=Object.keys(z);return V.sort!==!1&&b.sort(V.sort),b.map(T=>{const re=q[T];return re===void 0?"":re===null?m(T,V):Array.isArray(re)?re.length===0&&V.arrayFormat==="bracket-separator"?m(T,V)+"[]":re.reduce(U(T),[]).join("&"):m(T,V)+"="+m(re,V)}).filter(T=>T.length>0).join("&")},r.parseUrl=(q,V)=>{V=Object.assign({decode:!0},V);const[L,U]=n(q,"#");return Object.assign({url:L.split("?")[0]||"",query:J(H(q),V)},V&&V.parseFragmentIdentifier&&U?{fragmentIdentifier:_(U,V)}:{})},r.stringifyUrl=(q,V)=>{V=Object.assign({encode:!0,strict:!0,[f]:!0},V);const L=I(q.url).split("?")[0]||"",U=r.extract(q.url),z=r.parse(U,{sort:!1}),b=Object.assign(z,q.query);let T=r.stringify(b,V);T&&(T=`?${T}`);let re=P(q.url);return q.fragmentIdentifier&&(re=`#${V[f]?m(q.fragmentIdentifier,V):q.fragmentIdentifier}`),`${L}${T}${re}`},r.pick=(q,V,L)=>{L=Object.assign({parseFragmentIdentifier:!0,[f]:!1},L);const{url:U,query:z,fragmentIdentifier:b}=r.parseUrl(q,L);return r.stringifyUrl({url:U,query:a(z,V),fragmentIdentifier:b},L)},r.exclude=(q,V,L)=>{const U=Array.isArray(V)?z=>!V.includes(z):(z,b)=>!V(z,b);return r.pick(q,U,L)}})(Ra);var nu={},Cc={},et={},zp={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(h,p){var l=h>>>16&65535,m=h&65535,_=p>>>16&65535,M=p&65535;return m*M+(l*M+m*_<<16>>>0)|0}r.mul=Math.imul||e;function t(h,p){return h+p|0}r.add=t;function n(h,p){return h-p|0}r.sub=n;function a(h,p){return h<<p|h>>>32-p}r.rotl=a;function o(h,p){return h<<32-p|h>>>p}r.rotr=o;function f(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h}r.isInteger=Number.isInteger||f,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(h){return r.isInteger(h)&&h>=-r.MAX_SAFE_INTEGER&&h<=r.MAX_SAFE_INTEGER}})(zp);Object.defineProperty(et,"__esModule",{value:!0});var Hp=zp;function aw(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}et.readInt16BE=aw;function ow(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}et.readUint16BE=ow;function cw(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}et.readInt16LE=cw;function fw(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}et.readUint16LE=fw;function Kp(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}et.writeUint16BE=Kp;et.writeInt16BE=Kp;function jp(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}et.writeUint16LE=jp;et.writeInt16LE=jp;function Fh(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}et.readInt32BE=Fh;function qh(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}et.readUint32BE=qh;function Uh(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}et.readInt32LE=Uh;function Bh(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}et.readUint32LE=Bh;function bc(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}et.writeUint32BE=bc;et.writeInt32BE=bc;function vc(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}et.writeUint32LE=vc;et.writeInt32LE=vc;function hw(r,e){e===void 0&&(e=0);var t=Fh(r,e),n=Fh(r,e+4);return t*4294967296+n-(n>>31)*4294967296}et.readInt64BE=hw;function uw(r,e){e===void 0&&(e=0);var t=qh(r,e),n=qh(r,e+4);return t*4294967296+n}et.readUint64BE=uw;function dw(r,e){e===void 0&&(e=0);var t=Uh(r,e),n=Uh(r,e+4);return n*4294967296+t-(t>>31)*4294967296}et.readInt64LE=dw;function lw(r,e){e===void 0&&(e=0);var t=Bh(r,e),n=Bh(r,e+4);return n*4294967296+t}et.readUint64LE=lw;function kp(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),bc(r/4294967296>>>0,e,t),bc(r>>>0,e,t+4),e}et.writeUint64BE=kp;et.writeInt64BE=kp;function Wp(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),vc(r>>>0,e,t),vc(r/4294967296>>>0,e,t+4),e}et.writeUint64LE=Wp;et.writeInt64LE=Wp;function pw(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,a=1,o=r/8+t-1;o>=t;o--)n+=e[o]*a,a*=256;return n}et.readUintBE=pw;function gw(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,a=1,o=t;o<t+r/8;o++)n+=e[o]*a,a*=256;return n}et.readUintLE=gw;function bw(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Hp.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var a=1,o=r/8+n-1;o>=n;o--)t[o]=e/a&255,a*=256;return t}et.writeUintBE=bw;function vw(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Hp.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var a=1,o=n;o<n+r/8;o++)t[o]=e/a&255,a*=256;return t}et.writeUintLE=vw;function mw(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}et.readFloat32BE=mw;function yw(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}et.readFloat32LE=yw;function ww(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}et.readFloat64BE=ww;function _w(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}et.readFloat64LE=_w;function Ew(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}et.writeFloat32BE=Ew;function Sw(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}et.writeFloat32LE=Sw;function xw(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}et.writeFloat64BE=xw;function Iw(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}et.writeFloat64LE=Iw;var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});function Dw(r){for(var e=0;e<r.length;e++)r[e]=0;return r}Jr.wipe=Dw;Object.defineProperty(Cc,"__esModule",{value:!0});var yr=et,zh=Jr,Aw=20;function Mw(r,e,t){for(var n=1634760805,a=857760878,o=2036477234,f=1797285236,h=t[3]<<24|t[2]<<16|t[1]<<8|t[0],p=t[7]<<24|t[6]<<16|t[5]<<8|t[4],l=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=t[19]<<24|t[18]<<16|t[17]<<8|t[16],M=t[23]<<24|t[22]<<16|t[21]<<8|t[20],I=t[27]<<24|t[26]<<16|t[25]<<8|t[24],P=t[31]<<24|t[30]<<16|t[29]<<8|t[28],H=e[3]<<24|e[2]<<16|e[1]<<8|e[0],W=e[7]<<24|e[6]<<16|e[5]<<8|e[4],J=e[11]<<24|e[10]<<16|e[9]<<8|e[8],q=e[15]<<24|e[14]<<16|e[13]<<8|e[12],V=n,L=a,U=o,z=f,b=h,T=p,re=l,de=m,$=_,u=M,y=I,w=P,E=H,O=W,N=J,R=q,x=0;x<Aw;x+=2)V=V+b|0,E^=V,E=E>>>32-16|E<<16,$=$+E|0,b^=$,b=b>>>32-12|b<<12,L=L+T|0,O^=L,O=O>>>32-16|O<<16,u=u+O|0,T^=u,T=T>>>32-12|T<<12,U=U+re|0,N^=U,N=N>>>32-16|N<<16,y=y+N|0,re^=y,re=re>>>32-12|re<<12,z=z+de|0,R^=z,R=R>>>32-16|R<<16,w=w+R|0,de^=w,de=de>>>32-12|de<<12,U=U+re|0,N^=U,N=N>>>32-8|N<<8,y=y+N|0,re^=y,re=re>>>32-7|re<<7,z=z+de|0,R^=z,R=R>>>32-8|R<<8,w=w+R|0,de^=w,de=de>>>32-7|de<<7,L=L+T|0,O^=L,O=O>>>32-8|O<<8,u=u+O|0,T^=u,T=T>>>32-7|T<<7,V=V+b|0,E^=V,E=E>>>32-8|E<<8,$=$+E|0,b^=$,b=b>>>32-7|b<<7,V=V+T|0,R^=V,R=R>>>32-16|R<<16,y=y+R|0,T^=y,T=T>>>32-12|T<<12,L=L+re|0,E^=L,E=E>>>32-16|E<<16,w=w+E|0,re^=w,re=re>>>32-12|re<<12,U=U+de|0,O^=U,O=O>>>32-16|O<<16,$=$+O|0,de^=$,de=de>>>32-12|de<<12,z=z+b|0,N^=z,N=N>>>32-16|N<<16,u=u+N|0,b^=u,b=b>>>32-12|b<<12,U=U+de|0,O^=U,O=O>>>32-8|O<<8,$=$+O|0,de^=$,de=de>>>32-7|de<<7,z=z+b|0,N^=z,N=N>>>32-8|N<<8,u=u+N|0,b^=u,b=b>>>32-7|b<<7,L=L+re|0,E^=L,E=E>>>32-8|E<<8,w=w+E|0,re^=w,re=re>>>32-7|re<<7,V=V+T|0,R^=V,R=R>>>32-8|R<<8,y=y+R|0,T^=y,T=T>>>32-7|T<<7;yr.writeUint32LE(V+n|0,r,0),yr.writeUint32LE(L+a|0,r,4),yr.writeUint32LE(U+o|0,r,8),yr.writeUint32LE(z+f|0,r,12),yr.writeUint32LE(b+h|0,r,16),yr.writeUint32LE(T+p|0,r,20),yr.writeUint32LE(re+l|0,r,24),yr.writeUint32LE(de+m|0,r,28),yr.writeUint32LE($+_|0,r,32),yr.writeUint32LE(u+M|0,r,36),yr.writeUint32LE(y+I|0,r,40),yr.writeUint32LE(w+P|0,r,44),yr.writeUint32LE(E+H|0,r,48),yr.writeUint32LE(O+W|0,r,52),yr.writeUint32LE(N+J|0,r,56),yr.writeUint32LE(R+q|0,r,60)}function Vp(r,e,t,n,a){if(a===void 0&&(a=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var o,f;if(a===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");o=new Uint8Array(16),f=o.length-e.length,o.set(e,f)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");o=e,f=a}for(var h=new Uint8Array(64),p=0;p<t.length;p+=64){Mw(h,o,r);for(var l=p;l<p+64&&l<t.length;l++)n[l]=t[l]^h[l-p];Ow(o,0,f)}return zh.wipe(h),a===0&&zh.wipe(o),n}Cc.streamXOR=Vp;function Pw(r,e,t,n){return n===void 0&&(n=0),zh.wipe(t),Vp(r,e,t,t,n)}Cc.stream=Pw;function Ow(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Gp={},In={};Object.defineProperty(In,"__esModule",{value:!0});function Cw(r,e,t){return~(r-1)&e|r-1&t}In.select=Cw;function Rw(r,e){return(r|0)-(e|0)-1>>>31&1}In.lessOrEqual=Rw;function Jp(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}In.compare=Jp;function Tw(r,e){return r.length===0||e.length===0?!1:Jp(r,e)!==0}In.equal=Tw;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=In,t=Jr;r.DIGEST_LENGTH=16;var n=function(){function f(h){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var p=h[0]|h[1]<<8;this._r[0]=p&8191;var l=h[2]|h[3]<<8;this._r[1]=(p>>>13|l<<3)&8191;var m=h[4]|h[5]<<8;this._r[2]=(l>>>10|m<<6)&7939;var _=h[6]|h[7]<<8;this._r[3]=(m>>>7|_<<9)&8191;var M=h[8]|h[9]<<8;this._r[4]=(_>>>4|M<<12)&255,this._r[5]=M>>>1&8190;var I=h[10]|h[11]<<8;this._r[6]=(M>>>14|I<<2)&8191;var P=h[12]|h[13]<<8;this._r[7]=(I>>>11|P<<5)&8065;var H=h[14]|h[15]<<8;this._r[8]=(P>>>8|H<<8)&8191,this._r[9]=H>>>5&127,this._pad[0]=h[16]|h[17]<<8,this._pad[1]=h[18]|h[19]<<8,this._pad[2]=h[20]|h[21]<<8,this._pad[3]=h[22]|h[23]<<8,this._pad[4]=h[24]|h[25]<<8,this._pad[5]=h[26]|h[27]<<8,this._pad[6]=h[28]|h[29]<<8,this._pad[7]=h[30]|h[31]<<8}return f.prototype._blocks=function(h,p,l){for(var m=this._fin?0:2048,_=this._h[0],M=this._h[1],I=this._h[2],P=this._h[3],H=this._h[4],W=this._h[5],J=this._h[6],q=this._h[7],V=this._h[8],L=this._h[9],U=this._r[0],z=this._r[1],b=this._r[2],T=this._r[3],re=this._r[4],de=this._r[5],$=this._r[6],u=this._r[7],y=this._r[8],w=this._r[9];l>=16;){var E=h[p+0]|h[p+1]<<8;_+=E&8191;var O=h[p+2]|h[p+3]<<8;M+=(E>>>13|O<<3)&8191;var N=h[p+4]|h[p+5]<<8;I+=(O>>>10|N<<6)&8191;var R=h[p+6]|h[p+7]<<8;P+=(N>>>7|R<<9)&8191;var x=h[p+8]|h[p+9]<<8;H+=(R>>>4|x<<12)&8191,W+=x>>>1&8191;var d=h[p+10]|h[p+11]<<8;J+=(x>>>14|d<<2)&8191;var D=h[p+12]|h[p+13]<<8;q+=(d>>>11|D<<5)&8191;var fe=h[p+14]|h[p+15]<<8;V+=(D>>>8|fe<<8)&8191,L+=fe>>>5|m;var ee=0,he=ee;he+=_*U,he+=M*(5*w),he+=I*(5*y),he+=P*(5*u),he+=H*(5*$),ee=he>>>13,he&=8191,he+=W*(5*de),he+=J*(5*re),he+=q*(5*T),he+=V*(5*b),he+=L*(5*z),ee+=he>>>13,he&=8191;var ne=ee;ne+=_*z,ne+=M*U,ne+=I*(5*w),ne+=P*(5*y),ne+=H*(5*u),ee=ne>>>13,ne&=8191,ne+=W*(5*$),ne+=J*(5*de),ne+=q*(5*re),ne+=V*(5*T),ne+=L*(5*b),ee+=ne>>>13,ne&=8191;var ge=ee;ge+=_*b,ge+=M*z,ge+=I*U,ge+=P*(5*w),ge+=H*(5*y),ee=ge>>>13,ge&=8191,ge+=W*(5*u),ge+=J*(5*$),ge+=q*(5*de),ge+=V*(5*re),ge+=L*(5*T),ee+=ge>>>13,ge&=8191;var G=ee;G+=_*T,G+=M*b,G+=I*z,G+=P*U,G+=H*(5*w),ee=G>>>13,G&=8191,G+=W*(5*y),G+=J*(5*u),G+=q*(5*$),G+=V*(5*de),G+=L*(5*re),ee+=G>>>13,G&=8191;var Z=ee;Z+=_*re,Z+=M*T,Z+=I*b,Z+=P*z,Z+=H*U,ee=Z>>>13,Z&=8191,Z+=W*(5*w),Z+=J*(5*y),Z+=q*(5*u),Z+=V*(5*$),Z+=L*(5*de),ee+=Z>>>13,Z&=8191;var j=ee;j+=_*de,j+=M*re,j+=I*T,j+=P*b,j+=H*z,ee=j>>>13,j&=8191,j+=W*U,j+=J*(5*w),j+=q*(5*y),j+=V*(5*u),j+=L*(5*$),ee+=j>>>13,j&=8191;var v=ee;v+=_*$,v+=M*de,v+=I*re,v+=P*T,v+=H*b,ee=v>>>13,v&=8191,v+=W*z,v+=J*U,v+=q*(5*w),v+=V*(5*y),v+=L*(5*u),ee+=v>>>13,v&=8191;var K=ee;K+=_*u,K+=M*$,K+=I*de,K+=P*re,K+=H*T,ee=K>>>13,K&=8191,K+=W*b,K+=J*z,K+=q*U,K+=V*(5*w),K+=L*(5*y),ee+=K>>>13,K&=8191;var oe=ee;oe+=_*y,oe+=M*u,oe+=I*$,oe+=P*de,oe+=H*re,ee=oe>>>13,oe&=8191,oe+=W*T,oe+=J*b,oe+=q*z,oe+=V*U,oe+=L*(5*w),ee+=oe>>>13,oe&=8191;var le=ee;le+=_*w,le+=M*y,le+=I*u,le+=P*$,le+=H*de,ee=le>>>13,le&=8191,le+=W*re,le+=J*T,le+=q*b,le+=V*z,le+=L*U,ee+=le>>>13,le&=8191,ee=(ee<<2)+ee|0,ee=ee+he|0,he=ee&8191,ee=ee>>>13,ne+=ee,_=he,M=ne,I=ge,P=G,H=Z,W=j,J=v,q=K,V=oe,L=le,p+=16,l-=16}this._h[0]=_,this._h[1]=M,this._h[2]=I,this._h[3]=P,this._h[4]=H,this._h[5]=W,this._h[6]=J,this._h[7]=q,this._h[8]=V,this._h[9]=L},f.prototype.finish=function(h,p){p===void 0&&(p=0);var l=new Uint16Array(10),m,_,M,I;if(this._leftover){for(I=this._leftover,this._buffer[I++]=1;I<16;I++)this._buffer[I]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,I=2;I<10;I++)this._h[I]+=m,m=this._h[I]>>>13,this._h[I]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,l[0]=this._h[0]+5,m=l[0]>>>13,l[0]&=8191,I=1;I<10;I++)l[I]=this._h[I]+m,m=l[I]>>>13,l[I]&=8191;for(l[9]-=8192,_=(m^1)-1,I=0;I<10;I++)l[I]&=_;for(_=~_,I=0;I<10;I++)this._h[I]=this._h[I]&_|l[I];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,M=this._h[0]+this._pad[0],this._h[0]=M&65535,I=1;I<8;I++)M=(this._h[I]+this._pad[I]|0)+(M>>>16)|0,this._h[I]=M&65535;return h[p+0]=this._h[0]>>>0,h[p+1]=this._h[0]>>>8,h[p+2]=this._h[1]>>>0,h[p+3]=this._h[1]>>>8,h[p+4]=this._h[2]>>>0,h[p+5]=this._h[2]>>>8,h[p+6]=this._h[3]>>>0,h[p+7]=this._h[3]>>>8,h[p+8]=this._h[4]>>>0,h[p+9]=this._h[4]>>>8,h[p+10]=this._h[5]>>>0,h[p+11]=this._h[5]>>>8,h[p+12]=this._h[6]>>>0,h[p+13]=this._h[6]>>>8,h[p+14]=this._h[7]>>>0,h[p+15]=this._h[7]>>>8,this._finished=!0,this},f.prototype.update=function(h){var p=0,l=h.length,m;if(this._leftover){m=16-this._leftover,m>l&&(m=l);for(var _=0;_<m;_++)this._buffer[this._leftover+_]=h[p+_];if(l-=m,p+=m,this._leftover+=m,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(l>=16&&(m=l-l%16,this._blocks(h,p,m),p+=m,l-=m),l){for(var _=0;_<l;_++)this._buffer[this._leftover+_]=h[p+_];this._leftover+=l}return this},f.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var h=new Uint8Array(16);return this.finish(h),h},f.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},f}();r.Poly1305=n;function a(f,h){var p=new n(f);p.update(h);var l=p.digest();return p.clean(),l}r.oneTimeAuth=a;function o(f,h){return f.length!==r.DIGEST_LENGTH||h.length!==r.DIGEST_LENGTH?!1:e.equal(f,h)}r.equal=o})(Gp);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Cc,t=Gp,n=Jr,a=et,o=In;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var f=new Uint8Array(16),h=function(){function p(l){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,l.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(l)}return p.prototype.seal=function(l,m,_,M){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var I=new Uint8Array(16);I.set(l,I.length-l.length);var P=new Uint8Array(32);e.stream(this._key,I,P,4);var H=m.length+this.tagLength,W;if(M){if(M.length!==H)throw new Error("ChaCha20Poly1305: incorrect destination length");W=M}else W=new Uint8Array(H);return e.streamXOR(this._key,I,m,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),P,W.subarray(0,W.length-this.tagLength),_),n.wipe(I),W},p.prototype.open=function(l,m,_,M){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length<this.tagLength)return null;var I=new Uint8Array(16);I.set(l,I.length-l.length);var P=new Uint8Array(32);e.stream(this._key,I,P,4);var H=new Uint8Array(this.tagLength);if(this._authenticate(H,P,m.subarray(0,m.length-this.tagLength),_),!o.equal(H,m.subarray(m.length-this.tagLength,m.length)))return null;var W=m.length-this.tagLength,J;if(M){if(M.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");J=M}else J=new Uint8Array(W);return e.streamXOR(this._key,I,m.subarray(0,m.length-this.tagLength),J,4),n.wipe(I),J},p.prototype.clean=function(){return n.wipe(this._key),this},p.prototype._authenticate=function(l,m,_,M){var I=new t.Poly1305(m);M&&(I.update(M),M.length%16>0&&I.update(f.subarray(M.length%16))),I.update(_),_.length%16>0&&I.update(f.subarray(_.length%16));var P=new Uint8Array(8);M&&a.writeUint64LE(M.length,P),I.update(P),a.writeUint64LE(_.length,P),I.update(P);for(var H=I.digest(),W=0;W<H.length;W++)l[W]=H[W];I.clean(),n.wipe(H),n.wipe(P)},p}();r.ChaCha20Poly1305=h})(nu);var Yp={},Ba={},su={};Object.defineProperty(su,"__esModule",{value:!0});function Nw(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}su.isSerializableHash=Nw;Object.defineProperty(Ba,"__esModule",{value:!0});var Ni=su,$w=In,Lw=Jr,Xp=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var a=0;a<n.length;a++)n[a]^=54;this._inner.update(n);for(var a=0;a<n.length;a++)n[a]^=106;this._outer.update(n),Ni.isSerializableHash(this._inner)&&Ni.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Lw.wipe(n)}return r.prototype.reset=function(){if(!Ni.isSerializableHash(this._inner)||!Ni.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Ni.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ni.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!Ni.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!Ni.isSerializableHash(this._inner)||!Ni.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!Ni.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();Ba.HMAC=Xp;function Fw(r,e,t){var n=new Xp(r,e);n.update(t);var a=n.digest();return n.clean(),a}Ba.hmac=Fw;Ba.equal=$w.equal;Object.defineProperty(Yp,"__esModule",{value:!0});var Hl=Ba,Kl=Jr,qw=function(){function r(e,t,n,a){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=a;var o=Hl.hmac(this._hash,n,t);this._hmac=new Hl.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),Kl.wipe(this._buffer),Kl.wipe(this._counter),this._bufpos=0},r}(),Uw=Yp.HKDF=qw,Dn={},Rc={},Tc={};Object.defineProperty(Tc,"__esModule",{value:!0});Tc.BrowserRandomSource=void 0;const jl=65536;class Bw{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let n=0;n<t.length;n+=jl)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,jl)));return t}}Tc.BrowserRandomSource=Bw;var Nc={};Object.defineProperty(Nc,"__esModule",{value:!0});Nc.NodeRandomSource=void 0;const zw=Jr;class Hw{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof V2<"u"){const e=G2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let a=0;a<n.length;a++)n[a]=t[a];return(0,zw.wipe)(t),n}}Nc.NodeRandomSource=Hw;Object.defineProperty(Rc,"__esModule",{value:!0});Rc.SystemRandomSource=void 0;const Kw=Tc,jw=Nc;class kw{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Kw.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new jw.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)}}Rc.SystemRandomSource=kw;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=Rc,t=et,n=Jr;r.defaultRandomSource=new e.SystemRandomSource;function a(l,m=r.defaultRandomSource){return m.randomBytes(l)}r.randomBytes=a;function o(l=r.defaultRandomSource){const m=a(4,l),_=(0,t.readUint32LE)(m);return(0,n.wipe)(m),_}r.randomUint32=o;const f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function h(l,m=f,_=r.defaultRandomSource){if(m.length<2)throw new Error("randomString charset is too short");if(m.length>256)throw new Error("randomString charset is too long");let M="";const I=m.length,P=256-256%I;for(;l>0;){const H=a(Math.ceil(l*256/P),_);for(let W=0;W<H.length&&l>0;W++){const J=H[W];J<P&&(M+=m.charAt(J%I),l--)}(0,n.wipe)(H)}return M}r.randomString=h;function p(l,m=f,_=r.defaultRandomSource){const M=Math.ceil(l/(Math.log(m.length)/Math.LN2));return h(M,m,_)}r.randomStringForEntropy=p})(Dn);var za={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=et,t=Jr;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var n=function(){function h(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.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},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},h.prototype.update=function(p,l){if(l===void 0&&(l=p.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var m=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&l>0;)this._buffer[this._bufferLength++]=p[m++],l--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(m=o(this._temp,this._state,p,m,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=p[m++],l--;return this},h.prototype.finish=function(p){if(!this._finished){var l=this._bytesHashed,m=this._bufferLength,_=l/536870912|0,M=l<<3,I=l%64<56?64:128;this._buffer[m]=128;for(var P=m+1;P<I-8;P++)this._buffer[P]=0;e.writeUint32BE(_,this._buffer,I-8),e.writeUint32BE(M,this._buffer,I-4),o(this._temp,this._state,this._buffer,0,I),this._finished=!0}for(var P=0;P<this.digestLength/4;P++)e.writeUint32BE(this._state[P],p,P*4);return this},h.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},h.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}},h.prototype.restoreState=function(p){return this._state.set(p.state),this._bufferLength=p.bufferLength,p.buffer&&this._buffer.set(p.buffer),this._bytesHashed=p.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(p){t.wipe(p.state),p.buffer&&t.wipe(p.buffer),p.bufferLength=0,p.bytesHashed=0},h}();r.SHA256=n;var a=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(h,p,l,m,_){for(;_>=64;){for(var M=p[0],I=p[1],P=p[2],H=p[3],W=p[4],J=p[5],q=p[6],V=p[7],L=0;L<16;L++){var U=m+L*4;h[L]=e.readUint32BE(l,U)}for(var L=16;L<64;L++){var z=h[L-2],b=(z>>>17|z<<32-17)^(z>>>19|z<<32-19)^z>>>10;z=h[L-15];var T=(z>>>7|z<<32-7)^(z>>>18|z<<32-18)^z>>>3;h[L]=(b+h[L-7]|0)+(T+h[L-16]|0)}for(var L=0;L<64;L++){var b=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&J^~W&q)|0)+(V+(a[L]+h[L]|0)|0)|0,T=((M>>>2|M<<32-2)^(M>>>13|M<<32-13)^(M>>>22|M<<32-22))+(M&I^M&P^I&P)|0;V=q,q=J,J=W,W=H+b|0,H=P,P=I,I=M,M=b+T|0}p[0]+=M,p[1]+=I,p[2]+=P,p[3]+=H,p[4]+=W,p[5]+=J,p[6]+=q,p[7]+=V,m+=64,_-=64}return m}function f(h){var p=new n;p.update(h);var l=p.digest();return p.clean(),l}r.hash=f})(za);var au={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=Dn,t=Jr;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function n(L){const U=new Float64Array(16);if(L)for(let z=0;z<L.length;z++)U[z]=L[z];return U}const a=new Uint8Array(32);a[0]=9;const o=n([56129,1]);function f(L){let U=1;for(let z=0;z<16;z++){let b=L[z]+U+65535;U=Math.floor(b/65536),L[z]=b-U*65536}L[0]+=U-1+37*(U-1)}function h(L,U,z){const b=~(z-1);for(let T=0;T<16;T++){const re=b&(L[T]^U[T]);L[T]^=re,U[T]^=re}}function p(L,U){const z=n(),b=n();for(let T=0;T<16;T++)b[T]=U[T];f(b),f(b),f(b);for(let T=0;T<2;T++){z[0]=b[0]-65517;for(let de=1;de<15;de++)z[de]=b[de]-65535-(z[de-1]>>16&1),z[de-1]&=65535;z[15]=b[15]-32767-(z[14]>>16&1);const re=z[15]>>16&1;z[14]&=65535,h(b,z,1-re)}for(let T=0;T<16;T++)L[2*T]=b[T]&255,L[2*T+1]=b[T]>>8}function l(L,U){for(let z=0;z<16;z++)L[z]=U[2*z]+(U[2*z+1]<<8);L[15]&=32767}function m(L,U,z){for(let b=0;b<16;b++)L[b]=U[b]+z[b]}function _(L,U,z){for(let b=0;b<16;b++)L[b]=U[b]-z[b]}function M(L,U,z){let b,T,re=0,de=0,$=0,u=0,y=0,w=0,E=0,O=0,N=0,R=0,x=0,d=0,D=0,fe=0,ee=0,he=0,ne=0,ge=0,G=0,Z=0,j=0,v=0,K=0,oe=0,le=0,Te=0,Ae=0,Pe=0,He=0,Fe=0,qe=0,je=z[0],ye=z[1],Ie=z[2],Ue=z[3],De=z[4],Se=z[5],Be=z[6],me=z[7],xe=z[8],Ze=z[9],_e=z[10],Oe=z[11],ot=z[12],Ce=z[13],Re=z[14],ft=z[15];b=U[0],re+=b*je,de+=b*ye,$+=b*Ie,u+=b*Ue,y+=b*De,w+=b*Se,E+=b*Be,O+=b*me,N+=b*xe,R+=b*Ze,x+=b*_e,d+=b*Oe,D+=b*ot,fe+=b*Ce,ee+=b*Re,he+=b*ft,b=U[1],de+=b*je,$+=b*ye,u+=b*Ie,y+=b*Ue,w+=b*De,E+=b*Se,O+=b*Be,N+=b*me,R+=b*xe,x+=b*Ze,d+=b*_e,D+=b*Oe,fe+=b*ot,ee+=b*Ce,he+=b*Re,ne+=b*ft,b=U[2],$+=b*je,u+=b*ye,y+=b*Ie,w+=b*Ue,E+=b*De,O+=b*Se,N+=b*Be,R+=b*me,x+=b*xe,d+=b*Ze,D+=b*_e,fe+=b*Oe,ee+=b*ot,he+=b*Ce,ne+=b*Re,ge+=b*ft,b=U[3],u+=b*je,y+=b*ye,w+=b*Ie,E+=b*Ue,O+=b*De,N+=b*Se,R+=b*Be,x+=b*me,d+=b*xe,D+=b*Ze,fe+=b*_e,ee+=b*Oe,he+=b*ot,ne+=b*Ce,ge+=b*Re,G+=b*ft,b=U[4],y+=b*je,w+=b*ye,E+=b*Ie,O+=b*Ue,N+=b*De,R+=b*Se,x+=b*Be,d+=b*me,D+=b*xe,fe+=b*Ze,ee+=b*_e,he+=b*Oe,ne+=b*ot,ge+=b*Ce,G+=b*Re,Z+=b*ft,b=U[5],w+=b*je,E+=b*ye,O+=b*Ie,N+=b*Ue,R+=b*De,x+=b*Se,d+=b*Be,D+=b*me,fe+=b*xe,ee+=b*Ze,he+=b*_e,ne+=b*Oe,ge+=b*ot,G+=b*Ce,Z+=b*Re,j+=b*ft,b=U[6],E+=b*je,O+=b*ye,N+=b*Ie,R+=b*Ue,x+=b*De,d+=b*Se,D+=b*Be,fe+=b*me,ee+=b*xe,he+=b*Ze,ne+=b*_e,ge+=b*Oe,G+=b*ot,Z+=b*Ce,j+=b*Re,v+=b*ft,b=U[7],O+=b*je,N+=b*ye,R+=b*Ie,x+=b*Ue,d+=b*De,D+=b*Se,fe+=b*Be,ee+=b*me,he+=b*xe,ne+=b*Ze,ge+=b*_e,G+=b*Oe,Z+=b*ot,j+=b*Ce,v+=b*Re,K+=b*ft,b=U[8],N+=b*je,R+=b*ye,x+=b*Ie,d+=b*Ue,D+=b*De,fe+=b*Se,ee+=b*Be,he+=b*me,ne+=b*xe,ge+=b*Ze,G+=b*_e,Z+=b*Oe,j+=b*ot,v+=b*Ce,K+=b*Re,oe+=b*ft,b=U[9],R+=b*je,x+=b*ye,d+=b*Ie,D+=b*Ue,fe+=b*De,ee+=b*Se,he+=b*Be,ne+=b*me,ge+=b*xe,G+=b*Ze,Z+=b*_e,j+=b*Oe,v+=b*ot,K+=b*Ce,oe+=b*Re,le+=b*ft,b=U[10],x+=b*je,d+=b*ye,D+=b*Ie,fe+=b*Ue,ee+=b*De,he+=b*Se,ne+=b*Be,ge+=b*me,G+=b*xe,Z+=b*Ze,j+=b*_e,v+=b*Oe,K+=b*ot,oe+=b*Ce,le+=b*Re,Te+=b*ft,b=U[11],d+=b*je,D+=b*ye,fe+=b*Ie,ee+=b*Ue,he+=b*De,ne+=b*Se,ge+=b*Be,G+=b*me,Z+=b*xe,j+=b*Ze,v+=b*_e,K+=b*Oe,oe+=b*ot,le+=b*Ce,Te+=b*Re,Ae+=b*ft,b=U[12],D+=b*je,fe+=b*ye,ee+=b*Ie,he+=b*Ue,ne+=b*De,ge+=b*Se,G+=b*Be,Z+=b*me,j+=b*xe,v+=b*Ze,K+=b*_e,oe+=b*Oe,le+=b*ot,Te+=b*Ce,Ae+=b*Re,Pe+=b*ft,b=U[13],fe+=b*je,ee+=b*ye,he+=b*Ie,ne+=b*Ue,ge+=b*De,G+=b*Se,Z+=b*Be,j+=b*me,v+=b*xe,K+=b*Ze,oe+=b*_e,le+=b*Oe,Te+=b*ot,Ae+=b*Ce,Pe+=b*Re,He+=b*ft,b=U[14],ee+=b*je,he+=b*ye,ne+=b*Ie,ge+=b*Ue,G+=b*De,Z+=b*Se,j+=b*Be,v+=b*me,K+=b*xe,oe+=b*Ze,le+=b*_e,Te+=b*Oe,Ae+=b*ot,Pe+=b*Ce,He+=b*Re,Fe+=b*ft,b=U[15],he+=b*je,ne+=b*ye,ge+=b*Ie,G+=b*Ue,Z+=b*De,j+=b*Se,v+=b*Be,K+=b*me,oe+=b*xe,le+=b*Ze,Te+=b*_e,Ae+=b*Oe,Pe+=b*ot,He+=b*Ce,Fe+=b*Re,qe+=b*ft,re+=38*ne,de+=38*ge,$+=38*G,u+=38*Z,y+=38*j,w+=38*v,E+=38*K,O+=38*oe,N+=38*le,R+=38*Te,x+=38*Ae,d+=38*Pe,D+=38*He,fe+=38*Fe,ee+=38*qe,T=1,b=re+T+65535,T=Math.floor(b/65536),re=b-T*65536,b=de+T+65535,T=Math.floor(b/65536),de=b-T*65536,b=$+T+65535,T=Math.floor(b/65536),$=b-T*65536,b=u+T+65535,T=Math.floor(b/65536),u=b-T*65536,b=y+T+65535,T=Math.floor(b/65536),y=b-T*65536,b=w+T+65535,T=Math.floor(b/65536),w=b-T*65536,b=E+T+65535,T=Math.floor(b/65536),E=b-T*65536,b=O+T+65535,T=Math.floor(b/65536),O=b-T*65536,b=N+T+65535,T=Math.floor(b/65536),N=b-T*65536,b=R+T+65535,T=Math.floor(b/65536),R=b-T*65536,b=x+T+65535,T=Math.floor(b/65536),x=b-T*65536,b=d+T+65535,T=Math.floor(b/65536),d=b-T*65536,b=D+T+65535,T=Math.floor(b/65536),D=b-T*65536,b=fe+T+65535,T=Math.floor(b/65536),fe=b-T*65536,b=ee+T+65535,T=Math.floor(b/65536),ee=b-T*65536,b=he+T+65535,T=Math.floor(b/65536),he=b-T*65536,re+=T-1+37*(T-1),T=1,b=re+T+65535,T=Math.floor(b/65536),re=b-T*65536,b=de+T+65535,T=Math.floor(b/65536),de=b-T*65536,b=$+T+65535,T=Math.floor(b/65536),$=b-T*65536,b=u+T+65535,T=Math.floor(b/65536),u=b-T*65536,b=y+T+65535,T=Math.floor(b/65536),y=b-T*65536,b=w+T+65535,T=Math.floor(b/65536),w=b-T*65536,b=E+T+65535,T=Math.floor(b/65536),E=b-T*65536,b=O+T+65535,T=Math.floor(b/65536),O=b-T*65536,b=N+T+65535,T=Math.floor(b/65536),N=b-T*65536,b=R+T+65535,T=Math.floor(b/65536),R=b-T*65536,b=x+T+65535,T=Math.floor(b/65536),x=b-T*65536,b=d+T+65535,T=Math.floor(b/65536),d=b-T*65536,b=D+T+65535,T=Math.floor(b/65536),D=b-T*65536,b=fe+T+65535,T=Math.floor(b/65536),fe=b-T*65536,b=ee+T+65535,T=Math.floor(b/65536),ee=b-T*65536,b=he+T+65535,T=Math.floor(b/65536),he=b-T*65536,re+=T-1+37*(T-1),L[0]=re,L[1]=de,L[2]=$,L[3]=u,L[4]=y,L[5]=w,L[6]=E,L[7]=O,L[8]=N,L[9]=R,L[10]=x,L[11]=d,L[12]=D,L[13]=fe,L[14]=ee,L[15]=he}function I(L,U){M(L,U,U)}function P(L,U){const z=n();for(let b=0;b<16;b++)z[b]=U[b];for(let b=253;b>=0;b--)I(z,z),b!==2&&b!==4&&M(z,z,U);for(let b=0;b<16;b++)L[b]=z[b]}function H(L,U){const z=new Uint8Array(32),b=new Float64Array(80),T=n(),re=n(),de=n(),$=n(),u=n(),y=n();for(let N=0;N<31;N++)z[N]=L[N];z[31]=L[31]&127|64,z[0]&=248,l(b,U);for(let N=0;N<16;N++)re[N]=b[N];T[0]=$[0]=1;for(let N=254;N>=0;--N){const R=z[N>>>3]>>>(N&7)&1;h(T,re,R),h(de,$,R),m(u,T,de),_(T,T,de),m(de,re,$),_(re,re,$),I($,u),I(y,T),M(T,de,T),M(de,re,u),m(u,T,de),_(T,T,de),I(re,T),_(de,$,y),M(T,de,o),m(T,T,$),M(de,de,T),M(T,$,y),M($,re,b),I(re,u),h(T,re,R),h(de,$,R)}for(let N=0;N<16;N++)b[N+16]=T[N],b[N+32]=de[N],b[N+48]=re[N],b[N+64]=$[N];const w=b.subarray(32),E=b.subarray(16);P(w,w),M(E,E,w);const O=new Uint8Array(32);return p(O,E),O}r.scalarMult=H;function W(L){return H(L,a)}r.scalarMultBase=W;function J(L){if(L.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const U=new Uint8Array(L);return{publicKey:W(U),secretKey:U}}r.generateKeyPairFromSeed=J;function q(L){const U=(0,e.randomBytes)(32,L),z=J(U);return(0,t.wipe)(U),z}r.generateKeyPair=q;function V(L,U,z=!1){if(L.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(U.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const b=H(L,U);if(z){let T=0;for(let re=0;re<b.length;re++)T|=b[re];if(T===0)throw new Error("X25519: invalid shared key")}return b}r.sharedKey=V})(au);function Zp(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function fc(r,e){e||(e=r.reduce((a,o)=>a+o.length,0));const t=Zp(e);let n=0;for(const a of r)t.set(a,n),n+=a.length;return t}function Ww(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var a=0;a<r.length;a++){var o=r.charAt(a),f=o.charCodeAt(0);if(t[f]!==255)throw new TypeError(o+" is ambiguous");t[f]=a}var h=r.length,p=r.charAt(0),l=Math.log(h)/Math.log(256),m=Math.log(256)/Math.log(h);function _(P){if(P instanceof Uint8Array||(ArrayBuffer.isView(P)?P=new Uint8Array(P.buffer,P.byteOffset,P.byteLength):Array.isArray(P)&&(P=Uint8Array.from(P))),!(P instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(P.length===0)return"";for(var H=0,W=0,J=0,q=P.length;J!==q&&P[J]===0;)J++,H++;for(var V=(q-J)*m+1>>>0,L=new Uint8Array(V);J!==q;){for(var U=P[J],z=0,b=V-1;(U!==0||z<W)&&b!==-1;b--,z++)U+=256*L[b]>>>0,L[b]=U%h>>>0,U=U/h>>>0;if(U!==0)throw new Error("Non-zero carry");W=z,J++}for(var T=V-W;T!==V&&L[T]===0;)T++;for(var re=p.repeat(H);T<V;++T)re+=r.charAt(L[T]);return re}function M(P){if(typeof P!="string")throw new TypeError("Expected String");if(P.length===0)return new Uint8Array;var H=0;if(P[H]!==" "){for(var W=0,J=0;P[H]===p;)W++,H++;for(var q=(P.length-H)*l+1>>>0,V=new Uint8Array(q);P[H];){var L=t[P.charCodeAt(H)];if(L===255)return;for(var U=0,z=q-1;(L!==0||U<J)&&z!==-1;z--,U++)L+=h*V[z]>>>0,V[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");J=U,H++}if(P[H]!==" "){for(var b=q-J;b!==q&&V[b]===0;)b++;for(var T=new Uint8Array(W+(q-b)),re=W;b!==q;)T[re++]=V[b++];return T}}}function I(P){var H=M(P);if(H)return H;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:M,decode:I}}var Vw=Ww,Gw=Vw;const Jw=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},Yw=r=>new TextEncoder().encode(r),Xw=r=>new TextDecoder().decode(r);class Zw{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Qw{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=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 Qp(this,e)}}class e_{constructor(e){this.decoders=e}or(e){return Qp(this,e)}decode(e){const t=e[0],n=this.decoders[t];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 Qp=(r,e)=>new e_({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class t_{constructor(e,t,n,a){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=a,this.encoder=new Zw(e,t,n),this.decoder=new Qw(e,t,a)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const $c=({name:r,prefix:e,encode:t,decode:n})=>new t_(r,e,t,n),Ha=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:a}=Gw(t,e);return $c({prefix:r,name:e,encode:n,decode:o=>Jw(a(o))})},r_=(r,e,t,n)=>{const a={};for(let m=0;m<e.length;++m)a[e[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;const f=new Uint8Array(o*t/8|0);let h=0,p=0,l=0;for(let m=0;m<o;++m){const _=a[r[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<t|_,h+=t,h>=8&&(h-=8,f[l++]=255&p>>h)}if(h>=t||255&p<<8-h)throw new SyntaxError("Unexpected end of data");return f},i_=(r,e,t)=>{const n=e[e.length-1]==="=",a=(1<<t)-1;let o="",f=0,h=0;for(let p=0;p<r.length;++p)for(h=h<<8|r[p],f+=8;f>t;)f-=t,o+=e[a&h>>f];if(f&&(o+=e[a&h<<t-f]),n)for(;o.length*t&7;)o+="=";return o},lr=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>$c({prefix:e,name:r,encode(a){return i_(a,n,t)},decode(a){return r_(a,n,t,r)}}),n_=$c({prefix:"\0",name:"identity",encode:r=>Xw(r),decode:r=>Yw(r)}),s_=Object.freeze(Object.defineProperty({__proto__:null,identity:n_},Symbol.toStringTag,{value:"Module"})),a_=lr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),o_=Object.freeze(Object.defineProperty({__proto__:null,base2:a_},Symbol.toStringTag,{value:"Module"})),c_=lr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),f_=Object.freeze(Object.defineProperty({__proto__:null,base8:c_},Symbol.toStringTag,{value:"Module"})),h_=Ha({prefix:"9",name:"base10",alphabet:"0123456789"}),u_=Object.freeze(Object.defineProperty({__proto__:null,base10:h_},Symbol.toStringTag,{value:"Module"})),d_=lr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),l_=lr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),p_=Object.freeze(Object.defineProperty({__proto__:null,base16:d_,base16upper:l_},Symbol.toStringTag,{value:"Module"})),g_=lr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),b_=lr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),v_=lr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),m_=lr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),y_=lr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),w_=lr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),__=lr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),E_=lr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),S_=lr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),x_=Object.freeze(Object.defineProperty({__proto__:null,base32:g_,base32hex:y_,base32hexpad:__,base32hexpadupper:E_,base32hexupper:w_,base32pad:v_,base32padupper:m_,base32upper:b_,base32z:S_},Symbol.toStringTag,{value:"Module"})),I_=Ha({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),D_=Ha({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),A_=Object.freeze(Object.defineProperty({__proto__:null,base36:I_,base36upper:D_},Symbol.toStringTag,{value:"Module"})),M_=Ha({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),P_=Ha({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),O_=Object.freeze(Object.defineProperty({__proto__:null,base58btc:M_,base58flickr:P_},Symbol.toStringTag,{value:"Module"})),C_=lr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),R_=lr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),T_=lr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),N_=lr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),$_=Object.freeze(Object.defineProperty({__proto__:null,base64:C_,base64pad:R_,base64url:T_,base64urlpad:N_},Symbol.toStringTag,{value:"Module"})),e1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),L_=e1.reduce((r,e,t)=>(r[t]=e,r),[]),F_=e1.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function q_(r){return r.reduce((e,t)=>(e+=L_[t],e),"")}function U_(r){const e=[];for(const t of r){const n=F_[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const B_=$c({prefix:"🚀",name:"base256emoji",encode:q_,decode:U_}),z_=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:B_},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const kl={...s_,...o_,...f_,...u_,...p_,...x_,...A_,...O_,...$_,...z_};function t1(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const Wl=t1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ph=t1("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Zp(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),r1={utf8:Wl,"utf-8":Wl,hex:kl.base16,latin1:ph,ascii:ph,binary:ph,...kl};function or(r,e="utf8"){const t=r1[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function cr(r,e="utf8"){const t=r1[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var i1={};const H_="elliptic",K_="6.5.7",j_="EC cryptography",k_="lib/elliptic.js",W_=["lib"],V_={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},G_={type:"git",url:"git@github.com:indutny/elliptic"},J_=["EC","Elliptic","curve","Cryptography"],Y_="Fedor Indutny <fedor@indutny.com>",X_="MIT",Z_={url:"https://github.com/indutny/elliptic/issues"},Q_="https://github.com/indutny/elliptic",e5={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},t5={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},r5={name:H_,version:K_,description:j_,main:k_,files:W_,scripts:V_,repository:G_,keywords:J_,author:Y_,license:X_,bugs:Z_,homepage:Q_,devDependencies:e5,dependencies:t5};var Yr={},ou={exports:{}};ou.exports;(function(r){(function(e,t){function n($,u){if(!$)throw new Error(u||"Assertion failed")}function a($,u){$.super_=u;var y=function(){};y.prototype=u.prototype,$.prototype=new y,$.prototype.constructor=$}function o($,u,y){if(o.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((u==="le"||u==="be")&&(y=u,u=10),this._init($||0,u||10,y||"be"))}typeof e=="object"?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=J2.Buffer}catch{}o.isBN=function(u){return u instanceof o?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===o.wordSize&&Array.isArray(u.words)},o.max=function(u,y){return u.cmp(y)>0?u:y},o.min=function(u,y){return u.cmp(y)<0?u:y},o.prototype._init=function(u,y,w){if(typeof u=="number")return this._initNumber(u,y,w);if(typeof u=="object")return this._initArray(u,y,w);y==="hex"&&(y=16),n(y===(y|0)&&y>=2&&y<=36),u=u.toString().replace(/\s+/g,"");var E=0;u[0]==="-"&&(E++,this.negative=1),E<u.length&&(y===16?this._parseHex(u,E,w):(this._parseBase(u,y,E),w==="le"&&this._initArray(this.toArray(),y,w)))},o.prototype._initNumber=function(u,y,w){u<0&&(this.negative=1,u=-u),u<67108864?(this.words=[u&67108863],this.length=1):u<4503599627370496?(this.words=[u&67108863,u/67108864&67108863],this.length=2):(n(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),w==="le"&&this._initArray(this.toArray(),y,w)},o.prototype._initArray=function(u,y,w){if(n(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var O,N,R=0;if(w==="be")for(E=u.length-1,O=0;E>=0;E-=3)N=u[E]|u[E-1]<<8|u[E-2]<<16,this.words[O]|=N<<R&67108863,this.words[O+1]=N>>>26-R&67108863,R+=24,R>=26&&(R-=26,O++);else if(w==="le")for(E=0,O=0;E<u.length;E+=3)N=u[E]|u[E+1]<<8|u[E+2]<<16,this.words[O]|=N<<R&67108863,this.words[O+1]=N>>>26-R&67108863,R+=24,R>=26&&(R-=26,O++);return this.strip()};function h($,u){var y=$.charCodeAt(u);return y>=65&&y<=70?y-55:y>=97&&y<=102?y-87:y-48&15}function p($,u,y){var w=h($,y);return y-1>=u&&(w|=h($,y-1)<<4),w}o.prototype._parseHex=function(u,y,w){this.length=Math.ceil((u.length-y)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var O=0,N=0,R;if(w==="be")for(E=u.length-1;E>=y;E-=2)R=p(u,y,E)<<O,this.words[N]|=R&67108863,O>=18?(O-=18,N+=1,this.words[N]|=R>>>26):O+=8;else{var x=u.length-y;for(E=x%2===0?y+1:y;E<u.length;E+=2)R=p(u,y,E)<<O,this.words[N]|=R&67108863,O>=18?(O-=18,N+=1,this.words[N]|=R>>>26):O+=8}this.strip()};function l($,u,y,w){for(var E=0,O=Math.min($.length,y),N=u;N<O;N++){var R=$.charCodeAt(N)-48;E*=w,R>=49?E+=R-49+10:R>=17?E+=R-17+10:E+=R}return E}o.prototype._parseBase=function(u,y,w){this.words=[0],this.length=1;for(var E=0,O=1;O<=67108863;O*=y)E++;E--,O=O/y|0;for(var N=u.length-w,R=N%E,x=Math.min(N,N-R)+w,d=0,D=w;D<x;D+=E)d=l(u,D,D+E,y),this.imuln(O),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(R!==0){var fe=1;for(d=l(u,D,u.length,y),D=0;D<R;D++)fe*=y;this.imuln(fe),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},o.prototype.copy=function(u){u.words=new Array(this.length);for(var y=0;y<this.length;y++)u.words[y]=this.words[y];u.length=this.length,u.negative=this.negative,u.red=this.red},o.prototype.clone=function(){var u=new o(null);return this.copy(u),u},o.prototype._expand=function(u){for(;this.length<u;)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},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","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"],_=[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],M=[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(u,y){u=u||10,y=y|0||1;var w;if(u===16||u==="hex"){w="";for(var E=0,O=0,N=0;N<this.length;N++){var R=this.words[N],x=((R<<E|O)&16777215).toString(16);O=R>>>24-E&16777215,O!==0||N!==this.length-1?w=m[6-x.length]+x+w:w=x+w,E+=2,E>=26&&(E-=26,N--)}for(O!==0&&(w=O.toString(16)+w);w.length%y!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(u===(u|0)&&u>=2&&u<=36){var d=_[u],D=M[u];w="";var fe=this.clone();for(fe.negative=0;!fe.isZero();){var ee=fe.modn(D).toString(u);fe=fe.idivn(D),fe.isZero()?w=ee+w:w=m[d-ee.length]+ee+w}for(this.isZero()&&(w="0"+w);w.length%y!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(u,y){return n(typeof f<"u"),this.toArrayLike(f,u,y)},o.prototype.toArray=function(u,y){return this.toArrayLike(Array,u,y)},o.prototype.toArrayLike=function(u,y,w){var E=this.byteLength(),O=w||Math.max(1,E);n(E<=O,"byte array longer than desired length"),n(O>0,"Requested array length <= 0"),this.strip();var N=y==="le",R=new u(O),x,d,D=this.clone();if(N){for(d=0;!D.isZero();d++)x=D.andln(255),D.iushrn(8),R[d]=x;for(;d<O;d++)R[d]=0}else{for(d=0;d<O-E;d++)R[d]=0;for(d=0;!D.isZero();d++)x=D.andln(255),D.iushrn(8),R[O-d-1]=x}return R},Math.clz32?o.prototype._countBits=function(u){return 32-Math.clz32(u)}:o.prototype._countBits=function(u){var y=u,w=0;return y>=4096&&(w+=13,y>>>=13),y>=64&&(w+=7,y>>>=7),y>=8&&(w+=4,y>>>=4),y>=2&&(w+=2,y>>>=2),w+y},o.prototype._zeroBits=function(u){if(u===0)return 26;var y=u,w=0;return y&8191||(w+=13,y>>>=13),y&127||(w+=7,y>>>=7),y&15||(w+=4,y>>>=4),y&3||(w+=2,y>>>=2),y&1||w++,w},o.prototype.bitLength=function(){var u=this.words[this.length-1],y=this._countBits(u);return(this.length-1)*26+y};function I($){for(var u=new Array($.bitLength()),y=0;y<u.length;y++){var w=y/26|0,E=y%26;u[y]=($.words[w]&1<<E)>>>E}return u}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,y=0;y<this.length;y++){var w=this._zeroBits(this.words[y]);if(u+=w,w!==26)break}return u},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},o.prototype.fromTwos=function(u){return this.testn(u-1)?this.notn(u).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(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]|u.words[y];return this.strip()},o.prototype.ior=function(u){return n((this.negative|u.negative)===0),this.iuor(u)},o.prototype.or=function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},o.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},o.prototype.iuand=function(u){var y;this.length>u.length?y=u:y=this;for(var w=0;w<y.length;w++)this.words[w]=this.words[w]&u.words[w];return this.length=y.length,this.strip()},o.prototype.iand=function(u){return n((this.negative|u.negative)===0),this.iuand(u)},o.prototype.and=function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},o.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},o.prototype.iuxor=function(u){var y,w;this.length>u.length?(y=this,w=u):(y=u,w=this);for(var E=0;E<w.length;E++)this.words[E]=y.words[E]^w.words[E];if(this!==y)for(;E<y.length;E++)this.words[E]=y.words[E];return this.length=y.length,this.strip()},o.prototype.ixor=function(u){return n((this.negative|u.negative)===0),this.iuxor(u)},o.prototype.xor=function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},o.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},o.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var y=Math.ceil(u/26)|0,w=u%26;this._expand(y),w>0&&y--;for(var E=0;E<y;E++)this.words[E]=~this.words[E]&67108863;return w>0&&(this.words[E]=~this.words[E]&67108863>>26-w),this.strip()},o.prototype.notn=function(u){return this.clone().inotn(u)},o.prototype.setn=function(u,y){n(typeof u=="number"&&u>=0);var w=u/26|0,E=u%26;return this._expand(w+1),y?this.words[w]=this.words[w]|1<<E:this.words[w]=this.words[w]&~(1<<E),this.strip()},o.prototype.iadd=function(u){var y;if(this.negative!==0&&u.negative===0)return this.negative=0,y=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,y=this.isub(u),u.negative=1,y._normSign();var w,E;this.length>u.length?(w=this,E=u):(w=u,E=this);for(var O=0,N=0;N<E.length;N++)y=(w.words[N]|0)+(E.words[N]|0)+O,this.words[N]=y&67108863,O=y>>>26;for(;O!==0&&N<w.length;N++)y=(w.words[N]|0)+O,this.words[N]=y&67108863,O=y>>>26;if(this.length=w.length,O!==0)this.words[this.length]=O,this.length++;else if(w!==this)for(;N<w.length;N++)this.words[N]=w.words[N];return this},o.prototype.add=function(u){var y;return u.negative!==0&&this.negative===0?(u.negative=0,y=this.sub(u),u.negative^=1,y):u.negative===0&&this.negative!==0?(this.negative=0,y=u.sub(this),this.negative=1,y):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},o.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var y=this.iadd(u);return u.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var w=this.cmp(u);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,O;w>0?(E=this,O=u):(E=u,O=this);for(var N=0,R=0;R<O.length;R++)y=(E.words[R]|0)-(O.words[R]|0)+N,N=y>>26,this.words[R]=y&67108863;for(;N!==0&&R<E.length;R++)y=(E.words[R]|0)+N,N=y>>26,this.words[R]=y&67108863;if(N===0&&R<E.length&&E!==this)for(;R<E.length;R++)this.words[R]=E.words[R];return this.length=Math.max(this.length,R),E!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(u){return this.clone().isub(u)};function P($,u,y){y.negative=u.negative^$.negative;var w=$.length+u.length|0;y.length=w,w=w-1|0;var E=$.words[0]|0,O=u.words[0]|0,N=E*O,R=N&67108863,x=N/67108864|0;y.words[0]=R;for(var d=1;d<w;d++){for(var D=x>>>26,fe=x&67108863,ee=Math.min(d,u.length-1),he=Math.max(0,d-$.length+1);he<=ee;he++){var ne=d-he|0;E=$.words[ne]|0,O=u.words[he]|0,N=E*O+fe,D+=N/67108864|0,fe=N&67108863}y.words[d]=fe|0,x=D|0}return x!==0?y.words[d]=x|0:y.length--,y.strip()}var H=function(u,y,w){var E=u.words,O=y.words,N=w.words,R=0,x,d,D,fe=E[0]|0,ee=fe&8191,he=fe>>>13,ne=E[1]|0,ge=ne&8191,G=ne>>>13,Z=E[2]|0,j=Z&8191,v=Z>>>13,K=E[3]|0,oe=K&8191,le=K>>>13,Te=E[4]|0,Ae=Te&8191,Pe=Te>>>13,He=E[5]|0,Fe=He&8191,qe=He>>>13,je=E[6]|0,ye=je&8191,Ie=je>>>13,Ue=E[7]|0,De=Ue&8191,Se=Ue>>>13,Be=E[8]|0,me=Be&8191,xe=Be>>>13,Ze=E[9]|0,_e=Ze&8191,Oe=Ze>>>13,ot=O[0]|0,Ce=ot&8191,Re=ot>>>13,ft=O[1]|0,lt=ft&8191,bt=ft>>>13,Br=O[2]|0,pt=Br&8191,wt=Br>>>13,li=O[3]|0,Dt=li&8191,ke=li>>>13,Mt=O[4]|0,We=Mt&8191,Ve=Mt>>>13,Tt=O[5]|0,ze=Tt&8191,tt=Tt>>>13,Kt=O[6]|0,Ge=Kt&8191,rt=Kt>>>13,Ft=O[7]|0,Qe=Ft&8191,Je=Ft>>>13,St=O[8]|0,it=St&8191,nt=St>>>13,vs=O[9]|0,Bt=vs&8191,zt=vs>>>13;w.negative=u.negative^y.negative,w.length=19,x=Math.imul(ee,Ce),d=Math.imul(ee,Re),d=d+Math.imul(he,Ce)|0,D=Math.imul(he,Re);var br=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(br>>>26)|0,br&=67108863,x=Math.imul(ge,Ce),d=Math.imul(ge,Re),d=d+Math.imul(G,Ce)|0,D=Math.imul(G,Re),x=x+Math.imul(ee,lt)|0,d=d+Math.imul(ee,bt)|0,d=d+Math.imul(he,lt)|0,D=D+Math.imul(he,bt)|0;var Mn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Mn>>>26)|0,Mn&=67108863,x=Math.imul(j,Ce),d=Math.imul(j,Re),d=d+Math.imul(v,Ce)|0,D=Math.imul(v,Re),x=x+Math.imul(ge,lt)|0,d=d+Math.imul(ge,bt)|0,d=d+Math.imul(G,lt)|0,D=D+Math.imul(G,bt)|0,x=x+Math.imul(ee,pt)|0,d=d+Math.imul(ee,wt)|0,d=d+Math.imul(he,pt)|0,D=D+Math.imul(he,wt)|0;var Pn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,x=Math.imul(oe,Ce),d=Math.imul(oe,Re),d=d+Math.imul(le,Ce)|0,D=Math.imul(le,Re),x=x+Math.imul(j,lt)|0,d=d+Math.imul(j,bt)|0,d=d+Math.imul(v,lt)|0,D=D+Math.imul(v,bt)|0,x=x+Math.imul(ge,pt)|0,d=d+Math.imul(ge,wt)|0,d=d+Math.imul(G,pt)|0,D=D+Math.imul(G,wt)|0,x=x+Math.imul(ee,Dt)|0,d=d+Math.imul(ee,ke)|0,d=d+Math.imul(he,Dt)|0,D=D+Math.imul(he,ke)|0;var On=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(On>>>26)|0,On&=67108863,x=Math.imul(Ae,Ce),d=Math.imul(Ae,Re),d=d+Math.imul(Pe,Ce)|0,D=Math.imul(Pe,Re),x=x+Math.imul(oe,lt)|0,d=d+Math.imul(oe,bt)|0,d=d+Math.imul(le,lt)|0,D=D+Math.imul(le,bt)|0,x=x+Math.imul(j,pt)|0,d=d+Math.imul(j,wt)|0,d=d+Math.imul(v,pt)|0,D=D+Math.imul(v,wt)|0,x=x+Math.imul(ge,Dt)|0,d=d+Math.imul(ge,ke)|0,d=d+Math.imul(G,Dt)|0,D=D+Math.imul(G,ke)|0,x=x+Math.imul(ee,We)|0,d=d+Math.imul(ee,Ve)|0,d=d+Math.imul(he,We)|0,D=D+Math.imul(he,Ve)|0;var Cn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,x=Math.imul(Fe,Ce),d=Math.imul(Fe,Re),d=d+Math.imul(qe,Ce)|0,D=Math.imul(qe,Re),x=x+Math.imul(Ae,lt)|0,d=d+Math.imul(Ae,bt)|0,d=d+Math.imul(Pe,lt)|0,D=D+Math.imul(Pe,bt)|0,x=x+Math.imul(oe,pt)|0,d=d+Math.imul(oe,wt)|0,d=d+Math.imul(le,pt)|0,D=D+Math.imul(le,wt)|0,x=x+Math.imul(j,Dt)|0,d=d+Math.imul(j,ke)|0,d=d+Math.imul(v,Dt)|0,D=D+Math.imul(v,ke)|0,x=x+Math.imul(ge,We)|0,d=d+Math.imul(ge,Ve)|0,d=d+Math.imul(G,We)|0,D=D+Math.imul(G,Ve)|0,x=x+Math.imul(ee,ze)|0,d=d+Math.imul(ee,tt)|0,d=d+Math.imul(he,ze)|0,D=D+Math.imul(he,tt)|0;var Rn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,x=Math.imul(ye,Ce),d=Math.imul(ye,Re),d=d+Math.imul(Ie,Ce)|0,D=Math.imul(Ie,Re),x=x+Math.imul(Fe,lt)|0,d=d+Math.imul(Fe,bt)|0,d=d+Math.imul(qe,lt)|0,D=D+Math.imul(qe,bt)|0,x=x+Math.imul(Ae,pt)|0,d=d+Math.imul(Ae,wt)|0,d=d+Math.imul(Pe,pt)|0,D=D+Math.imul(Pe,wt)|0,x=x+Math.imul(oe,Dt)|0,d=d+Math.imul(oe,ke)|0,d=d+Math.imul(le,Dt)|0,D=D+Math.imul(le,ke)|0,x=x+Math.imul(j,We)|0,d=d+Math.imul(j,Ve)|0,d=d+Math.imul(v,We)|0,D=D+Math.imul(v,Ve)|0,x=x+Math.imul(ge,ze)|0,d=d+Math.imul(ge,tt)|0,d=d+Math.imul(G,ze)|0,D=D+Math.imul(G,tt)|0,x=x+Math.imul(ee,Ge)|0,d=d+Math.imul(ee,rt)|0,d=d+Math.imul(he,Ge)|0,D=D+Math.imul(he,rt)|0;var zr=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(zr>>>26)|0,zr&=67108863,x=Math.imul(De,Ce),d=Math.imul(De,Re),d=d+Math.imul(Se,Ce)|0,D=Math.imul(Se,Re),x=x+Math.imul(ye,lt)|0,d=d+Math.imul(ye,bt)|0,d=d+Math.imul(Ie,lt)|0,D=D+Math.imul(Ie,bt)|0,x=x+Math.imul(Fe,pt)|0,d=d+Math.imul(Fe,wt)|0,d=d+Math.imul(qe,pt)|0,D=D+Math.imul(qe,wt)|0,x=x+Math.imul(Ae,Dt)|0,d=d+Math.imul(Ae,ke)|0,d=d+Math.imul(Pe,Dt)|0,D=D+Math.imul(Pe,ke)|0,x=x+Math.imul(oe,We)|0,d=d+Math.imul(oe,Ve)|0,d=d+Math.imul(le,We)|0,D=D+Math.imul(le,Ve)|0,x=x+Math.imul(j,ze)|0,d=d+Math.imul(j,tt)|0,d=d+Math.imul(v,ze)|0,D=D+Math.imul(v,tt)|0,x=x+Math.imul(ge,Ge)|0,d=d+Math.imul(ge,rt)|0,d=d+Math.imul(G,Ge)|0,D=D+Math.imul(G,rt)|0,x=x+Math.imul(ee,Qe)|0,d=d+Math.imul(ee,Je)|0,d=d+Math.imul(he,Qe)|0,D=D+Math.imul(he,Je)|0;var Di=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Di>>>26)|0,Di&=67108863,x=Math.imul(me,Ce),d=Math.imul(me,Re),d=d+Math.imul(xe,Ce)|0,D=Math.imul(xe,Re),x=x+Math.imul(De,lt)|0,d=d+Math.imul(De,bt)|0,d=d+Math.imul(Se,lt)|0,D=D+Math.imul(Se,bt)|0,x=x+Math.imul(ye,pt)|0,d=d+Math.imul(ye,wt)|0,d=d+Math.imul(Ie,pt)|0,D=D+Math.imul(Ie,wt)|0,x=x+Math.imul(Fe,Dt)|0,d=d+Math.imul(Fe,ke)|0,d=d+Math.imul(qe,Dt)|0,D=D+Math.imul(qe,ke)|0,x=x+Math.imul(Ae,We)|0,d=d+Math.imul(Ae,Ve)|0,d=d+Math.imul(Pe,We)|0,D=D+Math.imul(Pe,Ve)|0,x=x+Math.imul(oe,ze)|0,d=d+Math.imul(oe,tt)|0,d=d+Math.imul(le,ze)|0,D=D+Math.imul(le,tt)|0,x=x+Math.imul(j,Ge)|0,d=d+Math.imul(j,rt)|0,d=d+Math.imul(v,Ge)|0,D=D+Math.imul(v,rt)|0,x=x+Math.imul(ge,Qe)|0,d=d+Math.imul(ge,Je)|0,d=d+Math.imul(G,Qe)|0,D=D+Math.imul(G,Je)|0,x=x+Math.imul(ee,it)|0,d=d+Math.imul(ee,nt)|0,d=d+Math.imul(he,it)|0,D=D+Math.imul(he,nt)|0;var Tn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,x=Math.imul(_e,Ce),d=Math.imul(_e,Re),d=d+Math.imul(Oe,Ce)|0,D=Math.imul(Oe,Re),x=x+Math.imul(me,lt)|0,d=d+Math.imul(me,bt)|0,d=d+Math.imul(xe,lt)|0,D=D+Math.imul(xe,bt)|0,x=x+Math.imul(De,pt)|0,d=d+Math.imul(De,wt)|0,d=d+Math.imul(Se,pt)|0,D=D+Math.imul(Se,wt)|0,x=x+Math.imul(ye,Dt)|0,d=d+Math.imul(ye,ke)|0,d=d+Math.imul(Ie,Dt)|0,D=D+Math.imul(Ie,ke)|0,x=x+Math.imul(Fe,We)|0,d=d+Math.imul(Fe,Ve)|0,d=d+Math.imul(qe,We)|0,D=D+Math.imul(qe,Ve)|0,x=x+Math.imul(Ae,ze)|0,d=d+Math.imul(Ae,tt)|0,d=d+Math.imul(Pe,ze)|0,D=D+Math.imul(Pe,tt)|0,x=x+Math.imul(oe,Ge)|0,d=d+Math.imul(oe,rt)|0,d=d+Math.imul(le,Ge)|0,D=D+Math.imul(le,rt)|0,x=x+Math.imul(j,Qe)|0,d=d+Math.imul(j,Je)|0,d=d+Math.imul(v,Qe)|0,D=D+Math.imul(v,Je)|0,x=x+Math.imul(ge,it)|0,d=d+Math.imul(ge,nt)|0,d=d+Math.imul(G,it)|0,D=D+Math.imul(G,nt)|0,x=x+Math.imul(ee,Bt)|0,d=d+Math.imul(ee,zt)|0,d=d+Math.imul(he,Bt)|0,D=D+Math.imul(he,zt)|0;var Ai=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,x=Math.imul(_e,lt),d=Math.imul(_e,bt),d=d+Math.imul(Oe,lt)|0,D=Math.imul(Oe,bt),x=x+Math.imul(me,pt)|0,d=d+Math.imul(me,wt)|0,d=d+Math.imul(xe,pt)|0,D=D+Math.imul(xe,wt)|0,x=x+Math.imul(De,Dt)|0,d=d+Math.imul(De,ke)|0,d=d+Math.imul(Se,Dt)|0,D=D+Math.imul(Se,ke)|0,x=x+Math.imul(ye,We)|0,d=d+Math.imul(ye,Ve)|0,d=d+Math.imul(Ie,We)|0,D=D+Math.imul(Ie,Ve)|0,x=x+Math.imul(Fe,ze)|0,d=d+Math.imul(Fe,tt)|0,d=d+Math.imul(qe,ze)|0,D=D+Math.imul(qe,tt)|0,x=x+Math.imul(Ae,Ge)|0,d=d+Math.imul(Ae,rt)|0,d=d+Math.imul(Pe,Ge)|0,D=D+Math.imul(Pe,rt)|0,x=x+Math.imul(oe,Qe)|0,d=d+Math.imul(oe,Je)|0,d=d+Math.imul(le,Qe)|0,D=D+Math.imul(le,Je)|0,x=x+Math.imul(j,it)|0,d=d+Math.imul(j,nt)|0,d=d+Math.imul(v,it)|0,D=D+Math.imul(v,nt)|0,x=x+Math.imul(ge,Bt)|0,d=d+Math.imul(ge,zt)|0,d=d+Math.imul(G,Bt)|0,D=D+Math.imul(G,zt)|0;var Nn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,x=Math.imul(_e,pt),d=Math.imul(_e,wt),d=d+Math.imul(Oe,pt)|0,D=Math.imul(Oe,wt),x=x+Math.imul(me,Dt)|0,d=d+Math.imul(me,ke)|0,d=d+Math.imul(xe,Dt)|0,D=D+Math.imul(xe,ke)|0,x=x+Math.imul(De,We)|0,d=d+Math.imul(De,Ve)|0,d=d+Math.imul(Se,We)|0,D=D+Math.imul(Se,Ve)|0,x=x+Math.imul(ye,ze)|0,d=d+Math.imul(ye,tt)|0,d=d+Math.imul(Ie,ze)|0,D=D+Math.imul(Ie,tt)|0,x=x+Math.imul(Fe,Ge)|0,d=d+Math.imul(Fe,rt)|0,d=d+Math.imul(qe,Ge)|0,D=D+Math.imul(qe,rt)|0,x=x+Math.imul(Ae,Qe)|0,d=d+Math.imul(Ae,Je)|0,d=d+Math.imul(Pe,Qe)|0,D=D+Math.imul(Pe,Je)|0,x=x+Math.imul(oe,it)|0,d=d+Math.imul(oe,nt)|0,d=d+Math.imul(le,it)|0,D=D+Math.imul(le,nt)|0,x=x+Math.imul(j,Bt)|0,d=d+Math.imul(j,zt)|0,d=d+Math.imul(v,Bt)|0,D=D+Math.imul(v,zt)|0;var $n=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+($n>>>26)|0,$n&=67108863,x=Math.imul(_e,Dt),d=Math.imul(_e,ke),d=d+Math.imul(Oe,Dt)|0,D=Math.imul(Oe,ke),x=x+Math.imul(me,We)|0,d=d+Math.imul(me,Ve)|0,d=d+Math.imul(xe,We)|0,D=D+Math.imul(xe,Ve)|0,x=x+Math.imul(De,ze)|0,d=d+Math.imul(De,tt)|0,d=d+Math.imul(Se,ze)|0,D=D+Math.imul(Se,tt)|0,x=x+Math.imul(ye,Ge)|0,d=d+Math.imul(ye,rt)|0,d=d+Math.imul(Ie,Ge)|0,D=D+Math.imul(Ie,rt)|0,x=x+Math.imul(Fe,Qe)|0,d=d+Math.imul(Fe,Je)|0,d=d+Math.imul(qe,Qe)|0,D=D+Math.imul(qe,Je)|0,x=x+Math.imul(Ae,it)|0,d=d+Math.imul(Ae,nt)|0,d=d+Math.imul(Pe,it)|0,D=D+Math.imul(Pe,nt)|0,x=x+Math.imul(oe,Bt)|0,d=d+Math.imul(oe,zt)|0,d=d+Math.imul(le,Bt)|0,D=D+Math.imul(le,zt)|0;var Mi=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,x=Math.imul(_e,We),d=Math.imul(_e,Ve),d=d+Math.imul(Oe,We)|0,D=Math.imul(Oe,Ve),x=x+Math.imul(me,ze)|0,d=d+Math.imul(me,tt)|0,d=d+Math.imul(xe,ze)|0,D=D+Math.imul(xe,tt)|0,x=x+Math.imul(De,Ge)|0,d=d+Math.imul(De,rt)|0,d=d+Math.imul(Se,Ge)|0,D=D+Math.imul(Se,rt)|0,x=x+Math.imul(ye,Qe)|0,d=d+Math.imul(ye,Je)|0,d=d+Math.imul(Ie,Qe)|0,D=D+Math.imul(Ie,Je)|0,x=x+Math.imul(Fe,it)|0,d=d+Math.imul(Fe,nt)|0,d=d+Math.imul(qe,it)|0,D=D+Math.imul(qe,nt)|0,x=x+Math.imul(Ae,Bt)|0,d=d+Math.imul(Ae,zt)|0,d=d+Math.imul(Pe,Bt)|0,D=D+Math.imul(Pe,zt)|0;var fn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(fn>>>26)|0,fn&=67108863,x=Math.imul(_e,ze),d=Math.imul(_e,tt),d=d+Math.imul(Oe,ze)|0,D=Math.imul(Oe,tt),x=x+Math.imul(me,Ge)|0,d=d+Math.imul(me,rt)|0,d=d+Math.imul(xe,Ge)|0,D=D+Math.imul(xe,rt)|0,x=x+Math.imul(De,Qe)|0,d=d+Math.imul(De,Je)|0,d=d+Math.imul(Se,Qe)|0,D=D+Math.imul(Se,Je)|0,x=x+Math.imul(ye,it)|0,d=d+Math.imul(ye,nt)|0,d=d+Math.imul(Ie,it)|0,D=D+Math.imul(Ie,nt)|0,x=x+Math.imul(Fe,Bt)|0,d=d+Math.imul(Fe,zt)|0,d=d+Math.imul(qe,Bt)|0,D=D+Math.imul(qe,zt)|0;var hn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(hn>>>26)|0,hn&=67108863,x=Math.imul(_e,Ge),d=Math.imul(_e,rt),d=d+Math.imul(Oe,Ge)|0,D=Math.imul(Oe,rt),x=x+Math.imul(me,Qe)|0,d=d+Math.imul(me,Je)|0,d=d+Math.imul(xe,Qe)|0,D=D+Math.imul(xe,Je)|0,x=x+Math.imul(De,it)|0,d=d+Math.imul(De,nt)|0,d=d+Math.imul(Se,it)|0,D=D+Math.imul(Se,nt)|0,x=x+Math.imul(ye,Bt)|0,d=d+Math.imul(ye,zt)|0,d=d+Math.imul(Ie,Bt)|0,D=D+Math.imul(Ie,zt)|0;var Er=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Er>>>26)|0,Er&=67108863,x=Math.imul(_e,Qe),d=Math.imul(_e,Je),d=d+Math.imul(Oe,Qe)|0,D=Math.imul(Oe,Je),x=x+Math.imul(me,it)|0,d=d+Math.imul(me,nt)|0,d=d+Math.imul(xe,it)|0,D=D+Math.imul(xe,nt)|0,x=x+Math.imul(De,Bt)|0,d=d+Math.imul(De,zt)|0,d=d+Math.imul(Se,Bt)|0,D=D+Math.imul(Se,zt)|0;var Ln=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,x=Math.imul(_e,it),d=Math.imul(_e,nt),d=d+Math.imul(Oe,it)|0,D=Math.imul(Oe,nt),x=x+Math.imul(me,Bt)|0,d=d+Math.imul(me,zt)|0,d=d+Math.imul(xe,Bt)|0,D=D+Math.imul(xe,zt)|0;var Fn=(R+x|0)+((d&8191)<<13)|0;R=(D+(d>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,x=Math.imul(_e,Bt),d=Math.imul(_e,zt),d=d+Math.imul(Oe,Bt)|0,D=Math.imul(Oe,zt);var qn=(R+x|0)+((d&8191)<<13)|0;return R=(D+(d>>>13)|0)+(qn>>>26)|0,qn&=67108863,N[0]=br,N[1]=Mn,N[2]=Pn,N[3]=On,N[4]=Cn,N[5]=Rn,N[6]=zr,N[7]=Di,N[8]=Tn,N[9]=Ai,N[10]=Nn,N[11]=$n,N[12]=Mi,N[13]=fn,N[14]=hn,N[15]=Er,N[16]=Ln,N[17]=Fn,N[18]=qn,R!==0&&(N[19]=R,w.length++),w};Math.imul||(H=P);function W($,u,y){y.negative=u.negative^$.negative,y.length=$.length+u.length;for(var w=0,E=0,O=0;O<y.length-1;O++){var N=E;E=0;for(var R=w&67108863,x=Math.min(O,u.length-1),d=Math.max(0,O-$.length+1);d<=x;d++){var D=O-d,fe=$.words[D]|0,ee=u.words[d]|0,he=fe*ee,ne=he&67108863;N=N+(he/67108864|0)|0,ne=ne+R|0,R=ne&67108863,N=N+(ne>>>26)|0,E+=N>>>26,N&=67108863}y.words[O]=R,w=N,N=E}return w!==0?y.words[O]=w:y.length--,y.strip()}function J($,u,y){var w=new q;return w.mulp($,u,y)}o.prototype.mulTo=function(u,y){var w,E=this.length+u.length;return this.length===10&&u.length===10?w=H(this,u,y):E<63?w=P(this,u,y):E<1024?w=W(this,u,y):w=J(this,u,y),w};function q($,u){this.x=$,this.y=u}q.prototype.makeRBT=function(u){for(var y=new Array(u),w=o.prototype._countBits(u)-1,E=0;E<u;E++)y[E]=this.revBin(E,w,u);return y},q.prototype.revBin=function(u,y,w){if(u===0||u===w-1)return u;for(var E=0,O=0;O<y;O++)E|=(u&1)<<y-O-1,u>>=1;return E},q.prototype.permute=function(u,y,w,E,O,N){for(var R=0;R<N;R++)E[R]=y[u[R]],O[R]=w[u[R]]},q.prototype.transform=function(u,y,w,E,O,N){this.permute(N,u,y,w,E,O);for(var R=1;R<O;R<<=1)for(var x=R<<1,d=Math.cos(2*Math.PI/x),D=Math.sin(2*Math.PI/x),fe=0;fe<O;fe+=x)for(var ee=d,he=D,ne=0;ne<R;ne++){var ge=w[fe+ne],G=E[fe+ne],Z=w[fe+ne+R],j=E[fe+ne+R],v=ee*Z-he*j;j=ee*j+he*Z,Z=v,w[fe+ne]=ge+Z,E[fe+ne]=G+j,w[fe+ne+R]=ge-Z,E[fe+ne+R]=G-j,ne!==x&&(v=d*ee-D*he,he=d*he+D*ee,ee=v)}},q.prototype.guessLen13b=function(u,y){var w=Math.max(y,u)|1,E=w&1,O=0;for(w=w/2|0;w;w=w>>>1)O++;return 1<<O+1+E},q.prototype.conjugate=function(u,y,w){if(!(w<=1))for(var E=0;E<w/2;E++){var O=u[E];u[E]=u[w-E-1],u[w-E-1]=O,O=y[E],y[E]=-y[w-E-1],y[w-E-1]=-O}},q.prototype.normalize13b=function(u,y){for(var w=0,E=0;E<y/2;E++){var O=Math.round(u[2*E+1]/y)*8192+Math.round(u[2*E]/y)+w;u[E]=O&67108863,O<67108864?w=0:w=O/67108864|0}return u},q.prototype.convert13b=function(u,y,w,E){for(var O=0,N=0;N<y;N++)O=O+(u[N]|0),w[2*N]=O&8191,O=O>>>13,w[2*N+1]=O&8191,O=O>>>13;for(N=2*y;N<E;++N)w[N]=0;n(O===0),n((O&-8192)===0)},q.prototype.stub=function(u){for(var y=new Array(u),w=0;w<u;w++)y[w]=0;return y},q.prototype.mulp=function(u,y,w){var E=2*this.guessLen13b(u.length,y.length),O=this.makeRBT(E),N=this.stub(E),R=new Array(E),x=new Array(E),d=new Array(E),D=new Array(E),fe=new Array(E),ee=new Array(E),he=w.words;he.length=E,this.convert13b(u.words,u.length,R,E),this.convert13b(y.words,y.length,D,E),this.transform(R,N,x,d,E,O),this.transform(D,N,fe,ee,E,O);for(var ne=0;ne<E;ne++){var ge=x[ne]*fe[ne]-d[ne]*ee[ne];d[ne]=x[ne]*ee[ne]+d[ne]*fe[ne],x[ne]=ge}return this.conjugate(x,d,E),this.transform(x,d,he,N,E,O),this.conjugate(he,N,E),this.normalize13b(he,E),w.negative=u.negative^y.negative,w.length=u.length+y.length,w.strip()},o.prototype.mul=function(u){var y=new o(null);return y.words=new Array(this.length+u.length),this.mulTo(u,y)},o.prototype.mulf=function(u){var y=new o(null);return y.words=new Array(this.length+u.length),J(this,u,y)},o.prototype.imul=function(u){return this.clone().mulTo(u,this)},o.prototype.imuln=function(u){n(typeof u=="number"),n(u<67108864);for(var y=0,w=0;w<this.length;w++){var E=(this.words[w]|0)*u,O=(E&67108863)+(y&67108863);y>>=26,y+=E/67108864|0,y+=O>>>26,this.words[w]=O&67108863}return y!==0&&(this.words[w]=y,this.length++),this},o.prototype.muln=function(u){return this.clone().imuln(u)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(u){var y=I(u);if(y.length===0)return new o(1);for(var w=this,E=0;E<y.length&&y[E]===0;E++,w=w.sqr());if(++E<y.length)for(var O=w.sqr();E<y.length;E++,O=O.sqr())y[E]!==0&&(w=w.mul(O));return w},o.prototype.iushln=function(u){n(typeof u=="number"&&u>=0);var y=u%26,w=(u-y)/26,E=67108863>>>26-y<<26-y,O;if(y!==0){var N=0;for(O=0;O<this.length;O++){var R=this.words[O]&E,x=(this.words[O]|0)-R<<y;this.words[O]=x|N,N=R>>>26-y}N&&(this.words[O]=N,this.length++)}if(w!==0){for(O=this.length-1;O>=0;O--)this.words[O+w]=this.words[O];for(O=0;O<w;O++)this.words[O]=0;this.length+=w}return this.strip()},o.prototype.ishln=function(u){return n(this.negative===0),this.iushln(u)},o.prototype.iushrn=function(u,y,w){n(typeof u=="number"&&u>=0);var E;y?E=(y-y%26)/26:E=0;var O=u%26,N=Math.min((u-O)/26,this.length),R=67108863^67108863>>>O<<O,x=w;if(E-=N,E=Math.max(0,E),x){for(var d=0;d<N;d++)x.words[d]=this.words[d];x.length=N}if(N!==0)if(this.length>N)for(this.length-=N,d=0;d<this.length;d++)this.words[d]=this.words[d+N];else this.words[0]=0,this.length=1;var D=0;for(d=this.length-1;d>=0&&(D!==0||d>=E);d--){var fe=this.words[d]|0;this.words[d]=D<<26-O|fe>>>O,D=fe&R}return x&&D!==0&&(x.words[x.length++]=D),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(u,y,w){return n(this.negative===0),this.iushrn(u,y,w)},o.prototype.shln=function(u){return this.clone().ishln(u)},o.prototype.ushln=function(u){return this.clone().iushln(u)},o.prototype.shrn=function(u){return this.clone().ishrn(u)},o.prototype.ushrn=function(u){return this.clone().iushrn(u)},o.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var y=u%26,w=(u-y)/26,E=1<<y;if(this.length<=w)return!1;var O=this.words[w];return!!(O&E)},o.prototype.imaskn=function(u){n(typeof u=="number"&&u>=0);var y=u%26,w=(u-y)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(y!==0&&w++,this.length=Math.min(w,this.length),y!==0){var E=67108863^67108863>>>y<<y;this.words[this.length-1]&=E}return this.strip()},o.prototype.maskn=function(u){return this.clone().imaskn(u)},o.prototype.iaddn=function(u){return n(typeof u=="number"),n(u<67108864),u<0?this.isubn(-u):this.negative!==0?this.length===1&&(this.words[0]|0)<u?(this.words[0]=u-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(u),this.negative=1,this):this._iaddn(u)},o.prototype._iaddn=function(u){this.words[0]+=u;for(var y=0;y<this.length&&this.words[y]>=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},o.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y<this.length&&this.words[y]<0;y++)this.words[y]+=67108864,this.words[y+1]-=1;return this.strip()},o.prototype.addn=function(u){return this.clone().iaddn(u)},o.prototype.subn=function(u){return this.clone().isubn(u)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(u,y,w){var E=u.length+w,O;this._expand(E);var N,R=0;for(O=0;O<u.length;O++){N=(this.words[O+w]|0)+R;var x=(u.words[O]|0)*y;N-=x&67108863,R=(N>>26)-(x/67108864|0),this.words[O+w]=N&67108863}for(;O<this.length-w;O++)N=(this.words[O+w]|0)+R,R=N>>26,this.words[O+w]=N&67108863;if(R===0)return this.strip();for(n(R===-1),R=0,O=0;O<this.length;O++)N=-(this.words[O]|0)+R,R=N>>26,this.words[O]=N&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(u,y){var w=this.length-u.length,E=this.clone(),O=u,N=O.words[O.length-1]|0,R=this._countBits(N);w=26-R,w!==0&&(O=O.ushln(w),E.iushln(w),N=O.words[O.length-1]|0);var x=E.length-O.length,d;if(y!=="mod"){d=new o(null),d.length=x+1,d.words=new Array(d.length);for(var D=0;D<d.length;D++)d.words[D]=0}var fe=E.clone()._ishlnsubmul(O,1,x);fe.negative===0&&(E=fe,d&&(d.words[x]=1));for(var ee=x-1;ee>=0;ee--){var he=(E.words[O.length+ee]|0)*67108864+(E.words[O.length+ee-1]|0);for(he=Math.min(he/N|0,67108863),E._ishlnsubmul(O,he,ee);E.negative!==0;)he--,E.negative=0,E._ishlnsubmul(O,1,ee),E.isZero()||(E.negative^=1);d&&(d.words[ee]=he)}return d&&d.strip(),E.strip(),y!=="div"&&w!==0&&E.iushrn(w),{div:d||null,mod:E}},o.prototype.divmod=function(u,y,w){if(n(!u.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var E,O,N;return this.negative!==0&&u.negative===0?(N=this.neg().divmod(u,y),y!=="mod"&&(E=N.div.neg()),y!=="div"&&(O=N.mod.neg(),w&&O.negative!==0&&O.iadd(u)),{div:E,mod:O}):this.negative===0&&u.negative!==0?(N=this.divmod(u.neg(),y),y!=="mod"&&(E=N.div.neg()),{div:E,mod:N.mod}):this.negative&u.negative?(N=this.neg().divmod(u.neg(),y),y!=="div"&&(O=N.mod.neg(),w&&O.negative!==0&&O.isub(u)),{div:N.div,mod:O}):u.length>this.length||this.cmp(u)<0?{div:new o(0),mod:this}:u.length===1?y==="div"?{div:this.divn(u.words[0]),mod:null}:y==="mod"?{div:null,mod:new o(this.modn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new o(this.modn(u.words[0]))}:this._wordDiv(u,y)},o.prototype.div=function(u){return this.divmod(u,"div",!1).div},o.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},o.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},o.prototype.divRound=function(u){var y=this.divmod(u);if(y.mod.isZero())return y.div;var w=y.div.negative!==0?y.mod.isub(u):y.mod,E=u.ushrn(1),O=u.andln(1),N=w.cmp(E);return N<0||O===1&&N===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},o.prototype.modn=function(u){n(u<=67108863);for(var y=(1<<26)%u,w=0,E=this.length-1;E>=0;E--)w=(y*w+(this.words[E]|0))%u;return w},o.prototype.idivn=function(u){n(u<=67108863);for(var y=0,w=this.length-1;w>=0;w--){var E=(this.words[w]|0)+y*67108864;this.words[w]=E/u|0,y=E%u}return this.strip()},o.prototype.divn=function(u){return this.clone().idivn(u)},o.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var y=this,w=u.clone();y.negative!==0?y=y.umod(u):y=y.clone();for(var E=new o(1),O=new o(0),N=new o(0),R=new o(1),x=0;y.isEven()&&w.isEven();)y.iushrn(1),w.iushrn(1),++x;for(var d=w.clone(),D=y.clone();!y.isZero();){for(var fe=0,ee=1;!(y.words[0]&ee)&&fe<26;++fe,ee<<=1);if(fe>0)for(y.iushrn(fe);fe-- >0;)(E.isOdd()||O.isOdd())&&(E.iadd(d),O.isub(D)),E.iushrn(1),O.iushrn(1);for(var he=0,ne=1;!(w.words[0]&ne)&&he<26;++he,ne<<=1);if(he>0)for(w.iushrn(he);he-- >0;)(N.isOdd()||R.isOdd())&&(N.iadd(d),R.isub(D)),N.iushrn(1),R.iushrn(1);y.cmp(w)>=0?(y.isub(w),E.isub(N),O.isub(R)):(w.isub(y),N.isub(E),R.isub(O))}return{a:N,b:R,gcd:w.iushln(x)}},o.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var y=this,w=u.clone();y.negative!==0?y=y.umod(u):y=y.clone();for(var E=new o(1),O=new o(0),N=w.clone();y.cmpn(1)>0&&w.cmpn(1)>0;){for(var R=0,x=1;!(y.words[0]&x)&&R<26;++R,x<<=1);if(R>0)for(y.iushrn(R);R-- >0;)E.isOdd()&&E.iadd(N),E.iushrn(1);for(var d=0,D=1;!(w.words[0]&D)&&d<26;++d,D<<=1);if(d>0)for(w.iushrn(d);d-- >0;)O.isOdd()&&O.iadd(N),O.iushrn(1);y.cmp(w)>=0?(y.isub(w),E.isub(O)):(w.isub(y),O.isub(E))}var fe;return y.cmpn(1)===0?fe=E:fe=O,fe.cmpn(0)<0&&fe.iadd(u),fe},o.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var y=this.clone(),w=u.clone();y.negative=0,w.negative=0;for(var E=0;y.isEven()&&w.isEven();E++)y.iushrn(1),w.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;w.isEven();)w.iushrn(1);var O=y.cmp(w);if(O<0){var N=y;y=w,w=N}else if(O===0||w.cmpn(1)===0)break;y.isub(w)}while(!0);return w.iushln(E)},o.prototype.invm=function(u){return this.egcd(u).a.umod(u)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(u){return this.words[0]&u},o.prototype.bincn=function(u){n(typeof u=="number");var y=u%26,w=(u-y)/26,E=1<<y;if(this.length<=w)return this._expand(w+1),this.words[w]|=E,this;for(var O=E,N=w;O!==0&&N<this.length;N++){var R=this.words[N]|0;R+=O,O=R>>>26,R&=67108863,this.words[N]=R}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(u){var y=u<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this.strip();var w;if(this.length>1)w=1;else{y&&(u=-u),n(u<=67108863,"Number is too big");var E=this.words[0]|0;w=E===u?0:E<u?-1:1}return this.negative!==0?-w|0:w},o.prototype.cmp=function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var y=this.ucmp(u);return this.negative!==0?-y|0:y},o.prototype.ucmp=function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var y=0,w=this.length-1;w>=0;w--){var E=this.words[w]|0,O=u.words[w]|0;if(E!==O){E<O?y=-1:E>O&&(y=1);break}}return y},o.prototype.gtn=function(u){return this.cmpn(u)===1},o.prototype.gt=function(u){return this.cmp(u)===1},o.prototype.gten=function(u){return this.cmpn(u)>=0},o.prototype.gte=function(u){return this.cmp(u)>=0},o.prototype.ltn=function(u){return this.cmpn(u)===-1},o.prototype.lt=function(u){return this.cmp(u)===-1},o.prototype.lten=function(u){return this.cmpn(u)<=0},o.prototype.lte=function(u){return this.cmp(u)<=0},o.prototype.eqn=function(u){return this.cmpn(u)===0},o.prototype.eq=function(u){return this.cmp(u)===0},o.red=function(u){return new re(u)},o.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(u){return this.red=u,this},o.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},o.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},o.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},o.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},o.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},o.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},o.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},o.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},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(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var V={k256:null,p224:null,p192:null,p25519:null};function L($,u){this.name=$,this.p=new o(u,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var u=new o(null);return u.words=new Array(Math.ceil(this.n/13)),u},L.prototype.ireduce=function(u){var y=u,w;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),w=y.bitLength();while(w>this.n);var E=w<this.n?-1:y.ucmp(this.p);return E===0?(y.words[0]=0,y.length=1):E>0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},L.prototype.split=function(u,y){u.iushrn(this.n,0,y)},L.prototype.imulK=function(u){return u.imul(this.k)};function U(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}a(U,L),U.prototype.split=function(u,y){for(var w=4194303,E=Math.min(u.length,9),O=0;O<E;O++)y.words[O]=u.words[O];if(y.length=E,u.length<=9){u.words[0]=0,u.length=1;return}var N=u.words[9];for(y.words[y.length++]=N&w,O=10;O<u.length;O++){var R=u.words[O]|0;u.words[O-10]=(R&w)<<4|N>>>22,N=R}N>>>=22,u.words[O-10]=N,N===0&&u.length>10?u.length-=10:u.length-=9},U.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var y=0,w=0;w<u.length;w++){var E=u.words[w]|0;y+=E*977,u.words[w]=y&67108863,y=E*64+(y/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u};function z(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}a(z,L);function b(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}a(b,L);function T(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}a(T,L),T.prototype.imulK=function(u){for(var y=0,w=0;w<u.length;w++){var E=(u.words[w]|0)*19+y,O=E&67108863;E>>>=26,u.words[w]=O,y=E}return y!==0&&(u.words[u.length++]=y),u},o._prime=function(u){if(V[u])return V[u];var y;if(u==="k256")y=new U;else if(u==="p224")y=new z;else if(u==="p192")y=new b;else if(u==="p25519")y=new T;else throw new Error("Unknown prime "+u);return V[u]=y,y};function re($){if(typeof $=="string"){var u=o._prime($);this.m=u.p,this.prime=u}else n($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}re.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},re.prototype._verify2=function(u,y){n((u.negative|y.negative)===0,"red works only with positives"),n(u.red&&u.red===y.red,"red works only with red numbers")},re.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):u.umod(this.m)._forceRed(this)},re.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},re.prototype.add=function(u,y){this._verify2(u,y);var w=u.add(y);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},re.prototype.iadd=function(u,y){this._verify2(u,y);var w=u.iadd(y);return w.cmp(this.m)>=0&&w.isub(this.m),w},re.prototype.sub=function(u,y){this._verify2(u,y);var w=u.sub(y);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},re.prototype.isub=function(u,y){this._verify2(u,y);var w=u.isub(y);return w.cmpn(0)<0&&w.iadd(this.m),w},re.prototype.shl=function(u,y){return this._verify1(u),this.imod(u.ushln(y))},re.prototype.imul=function(u,y){return this._verify2(u,y),this.imod(u.imul(y))},re.prototype.mul=function(u,y){return this._verify2(u,y),this.imod(u.mul(y))},re.prototype.isqr=function(u){return this.imul(u,u.clone())},re.prototype.sqr=function(u){return this.mul(u,u)},re.prototype.sqrt=function(u){if(u.isZero())return u.clone();var y=this.m.andln(3);if(n(y%2===1),y===3){var w=this.m.add(new o(1)).iushrn(2);return this.pow(u,w)}for(var E=this.m.subn(1),O=0;!E.isZero()&&E.andln(1)===0;)O++,E.iushrn(1);n(!E.isZero());var N=new o(1).toRed(this),R=N.redNeg(),x=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);this.pow(d,x).cmp(R)!==0;)d.redIAdd(R);for(var D=this.pow(d,E),fe=this.pow(u,E.addn(1).iushrn(1)),ee=this.pow(u,E),he=O;ee.cmp(N)!==0;){for(var ne=ee,ge=0;ne.cmp(N)!==0;ge++)ne=ne.redSqr();n(ge<he);var G=this.pow(D,new o(1).iushln(he-ge-1));fe=fe.redMul(G),D=G.redSqr(),ee=ee.redMul(D),he=ge}return fe},re.prototype.invm=function(u){var y=u._invmp(this.m);return y.negative!==0?(y.negative=0,this.imod(y).redNeg()):this.imod(y)},re.prototype.pow=function(u,y){if(y.isZero())return new o(1).toRed(this);if(y.cmpn(1)===0)return u.clone();var w=4,E=new Array(1<<w);E[0]=new o(1).toRed(this),E[1]=u;for(var O=2;O<E.length;O++)E[O]=this.mul(E[O-1],u);var N=E[0],R=0,x=0,d=y.bitLength()%26;for(d===0&&(d=26),O=y.length-1;O>=0;O--){for(var D=y.words[O],fe=d-1;fe>=0;fe--){var ee=D>>fe&1;if(N!==E[0]&&(N=this.sqr(N)),ee===0&&R===0){x=0;continue}R<<=1,R|=ee,x++,!(x!==w&&(O!==0||fe!==0))&&(N=this.mul(N,E[R]),x=0,R=0)}d=26}return N},re.prototype.convertTo=function(u){var y=u.umod(this.m);return y===u?y.clone():y},re.prototype.convertFrom=function(u){var y=u.clone();return y.red=null,y},o.mont=function(u){return new de(u)};function de($){re.call(this,$),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)}a(de,re),de.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},de.prototype.convertFrom=function(u){var y=this.imod(u.mul(this.rinv));return y.red=null,y},de.prototype.imul=function(u,y){if(u.isZero()||y.isZero())return u.words[0]=0,u.length=1,u;var w=u.imul(y),E=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=w.isub(E).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)},de.prototype.mul=function(u,y){if(u.isZero()||y.isZero())return new o(0)._forceRed(this);var w=u.mul(y),E=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=w.isub(E).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)},de.prototype.invm=function(u){var y=this.imod(u._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(r,wr)})(ou);var cn=ou.exports;(function(r){var e=r,t=cn,n=Y2,a=X2;e.assert=n,e.toArray=a.toArray,e.zero2=a.zero2,e.toHex=a.toHex,e.encode=a.encode;function o(m,_,M){var I=new Array(Math.max(m.bitLength(),M)+1),P;for(P=0;P<I.length;P+=1)I[P]=0;var H=1<<_+1,W=m.clone();for(P=0;P<I.length;P++){var J,q=W.andln(H-1);W.isOdd()?(q>(H>>1)-1?J=(H>>1)-q:J=q,W.isubn(J)):J=0,I[P]=J,W.iushrn(1)}return I}e.getNAF=o;function f(m,_){var M=[[],[]];m=m.clone(),_=_.clone();for(var I=0,P=0,H;m.cmpn(-I)>0||_.cmpn(-P)>0;){var W=m.andln(3)+I&3,J=_.andln(3)+P&3;W===3&&(W=-1),J===3&&(J=-1);var q;W&1?(H=m.andln(7)+I&7,(H===3||H===5)&&J===2?q=-W:q=W):q=0,M[0].push(q);var V;J&1?(H=_.andln(7)+P&7,(H===3||H===5)&&W===2?V=-J:V=J):V=0,M[1].push(V),2*I===q+1&&(I=1-I),2*P===V+1&&(P=1-P),m.iushrn(1),_.iushrn(1)}return M}e.getJSF=f;function h(m,_,M){var I="_"+_;m.prototype[_]=function(){return this[I]!==void 0?this[I]:this[I]=M.call(this)}}e.cachedProperty=h;function p(m){return typeof m=="string"?e.toArray(m,"hex"):m}e.parseBytes=p;function l(m){return new t(m,"hex","le")}e.intFromLE=l})(Yr);var cu={},es=cn,Ka=Yr,mc=Ka.getNAF,i5=Ka.getJSF,yc=Ka.assert;function An(r,e){this.type=r,this.p=new es(e.p,16),this.red=e.prime?es.red(e.prime):es.mont(this.p),this.zero=new es(0).toRed(this.red),this.one=new es(1).toRed(this.red),this.two=new es(2).toRed(this.red),this.n=e.n&&new es(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Lc=An;An.prototype.point=function(){throw new Error("Not implemented")};An.prototype.validate=function(){throw new Error("Not implemented")};An.prototype._fixedNafMul=function(e,t){yc(e.precomputed);var n=e._getDoubles(),a=mc(t,1,this._bitLength),o=(1<<n.step+1)-(n.step%2===0?2:1);o/=3;var f=[],h,p;for(h=0;h<a.length;h+=n.step){p=0;for(var l=h+n.step-1;l>=h;l--)p=(p<<1)+a[l];f.push(p)}for(var m=this.jpoint(null,null,null),_=this.jpoint(null,null,null),M=o;M>0;M--){for(h=0;h<f.length;h++)p=f[h],p===M?_=_.mixedAdd(n.points[h]):p===-M&&(_=_.mixedAdd(n.points[h].neg()));m=m.add(_)}return m.toP()};An.prototype._wnafMul=function(e,t){var n=4,a=e._getNAFPoints(n);n=a.wnd;for(var o=a.points,f=mc(t,n,this._bitLength),h=this.jpoint(null,null,null),p=f.length-1;p>=0;p--){for(var l=0;p>=0&&f[p]===0;p--)l++;if(p>=0&&l++,h=h.dblp(l),p<0)break;var m=f[p];yc(m!==0),e.type==="affine"?m>0?h=h.mixedAdd(o[m-1>>1]):h=h.mixedAdd(o[-m-1>>1].neg()):m>0?h=h.add(o[m-1>>1]):h=h.add(o[-m-1>>1].neg())}return e.type==="affine"?h.toP():h};An.prototype._wnafMulAdd=function(e,t,n,a,o){var f=this._wnafT1,h=this._wnafT2,p=this._wnafT3,l=0,m,_,M;for(m=0;m<a;m++){M=t[m];var I=M._getNAFPoints(e);f[m]=I.wnd,h[m]=I.points}for(m=a-1;m>=1;m-=2){var P=m-1,H=m;if(f[P]!==1||f[H]!==1){p[P]=mc(n[P],f[P],this._bitLength),p[H]=mc(n[H],f[H],this._bitLength),l=Math.max(p[P].length,l),l=Math.max(p[H].length,l);continue}var W=[t[P],null,null,t[H]];t[P].y.cmp(t[H].y)===0?(W[1]=t[P].add(t[H]),W[2]=t[P].toJ().mixedAdd(t[H].neg())):t[P].y.cmp(t[H].y.redNeg())===0?(W[1]=t[P].toJ().mixedAdd(t[H]),W[2]=t[P].add(t[H].neg())):(W[1]=t[P].toJ().mixedAdd(t[H]),W[2]=t[P].toJ().mixedAdd(t[H].neg()));var J=[-3,-1,-5,-7,0,7,5,1,3],q=i5(n[P],n[H]);for(l=Math.max(q[0].length,l),p[P]=new Array(l),p[H]=new Array(l),_=0;_<l;_++){var V=q[0][_]|0,L=q[1][_]|0;p[P][_]=J[(V+1)*3+(L+1)],p[H][_]=0,h[P]=W}}var U=this.jpoint(null,null,null),z=this._wnafT4;for(m=l;m>=0;m--){for(var b=0;m>=0;){var T=!0;for(_=0;_<a;_++)z[_]=p[_][m]|0,z[_]!==0&&(T=!1);if(!T)break;b++,m--}if(m>=0&&b++,U=U.dblp(b),m<0)break;for(_=0;_<a;_++){var re=z[_];re!==0&&(re>0?M=h[_][re-1>>1]:re<0&&(M=h[_][-re-1>>1].neg()),M.type==="affine"?U=U.mixedAdd(M):U=U.add(M))}}for(m=0;m<a;m++)h[m]=null;return o?U:U.toP()};function ui(r,e){this.curve=r,this.type=e,this.precomputed=null}An.BasePoint=ui;ui.prototype.eq=function(){throw new Error("Not implemented")};ui.prototype.validate=function(){return this.curve.validate(this)};An.prototype.decodePoint=function(e,t){e=Ka.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?yc(e[e.length-1]%2===0):e[0]===7&&yc(e[e.length-1]%2===1);var a=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return a}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")};ui.prototype.encodeCompressed=function(e){return this.encode(e,!0)};ui.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))};ui.prototype.encode=function(e,t){return Ka.encode(this._encode(t),e)};ui.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};ui.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};ui.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],a=this,o=0;o<t;o+=e){for(var f=0;f<e;f++)a=a.dbl();n.push(a)}return{step:e,points:n}};ui.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,a=n===1?null:this.dbl(),o=1;o<n;o++)t[o]=t[o-1].add(a);return{wnd:e,points:t}};ui.prototype._getBeta=function(){return null};ui.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var n5=Yr,Vt=cn,fu=eu,Vs=Lc,s5=n5.assert;function di(r){Vs.call(this,"short",r),this.a=new Vt(r.a,16).toRed(this.red),this.b=new Vt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}fu(di,Vs);var a5=di;di.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new Vt(e.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);t=a[0].cmp(a[1])<0?a[0]:a[1],t=t.toRed(this.red)}if(e.lambda)n=new Vt(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))===0?n=o[0]:(n=o[1],s5(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var f;return e.basis?f=e.basis.map(function(h){return{a:new Vt(h.a,16),b:new Vt(h.b,16)}}):f=this._getEndoBasis(n),{beta:t,lambda:n,basis:f}}};di.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Vt.mont(e),n=new Vt(2).toRed(t).redInvm(),a=n.redNeg(),o=new Vt(3).toRed(t).redNeg().redSqrt().redMul(n),f=a.redAdd(o).fromRed(),h=a.redSub(o).fromRed();return[f,h]};di.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,a=this.n.clone(),o=new Vt(1),f=new Vt(0),h=new Vt(0),p=new Vt(1),l,m,_,M,I,P,H,W=0,J,q;n.cmpn(0)!==0;){var V=a.div(n);J=a.sub(V.mul(n)),q=h.sub(V.mul(o));var L=p.sub(V.mul(f));if(!_&&J.cmp(t)<0)l=H.neg(),m=o,_=J.neg(),M=q;else if(_&&++W===2)break;H=J,a=n,n=J,h=o,o=q,p=f,f=L}I=J.neg(),P=q;var U=_.sqr().add(M.sqr()),z=I.sqr().add(P.sqr());return z.cmp(U)>=0&&(I=l,P=m),_.negative&&(_=_.neg(),M=M.neg()),I.negative&&(I=I.neg(),P=P.neg()),[{a:_,b:M},{a:I,b:P}]};di.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],a=t[1],o=a.b.mul(e).divRound(this.n),f=n.b.neg().mul(e).divRound(this.n),h=o.mul(n.a),p=f.mul(a.a),l=o.mul(n.b),m=f.mul(a.b),_=e.sub(h).sub(p),M=l.add(m).neg();return{k1:_,k2:M}};di.prototype.pointFromX=function(e,t){e=new Vt(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),a=n.redSqrt();if(a.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=a.fromRed().isOdd();return(t&&!o||!t&&o)&&(a=a.redNeg()),this.point(e,a)};di.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,a=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(a).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};di.prototype._endoWnafMulAdd=function(e,t,n){for(var a=this._endoWnafT1,o=this._endoWnafT2,f=0;f<e.length;f++){var h=this._endoSplit(t[f]),p=e[f],l=p._getBeta();h.k1.negative&&(h.k1.ineg(),p=p.neg(!0)),h.k2.negative&&(h.k2.ineg(),l=l.neg(!0)),a[f*2]=p,a[f*2+1]=l,o[f*2]=h.k1,o[f*2+1]=h.k2}for(var m=this._wnafMulAdd(1,a,o,f*2,n),_=0;_<f*2;_++)a[_]=null,o[_]=null;return m};function ur(r,e,t,n){Vs.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Vt(e,16),this.y=new Vt(t,16),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)}fu(ur,Vs.BasePoint);di.prototype.point=function(e,t,n){return new ur(this,e,t,n)};di.prototype.pointFromJSON=function(e,t){return ur.fromJSON(this,e,t)};ur.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 n=this.curve,a=function(o){return n.point(o.x.redMul(n.endo.beta),o.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(a)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(a)}}}return t}};ur.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]};ur.fromJSON=function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var a=e.point(t[0],t[1],n);if(!t[2])return a;function o(h){return e.point(h[0],h[1],n)}var f=t[2];return a.precomputed={beta:null,doubles:f.doubles&&{step:f.doubles.step,points:[a].concat(f.doubles.points.map(o))},naf:f.naf&&{wnd:f.naf.wnd,points:[a].concat(f.naf.points.map(o))}},a};ur.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)+">"};ur.prototype.isInfinity=function(){return this.inf};ur.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 n=t.redSqr().redISub(this.x).redISub(e.x),a=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,a)};ur.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,n=this.x.redSqr(),a=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(a),f=o.redSqr().redISub(this.x.redAdd(this.x)),h=o.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,h)};ur.prototype.getX=function(){return this.x.fromRed()};ur.prototype.getY=function(){return this.y.fromRed()};ur.prototype.mul=function(e){return e=new Vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};ur.prototype.mulAdd=function(e,t,n){var a=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(a,o):this.curve._wnafMulAdd(1,a,o,2)};ur.prototype.jmulAdd=function(e,t,n){var a=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(a,o,!0):this.curve._wnafMulAdd(1,a,o,2,!0)};ur.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)};ur.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,a=function(o){return o.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(a)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(a)}}}return t};ur.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 pr(r,e,t,n){Vs.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Vt(0)):(this.x=new Vt(e,16),this.y=new Vt(t,16),this.z=new Vt(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}fu(pr,Vs.BasePoint);di.prototype.jpoint=function(e,t,n){return new pr(this,e,t,n)};pr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),a=this.y.redMul(t).redMul(e);return this.curve.point(n,a)};pr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};pr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),a=this.x.redMul(t),o=e.x.redMul(n),f=this.y.redMul(t.redMul(e.z)),h=e.y.redMul(n.redMul(this.z)),p=a.redSub(o),l=f.redSub(h);if(p.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=p.redSqr(),_=m.redMul(p),M=a.redMul(m),I=l.redSqr().redIAdd(_).redISub(M).redISub(M),P=l.redMul(M.redISub(I)).redISub(f.redMul(_)),H=this.z.redMul(e.z).redMul(p);return this.curve.jpoint(I,P,H)};pr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,a=e.x.redMul(t),o=this.y,f=e.y.redMul(t).redMul(this.z),h=n.redSub(a),p=o.redSub(f);if(h.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=h.redSqr(),m=l.redMul(h),_=n.redMul(l),M=p.redSqr().redIAdd(m).redISub(_).redISub(_),I=p.redMul(_.redISub(M)).redISub(o.redMul(m)),P=this.z.redMul(h);return this.curve.jpoint(M,I,P)};pr.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 n=this;for(t=0;t<e;t++)n=n.dbl();return n}var a=this.curve.a,o=this.curve.tinv,f=this.x,h=this.y,p=this.z,l=p.redSqr().redSqr(),m=h.redAdd(h);for(t=0;t<e;t++){var _=f.redSqr(),M=m.redSqr(),I=M.redSqr(),P=_.redAdd(_).redIAdd(_).redIAdd(a.redMul(l)),H=f.redMul(M),W=P.redSqr().redISub(H.redAdd(H)),J=H.redISub(W),q=P.redMul(J);q=q.redIAdd(q).redISub(I);var V=m.redMul(p);t+1<e&&(l=l.redMul(I)),f=W,p=V,m=q}return this.curve.jpoint(f,m.redMul(o),p)};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 e,t,n;if(this.zOne){var a=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(a).redISub(f);h=h.redIAdd(h);var p=a.redAdd(a).redIAdd(a),l=p.redSqr().redISub(h).redISub(h),m=f.redIAdd(f);m=m.redIAdd(m),m=m.redIAdd(m),e=l,t=p.redMul(h.redISub(l)).redISub(m),n=this.y.redAdd(this.y)}else{var _=this.x.redSqr(),M=this.y.redSqr(),I=M.redSqr(),P=this.x.redAdd(M).redSqr().redISub(_).redISub(I);P=P.redIAdd(P);var H=_.redAdd(_).redIAdd(_),W=H.redSqr(),J=I.redIAdd(I);J=J.redIAdd(J),J=J.redIAdd(J),e=W.redISub(P).redISub(P),t=H.redMul(P.redISub(e)).redISub(J),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)};pr.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var a=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(a).redISub(f);h=h.redIAdd(h);var p=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a),l=p.redSqr().redISub(h).redISub(h);e=l;var m=f.redIAdd(f);m=m.redIAdd(m),m=m.redIAdd(m),t=p.redMul(h.redISub(l)).redISub(m),n=this.y.redAdd(this.y)}else{var _=this.z.redSqr(),M=this.y.redSqr(),I=this.x.redMul(M),P=this.x.redSub(_).redMul(this.x.redAdd(_));P=P.redAdd(P).redIAdd(P);var H=I.redIAdd(I);H=H.redIAdd(H);var W=H.redAdd(H);e=P.redSqr().redISub(W),n=this.y.redAdd(this.z).redSqr().redISub(M).redISub(_);var J=M.redSqr();J=J.redIAdd(J),J=J.redIAdd(J),J=J.redIAdd(J),t=P.redMul(H.redISub(e)).redISub(J)}return this.curve.jpoint(e,t,n)};pr.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,a=this.z,o=a.redSqr().redSqr(),f=t.redSqr(),h=n.redSqr(),p=f.redAdd(f).redIAdd(f).redIAdd(e.redMul(o)),l=t.redAdd(t);l=l.redIAdd(l);var m=l.redMul(h),_=p.redSqr().redISub(m.redAdd(m)),M=m.redISub(_),I=h.redSqr();I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var P=p.redMul(M).redISub(I),H=n.redAdd(n).redMul(a);return this.curve.jpoint(_,P,H)};pr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),a=t.redSqr(),o=e.redAdd(e).redIAdd(e),f=o.redSqr(),h=this.x.redAdd(t).redSqr().redISub(e).redISub(a);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(f);var p=h.redSqr(),l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var m=o.redIAdd(h).redSqr().redISub(f).redISub(p).redISub(l),_=t.redMul(m);_=_.redIAdd(_),_=_.redIAdd(_);var M=this.x.redMul(p).redISub(_);M=M.redIAdd(M),M=M.redIAdd(M);var I=this.y.redMul(m.redMul(l.redISub(m)).redISub(h.redMul(p)));I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var P=this.z.redAdd(h).redSqr().redISub(n).redISub(p);return this.curve.jpoint(M,I,P)};pr.prototype.mul=function(e,t){return e=new Vt(e,t),this.curve._wnafMul(this,e)};pr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var a=t.redMul(this.z),o=n.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(a)).cmpn(0)===0};pr.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var a=e.clone(),o=this.curve.redN.redMul(t);;){if(a.iadd(this.curve.n),a.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===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 Hs=cn,n1=eu,Fc=Lc,o5=Yr;function Gs(r){Fc.call(this,"mont",r),this.a=new Hs(r.a,16).toRed(this.red),this.b=new Hs(r.b,16).toRed(this.red),this.i4=new Hs(4).toRed(this.red).redInvm(),this.two=new Hs(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}n1(Gs,Fc);var c5=Gs;Gs.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),a=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t),o=a.redSqrt();return o.redSqr().cmp(a)===0};function hr(r,e,t){Fc.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Hs(e,16),this.z=new Hs(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n1(hr,Fc.BasePoint);Gs.prototype.decodePoint=function(e,t){return this.point(o5.toArray(e,t),1)};Gs.prototype.point=function(e,t){return new hr(this,e,t)};Gs.prototype.pointFromJSON=function(e){return hr.fromJSON(this,e)};hr.prototype.precompute=function(){};hr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};hr.fromJSON=function(e,t){return new hr(e,t[0],t[1]||e.one)};hr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};hr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};hr.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),n=this.x.redSub(this.z),a=n.redSqr(),o=t.redSub(a),f=t.redMul(a),h=o.redMul(a.redAdd(this.curve.a24.redMul(o)));return this.curve.point(f,h)};hr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};hr.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),a=this.x.redSub(this.z),o=e.x.redAdd(e.z),f=e.x.redSub(e.z),h=f.redMul(n),p=o.redMul(a),l=t.z.redMul(h.redAdd(p).redSqr()),m=t.x.redMul(h.redISub(p).redSqr());return this.curve.point(l,m)};hr.prototype.mul=function(e){for(var t=e.clone(),n=this,a=this.curve.point(null,null),o=this,f=[];t.cmpn(0)!==0;t.iushrn(1))f.push(t.andln(1));for(var h=f.length-1;h>=0;h--)f[h]===0?(n=n.diffAdd(a,o),a=a.dbl()):(a=n.diffAdd(a,o),n=n.dbl());return a};hr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};hr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};hr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};hr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var f5=Yr,sn=cn,s1=eu,qc=Lc,h5=f5.assert;function Hi(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,qc.call(this,"edwards",r),this.a=new sn(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new sn(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new sn(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),h5(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}s1(Hi,qc);var u5=Hi;Hi.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Hi.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Hi.prototype.jpoint=function(e,t,n,a){return this.point(e,t,n,a)};Hi.prototype.pointFromX=function(e,t){e=new sn(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),a=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),f=a.redMul(o.redInvm()),h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");var p=h.fromRed().isOdd();return(t&&!p||!t&&p)&&(h=h.redNeg()),this.point(e,h)};Hi.prototype.pointFromY=function(e,t){e=new sn(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),a=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),f=a.redMul(o.redInvm());if(f.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==t&&(h=h.redNeg()),this.point(h,e)};Hi.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),a=t.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return a.cmp(o)===0};function Lt(r,e,t,n,a){qc.BasePoint.call(this,r,"projective"),e===null&&t===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new sn(e,16),this.y=new sn(t,16),this.z=n?new sn(n,16):this.curve.one,this.t=a&&new sn(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s1(Lt,qc.BasePoint);Hi.prototype.pointFromJSON=function(e){return Lt.fromJSON(this,e)};Hi.prototype.point=function(e,t,n,a){return new Lt(this,e,t,n,a)};Lt.fromJSON=function(e,t){return new Lt(e,t[0],t[1],t[2])};Lt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Lt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Lt.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var a=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),f=a.redAdd(t),h=f.redSub(n),p=a.redSub(t),l=o.redMul(h),m=f.redMul(p),_=o.redMul(p),M=h.redMul(f);return this.curve.point(l,m,M,_)};Lt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),a,o,f,h,p,l;if(this.curve.twisted){h=this.curve._mulA(t);var m=h.redAdd(n);this.zOne?(a=e.redSub(t).redSub(n).redMul(m.redSub(this.curve.two)),o=m.redMul(h.redSub(n)),f=m.redSqr().redSub(m).redSub(m)):(p=this.z.redSqr(),l=m.redSub(p).redISub(p),a=e.redSub(t).redISub(n).redMul(l),o=m.redMul(h.redSub(n)),f=m.redMul(l))}else h=t.redAdd(n),p=this.curve._mulC(this.z).redSqr(),l=h.redSub(p).redSub(p),a=this.curve._mulC(e.redISub(h)).redMul(l),o=this.curve._mulC(h).redMul(t.redISub(n)),f=h.redMul(l);return this.curve.point(a,o,f)};Lt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Lt.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),a=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),f=n.redSub(t),h=o.redSub(a),p=o.redAdd(a),l=n.redAdd(t),m=f.redMul(h),_=p.redMul(l),M=f.redMul(l),I=h.redMul(p);return this.curve.point(m,_,I,M)};Lt.prototype._projAdd=function(e){var t=this.z.redMul(e.z),n=t.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),f=this.curve.d.redMul(a).redMul(o),h=n.redSub(f),p=n.redAdd(f),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),m=t.redMul(h).redMul(l),_,M;return this.curve.twisted?(_=t.redMul(p).redMul(o.redSub(this.curve._mulA(a))),M=h.redMul(p)):(_=t.redMul(p).redMul(o.redSub(a)),M=this.curve._mulC(h).redMul(p)),this.curve.point(m,_,M)};Lt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Lt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Lt.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)};Lt.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)};Lt.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};Lt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Lt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Lt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Lt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Lt.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),a=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(a),this.x.cmp(t)===0)return!0}};Lt.prototype.toP=Lt.prototype.normalize;Lt.prototype.mixedAdd=Lt.prototype.add;(function(r){var e=r;e.base=Lc,e.short=a5,e.mont=c5,e.edwards=u5})(cu);var Uc={},gh,Vl;function d5(){return Vl||(Vl=1,gh={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),gh}(function(r){var e=r,t=Rp,n=cu,a=Yr,o=a.assert;function f(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=f;function h(l,m){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var _=new f(m);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:_}),_}})}h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var p;try{p=d5()}catch{p=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",p]})})(Uc);var l5=cn,p5=Yr,Hh=p5.assert;function _r(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var g5=_r;_r.fromPublic=function(e,t,n){return t instanceof _r?t:new _r(e,{pub:t,pubEnc:n})};_r.fromPrivate=function(e,t,n){return t instanceof _r?t:new _r(e,{priv:t,privEnc:n})};_r.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"}};_r.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};_r.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};_r.prototype._importPrivate=function(e,t){this.priv=new l5(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)};_r.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Hh(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Hh(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)};_r.prototype.derive=function(e){return e.validate()||Hh(e.validate(),"public point not validated"),e.mul(this.priv).getX()};_r.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)};_r.prototype.verify=function(e,t){return this.ec.verify(e,t,this)};_r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var wc=cn,hu=Yr,b5=hu.assert;function Bc(r,e){if(r instanceof Bc)return r;this._importDER(r,e)||(b5(r.r&&r.s,"Signature without r or s"),this.r=new wc(r.r,16),this.s=new wc(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var v5=Bc;function m5(){this.place=0}function bh(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4||r[e.place]===0)return!1;for(var a=0,o=0,f=e.place;o<n;o++,f++)a<<=8,a|=r[f],a>>>=0;return a<=127?!1:(e.place=f,a)}function Gl(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}Bc.prototype._importDER=function(e,t){e=hu.toArray(e,t);var n=new m5;if(e[n.place++]!==48)return!1;var a=bh(e,n);if(a===!1||a+n.place!==e.length||e[n.place++]!==2)return!1;var o=bh(e,n);if(o===!1||e[n.place]&128)return!1;var f=e.slice(n.place,o+n.place);if(n.place+=o,e[n.place++]!==2)return!1;var h=bh(e,n);if(h===!1||e.length!==h+n.place||e[n.place]&128)return!1;var p=e.slice(n.place,h+n.place);if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;if(p[0]===0)if(p[1]&128)p=p.slice(1);else return!1;return this.r=new wc(f),this.s=new wc(p),this.recoveryParam=null,!0};function vh(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Bc.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=Gl(t),n=Gl(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var a=[2];vh(a,t.length),a=a.concat(t),a.push(2),vh(a,n.length);var o=a.concat(n),f=[48];return vh(f,o.length),f=f.concat(o),hu.encode(f,e)};var os=cn,a1=Z2,y5=Yr,mh=Uc,w5=Tp(),o1=y5.assert,uu=g5,zc=v5;function fi(r){if(!(this instanceof fi))return new fi(r);typeof r=="string"&&(o1(Object.prototype.hasOwnProperty.call(mh,r),"Unknown curve "+r),r=mh[r]),r instanceof mh.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var _5=fi;fi.prototype.keyPair=function(e){return new uu(this,e)};fi.prototype.keyFromPrivate=function(e,t){return uu.fromPrivate(this,e,t)};fi.prototype.keyFromPublic=function(e,t){return uu.fromPublic(this,e,t)};fi.prototype.genKeyPair=function(e){e||(e={});for(var t=new a1({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||w5(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),a=this.n.sub(new os(2));;){var o=new os(t.generate(n));if(!(o.cmp(a)>0))return o.iaddn(1),this.keyFromPrivate(o)}};fi.prototype._truncateToN=function(e,t){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};fi.prototype.sign=function(e,t,n,a){typeof n=="object"&&(a=n,n=null),a||(a={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new os(e,16));for(var o=this.n.byteLength(),f=t.getPrivate().toArray("be",o),h=e.toArray("be",o),p=new a1({hash:this.hash,entropy:f,nonce:h,pers:a.pers,persEnc:a.persEnc||"utf8"}),l=this.n.sub(new os(1)),m=0;;m++){var _=a.k?a.k(m):new os(p.generate(this.n.byteLength()));if(_=this._truncateToN(_,!0),!(_.cmpn(1)<=0||_.cmp(l)>=0)){var M=this.g.mul(_);if(!M.isInfinity()){var I=M.getX(),P=I.umod(this.n);if(P.cmpn(0)!==0){var H=_.invm(this.n).mul(P.mul(t.getPrivate()).iadd(e));if(H=H.umod(this.n),H.cmpn(0)!==0){var W=(M.getY().isOdd()?1:0)|(I.cmp(P)!==0?2:0);return a.canonical&&H.cmp(this.nh)>0&&(H=this.n.sub(H),W^=1),new zc({r:P,s:H,recoveryParam:W})}}}}}};fi.prototype.verify=function(e,t,n,a){e=this._truncateToN(new os(e,16)),n=this.keyFromPublic(n,a),t=new zc(t,"hex");var o=t.r,f=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;var h=f.invm(this.n),p=h.mul(e).umod(this.n),l=h.mul(o).umod(this.n),m;return this.curve._maxwellTrick?(m=this.g.jmulAdd(p,n.getPublic(),l),m.isInfinity()?!1:m.eqXToP(o)):(m=this.g.mulAdd(p,n.getPublic(),l),m.isInfinity()?!1:m.getX().umod(this.n).cmp(o)===0)};fi.prototype.recoverPubKey=function(r,e,t,n){o1((3&t)===t,"The recovery param is more than two bits"),e=new zc(e,n);var a=this.n,o=new os(r),f=e.r,h=e.s,p=t&1,l=t>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?f=this.curve.pointFromX(f.add(this.curve.n),p):f=this.curve.pointFromX(f,p);var m=e.r.invm(a),_=a.sub(o).mul(m).umod(a),M=h.mul(m).umod(a);return this.g.mulAdd(_,f,M)};fi.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new zc(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var a=0;a<4;a++){var o;try{o=this.recoverPubKey(r,e,a)}catch{continue}if(o.eq(t))return a}throw new Error("Unable to find valid recovery factor")};var ja=Yr,c1=ja.assert,Jl=ja.parseBytes,Js=ja.cachedProperty;function fr(r,e){this.eddsa=r,this._secret=Jl(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Jl(e.pub)}fr.fromPublic=function(e,t){return t instanceof fr?t:new fr(e,{pub:t})};fr.fromSecret=function(e,t){return t instanceof fr?t:new fr(e,{secret:t})};fr.prototype.secret=function(){return this._secret};Js(fr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Js(fr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Js(fr,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,a=t.slice(0,e.encodingLength);return a[0]&=248,a[n]&=127,a[n]|=64,a});Js(fr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Js(fr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Js(fr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});fr.prototype.sign=function(e){return c1(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};fr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)};fr.prototype.getSecret=function(e){return c1(this._secret,"KeyPair is public only"),ja.encode(this.secret(),e)};fr.prototype.getPublic=function(e){return ja.encode(this.pubBytes(),e)};var E5=fr,S5=cn,Hc=Yr,Yl=Hc.assert,Kc=Hc.cachedProperty,x5=Hc.parseBytes;function ds(r,e){this.eddsa=r,typeof e!="object"&&(e=x5(e)),Array.isArray(e)&&(Yl(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),Yl(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof S5&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Kc(ds,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Kc(ds,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Kc(ds,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Kc(ds,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});ds.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};ds.prototype.toHex=function(){return Hc.encode(this.toBytes(),"hex").toUpperCase()};var I5=ds,D5=Rp,A5=Uc,ks=Yr,M5=ks.assert,f1=ks.parseBytes,h1=E5,Xl=I5;function qr(r){if(M5(r==="ed25519","only tested with ed25519 so far"),!(this instanceof qr))return new qr(r);r=A5[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=D5.sha512}var P5=qr;qr.prototype.sign=function(e,t){e=f1(e);var n=this.keyFromSecret(t),a=this.hashInt(n.messagePrefix(),e),o=this.g.mul(a),f=this.encodePoint(o),h=this.hashInt(f,n.pubBytes(),e).mul(n.priv()),p=a.add(h).umod(this.curve.n);return this.makeSignature({R:o,S:p,Rencoded:f})};qr.prototype.verify=function(e,t,n){if(e=f1(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var a=this.keyFromPublic(n),o=this.hashInt(t.Rencoded(),a.pubBytes(),e),f=this.g.mul(t.S()),h=t.R().add(a.pub().mul(o));return h.eq(f)};qr.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return ks.intFromLE(e.digest()).umod(this.curve.n)};qr.prototype.keyFromPublic=function(e){return h1.fromPublic(this,e)};qr.prototype.keyFromSecret=function(e){return h1.fromSecret(this,e)};qr.prototype.makeSignature=function(e){return e instanceof Xl?e:new Xl(this,e)};qr.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t};qr.prototype.decodePoint=function(e){e=ks.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),a=(e[t]&128)!==0,o=ks.intFromLE(n);return this.curve.pointFromY(o,a)};qr.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};qr.prototype.decodeInt=function(e){return ks.intFromLE(e)};qr.prototype.isPoint=function(e){return e instanceof this.pointClass};(function(r){var e=r;e.version=r5.version,e.utils=Yr,e.rand=Tp(),e.curve=cu,e.curves=Uc,e.ec=_5,e.eddsa=P5})(i1);var du={},u1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=et,t=Jr;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var n=function(){function h(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.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},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},h.prototype.update=function(p,l){if(l===void 0&&(l=p.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var m=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&l>0;)this._buffer[this._bufferLength++]=p[m++],l--;this._bufferLength===this.blockSize&&(o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(m=o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,p,m,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=p[m++],l--;return this},h.prototype.finish=function(p){if(!this._finished){var l=this._bytesHashed,m=this._bufferLength,_=l/536870912|0,M=l<<3,I=l%128<112?128:256;this._buffer[m]=128;for(var P=m+1;P<I-8;P++)this._buffer[P]=0;e.writeUint32BE(_,this._buffer,I-8),e.writeUint32BE(M,this._buffer,I-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,I),this._finished=!0}for(var P=0;P<this.digestLength/8;P++)e.writeUint32BE(this._stateHi[P],p,P*8),e.writeUint32BE(this._stateLo[P],p,P*8+4);return this},h.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},h.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}},h.prototype.restoreState=function(p){return this._stateHi.set(p.stateHi),this._stateLo.set(p.stateLo),this._bufferLength=p.bufferLength,p.buffer&&this._buffer.set(p.buffer),this._bytesHashed=p.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(p){t.wipe(p.stateHi),t.wipe(p.stateLo),p.buffer&&t.wipe(p.buffer),p.bufferLength=0,p.bytesHashed=0},h}();r.SHA512=n;var a=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(h,p,l,m,_,M,I){for(var P=l[0],H=l[1],W=l[2],J=l[3],q=l[4],V=l[5],L=l[6],U=l[7],z=m[0],b=m[1],T=m[2],re=m[3],de=m[4],$=m[5],u=m[6],y=m[7],w,E,O,N,R,x,d,D;I>=128;){for(var fe=0;fe<16;fe++){var ee=8*fe+M;h[fe]=e.readUint32BE(_,ee),p[fe]=e.readUint32BE(_,ee+4)}for(var fe=0;fe<80;fe++){var he=P,ne=H,ge=W,G=J,Z=q,j=V,v=L,K=U,oe=z,le=b,Te=T,Ae=re,Pe=de,He=$,Fe=u,qe=y;if(w=U,E=y,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=(q>>>14|de<<32-14)^(q>>>18|de<<32-18)^(de>>>41-32|q<<32-(41-32)),E=(de>>>14|q<<32-14)^(de>>>18|q<<32-18)^(q>>>41-32|de<<32-(41-32)),R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,w=q&V^~q&L,E=de&$^~de&u,R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,w=a[fe*2],E=a[fe*2+1],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,w=h[fe%16],E=p[fe%16],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,O=d&65535|D<<16,N=R&65535|x<<16,w=O,E=N,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=(P>>>28|z<<32-28)^(z>>>34-32|P<<32-(34-32))^(z>>>39-32|P<<32-(39-32)),E=(z>>>28|P<<32-28)^(P>>>34-32|z<<32-(34-32))^(P>>>39-32|z<<32-(39-32)),R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,w=P&H^P&W^H&W,E=z&b^z&T^b&T,R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,K=d&65535|D<<16,qe=R&65535|x<<16,w=G,E=Ae,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=O,E=N,R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,G=d&65535|D<<16,Ae=R&65535|x<<16,H=he,W=ne,J=ge,q=G,V=Z,L=j,U=v,P=K,b=oe,T=le,re=Te,de=Ae,$=Pe,u=He,y=Fe,z=qe,fe%16===15)for(var ee=0;ee<16;ee++)w=h[ee],E=p[ee],R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=h[(ee+9)%16],E=p[(ee+9)%16],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,O=h[(ee+1)%16],N=p[(ee+1)%16],w=(O>>>1|N<<32-1)^(O>>>8|N<<32-8)^O>>>7,E=(N>>>1|O<<32-1)^(N>>>8|O<<32-8)^(N>>>7|O<<32-7),R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,O=h[(ee+14)%16],N=p[(ee+14)%16],w=(O>>>19|N<<32-19)^(N>>>61-32|O<<32-(61-32))^O>>>6,E=(N>>>19|O<<32-19)^(O>>>61-32|N<<32-(61-32))^(N>>>6|O<<32-6),R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,h[ee]=d&65535|D<<16,p[ee]=R&65535|x<<16}w=P,E=z,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[0],E=m[0],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[0]=P=d&65535|D<<16,m[0]=z=R&65535|x<<16,w=H,E=b,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[1],E=m[1],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[1]=H=d&65535|D<<16,m[1]=b=R&65535|x<<16,w=W,E=T,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[2],E=m[2],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[2]=W=d&65535|D<<16,m[2]=T=R&65535|x<<16,w=J,E=re,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[3],E=m[3],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[3]=J=d&65535|D<<16,m[3]=re=R&65535|x<<16,w=q,E=de,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[4],E=m[4],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[4]=q=d&65535|D<<16,m[4]=de=R&65535|x<<16,w=V,E=$,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[5],E=m[5],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[5]=V=d&65535|D<<16,m[5]=$=R&65535|x<<16,w=L,E=u,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[6],E=m[6],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[6]=L=d&65535|D<<16,m[6]=u=R&65535|x<<16,w=U,E=y,R=E&65535,x=E>>>16,d=w&65535,D=w>>>16,w=l[7],E=m[7],R+=E&65535,x+=E>>>16,d+=w&65535,D+=w>>>16,x+=R>>>16,d+=x>>>16,D+=d>>>16,l[7]=U=d&65535|D<<16,m[7]=y=R&65535|x<<16,M+=128,I-=128}return M}function f(h){var p=new n;p.update(h);var l=p.digest();return p.clean(),l}r.hash=f})(u1);(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=Dn,t=u1,n=Jr;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function a(G){const Z=new Float64Array(16);if(G)for(let j=0;j<G.length;j++)Z[j]=G[j];return Z}const o=new Uint8Array(32);o[0]=9;const f=a(),h=a([1]),p=a([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=a([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=a([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),_=a([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),M=a([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function I(G,Z){for(let j=0;j<16;j++)G[j]=Z[j]|0}function P(G){let Z=1;for(let j=0;j<16;j++){let v=G[j]+Z+65535;Z=Math.floor(v/65536),G[j]=v-Z*65536}G[0]+=Z-1+37*(Z-1)}function H(G,Z,j){const v=~(j-1);for(let K=0;K<16;K++){const oe=v&(G[K]^Z[K]);G[K]^=oe,Z[K]^=oe}}function W(G,Z){const j=a(),v=a();for(let K=0;K<16;K++)v[K]=Z[K];P(v),P(v),P(v);for(let K=0;K<2;K++){j[0]=v[0]-65517;for(let le=1;le<15;le++)j[le]=v[le]-65535-(j[le-1]>>16&1),j[le-1]&=65535;j[15]=v[15]-32767-(j[14]>>16&1);const oe=j[15]>>16&1;j[14]&=65535,H(v,j,1-oe)}for(let K=0;K<16;K++)G[2*K]=v[K]&255,G[2*K+1]=v[K]>>8}function J(G,Z){let j=0;for(let v=0;v<32;v++)j|=G[v]^Z[v];return(1&j-1>>>8)-1}function q(G,Z){const j=new Uint8Array(32),v=new Uint8Array(32);return W(j,G),W(v,Z),J(j,v)}function V(G){const Z=new Uint8Array(32);return W(Z,G),Z[0]&1}function L(G,Z){for(let j=0;j<16;j++)G[j]=Z[2*j]+(Z[2*j+1]<<8);G[15]&=32767}function U(G,Z,j){for(let v=0;v<16;v++)G[v]=Z[v]+j[v]}function z(G,Z,j){for(let v=0;v<16;v++)G[v]=Z[v]-j[v]}function b(G,Z,j){let v,K,oe=0,le=0,Te=0,Ae=0,Pe=0,He=0,Fe=0,qe=0,je=0,ye=0,Ie=0,Ue=0,De=0,Se=0,Be=0,me=0,xe=0,Ze=0,_e=0,Oe=0,ot=0,Ce=0,Re=0,ft=0,lt=0,bt=0,Br=0,pt=0,wt=0,li=0,Dt=0,ke=j[0],Mt=j[1],We=j[2],Ve=j[3],Tt=j[4],ze=j[5],tt=j[6],Kt=j[7],Ge=j[8],rt=j[9],Ft=j[10],Qe=j[11],Je=j[12],St=j[13],it=j[14],nt=j[15];v=Z[0],oe+=v*ke,le+=v*Mt,Te+=v*We,Ae+=v*Ve,Pe+=v*Tt,He+=v*ze,Fe+=v*tt,qe+=v*Kt,je+=v*Ge,ye+=v*rt,Ie+=v*Ft,Ue+=v*Qe,De+=v*Je,Se+=v*St,Be+=v*it,me+=v*nt,v=Z[1],le+=v*ke,Te+=v*Mt,Ae+=v*We,Pe+=v*Ve,He+=v*Tt,Fe+=v*ze,qe+=v*tt,je+=v*Kt,ye+=v*Ge,Ie+=v*rt,Ue+=v*Ft,De+=v*Qe,Se+=v*Je,Be+=v*St,me+=v*it,xe+=v*nt,v=Z[2],Te+=v*ke,Ae+=v*Mt,Pe+=v*We,He+=v*Ve,Fe+=v*Tt,qe+=v*ze,je+=v*tt,ye+=v*Kt,Ie+=v*Ge,Ue+=v*rt,De+=v*Ft,Se+=v*Qe,Be+=v*Je,me+=v*St,xe+=v*it,Ze+=v*nt,v=Z[3],Ae+=v*ke,Pe+=v*Mt,He+=v*We,Fe+=v*Ve,qe+=v*Tt,je+=v*ze,ye+=v*tt,Ie+=v*Kt,Ue+=v*Ge,De+=v*rt,Se+=v*Ft,Be+=v*Qe,me+=v*Je,xe+=v*St,Ze+=v*it,_e+=v*nt,v=Z[4],Pe+=v*ke,He+=v*Mt,Fe+=v*We,qe+=v*Ve,je+=v*Tt,ye+=v*ze,Ie+=v*tt,Ue+=v*Kt,De+=v*Ge,Se+=v*rt,Be+=v*Ft,me+=v*Qe,xe+=v*Je,Ze+=v*St,_e+=v*it,Oe+=v*nt,v=Z[5],He+=v*ke,Fe+=v*Mt,qe+=v*We,je+=v*Ve,ye+=v*Tt,Ie+=v*ze,Ue+=v*tt,De+=v*Kt,Se+=v*Ge,Be+=v*rt,me+=v*Ft,xe+=v*Qe,Ze+=v*Je,_e+=v*St,Oe+=v*it,ot+=v*nt,v=Z[6],Fe+=v*ke,qe+=v*Mt,je+=v*We,ye+=v*Ve,Ie+=v*Tt,Ue+=v*ze,De+=v*tt,Se+=v*Kt,Be+=v*Ge,me+=v*rt,xe+=v*Ft,Ze+=v*Qe,_e+=v*Je,Oe+=v*St,ot+=v*it,Ce+=v*nt,v=Z[7],qe+=v*ke,je+=v*Mt,ye+=v*We,Ie+=v*Ve,Ue+=v*Tt,De+=v*ze,Se+=v*tt,Be+=v*Kt,me+=v*Ge,xe+=v*rt,Ze+=v*Ft,_e+=v*Qe,Oe+=v*Je,ot+=v*St,Ce+=v*it,Re+=v*nt,v=Z[8],je+=v*ke,ye+=v*Mt,Ie+=v*We,Ue+=v*Ve,De+=v*Tt,Se+=v*ze,Be+=v*tt,me+=v*Kt,xe+=v*Ge,Ze+=v*rt,_e+=v*Ft,Oe+=v*Qe,ot+=v*Je,Ce+=v*St,Re+=v*it,ft+=v*nt,v=Z[9],ye+=v*ke,Ie+=v*Mt,Ue+=v*We,De+=v*Ve,Se+=v*Tt,Be+=v*ze,me+=v*tt,xe+=v*Kt,Ze+=v*Ge,_e+=v*rt,Oe+=v*Ft,ot+=v*Qe,Ce+=v*Je,Re+=v*St,ft+=v*it,lt+=v*nt,v=Z[10],Ie+=v*ke,Ue+=v*Mt,De+=v*We,Se+=v*Ve,Be+=v*Tt,me+=v*ze,xe+=v*tt,Ze+=v*Kt,_e+=v*Ge,Oe+=v*rt,ot+=v*Ft,Ce+=v*Qe,Re+=v*Je,ft+=v*St,lt+=v*it,bt+=v*nt,v=Z[11],Ue+=v*ke,De+=v*Mt,Se+=v*We,Be+=v*Ve,me+=v*Tt,xe+=v*ze,Ze+=v*tt,_e+=v*Kt,Oe+=v*Ge,ot+=v*rt,Ce+=v*Ft,Re+=v*Qe,ft+=v*Je,lt+=v*St,bt+=v*it,Br+=v*nt,v=Z[12],De+=v*ke,Se+=v*Mt,Be+=v*We,me+=v*Ve,xe+=v*Tt,Ze+=v*ze,_e+=v*tt,Oe+=v*Kt,ot+=v*Ge,Ce+=v*rt,Re+=v*Ft,ft+=v*Qe,lt+=v*Je,bt+=v*St,Br+=v*it,pt+=v*nt,v=Z[13],Se+=v*ke,Be+=v*Mt,me+=v*We,xe+=v*Ve,Ze+=v*Tt,_e+=v*ze,Oe+=v*tt,ot+=v*Kt,Ce+=v*Ge,Re+=v*rt,ft+=v*Ft,lt+=v*Qe,bt+=v*Je,Br+=v*St,pt+=v*it,wt+=v*nt,v=Z[14],Be+=v*ke,me+=v*Mt,xe+=v*We,Ze+=v*Ve,_e+=v*Tt,Oe+=v*ze,ot+=v*tt,Ce+=v*Kt,Re+=v*Ge,ft+=v*rt,lt+=v*Ft,bt+=v*Qe,Br+=v*Je,pt+=v*St,wt+=v*it,li+=v*nt,v=Z[15],me+=v*ke,xe+=v*Mt,Ze+=v*We,_e+=v*Ve,Oe+=v*Tt,ot+=v*ze,Ce+=v*tt,Re+=v*Kt,ft+=v*Ge,lt+=v*rt,bt+=v*Ft,Br+=v*Qe,pt+=v*Je,wt+=v*St,li+=v*it,Dt+=v*nt,oe+=38*xe,le+=38*Ze,Te+=38*_e,Ae+=38*Oe,Pe+=38*ot,He+=38*Ce,Fe+=38*Re,qe+=38*ft,je+=38*lt,ye+=38*bt,Ie+=38*Br,Ue+=38*pt,De+=38*wt,Se+=38*li,Be+=38*Dt,K=1,v=oe+K+65535,K=Math.floor(v/65536),oe=v-K*65536,v=le+K+65535,K=Math.floor(v/65536),le=v-K*65536,v=Te+K+65535,K=Math.floor(v/65536),Te=v-K*65536,v=Ae+K+65535,K=Math.floor(v/65536),Ae=v-K*65536,v=Pe+K+65535,K=Math.floor(v/65536),Pe=v-K*65536,v=He+K+65535,K=Math.floor(v/65536),He=v-K*65536,v=Fe+K+65535,K=Math.floor(v/65536),Fe=v-K*65536,v=qe+K+65535,K=Math.floor(v/65536),qe=v-K*65536,v=je+K+65535,K=Math.floor(v/65536),je=v-K*65536,v=ye+K+65535,K=Math.floor(v/65536),ye=v-K*65536,v=Ie+K+65535,K=Math.floor(v/65536),Ie=v-K*65536,v=Ue+K+65535,K=Math.floor(v/65536),Ue=v-K*65536,v=De+K+65535,K=Math.floor(v/65536),De=v-K*65536,v=Se+K+65535,K=Math.floor(v/65536),Se=v-K*65536,v=Be+K+65535,K=Math.floor(v/65536),Be=v-K*65536,v=me+K+65535,K=Math.floor(v/65536),me=v-K*65536,oe+=K-1+37*(K-1),K=1,v=oe+K+65535,K=Math.floor(v/65536),oe=v-K*65536,v=le+K+65535,K=Math.floor(v/65536),le=v-K*65536,v=Te+K+65535,K=Math.floor(v/65536),Te=v-K*65536,v=Ae+K+65535,K=Math.floor(v/65536),Ae=v-K*65536,v=Pe+K+65535,K=Math.floor(v/65536),Pe=v-K*65536,v=He+K+65535,K=Math.floor(v/65536),He=v-K*65536,v=Fe+K+65535,K=Math.floor(v/65536),Fe=v-K*65536,v=qe+K+65535,K=Math.floor(v/65536),qe=v-K*65536,v=je+K+65535,K=Math.floor(v/65536),je=v-K*65536,v=ye+K+65535,K=Math.floor(v/65536),ye=v-K*65536,v=Ie+K+65535,K=Math.floor(v/65536),Ie=v-K*65536,v=Ue+K+65535,K=Math.floor(v/65536),Ue=v-K*65536,v=De+K+65535,K=Math.floor(v/65536),De=v-K*65536,v=Se+K+65535,K=Math.floor(v/65536),Se=v-K*65536,v=Be+K+65535,K=Math.floor(v/65536),Be=v-K*65536,v=me+K+65535,K=Math.floor(v/65536),me=v-K*65536,oe+=K-1+37*(K-1),G[0]=oe,G[1]=le,G[2]=Te,G[3]=Ae,G[4]=Pe,G[5]=He,G[6]=Fe,G[7]=qe,G[8]=je,G[9]=ye,G[10]=Ie,G[11]=Ue,G[12]=De,G[13]=Se,G[14]=Be,G[15]=me}function T(G,Z){b(G,Z,Z)}function re(G,Z){const j=a();let v;for(v=0;v<16;v++)j[v]=Z[v];for(v=253;v>=0;v--)T(j,j),v!==2&&v!==4&&b(j,j,Z);for(v=0;v<16;v++)G[v]=j[v]}function de(G,Z){const j=a();let v;for(v=0;v<16;v++)j[v]=Z[v];for(v=250;v>=0;v--)T(j,j),v!==1&&b(j,j,Z);for(v=0;v<16;v++)G[v]=j[v]}function $(G,Z){const j=a(),v=a(),K=a(),oe=a(),le=a(),Te=a(),Ae=a(),Pe=a(),He=a();z(j,G[1],G[0]),z(He,Z[1],Z[0]),b(j,j,He),U(v,G[0],G[1]),U(He,Z[0],Z[1]),b(v,v,He),b(K,G[3],Z[3]),b(K,K,l),b(oe,G[2],Z[2]),U(oe,oe,oe),z(le,v,j),z(Te,oe,K),U(Ae,oe,K),U(Pe,v,j),b(G[0],le,Te),b(G[1],Pe,Ae),b(G[2],Ae,Te),b(G[3],le,Pe)}function u(G,Z,j){for(let v=0;v<4;v++)H(G[v],Z[v],j)}function y(G,Z){const j=a(),v=a(),K=a();re(K,Z[2]),b(j,Z[0],K),b(v,Z[1],K),W(G,v),G[31]^=V(j)<<7}function w(G,Z,j){I(G[0],f),I(G[1],h),I(G[2],h),I(G[3],f);for(let v=255;v>=0;--v){const K=j[v/8|0]>>(v&7)&1;u(G,Z,K),$(Z,G),$(G,G),u(G,Z,K)}}function E(G,Z){const j=[a(),a(),a(),a()];I(j[0],m),I(j[1],_),I(j[2],h),b(j[3],m,_),w(G,j,Z)}function O(G){if(G.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const Z=(0,t.hash)(G);Z[0]&=248,Z[31]&=127,Z[31]|=64;const j=new Uint8Array(32),v=[a(),a(),a(),a()];E(v,Z),y(j,v);const K=new Uint8Array(64);return K.set(G),K.set(j,32),{publicKey:j,secretKey:K}}r.generateKeyPairFromSeed=O;function N(G){const Z=(0,e.randomBytes)(32,G),j=O(Z);return(0,n.wipe)(Z),j}r.generateKeyPair=N;function R(G){if(G.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(G.subarray(32))}r.extractPublicKeyFromSecretKey=R;const x=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(G,Z){let j,v,K,oe;for(v=63;v>=32;--v){for(j=0,K=v-32,oe=v-12;K<oe;++K)Z[K]+=j-16*Z[v]*x[K-(v-32)],j=Math.floor((Z[K]+128)/256),Z[K]-=j*256;Z[K]+=j,Z[v]=0}for(j=0,K=0;K<32;K++)Z[K]+=j-(Z[31]>>4)*x[K],j=Z[K]>>8,Z[K]&=255;for(K=0;K<32;K++)Z[K]-=j*x[K];for(v=0;v<32;v++)Z[v+1]+=Z[v]>>8,G[v]=Z[v]&255}function D(G){const Z=new Float64Array(64);for(let j=0;j<64;j++)Z[j]=G[j];for(let j=0;j<64;j++)G[j]=0;d(G,Z)}function fe(G,Z){const j=new Float64Array(64),v=[a(),a(),a(),a()],K=(0,t.hash)(G.subarray(0,32));K[0]&=248,K[31]&=127,K[31]|=64;const oe=new Uint8Array(64);oe.set(K.subarray(32),32);const le=new t.SHA512;le.update(oe.subarray(32)),le.update(Z);const Te=le.digest();le.clean(),D(Te),E(v,Te),y(oe,v),le.reset(),le.update(oe.subarray(0,32)),le.update(G.subarray(32)),le.update(Z);const Ae=le.digest();D(Ae);for(let Pe=0;Pe<32;Pe++)j[Pe]=Te[Pe];for(let Pe=0;Pe<32;Pe++)for(let He=0;He<32;He++)j[Pe+He]+=Ae[Pe]*K[He];return d(oe.subarray(32),j),oe}r.sign=fe;function ee(G,Z){const j=a(),v=a(),K=a(),oe=a(),le=a(),Te=a(),Ae=a();return I(G[2],h),L(G[1],Z),T(K,G[1]),b(oe,K,p),z(K,K,G[2]),U(oe,G[2],oe),T(le,oe),T(Te,le),b(Ae,Te,le),b(j,Ae,K),b(j,j,oe),de(j,j),b(j,j,K),b(j,j,oe),b(j,j,oe),b(G[0],j,oe),T(v,G[0]),b(v,v,oe),q(v,K)&&b(G[0],G[0],M),T(v,G[0]),b(v,v,oe),q(v,K)?-1:(V(G[0])===Z[31]>>7&&z(G[0],f,G[0]),b(G[3],G[0],G[1]),0)}function he(G,Z,j){const v=new Uint8Array(32),K=[a(),a(),a(),a()],oe=[a(),a(),a(),a()];if(j.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(ee(oe,G))return!1;const le=new t.SHA512;le.update(j.subarray(0,32)),le.update(G),le.update(Z);const Te=le.digest();return D(Te),w(K,oe,Te),E(oe,j.subarray(32)),$(K,oe),y(v,K),!J(j,v)}r.verify=he;function ne(G){let Z=[a(),a(),a(),a()];if(ee(Z,G))throw new Error("Ed25519: invalid public key");let j=a(),v=a(),K=Z[1];U(j,h,K),z(v,h,K),re(v,v),b(j,j,v);let oe=new Uint8Array(32);return W(oe,j),oe}r.convertPublicKeyToX25519=ne;function ge(G){const Z=(0,t.hash)(G.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const j=new Uint8Array(Z.subarray(0,32));return(0,n.wipe)(Z),j}r.convertSecretKeyToX25519=ge})(du);const O5="EdDSA",C5="JWT",_c=".",jc="base64url",d1="utf8",l1="utf8",R5=":",T5="did",N5="key",Zl="base58btc",$5="z",L5="K36",F5=32,q5=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),U5=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(n,a)=>typeof a=="string"&&a.match(/^\d+n$/)?BigInt(a.substring(0,a.length-1)):a)};function cs(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return U5(r)}catch{return r}}function on(r){return typeof r=="string"?r:q5(r)||""}function Ql(r){return cs(cr(or(r,jc),d1))}function Ec(r){return cr(or(on(r),d1),jc)}function p1(r){const e=or(L5,Zl),t=$5+cr(fc([e,r]),Zl);return[T5,N5,t].join(R5)}function B5(r){return cr(r,jc)}function z5(r){return or(r,jc)}function H5(r){return or([Ec(r.header),Ec(r.payload)].join(_c),l1)}function K5(r){return[Ec(r.header),Ec(r.payload),B5(r.signature)].join(_c)}function Kh(r){const e=r.split(_c),t=Ql(e[0]),n=Ql(e[1]),a=z5(e[2]),o=or(e.slice(0,2).join(_c),l1);return{header:t,payload:n,signature:a,data:o}}function e0(r=Dn.randomBytes(F5)){return du.generateKeyPairFromSeed(r)}async function j5(r,e,t,n,a=be.fromMiliseconds(Date.now())){const o={alg:O5,typ:C5},f=p1(n.publicKey),h=a+t,p={iss:f,sub:r,aud:e,iat:a,exp:h},l=H5({header:o,payload:p}),m=du.sign(n.secretKey,l);return K5({header:o,payload:p,signature:m})}const k5={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"}},W5=":";function Ks(r){const[e,t]=r.split(W5);return{namespace:e,reference:t}}function t0(r,e=[]){const t=[];return Object.keys(r).forEach(n=>{if(e.length&&!e.includes(n))return;const a=r[n];t.push(...a.accounts)}),t}function g1(r,e){return r.includes(":")?[r]:e.chains||[]}var V5=Object.defineProperty,r0=Object.getOwnPropertySymbols,G5=Object.prototype.hasOwnProperty,J5=Object.prototype.propertyIsEnumerable,i0=(r,e,t)=>e in r?V5(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,n0=(r,e)=>{for(var t in e||(e={}))G5.call(e,t)&&i0(r,t,e[t]);if(r0)for(var t of r0(e))J5.call(e,t)&&i0(r,t,e[t]);return r};const Y5="ReactNative",Gr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},X5="js";function Sc(){return typeof Ei<"u"&&typeof Ei.versions<"u"&&typeof Ei.versions.node<"u"}function Ys(){return!Ua()&&!!ru()&&navigator.product===Y5}function ka(){return!Sc()&&!!ru()&&!!Ua()}function Wa(){return Ys()?Gr.reactNative:Sc()?Gr.node:ka()?Gr.browser:Gr.unknown}function Z5(){var r;try{return Ys()&&typeof ht<"u"&&typeof(ht==null?void 0:ht.Application)<"u"?(r=ht.Application)==null?void 0:r.applicationId:void 0}catch{return}}function Q5(r,e){let t=Ra.parse(r);return t=n0(n0({},t),e),r=Ra.stringify(t),r}function b1(){return Up()||{name:"",description:"",url:"",icons:[""]}}function e8(){if(Wa()===Gr.reactNative&&typeof ht<"u"&&typeof(ht==null?void 0:ht.Platform)<"u"){const{OS:t,Version:n}=ht.Platform;return[t,n].join("-")}const r=h6();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function t8(){var r;const e=Wa();return e===Gr.browser?[e,((r=qp())==null?void 0:r.host)||"unknown"].join(":"):e}function v1(r,e,t){const n=e8(),a=t8();return[[r,e].join("-"),[X5,t].join("-"),n,a].join("/")}function r8({protocol:r,version:e,relayUrl:t,sdkVersion:n,auth:a,projectId:o,useOnCloseEvent:f,bundleId:h}){const p=t.split("?"),l=v1(r,e,n),m={auth:a,ua:l,projectId:o,useOnCloseEvent:f||void 0,origin:h||void 0},_=Q5(p[1]||"",m);return p[0]+"?"+_}function ss(r,e){return r.filter(t=>e.includes(t)).length===r.length}function m1(r){return Object.fromEntries(r.entries())}function y1(r){return new Map(Object.entries(r))}function is(r=be.FIVE_MINUTES,e){const t=be.toMiliseconds(r||be.FIVE_MINUTES);let n,a,o;return{resolve:f=>{o&&n&&(clearTimeout(o),n(f))},reject:f=>{o&&a&&(clearTimeout(o),a(f))},done:()=>new Promise((f,h)=>{o=setTimeout(()=>{h(new Error(e))},t),n=f,a=h})}}function js(r,e,t){return new Promise(async(n,a)=>{const o=setTimeout(()=>a(new Error(t)),e);try{const f=await r;n(f)}catch(f){a(f)}clearTimeout(o)})}function w1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function i8(r){return w1("topic",r)}function n8(r){return w1("id",r)}function _1(r){const[e,t]=r.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")n.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))n.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return n}function rr(r,e){return be.fromMiliseconds((e||Date.now())+be.toMiliseconds(r))}function _n(r){return Date.now()>=be.toMiliseconds(r)}function dt(r,e){return`${r}${e?`:${e}`:""}`}function hc(r=[],e=[]){return[...new Set([...r,...e])]}async function s8({id:r,topic:e,wcDeepLink:t}){var n;try{if(!t)return;const a=typeof t=="string"?JSON.parse(t):t,o=a==null?void 0:a.href;if(typeof o!="string")return;const f=a8(o,r,e),h=Wa();if(h===Gr.browser){if(!((n=Ua())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}f.startsWith("https://")||f.startsWith("http://")?window.open(f,"_blank","noreferrer noopener"):window.open(f,c8()?"_blank":"_self","noreferrer noopener")}else h===Gr.reactNative&&typeof(ht==null?void 0:ht.Linking)<"u"&&await ht.Linking.openURL(f)}catch(a){console.error(a)}}function a8(r,e,t){const n=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let a=`${r}`;if(r.startsWith("https://t.me")){const o=r.includes("?")?"&startapp=":"?startapp=";a=`${a}${o}${f8(n,!0)}`}else a=`${a}/wc?${n}`;return a}async function o8(r,e){let t="";try{if(ka()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(n){console.error(n)}return t}function s0(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),n=t.indexOf(e);return t[n+2]}function a0(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function lu(){return typeof Ei<"u"&&{}.IS_VITEST==="true"}function c8(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function f8(r,e=!1){const t=ci.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function E1(r){return ci.from(r,"base64").toString("utf-8")}const h8="https://rpc.walletconnect.org/v1";async function u8(r,e,t,n,a,o){switch(t.t){case"eip191":return d8(r,e,t.s);case"eip1271":return await l8(r,e,t.s,n,a,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function d8(r,e,t){return Q2($p(e),t).toLowerCase()===r.toLowerCase()}async function l8(r,e,t,n,a,o){const f=Ks(n);if(!f.namespace||!f.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const h="0x1626ba7e",p="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",m=t.substring(2),_=$p(e).substring(2),M=h+_+p+l+m,I=await fetch(`${o||h8}/?chainId=${n}&projectId=${a}`,{method:"POST",body:JSON.stringify({id:p8(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:M},"latest"]})}),{result:P}=await I.json();return P?P.slice(0,h.length).toLowerCase()===h.toLowerCase():!1}catch(h){return console.error("isValidEip1271Signature: ",h),!1}}function p8(){return Date.now()+Math.floor(Math.random()*1e3)}var g8=Object.defineProperty,b8=Object.defineProperties,v8=Object.getOwnPropertyDescriptors,o0=Object.getOwnPropertySymbols,m8=Object.prototype.hasOwnProperty,y8=Object.prototype.propertyIsEnumerable,c0=(r,e,t)=>e in r?g8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,w8=(r,e)=>{for(var t in e||(e={}))m8.call(e,t)&&c0(r,t,e[t]);if(o0)for(var t of o0(e))y8.call(e,t)&&c0(r,t,e[t]);return r},_8=(r,e)=>b8(r,v8(e));const E8="did:pkh:",pu=r=>r==null?void 0:r.split(":"),S8=r=>{const e=r&&pu(r);if(e)return r.includes(E8)?e[3]:e[1]},jh=r=>{const e=r&&pu(r);if(e)return e[2]+":"+e[3]},xc=r=>{const e=r&&pu(r);if(e)return e.pop()};async function f0(r){const{cacao:e,projectId:t}=r,{s:n,p:a}=e,o=S1(a,a.iss),f=xc(a.iss);return await u8(f,o,n,jh(a.iss),t)}const S1=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,n=xc(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let a=r.statement||void 0;const o=`URI: ${r.aud||r.uri}`,f=`Version: ${r.version}`,h=`Chain ID: ${S8(e)}`,p=`Nonce: ${r.nonce}`,l=`Issued At: ${r.iat}`,m=r.exp?`Expiration Time: ${r.exp}`:void 0,_=r.nbf?`Not Before: ${r.nbf}`:void 0,M=r.requestId?`Request ID: ${r.requestId}`:void 0,I=r.resources?`Resources:${r.resources.map(H=>`
|
|
16
|
+
- ${H}`).join("")}`:void 0,P=uc(r.resources);if(P){const H=Ta(P);a=R8(a,H)}return[t,n,"",a,"",o,f,h,p,l,m,_,M,I].filter(H=>H!=null).join(`
|
|
17
|
+
`)};function x8(r){return ci.from(JSON.stringify(r)).toString("base64")}function I8(r){return JSON.parse(ci.from(r,"base64").toString("utf-8"))}function fs(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const n=r.att[t];if(Array.isArray(n))throw new Error(`Resource must be an object: ${t}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(n).forEach(a=>{const o=n[a];if(!Array.isArray(o))throw new Error(`Ability limits ${a} must be an array of objects, found: ${o}`);if(!o.length)throw new Error(`Value of ${a} is empty array, must be an array with objects`);o.forEach(f=>{if(typeof f!="object")throw new Error(`Ability limits (${a}) must be an array of objects, found: ${f}`)})})})}function D8(r,e,t,n={}){return t==null||t.sort((a,o)=>a.localeCompare(o)),{att:{[r]:A8(e,t,n)}}}function A8(r,e,t={}){e=e==null?void 0:e.sort((a,o)=>a.localeCompare(o));const n=e.map(a=>({[`${r}/${a}`]:[t]}));return Object.assign({},...n)}function x1(r){return fs(r),`urn:recap:${x8(r).replace(/=/g,"")}`}function Ta(r){const e=I8(r.replace("urn:recap:",""));return fs(e),e}function M8(r,e,t){const n=D8(r,e,t);return x1(n)}function P8(r){return r&&r.includes("urn:recap:")}function O8(r,e){const t=Ta(r),n=Ta(e),a=C8(t,n);return x1(a)}function C8(r,e){fs(r),fs(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((a,o)=>a.localeCompare(o)),n={att:{}};return t.forEach(a=>{var o,f;Object.keys(((o=r.att)==null?void 0:o[a])||{}).concat(Object.keys(((f=e.att)==null?void 0:f[a])||{})).sort((h,p)=>h.localeCompare(p)).forEach(h=>{var p,l;n.att[a]=_8(w8({},n.att[a]),{[h]:((p=r.att[a])==null?void 0:p[h])||((l=e.att[a])==null?void 0:l[h])})})}),n}function R8(r="",e){fs(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const n=[];let a=0;Object.keys(e.att).forEach(h=>{const p=Object.keys(e.att[h]).map(_=>({ability:_.split("/")[0],action:_.split("/")[1]}));p.sort((_,M)=>_.action.localeCompare(M.action));const l={};p.forEach(_=>{l[_.ability]||(l[_.ability]=[]),l[_.ability].push(_.action)});const m=Object.keys(l).map(_=>(a++,`(${a}) '${_}': '${l[_].join("', '")}' for '${h}'.`));n.push(m.join(", ").replace(".,","."))});const o=n.join(" "),f=`${t}${o}`;return`${r?r+" ":""}${f}`}function h0(r){var e;const t=Ta(r);fs(t);const n=(e=t.att)==null?void 0:e.eip155;return n?Object.keys(n).map(a=>a.split("/")[1]):[]}function u0(r){const e=Ta(r);fs(e);const t=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(a=>{var o;(o=a==null?void 0:a[0])!=null&&o.chains&&t.push(a[0].chains)})}),[...new Set(t.flat())]}function uc(r){if(!r)return;const e=r==null?void 0:r[r.length-1];return P8(e)?e:void 0}const I1="base10",Pr="base16",Sn="base64pad",wa="base64url",Va="utf8",D1=0,an=1,Ga=2,T8=0,d0=1,Ma=12,gu=32;function N8(){const r=au.generateKeyPair();return{privateKey:cr(r.secretKey,Pr),publicKey:cr(r.publicKey,Pr)}}function kh(){const r=Dn.randomBytes(gu);return cr(r,Pr)}function $8(r,e){const t=au.sharedKey(or(r,Pr),or(e,Pr),!0),n=new Uw(za.SHA256,t).expand(gu);return cr(n,Pr)}function dc(r){const e=za.hash(or(r,Pr));return cr(e,Pr)}function nn(r){const e=za.hash(or(r,Va));return cr(e,Pr)}function A1(r){return or(`${r}`,I1)}function hs(r){return Number(cr(r,I1))}function L8(r){const e=A1(typeof r.type<"u"?r.type:D1);if(hs(e)===an&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?or(r.senderPublicKey,Pr):void 0,n=typeof r.iv<"u"?or(r.iv,Pr):Dn.randomBytes(Ma),a=new nu.ChaCha20Poly1305(or(r.symKey,Pr)).seal(n,or(r.message,Va));return M1({type:e,sealed:a,iv:n,senderPublicKey:t,encoding:r.encoding})}function F8(r,e){const t=A1(Ga),n=Dn.randomBytes(Ma),a=or(r,Va);return M1({type:t,sealed:a,iv:n,encoding:e})}function q8(r){const e=new nu.ChaCha20Poly1305(or(r.symKey,Pr)),{sealed:t,iv:n}=Na({encoded:r.encoded,encoding:r==null?void 0:r.encoding}),a=e.open(n,t);if(a===null)throw new Error("Failed to decrypt");return cr(a,Va)}function U8(r,e){const{sealed:t}=Na({encoded:r,encoding:e});return cr(t,Va)}function M1(r){const{encoding:e=Sn}=r;if(hs(r.type)===Ga)return cr(fc([r.type,r.sealed]),e);if(hs(r.type)===an){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return cr(fc([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return cr(fc([r.type,r.iv,r.sealed]),e)}function Na(r){const{encoded:e,encoding:t=Sn}=r,n=or(e,t),a=n.slice(T8,d0),o=d0;if(hs(a)===an){const l=o+gu,m=l+Ma,_=n.slice(o,l),M=n.slice(l,m),I=n.slice(m);return{type:a,sealed:I,iv:M,senderPublicKey:_}}if(hs(a)===Ga){const l=n.slice(o),m=Dn.randomBytes(Ma);return{type:a,sealed:l,iv:m}}const f=o+Ma,h=n.slice(o,f),p=n.slice(f);return{type:a,sealed:p,iv:h}}function B8(r,e){const t=Na({encoded:r,encoding:e==null?void 0:e.encoding});return P1({type:hs(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?cr(t.senderPublicKey,Pr):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function P1(r){const e=(r==null?void 0:r.type)||D1;if(e===an){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function l0(r){return r.type===an&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function p0(r){return r.type===Ga}function z8(r){return new i1.ec("p256").keyFromPublic({x:ci.from(r.x,"base64").toString("hex"),y:ci.from(r.y,"base64").toString("hex")},"hex")}function H8(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function K8(r){return ci.from(H8(r),"base64")}function j8(r,e){const[t,n,a]=r.split("."),o=K8(a);if(o.length!==64)throw new Error("Invalid signature length");const f=o.slice(0,32).toString("hex"),h=o.slice(32,64).toString("hex"),p=`${t}.${n}`,l=new za.SHA256().update(ci.from(p)).digest(),m=z8(e),_=ci.from(l).toString("hex");if(!m.verify(_,{r:f,s:h}))throw new Error("Invalid signature");return Kh(r).payload}const k8="irn";function Wh(r){return(r==null?void 0:r.relay)||{protocol:k8}}function Da(r){const e=k5[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var W8=Object.defineProperty,V8=Object.defineProperties,G8=Object.getOwnPropertyDescriptors,g0=Object.getOwnPropertySymbols,J8=Object.prototype.hasOwnProperty,Y8=Object.prototype.propertyIsEnumerable,b0=(r,e,t)=>e in r?W8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,v0=(r,e)=>{for(var t in e||(e={}))J8.call(e,t)&&b0(r,t,e[t]);if(g0)for(var t of g0(e))Y8.call(e,t)&&b0(r,t,e[t]);return r},X8=(r,e)=>V8(r,G8(e));function Z8(r,e="-"){const t={},n="relay"+e;return Object.keys(r).forEach(a=>{if(a.startsWith(n)){const o=a.replace(n,""),f=r[a];t[o]=f}}),t}function m0(r){if(!r.includes("wc:")){const p=E1(r);p!=null&&p.includes("wc:")&&(r=p)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,n=r.substring(0,e),a=r.substring(e+1,t).split("@"),o=typeof t<"u"?r.substring(t):"",f=Ra.parse(o),h=typeof f.methods=="string"?f.methods.split(","):void 0;return{protocol:n,topic:Q8(a[0]),version:parseInt(a[1],10),symKey:f.symKey,relay:Z8(f),methods:h,expiryTimestamp:f.expiryTimestamp?parseInt(f.expiryTimestamp,10):void 0}}function Q8(r){return r.startsWith("//")?r.substring(2):r}function e4(r,e="-"){const t="relay",n={};return Object.keys(r).forEach(a=>{const o=t+e+a;r[a]&&(n[o]=r[a])}),n}function y0(r){return`${r.protocol}:${r.topic}@${r.version}?`+Ra.stringify(v0(X8(v0({symKey:r.symKey},e4(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function rc(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function Xs(r){const e=[];return r.forEach(t=>{const[n,a]=t.split(":");e.push(`${n}:${a}`)}),e}function t4(r){const e=[];return Object.values(r).forEach(t=>{e.push(...Xs(t.accounts))}),e}function r4(r,e){const t=[];return Object.values(r).forEach(n=>{Xs(n.accounts).includes(e)&&t.push(...n.methods)}),t}function i4(r,e){const t=[];return Object.values(r).forEach(n=>{Xs(n.accounts).includes(e)&&t.push(...n.events)}),t}function bu(r){return r.includes(":")}function Aa(r){return bu(r)?r.split(":")[0]:r}function n4(r){const e={};return r==null||r.forEach(t=>{const[n,a]=t.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(t),e[n].chains.push(`${n}:${a}`)}),e}function w0(r,e){e=e.map(n=>n.replace("did:pkh:",""));const t=n4(e);for(const[n,a]of Object.entries(t))a.methods?a.methods=hc(a.methods,r):a.methods=r,a.events=["chainChanged","accountsChanged"];return t}const s4={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}},a4={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 pe(r,e){const{message:t,code:n}=a4[r];return{message:e?`${t} ${e}`:t,code:n}}function It(r,e){const{message:t,code:n}=s4[r];return{message:e?`${t} ${e}`:t,code:n}}function Bi(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function $a(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Mr(r){return typeof r>"u"}function Xt(r,e){return e&&Mr(r)?!0:typeof r=="string"&&!!r.trim().length}function vu(r,e){return e&&Mr(r)?!0:typeof r=="number"&&!isNaN(r)}function o4(r,e){const{requiredNamespaces:t}=e,n=Object.keys(r.namespaces),a=Object.keys(t);let o=!0;return ss(a,n)?(n.forEach(f=>{const{accounts:h,methods:p,events:l}=r.namespaces[f],m=Xs(h),_=t[f];(!ss(g1(f,_),m)||!ss(_.methods,p)||!ss(_.events,l))&&(o=!1)}),o):!1}function Ic(r){return Xt(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function c4(r){if(Xt(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Ic(t)}}return!1}function f4(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(Xt(r,!1)){if(e(r))return!0;const t=E1(r);return e(t)}}catch{}return!1}function h4(r){var e;return(e=r==null?void 0:r.proposer)==null?void 0:e.publicKey}function u4(r){return r==null?void 0:r.topic}function d4(r,e){let t=null;return Xt(r==null?void 0:r.publicKey,!1)||(t=pe("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function _0(r){let e=!0;return Bi(r)?r.length&&(e=r.every(t=>Xt(t,!1))):e=!1,e}function l4(r,e,t){let n=null;return Bi(e)&&e.length?e.forEach(a=>{n||Ic(a)||(n=It("UNSUPPORTED_CHAINS",`${t}, chain ${a} should be a string and conform to "namespace:chainId" format`))}):Ic(r)||(n=It("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function p4(r,e,t){let n=null;return Object.entries(r).forEach(([a,o])=>{if(n)return;const f=l4(a,g1(a,o),`${e} ${t}`);f&&(n=f)}),n}function g4(r,e){let t=null;return Bi(r)?r.forEach(n=>{t||c4(n)||(t=It("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):t=It("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function b4(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const a=g4(n==null?void 0:n.accounts,`${e} namespace`);a&&(t=a)}),t}function v4(r,e){let t=null;return _0(r==null?void 0:r.methods)?_0(r==null?void 0:r.events)||(t=It("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=It("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function O1(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const a=v4(n,`${e}, namespace`);a&&(t=a)}),t}function m4(r,e,t){let n=null;if(r&&$a(r)){const a=O1(r,e);a&&(n=a);const o=p4(r,e,t);o&&(n=o)}else n=pe("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return n}function yh(r,e){let t=null;if(r&&$a(r)){const n=O1(r,e);n&&(t=n);const a=b4(r,e);a&&(t=a)}else t=pe("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function C1(r){return Xt(r.protocol,!0)}function y4(r,e){let t=!1;return e&&!r?t=!0:r&&Bi(r)&&r.length&&r.forEach(n=>{t=C1(n)}),t}function w4(r){return typeof r=="number"}function Fr(r){return typeof r<"u"&&typeof r!==null}function _4(r){return!(!r||typeof r!="object"||!r.code||!vu(r.code,!1)||!r.message||!Xt(r.message,!1))}function E4(r){return!(Mr(r)||!Xt(r.method,!1))}function S4(r){return!(Mr(r)||Mr(r.result)&&Mr(r.error)||!vu(r.id,!1)||!Xt(r.jsonrpc,!1))}function x4(r){return!(Mr(r)||!Xt(r.name,!1))}function E0(r,e){return!(!Ic(e)||!t4(r).includes(e))}function I4(r,e,t){return Xt(t,!1)?r4(r,e).includes(t):!1}function D4(r,e,t){return Xt(t,!1)?i4(r,e).includes(t):!1}function S0(r,e,t){let n=null;const a=A4(r),o=M4(e),f=Object.keys(a),h=Object.keys(o),p=x0(Object.keys(r)),l=x0(Object.keys(e)),m=p.filter(_=>!l.includes(_));return m.length&&(n=pe("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
|
|
18
|
+
Required: ${m.toString()}
|
|
19
|
+
Received: ${Object.keys(e).toString()}`)),ss(f,h)||(n=pe("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
|
|
20
|
+
Required: ${f.toString()}
|
|
21
|
+
Approved: ${h.toString()}`)),Object.keys(e).forEach(_=>{if(!_.includes(":")||n)return;const M=Xs(e[_].accounts);M.includes(_)||(n=pe("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${_}
|
|
22
|
+
Required: ${_}
|
|
23
|
+
Approved: ${M.toString()}`))}),f.forEach(_=>{n||(ss(a[_].methods,o[_].methods)?ss(a[_].events,o[_].events)||(n=pe("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${_}`)):n=pe("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${_}`))}),n}function A4(r){const e={};return Object.keys(r).forEach(t=>{var n;t.includes(":")?e[t]=r[t]:(n=r[t].chains)==null||n.forEach(a=>{e[a]={methods:r[t].methods,events:r[t].events}})}),e}function x0(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function M4(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const n=Xs(r[t].accounts);n==null||n.forEach(a=>{e[a]={accounts:r[t].accounts.filter(o=>o.includes(`${a}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function P4(r,e){return vu(r,!1)&&r<=e.max&&r>=e.min}function I0(){const r=Wa();return new Promise(e=>{switch(r){case Gr.browser:e(O4());break;case Gr.reactNative:e(C4());break;case Gr.node:e(R4());break;default:e(!0)}})}function O4(){return ka()&&(navigator==null?void 0:navigator.onLine)}async function C4(){if(Ys()&&typeof ht<"u"&&ht!=null&&ht.NetInfo){const r=await(ht==null?void 0:ht.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function R4(){return!0}function T4(r){switch(Wa()){case Gr.browser:N4(r);break;case Gr.reactNative:$4(r);break}}function N4(r){!Ys()&&ka()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function $4(r){var e;Ys()&&typeof ht<"u"&&ht!=null&&ht.NetInfo&&((e=ht)==null||e.NetInfo.addEventListener(t=>r(t==null?void 0:t.isConnected)))}const wh={};class _a{static get(e){return wh[e]}static set(e,t){wh[e]=t}static delete(e){delete wh[e]}}class ls{}let L4=class extends ls{constructor(e){super()}};const D0=be.FIVE_SECONDS,Zs={pulse:"heartbeat_pulse"};let F4=class R1 extends L4{constructor(e){super(e),this.events=new hi.EventEmitter,this.interval=D0,this.interval=(e==null?void 0:e.interval)||D0}static async init(e){const t=new R1(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),be.toMiliseconds(this.interval))}pulse(){this.events.emit(Zs.pulse)}};const q4=/"(?:_|\\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*:/,U4=/"(?: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*:/,B4=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function z4(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){H4(r);return}return e}function H4(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function ic(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.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(!B4.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(q4.test(r)||U4.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,z4)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}function K4(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ar(r,...e){try{return K4(r(...e))}catch(t){return Promise.reject(t)}}function j4(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function k4(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function lc(r){if(j4(r))return String(r);if(k4(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return lc(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function T1(){if(typeof ci>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const Vh="base64:";function W4(r){if(typeof r=="string")return r;T1();const e=ci.from(r).toString("base64");return Vh+e}function V4(r){return typeof r!="string"||!r.startsWith(Vh)?r:(T1(),ci.from(r.slice(Vh.length),"base64"))}function Lr(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function G4(...r){return Lr(r.join(":"))}function nc(r){return r=Lr(r),r?r+":":""}const J4="memory",Y4=()=>{const r=new Map;return{name:J4,getInstance:()=>r,hasItem(e){return r.has(e)},getItem(e){return r.get(e)??null},getItemRaw(e){return r.get(e)??null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function X4(r={}){const e={mounts:{"":r.driver||Y4()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=l=>{for(const m of e.mountpoints)if(l.startsWith(m))return{base:m,relativeKey:l.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,m)=>e.mountpoints.filter(_=>_.startsWith(l)||m&&l.startsWith(_)).map(_=>({relativeBase:l.length>_.length?l.slice(_.length):void 0,mountpoint:_,driver:e.mounts[_]})),a=(l,m)=>{if(e.watching){m=Lr(m);for(const _ of e.watchListeners)_(l,m)}},o=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await A0(e.mounts[l],a,l)}},f=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},h=(l,m,_)=>{const M=new Map,I=P=>{let H=M.get(P.base);return H||(H={driver:P.driver,base:P.base,items:[]},M.set(P.base,H)),H};for(const P of l){const H=typeof P=="string",W=Lr(H?P:P.key),J=H?void 0:P.value,q=H||!P.options?m:{...m,...P.options},V=t(W);I(V).items.push({key:W,value:J,relativeKey:V.relativeKey,options:q})}return Promise.all([...M.values()].map(P=>_(P))).then(P=>P.flat())},p={hasItem(l,m={}){l=Lr(l);const{relativeKey:_,driver:M}=t(l);return ar(M.hasItem,_,m)},getItem(l,m={}){l=Lr(l);const{relativeKey:_,driver:M}=t(l);return ar(M.getItem,_,m).then(I=>ic(I))},getItems(l,m){return h(l,m,_=>_.driver.getItems?ar(_.driver.getItems,_.items.map(M=>({key:M.relativeKey,options:M.options})),m).then(M=>M.map(I=>({key:G4(_.base,I.key),value:ic(I.value)}))):Promise.all(_.items.map(M=>ar(_.driver.getItem,M.relativeKey,M.options).then(I=>({key:M.key,value:ic(I)})))))},getItemRaw(l,m={}){l=Lr(l);const{relativeKey:_,driver:M}=t(l);return M.getItemRaw?ar(M.getItemRaw,_,m):ar(M.getItem,_,m).then(I=>V4(I))},async setItem(l,m,_={}){if(m===void 0)return p.removeItem(l);l=Lr(l);const{relativeKey:M,driver:I}=t(l);I.setItem&&(await ar(I.setItem,M,lc(m),_),I.watch||a("update",l))},async setItems(l,m){await h(l,m,async _=>{if(_.driver.setItems)return ar(_.driver.setItems,_.items.map(M=>({key:M.relativeKey,value:lc(M.value),options:M.options})),m);_.driver.setItem&&await Promise.all(_.items.map(M=>ar(_.driver.setItem,M.relativeKey,lc(M.value),M.options)))})},async setItemRaw(l,m,_={}){if(m===void 0)return p.removeItem(l,_);l=Lr(l);const{relativeKey:M,driver:I}=t(l);if(I.setItemRaw)await ar(I.setItemRaw,M,m,_);else if(I.setItem)await ar(I.setItem,M,W4(m),_);else return;I.watch||a("update",l)},async removeItem(l,m={}){typeof m=="boolean"&&(m={removeMeta:m}),l=Lr(l);const{relativeKey:_,driver:M}=t(l);M.removeItem&&(await ar(M.removeItem,_,m),(m.removeMeta||m.removeMata)&&await ar(M.removeItem,_+"$",m),M.watch||a("remove",l))},async getMeta(l,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),l=Lr(l);const{relativeKey:_,driver:M}=t(l),I=Object.create(null);if(M.getMeta&&Object.assign(I,await ar(M.getMeta,_,m)),!m.nativeOnly){const P=await ar(M.getItem,_+"$",m).then(H=>ic(H));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(I,P))}return I},setMeta(l,m,_={}){return this.setItem(l+"$",m,_)},removeMeta(l,m={}){return this.removeItem(l+"$",m)},async getKeys(l,m={}){l=nc(l);const _=n(l,!0);let M=[];const I=[];for(const P of _){const H=await ar(P.driver.getKeys,P.relativeBase,m);for(const W of H){const J=P.mountpoint+Lr(W);M.some(q=>J.startsWith(q))||I.push(J)}M=[P.mountpoint,...M.filter(W=>!W.startsWith(P.mountpoint))]}return l?I.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):I.filter(P=>P[P.length-1]!=="$")},async clear(l,m={}){l=nc(l),await Promise.all(n(l,!1).map(async _=>{if(_.driver.clear)return ar(_.driver.clear,_.relativeBase,m);if(_.driver.removeItem){const M=await _.driver.getKeys(_.relativeBase||"",m);return Promise.all(M.map(I=>_.driver.removeItem(I,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>M0(l)))},async watch(l){return await o(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==l),e.watchListeners.length===0&&await f()}},async unwatch(){e.watchListeners=[],await f()},mount(l,m){if(l=nc(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((_,M)=>M.length-_.length)),e.mounts[l]=m,e.watching&&Promise.resolve(A0(m,a,l)).then(_=>{e.unwatch[l]=_}).catch(console.error),p},async unmount(l,m=!0){l=nc(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),m&&await M0(e.mounts[l]),e.mountpoints=e.mountpoints.filter(_=>_!==l),delete e.mounts[l])},getMount(l=""){l=Lr(l)+":";const m=t(l);return{driver:m.driver,base:m.base}},getMounts(l="",m={}){return l=Lr(l),n(l,m.parents).map(M=>({driver:M.driver,base:M.mountpoint}))},keys:(l,m={})=>p.getKeys(l,m),get:(l,m={})=>p.getItem(l,m),set:(l,m,_={})=>p.setItem(l,m,_),has:(l,m={})=>p.hasItem(l,m),del:(l,m={})=>p.removeItem(l,m),remove:(l,m={})=>p.removeItem(l,m)};return p}function A0(r,e,t){return r.watch?r.watch((n,a)=>e(n,t+a)):()=>{}}async function M0(r){typeof r.dispose=="function"&&await ar(r.dispose)}function ps(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function N1(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const n=ps(t);return(a,o)=>n.then(f=>o(f.transaction(e,a).objectStore(e)))}let _h;function Ja(){return _h||(_h=N1("keyval-store","keyval")),_h}function P0(r,e=Ja()){return e("readonly",t=>ps(t.get(r)))}function Z4(r,e,t=Ja()){return t("readwrite",n=>(n.put(e,r),ps(n.transaction)))}function Q4(r,e=Ja()){return e("readwrite",t=>(t.delete(r),ps(t.transaction)))}function e9(r=Ja()){return r("readwrite",e=>(e.clear(),ps(e.transaction)))}function t9(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},ps(r.transaction)}function r9(r=Ja()){return r("readonly",e=>{if(e.getAllKeys)return ps(e.getAllKeys());const t=[];return t9(e,n=>t.push(n.key)).then(()=>t)})}const i9="idb-keyval";var n9=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=a=>e+a;let n;return r.dbName&&r.storeName&&(n=N1(r.dbName,r.storeName)),{name:i9,options:r,async hasItem(a){return!(typeof await P0(t(a),n)>"u")},async getItem(a){return await P0(t(a),n)??null},setItem(a,o){return Z4(t(a),o,n)},removeItem(a){return Q4(t(a),n)},getKeys(){return r9(n)},clear(){return e9(n)}}};const s9="WALLET_CONNECT_V2_INDEXED_DB",a9="keyvaluestorage";let o9=class{constructor(){this.indexedDb=X4({driver:n9({dbName:s9,storeName:a9})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,on(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var Eh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof ht<"u"?ht:typeof self<"u"?self:{},pc={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,n){this[t]=String(n)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Eh<"u"&&Eh.localStorage?pc.exports=Eh.localStorage:typeof window<"u"&&window.localStorage?pc.exports=window.localStorage:pc.exports=new e})();function c9(r){var e;return[r[0],cs((e=r[1])!=null?e:"")]}let f9=class{constructor(){this.localStorage=pc.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(c9)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return cs(t)}async setItem(e,t){this.localStorage.setItem(e,on(t))}async removeItem(e){this.localStorage.removeItem(e)}};const h9="wc_storage_version",O0=1,u9=async(r,e,t)=>{const n=h9,a=await e.getItem(n);if(a&&a>=O0){t(e);return}const o=await r.getKeys();if(!o.length){t(e);return}const f=[];for(;o.length;){const h=o.shift();if(!h)continue;const p=h.toLowerCase();if(p.includes("wc@")||p.includes("walletconnect")||p.includes("wc_")||p.includes("wallet_connect")){const l=await r.getItem(h);await e.setItem(h,l),f.push(h)}}await e.setItem(n,O0),t(e),d9(r,f)},d9=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};let l9=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new f9;this.storage=e;try{const t=new o9;u9(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}};function p9(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var g9=b9;function b9(r,e,t){var n=t&&t.stringify||p9,a=1;if(typeof r=="object"&&r!==null){var o=e.length+a;if(o===1)return r;var f=new Array(o);f[0]=n(r);for(var h=1;h<o;h++)f[h]=n(e[h]);return f.join(" ")}if(typeof r!="string")return r;var p=e.length;if(p===0)return r;for(var l="",m=1-a,_=-1,M=r&&r.length||0,I=0;I<M;){if(r.charCodeAt(I)===37&&I+1<M){switch(_=_>-1?_:0,r.charCodeAt(I+1)){case 100:case 102:if(m>=p||e[m]==null)break;_<I&&(l+=r.slice(_,I)),l+=Number(e[m]),_=I+2,I++;break;case 105:if(m>=p||e[m]==null)break;_<I&&(l+=r.slice(_,I)),l+=Math.floor(Number(e[m])),_=I+2,I++;break;case 79:case 111:case 106:if(m>=p||e[m]===void 0)break;_<I&&(l+=r.slice(_,I));var P=typeof e[m];if(P==="string"){l+="'"+e[m]+"'",_=I+2,I++;break}if(P==="function"){l+=e[m].name||"<anonymous>",_=I+2,I++;break}l+=n(e[m]),_=I+2,I++;break;case 115:if(m>=p)break;_<I&&(l+=r.slice(_,I)),l+=String(e[m]),_=I+2,I++;break;case 37:_<I&&(l+=r.slice(_,I)),l+="%",_=I+2,I++,m--;break}++m}++I}return _===-1?r:(_<M&&(l+=r.slice(_)),l)}const C0=g9;var Us=Ui;const La=D9().console||{},v9={mapHttpRequest:sc,mapHttpResponse:sc,wrapRequestSerializer:Sh,wrapResponseSerializer:Sh,wrapErrorSerializer:Sh,req:sc,res:sc,err:E9};function m9(r,e){return Array.isArray(r)?r.filter(function(n){return n!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Ui(r){r=r||{},r.browser=r.browser||{};const e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=r.browser.write||La;r.browser.write&&(r.browser.asObject=!0);const n=r.serializers||{},a=m9(r.browser.serialize,n);let o=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);const f=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const h=r.level||"info",p=Object.create(t);p.log||(p.log=Fa),Object.defineProperty(p,"levelVal",{get:m}),Object.defineProperty(p,"level",{get:_,set:M});const l={transmit:e,serialize:a,asObject:r.browser.asObject,levels:f,timestamp:S9(r)};p.levels=Ui.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=Fa,p.serializers=n,p._serialize=a,p._stdErrSerialize=o,p.child=I,e&&(p._logEvent=Gh());function m(){return this.level==="silent"?1/0:this.levels.values[this.level]}function _(){return this._level}function M(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,Ls(l,p,"error","log"),Ls(l,p,"fatal","error"),Ls(l,p,"warn","error"),Ls(l,p,"info","log"),Ls(l,p,"debug","log"),Ls(l,p,"trace","log")}function I(P,H){if(!P)throw new Error("missing bindings for child Pino");H=H||{},a&&P.serializers&&(H.serializers=P.serializers);const W=H.serializers;if(a&&W){var J=Object.assign({},n,W),q=r.browser.serialize===!0?Object.keys(J):a;delete P.serializers,kc([P],q,J,this._stdErrSerialize)}function V(L){this._childLevel=(L._childLevel|0)+1,this.error=Fs(L,P,"error"),this.fatal=Fs(L,P,"fatal"),this.warn=Fs(L,P,"warn"),this.info=Fs(L,P,"info"),this.debug=Fs(L,P,"debug"),this.trace=Fs(L,P,"trace"),J&&(this.serializers=J,this._serialize=q),e&&(this._logEvent=Gh([].concat(L._logEvent.bindings,P)))}return V.prototype=this,new V(this)}return p}Ui.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"}};Ui.stdSerializers=v9;Ui.stdTimeFunctions=Object.assign({},{nullTime:$1,epochTime:L1,unixTime:x9,isoTime:I9});function Ls(r,e,t,n){const a=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Fa:a[t]?a[t]:La[t]||La[n]||Fa,y9(r,e,t)}function y9(r,e,t){!r.transmit&&e[t]===Fa||(e[t]=function(n){return function(){const o=r.timestamp(),f=new Array(arguments.length),h=Object.getPrototypeOf&&Object.getPrototypeOf(this)===La?La:this;for(var p=0;p<f.length;p++)f[p]=arguments[p];if(r.serialize&&!r.asObject&&kc(f,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?n.call(h,w9(this,t,f,o)):n.apply(h,f),r.transmit){const l=r.transmit.level||e.level,m=Ui.levels.values[l],_=Ui.levels.values[t];if(_<m)return;_9(this,{ts:o,methodLevel:t,methodValue:_,transmitLevel:l,transmitValue:Ui.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},f)}}}(e[t]))}function w9(r,e,t,n){r._serialize&&kc(t,r._serialize,r.serializers,r._stdErrSerialize);const a=t.slice();let o=a[0];const f={};n&&(f.time=n),f.level=Ui.levels.values[e];let h=(r._childLevel|0)+1;if(h<1&&(h=1),o!==null&&typeof o=="object"){for(;h--&&typeof a[0]=="object";)Object.assign(f,a.shift());o=a.length?C0(a.shift(),a):void 0}else typeof o=="string"&&(o=C0(a.shift(),a));return o!==void 0&&(f.msg=o),f}function kc(r,e,t,n){for(const a in r)if(n&&r[a]instanceof Error)r[a]=Ui.stdSerializers.err(r[a]);else if(typeof r[a]=="object"&&!Array.isArray(r[a]))for(const o in r[a])e&&e.indexOf(o)>-1&&o in t&&(r[a][o]=t[o](r[a][o]))}function Fs(r,e,t){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var a=1;a<n.length;a++)n[a]=arguments[a-1];return r[t].apply(this,n)}}function _9(r,e,t){const n=e.send,a=e.ts,o=e.methodLevel,f=e.methodValue,h=e.val,p=r._logEvent.bindings;kc(t,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=a,r._logEvent.messages=t.filter(function(l){return p.indexOf(l)===-1}),r._logEvent.level.label=o,r._logEvent.level.value=f,n(o,r._logEvent,h),r._logEvent=Gh(p)}function Gh(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function E9(r){const e={type:r.constructor.name,msg:r.message,stack:r.stack};for(const t in r)e[t]===void 0&&(e[t]=r[t]);return e}function S9(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?$1:L1}function sc(){return{}}function Sh(r){return r}function Fa(){}function $1(){return!1}function L1(){return Date.now()}function x9(){return Math.round(Date.now()/1e3)}function I9(){return new Date(Date.now()).toISOString()}function D9(){function r(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return r(self)||r(window)||r(this)||{}}}const Ya=Np(Us),A9={level:"info"},Xa="custom_context",mu=1e3*1024;let M9=class{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}},R0=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new M9(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},F1=class{constructor(e,t=mu){this.level=e??"error",this.levelValue=Us.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new R0(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Us.levels.values.error?console.error(e):t===Us.levels.values.warn?console.warn(e):t===Us.levels.values.debug?console.debug(e):t===Us.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(on({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new R0(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(on({extraMetadata:e})),new Blob(t,{type:"application/json"})}},P9=class{constructor(e,t=mu){this.baseChunkLogger=new F1(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=t,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}},O9=class{constructor(e,t=mu){this.baseChunkLogger=new F1(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var C9=Object.defineProperty,R9=Object.defineProperties,T9=Object.getOwnPropertyDescriptors,T0=Object.getOwnPropertySymbols,N9=Object.prototype.hasOwnProperty,$9=Object.prototype.propertyIsEnumerable,N0=(r,e,t)=>e in r?C9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Dc=(r,e)=>{for(var t in e||(e={}))N9.call(e,t)&&N0(r,t,e[t]);if(T0)for(var t of T0(e))$9.call(e,t)&&N0(r,t,e[t]);return r},Ac=(r,e)=>R9(r,T9(e));function Wc(r){return Ac(Dc({},r),{level:(r==null?void 0:r.level)||A9.level})}function L9(r,e=Xa){return r[e]||""}function F9(r,e,t=Xa){return r[t]=e,r}function Ur(r,e=Xa){let t="";return typeof r.bindings>"u"?t=L9(r,e):t=r.bindings().context||"",t}function q9(r,e,t=Xa){const n=Ur(r,t);return n.trim()?`${n}/${e}`:e}function Or(r,e,t=Xa){const n=q9(r,e,t),a=r.child({context:n});return F9(a,n,t)}function U9(r){var e,t;const n=new P9((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Ya(Ac(Dc({},r.opts),{level:"trace",browser:Ac(Dc({},(t=r.opts)==null?void 0:t.browser),{write:a=>n.write(a)})})),chunkLoggerController:n}}function B9(r){var e;const t=new O9((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Ya(Ac(Dc({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function z9(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?U9(r):B9(r)}let H9=class extends ls{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},K9=class extends ls{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},j9=class{constructor(e,t){this.logger=e,this.core=t}},k9=class extends ls{constructor(e,t){super(),this.relayer=e,this.logger=t}},W9=class extends ls{constructor(e){super()}},V9=class{constructor(e,t,n,a){this.core=e,this.logger=t,this.name=n}},G9=class extends ls{constructor(e,t){super(),this.relayer=e,this.logger=t}},J9=class extends ls{constructor(e,t){super(),this.core=e,this.logger=t}},Y9=class{constructor(e,t,n){this.core=e,this.logger=t,this.store=n}},X9=class{constructor(e,t){this.projectId=e,this.logger=t}},Z9=class{constructor(e,t,n){this.core=e,this.logger=t,this.telemetryEnabled=n}},Q9=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},e7=class{constructor(e){this.client=e}};const t7="PARSE_ERROR",r7="INVALID_REQUEST",i7="METHOD_NOT_FOUND",n7="INVALID_PARAMS",q1="INTERNAL_ERROR",yu="SERVER_ERROR",s7=[-32700,-32600,-32601,-32602,-32603],Pa={[t7]:{code:-32700,message:"Parse error"},[r7]:{code:-32600,message:"Invalid Request"},[i7]:{code:-32601,message:"Method not found"},[n7]:{code:-32602,message:"Invalid params"},[q1]:{code:-32603,message:"Internal error"},[yu]:{code:-32e3,message:"Server error"}},U1=yu;function a7(r){return s7.includes(r)}function $0(r){return Object.keys(Pa).includes(r)?Pa[r]:Pa[U1]}function o7(r){const e=Object.values(Pa).find(t=>t.code===r);return e||Pa[U1]}function B1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var z1={},en={},L0;function c7(){if(L0)return en;L0=1,Object.defineProperty(en,"__esModule",{value:!0}),en.isBrowserCryptoAvailable=en.getSubtleCrypto=en.getBrowerCrypto=void 0;function r(){return(wr===null||wr===void 0?void 0:wr.crypto)||(wr===null||wr===void 0?void 0:wr.msCrypto)||{}}en.getBrowerCrypto=r;function e(){const n=r();return n.subtle||n.webkitSubtle}en.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return en.isBrowserCryptoAvailable=t,en}var tn={},F0;function f7(){if(F0)return tn;F0=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.isBrowser=tn.isNode=tn.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}tn.isReactNative=r;function e(){return typeof Ei<"u"&&typeof Ei.versions<"u"&&typeof Ei.versions.node<"u"}tn.isNode=e;function t(){return!r()&&!e()}return tn.isBrowser=t,tn}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=qa;e.__exportStar(c7(),r),e.__exportStar(f7(),r)})(z1);function En(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function as(r=6){return BigInt(En(r))}function xn(r,e,t){return{id:t||En(),jsonrpc:"2.0",method:r,params:e}}function Vc(r,e){return{id:r,jsonrpc:"2.0",result:e}}function Gc(r,e,t){return{id:r,jsonrpc:"2.0",error:h7(e,t)}}function h7(r,e){return typeof r>"u"?$0(q1):(typeof r=="string"&&(r=Object.assign(Object.assign({},$0(yu)),{message:r})),typeof e<"u"&&(r.data=e),a7(r.code)&&(r=o7(r.code)),r)}class u7{}class d7 extends u7{constructor(){super()}}class l7 extends d7{constructor(e){super()}}const p7="^https?:",g7="^wss?:";function b7(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function H1(r,e){const t=b7(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function q0(r){return H1(r,p7)}function U0(r){return H1(r,g7)}function v7(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function K1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function wu(r){return K1(r)&&"method"in r}function Jc(r){return K1(r)&&(Fi(r)||oi(r))}function Fi(r){return"result"in r}function oi(r){return"error"in r}let xi=class extends l7{constructor(e){super(e),this.events=new hi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(xn(e.method,e.params||[],e.id||as().toString()),t)}async requestStrict(e,t){return new Promise(async(n,a)=>{if(!this.connection.connected)try{await this.open()}catch(o){a(o)}this.events.on(`${e.id}`,o=>{oi(o)?a(o.error):n(o.result)});try{await this.connection.send(e,t)}catch(o){a(o)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Jc(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 m7=()=>typeof WebSocket<"u"?WebSocket:typeof ht<"u"&&typeof ht.WebSocket<"u"?ht.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),y7=()=>typeof WebSocket<"u"||typeof ht<"u"&&typeof ht.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",B0=r=>r.split("?")[0],z0=10,w7=m7();let _7=class{constructor(e){if(this.url=e,this.events=new hi.EventEmitter,this.registering=!1,!U0(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(on(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!U0(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,a)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),a(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return a(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,n)=>{const a=new URLSearchParams(e).get("origin"),o=z1.isReactNative()?{headers:{origin:a}}:{rejectUnauthorized:!v7(e)},f=new w7(e,[],o);y7()?f.onerror=h=>{const p=h;n(this.emitError(p.error))}:f.on("error",h=>{n(this.emitError(h))}),f.onopen=()=>{this.onOpen(f),t(f)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?cs(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),a=n.message||n.toString(),o=Gc(e,a);this.events.emit("payload",o)}parseError(e,t=this.url){return B1(e,B0(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>z0&&this.events.setMaxListeners(z0)}emitError(e){const t=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${B0(this.url)}`));return this.events.emit("register_error",t),t}};var Mc={exports:{}};Mc.exports;(function(r,e){var t=200,n="__lodash_hash_undefined__",a=1,o=2,f=9007199254740991,h="[object Arguments]",p="[object Array]",l="[object AsyncFunction]",m="[object Boolean]",_="[object Date]",M="[object Error]",I="[object Function]",P="[object GeneratorFunction]",H="[object Map]",W="[object Number]",J="[object Null]",q="[object Object]",V="[object Promise]",L="[object Proxy]",U="[object RegExp]",z="[object Set]",b="[object String]",T="[object Symbol]",re="[object Undefined]",de="[object WeakMap]",$="[object ArrayBuffer]",u="[object DataView]",y="[object Float32Array]",w="[object Float64Array]",E="[object Int8Array]",O="[object Int16Array]",N="[object Int32Array]",R="[object Uint8Array]",x="[object Uint8ClampedArray]",d="[object Uint16Array]",D="[object Uint32Array]",fe=/[\\^$.*+?()[\]{}|]/g,ee=/^\[object .+?Constructor\]$/,he=/^(?:0|[1-9]\d*)$/,ne={};ne[y]=ne[w]=ne[E]=ne[O]=ne[N]=ne[R]=ne[x]=ne[d]=ne[D]=!0,ne[h]=ne[p]=ne[$]=ne[m]=ne[u]=ne[_]=ne[M]=ne[I]=ne[H]=ne[W]=ne[q]=ne[U]=ne[z]=ne[b]=ne[de]=!1;var ge=typeof wr=="object"&&wr&&wr.Object===Object&&wr,G=typeof self=="object"&&self&&self.Object===Object&&self,Z=ge||G||Function("return this")(),j=e&&!e.nodeType&&e,v=j&&!0&&r&&!r.nodeType&&r,K=v&&v.exports===j,oe=K&&ge.process,le=function(){try{return oe&&oe.binding&&oe.binding("util")}catch{}}(),Te=le&&le.isTypedArray;function Ae(F,X){for(var ce=-1,we=F==null?0:F.length,Ot=0,Ye=[];++ce<we;){var qt=F[ce];X(qt,ce,F)&&(Ye[Ot++]=qt)}return Ye}function Pe(F,X){for(var ce=-1,we=X.length,Ot=F.length;++ce<we;)F[Ot+ce]=X[ce];return F}function He(F,X){for(var ce=-1,we=F==null?0:F.length;++ce<we;)if(X(F[ce],ce,F))return!0;return!1}function Fe(F,X){for(var ce=-1,we=Array(F);++ce<F;)we[ce]=X(ce);return we}function qe(F){return function(X){return F(X)}}function je(F,X){return F.has(X)}function ye(F,X){return F==null?void 0:F[X]}function Ie(F){var X=-1,ce=Array(F.size);return F.forEach(function(we,Ot){ce[++X]=[Ot,we]}),ce}function Ue(F,X){return function(ce){return F(X(ce))}}function De(F){var X=-1,ce=Array(F.size);return F.forEach(function(we){ce[++X]=we}),ce}var Se=Array.prototype,Be=Function.prototype,me=Object.prototype,xe=Z["__core-js_shared__"],Ze=Be.toString,_e=me.hasOwnProperty,Oe=function(){var F=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||"");return F?"Symbol(src)_1."+F:""}(),ot=me.toString,Ce=RegExp("^"+Ze.call(_e).replace(fe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=K?Z.Buffer:void 0,ft=Z.Symbol,lt=Z.Uint8Array,bt=me.propertyIsEnumerable,Br=Se.splice,pt=ft?ft.toStringTag:void 0,wt=Object.getOwnPropertySymbols,li=Re?Re.isBuffer:void 0,Dt=Ue(Object.keys,Object),ke=Hr(Z,"DataView"),Mt=Hr(Z,"Map"),We=Hr(Z,"Promise"),Ve=Hr(Z,"Set"),Tt=Hr(Z,"WeakMap"),ze=Hr(Object,"create"),tt=ji(ke),Kt=ji(Mt),Ge=ji(We),rt=ji(Ve),Ft=ji(Tt),Qe=ft?ft.prototype:void 0,Je=Qe?Qe.valueOf:void 0;function St(F){var X=-1,ce=F==null?0:F.length;for(this.clear();++X<ce;){var we=F[X];this.set(we[0],we[1])}}function it(){this.__data__=ze?ze(null):{},this.size=0}function nt(F){var X=this.has(F)&&delete this.__data__[F];return this.size-=X?1:0,X}function vs(F){var X=this.__data__;if(ze){var ce=X[F];return ce===n?void 0:ce}return _e.call(X,F)?X[F]:void 0}function Bt(F){var X=this.__data__;return ze?X[F]!==void 0:_e.call(X,F)}function zt(F,X){var ce=this.__data__;return this.size+=this.has(F)?0:1,ce[F]=ze&&X===void 0?n:X,this}St.prototype.clear=it,St.prototype.delete=nt,St.prototype.get=vs,St.prototype.has=Bt,St.prototype.set=zt;function br(F){var X=-1,ce=F==null?0:F.length;for(this.clear();++X<ce;){var we=F[X];this.set(we[0],we[1])}}function Mn(){this.__data__=[],this.size=0}function Pn(F){var X=this.__data__,ce=Un(X,F);if(ce<0)return!1;var we=X.length-1;return ce==we?X.pop():Br.call(X,ce,1),--this.size,!0}function On(F){var X=this.__data__,ce=Un(X,F);return ce<0?void 0:X[ce][1]}function Cn(F){return Un(this.__data__,F)>-1}function Rn(F,X){var ce=this.__data__,we=Un(ce,F);return we<0?(++this.size,ce.push([F,X])):ce[we][1]=X,this}br.prototype.clear=Mn,br.prototype.delete=Pn,br.prototype.get=On,br.prototype.has=Cn,br.prototype.set=Rn;function zr(F){var X=-1,ce=F==null?0:F.length;for(this.clear();++X<ce;){var we=F[X];this.set(we[0],we[1])}}function Di(){this.size=0,this.__data__={hash:new St,map:new(Mt||br),string:new St}}function Tn(F){var X=un(this,F).delete(F);return this.size-=X?1:0,X}function Ai(F){return un(this,F).get(F)}function Nn(F){return un(this,F).has(F)}function $n(F,X){var ce=un(this,F),we=ce.size;return ce.set(F,X),this.size+=ce.size==we?0:1,this}zr.prototype.clear=Di,zr.prototype.delete=Tn,zr.prototype.get=Ai,zr.prototype.has=Nn,zr.prototype.set=$n;function Mi(F){var X=-1,ce=F==null?0:F.length;for(this.__data__=new zr;++X<ce;)this.add(F[X])}function fn(F){return this.__data__.set(F,n),this}function hn(F){return this.__data__.has(F)}Mi.prototype.add=Mi.prototype.push=fn,Mi.prototype.has=hn;function Er(F){var X=this.__data__=new br(F);this.size=X.size}function Ln(){this.__data__=new br,this.size=0}function Fn(F){var X=this.__data__,ce=X.delete(F);return this.size=X.size,ce}function qn(F){return this.__data__.get(F)}function Zc(F){return this.__data__.has(F)}function Qa(F,X){var ce=this.__data__;if(ce instanceof br){var we=ce.__data__;if(!Mt||we.length<t-1)return we.push([F,X]),this.size=++ce.size,this;ce=this.__data__=new zr(we)}return ce.set(F,X),this.size=ce.size,this}Er.prototype.clear=Ln,Er.prototype.delete=Fn,Er.prototype.get=qn,Er.prototype.has=Zc,Er.prototype.set=Qa;function eo(F,X){var ce=ws(F),we=!ce&&lo(F),Ot=!ce&&!we&&ta(F),Ye=!ce&&!we&&!Ot&&bo(F),qt=ce||we||Ot||Ye,Zt=qt?Fe(F.length,String):[],vt=Zt.length;for(var Ct in F)(X||_e.call(F,Ct))&&!(qt&&(Ct=="length"||Ot&&(Ct=="offset"||Ct=="parent")||Ye&&(Ct=="buffer"||Ct=="byteLength"||Ct=="byteOffset")||oo(Ct,vt)))&&Zt.push(Ct);return Zt}function Un(F,X){for(var ce=F.length;ce--;)if(uo(F[ce][0],X))return ce;return-1}function Qs(F,X,ce){var we=X(F);return ws(F)?we:Pe(we,ce(F))}function Bn(F){return F==null?F===void 0?re:J:pt&&pt in Object(F)?so(F):tf(F)}function ea(F){return Hn(F)&&Bn(F)==h}function zn(F,X,ce,we,Ot){return F===X?!0:F==null||X==null||!Hn(F)&&!Hn(X)?F!==F&&X!==X:to(F,X,ce,we,zn,Ot)}function to(F,X,ce,we,Ot,Ye){var qt=ws(F),Zt=ws(X),vt=qt?p:Pi(F),Ct=Zt?p:Pi(X);vt=vt==h?q:vt,Ct=Ct==h?q:Ct;var Gt=vt==q,Cr=Ct==q,Qt=vt==Ct;if(Qt&&ta(F)){if(!ta(X))return!1;qt=!0,Gt=!1}if(Qt&&!Gt)return Ye||(Ye=new Er),qt||bo(F)?ms(F,X,ce,we,Ot,Ye):ef(F,X,vt,ce,we,Ot,Ye);if(!(ce&a)){var Ut=Gt&&_e.call(F,"__wrapped__"),Sr=Cr&&_e.call(X,"__wrapped__");if(Ut||Sr){var pi=Ut?F.value():F,Xr=Sr?X.value():X;return Ye||(Ye=new Er),Ot(pi,Xr,ce,we,Ye)}}return Qt?(Ye||(Ye=new Er),no(F,X,ce,we,Ot,Ye)):!1}function Qc(F){if(!go(F)||fo(F))return!1;var X=_s(F)?Ce:ee;return X.test(ji(F))}function ro(F){return Hn(F)&&po(F.length)&&!!ne[Bn(F)]}function io(F){if(!ho(F))return Dt(F);var X=[];for(var ce in Object(F))_e.call(F,ce)&&ce!="constructor"&&X.push(ce);return X}function ms(F,X,ce,we,Ot,Ye){var qt=ce&a,Zt=F.length,vt=X.length;if(Zt!=vt&&!(qt&&vt>Zt))return!1;var Ct=Ye.get(F);if(Ct&&Ye.get(X))return Ct==X;var Gt=-1,Cr=!0,Qt=ce&o?new Mi:void 0;for(Ye.set(F,X),Ye.set(X,F);++Gt<Zt;){var Ut=F[Gt],Sr=X[Gt];if(we)var pi=qt?we(Sr,Ut,Gt,X,F,Ye):we(Ut,Sr,Gt,F,X,Ye);if(pi!==void 0){if(pi)continue;Cr=!1;break}if(Qt){if(!He(X,function(Xr,Oi){if(!je(Qt,Oi)&&(Ut===Xr||Ot(Ut,Xr,ce,we,Ye)))return Qt.push(Oi)})){Cr=!1;break}}else if(!(Ut===Sr||Ot(Ut,Sr,ce,we,Ye))){Cr=!1;break}}return Ye.delete(F),Ye.delete(X),Cr}function ef(F,X,ce,we,Ot,Ye,qt){switch(ce){case u:if(F.byteLength!=X.byteLength||F.byteOffset!=X.byteOffset)return!1;F=F.buffer,X=X.buffer;case $:return!(F.byteLength!=X.byteLength||!Ye(new lt(F),new lt(X)));case m:case _:case W:return uo(+F,+X);case M:return F.name==X.name&&F.message==X.message;case U:case b:return F==X+"";case H:var Zt=Ie;case z:var vt=we&a;if(Zt||(Zt=De),F.size!=X.size&&!vt)return!1;var Ct=qt.get(F);if(Ct)return Ct==X;we|=o,qt.set(F,X);var Gt=ms(Zt(F),Zt(X),we,Ot,Ye,qt);return qt.delete(F),Gt;case T:if(Je)return Je.call(F)==Je.call(X)}return!1}function no(F,X,ce,we,Ot,Ye){var qt=ce&a,Zt=ys(F),vt=Zt.length,Ct=ys(X),Gt=Ct.length;if(vt!=Gt&&!qt)return!1;for(var Cr=vt;Cr--;){var Qt=Zt[Cr];if(!(qt?Qt in X:_e.call(X,Qt)))return!1}var Ut=Ye.get(F);if(Ut&&Ye.get(X))return Ut==X;var Sr=!0;Ye.set(F,X),Ye.set(X,F);for(var pi=qt;++Cr<vt;){Qt=Zt[Cr];var Xr=F[Qt],Oi=X[Qt];if(we)var ra=qt?we(Oi,Xr,Qt,X,F,Ye):we(Xr,Oi,Qt,F,X,Ye);if(!(ra===void 0?Xr===Oi||Ot(Xr,Oi,ce,we,Ye):ra)){Sr=!1;break}pi||(pi=Qt=="constructor")}if(Sr&&!pi){var Kn=F.constructor,ir=X.constructor;Kn!=ir&&"constructor"in F&&"constructor"in X&&!(typeof Kn=="function"&&Kn instanceof Kn&&typeof ir=="function"&&ir instanceof ir)&&(Sr=!1)}return Ye.delete(F),Ye.delete(X),Sr}function ys(F){return Qs(F,sf,ao)}function un(F,X){var ce=F.__data__;return co(X)?ce[typeof X=="string"?"string":"hash"]:ce.map}function Hr(F,X){var ce=ye(F,X);return Qc(ce)?ce:void 0}function so(F){var X=_e.call(F,pt),ce=F[pt];try{F[pt]=void 0;var we=!0}catch{}var Ot=ot.call(F);return we&&(X?F[pt]=ce:delete F[pt]),Ot}var ao=wt?function(F){return F==null?[]:(F=Object(F),Ae(wt(F),function(X){return bt.call(F,X)}))}:Pt,Pi=Bn;(ke&&Pi(new ke(new ArrayBuffer(1)))!=u||Mt&&Pi(new Mt)!=H||We&&Pi(We.resolve())!=V||Ve&&Pi(new Ve)!=z||Tt&&Pi(new Tt)!=de)&&(Pi=function(F){var X=Bn(F),ce=X==q?F.constructor:void 0,we=ce?ji(ce):"";if(we)switch(we){case tt:return u;case Kt:return H;case Ge:return V;case rt:return z;case Ft:return de}return X});function oo(F,X){return X=X??f,!!X&&(typeof F=="number"||he.test(F))&&F>-1&&F%1==0&&F<X}function co(F){var X=typeof F;return X=="string"||X=="number"||X=="symbol"||X=="boolean"?F!=="__proto__":F===null}function fo(F){return!!Oe&&Oe in F}function ho(F){var X=F&&F.constructor,ce=typeof X=="function"&&X.prototype||me;return F===ce}function tf(F){return ot.call(F)}function ji(F){if(F!=null){try{return Ze.call(F)}catch{}try{return F+""}catch{}}return""}function uo(F,X){return F===X||F!==F&&X!==X}var lo=ea(function(){return arguments}())?ea:function(F){return Hn(F)&&_e.call(F,"callee")&&!bt.call(F,"callee")},ws=Array.isArray;function rf(F){return F!=null&&po(F.length)&&!_s(F)}var ta=li||At;function nf(F,X){return zn(F,X)}function _s(F){if(!go(F))return!1;var X=Bn(F);return X==I||X==P||X==l||X==L}function po(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=f}function go(F){var X=typeof F;return F!=null&&(X=="object"||X=="function")}function Hn(F){return F!=null&&typeof F=="object"}var bo=Te?qe(Te):ro;function sf(F){return rf(F)?eo(F):io(F)}function Pt(){return[]}function At(){return!1}r.exports=nf})(Mc,Mc.exports);var E7=Mc.exports;const S7=Np(E7),j1="wc",k1=2,_u="core",zi=`${j1}@2:${_u}:`,x7={name:_u,logger:"error"},I7={database:":memory:"},D7="crypto",H0="client_ed25519_seed",A7=be.ONE_DAY,M7="keychain",P7="0.3",O7="messages",C7="0.3",R7=be.SIX_HOURS,T7="publisher",W1="irn",N7="error",V1="wss://relay.walletconnect.org",$7="relayer",Ar={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"},L7="_subscription",si={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},F7=.1,Jh="2.17.1",Nt={link_mode:"link_mode",relay:"relay"},q7="0.3",U7="WALLETCONNECT_CLIENT_ID",K0="WALLETCONNECT_LINK_MODE_APPS",qi={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},B7="subscription",z7="0.3",H7=be.FIVE_SECONDS*1e3,K7="pairing",j7="0.3",Ea={wc_pairingDelete:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:be.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:be.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:be.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:be.ONE_DAY,prompt:!1,tag:0},res:{ttl:be.ONE_DAY,prompt:!1,tag:0}}},ns={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},yi={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},k7="history",W7="0.3",V7="expirer",ai={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},G7="0.3",J7="verify-api",Y7="https://verify.walletconnect.com",G1="https://verify.walletconnect.org",Oa=G1,X7=`${Oa}/v3`,Z7=[Y7,G1],Q7="echo",eE="https://echo.walletconnect.com",Li={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},rn={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},wi={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ts={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},rs={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Sa={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},tE=.1,rE="event-client",iE=86400,nE="https://pulse.walletconnect.org/batch";function sE(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var a=0;a<r.length;a++){var o=r.charAt(a),f=o.charCodeAt(0);if(t[f]!==255)throw new TypeError(o+" is ambiguous");t[f]=a}var h=r.length,p=r.charAt(0),l=Math.log(h)/Math.log(256),m=Math.log(256)/Math.log(h);function _(P){if(P instanceof Uint8Array||(ArrayBuffer.isView(P)?P=new Uint8Array(P.buffer,P.byteOffset,P.byteLength):Array.isArray(P)&&(P=Uint8Array.from(P))),!(P instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(P.length===0)return"";for(var H=0,W=0,J=0,q=P.length;J!==q&&P[J]===0;)J++,H++;for(var V=(q-J)*m+1>>>0,L=new Uint8Array(V);J!==q;){for(var U=P[J],z=0,b=V-1;(U!==0||z<W)&&b!==-1;b--,z++)U+=256*L[b]>>>0,L[b]=U%h>>>0,U=U/h>>>0;if(U!==0)throw new Error("Non-zero carry");W=z,J++}for(var T=V-W;T!==V&&L[T]===0;)T++;for(var re=p.repeat(H);T<V;++T)re+=r.charAt(L[T]);return re}function M(P){if(typeof P!="string")throw new TypeError("Expected String");if(P.length===0)return new Uint8Array;var H=0;if(P[H]!==" "){for(var W=0,J=0;P[H]===p;)W++,H++;for(var q=(P.length-H)*l+1>>>0,V=new Uint8Array(q);P[H];){var L=t[P.charCodeAt(H)];if(L===255)return;for(var U=0,z=q-1;(L!==0||U<J)&&z!==-1;z--,U++)L+=h*V[z]>>>0,V[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");J=U,H++}if(P[H]!==" "){for(var b=q-J;b!==q&&V[b]===0;)b++;for(var T=new Uint8Array(W+(q-b)),re=W;b!==q;)T[re++]=V[b++];return T}}}function I(P){var H=M(P);if(H)return H;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:M,decode:I}}var aE=sE,oE=aE;const J1=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},cE=r=>new TextEncoder().encode(r),fE=r=>new TextDecoder().decode(r);class hE{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class uE{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=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 Y1(this,e)}}class dE{constructor(e){this.decoders=e}or(e){return Y1(this,e)}decode(e){const t=e[0],n=this.decoders[t];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 Y1=(r,e)=>new dE({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class lE{constructor(e,t,n,a){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=a,this.encoder=new hE(e,t,n),this.decoder=new uE(e,t,a)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Yc=({name:r,prefix:e,encode:t,decode:n})=>new lE(r,e,t,n),Za=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:a}=oE(t,e);return Yc({prefix:r,name:e,encode:n,decode:o=>J1(a(o))})},pE=(r,e,t,n)=>{const a={};for(let m=0;m<e.length;++m)a[e[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;const f=new Uint8Array(o*t/8|0);let h=0,p=0,l=0;for(let m=0;m<o;++m){const _=a[r[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<t|_,h+=t,h>=8&&(h-=8,f[l++]=255&p>>h)}if(h>=t||255&p<<8-h)throw new SyntaxError("Unexpected end of data");return f},gE=(r,e,t)=>{const n=e[e.length-1]==="=",a=(1<<t)-1;let o="",f=0,h=0;for(let p=0;p<r.length;++p)for(h=h<<8|r[p],f+=8;f>t;)f-=t,o+=e[a&h>>f];if(f&&(o+=e[a&h<<t-f]),n)for(;o.length*t&7;)o+="=";return o},gr=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Yc({prefix:e,name:r,encode(a){return gE(a,n,t)},decode(a){return pE(a,n,t,r)}}),bE=Yc({prefix:"\0",name:"identity",encode:r=>fE(r),decode:r=>cE(r)});var vE=Object.freeze({__proto__:null,identity:bE});const mE=gr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var yE=Object.freeze({__proto__:null,base2:mE});const wE=gr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var _E=Object.freeze({__proto__:null,base8:wE});const EE=Za({prefix:"9",name:"base10",alphabet:"0123456789"});var SE=Object.freeze({__proto__:null,base10:EE});const xE=gr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),IE=gr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var DE=Object.freeze({__proto__:null,base16:xE,base16upper:IE});const AE=gr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ME=gr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),PE=gr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),OE=gr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),CE=gr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),RE=gr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),TE=gr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),NE=gr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$E=gr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var LE=Object.freeze({__proto__:null,base32:AE,base32upper:ME,base32pad:PE,base32padupper:OE,base32hex:CE,base32hexupper:RE,base32hexpad:TE,base32hexpadupper:NE,base32z:$E});const FE=Za({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),qE=Za({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var UE=Object.freeze({__proto__:null,base36:FE,base36upper:qE});const BE=Za({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),zE=Za({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var HE=Object.freeze({__proto__:null,base58btc:BE,base58flickr:zE});const KE=gr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),jE=gr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),kE=gr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),WE=gr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var VE=Object.freeze({__proto__:null,base64:KE,base64pad:jE,base64url:kE,base64urlpad:WE});const X1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),GE=X1.reduce((r,e,t)=>(r[t]=e,r),[]),JE=X1.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function YE(r){return r.reduce((e,t)=>(e+=GE[t],e),"")}function XE(r){const e=[];for(const t of r){const n=JE[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const ZE=Yc({prefix:"🚀",name:"base256emoji",encode:YE,decode:XE});var QE=Object.freeze({__proto__:null,base256emoji:ZE}),eS=Z1,j0=128,tS=127,rS=~tS,iS=Math.pow(2,31);function Z1(r,e,t){e=e||[],t=t||0;for(var n=t;r>=iS;)e[t++]=r&255|j0,r/=128;for(;r&rS;)e[t++]=r&255|j0,r>>>=7;return e[t]=r|0,Z1.bytes=t-n+1,e}var nS=Yh,sS=128,k0=127;function Yh(r,n){var t=0,n=n||0,a=0,o=n,f,h=r.length;do{if(o>=h)throw Yh.bytes=0,new RangeError("Could not decode varint");f=r[o++],t+=a<28?(f&k0)<<a:(f&k0)*Math.pow(2,a),a+=7}while(f>=sS);return Yh.bytes=o-n,t}var aS=Math.pow(2,7),oS=Math.pow(2,14),cS=Math.pow(2,21),fS=Math.pow(2,28),hS=Math.pow(2,35),uS=Math.pow(2,42),dS=Math.pow(2,49),lS=Math.pow(2,56),pS=Math.pow(2,63),gS=function(r){return r<aS?1:r<oS?2:r<cS?3:r<fS?4:r<hS?5:r<uS?6:r<dS?7:r<lS?8:r<pS?9:10},bS={encode:eS,decode:nS,encodingLength:gS},Q1=bS;const W0=(r,e,t=0)=>(Q1.encode(r,e,t),e),V0=r=>Q1.encodingLength(r),Xh=(r,e)=>{const t=e.byteLength,n=V0(r),a=n+V0(t),o=new Uint8Array(a+t);return W0(r,o,0),W0(t,o,n),o.set(e,a),new vS(r,t,e,o)};class vS{constructor(e,t,n,a){this.code=e,this.size=t,this.digest=n,this.bytes=a}}const eg=({name:r,code:e,encode:t})=>new mS(r,e,t);class mS{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Xh(this.code,t):t.then(n=>Xh(this.code,n))}else throw Error("Unknown type, must be binary type")}}const tg=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),yS=eg({name:"sha2-256",code:18,encode:tg("SHA-256")}),wS=eg({name:"sha2-512",code:19,encode:tg("SHA-512")});var _S=Object.freeze({__proto__:null,sha256:yS,sha512:wS});const rg=0,ES="identity",ig=J1,SS=r=>Xh(rg,ig(r)),xS={code:rg,name:ES,encode:ig,digest:SS};var IS=Object.freeze({__proto__:null,identity:xS});new TextEncoder,new TextDecoder;const G0={...vE,...yE,..._E,...SE,...DE,...LE,...UE,...HE,...VE,...QE};({..._S,...IS});function DS(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function ng(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const J0=ng("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),xh=ng("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=DS(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),AS={utf8:J0,"utf-8":J0,hex:G0.base16,latin1:xh,ascii:xh,binary:xh,...G0};function MS(r,e="utf8"){const t=AS[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}class PS{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=M7,this.version=P7,this.initialized=!1,this.storagePrefix=zi,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,a)=>{this.isInitialized(),this.keychain.set(n,a),await this.persist()},this.get=n=>{this.isInitialized();const a=this.keychain.get(n);if(typeof a>"u"){const{message:o}=pe("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(o)}return a},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Or(t,this.name)}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,m1(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?y1(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}let OS=class{constructor(e,t,n){this.core=e,this.logger=t,this.name=D7,this.randomSessionIdentifier=kh(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=a=>(this.isInitialized(),this.keychain.has(a)),this.getClientId=async()=>{this.isInitialized();const a=await this.getClientSeed(),o=e0(a);return p1(o.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const a=N8();return this.setPrivateKey(a.publicKey,a.privateKey)},this.signJWT=async a=>{this.isInitialized();const o=await this.getClientSeed(),f=e0(o),h=this.randomSessionIdentifier;return await j5(h,a,A7,f)},this.generateSharedKey=(a,o,f)=>{this.isInitialized();const h=this.getPrivateKey(a),p=$8(h,o);return this.setSymKey(p,f)},this.setSymKey=async(a,o)=>{this.isInitialized();const f=o||dc(a);return await this.keychain.set(f,a),f},this.deleteKeyPair=async a=>{this.isInitialized(),await this.keychain.del(a)},this.deleteSymKey=async a=>{this.isInitialized(),await this.keychain.del(a)},this.encode=async(a,o,f)=>{this.isInitialized();const h=P1(f),p=on(o);if(p0(h))return F8(p,f==null?void 0:f.encoding);if(l0(h)){const M=h.senderPublicKey,I=h.receiverPublicKey;a=await this.generateSharedKey(M,I)}const l=this.getSymKey(a),{type:m,senderPublicKey:_}=h;return L8({type:m,symKey:l,message:p,senderPublicKey:_,encoding:f==null?void 0:f.encoding})},this.decode=async(a,o,f)=>{this.isInitialized();const h=B8(o,f);if(p0(h)){const p=U8(o,f==null?void 0:f.encoding);return cs(p)}if(l0(h)){const p=h.receiverPublicKey,l=h.senderPublicKey;a=await this.generateSharedKey(p,l)}try{const p=this.getSymKey(a),l=q8({symKey:p,encoded:o,encoding:f==null?void 0:f.encoding});return cs(l)}catch(p){this.logger.error(`Failed to decode message from topic: '${a}', clientId: '${await this.getClientId()}'`),this.logger.error(p)}},this.getPayloadType=(a,o=Sn)=>{const f=Na({encoded:a,encoding:o});return hs(f.type)},this.getPayloadSenderPublicKey=(a,o=Sn)=>{const f=Na({encoded:a,encoding:o});return f.senderPublicKey?cr(f.senderPublicKey,Pr):void 0},this.core=e,this.logger=Or(t,this.name),this.keychain=n||new PS(this.core,this.logger)}get context(){return Ur(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H0)}catch{e=kh(),await this.keychain.set(H0,e)}return MS(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}};class CS extends j9{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=O7,this.version=C7,this.initialized=!1,this.storagePrefix=zi,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,a)=>{this.isInitialized();const o=nn(a);let f=this.messages.get(n);return typeof f>"u"&&(f={}),typeof f[o]<"u"||(f[o]=a,this.messages.set(n,f),await this.persist()),o},this.get=n=>{this.isInitialized();let a=this.messages.get(n);return typeof a>"u"&&(a={}),a},this.has=(n,a)=>{this.isInitialized();const o=this.get(n),f=nn(a);return typeof o[f]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Or(e,this.name),this.core=t}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,m1(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?y1(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class RS extends k9{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new hi.EventEmitter,this.name=T7,this.queue=new Map,this.publishTimeout=be.toMiliseconds(be.ONE_MINUTE),this.failedPublishTimeout=be.toMiliseconds(be.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,a,o)=>{var f;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:a,opts:o}});const h=(o==null?void 0:o.ttl)||R7,p=Wh(o),l=(o==null?void 0:o.prompt)||!1,m=(o==null?void 0:o.tag)||0,_=(o==null?void 0:o.id)||as().toString(),M={topic:n,message:a,opts:{ttl:h,relay:p,prompt:l,tag:m,id:_,attestation:o==null?void 0:o.attestation}},I=`Failed to publish payload, please try again. id:${_} tag:${m}`,P=Date.now();let H,W=1;try{for(;H===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(I);this.logger.trace({id:_,attempts:W},`publisher.publish - attempt ${W}`),H=await await js(this.rpcPublish(n,a,h,p,l,m,_,o==null?void 0:o.attestation).catch(J=>this.logger.warn(J)),this.publishTimeout,I),W++,H||await new Promise(J=>setTimeout(J,this.failedPublishTimeout))}this.relayer.events.emit(Ar.publish,M),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:_,topic:n,message:a,opts:o}})}catch(J){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(J),(f=o==null?void 0:o.internal)!=null&&f.throwOnFailedPublish)throw J;this.queue.set(_,M)}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.relayer=e,this.logger=Or(t,this.name),this.registerEventListeners()}get context(){return Ur(this.logger)}rpcPublish(e,t,n,a,o,f,h,p){var l,m,_,M;const I={method:Da(a.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:o,tag:f,attestation:p},id:h};return Mr((l=I.params)==null?void 0:l.prompt)&&((m=I.params)==null||delete m.prompt),Mr((_=I.params)==null?void 0:_.tag)&&((M=I.params)==null||delete M.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:I}),this.relayer.request(I)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:n,opts:a}=e;await this.publish(t,n,a)})}registerEventListeners(){this.relayer.core.heartbeat.on(Zs.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Ar.connection_stalled);return}this.checkQueue()}),this.relayer.on(Ar.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TS{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const a=n.filter(o=>o!==t);if(!a.length){this.map.delete(e);return}this.map.set(e,a)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var NS=Object.defineProperty,$S=Object.defineProperties,LS=Object.getOwnPropertyDescriptors,Y0=Object.getOwnPropertySymbols,FS=Object.prototype.hasOwnProperty,qS=Object.prototype.propertyIsEnumerable,X0=(r,e,t)=>e in r?NS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xa=(r,e)=>{for(var t in e||(e={}))FS.call(e,t)&&X0(r,t,e[t]);if(Y0)for(var t of Y0(e))qS.call(e,t)&&X0(r,t,e[t]);return r},Ih=(r,e)=>$S(r,LS(e));class US extends G9{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new TS,this.events=new hi.EventEmitter,this.name=B7,this.version=z7,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=zi,this.subscribeTimeout=be.toMiliseconds(be.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,a)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}});try{const o=Wh(a),f={topic:n,relay:o,transportType:a==null?void 0:a.transportType};this.pending.set(n,f);const h=await this.rpcSubscribe(n,o,a);return typeof h=="string"&&(this.onSubscribe(h,f),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}})),h}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}},this.unsubscribe=async(n,a)=>{await this.restartToComplete(),this.isInitialized(),typeof(a==null?void 0:a.id)<"u"?await this.unsubscribeById(n,a.id,a):await this.unsubscribeByTopic(n,a)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const a=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((o,f)=>{const h=new be.Watch;h.start(a);const p=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(p),h.stop(a),o(!0)),h.elapsed(a)>=H7&&(clearInterval(p),h.stop(a),f(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},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=Or(t,this.name),this.clientId=""}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map(async a=>await this.unsubscribeById(e,a,t)))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const a=Wh(n);await this.rpcUnsubscribe(e,t,a);const o=It("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,o),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(a){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(a),a}}async rpcSubscribe(e,t,n){var a;(n==null?void 0:n.transportType)===Nt.relay&&await this.restartToComplete();const o={method:Da(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o});const f=(a=n==null?void 0:n.internal)==null?void 0:a.throwOnFailedPublish;try{const h=nn(e+this.clientId);if((n==null?void 0:n.transportType)===Nt.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(o).catch(l=>this.logger.warn(l))},be.toMiliseconds(be.ONE_SECOND)),h;const p=await js(this.relayer.request(o).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!p&&f)throw new Error(`Subscribing to ${e} failed, please try again`);return p?h:null}catch(h){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ar.connection_stalled),f)throw h}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,n={method:Da(t.protocol).batchSubscribe,params:{topics:e.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await js(this.relayer.request(n).catch(a=>this.logger.warn(a)),this.subscribeTimeout)}catch{this.relayer.events.emit(Ar.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,n={method:Da(t.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 a;try{a=await await js(this.relayer.request(n).catch(o=>this.logger.warn(o)),this.subscribeTimeout)}catch{this.relayer.events.emit(Ar.connection_stalled)}return a}rpcUnsubscribe(e,t,n){const a={method:Da(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a}),this.relayer.request(a)}onSubscribe(e,t){this.setSubscription(e,Ih(xa({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,xa({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,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,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,xa({},t)),this.topicMap.set(t.topic,e),this.events.emit(qi.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:n}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(qi.deleted,Ih(xa({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(qi.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(n),await this.batchSubscribe(n)}}this.events.emit(qi.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Bi(t)&&this.onBatchSubscribe(t.map((n,a)=>Ih(xa({},e[a]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Zs.pulse,async()=>{await this.checkPending()}),this.events.on(qi.created,async e=>{const t=qi.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(qi.deleted,async e=>{const t=qi.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var BS=Object.defineProperty,Z0=Object.getOwnPropertySymbols,zS=Object.prototype.hasOwnProperty,HS=Object.prototype.propertyIsEnumerable,Q0=(r,e,t)=>e in r?BS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ep=(r,e)=>{for(var t in e||(e={}))zS.call(e,t)&&Q0(r,t,e[t]);if(Z0)for(var t of Z0(e))HS.call(e,t)&&Q0(r,t,e[t]);return r};class KS extends W9{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new hi.EventEmitter,this.name=$7,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=be.toMiliseconds(be.THIRTY_SECONDS+be.ONE_SECOND),this.request=async t=>{var n,a;this.logger.debug("Publishing Request Payload");const o=t.id||as().toString();await this.toEstablishConnection();try{const f=this.provider.request(t);this.requestsInFlight.set(o,{promise:f,request:t}),this.logger.trace({id:o,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const h=await new Promise(async(p,l)=>{const m=()=>{l(new Error(`relayer.request - publish interrupted, id: ${o}`))};this.provider.on(si.disconnect,m);const _=await f;this.provider.off(si.disconnect,m),p(_)});return this.logger.trace({id:o,method:t.method,topic:(a=t.params)==null?void 0:a.topic},"relayer.request - published"),h}catch(f){throw this.logger.debug(`Failed to Publish Request: ${o}`),f}finally{this.requestsInFlight.delete(o)}},this.resetPingTimeout=()=>{if(Sc())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,n,a;(a=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null||a.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Ar.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Ar.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(si.payload,this.onPayloadHandler),this.provider.on(si.connect,this.onConnectHandler),this.provider.on(si.disconnect,this.onDisconnectHandler),this.provider.on(si.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Or(e.logger,this.name):Ya(Wc({level:e.logger||N7})),this.messages=new CS(this.logger,e.core),this.subscriber=new US(this,this.logger),this.publisher=new RS(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||V1,this.projectId=e.projectId,this.bundleId=Z5(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Ur(this.logger)}get connected(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===1}get connecting(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===0}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Nt.relay})}async subscribe(e,t){var n,a,o;this.isInitialized(),(t==null?void 0:t.transportType)==="relay"&&await this.toEstablishConnection();const f=typeof((n=t==null?void 0:t.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(a=t==null?void 0:t.internal)==null?void 0:a.throwOnFailedPublish;let h=((o=this.subscriber.topicMap.get(e))==null?void 0:o[0])||"",p;const l=m=>{m.topic===e&&(this.subscriber.off(qi.created,l),p())};return await Promise.all([new Promise(m=>{p=m,this.subscriber.on(qi.created,l)}),new Promise(async(m,_)=>{h=await this.subscriber.subscribe(e,ep({internal:{throwOnFailedPublish:f}},t)).catch(M=>{f&&_(M)})||h,m()})]),h}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await js(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,n)=>{const a=()=>{this.provider.off(si.disconnect,a),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(si.disconnect,a),await js(this.provider.connect(),be.toMiliseconds(be.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{n(o)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(o=>{this.logger.error(o),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const n=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await I0())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((n,a)=>n.publishedAt-a.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const n of t)try{await this.onMessageEvent(n)}catch(a){this.logger.warn(a)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:n}=e;if(!t.sessionExists){const a=rr(be.FIVE_MINUTES),o={topic:n,expiry:a,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,o)}this.events.emit(Ar.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,n,a,o;if(Sc())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((o=(a=(n=this.provider)==null?void 0:n.connection)==null?void 0:a.socket)==null||o.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(f){this.logger.warn(f)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new xi(new _7(r8({sdkVersion:Jh,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const a=this.messages.has(t,n);return a&&this.logger.debug(`Ignoring duplicate message: ${n}`),a}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),wu(e)){if(!e.method.endsWith(L7))return;const t=e.params,{topic:n,message:a,publishedAt:o,attestation:f}=t.data,h={topic:n,message:a,publishedAt:o,transportType:Nt.relay,attestation:f};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ep({type:"event",event:t.id},h)),this.events.emit(t.id,h),await this.acknowledgePayload(e),await this.onMessageEvent(h)}else Jc(e)&&this.events.emit(Ar.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ar.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Vc(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(si.payload,this.onPayloadHandler),this.provider.off(si.connect,this.onConnectHandler),this.provider.off(si.disconnect,this.onDisconnectHandler),this.provider.off(si.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await I0();T4(async t=>{e!==t&&(e=t,t?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(Ar.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},be.toMiliseconds(F7))))}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var jS=Object.defineProperty,tp=Object.getOwnPropertySymbols,kS=Object.prototype.hasOwnProperty,WS=Object.prototype.propertyIsEnumerable,rp=(r,e,t)=>e in r?jS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ip=(r,e)=>{for(var t in e||(e={}))kS.call(e,t)&&rp(r,t,e[t]);if(tp)for(var t of tp(e))WS.call(e,t)&&rp(r,t,e[t]);return r};class gs extends V9{constructor(e,t,n,a=zi,o=void 0){super(e,t,n,a),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version=q7,this.cached=[],this.initialized=!1,this.storagePrefix=zi,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(f=>{this.getKey&&f!==null&&!Mr(f)?this.map.set(this.getKey(f),f):h4(f)?this.map.set(f.id,f):u4(f)&&this.map.set(f.topic,f)}),this.cached=[],this.initialized=!0)},this.set=async(f,h)=>{this.isInitialized(),this.map.has(f)?await this.update(f,h):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:f,value:h}),this.map.set(f,h),await this.persist())},this.get=f=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:f}),this.getData(f)),this.getAll=f=>(this.isInitialized(),f?this.values.filter(h=>Object.keys(f).every(p=>S7(h[p],f[p]))):this.values),this.update=async(f,h)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:f,update:h});const p=ip(ip({},this.getData(f)),h);this.map.set(f,p),await this.persist()},this.delete=async(f,h)=>{this.isInitialized(),this.map.has(f)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:f,reason:h}),this.map.delete(f),this.addToRecentlyDeleted(f),await this.persist())},this.logger=Or(t,this.name),this.storagePrefix=a,this.getKey=o}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:a}=pe("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(a),new Error(a)}const{message:n}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VS{constructor(e,t){this.core=e,this.logger=t,this.name=K7,this.version=j7,this.events=new tu,this.initialized=!1,this.storagePrefix=zi,this.ignoredPayloadTypes=[an],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 a=kh(),o=await this.core.crypto.setSymKey(a),f=rr(be.FIVE_MINUTES),h={protocol:W1},p={topic:o,expiry:f,relay:h,active:!1,methods:n==null?void 0:n.methods},l=y0({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:a,relay:h,expiryTimestamp:f,methods:n==null?void 0:n.methods});return this.events.emit(ns.create,p),this.core.expirer.set(o,f),await this.pairings.set(o,p),await this.core.relayer.subscribe(o,{transportType:n==null?void 0:n.transportType}),{topic:o,uri:l}},this.pair=async n=>{this.isInitialized();const a=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Li.pairing_started]}});this.isValidPair(n,a);const{topic:o,symKey:f,relay:h,expiryTimestamp:p,methods:l}=m0(n.uri);a.props.properties.topic=o,a.addTrace(Li.pairing_uri_validation_success),a.addTrace(Li.pairing_uri_not_expired);let m;if(this.pairings.keys.includes(o)){if(m=this.pairings.get(o),a.addTrace(Li.existing_pairing),m.active)throw a.setError(rn.active_pairing_already_exists),new Error(`Pairing already exists: ${o}. Please try again with a new connection URI.`);a.addTrace(Li.pairing_not_expired)}const _=p||rr(be.FIVE_MINUTES),M={topic:o,relay:h,expiry:_,active:!1,methods:l};this.core.expirer.set(o,_),await this.pairings.set(o,M),a.addTrace(Li.store_new_pairing),n.activatePairing&&await this.activate({topic:o}),this.events.emit(ns.create,M),a.addTrace(Li.emit_inactive_pairing),this.core.crypto.keychain.has(o)||await this.core.crypto.setSymKey(f,o),a.addTrace(Li.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{a.setError(rn.no_internet_connection)}try{await this.core.relayer.subscribe(o,{relay:h})}catch(I){throw a.setError(rn.subscribe_pairing_topic_failure),I}return a.addTrace(Li.subscribe_pairing_topic_success),M},this.activate=async({topic:n})=>{this.isInitialized();const a=rr(be.THIRTY_DAYS);this.core.expirer.set(n,a),await this.pairings.update(n,{active:!0,expiry:a})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:a}=n;if(this.pairings.keys.includes(a)){const o=await this.sendRequest(a,"wc_pairingPing",{}),{done:f,resolve:h,reject:p}=is();this.events.once(dt("pairing_ping",o),({error:l})=>{l?p(l):h()}),await f()}},this.updateExpiry=async({topic:n,expiry:a})=>{this.isInitialized(),await this.pairings.update(n,{expiry:a})},this.updateMetadata=async({topic:n,metadata:a})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:a})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:a}=n;this.pairings.keys.includes(a)&&(await this.sendRequest(a,"wc_pairingDelete",It("USER_DISCONNECTED")),await this.deletePairing(a))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:a,relay:o,expiry:f,methods:h}=n,p=this.core.crypto.keychain.get(a);return y0({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:p,relay:o,expiryTimestamp:f,methods:h})},this.sendRequest=async(n,a,o)=>{const f=xn(a,o),h=await this.core.crypto.encode(n,f),p=Ea[a].req;return this.core.history.set(n,f),this.core.relayer.publish(n,h,p),f.id},this.sendResult=async(n,a,o)=>{const f=Vc(n,o),h=await this.core.crypto.encode(a,f),p=await this.core.history.get(a,n),l=Ea[p.request.method].res;await this.core.relayer.publish(a,h,l),await this.core.history.resolve(f)},this.sendError=async(n,a,o)=>{const f=Gc(n,o),h=await this.core.crypto.encode(a,f),p=await this.core.history.get(a,n),l=Ea[p.request.method]?Ea[p.request.method].res:Ea.unregistered_method.res;await this.core.relayer.publish(a,h,l),await this.core.history.resolve(f)},this.deletePairing=async(n,a)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,It("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),a?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(a=>_n(a.expiry));await Promise.all(n.map(a=>this.deletePairing(a.topic)))},this.onRelayEventRequest=n=>{const{topic:a,payload:o}=n;switch(o.method){case"wc_pairingPing":return this.onPairingPingRequest(a,o);case"wc_pairingDelete":return this.onPairingDeleteRequest(a,o);default:return this.onUnknownRpcMethodRequest(a,o)}},this.onRelayEventResponse=async n=>{const{topic:a,payload:o}=n,f=(await this.core.history.get(a,o.id)).request.method;switch(f){case"wc_pairingPing":return this.onPairingPingResponse(a,o);default:return this.onUnknownRpcMethodResponse(f)}},this.onPairingPingRequest=async(n,a)=>{const{id:o}=a;try{this.isValidPing({topic:n}),await this.sendResult(o,n,!0),this.events.emit(ns.ping,{id:o,topic:n})}catch(f){await this.sendError(o,n,f),this.logger.error(f)}},this.onPairingPingResponse=(n,a)=>{const{id:o}=a;setTimeout(()=>{Fi(a)?this.events.emit(dt("pairing_ping",o),{}):oi(a)&&this.events.emit(dt("pairing_ping",o),{error:a.error})},500)},this.onPairingDeleteRequest=async(n,a)=>{const{id:o}=a;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(ns.delete,{id:o,topic:n})}catch(f){await this.sendError(o,n,f),this.logger.error(f)}},this.onUnknownRpcMethodRequest=async(n,a)=>{const{id:o,method:f}=a;try{if(this.registeredMethods.includes(f))return;const h=It("WC_METHOD_UNSUPPORTED",f);await this.sendError(o,n,h),this.logger.error(h)}catch(h){await this.sendError(o,n,h),this.logger.error(h)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(It("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,a)=>{var o;if(!Fr(n)){const{message:h}=pe("MISSING_OR_INVALID",`pair() params: ${n}`);throw a.setError(rn.malformed_pairing_uri),new Error(h)}if(!f4(n.uri)){const{message:h}=pe("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw a.setError(rn.malformed_pairing_uri),new Error(h)}const f=m0(n==null?void 0:n.uri);if(!((o=f==null?void 0:f.relay)!=null&&o.protocol)){const{message:h}=pe("MISSING_OR_INVALID","pair() uri#relay-protocol");throw a.setError(rn.malformed_pairing_uri),new Error(h)}if(!(f!=null&&f.symKey)){const{message:h}=pe("MISSING_OR_INVALID","pair() uri#symKey");throw a.setError(rn.malformed_pairing_uri),new Error(h)}if(f!=null&&f.expiryTimestamp&&be.toMiliseconds(f==null?void 0:f.expiryTimestamp)<Date.now()){a.setError(rn.pairing_expired);const{message:h}=pe("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(h)}},this.isValidPing=async n=>{if(!Fr(n)){const{message:o}=pe("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(o)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidDisconnect=async n=>{if(!Fr(n)){const{message:o}=pe("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(o)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidPairingTopic=async n=>{if(!Xt(n,!1)){const{message:a}=pe("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(a)}if(!this.pairings.keys.includes(n)){const{message:a}=pe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(a)}if(_n(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:a}=pe("EXPIRED",`pairing topic: ${n}`);throw new Error(a)}},this.core=e,this.logger=Or(t,this.name),this.pairings=new gs(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ur(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ar.message,async e=>{const{topic:t,message:n,transportType:a}=e;if(!this.pairings.keys.includes(t)||a===Nt.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const o=await this.core.crypto.decode(t,n);try{wu(o)?(this.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):Jc(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.core.history.delete(t,o.id))}catch(f){this.logger.error(f)}})}registerExpirerEvents(){this.core.expirer.on(ai.expired,async e=>{const{topic:t}=_1(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(ns.expire,{topic:t}))})}}class GS extends K9{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new hi.EventEmitter,this.name=k7,this.version=W7,this.cached=[],this.initialized=!1,this.storagePrefix=zi,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,a,o)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:a,chainId:o}),this.records.has(a.id))return;const f={id:a.id,topic:n,request:{method:a.method,params:a.params||null},chainId:o,expiry:rr(be.THIRTY_DAYS)};this.records.set(f.id,f),this.persist(),this.events.emit(yi.created,f)},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 a=await this.getRecord(n.id);typeof a.response>"u"&&(a.response=oi(n)?{error:n.error}:{result:n.result},this.records.set(a.id,a),this.persist(),this.events.emit(yi.updated,a))},this.get=async(n,a)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:a}),await this.getRecord(a)),this.delete=(n,a)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:a}),this.values.forEach(o=>{if(o.topic===n){if(typeof a<"u"&&o.id!==a)return;this.records.delete(o.id),this.events.emit(yi.deleted,o)}}),this.persist()},this.exists=async(n,a)=>(this.isInitialized(),this.records.has(a)?(await this.getRecord(a)).topic===n:!1),this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Or(t,this.name)}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:xn(t.request.method,t.request.params,t.id),chainId:t.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 t=this.records.get(e);if(!t){const{message:n}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(yi.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(yi.created,e=>{const t=yi.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(yi.updated,e=>{const t=yi.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(yi.deleted,e=>{const t=yi.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(Zs.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{be.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(yi.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class JS extends J9{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new hi.EventEmitter,this.name=V7,this.version=G7,this.cached=[],this.initialized=!1,this.storagePrefix=zi,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 a=this.formatTarget(n);return typeof this.getExpiration(a)<"u"}catch{return!1}},this.set=(n,a)=>{this.isInitialized();const o=this.formatTarget(n),f={target:o,expiry:a};this.expirations.set(o,f),this.checkExpiry(o,f),this.events.emit(ai.created,{target:o,expiration:f})},this.get=n=>{this.isInitialized();const a=this.formatTarget(n);return this.getExpiration(a)},this.del=n=>{if(this.isInitialized(),this.has(n)){const a=this.formatTarget(n),o=this.getExpiration(a);this.expirations.delete(a),this.events.emit(ai.deleted,{target:a,expiration:o})}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Or(t,this.name)}get context(){return Ur(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 i8(e);if(typeof e=="number")return n8(e);const{message:t}=pe("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ai.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:n}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return t}checkExpiry(e,t){const{expiry:n}=t;be.toMiliseconds(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(ai.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(Zs.pulse,()=>this.checkExpirations()),this.events.on(ai.created,e=>{const t=ai.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(ai.expired,e=>{const t=ai.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(ai.deleted,e=>{const t=ai.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class YS extends Y9{constructor(e,t,n){super(e,t,n),this.core=e,this.logger=t,this.store=n,this.name=J7,this.verifyUrlV3=X7,this.storagePrefix=zi,this.version=k1,this.init=async()=>{var a;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&be.toMiliseconds((a=this.publicKey)==null?void 0:a.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async a=>{if(!ka()||this.isDevEnv)return;const o=window.location.origin,{id:f,decryptedId:h}=a,p=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${o}&id=${f}&decryptedId=${h}`;try{const l=Ua(),m=this.startAbortTimer(be.ONE_SECOND*5),_=await new Promise((M,I)=>{const P=()=>{window.removeEventListener("message",W),l.body.removeChild(H),I("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const H=l.createElement("iframe");H.src=p,H.style.display="none",H.addEventListener("error",P,{signal:this.abortController.signal});const W=J=>{if(J.data&&typeof J.data=="string")try{const q=JSON.parse(J.data);if(q.type==="verify_attestation"){if(Kh(q.attestation).payload.id!==f)return;clearInterval(m),l.body.removeChild(H),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",W),M(q.attestation===null?"":q.attestation)}}catch(q){this.logger.warn(q)}};l.body.appendChild(H),window.addEventListener("message",W,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",_),_}catch(l){this.logger.warn(l)}return""},this.resolve=async a=>{if(this.isDevEnv)return"";const{attestationId:o,hash:f,encryptedId:h}=a;if(o===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(o){if(Kh(o).payload.id!==h)return;const l=await this.isValidJwtAttestation(o);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!f)return;const p=this.getVerifyUrl(a==null?void 0:a.verifyUrl);return this.fetchAttestation(f,p)},this.fetchAttestation=async(a,o)=>{this.logger.debug(`resolving attestation: ${a} from url: ${o}`);const f=this.startAbortTimer(be.ONE_SECOND*5),h=await fetch(`${o}/attestation/${a}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(f),h.status===200?await h.json():void 0},this.getVerifyUrl=a=>{let o=a||Oa;return Z7.includes(o)||(this.logger.info(`verify url: ${o}, not included in trusted list, assigning default: ${Oa}`),o=Oa),o},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const a=this.startAbortTimer(be.FIVE_SECONDS),o=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(a),await o.json()}catch(a){this.logger.warn(a)}},this.persistPublicKey=async a=>{this.logger.debug("persisting public key to local storage",a),await this.store.setItem(this.storeKey,a),this.publicKey=a},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async a=>{const o=await this.getPublicKey();try{if(o)return this.validateAttestation(a,o)}catch(h){this.logger.error(h),this.logger.warn("error validating attestation")}const f=await this.fetchAndPersistPublicKey();try{if(f)return this.validateAttestation(a,f)}catch(h){this.logger.error(h),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async o=>{const f=await this.fetchPublicKey();f&&(await this.persistPublicKey(f),o(f))});const a=await this.fetchPromise;return this.fetchPromise=void 0,a},this.validateAttestation=(a,o)=>{const f=j8(a,o.publicKey),h={hasExpired:be.toMiliseconds(f.exp)<Date.now(),payload:f};if(h.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:h.payload.origin,isScam:h.payload.isScam,isVerified:h.payload.isVerified}},this.logger=Or(t,this.name),this.abortController=new AbortController,this.isDevEnv=lu(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ur(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),be.toMiliseconds(e))}}class XS extends X9{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=Q7,this.registerDeviceToken=async n=>{const{clientId:a,token:o,notificationType:f,enableEncrypted:h=!1}=n,p=`${eE}/${this.projectId}/clients`;await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:a,type:f,token:o,always_raw:h})})},this.logger=Or(t,this.context)}}var ZS=Object.defineProperty,np=Object.getOwnPropertySymbols,QS=Object.prototype.hasOwnProperty,ex=Object.prototype.propertyIsEnumerable,sp=(r,e,t)=>e in r?ZS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ia=(r,e)=>{for(var t in e||(e={}))QS.call(e,t)&&sp(r,t,e[t]);if(np)for(var t of np(e))ex.call(e,t)&&sp(r,t,e[t]);return r};class tx extends Z9{constructor(e,t,n=!0){super(e,t,n),this.core=e,this.logger=t,this.context=rE,this.storagePrefix=zi,this.storageVersion=tE,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!lu())try{const a={eventId:a0(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:v1(this.core.relayer.protocol,this.core.relayer.version,Jh)}}};await this.sendEvent([a])}catch(a){this.logger.warn(a)}},this.createEvent=a=>{const{event:o="ERROR",type:f="",properties:{topic:h,trace:p}}=a,l=a0(),m=this.core.projectId||"",_=Date.now(),M=Ia({eventId:l,timestamp:_,props:{event:o,type:f,properties:{topic:h,trace:p}},bundleId:m,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,M),this.shouldPersist=!0),M},this.getEvent=a=>{const{eventId:o,topic:f}=a;if(o)return this.events.get(o);const h=Array.from(this.events.values()).find(p=>p.props.properties.topic===f);if(h)return Ia(Ia({},h),this.setMethods(h.eventId))},this.deleteEvent=a=>{const{eventId:o}=a;this.events.delete(o),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Zs.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(a=>{be.fromMiliseconds(Date.now())-be.fromMiliseconds(a.timestamp)>iE&&(this.events.delete(a.eventId),this.shouldPersist=!0)})})},this.setMethods=a=>({addTrace:o=>this.addTrace(a,o),setError:o=>this.setError(a,o)}),this.addTrace=(a,o)=>{const f=this.events.get(a);f&&(f.props.properties.trace.push(o),this.events.set(a,f),this.shouldPersist=!0)},this.setError=(a,o)=>{const f=this.events.get(a);f&&(f.props.type=o,f.timestamp=Date.now(),this.events.set(a,f),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const a=await this.core.storage.getItem(this.storageKey)||[];if(!a.length)return;a.forEach(o=>{this.events.set(o.eventId,Ia(Ia({},o),this.setMethods(o.eventId)))})}catch(a){this.logger.warn(a)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const a=[];for(const[o,f]of this.events)f.props.type&&a.push(f);if(a.length!==0)try{if((await this.sendEvent(a)).ok)for(const o of a)this.events.delete(o.eventId),this.shouldPersist=!0}catch(o){this.logger.warn(o)}},this.sendEvent=async a=>{const o=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Jh}${o}`,{method:"POST",body:JSON.stringify(a)})},this.getAppDomain=()=>b1().url,this.logger=Or(t,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var rx=Object.defineProperty,ap=Object.getOwnPropertySymbols,ix=Object.prototype.hasOwnProperty,nx=Object.prototype.propertyIsEnumerable,op=(r,e,t)=>e in r?rx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,cp=(r,e)=>{for(var t in e||(e={}))ix.call(e,t)&&op(r,t,e[t]);if(ap)for(var t of ap(e))nx.call(e,t)&&op(r,t,e[t]);return r};class Eu extends H9{constructor(e){var t;super(e),this.protocol=j1,this.version=k1,this.name=_u,this.events=new hi.EventEmitter,this.initialized=!1,this.on=(f,h)=>this.events.on(f,h),this.once=(f,h)=>this.events.once(f,h),this.off=(f,h)=>this.events.off(f,h),this.removeListener=(f,h)=>this.events.removeListener(f,h),this.dispatchEnvelope=({topic:f,message:h,sessionExists:p})=>{if(!f||!h)return;const l={topic:f,message:h,publishedAt:Date.now(),transportType:Nt.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:p})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||V1,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=Wc({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:x7.logger}),{logger:a,chunkLoggerController:o}=z9({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var f,h;(f=this.logChunkController)!=null&&f.downloadLogsBlobInBrowser&&((h=this.logChunkController)==null||h.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Or(a,this.name),this.heartbeat=new F4,this.crypto=new OS(this,this.logger,e==null?void 0:e.keychain),this.history=new GS(this,this.logger),this.expirer=new JS(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new l9(cp(cp({},I7),e==null?void 0:e.storageOptions)),this.relayer=new KS({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new VS(this,this.logger),this.verify=new YS(this,this.logger,this.storage),this.echoClient=new XS(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new tx(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const t=new Eu(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(U7,n),t}get context(){return Ur(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(K0,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(K0)||[],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 sx=Eu,sg="wc",ag=2,og="client",Su=`${sg}@${ag}:${og}:`,Dh={name:og,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},fp="WALLETCONNECT_DEEPLINK_CHOICE",ax="proposal",cg="Proposal expired",ox="session",qs=be.SEVEN_DAYS,cx="engine",sr={wc_sessionPropose:{req:{ttl:be.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1104},res:{ttl:be.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1106},res:{ttl:be.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:be.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:be.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1112},res:{ttl:be.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1114},res:{ttl:be.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:be.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:be.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1119}}},Ah={min:be.FIVE_MINUTES,max:be.SEVEN_DAYS},$i={idle:"IDLE",active:"ACTIVE"},fx="request",hx=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ux="wc",dx="auth",lx="authKeys",px="pairingTopics",gx="requests",Xc=`${ux}@${1.5}:${dx}:`,gc=`${Xc}:PUB_KEY`;var bx=Object.defineProperty,vx=Object.defineProperties,mx=Object.getOwnPropertyDescriptors,hp=Object.getOwnPropertySymbols,yx=Object.prototype.hasOwnProperty,wx=Object.prototype.propertyIsEnumerable,up=(r,e,t)=>e in r?bx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wt=(r,e)=>{for(var t in e||(e={}))yx.call(e,t)&&up(r,t,e[t]);if(hp)for(var t of hp(e))wx.call(e,t)&&up(r,t,e[t]);return r},_i=(r,e)=>vx(r,mx(e));class _x extends e7{constructor(e){super(e),this.name=cx,this.events=new tu,this.initialized=!1,this.requestQueue={state:$i.idle,queue:[]},this.sessionRequestQueue={state:$i.idle,queue:[]},this.requestQueueDelay=be.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(sr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},be.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=_i(Wt({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:a,requiredNamespaces:o,optionalNamespaces:f,sessionProperties:h,relays:p}=n;let l=a,m,_=!1;try{l&&(_=this.client.core.pairing.pairings.get(l).active)}catch(L){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),L}if(!l||!_){const{topic:L,uri:U}=await this.client.core.pairing.create();l=L,m=U}if(!l){const{message:L}=pe("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(L)}const M=await this.client.core.crypto.generateKeyPair(),I=sr.wc_sessionPropose.req.ttl||be.FIVE_MINUTES,P=rr(I),H=Wt({requiredNamespaces:o,optionalNamespaces:f,relays:p??[{protocol:W1}],proposer:{publicKey:M,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},h&&{sessionProperties:h}),{reject:W,resolve:J,done:q}=is(I,cg);this.events.once(dt("session_connect"),async({error:L,session:U})=>{if(L)W(L);else if(U){U.self.publicKey=M;const z=_i(Wt({},U),{pairingTopic:H.pairingTopic,requiredNamespaces:H.requiredNamespaces,optionalNamespaces:H.optionalNamespaces,transportType:Nt.relay});await this.client.session.set(U.topic,z),await this.setExpiry(U.topic,U.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:U.peer.metadata}),this.cleanupDuplicatePairings(z),J(z)}});const V=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:H,throwOnFailedPublish:!0});return await this.setProposal(V,Wt({id:V},H)),{uri:m,approval:q}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async t=>{var n,a,o;const f=this.client.core.eventClient.createEvent({properties:{topic:(n=t==null?void 0:t.id)==null?void 0:n.toString(),trace:[wi.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(T){throw f.setError(ts.no_internet_connection),T}try{await this.isValidProposalId(t==null?void 0:t.id)}catch(T){throw this.client.logger.error(`approve() -> proposal.get(${t==null?void 0:t.id}) failed`),f.setError(ts.proposal_not_found),T}try{await this.isValidApprove(t)}catch(T){throw this.client.logger.error("approve() -> isValidApprove() failed"),f.setError(ts.session_approve_namespace_validation_failure),T}const{id:h,relayProtocol:p,namespaces:l,sessionProperties:m,sessionConfig:_}=t,M=this.client.proposal.get(h);this.client.core.eventClient.deleteEvent({eventId:f.eventId});const{pairingTopic:I,proposer:P,requiredNamespaces:H,optionalNamespaces:W}=M;let J=(a=this.client.core.eventClient)==null?void 0:a.getEvent({topic:I});J||(J=(o=this.client.core.eventClient)==null?void 0:o.createEvent({type:wi.session_approve_started,properties:{topic:I,trace:[wi.session_approve_started,wi.session_namespaces_validation_success]}}));const q=await this.client.core.crypto.generateKeyPair(),V=P.publicKey,L=await this.client.core.crypto.generateSharedKey(q,V),U=Wt(Wt({relay:{protocol:p??"irn"},namespaces:l,controller:{publicKey:q,metadata:this.client.metadata},expiry:rr(qs)},m&&{sessionProperties:m}),_&&{sessionConfig:_}),z=Nt.relay;J.addTrace(wi.subscribing_session_topic);try{await this.client.core.relayer.subscribe(L,{transportType:z})}catch(T){throw J.setError(ts.subscribe_session_topic_failure),T}J.addTrace(wi.subscribe_session_topic_success);const b=_i(Wt({},U),{topic:L,requiredNamespaces:H,optionalNamespaces:W,pairingTopic:I,acknowledged:!1,self:U.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:q,transportType:Nt.relay});await this.client.session.set(L,b),J.addTrace(wi.store_session);try{J.addTrace(wi.publishing_session_settle),await this.sendRequest({topic:L,method:"wc_sessionSettle",params:U,throwOnFailedPublish:!0}).catch(T=>{throw J==null||J.setError(ts.session_settle_publish_failure),T}),J.addTrace(wi.session_settle_publish_success),J.addTrace(wi.publishing_session_approve),await this.sendResult({id:h,topic:I,result:{relay:{protocol:p??"irn"},responderPublicKey:q},throwOnFailedPublish:!0}).catch(T=>{throw J==null||J.setError(ts.session_approve_publish_failure),T}),J.addTrace(wi.session_approve_publish_success)}catch(T){throw this.client.logger.error(T),this.client.session.delete(L,It("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(L),T}return this.client.core.eventClient.deleteEvent({eventId:J.eventId}),await this.client.core.pairing.updateMetadata({topic:I,metadata:P.metadata}),await this.client.proposal.delete(h,It("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:I}),await this.setExpiry(L,rr(qs)),{topic:L,acknowledged:()=>Promise.resolve(this.client.session.get(L))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(f){throw this.client.logger.error("reject() -> isValidReject() failed"),f}const{id:n,reason:a}=t;let o;try{o=this.client.proposal.get(n).pairingTopic}catch(f){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),f}o&&(await this.sendError({id:n,topic:o,error:a,rpcOpts:sr.wc_sessionPropose.reject}),await this.client.proposal.delete(n,It("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(_){throw this.client.logger.error("update() -> isValidUpdate() failed"),_}const{topic:n,namespaces:a}=t,{done:o,resolve:f,reject:h}=is(),p=En(),l=as().toString(),m=this.client.session.get(n).namespaces;return this.events.once(dt("session_update",p),({error:_})=>{_?h(_):f()}),await this.client.session.update(n,{namespaces:a}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:a},throwOnFailedPublish:!0,clientRpcId:p,relayRpcId:l}).catch(_=>{this.client.logger.error(_),this.client.session.update(n,{namespaces:m}),h(_)}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(p){throw this.client.logger.error("extend() -> isValidExtend() failed"),p}const{topic:n}=t,a=En(),{done:o,resolve:f,reject:h}=is();return this.events.once(dt("session_extend",a),({error:p})=>{p?h(p):f()}),await this.setExpiry(n,rr(qs)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:a,throwOnFailedPublish:!0}).catch(p=>{h(p)}),{acknowledged:o}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:a,topic:o,expiry:f=sr.wc_sessionRequest.req.ttl}=t,h=this.client.session.get(o);(h==null?void 0:h.transportType)===Nt.relay&&await this.confirmOnlineStateOrThrow();const p=En(),l=as().toString(),{done:m,resolve:_,reject:M}=is(f,"Request expired. Please try again.");this.events.once(dt("session_request",p),({error:P,result:H})=>{P?M(P):_(H)});const I=this.getAppLinkIfEnabled(h.peer.metadata,h.transportType);return I?(await this.sendRequest({clientRpcId:p,relayRpcId:l,topic:o,method:"wc_sessionRequest",params:{request:_i(Wt({},a),{expiryTimestamp:rr(f)}),chainId:n},expiry:f,throwOnFailedPublish:!0,appLink:I}).catch(P=>M(P)),this.client.events.emit("session_request_sent",{topic:o,request:a,chainId:n,id:p}),await m()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:p,relayRpcId:l,topic:o,method:"wc_sessionRequest",params:{request:_i(Wt({},a),{expiryTimestamp:rr(f)}),chainId:n},expiry:f,throwOnFailedPublish:!0}).catch(H=>M(H)),this.client.events.emit("session_request_sent",{topic:o,request:a,chainId:n,id:p}),P()}),new Promise(async P=>{var H;if(!((H=h.sessionConfig)!=null&&H.disableDeepLink)){const W=await o8(this.client.core.storage,fp);await s8({id:p,topic:o,wcDeepLink:W})}P()}),m()]).then(P=>P[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:n,response:a}=t,{id:o}=a,f=this.client.session.get(n);f.transportType===Nt.relay&&await this.confirmOnlineStateOrThrow();const h=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);Fi(a)?await this.sendResult({id:o,topic:n,result:a.result,throwOnFailedPublish:!0,appLink:h}):oi(a)&&await this.sendError({id:o,topic:n,error:a.error,appLink:h}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(a){throw this.client.logger.error("ping() -> isValidPing() failed"),a}const{topic:n}=t;if(this.client.session.keys.includes(n)){const a=En(),o=as().toString(),{done:f,resolve:h,reject:p}=is();this.events.once(dt("session_ping",a),({error:l})=>{l?p(l):h()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:o}),f()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:n,event:a,chainId:o}=t,f=as().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:a,chainId:o},throwOnFailedPublish:!0,relayRpcId:f})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:n}=t;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:It("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:a}=pe("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(a)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(n=>o4(n,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,n)=>{var a;this.isInitialized(),this.isValidAuthenticate(t);const o=n&&this.client.core.linkModeSupportedApps.includes(n)&&((a=this.client.metadata.redirect)==null?void 0:a.linkMode),f=o?Nt.link_mode:Nt.relay;f===Nt.relay&&await this.confirmOnlineStateOrThrow();const{chains:h,statement:p="",uri:l,domain:m,nonce:_,type:M,exp:I,nbf:P,methods:H=[],expiry:W}=t,J=[...t.resources||[]],{topic:q,uri:V}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:f});this.client.logger.info({message:"Generated new pairing",pairing:{topic:q,uri:V}});const L=await this.client.core.crypto.generateKeyPair(),U=dc(L);if(await Promise.all([this.client.auth.authKeys.set(gc,{responseTopic:U,publicKey:L}),this.client.auth.pairingTopics.set(U,{topic:U,pairingTopic:q})]),await this.client.core.relayer.subscribe(U,{transportType:f}),this.client.logger.info(`sending request to new pairing topic: ${q}`),H.length>0){const{namespace:R}=Ks(h[0]);let x=M8(R,"request",H);uc(J)&&(x=O8(x,J.pop())),J.push(x)}const z=W&&W>sr.wc_sessionAuthenticate.req.ttl?W:sr.wc_sessionAuthenticate.req.ttl,b={authPayload:{type:M??"caip122",chains:h,statement:p,aud:l,domain:m,version:"1",nonce:_,iat:new Date().toISOString(),exp:I,nbf:P,resources:J},requester:{publicKey:L,metadata:this.client.metadata},expiryTimestamp:rr(z)},T={eip155:{chains:h,methods:[...new Set(["personal_sign",...H])],events:["chainChanged","accountsChanged"]}},re={requiredNamespaces:{},optionalNamespaces:T,relays:[{protocol:"irn"}],pairingTopic:q,proposer:{publicKey:L,metadata:this.client.metadata},expiryTimestamp:rr(sr.wc_sessionPropose.req.ttl)},{done:de,resolve:$,reject:u}=is(z,"Request expired"),y=async({error:R,session:x})=>{if(this.events.off(dt("session_request",E),w),R)u(R);else if(x){x.self.publicKey=L,await this.client.session.set(x.topic,x),await this.setExpiry(x.topic,x.expiry),q&&await this.client.core.pairing.updateMetadata({topic:q,metadata:x.peer.metadata});const d=this.client.session.get(x.topic);await this.deleteProposal(O),$({session:d})}},w=async R=>{var x,d,D;if(await this.deletePendingAuthRequest(E,{message:"fulfilled",code:0}),R.error){const Z=It("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return R.error.code===Z.code?void 0:(this.events.off(dt("session_connect"),y),u(R.error.message))}await this.deleteProposal(O),this.events.off(dt("session_connect"),y);const{cacaos:fe,responder:ee}=R.result,he=[],ne=[];for(const Z of fe){await f0({cacao:Z,projectId:this.client.core.projectId})||(this.client.logger.error(Z,"Signature verification failed"),u(It("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:j}=Z,v=uc(j.resources),K=[jh(j.iss)],oe=xc(j.iss);if(v){const le=h0(v),Te=u0(v);he.push(...le),K.push(...Te)}for(const le of K)ne.push(`${le}:${oe}`)}const ge=await this.client.core.crypto.generateSharedKey(L,ee.publicKey);let G;he.length>0&&(G={topic:ge,acknowledged:!0,self:{publicKey:L,metadata:this.client.metadata},peer:ee,controller:ee.publicKey,expiry:rr(qs),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:q,namespaces:w0([...new Set(he)],[...new Set(ne)]),transportType:f},await this.client.core.relayer.subscribe(ge,{transportType:f}),await this.client.session.set(ge,G),q&&await this.client.core.pairing.updateMetadata({topic:q,metadata:ee.metadata}),G=this.client.session.get(ge)),(x=this.client.metadata.redirect)!=null&&x.linkMode&&(d=ee.metadata.redirect)!=null&&d.linkMode&&(D=ee.metadata.redirect)!=null&&D.universal&&n&&(this.client.core.addLinkModeSupportedApp(ee.metadata.redirect.universal),this.client.session.update(ge,{transportType:Nt.link_mode})),$({auths:fe,session:G})},E=En(),O=En();this.events.once(dt("session_connect"),y),this.events.once(dt("session_request",E),w);let N;try{if(o){const R=xn("wc_sessionAuthenticate",b,E);this.client.core.history.set(q,R);const x=await this.client.core.crypto.encode("",R,{type:Ga,encoding:wa});N=rc(n,q,x)}else await Promise.all([this.sendRequest({topic:q,method:"wc_sessionAuthenticate",params:b,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:E}),this.sendRequest({topic:q,method:"wc_sessionPropose",params:re,expiry:sr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:O})])}catch(R){throw this.events.off(dt("session_connect"),y),this.events.off(dt("session_request",E),w),R}return await this.setProposal(O,Wt({id:O},re)),await this.setAuthRequest(E,{request:_i(Wt({},b),{verifyContext:{}}),pairingTopic:q,transportType:f}),{uri:N??V,response:de}},this.approveSessionAuthenticate=async t=>{const{id:n,auths:a}=t,o=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[rs.authenticated_session_approve_started]}});try{this.isInitialized()}catch(W){throw o.setError(Sa.no_internet_connection),W}const f=this.getPendingAuthRequest(n);if(!f)throw o.setError(Sa.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const h=f.transportType||Nt.relay;h===Nt.relay&&await this.confirmOnlineStateOrThrow();const p=f.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),m=dc(p),_={type:an,receiverPublicKey:p,senderPublicKey:l},M=[],I=[];for(const W of a){if(!await f0({cacao:W,projectId:this.client.core.projectId})){o.setError(Sa.invalid_cacao);const U=It("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:m,error:U,encodeOpts:_}),new Error(U.message)}o.addTrace(rs.cacaos_verified);const{p:J}=W,q=uc(J.resources),V=[jh(J.iss)],L=xc(J.iss);if(q){const U=h0(q),z=u0(q);M.push(...U),V.push(...z)}for(const U of V)I.push(`${U}:${L}`)}const P=await this.client.core.crypto.generateSharedKey(l,p);o.addTrace(rs.create_authenticated_session_topic);let H;if((M==null?void 0:M.length)>0){H={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:p,metadata:f.requester.metadata},controller:p,expiry:rr(qs),authentication:a,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:f.pairingTopic,namespaces:w0([...new Set(M)],[...new Set(I)]),transportType:h},o.addTrace(rs.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:h})}catch(W){throw o.setError(Sa.subscribe_authenticated_session_topic_failure),W}o.addTrace(rs.subscribe_authenticated_session_topic_success),await this.client.session.set(P,H),o.addTrace(rs.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:f.requester.metadata})}o.addTrace(rs.publishing_authenticated_session_approve);try{await this.sendResult({topic:m,id:n,result:{cacaos:a,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:_,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(f.requester.metadata,h)})}catch(W){throw o.setError(Sa.authenticated_session_approve_publish_failure),W}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:f.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:o.eventId}),{session:H}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:n,reason:a}=t,o=this.getPendingAuthRequest(n);if(!o)throw new Error(`Could not find pending auth request with id ${n}`);o.transportType===Nt.relay&&await this.confirmOnlineStateOrThrow();const f=o.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=dc(f),l={type:an,receiverPublicKey:f,senderPublicKey:h};await this.sendError({id:n,topic:p,error:a,encodeOpts:l,rpcOpts:sr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(o.requester.metadata,o.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,It("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:n,iss:a}=t;return S1(n,a)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const n=this.client.core.pairing.pairings.get(t.pairingTopic),a=this.client.core.pairing.pairings.getAll().filter(o=>{var f,h;return((f=o.peerMetadata)==null?void 0:f.url)&&((h=o.peerMetadata)==null?void 0:h.url)===t.peer.metadata.url&&o.topic&&o.topic!==n.topic});if(a.length===0)return;this.client.logger.info(`Cleaning up ${a.length} duplicate pairing(s)`),await Promise.all(a.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 t=>{var n;const{topic:a,expirerHasDeleted:o=!1,emitEvent:f=!0,id:h=0}=t,{self:p}=this.client.session.get(a);await this.client.core.relayer.unsubscribe(a),await this.client.session.delete(a,It("USER_DISCONNECTED")),this.addToRecentlyDeleted(a,"session"),this.client.core.crypto.keychain.has(p.publicKey)&&await this.client.core.crypto.deleteKeyPair(p.publicKey),this.client.core.crypto.keychain.has(a)&&await this.client.core.crypto.deleteSymKey(a),o||this.client.core.expirer.del(a),this.client.core.storage.removeItem(fp).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===a&&this.deletePendingSessionRequest(l.id,It("USER_DISCONNECTED"))}),a===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=$i.idle),f&&this.client.events.emit("session_delete",{id:h,topic:a})},this.deleteProposal=async(t,n)=>{if(n)try{const a=this.client.proposal.get(t),o=this.client.core.eventClient.getEvent({topic:a.pairingTopic});o==null||o.setError(ts.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,It("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,n,a=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,n),a?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(o=>o.id!==t),a&&(this.sessionRequestQueue.state=$i.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,n,a=!1)=>{await Promise.all([this.client.auth.requests.delete(t,n),a?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,n)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,n),await this.client.session.update(t,{expiry:n}))},this.setProposal=async(t,n)=>{this.client.core.expirer.set(t,rr(sr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,n)},this.setAuthRequest=async(t,n)=>{const{request:a,pairingTopic:o,transportType:f=Nt.relay}=n;this.client.core.expirer.set(t,a.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:a.authPayload,requester:a.requester,expiryTimestamp:a.expiryTimestamp,id:t,pairingTopic:o,verifyContext:a.verifyContext,transportType:f})},this.setPendingSessionRequest=async t=>{const{id:n,topic:a,params:o,verifyContext:f}=t,h=o.request.expiryTimestamp||rr(sr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,h),await this.client.pendingRequest.set(n,{id:n,topic:a,params:o,verifyContext:f})},this.sendRequest=async t=>{const{topic:n,method:a,params:o,expiry:f,relayRpcId:h,clientRpcId:p,throwOnFailedPublish:l,appLink:m}=t,_=xn(a,o,p);let M;const I=!!m;try{const W=I?wa:Sn;M=await this.client.core.crypto.encode(n,_,{encoding:W})}catch(W){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),W}let P;if(hx.includes(a)){const W=nn(JSON.stringify(_)),J=nn(M);P=await this.client.core.verify.register({id:J,decryptedId:W})}const H=sr[a].req;if(H.attestation=P,f&&(H.ttl=f),h&&(H.id=h),this.client.core.history.set(n,_),I){const W=rc(m,n,M);await ht.Linking.openURL(W,this.client.name)}else{const W=sr[a].req;f&&(W.ttl=f),h&&(W.id=h),l?(W.internal=_i(Wt({},W.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,M,W)):this.client.core.relayer.publish(n,M,W).catch(J=>this.client.logger.error(J))}return _.id},this.sendResult=async t=>{const{id:n,topic:a,result:o,throwOnFailedPublish:f,encodeOpts:h,appLink:p}=t,l=Vc(n,o);let m;const _=p&&typeof(ht==null?void 0:ht.Linking)<"u";try{const I=_?wa:Sn;m=await this.client.core.crypto.encode(a,l,_i(Wt({},h||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${a} failed`),I}let M;try{M=await this.client.core.history.get(a,n)}catch(I){throw this.client.logger.error(`sendResult() -> history.get(${a}, ${n}) failed`),I}if(_){const I=rc(p,a,m);await ht.Linking.openURL(I,this.client.name)}else{const I=sr[M.request.method].res;f?(I.internal=_i(Wt({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(a,m,I)):this.client.core.relayer.publish(a,m,I).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async t=>{const{id:n,topic:a,error:o,encodeOpts:f,rpcOpts:h,appLink:p}=t,l=Gc(n,o);let m;const _=p&&typeof(ht==null?void 0:ht.Linking)<"u";try{const I=_?wa:Sn;m=await this.client.core.crypto.encode(a,l,_i(Wt({},f||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${a} failed`),I}let M;try{M=await this.client.core.history.get(a,n)}catch(I){throw this.client.logger.error(`sendError() -> history.get(${a}, ${n}) failed`),I}if(_){const I=rc(p,a,m);await ht.Linking.openURL(I,this.client.name)}else{const I=h||sr[M.request.method].res;this.client.core.relayer.publish(a,m,I)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const t=[],n=[];this.client.session.getAll().forEach(a=>{let o=!1;_n(a.expiry)&&(o=!0),this.client.core.crypto.keychain.has(a.topic)||(o=!0),o&&t.push(a.topic)}),this.client.proposal.getAll().forEach(a=>{_n(a.expiryTimestamp)&&n.push(a.id)}),await Promise.all([...t.map(a=>this.deleteSession({topic:a})),...n.map(a=>this.deleteProposal(a))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===$i.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=$i.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=$i.idle},this.processRequest=async t=>{const{topic:n,payload:a,attestation:o,transportType:f,encryptedId:h}=t,p=a.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:p}))switch(p){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:a,attestation:o,encryptedId:h});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,a);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,a);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,a);case"wc_sessionPing":return await this.onSessionPingRequest(n,a);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,a);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:a,attestation:o,encryptedId:h,transportType:f});case"wc_sessionEvent":return await this.onSessionEventRequest(n,a);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:a,attestation:o,encryptedId:h,transportType:f});default:return this.client.logger.info(`Unsupported request method ${p}`)}},this.onRelayEventResponse=async t=>{const{topic:n,payload:a,transportType:o}=t,f=(await this.client.core.history.get(n,a.id)).request.method;switch(f){case"wc_sessionPropose":return this.onSessionProposeResponse(n,a,o);case"wc_sessionSettle":return this.onSessionSettleResponse(n,a);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,a);case"wc_sessionExtend":return this.onSessionExtendResponse(n,a);case"wc_sessionPing":return this.onSessionPingResponse(n,a);case"wc_sessionRequest":return this.onSessionRequestResponse(n,a);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,a);default:return this.client.logger.info(`Unsupported response method ${f}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:n}=t,{message:a}=pe("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(a)},this.shouldIgnorePairingRequest=t=>{const{topic:n,requestMethod:a}=t,o=this.expectedPairingMethodMap.get(n);return!o||o.includes(a)?!1:!!(o.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:n,payload:a,attestation:o,encryptedId:f}=t,{params:h,id:p}=a;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(Wt({},a.params));const m=h.expiryTimestamp||rr(sr.wc_sessionPropose.req.ttl),_=Wt({id:p,pairingTopic:n,expiryTimestamp:m},h);await this.setProposal(p,_);const M=await this.getVerifyContext({attestationId:o,hash:nn(JSON.stringify(a)),encryptedId:f,metadata:_.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(rn.proposal_listener_not_found)),l==null||l.addTrace(Li.emit_session_proposal),this.client.events.emit("session_proposal",{id:p,params:_,verifyContext:M})}catch(l){await this.sendError({id:p,topic:n,error:l,rpcOpts:sr.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(t,n,a)=>{const{id:o}=n;if(Fi(n)){const{result:f}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:f});const h=this.client.proposal.get(o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:h});const p=h.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:p});const l=f.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const m=await this.client.core.crypto.generateSharedKey(p,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:m});const _=await this.client.core.relayer.subscribe(m,{transportType:a});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:_}),await this.client.core.pairing.activate({topic:t})}else if(oi(n)){await this.client.proposal.delete(o,It("USER_DISCONNECTED"));const f=dt("session_connect");if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners, 954`);this.events.emit(dt("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(t,n)=>{const{id:a,params:o}=n;try{this.isValidSessionSettleRequest(o);const{relay:f,controller:h,expiry:p,namespaces:l,sessionProperties:m,sessionConfig:_}=n.params,M=_i(Wt(Wt({topic:t,relay:f,expiry:p,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:h.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:h.publicKey,metadata:h.metadata}},m&&{sessionProperties:m}),_&&{sessionConfig:_}),{transportType:Nt.relay}),I=dt("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(dt("session_connect"),{session:M}),await this.sendResult({id:n.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(f){await this.sendError({id:a,topic:t,error:f}),this.client.logger.error(f)}},this.onSessionSettleResponse=async(t,n)=>{const{id:a}=n;Fi(n)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(dt("session_approve",a),{})):oi(n)&&(await this.client.session.delete(t,It("USER_DISCONNECTED")),this.events.emit(dt("session_approve",a),{error:n.error}))},this.onSessionUpdateRequest=async(t,n)=>{const{params:a,id:o}=n;try{const f=`${t}_session_update`,h=_a.get(f);if(h&&this.isRequestOutOfSync(h,o)){this.client.logger.info(`Discarding out of sync request - ${o}`),this.sendError({id:o,topic:t,error:It("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Wt({topic:t},a));try{_a.set(f,o),await this.client.session.update(t,{namespaces:a.namespaces}),await this.sendResult({id:o,topic:t,result:!0,throwOnFailedPublish:!0})}catch(p){throw _a.delete(f),p}this.client.events.emit("session_update",{id:o,topic:t,params:a})}catch(f){await this.sendError({id:o,topic:t,error:f}),this.client.logger.error(f)}},this.isRequestOutOfSync=(t,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,n)=>{const{id:a}=n,o=dt("session_update",a);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);Fi(n)?this.events.emit(dt("session_update",a),{}):oi(n)&&this.events.emit(dt("session_update",a),{error:n.error})},this.onSessionExtendRequest=async(t,n)=>{const{id:a}=n;try{this.isValidExtend({topic:t}),await this.setExpiry(t,rr(qs)),await this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:a,topic:t})}catch(o){await this.sendError({id:a,topic:t,error:o}),this.client.logger.error(o)}},this.onSessionExtendResponse=(t,n)=>{const{id:a}=n,o=dt("session_extend",a);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);Fi(n)?this.events.emit(dt("session_extend",a),{}):oi(n)&&this.events.emit(dt("session_extend",a),{error:n.error})},this.onSessionPingRequest=async(t,n)=>{const{id:a}=n;try{this.isValidPing({topic:t}),await this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:a,topic:t})}catch(o){await this.sendError({id:a,topic:t,error:o}),this.client.logger.error(o)}},this.onSessionPingResponse=(t,n)=>{const{id:a}=n,o=dt("session_ping",a);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);setTimeout(()=>{Fi(n)?this.events.emit(dt("session_ping",a),{}):oi(n)&&this.events.emit(dt("session_ping",a),{error:n.error})},500)},this.onSessionDeleteRequest=async(t,n)=>{const{id:a}=n;try{this.isValidDisconnect({topic:t,reason:n.params}),Promise.all([new Promise(o=>{this.client.core.relayer.once(Ar.publish,async()=>{o(await this.deleteSession({topic:t,id:a}))})}),this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:It("USER_DISCONNECTED")})]).catch(o=>this.client.logger.error(o))}catch(o){this.client.logger.error(o)}},this.onSessionRequest=async t=>{var n,a,o;const{topic:f,payload:h,attestation:p,encryptedId:l,transportType:m}=t,{id:_,params:M}=h;try{await this.isValidRequest(Wt({topic:f},M));const I=this.client.session.get(f),P=await this.getVerifyContext({attestationId:p,hash:nn(JSON.stringify(xn("wc_sessionRequest",M,_))),encryptedId:l,metadata:I.peer.metadata,transportType:m}),H={id:_,topic:f,params:M,verifyContext:P};await this.setPendingSessionRequest(H),m===Nt.link_mode&&(n=I.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((a=I.peer.metadata.redirect)==null?void 0:a.universal),(o=this.client.signConfig)!=null&&o.disableRequestQueue?this.emitSessionRequest(H):(this.addSessionRequestToSessionRequestQueue(H),this.processSessionRequestQueue())}catch(I){await this.sendError({id:_,topic:f,error:I}),this.client.logger.error(I)}},this.onSessionRequestResponse=(t,n)=>{const{id:a}=n,o=dt("session_request",a);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);Fi(n)?this.events.emit(dt("session_request",a),{result:n.result}):oi(n)&&this.events.emit(dt("session_request",a),{error:n.error})},this.onSessionEventRequest=async(t,n)=>{const{id:a,params:o}=n;try{const f=`${t}_session_event_${o.event.name}`,h=_a.get(f);if(h&&this.isRequestOutOfSync(h,a)){this.client.logger.info(`Discarding out of sync request - ${a}`);return}this.isValidEmit(Wt({topic:t},o)),this.client.events.emit("session_event",{id:a,topic:t,params:o}),_a.set(f,a)}catch(f){await this.sendError({id:a,topic:t,error:f}),this.client.logger.error(f)}},this.onSessionAuthenticateResponse=(t,n)=>{const{id:a}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:n}),Fi(n)?this.events.emit(dt("session_request",a),{result:n.result}):oi(n)&&this.events.emit(dt("session_request",a),{error:n.error})},this.onSessionAuthenticateRequest=async t=>{var n;const{topic:a,payload:o,attestation:f,encryptedId:h,transportType:p}=t;try{const{requester:l,authPayload:m,expiryTimestamp:_}=o.params,M=await this.getVerifyContext({attestationId:f,hash:nn(JSON.stringify(o)),encryptedId:h,metadata:l.metadata,transportType:p}),I={requester:l,pairingTopic:a,id:o.id,authPayload:m,verifyContext:M,expiryTimestamp:_};await this.setAuthRequest(o.id,{request:I,pairingTopic:a,transportType:p}),p===Nt.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:a,params:o.params,id:o.id,verifyContext:M})}catch(l){this.client.logger.error(l);const m=o.params.requester.publicKey,_=await this.client.core.crypto.generateKeyPair(),M=this.getAppLinkIfEnabled(o.params.requester.metadata,p),I={type:an,receiverPublicKey:m,senderPublicKey:_};await this.sendError({id:o.id,topic:a,error:l,encodeOpts:I,rpcOpts:sr.wc_sessionAuthenticate.autoReject,appLink:M})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=$i.idle,this.processSessionRequestQueue()},be.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:n})=>{const a=this.client.core.history.pending;a.length>0&&a.filter(o=>o.topic===t&&o.request.method==="wc_sessionRequest").forEach(o=>{const f=o.request.id,h=dt("session_request",f);if(this.events.listenerCount(h)===0)throw new Error(`emitting ${h} without any listeners`);this.events.emit(dt("session_request",o.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===$i.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=$i.active,this.emitSessionRequest(t)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const n=this.client.proposal.getAll().find(a=>a.pairingTopic===t.topic);n&&this.onSessionProposeRequest({topic:t.topic,payload:xn("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async t=>{if(!Fr(t)){const{message:p}=pe("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(p)}const{pairingTopic:n,requiredNamespaces:a,optionalNamespaces:o,sessionProperties:f,relays:h}=t;if(Mr(n)||await this.isValidPairingTopic(n),!y4(h,!0)){const{message:p}=pe("MISSING_OR_INVALID",`connect() relays: ${h}`);throw new Error(p)}!Mr(a)&&$a(a)!==0&&this.validateNamespaces(a,"requiredNamespaces"),!Mr(o)&&$a(o)!==0&&this.validateNamespaces(o,"optionalNamespaces"),Mr(f)||this.validateSessionProps(f,"sessionProperties")},this.validateNamespaces=(t,n)=>{const a=m4(t,"connect()",n);if(a)throw new Error(a.message)},this.isValidApprove=async t=>{if(!Fr(t))throw new Error(pe("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:n,namespaces:a,relayProtocol:o,sessionProperties:f}=t;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const h=this.client.proposal.get(n),p=yh(a,"approve()");if(p)throw new Error(p.message);const l=S0(h.requiredNamespaces,a,"approve()");if(l)throw new Error(l.message);if(!Xt(o,!0)){const{message:m}=pe("MISSING_OR_INVALID",`approve() relayProtocol: ${o}`);throw new Error(m)}Mr(f)||this.validateSessionProps(f,"sessionProperties")},this.isValidReject=async t=>{if(!Fr(t)){const{message:o}=pe("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(o)}const{id:n,reason:a}=t;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!_4(a)){const{message:o}=pe("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(a)}`);throw new Error(o)}},this.isValidSessionSettleRequest=t=>{if(!Fr(t)){const{message:l}=pe("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(l)}const{relay:n,controller:a,namespaces:o,expiry:f}=t;if(!C1(n)){const{message:l}=pe("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const h=d4(a,"onSessionSettleRequest()");if(h)throw new Error(h.message);const p=yh(o,"onSessionSettleRequest()");if(p)throw new Error(p.message);if(_n(f)){const{message:l}=pe("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async t=>{if(!Fr(t)){const{message:p}=pe("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(p)}const{topic:n,namespaces:a}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const o=this.client.session.get(n),f=yh(a,"update()");if(f)throw new Error(f.message);const h=S0(o.requiredNamespaces,a,"update()");if(h)throw new Error(h.message)},this.isValidExtend=async t=>{if(!Fr(t)){const{message:a}=pe("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(a)}const{topic:n}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async t=>{if(!Fr(t)){const{message:p}=pe("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(p)}const{topic:n,request:a,chainId:o,expiry:f}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:h}=this.client.session.get(n);if(!E0(h,o)){const{message:p}=pe("MISSING_OR_INVALID",`request() chainId: ${o}`);throw new Error(p)}if(!E4(a)){const{message:p}=pe("MISSING_OR_INVALID",`request() ${JSON.stringify(a)}`);throw new Error(p)}if(!I4(h,o,a.method)){const{message:p}=pe("MISSING_OR_INVALID",`request() method: ${a.method}`);throw new Error(p)}if(f&&!P4(f,Ah)){const{message:p}=pe("MISSING_OR_INVALID",`request() expiry: ${f}. Expiry must be a number (in seconds) between ${Ah.min} and ${Ah.max}`);throw new Error(p)}},this.isValidRespond=async t=>{var n;if(!Fr(t)){const{message:f}=pe("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(f)}const{topic:a,response:o}=t;try{await this.isValidSessionTopic(a)}catch(f){throw(n=t==null?void 0:t.response)!=null&&n.id&&this.cleanupAfterResponse(t),f}if(!S4(o)){const{message:f}=pe("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(f)}},this.isValidPing=async t=>{if(!Fr(t)){const{message:a}=pe("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(a)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async t=>{if(!Fr(t)){const{message:h}=pe("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(h)}const{topic:n,event:a,chainId:o}=t;await this.isValidSessionTopic(n);const{namespaces:f}=this.client.session.get(n);if(!E0(f,o)){const{message:h}=pe("MISSING_OR_INVALID",`emit() chainId: ${o}`);throw new Error(h)}if(!x4(a)){const{message:h}=pe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(h)}if(!D4(f,o,a.name)){const{message:h}=pe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(h)}},this.isValidDisconnect=async t=>{if(!Fr(t)){const{message:a}=pe("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(a)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=t=>{const{chains:n,uri:a,domain:o,nonce:f}=t;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!Xt(a,!1))throw new Error("uri is required parameter");if(!Xt(o,!1))throw new Error("domain is required parameter");if(!Xt(f,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(p=>Ks(p).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:h}=Ks(n[0]);if(h!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:n,hash:a,encryptedId:o,metadata:f,transportType:h}=t,p={verified:{verifyUrl:f.verifyUrl||Oa,validation:"UNKNOWN",origin:f.url||""}};try{if(h===Nt.link_mode){const m=this.getAppLinkIfEnabled(f,h);return p.verified.validation=m&&new URL(m).origin===new URL(f.url).origin?"VALID":"INVALID",p}const l=await this.client.core.verify.resolve({attestationId:n,hash:a,encryptedId:o,verifyUrl:f.verifyUrl});l&&(p.verified.origin=l.origin,p.verified.isScam=l.isScam,p.verified.validation=l.origin===new URL(f.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(p)}`),p},this.validateSessionProps=(t,n)=>{Object.values(t).forEach(a=>{if(!Xt(a,!1)){const{message:o}=pe("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(a)}`);throw new Error(o)}})},this.getPendingAuthRequest=t=>{const n=this.client.auth.requests.get(t);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(t,n)=>{if(this.recentlyDeletedMap.set(t,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let a=0;const o=this.recentlyDeletedLimit/2;for(const f of this.recentlyDeletedMap.keys()){if(a++>=o)break;this.recentlyDeletedMap.delete(f)}}},this.checkRecentlyDeleted=t=>{const n=this.recentlyDeletedMap.get(t);if(n){const{message:a}=pe("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${t}`);throw new Error(a)}},this.isLinkModeEnabled=(t,n)=>{var a,o,f,h,p,l,m,_,M;return!t||n!==Nt.link_mode?!1:((o=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:o.linkMode)===!0&&((h=(f=this.client.metadata)==null?void 0:f.redirect)==null?void 0:h.universal)!==void 0&&((l=(p=this.client.metadata)==null?void 0:p.redirect)==null?void 0:l.universal)!==""&&((m=t==null?void 0:t.redirect)==null?void 0:m.universal)!==void 0&&((_=t==null?void 0:t.redirect)==null?void 0:_.universal)!==""&&((M=t==null?void 0:t.redirect)==null?void 0:M.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(ht==null?void 0:ht.Linking)<"u"},this.getAppLinkIfEnabled=(t,n)=>{var a;return this.isLinkModeEnabled(t,n)?(a=t==null?void 0:t.redirect)==null?void 0:a.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const n=s0(t,"topic")||"",a=decodeURIComponent(s0(t,"wc_ev")||""),o=this.client.session.keys.includes(n);o&&this.client.session.update(n,{transportType:Nt.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:a,sessionExists:o})},this.registerLinkModeListeners=async()=>{var t;if(lu()||Ys()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const n=ht==null?void 0:ht.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const a=await n.getInitialURL();a&&setTimeout(()=>{this.handleLinkModeMessage({url:a})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ar.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:n,attestation:a,transportType:o}=e,{publicKey:f}=this.client.auth.authKeys.keys.includes(gc)?this.client.auth.authKeys.get(gc):{responseTopic:void 0,publicKey:void 0},h=await this.client.core.crypto.decode(t,n,{receiverPublicKey:f,encoding:o===Nt.link_mode?wa:Sn});try{wu(h)?(this.client.core.history.set(t,h),this.onRelayEventRequest({topic:t,payload:h,attestation:a,transportType:o,encryptedId:nn(n)})):Jc(h)?(await this.client.core.history.resolve(h),await this.onRelayEventResponse({topic:t,payload:h,transportType:o}),this.client.core.history.delete(t,h.id)):this.onRelayEventUnknownPayload({topic:t,payload:h,transportType:o})}catch(p){this.client.logger.error(p)}}registerExpirerEvents(){this.client.core.expirer.on(ai.expired,async e=>{const{topic:t,id:n}=_1(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,pe("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,pe("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(ns.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(ns.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!Xt(e,!1)){const{message:t}=pe("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=pe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(_n(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=pe("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!Xt(e,!1)){const{message:t}=pe("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=pe("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(_n(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=pe("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=pe("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(Xt(e,!1)){const{message:t}=pe("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=pe("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!w4(e)){const{message:t}=pe("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=pe("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(_n(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=pe("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Ex extends gs{constructor(e,t){super(e,t,ax,Su),this.core=e,this.logger=t}}let Sx=class extends gs{constructor(e,t){super(e,t,ox,Su),this.core=e,this.logger=t}};class xx extends gs{constructor(e,t){super(e,t,fx,Su,n=>n.id),this.core=e,this.logger=t}}class Ix extends gs{constructor(e,t){super(e,t,lx,Xc,()=>gc),this.core=e,this.logger=t}}class Dx extends gs{constructor(e,t){super(e,t,px,Xc),this.core=e,this.logger=t}}class Ax extends gs{constructor(e,t){super(e,t,gx,Xc,n=>n.id),this.core=e,this.logger=t}}class Mx{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new Ix(this.core,this.logger),this.pairingTopics=new Dx(this.core,this.logger),this.requests=new Ax(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class xu extends Q9{constructor(e){super(e),this.protocol=sg,this.version=ag,this.name=Dh.name,this.events=new hi.EventEmitter,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(a){throw this.logger.error(a.message),a}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(a){throw this.logger.error(a.message),a}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(a){throw this.logger.error(a.message),a}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(a){throw this.logger.error(a.message),a}},this.update=async n=>{try{return await this.engine.update(n)}catch(a){throw this.logger.error(a.message),a}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(a){throw this.logger.error(a.message),a}},this.request=async n=>{try{return await this.engine.request(n)}catch(a){throw this.logger.error(a.message),a}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(a){throw this.logger.error(a.message),a}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(a){throw this.logger.error(a.message),a}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(a){throw this.logger.error(a.message),a}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(a){throw this.logger.error(a.message),a}},this.find=n=>{try{return this.engine.find(n)}catch(a){throw this.logger.error(a.message),a}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,a)=>{try{return await this.engine.authenticate(n,a)}catch(o){throw this.logger.error(o.message),o}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(a){throw this.logger.error(a.message),a}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(a){throw this.logger.error(a.message),a}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(a){throw this.logger.error(a.message),a}},this.name=(e==null?void 0:e.name)||Dh.name,this.metadata=(e==null?void 0:e.metadata)||b1(),this.signConfig=e==null?void 0:e.signConfig;const t=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Ya(Wc({level:(e==null?void 0:e.logger)||Dh.logger}));this.core=(e==null?void 0:e.core)||new sx(e),this.logger=Or(t,this.name),this.session=new Sx(this.core,this.logger),this.proposal=new Ex(this.core,this.logger),this.pendingRequest=new xx(this.core,this.logger),this.engine=new _x(this),this.auth=new Mx(this.core,this.logger)}static async init(e){const t=new xu(e);return await t.initialize(),t}get context(){return Ur(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Pc={exports:{}};/**
|
|
24
|
+
* @license
|
|
25
|
+
* Lodash <https://lodash.com/>
|
|
26
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
27
|
+
* Released under MIT license <https://lodash.com/license>
|
|
28
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
29
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
30
|
+
*/Pc.exports;(function(r,e){(function(){var t,n="4.17.21",a=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",f="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",l=500,m="__lodash_placeholder__",_=1,M=2,I=4,P=1,H=2,W=1,J=2,q=4,V=8,L=16,U=32,z=64,b=128,T=256,re=512,de=30,$="...",u=800,y=16,w=1,E=2,O=3,N=1/0,R=9007199254740991,x=17976931348623157e292,d=0/0,D=4294967295,fe=D-1,ee=D>>>1,he=[["ary",b],["bind",W],["bindKey",J],["curry",V],["curryRight",L],["flip",re],["partial",U],["partialRight",z],["rearg",T]],ne="[object Arguments]",ge="[object Array]",G="[object AsyncFunction]",Z="[object Boolean]",j="[object Date]",v="[object DOMException]",K="[object Error]",oe="[object Function]",le="[object GeneratorFunction]",Te="[object Map]",Ae="[object Number]",Pe="[object Null]",He="[object Object]",Fe="[object Promise]",qe="[object Proxy]",je="[object RegExp]",ye="[object Set]",Ie="[object String]",Ue="[object Symbol]",De="[object Undefined]",Se="[object WeakMap]",Be="[object WeakSet]",me="[object ArrayBuffer]",xe="[object DataView]",Ze="[object Float32Array]",_e="[object Float64Array]",Oe="[object Int8Array]",ot="[object Int16Array]",Ce="[object Int32Array]",Re="[object Uint8Array]",ft="[object Uint8ClampedArray]",lt="[object Uint16Array]",bt="[object Uint32Array]",Br=/\b__p \+= '';/g,pt=/\b(__p \+=) '' \+/g,wt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,li=/&(?:amp|lt|gt|quot|#39);/g,Dt=/[&<>"']/g,ke=RegExp(li.source),Mt=RegExp(Dt.source),We=/<%-([\s\S]+?)%>/g,Ve=/<%([\s\S]+?)%>/g,Tt=/<%=([\s\S]+?)%>/g,ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,Kt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ge=/[\\^$.*+?()[\]{}|]/g,rt=RegExp(Ge.source),Ft=/^\s+/,Qe=/\s/,Je=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,St=/\{\n\/\* \[wrapped with (.+)\] \*/,it=/,? & /,nt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,vs=/[()=,{}\[\]\/\s]/,Bt=/\\(\\)?/g,zt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,br=/\w*$/,Mn=/^[-+]0x[0-9a-f]+$/i,Pn=/^0b[01]+$/i,On=/^\[object .+?Constructor\]$/,Cn=/^0o[0-7]+$/i,Rn=/^(?:0|[1-9]\d*)$/,zr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Di=/($^)/,Tn=/['\n\r\u2028\u2029\\]/g,Ai="\\ud800-\\udfff",Nn="\\u0300-\\u036f",$n="\\ufe20-\\ufe2f",Mi="\\u20d0-\\u20ff",fn=Nn+$n+Mi,hn="\\u2700-\\u27bf",Er="a-z\\xdf-\\xf6\\xf8-\\xff",Ln="\\xac\\xb1\\xd7\\xf7",Fn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qn="\\u2000-\\u206f",Zc=" \\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",Qa="A-Z\\xc0-\\xd6\\xd8-\\xde",eo="\\ufe0e\\ufe0f",Un=Ln+Fn+qn+Zc,Qs="['’]",Bn="["+Ai+"]",ea="["+Un+"]",zn="["+fn+"]",to="\\d+",Qc="["+hn+"]",ro="["+Er+"]",io="[^"+Ai+Un+to+hn+Er+Qa+"]",ms="\\ud83c[\\udffb-\\udfff]",ef="(?:"+zn+"|"+ms+")",no="[^"+Ai+"]",ys="(?:\\ud83c[\\udde6-\\uddff]){2}",un="[\\ud800-\\udbff][\\udc00-\\udfff]",Hr="["+Qa+"]",so="\\u200d",ao="(?:"+ro+"|"+io+")",Pi="(?:"+Hr+"|"+io+")",oo="(?:"+Qs+"(?:d|ll|m|re|s|t|ve))?",co="(?:"+Qs+"(?:D|LL|M|RE|S|T|VE))?",fo=ef+"?",ho="["+eo+"]?",tf="(?:"+so+"(?:"+[no,ys,un].join("|")+")"+ho+fo+")*",ji="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",uo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",lo=ho+fo+tf,ws="(?:"+[Qc,ys,un].join("|")+")"+lo,rf="(?:"+[no+zn+"?",zn,ys,un,Bn].join("|")+")",ta=RegExp(Qs,"g"),nf=RegExp(zn,"g"),_s=RegExp(ms+"(?="+ms+")|"+rf+lo,"g"),po=RegExp([Hr+"?"+ro+"+"+oo+"(?="+[ea,Hr,"$"].join("|")+")",Pi+"+"+co+"(?="+[ea,Hr+ao,"$"].join("|")+")",Hr+"?"+ao+"+"+oo,Hr+"+"+co,uo,ji,to,ws].join("|"),"g"),go=RegExp("["+so+Ai+fn+eo+"]"),Hn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,bo=["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"],sf=-1,Pt={};Pt[Ze]=Pt[_e]=Pt[Oe]=Pt[ot]=Pt[Ce]=Pt[Re]=Pt[ft]=Pt[lt]=Pt[bt]=!0,Pt[ne]=Pt[ge]=Pt[me]=Pt[Z]=Pt[xe]=Pt[j]=Pt[K]=Pt[oe]=Pt[Te]=Pt[Ae]=Pt[He]=Pt[je]=Pt[ye]=Pt[Ie]=Pt[Se]=!1;var At={};At[ne]=At[ge]=At[me]=At[xe]=At[Z]=At[j]=At[Ze]=At[_e]=At[Oe]=At[ot]=At[Ce]=At[Te]=At[Ae]=At[He]=At[je]=At[ye]=At[Ie]=At[Ue]=At[Re]=At[ft]=At[lt]=At[bt]=!0,At[K]=At[oe]=At[Se]=!1;var F={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},X={"&":"&","<":"<",">":">",'"':""","'":"'"},ce={"&":"&","<":"<",">":">",""":'"',"'":"'"},we={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ot=parseFloat,Ye=parseInt,qt=typeof wr=="object"&&wr&&wr.Object===Object&&wr,Zt=typeof self=="object"&&self&&self.Object===Object&&self,vt=qt||Zt||Function("return this")(),Ct=e&&!e.nodeType&&e,Gt=Ct&&!0&&r&&!r.nodeType&&r,Cr=Gt&&Gt.exports===Ct,Qt=Cr&&qt.process,Ut=function(){try{var Y=Gt&&Gt.require&&Gt.require("util").types;return Y||Qt&&Qt.binding&&Qt.binding("util")}catch{}}(),Sr=Ut&&Ut.isArrayBuffer,pi=Ut&&Ut.isDate,Xr=Ut&&Ut.isMap,Oi=Ut&&Ut.isRegExp,ra=Ut&&Ut.isSet,Kn=Ut&&Ut.isTypedArray;function ir(Y,ie,te){switch(te.length){case 0:return Y.call(ie);case 1:return Y.call(ie,te[0]);case 2:return Y.call(ie,te[0],te[1]);case 3:return Y.call(ie,te[0],te[1],te[2])}return Y.apply(ie,te)}function lg(Y,ie,te,Ee){for(var Ke=-1,yt=Y==null?0:Y.length;++Ke<yt;){var er=Y[Ke];ie(Ee,er,te(er),Y)}return Ee}function Zr(Y,ie){for(var te=-1,Ee=Y==null?0:Y.length;++te<Ee&&ie(Y[te],te,Y)!==!1;);return Y}function pg(Y,ie){for(var te=Y==null?0:Y.length;te--&&ie(Y[te],te,Y)!==!1;);return Y}function Du(Y,ie){for(var te=-1,Ee=Y==null?0:Y.length;++te<Ee;)if(!ie(Y[te],te,Y))return!1;return!0}function dn(Y,ie){for(var te=-1,Ee=Y==null?0:Y.length,Ke=0,yt=[];++te<Ee;){var er=Y[te];ie(er,te,Y)&&(yt[Ke++]=er)}return yt}function vo(Y,ie){var te=Y==null?0:Y.length;return!!te&&Es(Y,ie,0)>-1}function af(Y,ie,te){for(var Ee=-1,Ke=Y==null?0:Y.length;++Ee<Ke;)if(te(ie,Y[Ee]))return!0;return!1}function Ht(Y,ie){for(var te=-1,Ee=Y==null?0:Y.length,Ke=Array(Ee);++te<Ee;)Ke[te]=ie(Y[te],te,Y);return Ke}function ln(Y,ie){for(var te=-1,Ee=ie.length,Ke=Y.length;++te<Ee;)Y[Ke+te]=ie[te];return Y}function of(Y,ie,te,Ee){var Ke=-1,yt=Y==null?0:Y.length;for(Ee&&yt&&(te=Y[++Ke]);++Ke<yt;)te=ie(te,Y[Ke],Ke,Y);return te}function gg(Y,ie,te,Ee){var Ke=Y==null?0:Y.length;for(Ee&&Ke&&(te=Y[--Ke]);Ke--;)te=ie(te,Y[Ke],Ke,Y);return te}function cf(Y,ie){for(var te=-1,Ee=Y==null?0:Y.length;++te<Ee;)if(ie(Y[te],te,Y))return!0;return!1}var bg=ff("length");function vg(Y){return Y.split("")}function mg(Y){return Y.match(nt)||[]}function Au(Y,ie,te){var Ee;return te(Y,function(Ke,yt,er){if(ie(Ke,yt,er))return Ee=yt,!1}),Ee}function mo(Y,ie,te,Ee){for(var Ke=Y.length,yt=te+(Ee?1:-1);Ee?yt--:++yt<Ke;)if(ie(Y[yt],yt,Y))return yt;return-1}function Es(Y,ie,te){return ie===ie?Og(Y,ie,te):mo(Y,Mu,te)}function yg(Y,ie,te,Ee){for(var Ke=te-1,yt=Y.length;++Ke<yt;)if(Ee(Y[Ke],ie))return Ke;return-1}function Mu(Y){return Y!==Y}function Pu(Y,ie){var te=Y==null?0:Y.length;return te?uf(Y,ie)/te:d}function ff(Y){return function(ie){return ie==null?t:ie[Y]}}function hf(Y){return function(ie){return Y==null?t:Y[ie]}}function Ou(Y,ie,te,Ee,Ke){return Ke(Y,function(yt,er,Rt){te=Ee?(Ee=!1,yt):ie(te,yt,er,Rt)}),te}function wg(Y,ie){var te=Y.length;for(Y.sort(ie);te--;)Y[te]=Y[te].value;return Y}function uf(Y,ie){for(var te,Ee=-1,Ke=Y.length;++Ee<Ke;){var yt=ie(Y[Ee]);yt!==t&&(te=te===t?yt:te+yt)}return te}function df(Y,ie){for(var te=-1,Ee=Array(Y);++te<Y;)Ee[te]=ie(te);return Ee}function _g(Y,ie){return Ht(ie,function(te){return[te,Y[te]]})}function Cu(Y){return Y&&Y.slice(0,$u(Y)+1).replace(Ft,"")}function Kr(Y){return function(ie){return Y(ie)}}function lf(Y,ie){return Ht(ie,function(te){return Y[te]})}function ia(Y,ie){return Y.has(ie)}function Ru(Y,ie){for(var te=-1,Ee=Y.length;++te<Ee&&Es(ie,Y[te],0)>-1;);return te}function Tu(Y,ie){for(var te=Y.length;te--&&Es(ie,Y[te],0)>-1;);return te}function Eg(Y,ie){for(var te=Y.length,Ee=0;te--;)Y[te]===ie&&++Ee;return Ee}var Sg=hf(F),xg=hf(X);function Ig(Y){return"\\"+we[Y]}function Dg(Y,ie){return Y==null?t:Y[ie]}function Ss(Y){return go.test(Y)}function Ag(Y){return Hn.test(Y)}function Mg(Y){for(var ie,te=[];!(ie=Y.next()).done;)te.push(ie.value);return te}function pf(Y){var ie=-1,te=Array(Y.size);return Y.forEach(function(Ee,Ke){te[++ie]=[Ke,Ee]}),te}function Nu(Y,ie){return function(te){return Y(ie(te))}}function pn(Y,ie){for(var te=-1,Ee=Y.length,Ke=0,yt=[];++te<Ee;){var er=Y[te];(er===ie||er===m)&&(Y[te]=m,yt[Ke++]=te)}return yt}function yo(Y){var ie=-1,te=Array(Y.size);return Y.forEach(function(Ee){te[++ie]=Ee}),te}function Pg(Y){var ie=-1,te=Array(Y.size);return Y.forEach(function(Ee){te[++ie]=[Ee,Ee]}),te}function Og(Y,ie,te){for(var Ee=te-1,Ke=Y.length;++Ee<Ke;)if(Y[Ee]===ie)return Ee;return-1}function Cg(Y,ie,te){for(var Ee=te+1;Ee--;)if(Y[Ee]===ie)return Ee;return Ee}function xs(Y){return Ss(Y)?Tg(Y):bg(Y)}function gi(Y){return Ss(Y)?Ng(Y):vg(Y)}function $u(Y){for(var ie=Y.length;ie--&&Qe.test(Y.charAt(ie)););return ie}var Rg=hf(ce);function Tg(Y){for(var ie=_s.lastIndex=0;_s.test(Y);)++ie;return ie}function Ng(Y){return Y.match(_s)||[]}function $g(Y){return Y.match(po)||[]}var Lg=function Y(ie){ie=ie==null?vt:Is.defaults(vt.Object(),ie,Is.pick(vt,bo));var te=ie.Array,Ee=ie.Date,Ke=ie.Error,yt=ie.Function,er=ie.Math,Rt=ie.Object,gf=ie.RegExp,Fg=ie.String,Qr=ie.TypeError,wo=te.prototype,qg=yt.prototype,Ds=Rt.prototype,_o=ie["__core-js_shared__"],Eo=qg.toString,xt=Ds.hasOwnProperty,Ug=0,Lu=function(){var i=/[^.]+$/.exec(_o&&_o.keys&&_o.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}(),So=Ds.toString,Bg=Eo.call(Rt),zg=vt._,Hg=gf("^"+Eo.call(xt).replace(Ge,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xo=Cr?ie.Buffer:t,gn=ie.Symbol,Io=ie.Uint8Array,Fu=xo?xo.allocUnsafe:t,Do=Nu(Rt.getPrototypeOf,Rt),qu=Rt.create,Uu=Ds.propertyIsEnumerable,Ao=wo.splice,Bu=gn?gn.isConcatSpreadable:t,na=gn?gn.iterator:t,jn=gn?gn.toStringTag:t,Mo=function(){try{var i=Jn(Rt,"defineProperty");return i({},"",{}),i}catch{}}(),Kg=ie.clearTimeout!==vt.clearTimeout&&ie.clearTimeout,jg=Ee&&Ee.now!==vt.Date.now&&Ee.now,kg=ie.setTimeout!==vt.setTimeout&&ie.setTimeout,Po=er.ceil,Oo=er.floor,bf=Rt.getOwnPropertySymbols,Wg=xo?xo.isBuffer:t,zu=ie.isFinite,Vg=wo.join,Gg=Nu(Rt.keys,Rt),tr=er.max,vr=er.min,Jg=Ee.now,Yg=ie.parseInt,Hu=er.random,Xg=wo.reverse,vf=Jn(ie,"DataView"),sa=Jn(ie,"Map"),mf=Jn(ie,"Promise"),As=Jn(ie,"Set"),aa=Jn(ie,"WeakMap"),oa=Jn(Rt,"create"),Co=aa&&new aa,Ms={},Zg=Yn(vf),Qg=Yn(sa),eb=Yn(mf),tb=Yn(As),rb=Yn(aa),Ro=gn?gn.prototype:t,ca=Ro?Ro.valueOf:t,Ku=Ro?Ro.toString:t;function A(i){if(kt(i)&&!Xe(i)&&!(i instanceof gt)){if(i instanceof ei)return i;if(xt.call(i,"__wrapped__"))return jd(i)}return new ei(i)}var Ps=function(){function i(){}return function(s){if(!jt(s))return{};if(qu)return qu(s);i.prototype=s;var c=new i;return i.prototype=t,c}}();function To(){}function ei(i,s){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!s,this.__index__=0,this.__values__=t}A.templateSettings={escape:We,evaluate:Ve,interpolate:Tt,variable:"",imports:{_:A}},A.prototype=To.prototype,A.prototype.constructor=A,ei.prototype=Ps(To.prototype),ei.prototype.constructor=ei;function gt(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=D,this.__views__=[]}function ib(){var i=new gt(this.__wrapped__);return i.__actions__=Rr(this.__actions__),i.__dir__=this.__dir__,i.__filtered__=this.__filtered__,i.__iteratees__=Rr(this.__iteratees__),i.__takeCount__=this.__takeCount__,i.__views__=Rr(this.__views__),i}function nb(){if(this.__filtered__){var i=new gt(this);i.__dir__=-1,i.__filtered__=!0}else i=this.clone(),i.__dir__*=-1;return i}function sb(){var i=this.__wrapped__.value(),s=this.__dir__,c=Xe(i),g=s<0,S=c?i.length:0,C=vv(0,S,this.__views__),B=C.start,k=C.end,Q=k-B,se=g?k:B-1,ae=this.__iteratees__,ue=ae.length,ve=0,Me=vr(Q,this.__takeCount__);if(!c||!g&&S==Q&&Me==Q)return ld(i,this.__actions__);var $e=[];e:for(;Q--&&ve<Me;){se+=s;for(var at=-1,Le=i[se];++at<ue;){var ut=ae[at],mt=ut.iteratee,Wr=ut.type,Dr=mt(Le);if(Wr==E)Le=Dr;else if(!Dr){if(Wr==w)continue e;break e}}$e[ve++]=Le}return $e}gt.prototype=Ps(To.prototype),gt.prototype.constructor=gt;function kn(i){var s=-1,c=i==null?0:i.length;for(this.clear();++s<c;){var g=i[s];this.set(g[0],g[1])}}function ab(){this.__data__=oa?oa(null):{},this.size=0}function ob(i){var s=this.has(i)&&delete this.__data__[i];return this.size-=s?1:0,s}function cb(i){var s=this.__data__;if(oa){var c=s[i];return c===p?t:c}return xt.call(s,i)?s[i]:t}function fb(i){var s=this.__data__;return oa?s[i]!==t:xt.call(s,i)}function hb(i,s){var c=this.__data__;return this.size+=this.has(i)?0:1,c[i]=oa&&s===t?p:s,this}kn.prototype.clear=ab,kn.prototype.delete=ob,kn.prototype.get=cb,kn.prototype.has=fb,kn.prototype.set=hb;function ki(i){var s=-1,c=i==null?0:i.length;for(this.clear();++s<c;){var g=i[s];this.set(g[0],g[1])}}function ub(){this.__data__=[],this.size=0}function db(i){var s=this.__data__,c=No(s,i);if(c<0)return!1;var g=s.length-1;return c==g?s.pop():Ao.call(s,c,1),--this.size,!0}function lb(i){var s=this.__data__,c=No(s,i);return c<0?t:s[c][1]}function pb(i){return No(this.__data__,i)>-1}function gb(i,s){var c=this.__data__,g=No(c,i);return g<0?(++this.size,c.push([i,s])):c[g][1]=s,this}ki.prototype.clear=ub,ki.prototype.delete=db,ki.prototype.get=lb,ki.prototype.has=pb,ki.prototype.set=gb;function Wi(i){var s=-1,c=i==null?0:i.length;for(this.clear();++s<c;){var g=i[s];this.set(g[0],g[1])}}function bb(){this.size=0,this.__data__={hash:new kn,map:new(sa||ki),string:new kn}}function vb(i){var s=Wo(this,i).delete(i);return this.size-=s?1:0,s}function mb(i){return Wo(this,i).get(i)}function yb(i){return Wo(this,i).has(i)}function wb(i,s){var c=Wo(this,i),g=c.size;return c.set(i,s),this.size+=c.size==g?0:1,this}Wi.prototype.clear=bb,Wi.prototype.delete=vb,Wi.prototype.get=mb,Wi.prototype.has=yb,Wi.prototype.set=wb;function Wn(i){var s=-1,c=i==null?0:i.length;for(this.__data__=new Wi;++s<c;)this.add(i[s])}function _b(i){return this.__data__.set(i,p),this}function Eb(i){return this.__data__.has(i)}Wn.prototype.add=Wn.prototype.push=_b,Wn.prototype.has=Eb;function bi(i){var s=this.__data__=new ki(i);this.size=s.size}function Sb(){this.__data__=new ki,this.size=0}function xb(i){var s=this.__data__,c=s.delete(i);return this.size=s.size,c}function Ib(i){return this.__data__.get(i)}function Db(i){return this.__data__.has(i)}function Ab(i,s){var c=this.__data__;if(c instanceof ki){var g=c.__data__;if(!sa||g.length<a-1)return g.push([i,s]),this.size=++c.size,this;c=this.__data__=new Wi(g)}return c.set(i,s),this.size=c.size,this}bi.prototype.clear=Sb,bi.prototype.delete=xb,bi.prototype.get=Ib,bi.prototype.has=Db,bi.prototype.set=Ab;function ju(i,s){var c=Xe(i),g=!c&&Xn(i),S=!c&&!g&&wn(i),C=!c&&!g&&!S&&Ts(i),B=c||g||S||C,k=B?df(i.length,Fg):[],Q=k.length;for(var se in i)(s||xt.call(i,se))&&!(B&&(se=="length"||S&&(se=="offset"||se=="parent")||C&&(se=="buffer"||se=="byteLength"||se=="byteOffset")||Yi(se,Q)))&&k.push(se);return k}function ku(i){var s=i.length;return s?i[Pf(0,s-1)]:t}function Mb(i,s){return Vo(Rr(i),Vn(s,0,i.length))}function Pb(i){return Vo(Rr(i))}function yf(i,s,c){(c!==t&&!vi(i[s],c)||c===t&&!(s in i))&&Vi(i,s,c)}function fa(i,s,c){var g=i[s];(!(xt.call(i,s)&&vi(g,c))||c===t&&!(s in i))&&Vi(i,s,c)}function No(i,s){for(var c=i.length;c--;)if(vi(i[c][0],s))return c;return-1}function Ob(i,s,c,g){return bn(i,function(S,C,B){s(g,S,c(S),B)}),g}function Wu(i,s){return i&&Ri(s,nr(s),i)}function Cb(i,s){return i&&Ri(s,Nr(s),i)}function Vi(i,s,c){s=="__proto__"&&Mo?Mo(i,s,{configurable:!0,enumerable:!0,value:c,writable:!0}):i[s]=c}function wf(i,s){for(var c=-1,g=s.length,S=te(g),C=i==null;++c<g;)S[c]=C?t:eh(i,s[c]);return S}function Vn(i,s,c){return i===i&&(c!==t&&(i=i<=c?i:c),s!==t&&(i=i>=s?i:s)),i}function ti(i,s,c,g,S,C){var B,k=s&_,Q=s&M,se=s&I;if(c&&(B=S?c(i,g,S,C):c(i)),B!==t)return B;if(!jt(i))return i;var ae=Xe(i);if(ae){if(B=yv(i),!k)return Rr(i,B)}else{var ue=mr(i),ve=ue==oe||ue==le;if(wn(i))return bd(i,k);if(ue==He||ue==ne||ve&&!S){if(B=Q||ve?{}:$d(i),!k)return Q?cv(i,Cb(B,i)):ov(i,Wu(B,i))}else{if(!At[ue])return S?i:{};B=wv(i,ue,k)}}C||(C=new bi);var Me=C.get(i);if(Me)return Me;C.set(i,B),hl(i)?i.forEach(function(Le){B.add(ti(Le,s,c,Le,i,C))}):cl(i)&&i.forEach(function(Le,ut){B.set(ut,ti(Le,s,c,ut,i,C))});var $e=se?Q?Bf:Uf:Q?Nr:nr,at=ae?t:$e(i);return Zr(at||i,function(Le,ut){at&&(ut=Le,Le=i[ut]),fa(B,ut,ti(Le,s,c,ut,i,C))}),B}function Rb(i){var s=nr(i);return function(c){return Vu(c,i,s)}}function Vu(i,s,c){var g=c.length;if(i==null)return!g;for(i=Rt(i);g--;){var S=c[g],C=s[S],B=i[S];if(B===t&&!(S in i)||!C(B))return!1}return!0}function Gu(i,s,c){if(typeof i!="function")throw new Qr(f);return ba(function(){i.apply(t,c)},s)}function ha(i,s,c,g){var S=-1,C=vo,B=!0,k=i.length,Q=[],se=s.length;if(!k)return Q;c&&(s=Ht(s,Kr(c))),g?(C=af,B=!1):s.length>=a&&(C=ia,B=!1,s=new Wn(s));e:for(;++S<k;){var ae=i[S],ue=c==null?ae:c(ae);if(ae=g||ae!==0?ae:0,B&&ue===ue){for(var ve=se;ve--;)if(s[ve]===ue)continue e;Q.push(ae)}else C(s,ue,g)||Q.push(ae)}return Q}var bn=_d(Ci),Ju=_d(Ef,!0);function Tb(i,s){var c=!0;return bn(i,function(g,S,C){return c=!!s(g,S,C),c}),c}function $o(i,s,c){for(var g=-1,S=i.length;++g<S;){var C=i[g],B=s(C);if(B!=null&&(k===t?B===B&&!kr(B):c(B,k)))var k=B,Q=C}return Q}function Nb(i,s,c,g){var S=i.length;for(c=st(c),c<0&&(c=-c>S?0:S+c),g=g===t||g>S?S:st(g),g<0&&(g+=S),g=c>g?0:dl(g);c<g;)i[c++]=s;return i}function Yu(i,s){var c=[];return bn(i,function(g,S,C){s(g,S,C)&&c.push(g)}),c}function dr(i,s,c,g,S){var C=-1,B=i.length;for(c||(c=Ev),S||(S=[]);++C<B;){var k=i[C];s>0&&c(k)?s>1?dr(k,s-1,c,g,S):ln(S,k):g||(S[S.length]=k)}return S}var _f=Ed(),Xu=Ed(!0);function Ci(i,s){return i&&_f(i,s,nr)}function Ef(i,s){return i&&Xu(i,s,nr)}function Lo(i,s){return dn(s,function(c){return Xi(i[c])})}function Gn(i,s){s=mn(s,i);for(var c=0,g=s.length;i!=null&&c<g;)i=i[Ti(s[c++])];return c&&c==g?i:t}function Zu(i,s,c){var g=s(i);return Xe(i)?g:ln(g,c(i))}function xr(i){return i==null?i===t?De:Pe:jn&&jn in Rt(i)?bv(i):Pv(i)}function Sf(i,s){return i>s}function $b(i,s){return i!=null&&xt.call(i,s)}function Lb(i,s){return i!=null&&s in Rt(i)}function Fb(i,s,c){return i>=vr(s,c)&&i<tr(s,c)}function xf(i,s,c){for(var g=c?af:vo,S=i[0].length,C=i.length,B=C,k=te(C),Q=1/0,se=[];B--;){var ae=i[B];B&&s&&(ae=Ht(ae,Kr(s))),Q=vr(ae.length,Q),k[B]=!c&&(s||S>=120&&ae.length>=120)?new Wn(B&&ae):t}ae=i[0];var ue=-1,ve=k[0];e:for(;++ue<S&&se.length<Q;){var Me=ae[ue],$e=s?s(Me):Me;if(Me=c||Me!==0?Me:0,!(ve?ia(ve,$e):g(se,$e,c))){for(B=C;--B;){var at=k[B];if(!(at?ia(at,$e):g(i[B],$e,c)))continue e}ve&&ve.push($e),se.push(Me)}}return se}function qb(i,s,c,g){return Ci(i,function(S,C,B){s(g,c(S),C,B)}),g}function ua(i,s,c){s=mn(s,i),i=Ud(i,s);var g=i==null?i:i[Ti(ii(s))];return g==null?t:ir(g,i,c)}function Qu(i){return kt(i)&&xr(i)==ne}function Ub(i){return kt(i)&&xr(i)==me}function Bb(i){return kt(i)&&xr(i)==j}function da(i,s,c,g,S){return i===s?!0:i==null||s==null||!kt(i)&&!kt(s)?i!==i&&s!==s:zb(i,s,c,g,da,S)}function zb(i,s,c,g,S,C){var B=Xe(i),k=Xe(s),Q=B?ge:mr(i),se=k?ge:mr(s);Q=Q==ne?He:Q,se=se==ne?He:se;var ae=Q==He,ue=se==He,ve=Q==se;if(ve&&wn(i)){if(!wn(s))return!1;B=!0,ae=!1}if(ve&&!ae)return C||(C=new bi),B||Ts(i)?Rd(i,s,c,g,S,C):pv(i,s,Q,c,g,S,C);if(!(c&P)){var Me=ae&&xt.call(i,"__wrapped__"),$e=ue&&xt.call(s,"__wrapped__");if(Me||$e){var at=Me?i.value():i,Le=$e?s.value():s;return C||(C=new bi),S(at,Le,c,g,C)}}return ve?(C||(C=new bi),gv(i,s,c,g,S,C)):!1}function Hb(i){return kt(i)&&mr(i)==Te}function If(i,s,c,g){var S=c.length,C=S,B=!g;if(i==null)return!C;for(i=Rt(i);S--;){var k=c[S];if(B&&k[2]?k[1]!==i[k[0]]:!(k[0]in i))return!1}for(;++S<C;){k=c[S];var Q=k[0],se=i[Q],ae=k[1];if(B&&k[2]){if(se===t&&!(Q in i))return!1}else{var ue=new bi;if(g)var ve=g(se,ae,Q,i,s,ue);if(!(ve===t?da(ae,se,P|H,g,ue):ve))return!1}}return!0}function ed(i){if(!jt(i)||xv(i))return!1;var s=Xi(i)?Hg:On;return s.test(Yn(i))}function Kb(i){return kt(i)&&xr(i)==je}function jb(i){return kt(i)&&mr(i)==ye}function kb(i){return kt(i)&&Qo(i.length)&&!!Pt[xr(i)]}function td(i){return typeof i=="function"?i:i==null?$r:typeof i=="object"?Xe(i)?nd(i[0],i[1]):id(i):Sl(i)}function Df(i){if(!ga(i))return Gg(i);var s=[];for(var c in Rt(i))xt.call(i,c)&&c!="constructor"&&s.push(c);return s}function Wb(i){if(!jt(i))return Mv(i);var s=ga(i),c=[];for(var g in i)g=="constructor"&&(s||!xt.call(i,g))||c.push(g);return c}function Af(i,s){return i<s}function rd(i,s){var c=-1,g=Tr(i)?te(i.length):[];return bn(i,function(S,C,B){g[++c]=s(S,C,B)}),g}function id(i){var s=Hf(i);return s.length==1&&s[0][2]?Fd(s[0][0],s[0][1]):function(c){return c===i||If(c,i,s)}}function nd(i,s){return jf(i)&&Ld(s)?Fd(Ti(i),s):function(c){var g=eh(c,i);return g===t&&g===s?th(c,i):da(s,g,P|H)}}function Fo(i,s,c,g,S){i!==s&&_f(s,function(C,B){if(S||(S=new bi),jt(C))Vb(i,s,B,c,Fo,g,S);else{var k=g?g(Wf(i,B),C,B+"",i,s,S):t;k===t&&(k=C),yf(i,B,k)}},Nr)}function Vb(i,s,c,g,S,C,B){var k=Wf(i,c),Q=Wf(s,c),se=B.get(Q);if(se){yf(i,c,se);return}var ae=C?C(k,Q,c+"",i,s,B):t,ue=ae===t;if(ue){var ve=Xe(Q),Me=!ve&&wn(Q),$e=!ve&&!Me&&Ts(Q);ae=Q,ve||Me||$e?Xe(k)?ae=k:Jt(k)?ae=Rr(k):Me?(ue=!1,ae=bd(Q,!0)):$e?(ue=!1,ae=vd(Q,!0)):ae=[]:va(Q)||Xn(Q)?(ae=k,Xn(k)?ae=ll(k):(!jt(k)||Xi(k))&&(ae=$d(Q))):ue=!1}ue&&(B.set(Q,ae),S(ae,Q,g,C,B),B.delete(Q)),yf(i,c,ae)}function sd(i,s){var c=i.length;if(c)return s+=s<0?c:0,Yi(s,c)?i[s]:t}function ad(i,s,c){s.length?s=Ht(s,function(C){return Xe(C)?function(B){return Gn(B,C.length===1?C[0]:C)}:C}):s=[$r];var g=-1;s=Ht(s,Kr(Ne()));var S=rd(i,function(C,B,k){var Q=Ht(s,function(se){return se(C)});return{criteria:Q,index:++g,value:C}});return wg(S,function(C,B){return av(C,B,c)})}function Gb(i,s){return od(i,s,function(c,g){return th(i,g)})}function od(i,s,c){for(var g=-1,S=s.length,C={};++g<S;){var B=s[g],k=Gn(i,B);c(k,B)&&la(C,mn(B,i),k)}return C}function Jb(i){return function(s){return Gn(s,i)}}function Mf(i,s,c,g){var S=g?yg:Es,C=-1,B=s.length,k=i;for(i===s&&(s=Rr(s)),c&&(k=Ht(i,Kr(c)));++C<B;)for(var Q=0,se=s[C],ae=c?c(se):se;(Q=S(k,ae,Q,g))>-1;)k!==i&&Ao.call(k,Q,1),Ao.call(i,Q,1);return i}function cd(i,s){for(var c=i?s.length:0,g=c-1;c--;){var S=s[c];if(c==g||S!==C){var C=S;Yi(S)?Ao.call(i,S,1):Rf(i,S)}}return i}function Pf(i,s){return i+Oo(Hu()*(s-i+1))}function Yb(i,s,c,g){for(var S=-1,C=tr(Po((s-i)/(c||1)),0),B=te(C);C--;)B[g?C:++S]=i,i+=c;return B}function Of(i,s){var c="";if(!i||s<1||s>R)return c;do s%2&&(c+=i),s=Oo(s/2),s&&(i+=i);while(s);return c}function ct(i,s){return Vf(qd(i,s,$r),i+"")}function Xb(i){return ku(Ns(i))}function Zb(i,s){var c=Ns(i);return Vo(c,Vn(s,0,c.length))}function la(i,s,c,g){if(!jt(i))return i;s=mn(s,i);for(var S=-1,C=s.length,B=C-1,k=i;k!=null&&++S<C;){var Q=Ti(s[S]),se=c;if(Q==="__proto__"||Q==="constructor"||Q==="prototype")return i;if(S!=B){var ae=k[Q];se=g?g(ae,Q,k):t,se===t&&(se=jt(ae)?ae:Yi(s[S+1])?[]:{})}fa(k,Q,se),k=k[Q]}return i}var fd=Co?function(i,s){return Co.set(i,s),i}:$r,Qb=Mo?function(i,s){return Mo(i,"toString",{configurable:!0,enumerable:!1,value:ih(s),writable:!0})}:$r;function ev(i){return Vo(Ns(i))}function ri(i,s,c){var g=-1,S=i.length;s<0&&(s=-s>S?0:S+s),c=c>S?S:c,c<0&&(c+=S),S=s>c?0:c-s>>>0,s>>>=0;for(var C=te(S);++g<S;)C[g]=i[g+s];return C}function tv(i,s){var c;return bn(i,function(g,S,C){return c=s(g,S,C),!c}),!!c}function qo(i,s,c){var g=0,S=i==null?g:i.length;if(typeof s=="number"&&s===s&&S<=ee){for(;g<S;){var C=g+S>>>1,B=i[C];B!==null&&!kr(B)&&(c?B<=s:B<s)?g=C+1:S=C}return S}return Cf(i,s,$r,c)}function Cf(i,s,c,g){var S=0,C=i==null?0:i.length;if(C===0)return 0;s=c(s);for(var B=s!==s,k=s===null,Q=kr(s),se=s===t;S<C;){var ae=Oo((S+C)/2),ue=c(i[ae]),ve=ue!==t,Me=ue===null,$e=ue===ue,at=kr(ue);if(B)var Le=g||$e;else se?Le=$e&&(g||ve):k?Le=$e&&ve&&(g||!Me):Q?Le=$e&&ve&&!Me&&(g||!at):Me||at?Le=!1:Le=g?ue<=s:ue<s;Le?S=ae+1:C=ae}return vr(C,fe)}function hd(i,s){for(var c=-1,g=i.length,S=0,C=[];++c<g;){var B=i[c],k=s?s(B):B;if(!c||!vi(k,Q)){var Q=k;C[S++]=B===0?0:B}}return C}function ud(i){return typeof i=="number"?i:kr(i)?d:+i}function jr(i){if(typeof i=="string")return i;if(Xe(i))return Ht(i,jr)+"";if(kr(i))return Ku?Ku.call(i):"";var s=i+"";return s=="0"&&1/i==-N?"-0":s}function vn(i,s,c){var g=-1,S=vo,C=i.length,B=!0,k=[],Q=k;if(c)B=!1,S=af;else if(C>=a){var se=s?null:dv(i);if(se)return yo(se);B=!1,S=ia,Q=new Wn}else Q=s?[]:k;e:for(;++g<C;){var ae=i[g],ue=s?s(ae):ae;if(ae=c||ae!==0?ae:0,B&&ue===ue){for(var ve=Q.length;ve--;)if(Q[ve]===ue)continue e;s&&Q.push(ue),k.push(ae)}else S(Q,ue,c)||(Q!==k&&Q.push(ue),k.push(ae))}return k}function Rf(i,s){return s=mn(s,i),i=Ud(i,s),i==null||delete i[Ti(ii(s))]}function dd(i,s,c,g){return la(i,s,c(Gn(i,s)),g)}function Uo(i,s,c,g){for(var S=i.length,C=g?S:-1;(g?C--:++C<S)&&s(i[C],C,i););return c?ri(i,g?0:C,g?C+1:S):ri(i,g?C+1:0,g?S:C)}function ld(i,s){var c=i;return c instanceof gt&&(c=c.value()),of(s,function(g,S){return S.func.apply(S.thisArg,ln([g],S.args))},c)}function Tf(i,s,c){var g=i.length;if(g<2)return g?vn(i[0]):[];for(var S=-1,C=te(g);++S<g;)for(var B=i[S],k=-1;++k<g;)k!=S&&(C[S]=ha(C[S]||B,i[k],s,c));return vn(dr(C,1),s,c)}function pd(i,s,c){for(var g=-1,S=i.length,C=s.length,B={};++g<S;){var k=g<C?s[g]:t;c(B,i[g],k)}return B}function Nf(i){return Jt(i)?i:[]}function $f(i){return typeof i=="function"?i:$r}function mn(i,s){return Xe(i)?i:jf(i,s)?[i]:Kd(_t(i))}var rv=ct;function yn(i,s,c){var g=i.length;return c=c===t?g:c,!s&&c>=g?i:ri(i,s,c)}var gd=Kg||function(i){return vt.clearTimeout(i)};function bd(i,s){if(s)return i.slice();var c=i.length,g=Fu?Fu(c):new i.constructor(c);return i.copy(g),g}function Lf(i){var s=new i.constructor(i.byteLength);return new Io(s).set(new Io(i)),s}function iv(i,s){var c=s?Lf(i.buffer):i.buffer;return new i.constructor(c,i.byteOffset,i.byteLength)}function nv(i){var s=new i.constructor(i.source,br.exec(i));return s.lastIndex=i.lastIndex,s}function sv(i){return ca?Rt(ca.call(i)):{}}function vd(i,s){var c=s?Lf(i.buffer):i.buffer;return new i.constructor(c,i.byteOffset,i.length)}function md(i,s){if(i!==s){var c=i!==t,g=i===null,S=i===i,C=kr(i),B=s!==t,k=s===null,Q=s===s,se=kr(s);if(!k&&!se&&!C&&i>s||C&&B&&Q&&!k&&!se||g&&B&&Q||!c&&Q||!S)return 1;if(!g&&!C&&!se&&i<s||se&&c&&S&&!g&&!C||k&&c&&S||!B&&S||!Q)return-1}return 0}function av(i,s,c){for(var g=-1,S=i.criteria,C=s.criteria,B=S.length,k=c.length;++g<B;){var Q=md(S[g],C[g]);if(Q){if(g>=k)return Q;var se=c[g];return Q*(se=="desc"?-1:1)}}return i.index-s.index}function yd(i,s,c,g){for(var S=-1,C=i.length,B=c.length,k=-1,Q=s.length,se=tr(C-B,0),ae=te(Q+se),ue=!g;++k<Q;)ae[k]=s[k];for(;++S<B;)(ue||S<C)&&(ae[c[S]]=i[S]);for(;se--;)ae[k++]=i[S++];return ae}function wd(i,s,c,g){for(var S=-1,C=i.length,B=-1,k=c.length,Q=-1,se=s.length,ae=tr(C-k,0),ue=te(ae+se),ve=!g;++S<ae;)ue[S]=i[S];for(var Me=S;++Q<se;)ue[Me+Q]=s[Q];for(;++B<k;)(ve||S<C)&&(ue[Me+c[B]]=i[S++]);return ue}function Rr(i,s){var c=-1,g=i.length;for(s||(s=te(g));++c<g;)s[c]=i[c];return s}function Ri(i,s,c,g){var S=!c;c||(c={});for(var C=-1,B=s.length;++C<B;){var k=s[C],Q=g?g(c[k],i[k],k,c,i):t;Q===t&&(Q=i[k]),S?Vi(c,k,Q):fa(c,k,Q)}return c}function ov(i,s){return Ri(i,Kf(i),s)}function cv(i,s){return Ri(i,Td(i),s)}function Bo(i,s){return function(c,g){var S=Xe(c)?lg:Ob,C=s?s():{};return S(c,i,Ne(g,2),C)}}function Os(i){return ct(function(s,c){var g=-1,S=c.length,C=S>1?c[S-1]:t,B=S>2?c[2]:t;for(C=i.length>3&&typeof C=="function"?(S--,C):t,B&&Ir(c[0],c[1],B)&&(C=S<3?t:C,S=1),s=Rt(s);++g<S;){var k=c[g];k&&i(s,k,g,C)}return s})}function _d(i,s){return function(c,g){if(c==null)return c;if(!Tr(c))return i(c,g);for(var S=c.length,C=s?S:-1,B=Rt(c);(s?C--:++C<S)&&g(B[C],C,B)!==!1;);return c}}function Ed(i){return function(s,c,g){for(var S=-1,C=Rt(s),B=g(s),k=B.length;k--;){var Q=B[i?k:++S];if(c(C[Q],Q,C)===!1)break}return s}}function fv(i,s,c){var g=s&W,S=pa(i);function C(){var B=this&&this!==vt&&this instanceof C?S:i;return B.apply(g?c:this,arguments)}return C}function Sd(i){return function(s){s=_t(s);var c=Ss(s)?gi(s):t,g=c?c[0]:s.charAt(0),S=c?yn(c,1).join(""):s.slice(1);return g[i]()+S}}function Cs(i){return function(s){return of(_l(wl(s).replace(ta,"")),i,"")}}function pa(i){return function(){var s=arguments;switch(s.length){case 0:return new i;case 1:return new i(s[0]);case 2:return new i(s[0],s[1]);case 3:return new i(s[0],s[1],s[2]);case 4:return new i(s[0],s[1],s[2],s[3]);case 5:return new i(s[0],s[1],s[2],s[3],s[4]);case 6:return new i(s[0],s[1],s[2],s[3],s[4],s[5]);case 7:return new i(s[0],s[1],s[2],s[3],s[4],s[5],s[6])}var c=Ps(i.prototype),g=i.apply(c,s);return jt(g)?g:c}}function hv(i,s,c){var g=pa(i);function S(){for(var C=arguments.length,B=te(C),k=C,Q=Rs(S);k--;)B[k]=arguments[k];var se=C<3&&B[0]!==Q&&B[C-1]!==Q?[]:pn(B,Q);if(C-=se.length,C<c)return Md(i,s,zo,S.placeholder,t,B,se,t,t,c-C);var ae=this&&this!==vt&&this instanceof S?g:i;return ir(ae,this,B)}return S}function xd(i){return function(s,c,g){var S=Rt(s);if(!Tr(s)){var C=Ne(c,3);s=nr(s),c=function(k){return C(S[k],k,S)}}var B=i(s,c,g);return B>-1?S[C?s[B]:B]:t}}function Id(i){return Ji(function(s){var c=s.length,g=c,S=ei.prototype.thru;for(i&&s.reverse();g--;){var C=s[g];if(typeof C!="function")throw new Qr(f);if(S&&!B&&ko(C)=="wrapper")var B=new ei([],!0)}for(g=B?g:c;++g<c;){C=s[g];var k=ko(C),Q=k=="wrapper"?zf(C):t;Q&&kf(Q[0])&&Q[1]==(b|V|U|T)&&!Q[4].length&&Q[9]==1?B=B[ko(Q[0])].apply(B,Q[3]):B=C.length==1&&kf(C)?B[k]():B.thru(C)}return function(){var se=arguments,ae=se[0];if(B&&se.length==1&&Xe(ae))return B.plant(ae).value();for(var ue=0,ve=c?s[ue].apply(this,se):ae;++ue<c;)ve=s[ue].call(this,ve);return ve}})}function zo(i,s,c,g,S,C,B,k,Q,se){var ae=s&b,ue=s&W,ve=s&J,Me=s&(V|L),$e=s&re,at=ve?t:pa(i);function Le(){for(var ut=arguments.length,mt=te(ut),Wr=ut;Wr--;)mt[Wr]=arguments[Wr];if(Me)var Dr=Rs(Le),Vr=Eg(mt,Dr);if(g&&(mt=yd(mt,g,S,Me)),C&&(mt=wd(mt,C,B,Me)),ut-=Vr,Me&&ut<se){var Yt=pn(mt,Dr);return Md(i,s,zo,Le.placeholder,c,mt,Yt,k,Q,se-ut)}var mi=ue?c:this,Qi=ve?mi[i]:i;return ut=mt.length,k?mt=Ov(mt,k):$e&&ut>1&&mt.reverse(),ae&&Q<ut&&(mt.length=Q),this&&this!==vt&&this instanceof Le&&(Qi=at||pa(Qi)),Qi.apply(mi,mt)}return Le}function Dd(i,s){return function(c,g){return qb(c,i,s(g),{})}}function Ho(i,s){return function(c,g){var S;if(c===t&&g===t)return s;if(c!==t&&(S=c),g!==t){if(S===t)return g;typeof c=="string"||typeof g=="string"?(c=jr(c),g=jr(g)):(c=ud(c),g=ud(g)),S=i(c,g)}return S}}function Ff(i){return Ji(function(s){return s=Ht(s,Kr(Ne())),ct(function(c){var g=this;return i(s,function(S){return ir(S,g,c)})})})}function Ko(i,s){s=s===t?" ":jr(s);var c=s.length;if(c<2)return c?Of(s,i):s;var g=Of(s,Po(i/xs(s)));return Ss(s)?yn(gi(g),0,i).join(""):g.slice(0,i)}function uv(i,s,c,g){var S=s&W,C=pa(i);function B(){for(var k=-1,Q=arguments.length,se=-1,ae=g.length,ue=te(ae+Q),ve=this&&this!==vt&&this instanceof B?C:i;++se<ae;)ue[se]=g[se];for(;Q--;)ue[se++]=arguments[++k];return ir(ve,S?c:this,ue)}return B}function Ad(i){return function(s,c,g){return g&&typeof g!="number"&&Ir(s,c,g)&&(c=g=t),s=Zi(s),c===t?(c=s,s=0):c=Zi(c),g=g===t?s<c?1:-1:Zi(g),Yb(s,c,g,i)}}function jo(i){return function(s,c){return typeof s=="string"&&typeof c=="string"||(s=ni(s),c=ni(c)),i(s,c)}}function Md(i,s,c,g,S,C,B,k,Q,se){var ae=s&V,ue=ae?B:t,ve=ae?t:B,Me=ae?C:t,$e=ae?t:C;s|=ae?U:z,s&=~(ae?z:U),s&q||(s&=~(W|J));var at=[i,s,S,Me,ue,$e,ve,k,Q,se],Le=c.apply(t,at);return kf(i)&&Bd(Le,at),Le.placeholder=g,zd(Le,i,s)}function qf(i){var s=er[i];return function(c,g){if(c=ni(c),g=g==null?0:vr(st(g),292),g&&zu(c)){var S=(_t(c)+"e").split("e"),C=s(S[0]+"e"+(+S[1]+g));return S=(_t(C)+"e").split("e"),+(S[0]+"e"+(+S[1]-g))}return s(c)}}var dv=As&&1/yo(new As([,-0]))[1]==N?function(i){return new As(i)}:ah;function Pd(i){return function(s){var c=mr(s);return c==Te?pf(s):c==ye?Pg(s):_g(s,i(s))}}function Gi(i,s,c,g,S,C,B,k){var Q=s&J;if(!Q&&typeof i!="function")throw new Qr(f);var se=g?g.length:0;if(se||(s&=~(U|z),g=S=t),B=B===t?B:tr(st(B),0),k=k===t?k:st(k),se-=S?S.length:0,s&z){var ae=g,ue=S;g=S=t}var ve=Q?t:zf(i),Me=[i,s,c,g,S,ae,ue,C,B,k];if(ve&&Av(Me,ve),i=Me[0],s=Me[1],c=Me[2],g=Me[3],S=Me[4],k=Me[9]=Me[9]===t?Q?0:i.length:tr(Me[9]-se,0),!k&&s&(V|L)&&(s&=~(V|L)),!s||s==W)var $e=fv(i,s,c);else s==V||s==L?$e=hv(i,s,k):(s==U||s==(W|U))&&!S.length?$e=uv(i,s,c,g):$e=zo.apply(t,Me);var at=ve?fd:Bd;return zd(at($e,Me),i,s)}function Od(i,s,c,g){return i===t||vi(i,Ds[c])&&!xt.call(g,c)?s:i}function Cd(i,s,c,g,S,C){return jt(i)&&jt(s)&&(C.set(s,i),Fo(i,s,t,Cd,C),C.delete(s)),i}function lv(i){return va(i)?t:i}function Rd(i,s,c,g,S,C){var B=c&P,k=i.length,Q=s.length;if(k!=Q&&!(B&&Q>k))return!1;var se=C.get(i),ae=C.get(s);if(se&&ae)return se==s&&ae==i;var ue=-1,ve=!0,Me=c&H?new Wn:t;for(C.set(i,s),C.set(s,i);++ue<k;){var $e=i[ue],at=s[ue];if(g)var Le=B?g(at,$e,ue,s,i,C):g($e,at,ue,i,s,C);if(Le!==t){if(Le)continue;ve=!1;break}if(Me){if(!cf(s,function(ut,mt){if(!ia(Me,mt)&&($e===ut||S($e,ut,c,g,C)))return Me.push(mt)})){ve=!1;break}}else if(!($e===at||S($e,at,c,g,C))){ve=!1;break}}return C.delete(i),C.delete(s),ve}function pv(i,s,c,g,S,C,B){switch(c){case xe:if(i.byteLength!=s.byteLength||i.byteOffset!=s.byteOffset)return!1;i=i.buffer,s=s.buffer;case me:return!(i.byteLength!=s.byteLength||!C(new Io(i),new Io(s)));case Z:case j:case Ae:return vi(+i,+s);case K:return i.name==s.name&&i.message==s.message;case je:case Ie:return i==s+"";case Te:var k=pf;case ye:var Q=g&P;if(k||(k=yo),i.size!=s.size&&!Q)return!1;var se=B.get(i);if(se)return se==s;g|=H,B.set(i,s);var ae=Rd(k(i),k(s),g,S,C,B);return B.delete(i),ae;case Ue:if(ca)return ca.call(i)==ca.call(s)}return!1}function gv(i,s,c,g,S,C){var B=c&P,k=Uf(i),Q=k.length,se=Uf(s),ae=se.length;if(Q!=ae&&!B)return!1;for(var ue=Q;ue--;){var ve=k[ue];if(!(B?ve in s:xt.call(s,ve)))return!1}var Me=C.get(i),$e=C.get(s);if(Me&&$e)return Me==s&&$e==i;var at=!0;C.set(i,s),C.set(s,i);for(var Le=B;++ue<Q;){ve=k[ue];var ut=i[ve],mt=s[ve];if(g)var Wr=B?g(mt,ut,ve,s,i,C):g(ut,mt,ve,i,s,C);if(!(Wr===t?ut===mt||S(ut,mt,c,g,C):Wr)){at=!1;break}Le||(Le=ve=="constructor")}if(at&&!Le){var Dr=i.constructor,Vr=s.constructor;Dr!=Vr&&"constructor"in i&&"constructor"in s&&!(typeof Dr=="function"&&Dr instanceof Dr&&typeof Vr=="function"&&Vr instanceof Vr)&&(at=!1)}return C.delete(i),C.delete(s),at}function Ji(i){return Vf(qd(i,t,Vd),i+"")}function Uf(i){return Zu(i,nr,Kf)}function Bf(i){return Zu(i,Nr,Td)}var zf=Co?function(i){return Co.get(i)}:ah;function ko(i){for(var s=i.name+"",c=Ms[s],g=xt.call(Ms,s)?c.length:0;g--;){var S=c[g],C=S.func;if(C==null||C==i)return S.name}return s}function Rs(i){var s=xt.call(A,"placeholder")?A:i;return s.placeholder}function Ne(){var i=A.iteratee||nh;return i=i===nh?td:i,arguments.length?i(arguments[0],arguments[1]):i}function Wo(i,s){var c=i.__data__;return Sv(s)?c[typeof s=="string"?"string":"hash"]:c.map}function Hf(i){for(var s=nr(i),c=s.length;c--;){var g=s[c],S=i[g];s[c]=[g,S,Ld(S)]}return s}function Jn(i,s){var c=Dg(i,s);return ed(c)?c:t}function bv(i){var s=xt.call(i,jn),c=i[jn];try{i[jn]=t;var g=!0}catch{}var S=So.call(i);return g&&(s?i[jn]=c:delete i[jn]),S}var Kf=bf?function(i){return i==null?[]:(i=Rt(i),dn(bf(i),function(s){return Uu.call(i,s)}))}:oh,Td=bf?function(i){for(var s=[];i;)ln(s,Kf(i)),i=Do(i);return s}:oh,mr=xr;(vf&&mr(new vf(new ArrayBuffer(1)))!=xe||sa&&mr(new sa)!=Te||mf&&mr(mf.resolve())!=Fe||As&&mr(new As)!=ye||aa&&mr(new aa)!=Se)&&(mr=function(i){var s=xr(i),c=s==He?i.constructor:t,g=c?Yn(c):"";if(g)switch(g){case Zg:return xe;case Qg:return Te;case eb:return Fe;case tb:return ye;case rb:return Se}return s});function vv(i,s,c){for(var g=-1,S=c.length;++g<S;){var C=c[g],B=C.size;switch(C.type){case"drop":i+=B;break;case"dropRight":s-=B;break;case"take":s=vr(s,i+B);break;case"takeRight":i=tr(i,s-B);break}}return{start:i,end:s}}function mv(i){var s=i.match(St);return s?s[1].split(it):[]}function Nd(i,s,c){s=mn(s,i);for(var g=-1,S=s.length,C=!1;++g<S;){var B=Ti(s[g]);if(!(C=i!=null&&c(i,B)))break;i=i[B]}return C||++g!=S?C:(S=i==null?0:i.length,!!S&&Qo(S)&&Yi(B,S)&&(Xe(i)||Xn(i)))}function yv(i){var s=i.length,c=new i.constructor(s);return s&&typeof i[0]=="string"&&xt.call(i,"index")&&(c.index=i.index,c.input=i.input),c}function $d(i){return typeof i.constructor=="function"&&!ga(i)?Ps(Do(i)):{}}function wv(i,s,c){var g=i.constructor;switch(s){case me:return Lf(i);case Z:case j:return new g(+i);case xe:return iv(i,c);case Ze:case _e:case Oe:case ot:case Ce:case Re:case ft:case lt:case bt:return vd(i,c);case Te:return new g;case Ae:case Ie:return new g(i);case je:return nv(i);case ye:return new g;case Ue:return sv(i)}}function _v(i,s){var c=s.length;if(!c)return i;var g=c-1;return s[g]=(c>1?"& ":"")+s[g],s=s.join(c>2?", ":" "),i.replace(Je,`{
|
|
31
|
+
/* [wrapped with `+s+`] */
|
|
32
|
+
`)}function Ev(i){return Xe(i)||Xn(i)||!!(Bu&&i&&i[Bu])}function Yi(i,s){var c=typeof i;return s=s??R,!!s&&(c=="number"||c!="symbol"&&Rn.test(i))&&i>-1&&i%1==0&&i<s}function Ir(i,s,c){if(!jt(c))return!1;var g=typeof s;return(g=="number"?Tr(c)&&Yi(s,c.length):g=="string"&&s in c)?vi(c[s],i):!1}function jf(i,s){if(Xe(i))return!1;var c=typeof i;return c=="number"||c=="symbol"||c=="boolean"||i==null||kr(i)?!0:tt.test(i)||!ze.test(i)||s!=null&&i in Rt(s)}function Sv(i){var s=typeof i;return s=="string"||s=="number"||s=="symbol"||s=="boolean"?i!=="__proto__":i===null}function kf(i){var s=ko(i),c=A[s];if(typeof c!="function"||!(s in gt.prototype))return!1;if(i===c)return!0;var g=zf(c);return!!g&&i===g[0]}function xv(i){return!!Lu&&Lu in i}var Iv=_o?Xi:ch;function ga(i){var s=i&&i.constructor,c=typeof s=="function"&&s.prototype||Ds;return i===c}function Ld(i){return i===i&&!jt(i)}function Fd(i,s){return function(c){return c==null?!1:c[i]===s&&(s!==t||i in Rt(c))}}function Dv(i){var s=Xo(i,function(g){return c.size===l&&c.clear(),g}),c=s.cache;return s}function Av(i,s){var c=i[1],g=s[1],S=c|g,C=S<(W|J|b),B=g==b&&c==V||g==b&&c==T&&i[7].length<=s[8]||g==(b|T)&&s[7].length<=s[8]&&c==V;if(!(C||B))return i;g&W&&(i[2]=s[2],S|=c&W?0:q);var k=s[3];if(k){var Q=i[3];i[3]=Q?yd(Q,k,s[4]):k,i[4]=Q?pn(i[3],m):s[4]}return k=s[5],k&&(Q=i[5],i[5]=Q?wd(Q,k,s[6]):k,i[6]=Q?pn(i[5],m):s[6]),k=s[7],k&&(i[7]=k),g&b&&(i[8]=i[8]==null?s[8]:vr(i[8],s[8])),i[9]==null&&(i[9]=s[9]),i[0]=s[0],i[1]=S,i}function Mv(i){var s=[];if(i!=null)for(var c in Rt(i))s.push(c);return s}function Pv(i){return So.call(i)}function qd(i,s,c){return s=tr(s===t?i.length-1:s,0),function(){for(var g=arguments,S=-1,C=tr(g.length-s,0),B=te(C);++S<C;)B[S]=g[s+S];S=-1;for(var k=te(s+1);++S<s;)k[S]=g[S];return k[s]=c(B),ir(i,this,k)}}function Ud(i,s){return s.length<2?i:Gn(i,ri(s,0,-1))}function Ov(i,s){for(var c=i.length,g=vr(s.length,c),S=Rr(i);g--;){var C=s[g];i[g]=Yi(C,c)?S[C]:t}return i}function Wf(i,s){if(!(s==="constructor"&&typeof i[s]=="function")&&s!="__proto__")return i[s]}var Bd=Hd(fd),ba=kg||function(i,s){return vt.setTimeout(i,s)},Vf=Hd(Qb);function zd(i,s,c){var g=s+"";return Vf(i,_v(g,Cv(mv(g),c)))}function Hd(i){var s=0,c=0;return function(){var g=Jg(),S=y-(g-c);if(c=g,S>0){if(++s>=u)return arguments[0]}else s=0;return i.apply(t,arguments)}}function Vo(i,s){var c=-1,g=i.length,S=g-1;for(s=s===t?g:s;++c<s;){var C=Pf(c,S),B=i[C];i[C]=i[c],i[c]=B}return i.length=s,i}var Kd=Dv(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(Kt,function(c,g,S,C){s.push(S?C.replace(Bt,"$1"):g||c)}),s});function Ti(i){if(typeof i=="string"||kr(i))return i;var s=i+"";return s=="0"&&1/i==-N?"-0":s}function Yn(i){if(i!=null){try{return Eo.call(i)}catch{}try{return i+""}catch{}}return""}function Cv(i,s){return Zr(he,function(c){var g="_."+c[0];s&c[1]&&!vo(i,g)&&i.push(g)}),i.sort()}function jd(i){if(i instanceof gt)return i.clone();var s=new ei(i.__wrapped__,i.__chain__);return s.__actions__=Rr(i.__actions__),s.__index__=i.__index__,s.__values__=i.__values__,s}function Rv(i,s,c){(c?Ir(i,s,c):s===t)?s=1:s=tr(st(s),0);var g=i==null?0:i.length;if(!g||s<1)return[];for(var S=0,C=0,B=te(Po(g/s));S<g;)B[C++]=ri(i,S,S+=s);return B}function Tv(i){for(var s=-1,c=i==null?0:i.length,g=0,S=[];++s<c;){var C=i[s];C&&(S[g++]=C)}return S}function Nv(){var i=arguments.length;if(!i)return[];for(var s=te(i-1),c=arguments[0],g=i;g--;)s[g-1]=arguments[g];return ln(Xe(c)?Rr(c):[c],dr(s,1))}var $v=ct(function(i,s){return Jt(i)?ha(i,dr(s,1,Jt,!0)):[]}),Lv=ct(function(i,s){var c=ii(s);return Jt(c)&&(c=t),Jt(i)?ha(i,dr(s,1,Jt,!0),Ne(c,2)):[]}),Fv=ct(function(i,s){var c=ii(s);return Jt(c)&&(c=t),Jt(i)?ha(i,dr(s,1,Jt,!0),t,c):[]});function qv(i,s,c){var g=i==null?0:i.length;return g?(s=c||s===t?1:st(s),ri(i,s<0?0:s,g)):[]}function Uv(i,s,c){var g=i==null?0:i.length;return g?(s=c||s===t?1:st(s),s=g-s,ri(i,0,s<0?0:s)):[]}function Bv(i,s){return i&&i.length?Uo(i,Ne(s,3),!0,!0):[]}function zv(i,s){return i&&i.length?Uo(i,Ne(s,3),!0):[]}function Hv(i,s,c,g){var S=i==null?0:i.length;return S?(c&&typeof c!="number"&&Ir(i,s,c)&&(c=0,g=S),Nb(i,s,c,g)):[]}function kd(i,s,c){var g=i==null?0:i.length;if(!g)return-1;var S=c==null?0:st(c);return S<0&&(S=tr(g+S,0)),mo(i,Ne(s,3),S)}function Wd(i,s,c){var g=i==null?0:i.length;if(!g)return-1;var S=g-1;return c!==t&&(S=st(c),S=c<0?tr(g+S,0):vr(S,g-1)),mo(i,Ne(s,3),S,!0)}function Vd(i){var s=i==null?0:i.length;return s?dr(i,1):[]}function Kv(i){var s=i==null?0:i.length;return s?dr(i,N):[]}function jv(i,s){var c=i==null?0:i.length;return c?(s=s===t?1:st(s),dr(i,s)):[]}function kv(i){for(var s=-1,c=i==null?0:i.length,g={};++s<c;){var S=i[s];g[S[0]]=S[1]}return g}function Gd(i){return i&&i.length?i[0]:t}function Wv(i,s,c){var g=i==null?0:i.length;if(!g)return-1;var S=c==null?0:st(c);return S<0&&(S=tr(g+S,0)),Es(i,s,S)}function Vv(i){var s=i==null?0:i.length;return s?ri(i,0,-1):[]}var Gv=ct(function(i){var s=Ht(i,Nf);return s.length&&s[0]===i[0]?xf(s):[]}),Jv=ct(function(i){var s=ii(i),c=Ht(i,Nf);return s===ii(c)?s=t:c.pop(),c.length&&c[0]===i[0]?xf(c,Ne(s,2)):[]}),Yv=ct(function(i){var s=ii(i),c=Ht(i,Nf);return s=typeof s=="function"?s:t,s&&c.pop(),c.length&&c[0]===i[0]?xf(c,t,s):[]});function Xv(i,s){return i==null?"":Vg.call(i,s)}function ii(i){var s=i==null?0:i.length;return s?i[s-1]:t}function Zv(i,s,c){var g=i==null?0:i.length;if(!g)return-1;var S=g;return c!==t&&(S=st(c),S=S<0?tr(g+S,0):vr(S,g-1)),s===s?Cg(i,s,S):mo(i,Mu,S,!0)}function Qv(i,s){return i&&i.length?sd(i,st(s)):t}var em=ct(Jd);function Jd(i,s){return i&&i.length&&s&&s.length?Mf(i,s):i}function tm(i,s,c){return i&&i.length&&s&&s.length?Mf(i,s,Ne(c,2)):i}function rm(i,s,c){return i&&i.length&&s&&s.length?Mf(i,s,t,c):i}var im=Ji(function(i,s){var c=i==null?0:i.length,g=wf(i,s);return cd(i,Ht(s,function(S){return Yi(S,c)?+S:S}).sort(md)),g});function nm(i,s){var c=[];if(!(i&&i.length))return c;var g=-1,S=[],C=i.length;for(s=Ne(s,3);++g<C;){var B=i[g];s(B,g,i)&&(c.push(B),S.push(g))}return cd(i,S),c}function Gf(i){return i==null?i:Xg.call(i)}function sm(i,s,c){var g=i==null?0:i.length;return g?(c&&typeof c!="number"&&Ir(i,s,c)?(s=0,c=g):(s=s==null?0:st(s),c=c===t?g:st(c)),ri(i,s,c)):[]}function am(i,s){return qo(i,s)}function om(i,s,c){return Cf(i,s,Ne(c,2))}function cm(i,s){var c=i==null?0:i.length;if(c){var g=qo(i,s);if(g<c&&vi(i[g],s))return g}return-1}function fm(i,s){return qo(i,s,!0)}function hm(i,s,c){return Cf(i,s,Ne(c,2),!0)}function um(i,s){var c=i==null?0:i.length;if(c){var g=qo(i,s,!0)-1;if(vi(i[g],s))return g}return-1}function dm(i){return i&&i.length?hd(i):[]}function lm(i,s){return i&&i.length?hd(i,Ne(s,2)):[]}function pm(i){var s=i==null?0:i.length;return s?ri(i,1,s):[]}function gm(i,s,c){return i&&i.length?(s=c||s===t?1:st(s),ri(i,0,s<0?0:s)):[]}function bm(i,s,c){var g=i==null?0:i.length;return g?(s=c||s===t?1:st(s),s=g-s,ri(i,s<0?0:s,g)):[]}function vm(i,s){return i&&i.length?Uo(i,Ne(s,3),!1,!0):[]}function mm(i,s){return i&&i.length?Uo(i,Ne(s,3)):[]}var ym=ct(function(i){return vn(dr(i,1,Jt,!0))}),wm=ct(function(i){var s=ii(i);return Jt(s)&&(s=t),vn(dr(i,1,Jt,!0),Ne(s,2))}),_m=ct(function(i){var s=ii(i);return s=typeof s=="function"?s:t,vn(dr(i,1,Jt,!0),t,s)});function Em(i){return i&&i.length?vn(i):[]}function Sm(i,s){return i&&i.length?vn(i,Ne(s,2)):[]}function xm(i,s){return s=typeof s=="function"?s:t,i&&i.length?vn(i,t,s):[]}function Jf(i){if(!(i&&i.length))return[];var s=0;return i=dn(i,function(c){if(Jt(c))return s=tr(c.length,s),!0}),df(s,function(c){return Ht(i,ff(c))})}function Yd(i,s){if(!(i&&i.length))return[];var c=Jf(i);return s==null?c:Ht(c,function(g){return ir(s,t,g)})}var Im=ct(function(i,s){return Jt(i)?ha(i,s):[]}),Dm=ct(function(i){return Tf(dn(i,Jt))}),Am=ct(function(i){var s=ii(i);return Jt(s)&&(s=t),Tf(dn(i,Jt),Ne(s,2))}),Mm=ct(function(i){var s=ii(i);return s=typeof s=="function"?s:t,Tf(dn(i,Jt),t,s)}),Pm=ct(Jf);function Om(i,s){return pd(i||[],s||[],fa)}function Cm(i,s){return pd(i||[],s||[],la)}var Rm=ct(function(i){var s=i.length,c=s>1?i[s-1]:t;return c=typeof c=="function"?(i.pop(),c):t,Yd(i,c)});function Xd(i){var s=A(i);return s.__chain__=!0,s}function Tm(i,s){return s(i),i}function Go(i,s){return s(i)}var Nm=Ji(function(i){var s=i.length,c=s?i[0]:0,g=this.__wrapped__,S=function(C){return wf(C,i)};return s>1||this.__actions__.length||!(g instanceof gt)||!Yi(c)?this.thru(S):(g=g.slice(c,+c+(s?1:0)),g.__actions__.push({func:Go,args:[S],thisArg:t}),new ei(g,this.__chain__).thru(function(C){return s&&!C.length&&C.push(t),C}))});function $m(){return Xd(this)}function Lm(){return new ei(this.value(),this.__chain__)}function Fm(){this.__values__===t&&(this.__values__=ul(this.value()));var i=this.__index__>=this.__values__.length,s=i?t:this.__values__[this.__index__++];return{done:i,value:s}}function qm(){return this}function Um(i){for(var s,c=this;c instanceof To;){var g=jd(c);g.__index__=0,g.__values__=t,s?S.__wrapped__=g:s=g;var S=g;c=c.__wrapped__}return S.__wrapped__=i,s}function Bm(){var i=this.__wrapped__;if(i instanceof gt){var s=i;return this.__actions__.length&&(s=new gt(this)),s=s.reverse(),s.__actions__.push({func:Go,args:[Gf],thisArg:t}),new ei(s,this.__chain__)}return this.thru(Gf)}function zm(){return ld(this.__wrapped__,this.__actions__)}var Hm=Bo(function(i,s,c){xt.call(i,c)?++i[c]:Vi(i,c,1)});function Km(i,s,c){var g=Xe(i)?Du:Tb;return c&&Ir(i,s,c)&&(s=t),g(i,Ne(s,3))}function jm(i,s){var c=Xe(i)?dn:Yu;return c(i,Ne(s,3))}var km=xd(kd),Wm=xd(Wd);function Vm(i,s){return dr(Jo(i,s),1)}function Gm(i,s){return dr(Jo(i,s),N)}function Jm(i,s,c){return c=c===t?1:st(c),dr(Jo(i,s),c)}function Zd(i,s){var c=Xe(i)?Zr:bn;return c(i,Ne(s,3))}function Qd(i,s){var c=Xe(i)?pg:Ju;return c(i,Ne(s,3))}var Ym=Bo(function(i,s,c){xt.call(i,c)?i[c].push(s):Vi(i,c,[s])});function Xm(i,s,c,g){i=Tr(i)?i:Ns(i),c=c&&!g?st(c):0;var S=i.length;return c<0&&(c=tr(S+c,0)),ec(i)?c<=S&&i.indexOf(s,c)>-1:!!S&&Es(i,s,c)>-1}var Zm=ct(function(i,s,c){var g=-1,S=typeof s=="function",C=Tr(i)?te(i.length):[];return bn(i,function(B){C[++g]=S?ir(s,B,c):ua(B,s,c)}),C}),Qm=Bo(function(i,s,c){Vi(i,c,s)});function Jo(i,s){var c=Xe(i)?Ht:rd;return c(i,Ne(s,3))}function ey(i,s,c,g){return i==null?[]:(Xe(s)||(s=s==null?[]:[s]),c=g?t:c,Xe(c)||(c=c==null?[]:[c]),ad(i,s,c))}var ty=Bo(function(i,s,c){i[c?0:1].push(s)},function(){return[[],[]]});function ry(i,s,c){var g=Xe(i)?of:Ou,S=arguments.length<3;return g(i,Ne(s,4),c,S,bn)}function iy(i,s,c){var g=Xe(i)?gg:Ou,S=arguments.length<3;return g(i,Ne(s,4),c,S,Ju)}function ny(i,s){var c=Xe(i)?dn:Yu;return c(i,Zo(Ne(s,3)))}function sy(i){var s=Xe(i)?ku:Xb;return s(i)}function ay(i,s,c){(c?Ir(i,s,c):s===t)?s=1:s=st(s);var g=Xe(i)?Mb:Zb;return g(i,s)}function oy(i){var s=Xe(i)?Pb:ev;return s(i)}function cy(i){if(i==null)return 0;if(Tr(i))return ec(i)?xs(i):i.length;var s=mr(i);return s==Te||s==ye?i.size:Df(i).length}function fy(i,s,c){var g=Xe(i)?cf:tv;return c&&Ir(i,s,c)&&(s=t),g(i,Ne(s,3))}var hy=ct(function(i,s){if(i==null)return[];var c=s.length;return c>1&&Ir(i,s[0],s[1])?s=[]:c>2&&Ir(s[0],s[1],s[2])&&(s=[s[0]]),ad(i,dr(s,1),[])}),Yo=jg||function(){return vt.Date.now()};function uy(i,s){if(typeof s!="function")throw new Qr(f);return i=st(i),function(){if(--i<1)return s.apply(this,arguments)}}function el(i,s,c){return s=c?t:s,s=i&&s==null?i.length:s,Gi(i,b,t,t,t,t,s)}function tl(i,s){var c;if(typeof s!="function")throw new Qr(f);return i=st(i),function(){return--i>0&&(c=s.apply(this,arguments)),i<=1&&(s=t),c}}var Yf=ct(function(i,s,c){var g=W;if(c.length){var S=pn(c,Rs(Yf));g|=U}return Gi(i,g,s,c,S)}),rl=ct(function(i,s,c){var g=W|J;if(c.length){var S=pn(c,Rs(rl));g|=U}return Gi(s,g,i,c,S)});function il(i,s,c){s=c?t:s;var g=Gi(i,V,t,t,t,t,t,s);return g.placeholder=il.placeholder,g}function nl(i,s,c){s=c?t:s;var g=Gi(i,L,t,t,t,t,t,s);return g.placeholder=nl.placeholder,g}function sl(i,s,c){var g,S,C,B,k,Q,se=0,ae=!1,ue=!1,ve=!0;if(typeof i!="function")throw new Qr(f);s=ni(s)||0,jt(c)&&(ae=!!c.leading,ue="maxWait"in c,C=ue?tr(ni(c.maxWait)||0,s):C,ve="trailing"in c?!!c.trailing:ve);function Me(Yt){var mi=g,Qi=S;return g=S=t,se=Yt,B=i.apply(Qi,mi),B}function $e(Yt){return se=Yt,k=ba(ut,s),ae?Me(Yt):B}function at(Yt){var mi=Yt-Q,Qi=Yt-se,xl=s-mi;return ue?vr(xl,C-Qi):xl}function Le(Yt){var mi=Yt-Q,Qi=Yt-se;return Q===t||mi>=s||mi<0||ue&&Qi>=C}function ut(){var Yt=Yo();if(Le(Yt))return mt(Yt);k=ba(ut,at(Yt))}function mt(Yt){return k=t,ve&&g?Me(Yt):(g=S=t,B)}function Wr(){k!==t&&gd(k),se=0,g=Q=S=k=t}function Dr(){return k===t?B:mt(Yo())}function Vr(){var Yt=Yo(),mi=Le(Yt);if(g=arguments,S=this,Q=Yt,mi){if(k===t)return $e(Q);if(ue)return gd(k),k=ba(ut,s),Me(Q)}return k===t&&(k=ba(ut,s)),B}return Vr.cancel=Wr,Vr.flush=Dr,Vr}var dy=ct(function(i,s){return Gu(i,1,s)}),ly=ct(function(i,s,c){return Gu(i,ni(s)||0,c)});function py(i){return Gi(i,re)}function Xo(i,s){if(typeof i!="function"||s!=null&&typeof s!="function")throw new Qr(f);var c=function(){var g=arguments,S=s?s.apply(this,g):g[0],C=c.cache;if(C.has(S))return C.get(S);var B=i.apply(this,g);return c.cache=C.set(S,B)||C,B};return c.cache=new(Xo.Cache||Wi),c}Xo.Cache=Wi;function Zo(i){if(typeof i!="function")throw new Qr(f);return function(){var s=arguments;switch(s.length){case 0:return!i.call(this);case 1:return!i.call(this,s[0]);case 2:return!i.call(this,s[0],s[1]);case 3:return!i.call(this,s[0],s[1],s[2])}return!i.apply(this,s)}}function gy(i){return tl(2,i)}var by=rv(function(i,s){s=s.length==1&&Xe(s[0])?Ht(s[0],Kr(Ne())):Ht(dr(s,1),Kr(Ne()));var c=s.length;return ct(function(g){for(var S=-1,C=vr(g.length,c);++S<C;)g[S]=s[S].call(this,g[S]);return ir(i,this,g)})}),Xf=ct(function(i,s){var c=pn(s,Rs(Xf));return Gi(i,U,t,s,c)}),al=ct(function(i,s){var c=pn(s,Rs(al));return Gi(i,z,t,s,c)}),vy=Ji(function(i,s){return Gi(i,T,t,t,t,s)});function my(i,s){if(typeof i!="function")throw new Qr(f);return s=s===t?s:st(s),ct(i,s)}function yy(i,s){if(typeof i!="function")throw new Qr(f);return s=s==null?0:tr(st(s),0),ct(function(c){var g=c[s],S=yn(c,0,s);return g&&ln(S,g),ir(i,this,S)})}function wy(i,s,c){var g=!0,S=!0;if(typeof i!="function")throw new Qr(f);return jt(c)&&(g="leading"in c?!!c.leading:g,S="trailing"in c?!!c.trailing:S),sl(i,s,{leading:g,maxWait:s,trailing:S})}function _y(i){return el(i,1)}function Ey(i,s){return Xf($f(s),i)}function Sy(){if(!arguments.length)return[];var i=arguments[0];return Xe(i)?i:[i]}function xy(i){return ti(i,I)}function Iy(i,s){return s=typeof s=="function"?s:t,ti(i,I,s)}function Dy(i){return ti(i,_|I)}function Ay(i,s){return s=typeof s=="function"?s:t,ti(i,_|I,s)}function My(i,s){return s==null||Vu(i,s,nr(s))}function vi(i,s){return i===s||i!==i&&s!==s}var Py=jo(Sf),Oy=jo(function(i,s){return i>=s}),Xn=Qu(function(){return arguments}())?Qu:function(i){return kt(i)&&xt.call(i,"callee")&&!Uu.call(i,"callee")},Xe=te.isArray,Cy=Sr?Kr(Sr):Ub;function Tr(i){return i!=null&&Qo(i.length)&&!Xi(i)}function Jt(i){return kt(i)&&Tr(i)}function Ry(i){return i===!0||i===!1||kt(i)&&xr(i)==Z}var wn=Wg||ch,Ty=pi?Kr(pi):Bb;function Ny(i){return kt(i)&&i.nodeType===1&&!va(i)}function $y(i){if(i==null)return!0;if(Tr(i)&&(Xe(i)||typeof i=="string"||typeof i.splice=="function"||wn(i)||Ts(i)||Xn(i)))return!i.length;var s=mr(i);if(s==Te||s==ye)return!i.size;if(ga(i))return!Df(i).length;for(var c in i)if(xt.call(i,c))return!1;return!0}function Ly(i,s){return da(i,s)}function Fy(i,s,c){c=typeof c=="function"?c:t;var g=c?c(i,s):t;return g===t?da(i,s,t,c):!!g}function Zf(i){if(!kt(i))return!1;var s=xr(i);return s==K||s==v||typeof i.message=="string"&&typeof i.name=="string"&&!va(i)}function qy(i){return typeof i=="number"&&zu(i)}function Xi(i){if(!jt(i))return!1;var s=xr(i);return s==oe||s==le||s==G||s==qe}function ol(i){return typeof i=="number"&&i==st(i)}function Qo(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=R}function jt(i){var s=typeof i;return i!=null&&(s=="object"||s=="function")}function kt(i){return i!=null&&typeof i=="object"}var cl=Xr?Kr(Xr):Hb;function Uy(i,s){return i===s||If(i,s,Hf(s))}function By(i,s,c){return c=typeof c=="function"?c:t,If(i,s,Hf(s),c)}function zy(i){return fl(i)&&i!=+i}function Hy(i){if(Iv(i))throw new Ke(o);return ed(i)}function Ky(i){return i===null}function jy(i){return i==null}function fl(i){return typeof i=="number"||kt(i)&&xr(i)==Ae}function va(i){if(!kt(i)||xr(i)!=He)return!1;var s=Do(i);if(s===null)return!0;var c=xt.call(s,"constructor")&&s.constructor;return typeof c=="function"&&c instanceof c&&Eo.call(c)==Bg}var Qf=Oi?Kr(Oi):Kb;function ky(i){return ol(i)&&i>=-R&&i<=R}var hl=ra?Kr(ra):jb;function ec(i){return typeof i=="string"||!Xe(i)&&kt(i)&&xr(i)==Ie}function kr(i){return typeof i=="symbol"||kt(i)&&xr(i)==Ue}var Ts=Kn?Kr(Kn):kb;function Wy(i){return i===t}function Vy(i){return kt(i)&&mr(i)==Se}function Gy(i){return kt(i)&&xr(i)==Be}var Jy=jo(Af),Yy=jo(function(i,s){return i<=s});function ul(i){if(!i)return[];if(Tr(i))return ec(i)?gi(i):Rr(i);if(na&&i[na])return Mg(i[na]());var s=mr(i),c=s==Te?pf:s==ye?yo:Ns;return c(i)}function Zi(i){if(!i)return i===0?i:0;if(i=ni(i),i===N||i===-N){var s=i<0?-1:1;return s*x}return i===i?i:0}function st(i){var s=Zi(i),c=s%1;return s===s?c?s-c:s:0}function dl(i){return i?Vn(st(i),0,D):0}function ni(i){if(typeof i=="number")return i;if(kr(i))return d;if(jt(i)){var s=typeof i.valueOf=="function"?i.valueOf():i;i=jt(s)?s+"":s}if(typeof i!="string")return i===0?i:+i;i=Cu(i);var c=Pn.test(i);return c||Cn.test(i)?Ye(i.slice(2),c?2:8):Mn.test(i)?d:+i}function ll(i){return Ri(i,Nr(i))}function Xy(i){return i?Vn(st(i),-R,R):i===0?i:0}function _t(i){return i==null?"":jr(i)}var Zy=Os(function(i,s){if(ga(s)||Tr(s)){Ri(s,nr(s),i);return}for(var c in s)xt.call(s,c)&&fa(i,c,s[c])}),pl=Os(function(i,s){Ri(s,Nr(s),i)}),tc=Os(function(i,s,c,g){Ri(s,Nr(s),i,g)}),Qy=Os(function(i,s,c,g){Ri(s,nr(s),i,g)}),e3=Ji(wf);function t3(i,s){var c=Ps(i);return s==null?c:Wu(c,s)}var r3=ct(function(i,s){i=Rt(i);var c=-1,g=s.length,S=g>2?s[2]:t;for(S&&Ir(s[0],s[1],S)&&(g=1);++c<g;)for(var C=s[c],B=Nr(C),k=-1,Q=B.length;++k<Q;){var se=B[k],ae=i[se];(ae===t||vi(ae,Ds[se])&&!xt.call(i,se))&&(i[se]=C[se])}return i}),i3=ct(function(i){return i.push(t,Cd),ir(gl,t,i)});function n3(i,s){return Au(i,Ne(s,3),Ci)}function s3(i,s){return Au(i,Ne(s,3),Ef)}function a3(i,s){return i==null?i:_f(i,Ne(s,3),Nr)}function o3(i,s){return i==null?i:Xu(i,Ne(s,3),Nr)}function c3(i,s){return i&&Ci(i,Ne(s,3))}function f3(i,s){return i&&Ef(i,Ne(s,3))}function h3(i){return i==null?[]:Lo(i,nr(i))}function u3(i){return i==null?[]:Lo(i,Nr(i))}function eh(i,s,c){var g=i==null?t:Gn(i,s);return g===t?c:g}function d3(i,s){return i!=null&&Nd(i,s,$b)}function th(i,s){return i!=null&&Nd(i,s,Lb)}var l3=Dd(function(i,s,c){s!=null&&typeof s.toString!="function"&&(s=So.call(s)),i[s]=c},ih($r)),p3=Dd(function(i,s,c){s!=null&&typeof s.toString!="function"&&(s=So.call(s)),xt.call(i,s)?i[s].push(c):i[s]=[c]},Ne),g3=ct(ua);function nr(i){return Tr(i)?ju(i):Df(i)}function Nr(i){return Tr(i)?ju(i,!0):Wb(i)}function b3(i,s){var c={};return s=Ne(s,3),Ci(i,function(g,S,C){Vi(c,s(g,S,C),g)}),c}function v3(i,s){var c={};return s=Ne(s,3),Ci(i,function(g,S,C){Vi(c,S,s(g,S,C))}),c}var m3=Os(function(i,s,c){Fo(i,s,c)}),gl=Os(function(i,s,c,g){Fo(i,s,c,g)}),y3=Ji(function(i,s){var c={};if(i==null)return c;var g=!1;s=Ht(s,function(C){return C=mn(C,i),g||(g=C.length>1),C}),Ri(i,Bf(i),c),g&&(c=ti(c,_|M|I,lv));for(var S=s.length;S--;)Rf(c,s[S]);return c});function w3(i,s){return bl(i,Zo(Ne(s)))}var _3=Ji(function(i,s){return i==null?{}:Gb(i,s)});function bl(i,s){if(i==null)return{};var c=Ht(Bf(i),function(g){return[g]});return s=Ne(s),od(i,c,function(g,S){return s(g,S[0])})}function E3(i,s,c){s=mn(s,i);var g=-1,S=s.length;for(S||(S=1,i=t);++g<S;){var C=i==null?t:i[Ti(s[g])];C===t&&(g=S,C=c),i=Xi(C)?C.call(i):C}return i}function S3(i,s,c){return i==null?i:la(i,s,c)}function x3(i,s,c,g){return g=typeof g=="function"?g:t,i==null?i:la(i,s,c,g)}var vl=Pd(nr),ml=Pd(Nr);function I3(i,s,c){var g=Xe(i),S=g||wn(i)||Ts(i);if(s=Ne(s,4),c==null){var C=i&&i.constructor;S?c=g?new C:[]:jt(i)?c=Xi(C)?Ps(Do(i)):{}:c={}}return(S?Zr:Ci)(i,function(B,k,Q){return s(c,B,k,Q)}),c}function D3(i,s){return i==null?!0:Rf(i,s)}function A3(i,s,c){return i==null?i:dd(i,s,$f(c))}function M3(i,s,c,g){return g=typeof g=="function"?g:t,i==null?i:dd(i,s,$f(c),g)}function Ns(i){return i==null?[]:lf(i,nr(i))}function P3(i){return i==null?[]:lf(i,Nr(i))}function O3(i,s,c){return c===t&&(c=s,s=t),c!==t&&(c=ni(c),c=c===c?c:0),s!==t&&(s=ni(s),s=s===s?s:0),Vn(ni(i),s,c)}function C3(i,s,c){return s=Zi(s),c===t?(c=s,s=0):c=Zi(c),i=ni(i),Fb(i,s,c)}function R3(i,s,c){if(c&&typeof c!="boolean"&&Ir(i,s,c)&&(s=c=t),c===t&&(typeof s=="boolean"?(c=s,s=t):typeof i=="boolean"&&(c=i,i=t)),i===t&&s===t?(i=0,s=1):(i=Zi(i),s===t?(s=i,i=0):s=Zi(s)),i>s){var g=i;i=s,s=g}if(c||i%1||s%1){var S=Hu();return vr(i+S*(s-i+Ot("1e-"+((S+"").length-1))),s)}return Pf(i,s)}var T3=Cs(function(i,s,c){return s=s.toLowerCase(),i+(c?yl(s):s)});function yl(i){return rh(_t(i).toLowerCase())}function wl(i){return i=_t(i),i&&i.replace(zr,Sg).replace(nf,"")}function N3(i,s,c){i=_t(i),s=jr(s);var g=i.length;c=c===t?g:Vn(st(c),0,g);var S=c;return c-=s.length,c>=0&&i.slice(c,S)==s}function $3(i){return i=_t(i),i&&Mt.test(i)?i.replace(Dt,xg):i}function L3(i){return i=_t(i),i&&rt.test(i)?i.replace(Ge,"\\$&"):i}var F3=Cs(function(i,s,c){return i+(c?"-":"")+s.toLowerCase()}),q3=Cs(function(i,s,c){return i+(c?" ":"")+s.toLowerCase()}),U3=Sd("toLowerCase");function B3(i,s,c){i=_t(i),s=st(s);var g=s?xs(i):0;if(!s||g>=s)return i;var S=(s-g)/2;return Ko(Oo(S),c)+i+Ko(Po(S),c)}function z3(i,s,c){i=_t(i),s=st(s);var g=s?xs(i):0;return s&&g<s?i+Ko(s-g,c):i}function H3(i,s,c){i=_t(i),s=st(s);var g=s?xs(i):0;return s&&g<s?Ko(s-g,c)+i:i}function K3(i,s,c){return c||s==null?s=0:s&&(s=+s),Yg(_t(i).replace(Ft,""),s||0)}function j3(i,s,c){return(c?Ir(i,s,c):s===t)?s=1:s=st(s),Of(_t(i),s)}function k3(){var i=arguments,s=_t(i[0]);return i.length<3?s:s.replace(i[1],i[2])}var W3=Cs(function(i,s,c){return i+(c?"_":"")+s.toLowerCase()});function V3(i,s,c){return c&&typeof c!="number"&&Ir(i,s,c)&&(s=c=t),c=c===t?D:c>>>0,c?(i=_t(i),i&&(typeof s=="string"||s!=null&&!Qf(s))&&(s=jr(s),!s&&Ss(i))?yn(gi(i),0,c):i.split(s,c)):[]}var G3=Cs(function(i,s,c){return i+(c?" ":"")+rh(s)});function J3(i,s,c){return i=_t(i),c=c==null?0:Vn(st(c),0,i.length),s=jr(s),i.slice(c,c+s.length)==s}function Y3(i,s,c){var g=A.templateSettings;c&&Ir(i,s,c)&&(s=t),i=_t(i),s=tc({},s,g,Od);var S=tc({},s.imports,g.imports,Od),C=nr(S),B=lf(S,C),k,Q,se=0,ae=s.interpolate||Di,ue="__p += '",ve=gf((s.escape||Di).source+"|"+ae.source+"|"+(ae===Tt?zt:Di).source+"|"+(s.evaluate||Di).source+"|$","g"),Me="//# sourceURL="+(xt.call(s,"sourceURL")?(s.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++sf+"]")+`
|
|
33
|
+
`;i.replace(ve,function(Le,ut,mt,Wr,Dr,Vr){return mt||(mt=Wr),ue+=i.slice(se,Vr).replace(Tn,Ig),ut&&(k=!0,ue+=`' +
|
|
34
|
+
__e(`+ut+`) +
|
|
35
|
+
'`),Dr&&(Q=!0,ue+=`';
|
|
36
|
+
`+Dr+`;
|
|
37
|
+
__p += '`),mt&&(ue+=`' +
|
|
38
|
+
((__t = (`+mt+`)) == null ? '' : __t) +
|
|
39
|
+
'`),se=Vr+Le.length,Le}),ue+=`';
|
|
40
|
+
`;var $e=xt.call(s,"variable")&&s.variable;if(!$e)ue=`with (obj) {
|
|
41
|
+
`+ue+`
|
|
42
|
+
}
|
|
43
|
+
`;else if(vs.test($e))throw new Ke(h);ue=(Q?ue.replace(Br,""):ue).replace(pt,"$1").replace(wt,"$1;"),ue="function("+($e||"obj")+`) {
|
|
44
|
+
`+($e?"":`obj || (obj = {});
|
|
45
|
+
`)+"var __t, __p = ''"+(k?", __e = _.escape":"")+(Q?`, __j = Array.prototype.join;
|
|
46
|
+
function print() { __p += __j.call(arguments, '') }
|
|
47
|
+
`:`;
|
|
48
|
+
`)+ue+`return __p
|
|
49
|
+
}`;var at=El(function(){return yt(C,Me+"return "+ue).apply(t,B)});if(at.source=ue,Zf(at))throw at;return at}function X3(i){return _t(i).toLowerCase()}function Z3(i){return _t(i).toUpperCase()}function Q3(i,s,c){if(i=_t(i),i&&(c||s===t))return Cu(i);if(!i||!(s=jr(s)))return i;var g=gi(i),S=gi(s),C=Ru(g,S),B=Tu(g,S)+1;return yn(g,C,B).join("")}function e2(i,s,c){if(i=_t(i),i&&(c||s===t))return i.slice(0,$u(i)+1);if(!i||!(s=jr(s)))return i;var g=gi(i),S=Tu(g,gi(s))+1;return yn(g,0,S).join("")}function t2(i,s,c){if(i=_t(i),i&&(c||s===t))return i.replace(Ft,"");if(!i||!(s=jr(s)))return i;var g=gi(i),S=Ru(g,gi(s));return yn(g,S).join("")}function r2(i,s){var c=de,g=$;if(jt(s)){var S="separator"in s?s.separator:S;c="length"in s?st(s.length):c,g="omission"in s?jr(s.omission):g}i=_t(i);var C=i.length;if(Ss(i)){var B=gi(i);C=B.length}if(c>=C)return i;var k=c-xs(g);if(k<1)return g;var Q=B?yn(B,0,k).join(""):i.slice(0,k);if(S===t)return Q+g;if(B&&(k+=Q.length-k),Qf(S)){if(i.slice(k).search(S)){var se,ae=Q;for(S.global||(S=gf(S.source,_t(br.exec(S))+"g")),S.lastIndex=0;se=S.exec(ae);)var ue=se.index;Q=Q.slice(0,ue===t?k:ue)}}else if(i.indexOf(jr(S),k)!=k){var ve=Q.lastIndexOf(S);ve>-1&&(Q=Q.slice(0,ve))}return Q+g}function i2(i){return i=_t(i),i&&ke.test(i)?i.replace(li,Rg):i}var n2=Cs(function(i,s,c){return i+(c?" ":"")+s.toUpperCase()}),rh=Sd("toUpperCase");function _l(i,s,c){return i=_t(i),s=c?t:s,s===t?Ag(i)?$g(i):mg(i):i.match(s)||[]}var El=ct(function(i,s){try{return ir(i,t,s)}catch(c){return Zf(c)?c:new Ke(c)}}),s2=Ji(function(i,s){return Zr(s,function(c){c=Ti(c),Vi(i,c,Yf(i[c],i))}),i});function a2(i){var s=i==null?0:i.length,c=Ne();return i=s?Ht(i,function(g){if(typeof g[1]!="function")throw new Qr(f);return[c(g[0]),g[1]]}):[],ct(function(g){for(var S=-1;++S<s;){var C=i[S];if(ir(C[0],this,g))return ir(C[1],this,g)}})}function o2(i){return Rb(ti(i,_))}function ih(i){return function(){return i}}function c2(i,s){return i==null||i!==i?s:i}var f2=Id(),h2=Id(!0);function $r(i){return i}function nh(i){return td(typeof i=="function"?i:ti(i,_))}function u2(i){return id(ti(i,_))}function d2(i,s){return nd(i,ti(s,_))}var l2=ct(function(i,s){return function(c){return ua(c,i,s)}}),p2=ct(function(i,s){return function(c){return ua(i,c,s)}});function sh(i,s,c){var g=nr(s),S=Lo(s,g);c==null&&!(jt(s)&&(S.length||!g.length))&&(c=s,s=i,i=this,S=Lo(s,nr(s)));var C=!(jt(c)&&"chain"in c)||!!c.chain,B=Xi(i);return Zr(S,function(k){var Q=s[k];i[k]=Q,B&&(i.prototype[k]=function(){var se=this.__chain__;if(C||se){var ae=i(this.__wrapped__),ue=ae.__actions__=Rr(this.__actions__);return ue.push({func:Q,args:arguments,thisArg:i}),ae.__chain__=se,ae}return Q.apply(i,ln([this.value()],arguments))})}),i}function g2(){return vt._===this&&(vt._=zg),this}function ah(){}function b2(i){return i=st(i),ct(function(s){return sd(s,i)})}var v2=Ff(Ht),m2=Ff(Du),y2=Ff(cf);function Sl(i){return jf(i)?ff(Ti(i)):Jb(i)}function w2(i){return function(s){return i==null?t:Gn(i,s)}}var _2=Ad(),E2=Ad(!0);function oh(){return[]}function ch(){return!1}function S2(){return{}}function x2(){return""}function I2(){return!0}function D2(i,s){if(i=st(i),i<1||i>R)return[];var c=D,g=vr(i,D);s=Ne(s),i-=D;for(var S=df(g,s);++c<i;)s(c);return S}function A2(i){return Xe(i)?Ht(i,Ti):kr(i)?[i]:Rr(Kd(_t(i)))}function M2(i){var s=++Ug;return _t(i)+s}var P2=Ho(function(i,s){return i+s},0),O2=qf("ceil"),C2=Ho(function(i,s){return i/s},1),R2=qf("floor");function T2(i){return i&&i.length?$o(i,$r,Sf):t}function N2(i,s){return i&&i.length?$o(i,Ne(s,2),Sf):t}function $2(i){return Pu(i,$r)}function L2(i,s){return Pu(i,Ne(s,2))}function F2(i){return i&&i.length?$o(i,$r,Af):t}function q2(i,s){return i&&i.length?$o(i,Ne(s,2),Af):t}var U2=Ho(function(i,s){return i*s},1),B2=qf("round"),z2=Ho(function(i,s){return i-s},0);function H2(i){return i&&i.length?uf(i,$r):0}function K2(i,s){return i&&i.length?uf(i,Ne(s,2)):0}return A.after=uy,A.ary=el,A.assign=Zy,A.assignIn=pl,A.assignInWith=tc,A.assignWith=Qy,A.at=e3,A.before=tl,A.bind=Yf,A.bindAll=s2,A.bindKey=rl,A.castArray=Sy,A.chain=Xd,A.chunk=Rv,A.compact=Tv,A.concat=Nv,A.cond=a2,A.conforms=o2,A.constant=ih,A.countBy=Hm,A.create=t3,A.curry=il,A.curryRight=nl,A.debounce=sl,A.defaults=r3,A.defaultsDeep=i3,A.defer=dy,A.delay=ly,A.difference=$v,A.differenceBy=Lv,A.differenceWith=Fv,A.drop=qv,A.dropRight=Uv,A.dropRightWhile=Bv,A.dropWhile=zv,A.fill=Hv,A.filter=jm,A.flatMap=Vm,A.flatMapDeep=Gm,A.flatMapDepth=Jm,A.flatten=Vd,A.flattenDeep=Kv,A.flattenDepth=jv,A.flip=py,A.flow=f2,A.flowRight=h2,A.fromPairs=kv,A.functions=h3,A.functionsIn=u3,A.groupBy=Ym,A.initial=Vv,A.intersection=Gv,A.intersectionBy=Jv,A.intersectionWith=Yv,A.invert=l3,A.invertBy=p3,A.invokeMap=Zm,A.iteratee=nh,A.keyBy=Qm,A.keys=nr,A.keysIn=Nr,A.map=Jo,A.mapKeys=b3,A.mapValues=v3,A.matches=u2,A.matchesProperty=d2,A.memoize=Xo,A.merge=m3,A.mergeWith=gl,A.method=l2,A.methodOf=p2,A.mixin=sh,A.negate=Zo,A.nthArg=b2,A.omit=y3,A.omitBy=w3,A.once=gy,A.orderBy=ey,A.over=v2,A.overArgs=by,A.overEvery=m2,A.overSome=y2,A.partial=Xf,A.partialRight=al,A.partition=ty,A.pick=_3,A.pickBy=bl,A.property=Sl,A.propertyOf=w2,A.pull=em,A.pullAll=Jd,A.pullAllBy=tm,A.pullAllWith=rm,A.pullAt=im,A.range=_2,A.rangeRight=E2,A.rearg=vy,A.reject=ny,A.remove=nm,A.rest=my,A.reverse=Gf,A.sampleSize=ay,A.set=S3,A.setWith=x3,A.shuffle=oy,A.slice=sm,A.sortBy=hy,A.sortedUniq=dm,A.sortedUniqBy=lm,A.split=V3,A.spread=yy,A.tail=pm,A.take=gm,A.takeRight=bm,A.takeRightWhile=vm,A.takeWhile=mm,A.tap=Tm,A.throttle=wy,A.thru=Go,A.toArray=ul,A.toPairs=vl,A.toPairsIn=ml,A.toPath=A2,A.toPlainObject=ll,A.transform=I3,A.unary=_y,A.union=ym,A.unionBy=wm,A.unionWith=_m,A.uniq=Em,A.uniqBy=Sm,A.uniqWith=xm,A.unset=D3,A.unzip=Jf,A.unzipWith=Yd,A.update=A3,A.updateWith=M3,A.values=Ns,A.valuesIn=P3,A.without=Im,A.words=_l,A.wrap=Ey,A.xor=Dm,A.xorBy=Am,A.xorWith=Mm,A.zip=Pm,A.zipObject=Om,A.zipObjectDeep=Cm,A.zipWith=Rm,A.entries=vl,A.entriesIn=ml,A.extend=pl,A.extendWith=tc,sh(A,A),A.add=P2,A.attempt=El,A.camelCase=T3,A.capitalize=yl,A.ceil=O2,A.clamp=O3,A.clone=xy,A.cloneDeep=Dy,A.cloneDeepWith=Ay,A.cloneWith=Iy,A.conformsTo=My,A.deburr=wl,A.defaultTo=c2,A.divide=C2,A.endsWith=N3,A.eq=vi,A.escape=$3,A.escapeRegExp=L3,A.every=Km,A.find=km,A.findIndex=kd,A.findKey=n3,A.findLast=Wm,A.findLastIndex=Wd,A.findLastKey=s3,A.floor=R2,A.forEach=Zd,A.forEachRight=Qd,A.forIn=a3,A.forInRight=o3,A.forOwn=c3,A.forOwnRight=f3,A.get=eh,A.gt=Py,A.gte=Oy,A.has=d3,A.hasIn=th,A.head=Gd,A.identity=$r,A.includes=Xm,A.indexOf=Wv,A.inRange=C3,A.invoke=g3,A.isArguments=Xn,A.isArray=Xe,A.isArrayBuffer=Cy,A.isArrayLike=Tr,A.isArrayLikeObject=Jt,A.isBoolean=Ry,A.isBuffer=wn,A.isDate=Ty,A.isElement=Ny,A.isEmpty=$y,A.isEqual=Ly,A.isEqualWith=Fy,A.isError=Zf,A.isFinite=qy,A.isFunction=Xi,A.isInteger=ol,A.isLength=Qo,A.isMap=cl,A.isMatch=Uy,A.isMatchWith=By,A.isNaN=zy,A.isNative=Hy,A.isNil=jy,A.isNull=Ky,A.isNumber=fl,A.isObject=jt,A.isObjectLike=kt,A.isPlainObject=va,A.isRegExp=Qf,A.isSafeInteger=ky,A.isSet=hl,A.isString=ec,A.isSymbol=kr,A.isTypedArray=Ts,A.isUndefined=Wy,A.isWeakMap=Vy,A.isWeakSet=Gy,A.join=Xv,A.kebabCase=F3,A.last=ii,A.lastIndexOf=Zv,A.lowerCase=q3,A.lowerFirst=U3,A.lt=Jy,A.lte=Yy,A.max=T2,A.maxBy=N2,A.mean=$2,A.meanBy=L2,A.min=F2,A.minBy=q2,A.stubArray=oh,A.stubFalse=ch,A.stubObject=S2,A.stubString=x2,A.stubTrue=I2,A.multiply=U2,A.nth=Qv,A.noConflict=g2,A.noop=ah,A.now=Yo,A.pad=B3,A.padEnd=z3,A.padStart=H3,A.parseInt=K3,A.random=R3,A.reduce=ry,A.reduceRight=iy,A.repeat=j3,A.replace=k3,A.result=E3,A.round=B2,A.runInContext=Y,A.sample=sy,A.size=cy,A.snakeCase=W3,A.some=fy,A.sortedIndex=am,A.sortedIndexBy=om,A.sortedIndexOf=cm,A.sortedLastIndex=fm,A.sortedLastIndexBy=hm,A.sortedLastIndexOf=um,A.startCase=G3,A.startsWith=J3,A.subtract=z2,A.sum=H2,A.sumBy=K2,A.template=Y3,A.times=D2,A.toFinite=Zi,A.toInteger=st,A.toLength=dl,A.toLower=X3,A.toNumber=ni,A.toSafeInteger=Xy,A.toString=_t,A.toUpper=Z3,A.trim=Q3,A.trimEnd=e2,A.trimStart=t2,A.truncate=r2,A.unescape=i2,A.uniqueId=M2,A.upperCase=n2,A.upperFirst=rh,A.each=Zd,A.eachRight=Qd,A.first=Gd,sh(A,function(){var i={};return Ci(A,function(s,c){xt.call(A.prototype,c)||(i[c]=s)}),i}(),{chain:!1}),A.VERSION=n,Zr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){A[i].placeholder=A}),Zr(["drop","take"],function(i,s){gt.prototype[i]=function(c){c=c===t?1:tr(st(c),0);var g=this.__filtered__&&!s?new gt(this):this.clone();return g.__filtered__?g.__takeCount__=vr(c,g.__takeCount__):g.__views__.push({size:vr(c,D),type:i+(g.__dir__<0?"Right":"")}),g},gt.prototype[i+"Right"]=function(c){return this.reverse()[i](c).reverse()}}),Zr(["filter","map","takeWhile"],function(i,s){var c=s+1,g=c==w||c==O;gt.prototype[i]=function(S){var C=this.clone();return C.__iteratees__.push({iteratee:Ne(S,3),type:c}),C.__filtered__=C.__filtered__||g,C}}),Zr(["head","last"],function(i,s){var c="take"+(s?"Right":"");gt.prototype[i]=function(){return this[c](1).value()[0]}}),Zr(["initial","tail"],function(i,s){var c="drop"+(s?"":"Right");gt.prototype[i]=function(){return this.__filtered__?new gt(this):this[c](1)}}),gt.prototype.compact=function(){return this.filter($r)},gt.prototype.find=function(i){return this.filter(i).head()},gt.prototype.findLast=function(i){return this.reverse().find(i)},gt.prototype.invokeMap=ct(function(i,s){return typeof i=="function"?new gt(this):this.map(function(c){return ua(c,i,s)})}),gt.prototype.reject=function(i){return this.filter(Zo(Ne(i)))},gt.prototype.slice=function(i,s){i=st(i);var c=this;return c.__filtered__&&(i>0||s<0)?new gt(c):(i<0?c=c.takeRight(-i):i&&(c=c.drop(i)),s!==t&&(s=st(s),c=s<0?c.dropRight(-s):c.take(s-i)),c)},gt.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},gt.prototype.toArray=function(){return this.take(D)},Ci(gt.prototype,function(i,s){var c=/^(?:filter|find|map|reject)|While$/.test(s),g=/^(?:head|last)$/.test(s),S=A[g?"take"+(s=="last"?"Right":""):s],C=g||/^find/.test(s);S&&(A.prototype[s]=function(){var B=this.__wrapped__,k=g?[1]:arguments,Q=B instanceof gt,se=k[0],ae=Q||Xe(B),ue=function(ut){var mt=S.apply(A,ln([ut],k));return g&&ve?mt[0]:mt};ae&&c&&typeof se=="function"&&se.length!=1&&(Q=ae=!1);var ve=this.__chain__,Me=!!this.__actions__.length,$e=C&&!ve,at=Q&&!Me;if(!C&&ae){B=at?B:new gt(this);var Le=i.apply(B,k);return Le.__actions__.push({func:Go,args:[ue],thisArg:t}),new ei(Le,ve)}return $e&&at?i.apply(this,k):(Le=this.thru(ue),$e?g?Le.value()[0]:Le.value():Le)})}),Zr(["pop","push","shift","sort","splice","unshift"],function(i){var s=wo[i],c=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",g=/^(?:pop|shift)$/.test(i);A.prototype[i]=function(){var S=arguments;if(g&&!this.__chain__){var C=this.value();return s.apply(Xe(C)?C:[],S)}return this[c](function(B){return s.apply(Xe(B)?B:[],S)})}}),Ci(gt.prototype,function(i,s){var c=A[s];if(c){var g=c.name+"";xt.call(Ms,g)||(Ms[g]=[]),Ms[g].push({name:s,func:c})}}),Ms[zo(t,J).name]=[{name:"wrapper",func:t}],gt.prototype.clone=ib,gt.prototype.reverse=nb,gt.prototype.value=sb,A.prototype.at=Nm,A.prototype.chain=$m,A.prototype.commit=Lm,A.prototype.next=Fm,A.prototype.plant=Um,A.prototype.reverse=Bm,A.prototype.toJSON=A.prototype.valueOf=A.prototype.value=zm,A.prototype.first=A.prototype.head,na&&(A.prototype[na]=qm),A},Is=Lg();Gt?((Gt.exports=Is)._=Is,Ct._=Is):vt._=Is}).call(wr)})(Pc,Pc.exports);var Px=Pc.exports,Ox=Object.defineProperty,Cx=Object.defineProperties,Rx=Object.getOwnPropertyDescriptors,dp=Object.getOwnPropertySymbols,Tx=Object.prototype.hasOwnProperty,Nx=Object.prototype.propertyIsEnumerable,lp=(r,e,t)=>e in r?Ox(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pp=(r,e)=>{for(var t in e||(e={}))Tx.call(e,t)&&lp(r,t,e[t]);if(dp)for(var t of dp(e))Nx.call(e,t)&&lp(r,t,e[t]);return r},gp=(r,e)=>Cx(r,Rx(e));const $x={Accept:"application/json","Content-Type":"application/json"},Lx="POST",bp={headers:$x,method:Lx},vp=10;let Ki=class{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new hi.EventEmitter,this.isAvailable=!1,this.registering=!1,!q0(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=on(e),n=await(await Il(this.url,gp(pp({},bp),{body:t}))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!q0(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,a)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),a(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return a(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=on({id:1,jsonrpc:"2.0",method:"test",params:[]});await Il(e,gp(pp({},bp),{body:t}))}this.onOpen()}catch(t){const n=this.parseError(t);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 t=typeof e.data=="string"?cs(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),a=n.message||n.toString(),o=Gc(e,a);this.events.emit("payload",o)}parseError(e,t=this.url){return B1(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>vp&&this.events.setMaxListeners(vp)}};const mp="error",Fx="wss://relay.walletconnect.org",qx="wc",Ux="universal_provider",yp=`${qx}@2:${Ux}:`,fg="https://rpc.walletconnect.org/v1/",Bs="generic",Bx=`${fg}bundler`,Ii={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var zx=Object.defineProperty,Hx=Object.defineProperties,Kx=Object.getOwnPropertyDescriptors,wp=Object.getOwnPropertySymbols,jx=Object.prototype.hasOwnProperty,kx=Object.prototype.propertyIsEnumerable,_p=(r,e,t)=>e in r?zx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ac=(r,e)=>{for(var t in e||(e={}))jx.call(e,t)&&_p(r,t,e[t]);if(wp)for(var t of wp(e))kx.call(e,t)&&_p(r,t,e[t]);return r},Wx=(r,e)=>Hx(r,Kx(e));function Si(r,e,t){var n;const a=Ks(r);return((n=e.rpcMap)==null?void 0:n[a.reference])||`${fg}?chainId=${a.namespace}:${a.reference}&projectId=${t}`}function bs(r){return r.includes(":")?r.split(":")[1]:r}function hg(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Vx(r,e){const t=Object.keys(e.namespaces).filter(a=>a.includes(r));if(!t.length)return[];const n=[];return t.forEach(a=>{const o=e.namespaces[a].accounts;n.push(...o)}),n}function Mh(r={},e={}){const t=Ep(r),n=Ep(e);return Px.merge(t,n)}function Ep(r){var e,t,n,a;const o={};if(!$a(r))return o;for(const[f,h]of Object.entries(r)){const p=bu(f)?[f]:h.chains,l=h.methods||[],m=h.events||[],_=h.rpcMap||{},M=Aa(f);o[M]=Wx(ac(ac({},o[M]),h),{chains:hc(p,(e=o[M])==null?void 0:e.chains),methods:hc(l,(t=o[M])==null?void 0:t.methods),events:hc(m,(n=o[M])==null?void 0:n.events),rpcMap:ac(ac({},_),(a=o[M])==null?void 0:a.rpcMap)})}return o}function Gx(r){return r.includes(":")?r.split(":")[2]:r}function Sp(r){const e={};for(const[t,n]of Object.entries(r)){const a=n.methods||[],o=n.events||[],f=n.accounts||[],h=bu(t)?[t]:n.chains?n.chains:hg(n.accounts);e[t]={chains:h,methods:a,events:o,accounts:f}}return e}function Ph(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const ug={},Et=r=>ug[r],Oh=(r,e)=>{ug[r]=e};class Jx{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const a=bs(t);e[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}}var Yx=Object.defineProperty,Xx=Object.defineProperties,Zx=Object.getOwnPropertyDescriptors,xp=Object.getOwnPropertySymbols,Qx=Object.prototype.hasOwnProperty,eI=Object.prototype.propertyIsEnumerable,Ip=(r,e,t)=>e in r?Yx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Dp=(r,e)=>{for(var t in e||(e={}))Qx.call(e,t)&&Ip(r,t,e[t]);if(xp)for(var t of xp(e))eI.call(e,t)&&Ip(r,t,e[t]);return r},Ap=(r,e)=>Xx(r,Zx(e));class tI{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||Si(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const a=parseInt(bs(t));e[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let a=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const o=parseInt(a,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:a}]},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 t,n,a;const o=(n=(t=e.request)==null?void 0:t.params)==null?void 0:n[0];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const f=this.client.session.get(e.topic),h=((a=f==null?void 0:f.sessionProperties)==null?void 0:a.capabilities)||{};if(h!=null&&h[o])return h==null?void 0:h[o];const p=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Ap(Dp({},f.sessionProperties||{}),{capabilities:Ap(Dp({},h||{}),{[o]:p})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return p}async getCallStatus(e){var t,n;const a=this.client.session.get(e.topic),o=(t=a.sessionProperties)==null?void 0:t.bundler_name;if(o){const h=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(h,e)}catch(p){console.warn("Failed to fetch call status from bundler",p,h)}}const f=(n=a.sessionProperties)==null?void 0:n.bundler_url;if(f)try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from custom bundler",h,f)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var n;const a=new URL(e),o=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(xn("eth_getUserOperationReceipt",[(n=t.request.params)==null?void 0:n[0]]))});if(!o.ok)throw new Error(`Failed to fetch user operation receipt - ${o.status}`);return await o.json()}getBundlerUrl(e,t){return`${Bx}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class rI{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const a=bs(t);e[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}}class iI{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const a=bs(t);e[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}}class nI{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const n=t||Si(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;e[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new xi(new Ki(n,Et("disableProviderPing")))}}class sI{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const n=this.getCardanoRPCUrl(t),a=bs(t);e[a]=this.createHttpProvider(a,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}}class aI{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const a=bs(t);e[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}}class oI{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const a=bs(t);e[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}}class cI{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||Si(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;e[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace);return typeof n>"u"?void 0:new xi(new Ki(n,Et("disableProviderPing")))}}class fI{constructor(e){this.name=Bs,this.namespace=e.namespace,this.events=Et("events"),this.client=Et("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const n={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(a=>{const o=Ks(a);n[`${o.namespace}:${o.reference}`]=this.createHttpProvider(a)}),n}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Si(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new xi(new Ki(n,Et("disableProviderPing")))}}var hI=Object.defineProperty,uI=Object.defineProperties,dI=Object.getOwnPropertyDescriptors,Mp=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,pI=Object.prototype.propertyIsEnumerable,Pp=(r,e,t)=>e in r?hI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oc=(r,e)=>{for(var t in e||(e={}))lI.call(e,t)&&Pp(r,t,e[t]);if(Mp)for(var t of Mp(e))pI.call(e,t)&&Pp(r,t,e[t]);return r},Ch=(r,e)=>uI(r,dI(e));let gI=class dg{constructor(e){this.events=new tu,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Ya(Wc({level:(e==null?void 0:e.logger)||mp})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new dg(e);return await t.initialize(),t}async request(e,t,n){const[a,o]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(a).request({request:oc({},e),chainId:`${a}:${o}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,a){const o=new Date().getTime();this.request(e,n,a).then(f=>t(null,Vc(o,f))).catch(f=>t(f,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:It("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:a}=await this.client.authenticate(e,t);n&&(this.uri=n,this.events.emit("display_uri",n));const o=await a();if(this.session=o.session,this.session){const f=Sp(this.session.namespaces);this.namespaces=Mh(this.namespaces,f),this.persist("namespaces",this.namespaces),this.onConnect()}return o}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:a}=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 a().then(o=>{this.session=o;const f=Sp(o.namespaces);this.namespaces=Mh(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==cg)throw o;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,a]=this.validateChain(e),o=this.getProvider(n);o.name===Bs?o.setDefaultChain(`${n}:${a}`,t):o.setDefaultChain(a,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Bi(t)){for(const n of t)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: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await xu.init({core:this.providerOpts.core,logger:this.providerOpts.logger||mp,relayUrl:this.providerOpts.relayUrl||Fx,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Aa(t)))];Oh("client",this.client),Oh("events",this.events),Oh("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const n=Vx(t,this.session),a=hg(n),o=Mh(this.namespaces,this.optionalNamespaces),f=Ch(oc({},o[t]),{accounts:n,chains:a});switch(t){case"eip155":this.rpcProviders[t]=new tI({namespace:f});break;case"algorand":this.rpcProviders[t]=new nI({namespace:f});break;case"solana":this.rpcProviders[t]=new rI({namespace:f});break;case"cosmos":this.rpcProviders[t]=new iI({namespace:f});break;case"polkadot":this.rpcProviders[t]=new Jx({namespace:f});break;case"cip34":this.rpcProviders[t]=new sI({namespace:f});break;case"elrond":this.rpcProviders[t]=new aI({namespace:f});break;case"multiversx":this.rpcProviders[t]=new oI({namespace:f});break;case"near":this.rpcProviders[t]=new cI({namespace:f});break;default:this.rpcProviders[Bs]?this.rpcProviders[Bs].updateNamespace(f):this.rpcProviders[Bs]=new fI({namespace:f})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:n}=t;if(n.name==="accountsChanged"){const a=n.data;a&&Bi(a)&&this.events.emit("accountsChanged",a.map(Gx))}else if(n.name==="chainChanged"){const a=t.chainId,o=t.event.data,f=Aa(a),h=Ph(a)!==Ph(o)?`${f}:${Ph(o)}`:a;this.onChainChanged(h)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var n;const{namespaces:a}=t,o=(n=this.client)==null?void 0:n.session.get(e);this.session=Ch(oc({},o),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Ch(oc({},It("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Ii.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Bs]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:a}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=a,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(f=>Aa(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const a=Aa(Object.keys(this.namespaces)[0]),o=this.rpcProviders[a].getDefaultChain();return[a,o]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[n,a]=this.validateChain(e);a&&(t||this.getProvider(n).setDefaultChain(a),this.namespaces[n]?this.namespaces[n].defaultChain=a:this.namespaces[`${n}:${a}`]?this.namespaces[`${n}:${a}`].defaultChain=a:this.namespaces[`${n}:${a}`]={defaultChain:a},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",a))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${yp}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${yp}/${e}`)}};const bI=gI,vI="wc",mI="ethereum_provider",yI=`${vI}@2:${mI}:`,wI="https://rpc.walletconnect.org/v1/",Zh=["eth_sendTransaction","personal_sign"],_I=["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"],Qh=["chainChanged","accountsChanged"],EI=["chainChanged","accountsChanged","message","disconnect","connect"];var SI=Object.defineProperty,xI=Object.defineProperties,II=Object.getOwnPropertyDescriptors,Op=Object.getOwnPropertySymbols,DI=Object.prototype.hasOwnProperty,AI=Object.prototype.propertyIsEnumerable,Cp=(r,e,t)=>e in r?SI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zs=(r,e)=>{for(var t in e||(e={}))DI.call(e,t)&&Cp(r,t,e[t]);if(Op)for(var t of Op(e))AI.call(e,t)&&Cp(r,t,e[t]);return r},Rh=(r,e)=>xI(r,II(e));function Oc(r){return Number(r[0].split(":")[1])}function cc(r){return`0x${r.toString(16)}`}function MI(r){const{chains:e,optionalChains:t,methods:n,optionalMethods:a,events:o,optionalEvents:f,rpcMap:h}=r;if(!Bi(e))throw new Error("Invalid chains");const p={chains:e,methods:n||Zh,events:o||Qh,rpcMap:zs({},e.length?{[Oc(e)]:h[Oc(e)]}:{})},l=o==null?void 0:o.filter(I=>!Qh.includes(I)),m=n==null?void 0:n.filter(I=>!Zh.includes(I));if(!t&&!f&&!a&&!(l!=null&&l.length)&&!(m!=null&&m.length))return{required:e.length?p:void 0};const _=(l==null?void 0:l.length)&&(m==null?void 0:m.length)||!t,M={chains:[...new Set(_?p.chains.concat(t||[]):t)],methods:[...new Set(p.methods.concat(a!=null&&a.length?a:_I))],events:[...new Set(p.events.concat(f!=null&&f.length?f:EI))],rpcMap:h};return{required:e.length?p:void 0,optional:t.length?M:void 0}}class Iu{constructor(){this.events=new hi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=yI,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new Iu;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,n){this.signer.sendAsync(e,t,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:t,optional:n}=MI(this.rpc);try{const a=await new Promise(async(f,h)=>{var p;this.rpc.showQrModal&&((p=this.modal)==null||p.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),h(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Rh(zs({namespaces:zs({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{f(l)}).catch(l=>{h(new Error(l.message))})});if(!a)return;const o=t0(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:cc(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(o,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(Rh(zs({},e),{chains:this.rpc.chains}),t).then(p=>{o(p)}).catch(p=>{f(new Error(p.message))})}),a=n.session;if(a){const o=t0(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:cc(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:n}=t;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 t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",cc(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",Rh(zs({},It("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.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 t=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",cc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,a]=e.split(":");return{chainId:`${t}:${n}`,address:a}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,n;const a=(t=e==null?void 0:e.chains)!=null?t:[],o=(n=e==null?void 0:e.optionalChains)!=null?n:[],f=a.concat(o);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const h=a.length?(e==null?void 0:e.methods)||Zh:[],p=a.length?(e==null?void 0:e.events)||Qh:[],l=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],_=(e==null?void 0:e.rpcMap)||this.buildRpcMap(f,e.projectId),M=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(I=>this.formatChainId(I)),optionalChains:o.map(I=>this.formatChainId(I)),methods:h,events:p,optionalMethods:l,optionalEvents:m,rpcMap:_,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:M,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach(a=>{n[a]=this.getRpcUrl(a,t)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Oc(this.rpc.chains):Oc(this.rpc.optionalChains),this.signer=await bI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:n}=await e6(()=>import("./index-1d8346ff.js").then(a=>a.i),["assets/index-1d8346ff.js","assets/index-9ab4b2f8.js","assets/index-d326c9c7.css"]);t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(zs({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:t,optionalChains:n,rpcMap:a}=e;t&&Bi(t)&&(this.rpc.chains=t.map(o=>this.formatChainId(o)),t.forEach(o=>{this.rpc.rpcMap[o]=(a==null?void 0:a[o])||this.getRpcUrl(o)})),n&&Bi(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(o=>this.formatChainId(o)),n.forEach(o=>{this.rpc.rpcMap[o]=(a==null?void 0:a[o])||this.getRpcUrl(o)}))}getRpcUrl(e,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${wI}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const iD=Iu;export{iD as EthereumProvider,EI as OPTIONAL_EVENTS,_I as OPTIONAL_METHODS,Qh as REQUIRED_EVENTS,Zh as REQUIRED_METHODS,Iu as default};
|