@depay/widgets 10.2.7 → 10.2.8

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.
@@ -53,7 +53,7 @@ o((function(t,e){}));var rh=o((function(t){!function t(){if("undefined"!=typeof
53
53
  /*! https://mths.be/punycode v1.4.1 by @mathias */
54
54
  var KA=2147483647,XA=36,$A=1,tx=26,ex=38,nx=700,rx=72,ix=128,ox="-",ax=/[^\x20-\x7E]/,sx=/[\x2E\u3002\uFF0E\uFF61]/g,ux={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},cx=XA-$A,lx=Math.floor,hx=String.fromCharCode;function dx(t){throw new RangeError(ux[t])}function fx(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function px(t,e,n){var r=0;for(t=n?lx(t/nx):t>>1,t+=lx(t/e);t>cx*tx>>1;r+=XA)t=lx(t/cx);return lx(r+(cx+1)*t/(t+ex))}function mx(t){return function(t,e){var n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);var i=function(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}((t=t.replace(sx,".")).split("."),e).join(".");return r+i}(t,(function(t){return ax.test(t)?"xn--"+function(t){var e,n,r,i,o,a,s,u,c,l,h,d,f,p,m,g=[];for(t=function(t){for(var e,n,r=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(n=t.charCodeAt(i++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--):r.push(e);return r}(t),d=t.length,e=ix,n=0,o=rx,a=0;a<d;++a)(h=t[a])<128&&g.push(hx(h));for(r=i=g.length,i&&g.push(ox);r<d;){for(s=KA,a=0;a<d;++a)(h=t[a])>=e&&h<s&&(s=h);for(s-e>lx((KA-n)/(f=r+1))&&dx("overflow"),n+=(s-e)*f,e=s,a=0;a<d;++a)if((h=t[a])<e&&++n>KA&&dx("overflow"),h==e){for(u=n,c=XA;!(u<(l=c<=o?$A:c>=o+tx?tx:c-o));c+=XA)m=u-l,p=XA-l,g.push(hx(fx(l+m%p,0))),u=lx(m/p);g.push(hx(fx(u,0))),o=px(n,f,r==i),n=0,++r}++n,++e}return g.join("")}(t):t}))}function gx(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var yx=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function bx(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}function vx(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var wx=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e};function Mx(t,e,n,r){e=e||"&",n=n||"=";var i={};if("string"!=typeof t||0===t.length)return i;var o=/\+/g;t=t.split(e);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var s=t.length;a>0&&s>a&&(s=a);for(var u=0;u<s;++u){var c,l,h,d,f=t[u].replace(o,"%20"),p=f.indexOf(n);p>=0?(c=f.substr(0,p),l=f.substr(p+1)):(c=f,l=""),h=decodeURIComponent(c),d=decodeURIComponent(l),gx(i,h)?yx(i[h])?i[h].push(d):i[h]=[i[h],d]:i[h]=d}return i}var _x={parse:Px,resolve:Wx,resolveObject:Yx,fileURLToPath:Bx,format:Ux,Url:Ex};function Ex(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Nx=/^([a-z0-9.+-]+:)/i,Lx=/:[0-9]*$/,Sx=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Ax=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),xx=["'"].concat(Ax),Tx=["%","/","?",";","#"].concat(xx),Ix=["/","?","#"],kx=255,jx=/^[+a-z0-9A-Z_-]{0,63}$/,Cx=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Dx={javascript:!0,"javascript:":!0},Ox={javascript:!0,"javascript:":!0},zx={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Px(t,e,n){if(t&&qS(t)&&t instanceof Ex)return t;var r=new Ex;return r.parse(t,e,n),r}function Rx(t,e,n,r){if(!GS(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),o=-1!==i&&i<e.indexOf("#")?"?":"#",a=e.split(o);a[0]=a[0].replace(/\\/g,"/");var s=e=a.join(o);if(s=s.trim(),!r&&1===e.split("#").length){var u=Sx.exec(s);if(u)return t.path=s,t.href=s,t.pathname=u[1],u[2]?(t.search=u[2],t.query=n?Mx(t.search.substr(1)):t.search.substr(1)):n&&(t.search="",t.query={}),t}var c,l,h,d,f=Nx.exec(s);if(f){var p=(f=f[0]).toLowerCase();t.protocol=p,s=s.substr(f.length)}if(r||f||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var m="//"===s.substr(0,2);!m||f&&Ox[f]||(s=s.substr(2),t.slashes=!0)}if(!Ox[f]&&(m||f&&!zx[f])){var g,y,b=-1;for(c=0;c<Ix.length;c++)-1!==(l=s.indexOf(Ix[c]))&&(-1===b||l<b)&&(b=l);for(-1!==(y=-1===b?s.lastIndexOf("@"):s.lastIndexOf("@",b))&&(g=s.slice(0,y),s=s.slice(y+1),t.auth=decodeURIComponent(g)),b=-1,c=0;c<Tx.length;c++)-1!==(l=s.indexOf(Tx[c]))&&(-1===b||l<b)&&(b=l);-1===b&&(b=s.length),t.host=s.slice(0,b),s=s.slice(b),Qx(t),t.hostname=t.hostname||"";var v="["===t.hostname[0]&&"]"===t.hostname[t.hostname.length-1];if(!v){var w=t.hostname.split(/\./);for(c=0,h=w.length;c<h;c++){var M=w[c];if(M&&!M.match(jx)){for(var _="",E=0,N=M.length;E<N;E++)M.charCodeAt(E)>127?_+="x":_+=M[E];if(!_.match(jx)){var L=w.slice(0,c),S=w.slice(c+1),A=M.match(Cx);A&&(L.push(A[1]),S.unshift(A[2])),S.length&&(s="/"+S.join(".")+s),t.hostname=L.join(".");break}}}}t.hostname.length>kx?t.hostname="":t.hostname=t.hostname.toLowerCase(),v||(t.hostname=mx(t.hostname)),d=t.port?":"+t.port:"";var x=t.hostname||"";t.host=x+d,t.href+=t.host,v&&(t.hostname=t.hostname.substr(1,t.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!Dx[p])for(c=0,h=xx.length;c<h;c++){var T=xx[c];if(-1!==s.indexOf(T)){var I=encodeURIComponent(T);I===T&&(I=escape(T)),s=s.split(T).join(I)}}var k=s.indexOf("#");-1!==k&&(t.hash=s.substr(k),s=s.slice(0,k));var j=s.indexOf("?");if(-1!==j?(t.search=s.substr(j),t.query=s.substr(j+1),n&&(t.query=Mx(t.query)),s=s.slice(0,j)):n&&(t.search="",t.query={}),s&&(t.pathname=s),zx[p]&&t.hostname&&!t.pathname&&(t.pathname="/"),t.pathname||t.search){d=t.pathname||"";var C=t.search||"";t.path=d+C}return t.href=Fx(t),t}function Bx(t){if("string"==typeof t)t=(new Ex).parse(t);else if(!(url instanceof Ex))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof t+String(t));if("file:"!==t.protocol)throw new TypeError("The URL must be of scheme file");return function(t){const e=t.pathname;for(let t=0;t<e.length;t++)if("%"===e[t]){const n=32|e.codePointAt(t+2);if("2"===e[t+1]&&102===n)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(e)}(t)}function Ux(t){return GS(t)&&(t=Rx({},t)),Fx(t)}function Fx(t){var e=t.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var n=t.protocol||"",r=t.pathname||"",i=t.hash||"",o=!1,a="";t.host?o=e+t.host:t.hostname&&(o=e+(-1===t.hostname.indexOf(":")?t.hostname:"["+this.hostname+"]"),t.port&&(o+=":"+t.port)),t.query&&qS(t.query)&&Object.keys(t.query).length&&(a=function(t,e,n,r){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?vx(wx(t),(function(r){var i=encodeURIComponent(bx(r))+n;return yx(t[r])?vx(t[r],(function(t){return i+encodeURIComponent(bx(t))})).join(e):i+encodeURIComponent(bx(t[r]))})).join(e):r?encodeURIComponent(bx(r))+n+encodeURIComponent(bx(t)):""}(t.query));var s=t.search||a&&"?"+a||"";return n&&":"!==n.substr(-1)&&(n+=":"),t.slashes||(!n||zx[n])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),n+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+i}function Wx(t,e){return Px(t,!1,!0).resolve(e)}function Yx(t,e){return t?Px(t,!1,!0).resolveObject(e):e}function Qx(t){var e=t.host,n=Lx.exec(e);n&&(":"!==(n=n[0])&&(t.port=n.substr(1)),e=e.substr(0,e.length-n.length)),e&&(t.hostname=e)}Ex.prototype.parse=function(t,e,n){return Rx(this,t,e,n)},Ex.prototype.format=function(){return Fx(this)},Ex.prototype.resolve=function(t){return this.resolveObject(Px(t,!1,!0)).format()},Ex.prototype.resolveObject=function(t){if(GS(t)){var e=new Ex;e.parse(t,!1,!0),t=e}for(var n,r=new Ex,i=Object.keys(this),o=0;o<i.length;o++){var a=i[o];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),u=0;u<s.length;u++){var c=s[u];"protocol"!==c&&(r[c]=t[c])}return zx[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!zx[t.protocol]){for(var l=Object.keys(t),h=0;h<l.length;h++){var d=l[h];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||Ox[t.protocol])r.pathname=t.pathname;else{for(n=(t.pathname||"").split("/");n.length&&!(t.host=n.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),r.pathname=n.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var f=r.pathname||"",p=r.search||"";r.path=f+p}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var m,g=r.pathname&&"/"===r.pathname.charAt(0),y=t.host||t.pathname&&"/"===t.pathname.charAt(0),b=y||g||r.host&&t.pathname,v=b,w=r.pathname&&r.pathname.split("/")||[],M=r.protocol&&!zx[r.protocol];if(n=t.pathname&&t.pathname.split("/")||[],M&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===n[0]?n[0]=t.host:n.unshift(t.host)),t.host=null),b=b&&(""===n[0]||""===w[0])),y)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,w=n;else if(n.length)w||(w=[]),w.pop(),w=w.concat(n),r.search=t.search,r.query=t.query;else if(null!=t.search)return M&&(r.hostname=r.host=w.shift(),(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),r.search=t.search,r.query=t.query,HS(r.pathname)&&HS(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var _=w.slice(-1)[0],E=(r.host||t.host||w.length>1)&&("."===_||".."===_)||""===_,N=0,L=w.length;L>=0;L--)"."===(_=w[L])?w.splice(L,1):".."===_?(w.splice(L,1),N++):N&&(w.splice(L,1),N--);if(!b&&!v)for(;N--;N)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),E&&"/"!==w.join("/").substr(-1)&&w.push("");var S=""===w[0]||w[0]&&"/"===w[0].charAt(0);return M&&(r.hostname=r.host=S?"":w.length?w.shift():"",(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),(b=b||r.host&&w.length)&&!S&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),HS(r.pathname)&&HS(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Ex.prototype.parseHost=function(){return Qx(this)};var Hx=Object.freeze({__proto__:null,parse:Px,resolve:Wx,resolveObject:Yx,fileURLToPath:Bx,format:Ux,default:_x,Url:Ex});function Gx(t,e){"string"==typeof t&&(t=Px(t));var n=-1===XM.location.protocol.search(/^https?:$/)?"http:":"",r=t.protocol||n,i=t.hostname||t.host,o=t.port,a=t.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),t.url=(i?r+"//"+i:"")+(o?":"+o:"")+a,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var s=new qA(t);return e&&s.on("response",e),s}function Zx(t,e){var n=Gx(t,e);return n.end(),n}function Vx(){}Vx.defaultMaxSockets=4;var qx=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Jx={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},Kx={request:Gx,get:Zx,Agent:Vx,METHODS:qx,STATUS_CODES:Jx},Xx=KM(Object.freeze({__proto__:null,request:Gx,get:Zx,Agent:Vx,METHODS:qx,STATUS_CODES:Jx,default:Kx}));function $x(t,e){"string"==typeof t&&(t=Px(t));var n=-1===XM.location.protocol.search(/^https?:$/)?"http:":"",r=t.protocol||n,i=t.hostname||t.host,o=t.port,a=t.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),t.url=(i?r+"//"+i:"")+(o?":"+o:"")+a,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var s=new qA(t);return e&&s.on("response",e),s}function tT(t,e){var n=$x(t,e);return n.end(),n}function eT(){}eT.defaultMaxSockets=4;var nT=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],rT={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},iT={request:$x,get:tT,Agent:eT,METHODS:nT,STATUS_CODES:rT},oT=KM(Object.freeze({__proto__:null,request:$x,get:tT,Agent:eT,METHODS:nT,STATUS_CODES:rT,default:iT})),aT=KM(Object.freeze({__proto__:null,default:{}})),sT=KM(Object.freeze({__proto__:null,default:{}})),uT=KM(HA),cT=KM(Hx),lT={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function hT(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function dT(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]}var fT=Uint8Array,pT=Uint16Array,mT=Int32Array,gT=4,yT=0,bT=1,vT=2;function wT(t){for(var e=t.length;--e>=0;)t[e]=0}var MT=0,_T=1,ET=2,NT=29,LT=256,ST=LT+1+NT,AT=30,xT=19,TT=2*ST+1,IT=15,kT=16,jT=7,CT=256,DT=16,OT=17,zT=18,PT=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],RT=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],BT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],UT=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],FT=new Array(2*(ST+2));wT(FT);var WT=new Array(2*AT);wT(WT);var YT=new Array(512);wT(YT);var QT=new Array(256);wT(QT);var HT=new Array(NT);wT(HT);var GT,ZT,VT,qT=new Array(AT);function JT(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function KT(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function XT(t){return t<256?YT[t]:YT[256+(t>>>7)]}function $T(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function tI(t,e,n){t.bi_valid>kT-n?(t.bi_buf|=e<<t.bi_valid&65535,$T(t,t.bi_buf),t.bi_buf=e>>kT-t.bi_valid,t.bi_valid+=n-kT):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function eI(t,e,n){tI(t,n[2*e],n[2*e+1])}function nI(t,e){var n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}function rI(t,e,n){var r,i,o=new Array(IT+1),a=0;for(r=1;r<=IT;r++)o[r]=a=a+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=nI(o[s]++,s))}}function iI(t){var e;for(e=0;e<ST;e++)t.dyn_ltree[2*e]=0;for(e=0;e<AT;e++)t.dyn_dtree[2*e]=0;for(e=0;e<xT;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*CT]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function oI(t){t.bi_valid>8?$T(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function aI(t,e,n,r){var i=2*e,o=2*n;return t[i]<t[o]||t[i]===t[o]&&r[e]<=r[n]}function sI(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&aI(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!aI(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function uI(t,e,n){var r,i,o,a,s=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*s]<<8|t.pending_buf[t.d_buf+2*s+1],i=t.pending_buf[t.l_buf+s],s++,0===r?eI(t,i,e):(eI(t,(o=QT[i])+LT+1,e),0!==(a=PT[o])&&tI(t,i-=HT[o],a),eI(t,o=XT(--r),n),0!==(a=RT[o])&&tI(t,r-=qT[o],a))}while(s<t.last_lit);eI(t,CT,e)}function cI(t,e){var n,r,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,u=e.stat_desc.elems,c=-1;for(t.heap_len=0,t.heap_max=TT,n=0;n<u;n++)0!==o[2*n]?(t.heap[++t.heap_len]=c=n,t.depth[n]=0):o[2*n+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=c,n=t.heap_len>>1;n>=1;n--)sI(t,o,n);i=u;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],sI(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,sI(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,a,s,u=e.dyn_tree,c=e.max_code,l=e.stat_desc.static_tree,h=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(o=0;o<=IT;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<TT;n++)(o=u[2*u[2*(r=t.heap[n])+1]+1]+1)>p&&(o=p,m++),u[2*r+1]=o,r>c||(t.bl_count[o]++,a=0,r>=f&&(a=d[r-f]),s=u[2*r],t.opt_len+=s*(o+a),h&&(t.static_len+=s*(l[2*r+1]+a)));if(0!==m){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)(i=t.heap[--n])>c||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),r--)}}(t,e),rI(o,c,t.bl_count)}function lI(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=e[2*(r+1)+1],++s<u&&i===a||(s<c?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[2*DT]++):s<=10?t.bl_tree[2*OT]++:t.bl_tree[2*zT]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function hI(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),r=0;r<=n;r++)if(i=a,a=e[2*(r+1)+1],!(++s<u&&i===a)){if(s<c)do{eI(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(eI(t,i,t.bl_tree),s--),eI(t,DT,t.bl_tree),tI(t,s-3,2)):s<=10?(eI(t,OT,t.bl_tree),tI(t,s-3,3)):(eI(t,zT,t.bl_tree),tI(t,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}wT(qT);var dI=!1;function fI(t){dI||(!function(){var t,e,n,r,i,o=new Array(IT+1);for(n=0,r=0;r<NT-1;r++)for(HT[r]=n,t=0;t<1<<PT[r];t++)QT[n++]=r;for(QT[n-1]=r,i=0,r=0;r<16;r++)for(qT[r]=i,t=0;t<1<<RT[r];t++)YT[i++]=r;for(i>>=7;r<AT;r++)for(qT[r]=i<<7,t=0;t<1<<RT[r]-7;t++)YT[256+i++]=r;for(e=0;e<=IT;e++)o[e]=0;for(t=0;t<=143;)FT[2*t+1]=8,t++,o[8]++;for(;t<=255;)FT[2*t+1]=9,t++,o[9]++;for(;t<=279;)FT[2*t+1]=7,t++,o[7]++;for(;t<=287;)FT[2*t+1]=8,t++,o[8]++;for(rI(FT,ST+1,o),t=0;t<AT;t++)WT[2*t+1]=5,WT[2*t]=nI(t,5);GT=new JT(FT,PT,LT+1,ST,IT),ZT=new JT(WT,RT,0,AT,IT),VT=new JT(new Array(0),BT,0,xT,jT)}(),dI=!0),t.l_desc=new KT(t.dyn_ltree,GT),t.d_desc=new KT(t.dyn_dtree,ZT),t.bl_desc=new KT(t.bl_tree,VT),t.bi_buf=0,t.bi_valid=0,iI(t)}function pI(t,e,n,r){tI(t,(MT<<1)+(r?1:0),3),function(t,e,n,r){oI(t),r&&($T(t,n),$T(t,~n)),dT(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n,!0)}function mI(t){tI(t,_T<<1,3),eI(t,CT,FT),function(t){16===t.bi_valid?($T(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}function gI(t,e,n,r){var i,o,a=0;t.level>0?(t.strm.data_type===vT&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return yT;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return bT;for(e=32;e<LT;e++)if(0!==t.dyn_ltree[2*e])return bT;return yT}(t)),cI(t,t.l_desc),cI(t,t.d_desc),a=function(t){var e;for(lI(t,t.dyn_ltree,t.l_desc.max_code),lI(t,t.dyn_dtree,t.d_desc.max_code),cI(t,t.bl_desc),e=xT-1;e>=3&&0===t.bl_tree[2*UT[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?pI(t,e,n,r):t.strategy===gT||o===i?(tI(t,(_T<<1)+(r?1:0),3),uI(t,FT,WT)):(tI(t,(ET<<1)+(r?1:0),3),function(t,e,n,r){var i;for(tI(t,e-257,5),tI(t,n-1,5),tI(t,r-4,4),i=0;i<r;i++)tI(t,t.bl_tree[2*UT[i]+1],3);hI(t,t.dyn_ltree,e-1),hI(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),uI(t,t.dyn_ltree,t.dyn_dtree)),iI(t),r&&oI(t)}function yI(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(QT[n]+LT+1)]++,t.dyn_dtree[2*XT(e)]++),t.last_lit===t.lit_bufsize-1}function bI(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}var vI=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();function wI(t,e,n,r){var i=vI,o=r+n;t^=-1;for(var a=r;a<o;a++)t=t>>>8^i[255&(t^e[a])];return-1^t}var MI,_I=0,EI=1,NI=3,LI=4,SI=5,AI=0,xI=1,TI=-2,II=-3,kI=-5,jI=-1,CI=1,DI=2,OI=3,zI=4,PI=2,RI=8,BI=9,UI=286,FI=30,WI=19,YI=2*UI+1,QI=15,HI=3,GI=258,ZI=GI+HI+1,VI=32,qI=42,JI=69,KI=73,XI=91,$I=103,tk=113,ek=666,nk=1,rk=2,ik=3,ok=4,ak=3;function sk(t,e){return t.msg=lT[e],e}function uk(t){return(t<<1)-(t>4?9:0)}function ck(t){for(var e=t.length;--e>=0;)t[e]=0}function lk(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(dT(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function hk(t,e){gI(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,lk(t.strm)}function dk(t,e){t.pending_buf[t.pending++]=e}function fk(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function pk(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),0===i?0:(t.avail_in-=i,dT(e,t.input,t.next_in,i,n),1===t.state.wrap?t.adler=bI(t.adler,e,i,n):2===t.state.wrap&&(t.adler=wI(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function mk(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-ZI?t.strstart-(t.w_size-ZI):0,c=t.window,l=t.w_mask,h=t.prev,d=t.strstart+GI,f=c[o+a-1],p=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(c[(n=e)+a]===p&&c[n+a-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&o<d);if(r=GI-(d-o),o=d-GI,r>a){if(t.match_start=e,a=r,r>=s)break;f=c[o+a-1],p=c[o+a]}}}while((e=h[e&l])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead}function gk(t){var e,n,r,i,o,a=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=a+(a-ZI)){dT(t.window,t.window,a,a,0),t.match_start-=a,t.strstart-=a,t.block_start-=a,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=a?r-a:0}while(--n);e=n=a;do{r=t.prev[--e],t.prev[e]=r>=a?r-a:0}while(--n);i+=a}if(0===t.strm.avail_in)break;if(n=pk(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=HI)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+HI-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<HI)););}while(t.lookahead<ZI&&0!==t.strm.avail_in)}function yk(t,e){for(var n,r;;){if(t.lookahead<ZI){if(gk(t),t.lookahead<ZI&&e===_I)return nk;if(0===t.lookahead)break}if(n=0,t.lookahead>=HI&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+HI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-ZI&&(t.match_length=mk(t,n)),t.match_length>=HI)if(r=yI(t,t.strstart-t.match_start,t.match_length-HI),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=HI){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+HI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=yI(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(hk(t,!1),0===t.strm.avail_out))return nk}return t.insert=t.strstart<HI-1?t.strstart:HI-1,e===LI?(hk(t,!0),0===t.strm.avail_out?ik:ok):t.last_lit&&(hk(t,!1),0===t.strm.avail_out)?nk:rk}function bk(t,e){for(var n,r,i;;){if(t.lookahead<ZI){if(gk(t),t.lookahead<ZI&&e===_I)return nk;if(0===t.lookahead)break}if(n=0,t.lookahead>=HI&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+HI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=HI-1,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-ZI&&(t.match_length=mk(t,n),t.match_length<=5&&(t.strategy===CI||t.match_length===HI&&t.strstart-t.match_start>4096)&&(t.match_length=HI-1)),t.prev_length>=HI&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-HI,r=yI(t,t.strstart-1-t.prev_match,t.prev_length-HI),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+HI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=HI-1,t.strstart++,r&&(hk(t,!1),0===t.strm.avail_out))return nk}else if(t.match_available){if((r=yI(t,0,t.window[t.strstart-1]))&&hk(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return nk}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=yI(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<HI-1?t.strstart:HI-1,e===LI?(hk(t,!0),0===t.strm.avail_out?ik:ok):t.last_lit&&(hk(t,!1),0===t.strm.avail_out)?nk:rk}function vk(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}function wk(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=RI,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new pT(2*YI),this.dyn_dtree=new pT(2*(2*FI+1)),this.bl_tree=new pT(2*(2*WI+1)),ck(this.dyn_ltree),ck(this.dyn_dtree),ck(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new pT(QI+1),this.heap=new pT(2*UI+1),ck(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new pT(2*UI+1),ck(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Mk(t){var e=function(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=PI,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?qI:tk,t.adler=2===e.wrap?0:1,e.last_flush=_I,fI(e),AI):sk(t,TI)}(t);return e===AI&&function(t){t.window_size=2*t.w_size,ck(t.head),t.max_lazy_match=MI[t.level].max_lazy,t.good_match=MI[t.level].good_length,t.nice_match=MI[t.level].nice_length,t.max_chain_length=MI[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=HI-1,t.match_available=0,t.ins_h=0}(t.state),e}function _k(t,e){var n,r,i,o;if(!t||!t.state||e>SI||e<0)return t?sk(t,TI):TI;if(r=t.state,!t.output||!t.input&&0!==t.avail_in||r.status===ek&&e!==LI)return sk(t,0===t.avail_out?kI:TI);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===qI)if(2===r.wrap)t.adler=0,dk(r,31),dk(r,139),dk(r,8),r.gzhead?(dk(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),dk(r,255&r.gzhead.time),dk(r,r.gzhead.time>>8&255),dk(r,r.gzhead.time>>16&255),dk(r,r.gzhead.time>>24&255),dk(r,9===r.level?2:r.strategy>=DI||r.level<2?4:0),dk(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(dk(r,255&r.gzhead.extra.length),dk(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=wI(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=JI):(dk(r,0),dk(r,0),dk(r,0),dk(r,0),dk(r,0),dk(r,9===r.level?2:r.strategy>=DI||r.level<2?4:0),dk(r,ak),r.status=tk);else{var a=RI+(r.w_bits-8<<4)<<8;a|=(r.strategy>=DI||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=VI),a+=31-a%31,r.status=tk,fk(r,a),0!==r.strstart&&(fk(r,t.adler>>>16),fk(r,65535&t.adler)),t.adler=1}if(r.status===JI)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(t.adler=wI(t.adler,r.pending_buf,r.pending-i,i)),lk(t),i=r.pending,r.pending!==r.pending_buf_size));)dk(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=wI(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=KI)}else r.status=KI;if(r.status===KI)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=wI(t.adler,r.pending_buf,r.pending-i,i)),lk(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,dk(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=wI(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.gzindex=0,r.status=XI)}else r.status=XI;if(r.status===XI)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=wI(t.adler,r.pending_buf,r.pending-i,i)),lk(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,dk(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=wI(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.status=$I)}else r.status=$I;if(r.status===$I&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&lk(t),r.pending+2<=r.pending_buf_size&&(dk(r,255&t.adler),dk(r,t.adler>>8&255),t.adler=0,r.status=tk)):r.status=tk),0!==r.pending){if(lk(t),0===t.avail_out)return r.last_flush=-1,AI}else if(0===t.avail_in&&uk(e)<=uk(n)&&e!==LI)return sk(t,kI);if(r.status===ek&&0!==t.avail_in)return sk(t,kI);if(0!==t.avail_in||0!==r.lookahead||e!==_I&&r.status!==ek){var s=r.strategy===DI?function(t,e){for(var n;;){if(0===t.lookahead&&(gk(t),0===t.lookahead)){if(e===_I)return nk;break}if(t.match_length=0,n=yI(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(hk(t,!1),0===t.strm.avail_out))return nk}return t.insert=0,e===LI?(hk(t,!0),0===t.strm.avail_out?ik:ok):t.last_lit&&(hk(t,!1),0===t.strm.avail_out)?nk:rk}(r,e):r.strategy===OI?function(t,e){for(var n,r,i,o,a=t.window;;){if(t.lookahead<=GI){if(gk(t),t.lookahead<=GI&&e===_I)return nk;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=HI&&t.strstart>0&&(r=a[i=t.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){o=t.strstart+GI;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);t.match_length=GI-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=HI?(n=yI(t,1,t.match_length-HI),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=yI(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(hk(t,!1),0===t.strm.avail_out))return nk}return t.insert=0,e===LI?(hk(t,!0),0===t.strm.avail_out?ik:ok):t.last_lit&&(hk(t,!1),0===t.strm.avail_out)?nk:rk}(r,e):MI[r.level].func(r,e);if(s!==ik&&s!==ok||(r.status=ek),s===nk||s===ik)return 0===t.avail_out&&(r.last_flush=-1),AI;if(s===rk&&(e===EI?mI(r):e!==SI&&(pI(r,0,0,!1),e===NI&&(ck(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),lk(t),0===t.avail_out))return r.last_flush=-1,AI}return e!==LI?AI:r.wrap<=0?xI:(2===r.wrap?(dk(r,255&t.adler),dk(r,t.adler>>8&255),dk(r,t.adler>>16&255),dk(r,t.adler>>24&255),dk(r,255&t.total_in),dk(r,t.total_in>>8&255),dk(r,t.total_in>>16&255),dk(r,t.total_in>>24&255)):(fk(r,t.adler>>>16),fk(r,65535&t.adler)),lk(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?AI:xI)}MI=[new vk(0,0,0,0,(function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(gk(t),0===t.lookahead&&e===_I)return nk;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,hk(t,!1),0===t.strm.avail_out))return nk;if(t.strstart-t.block_start>=t.w_size-ZI&&(hk(t,!1),0===t.strm.avail_out))return nk}return t.insert=0,e===LI?(hk(t,!0),0===t.strm.avail_out?ik:ok):(t.strstart>t.block_start&&(hk(t,!1),t.strm.avail_out),nk)})),new vk(4,4,8,4,yk),new vk(4,5,16,8,yk),new vk(4,6,32,32,yk),new vk(4,4,16,16,bk),new vk(8,16,32,32,bk),new vk(8,16,128,128,bk),new vk(8,32,128,256,bk),new vk(32,128,258,1024,bk),new vk(32,258,258,4096,bk)];var Ek=30,Nk=12;function Lk(t,e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S;n=t.state,r=t.next_in,L=t.input,i=r+(t.avail_in-5),o=t.next_out,S=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),u=n.dmax,c=n.wsize,l=n.whave,h=n.wnext,d=n.window,f=n.hold,p=n.bits,m=n.lencode,g=n.distcode,y=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;t:do{p<15&&(f+=L[r++]<<p,p+=8,f+=L[r++]<<p,p+=8),v=m[f&y];e:for(;;){if(f>>>=w=v>>>24,p-=w,0===(w=v>>>16&255))S[o++]=65535&v;else{if(!(16&w)){if(0==(64&w)){v=m[(65535&v)+(f&(1<<w)-1)];continue e}if(32&w){n.mode=Nk;break t}t.msg="invalid literal/length code",n.mode=Ek;break t}M=65535&v,(w&=15)&&(p<w&&(f+=L[r++]<<p,p+=8),M+=f&(1<<w)-1,f>>>=w,p-=w),p<15&&(f+=L[r++]<<p,p+=8,f+=L[r++]<<p,p+=8),v=g[f&b];n:for(;;){if(f>>>=w=v>>>24,p-=w,!(16&(w=v>>>16&255))){if(0==(64&w)){v=g[(65535&v)+(f&(1<<w)-1)];continue n}t.msg="invalid distance code",n.mode=Ek;break t}if(_=65535&v,p<(w&=15)&&(f+=L[r++]<<p,(p+=8)<w&&(f+=L[r++]<<p,p+=8)),(_+=f&(1<<w)-1)>u){t.msg="invalid distance too far back",n.mode=Ek;break t}if(f>>>=w,p-=w,_>(w=o-a)){if((w=_-w)>l&&n.sane){t.msg="invalid distance too far back",n.mode=Ek;break t}if(E=0,N=d,0===h){if(E+=c-w,w<M){M-=w;do{S[o++]=d[E++]}while(--w);E=o-_,N=S}}else if(h<w){if(E+=c+h-w,(w-=h)<M){M-=w;do{S[o++]=d[E++]}while(--w);if(E=0,h<M){M-=w=h;do{S[o++]=d[E++]}while(--w);E=o-_,N=S}}}else if(E+=h-w,w<M){M-=w;do{S[o++]=d[E++]}while(--w);E=o-_,N=S}for(;M>2;)S[o++]=N[E++],S[o++]=N[E++],S[o++]=N[E++],M-=3;M&&(S[o++]=N[E++],M>1&&(S[o++]=N[E++]))}else{E=o-_;do{S[o++]=S[E++],S[o++]=S[E++],S[o++]=S[E++],M-=3}while(M>2);M&&(S[o++]=S[E++],M>1&&(S[o++]=S[E++]))}break}}break}}while(r<i&&o<s);r-=M=p>>3,f&=(1<<(p-=M<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=o<s?s-o+257:257-(o-s),n.hold=f,n.bits=p}var Sk=15,Ak=852,xk=592,Tk=0,Ik=1,kk=2,jk=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Ck=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Dk=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Ok=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function zk(t,e,n,r,i,o,a,s){var u,c,l,h,d,f,p,m,g,y=s.bits,b=0,v=0,w=0,M=0,_=0,E=0,N=0,L=0,S=0,A=0,x=null,T=0,I=new pT(Sk+1),k=new pT(Sk+1),j=null,C=0;for(b=0;b<=Sk;b++)I[b]=0;for(v=0;v<r;v++)I[e[n+v]]++;for(_=y,M=Sk;M>=1&&0===I[M];M--);if(_>M&&(_=M),0===M)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(w=1;w<M&&0===I[w];w++);for(_<w&&(_=w),L=1,b=1;b<=Sk;b++)if(L<<=1,(L-=I[b])<0)return-1;if(L>0&&(t===Tk||1!==M))return-1;for(k[1]=0,b=1;b<Sk;b++)k[b+1]=k[b]+I[b];for(v=0;v<r;v++)0!==e[n+v]&&(a[k[e[n+v]]++]=v);if(t===Tk?(x=j=a,f=19):t===Ik?(x=jk,T-=257,j=Ck,C-=257,f=256):(x=Dk,j=Ok,f=-1),A=0,v=0,b=w,d=o,E=_,N=0,l=-1,h=(S=1<<_)-1,t===Ik&&S>Ak||t===kk&&S>xk)return 1;for(;;){p=b-N,a[v]<f?(m=0,g=a[v]):a[v]>f?(m=j[C+a[v]],g=x[T+a[v]]):(m=96,g=0),u=1<<b-N,w=c=1<<E;do{i[d+(A>>N)+(c-=u)]=p<<24|m<<16|g|0}while(0!==c);for(u=1<<b-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,v++,0==--I[b]){if(b===M)break;b=e[n+a[v]]}if(b>_&&(A&h)!==l){for(0===N&&(N=_),d+=w,L=1<<(E=b-N);E+N<M&&!((L-=I[E+N])<=0);)E++,L<<=1;if(S+=1<<E,t===Ik&&S>Ak||t===kk&&S>xk)return 1;i[l=A&h]=_<<24|E<<16|d-o|0}}return 0!==A&&(i[d+A]=b-N<<24|64<<16|0),s.bits=_,0}var Pk=0,Rk=1,Bk=2,Uk=4,Fk=5,Wk=6,Yk=0,Qk=1,Hk=2,Gk=-2,Zk=-3,Vk=-4,qk=-5,Jk=8,Kk=1,Xk=2,$k=3,tj=4,ej=5,nj=6,rj=7,ij=8,oj=9,aj=10,sj=11,uj=12,cj=13,lj=14,hj=15,dj=16,fj=17,pj=18,mj=19,gj=20,yj=21,bj=22,vj=23,wj=24,Mj=25,_j=26,Ej=27,Nj=28,Lj=29,Sj=30,Aj=31,xj=852,Tj=592;function Ij(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function kj(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new pT(320),this.work=new pT(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function jj(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kk,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new mT(xj),e.distcode=e.distdyn=new mT(Tj),e.sane=1,e.back=-1,Yk):Gk}(t)):Gk}function Cj(t,e){var n,r;return t?(r=new kj,t.state=r,r.window=null,n=function(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Gk:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,jj(t))):Gk}(t,e),n!==Yk&&(t.state=null),n):Gk}var Dj,Oj,zj=!0;function Pj(t){if(zj){var e;for(Dj=new mT(512),Oj=new mT(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(zk(Rk,t.lens,0,288,Dj,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;zk(Bk,t.lens,0,32,Oj,0,t.work,{bits:5}),zj=!1}t.lencode=Dj,t.lenbits=9,t.distcode=Oj,t.distbits=5}function Rj(t,e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S=0,A=new fT(4),x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return Gk;(n=t.state).mode===uj&&(n.mode=cj),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,c=n.hold,l=n.bits,h=s,d=u,E=Yk;t:for(;;)switch(n.mode){case Kk:if(0===n.wrap){n.mode=cj;break}for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(2&n.wrap&&35615===c){n.check=0,A[0]=255&c,A[1]=c>>>8&255,n.check=wI(n.check,A,2,0),c=0,l=0,n.mode=Xk;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=Sj;break}if((15&c)!==Jk){t.msg="unknown compression method",n.mode=Sj;break}if(l-=4,_=8+(15&(c>>>=4)),0===n.wbits)n.wbits=_;else if(_>n.wbits){t.msg="invalid window size",n.mode=Sj;break}n.dmax=1<<_,t.adler=n.check=1,n.mode=512&c?aj:uj,c=0,l=0;break;case Xk:for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(n.flags=c,(255&n.flags)!==Jk){t.msg="unknown compression method",n.mode=Sj;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=Sj;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,n.check=wI(n.check,A,2,0)),c=0,l=0,n.mode=$k;case $k:for(;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.head&&(n.head.time=c),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,n.check=wI(n.check,A,4,0)),c=0,l=0,n.mode=tj;case tj:for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,n.check=wI(n.check,A,2,0)),c=0,l=0,n.mode=ej;case ej:if(1024&n.flags){for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,n.check=wI(n.check,A,2,0)),c=0,l=0}else n.head&&(n.head.extra=null);n.mode=nj;case nj:if(1024&n.flags&&((f=n.length)>s&&(f=s),f&&(n.head&&(_=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),dT(n.head.extra,r,o,f,_)),512&n.flags&&(n.check=wI(n.check,r,f,o)),s-=f,o+=f,n.length-=f),n.length))break t;n.length=0,n.mode=rj;case rj:if(2048&n.flags){if(0===s)break t;f=0;do{_=r[o+f++],n.head&&_&&n.length<65536&&(n.head.name+=String.fromCharCode(_))}while(_&&f<s);if(512&n.flags&&(n.check=wI(n.check,r,f,o)),s-=f,o+=f,_)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=ij;case ij:if(4096&n.flags){if(0===s)break t;f=0;do{_=r[o+f++],n.head&&_&&n.length<65536&&(n.head.comment+=String.fromCharCode(_))}while(_&&f<s);if(512&n.flags&&(n.check=wI(n.check,r,f,o)),s-=f,o+=f,_)break t}else n.head&&(n.head.comment=null);n.mode=oj;case oj:if(512&n.flags){for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(c!==(65535&n.check)){t.msg="header crc mismatch",n.mode=Sj;break}c=0,l=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=uj;break;case aj:for(;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}t.adler=n.check=Ij(c),c=0,l=0,n.mode=sj;case sj:if(0===n.havedict)return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,n.hold=c,n.bits=l,Hk;t.adler=n.check=1,n.mode=uj;case uj:if(e===Fk||e===Wk)break t;case cj:if(n.last){c>>>=7&l,l-=7&l,n.mode=Ej;break}for(;l<3;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}switch(n.last=1&c,l-=1,3&(c>>>=1)){case 0:n.mode=lj;break;case 1:if(Pj(n),n.mode=gj,e===Wk){c>>>=2,l-=2;break t}break;case 2:n.mode=fj;break;case 3:t.msg="invalid block type",n.mode=Sj}c>>>=2,l-=2;break;case lj:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){t.msg="invalid stored block lengths",n.mode=Sj;break}if(n.length=65535&c,c=0,l=0,n.mode=hj,e===Wk)break t;case hj:n.mode=dj;case dj:if(f=n.length){if(f>s&&(f=s),f>u&&(f=u),0===f)break t;dT(i,r,o,f,a),s-=f,o+=f,u-=f,a+=f,n.length-=f;break}n.mode=uj;break;case fj:for(;l<14;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(n.nlen=257+(31&c),c>>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Sj;break}n.have=0,n.mode=pj;case pj:for(;n.have<n.ncode;){for(;l<3;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.lens[x[n.have++]]=7&c,c>>>=3,l-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},E=zk(Pk,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,E){t.msg="invalid code lengths set",n.mode=Sj;break}n.have=0,n.mode=mj;case mj:for(;n.have<n.nlen+n.ndist;){for(;y=(S=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,b=65535&S,!((g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(b<16)c>>>=g,l-=g,n.lens[n.have++]=b;else{if(16===b){for(L=g+2;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(c>>>=g,l-=g,0===n.have){t.msg="invalid bit length repeat",n.mode=Sj;break}_=n.lens[n.have-1],f=3+(3&c),c>>>=2,l-=2}else if(17===b){for(L=g+3;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}l-=g,_=0,f=3+(7&(c>>>=g)),c>>>=3,l-=3}else{for(L=g+7;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}l-=g,_=0,f=11+(127&(c>>>=g)),c>>>=7,l-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Sj;break}for(;f--;)n.lens[n.have++]=_}}if(n.mode===Sj)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=Sj;break}if(n.lenbits=9,N={bits:n.lenbits},E=zk(Rk,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,E){t.msg="invalid literal/lengths set",n.mode=Sj;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},E=zk(Bk,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,E){t.msg="invalid distances set",n.mode=Sj;break}if(n.mode=gj,e===Wk)break t;case gj:n.mode=yj;case yj:if(s>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,n.hold=c,n.bits=l,Lk(t,d),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,c=n.hold,l=n.bits,n.mode===uj&&(n.back=-1);break}for(n.back=0;y=(S=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,b=65535&S,!((g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(y&&0==(240&y)){for(v=g,w=y,M=b;y=(S=n.lencode[M+((c&(1<<v+w)-1)>>v)])>>>16&255,b=65535&S,!(v+(g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=g,l-=g,n.back+=g,n.length=b,0===y){n.mode=_j;break}if(32&y){n.back=-1,n.mode=uj;break}if(64&y){t.msg="invalid literal/length code",n.mode=Sj;break}n.extra=15&y,n.mode=bj;case bj:if(n.extra){for(L=n.extra;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=vj;case vj:for(;y=(S=n.distcode[c&(1<<n.distbits)-1])>>>16&255,b=65535&S,!((g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(0==(240&y)){for(v=g,w=y,M=b;y=(S=n.distcode[M+((c&(1<<v+w)-1)>>v)])>>>16&255,b=65535&S,!(v+(g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=g,l-=g,n.back+=g,64&y){t.msg="invalid distance code",n.mode=Sj;break}n.offset=b,n.extra=15&y,n.mode=wj;case wj:if(n.extra){for(L=n.extra;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Sj;break}n.mode=Mj;case Mj:if(0===u)break t;if(f=d-u,n.offset>f){if((f=n.offset-f)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Sj;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),m=n.window}else m=i,p=a-n.offset,f=n.length;f>u&&(f=u),u-=f,n.length-=f;do{i[a++]=m[p++]}while(--f);0===n.length&&(n.mode=yj);break;case _j:if(0===u)break t;i[a++]=n.length,u--,n.mode=yj;break;case Ej:if(n.wrap){for(;l<32;){if(0===s)break t;s--,c|=r[o++]<<l,l+=8}if(d-=u,t.total_out+=d,n.total+=d,d&&(t.adler=n.check=n.flags?wI(n.check,i,d,a-d):bI(n.check,i,d,a-d)),d=u,(n.flags?c:Ij(c))!==n.check){t.msg="incorrect data check",n.mode=Sj;break}c=0,l=0}n.mode=Nj;case Nj:if(n.wrap&&n.flags){for(;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(c!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=Sj;break}c=0,l=0}n.mode=Lj;case Lj:E=Qk;break t;case Sj:E=Zk;break t;case Aj:return Vk;default:return Gk}return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,n.hold=c,n.bits=l,(n.wsize||d!==t.avail_out&&n.mode<Sj&&(n.mode<Ej||e!==Uk))&&function(t,e,n,r){var i,o=t.state;null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new fT(o.wsize)),r>=o.wsize?(dT(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>r&&(i=r),dT(o.window,e,n-r,i,o.wnext),(r-=i)?(dT(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i)))}(t,t.output,t.next_out,d-t.avail_out),h-=t.avail_in,d-=t.avail_out,t.total_in+=h,t.total_out+=d,n.total+=d,n.wrap&&d&&(t.adler=n.check=n.flags?wI(n.check,i,d,t.next_out-d):bI(n.check,i,d,t.next_out-d)),t.data_type=n.bits+(n.last?64:0)+(n.mode===uj?128:0)+(n.mode===gj||n.mode===hj?256:0),(0===h&&0===d||e===Uk)&&E===Yk&&(E=qk),E}var Bj,Uj=1,Fj=7;function Wj(t){if(t<Uj||t>Fj)throw new TypeError("Bad argument");this.mode=t,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function Yj(t,e){for(var n=0;n<t.length;n++)this[e+n]=t[n]}Wj.prototype.init=function(t,e,n,r,i){var o;switch(this.windowBits=t,this.level=e,this.memLevel=n,this.strategy=r,3!==this.mode&&4!==this.mode||(this.windowBits+=16),this.mode===Fj&&(this.windowBits+=32),5!==this.mode&&6!==this.mode||(this.windowBits=-this.windowBits),this.strm=new hT,this.mode){case Uj:case 3:case 5:o=function(t,e,n,r,i,o){if(!t)return TI;var a=1;if(e===jI&&(e=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>BI||n!==RI||r<8||r>15||e<0||e>9||o<0||o>zI)return sk(t,TI);8===r&&(r=9);var s=new wk;return t.state=s,s.strm=t,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+HI-1)/HI),s.window=new fT(2*s.w_size),s.head=new pT(s.hash_size),s.prev=new pT(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new fT(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=o,s.method=n,Mk(t)}(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case Fj:o=Cj(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}0===o?(this.write_in_progress=!1,this.init_done=!0):this._error(o)},Wj.prototype.params=function(){throw new Error("deflateParams Not supported")},Wj.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(0===this.mode)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},Wj.prototype.write=function(t,e,n,r,i,o,a){this._writeCheck(),this.write_in_progress=!0;var s=this;return hS.nextTick((function(){s.write_in_progress=!1;var u=s._write(t,e,n,r,i,o,a);s.callback(u[0],u[1]),s.pending_close&&s.close()})),this},Wj.prototype.writeSync=function(t,e,n,r,i,o,a){return this._writeCheck(),this._write(t,e,n,r,i,o,a)},Wj.prototype._write=function(t,e,n,r,i,o,a){if(this.write_in_progress=!0,0!==t&&1!==t&&2!==t&&3!==t&&4!==t&&5!==t)throw new Error("Invalid flush value");null==e&&(e=new f_(0),r=0,n=0),i._set?i.set=i._set:i.set=Yj;var s,u=this.strm;switch(u.avail_in=r,u.input=e,u.next_in=n,u.avail_out=a,u.output=i,u.next_out=o,this.mode){case Uj:case 3:case 5:s=_k(u,t);break;case Fj:case 2:case 4:case 6:s=Rj(u,t);break;default:throw new Error("Unknown mode "+this.mode)}return 1!==s&&0!==s&&this._error(s),this.write_in_progress=!1,[u.avail_in,u.avail_out]},Wj.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,this.mode===Uj||3===this.mode||5===this.mode?function(t){var e;t&&t.state&&((e=t.state.status)!==qI&&e!==JI&&e!==KI&&e!==XI&&e!==$I&&e!==tk&&e!==ek?sk(t,TI):(t.state=null,e===tk&&sk(t,II)))}(this.strm):function(t){if(!t||!t.state)return Gk;var e=t.state;e.window&&(e.window=null),t.state=null}(this.strm),this.mode=0)},Wj.prototype.reset=function(){switch(this.mode){case Uj:case 5:Bj=Mk(this.strm);break;case 2:case 6:Bj=jj(this.strm)}0!==Bj&&this._error(Bj)},Wj.prototype._error=function(t){this.onerror(lT[t]+": "+this.strm.msg,t),this.write_in_progress=!1,this.pending_close&&this.close()};var Qj=Object.freeze({__proto__:null,NONE:0,DEFLATE:Uj,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:Fj,Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8,Zlib:Wj});var Hj={};Object.keys(Qj).forEach((function(t){Hj[t]=Qj[t]})),Hj.Z_MIN_WINDOWBITS=8,Hj.Z_MAX_WINDOWBITS=15,Hj.Z_DEFAULT_WINDOWBITS=15,Hj.Z_MIN_CHUNK=64,Hj.Z_MAX_CHUNK=1/0,Hj.Z_DEFAULT_CHUNK=16384,Hj.Z_MIN_MEMLEVEL=1,Hj.Z_MAX_MEMLEVEL=9,Hj.Z_DEFAULT_MEMLEVEL=8,Hj.Z_MIN_LEVEL=-1,Hj.Z_MAX_LEVEL=9,Hj.Z_DEFAULT_LEVEL=Hj.Z_DEFAULT_COMPRESSION;var Gj={Z_OK:Hj.Z_OK,Z_STREAM_END:Hj.Z_STREAM_END,Z_NEED_DICT:Hj.Z_NEED_DICT,Z_ERRNO:Hj.Z_ERRNO,Z_STREAM_ERROR:Hj.Z_STREAM_ERROR,Z_DATA_ERROR:Hj.Z_DATA_ERROR,Z_MEM_ERROR:Hj.Z_MEM_ERROR,Z_BUF_ERROR:Hj.Z_BUF_ERROR,Z_VERSION_ERROR:Hj.Z_VERSION_ERROR};function Zj(t){return new gC(t)}function Vj(t){return new yC(t)}function qj(t){return new wC(t)}function Jj(t){return new MC(t)}function Kj(t){return new bC(t)}function Xj(t){return new vC(t)}function $j(t){return new _C(t)}function tC(t,e,n){return"function"==typeof e&&(n=e,e={}),pC(new gC(e),t,n)}function eC(t,e){return mC(new gC(e),t)}function nC(t,e,n){return"function"==typeof e&&(n=e,e={}),pC(new bC(e),t,n)}function rC(t,e){return mC(new bC(e),t)}function iC(t,e,n){return"function"==typeof e&&(n=e,e={}),pC(new wC(e),t,n)}function oC(t,e){return mC(new wC(e),t)}function aC(t,e,n){return"function"==typeof e&&(n=e,e={}),pC(new _C(e),t,n)}function sC(t,e){return mC(new _C(e),t)}function uC(t,e,n){return"function"==typeof e&&(n=e,e={}),pC(new yC(e),t,n)}function cC(t,e){return mC(new yC(e),t)}function lC(t,e,n){return"function"==typeof e&&(n=e,e={}),pC(new vC(e),t,n)}function hC(t,e){return mC(new vC(e),t)}function dC(t,e,n){return"function"==typeof e&&(n=e,e={}),pC(new MC(e),t,n)}function fC(t,e){return mC(new MC(e),t)}function pC(t,e,n){var r=[],i=0;function o(){for(var e;null!==(e=t.read());)r.push(e),i+=e.length;t.once("readable",o)}function a(){var e=f_.concat(r,i);r=[],n(null,e),t.close()}t.on("error",(function(e){t.removeListener("end",a),t.removeListener("readable",o),n(e)})),t.on("end",a),t.end(e),o()}function mC(t,e){if("string"==typeof e&&(e=new f_(e)),!f_.isBuffer(e))throw new TypeError("Not a string or buffer");var n=Hj.Z_FINISH;return t._processChunk(e,n)}function gC(t){if(!(this instanceof gC))return new gC(t);EC.call(this,t,Hj.DEFLATE)}function yC(t){if(!(this instanceof yC))return new yC(t);EC.call(this,t,Hj.INFLATE)}function bC(t){if(!(this instanceof bC))return new bC(t);EC.call(this,t,Hj.GZIP)}function vC(t){if(!(this instanceof vC))return new vC(t);EC.call(this,t,Hj.GUNZIP)}function wC(t){if(!(this instanceof wC))return new wC(t);EC.call(this,t,Hj.DEFLATERAW)}function MC(t){if(!(this instanceof MC))return new MC(t);EC.call(this,t,Hj.INFLATERAW)}function _C(t){if(!(this instanceof _C))return new _C(t);EC.call(this,t,Hj.UNZIP)}function EC(t,e){if(this._opts=t=t||{},this._chunkSize=t.chunkSize||Hj.Z_DEFAULT_CHUNK,FA.call(this,t),t.flush&&t.flush!==Hj.Z_NO_FLUSH&&t.flush!==Hj.Z_PARTIAL_FLUSH&&t.flush!==Hj.Z_SYNC_FLUSH&&t.flush!==Hj.Z_FULL_FLUSH&&t.flush!==Hj.Z_FINISH&&t.flush!==Hj.Z_BLOCK)throw new Error("Invalid flush flag: "+t.flush);if(this._flushFlag=t.flush||Hj.Z_NO_FLUSH,t.chunkSize&&(t.chunkSize<Hj.Z_MIN_CHUNK||t.chunkSize>Hj.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<Hj.Z_MIN_WINDOWBITS||t.windowBits>Hj.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<Hj.Z_MIN_LEVEL||t.level>Hj.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<Hj.Z_MIN_MEMLEVEL||t.memLevel>Hj.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=Hj.Z_FILTERED&&t.strategy!=Hj.Z_HUFFMAN_ONLY&&t.strategy!=Hj.Z_RLE&&t.strategy!=Hj.Z_FIXED&&t.strategy!=Hj.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!f_.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new Hj.Zlib(e);var n=this;this._hadError=!1,this._binding.onerror=function(t,e){n._binding=null,n._hadError=!0;var r=new Error(t);r.errno=e,r.code=Hj.codes[e],n.emit("error",r)};var r=Hj.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(r=t.level);var i=Hj.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(i=t.strategy),this._binding.init(t.windowBits||Hj.Z_DEFAULT_WINDOWBITS,r,t.memLevel||Hj.Z_DEFAULT_MEMLEVEL,i,t.dictionary),this._buffer=new f_(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=i,this.once("end",this.close)}Object.keys(Gj).forEach((function(t){Gj[Gj[t]]=t})),jS(EC,FA),EC.prototype.params=function(t,e,n){if(t<Hj.Z_MIN_LEVEL||t>Hj.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(e!=Hj.Z_FILTERED&&e!=Hj.Z_HUFFMAN_ONLY&&e!=Hj.Z_RLE&&e!=Hj.Z_FIXED&&e!=Hj.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+e);if(this._level!==t||this._strategy!==e){var r=this;this.flush(Hj.Z_SYNC_FLUSH,(function(){r._binding.params(t,e),r._hadError||(r._level=t,r._strategy=e,n&&n())}))}else hS.nextTick(n)},EC.prototype.reset=function(){return this._binding.reset()},EC.prototype._flush=function(t){this._transform(new f_(0),"",t)},EC.prototype.flush=function(t,e){var n=this._writableState;if(("function"==typeof t||void 0===t&&!e)&&(e=t,t=Hj.Z_FULL_FLUSH),n.ended)e&&hS.nextTick(e);else if(n.ending)e&&this.once("end",e);else if(n.needDrain){var r=this;this.once("drain",(function(){r.flush(e)}))}else this._flushFlag=t,this.write(new f_(0),"",e)},EC.prototype.close=function(t){if(t&&hS.nextTick(t),!this._closed){this._closed=!0,this._binding.close();var e=this;hS.nextTick((function(){e.emit("close")}))}},EC.prototype._transform=function(t,e,n){var r,i=this._writableState,o=(i.ending||i.ended)&&(!t||i.length===t.length);if(null===!t&&!f_.isBuffer(t))return n(new Error("invalid input"));o?r=Hj.Z_FINISH:(r=this._flushFlag,t.length>=i.length&&(this._flushFlag=this._opts.flush||Hj.Z_NO_FLUSH)),this._processChunk(t,r,n)},EC.prototype._processChunk=function(t,e,n){var r=t&&t.length,i=this._chunkSize-this._offset,o=0,a=this,s="function"==typeof n;if(!s){var u,c=[],l=0;this.on("error",(function(t){u=t}));do{var h=this._binding.writeSync(e,t,o,r,this._buffer,this._offset,i)}while(!this._hadError&&p(h[0],h[1]));if(this._hadError)throw u;var d=f_.concat(c,l);return this.close(),d}var f=this._binding.write(e,t,o,r,this._buffer,this._offset,i);function p(u,h){if(!a._hadError){var d=i-h;if(function(t,e){if(!t)throw new Error(e)}(d>=0,"have should not go down"),d>0){var f=a._buffer.slice(a._offset,a._offset+d);a._offset+=d,s?a.push(f):(c.push(f),l+=f.length)}if((0===h||a._offset>=a._chunkSize)&&(i=a._chunkSize,a._offset=0,a._buffer=new f_(a._chunkSize)),0===h){if(o+=r-u,r=u,!s)return!0;var m=a._binding.write(e,t,o,r,a._buffer,a._offset,a._chunkSize);return m.callback=p,void(m.buffer=t)}if(!s)return!1;n()}}f.buffer=t,f.callback=p},jS(gC,EC),jS(yC,EC),jS(bC,EC),jS(vC,EC),jS(wC,EC),jS(MC,EC),jS(_C,EC);var NC,LC,SC={codes:Gj,createDeflate:Zj,createInflate:Vj,createDeflateRaw:qj,createInflateRaw:Jj,createGzip:Kj,createGunzip:Xj,createUnzip:$j,deflate:tC,deflateSync:eC,gzip:nC,gzipSync:rC,deflateRaw:iC,deflateRawSync:oC,unzip:aC,unzipSync:sC,inflate:uC,inflateSync:cC,gunzip:lC,gunzipSync:hC,inflateRaw:dC,inflateRawSync:fC,Deflate:gC,Inflate:yC,Gzip:bC,Gunzip:vC,DeflateRaw:wC,InflateRaw:MC,Unzip:_C,Zlib:EC},AC=KM(Object.freeze({__proto__:null,codes:Gj,createDeflate:Zj,createInflate:Vj,createDeflateRaw:qj,createInflateRaw:Jj,createGzip:Kj,createGunzip:Xj,createUnzip:$j,deflate:tC,deflateSync:eC,gzip:nC,gzipSync:rC,deflateRaw:iC,deflateRawSync:oC,unzip:aC,unzipSync:sC,inflate:uC,inflateSync:cC,gunzip:lC,gunzipSync:hC,inflateRaw:dC,inflateRawSync:fC,Deflate:gC,Inflate:yC,Gzip:bC,Gunzip:vC,DeflateRaw:wC,InflateRaw:MC,Unzip:_C,Zlib:EC,default:SC})),xC={exports:{}};function TC(){return LC?NC:(LC=1,NC={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:f_.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}})}var IC="/Users/sebastian/Work/DePay/solana-web3.js/node_modules/bufferutil",kC={exports:{}},jC=KM(Object.freeze({__proto__:null,default:{}}));function CC(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var DC=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,OC=function(t){return DC.exec(t).slice(1)};function zC(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,e="/"===r.charAt(0))}return t=CC(HC(t.split("/"),(function(t){return!!t})),!e).join("/"),(e?"/":"")+t||"."}function PC(t){var e=RC(t),n="/"===ZC(t,-1);return t=CC(HC(t.split("/"),(function(t){return!!t})),!e).join("/"),t||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t}function RC(t){return"/"===t.charAt(0)}function BC(){return PC(HC(Array.prototype.slice.call(arguments,0),(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))}function UC(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=zC(t).substr(1),e=zC(e).substr(1);for(var r=n(t.split("/")),i=n(e.split("/")),o=Math.min(r.length,i.length),a=o,s=0;s<o;s++)if(r[s]!==i[s]){a=s;break}var u=[];for(s=a;s<r.length;s++)u.push("..");return(u=u.concat(i.slice(a))).join("/")}function FC(t){var e=OC(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function WC(t,e){var n=OC(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n}function YC(t){return OC(t)[3]}var QC={extname:YC,basename:WC,dirname:FC,sep:"/",delimiter:":",relative:UC,join:BC,isAbsolute:RC,normalize:PC,resolve:zC};function HC(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var GC,ZC="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)},VC=KM(Object.freeze({__proto__:null,resolve:zC,normalize:PC,isAbsolute:RC,join:BC,relative:UC,sep:"/",delimiter:":",dirname:FC,basename:WC,extname:YC,default:QC}));function qC(){if(void 0===GC){var t=new ArrayBuffer(2),e=new Uint8Array(t),n=new Uint16Array(t);if(e[0]=1,e[1]=2,258===n[0])GC="BE";else{if(513!==n[0])throw new Error("unable to figure out endianess");GC="LE"}}return GC}function JC(){return void 0!==XM.location?XM.location.hostname:""}function KC(){return[]}function XC(){return 0}function $C(){return Number.MAX_VALUE}function tD(){return Number.MAX_VALUE}function eD(){return[]}function nD(){return"Browser"}function rD(){return void 0!==XM.navigator?XM.navigator.appVersion:""}function iD(){return{}}function oD(){return{}}function aD(){return"javascript"}function sD(){return"browser"}function uD(){return"/tmp"}var cD=uD;function lD(){return"$HOME"}var hD,dD,fD,pD,mD,gD,yD,bD,vD,wD,MD={homedir:lD,EOL:"\n",arch:aD,platform:sD,tmpdir:cD,tmpDir:uD,networkInterfaces:iD,getNetworkInterfaces:oD,release:rD,type:nD,cpus:eD,totalmem:tD,freemem:$C,uptime:XC,loadavg:KC,hostname:JC,endianness:qC},_D=KM(Object.freeze({__proto__:null,endianness:qC,hostname:JC,loadavg:KC,uptime:XC,freemem:$C,totalmem:tD,cpus:eD,type:nD,release:rD,networkInterfaces:iD,getNetworkInterfaces:oD,arch:aD,platform:sD,tmpDir:uD,tmpdir:cD,EOL:"\n",homedir:lD,default:MD}));function ED(){if(dD)return hD;dD=1;var t=jC,e=VC,n=_D,r="function"==typeof __webpack_require__?__non_webpack_require__:nE,i=hS.config&&hS.config.variables||{},o=!!hS.env.PREBUILDS_ONLY,a=hS.versions.modules,s=!(!hS.versions||!hS.versions.electron)||!!hS.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":hS.versions&&hS.versions.nw?"node-webkit":"node",u=hS.env.npm_config_arch||n.arch(),c=hS.env.npm_config_platform||n.platform(),l=hS.env.LIBC||(function(e){return"linux"===e&&t.existsSync("/etc/alpine-release")}(c)?"musl":"glibc"),h=hS.env.ARM_VERSION||("arm64"===u?"8":i.arm_version)||"",d=(hS.versions.uv||"").split(".")[0];function f(t){return r(f.path(t))}function p(e){try{return t.readdirSync(e)}catch(t){return[]}}function m(t,n){var r=p(t).filter(n);return r[0]&&e.join(t,r[0])}function g(t){return/\.node$/.test(t)}function y(t){var e=t.split("-");if(2===e.length){var n=e[0],r=e[1].split("+");if(n&&r.length&&r.every(Boolean))return{name:t,platform:n,architectures:r}}}function b(t,e){return function(n){return null!=n&&(n.platform===t&&n.architectures.includes(e))}}function v(t,e){return t.architectures.length-e.architectures.length}function w(t){var e=t.split("."),n={file:t,specificity:0};if("node"===e.pop()){for(var r=0;r<e.length;r++){var i=e[r];if("node"===i||"electron"===i||"node-webkit"===i)n.runtime=i;else if("napi"===i)n.napi=!0;else if("abi"===i.slice(0,3))n.abi=i.slice(3);else if("uv"===i.slice(0,2))n.uv=i.slice(2);else if("armv"===i.slice(0,4))n.armv=i.slice(4);else{if("glibc"!==i&&"musl"!==i)continue;n.libc=i}n.specificity++}return n}}function M(t,e){return function(n){return null!=n&&(!(n.runtime!==t&&!function(t){return"node"===t.runtime&&t.napi}(n))&&(!(n.abi!==e&&!n.napi)&&((!n.uv||n.uv===d)&&((!n.armv||n.armv===h)&&(!n.libc||n.libc===l)))))}}function _(t){return function(e,n){return e.runtime!==n.runtime?e.runtime===t?-1:1:e.abi!==n.abi?e.abi?-1:1:e.specificity!==n.specificity?e.specificity>n.specificity?-1:1:0}}return hD=f,f.path=function(t){t=e.resolve(t||".");try{var n=r(e.join(t,"package.json")).name.toUpperCase().replace(/-/g,"_");hS.env[n+"_PREBUILD"]&&(t=hS.env[n+"_PREBUILD"])}catch(t){}if(!o){var i=m(e.join(t,"build/Release"),g);if(i)return i;var f=m(e.join(t,"build/Debug"),g);if(f)return f}var E=S(t);if(E)return E;var N=S(e.dirname(hS.execPath));if(N)return N;var L=["platform="+c,"arch="+u,"runtime="+s,"abi="+a,"uv="+d,h?"armv="+h:"","libc="+l,"node="+hS.versions.node,hS.versions.electron?"electron="+hS.versions.electron:"","function"==typeof __webpack_require__?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+L+"\n loaded from: "+t+"\n");function S(t){var n=p(e.join(t,"prebuilds")).map(y).filter(b(c,u)).sort(v)[0];if(n){var r=e.join(t,"prebuilds",n.name),i=p(r).map(w).filter(M(s,a)).sort(_(s))[0];return i?e.join(r,i.file):void 0}}},f.parseTags=w,f.matchTags=M,f.compareTags=_,f.parseTuple=y,f.matchTuple=b,f.compareTuples=v,hD}function ND(){return mD||(mD=1,function(t){try{t.exports=ED()(IC)}catch(e){t.exports=(pD||(pD=1,fD={mask:(t,e,n,r,i)=>{for(var o=0;o<i;o++)n[r+o]=t[o]^e[3&o]},unmask:(t,e)=>{const n=t.length;for(var r=0;r<n;r++)t[r]^=e[3&r]}}),fD)}}(kC)),kC.exports}function LD(){if(gD)return xC.exports;gD=1;const{EMPTY_BUFFER:t}=TC();function e(t,e,n,r,i){for(let o=0;o<i;o++)n[r+o]=t[o]^e[3&o]}function n(t,e){for(let n=0;n<t.length;n++)t[n]^=e[3&n]}if(xC.exports={concat:function(e,n){if(0===e.length)return t;if(1===e.length)return e[0];const r=f_.allocUnsafe(n);let i=0;for(let t=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return i<n?r.slice(0,i):r},mask:e,toArrayBuffer:function(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)},toBuffer:function t(e){if(t.readOnly=!0,f_.isBuffer(e))return e;let n;return e instanceof ArrayBuffer?n=f_.from(e):ArrayBuffer.isView(e)?n=f_.from(e.buffer,e.byteOffset,e.byteLength):(n=f_.from(e),t.readOnly=!1),n},unmask:n},!hS.env.WS_NO_BUFFER_UTIL)try{const t=ND();xC.exports.mask=function(n,r,i,o,a){a<48?e(n,r,i,o,a):t.mask(n,r,i,o,a)},xC.exports.unmask=function(e,r){e.length<32?n(e,r):t.unmask(e,r)}}catch(t){}return xC.exports}function SD(){if(wD)return vD;wD=1;const t=AC,e=LD(),n=function(){if(bD)return yD;bD=1;const t=Symbol("kDone"),e=Symbol("kRun");return yD=class{constructor(n){this[t]=()=>{this.pending--,this[e]()},this.concurrency=n||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[e]()}[e](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[t])}}}}(),{kStatusCode:r}=TC(),i=f_.from([0,0,255,255]),o=Symbol("permessage-deflate"),a=Symbol("total-length"),s=Symbol("callback"),u=Symbol("buffers"),c=Symbol("error");let l;function h(t){this[u].push(t),this[a]+=t.length}function d(t){this[a]+=t.length,this[o]._maxPayload<1||this[a]<=this[o]._maxPayload?this[u].push(t):(this[c]=new RangeError("Max payload size exceeded"),this[c].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[c][r]=1009,this.removeListener("data",d),this.reset())}function f(t){this[o]._inflate=null,t[r]=1007,this[s](t)}return vD=class{constructor(t,e,r){if(this._maxPayload=0|r,this._options=t||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!e,this._deflate=null,this._inflate=null,this.params=null,!l){const t=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;l=new n(t)}}static get extensionName(){return"permessage-deflate"}offer(){const t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const t=this._deflate[s];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){const e=this._options,n=t.find((t=>!(!1===e.serverNoContextTakeover&&t.server_no_context_takeover||t.server_max_window_bits&&(!1===e.serverMaxWindowBits||"number"==typeof e.serverMaxWindowBits&&e.serverMaxWindowBits>t.server_max_window_bits)||"number"==typeof e.clientMaxWindowBits&&!t.client_max_window_bits)));if(!n)throw new Error("None of the extension offers can be accepted");return e.serverNoContextTakeover&&(n.server_no_context_takeover=!0),e.clientNoContextTakeover&&(n.client_no_context_takeover=!0),"number"==typeof e.serverMaxWindowBits&&(n.server_max_window_bits=e.serverMaxWindowBits),"number"==typeof e.clientMaxWindowBits?n.client_max_window_bits=e.clientMaxWindowBits:!0!==n.client_max_window_bits&&!1!==e.clientMaxWindowBits||delete n.client_max_window_bits,n}acceptAsClient(t){const e=t[0];if(!1===this._options.clientNoContextTakeover&&e.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(e.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&e.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(e.client_max_window_bits=this._options.clientMaxWindowBits);return e}normalizeParams(t){return t.forEach((t=>{Object.keys(t).forEach((e=>{let n=t[e];if(n.length>1)throw new Error(`Parameter "${e}" must have only a single value`);if(n=n[0],"client_max_window_bits"===e){if(!0!==n){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}else if("server_max_window_bits"===e){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else{if("client_no_context_takeover"!==e&&"server_no_context_takeover"!==e)throw new Error(`Unknown parameter "${e}"`);if(!0!==n)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}t[e]=n}))})),t}decompress(t,e,n){l.add((r=>{this._decompress(t,e,((t,e)=>{r(),n(t,e)}))}))}compress(t,e,n){l.add((r=>{this._compress(t,e,((t,e)=>{r(),n(t,e)}))}))}_decompress(n,r,l){const h=this._isServer?"client":"server";if(!this._inflate){const e=`${h}_max_window_bits`,n="number"!=typeof this.params[e]?t.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=t.createInflateRaw({...this._options.zlibInflateOptions,windowBits:n}),this._inflate[o]=this,this._inflate[a]=0,this._inflate[u]=[],this._inflate.on("error",f),this._inflate.on("data",d)}this._inflate[s]=l,this._inflate.write(n),r&&this._inflate.write(i),this._inflate.flush((()=>{const t=this._inflate[c];if(t)return this._inflate.close(),this._inflate=null,void l(t);const n=e.concat(this._inflate[u],this._inflate[a]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[a]=0,this._inflate[u]=[],r&&this.params[`${h}_no_context_takeover`]&&this._inflate.reset()),l(null,n)}))}_compress(n,r,i){const o=this._isServer?"server":"client";if(!this._deflate){const e=`${o}_max_window_bits`,n="number"!=typeof this.params[e]?t.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=t.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:n}),this._deflate[a]=0,this._deflate[u]=[],this._deflate.on("data",h)}this._deflate[s]=i,this._deflate.write(n),this._deflate.flush(t.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let t=e.concat(this._deflate[u],this._deflate[a]);r&&(t=t.slice(0,t.length-4)),this._deflate[s]=null,this._deflate[a]=0,this._deflate[u]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),i(null,t)}))}},vD}var AD,xD,TD,ID,kD,jD,CD,DD,OD,zD,PD,RD,BD,UD,FD,WD,YD,QD,HD,GD,ZD,VD,qD,JD={exports:{}},KD="/Users/sebastian/Work/DePay/solana-web3.js/node_modules/utf-8-validate",XD={exports:{}};function $D(){return TD||(TD=1,function(t){try{t.exports=ED()(KD)}catch(e){t.exports=(xD||(xD=1,AD=function(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0}),AD)}}(XD)),XD.exports}function tO(){if(ID)return JD.exports;ID=1;function t(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0}if(JD.exports={isValidStatusCode:function(t){return t>=1e3&&t<=1014&&1004!==t&&1005!==t&&1006!==t||t>=3e3&&t<=4999},isValidUTF8:t,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},!hS.env.WS_NO_UTF_8_VALIDATE)try{const e=$D();JD.exports.isValidUTF8=function(n){return n.length<150?t(n):e(n)}}catch(t){}return JD.exports}function eO(){if(jD)return kD;jD=1;const{Writable:t}=uT,e=SD(),{BINARY_TYPES:n,EMPTY_BUFFER:r,kStatusCode:i,kWebSocket:o}=TC(),{concat:a,toArrayBuffer:s,unmask:u}=LD(),{isValidStatusCode:c,isValidUTF8:l}=tO();function h(t,e,n,r,o){const a=new t(n?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(a,h),a.code=o,a[i]=r,a}return kD=class extends t{constructor(t={}){super(),this._binaryType=t.binaryType||n[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=0|t.maxPayload,this._skipUTF8Validation=!!t.skipUTF8Validation,this[o]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(t,e,n){if(8===this._opcode&&0==this._state)return n();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){const e=this._buffers[0];return this._buffers[0]=e.slice(t),e.slice(0,t)}const e=f_.allocUnsafe(t);do{const n=this._buffers[0],r=e.length-t;t>=n.length?e.set(this._buffers.shift(),r):(e.set(new Uint8Array(n.buffer,n.byteOffset,t),r),this._buffers[0]=n.slice(t)),t-=n.length}while(t>0);return e}startLoop(t){let e;this._loop=!0;do{switch(this._state){case 0:e=this.getInfo();break;case 1:e=this.getPayloadLength16();break;case 2:e=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:e=this.getData(t);break;default:return void(this._loop=!1)}}while(this._loop);t(e)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(0!=(48&t[0]))return this._loop=!1,h(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const n=64==(64&t[0]);if(n&&!this._extensions[e.extensionName])return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(n)return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,h(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,h(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=n}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,h(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,h(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(n)return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,h(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&t[1]),this._isServer){if(!this._masked)return this._loop=!1,h(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,h(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),e=t.readUInt32BE(0);return e>Math.pow(2,21)-1?(this._loop=!1,h(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=e*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,h(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(t){let e=r;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);e=this.consume(this._payloadLength),this._masked&&0!=(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])&&u(e,this._mask)}return this._opcode>7?this.controlMessage(e):this._compressed?(this._state=5,void this.decompress(e,t)):(e.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(e)),this.dataMessage())}decompress(t,n){this._extensions[e.extensionName].decompress(t,this._fin,((t,e)=>{if(t)return n(t);if(e.length){if(this._messageLength+=e.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return n(h(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(e)}const r=this.dataMessage();if(r)return n(r);this.startLoop(n)}))}dataMessage(){if(this._fin){const t=this._messageLength,e=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let n;n="nodebuffer"===this._binaryType?a(e,t):"arraybuffer"===this._binaryType?s(a(e,t)):e,this.emit("message",n,!0)}else{const n=a(e,t);if(!this._skipUTF8Validation&&!l(n))return this._loop=!1,h(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",n,!1)}}this._state=0}controlMessage(t){if(8===this._opcode)if(this._loop=!1,0===t.length)this.emit("conclude",1005,r),this.end();else{if(1===t.length)return h(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const e=t.readUInt16BE(0);if(!c(e))return h(RangeError,`invalid status code ${e}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const n=t.slice(2);if(!this._skipUTF8Validation&&!l(n))return h(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",e,n),this.end()}}else 9===this._opcode?this.emit("ping",t):this.emit("pong",t);this._state=0}},kD}function nO(){if(DD)return CD;DD=1;const{randomFillSync:t}=iE,e=SD(),{EMPTY_BUFFER:n}=TC(),{isValidStatusCode:r}=tO(),{mask:i,toBuffer:o}=LD(),a=Symbol("kByteLength"),s=f_.alloc(4);class u{constructor(t,e,n){this._extensions=e||{},n&&(this._generateMask=n,this._maskBuffer=f_.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,n){let r,o,u=!1,c=2,l=!1;n.mask&&(r=n.maskBuffer||s,n.generateMask?n.generateMask(r):t(r,0,4),l=0==(r[0]|r[1]|r[2]|r[3]),c=6),"string"==typeof e?o=n.mask&&!l||void 0===n[a]?(e=f_.from(e)).length:n[a]:(o=e.length,u=n.mask&&n.readOnly&&!l);let h=o;o>=65536?(c+=8,h=127):o>125&&(c+=2,h=126);const d=f_.allocUnsafe(u?o+c:c);return d[0]=n.fin?128|n.opcode:n.opcode,n.rsv1&&(d[0]|=64),d[1]=h,126===h?d.writeUInt16BE(o,2):127===h&&(d[2]=d[3]=0,d.writeUIntBE(o,4,6)),n.mask?(d[1]|=128,d[c-4]=r[0],d[c-3]=r[1],d[c-2]=r[2],d[c-1]=r[3],l?[d,e]:u?(i(e,r,d,c,o),[d]):(i(e,r,e,0,o),[d,e])):[d,e]}close(t,e,i,o){let s;if(void 0===t)s=n;else{if("number"!=typeof t||!r(t))throw new TypeError("First argument must be a valid error code number");if(void 0!==e&&e.length){const n=f_.byteLength(e);if(n>123)throw new RangeError("The message must not be greater than 123 bytes");s=f_.allocUnsafe(2+n),s.writeUInt16BE(t,0),"string"==typeof e?s.write(e,2):s.set(e,2)}else s=f_.allocUnsafe(2),s.writeUInt16BE(t,0)}const c={[a]:s.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,s,!1,c,o]):this.sendFrame(u.frame(s,c),o)}ping(t,e,n){let r,i;if("string"==typeof t?(r=f_.byteLength(t),i=!1):(r=(t=o(t)).length,i=o.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const s={[a]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(u.frame(t,s),n)}pong(t,e,n){let r,i;if("string"==typeof t?(r=f_.byteLength(t),i=!1):(r=(t=o(t)).length,i=o.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const s={[a]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(u.frame(t,s),n)}send(t,n,r){const i=this._extensions[e.extensionName];let s,c,l=n.binary?2:1,h=n.compress;if("string"==typeof t?(s=f_.byteLength(t),c=!1):(s=(t=o(t)).length,c=o.readOnly),this._firstFragment?(this._firstFragment=!1,h&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(h=s>=i._threshold),this._compress=h):(h=!1,l=0),n.fin&&(this._firstFragment=!0),i){const e={[a]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:l,readOnly:c,rsv1:h};this._deflating?this.enqueue([this.dispatch,t,this._compress,e,r]):this.dispatch(t,this._compress,e,r)}else this.sendFrame(u.frame(t,{[a]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:l,readOnly:c,rsv1:!1}),r)}dispatch(t,n,r,i){if(!n)return void this.sendFrame(u.frame(t,r),i);const o=this._extensions[e.extensionName];this._bufferedBytes+=r[a],this._deflating=!0,o.compress(t,r.fin,((t,e)=>{if(this._socket.destroyed){const t=new Error("The socket was closed while data was being compressed");"function"==typeof i&&i(t);for(let e=0;e<this._queue.length;e++){const n=this._queue[e],r=n[n.length-1];"function"==typeof r&&r(t)}}else this._bufferedBytes-=r[a],this._deflating=!1,r.readOnly=!1,this.sendFrame(u.frame(e,r),i),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const t=this._queue.shift();this._bufferedBytes-=t[3][a],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][a],this._queue.push(t)}sendFrame(t,e){2===t.length?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],e),this._socket.uncork()):this._socket.write(t[0],e)}}return CD=u}function rO(){if(RD)return PD;RD=1;const{tokenChars:t}=tO();function e(t,e,n){void 0===t[e]?t[e]=[n]:t[e].push(n)}return PD={format:function(t){return Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>[e].concat(Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>!0===t?e:`${e}=${t}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(n){const r=Object.create(null);let i,o,a=Object.create(null),s=!1,u=!1,c=!1,l=-1,h=-1,d=-1,f=0;for(;f<n.length;f++)if(h=n.charCodeAt(f),void 0===i)if(-1===d&&1===t[h])-1===l&&(l=f);else if(0===f||32!==h&&9!==h){if(59!==h&&44!==h)throw new SyntaxError(`Unexpected character at index ${f}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===d&&(d=f);const t=n.slice(l,d);44===h?(e(r,t,a),a=Object.create(null)):i=t,l=d=-1}}else-1===d&&-1!==l&&(d=f);else if(void 0===o)if(-1===d&&1===t[h])-1===l&&(l=f);else if(32===h||9===h)-1===d&&-1!==l&&(d=f);else if(59===h||44===h){if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===d&&(d=f),e(a,n.slice(l,d),!0),44===h&&(e(r,i,a),a=Object.create(null),i=void 0),l=d=-1}else{if(61!==h||-1===l||-1!==d)throw new SyntaxError(`Unexpected character at index ${f}`);o=n.slice(l,f),l=d=-1}else if(u){if(1!==t[h])throw new SyntaxError(`Unexpected character at index ${f}`);-1===l?l=f:s||(s=!0),u=!1}else if(c)if(1===t[h])-1===l&&(l=f);else if(34===h&&-1!==l)c=!1,d=f;else{if(92!==h)throw new SyntaxError(`Unexpected character at index ${f}`);u=!0}else if(34===h&&61===n.charCodeAt(f-1))c=!0;else if(-1===d&&1===t[h])-1===l&&(l=f);else if(-1===l||32!==h&&9!==h){if(59!==h&&44!==h)throw new SyntaxError(`Unexpected character at index ${f}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===d&&(d=f);let t=n.slice(l,d);s&&(t=t.replace(/\\/g,""),s=!1),e(a,o,t),44===h&&(e(r,i,a),a=Object.create(null),i=void 0),o=void 0,l=d=-1}}else-1===d&&(d=f);if(-1===l||c||32===h||9===h)throw new SyntaxError("Unexpected end of input");-1===d&&(d=f);const p=n.slice(l,d);return void 0===i?e(r,p,a):(void 0===o?e(a,p,!0):e(a,o,s?p.replace(/\\/g,""):p),e(r,i,a)),r}},PD}function iO(){if(UD)return BD;UD=1;const t=MS,e=Xx,n=oT,r=aT,i=sT,{randomBytes:o,createHash:a}=iE,{URL:s}=cT,u=SD(),c=eO(),l=nO(),{BINARY_TYPES:h,EMPTY_BUFFER:d,GUID:f,kForOnEventAttribute:p,kListener:m,kStatusCode:g,kWebSocket:y,NOOP:b}=TC(),{EventTarget:{addEventListener:v,removeEventListener:w}}=function(){if(zD)return OD;zD=1;const{kForOnEventAttribute:t,kListener:e}=TC(),n=Symbol("kCode"),r=Symbol("kData"),i=Symbol("kError"),o=Symbol("kMessage"),a=Symbol("kReason"),s=Symbol("kTarget"),u=Symbol("kType"),c=Symbol("kWasClean");class l{constructor(t){this[s]=null,this[u]=t}get target(){return this[s]}get type(){return this[u]}}Object.defineProperty(l.prototype,"target",{enumerable:!0}),Object.defineProperty(l.prototype,"type",{enumerable:!0});class h extends l{constructor(t,e={}){super(t),this[n]=void 0===e.code?0:e.code,this[a]=void 0===e.reason?"":e.reason,this[c]=void 0!==e.wasClean&&e.wasClean}get code(){return this[n]}get reason(){return this[a]}get wasClean(){return this[c]}}Object.defineProperty(h.prototype,"code",{enumerable:!0}),Object.defineProperty(h.prototype,"reason",{enumerable:!0}),Object.defineProperty(h.prototype,"wasClean",{enumerable:!0});class d extends l{constructor(t,e={}){super(t),this[i]=void 0===e.error?null:e.error,this[o]=void 0===e.message?"":e.message}get error(){return this[i]}get message(){return this[o]}}Object.defineProperty(d.prototype,"error",{enumerable:!0}),Object.defineProperty(d.prototype,"message",{enumerable:!0});class f extends l{constructor(t,e={}){super(t),this[r]=void 0===e.data?null:e.data}get data(){return this[r]}}Object.defineProperty(f.prototype,"data",{enumerable:!0});const p={addEventListener(n,r,i={}){let o;if("message"===n)o=function(t,e){const n=new f("message",{data:e?t:t.toString()});n[s]=this,r.call(this,n)};else if("close"===n)o=function(t,e){const n=new h("close",{code:t,reason:e.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});n[s]=this,r.call(this,n)};else if("error"===n)o=function(t){const e=new d("error",{error:t,message:t.message});e[s]=this,r.call(this,e)};else{if("open"!==n)return;o=function(){const t=new l("open");t[s]=this,r.call(this,t)}}o[t]=!!i[t],o[e]=r,i.once?this.once(n,o):this.on(n,o)},removeEventListener(n,r){for(const i of this.listeners(n))if(i[e]===r&&!i[t]){this.removeListener(n,i);break}}};return OD={CloseEvent:h,ErrorEvent:d,Event:l,EventTarget:p,MessageEvent:f}}(),{format:M,parse:_}=rO(),{toBuffer:E}=LD(),N=Symbol("kAborted"),L=[8,13],S=["CONNECTING","OPEN","CLOSING","CLOSED"],A=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class x extends t{constructor(t,e,n){super(),this._binaryType=h[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=d,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=x.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==t?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===e?e=[]:Array.isArray(e)||("object"==typeof e&&null!==e?(n=e,e=[]):e=[e]),T(this,t,e,n)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(t){h.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,e,n){const r=new c({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation});this._sender=new l(t,this._extensions,n.generateMask),this._receiver=r,this._socket=t,r[y]=this,t[y]=this,r.on("conclude",O),r.on("drain",z),r.on("error",P),r.on("message",B),r.on("ping",U),r.on("pong",F),t.setTimeout(0),t.setNoDelay(),e.length>0&&t.unshift(e),t.on("close",Y),t.on("data",Q),t.on("end",H),t.on("error",G),this._readyState=x.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=x.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=x.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,e){if(this.readyState!==x.CLOSED){if(this.readyState===x.CONNECTING){const t="WebSocket was closed before the connection was established";return C(this,this._req,t)}this.readyState!==x.CLOSING?(this._readyState=x.CLOSING,this._sender.close(t,e,!this._isServer,(t=>{t||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==x.CONNECTING&&this.readyState!==x.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,e,n){if(this.readyState===x.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===x.OPEN?(void 0===e&&(e=!this._isServer),this._sender.ping(t||d,e,n)):D(this,t,n)}pong(t,e,n){if(this.readyState===x.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===x.OPEN?(void 0===e&&(e=!this._isServer),this._sender.pong(t||d,e,n)):D(this,t,n)}resume(){this.readyState!==x.CONNECTING&&this.readyState!==x.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,e,n){if(this.readyState===x.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof e&&(n=e,e={}),"number"==typeof t&&(t=t.toString()),this.readyState!==x.OPEN)return void D(this,t,n);const r={binary:"string"!=typeof t,mask:!this._isServer,compress:!0,fin:!0,...e};this._extensions[u.extensionName]||(r.compress=!1),this._sender.send(t||d,r,n)}terminate(){if(this.readyState!==x.CLOSED){if(this.readyState===x.CONNECTING){const t="WebSocket was closed before the connection was established";return C(this,this._req,t)}this._socket&&(this._readyState=x.CLOSING,this._socket.destroy())}}}function T(t,r,i,c){const l={protocolVersion:L[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...c,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!L.includes(l.protocolVersion))throw new RangeError(`Unsupported protocol version: ${l.protocolVersion} (supported versions: ${L.join(", ")})`);let h;if(r instanceof s)h=r,t._url=r.href;else{try{h=new s(r)}catch(t){throw new SyntaxError(`Invalid URL: ${r}`)}t._url=r}const d="wss:"===h.protocol,p="ws+unix:"===h.protocol;let m;if("ws:"===h.protocol||d||p?p&&!h.pathname?m="The URL's pathname is empty":h.hash&&(m="The URL contains a fragment identifier"):m='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',m){const e=new SyntaxError(m);if(0===t._redirects)throw e;return void I(t,e)}const g=d?443:80,y=o(16).toString("base64"),b=d?e.request:n.request,v=new Set;let w,E;if(l.createConnection=d?j:k,l.defaultPort=l.defaultPort||g,l.port=h.port||g,l.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,l.headers={"Sec-WebSocket-Version":l.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket",...l.headers},l.path=h.pathname+h.search,l.timeout=l.handshakeTimeout,l.perMessageDeflate&&(w=new u(!0!==l.perMessageDeflate?l.perMessageDeflate:{},!1,l.maxPayload),l.headers["Sec-WebSocket-Extensions"]=M({[u.extensionName]:w.offer()})),i.length){for(const t of i){if("string"!=typeof t||!A.test(t)||v.has(t))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(t)}l.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(l.origin&&(l.protocolVersion<13?l.headers["Sec-WebSocket-Origin"]=l.origin:l.headers.Origin=l.origin),(h.username||h.password)&&(l.auth=`${h.username}:${h.password}`),p){const t=l.path.split(":");l.socketPath=t[0],l.path=t[1]}if(l.followRedirects){if(0===t._redirects){t._originalSecure=d,t._originalHost=h.host;const e=c&&c.headers;if(c={...c,headers:{}},e)for(const[t,n]of Object.entries(e))c.headers[t.toLowerCase()]=n}else if(0===t.listenerCount("redirect")){const e=h.host===t._originalHost;(!e||t._originalSecure&&!d)&&(delete l.headers.authorization,delete l.headers.cookie,e||delete l.headers.host,l.auth=void 0)}l.auth&&!c.headers.authorization&&(c.headers.authorization="Basic "+f_.from(l.auth).toString("base64")),E=t._req=b(l),t._redirects&&t.emit("redirect",t.url,E)}else E=t._req=b(l);l.timeout&&E.on("timeout",(()=>{C(t,E,"Opening handshake has timed out")})),E.on("error",(e=>{null===E||E[N]||(E=t._req=null,I(t,e))})),E.on("response",(e=>{const n=e.headers.location,o=e.statusCode;if(n&&l.followRedirects&&o>=300&&o<400){if(++t._redirects>l.maxRedirects)return void C(t,E,"Maximum redirects exceeded");let e;E.abort();try{e=new s(n,r)}catch(e){const r=new SyntaxError(`Invalid URL: ${n}`);return void I(t,r)}T(t,e,i,c)}else t.emit("unexpected-response",E,e)||C(t,E,`Unexpected server response: ${e.statusCode}`)})),E.on("upgrade",((e,n,r)=>{if(t.emit("upgrade",e),t.readyState!==x.CONNECTING)return;if(E=t._req=null,"websocket"!==e.headers.upgrade.toLowerCase())return void C(t,n,"Invalid Upgrade header");const i=a("sha1").update(y+f).digest("base64");if(e.headers["sec-websocket-accept"]!==i)return void C(t,n,"Invalid Sec-WebSocket-Accept header");const o=e.headers["sec-websocket-protocol"];let s;if(void 0!==o?v.size?v.has(o)||(s="Server sent an invalid subprotocol"):s="Server sent a subprotocol but none was requested":v.size&&(s="Server sent no subprotocol"),s)return void C(t,n,s);o&&(t._protocol=o);const c=e.headers["sec-websocket-extensions"];if(void 0!==c){if(!w){return void C(t,n,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let e;try{e=_(c)}catch(e){return void C(t,n,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(e);if(1!==r.length||r[0]!==u.extensionName){return void C(t,n,"Server indicated an extension that was not requested")}try{w.accept(e[u.extensionName])}catch(e){return void C(t,n,"Invalid Sec-WebSocket-Extensions header")}t._extensions[u.extensionName]=w}t.setSocket(n,r,{generateMask:l.generateMask,maxPayload:l.maxPayload,skipUTF8Validation:l.skipUTF8Validation})})),E.end()}function I(t,e){t._readyState=x.CLOSING,t.emit("error",e),t.emitClose()}function k(t){return t.path=t.socketPath,r.connect(t)}function j(t){return t.path=void 0,t.servername||""===t.servername||(t.servername=r.isIP(t.host)?"":t.host),i.connect(t)}function C(t,e,n){t._readyState=x.CLOSING;const r=new Error(n);Error.captureStackTrace(r,C),e.setHeader?(e[N]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),hS.nextTick(I,t,r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function D(t,e,n){if(e){const n=E(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(n){n(new Error(`WebSocket is not open: readyState ${t.readyState} (${S[t.readyState]})`))}}function O(t,e){const n=this[y];n._closeFrameReceived=!0,n._closeMessage=e,n._closeCode=t,void 0!==n._socket[y]&&(n._socket.removeListener("data",Q),hS.nextTick(W,n._socket),1005===t?n.close():n.close(t,e))}function z(){const t=this[y];t.isPaused||t._socket.resume()}function P(t){const e=this[y];void 0!==e._socket[y]&&(e._socket.removeListener("data",Q),hS.nextTick(W,e._socket),e.close(t[g])),e.emit("error",t)}function R(){this[y].emitClose()}function B(t,e){this[y].emit("message",t,e)}function U(t){const e=this[y];e.pong(t,!e._isServer,b),e.emit("ping",t)}function F(t){this[y].emit("pong",t)}function W(t){t.resume()}function Y(){const t=this[y];let e;this.removeListener("close",Y),this.removeListener("data",Q),this.removeListener("end",H),t._readyState=x.CLOSING,this._readableState.endEmitted||t._closeFrameReceived||t._receiver._writableState.errorEmitted||null===(e=t._socket.read())||t._receiver.write(e),t._receiver.end(),this[y]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",R),t._receiver.on("finish",R))}function Q(t){this[y]._receiver.write(t)||this.pause()}function H(){const t=this[y];t._readyState=x.CLOSING,t._receiver.end(),this.end()}function G(){const t=this[y];this.removeListener("error",G),this.on("error",b),t&&(t._readyState=x.CLOSING,this.destroy())}return Object.defineProperty(x,"CONNECTING",{enumerable:!0,value:S.indexOf("CONNECTING")}),Object.defineProperty(x.prototype,"CONNECTING",{enumerable:!0,value:S.indexOf("CONNECTING")}),Object.defineProperty(x,"OPEN",{enumerable:!0,value:S.indexOf("OPEN")}),Object.defineProperty(x.prototype,"OPEN",{enumerable:!0,value:S.indexOf("OPEN")}),Object.defineProperty(x,"CLOSING",{enumerable:!0,value:S.indexOf("CLOSING")}),Object.defineProperty(x.prototype,"CLOSING",{enumerable:!0,value:S.indexOf("CLOSING")}),Object.defineProperty(x,"CLOSED",{enumerable:!0,value:S.indexOf("CLOSED")}),Object.defineProperty(x.prototype,"CLOSED",{enumerable:!0,value:S.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((t=>{Object.defineProperty(x.prototype,t,{enumerable:!0})})),["open","error","close","message"].forEach((t=>{Object.defineProperty(x.prototype,`on${t}`,{enumerable:!0,get(){for(const e of this.listeners(t))if(e[p])return e[m];return null},set(e){for(const e of this.listeners(t))if(e[p]){this.removeListener(t,e);break}"function"==typeof e&&this.addEventListener(t,e,{[p]:!0})}})})),x.prototype.addEventListener=v,x.prototype.removeEventListener=w,BD=x}function oO(){if(QD)return YD;QD=1;const{tokenChars:t}=tO();return YD={parse:function(e){const n=new Set;let r=-1,i=-1,o=0;for(;o<e.length;o++){const a=e.charCodeAt(o);if(-1===i&&1===t[a])-1===r&&(r=o);else if(0===o||32!==a&&9!==a){if(44!==a)throw new SyntaxError(`Unexpected character at index ${o}`);{if(-1===r)throw new SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);const t=e.slice(r,i);if(n.has(t))throw new SyntaxError(`The "${t}" subprotocol is duplicated`);n.add(t),r=i=-1}}else-1===i&&-1!==r&&(i=o)}if(-1===r||-1!==i)throw new SyntaxError("Unexpected end of input");const a=e.slice(r,o);if(n.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return n.add(a),n}},YD}function aO(){if(GD)return HD;GD=1;const t=MS,e=oT,{createHash:n}=iE,r=rO(),i=SD(),o=oO(),a=iO(),{GUID:s,kWebSocket:u}=TC(),c=/^[+/0-9A-Za-z]{22}==$/,l=2;function h(t){t._state=l,t.emit("close")}function d(){this.destroy()}function f(t,n,r,i){r=r||e.STATUS_CODES[n],i={Connection:"close","Content-Type":"text/html","Content-Length":f_.byteLength(r),...i},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${n} ${e.STATUS_CODES[n]}\r\n`+Object.keys(i).map((t=>`${t}: ${i[t]}`)).join("\r\n")+"\r\n\r\n"+r)}function p(t,e,n,r,i){if(t.listenerCount("wsClientError")){const r=new Error(i);Error.captureStackTrace(r,p),t.emit("wsClientError",r,n,e)}else f(n,r,i)}return HD=class extends t{constructor(t,n){if(super(),null==(t={maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:a,...t}).port&&!t.server&&!t.noServer||null!=t.port&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=t.port?(this._server=e.createServer(((t,n)=>{const r=e.STATUS_CODES[426];n.writeHead(426,{"Content-Length":r.length,"Content-Type":"text/plain"}),n.end(r)})),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){const t=this.emit.bind(this,"connection");this._removeListeners=function(t,e){for(const n of Object.keys(e))t.on(n,e[n]);return function(){for(const n of Object.keys(e))t.removeListener(n,e[n])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(e,n,r)=>{this.handleUpgrade(e,n,r,t)}})}!0===t.perMessageDeflate&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===l)return t&&this.once("close",(()=>{t(new Error("The server is not running"))})),void hS.nextTick(h,this);if(t&&this.once("close",t),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:hS.nextTick(h,this);else{const t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close((()=>{h(this)}))}}shouldHandle(t){if(this.options.path){const e=t.url.indexOf("?");if((-1!==e?t.url.slice(0,e):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,e,n,a){e.on("error",d);const s=t.headers["sec-websocket-key"],u=+t.headers["sec-websocket-version"];if("GET"!==t.method){return void p(this,t,e,405,"Invalid HTTP method")}if("websocket"!==t.headers.upgrade.toLowerCase()){return void p(this,t,e,400,"Invalid Upgrade header")}if(!s||!c.test(s)){return void p(this,t,e,400,"Missing or invalid Sec-WebSocket-Key header")}if(8!==u&&13!==u){return void p(this,t,e,400,"Missing or invalid Sec-WebSocket-Version header")}if(!this.shouldHandle(t))return void f(e,400);const l=t.headers["sec-websocket-protocol"];let h=new Set;if(void 0!==l)try{h=o.parse(l)}catch(n){return void p(this,t,e,400,"Invalid Sec-WebSocket-Protocol header")}const m=t.headers["sec-websocket-extensions"],g={};if(this.options.perMessageDeflate&&void 0!==m){const n=new i(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=r.parse(m);t[i.extensionName]&&(n.accept(t[i.extensionName]),g[i.extensionName]=n)}catch(n){return void p(this,t,e,400,"Invalid or unacceptable Sec-WebSocket-Extensions header")}}if(this.options.verifyClient){const r={origin:t.headers[""+(8===u?"sec-websocket-origin":"origin")],secure:!(!t.socket.authorized&&!t.socket.encrypted),req:t};if(2===this.options.verifyClient.length)return void this.options.verifyClient(r,((r,i,o,u)=>{if(!r)return f(e,i||401,o,u);this.completeUpgrade(g,s,h,t,e,n,a)}));if(!this.options.verifyClient(r))return f(e,401)}this.completeUpgrade(g,s,h,t,e,n,a)}completeUpgrade(t,e,o,a,c,l,p){if(!c.readable||!c.writable)return c.destroy();if(c[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return f(c,503);const m=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n("sha1").update(e+s).digest("base64")}`],g=new this.options.WebSocket(null);if(o.size){const t=this.options.handleProtocols?this.options.handleProtocols(o,a):o.values().next().value;t&&(m.push(`Sec-WebSocket-Protocol: ${t}`),g._protocol=t)}if(t[i.extensionName]){const e=t[i.extensionName].params,n=r.format({[i.extensionName]:[e]});m.push(`Sec-WebSocket-Extensions: ${n}`),g._extensions=t}this.emit("headers",m,a),c.write(m.concat("\r\n").join("\r\n")),c.removeListener("error",d),g.setSocket(c,l,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(g),g.on("close",(()=>{this.clients.delete(g),this._shouldEmitClose&&!this.clients.size&&hS.nextTick(h,this)}))),p(g,a)}},HD}function sO(){if(VD)return ZD;VD=1;const t=iO();return t.createWebSocketStream=function(){if(WD)return FD;WD=1;const{Duplex:t}=uT;function e(t){t.emit("close")}function n(){!this.destroyed&&this._writableState.finished&&this.destroy()}function r(t){this.removeListener("error",r),this.destroy(),0===this.listenerCount("error")&&this.emit("error",t)}return FD=function(i,o){let a=!0;const s=new t({...o,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return i.on("message",(function(t,e){const n=!e&&s._readableState.objectMode?t.toString():t;s.push(n)||i.pause()})),i.once("error",(function(t){s.destroyed||(a=!1,s.destroy(t))})),i.once("close",(function(){s.destroyed||s.push(null)})),s._destroy=function(t,n){if(i.readyState===i.CLOSED)return n(t),void hS.nextTick(e,s);let r=!1;i.once("error",(function(t){r=!0,n(t)})),i.once("close",(function(){r||n(t),hS.nextTick(e,s)})),a&&i.terminate()},s._final=function(t){i.readyState!==i.CONNECTING?null!==i._socket&&(i._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(i._socket.once("finish",(function(){t()})),i.close())):i.once("open",(function(){s._final(t)}))},s._read=function(){i.isPaused&&i.resume()},s._write=function(t,e,n){i.readyState!==i.CONNECTING?i.send(t,n):i.once("open",(function(){s._write(t,e,n)}))},s.on("end",n),s.on("error",r),s},FD}(),t.Server=aO(),t.Receiver=eO(),t.Sender=nO(),t.WebSocket=t,t.WebSocketServer=t.Server,ZD=t}var uO,cO,lO,hO={},dO={exports:{}};function fO(){return uO||(uO=1,function(t){var e=kL().default;function n(){
55
55
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
56
- t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return x()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function p(){}function m(){}function g(){}var y={};l(y,s,(function(){return this}));var b=Object.getPrototypeOf,v=b&&b(b(A([])));v&&v!==i&&o.call(v,s)&&(y=v);var w=g.prototype=p.prototype=Object.create(y);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,n){function r(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==e(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):n.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;this._invoke=function(t,e){function o(){return new n((function(n,i){r(t,e,n,i)}))}return i=i?i.then(o,o):o()}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=g,l(w,"constructor",g),l(g,"constructor",m),m.displayName=l(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},r.awrap=function(t){return{__await:t}},M(_.prototype),l(_.prototype,u,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new _(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},M(w),l(w,c,"Generator"),l(w,s,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:A(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(dO)),dO.exports}function pO(){if(lO)return cO;lO=1;var t=fO()();cO=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return cO}var mO,gO={exports:{}};function yO(){return mO||(mO=1,function(t){function e(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function s(t){e(a,i,o,s,u,"next",t)}function u(t){e(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(gO)),gO.exports}var bO,vO,wO={exports:{}};function MO(){return bO||(bO=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(wO)),wO.exports}function _O(){return vO||(vO=1,function(t){var e=mL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(pO()),r=e(yO()),i=e(kL()),o=e(ML()),a=e(bL()),s=e(AL()),u=e(zL()),c=e(BL()),l=MO();function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(t){(0,s.default)(f,t);var e,u,c,l,d=h(f);function f(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,f);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,p=r.max_reconnects,m=void 0===p?5:p,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=d.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(f,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=f_.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;i<e.params.length;i++)r.push(e.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[e.id])return e.method&&e.params?Promise.resolve().then((function(){n.emit(e.method,e.params)})):void 0;"error"in e=="result"in e&&n.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[e.id].timeout&&clearTimeout(n.queue[e.id].timeout),e.error?n.queue[e.id].promise[1](e.error):n.queue[e.id].promise[0](e.result),delete n.queue[e.id]})),this.socket.addEventListener("error",(function(t){return n.emit("error",t)})),this.socket.addEventListener("close",(function(r){var i=r.code,o=r.reason;n.ready&&setTimeout((function(){return n.emit("close",i,o)}),0),n.ready=!1,n.socket=void 0,1e3!==i&&(n.current_reconnects++,n.reconnect&&(n.max_reconnects>n.current_reconnects||0===n.max_reconnects)&&setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval))}))}}]),f}(l.EventEmitter);t.default=d}(hO)),hO}var EO,NO={},LO={exports:{}};var SO,AO,xO={exports:{}},TO={exports:{}},IO={exports:{}};function kO(){return SO||(SO=1,function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports}(IO)),IO.exports}function jO(){return AO||(AO=1,function(t){var e=kO();t.exports=function(t){if(Array.isArray(t))return e(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(TO)),TO.exports}var CO,DO={exports:{}};function OO(){return CO||(CO=1,function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(DO)),DO.exports}var zO,PO={exports:{}};function RO(){return zO||(zO=1,function(t){var e=kO();t.exports=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}(PO)),PO.exports}var BO,UO,FO,WO={exports:{}};function YO(){return BO||(BO=1,function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports}(WO)),WO.exports}var QO=new Uint8Array(16);function HO(){if(!FO&&!(FO="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return FO(QO)}var GO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ZO(t){return"string"==typeof t&&GO.test(t)}for(var VO,qO,JO=[],KO=0;KO<256;++KO)JO.push((KO+256).toString(16).substr(1));function XO(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(JO[t[e+0]]+JO[t[e+1]]+JO[t[e+2]]+JO[t[e+3]]+"-"+JO[t[e+4]]+JO[t[e+5]]+"-"+JO[t[e+6]]+JO[t[e+7]]+"-"+JO[t[e+8]]+JO[t[e+9]]+"-"+JO[t[e+10]]+JO[t[e+11]]+JO[t[e+12]]+JO[t[e+13]]+JO[t[e+14]]+JO[t[e+15]]).toLowerCase();if(!ZO(n))throw TypeError("Stringified UUID is invalid");return n}var $O=0,tz=0;function ez(t){if(!ZO(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}var nz="6ba7b810-9dad-11d1-80b4-00c04fd430c8",rz="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function iz(t,e,n){function r(t,r,i,o){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=ez(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+t.length);if(a.set(r),a.set(t,r.length),(a=n(a))[6]=15&a[6]|e,a[8]=63&a[8]|128,i){o=o||0;for(var s=0;s<16;++s)i[o+s]=a[s];return i}return XO(a)}try{r.name=t}catch(t){}return r.DNS=nz,r.URL=rz,r}function oz(t){return 14+(t+64>>>9<<4)+1}function az(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function sz(t,e,n,r,i,o){return az((a=az(az(e,t),az(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function uz(t,e,n,r,i,o,a){return sz(e&n|~e&r,t,e,i,o,a)}function cz(t,e,n,r,i,o,a){return sz(e&r|n&~r,t,e,i,o,a)}function lz(t,e,n,r,i,o,a){return sz(e^n^r,t,e,i,o,a)}function hz(t,e,n,r,i,o,a){return sz(n^(e|~r),t,e,i,o,a)}var dz=iz("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){for(var e=[],n=32*t.length,r="0123456789abcdef",i=0;i<n;i+=8){var o=t[i>>5]>>>i%32&255,a=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);e.push(a)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[oz(e)-1]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,u=r,c=i,l=o;n=uz(n,r,i,o,t[a],7,-680876936),o=uz(o,n,r,i,t[a+1],12,-389564586),i=uz(i,o,n,r,t[a+2],17,606105819),r=uz(r,i,o,n,t[a+3],22,-1044525330),n=uz(n,r,i,o,t[a+4],7,-176418897),o=uz(o,n,r,i,t[a+5],12,1200080426),i=uz(i,o,n,r,t[a+6],17,-1473231341),r=uz(r,i,o,n,t[a+7],22,-45705983),n=uz(n,r,i,o,t[a+8],7,1770035416),o=uz(o,n,r,i,t[a+9],12,-1958414417),i=uz(i,o,n,r,t[a+10],17,-42063),r=uz(r,i,o,n,t[a+11],22,-1990404162),n=uz(n,r,i,o,t[a+12],7,1804603682),o=uz(o,n,r,i,t[a+13],12,-40341101),i=uz(i,o,n,r,t[a+14],17,-1502002290),n=cz(n,r=uz(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=cz(o,n,r,i,t[a+6],9,-1069501632),i=cz(i,o,n,r,t[a+11],14,643717713),r=cz(r,i,o,n,t[a],20,-373897302),n=cz(n,r,i,o,t[a+5],5,-701558691),o=cz(o,n,r,i,t[a+10],9,38016083),i=cz(i,o,n,r,t[a+15],14,-660478335),r=cz(r,i,o,n,t[a+4],20,-405537848),n=cz(n,r,i,o,t[a+9],5,568446438),o=cz(o,n,r,i,t[a+14],9,-1019803690),i=cz(i,o,n,r,t[a+3],14,-187363961),r=cz(r,i,o,n,t[a+8],20,1163531501),n=cz(n,r,i,o,t[a+13],5,-1444681467),o=cz(o,n,r,i,t[a+2],9,-51403784),i=cz(i,o,n,r,t[a+7],14,1735328473),n=lz(n,r=cz(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=lz(o,n,r,i,t[a+8],11,-2022574463),i=lz(i,o,n,r,t[a+11],16,1839030562),r=lz(r,i,o,n,t[a+14],23,-35309556),n=lz(n,r,i,o,t[a+1],4,-1530992060),o=lz(o,n,r,i,t[a+4],11,1272893353),i=lz(i,o,n,r,t[a+7],16,-155497632),r=lz(r,i,o,n,t[a+10],23,-1094730640),n=lz(n,r,i,o,t[a+13],4,681279174),o=lz(o,n,r,i,t[a],11,-358537222),i=lz(i,o,n,r,t[a+3],16,-722521979),r=lz(r,i,o,n,t[a+6],23,76029189),n=lz(n,r,i,o,t[a+9],4,-640364487),o=lz(o,n,r,i,t[a+12],11,-421815835),i=lz(i,o,n,r,t[a+15],16,530742520),n=hz(n,r=lz(r,i,o,n,t[a+2],23,-995338651),i,o,t[a],6,-198630844),o=hz(o,n,r,i,t[a+7],10,1126891415),i=hz(i,o,n,r,t[a+14],15,-1416354905),r=hz(r,i,o,n,t[a+5],21,-57434055),n=hz(n,r,i,o,t[a+12],6,1700485571),o=hz(o,n,r,i,t[a+3],10,-1894986606),i=hz(i,o,n,r,t[a+10],15,-1051523),r=hz(r,i,o,n,t[a+1],21,-2054922799),n=hz(n,r,i,o,t[a+8],6,1873313359),o=hz(o,n,r,i,t[a+15],10,-30611744),i=hz(i,o,n,r,t[a+6],15,-1560198380),r=hz(r,i,o,n,t[a+13],21,1309151649),n=hz(n,r,i,o,t[a+4],6,-145523070),o=hz(o,n,r,i,t[a+11],10,-1120210379),i=hz(i,o,n,r,t[a+2],15,718787259),r=hz(r,i,o,n,t[a+9],21,-343485551),n=az(n,s),r=az(r,u),i=az(i,c),o=az(o,l)}return[n,r,i,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(oz(e)),r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))})),fz=dz;function pz(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function mz(t,e){return t<<e|t>>>32-e}var gz=iz("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var r=unescape(encodeURIComponent(t));t=[];for(var i=0;i<r.length;++i)t.push(r.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,a=Math.ceil(o/16),s=new Array(a),u=0;u<a;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=t[64*u+4*l]<<24|t[64*u+4*l+1]<<16|t[64*u+4*l+2]<<8|t[64*u+4*l+3];s[u]=c}s[a-1][14]=8*(t.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(t.length-1)&4294967295;for(var h=0;h<a;++h){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=s[h][f];for(var p=16;p<80;++p)d[p]=mz(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var m=n[0],g=n[1],y=n[2],b=n[3],v=n[4],w=0;w<80;++w){var M=Math.floor(w/20),_=mz(m,5)+pz(M,g,y,b)+v+e[M]+d[w]>>>0;v=b,b=y,y=mz(g,30)>>>0,g=m,m=_}n[0]=n[0]+m>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+b>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),yz=gz;var bz,vz,wz=Object.freeze({__proto__:null,v1:function(t,e,n){var r=e&&n||0,i=e||new Array(16),o=(t=t||{}).node||VO,a=void 0!==t.clockseq?t.clockseq:qO;if(null==o||null==a){var s=t.random||(t.rng||HO)();null==o&&(o=VO=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=qO=16383&(s[6]<<8|s[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:tz+1,l=u-$O+(c-tz)/1e4;if(l<0&&void 0===t.clockseq&&(a=a+1&16383),(l<0||u>$O)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");$O=u,tz=c,qO=a;var h=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=h>>>24&255,i[r++]=h>>>16&255,i[r++]=h>>>8&255,i[r++]=255&h;var d=u/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var f=0;f<6;++f)i[r+f]=o[f];return e||XO(i)},v3:fz,v4:function(t,e,n){var r=(t=t||{}).random||(t.rng||HO)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return XO(r)},v5:yz,NIL:"00000000-0000-0000-0000-000000000000",version:function(t){if(!ZO(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)},validate:ZO,stringify:XO,parse:ez}),Mz=KM(wz),_z={};function Ez(){return vz||(vz=1,function(t){var e=mL.exports,n=kL();Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=e(pO()),i=e(kL()),o=e(yO()),a=e((EO||(EO=1,function(t){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports}(LO)),LO.exports)),s=e((UO||(UO=1,function(t){var e=jO(),n=OO(),r=RO(),i=YO();t.exports=function(t){return e(t)||n(t)||r(t)||i()},t.exports.__esModule=!0,t.exports.default=t.exports}(xO)),xO.exports)),u=e(ML()),c=e(bL()),l=e(AL()),h=e(zL()),d=e(BL()),f=MO(),p=sO(),m=Mz,g=e(cT),y=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==n(t)&&"function"!=typeof t)return{default:t};var r=b(e);if(r&&r.has(t))return r.get(t);var i={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var s=o?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(i,a,s):i[a]=t[a]}i.default=t,r&&r.set(t,i);return i}(function(){if(bz)return _z;bz=1,Object.defineProperty(_z,"__esModule",{value:!0}),_z.createError=function(e,n){var r={code:e,message:t.get(e)||"Internal Server Error"};return n&&(r.data=n),r};var t=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]);return _z}());function b(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(b=function(t){return t?n:e})(t)}function v(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,d.default)(t);if(e){var i=(0,d.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,h.default)(this,n)}}var _=function(t){(0,l.default)(h,t);var e,n=M(h);function h(t){var e;return(0,u.default)(this,h),(e=n.call(this)).namespaces={},e.wss=new p.Server(t),e.wss.on("listening",(function(){return e.emit("listening")})),e.wss.on("connection",(function(t,n){var r=g.default.parse(n.url,!0),i=r.pathname;return r.query.socket_id?t._id=r.query.socket_id:t._id=(0,m.v1)(),t._authenticated=!1,t.on("error",(function(n){return e.emit("socket-error",t,n)})),t.on("close",(function(){e.namespaces[i].clients.delete(t._id);for(var n=0,r=Object.keys(e.namespaces[i].events);n<r.length;n++){var o=r[n],a=e.namespaces[i].events[o].sockets.indexOf(t._id);a>=0&&e.namespaces[i].events[o].sockets.splice(a,1)}e.emit("disconnection",t)})),e.namespaces[i]||e._generateNamespace(i),e.namespaces[i].clients.set(t._id,t),e.emit("connection",t,n),e._handleRPC(t,i)})),e.wss.on("error",(function(t){return e.emit("error",t)})),e}return(0,c.default)(h,[{key:"register",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/";return this.namespaces[r]||this._generateNamespace(r),this.namespaces[r].rpc_methods[t]={fn:e,protected:!1},{protected:function(){return n._makeProtectedMethod(t,r)},public:function(){return n._makePublicMethod(t,r)}}}},{key:"setAuth",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.register("rpc.login",t,e)}},{key:"_makeProtectedMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!0}},{key:"_makePublicMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!1}},{key:"_makeProtectedEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!0}},{key:"_makePublicEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!1}},{key:"closeNamespace",value:function(t){var e=this.namespaces[t];if(e){delete e.rpc_methods,delete e.events;var n,r=v(e.clients.values());try{for(r.s();!(n=r.n()).done;){n.value.close()}}catch(t){r.e(t)}finally{r.f()}delete this.namespaces[t]}}},{key:"event",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";if(this.namespaces[n]){if(void 0!==this.namespaces[n].events[t])throw new Error("Already registered event ".concat(n).concat(t))}else this._generateNamespace(n);return this.namespaces[n].events[t]={sockets:[],protected:!1},this.on(t,(function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];1===i.length&&i[0]instanceof Object&&(i=i[0]);var a,s=v(e.namespaces[n].events[t].sockets);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=e.namespaces[n].clients.get(u);c&&c.send(JSON.stringify({notification:t,params:i||null}))}}catch(t){s.e(t)}finally{s.f()}})),{protected:function(){return e._makeProtectedEvent(t,n)},public:function(){return e._makePublicEvent(t,n)}}}},{key:"of",value:function(t){this.namespaces[t]||this._generateNamespace(t);var e=this;return{register:function(n,r){if(2!==arguments.length)throw new Error("must provide exactly two arguments");if("string"!=typeof n)throw new Error("name must be a string");if("function"!=typeof r)throw new Error("handler must be a function");return e.register(n,r,t)},event:function(n){if(1!==arguments.length)throw new Error("must provide exactly one argument");if("string"!=typeof n)throw new Error("name must be a string");return e.event(n,t)},get eventList(){return Object.keys(e.namespaces[t].events)},emit:function(n){for(var r=(0,s.default)(e.namespaces[t].clients.keys()),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];for(var u,c=0;u=r[c];++c)e.namespaces[t].clients.get(u).send(JSON.stringify({notification:n,params:o||[]}))},get name(){return t},connected:function(){return(0,s.default)(e.namespaces[t].clients.keys()).reduce((function(n,r){return Object.assign(Object.assign({},n),(0,a.default)({},r,e.namespaces[t].clients.get(r)))}),{})},clients:function(){return e.namespaces[t]}}}},{key:"eventList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";return this.namespaces[t]?Object.keys(this.namespaces[t].events):[]}},{key:"createError",value:function(t,e,n){return{code:t,message:e,data:n||null}}},{key:"close",value:function(){var t=this;return new Promise((function(e,n){try{t.wss.close(),t.emit("close"),e()}catch(t){n(t)}}))}},{key:"_handleRPC",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";t.on("message",function(){var i=(0,o.default)(r.default.mark((function i(o){var a,s,u,c,l,h,d,f;return r.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a={},o instanceof ArrayBuffer&&(a.binary=!0,o=f_.from(o).toString()),1===t.readyState){r.next=4;break}return r.abrupt("return");case 4:r.prev=4,s=JSON.parse(o),r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(4),r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32700,r.t0.toString()),id:null}),a));case 11:if(!Array.isArray(s)){r.next=39;break}if(s.length){r.next=14;break}return r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32600,"Invalid array"),id:null}),a));case 14:u=[],c=v(s),r.prev=16,c.s();case 18:if((l=c.n()).done){r.next=28;break}return h=l.value,r.next=22,e._runMethod(h,t._id,n);case 22:if(d=r.sent){r.next=25;break}return r.abrupt("continue",26);case 25:u.push(d);case 26:r.next=18;break;case 28:r.next=33;break;case 30:r.prev=30,r.t1=r.catch(16),c.e(r.t1);case 33:return r.prev=33,c.f(),r.finish(33);case 36:if(u.length){r.next=38;break}return r.abrupt("return");case 38:return r.abrupt("return",t.send(JSON.stringify(u),a));case 39:return r.next=41,e._runMethod(s,t._id,n);case 41:if(f=r.sent){r.next=44;break}return r.abrupt("return");case 44:return r.abrupt("return",t.send(JSON.stringify(f),a));case 45:case"end":return r.stop()}}),i,null,[[4,8],[16,30,33,36]])})));return function(t){return i.apply(this,arguments)}}())}},{key:"_runMethod",value:(e=(0,o.default)(r.default.mark((function t(e,n){var o,a,s,u,c,l,h,d,f,p,m,g,b,w,M,_=arguments;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=_.length>2&&void 0!==_[2]?_[2]:"/","object"===(0,i.default)(e)&&null!==e){t.next=3;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:null});case 3:if("2.0"===e.jsonrpc){t.next=5;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid JSON RPC version"),id:e.id||null});case 5:if(e.method){t.next=7;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32602,"Method not specified"),id:e.id||null});case 7:if("string"==typeof e.method){t.next=9;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid method name"),id:e.id||null});case 9:if(!e.params||"string"!=typeof e.params){t.next=11;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:e.id||null});case 11:if("rpc.on"!==e.method){t.next=47;break}if(e.params){t.next=14;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 14:a={},s=Object.keys(this.namespaces[o].events),u=v(e.params),t.prev=17,u.s();case 19:if((c=u.n()).done){t.next=36;break}if(l=c.value,h=s.indexOf(l),d=this.namespaces[o],-1!==h){t.next=26;break}return a[l]="provided event invalid",t.abrupt("continue",34);case 26:if(!0!==d.events[s[h]].protected||!1!==d.clients.get(n)._authenticated){t.next=28;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32606),id:e.id||null});case 28:if(!(d.events[s[h]].sockets.indexOf(n)>=0)){t.next=32;break}return a[l]="socket has already been subscribed to event",t.abrupt("continue",34);case 32:d.events[s[h]].sockets.push(n),a[l]="ok";case 34:t.next=19;break;case 36:t.next=41;break;case 38:t.prev=38,t.t0=t.catch(17),u.e(t.t0);case 41:return t.prev=41,u.f(),t.finish(41);case 44:return t.abrupt("return",{jsonrpc:"2.0",result:a,id:e.id||null});case 47:if("rpc.off"!==e.method){t.next=78;break}if(e.params){t.next=50;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 50:f={},p=v(e.params),t.prev=52,p.s();case 54:if((m=p.n()).done){t.next=67;break}if(g=m.value,this.namespaces[o].events[g]){t.next=59;break}return f[g]="provided event invalid",t.abrupt("continue",65);case 59:if(-1!==(b=this.namespaces[o].events[g].sockets.indexOf(n))){t.next=63;break}return f[g]="not subscribed",t.abrupt("continue",65);case 63:this.namespaces[o].events[g].sockets.splice(b,1),f[g]="ok";case 65:t.next=54;break;case 67:t.next=72;break;case 69:t.prev=69,t.t1=t.catch(52),p.e(t.t1);case 72:return t.prev=72,p.f(),t.finish(72);case 75:return t.abrupt("return",{jsonrpc:"2.0",result:f,id:e.id||null});case 78:if("rpc.login"!==e.method){t.next=81;break}if(e.params){t.next=81;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32604),id:e.id||null});case 81:if(this.namespaces[o].rpc_methods[e.method]){t.next=83;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32601),id:e.id||null});case 83:if(w=null,!0!==this.namespaces[o].rpc_methods[e.method].protected||!1!==this.namespaces[o].clients.get(n)._authenticated){t.next=86;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32605),id:e.id||null});case 86:return t.prev=86,t.next=89,this.namespaces[o].rpc_methods[e.method].fn(e.params,n);case 89:w=t.sent,t.next=99;break;case 92:if(t.prev=92,t.t2=t.catch(86),e.id){t.next=96;break}return t.abrupt("return");case 96:if(!(t.t2 instanceof Error)){t.next=98;break}return t.abrupt("return",{jsonrpc:"2.0",error:{code:-32e3,message:t.t2.name,data:t.t2.message},id:e.id});case 98:return t.abrupt("return",{jsonrpc:"2.0",error:t.t2,id:e.id});case 99:if(e.id){t.next=101;break}return t.abrupt("return");case 101:return"rpc.login"===e.method&&!0===w&&((M=this.namespaces[o].clients.get(n))._authenticated=!0,this.namespaces[o].clients.set(n,M)),t.abrupt("return",{jsonrpc:"2.0",result:w,id:e.id});case 103:case"end":return t.stop()}}),t,this,[[17,38,41,44],[52,69,72,75],[86,92]])}))),function(t,n){return e.apply(this,arguments)})},{key:"_generateNamespace",value:function(t){var e=this;this.namespaces[t]={rpc_methods:{__listMethods:{fn:function(){return Object.keys(e.namespaces[t].rpc_methods)},protected:!1}},clients:new Map,events:{}}}}]),h}(f.EventEmitter);t.default=_}(NO)),NO}!function(t){var e=mL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0,Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return c.default}});var n=e(bL()),r=e(ML()),i=e(AL()),o=e(zL()),a=e(BL()),s=e((qD||(qD=1,function(t){var e=mL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new n.default(t,e)};var n=e(sO())}(UL)),UL)),u=e(_O()),c=e(Ez());function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var h=function(t){(0,i.default)(o,t);var e=l(o);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ws://localhost:8080",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;(0,r.default)(this,o);var a=n.autoconnect,u=void 0===a||a,c=n.reconnect,l=void 0===c||c,h=n.reconnect_interval,d=void 0===h?1e3:h,f=n.max_reconnects,p=void 0===f?5:f,m=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return e.call(this,s.default,t,Object.assign({autoconnect:u,reconnect:l,reconnect_interval:d,max_reconnects:p},m),i)}return(0,n.default)(o)}(u.default);t.Client=h}(pL);const Nz=Mz.v4;var Lz=function(t,e,n,r){if("string"!=typeof t)throw new TypeError(t+" must be a string");const i="number"==typeof(r=r||{}).version?r.version:2;if(1!==i&&2!==i)throw new TypeError(i+" must be 1 or 2");const o={method:t};if(2===i&&(o.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");o.params=e}if(void 0===n){const t="function"==typeof r.generator?r.generator:function(){return Nz()};o.id=t(o,r)}else 2===i&&null===n?r.notificationIdNull&&(o.id=null):o.id=n;return o};const Sz=Mz.v4,Az=Lz,xz=function(t,e){if(!(this instanceof xz))return new xz(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return Sz()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};var Tz=xz;xz.prototype.request=function(t,e,n,r){const i=this;let o=null;const a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&t&&"object"==typeof t&&"function"==typeof e)r=e,o=t;else{"function"==typeof n&&(r=n,n=void 0);const i="function"==typeof r;try{o=Az(t,e,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(i)return r(t);throw t}if(!i)return o}let s;try{s=JSON.stringify(o,this.options.replacer)}catch(t){return r(t)}return this.callServer(s,(function(t,e){i._parseResponse(t,e,r)})),o},xz.prototype._parseResponse=function(t,e,n){if(t)return void n(t);if(!e)return n();let r;try{r=JSON.parse(e,this.options.reviver)}catch(t){return n(t)}if(3===n.length){if(Array.isArray(r)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return n(null,r.filter(t),r.filter(e))}return n(null,r.error,r.result)}n(null,r)};var Iz=Tz;const kz="Impossible case. Please create issue.",jz="The tweak was out of range or the resulted private key is invalid",Cz="The tweak was out of range or equal to zero",Dz="Unknow error on context randomization",Oz="Private Key is invalid",zz="Public Key could not be parsed",Pz="Public Key serialization error",Rz="The sum of the public keys is not valid",Bz="Signature could not be parsed",Uz="The nonce generation function failed, or the private key was invalid",Fz="Public key could not be recover",Wz="Scalar was invalid (zero or overflow)";function Yz(t,e){if(!t)throw new Error(e)}function Qz(t,e,n){if(Yz(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==n)if(Array.isArray(n)){const r=`Expected ${t} to be an Uint8Array with length [${n.join(", ")}]`;Yz(n.includes(e.length),r)}else{const r=`Expected ${t} to be an Uint8Array with length ${n}`;Yz(e.length===n,r)}}function Hz(t){Yz("Boolean"===Zz(t),"Expected compressed to be a Boolean")}function Gz(t=(t=>new Uint8Array(t)),e){return"function"==typeof t&&(t=t(e)),Qz("output",t,e),t}function Zz(t){return Object.prototype.toString.call(t).slice(8,-1)}var Vz={},qz="6.5.4",Jz={},Kz={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$_.Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[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];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],f=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);r=(p=p.idivn(f)).isZero()?m+r:c[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),i.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?f(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e),n},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=i.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new _(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}y.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},r(b,y),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(v,y),r(w,y),r(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,JM)}(Kz);var Xz=$z;function $z(t,e){if(!t)throw new Error(e||"Assertion failed")}$z.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var tP={};!function(t){var e=t;function n(t){return 1===t.length?"0"+t:t}function r(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=n,e.toHex=r,e.encode=function(t,e){return"hex"===e?r(t):t}}(tP),function(t){var e=t,n=Kz.exports,r=Xz,i=tP;e.assert=r,e.toArray=i.toArray,e.zero2=i.zero2,e.toHex=i.toHex,e.encode=i.encode,e.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},e.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},e.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},e.parseBytes=function(t){return"string"==typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new n(t,"hex","le")}}(Jz);var eP,nP={exports:{}};function rP(t){this.rand=t}if(nP.exports=function(t){return eP||(eP=new rP(null)),eP.generate(t)},nP.exports.Rand=rP,rP.prototype.generate=function(t){return this._rand(t)},rP.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?rP.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?rP.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(rP.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var iP=iE;if("function"!=typeof iP.randomBytes)throw new Error("Not supported");rP.prototype._rand=function(t){return iP.randomBytes(t)}}catch(t){}var oP={},aP=Kz.exports,sP=Jz,uP=sP.getNAF,cP=sP.getJSF,lP=sP.assert;function hP(t,e){this.type=t,this.p=new aP(e.p,16),this.red=e.prime?aP.red(e.prime):aP.mont(this.p),this.zero=new aP(0).toRed(this.red),this.one=new aP(1).toRed(this.red),this.two=new aP(2).toRed(this.red),this.n=e.n&&new aP(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 n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var dP=hP;function fP(t,e){this.curve=t,this.type=e,this.precomputed=null}hP.prototype.point=function(){throw new Error("Not implemented")},hP.prototype.validate=function(){throw new Error("Not implemented")},hP.prototype._fixedNafMul=function(t,e){lP(t.precomputed);var n=t._getDoubles(),r=uP(e,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<s.length;o++)(a=s[o])===h?l=l.mixedAdd(n.points[o]):a===-h&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},hP.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=uP(e,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];lP(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},hP.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(s=e[o])._getNAFPoints(t);u[o]=d.wnd,c[o]=d.points}for(o=r-1;o>=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var m=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(m[1]=e[f].add(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].add(e[p].neg())):(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=cP(n[f],n[p]);for(h=Math.max(y[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a<h;a++){var b=0|y[0][a],v=0|y[1][a];l[f][a]=g[3*(b+1)+(v+1)],l[p][a]=0,c[f]=m}}else l[f]=uP(n[f],u[f],this._bitLength),l[p]=uP(n[p],u[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var w=this.jpoint(null,null,null),M=this._wnafT4;for(o=h;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a<r;a++){var N=M[a];0!==N&&(N>0?s=c[a][N-1>>1]:N<0&&(s=c[a][-N-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o<r;o++)c[o]=null;return i?w:w.toP()},hP.BasePoint=fP,fP.prototype.eq=function(){throw new Error("Not implemented")},fP.prototype.validate=function(){return this.curve.validate(this)},hP.prototype.decodePoint=function(t,e){t=sP.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?lP(t[t.length-1]%2==0):7===t[0]&&lP(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},fP.prototype.encodeCompressed=function(t){return this.encode(t,!0)},fP.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},fP.prototype.encode=function(t,e){return sP.encode(this._encode(e),t)},fP.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},fP.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},fP.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},fP.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},fP.prototype._getBeta=function(){return null},fP.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};var pP="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},mP=KM(Object.freeze({__proto__:null,default:pP})),gP=Kz.exports,yP=mP,bP=dP,vP=Jz.assert;function wP(t){bP.call(this,"short",t),this.a=new gP(t.a,16).toRed(this.red),this.b=new gP(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}yP(wP,bP);var MP=wP;function _P(t,e,n,r){bP.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new gP(e,16),this.y=new gP(n,16),r&&(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)}function EP(t,e,n,r){bP.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new gP(0)):(this.x=new gP(e,16),this.y=new gP(n,16),this.z=new gP(r,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}wP.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n,r;if(t.beta)e=new gP(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)n=new gP(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],vP(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return r=t.basis?t.basis.map((function(t){return{a:new gP(t.a,16),b:new gP(t.b,16)}})):this._getEndoBasis(n),{beta:e,lambda:n,basis:r}}},wP.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:gP.mont(t),n=new gP(2).toRed(e).redInvm(),r=n.redNeg(),i=new gP(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},wP.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,d=this.n.clone(),f=new gP(1),p=new gP(0),m=new gP(0),g=new gP(1),y=0;0!==h.cmpn(0);){var b=d.div(h);u=d.sub(b.mul(h)),c=m.sub(b.mul(f));var v=g.sub(b.mul(p));if(!r&&u.cmp(l)<0)e=s.neg(),n=f,r=u.neg(),i=c;else if(r&&2==++y)break;s=u,d=h,h=u,m=f,f=c,g=p,p=v}o=u.neg(),a=c;var w=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},wP.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},wP.prototype.pointFromX=function(t,e){(t=new gP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},wP.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},wP.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},yP(_P,bP.BasePoint),wP.prototype.point=function(t,e,n){return new _P(this,t,e,n)},wP.prototype.pointFromJSON=function(t,e){return _P.fromJSON(this,t,e)},_P.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},_P.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]},_P.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},_P.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)+">"},_P.prototype.isInfinity=function(){return this.inf},_P.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},_P.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},_P.prototype.getX=function(){return this.x.fromRed()},_P.prototype.getY=function(){return this.y.fromRed()},_P.prototype.mul=function(t){return t=new gP(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},_P.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},_P.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},_P.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},_P.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},_P.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},yP(EP,bP.BasePoint),wP.prototype.jpoint=function(t,e,n){return new EP(this,t,e,n)},EP.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},EP.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},EP.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},EP.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},EP.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e<t;e++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(d);var b=c.redMul(s);e+1<t&&(u=u.redMul(d)),o=m,s=b,c=y}return this.curve.jpoint(o,c.redMul(i),s)},EP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},EP.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(f).redISub(f),e=p.redMul(f.redISub(t)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},EP.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),m=(p=p.redIAdd(p)).redAdd(p);t=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=f.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,n)},EP.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},EP.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},EP.prototype.mul=function(t,e){return t=new gP(t,e),this.curve._wnafMul(this,t)},EP.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},EP.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},EP.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)+">"},EP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var NP=Kz.exports,LP=mP,SP=dP,AP=Jz;function xP(t){SP.call(this,"mont",t),this.a=new NP(t.a,16).toRed(this.red),this.b=new NP(t.b,16).toRed(this.red),this.i4=new NP(4).toRed(this.red).redInvm(),this.two=new NP(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}LP(xP,SP);var TP=xP;function IP(t,e,n){SP.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new NP(e,16),this.z=new NP(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}xP.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},LP(IP,SP.BasePoint),xP.prototype.decodePoint=function(t,e){return this.point(AP.toArray(t,e),1)},xP.prototype.point=function(t,e){return new IP(this,t,e)},xP.prototype.pointFromJSON=function(t){return IP.fromJSON(this,t)},IP.prototype.precompute=function(){},IP.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},IP.fromJSON=function(t,e){return new IP(t,e[0],e[1]||t.one)},IP.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)+">"},IP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},IP.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},IP.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},IP.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=i.redMul(r),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},IP.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},IP.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},IP.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},IP.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},IP.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},IP.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var kP=Kz.exports,jP=mP,CP=dP,DP=Jz.assert;function OP(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,CP.call(this,"edwards",t),this.a=new kP(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new kP(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new kP(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),DP(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}jP(OP,CP);var zP=OP;function PP(t,e,n,r,i){CP.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(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 kP(e,16),this.y=new kP(n,16),this.z=r?new kP(r,16):this.curve.one,this.t=i&&new kP(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.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()))))}OP.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},OP.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},OP.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},OP.prototype.pointFromX=function(t,e){(t=new kP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},OP.prototype.pointFromY=function(t,e){(t=new kP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},OP.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},jP(PP,CP.BasePoint),OP.prototype.pointFromJSON=function(t){return PP.fromJSON(this,t)},OP.prototype.point=function(t,e,n,r){return new PP(this,t,e,n,r)},PP.fromJSON=function(t,e){return new PP(t,e[0],e[1],e[2])},PP.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)+">"},PP.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},PP.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),a=o.redSub(n),s=r.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,l)},PP.prototype._projDbl=function(){var t,e,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(r=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(r.redSub(u)),n=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(r.redSub(u)),n=c.redMul(o))}else r=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(r)).redMul(o),e=this.curve._mulC(r).redMul(s.redISub(u)),n=r.redMul(o);return this.curve.point(t,e,n)},PP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},PP.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(e),c=o.redMul(a),l=s.redMul(u),h=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,h)},PP.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=r.redMul(u).redMul(l);return this.curve.twisted?(e=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,n)},PP.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},PP.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},PP.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},PP.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},PP.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},PP.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},PP.prototype.getX=function(){return this.normalize(),this.x.fromRed()},PP.prototype.getY=function(){return this.normalize(),this.y.fromRed()},PP.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},PP.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},PP.prototype.toP=PP.prototype.normalize,PP.prototype.mixedAdd=PP.prototype.add,function(t){var e=t;e.base=dP,e.short=MP,e.mont=TP,e.edwards=zP}(oP);var RP={},BP={},UP={},FP=Xz,WP=mP;function YP(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function QP(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function HP(t){return 1===t.length?"0"+t:t}function GP(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}UP.inherits=WP,UP.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):YP(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},UP.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=HP(t[n].toString(16));return e},UP.htonl=QP,UP.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=QP(i)),n+=GP(i.toString(16))}return n},UP.zero2=HP,UP.zero8=GP,UP.join32=function(t,e,n,r){var i=n-e;FP(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},UP.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},UP.rotr32=function(t,e){return t>>>e|t<<32-e},UP.rotl32=function(t,e){return t<<e|t>>>32-e},UP.sum32=function(t,e){return t+e>>>0},UP.sum32_3=function(t,e,n){return t+e+n>>>0},UP.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},UP.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},UP.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},UP.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},UP.sum64_lo=function(t,e,n,r){return e+r>>>0},UP.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},UP.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},UP.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},UP.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},UP.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},UP.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},UP.shr64_hi=function(t,e,n){return t>>>n},UP.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var ZP={},VP=UP,qP=Xz;function JP(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}ZP.BlockHash=JP,JP.prototype.update=function(t,e){if(t=VP.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=VP.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},JP.prototype.digest=function(t){return this.update(this._pad()),qP(null===this.pending),this._digest(t)},JP.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var KP={},XP={},$P=UP.rotr32;function tR(t,e,n){return t&e^~t&n}function eR(t,e,n){return t&e^t&n^e&n}function nR(t,e,n){return t^e^n}XP.ft_1=function(t,e,n,r){return 0===t?tR(e,n,r):1===t||3===t?nR(e,n,r):2===t?eR(e,n,r):void 0},XP.ch32=tR,XP.maj32=eR,XP.p32=nR,XP.s0_256=function(t){return $P(t,2)^$P(t,13)^$P(t,22)},XP.s1_256=function(t){return $P(t,6)^$P(t,11)^$P(t,25)},XP.g0_256=function(t){return $P(t,7)^$P(t,18)^t>>>3},XP.g1_256=function(t){return $P(t,17)^$P(t,19)^t>>>10};var rR=UP,iR=ZP,oR=XP,aR=rR.rotl32,sR=rR.sum32,uR=rR.sum32_5,cR=oR.ft_1,lR=iR.BlockHash,hR=[1518500249,1859775393,2400959708,3395469782];function dR(){if(!(this instanceof dR))return new dR;lR.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}rR.inherits(dR,lR);var fR=dR;dR.blockSize=512,dR.outSize=160,dR.hmacStrength=80,dR.padLength=64,dR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=aR(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=uR(aR(i,5),cR(c,o,a,s),u,n[r],hR[c]);u=s,s=a,a=aR(o,30),o=i,i=l}this.h[0]=sR(this.h[0],i),this.h[1]=sR(this.h[1],o),this.h[2]=sR(this.h[2],a),this.h[3]=sR(this.h[3],s),this.h[4]=sR(this.h[4],u)},dR.prototype._digest=function(t){return"hex"===t?rR.toHex32(this.h,"big"):rR.split32(this.h,"big")};var pR=UP,mR=ZP,gR=XP,yR=Xz,bR=pR.sum32,vR=pR.sum32_4,wR=pR.sum32_5,MR=gR.ch32,_R=gR.maj32,ER=gR.s0_256,NR=gR.s1_256,LR=gR.g0_256,SR=gR.g1_256,AR=mR.BlockHash,xR=[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 TR(){if(!(this instanceof TR))return new TR;AR.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=xR,this.W=new Array(64)}pR.inherits(TR,AR);var IR=TR;TR.blockSize=512,TR.outSize=256,TR.hmacStrength=192,TR.padLength=64,TR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=vR(SR(n[r-2]),n[r-7],LR(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(yR(this.k.length===n.length),r=0;r<n.length;r++){var d=wR(h,NR(u),MR(u,c,l),this.k[r],n[r]),f=bR(ER(i),_R(i,o,a));h=l,l=c,c=u,u=bR(s,d),s=a,a=o,o=i,i=bR(d,f)}this.h[0]=bR(this.h[0],i),this.h[1]=bR(this.h[1],o),this.h[2]=bR(this.h[2],a),this.h[3]=bR(this.h[3],s),this.h[4]=bR(this.h[4],u),this.h[5]=bR(this.h[5],c),this.h[6]=bR(this.h[6],l),this.h[7]=bR(this.h[7],h)},TR.prototype._digest=function(t){return"hex"===t?pR.toHex32(this.h,"big"):pR.split32(this.h,"big")};var kR=UP,jR=IR;function CR(){if(!(this instanceof CR))return new CR;jR.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}kR.inherits(CR,jR);var DR=CR;CR.blockSize=512,CR.outSize=224,CR.hmacStrength=192,CR.padLength=64,CR.prototype._digest=function(t){return"hex"===t?kR.toHex32(this.h.slice(0,7),"big"):kR.split32(this.h.slice(0,7),"big")};var OR=UP,zR=ZP,PR=Xz,RR=OR.rotr64_hi,BR=OR.rotr64_lo,UR=OR.shr64_hi,FR=OR.shr64_lo,WR=OR.sum64,YR=OR.sum64_hi,QR=OR.sum64_lo,HR=OR.sum64_4_hi,GR=OR.sum64_4_lo,ZR=OR.sum64_5_hi,VR=OR.sum64_5_lo,qR=zR.BlockHash,JR=[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 KR(){if(!(this instanceof KR))return new KR;qR.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=JR,this.W=new Array(160)}OR.inherits(KR,qR);var XR=KR;function $R(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function tB(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function eB(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function nB(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function rB(t,e){var n=RR(t,e,28)^RR(e,t,2)^RR(e,t,7);return n<0&&(n+=4294967296),n}function iB(t,e){var n=BR(t,e,28)^BR(e,t,2)^BR(e,t,7);return n<0&&(n+=4294967296),n}function oB(t,e){var n=RR(t,e,14)^RR(t,e,18)^RR(e,t,9);return n<0&&(n+=4294967296),n}function aB(t,e){var n=BR(t,e,14)^BR(t,e,18)^BR(e,t,9);return n<0&&(n+=4294967296),n}function sB(t,e){var n=RR(t,e,1)^RR(t,e,8)^UR(t,e,7);return n<0&&(n+=4294967296),n}function uB(t,e){var n=BR(t,e,1)^BR(t,e,8)^FR(t,e,7);return n<0&&(n+=4294967296),n}function cB(t,e){var n=RR(t,e,19)^RR(e,t,29)^UR(t,e,6);return n<0&&(n+=4294967296),n}function lB(t,e){var n=BR(t,e,19)^BR(e,t,29)^FR(t,e,6);return n<0&&(n+=4294967296),n}KR.blockSize=1024,KR.outSize=512,KR.hmacStrength=192,KR.padLength=128,KR.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=cB(n[r-4],n[r-3]),o=lB(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=sB(n[r-30],n[r-29]),c=uB(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=HR(i,o,a,s,u,c,l,h),n[r+1]=GR(i,o,a,s,u,c,l,h)}},KR.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];PR(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=oB(h,d),E=aB(h,d),N=$R(h,d,f,p,m),L=tB(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=ZR(w,M,_,E,N,L,S,A,x,T),k=VR(w,M,_,E,N,L,S,A,x,T);w=rB(r,i),M=iB(r,i),_=eB(r,i,o,a,s),E=nB(r,i,o,a,s,u);var j=YR(w,M,_,E),C=QR(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=YR(c,l,I,k),d=QR(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=YR(I,k,j,C),i=QR(I,k,j,C)}WR(this.h,0,r,i),WR(this.h,2,o,a),WR(this.h,4,s,u),WR(this.h,6,c,l),WR(this.h,8,h,d),WR(this.h,10,f,p),WR(this.h,12,m,g),WR(this.h,14,y,b)},KR.prototype._digest=function(t){return"hex"===t?OR.toHex32(this.h,"big"):OR.split32(this.h,"big")};var hB=UP,dB=XR;function fB(){if(!(this instanceof fB))return new fB;dB.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}hB.inherits(fB,dB);var pB=fB;fB.blockSize=1024,fB.outSize=384,fB.hmacStrength=192,fB.padLength=128,fB.prototype._digest=function(t){return"hex"===t?hB.toHex32(this.h.slice(0,12),"big"):hB.split32(this.h.slice(0,12),"big")},KP.sha1=fR,KP.sha224=DR,KP.sha256=IR,KP.sha384=pB,KP.sha512=XR;var mB={},gB=UP,yB=ZP,bB=gB.rotl32,vB=gB.sum32,wB=gB.sum32_3,MB=gB.sum32_4,_B=yB.BlockHash;function EB(){if(!(this instanceof EB))return new EB;_B.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function NB(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function LB(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function SB(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}gB.inherits(EB,_B),mB.ripemd160=EB,EB.blockSize=512,EB.outSize=160,EB.hmacStrength=192,EB.padLength=64,EB.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=vB(bB(MB(n,NB(d,r,i,o),t[AB[d]+e],LB(d)),TB[d]),a);n=a,a=o,o=bB(i,10),i=r,r=f,f=vB(bB(MB(s,NB(79-d,u,c,l),t[xB[d]+e],SB(d)),IB[d]),h),s=h,h=l,l=bB(c,10),c=u,u=f}f=wB(this.h[1],i,l),this.h[1]=wB(this.h[2],o,h),this.h[2]=wB(this.h[3],a,s),this.h[3]=wB(this.h[4],n,u),this.h[4]=wB(this.h[0],r,c),this.h[0]=f},EB.prototype._digest=function(t){return"hex"===t?gB.toHex32(this.h,"little"):gB.split32(this.h,"little")};var AB=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],xB=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],TB=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],IB=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],kB=UP,jB=Xz;function CB(t,e,n){if(!(this instanceof CB))return new CB(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(kB.toArray(e,n))}var DB,OB,zB=CB;CB.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),jB(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},CB.prototype.update=function(t,e){return this.inner.update(t,e),this},CB.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=UP,e.common=ZP,e.sha=KP,e.ripemd=mB,e.hmac=zB,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(BP),function(t){var e,n=t,r=BP,i=oP,o=Jz.assert;function a(t){"short"===t.type?this.curve=new i.short(t):"edwards"===t.type?this.curve=new i.edwards(t):this.curve=new i.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new a(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{e=OB?DB:(OB=1,DB={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"]]}})}catch(t){e=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",e]})}(RP);var PB=BP,RB=tP,BB=Xz;function UB(t){if(!(this instanceof UB))return new UB(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=RB.toArray(t.entropy,t.entropyEnc||"hex"),n=RB.toArray(t.nonce,t.nonceEnc||"hex"),r=RB.toArray(t.pers,t.persEnc||"hex");BB(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var FB=UB;UB.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},UB.prototype._hmac=function(){return new PB.hmac(this.hash,this.K)},UB.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},UB.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=RB.toArray(t,e),n=RB.toArray(n,r),BB(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},UB.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=RB.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(n),this._reseed++,RB.encode(o,e)};var WB=Kz.exports,YB=Jz.assert;function QB(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var HB=QB;QB.fromPublic=function(t,e,n){return e instanceof QB?e:new QB(t,{pub:e,pubEnc:n})},QB.fromPrivate=function(t,e,n){return e instanceof QB?e:new QB(t,{priv:e,privEnc:n})},QB.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},QB.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},QB.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},QB.prototype._importPrivate=function(t,e){this.priv=new WB(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},QB.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?YB(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||YB(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},QB.prototype.derive=function(t){return t.validate()||YB(t.validate(),"public point not validated"),t.mul(this.priv).getX()},QB.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},QB.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},QB.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var GB=Kz.exports,ZB=Jz,VB=ZB.assert;function qB(t,e){if(t instanceof qB)return t;this._importDER(t,e)||(VB(t.r&&t.s,"Signature without r or s"),this.r=new GB(t.r,16),this.s=new GB(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var JB=qB;function KB(){this.place=0}function XB(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function $B(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function tU(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}qB.prototype._importDER=function(t,e){t=ZB.toArray(t,e);var n=new KB;if(48!==t[n.place++])return!1;var r=XB(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=XB(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=XB(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new GB(o),this.s=new GB(s),this.recoveryParam=null,!0},qB.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=$B(e),n=$B(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];tU(r,e.length),(r=r.concat(e)).push(2),tU(r,n.length);var i=r.concat(n),o=[48];return tU(o,i.length),o=o.concat(i),ZB.encode(o,t)};var eU=Kz.exports,nU=FB,rU=Jz,iU=RP,oU=nP.exports,aU=rU.assert,sU=HB,uU=JB;function cU(t){if(!(this instanceof cU))return new cU(t);"string"==typeof t&&(aU(Object.prototype.hasOwnProperty.call(iU,t),"Unknown curve "+t),t=iU[t]),t instanceof iU.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var lU=cU;cU.prototype.keyPair=function(t){return new sU(this,t)},cU.prototype.keyFromPrivate=function(t,e){return sU.fromPrivate(this,t,e)},cU.prototype.keyFromPublic=function(t,e){return sU.fromPublic(this,t,e)},cU.prototype.genKeyPair=function(t){t||(t={});for(var e=new nU({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||oU(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new eU(2));;){var i=new eU(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},cU.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},cU.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new eU(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new nU({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new eU(1)),c=0;;c++){var l=r.k?r.k(c):new eU(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new uU({r:f,s:p,recoveryParam:m})}}}}}},cU.prototype.verify=function(t,e,n,r){t=this._truncateToN(new eU(t,16)),n=this.keyFromPublic(n,r);var i=(e=new uU(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},cU.prototype.recoverPubKey=function(t,e,n,r){aU((3&n)===n,"The recovery param is more than two bits"),e=new uU(e,r);var i=this.n,o=new eU(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},cU.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new uU(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var hU=Jz,dU=hU.assert,fU=hU.parseBytes,pU=hU.cachedProperty;function mU(t,e){this.eddsa=t,this._secret=fU(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=fU(e.pub)}mU.fromPublic=function(t,e){return e instanceof mU?e:new mU(t,{pub:e})},mU.fromSecret=function(t,e){return e instanceof mU?e:new mU(t,{secret:e})},mU.prototype.secret=function(){return this._secret},pU(mU,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),pU(mU,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),pU(mU,"privBytes",(function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),pU(mU,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),pU(mU,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),pU(mU,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),mU.prototype.sign=function(t){return dU(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},mU.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},mU.prototype.getSecret=function(t){return dU(this._secret,"KeyPair is public only"),hU.encode(this.secret(),t)},mU.prototype.getPublic=function(t){return hU.encode(this.pubBytes(),t)};var gU=mU,yU=Kz.exports,bU=Jz,vU=bU.assert,wU=bU.cachedProperty,MU=bU.parseBytes;function _U(t,e){this.eddsa=t,"object"!=typeof e&&(e=MU(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),vU(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof yU&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}wU(_U,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),wU(_U,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),wU(_U,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),wU(_U,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),_U.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},_U.prototype.toHex=function(){return bU.encode(this.toBytes(),"hex").toUpperCase()};var EU=_U,NU=BP,LU=RP,SU=Jz,AU=SU.assert,xU=SU.parseBytes,TU=gU,IU=EU;function kU(t){if(AU("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof kU))return new kU(t);t=LU[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=NU.sha512}var jU=kU;kU.prototype.sign=function(t,e){t=xU(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},kU.prototype.verify=function(t,e,n){t=xU(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},kU.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return SU.intFromLE(t.digest()).umod(this.curve.n)},kU.prototype.keyFromPublic=function(t){return TU.fromPublic(this,t)},kU.prototype.keyFromSecret=function(t){return TU.fromSecret(this,t)},kU.prototype.makeSignature=function(t){return t instanceof IU?t:new IU(this,t)},kU.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},kU.prototype.decodePoint=function(t){var e=(t=SU.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=SU.intFromLE(n);return this.curve.pointFromY(i,r)},kU.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},kU.prototype.decodeInt=function(t){return SU.intFromLE(t)},kU.prototype.isPoint=function(t){return t instanceof this.pointClass},function(t){var e=t;e.version=qz,e.utils=Jz,e.rand=nP.exports,e.curve=oP,e.curves=RP,e.ec=lU,e.eddsa=jU}(Vz);const CU=new(0,Vz.ec)("secp256k1"),DU=CU.curve,OU=DU.n.constructor;function zU(t){const e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:function(t,e){let n=new OU(e);if(n.cmp(DU.p)>=0)return null;n=n.toRed(DU.red);let r=n.redSqr().redIMul(n).redIAdd(DU.b).redSqrt();return 3===t!==r.isOdd()&&(r=r.redNeg()),CU.keyPair({pub:{x:n,y:r}})}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,n){let r=new OU(e),i=new OU(n);if(r.cmp(DU.p)>=0||i.cmp(DU.p)>=0)return null;if(r=r.toRed(DU.red),i=i.toRed(DU.red),(6===t||7===t)&&i.isOdd()!==(7===t))return null;const o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(DU.b)).isZero()?CU.keyPair({pub:{x:r,y:i}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function PU(t,e){const n=e.encode(null,33===t.length);for(let e=0;e<t.length;++e)t[e]=n[e]}var RU={contextRandomize:()=>0,privateKeyVerify(t){const e=new OU(t);return e.cmp(DU.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new OU(t),n=DU.n.sub(e).umod(DU.n).toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakAdd(t,e){const n=new OU(e);if(n.cmp(DU.n)>=0)return 1;if(n.iadd(new OU(t)),n.cmp(DU.n)>=0&&n.isub(DU.n),n.isZero())return 1;const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakMul(t,e){let n=new OU(e);if(n.cmp(DU.n)>=0||n.isZero())return 1;n.imul(new OU(t)),n.cmp(DU.n)>=0&&(n=n.umod(DU.n));const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},publicKeyVerify:t=>null===zU(t)?1:0,publicKeyCreate(t,e){const n=new OU(e);if(n.cmp(DU.n)>=0||n.isZero())return 1;return PU(t,CU.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const n=zU(e);if(null===n)return 1;return PU(t,n.getPublic()),0},publicKeyNegate(t,e){const n=zU(e);if(null===n)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),PU(t,r),0},publicKeyCombine(t,e){const n=new Array(e.length);for(let t=0;t<e.length;++t)if(n[t]=zU(e[t]),null===n[t])return 1;let r=n[0].getPublic();for(let t=1;t<n.length;++t)r=r.add(n[t].pub);return r.isInfinity()?2:(PU(t,r),0)},publicKeyTweakAdd(t,e,n){const r=zU(e);if(null===r)return 1;if((n=new OU(n)).cmp(DU.n)>=0)return 2;const i=r.getPublic().add(DU.g.mul(n));return i.isInfinity()?2:(PU(t,i),0)},publicKeyTweakMul(t,e,n){const r=zU(e);if(null===r)return 1;if((n=new OU(n)).cmp(DU.n)>=0||n.isZero())return 2;return PU(t,r.getPublic().mul(n)),0},signatureNormalize(t){const e=new OU(t.subarray(0,32)),n=new OU(t.subarray(32,64));return e.cmp(DU.n)>=0||n.cmp(DU.n)>=0?1:(1===n.cmp(CU.nh)&&t.set(DU.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const n=e.subarray(0,32),r=e.subarray(32,64);if(new OU(n).cmp(DU.n)>=0)return 1;if(new OU(r).cmp(DU.n)>=0)return 1;const{output:i}=t;let o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(o=o.subarray(s),128&o[0])return 1;if(a>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(r,1);let c=33,l=0;for(;c>1&&0===u[l]&&!(128&u[l+1]);--c,++l);return u=u.subarray(l),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(t.outputlen=6+a+c,i[0]=48,i[1]=t.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=u.length,i.set(u,6+a),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const n=e[3];if(0===n)return 1;if(5+n>=e.length)return 1;if(2!==e[4+n])return 1;const r=e[5+n];if(0===r)return 1;if(6+n+r!==e.length)return 1;if(128&e[4])return 1;if(n>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[n+6])return 1;if(r>1&&0===e[n+6]&&!(128&e[n+7]))return 1;let i=e.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=e.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let a=new OU(i);a.cmp(DU.n)>=0&&(a=new OU(0));let s=new OU(e.subarray(6+n));return s.cmp(DU.n)>=0&&(s=new OU(0)),t.set(a.toArrayLike(Uint8Array,"be",32),0),t.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,n,r,i){if(i){const t=i;i=i=>{const o=t(e,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new OU(o)}}const o=new OU(n);if(o.cmp(DU.n)>=0||o.isZero())return 1;let a;try{a=CU.sign(e,n,{canonical:!0,k:i,pers:r})}catch(t){return 1}return t.signature.set(a.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(a.s.toArrayLike(Uint8Array,"be",32),32),t.recid=a.recoveryParam,0},ecdsaVerify(t,e,n){const r={r:t.subarray(0,32),s:t.subarray(32,64)},i=new OU(r.r),o=new OU(r.s);if(i.cmp(DU.n)>=0||o.cmp(DU.n)>=0)return 1;if(1===o.cmp(CU.nh)||i.isZero()||o.isZero())return 3;const a=zU(n);if(null===a)return 2;const s=a.getPublic();return CU.verify(e,r,s)?0:3},ecdsaRecover(t,e,n,r){const i={r:e.slice(0,32),s:e.slice(32,64)},o=new OU(i.r),a=new OU(i.s);if(o.cmp(DU.n)>=0||a.cmp(DU.n)>=0)return 1;if(o.isZero()||a.isZero())return 2;let s;try{s=CU.recoverPubKey(r,i,n)}catch(t){return 2}return PU(t,s),0},ecdh(t,e,n,r,i,o,a){const s=zU(e);if(null===s)return 1;const u=new OU(n);if(u.cmp(DU.n)>=0||u.isZero())return 2;const c=s.getPublic().mul(u);if(void 0===i){const e=c.encode(null,!0),n=CU.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=n[e]}else{o||(o=new Uint8Array(32));const e=c.getX().toArray("be",32);for(let t=0;t<32;++t)o[t]=e[t];a||(a=new Uint8Array(32));const n=c.getY().toArray("be",32);for(let t=0;t<32;++t)a[t]=n[t];const s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===t.length))return 2;t.set(s)}return 0}},BU=(t=>({contextRandomize(e){if(Yz(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&Qz("seed",e,32),1===t.contextRandomize(e))throw new Error(Dz)},privateKeyVerify:e=>(Qz("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(Qz("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(kz)}},privateKeyTweakAdd(e,n){switch(Qz("private key",e,32),Qz("tweak",n,32),t.privateKeyTweakAdd(e,n)){case 0:return e;case 1:throw new Error(jz)}},privateKeyTweakMul(e,n){switch(Qz("private key",e,32),Qz("tweak",n,32),t.privateKeyTweakMul(e,n)){case 0:return e;case 1:throw new Error(Cz)}},publicKeyVerify:e=>(Qz("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,n=!0,r){switch(Qz("private key",e,32),Hz(n),r=Gz(r,n?33:65),t.publicKeyCreate(r,e)){case 0:return r;case 1:throw new Error(Oz);case 2:throw new Error(Pz)}},publicKeyConvert(e,n=!0,r){switch(Qz("public key",e,[33,65]),Hz(n),r=Gz(r,n?33:65),t.publicKeyConvert(r,e)){case 0:return r;case 1:throw new Error(zz);case 2:throw new Error(Pz)}},publicKeyNegate(e,n=!0,r){switch(Qz("public key",e,[33,65]),Hz(n),r=Gz(r,n?33:65),t.publicKeyNegate(r,e)){case 0:return r;case 1:throw new Error(zz);case 2:throw new Error(kz);case 3:throw new Error(Pz)}},publicKeyCombine(e,n=!0,r){Yz(Array.isArray(e),"Expected public keys to be an Array"),Yz(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)Qz("public key",t,[33,65]);switch(Hz(n),r=Gz(r,n?33:65),t.publicKeyCombine(r,e)){case 0:return r;case 1:throw new Error(zz);case 2:throw new Error(Rz);case 3:throw new Error(Pz)}},publicKeyTweakAdd(e,n,r=!0,i){switch(Qz("public key",e,[33,65]),Qz("tweak",n,32),Hz(r),i=Gz(i,r?33:65),t.publicKeyTweakAdd(i,e,n)){case 0:return i;case 1:throw new Error(zz);case 2:throw new Error(jz)}},publicKeyTweakMul(e,n,r=!0,i){switch(Qz("public key",e,[33,65]),Qz("tweak",n,32),Hz(r),i=Gz(i,r?33:65),t.publicKeyTweakMul(i,e,n)){case 0:return i;case 1:throw new Error(zz);case 2:throw new Error(Cz)}},signatureNormalize(e){switch(Qz("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(Bz)}},signatureExport(e,n){Qz("signature",e,64);const r={output:n=Gz(n,72),outputlen:72};switch(t.signatureExport(r,e)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(Bz);case 2:throw new Error(kz)}},signatureImport(e,n){switch(Qz("signature",e),n=Gz(n,64),t.signatureImport(n,e)){case 0:return n;case 1:throw new Error(Bz);case 2:throw new Error(kz)}},ecdsaSign(e,n,r={},i){Qz("message",e,32),Qz("private key",n,32),Yz("Object"===Zz(r),"Expected options to be an Object"),void 0!==r.data&&Qz("options.data",r.data),void 0!==r.noncefn&&Yz("Function"===Zz(r.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=Gz(i,64),recid:null};switch(t.ecdsaSign(o,e,n,r.data,r.noncefn)){case 0:return o;case 1:throw new Error(Uz);case 2:throw new Error(kz)}},ecdsaVerify(e,n,r){switch(Qz("signature",e,64),Qz("message",n,32),Qz("public key",r,[33,65]),t.ecdsaVerify(e,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(Bz);case 2:throw new Error(zz)}},ecdsaRecover(e,n,r,i=!0,o){switch(Qz("signature",e,64),Yz("Number"===Zz(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),Qz("message",r,32),Hz(i),o=Gz(o,i?33:65),t.ecdsaRecover(o,e,n,r)){case 0:return o;case 1:throw new Error(Bz);case 2:throw new Error(Fz);case 3:throw new Error(kz)}},ecdh(e,n,r={},i){switch(Qz("public key",e,[33,65]),Qz("private key",n,32),Yz("Object"===Zz(r),"Expected options to be an Object"),void 0!==r.data&&Qz("options.data",r.data),void 0!==r.hashfn?(Yz("Function"===Zz(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&Qz("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&Qz("options.ybuf",r.ybuf,32),Qz("output",i)):i=Gz(i,32),t.ecdh(i,e,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return i;case 1:throw new Error(zz);case 2:throw new Error(Wz)}}}))(RU),UU=BU,FU={exports:{}};!function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof hS&&hS.versions&&hS.versions.node?r=JM:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new I(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new I(t,e,i).update(r)[n]()}},y=function(t,e,n){return function(e,r,i,o){return _["cshake"+t].update(e,r,i,o)[n]()}},b=function(t,e,n){return function(e,r,i,o){return _["kmac"+t].update(e,r,i,o)[n]()}},v=function(t,e,n,r){for(var i=0;i<f.length;++i){var o=f[i];t[o]=e(n,r,o)}return t},w=function(t,e){var n=m(t,e,"hex");return n.create=function(){return new I(t,e,t)},n.update=function(t){return n.create().update(t)},v(n,m,t,e)},M=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:w},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:w},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var n=g(t,e,"hex");return n.create=function(n){return new I(t,e,n)},n.update=function(t,e){return n.create(e).update(t)},v(n,g,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=y(t,0,"hex");return r.create=function(r,i,o){return i||o?new I(t,e,r).bytepad([i,o],n):_["shake"+t].create(r)},r.update=function(t,e,n,i){return r.create(e,n,i).update(t)},v(r,y,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=b(t,0,"hex");return r.create=function(r,i,o){return new k(t,e,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(t,e,n,i){return r.create(t,n,i).update(e)},v(r,b,t,e)}}],_={},E=[],N=0;N<M.length;++N)for(var L=M[N],S=L.bits,A=0;A<S.length;++A){var x=L.name+"_"+S[A];if(E.push(x),_[x]=L.createMethod(S[A],L.padding),"sha3"!==L.name){var T=L.name+S[A];E.push(T),_[T]=_[x]}}function I(t,e,n){this.blocks=[],this.s=[],this.padding=e,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function k(t,e,n){I.call(this,t,e,n)}I.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<h+1;++i)s[i]=0;if(n)for(i=this.start;d<l&&i<u;++d)s[i>>2]|=t[d]<<c[3&i++];else for(i=this.start;d<l&&i<u;++d)(o=t.charCodeAt(d))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++d)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[h],i=0;i<h;++i)f[i]^=s[i];j(f),this.reset=!0}else this.start=i}return this},I.prototype.encode=function(t,e){var n=255&t,r=1,i=[n];for(n=255&(t>>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},I.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s<t.length;++s){var u=t.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},I.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r<t.length;++r)n+=this.encodeString(t[r]);var i=e-n%e,o=[];return o.length=i,this.update(o),this},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,n=this.blockCount,r=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e<n+1;++e)t[e]=0;for(t[n-1]|=2147483648,e=0;e<n;++e)r[e]^=t[e];j(r)}},I.prototype.toString=I.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<r;){for(o=0;o<e&&a<r;++o,++a)t=n[o],u+=s[t>>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(j(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},I.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<r;){for(o=0;o<e&&a<r;++o,++a)u[a]=n[o];a%e==0&&j(n)}return i&&(u[o]=n[o],t=t.slice(0,s)),t},I.prototype.buffer=I.prototype.arrayBuffer,I.prototype.digest=I.prototype.array=function(){this.finalize();for(var t,e,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)t=s<<2,e=r[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&j(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},k.prototype=new I,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var j=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S,A,x,T,I,k,j,C,D,O,z,P,R,B,U,F,W,Y,Q,H,G,Z,V,q,J,K,X,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,m=t[0],g=t[1],Z=t[11]<<4|t[10]>>>28,V=t[10]<<4|t[11]>>>28,T=t[20]<<3|t[21]>>>29,I=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,Q=t[41]<<18|t[40]>>>14,O=t[2]<<1|t[3]>>>31,z=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,q=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,k=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,P=t[14]<<6|t[15]>>>26,R=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,C=t[45]<<29|t[44]>>>3,D=t[44]<<29|t[45]>>>3,L=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,B=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,A=t[18]<<20|t[19]>>>12,x=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,F=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,N=t[49]<<14|t[48]>>>18,t[0]=m^~y&v,t[1]=g^~b&w,t[10]=L^~A&T,t[11]=S^~x&I,t[20]=O^~P&B,t[21]=z^~R&U,t[30]=H^~Z&q,t[31]=G^~V&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=y^~v&M,t[3]=b^~w&_,t[12]=A^~T&k,t[13]=x^~I&j,t[22]=P^~B&F,t[23]=R^~U&W,t[32]=Z^~q&K,t[33]=V^~J&X,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=v^~M&E,t[5]=w^~_&N,t[14]=T^~k&C,t[15]=I^~j&D,t[24]=B^~F&Y,t[25]=U^~W&Q,t[34]=q^~K&$,t[35]=J^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&lt,t[6]=M^~E&m,t[7]=_^~N&g,t[16]=k^~C&L,t[17]=j^~D&S,t[26]=F^~Y&O,t[27]=W^~Q&z,t[36]=K^~$&H,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=E^~m&y,t[9]=N^~g&b,t[18]=C^~L&A,t[19]=D^~S&x,t[28]=Y^~O&P,t[29]=Q^~z&R,t[38]=$^~H&Z,t[39]=tt^~G&V,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=_;else for(N=0;N<E.length;++N)r[E[N]]=_[E[N]]}()}(FU);var WU=FU.exports;const YU=t=>f_.isBuffer(t)?t:t instanceof Uint8Array?f_.from(t.buffer,t.byteOffset,t.byteLength):f_.from(t);var QU={},HU={},GU=ZU;function ZU(t,e){if(!t)throw new Error(e||"Assertion failed")}ZU.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var VU={exports:{}};"function"==typeof Object.create?VU.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:VU.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var qU=GU,JU=VU.exports;function KU(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function XU(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function $U(t){return 1===t.length?"0"+t:t}function tF(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}HU.inherits=JU,HU.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):KU(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},HU.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=$U(t[n].toString(16));return e},HU.htonl=XU,HU.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=XU(i)),n+=tF(i.toString(16))}return n},HU.zero2=$U,HU.zero8=tF,HU.join32=function(t,e,n,r){var i=n-e;qU(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},HU.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},HU.rotr32=function(t,e){return t>>>e|t<<32-e},HU.rotl32=function(t,e){return t<<e|t>>>32-e},HU.sum32=function(t,e){return t+e>>>0},HU.sum32_3=function(t,e,n){return t+e+n>>>0},HU.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},HU.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},HU.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},HU.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},HU.sum64_lo=function(t,e,n,r){return e+r>>>0},HU.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},HU.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},HU.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},HU.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},HU.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},HU.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},HU.shr64_hi=function(t,e,n){return t>>>n},HU.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var eF={},nF=HU,rF=GU;function iF(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}eF.BlockHash=iF,iF.prototype.update=function(t,e){if(t=nF.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=nF.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},iF.prototype.digest=function(t){return this.update(this._pad()),rF(null===this.pending),this._digest(t)},iF.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var oF={},aF={},sF=HU.rotr32;function uF(t,e,n){return t&e^~t&n}function cF(t,e,n){return t&e^t&n^e&n}function lF(t,e,n){return t^e^n}aF.ft_1=function(t,e,n,r){return 0===t?uF(e,n,r):1===t||3===t?lF(e,n,r):2===t?cF(e,n,r):void 0},aF.ch32=uF,aF.maj32=cF,aF.p32=lF,aF.s0_256=function(t){return sF(t,2)^sF(t,13)^sF(t,22)},aF.s1_256=function(t){return sF(t,6)^sF(t,11)^sF(t,25)},aF.g0_256=function(t){return sF(t,7)^sF(t,18)^t>>>3},aF.g1_256=function(t){return sF(t,17)^sF(t,19)^t>>>10};var hF=HU,dF=eF,fF=aF,pF=hF.rotl32,mF=hF.sum32,gF=hF.sum32_5,yF=fF.ft_1,bF=dF.BlockHash,vF=[1518500249,1859775393,2400959708,3395469782];function wF(){if(!(this instanceof wF))return new wF;bF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hF.inherits(wF,bF);var MF=wF;wF.blockSize=512,wF.outSize=160,wF.hmacStrength=80,wF.padLength=64,wF.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=pF(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=gF(pF(i,5),yF(c,o,a,s),u,n[r],vF[c]);u=s,s=a,a=pF(o,30),o=i,i=l}this.h[0]=mF(this.h[0],i),this.h[1]=mF(this.h[1],o),this.h[2]=mF(this.h[2],a),this.h[3]=mF(this.h[3],s),this.h[4]=mF(this.h[4],u)},wF.prototype._digest=function(t){return"hex"===t?hF.toHex32(this.h,"big"):hF.split32(this.h,"big")};var _F=HU,EF=eF,NF=aF,LF=GU,SF=_F.sum32,AF=_F.sum32_4,xF=_F.sum32_5,TF=NF.ch32,IF=NF.maj32,kF=NF.s0_256,jF=NF.s1_256,CF=NF.g0_256,DF=NF.g1_256,OF=EF.BlockHash,zF=[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 PF(){if(!(this instanceof PF))return new PF;OF.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=zF,this.W=new Array(64)}_F.inherits(PF,OF);var RF=PF;PF.blockSize=512,PF.outSize=256,PF.hmacStrength=192,PF.padLength=64,PF.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=AF(DF(n[r-2]),n[r-7],CF(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(LF(this.k.length===n.length),r=0;r<n.length;r++){var d=xF(h,jF(u),TF(u,c,l),this.k[r],n[r]),f=SF(kF(i),IF(i,o,a));h=l,l=c,c=u,u=SF(s,d),s=a,a=o,o=i,i=SF(d,f)}this.h[0]=SF(this.h[0],i),this.h[1]=SF(this.h[1],o),this.h[2]=SF(this.h[2],a),this.h[3]=SF(this.h[3],s),this.h[4]=SF(this.h[4],u),this.h[5]=SF(this.h[5],c),this.h[6]=SF(this.h[6],l),this.h[7]=SF(this.h[7],h)},PF.prototype._digest=function(t){return"hex"===t?_F.toHex32(this.h,"big"):_F.split32(this.h,"big")};var BF=HU,UF=RF;function FF(){if(!(this instanceof FF))return new FF;UF.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}BF.inherits(FF,UF);var WF=FF;FF.blockSize=512,FF.outSize=224,FF.hmacStrength=192,FF.padLength=64,FF.prototype._digest=function(t){return"hex"===t?BF.toHex32(this.h.slice(0,7),"big"):BF.split32(this.h.slice(0,7),"big")};var YF=HU,QF=eF,HF=GU,GF=YF.rotr64_hi,ZF=YF.rotr64_lo,VF=YF.shr64_hi,qF=YF.shr64_lo,JF=YF.sum64,KF=YF.sum64_hi,XF=YF.sum64_lo,$F=YF.sum64_4_hi,tW=YF.sum64_4_lo,eW=YF.sum64_5_hi,nW=YF.sum64_5_lo,rW=QF.BlockHash,iW=[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 oW(){if(!(this instanceof oW))return new oW;rW.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=iW,this.W=new Array(160)}YF.inherits(oW,rW);var aW=oW;function sW(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function uW(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function cW(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function lW(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function hW(t,e){var n=GF(t,e,28)^GF(e,t,2)^GF(e,t,7);return n<0&&(n+=4294967296),n}function dW(t,e){var n=ZF(t,e,28)^ZF(e,t,2)^ZF(e,t,7);return n<0&&(n+=4294967296),n}function fW(t,e){var n=GF(t,e,14)^GF(t,e,18)^GF(e,t,9);return n<0&&(n+=4294967296),n}function pW(t,e){var n=ZF(t,e,14)^ZF(t,e,18)^ZF(e,t,9);return n<0&&(n+=4294967296),n}function mW(t,e){var n=GF(t,e,1)^GF(t,e,8)^VF(t,e,7);return n<0&&(n+=4294967296),n}function gW(t,e){var n=ZF(t,e,1)^ZF(t,e,8)^qF(t,e,7);return n<0&&(n+=4294967296),n}function yW(t,e){var n=GF(t,e,19)^GF(e,t,29)^VF(t,e,6);return n<0&&(n+=4294967296),n}function bW(t,e){var n=ZF(t,e,19)^ZF(e,t,29)^qF(t,e,6);return n<0&&(n+=4294967296),n}oW.blockSize=1024,oW.outSize=512,oW.hmacStrength=192,oW.padLength=128,oW.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=yW(n[r-4],n[r-3]),o=bW(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=mW(n[r-30],n[r-29]),c=gW(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=$F(i,o,a,s,u,c,l,h),n[r+1]=tW(i,o,a,s,u,c,l,h)}},oW.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];HF(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=fW(h,d),E=pW(h,d),N=sW(h,d,f,p,m),L=uW(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=eW(w,M,_,E,N,L,S,A,x,T),k=nW(w,M,_,E,N,L,S,A,x,T);w=hW(r,i),M=dW(r,i),_=cW(r,i,o,a,s),E=lW(r,i,o,a,s,u);var j=KF(w,M,_,E),C=XF(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=KF(c,l,I,k),d=XF(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=KF(I,k,j,C),i=XF(I,k,j,C)}JF(this.h,0,r,i),JF(this.h,2,o,a),JF(this.h,4,s,u),JF(this.h,6,c,l),JF(this.h,8,h,d),JF(this.h,10,f,p),JF(this.h,12,m,g),JF(this.h,14,y,b)},oW.prototype._digest=function(t){return"hex"===t?YF.toHex32(this.h,"big"):YF.split32(this.h,"big")};var vW=HU,wW=aW;function MW(){if(!(this instanceof MW))return new MW;wW.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}vW.inherits(MW,wW);var _W=MW;MW.blockSize=1024,MW.outSize=384,MW.hmacStrength=192,MW.padLength=128,MW.prototype._digest=function(t){return"hex"===t?vW.toHex32(this.h.slice(0,12),"big"):vW.split32(this.h.slice(0,12),"big")},oF.sha1=MF,oF.sha224=WF,oF.sha256=RF,oF.sha384=_W,oF.sha512=aW;var EW={},NW=HU,LW=eF,SW=NW.rotl32,AW=NW.sum32,xW=NW.sum32_3,TW=NW.sum32_4,IW=LW.BlockHash;function kW(){if(!(this instanceof kW))return new kW;IW.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function jW(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function CW(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function DW(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}NW.inherits(kW,IW),EW.ripemd160=kW,kW.blockSize=512,kW.outSize=160,kW.hmacStrength=192,kW.padLength=64,kW.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=AW(SW(TW(n,jW(d,r,i,o),t[OW[d]+e],CW(d)),PW[d]),a);n=a,a=o,o=SW(i,10),i=r,r=f,f=AW(SW(TW(s,jW(79-d,u,c,l),t[zW[d]+e],DW(d)),RW[d]),h),s=h,h=l,l=SW(c,10),c=u,u=f}f=xW(this.h[1],i,l),this.h[1]=xW(this.h[2],o,h),this.h[2]=xW(this.h[3],a,s),this.h[3]=xW(this.h[4],n,u),this.h[4]=xW(this.h[0],r,c),this.h[0]=f},kW.prototype._digest=function(t){return"hex"===t?NW.toHex32(this.h,"little"):NW.split32(this.h,"little")};var OW=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zW=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],PW=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],RW=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],BW=HU,UW=GU;function FW(t,e,n){if(!(this instanceof FW))return new FW(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(BW.toArray(e,n))}var WW=FW;FW.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),UW(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},FW.prototype.update=function(t,e){return this.inner.update(t,e),this},FW.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=HU,e.common=eF,e.sha=oF,e.ripemd=EW,e.hmac=WW,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(QU);var YW=QU;let QW=!1,HW=!1;const GW={debug:1,default:2,info:2,warning:3,error:4,off:5};let ZW=GW.default,VW=null;const qW=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var JW,KW;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(JW||(JW={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(KW||(KW={}));const XW="0123456789abcdef";class $W{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==GW[n]&&this.throwArgumentError("invalid log level name","logLevel",t),ZW>GW[n]||console.log.apply(console,e)}debug(...t){this._log($W.levels.DEBUG,t)}info(...t){this._log($W.levels.INFO,t)}warn(...t){this._log($W.levels.WARNING,t)}makeError(t,e,n){if(HW)return this.makeError("censored error",e,{});e||(e=$W.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t<e.length;t++)n+=XW[e[t]>>4],n+=XW[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case KW.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case KW.CALL_EXCEPTION:case KW.INSUFFICIENT_FUNDS:case KW.MISSING_NEW:case KW.NONCE_EXPIRED:case KW.REPLACEMENT_UNDERPRICED:case KW.TRANSACTION_REPLACED:case KW.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,$W.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){qW&&this.throwError("platform missing String.prototype.normalize",$W.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:qW})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,$W.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,$W.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",t<e&&this.throwError("missing argument"+n,$W.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,$W.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",$W.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",$W.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",$W.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return VW||(VW=new $W("logger/5.6.0")),VW}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",$W.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),QW){if(!t)return;this.globalLogger().throwError("error censorship permanent",$W.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}HW=!!t,QW=!!e}static setLogLevel(t){const e=GW[t.toLowerCase()];null!=e?ZW=e:$W.globalLogger().warn("invalid log level - "+t)}static from(t){return new $W(t)}}$W.errors=KW,$W.levels=JW;const tY=new $W("bytes/5.6.0");function eY(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return eY(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function nY(t){return"number"==typeof t&&t==t&&t%1==0}function rY(t,e){if(e||(e={}),"number"==typeof t){tY.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),eY(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0x0"+n.substring(2):"right"===e.hexPad?n+="0":tY.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;t<n.length;t+=2)r.push(parseInt(n.substring(t,t+2),16));return eY(new Uint8Array(r))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!nY(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const n=t[e];if(!nY(n)||n<0||n>=256)return!1}return!0}(t)?eY(new Uint8Array(t)):tY.throwArgumentError("invalid arrayify value","value",t)}function iY(t){return"0x"+YW.sha256().update(rY(t)).digest("hex")}new $W("sha2/5.6.0");class oY{constructor(t){Object.assign(this,t)}encode(){return f_.from(WE(aY,this))}static decode(t){return HE(aY,this,t)}static decodeUnchecked(t){return TE(aY,this,t)}}const aY=new Map;class sY extends oY{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=lE.decode(t);if(32!=e.length)throw new Error("Invalid public key input");this._bn=new eE(e)}else this._bn=new eE(t);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(t){return this._bn.eq(t._bn)}toBase58(){return lE.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const t=this._bn.toArrayLike(f_);if(32===t.length)return t;const e=f_.alloc(32);return t.copy(e,32-t.length),e}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=f_.concat([t.toBuffer(),f_.from(e),n.toBuffer()]),i=iY(new Uint8Array(r)).slice(2);return new sY(f_.from(i,"hex"))}static createProgramAddressSync(t,e){let n=f_.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=f_.concat([n,YU(t)])})),n=f_.concat([n,e.toBuffer(),f_.from("ProgramDerivedAddress")]);let r=iY(new Uint8Array(n)).slice(2),i=new eE(r,16).toArray(void 0,32);if(cY(i))throw new Error("Invalid seeds, address must fall off the curve");return new sY(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const i=t.concat(f_.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return 1==cY(new sY(t).toBytes())}}sY.default=new sY("11111111111111111111111111111111"),aY.set(sY,{kind:"struct",fields:[["_bn","u256"]]});let uY=oE.lowlevel;function cY(t){var e=[uY.gf(),uY.gf(),uY.gf(),uY.gf()],n=uY.gf(),r=uY.gf(),i=uY.gf(),o=uY.gf(),a=uY.gf(),s=uY.gf(),u=uY.gf();return uY.set25519(e[2],lY),uY.unpack25519(e[1],t),uY.S(i,e[1]),uY.M(o,i,uY.D),uY.Z(i,i,e[2]),uY.A(o,e[2],o),uY.S(a,o),uY.S(s,a),uY.M(u,s,a),uY.M(n,u,i),uY.M(n,n,o),uY.pow2523(n,n),uY.M(n,n,i),uY.M(n,n,o),uY.M(n,n,o),uY.M(e[0],n,o),uY.S(r,e[0]),uY.M(r,r,o),dY(r,i)&&uY.M(e[0],e[0],hY),uY.S(r,e[0]),uY.M(r,r,o),dY(r,i)?0:1}let lY=uY.gf([1]),hY=uY.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function dY(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return uY.pack25519(n,t),uY.pack25519(r,e),uY.crypto_verify_32(n,0,r,0)}const fY=new sY("BPFLoader1111111111111111111111111111111111"),pY=1232,mY=(t="publicKey")=>RN(32,t),gY=(t="string")=>{const e=zN([CN("length"),CN("lengthPadding"),RN(IN(CN(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=(t,e)=>n(t,e).chars.toString(),i.encode=(t,e,n)=>{const i={chars:f_.from(t,"utf8")};return r(i,e,n)},i.alloc=t=>CN().span+CN().span+f_.from(t,"utf8").length,i};function yY(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function bY(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}class vY{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new sY(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){return t<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||t>=this.header.numRequiredSignatures&&t<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((t,e)=>!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];bY(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(lE.decode(t.data));let i=[];bY(i,e.length);let o=[];return bY(o,r.length),{programIdIndex:n,keyIndicesCount:f_.from(i),keyIndices:e,dataLength:f_.from(o),data:r}}));let r=[];bY(r,n.length);let i=f_.alloc(pY);f_.from(r).copy(i);let o=r.length;n.forEach((t=>{const e=zN([kN("programIdIndex"),RN(t.keyIndicesCount.length,"keyIndicesCount"),PN(kN("keyIndex"),t.keyIndices.length,"keyIndices"),RN(t.dataLength.length,"dataLength"),PN(kN("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const a=zN([RN(1,"numRequiredSignatures"),RN(1,"numReadonlySignedAccounts"),RN(1,"numReadonlyUnsignedAccounts"),RN(e.length,"keyCount"),PN(mY("key"),t,"keys"),mY("recentBlockhash")]),s={numRequiredSignatures:f_.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:f_.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:f_.from([this.header.numReadonlyUnsignedAccounts]),keyCount:f_.from(e),keys:this.accountKeys.map((t=>YU(t.toBytes()))),recentBlockhash:lE.decode(this.recentBlockhash)};let u=f_.alloc(2048);const c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}static from(t){let e=[...t];const n=e.shift(),r=e.shift(),i=e.shift(),o=yY(e);let a=[];for(let t=0;t<o;t++){const t=e.slice(0,32);e=e.slice(32),a.push(lE.encode(f_.from(t)))}const s=e.slice(0,32);e=e.slice(32);const u=yY(e);let c=[];for(let t=0;t<u;t++){const t=e.shift(),n=yY(e),r=e.slice(0,n);e=e.slice(n);const i=yY(e),o=e.slice(0,i),a=lE.encode(f_.from(o));e=e.slice(i),c.push({programIdIndex:t,accounts:r,data:a})}const l={header:{numRequiredSignatures:n,numReadonlySignedAccounts:r,numReadonlyUnsignedAccounts:i},recentBlockhash:lE.encode(f_.from(s)),accountKeys:a,instructions:c};return new vY(l)}}function wY(t,e){if(!t)throw new Error(e||"Assertion failed")}let MY;!function(t){t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT"}(MY||(MY={}));const _Y=f_.alloc(64).fill(0);class EY{constructor(t){this.keys=void 0,this.programId=void 0,this.data=f_.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class NY{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new EY(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw new Error(`Transaction instruction index ${t} has undefined program id`);const r=[],i=[];e.forEach((t=>{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new sY(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58())}));const a=o.findIndex((t=>t.pubkey.equals(n)));if(a>-1){const[t]=o.splice(a,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let s=0,u=0,c=0;const l=[],h=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(l.push(t.toString()),s+=1,n||(u+=1)):(h.push(t.toString()),n||(c+=1))}));const d=l.concat(h),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:d.indexOf(n.toString()),accounts:t.keys.map((t=>d.indexOf(t.pubkey.toString()))),data:lE.encode(e)}}));return f.forEach((t=>{wY(t.programIdIndex>=0),t.accounts.forEach((t=>wY(t>=0)))})),new vY({header:{numRequiredSignatures:s,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:d,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length){if(this.signatures.every(((t,n)=>e[n].equals(t.publicKey))))return t}return this.signatures=e.map((t=>({signature:null,publicKey:t}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=oE.sign.detached(n,t.secretKey);this._addSignature(t.publicKey,YU(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){wY(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=f_.from(e)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(t,e){for(const{signature:n,publicKey:r}of this.signatures)if(null===n){if(e)return!1}else if(!oE.sign.detached.verify(t,n,r.toBuffer()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n&&!this._verifySignatures(r,e))throw new Error("Signature verification failed");return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];bY(n,e.length);const r=n.length+64*e.length+t.length,i=f_.alloc(r);return wY(e.length<256),f_.from(n).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&(wY(64===t.length,"signature has invalid length"),f_.from(t).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),wY(i.length<=pY,`Transaction too large: ${i.length} > 1232`),i}get keys(){return wY(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return wY(1===this.instructions.length),this.instructions[0].programId}get data(){return wY(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=yY(e);let r=[];for(let t=0;t<n;t++){const t=e.slice(0,64);e=e.slice(64),r.push(lE.encode(f_.from(t)))}return NY.populate(vY.from(e),r)}static populate(t,e=[]){const n=new NY;return n.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==lE.encode(_Y)?null:lE.decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new EY({keys:r,programId:t.accountKeys[e.programIdIndex],data:lE.decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}const LY=new sY("SysvarC1ock11111111111111111111111111111111"),SY=new sY("SysvarEpochSchedu1e111111111111111111111111"),AY=new sY("Sysvar1nstructions1111111111111111111111111"),xY=new sY("SysvarRecentB1ockHashes11111111111111111111"),TY=new sY("SysvarRent111111111111111111111111111111111"),IY=new sY("SysvarRewards111111111111111111111111111111"),kY=new sY("SysvarS1otHashes111111111111111111111111111"),jY=new sY("SysvarS1otHistory11111111111111111111111111"),CY=new sY("SysvarStakeHistory1111111111111111111111111");async function DY(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i),a=null!=e.recentBlockhash&&null!=e.lastValidBlockHeight?(await t.confirmTransaction({signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value:(await t.confirmTransaction(o,r&&r.commitment)).value;if(a.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(a)})`);return o}function OY(t){return new Promise((e=>setTimeout(e,t)))}function zY(t,e){const n=t.layout.span>=0?t.layout.span:function(t,e){let n=0;return t.layout.fields.forEach((t=>{t.span>=0?n+=t.span:"function"==typeof t.alloc&&(n+=t.alloc(e[t.property]))})),n}(t,e),r=f_.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function PY(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const RY=DN("lamportsPerSignature"),BY=zN([CN("version"),CN("state"),mY("authorizedPubkey"),mY("nonce"),zN([RY],"feeCalculator")]),UY=BY.span;class FY{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=BY.decode(YU(t),0);return new FY({authorizedPubkey:new sY(e.authorizedPubkey),nonce:new sY(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const WY=(YY=8,t=>{const e=RN(YY,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return UN(f_.from(n))},i.encode=(t,e,r)=>{const i=FN(t,YY);return n(i,e,r)},i});var YY;const QY=Object.freeze({Create:{index:0,layout:zN([CN("instruction"),ON("lamports"),ON("space"),mY("programId")])},Assign:{index:1,layout:zN([CN("instruction"),mY("programId")])},Transfer:{index:2,layout:zN([CN("instruction"),WY("lamports")])},CreateWithSeed:{index:3,layout:zN([CN("instruction"),mY("base"),gY("seed"),ON("lamports"),ON("space"),mY("programId")])},AdvanceNonceAccount:{index:4,layout:zN([CN("instruction")])},WithdrawNonceAccount:{index:5,layout:zN([CN("instruction"),ON("lamports")])},InitializeNonceAccount:{index:6,layout:zN([CN("instruction"),mY("authorized")])},AuthorizeNonceAccount:{index:7,layout:zN([CN("instruction"),mY("authorized")])},Allocate:{index:8,layout:zN([CN("instruction"),ON("space")])},AllocateWithSeed:{index:9,layout:zN([CN("instruction"),mY("base"),gY("seed"),ON("space"),mY("programId")])},AssignWithSeed:{index:10,layout:zN([CN("instruction"),mY("base"),gY("seed"),mY("programId")])},TransferWithSeed:{index:11,layout:zN([CN("instruction"),WY("lamports"),gY("seed"),mY("programId")])},UpgradeNonceAccount:{index:12,layout:zN([CN("instruction")])}});class HY{constructor(){}static createAccount(t){const e=zY(QY.Create,{lamports:t.lamports,space:t.space,programId:YU(t.programId.toBuffer())});return new EY({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;if("basePubkey"in t){e=zY(QY.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{e=zY(QY.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new EY({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;if("basePubkey"in t){e=zY(QY.AssignWithSeed,{base:YU(t.basePubkey.toBuffer()),seed:t.seed,programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=zY(QY.Assign,{programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new EY({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=zY(QY.CreateWithSeed,{base:YU(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:YU(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new EY({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new NY;"basePubkey"in t&&"seed"in t?e.add(HY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:UY,programId:this.programId})):e.add(HY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:UY,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=zY(QY.InitializeNonceAccount,{authorized:YU(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:xY,isSigner:!1,isWritable:!1},{pubkey:TY,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new EY(n)}static nonceAdvance(t){const e=zY(QY.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:xY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new EY(n)}static nonceWithdraw(t){const e=zY(QY.WithdrawNonceAccount,{lamports:t.lamports});return new EY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:xY,isSigner:!1,isWritable:!1},{pubkey:TY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=zY(QY.AuthorizeNonceAccount,{authorized:YU(t.newAuthorizedPubkey.toBuffer())});return new EY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;if("basePubkey"in t){e=zY(QY.AllocateWithSeed,{base:YU(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=zY(QY.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new EY({keys:n,programId:this.programId,data:e})}}HY.programId=new sY("11111111111111111111111111111111");class GY{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/GY.chunkSize)+1+1)}static async load(t,e,n,r,i){{const o=await t.getMinimumBalanceForRentExemption(i.length),a=await t.getAccountInfo(n.publicKey,"confirmed");let s=null;if(null!==a){if(a.executable)return console.error("Program load failed, account is already executable"),!1;a.data.length!==i.length&&(s=s||new NY,s.add(HY.allocate({accountPubkey:n.publicKey,space:i.length}))),a.owner.equals(r)||(s=s||new NY,s.add(HY.assign({accountPubkey:n.publicKey,programId:r}))),a.lamports<o&&(s=s||new NY,s.add(HY.transfer({fromPubkey:e.publicKey,toPubkey:n.publicKey,lamports:o-a.lamports})))}else s=(new NY).add(HY.createAccount({fromPubkey:e.publicKey,newAccountPubkey:n.publicKey,lamports:o>0?o:1,space:i.length,programId:r}));null!==s&&await DY(t,s,[e,n],{commitment:"confirmed"})}const o=zN([CN("instruction"),CN("offset"),CN("bytesLength"),CN("bytesLengthPadding"),PN(kN("byte"),IN(CN(),-8),"bytes")]),a=GY.chunkSize;let s=0,u=i,c=[];for(;u.length>0;){const i=u.slice(0,a),l=f_.alloc(a+16);o.encode({instruction:0,offset:s,bytes:i,bytesLength:0,bytesLengthPadding:0},l);const h=(new NY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(c.push(DY(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await OY(1e3/t)}s+=a,u=u.slice(a)}await Promise.all(c);{const i=zN([CN("instruction")]),o=f_.alloc(i.span);i.encode({instruction:1},o);const a=(new NY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:TY,isSigner:!1,isWritable:!1}],programId:r,data:o});await DY(t,a,[e,n],{commitment:"confirmed"})}return!0}}GY.chunkSize=932;const ZY=new sY("BPFLoader2111111111111111111111111111111111");const VY=Object.freeze({RequestUnits:{index:0,layout:zN([kN("instruction"),CN("units"),CN("additionalFee")])},RequestHeapFrame:{index:1,layout:zN([kN("instruction"),CN("bytes")])},SetComputeUnitLimit:{index:2,layout:zN([kN("instruction"),CN("units")])},SetComputeUnitPrice:{index:3,layout:zN([kN("instruction"),WY("microLamports")])}});class qY{constructor(){}static requestUnits(t){const e=zY(VY.RequestUnits,t);return new EY({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=zY(VY.RequestHeapFrame,t);return new EY({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=zY(VY.SetComputeUnitLimit,t);return new EY({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=zY(VY.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new EY({keys:[],programId:this.programId,data:e})}}qY.programId=new sY("ComputeBudget111111111111111111111111111111");var JY=Object.prototype.toString,KY=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function XY(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return XY(t.toJSON(),e);if("[object Array]"===(u=JY.call(t))){for(i="[",r=t.length-1,n=0;n<r;n++)i+=XY(t[n],!0)+",";return r>-1&&(i+=XY(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=KY(t).sort()).length,i="",n=0;n<r;)void 0!==(s=XY(t[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(t);case"function":case"undefined":return e?null:void 0;case"string":return JSON.stringify(t);default:return isFinite(t)?t:null}}var $Y=function(t){var e=XY(t,!1);if(void 0!==e)return""+e};function tQ(t){let e=0;for(;t>1;)t/=2,e++;return e}class eQ{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){const e=tQ(function(t){return 0===t?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-tQ(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t<this.firstNormalEpoch?Math.pow(2,t+tQ(32)):this.slotsPerEpoch}}class nQ extends Error{constructor(t,e){super(t),this.logs=void 0,this.logs=e}}class rQ extends Error{constructor({code:t,message:e,data:n},r){super(null!=r?`${r}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=n,this.name="SolanaJSONRPCError"}}var iQ=globalThis.fetch;class oQ extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(oQ.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class aQ extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}var sQ;Object.defineProperty(aQ.prototype,"name",{value:"TransactionExpiredTimeoutError"});const uQ=fL(nL(sY),uL(),(t=>new sY(t))),cQ=cL([uL(),rL("base64")]),lQ=fL(nL(f_),cQ,(t=>f_.from(t[0],"base64")));function hQ(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function dQ(t){return hL([lL({jsonrpc:rL("2.0"),id:uL(),result:t}),lL({jsonrpc:rL("2.0"),id:uL(),error:lL({code:dL(),message:uL(),data:aL($N("any",(()=>!0)))})})])}const fQ=dQ(dL());function pQ(t){return fL(dQ(t),fQ,(e=>"error"in e?e:{...e,result:JN(e.result,t)}))}function mQ(t){return pQ(lL({context:lL({slot:oL()}),value:t}))}function gQ(t){return lL({context:lL({slot:oL()}),value:t})}const yQ=lL({foundation:oL(),foundationTerm:oL(),initial:oL(),taper:oL(),terminal:oL()}),bQ=pQ(tL(iL(lL({epoch:oL(),effectiveSlot:oL(),amount:oL(),postBalance:oL()})))),vQ=lL({epoch:oL(),slotIndex:oL(),slotsInEpoch:oL(),absoluteSlot:oL(),blockHeight:aL(oL()),transactionCount:aL(oL())}),wQ=lL({slotsPerEpoch:oL(),leaderScheduleSlotOffset:oL(),warmup:eL(),firstNormalEpoch:oL(),firstNormalSlot:oL()}),MQ=sL(uL(),tL(oL())),_Q=iL(hL([lL({}),uL()])),EQ=lL({err:_Q}),NQ=rL("receivedSignature"),LQ=lL({"solana-core":uL(),"feature-set":aL(oL())}),SQ=mQ(lL({err:iL(hL([lL({}),uL()])),logs:iL(tL(uL())),accounts:aL(iL(tL(iL(lL({executable:eL(),owner:uL(),lamports:oL(),data:tL(uL()),rentEpoch:aL(oL())}))))),unitsConsumed:aL(oL())})),AQ=mQ(lL({byIdentity:sL(uL(),tL(oL())),range:lL({firstSlot:oL(),lastSlot:oL()})}));const xQ=pQ(yQ),TQ=pQ(vQ),IQ=pQ(wQ),kQ=pQ(MQ),jQ=pQ(oL()),CQ=mQ(lL({total:oL(),circulating:oL(),nonCirculating:oL(),nonCirculatingAccounts:tL(uQ)})),DQ=lL({amount:uL(),uiAmount:iL(oL()),decimals:oL(),uiAmountString:aL(uL())}),OQ=mQ(tL(lL({address:uQ,amount:uL(),uiAmount:iL(oL()),decimals:oL(),uiAmountString:aL(uL())}))),zQ=mQ(tL(lL({pubkey:uQ,account:lL({executable:eL(),owner:uQ,lamports:oL(),data:lQ,rentEpoch:oL()})}))),PQ=lL({program:uL(),parsed:dL(),space:oL()}),RQ=mQ(tL(lL({pubkey:uQ,account:lL({executable:eL(),owner:uQ,lamports:oL(),data:PQ,rentEpoch:oL()})}))),BQ=mQ(tL(lL({lamports:oL(),address:uQ}))),UQ=lL({executable:eL(),owner:uQ,lamports:oL(),data:lQ,rentEpoch:oL()}),FQ=lL({pubkey:uQ,account:UQ}),WQ=fL(hL([nL(f_),PQ]),hL([cQ,PQ]),(t=>Array.isArray(t)?JN(t,lQ):t)),YQ=lL({executable:eL(),owner:uQ,lamports:oL(),data:WQ,rentEpoch:oL()}),QQ=lL({pubkey:uQ,account:YQ}),HQ=lL({state:hL([rL("active"),rL("inactive"),rL("activating"),rL("deactivating")]),active:oL(),inactive:oL()}),GQ=pQ(tL(lL({signature:uL(),slot:oL(),err:_Q,memo:iL(uL()),blockTime:aL(iL(oL()))}))),ZQ=pQ(tL(lL({signature:uL(),slot:oL(),err:_Q,memo:iL(uL()),blockTime:aL(iL(oL()))}))),VQ=lL({subscription:oL(),result:gQ(UQ)}),qQ=lL({pubkey:uQ,account:UQ}),JQ=lL({subscription:oL(),result:gQ(qQ)}),KQ=lL({parent:oL(),slot:oL(),root:oL()}),XQ=lL({subscription:oL(),result:KQ}),$Q=hL([lL({type:hL([rL("firstShredReceived"),rL("completed"),rL("optimisticConfirmation"),rL("root")]),slot:oL(),timestamp:oL()}),lL({type:rL("createdBank"),parent:oL(),slot:oL(),timestamp:oL()}),lL({type:rL("frozen"),slot:oL(),timestamp:oL(),stats:lL({numTransactionEntries:oL(),numSuccessfulTransactions:oL(),numFailedTransactions:oL(),maxTransactionsPerEntry:oL()})}),lL({type:rL("dead"),slot:oL(),timestamp:oL(),err:uL()})]),tH=lL({subscription:oL(),result:$Q}),eH=lL({subscription:oL(),result:gQ(hL([EQ,NQ]))}),nH=lL({subscription:oL(),result:oL()}),rH=lL({pubkey:uL(),gossip:iL(uL()),tpu:iL(uL()),rpc:iL(uL()),version:iL(uL())}),iH=lL({votePubkey:uL(),nodePubkey:uL(),activatedStake:oL(),epochVoteAccount:eL(),epochCredits:tL(cL([oL(),oL(),oL()])),commission:oL(),lastVote:oL(),rootSlot:iL(oL())}),oH=pQ(lL({current:tL(iH),delinquent:tL(iH)})),aH=hL([rL("processed"),rL("confirmed"),rL("finalized")]),sH=lL({slot:oL(),confirmations:iL(oL()),err:_Q,confirmationStatus:aL(aH)}),uH=mQ(tL(iL(sH))),cH=pQ(oL()),lH=lL({signatures:tL(uL()),message:lL({accountKeys:tL(uL()),header:lL({numRequiredSignatures:oL(),numReadonlySignedAccounts:oL(),numReadonlyUnsignedAccounts:oL()}),instructions:tL(lL({accounts:tL(oL()),data:uL(),programIdIndex:oL()})),recentBlockhash:uL()})}),hH=lL({parsed:dL(),program:uL(),programId:uQ}),dH=lL({accounts:tL(uQ),data:uL(),programId:uQ}),fH=fL(hL([dH,hH]),hL([lL({parsed:dL(),program:uL(),programId:uL()}),lL({accounts:tL(uL()),data:uL(),programId:uL()})]),(t=>JN(t,"accounts"in t?dH:hH))),pH=lL({signatures:tL(uL()),message:lL({accountKeys:tL(lL({pubkey:uQ,signer:eL(),writable:eL()})),instructions:tL(fH),recentBlockhash:uL()})}),mH=lL({accountIndex:oL(),mint:uL(),owner:aL(uL()),uiTokenAmount:DQ}),gH=lL({err:_Q,fee:oL(),innerInstructions:aL(iL(tL(lL({index:oL(),instructions:tL(lL({accounts:tL(oL()),data:uL(),programIdIndex:oL()}))})))),preBalances:tL(oL()),postBalances:tL(oL()),logMessages:aL(iL(tL(uL()))),preTokenBalances:aL(iL(tL(mH))),postTokenBalances:aL(iL(tL(mH)))}),yH=lL({err:_Q,fee:oL(),innerInstructions:aL(iL(tL(lL({index:oL(),instructions:tL(fH)})))),preBalances:tL(oL()),postBalances:tL(oL()),logMessages:aL(iL(tL(uL()))),preTokenBalances:aL(iL(tL(mH))),postTokenBalances:aL(iL(tL(mH)))}),bH=pQ(iL(lL({blockhash:uL(),previousBlockhash:uL(),parentSlot:oL(),transactions:tL(lL({transaction:lH,meta:iL(gH)})),rewards:aL(tL(lL({pubkey:uL(),lamports:oL(),postBalance:iL(oL()),rewardType:iL(uL())}))),blockTime:iL(oL()),blockHeight:iL(oL())}))),vH=pQ(iL(lL({blockhash:uL(),previousBlockhash:uL(),parentSlot:oL(),transactions:tL(lL({transaction:lH,meta:iL(gH)})),rewards:aL(tL(lL({pubkey:uL(),lamports:oL(),postBalance:iL(oL()),rewardType:iL(uL())}))),blockTime:iL(oL())}))),wH=pQ(iL(lL({blockhash:uL(),previousBlockhash:uL(),parentSlot:oL(),signatures:tL(uL()),blockTime:iL(oL())}))),MH=pQ(iL(lL({slot:oL(),meta:gH,blockTime:aL(iL(oL())),transaction:lH}))),_H=pQ(iL(lL({slot:oL(),transaction:pH,meta:iL(yH),blockTime:aL(iL(oL()))}))),EH=mQ(lL({blockhash:uL(),feeCalculator:lL({lamportsPerSignature:oL()})})),NH=mQ(lL({blockhash:uL(),lastValidBlockHeight:oL()})),LH=pQ(tL(lL({slot:oL(),numTransactions:oL(),numSlots:oL(),samplePeriodSecs:oL()}))),SH=mQ(iL(lL({feeCalculator:lL({lamportsPerSignature:oL()})}))),AH=pQ(uL()),xH=pQ(uL()),TH=lL({err:_Q,logs:tL(uL()),signature:uL()}),IH=lL({result:gQ(TH),subscription:oL()}),kH={"solana-client":`js/${null!==(sQ="0.0.0-development")?sQ:"UNKNOWN"}`};class jH{constructor(t,e){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set;let n=new URL(t);n.protocol;let r,i,o,a,s;e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,r=e.wsEndpoint,i=e.httpHeaders,o=e.fetch,a=e.fetchMiddleware,s=e.disableRetryOnRateLimit),this._rpcEndpoint=t,this._rpcWsEndpoint=r||function(t){let e=new URL(t);const n="https:"===e.protocol;return e.protocol=n?"wss:":"ws:",e.host="",""!==e.port&&(e.port=String(Number(e.port)+1)),e.toString()}(t),this._rpcClient=function(t,e,n,r,i,o){const a=r||iQ;let s;i&&(s=async(t,e)=>{const n=await new Promise(((n,r)=>{try{i(t,e,((t,e)=>n([t,e])))}catch(t){r(t)}}));return await a(...n)});const u=new Iz((async(e,r)=>{const i={method:"POST",body:e,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},n||{},kH)};try{let e,n=5,u=500;for(;e=s?await s(t,i):await a(t,i),429===e.status&&!0!==o&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await OY(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{});return u}(n.toString(),0,i,o,a,s),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new pL.Client(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=hQ(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=JN(await this._rpcRequest("getBalance",i),mQ(oL()));if("error"in o)throw new rQ(o.error,`failed to get balance for ${t.toBase58()}`);return o.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=JN(await this._rpcRequest("getBlockTime",[t]),pQ(iL(oL())));if("error"in e)throw new rQ(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){const t=JN(await this._rpcRequest("minimumLedgerSlot",[]),pQ(oL()));if("error"in t)throw new rQ(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const t=JN(await this._rpcRequest("getFirstAvailableBlock",[]),jQ);if("error"in t)throw new rQ(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=JN(await this._rpcRequest("getSupply",[e]),CQ);if("error"in n)throw new rQ(n.error,"failed to get supply");return n.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=JN(await this._rpcRequest("getTokenSupply",n),mQ(DQ));if("error"in r)throw new rQ(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=JN(await this._rpcRequest("getTokenAccountBalance",n),mQ(DQ));if("error"in r)throw new rQ(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=hQ(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const a=this._buildArgs(o,r,"base64",i),s=JN(await this._rpcRequest("getTokenAccountsByOwner",a),zQ);if("error"in s)throw new rQ(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=JN(await this._rpcRequest("getTokenAccountsByOwner",i),RQ);if("error"in o)throw new rQ(o.error,`failed to get token accounts owned by account ${t.toBase58()}`);return o.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=JN(await this._rpcRequest("getLargestAccounts",n),BQ);if("error"in r)throw new rQ(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=JN(await this._rpcRequest("getTokenLargestAccounts",n),OQ);if("error"in r)throw new rQ(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=hQ(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=JN(await this._rpcRequest("getAccountInfo",i),mQ(iL(UQ)));if("error"in o)throw new rQ(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getParsedAccountInfo(t,e){const n=this._buildArgs([t.toBase58()],e,"jsonParsed"),r=JN(await this._rpcRequest("getAccountInfo",n),mQ(iL(YQ)));if("error"in r)throw new rQ(r.error,`failed to get info about account ${t.toBase58()}`);return r.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=hQ(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),a=JN(await this._rpcRequest("getMultipleAccounts",o),mQ(tL(iL(UQ))));if("error"in a)throw new rQ(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=hQ(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:null==i?void 0:i.epoch}),a=JN(await this._rpcRequest("getStakeActivation",o),pQ(HQ));if("error"in a)throw new rQ(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=hQ(e),{encoding:i,...o}=r||{},a=this._buildArgs([t.toBase58()],n,i||"base64",o),s=JN(await this._rpcRequest("getProgramAccounts",a),pQ(tL(FQ)));if("error"in s)throw new rQ(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=hQ(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=JN(await this._rpcRequest("getProgramAccounts",i),pQ(tL(QQ)));if("error"in o)throw new rQ(o.error,`failed to get accounts owned by program ${t.toBase58()}`);return o.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{n=t.signature}try{r=lE.decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}wY(64===r.length,"signature has invalid length");const i=e||this.commitment;let o,a,s=!1;const u=new Promise(((t,e)=>{try{a=this.onSignature(n,((e,n)=>{a=void 0;const r={context:n,value:e};s=!0,t({__type:MY.PROCESSED,response:r})}),i)}catch(t){e(t)}})),c=new Promise((n=>{if("string"==typeof t){let t=this._confirmTransactionInitialTimeout||6e4;switch(i){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=this._confirmTransactionInitialTimeout||3e4}o=setTimeout((()=>n({__type:MY.TIMED_OUT,timeoutMs:t})),t)}else{let r=t;const i=async()=>{try{return await this.getBlockHeight(e)}catch(t){return-1}};(async()=>{let t=await i();if(!s){for(;t<=r.lastValidBlockHeight;){if(await OY(1e3),s)return;if(t=await i(),s)return}n({__type:MY.BLOCKHEIGHT_EXCEEDED})}})()}}));let l;try{const t=await Promise.race([u,c]);switch(t.__type){case MY.BLOCKHEIGHT_EXCEEDED:throw new oQ(n);case MY.PROCESSED:l=t.response;break;case MY.TIMED_OUT:throw new aQ(n,t.timeoutMs/1e3)}}finally{clearTimeout(o),a&&this.removeSignatureListener(a)}return l}async getClusterNodes(){const t=JN(await this._rpcRequest("getClusterNodes",[]),pQ(tL(rH)));if("error"in t)throw new rQ(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=JN(await this._rpcRequest("getVoteAccounts",e),oH);if("error"in n)throw new rQ(n.error,"failed to get vote accounts");return n.result}async getSlot(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getSlot",r),pQ(oL()));if("error"in i)throw new rQ(i.error,"failed to get slot");return i.result}async getSlotLeader(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getSlotLeader",r),pQ(uL()));if("error"in i)throw new rQ(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(t,e){const n=[t,e],r=JN(await this._rpcRequest("getSlotLeaders",n),pQ(tL(uQ)));if("error"in r)throw new rQ(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);wY(1===r.length);return{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=JN(await this._rpcRequest("getSignatureStatuses",n),uH);if("error"in r)throw new rQ(r.error,"failed to get signature status");return r.result}async getTransactionCount(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getTransactionCount",r),pQ(oL()));if("error"in i)throw new rQ(i.error,"failed to get transaction count");return i.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=JN(await this._rpcRequest("getInflationGovernor",e),xQ);if("error"in n)throw new rQ(n.error,"failed to get inflation");return n.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=hQ(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:null==i?void 0:i.epoch}),a=JN(await this._rpcRequest("getInflationReward",o),bQ);if("error"in a)throw new rQ(a.error,"failed to get inflation reward");return a.result}async getEpochInfo(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getEpochInfo",r),TQ);if("error"in i)throw new rQ(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const t=JN(await this._rpcRequest("getEpochSchedule",[]),IQ);if("error"in t)throw new rQ(t.error,"failed to get epoch schedule");const e=t.result;return new eQ(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){const t=JN(await this._rpcRequest("getLeaderSchedule",[]),kQ);if("error"in t)throw new rQ(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=JN(await this._rpcRequest("getMinimumBalanceForRentExemption",n),cH);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=JN(await this._rpcRequest("getRecentBlockhash",e),EH);if("error"in n)throw new rQ(n.error,"failed to get recent blockhash");return n.result}async getRecentPerformanceSamples(t){const e=JN(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),LH);if("error"in e)throw new rQ(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=JN(await this._rpcRequest("getFeeCalculatorForBlockhash",n),SH);if("error"in r)throw new rQ(r.error,"failed to get fee calculator");const{context:i,value:o}=r.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(t,e){const n=t.serialize().toString("base64"),r=this._buildArgs([n],e),i=JN(await this._rpcRequest("getFeeForMessage",r),mQ(iL(oL())));if("error"in i)throw new rQ(i.error,"failed to get slot");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getLatestBlockhash",r),NH);if("error"in i)throw new rQ(i.error,"failed to get latest blockhash");return i.result}async getVersion(){const t=JN(await this._rpcRequest("getVersion",[]),pQ(LQ));if("error"in t)throw new rQ(t.error,"failed to get version");return t.result}async getGenesisHash(){const t=JN(await this._rpcRequest("getGenesisHash",[]),pQ(uL()));if("error"in t)throw new rQ(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=JN(await this._rpcRequest("getBlock",n),bH);if("error"in r)throw new rQ(r.error,"failed to get confirmed block");const i=r.result;return i?{...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new vY(t.message);return{meta:e,transaction:{...t,message:n}}}))}:i}async getBlockHeight(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getBlockHeight",r),pQ(oL()));if("error"in i)throw new rQ(i.error,"failed to get block height information");return i.result}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=JN(await this._rpcRequest("getBlockProduction",r),AQ);if("error"in i)throw new rQ(i.error,"failed to get block production information");return i.result}async getTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=JN(await this._rpcRequest("getTransaction",n),MH);if("error"in r)throw new rQ(r.error,"failed to get transaction");const i=r.result;return i?{...i,transaction:{...i.transaction,message:new vY(i.transaction.message)}}:i}async getParsedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=JN(await this._rpcRequest("getTransaction",n),_H);if("error"in r)throw new rQ(r.error,"failed to get transaction");return r.result}async getParsedTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=JN(t,_H);if("error"in e)throw new rQ(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e)})));return(await this._rpcBatchRequest(n)).map((t=>{const e=JN(t,MH);if("error"in e)throw new rQ(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:new vY(n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=JN(await this._rpcRequest("getConfirmedBlock",n),vH);if("error"in r)throw new rQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");const o={...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new vY(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...o,transactions:o.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:NY.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=JN(await this._rpcRequest("getBlocks",r),pQ(tL(oL())));if("error"in i)throw new rQ(i.error,"failed to get blocks");return i.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=JN(await this._rpcRequest("getBlock",n),wH);if("error"in r)throw new rQ(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+t+" not found");return i}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=JN(await this._rpcRequest("getConfirmedBlock",n),wH);if("error"in r)throw new rQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");return i}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=JN(await this._rpcRequest("getConfirmedTransaction",n),MH);if("error"in r)throw new rQ(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new vY(i.transaction.message),a=i.transaction.signatures;return{...i,transaction:NY.populate(o,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=JN(await this._rpcRequest("getConfirmedTransaction",n),_H);if("error"in r)throw new rQ(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=JN(t,_H);if("error"in e)throw new rQ(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e<i);)try{const t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=JN(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),GQ);if("error"in i)throw new rQ(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=JN(await this._rpcRequest("getSignaturesForAddress",r),ZQ);if("error"in i)throw new rQ(i.error,"failed to get signatures for address");return i.result}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=FY.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=JN(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),AH);if("error"in n)throw new rQ(n.error,`airdrop to ${t.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await OY(100);const t=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await OY(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(t,e,n){let r;if(t instanceof NY){let e=t;r=new NY,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=NY.populate(t),r._message=r._json=void 0;if(r.nonceInfo&&e)r.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=n.lastValidBlockHeight,r.recentBlockhash=n.blockhash,!e)break;if(r.sign(...e),!r.signature)throw new Error("!signature");const i=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(i)&&!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.simulatedSignatures.push(i);break}t=!0}}const i=r._compile(),o=i.serialize(),a=r._serialize(o).toString("base64"),s={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:i.nonProgramIds()).map((t=>t.toBase58()));s.accounts={encoding:"base64",addresses:t}}e&&(s.sigVerify=!0);const u=[a,s],c=JN(await this._rpcRequest("simulateTransaction",u),SQ);if("error"in c){let t;if("data"in c.error&&(t=c.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(c.error.message,n)}throw new nQ("failed to simulate transaction: "+c.error.message,t)}return c.result}async sendTransaction(t,e,n){if(t.nonceInfo)t.sign(...e);else{let n=this._disableBlockhashCaching;for(;;){const r=await this._blockhashWithExpiryBlockHeight(n);if(t.lastValidBlockHeight=r.lastValidBlockHeight,t.recentBlockhash=r.blockhash,t.sign(...e),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}n=!0}}const r=t.serialize();return await this.sendRawTransaction(r,n)}async sendRawTransaction(t,e){const n=YU(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],a=JN(await this._rpcRequest("sendTransaction",o),xH);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new nQ("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{this._rpcWebSocket.notify("ping").catch((()=>{}))}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration++,this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._subscriptionsByHash[t]={...e,state:"pending"}}))):this._updateSubscriptions()}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._subscriptionsByHash[t]={...n,state:"subscribing"};const e=await this._rpcWebSocket.call(i,r);this._subscriptionsByHash[t]={...n,serverSubscriptionId:e,state:"subscribed"},this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._subscriptionsByHash[t]={...n,state:"pending"},await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._subscriptionsByHash[t]={...n,state:"unsubscribing"};try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._subscriptionsByHash[t]={...n,state:"subscribed"},void await this._updateSubscriptions()}}this._subscriptionsByHash[t]={...n,state:"unsubscribed"},await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=JN(t,VQ);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=$Y([t.method,e]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];wY(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=JN(t,JQ);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=JN(t,IH);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=JN(t,XQ);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=JN(t,tH);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=JN(t,eH);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),a=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(a)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return a}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=JN(t,nH);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class CH{constructor(t){this._keypair=void 0,this._keypair=t||oE.sign.keyPair()}static generate(){return new CH(oE.sign.keyPair())}static fromSecretKey(t,e){const n=oE.sign.keyPair.fromSecretKey(t);if(!e||!e.skipValidation){const t=(new TextEncoder).encode("@solana/web3.js-validation-v1"),e=oE.sign.detached(t,n.secretKey);if(!oE.sign.detached.verify(t,e,n.publicKey))throw new Error("provided secretKey is invalid")}return new CH(n)}static fromSeed(t){return new CH(oE.sign.keyPair.fromSeed(t))}get publicKey(){return new sY(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const DH=zN([kN("numSignatures"),kN("padding"),jN("signatureOffset"),jN("signatureInstructionIndex"),jN("publicKeyOffset"),jN("publicKeyInstructionIndex"),jN("messageDataOffset"),jN("messageDataSize"),jN("messageInstructionIndex")]);class OH{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:i}=t;wY(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),wY(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const o=DH.span,a=o+e.length,s=a+r.length,u=f_.alloc(s+n.length),c=null==i?65535:i;return DH.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:c,publicKeyOffset:o,publicKeyInstructionIndex:c,messageDataOffset:s,messageDataSize:n.length,messageInstructionIndex:c},u),u.fill(e,o),u.fill(r,a),u.fill(n,s),new EY({keys:[],programId:OH.programId,data:u})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;wY(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=CH.fromSecretKey(e),i=t.publicKey.toBytes(),o=oE.sign.detached(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}OH.programId=new sY("Ed25519SigVerify111111111111111111111111111");const zH=new sY("StakeConfig11111111111111111111111111111111");class PH{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class RH{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}RH.default=new RH(0,0,sY.default);const BH=Object.freeze({Initialize:{index:0,layout:zN([CN("instruction"),((t="authorized")=>zN([mY("staker"),mY("withdrawer")],t))(),((t="lockup")=>zN([ON("unixTimestamp"),ON("epoch"),mY("custodian")],t))()])},Authorize:{index:1,layout:zN([CN("instruction"),mY("newAuthorized"),CN("stakeAuthorizationType")])},Delegate:{index:2,layout:zN([CN("instruction")])},Split:{index:3,layout:zN([CN("instruction"),ON("lamports")])},Withdraw:{index:4,layout:zN([CN("instruction"),ON("lamports")])},Deactivate:{index:5,layout:zN([CN("instruction")])},Merge:{index:7,layout:zN([CN("instruction")])},AuthorizeWithSeed:{index:8,layout:zN([CN("instruction"),mY("newAuthorized"),CN("stakeAuthorizationType"),gY("authoritySeed"),mY("authorityOwner")])}}),UH=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class FH{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||RH.default,o=zY(BH.Initialize,{authorized:{staker:YU(n.staker.toBuffer()),withdrawer:YU(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:YU(i.custodian.toBuffer())}}),a={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:TY,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new EY(a)}static createAccountWithSeed(t){const e=new NY;e.add(HY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new NY;e.add(HY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=zY(BH.Delegate);return(new NY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:CY,isSigner:!1,isWritable:!1},{pubkey:zH,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,a=zY(BH.Authorize,{newAuthorized:YU(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new NY).add({keys:s,programId:this.programId,data:a})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:a,custodianPubkey:s}=t,u=zY(BH.AuthorizeWithSeed,{newAuthorized:YU(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:YU(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:LY,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new NY).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=zY(BH.Split,{lamports:i});return new EY({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new NY;return e.add(HY.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:a}=t,s=new NY;return s.add(HY.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=zY(BH.Merge);return(new NY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:CY,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,a=zY(BH.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:CY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new NY).add({keys:s,programId:this.programId,data:a})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=zY(BH.Deactivate);return(new NY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}FH.programId=new sY("Stake11111111111111111111111111111111111111"),FH.space=200;const{publicKeyCreate:WH,ecdsaSign:YH}=UU,QH=zN([kN("numSignatures"),jN("signatureOffset"),kN("signatureInstructionIndex"),jN("ethAddressOffset"),kN("ethAddressInstructionIndex"),jN("messageDataOffset"),jN("messageDataSize"),kN("messageInstructionIndex"),RN(20,"ethAddress"),RN(64,"signature"),kN("recoveryId")]);class HH{constructor(){}static publicKeyToEthAddress(t){wY(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return f_.from(WU.keccak_256.update(YU(t)).digest()).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return HH.createInstructionWithEthAddress({ethAddress:HH.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?f_.from(e.substr(2),"hex"):f_.from(e,"hex"):e,wY(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const s=12+a.length,u=s+r.length+1,c=f_.alloc(QH.span+n.length);return QH.encode({numSignatures:1,signatureOffset:s,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:o,signature:YU(r),ethAddress:YU(a),recoveryId:i},c),c.fill(YU(n),QH.span),new EY({keys:[],programId:HH.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;wY(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=YU(e),i=WH(t,!1).slice(1),o=f_.from(WU.keccak_256.update(YU(n)).digest()),{signature:a,recid:s}=YH(o,t);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:a,recoveryId:s,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}HH.programId=new sY("KeccakSecp256k11111111111111111111111111111");const GH=new sY("Va1idator1nfo111111111111111111111111111111"),ZH=lL({name:uL(),website:aL(uL()),details:aL(uL()),keybaseUsername:aL(uL())});class VH{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==yY(e))return null;const n=[];for(let t=0;t<2;t++){const t=new sY(e.slice(0,32));e=e.slice(32);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(GH)&&n[1].isSigner){const t=gY().decode(f_.from(e)),r=JSON.parse(t);return qN(r,ZH),new VH(n[1].publicKey,r)}return null}}const qH=new sY("Vote111111111111111111111111111111111111111"),JH=zN([mY("nodePubkey"),mY("authorizedWithdrawer"),kN("commission"),DN(),PN(zN([DN("slot"),CN("confirmationCount")]),IN(CN(),-8),"votes"),kN("rootSlotValid"),DN("rootSlot"),DN(),PN(zN([DN("epoch"),mY("authorizedVoter")]),IN(CN(),-8),"authorizedVoters"),zN([PN(zN([mY("authorizedPubkey"),DN("epochOfLastAuthorizedSwitch"),DN("targetEpoch")]),32,"buf"),DN("idx"),kN("isEmpty")],"priorVoters"),DN(),PN(zN([DN("epoch"),DN("credits"),DN("prevCredits")]),IN(CN(),-8),"epochCredits"),zN([DN("slot"),DN("timestamp")],"lastTimestamp")]);class KH{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=JH.decode(YU(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new KH({nodePubkey:new sY(e.nodePubkey),authorizedWithdrawer:new sY(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(XH),priorVoters:tG(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function XH({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new sY(t)}}function $H({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new sY(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function tG({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map($H),...t.slice(0,e).map($H)]}class eG{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}const nG=Object.freeze({InitializeAccount:{index:0,layout:zN([CN("instruction"),((t="voteInit")=>zN([mY("nodePubkey"),mY("authorizedVoter"),mY("authorizedWithdrawer"),kN("commission")],t))()])},Authorize:{index:1,layout:zN([CN("instruction"),mY("newAuthorized"),CN("voteAuthorizationType")])},Withdraw:{index:3,layout:zN([CN("instruction"),ON("lamports")])}}),rG=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class iG{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=zY(nG.InitializeAccount,{voteInit:{nodePubkey:YU(r.nodePubkey.toBuffer()),authorizedVoter:YU(r.authorizedVoter.toBuffer()),authorizedWithdrawer:YU(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:TY,isSigner:!1,isWritable:!1},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new EY(o)}static createAccount(t){const e=new NY;return e.add(HY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=zY(nG.Authorize,{newAuthorized:YU(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new NY).add({keys:a,programId:this.programId,data:o})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=zY(nG.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new NY).add({keys:a,programId:this.programId,data:o})}}iG.programId=new sY("Vote111111111111111111111111111111111111111"),iG.space=3731;const oG={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};var aG=Object.freeze({__proto__:null,Account:class{constructor(t){this._keypair=void 0,this._keypair=t?oE.sign.keyPair.fromSecretKey(YU(t)):oE.sign.keyPair()}get publicKey(){return new sY(this._keypair.publicKey)}get secretKey(){return YU(this._keypair.secretKey)}},Authorized:PH,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:fY,BPF_LOADER_PROGRAM_ID:ZY,BpfLoader:class{static getMinNumSignatures(t){return GY.getMinNumSignatures(t)}static load(t,e,n,r,i){return GY.load(t,e,n,i,r)}},COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:VY,ComputeBudgetInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=kN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(VY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=PY(VY.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=PY(VY.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=PY(VY.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=PY(VY.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(qY.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}},ComputeBudgetProgram:qY,Connection:jH,Ed25519Program:OH,Enum:class extends oY{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}},EpochSchedule:eQ,FeeCalculatorLayout:RY,Keypair:CH,LAMPORTS_PER_SOL:1e9,Loader:GY,Lockup:RH,MAX_SEED_LENGTH:32,Message:vY,NONCE_ACCOUNT_LENGTH:UY,NonceAccount:FY,PACKET_DATA_SIZE:pY,PublicKey:sY,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:aY,STAKE_CONFIG_ID:zH,STAKE_INSTRUCTION_LAYOUTS:BH,SYSTEM_INSTRUCTION_LAYOUTS:QY,SYSVAR_CLOCK_PUBKEY:LY,SYSVAR_EPOCH_SCHEDULE_PUBKEY:SY,SYSVAR_INSTRUCTIONS_PUBKEY:AY,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:xY,SYSVAR_RENT_PUBKEY:TY,SYSVAR_REWARDS_PUBKEY:IY,SYSVAR_SLOT_HASHES_PUBKEY:kY,SYSVAR_SLOT_HISTORY_PUBKEY:jY,SYSVAR_STAKE_HISTORY_PUBKEY:CY,Secp256k1Program:HH,SendTransactionError:nQ,SolanaJSONRPCError:rQ,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:UH,StakeInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=CN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(BH))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=PY(BH.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new PH(new sY(e.staker),new sY(e.withdrawer)),lockup:new RH(n.unixTimestamp,n.epoch,new sY(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),PY(BH.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=PY(BH.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new sY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=PY(BH.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new sY(i),newAuthorizedPubkey:new sY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=PY(BH.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),PY(BH.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=PY(BH.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),PY(BH.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(FH.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},StakeProgram:FH,Struct:oY,SystemInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=CN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(QY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=PY(QY.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new sY(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=PY(QY.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=PY(QY.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new sY(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=PY(QY.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=PY(QY.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new sY(e),seed:n,space:r,programId:new sY(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=PY(QY.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new sY(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=PY(QY.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new sY(e),seed:n,programId:new sY(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=PY(QY.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new sY(e),seed:n,lamports:r,space:i,programId:new sY(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=PY(QY.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new sY(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),PY(QY.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=PY(QY.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=PY(QY.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new sY(e)}}static checkProgramId(t){if(!t.equals(HY.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},SystemProgram:HY,Transaction:NY,TransactionExpiredBlockheightExceededError:oQ,TransactionExpiredTimeoutError:aQ,TransactionInstruction:EY,get TransactionStatus(){return MY},VALIDATOR_INFO_KEY:GH,VOTE_PROGRAM_ID:qH,ValidatorInfo:VH,VoteAccount:KH,VoteAuthorizationLayout:rG,VoteInit:eG,VoteInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=CN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(nG))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=PY(nG.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new eG(new sY(e.nodePubkey),new sY(e.authorizedVoter),new sY(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=PY(nG.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new sY(e),voteAuthorizationType:{index:n}}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=PY(nG.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(iG.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},VoteProgram:iG,clusterApiUrl:function(t,e){const n=!1===e?"http":"https";if(!t)return oG[n].devnet;const r=oG[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r},sendAndConfirmRawTransaction:async function(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")?(i=n,o=r):o=n;const a=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},s=await t.sendRawTransaction(e,a),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(s,u),l=(await c).value;if(l.err)throw new Error(`Raw transaction ${s} failed (${JSON.stringify(l)})`);return s},sendAndConfirmTransaction:DY}),sG={};class uG{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function cG(t,e){return e.property?t+"["+e.property+"]":t}sG.Layout=uG,sG.nameWithProperty=cG,sG.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof uG))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class lG extends uG{isCount(){throw new Error("ExternalLayout is abstract")}}class hG extends lG{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class dG extends lG{constructor(t,e,n){if(!(t instanceof uG))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof fG||this.layout instanceof pG}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class fG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}class pG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}class mG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}class gG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}const yG=Math.pow(2,32);function bG(t){const e=Math.floor(t/yG);return{hi32:e,lo32:t-e*yG}}function vG(t,e){return t*yG+e}class wG extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return vG(t.readUInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}class MG extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return vG(t.readUInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class _G extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return vG(t.readInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}class EG extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return vG(t.readInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class NG extends uG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}class LG extends uG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}class SG extends uG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}class AG extends uG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}class xG extends uG{constructor(t,e,n){if(!(t instanceof uG))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof lG&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(e instanceof lG)&&0<t.span&&(r=e*t.span),super(r,n),this.elementLayout=t,this.count=e}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0,r=this.count;if(r instanceof lG&&(r=r.decode(t,e)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let i=0;for(;i<r;)n+=this.elementLayout.getSpan(t,e+n),++i}return n}decode(t,e){void 0===e&&(e=0);const n=[];let r=0,i=this.count;for(i instanceof lG&&(i=i.decode(t,e));r<i;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),r+=1;return n}encode(t,e,n){void 0===n&&(n=0);const r=this.elementLayout,i=t.reduce(((t,i)=>t+r.encode(i,e,n+t)),0);return this.count instanceof lG&&this.count.encode(t.length,e,n),i}}class TG extends uG{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof uG),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let a=r.span;if(o=0<a?a:0,void 0!==r.property){const i=t[r.property];void 0!==i&&(o=r.encode(i,e,n),0>a&&(a=r.getSpan(e,n)))}i=n,n+=a}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<t.length&&(e[n.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}}class IG{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class kG extends IG{constructor(t,e){if(!(t instanceof lG&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class jG extends uG{constructor(t,e,n){const r=t instanceof fG||t instanceof pG;if(r)t=new kG(new dG(t));else if(t instanceof lG&&t.isCount())t=new kG(t);else if(!(t instanceof IG))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof uG))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new CG(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return f_.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class CG extends uG{constructor(t,e,n,r){if(!(t instanceof jG))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof uG))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function DG(t){return 0>t&&(t+=4294967296),t}class OG extends uG{constructor(t,e,n){if(!(t instanceof fG||t instanceof pG))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,n),this.word=t,this.msb=!!e,this.fields=[];let r=0;this._packedSetValue=function(t){return r=DG(t),this},this._packedGetValue=function(){return r}}decode(t,e){const n=this.makeDestinationObject();void 0===e&&(e=0);const r=this.word.decode(t,e);this._packedSetValue(r);for(const t of this.fields)void 0!==t.property&&(n[t.property]=t.decode(r));return n}encode(t,e,n){void 0===n&&(n=0);const r=this.word.decode(e,n);this._packedSetValue(r);for(const e of this.fields)if(void 0!==e.property){const n=t[e.property];void 0!==n&&e.encode(n)}return this.word.encode(this._packedGetValue(),e,n)}addField(t,e){const n=new zG(this,t,e);return this.fields.push(n),n}addBoolean(t){const e=new PG(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}class zG{constructor(t,e,n){if(!(t instanceof OG))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=r-i-e),this.wordMask=DG(this.valueMask<<this.start),this.property=n}decode(){return DG(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if(!Number.isInteger(t)||t!==DG(t&this.valueMask))throw new TypeError(cG("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=DG(t<<this.start);this.container._packedSetValue(DG(e&~this.wordMask)|n)}}class PG extends zG{constructor(t,e){super(t,1,e)}decode(t,e){return!!zG.prototype.decode.call(this,t,e)}encode(t){return"boolean"==typeof t&&(t=+t),zG.prototype.encode.call(this,t)}}class RG extends uG{constructor(t,e){if(!(t instanceof lG&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof lG||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof lG&&(r=t.length),!f_.isBuffer(t)||r!==t.length)throw new TypeError(cG("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof lG&&this.length.encode(r,e,n),r}}class BG extends uG{constructor(t){super(-1,t)}getSpan(t,e){if(!f_.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;n<t.length&&0!==t[n];)n+=1;return 1+n-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);return t.slice(e,e+r-1).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new f_(t,"utf8"),i=r.length;if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class UG extends uG{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!f_.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+r).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new f_(t,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class FG extends uG{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}sG.ExternalLayout=lG,sG.GreedyCount=hG,sG.OffsetLayout=dG,sG.UInt=fG,sG.UIntBE=pG,sG.Int=mG,sG.IntBE=gG,sG.Float=NG,sG.FloatBE=LG,sG.Double=SG,sG.DoubleBE=AG,sG.Sequence=xG,sG.Structure=TG,sG.UnionDiscriminator=IG,sG.UnionLayoutDiscriminator=kG,sG.Union=jG,sG.VariantLayout=CG,sG.BitStructure=OG,sG.BitField=zG,sG.Boolean=PG,sG.Blob=RG,sG.CString=BG,sG.UTF8=UG,sG.Constant=FG,sG.greedy=(t,e)=>new hG(t,e),sG.offset=(t,e,n)=>new dG(t,e,n),sG.u8=t=>new fG(1,t),sG.u16=t=>new fG(2,t),sG.u24=t=>new fG(3,t),sG.u32=t=>new fG(4,t),sG.u40=t=>new fG(5,t),sG.u48=t=>new fG(6,t),sG.nu64=t=>new wG(t),sG.u16be=t=>new pG(2,t),sG.u24be=t=>new pG(3,t),sG.u32be=t=>new pG(4,t),sG.u40be=t=>new pG(5,t),sG.u48be=t=>new pG(6,t),sG.nu64be=t=>new MG(t),sG.s8=t=>new mG(1,t),sG.s16=t=>new mG(2,t),sG.s24=t=>new mG(3,t),sG.s32=t=>new mG(4,t),sG.s40=t=>new mG(5,t),sG.s48=t=>new mG(6,t),sG.ns64=t=>new _G(t),sG.s16be=t=>new gG(2,t),sG.s24be=t=>new gG(3,t),sG.s32be=t=>new gG(4,t),sG.s40be=t=>new gG(5,t),sG.s48be=t=>new gG(6,t),sG.ns64be=t=>new EG(t),sG.f32=t=>new NG(t),sG.f32be=t=>new LG(t),sG.f64=t=>new SG(t),sG.f64be=t=>new AG(t),sG.struct=(t,e,n)=>new TG(t,e,n),sG.bits=(t,e,n)=>new OG(t,e,n);var WG=sG.seq=(t,e,n)=>new xG(t,e,n);sG.union=(t,e,n)=>new jG(t,e,n),sG.unionLayoutDiscriminator=(t,e)=>new kG(t,e);var YG=sG.blob=(t,e)=>new RG(t,e);sG.cstr=t=>new BG(t),sG.utf8=(t,e)=>new UG(t,e),sG.const=(t,e)=>new FG(t,e);var QG={},HG=KM(aG),GG={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$_.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new N(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function L(t){N.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},r(w,v),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,v),r(_,v),r(E,v),E.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},N.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},N.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},N.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},N.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},N.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},N.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},N.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},N.prototype.isqr=function(t){return this.imul(t,t.clone())},N.prototype.sqr=function(t){return this.mul(t,t)},N.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},N.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},N.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},N.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new L(t)},r(L,N),L.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},L.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},L.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},L.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},L.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,JM)}(GG),function(t){var e=JM&&JM.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;const n=sG,r=HG,i=e(GG.exports);var o=sG;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});class a extends n.Layout{constructor(t,e,r){super(t,r),this.blob=n.blob(t),this.signed=e}decode(t,e=0){const n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(t,e,n=0){return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(f_,"le",this.span),e,n)}}function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};class u extends n.Layout{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}t.publicKey=function(t){return new u(n.blob(32),(t=>new r.PublicKey(t)),(t=>t.toBuffer()),t)};class c extends n.Layout{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=n.u8()}encode(t,e,n=0){return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}getSpan(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){const e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(({data:t})=>t),(t=>({data:t})),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){const r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),e)},t.tagged=function(t,e,r){const i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function({tag:e,data:n}){if(!e.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+e.toString("hex"));return n}),(e=>({tag:t,data:e})),r)},t.vecU8=d,t.str=function(t){return new u(d(),(t=>t.toString("utf-8")),(t=>f_.from(t,"utf-8")),t)},t.rustEnum=function(t,e,r){const i=n.union(null!=r?r:n.u8(),e);return t.forEach(((t,e)=>i.addVariant(e,t,t.property))),i},t.array=function(t,e,r){const i=n.struct([n.seq(t,e,"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),r)};class f extends n.Layout{constructor(t,e,n){super(t.span+e.span,n),this.keyLayout=t,this.valueLayout=e}decode(t,e){e=e||0;return[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}encode(t,e,n){n=n||0;const r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}getSpan(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}t.map=function(t,e,r){const i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(({values:t})=>new Map(t)),(t=>({values:Array.from(t.entries())})),r)}}(QG);const ZG=$_.Buffer,VG=tE.exports,qG=QG.struct([QG.publicKey("mint"),QG.publicKey("owner"),QG.u64("amount"),QG.u32("delegateOption"),QG.publicKey("delegate"),QG.u8("state"),QG.u32("isNativeOption"),QG.u64("isNative"),QG.u64("delegatedAmount"),QG.u32("closeAuthorityOption"),QG.publicKey("closeAuthority")]);QG.array;var JG=QG.bool;QG.i128,QG.i16,QG.i32,QG.i64,QG.i8,QG.map;var KG=QG.option,XG=QG.publicKey,$G=QG.rustEnum,tZ=QG.str,eZ=QG.struct;QG.tagged;var nZ=QG.u128,rZ=QG.u16,iZ=QG.u32,oZ=QG.u64,aZ=QG.u8,sZ=QG.vec;QG.vecU8;var uZ=({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new xw(n,o,t),u=s.estimateGas[i],c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});return c?u(...c,{from:e,value:r}):u({from:e,value:r})}};let cZ=["ethereum","bsc","polygon","fantom","velas"];cZ.evm=["ethereum","bsc","polygon","fantom","velas"],cZ.solana=[];class lZ extends FM{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}detectNetwork(){return Promise.resolve(nd(this._network).id)}requestChunk(t,e){const n=t.map((t=>t.request));return Hw(e,JSON.stringify(n)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(r.error){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else t.resolve(r.result)}))})).catch((e=>{if(e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint)}else t.forEach((t=>{t.reject(e)}))}))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=[];for(let n=0;n<Math.ceil(t.length/99);n++)e[n]=t.slice(99*n,99*(n+1));e.forEach((t=>(t.map((t=>t.request)),this.requestChunk(t,this._endpoint))))}),10)),i}}let hZ=()=>"object"==typeof wh?wh:window;const dZ={ethereum:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],bsc:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],polygon:["https://polygon-rpc.com","https://poly-rpc.gateway.pokt.network","https://matic-mainnet.chainstacklabs.com"],fantom:["https://fantom.blockpi.network/v1/rpc/public","https://rpcapi.fantom.network","https://rpc.ftm.tools"],velas:["https://mainnet.velas.com/rpc","https://evmexplorer.velas.com/rpc","https://explorer.velas.com/rpc"]},fZ=()=>(null==hZ()._clientProviders&&(hZ()._clientProviders={}),hZ()._clientProviders),pZ=(t,e)=>{fZ()[t]=e},mZ=async(t,e)=>{let n,r=hZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}pZ(t,new lZ(n,t,e))};var gZ=async t=>{let e=fZ();if(e&&e[t])return e[t];let n=hZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await mZ(t,dZ[t]),e(hZ()._clientProviders[t])}))),await n._getProviderPromise[t]},yZ=mZ;let bZ=()=>(null==hZ()._cacheStore&&wZ(),hZ()._cacheStore),vZ=()=>(null==hZ()._promiseStore&&wZ(),hZ()._promiseStore),wZ=()=>{hZ()._cacheStore={},hZ()._promiseStore={},hZ()._clientProviders={}},MZ=function({key:t}){vZ()[t]=void 0},_Z=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return vZ()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return vZ()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=bZ()[t];if(function(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],o=t[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(e=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...t)=>n.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){bZ()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{MZ({key:e})})).catch((()=>{MZ({key:e})}))}))},EZ=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!cZ.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await(async t=>{if(cZ.evm.includes(t))return await gZ(t);throw"Unknown blockchain: "+t})(t);return await _Z({expires:s||0,key:[t,e,n,r,i,a],call:async()=>uZ({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};let NZ=({address:t,api:e,method:n,params:r,provider:i,block:o})=>{let a=new xw(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r});return a[n](...s,{blockTag:o})};class LZ extends jH{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}}const SZ={solana:["https://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","https://mainnet-beta.solflare.network","https://us-solana1.twnodes.com"]},AZ=()=>(null==hZ()._clientProviders&&(hZ()._clientProviders={}),hZ()._clientProviders),xZ=(t,e)=>{AZ()[t]=e},TZ=async(t,e)=>{let n,r=hZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}xZ(t,new LZ(n,t,e))};var IZ=async t=>{let e=AZ();if(e&&e[t])return e[t];let n=hZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await TZ(t,SZ[t]),e(hZ()._clientProviders[t])}))),await n._getProviderPromise[t]},kZ=TZ;var jZ=async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await IZ(t);return null==r||"getAccountInfo"===r?(null==n&&(n=qG),(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new sY(t));return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o})):"getProgramAccounts"===r?a.getProgramAccounts(new sY(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t)):"getTokenAccountBalance"===r?a.getTokenAccountBalance(new sY(e)):"latestBlockNumber"===r?a.getBlockHeight():"balance"===r?(({address:t,provider:e})=>e.getBalance(new sY(t)))({address:e,provider:a}):void 0};let CZ=["ethereum","bsc","polygon","solana","fantom","velas"];CZ.evm=["ethereum","bsc","polygon","fantom","velas"],CZ.solana=["solana"];let DZ=async function(t,e){let{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?<blockchain>\w+):\/\/(?<part1>[\w\d]+)(\/(?<part2>[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u}=("object"==typeof t?t:e)||{};return await _Z({expires:s||0,key:[n,r,i,a,u],call:async()=>{if(CZ.evm.includes(n))return(async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await gZ(t);return n?NZ({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0})({blockchain:n,address:r,api:o,method:i,params:a,block:u});if(CZ.solana.includes(n))return jZ({blockchain:n,address:r,api:o,method:i,params:a,block:u});throw"Unknown blockchain: "+n}})};const OZ=async t=>{if(CZ.evm.includes(t))return await gZ(t);if(CZ.solana.includes(t))return await IZ(t);throw"Unknown blockchain: "+t};let zZ={ethereum:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"ETH",CURRENCY:"Ether",NAME:"Ethereum",USD:"0x6B175474E89094C44Da98b954EedeAC495271d0F",USD_DECIMALS:18},bsc:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"BNB",CURRENCY:"BNB",NAME:"BNB Smart Chain",USD:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",USD_DECIMALS:18},polygon:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"MATIC",CURRENCY:"Polygon",NAME:"Polygon",USD:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",USD_DECIMALS:6},solana:{ZERO:"0",MAXINT:"340282366920938463463374607431768211455",WRAPPED:"So11111111111111111111111111111111111111112",NATIVE:"11111111111111111111111111111111",DECIMALS:9,SYMBOL:"SOL",CURRENCY:"Solana",NAME:"Solana",USD:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",USD_DECIMALS:6},fantom:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"FTM",CURRENCY:"Fantom",NAME:"Fantom",USD:"0x04068da6c83afcfa0e13ba15a6696662335d5b75",USD_DECIMALS:6},velas:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"VLX",CURRENCY:"Velas",NAME:"Velas",USD:"0xc111c29A988AE0C0087D97b33C6E6766808A3BD3",USD_DECIMALS:18}};var PZ=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=92)}([function(t,e,n){(function(t){n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"e",(function(){return f})),n.d(e,"d",(function(){return p})),n.d(e,"o",(function(){return m})),n.d(e,"n",(function(){return g})),n.d(e,"p",(function(){return y})),n.d(e,"A",(function(){return b})),n.d(e,"z",(function(){return v})),n.d(e,"B",(function(){return w})),n.d(e,"v",(function(){return M})),n.d(e,"u",(function(){return _})),n.d(e,"s",(function(){return L})),n.d(e,"r",(function(){return S})),n.d(e,"t",(function(){return A})),n.d(e,"q",(function(){return x})),n.d(e,"m",(function(){return T})),n.d(e,"l",(function(){return I})),n.d(e,"k",(function(){return k})),n.d(e,"j",(function(){return j})),n.d(e,"x",(function(){return D})),n.d(e,"a",(function(){return O})),n.d(e,"y",(function(){return z})),n.d(e,"w",(function(){return P}));var r=n(22),i=n.n(r),o=n(49),a=n.n(o);function s(t){return new Uint8Array(t)}function u(t,e=!1){const n=t.toString("hex");return e?O(n):n}function c(t){return t.toString("utf8")}function l(t){return t.readUIntBE(0,t.length)}function h(t){return a()(t)}function d(t,e=!1){return u(h(t),e)}function f(t){return c(h(t))}function p(t){return l(h(t))}function m(e){return t.from(D(e),"hex")}function g(t){return s(m(t))}function y(t){return c(m(t))}function b(e){return t.from(e,"utf8")}function v(t){return s(b(t))}function w(t,e=!1){return u(b(t),e)}function M(t){return h(N(E(t)))}function _(t){return N(E(t))}function E(t){return C((t>>>0).toString(2))}function N(t){return new Uint8Array(function(t,e=8){const n=C(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}(t).map((t=>parseInt(t,2))))}function L(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function S(e){return t.isBuffer(e)}function A(t){return i.a.strict(t)&&!S(t)}function x(t){return!A(t)&&!S(t)&&void 0!==t.byteLength}function T(t){return S(t)?"buffer":A(t)?"typed-array":x(t)?"array-buffer":Array.isArray(t)?"array":typeof t}function I(t){return function(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}(t)?"binary":L(t)?"hex":"utf8"}function k(...e){return t.concat(e)}function j(...t){let e=[];return t.forEach((t=>e=e.concat(Array.from(t)))),new Uint8Array([...e])}function C(t,e=8,n="0"){return function(t,e,n="0"){return function(t,e,n,r="0"){const i=e-t.length;let o=t;if(i>0){const e=r.repeat(i);o=n?e+t:t+e}return o}(t,e,!0,n)}(t,function(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}(t.length,e),n)}function D(t){return t.replace(/^0x/,"")}function O(t){return t.startsWith("0x")?t:"0x"+t}function z(t){return(t=C(t=D(t),2))&&(t=O(t)),t}function P(t){const e=t.startsWith("0x");return t=(t=D(t)).startsWith("0")?t.substring(1):t,e?O(t):t}}).call(this,n(18).Buffer)},function(t,e,n){n.d(e,"g",(function(){return r.detectEnv})),n.d(e,"r",(function(){return r.isMobile})),n.d(e,"m",(function(){return r.isBrowser})),n.d(e,"k",(function(){return r.getLocation})),n.d(e,"i",(function(){return r.getClientMeta})),n.d(e,"B",(function(){return r.setLocal})),n.d(e,"j",(function(){return r.getLocal})),n.d(e,"A",(function(){return r.removeLocal})),n.d(e,"v",(function(){return r.mobileLinkChoiceKey})),n.d(e,"C",(function(){return o})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return l})),n.d(e,"d",(function(){return h})),n.d(e,"e",(function(){return d})),n.d(e,"f",(function(){return f})),n.d(e,"w",(function(){return L})),n.d(e,"x",(function(){return S})),n.d(e,"z",(function(){return g})),n.d(e,"D",(function(){return y})),n.d(e,"h",(function(){return A})),n.d(e,"u",(function(){return j})),n.d(e,"y",(function(){return C})),n.d(e,"l",(function(){return T})),n.d(e,"a",(function(){return I})),n.d(e,"o",(function(){return v})),n.d(e,"q",(function(){return w})),n.d(e,"p",(function(){return M})),n.d(e,"n",(function(){return _})),n.d(e,"s",(function(){return E})),n.d(e,"t",(function(){return N}));var r=n(21);const i=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],o=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var a=n(16),s=n.n(a),u=n(0);function c(t){return u.b(new Uint8Array(t))}function l(t,e){return u.c(new Uint8Array(t),!e)}function h(t){return u.f(t).buffer}function d(t){return u.n(t).buffer}function f(t,e){const n=u.x(u.y(new s.a(t).toString(16)));return e?n:u.a(n)}var p=n(50);function m(t){return u.y(t)}const g=n(51).payloadId;function y(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function b(t,e){return u.s(t,e)}function v(t){return void 0!==t.method}function w(t){return void 0!==t.result}function M(t){return void 0!==t.error}function _(t){return void 0!==t.event}function E(t){return i.includes(t)||t.startsWith("wc_")}function N(t){return!!t.method.startsWith("wc_")||!o.includes(t.method)}function L(t){var e,n;return(n=t)&&n.length&&!b(t[0])&&(t[0]=(e=t[0],u.B(e,!0))),t}function S(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!(e=t.from)||"0x"!==e.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(e)||!/^(0x)?[0-9a-f]{40}$/.test(e)&&!/^(0x)?[0-9A-F]{40}$/.test(e)&&e!==function(t){t=Object(u.x)(t.toLowerCase());const e=Object(u.x)(Object(p.keccak_256)((n=t,u.A(n))));var n;let r="";for(let n=0;n<t.length;n++)parseInt(e[n],16)>7?r+=t[n].toUpperCase():r+=t[n];return Object(u.a)(r)}(e))throw new Error("Transaction object must include a valid 'from' value.");var e;function n(t){let e=t;var n;return("number"==typeof t||"string"==typeof t&&!function(t){return""===t||"string"==typeof t&&""===t.trim()}(t))&&(b(t)?"string"==typeof t&&(e=m(t)):e=f(t)),"string"==typeof e&&(n=e,e=u.w(u.a(n))),e}const r={from:m(t.from),to:void 0===t.to?void 0:m(t.to),gasPrice:void 0===t.gasPrice?"":n(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":n(t.gasLimit):n(t.gas),value:void 0===t.value?"":n(t.value),nonce:void 0===t.nonce?"":n(t.nonce),data:void 0===t.data?"":m(t.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((t=>{(void 0===r[t]||"string"==typeof r[t]&&!r[t].trim().length)&&i.includes(t)&&delete r[t]})),r}function A(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:e};return t.data&&(r.data=t.data),r}var x=n(23);function T(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function I(t,e){let n=k(t);return n=Object.assign(Object.assign({},n),e),function(t){return x.stringify(t)}(n)}function k(t){return x.parse(t)}function j(t){return void 0!==t.bridge}function C(t){const e=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,n)),o=function(t){const e=k(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}},function(t,e,n){n.d(e,"b",(function(){return i})),n.d(e,"g",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"j",(function(){return l})),n.d(e,"h",(function(){return r})),n.d(e,"d",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"l",(function(){return p}));const r=512,i=256,o=256,a="AES-CBC",s="SHA-"+i,u="HMAC",c="SHA-256",l="SHA-512",h="encrypt",d="decrypt",f="sign",p="verify"},function(t,e,n){n.d(e,"b",(function(){return r})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"a",(function(){return u}));const r="INTERNAL_ERROR",i="SERVER_ERROR",o=[-32700,-32600,-32601,-32602,-32603],a=[-32e3,-32099],s={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[r]:{code:-32603,message:"Internal error"},[i]:{code:-32e3,message:"Server error"}},u=i},function(t,e,n){function r(t){let e;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function i(t){const e=r(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=r,e.getFromWindowOrThrow=i,e.getDocumentOrThrow=function(){return i("document")},e.getDocument=function(){return r("document")},e.getNavigatorOrThrow=function(){return i("navigator")},e.getNavigator=function(){return r("navigator")},e.getLocationOrThrow=function(){return i("location")},e.getLocation=function(){return r("location")},e.getCryptoOrThrow=function(){return i("crypto")},e.getCrypto=function(){return r("crypto")},e.getLocalStorageOrThrow=function(){return i("localStorage")},e.getLocalStorage=function(){return r("localStorage")}},function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(67),e),i(n(68),e)},function(t,e,n){n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"f",(function(){return h}));var r=n(5),i=n(2);async function o(t,e=i.a){return r.getSubtleCrypto().importKey("raw",t,function(t){return t===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(e),!0,function(t){return t===i.a?[i.d,i.c]:[i.k,i.l]}(e))}async function a(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.encrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function s(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.decrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function u(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.g,name:i.e},a,e);return new Uint8Array(s)}async function c(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.h,name:i.e},a,e);return new Uint8Array(s)}async function l(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.i},t);return new Uint8Array(n)}async function h(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.j},t);return new Uint8Array(n)}},function(t,e){var n,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return r[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},function(t,e,n){var r=n(44),i=n(45);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return n}}},function(t,e,n){n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));var r=n(3);function i(t){return r.c.includes(t)}function o(t){return Object.keys(r.f).includes(t)?r.f[t]:r.f[r.a]}function a(t){return Object.values(r.f).find((e=>e.code===t))||r.f[r.a]}},function(t,e,n){var r=n(19);o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var i=o.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function o(t,e,n){return o.TYPED_ARRAY_SUPPORT||this instanceof o?"number"==typeof t?u(this,t):function(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;return i=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),o.TYPED_ARRAY_SUPPORT?i.__proto__=o.prototype:i=c(t,i),i}(t,e,n,r):"string"==typeof e?function(t,e){var n=0|h(e),r=s(t,n),i=r.write(e);return i!==n&&(r=r.slice(0,i)),r}(t,e):function(t,e){if(o.isBuffer(e)){var n=0|a(e.length),r=s(t,n);return 0===r.length||e.copy(r,0,0,n),r}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?s(t,0):c(t,e);if("Buffer"===e.type&&Array.isArray(e.data))return c(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}(this,t,e,n):new o(t,e,n)}function a(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function s(t,e){var n;return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e)).__proto__=o.prototype:(null===(n=t)&&(n=new o(e)),n.length=e),n}function u(t,e){var n=s(t,e<0?0:0|a(e));if(!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)n[r]=0;return n}function c(t,e){for(var n=e.length<0?0:0|a(e.length),r=s(t,n),i=0;i<n;i+=1)r[i]=255&e[i];return r}function l(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function h(t){return o.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:l(t).length)}o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),o.prototype.write=function(t,e,n){void 0===e||void 0===n&&"string"==typeof e?(n=this.length,e=0):isFinite(e)&&(e|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(t,e,n,r){return function(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}(l(e,t.length-n),t,n,r)}(this,t,e,n)},o.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),o.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+t]}return n},o.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,a=r-n;if(this===t&&n<e&&e<r)for(i=a-1;i>=0;--i)t[i+e]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+a),e);return a},o.prototype.fill=function(t,e,n){if("string"==typeof t){if("string"==typeof e?(e=0,n=this.length):"string"==typeof n&&(n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=o.isBuffer(t)?t:new o(t),s=a.length;for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this},o.concat=function(t,e){if(!r(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s(null,0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=u(null,e),a=0;for(n=0;n<t.length;++n){var c=t[n];if(!o.isBuffer(c))throw new TypeError('"list" argument must be an Array of Buffers');c.copy(i,a),a+=c.length}return i},o.byteLength=h,o.prototype._isBuffer=!0,o.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.exports.alloc=function(t){var e=new o(t);return e.fill(0),e},t.exports.from=function(t){return new o(t)}},function(t,e,n){var r=n(34);n.d(e,"randomBytes",(function(){return r.a}));var i=n(35);n.d(e,"aesCbcDecrypt",(function(){return i.a})),n.d(e,"aesCbcEncrypt",(function(){return i.b}));var o=n(36);n.d(e,"hmacSha256Sign",(function(){return o.a})),n(41),n(15),n(2)},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.d(e,"a",(function(){return r}));class r{}},function(t,e,n){var r=n(37);n.o(r,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return r.isConstantTime})),n(38);var i=n(39);n.o(i,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return i.isConstantTime}));var o=n(40);n.d(e,"isConstantTime",(function(){return o.a}))},function(t,e,n){(function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=n(55).Buffer}catch(t){}function s(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var a=t.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=t.length-6,r=0;n>=e;n-=6)i=s(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==e&&(i=s(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[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];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:c[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new _(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.call(this,t),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)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<p);var y=this.pow(h,new o(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},i(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(54)(t))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});const r=n(60);r.__exportStar(n(61),e),r.__exportStar(n(62),e)},function(t,e,n){(function(t){
56
+ t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return x()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function p(){}function m(){}function g(){}var y={};l(y,s,(function(){return this}));var b=Object.getPrototypeOf,v=b&&b(b(A([])));v&&v!==i&&o.call(v,s)&&(y=v);var w=g.prototype=p.prototype=Object.create(y);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,n){function r(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==e(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):n.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;this._invoke=function(t,e){function o(){return new n((function(n,i){r(t,e,n,i)}))}return i=i?i.then(o,o):o()}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=g,l(w,"constructor",g),l(g,"constructor",m),m.displayName=l(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},r.awrap=function(t){return{__await:t}},M(_.prototype),l(_.prototype,u,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new _(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},M(w),l(w,c,"Generator"),l(w,s,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:A(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(dO)),dO.exports}function pO(){if(lO)return cO;lO=1;var t=fO()();cO=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return cO}var mO,gO={exports:{}};function yO(){return mO||(mO=1,function(t){function e(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function s(t){e(a,i,o,s,u,"next",t)}function u(t){e(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(gO)),gO.exports}var bO,vO,wO={exports:{}};function MO(){return bO||(bO=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(wO)),wO.exports}function _O(){return vO||(vO=1,function(t){var e=mL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(pO()),r=e(yO()),i=e(kL()),o=e(ML()),a=e(bL()),s=e(AL()),u=e(zL()),c=e(BL()),l=MO();function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(t){(0,s.default)(f,t);var e,u,c,l,d=h(f);function f(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,f);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,p=r.max_reconnects,m=void 0===p?5:p,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=d.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(f,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=f_.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;i<e.params.length;i++)r.push(e.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[e.id])return e.method&&e.params?Promise.resolve().then((function(){n.emit(e.method,e.params)})):void 0;"error"in e=="result"in e&&n.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[e.id].timeout&&clearTimeout(n.queue[e.id].timeout),e.error?n.queue[e.id].promise[1](e.error):n.queue[e.id].promise[0](e.result),delete n.queue[e.id]})),this.socket.addEventListener("error",(function(t){return n.emit("error",t)})),this.socket.addEventListener("close",(function(r){var i=r.code,o=r.reason;n.ready&&setTimeout((function(){return n.emit("close",i,o)}),0),n.ready=!1,n.socket=void 0,1e3!==i&&(n.current_reconnects++,n.reconnect&&(n.max_reconnects>n.current_reconnects||0===n.max_reconnects)&&setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval))}))}}]),f}(l.EventEmitter);t.default=d}(hO)),hO}var EO,NO={},LO={exports:{}};var SO,AO,xO={exports:{}},TO={exports:{}},IO={exports:{}};function kO(){return SO||(SO=1,function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports}(IO)),IO.exports}function jO(){return AO||(AO=1,function(t){var e=kO();t.exports=function(t){if(Array.isArray(t))return e(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(TO)),TO.exports}var CO,DO={exports:{}};function OO(){return CO||(CO=1,function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(DO)),DO.exports}var zO,PO={exports:{}};function RO(){return zO||(zO=1,function(t){var e=kO();t.exports=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}(PO)),PO.exports}var BO,UO,FO,WO={exports:{}};function YO(){return BO||(BO=1,function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports}(WO)),WO.exports}var QO=new Uint8Array(16);function HO(){if(!FO&&!(FO="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return FO(QO)}var GO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ZO(t){return"string"==typeof t&&GO.test(t)}for(var VO,qO,JO=[],KO=0;KO<256;++KO)JO.push((KO+256).toString(16).substr(1));function XO(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(JO[t[e+0]]+JO[t[e+1]]+JO[t[e+2]]+JO[t[e+3]]+"-"+JO[t[e+4]]+JO[t[e+5]]+"-"+JO[t[e+6]]+JO[t[e+7]]+"-"+JO[t[e+8]]+JO[t[e+9]]+"-"+JO[t[e+10]]+JO[t[e+11]]+JO[t[e+12]]+JO[t[e+13]]+JO[t[e+14]]+JO[t[e+15]]).toLowerCase();if(!ZO(n))throw TypeError("Stringified UUID is invalid");return n}var $O=0,tz=0;function ez(t){if(!ZO(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}var nz="6ba7b810-9dad-11d1-80b4-00c04fd430c8",rz="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function iz(t,e,n){function r(t,r,i,o){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=ez(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+t.length);if(a.set(r),a.set(t,r.length),(a=n(a))[6]=15&a[6]|e,a[8]=63&a[8]|128,i){o=o||0;for(var s=0;s<16;++s)i[o+s]=a[s];return i}return XO(a)}try{r.name=t}catch(t){}return r.DNS=nz,r.URL=rz,r}function oz(t){return 14+(t+64>>>9<<4)+1}function az(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function sz(t,e,n,r,i,o){return az((a=az(az(e,t),az(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function uz(t,e,n,r,i,o,a){return sz(e&n|~e&r,t,e,i,o,a)}function cz(t,e,n,r,i,o,a){return sz(e&r|n&~r,t,e,i,o,a)}function lz(t,e,n,r,i,o,a){return sz(e^n^r,t,e,i,o,a)}function hz(t,e,n,r,i,o,a){return sz(n^(e|~r),t,e,i,o,a)}var dz=iz("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){for(var e=[],n=32*t.length,r="0123456789abcdef",i=0;i<n;i+=8){var o=t[i>>5]>>>i%32&255,a=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);e.push(a)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[oz(e)-1]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,u=r,c=i,l=o;n=uz(n,r,i,o,t[a],7,-680876936),o=uz(o,n,r,i,t[a+1],12,-389564586),i=uz(i,o,n,r,t[a+2],17,606105819),r=uz(r,i,o,n,t[a+3],22,-1044525330),n=uz(n,r,i,o,t[a+4],7,-176418897),o=uz(o,n,r,i,t[a+5],12,1200080426),i=uz(i,o,n,r,t[a+6],17,-1473231341),r=uz(r,i,o,n,t[a+7],22,-45705983),n=uz(n,r,i,o,t[a+8],7,1770035416),o=uz(o,n,r,i,t[a+9],12,-1958414417),i=uz(i,o,n,r,t[a+10],17,-42063),r=uz(r,i,o,n,t[a+11],22,-1990404162),n=uz(n,r,i,o,t[a+12],7,1804603682),o=uz(o,n,r,i,t[a+13],12,-40341101),i=uz(i,o,n,r,t[a+14],17,-1502002290),n=cz(n,r=uz(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=cz(o,n,r,i,t[a+6],9,-1069501632),i=cz(i,o,n,r,t[a+11],14,643717713),r=cz(r,i,o,n,t[a],20,-373897302),n=cz(n,r,i,o,t[a+5],5,-701558691),o=cz(o,n,r,i,t[a+10],9,38016083),i=cz(i,o,n,r,t[a+15],14,-660478335),r=cz(r,i,o,n,t[a+4],20,-405537848),n=cz(n,r,i,o,t[a+9],5,568446438),o=cz(o,n,r,i,t[a+14],9,-1019803690),i=cz(i,o,n,r,t[a+3],14,-187363961),r=cz(r,i,o,n,t[a+8],20,1163531501),n=cz(n,r,i,o,t[a+13],5,-1444681467),o=cz(o,n,r,i,t[a+2],9,-51403784),i=cz(i,o,n,r,t[a+7],14,1735328473),n=lz(n,r=cz(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=lz(o,n,r,i,t[a+8],11,-2022574463),i=lz(i,o,n,r,t[a+11],16,1839030562),r=lz(r,i,o,n,t[a+14],23,-35309556),n=lz(n,r,i,o,t[a+1],4,-1530992060),o=lz(o,n,r,i,t[a+4],11,1272893353),i=lz(i,o,n,r,t[a+7],16,-155497632),r=lz(r,i,o,n,t[a+10],23,-1094730640),n=lz(n,r,i,o,t[a+13],4,681279174),o=lz(o,n,r,i,t[a],11,-358537222),i=lz(i,o,n,r,t[a+3],16,-722521979),r=lz(r,i,o,n,t[a+6],23,76029189),n=lz(n,r,i,o,t[a+9],4,-640364487),o=lz(o,n,r,i,t[a+12],11,-421815835),i=lz(i,o,n,r,t[a+15],16,530742520),n=hz(n,r=lz(r,i,o,n,t[a+2],23,-995338651),i,o,t[a],6,-198630844),o=hz(o,n,r,i,t[a+7],10,1126891415),i=hz(i,o,n,r,t[a+14],15,-1416354905),r=hz(r,i,o,n,t[a+5],21,-57434055),n=hz(n,r,i,o,t[a+12],6,1700485571),o=hz(o,n,r,i,t[a+3],10,-1894986606),i=hz(i,o,n,r,t[a+10],15,-1051523),r=hz(r,i,o,n,t[a+1],21,-2054922799),n=hz(n,r,i,o,t[a+8],6,1873313359),o=hz(o,n,r,i,t[a+15],10,-30611744),i=hz(i,o,n,r,t[a+6],15,-1560198380),r=hz(r,i,o,n,t[a+13],21,1309151649),n=hz(n,r,i,o,t[a+4],6,-145523070),o=hz(o,n,r,i,t[a+11],10,-1120210379),i=hz(i,o,n,r,t[a+2],15,718787259),r=hz(r,i,o,n,t[a+9],21,-343485551),n=az(n,s),r=az(r,u),i=az(i,c),o=az(o,l)}return[n,r,i,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(oz(e)),r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))})),fz=dz;function pz(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function mz(t,e){return t<<e|t>>>32-e}var gz=iz("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var r=unescape(encodeURIComponent(t));t=[];for(var i=0;i<r.length;++i)t.push(r.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,a=Math.ceil(o/16),s=new Array(a),u=0;u<a;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=t[64*u+4*l]<<24|t[64*u+4*l+1]<<16|t[64*u+4*l+2]<<8|t[64*u+4*l+3];s[u]=c}s[a-1][14]=8*(t.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(t.length-1)&4294967295;for(var h=0;h<a;++h){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=s[h][f];for(var p=16;p<80;++p)d[p]=mz(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var m=n[0],g=n[1],y=n[2],b=n[3],v=n[4],w=0;w<80;++w){var M=Math.floor(w/20),_=mz(m,5)+pz(M,g,y,b)+v+e[M]+d[w]>>>0;v=b,b=y,y=mz(g,30)>>>0,g=m,m=_}n[0]=n[0]+m>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+b>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),yz=gz;var bz,vz,wz=Object.freeze({__proto__:null,v1:function(t,e,n){var r=e&&n||0,i=e||new Array(16),o=(t=t||{}).node||VO,a=void 0!==t.clockseq?t.clockseq:qO;if(null==o||null==a){var s=t.random||(t.rng||HO)();null==o&&(o=VO=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=qO=16383&(s[6]<<8|s[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:tz+1,l=u-$O+(c-tz)/1e4;if(l<0&&void 0===t.clockseq&&(a=a+1&16383),(l<0||u>$O)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");$O=u,tz=c,qO=a;var h=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=h>>>24&255,i[r++]=h>>>16&255,i[r++]=h>>>8&255,i[r++]=255&h;var d=u/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var f=0;f<6;++f)i[r+f]=o[f];return e||XO(i)},v3:fz,v4:function(t,e,n){var r=(t=t||{}).random||(t.rng||HO)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return XO(r)},v5:yz,NIL:"00000000-0000-0000-0000-000000000000",version:function(t){if(!ZO(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)},validate:ZO,stringify:XO,parse:ez}),Mz=KM(wz),_z={};function Ez(){return vz||(vz=1,function(t){var e=mL.exports,n=kL();Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=e(pO()),i=e(kL()),o=e(yO()),a=e((EO||(EO=1,function(t){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports}(LO)),LO.exports)),s=e((UO||(UO=1,function(t){var e=jO(),n=OO(),r=RO(),i=YO();t.exports=function(t){return e(t)||n(t)||r(t)||i()},t.exports.__esModule=!0,t.exports.default=t.exports}(xO)),xO.exports)),u=e(ML()),c=e(bL()),l=e(AL()),h=e(zL()),d=e(BL()),f=MO(),p=sO(),m=Mz,g=e(cT),y=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==n(t)&&"function"!=typeof t)return{default:t};var r=b(e);if(r&&r.has(t))return r.get(t);var i={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var s=o?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(i,a,s):i[a]=t[a]}i.default=t,r&&r.set(t,i);return i}(function(){if(bz)return _z;bz=1,Object.defineProperty(_z,"__esModule",{value:!0}),_z.createError=function(e,n){var r={code:e,message:t.get(e)||"Internal Server Error"};return n&&(r.data=n),r};var t=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]);return _z}());function b(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(b=function(t){return t?n:e})(t)}function v(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,d.default)(t);if(e){var i=(0,d.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,h.default)(this,n)}}var _=function(t){(0,l.default)(h,t);var e,n=M(h);function h(t){var e;return(0,u.default)(this,h),(e=n.call(this)).namespaces={},e.wss=new p.Server(t),e.wss.on("listening",(function(){return e.emit("listening")})),e.wss.on("connection",(function(t,n){var r=g.default.parse(n.url,!0),i=r.pathname;return r.query.socket_id?t._id=r.query.socket_id:t._id=(0,m.v1)(),t._authenticated=!1,t.on("error",(function(n){return e.emit("socket-error",t,n)})),t.on("close",(function(){e.namespaces[i].clients.delete(t._id);for(var n=0,r=Object.keys(e.namespaces[i].events);n<r.length;n++){var o=r[n],a=e.namespaces[i].events[o].sockets.indexOf(t._id);a>=0&&e.namespaces[i].events[o].sockets.splice(a,1)}e.emit("disconnection",t)})),e.namespaces[i]||e._generateNamespace(i),e.namespaces[i].clients.set(t._id,t),e.emit("connection",t,n),e._handleRPC(t,i)})),e.wss.on("error",(function(t){return e.emit("error",t)})),e}return(0,c.default)(h,[{key:"register",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/";return this.namespaces[r]||this._generateNamespace(r),this.namespaces[r].rpc_methods[t]={fn:e,protected:!1},{protected:function(){return n._makeProtectedMethod(t,r)},public:function(){return n._makePublicMethod(t,r)}}}},{key:"setAuth",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.register("rpc.login",t,e)}},{key:"_makeProtectedMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!0}},{key:"_makePublicMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!1}},{key:"_makeProtectedEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!0}},{key:"_makePublicEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!1}},{key:"closeNamespace",value:function(t){var e=this.namespaces[t];if(e){delete e.rpc_methods,delete e.events;var n,r=v(e.clients.values());try{for(r.s();!(n=r.n()).done;){n.value.close()}}catch(t){r.e(t)}finally{r.f()}delete this.namespaces[t]}}},{key:"event",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";if(this.namespaces[n]){if(void 0!==this.namespaces[n].events[t])throw new Error("Already registered event ".concat(n).concat(t))}else this._generateNamespace(n);return this.namespaces[n].events[t]={sockets:[],protected:!1},this.on(t,(function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];1===i.length&&i[0]instanceof Object&&(i=i[0]);var a,s=v(e.namespaces[n].events[t].sockets);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=e.namespaces[n].clients.get(u);c&&c.send(JSON.stringify({notification:t,params:i||null}))}}catch(t){s.e(t)}finally{s.f()}})),{protected:function(){return e._makeProtectedEvent(t,n)},public:function(){return e._makePublicEvent(t,n)}}}},{key:"of",value:function(t){this.namespaces[t]||this._generateNamespace(t);var e=this;return{register:function(n,r){if(2!==arguments.length)throw new Error("must provide exactly two arguments");if("string"!=typeof n)throw new Error("name must be a string");if("function"!=typeof r)throw new Error("handler must be a function");return e.register(n,r,t)},event:function(n){if(1!==arguments.length)throw new Error("must provide exactly one argument");if("string"!=typeof n)throw new Error("name must be a string");return e.event(n,t)},get eventList(){return Object.keys(e.namespaces[t].events)},emit:function(n){for(var r=(0,s.default)(e.namespaces[t].clients.keys()),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];for(var u,c=0;u=r[c];++c)e.namespaces[t].clients.get(u).send(JSON.stringify({notification:n,params:o||[]}))},get name(){return t},connected:function(){return(0,s.default)(e.namespaces[t].clients.keys()).reduce((function(n,r){return Object.assign(Object.assign({},n),(0,a.default)({},r,e.namespaces[t].clients.get(r)))}),{})},clients:function(){return e.namespaces[t]}}}},{key:"eventList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";return this.namespaces[t]?Object.keys(this.namespaces[t].events):[]}},{key:"createError",value:function(t,e,n){return{code:t,message:e,data:n||null}}},{key:"close",value:function(){var t=this;return new Promise((function(e,n){try{t.wss.close(),t.emit("close"),e()}catch(t){n(t)}}))}},{key:"_handleRPC",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";t.on("message",function(){var i=(0,o.default)(r.default.mark((function i(o){var a,s,u,c,l,h,d,f;return r.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a={},o instanceof ArrayBuffer&&(a.binary=!0,o=f_.from(o).toString()),1===t.readyState){r.next=4;break}return r.abrupt("return");case 4:r.prev=4,s=JSON.parse(o),r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(4),r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32700,r.t0.toString()),id:null}),a));case 11:if(!Array.isArray(s)){r.next=39;break}if(s.length){r.next=14;break}return r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32600,"Invalid array"),id:null}),a));case 14:u=[],c=v(s),r.prev=16,c.s();case 18:if((l=c.n()).done){r.next=28;break}return h=l.value,r.next=22,e._runMethod(h,t._id,n);case 22:if(d=r.sent){r.next=25;break}return r.abrupt("continue",26);case 25:u.push(d);case 26:r.next=18;break;case 28:r.next=33;break;case 30:r.prev=30,r.t1=r.catch(16),c.e(r.t1);case 33:return r.prev=33,c.f(),r.finish(33);case 36:if(u.length){r.next=38;break}return r.abrupt("return");case 38:return r.abrupt("return",t.send(JSON.stringify(u),a));case 39:return r.next=41,e._runMethod(s,t._id,n);case 41:if(f=r.sent){r.next=44;break}return r.abrupt("return");case 44:return r.abrupt("return",t.send(JSON.stringify(f),a));case 45:case"end":return r.stop()}}),i,null,[[4,8],[16,30,33,36]])})));return function(t){return i.apply(this,arguments)}}())}},{key:"_runMethod",value:(e=(0,o.default)(r.default.mark((function t(e,n){var o,a,s,u,c,l,h,d,f,p,m,g,b,w,M,_=arguments;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=_.length>2&&void 0!==_[2]?_[2]:"/","object"===(0,i.default)(e)&&null!==e){t.next=3;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:null});case 3:if("2.0"===e.jsonrpc){t.next=5;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid JSON RPC version"),id:e.id||null});case 5:if(e.method){t.next=7;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32602,"Method not specified"),id:e.id||null});case 7:if("string"==typeof e.method){t.next=9;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid method name"),id:e.id||null});case 9:if(!e.params||"string"!=typeof e.params){t.next=11;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:e.id||null});case 11:if("rpc.on"!==e.method){t.next=47;break}if(e.params){t.next=14;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 14:a={},s=Object.keys(this.namespaces[o].events),u=v(e.params),t.prev=17,u.s();case 19:if((c=u.n()).done){t.next=36;break}if(l=c.value,h=s.indexOf(l),d=this.namespaces[o],-1!==h){t.next=26;break}return a[l]="provided event invalid",t.abrupt("continue",34);case 26:if(!0!==d.events[s[h]].protected||!1!==d.clients.get(n)._authenticated){t.next=28;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32606),id:e.id||null});case 28:if(!(d.events[s[h]].sockets.indexOf(n)>=0)){t.next=32;break}return a[l]="socket has already been subscribed to event",t.abrupt("continue",34);case 32:d.events[s[h]].sockets.push(n),a[l]="ok";case 34:t.next=19;break;case 36:t.next=41;break;case 38:t.prev=38,t.t0=t.catch(17),u.e(t.t0);case 41:return t.prev=41,u.f(),t.finish(41);case 44:return t.abrupt("return",{jsonrpc:"2.0",result:a,id:e.id||null});case 47:if("rpc.off"!==e.method){t.next=78;break}if(e.params){t.next=50;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 50:f={},p=v(e.params),t.prev=52,p.s();case 54:if((m=p.n()).done){t.next=67;break}if(g=m.value,this.namespaces[o].events[g]){t.next=59;break}return f[g]="provided event invalid",t.abrupt("continue",65);case 59:if(-1!==(b=this.namespaces[o].events[g].sockets.indexOf(n))){t.next=63;break}return f[g]="not subscribed",t.abrupt("continue",65);case 63:this.namespaces[o].events[g].sockets.splice(b,1),f[g]="ok";case 65:t.next=54;break;case 67:t.next=72;break;case 69:t.prev=69,t.t1=t.catch(52),p.e(t.t1);case 72:return t.prev=72,p.f(),t.finish(72);case 75:return t.abrupt("return",{jsonrpc:"2.0",result:f,id:e.id||null});case 78:if("rpc.login"!==e.method){t.next=81;break}if(e.params){t.next=81;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32604),id:e.id||null});case 81:if(this.namespaces[o].rpc_methods[e.method]){t.next=83;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32601),id:e.id||null});case 83:if(w=null,!0!==this.namespaces[o].rpc_methods[e.method].protected||!1!==this.namespaces[o].clients.get(n)._authenticated){t.next=86;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32605),id:e.id||null});case 86:return t.prev=86,t.next=89,this.namespaces[o].rpc_methods[e.method].fn(e.params,n);case 89:w=t.sent,t.next=99;break;case 92:if(t.prev=92,t.t2=t.catch(86),e.id){t.next=96;break}return t.abrupt("return");case 96:if(!(t.t2 instanceof Error)){t.next=98;break}return t.abrupt("return",{jsonrpc:"2.0",error:{code:-32e3,message:t.t2.name,data:t.t2.message},id:e.id});case 98:return t.abrupt("return",{jsonrpc:"2.0",error:t.t2,id:e.id});case 99:if(e.id){t.next=101;break}return t.abrupt("return");case 101:return"rpc.login"===e.method&&!0===w&&((M=this.namespaces[o].clients.get(n))._authenticated=!0,this.namespaces[o].clients.set(n,M)),t.abrupt("return",{jsonrpc:"2.0",result:w,id:e.id});case 103:case"end":return t.stop()}}),t,this,[[17,38,41,44],[52,69,72,75],[86,92]])}))),function(t,n){return e.apply(this,arguments)})},{key:"_generateNamespace",value:function(t){var e=this;this.namespaces[t]={rpc_methods:{__listMethods:{fn:function(){return Object.keys(e.namespaces[t].rpc_methods)},protected:!1}},clients:new Map,events:{}}}}]),h}(f.EventEmitter);t.default=_}(NO)),NO}!function(t){var e=mL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0,Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return c.default}});var n=e(bL()),r=e(ML()),i=e(AL()),o=e(zL()),a=e(BL()),s=e((qD||(qD=1,function(t){var e=mL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new n.default(t,e)};var n=e(sO())}(UL)),UL)),u=e(_O()),c=e(Ez());function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var h=function(t){(0,i.default)(o,t);var e=l(o);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ws://localhost:8080",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;(0,r.default)(this,o);var a=n.autoconnect,u=void 0===a||a,c=n.reconnect,l=void 0===c||c,h=n.reconnect_interval,d=void 0===h?1e3:h,f=n.max_reconnects,p=void 0===f?5:f,m=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return e.call(this,s.default,t,Object.assign({autoconnect:u,reconnect:l,reconnect_interval:d,max_reconnects:p},m),i)}return(0,n.default)(o)}(u.default);t.Client=h}(pL);const Nz=Mz.v4;var Lz=function(t,e,n,r){if("string"!=typeof t)throw new TypeError(t+" must be a string");const i="number"==typeof(r=r||{}).version?r.version:2;if(1!==i&&2!==i)throw new TypeError(i+" must be 1 or 2");const o={method:t};if(2===i&&(o.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");o.params=e}if(void 0===n){const t="function"==typeof r.generator?r.generator:function(){return Nz()};o.id=t(o,r)}else 2===i&&null===n?r.notificationIdNull&&(o.id=null):o.id=n;return o};const Sz=Mz.v4,Az=Lz,xz=function(t,e){if(!(this instanceof xz))return new xz(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return Sz()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};var Tz=xz;xz.prototype.request=function(t,e,n,r){const i=this;let o=null;const a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&t&&"object"==typeof t&&"function"==typeof e)r=e,o=t;else{"function"==typeof n&&(r=n,n=void 0);const i="function"==typeof r;try{o=Az(t,e,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(i)return r(t);throw t}if(!i)return o}let s;try{s=JSON.stringify(o,this.options.replacer)}catch(t){return r(t)}return this.callServer(s,(function(t,e){i._parseResponse(t,e,r)})),o},xz.prototype._parseResponse=function(t,e,n){if(t)return void n(t);if(!e)return n();let r;try{r=JSON.parse(e,this.options.reviver)}catch(t){return n(t)}if(3===n.length){if(Array.isArray(r)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return n(null,r.filter(t),r.filter(e))}return n(null,r.error,r.result)}n(null,r)};var Iz=Tz;const kz="Impossible case. Please create issue.",jz="The tweak was out of range or the resulted private key is invalid",Cz="The tweak was out of range or equal to zero",Dz="Unknow error on context randomization",Oz="Private Key is invalid",zz="Public Key could not be parsed",Pz="Public Key serialization error",Rz="The sum of the public keys is not valid",Bz="Signature could not be parsed",Uz="The nonce generation function failed, or the private key was invalid",Fz="Public key could not be recover",Wz="Scalar was invalid (zero or overflow)";function Yz(t,e){if(!t)throw new Error(e)}function Qz(t,e,n){if(Yz(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==n)if(Array.isArray(n)){const r=`Expected ${t} to be an Uint8Array with length [${n.join(", ")}]`;Yz(n.includes(e.length),r)}else{const r=`Expected ${t} to be an Uint8Array with length ${n}`;Yz(e.length===n,r)}}function Hz(t){Yz("Boolean"===Zz(t),"Expected compressed to be a Boolean")}function Gz(t=(t=>new Uint8Array(t)),e){return"function"==typeof t&&(t=t(e)),Qz("output",t,e),t}function Zz(t){return Object.prototype.toString.call(t).slice(8,-1)}var Vz={},qz="6.5.4",Jz={},Kz={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$_.Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[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];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],f=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);r=(p=p.idivn(f)).isZero()?m+r:c[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),i.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?f(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e),n},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=i.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new _(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}y.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},r(b,y),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(v,y),r(w,y),r(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,JM)}(Kz);var Xz=$z;function $z(t,e){if(!t)throw new Error(e||"Assertion failed")}$z.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var tP={};!function(t){var e=t;function n(t){return 1===t.length?"0"+t:t}function r(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=n,e.toHex=r,e.encode=function(t,e){return"hex"===e?r(t):t}}(tP),function(t){var e=t,n=Kz.exports,r=Xz,i=tP;e.assert=r,e.toArray=i.toArray,e.zero2=i.zero2,e.toHex=i.toHex,e.encode=i.encode,e.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},e.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},e.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},e.parseBytes=function(t){return"string"==typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new n(t,"hex","le")}}(Jz);var eP,nP={exports:{}};function rP(t){this.rand=t}if(nP.exports=function(t){return eP||(eP=new rP(null)),eP.generate(t)},nP.exports.Rand=rP,rP.prototype.generate=function(t){return this._rand(t)},rP.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?rP.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?rP.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(rP.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var iP=iE;if("function"!=typeof iP.randomBytes)throw new Error("Not supported");rP.prototype._rand=function(t){return iP.randomBytes(t)}}catch(t){}var oP={},aP=Kz.exports,sP=Jz,uP=sP.getNAF,cP=sP.getJSF,lP=sP.assert;function hP(t,e){this.type=t,this.p=new aP(e.p,16),this.red=e.prime?aP.red(e.prime):aP.mont(this.p),this.zero=new aP(0).toRed(this.red),this.one=new aP(1).toRed(this.red),this.two=new aP(2).toRed(this.red),this.n=e.n&&new aP(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 n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var dP=hP;function fP(t,e){this.curve=t,this.type=e,this.precomputed=null}hP.prototype.point=function(){throw new Error("Not implemented")},hP.prototype.validate=function(){throw new Error("Not implemented")},hP.prototype._fixedNafMul=function(t,e){lP(t.precomputed);var n=t._getDoubles(),r=uP(e,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<s.length;o++)(a=s[o])===h?l=l.mixedAdd(n.points[o]):a===-h&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},hP.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=uP(e,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];lP(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},hP.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(s=e[o])._getNAFPoints(t);u[o]=d.wnd,c[o]=d.points}for(o=r-1;o>=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var m=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(m[1]=e[f].add(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].add(e[p].neg())):(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=cP(n[f],n[p]);for(h=Math.max(y[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a<h;a++){var b=0|y[0][a],v=0|y[1][a];l[f][a]=g[3*(b+1)+(v+1)],l[p][a]=0,c[f]=m}}else l[f]=uP(n[f],u[f],this._bitLength),l[p]=uP(n[p],u[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var w=this.jpoint(null,null,null),M=this._wnafT4;for(o=h;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a<r;a++){var N=M[a];0!==N&&(N>0?s=c[a][N-1>>1]:N<0&&(s=c[a][-N-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o<r;o++)c[o]=null;return i?w:w.toP()},hP.BasePoint=fP,fP.prototype.eq=function(){throw new Error("Not implemented")},fP.prototype.validate=function(){return this.curve.validate(this)},hP.prototype.decodePoint=function(t,e){t=sP.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?lP(t[t.length-1]%2==0):7===t[0]&&lP(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},fP.prototype.encodeCompressed=function(t){return this.encode(t,!0)},fP.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},fP.prototype.encode=function(t,e){return sP.encode(this._encode(e),t)},fP.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},fP.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},fP.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},fP.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},fP.prototype._getBeta=function(){return null},fP.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};var pP="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},mP=KM(Object.freeze({__proto__:null,default:pP})),gP=Kz.exports,yP=mP,bP=dP,vP=Jz.assert;function wP(t){bP.call(this,"short",t),this.a=new gP(t.a,16).toRed(this.red),this.b=new gP(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}yP(wP,bP);var MP=wP;function _P(t,e,n,r){bP.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new gP(e,16),this.y=new gP(n,16),r&&(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)}function EP(t,e,n,r){bP.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new gP(0)):(this.x=new gP(e,16),this.y=new gP(n,16),this.z=new gP(r,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}wP.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n,r;if(t.beta)e=new gP(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)n=new gP(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],vP(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return r=t.basis?t.basis.map((function(t){return{a:new gP(t.a,16),b:new gP(t.b,16)}})):this._getEndoBasis(n),{beta:e,lambda:n,basis:r}}},wP.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:gP.mont(t),n=new gP(2).toRed(e).redInvm(),r=n.redNeg(),i=new gP(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},wP.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,d=this.n.clone(),f=new gP(1),p=new gP(0),m=new gP(0),g=new gP(1),y=0;0!==h.cmpn(0);){var b=d.div(h);u=d.sub(b.mul(h)),c=m.sub(b.mul(f));var v=g.sub(b.mul(p));if(!r&&u.cmp(l)<0)e=s.neg(),n=f,r=u.neg(),i=c;else if(r&&2==++y)break;s=u,d=h,h=u,m=f,f=c,g=p,p=v}o=u.neg(),a=c;var w=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},wP.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},wP.prototype.pointFromX=function(t,e){(t=new gP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},wP.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},wP.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},yP(_P,bP.BasePoint),wP.prototype.point=function(t,e,n){return new _P(this,t,e,n)},wP.prototype.pointFromJSON=function(t,e){return _P.fromJSON(this,t,e)},_P.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},_P.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]},_P.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},_P.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)+">"},_P.prototype.isInfinity=function(){return this.inf},_P.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},_P.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},_P.prototype.getX=function(){return this.x.fromRed()},_P.prototype.getY=function(){return this.y.fromRed()},_P.prototype.mul=function(t){return t=new gP(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},_P.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},_P.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},_P.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},_P.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},_P.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},yP(EP,bP.BasePoint),wP.prototype.jpoint=function(t,e,n){return new EP(this,t,e,n)},EP.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},EP.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},EP.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},EP.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},EP.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e<t;e++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(d);var b=c.redMul(s);e+1<t&&(u=u.redMul(d)),o=m,s=b,c=y}return this.curve.jpoint(o,c.redMul(i),s)},EP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},EP.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(f).redISub(f),e=p.redMul(f.redISub(t)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},EP.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),m=(p=p.redIAdd(p)).redAdd(p);t=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=f.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,n)},EP.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},EP.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},EP.prototype.mul=function(t,e){return t=new gP(t,e),this.curve._wnafMul(this,t)},EP.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},EP.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},EP.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)+">"},EP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var NP=Kz.exports,LP=mP,SP=dP,AP=Jz;function xP(t){SP.call(this,"mont",t),this.a=new NP(t.a,16).toRed(this.red),this.b=new NP(t.b,16).toRed(this.red),this.i4=new NP(4).toRed(this.red).redInvm(),this.two=new NP(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}LP(xP,SP);var TP=xP;function IP(t,e,n){SP.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new NP(e,16),this.z=new NP(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}xP.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},LP(IP,SP.BasePoint),xP.prototype.decodePoint=function(t,e){return this.point(AP.toArray(t,e),1)},xP.prototype.point=function(t,e){return new IP(this,t,e)},xP.prototype.pointFromJSON=function(t){return IP.fromJSON(this,t)},IP.prototype.precompute=function(){},IP.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},IP.fromJSON=function(t,e){return new IP(t,e[0],e[1]||t.one)},IP.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)+">"},IP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},IP.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},IP.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},IP.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=i.redMul(r),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},IP.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},IP.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},IP.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},IP.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},IP.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},IP.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var kP=Kz.exports,jP=mP,CP=dP,DP=Jz.assert;function OP(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,CP.call(this,"edwards",t),this.a=new kP(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new kP(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new kP(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),DP(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}jP(OP,CP);var zP=OP;function PP(t,e,n,r,i){CP.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(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 kP(e,16),this.y=new kP(n,16),this.z=r?new kP(r,16):this.curve.one,this.t=i&&new kP(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.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()))))}OP.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},OP.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},OP.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},OP.prototype.pointFromX=function(t,e){(t=new kP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},OP.prototype.pointFromY=function(t,e){(t=new kP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},OP.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},jP(PP,CP.BasePoint),OP.prototype.pointFromJSON=function(t){return PP.fromJSON(this,t)},OP.prototype.point=function(t,e,n,r){return new PP(this,t,e,n,r)},PP.fromJSON=function(t,e){return new PP(t,e[0],e[1],e[2])},PP.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)+">"},PP.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},PP.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),a=o.redSub(n),s=r.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,l)},PP.prototype._projDbl=function(){var t,e,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(r=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(r.redSub(u)),n=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(r.redSub(u)),n=c.redMul(o))}else r=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(r)).redMul(o),e=this.curve._mulC(r).redMul(s.redISub(u)),n=r.redMul(o);return this.curve.point(t,e,n)},PP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},PP.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(e),c=o.redMul(a),l=s.redMul(u),h=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,h)},PP.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=r.redMul(u).redMul(l);return this.curve.twisted?(e=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,n)},PP.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},PP.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},PP.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},PP.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},PP.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},PP.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},PP.prototype.getX=function(){return this.normalize(),this.x.fromRed()},PP.prototype.getY=function(){return this.normalize(),this.y.fromRed()},PP.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},PP.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},PP.prototype.toP=PP.prototype.normalize,PP.prototype.mixedAdd=PP.prototype.add,function(t){var e=t;e.base=dP,e.short=MP,e.mont=TP,e.edwards=zP}(oP);var RP={},BP={},UP={},FP=Xz,WP=mP;function YP(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function QP(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function HP(t){return 1===t.length?"0"+t:t}function GP(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}UP.inherits=WP,UP.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):YP(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},UP.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=HP(t[n].toString(16));return e},UP.htonl=QP,UP.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=QP(i)),n+=GP(i.toString(16))}return n},UP.zero2=HP,UP.zero8=GP,UP.join32=function(t,e,n,r){var i=n-e;FP(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},UP.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},UP.rotr32=function(t,e){return t>>>e|t<<32-e},UP.rotl32=function(t,e){return t<<e|t>>>32-e},UP.sum32=function(t,e){return t+e>>>0},UP.sum32_3=function(t,e,n){return t+e+n>>>0},UP.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},UP.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},UP.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},UP.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},UP.sum64_lo=function(t,e,n,r){return e+r>>>0},UP.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},UP.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},UP.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},UP.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},UP.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},UP.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},UP.shr64_hi=function(t,e,n){return t>>>n},UP.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var ZP={},VP=UP,qP=Xz;function JP(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}ZP.BlockHash=JP,JP.prototype.update=function(t,e){if(t=VP.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=VP.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},JP.prototype.digest=function(t){return this.update(this._pad()),qP(null===this.pending),this._digest(t)},JP.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var KP={},XP={},$P=UP.rotr32;function tR(t,e,n){return t&e^~t&n}function eR(t,e,n){return t&e^t&n^e&n}function nR(t,e,n){return t^e^n}XP.ft_1=function(t,e,n,r){return 0===t?tR(e,n,r):1===t||3===t?nR(e,n,r):2===t?eR(e,n,r):void 0},XP.ch32=tR,XP.maj32=eR,XP.p32=nR,XP.s0_256=function(t){return $P(t,2)^$P(t,13)^$P(t,22)},XP.s1_256=function(t){return $P(t,6)^$P(t,11)^$P(t,25)},XP.g0_256=function(t){return $P(t,7)^$P(t,18)^t>>>3},XP.g1_256=function(t){return $P(t,17)^$P(t,19)^t>>>10};var rR=UP,iR=ZP,oR=XP,aR=rR.rotl32,sR=rR.sum32,uR=rR.sum32_5,cR=oR.ft_1,lR=iR.BlockHash,hR=[1518500249,1859775393,2400959708,3395469782];function dR(){if(!(this instanceof dR))return new dR;lR.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}rR.inherits(dR,lR);var fR=dR;dR.blockSize=512,dR.outSize=160,dR.hmacStrength=80,dR.padLength=64,dR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=aR(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=uR(aR(i,5),cR(c,o,a,s),u,n[r],hR[c]);u=s,s=a,a=aR(o,30),o=i,i=l}this.h[0]=sR(this.h[0],i),this.h[1]=sR(this.h[1],o),this.h[2]=sR(this.h[2],a),this.h[3]=sR(this.h[3],s),this.h[4]=sR(this.h[4],u)},dR.prototype._digest=function(t){return"hex"===t?rR.toHex32(this.h,"big"):rR.split32(this.h,"big")};var pR=UP,mR=ZP,gR=XP,yR=Xz,bR=pR.sum32,vR=pR.sum32_4,wR=pR.sum32_5,MR=gR.ch32,_R=gR.maj32,ER=gR.s0_256,NR=gR.s1_256,LR=gR.g0_256,SR=gR.g1_256,AR=mR.BlockHash,xR=[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 TR(){if(!(this instanceof TR))return new TR;AR.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=xR,this.W=new Array(64)}pR.inherits(TR,AR);var IR=TR;TR.blockSize=512,TR.outSize=256,TR.hmacStrength=192,TR.padLength=64,TR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=vR(SR(n[r-2]),n[r-7],LR(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(yR(this.k.length===n.length),r=0;r<n.length;r++){var d=wR(h,NR(u),MR(u,c,l),this.k[r],n[r]),f=bR(ER(i),_R(i,o,a));h=l,l=c,c=u,u=bR(s,d),s=a,a=o,o=i,i=bR(d,f)}this.h[0]=bR(this.h[0],i),this.h[1]=bR(this.h[1],o),this.h[2]=bR(this.h[2],a),this.h[3]=bR(this.h[3],s),this.h[4]=bR(this.h[4],u),this.h[5]=bR(this.h[5],c),this.h[6]=bR(this.h[6],l),this.h[7]=bR(this.h[7],h)},TR.prototype._digest=function(t){return"hex"===t?pR.toHex32(this.h,"big"):pR.split32(this.h,"big")};var kR=UP,jR=IR;function CR(){if(!(this instanceof CR))return new CR;jR.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}kR.inherits(CR,jR);var DR=CR;CR.blockSize=512,CR.outSize=224,CR.hmacStrength=192,CR.padLength=64,CR.prototype._digest=function(t){return"hex"===t?kR.toHex32(this.h.slice(0,7),"big"):kR.split32(this.h.slice(0,7),"big")};var OR=UP,zR=ZP,PR=Xz,RR=OR.rotr64_hi,BR=OR.rotr64_lo,UR=OR.shr64_hi,FR=OR.shr64_lo,WR=OR.sum64,YR=OR.sum64_hi,QR=OR.sum64_lo,HR=OR.sum64_4_hi,GR=OR.sum64_4_lo,ZR=OR.sum64_5_hi,VR=OR.sum64_5_lo,qR=zR.BlockHash,JR=[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 KR(){if(!(this instanceof KR))return new KR;qR.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=JR,this.W=new Array(160)}OR.inherits(KR,qR);var XR=KR;function $R(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function tB(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function eB(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function nB(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function rB(t,e){var n=RR(t,e,28)^RR(e,t,2)^RR(e,t,7);return n<0&&(n+=4294967296),n}function iB(t,e){var n=BR(t,e,28)^BR(e,t,2)^BR(e,t,7);return n<0&&(n+=4294967296),n}function oB(t,e){var n=RR(t,e,14)^RR(t,e,18)^RR(e,t,9);return n<0&&(n+=4294967296),n}function aB(t,e){var n=BR(t,e,14)^BR(t,e,18)^BR(e,t,9);return n<0&&(n+=4294967296),n}function sB(t,e){var n=RR(t,e,1)^RR(t,e,8)^UR(t,e,7);return n<0&&(n+=4294967296),n}function uB(t,e){var n=BR(t,e,1)^BR(t,e,8)^FR(t,e,7);return n<0&&(n+=4294967296),n}function cB(t,e){var n=RR(t,e,19)^RR(e,t,29)^UR(t,e,6);return n<0&&(n+=4294967296),n}function lB(t,e){var n=BR(t,e,19)^BR(e,t,29)^FR(t,e,6);return n<0&&(n+=4294967296),n}KR.blockSize=1024,KR.outSize=512,KR.hmacStrength=192,KR.padLength=128,KR.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=cB(n[r-4],n[r-3]),o=lB(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=sB(n[r-30],n[r-29]),c=uB(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=HR(i,o,a,s,u,c,l,h),n[r+1]=GR(i,o,a,s,u,c,l,h)}},KR.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];PR(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=oB(h,d),E=aB(h,d),N=$R(h,d,f,p,m),L=tB(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=ZR(w,M,_,E,N,L,S,A,x,T),k=VR(w,M,_,E,N,L,S,A,x,T);w=rB(r,i),M=iB(r,i),_=eB(r,i,o,a,s),E=nB(r,i,o,a,s,u);var j=YR(w,M,_,E),C=QR(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=YR(c,l,I,k),d=QR(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=YR(I,k,j,C),i=QR(I,k,j,C)}WR(this.h,0,r,i),WR(this.h,2,o,a),WR(this.h,4,s,u),WR(this.h,6,c,l),WR(this.h,8,h,d),WR(this.h,10,f,p),WR(this.h,12,m,g),WR(this.h,14,y,b)},KR.prototype._digest=function(t){return"hex"===t?OR.toHex32(this.h,"big"):OR.split32(this.h,"big")};var hB=UP,dB=XR;function fB(){if(!(this instanceof fB))return new fB;dB.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}hB.inherits(fB,dB);var pB=fB;fB.blockSize=1024,fB.outSize=384,fB.hmacStrength=192,fB.padLength=128,fB.prototype._digest=function(t){return"hex"===t?hB.toHex32(this.h.slice(0,12),"big"):hB.split32(this.h.slice(0,12),"big")},KP.sha1=fR,KP.sha224=DR,KP.sha256=IR,KP.sha384=pB,KP.sha512=XR;var mB={},gB=UP,yB=ZP,bB=gB.rotl32,vB=gB.sum32,wB=gB.sum32_3,MB=gB.sum32_4,_B=yB.BlockHash;function EB(){if(!(this instanceof EB))return new EB;_B.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function NB(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function LB(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function SB(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}gB.inherits(EB,_B),mB.ripemd160=EB,EB.blockSize=512,EB.outSize=160,EB.hmacStrength=192,EB.padLength=64,EB.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=vB(bB(MB(n,NB(d,r,i,o),t[AB[d]+e],LB(d)),TB[d]),a);n=a,a=o,o=bB(i,10),i=r,r=f,f=vB(bB(MB(s,NB(79-d,u,c,l),t[xB[d]+e],SB(d)),IB[d]),h),s=h,h=l,l=bB(c,10),c=u,u=f}f=wB(this.h[1],i,l),this.h[1]=wB(this.h[2],o,h),this.h[2]=wB(this.h[3],a,s),this.h[3]=wB(this.h[4],n,u),this.h[4]=wB(this.h[0],r,c),this.h[0]=f},EB.prototype._digest=function(t){return"hex"===t?gB.toHex32(this.h,"little"):gB.split32(this.h,"little")};var AB=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],xB=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],TB=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],IB=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],kB=UP,jB=Xz;function CB(t,e,n){if(!(this instanceof CB))return new CB(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(kB.toArray(e,n))}var DB,OB,zB=CB;CB.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),jB(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},CB.prototype.update=function(t,e){return this.inner.update(t,e),this},CB.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=UP,e.common=ZP,e.sha=KP,e.ripemd=mB,e.hmac=zB,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(BP),function(t){var e,n=t,r=BP,i=oP,o=Jz.assert;function a(t){"short"===t.type?this.curve=new i.short(t):"edwards"===t.type?this.curve=new i.edwards(t):this.curve=new i.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new a(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{e=OB?DB:(OB=1,DB={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"]]}})}catch(t){e=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",e]})}(RP);var PB=BP,RB=tP,BB=Xz;function UB(t){if(!(this instanceof UB))return new UB(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=RB.toArray(t.entropy,t.entropyEnc||"hex"),n=RB.toArray(t.nonce,t.nonceEnc||"hex"),r=RB.toArray(t.pers,t.persEnc||"hex");BB(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var FB=UB;UB.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},UB.prototype._hmac=function(){return new PB.hmac(this.hash,this.K)},UB.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},UB.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=RB.toArray(t,e),n=RB.toArray(n,r),BB(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},UB.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=RB.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(n),this._reseed++,RB.encode(o,e)};var WB=Kz.exports,YB=Jz.assert;function QB(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var HB=QB;QB.fromPublic=function(t,e,n){return e instanceof QB?e:new QB(t,{pub:e,pubEnc:n})},QB.fromPrivate=function(t,e,n){return e instanceof QB?e:new QB(t,{priv:e,privEnc:n})},QB.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},QB.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},QB.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},QB.prototype._importPrivate=function(t,e){this.priv=new WB(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},QB.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?YB(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||YB(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},QB.prototype.derive=function(t){return t.validate()||YB(t.validate(),"public point not validated"),t.mul(this.priv).getX()},QB.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},QB.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},QB.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var GB=Kz.exports,ZB=Jz,VB=ZB.assert;function qB(t,e){if(t instanceof qB)return t;this._importDER(t,e)||(VB(t.r&&t.s,"Signature without r or s"),this.r=new GB(t.r,16),this.s=new GB(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var JB=qB;function KB(){this.place=0}function XB(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function $B(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function tU(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}qB.prototype._importDER=function(t,e){t=ZB.toArray(t,e);var n=new KB;if(48!==t[n.place++])return!1;var r=XB(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=XB(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=XB(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new GB(o),this.s=new GB(s),this.recoveryParam=null,!0},qB.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=$B(e),n=$B(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];tU(r,e.length),(r=r.concat(e)).push(2),tU(r,n.length);var i=r.concat(n),o=[48];return tU(o,i.length),o=o.concat(i),ZB.encode(o,t)};var eU=Kz.exports,nU=FB,rU=Jz,iU=RP,oU=nP.exports,aU=rU.assert,sU=HB,uU=JB;function cU(t){if(!(this instanceof cU))return new cU(t);"string"==typeof t&&(aU(Object.prototype.hasOwnProperty.call(iU,t),"Unknown curve "+t),t=iU[t]),t instanceof iU.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var lU=cU;cU.prototype.keyPair=function(t){return new sU(this,t)},cU.prototype.keyFromPrivate=function(t,e){return sU.fromPrivate(this,t,e)},cU.prototype.keyFromPublic=function(t,e){return sU.fromPublic(this,t,e)},cU.prototype.genKeyPair=function(t){t||(t={});for(var e=new nU({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||oU(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new eU(2));;){var i=new eU(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},cU.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},cU.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new eU(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new nU({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new eU(1)),c=0;;c++){var l=r.k?r.k(c):new eU(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new uU({r:f,s:p,recoveryParam:m})}}}}}},cU.prototype.verify=function(t,e,n,r){t=this._truncateToN(new eU(t,16)),n=this.keyFromPublic(n,r);var i=(e=new uU(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},cU.prototype.recoverPubKey=function(t,e,n,r){aU((3&n)===n,"The recovery param is more than two bits"),e=new uU(e,r);var i=this.n,o=new eU(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},cU.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new uU(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var hU=Jz,dU=hU.assert,fU=hU.parseBytes,pU=hU.cachedProperty;function mU(t,e){this.eddsa=t,this._secret=fU(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=fU(e.pub)}mU.fromPublic=function(t,e){return e instanceof mU?e:new mU(t,{pub:e})},mU.fromSecret=function(t,e){return e instanceof mU?e:new mU(t,{secret:e})},mU.prototype.secret=function(){return this._secret},pU(mU,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),pU(mU,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),pU(mU,"privBytes",(function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),pU(mU,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),pU(mU,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),pU(mU,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),mU.prototype.sign=function(t){return dU(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},mU.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},mU.prototype.getSecret=function(t){return dU(this._secret,"KeyPair is public only"),hU.encode(this.secret(),t)},mU.prototype.getPublic=function(t){return hU.encode(this.pubBytes(),t)};var gU=mU,yU=Kz.exports,bU=Jz,vU=bU.assert,wU=bU.cachedProperty,MU=bU.parseBytes;function _U(t,e){this.eddsa=t,"object"!=typeof e&&(e=MU(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),vU(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof yU&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}wU(_U,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),wU(_U,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),wU(_U,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),wU(_U,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),_U.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},_U.prototype.toHex=function(){return bU.encode(this.toBytes(),"hex").toUpperCase()};var EU=_U,NU=BP,LU=RP,SU=Jz,AU=SU.assert,xU=SU.parseBytes,TU=gU,IU=EU;function kU(t){if(AU("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof kU))return new kU(t);t=LU[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=NU.sha512}var jU=kU;kU.prototype.sign=function(t,e){t=xU(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},kU.prototype.verify=function(t,e,n){t=xU(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},kU.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return SU.intFromLE(t.digest()).umod(this.curve.n)},kU.prototype.keyFromPublic=function(t){return TU.fromPublic(this,t)},kU.prototype.keyFromSecret=function(t){return TU.fromSecret(this,t)},kU.prototype.makeSignature=function(t){return t instanceof IU?t:new IU(this,t)},kU.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},kU.prototype.decodePoint=function(t){var e=(t=SU.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=SU.intFromLE(n);return this.curve.pointFromY(i,r)},kU.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},kU.prototype.decodeInt=function(t){return SU.intFromLE(t)},kU.prototype.isPoint=function(t){return t instanceof this.pointClass},function(t){var e=t;e.version=qz,e.utils=Jz,e.rand=nP.exports,e.curve=oP,e.curves=RP,e.ec=lU,e.eddsa=jU}(Vz);const CU=new(0,Vz.ec)("secp256k1"),DU=CU.curve,OU=DU.n.constructor;function zU(t){const e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:function(t,e){let n=new OU(e);if(n.cmp(DU.p)>=0)return null;n=n.toRed(DU.red);let r=n.redSqr().redIMul(n).redIAdd(DU.b).redSqrt();return 3===t!==r.isOdd()&&(r=r.redNeg()),CU.keyPair({pub:{x:n,y:r}})}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,n){let r=new OU(e),i=new OU(n);if(r.cmp(DU.p)>=0||i.cmp(DU.p)>=0)return null;if(r=r.toRed(DU.red),i=i.toRed(DU.red),(6===t||7===t)&&i.isOdd()!==(7===t))return null;const o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(DU.b)).isZero()?CU.keyPair({pub:{x:r,y:i}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function PU(t,e){const n=e.encode(null,33===t.length);for(let e=0;e<t.length;++e)t[e]=n[e]}var RU={contextRandomize:()=>0,privateKeyVerify(t){const e=new OU(t);return e.cmp(DU.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new OU(t),n=DU.n.sub(e).umod(DU.n).toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakAdd(t,e){const n=new OU(e);if(n.cmp(DU.n)>=0)return 1;if(n.iadd(new OU(t)),n.cmp(DU.n)>=0&&n.isub(DU.n),n.isZero())return 1;const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakMul(t,e){let n=new OU(e);if(n.cmp(DU.n)>=0||n.isZero())return 1;n.imul(new OU(t)),n.cmp(DU.n)>=0&&(n=n.umod(DU.n));const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},publicKeyVerify:t=>null===zU(t)?1:0,publicKeyCreate(t,e){const n=new OU(e);if(n.cmp(DU.n)>=0||n.isZero())return 1;return PU(t,CU.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const n=zU(e);if(null===n)return 1;return PU(t,n.getPublic()),0},publicKeyNegate(t,e){const n=zU(e);if(null===n)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),PU(t,r),0},publicKeyCombine(t,e){const n=new Array(e.length);for(let t=0;t<e.length;++t)if(n[t]=zU(e[t]),null===n[t])return 1;let r=n[0].getPublic();for(let t=1;t<n.length;++t)r=r.add(n[t].pub);return r.isInfinity()?2:(PU(t,r),0)},publicKeyTweakAdd(t,e,n){const r=zU(e);if(null===r)return 1;if((n=new OU(n)).cmp(DU.n)>=0)return 2;const i=r.getPublic().add(DU.g.mul(n));return i.isInfinity()?2:(PU(t,i),0)},publicKeyTweakMul(t,e,n){const r=zU(e);if(null===r)return 1;if((n=new OU(n)).cmp(DU.n)>=0||n.isZero())return 2;return PU(t,r.getPublic().mul(n)),0},signatureNormalize(t){const e=new OU(t.subarray(0,32)),n=new OU(t.subarray(32,64));return e.cmp(DU.n)>=0||n.cmp(DU.n)>=0?1:(1===n.cmp(CU.nh)&&t.set(DU.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const n=e.subarray(0,32),r=e.subarray(32,64);if(new OU(n).cmp(DU.n)>=0)return 1;if(new OU(r).cmp(DU.n)>=0)return 1;const{output:i}=t;let o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(o=o.subarray(s),128&o[0])return 1;if(a>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(r,1);let c=33,l=0;for(;c>1&&0===u[l]&&!(128&u[l+1]);--c,++l);return u=u.subarray(l),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(t.outputlen=6+a+c,i[0]=48,i[1]=t.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=u.length,i.set(u,6+a),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const n=e[3];if(0===n)return 1;if(5+n>=e.length)return 1;if(2!==e[4+n])return 1;const r=e[5+n];if(0===r)return 1;if(6+n+r!==e.length)return 1;if(128&e[4])return 1;if(n>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[n+6])return 1;if(r>1&&0===e[n+6]&&!(128&e[n+7]))return 1;let i=e.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=e.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let a=new OU(i);a.cmp(DU.n)>=0&&(a=new OU(0));let s=new OU(e.subarray(6+n));return s.cmp(DU.n)>=0&&(s=new OU(0)),t.set(a.toArrayLike(Uint8Array,"be",32),0),t.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,n,r,i){if(i){const t=i;i=i=>{const o=t(e,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new OU(o)}}const o=new OU(n);if(o.cmp(DU.n)>=0||o.isZero())return 1;let a;try{a=CU.sign(e,n,{canonical:!0,k:i,pers:r})}catch(t){return 1}return t.signature.set(a.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(a.s.toArrayLike(Uint8Array,"be",32),32),t.recid=a.recoveryParam,0},ecdsaVerify(t,e,n){const r={r:t.subarray(0,32),s:t.subarray(32,64)},i=new OU(r.r),o=new OU(r.s);if(i.cmp(DU.n)>=0||o.cmp(DU.n)>=0)return 1;if(1===o.cmp(CU.nh)||i.isZero()||o.isZero())return 3;const a=zU(n);if(null===a)return 2;const s=a.getPublic();return CU.verify(e,r,s)?0:3},ecdsaRecover(t,e,n,r){const i={r:e.slice(0,32),s:e.slice(32,64)},o=new OU(i.r),a=new OU(i.s);if(o.cmp(DU.n)>=0||a.cmp(DU.n)>=0)return 1;if(o.isZero()||a.isZero())return 2;let s;try{s=CU.recoverPubKey(r,i,n)}catch(t){return 2}return PU(t,s),0},ecdh(t,e,n,r,i,o,a){const s=zU(e);if(null===s)return 1;const u=new OU(n);if(u.cmp(DU.n)>=0||u.isZero())return 2;const c=s.getPublic().mul(u);if(void 0===i){const e=c.encode(null,!0),n=CU.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=n[e]}else{o||(o=new Uint8Array(32));const e=c.getX().toArray("be",32);for(let t=0;t<32;++t)o[t]=e[t];a||(a=new Uint8Array(32));const n=c.getY().toArray("be",32);for(let t=0;t<32;++t)a[t]=n[t];const s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===t.length))return 2;t.set(s)}return 0}},BU=(t=>({contextRandomize(e){if(Yz(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&Qz("seed",e,32),1===t.contextRandomize(e))throw new Error(Dz)},privateKeyVerify:e=>(Qz("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(Qz("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(kz)}},privateKeyTweakAdd(e,n){switch(Qz("private key",e,32),Qz("tweak",n,32),t.privateKeyTweakAdd(e,n)){case 0:return e;case 1:throw new Error(jz)}},privateKeyTweakMul(e,n){switch(Qz("private key",e,32),Qz("tweak",n,32),t.privateKeyTweakMul(e,n)){case 0:return e;case 1:throw new Error(Cz)}},publicKeyVerify:e=>(Qz("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,n=!0,r){switch(Qz("private key",e,32),Hz(n),r=Gz(r,n?33:65),t.publicKeyCreate(r,e)){case 0:return r;case 1:throw new Error(Oz);case 2:throw new Error(Pz)}},publicKeyConvert(e,n=!0,r){switch(Qz("public key",e,[33,65]),Hz(n),r=Gz(r,n?33:65),t.publicKeyConvert(r,e)){case 0:return r;case 1:throw new Error(zz);case 2:throw new Error(Pz)}},publicKeyNegate(e,n=!0,r){switch(Qz("public key",e,[33,65]),Hz(n),r=Gz(r,n?33:65),t.publicKeyNegate(r,e)){case 0:return r;case 1:throw new Error(zz);case 2:throw new Error(kz);case 3:throw new Error(Pz)}},publicKeyCombine(e,n=!0,r){Yz(Array.isArray(e),"Expected public keys to be an Array"),Yz(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)Qz("public key",t,[33,65]);switch(Hz(n),r=Gz(r,n?33:65),t.publicKeyCombine(r,e)){case 0:return r;case 1:throw new Error(zz);case 2:throw new Error(Rz);case 3:throw new Error(Pz)}},publicKeyTweakAdd(e,n,r=!0,i){switch(Qz("public key",e,[33,65]),Qz("tweak",n,32),Hz(r),i=Gz(i,r?33:65),t.publicKeyTweakAdd(i,e,n)){case 0:return i;case 1:throw new Error(zz);case 2:throw new Error(jz)}},publicKeyTweakMul(e,n,r=!0,i){switch(Qz("public key",e,[33,65]),Qz("tweak",n,32),Hz(r),i=Gz(i,r?33:65),t.publicKeyTweakMul(i,e,n)){case 0:return i;case 1:throw new Error(zz);case 2:throw new Error(Cz)}},signatureNormalize(e){switch(Qz("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(Bz)}},signatureExport(e,n){Qz("signature",e,64);const r={output:n=Gz(n,72),outputlen:72};switch(t.signatureExport(r,e)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(Bz);case 2:throw new Error(kz)}},signatureImport(e,n){switch(Qz("signature",e),n=Gz(n,64),t.signatureImport(n,e)){case 0:return n;case 1:throw new Error(Bz);case 2:throw new Error(kz)}},ecdsaSign(e,n,r={},i){Qz("message",e,32),Qz("private key",n,32),Yz("Object"===Zz(r),"Expected options to be an Object"),void 0!==r.data&&Qz("options.data",r.data),void 0!==r.noncefn&&Yz("Function"===Zz(r.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=Gz(i,64),recid:null};switch(t.ecdsaSign(o,e,n,r.data,r.noncefn)){case 0:return o;case 1:throw new Error(Uz);case 2:throw new Error(kz)}},ecdsaVerify(e,n,r){switch(Qz("signature",e,64),Qz("message",n,32),Qz("public key",r,[33,65]),t.ecdsaVerify(e,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(Bz);case 2:throw new Error(zz)}},ecdsaRecover(e,n,r,i=!0,o){switch(Qz("signature",e,64),Yz("Number"===Zz(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),Qz("message",r,32),Hz(i),o=Gz(o,i?33:65),t.ecdsaRecover(o,e,n,r)){case 0:return o;case 1:throw new Error(Bz);case 2:throw new Error(Fz);case 3:throw new Error(kz)}},ecdh(e,n,r={},i){switch(Qz("public key",e,[33,65]),Qz("private key",n,32),Yz("Object"===Zz(r),"Expected options to be an Object"),void 0!==r.data&&Qz("options.data",r.data),void 0!==r.hashfn?(Yz("Function"===Zz(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&Qz("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&Qz("options.ybuf",r.ybuf,32),Qz("output",i)):i=Gz(i,32),t.ecdh(i,e,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return i;case 1:throw new Error(zz);case 2:throw new Error(Wz)}}}))(RU),UU=BU,FU={exports:{}};!function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof hS&&hS.versions&&hS.versions.node?r=JM:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new I(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new I(t,e,i).update(r)[n]()}},y=function(t,e,n){return function(e,r,i,o){return _["cshake"+t].update(e,r,i,o)[n]()}},b=function(t,e,n){return function(e,r,i,o){return _["kmac"+t].update(e,r,i,o)[n]()}},v=function(t,e,n,r){for(var i=0;i<f.length;++i){var o=f[i];t[o]=e(n,r,o)}return t},w=function(t,e){var n=m(t,e,"hex");return n.create=function(){return new I(t,e,t)},n.update=function(t){return n.create().update(t)},v(n,m,t,e)},M=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:w},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:w},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var n=g(t,e,"hex");return n.create=function(n){return new I(t,e,n)},n.update=function(t,e){return n.create(e).update(t)},v(n,g,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=y(t,0,"hex");return r.create=function(r,i,o){return i||o?new I(t,e,r).bytepad([i,o],n):_["shake"+t].create(r)},r.update=function(t,e,n,i){return r.create(e,n,i).update(t)},v(r,y,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=b(t,0,"hex");return r.create=function(r,i,o){return new k(t,e,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(t,e,n,i){return r.create(t,n,i).update(e)},v(r,b,t,e)}}],_={},E=[],N=0;N<M.length;++N)for(var L=M[N],S=L.bits,A=0;A<S.length;++A){var x=L.name+"_"+S[A];if(E.push(x),_[x]=L.createMethod(S[A],L.padding),"sha3"!==L.name){var T=L.name+S[A];E.push(T),_[T]=_[x]}}function I(t,e,n){this.blocks=[],this.s=[],this.padding=e,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function k(t,e,n){I.call(this,t,e,n)}I.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<h+1;++i)s[i]=0;if(n)for(i=this.start;d<l&&i<u;++d)s[i>>2]|=t[d]<<c[3&i++];else for(i=this.start;d<l&&i<u;++d)(o=t.charCodeAt(d))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++d)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[h],i=0;i<h;++i)f[i]^=s[i];j(f),this.reset=!0}else this.start=i}return this},I.prototype.encode=function(t,e){var n=255&t,r=1,i=[n];for(n=255&(t>>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},I.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s<t.length;++s){var u=t.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},I.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r<t.length;++r)n+=this.encodeString(t[r]);var i=e-n%e,o=[];return o.length=i,this.update(o),this},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,n=this.blockCount,r=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e<n+1;++e)t[e]=0;for(t[n-1]|=2147483648,e=0;e<n;++e)r[e]^=t[e];j(r)}},I.prototype.toString=I.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<r;){for(o=0;o<e&&a<r;++o,++a)t=n[o],u+=s[t>>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(j(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},I.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<r;){for(o=0;o<e&&a<r;++o,++a)u[a]=n[o];a%e==0&&j(n)}return i&&(u[o]=n[o],t=t.slice(0,s)),t},I.prototype.buffer=I.prototype.arrayBuffer,I.prototype.digest=I.prototype.array=function(){this.finalize();for(var t,e,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)t=s<<2,e=r[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&j(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},k.prototype=new I,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var j=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S,A,x,T,I,k,j,C,D,O,z,P,R,B,U,F,W,Y,Q,H,G,Z,V,q,J,K,X,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,m=t[0],g=t[1],Z=t[11]<<4|t[10]>>>28,V=t[10]<<4|t[11]>>>28,T=t[20]<<3|t[21]>>>29,I=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,Q=t[41]<<18|t[40]>>>14,O=t[2]<<1|t[3]>>>31,z=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,q=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,k=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,P=t[14]<<6|t[15]>>>26,R=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,C=t[45]<<29|t[44]>>>3,D=t[44]<<29|t[45]>>>3,L=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,B=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,A=t[18]<<20|t[19]>>>12,x=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,F=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,N=t[49]<<14|t[48]>>>18,t[0]=m^~y&v,t[1]=g^~b&w,t[10]=L^~A&T,t[11]=S^~x&I,t[20]=O^~P&B,t[21]=z^~R&U,t[30]=H^~Z&q,t[31]=G^~V&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=y^~v&M,t[3]=b^~w&_,t[12]=A^~T&k,t[13]=x^~I&j,t[22]=P^~B&F,t[23]=R^~U&W,t[32]=Z^~q&K,t[33]=V^~J&X,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=v^~M&E,t[5]=w^~_&N,t[14]=T^~k&C,t[15]=I^~j&D,t[24]=B^~F&Y,t[25]=U^~W&Q,t[34]=q^~K&$,t[35]=J^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&lt,t[6]=M^~E&m,t[7]=_^~N&g,t[16]=k^~C&L,t[17]=j^~D&S,t[26]=F^~Y&O,t[27]=W^~Q&z,t[36]=K^~$&H,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=E^~m&y,t[9]=N^~g&b,t[18]=C^~L&A,t[19]=D^~S&x,t[28]=Y^~O&P,t[29]=Q^~z&R,t[38]=$^~H&Z,t[39]=tt^~G&V,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=_;else for(N=0;N<E.length;++N)r[E[N]]=_[E[N]]}()}(FU);var WU=FU.exports;const YU=t=>f_.isBuffer(t)?t:t instanceof Uint8Array?f_.from(t.buffer,t.byteOffset,t.byteLength):f_.from(t);var QU={},HU={},GU=ZU;function ZU(t,e){if(!t)throw new Error(e||"Assertion failed")}ZU.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var VU={exports:{}};"function"==typeof Object.create?VU.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:VU.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var qU=GU,JU=VU.exports;function KU(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function XU(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function $U(t){return 1===t.length?"0"+t:t}function tF(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}HU.inherits=JU,HU.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):KU(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},HU.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=$U(t[n].toString(16));return e},HU.htonl=XU,HU.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=XU(i)),n+=tF(i.toString(16))}return n},HU.zero2=$U,HU.zero8=tF,HU.join32=function(t,e,n,r){var i=n-e;qU(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},HU.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},HU.rotr32=function(t,e){return t>>>e|t<<32-e},HU.rotl32=function(t,e){return t<<e|t>>>32-e},HU.sum32=function(t,e){return t+e>>>0},HU.sum32_3=function(t,e,n){return t+e+n>>>0},HU.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},HU.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},HU.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},HU.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},HU.sum64_lo=function(t,e,n,r){return e+r>>>0},HU.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},HU.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},HU.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},HU.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},HU.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},HU.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},HU.shr64_hi=function(t,e,n){return t>>>n},HU.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var eF={},nF=HU,rF=GU;function iF(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}eF.BlockHash=iF,iF.prototype.update=function(t,e){if(t=nF.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=nF.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},iF.prototype.digest=function(t){return this.update(this._pad()),rF(null===this.pending),this._digest(t)},iF.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var oF={},aF={},sF=HU.rotr32;function uF(t,e,n){return t&e^~t&n}function cF(t,e,n){return t&e^t&n^e&n}function lF(t,e,n){return t^e^n}aF.ft_1=function(t,e,n,r){return 0===t?uF(e,n,r):1===t||3===t?lF(e,n,r):2===t?cF(e,n,r):void 0},aF.ch32=uF,aF.maj32=cF,aF.p32=lF,aF.s0_256=function(t){return sF(t,2)^sF(t,13)^sF(t,22)},aF.s1_256=function(t){return sF(t,6)^sF(t,11)^sF(t,25)},aF.g0_256=function(t){return sF(t,7)^sF(t,18)^t>>>3},aF.g1_256=function(t){return sF(t,17)^sF(t,19)^t>>>10};var hF=HU,dF=eF,fF=aF,pF=hF.rotl32,mF=hF.sum32,gF=hF.sum32_5,yF=fF.ft_1,bF=dF.BlockHash,vF=[1518500249,1859775393,2400959708,3395469782];function wF(){if(!(this instanceof wF))return new wF;bF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hF.inherits(wF,bF);var MF=wF;wF.blockSize=512,wF.outSize=160,wF.hmacStrength=80,wF.padLength=64,wF.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=pF(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=gF(pF(i,5),yF(c,o,a,s),u,n[r],vF[c]);u=s,s=a,a=pF(o,30),o=i,i=l}this.h[0]=mF(this.h[0],i),this.h[1]=mF(this.h[1],o),this.h[2]=mF(this.h[2],a),this.h[3]=mF(this.h[3],s),this.h[4]=mF(this.h[4],u)},wF.prototype._digest=function(t){return"hex"===t?hF.toHex32(this.h,"big"):hF.split32(this.h,"big")};var _F=HU,EF=eF,NF=aF,LF=GU,SF=_F.sum32,AF=_F.sum32_4,xF=_F.sum32_5,TF=NF.ch32,IF=NF.maj32,kF=NF.s0_256,jF=NF.s1_256,CF=NF.g0_256,DF=NF.g1_256,OF=EF.BlockHash,zF=[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 PF(){if(!(this instanceof PF))return new PF;OF.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=zF,this.W=new Array(64)}_F.inherits(PF,OF);var RF=PF;PF.blockSize=512,PF.outSize=256,PF.hmacStrength=192,PF.padLength=64,PF.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=AF(DF(n[r-2]),n[r-7],CF(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(LF(this.k.length===n.length),r=0;r<n.length;r++){var d=xF(h,jF(u),TF(u,c,l),this.k[r],n[r]),f=SF(kF(i),IF(i,o,a));h=l,l=c,c=u,u=SF(s,d),s=a,a=o,o=i,i=SF(d,f)}this.h[0]=SF(this.h[0],i),this.h[1]=SF(this.h[1],o),this.h[2]=SF(this.h[2],a),this.h[3]=SF(this.h[3],s),this.h[4]=SF(this.h[4],u),this.h[5]=SF(this.h[5],c),this.h[6]=SF(this.h[6],l),this.h[7]=SF(this.h[7],h)},PF.prototype._digest=function(t){return"hex"===t?_F.toHex32(this.h,"big"):_F.split32(this.h,"big")};var BF=HU,UF=RF;function FF(){if(!(this instanceof FF))return new FF;UF.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}BF.inherits(FF,UF);var WF=FF;FF.blockSize=512,FF.outSize=224,FF.hmacStrength=192,FF.padLength=64,FF.prototype._digest=function(t){return"hex"===t?BF.toHex32(this.h.slice(0,7),"big"):BF.split32(this.h.slice(0,7),"big")};var YF=HU,QF=eF,HF=GU,GF=YF.rotr64_hi,ZF=YF.rotr64_lo,VF=YF.shr64_hi,qF=YF.shr64_lo,JF=YF.sum64,KF=YF.sum64_hi,XF=YF.sum64_lo,$F=YF.sum64_4_hi,tW=YF.sum64_4_lo,eW=YF.sum64_5_hi,nW=YF.sum64_5_lo,rW=QF.BlockHash,iW=[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 oW(){if(!(this instanceof oW))return new oW;rW.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=iW,this.W=new Array(160)}YF.inherits(oW,rW);var aW=oW;function sW(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function uW(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function cW(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function lW(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function hW(t,e){var n=GF(t,e,28)^GF(e,t,2)^GF(e,t,7);return n<0&&(n+=4294967296),n}function dW(t,e){var n=ZF(t,e,28)^ZF(e,t,2)^ZF(e,t,7);return n<0&&(n+=4294967296),n}function fW(t,e){var n=GF(t,e,14)^GF(t,e,18)^GF(e,t,9);return n<0&&(n+=4294967296),n}function pW(t,e){var n=ZF(t,e,14)^ZF(t,e,18)^ZF(e,t,9);return n<0&&(n+=4294967296),n}function mW(t,e){var n=GF(t,e,1)^GF(t,e,8)^VF(t,e,7);return n<0&&(n+=4294967296),n}function gW(t,e){var n=ZF(t,e,1)^ZF(t,e,8)^qF(t,e,7);return n<0&&(n+=4294967296),n}function yW(t,e){var n=GF(t,e,19)^GF(e,t,29)^VF(t,e,6);return n<0&&(n+=4294967296),n}function bW(t,e){var n=ZF(t,e,19)^ZF(e,t,29)^qF(t,e,6);return n<0&&(n+=4294967296),n}oW.blockSize=1024,oW.outSize=512,oW.hmacStrength=192,oW.padLength=128,oW.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=yW(n[r-4],n[r-3]),o=bW(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=mW(n[r-30],n[r-29]),c=gW(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=$F(i,o,a,s,u,c,l,h),n[r+1]=tW(i,o,a,s,u,c,l,h)}},oW.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];HF(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=fW(h,d),E=pW(h,d),N=sW(h,d,f,p,m),L=uW(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=eW(w,M,_,E,N,L,S,A,x,T),k=nW(w,M,_,E,N,L,S,A,x,T);w=hW(r,i),M=dW(r,i),_=cW(r,i,o,a,s),E=lW(r,i,o,a,s,u);var j=KF(w,M,_,E),C=XF(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=KF(c,l,I,k),d=XF(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=KF(I,k,j,C),i=XF(I,k,j,C)}JF(this.h,0,r,i),JF(this.h,2,o,a),JF(this.h,4,s,u),JF(this.h,6,c,l),JF(this.h,8,h,d),JF(this.h,10,f,p),JF(this.h,12,m,g),JF(this.h,14,y,b)},oW.prototype._digest=function(t){return"hex"===t?YF.toHex32(this.h,"big"):YF.split32(this.h,"big")};var vW=HU,wW=aW;function MW(){if(!(this instanceof MW))return new MW;wW.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}vW.inherits(MW,wW);var _W=MW;MW.blockSize=1024,MW.outSize=384,MW.hmacStrength=192,MW.padLength=128,MW.prototype._digest=function(t){return"hex"===t?vW.toHex32(this.h.slice(0,12),"big"):vW.split32(this.h.slice(0,12),"big")},oF.sha1=MF,oF.sha224=WF,oF.sha256=RF,oF.sha384=_W,oF.sha512=aW;var EW={},NW=HU,LW=eF,SW=NW.rotl32,AW=NW.sum32,xW=NW.sum32_3,TW=NW.sum32_4,IW=LW.BlockHash;function kW(){if(!(this instanceof kW))return new kW;IW.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function jW(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function CW(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function DW(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}NW.inherits(kW,IW),EW.ripemd160=kW,kW.blockSize=512,kW.outSize=160,kW.hmacStrength=192,kW.padLength=64,kW.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=AW(SW(TW(n,jW(d,r,i,o),t[OW[d]+e],CW(d)),PW[d]),a);n=a,a=o,o=SW(i,10),i=r,r=f,f=AW(SW(TW(s,jW(79-d,u,c,l),t[zW[d]+e],DW(d)),RW[d]),h),s=h,h=l,l=SW(c,10),c=u,u=f}f=xW(this.h[1],i,l),this.h[1]=xW(this.h[2],o,h),this.h[2]=xW(this.h[3],a,s),this.h[3]=xW(this.h[4],n,u),this.h[4]=xW(this.h[0],r,c),this.h[0]=f},kW.prototype._digest=function(t){return"hex"===t?NW.toHex32(this.h,"little"):NW.split32(this.h,"little")};var OW=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zW=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],PW=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],RW=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],BW=HU,UW=GU;function FW(t,e,n){if(!(this instanceof FW))return new FW(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(BW.toArray(e,n))}var WW=FW;FW.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),UW(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},FW.prototype.update=function(t,e){return this.inner.update(t,e),this},FW.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=HU,e.common=eF,e.sha=oF,e.ripemd=EW,e.hmac=WW,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(QU);var YW=QU;let QW=!1,HW=!1;const GW={debug:1,default:2,info:2,warning:3,error:4,off:5};let ZW=GW.default,VW=null;const qW=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var JW,KW;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(JW||(JW={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(KW||(KW={}));const XW="0123456789abcdef";class $W{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==GW[n]&&this.throwArgumentError("invalid log level name","logLevel",t),ZW>GW[n]||console.log.apply(console,e)}debug(...t){this._log($W.levels.DEBUG,t)}info(...t){this._log($W.levels.INFO,t)}warn(...t){this._log($W.levels.WARNING,t)}makeError(t,e,n){if(HW)return this.makeError("censored error",e,{});e||(e=$W.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t<e.length;t++)n+=XW[e[t]>>4],n+=XW[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case KW.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case KW.CALL_EXCEPTION:case KW.INSUFFICIENT_FUNDS:case KW.MISSING_NEW:case KW.NONCE_EXPIRED:case KW.REPLACEMENT_UNDERPRICED:case KW.TRANSACTION_REPLACED:case KW.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,$W.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){qW&&this.throwError("platform missing String.prototype.normalize",$W.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:qW})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,$W.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,$W.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",t<e&&this.throwError("missing argument"+n,$W.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,$W.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",$W.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",$W.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",$W.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return VW||(VW=new $W("logger/5.6.0")),VW}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",$W.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),QW){if(!t)return;this.globalLogger().throwError("error censorship permanent",$W.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}HW=!!t,QW=!!e}static setLogLevel(t){const e=GW[t.toLowerCase()];null!=e?ZW=e:$W.globalLogger().warn("invalid log level - "+t)}static from(t){return new $W(t)}}$W.errors=KW,$W.levels=JW;const tY=new $W("bytes/5.6.0");function eY(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return eY(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function nY(t){return"number"==typeof t&&t==t&&t%1==0}function rY(t,e){if(e||(e={}),"number"==typeof t){tY.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),eY(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0x0"+n.substring(2):"right"===e.hexPad?n+="0":tY.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;t<n.length;t+=2)r.push(parseInt(n.substring(t,t+2),16));return eY(new Uint8Array(r))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!nY(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const n=t[e];if(!nY(n)||n<0||n>=256)return!1}return!0}(t)?eY(new Uint8Array(t)):tY.throwArgumentError("invalid arrayify value","value",t)}function iY(t){return"0x"+YW.sha256().update(rY(t)).digest("hex")}new $W("sha2/5.6.0");class oY{constructor(t){Object.assign(this,t)}encode(){return f_.from(WE(aY,this))}static decode(t){return HE(aY,this,t)}static decodeUnchecked(t){return TE(aY,this,t)}}const aY=new Map;class sY extends oY{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=lE.decode(t);if(32!=e.length)throw new Error("Invalid public key input");this._bn=new eE(e)}else this._bn=new eE(t);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(t){return this._bn.eq(t._bn)}toBase58(){return lE.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const t=this._bn.toArrayLike(f_);if(32===t.length)return t;const e=f_.alloc(32);return t.copy(e,32-t.length),e}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=f_.concat([t.toBuffer(),f_.from(e),n.toBuffer()]),i=iY(new Uint8Array(r)).slice(2);return new sY(f_.from(i,"hex"))}static createProgramAddressSync(t,e){let n=f_.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=f_.concat([n,YU(t)])})),n=f_.concat([n,e.toBuffer(),f_.from("ProgramDerivedAddress")]);let r=iY(new Uint8Array(n)).slice(2),i=new eE(r,16).toArray(void 0,32);if(cY(i))throw new Error("Invalid seeds, address must fall off the curve");return new sY(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const i=t.concat(f_.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return 1==cY(new sY(t).toBytes())}}sY.default=new sY("11111111111111111111111111111111"),aY.set(sY,{kind:"struct",fields:[["_bn","u256"]]});let uY=oE.lowlevel;function cY(t){var e=[uY.gf(),uY.gf(),uY.gf(),uY.gf()],n=uY.gf(),r=uY.gf(),i=uY.gf(),o=uY.gf(),a=uY.gf(),s=uY.gf(),u=uY.gf();return uY.set25519(e[2],lY),uY.unpack25519(e[1],t),uY.S(i,e[1]),uY.M(o,i,uY.D),uY.Z(i,i,e[2]),uY.A(o,e[2],o),uY.S(a,o),uY.S(s,a),uY.M(u,s,a),uY.M(n,u,i),uY.M(n,n,o),uY.pow2523(n,n),uY.M(n,n,i),uY.M(n,n,o),uY.M(n,n,o),uY.M(e[0],n,o),uY.S(r,e[0]),uY.M(r,r,o),dY(r,i)&&uY.M(e[0],e[0],hY),uY.S(r,e[0]),uY.M(r,r,o),dY(r,i)?0:1}let lY=uY.gf([1]),hY=uY.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function dY(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return uY.pack25519(n,t),uY.pack25519(r,e),uY.crypto_verify_32(n,0,r,0)}const fY=new sY("BPFLoader1111111111111111111111111111111111"),pY=1232,mY=(t="publicKey")=>RN(32,t),gY=(t="string")=>{const e=zN([CN("length"),CN("lengthPadding"),RN(IN(CN(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=(t,e)=>n(t,e).chars.toString(),i.encode=(t,e,n)=>{const i={chars:f_.from(t,"utf8")};return r(i,e,n)},i.alloc=t=>CN().span+CN().span+f_.from(t,"utf8").length,i};function yY(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function bY(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}class vY{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new sY(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){return t<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||t>=this.header.numRequiredSignatures&&t<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((t,e)=>!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];bY(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(lE.decode(t.data));let i=[];bY(i,e.length);let o=[];return bY(o,r.length),{programIdIndex:n,keyIndicesCount:f_.from(i),keyIndices:e,dataLength:f_.from(o),data:r}}));let r=[];bY(r,n.length);let i=f_.alloc(pY);f_.from(r).copy(i);let o=r.length;n.forEach((t=>{const e=zN([kN("programIdIndex"),RN(t.keyIndicesCount.length,"keyIndicesCount"),PN(kN("keyIndex"),t.keyIndices.length,"keyIndices"),RN(t.dataLength.length,"dataLength"),PN(kN("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const a=zN([RN(1,"numRequiredSignatures"),RN(1,"numReadonlySignedAccounts"),RN(1,"numReadonlyUnsignedAccounts"),RN(e.length,"keyCount"),PN(mY("key"),t,"keys"),mY("recentBlockhash")]),s={numRequiredSignatures:f_.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:f_.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:f_.from([this.header.numReadonlyUnsignedAccounts]),keyCount:f_.from(e),keys:this.accountKeys.map((t=>YU(t.toBytes()))),recentBlockhash:lE.decode(this.recentBlockhash)};let u=f_.alloc(2048);const c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}static from(t){let e=[...t];const n=e.shift(),r=e.shift(),i=e.shift(),o=yY(e);let a=[];for(let t=0;t<o;t++){const t=e.slice(0,32);e=e.slice(32),a.push(lE.encode(f_.from(t)))}const s=e.slice(0,32);e=e.slice(32);const u=yY(e);let c=[];for(let t=0;t<u;t++){const t=e.shift(),n=yY(e),r=e.slice(0,n);e=e.slice(n);const i=yY(e),o=e.slice(0,i),a=lE.encode(f_.from(o));e=e.slice(i),c.push({programIdIndex:t,accounts:r,data:a})}const l={header:{numRequiredSignatures:n,numReadonlySignedAccounts:r,numReadonlyUnsignedAccounts:i},recentBlockhash:lE.encode(f_.from(s)),accountKeys:a,instructions:c};return new vY(l)}}function wY(t,e){if(!t)throw new Error(e||"Assertion failed")}let MY;!function(t){t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT"}(MY||(MY={}));const _Y=f_.alloc(64).fill(0);class EY{constructor(t){this.keys=void 0,this.programId=void 0,this.data=f_.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class NY{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new EY(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw new Error(`Transaction instruction index ${t} has undefined program id`);const r=[],i=[];e.forEach((t=>{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new sY(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58())}));const a=o.findIndex((t=>t.pubkey.equals(n)));if(a>-1){const[t]=o.splice(a,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let s=0,u=0,c=0;const l=[],h=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(l.push(t.toString()),s+=1,n||(u+=1)):(h.push(t.toString()),n||(c+=1))}));const d=l.concat(h),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:d.indexOf(n.toString()),accounts:t.keys.map((t=>d.indexOf(t.pubkey.toString()))),data:lE.encode(e)}}));return f.forEach((t=>{wY(t.programIdIndex>=0),t.accounts.forEach((t=>wY(t>=0)))})),new vY({header:{numRequiredSignatures:s,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:d,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length){if(this.signatures.every(((t,n)=>e[n].equals(t.publicKey))))return t}return this.signatures=e.map((t=>({signature:null,publicKey:t}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=oE.sign.detached(n,t.secretKey);this._addSignature(t.publicKey,YU(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){wY(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=f_.from(e)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(t,e){for(const{signature:n,publicKey:r}of this.signatures)if(null===n){if(e)return!1}else if(!oE.sign.detached.verify(t,n,r.toBuffer()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n&&!this._verifySignatures(r,e))throw new Error("Signature verification failed");return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];bY(n,e.length);const r=n.length+64*e.length+t.length,i=f_.alloc(r);return wY(e.length<256),f_.from(n).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&(wY(64===t.length,"signature has invalid length"),f_.from(t).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),wY(i.length<=pY,`Transaction too large: ${i.length} > 1232`),i}get keys(){return wY(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return wY(1===this.instructions.length),this.instructions[0].programId}get data(){return wY(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=yY(e);let r=[];for(let t=0;t<n;t++){const t=e.slice(0,64);e=e.slice(64),r.push(lE.encode(f_.from(t)))}return NY.populate(vY.from(e),r)}static populate(t,e=[]){const n=new NY;return n.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==lE.encode(_Y)?null:lE.decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new EY({keys:r,programId:t.accountKeys[e.programIdIndex],data:lE.decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}const LY=new sY("SysvarC1ock11111111111111111111111111111111"),SY=new sY("SysvarEpochSchedu1e111111111111111111111111"),AY=new sY("Sysvar1nstructions1111111111111111111111111"),xY=new sY("SysvarRecentB1ockHashes11111111111111111111"),TY=new sY("SysvarRent111111111111111111111111111111111"),IY=new sY("SysvarRewards111111111111111111111111111111"),kY=new sY("SysvarS1otHashes111111111111111111111111111"),jY=new sY("SysvarS1otHistory11111111111111111111111111"),CY=new sY("SysvarStakeHistory1111111111111111111111111");async function DY(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i),a=null!=e.recentBlockhash&&null!=e.lastValidBlockHeight?(await t.confirmTransaction({signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value:(await t.confirmTransaction(o,r&&r.commitment)).value;if(a.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(a)})`);return o}function OY(t){return new Promise((e=>setTimeout(e,t)))}function zY(t,e){const n=t.layout.span>=0?t.layout.span:function(t,e){let n=0;return t.layout.fields.forEach((t=>{t.span>=0?n+=t.span:"function"==typeof t.alloc&&(n+=t.alloc(e[t.property]))})),n}(t,e),r=f_.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function PY(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const RY=DN("lamportsPerSignature"),BY=zN([CN("version"),CN("state"),mY("authorizedPubkey"),mY("nonce"),zN([RY],"feeCalculator")]),UY=BY.span;class FY{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=BY.decode(YU(t),0);return new FY({authorizedPubkey:new sY(e.authorizedPubkey),nonce:new sY(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const WY=(YY=8,t=>{const e=RN(YY,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return UN(f_.from(n))},i.encode=(t,e,r)=>{const i=FN(t,YY);return n(i,e,r)},i});var YY;const QY=Object.freeze({Create:{index:0,layout:zN([CN("instruction"),ON("lamports"),ON("space"),mY("programId")])},Assign:{index:1,layout:zN([CN("instruction"),mY("programId")])},Transfer:{index:2,layout:zN([CN("instruction"),WY("lamports")])},CreateWithSeed:{index:3,layout:zN([CN("instruction"),mY("base"),gY("seed"),ON("lamports"),ON("space"),mY("programId")])},AdvanceNonceAccount:{index:4,layout:zN([CN("instruction")])},WithdrawNonceAccount:{index:5,layout:zN([CN("instruction"),ON("lamports")])},InitializeNonceAccount:{index:6,layout:zN([CN("instruction"),mY("authorized")])},AuthorizeNonceAccount:{index:7,layout:zN([CN("instruction"),mY("authorized")])},Allocate:{index:8,layout:zN([CN("instruction"),ON("space")])},AllocateWithSeed:{index:9,layout:zN([CN("instruction"),mY("base"),gY("seed"),ON("space"),mY("programId")])},AssignWithSeed:{index:10,layout:zN([CN("instruction"),mY("base"),gY("seed"),mY("programId")])},TransferWithSeed:{index:11,layout:zN([CN("instruction"),WY("lamports"),gY("seed"),mY("programId")])},UpgradeNonceAccount:{index:12,layout:zN([CN("instruction")])}});class HY{constructor(){}static createAccount(t){const e=zY(QY.Create,{lamports:t.lamports,space:t.space,programId:YU(t.programId.toBuffer())});return new EY({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;if("basePubkey"in t){e=zY(QY.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{e=zY(QY.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new EY({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;if("basePubkey"in t){e=zY(QY.AssignWithSeed,{base:YU(t.basePubkey.toBuffer()),seed:t.seed,programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=zY(QY.Assign,{programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new EY({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=zY(QY.CreateWithSeed,{base:YU(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:YU(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new EY({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new NY;"basePubkey"in t&&"seed"in t?e.add(HY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:UY,programId:this.programId})):e.add(HY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:UY,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=zY(QY.InitializeNonceAccount,{authorized:YU(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:xY,isSigner:!1,isWritable:!1},{pubkey:TY,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new EY(n)}static nonceAdvance(t){const e=zY(QY.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:xY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new EY(n)}static nonceWithdraw(t){const e=zY(QY.WithdrawNonceAccount,{lamports:t.lamports});return new EY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:xY,isSigner:!1,isWritable:!1},{pubkey:TY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=zY(QY.AuthorizeNonceAccount,{authorized:YU(t.newAuthorizedPubkey.toBuffer())});return new EY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;if("basePubkey"in t){e=zY(QY.AllocateWithSeed,{base:YU(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:YU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=zY(QY.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new EY({keys:n,programId:this.programId,data:e})}}HY.programId=new sY("11111111111111111111111111111111");class GY{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/GY.chunkSize)+1+1)}static async load(t,e,n,r,i){{const o=await t.getMinimumBalanceForRentExemption(i.length),a=await t.getAccountInfo(n.publicKey,"confirmed");let s=null;if(null!==a){if(a.executable)return console.error("Program load failed, account is already executable"),!1;a.data.length!==i.length&&(s=s||new NY,s.add(HY.allocate({accountPubkey:n.publicKey,space:i.length}))),a.owner.equals(r)||(s=s||new NY,s.add(HY.assign({accountPubkey:n.publicKey,programId:r}))),a.lamports<o&&(s=s||new NY,s.add(HY.transfer({fromPubkey:e.publicKey,toPubkey:n.publicKey,lamports:o-a.lamports})))}else s=(new NY).add(HY.createAccount({fromPubkey:e.publicKey,newAccountPubkey:n.publicKey,lamports:o>0?o:1,space:i.length,programId:r}));null!==s&&await DY(t,s,[e,n],{commitment:"confirmed"})}const o=zN([CN("instruction"),CN("offset"),CN("bytesLength"),CN("bytesLengthPadding"),PN(kN("byte"),IN(CN(),-8),"bytes")]),a=GY.chunkSize;let s=0,u=i,c=[];for(;u.length>0;){const i=u.slice(0,a),l=f_.alloc(a+16);o.encode({instruction:0,offset:s,bytes:i,bytesLength:0,bytesLengthPadding:0},l);const h=(new NY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(c.push(DY(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await OY(1e3/t)}s+=a,u=u.slice(a)}await Promise.all(c);{const i=zN([CN("instruction")]),o=f_.alloc(i.span);i.encode({instruction:1},o);const a=(new NY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:TY,isSigner:!1,isWritable:!1}],programId:r,data:o});await DY(t,a,[e,n],{commitment:"confirmed"})}return!0}}GY.chunkSize=932;const ZY=new sY("BPFLoader2111111111111111111111111111111111");const VY=Object.freeze({RequestUnits:{index:0,layout:zN([kN("instruction"),CN("units"),CN("additionalFee")])},RequestHeapFrame:{index:1,layout:zN([kN("instruction"),CN("bytes")])},SetComputeUnitLimit:{index:2,layout:zN([kN("instruction"),CN("units")])},SetComputeUnitPrice:{index:3,layout:zN([kN("instruction"),WY("microLamports")])}});class qY{constructor(){}static requestUnits(t){const e=zY(VY.RequestUnits,t);return new EY({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=zY(VY.RequestHeapFrame,t);return new EY({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=zY(VY.SetComputeUnitLimit,t);return new EY({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=zY(VY.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new EY({keys:[],programId:this.programId,data:e})}}qY.programId=new sY("ComputeBudget111111111111111111111111111111");var JY=Object.prototype.toString,KY=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function XY(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return XY(t.toJSON(),e);if("[object Array]"===(u=JY.call(t))){for(i="[",r=t.length-1,n=0;n<r;n++)i+=XY(t[n],!0)+",";return r>-1&&(i+=XY(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=KY(t).sort()).length,i="",n=0;n<r;)void 0!==(s=XY(t[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(t);case"function":case"undefined":return e?null:void 0;case"string":return JSON.stringify(t);default:return isFinite(t)?t:null}}var $Y=function(t){var e=XY(t,!1);if(void 0!==e)return""+e};function tQ(t){let e=0;for(;t>1;)t/=2,e++;return e}class eQ{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){const e=tQ(function(t){return 0===t?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-tQ(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t<this.firstNormalEpoch?Math.pow(2,t+tQ(32)):this.slotsPerEpoch}}class nQ extends Error{constructor(t,e){super(t),this.logs=void 0,this.logs=e}}class rQ extends Error{constructor({code:t,message:e,data:n},r){super(null!=r?`${r}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=n,this.name="SolanaJSONRPCError"}}var iQ=globalThis.fetch;class oQ extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(oQ.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class aQ extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}var sQ;Object.defineProperty(aQ.prototype,"name",{value:"TransactionExpiredTimeoutError"});const uQ=fL(nL(sY),uL(),(t=>new sY(t))),cQ=cL([uL(),rL("base64")]),lQ=fL(nL(f_),cQ,(t=>f_.from(t[0],"base64")));function hQ(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function dQ(t){return hL([lL({jsonrpc:rL("2.0"),id:uL(),result:t}),lL({jsonrpc:rL("2.0"),id:uL(),error:lL({code:dL(),message:uL(),data:aL($N("any",(()=>!0)))})})])}const fQ=dQ(dL());function pQ(t){return fL(dQ(t),fQ,(e=>"error"in e?e:{...e,result:JN(e.result,t)}))}function mQ(t){return pQ(lL({context:lL({slot:oL()}),value:t}))}function gQ(t){return lL({context:lL({slot:oL()}),value:t})}const yQ=lL({foundation:oL(),foundationTerm:oL(),initial:oL(),taper:oL(),terminal:oL()}),bQ=pQ(tL(iL(lL({epoch:oL(),effectiveSlot:oL(),amount:oL(),postBalance:oL()})))),vQ=lL({epoch:oL(),slotIndex:oL(),slotsInEpoch:oL(),absoluteSlot:oL(),blockHeight:aL(oL()),transactionCount:aL(oL())}),wQ=lL({slotsPerEpoch:oL(),leaderScheduleSlotOffset:oL(),warmup:eL(),firstNormalEpoch:oL(),firstNormalSlot:oL()}),MQ=sL(uL(),tL(oL())),_Q=iL(hL([lL({}),uL()])),EQ=lL({err:_Q}),NQ=rL("receivedSignature"),LQ=lL({"solana-core":uL(),"feature-set":aL(oL())}),SQ=mQ(lL({err:iL(hL([lL({}),uL()])),logs:iL(tL(uL())),accounts:aL(iL(tL(iL(lL({executable:eL(),owner:uL(),lamports:oL(),data:tL(uL()),rentEpoch:aL(oL())}))))),unitsConsumed:aL(oL())})),AQ=mQ(lL({byIdentity:sL(uL(),tL(oL())),range:lL({firstSlot:oL(),lastSlot:oL()})}));const xQ=pQ(yQ),TQ=pQ(vQ),IQ=pQ(wQ),kQ=pQ(MQ),jQ=pQ(oL()),CQ=mQ(lL({total:oL(),circulating:oL(),nonCirculating:oL(),nonCirculatingAccounts:tL(uQ)})),DQ=lL({amount:uL(),uiAmount:iL(oL()),decimals:oL(),uiAmountString:aL(uL())}),OQ=mQ(tL(lL({address:uQ,amount:uL(),uiAmount:iL(oL()),decimals:oL(),uiAmountString:aL(uL())}))),zQ=mQ(tL(lL({pubkey:uQ,account:lL({executable:eL(),owner:uQ,lamports:oL(),data:lQ,rentEpoch:oL()})}))),PQ=lL({program:uL(),parsed:dL(),space:oL()}),RQ=mQ(tL(lL({pubkey:uQ,account:lL({executable:eL(),owner:uQ,lamports:oL(),data:PQ,rentEpoch:oL()})}))),BQ=mQ(tL(lL({lamports:oL(),address:uQ}))),UQ=lL({executable:eL(),owner:uQ,lamports:oL(),data:lQ,rentEpoch:oL()}),FQ=lL({pubkey:uQ,account:UQ}),WQ=fL(hL([nL(f_),PQ]),hL([cQ,PQ]),(t=>Array.isArray(t)?JN(t,lQ):t)),YQ=lL({executable:eL(),owner:uQ,lamports:oL(),data:WQ,rentEpoch:oL()}),QQ=lL({pubkey:uQ,account:YQ}),HQ=lL({state:hL([rL("active"),rL("inactive"),rL("activating"),rL("deactivating")]),active:oL(),inactive:oL()}),GQ=pQ(tL(lL({signature:uL(),slot:oL(),err:_Q,memo:iL(uL()),blockTime:aL(iL(oL()))}))),ZQ=pQ(tL(lL({signature:uL(),slot:oL(),err:_Q,memo:iL(uL()),blockTime:aL(iL(oL()))}))),VQ=lL({subscription:oL(),result:gQ(UQ)}),qQ=lL({pubkey:uQ,account:UQ}),JQ=lL({subscription:oL(),result:gQ(qQ)}),KQ=lL({parent:oL(),slot:oL(),root:oL()}),XQ=lL({subscription:oL(),result:KQ}),$Q=hL([lL({type:hL([rL("firstShredReceived"),rL("completed"),rL("optimisticConfirmation"),rL("root")]),slot:oL(),timestamp:oL()}),lL({type:rL("createdBank"),parent:oL(),slot:oL(),timestamp:oL()}),lL({type:rL("frozen"),slot:oL(),timestamp:oL(),stats:lL({numTransactionEntries:oL(),numSuccessfulTransactions:oL(),numFailedTransactions:oL(),maxTransactionsPerEntry:oL()})}),lL({type:rL("dead"),slot:oL(),timestamp:oL(),err:uL()})]),tH=lL({subscription:oL(),result:$Q}),eH=lL({subscription:oL(),result:gQ(hL([EQ,NQ]))}),nH=lL({subscription:oL(),result:oL()}),rH=lL({pubkey:uL(),gossip:iL(uL()),tpu:iL(uL()),rpc:iL(uL()),version:iL(uL())}),iH=lL({votePubkey:uL(),nodePubkey:uL(),activatedStake:oL(),epochVoteAccount:eL(),epochCredits:tL(cL([oL(),oL(),oL()])),commission:oL(),lastVote:oL(),rootSlot:iL(oL())}),oH=pQ(lL({current:tL(iH),delinquent:tL(iH)})),aH=hL([rL("processed"),rL("confirmed"),rL("finalized")]),sH=lL({slot:oL(),confirmations:iL(oL()),err:_Q,confirmationStatus:aL(aH)}),uH=mQ(tL(iL(sH))),cH=pQ(oL()),lH=lL({signatures:tL(uL()),message:lL({accountKeys:tL(uL()),header:lL({numRequiredSignatures:oL(),numReadonlySignedAccounts:oL(),numReadonlyUnsignedAccounts:oL()}),instructions:tL(lL({accounts:tL(oL()),data:uL(),programIdIndex:oL()})),recentBlockhash:uL()})}),hH=lL({parsed:dL(),program:uL(),programId:uQ}),dH=lL({accounts:tL(uQ),data:uL(),programId:uQ}),fH=fL(hL([dH,hH]),hL([lL({parsed:dL(),program:uL(),programId:uL()}),lL({accounts:tL(uL()),data:uL(),programId:uL()})]),(t=>JN(t,"accounts"in t?dH:hH))),pH=lL({signatures:tL(uL()),message:lL({accountKeys:tL(lL({pubkey:uQ,signer:eL(),writable:eL()})),instructions:tL(fH),recentBlockhash:uL()})}),mH=lL({accountIndex:oL(),mint:uL(),owner:aL(uL()),uiTokenAmount:DQ}),gH=lL({err:_Q,fee:oL(),innerInstructions:aL(iL(tL(lL({index:oL(),instructions:tL(lL({accounts:tL(oL()),data:uL(),programIdIndex:oL()}))})))),preBalances:tL(oL()),postBalances:tL(oL()),logMessages:aL(iL(tL(uL()))),preTokenBalances:aL(iL(tL(mH))),postTokenBalances:aL(iL(tL(mH)))}),yH=lL({err:_Q,fee:oL(),innerInstructions:aL(iL(tL(lL({index:oL(),instructions:tL(fH)})))),preBalances:tL(oL()),postBalances:tL(oL()),logMessages:aL(iL(tL(uL()))),preTokenBalances:aL(iL(tL(mH))),postTokenBalances:aL(iL(tL(mH)))}),bH=pQ(iL(lL({blockhash:uL(),previousBlockhash:uL(),parentSlot:oL(),transactions:tL(lL({transaction:lH,meta:iL(gH)})),rewards:aL(tL(lL({pubkey:uL(),lamports:oL(),postBalance:iL(oL()),rewardType:iL(uL())}))),blockTime:iL(oL()),blockHeight:iL(oL())}))),vH=pQ(iL(lL({blockhash:uL(),previousBlockhash:uL(),parentSlot:oL(),transactions:tL(lL({transaction:lH,meta:iL(gH)})),rewards:aL(tL(lL({pubkey:uL(),lamports:oL(),postBalance:iL(oL()),rewardType:iL(uL())}))),blockTime:iL(oL())}))),wH=pQ(iL(lL({blockhash:uL(),previousBlockhash:uL(),parentSlot:oL(),signatures:tL(uL()),blockTime:iL(oL())}))),MH=pQ(iL(lL({slot:oL(),meta:gH,blockTime:aL(iL(oL())),transaction:lH}))),_H=pQ(iL(lL({slot:oL(),transaction:pH,meta:iL(yH),blockTime:aL(iL(oL()))}))),EH=mQ(lL({blockhash:uL(),feeCalculator:lL({lamportsPerSignature:oL()})})),NH=mQ(lL({blockhash:uL(),lastValidBlockHeight:oL()})),LH=pQ(tL(lL({slot:oL(),numTransactions:oL(),numSlots:oL(),samplePeriodSecs:oL()}))),SH=mQ(iL(lL({feeCalculator:lL({lamportsPerSignature:oL()})}))),AH=pQ(uL()),xH=pQ(uL()),TH=lL({err:_Q,logs:tL(uL()),signature:uL()}),IH=lL({result:gQ(TH),subscription:oL()}),kH={"solana-client":`js/${null!==(sQ="0.0.0-development")?sQ:"UNKNOWN"}`};class jH{constructor(t,e){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set;let n=new URL(t);n.protocol;let r,i,o,a,s;e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,r=e.wsEndpoint,i=e.httpHeaders,o=e.fetch,a=e.fetchMiddleware,s=e.disableRetryOnRateLimit),this._rpcEndpoint=t,this._rpcWsEndpoint=r||function(t){let e=new URL(t);const n="https:"===e.protocol;return e.protocol=n?"wss:":"ws:",e.host="",""!==e.port&&(e.port=String(Number(e.port)+1)),e.toString()}(t),this._rpcClient=function(t,e,n,r,i,o){const a=r||iQ;let s;i&&(s=async(t,e)=>{const n=await new Promise(((n,r)=>{try{i(t,e,((t,e)=>n([t,e])))}catch(t){r(t)}}));return await a(...n)});const u=new Iz((async(e,r)=>{const i={method:"POST",body:e,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},n||{},kH)};try{let e,n=5,u=500;for(;e=s?await s(t,i):await a(t,i),429===e.status&&!0!==o&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await OY(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{});return u}(n.toString(),0,i,o,a,s),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new pL.Client(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=hQ(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=JN(await this._rpcRequest("getBalance",i),mQ(oL()));if("error"in o)throw new rQ(o.error,`failed to get balance for ${t.toBase58()}`);return o.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=JN(await this._rpcRequest("getBlockTime",[t]),pQ(iL(oL())));if("error"in e)throw new rQ(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){const t=JN(await this._rpcRequest("minimumLedgerSlot",[]),pQ(oL()));if("error"in t)throw new rQ(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const t=JN(await this._rpcRequest("getFirstAvailableBlock",[]),jQ);if("error"in t)throw new rQ(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=JN(await this._rpcRequest("getSupply",[e]),CQ);if("error"in n)throw new rQ(n.error,"failed to get supply");return n.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=JN(await this._rpcRequest("getTokenSupply",n),mQ(DQ));if("error"in r)throw new rQ(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=JN(await this._rpcRequest("getTokenAccountBalance",n),mQ(DQ));if("error"in r)throw new rQ(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=hQ(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const a=this._buildArgs(o,r,"base64",i),s=JN(await this._rpcRequest("getTokenAccountsByOwner",a),zQ);if("error"in s)throw new rQ(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=JN(await this._rpcRequest("getTokenAccountsByOwner",i),RQ);if("error"in o)throw new rQ(o.error,`failed to get token accounts owned by account ${t.toBase58()}`);return o.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=JN(await this._rpcRequest("getLargestAccounts",n),BQ);if("error"in r)throw new rQ(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=JN(await this._rpcRequest("getTokenLargestAccounts",n),OQ);if("error"in r)throw new rQ(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=hQ(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=JN(await this._rpcRequest("getAccountInfo",i),mQ(iL(UQ)));if("error"in o)throw new rQ(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getParsedAccountInfo(t,e){const n=this._buildArgs([t.toBase58()],e,"jsonParsed"),r=JN(await this._rpcRequest("getAccountInfo",n),mQ(iL(YQ)));if("error"in r)throw new rQ(r.error,`failed to get info about account ${t.toBase58()}`);return r.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=hQ(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),a=JN(await this._rpcRequest("getMultipleAccounts",o),mQ(tL(iL(UQ))));if("error"in a)throw new rQ(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=hQ(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:null==i?void 0:i.epoch}),a=JN(await this._rpcRequest("getStakeActivation",o),pQ(HQ));if("error"in a)throw new rQ(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=hQ(e),{encoding:i,...o}=r||{},a=this._buildArgs([t.toBase58()],n,i||"base64",o),s=JN(await this._rpcRequest("getProgramAccounts",a),pQ(tL(FQ)));if("error"in s)throw new rQ(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=hQ(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=JN(await this._rpcRequest("getProgramAccounts",i),pQ(tL(QQ)));if("error"in o)throw new rQ(o.error,`failed to get accounts owned by program ${t.toBase58()}`);return o.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{n=t.signature}try{r=lE.decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}wY(64===r.length,"signature has invalid length");const i=e||this.commitment;let o,a,s=!1;const u=new Promise(((t,e)=>{try{a=this.onSignature(n,((e,n)=>{a=void 0;const r={context:n,value:e};s=!0,t({__type:MY.PROCESSED,response:r})}),i)}catch(t){e(t)}})),c=new Promise((n=>{if("string"==typeof t){let t=this._confirmTransactionInitialTimeout||6e4;switch(i){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=this._confirmTransactionInitialTimeout||3e4}o=setTimeout((()=>n({__type:MY.TIMED_OUT,timeoutMs:t})),t)}else{let r=t;const i=async()=>{try{return await this.getBlockHeight(e)}catch(t){return-1}};(async()=>{let t=await i();if(!s){for(;t<=r.lastValidBlockHeight;){if(await OY(1e3),s)return;if(t=await i(),s)return}n({__type:MY.BLOCKHEIGHT_EXCEEDED})}})()}}));let l;try{const t=await Promise.race([u,c]);switch(t.__type){case MY.BLOCKHEIGHT_EXCEEDED:throw new oQ(n);case MY.PROCESSED:l=t.response;break;case MY.TIMED_OUT:throw new aQ(n,t.timeoutMs/1e3)}}finally{clearTimeout(o),a&&this.removeSignatureListener(a)}return l}async getClusterNodes(){const t=JN(await this._rpcRequest("getClusterNodes",[]),pQ(tL(rH)));if("error"in t)throw new rQ(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=JN(await this._rpcRequest("getVoteAccounts",e),oH);if("error"in n)throw new rQ(n.error,"failed to get vote accounts");return n.result}async getSlot(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getSlot",r),pQ(oL()));if("error"in i)throw new rQ(i.error,"failed to get slot");return i.result}async getSlotLeader(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getSlotLeader",r),pQ(uL()));if("error"in i)throw new rQ(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(t,e){const n=[t,e],r=JN(await this._rpcRequest("getSlotLeaders",n),pQ(tL(uQ)));if("error"in r)throw new rQ(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);wY(1===r.length);return{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=JN(await this._rpcRequest("getSignatureStatuses",n),uH);if("error"in r)throw new rQ(r.error,"failed to get signature status");return r.result}async getTransactionCount(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getTransactionCount",r),pQ(oL()));if("error"in i)throw new rQ(i.error,"failed to get transaction count");return i.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=JN(await this._rpcRequest("getInflationGovernor",e),xQ);if("error"in n)throw new rQ(n.error,"failed to get inflation");return n.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=hQ(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:null==i?void 0:i.epoch}),a=JN(await this._rpcRequest("getInflationReward",o),bQ);if("error"in a)throw new rQ(a.error,"failed to get inflation reward");return a.result}async getEpochInfo(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getEpochInfo",r),TQ);if("error"in i)throw new rQ(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const t=JN(await this._rpcRequest("getEpochSchedule",[]),IQ);if("error"in t)throw new rQ(t.error,"failed to get epoch schedule");const e=t.result;return new eQ(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){const t=JN(await this._rpcRequest("getLeaderSchedule",[]),kQ);if("error"in t)throw new rQ(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=JN(await this._rpcRequest("getMinimumBalanceForRentExemption",n),cH);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=JN(await this._rpcRequest("getRecentBlockhash",e),EH);if("error"in n)throw new rQ(n.error,"failed to get recent blockhash");return n.result}async getRecentPerformanceSamples(t){const e=JN(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),LH);if("error"in e)throw new rQ(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=JN(await this._rpcRequest("getFeeCalculatorForBlockhash",n),SH);if("error"in r)throw new rQ(r.error,"failed to get fee calculator");const{context:i,value:o}=r.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(t,e){const n=t.serialize().toString("base64"),r=this._buildArgs([n],e),i=JN(await this._rpcRequest("getFeeForMessage",r),mQ(iL(oL())));if("error"in i)throw new rQ(i.error,"failed to get slot");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getLatestBlockhash",r),NH);if("error"in i)throw new rQ(i.error,"failed to get latest blockhash");return i.result}async getVersion(){const t=JN(await this._rpcRequest("getVersion",[]),pQ(LQ));if("error"in t)throw new rQ(t.error,"failed to get version");return t.result}async getGenesisHash(){const t=JN(await this._rpcRequest("getGenesisHash",[]),pQ(uL()));if("error"in t)throw new rQ(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=JN(await this._rpcRequest("getBlock",n),bH);if("error"in r)throw new rQ(r.error,"failed to get confirmed block");const i=r.result;return i?{...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new vY(t.message);return{meta:e,transaction:{...t,message:n}}}))}:i}async getBlockHeight(t){const{commitment:e,config:n}=hQ(t),r=this._buildArgs([],e,void 0,n),i=JN(await this._rpcRequest("getBlockHeight",r),pQ(oL()));if("error"in i)throw new rQ(i.error,"failed to get block height information");return i.result}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=JN(await this._rpcRequest("getBlockProduction",r),AQ);if("error"in i)throw new rQ(i.error,"failed to get block production information");return i.result}async getTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=JN(await this._rpcRequest("getTransaction",n),MH);if("error"in r)throw new rQ(r.error,"failed to get transaction");const i=r.result;return i?{...i,transaction:{...i.transaction,message:new vY(i.transaction.message)}}:i}async getParsedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=JN(await this._rpcRequest("getTransaction",n),_H);if("error"in r)throw new rQ(r.error,"failed to get transaction");return r.result}async getParsedTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=JN(t,_H);if("error"in e)throw new rQ(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e)})));return(await this._rpcBatchRequest(n)).map((t=>{const e=JN(t,MH);if("error"in e)throw new rQ(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:new vY(n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=JN(await this._rpcRequest("getConfirmedBlock",n),vH);if("error"in r)throw new rQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");const o={...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new vY(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...o,transactions:o.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:NY.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=JN(await this._rpcRequest("getBlocks",r),pQ(tL(oL())));if("error"in i)throw new rQ(i.error,"failed to get blocks");return i.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=JN(await this._rpcRequest("getBlock",n),wH);if("error"in r)throw new rQ(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+t+" not found");return i}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=JN(await this._rpcRequest("getConfirmedBlock",n),wH);if("error"in r)throw new rQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");return i}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=JN(await this._rpcRequest("getConfirmedTransaction",n),MH);if("error"in r)throw new rQ(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new vY(i.transaction.message),a=i.transaction.signatures;return{...i,transaction:NY.populate(o,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=JN(await this._rpcRequest("getConfirmedTransaction",n),_H);if("error"in r)throw new rQ(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=JN(t,_H);if("error"in e)throw new rQ(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e<i);)try{const t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=JN(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),GQ);if("error"in i)throw new rQ(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=JN(await this._rpcRequest("getSignaturesForAddress",r),ZQ);if("error"in i)throw new rQ(i.error,"failed to get signatures for address");return i.result}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=FY.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=JN(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),AH);if("error"in n)throw new rQ(n.error,`airdrop to ${t.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await OY(100);const t=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await OY(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(t,e,n){let r;if(t instanceof NY){let e=t;r=new NY,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=NY.populate(t),r._message=r._json=void 0;if(r.nonceInfo&&e)r.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=n.lastValidBlockHeight,r.recentBlockhash=n.blockhash,!e)break;if(r.sign(...e),!r.signature)throw new Error("!signature");const i=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(i)&&!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.simulatedSignatures.push(i);break}t=!0}}const i=r._compile(),o=i.serialize(),a=r._serialize(o).toString("base64"),s={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:i.nonProgramIds()).map((t=>t.toBase58()));s.accounts={encoding:"base64",addresses:t}}e&&(s.sigVerify=!0);const u=[a,s],c=JN(await this._rpcRequest("simulateTransaction",u),SQ);if("error"in c){let t;if("data"in c.error&&(t=c.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(c.error.message,n)}throw new nQ("failed to simulate transaction: "+c.error.message,t)}return c.result}async sendTransaction(t,e,n){if(t.nonceInfo)t.sign(...e);else{let n=this._disableBlockhashCaching;for(;;){const r=await this._blockhashWithExpiryBlockHeight(n);if(t.lastValidBlockHeight=r.lastValidBlockHeight,t.recentBlockhash=r.blockhash,t.sign(...e),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}n=!0}}const r=t.serialize();return await this.sendRawTransaction(r,n)}async sendRawTransaction(t,e){const n=YU(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],a=JN(await this._rpcRequest("sendTransaction",o),xH);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new nQ("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{this._rpcWebSocket.notify("ping").catch((()=>{}))}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration++,this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._subscriptionsByHash[t]={...e,state:"pending"}}))):this._updateSubscriptions()}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._subscriptionsByHash[t]={...n,state:"subscribing"};const e=await this._rpcWebSocket.call(i,r);this._subscriptionsByHash[t]={...n,serverSubscriptionId:e,state:"subscribed"},this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._subscriptionsByHash[t]={...n,state:"pending"},await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._subscriptionsByHash[t]={...n,state:"unsubscribing"};try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._subscriptionsByHash[t]={...n,state:"subscribed"},void await this._updateSubscriptions()}}this._subscriptionsByHash[t]={...n,state:"unsubscribed"},await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=JN(t,VQ);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=$Y([t.method,e]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];wY(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=JN(t,JQ);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=JN(t,IH);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=JN(t,XQ);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=JN(t,tH);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=JN(t,eH);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),a=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(a)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return a}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=JN(t,nH);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class CH{constructor(t){this._keypair=void 0,this._keypair=t||oE.sign.keyPair()}static generate(){return new CH(oE.sign.keyPair())}static fromSecretKey(t,e){const n=oE.sign.keyPair.fromSecretKey(t);if(!e||!e.skipValidation){const t=(new TextEncoder).encode("@solana/web3.js-validation-v1"),e=oE.sign.detached(t,n.secretKey);if(!oE.sign.detached.verify(t,e,n.publicKey))throw new Error("provided secretKey is invalid")}return new CH(n)}static fromSeed(t){return new CH(oE.sign.keyPair.fromSeed(t))}get publicKey(){return new sY(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const DH=zN([kN("numSignatures"),kN("padding"),jN("signatureOffset"),jN("signatureInstructionIndex"),jN("publicKeyOffset"),jN("publicKeyInstructionIndex"),jN("messageDataOffset"),jN("messageDataSize"),jN("messageInstructionIndex")]);class OH{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:i}=t;wY(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),wY(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const o=DH.span,a=o+e.length,s=a+r.length,u=f_.alloc(s+n.length),c=null==i?65535:i;return DH.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:c,publicKeyOffset:o,publicKeyInstructionIndex:c,messageDataOffset:s,messageDataSize:n.length,messageInstructionIndex:c},u),u.fill(e,o),u.fill(r,a),u.fill(n,s),new EY({keys:[],programId:OH.programId,data:u})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;wY(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=CH.fromSecretKey(e),i=t.publicKey.toBytes(),o=oE.sign.detached(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}OH.programId=new sY("Ed25519SigVerify111111111111111111111111111");const zH=new sY("StakeConfig11111111111111111111111111111111");class PH{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class RH{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}RH.default=new RH(0,0,sY.default);const BH=Object.freeze({Initialize:{index:0,layout:zN([CN("instruction"),((t="authorized")=>zN([mY("staker"),mY("withdrawer")],t))(),((t="lockup")=>zN([ON("unixTimestamp"),ON("epoch"),mY("custodian")],t))()])},Authorize:{index:1,layout:zN([CN("instruction"),mY("newAuthorized"),CN("stakeAuthorizationType")])},Delegate:{index:2,layout:zN([CN("instruction")])},Split:{index:3,layout:zN([CN("instruction"),ON("lamports")])},Withdraw:{index:4,layout:zN([CN("instruction"),ON("lamports")])},Deactivate:{index:5,layout:zN([CN("instruction")])},Merge:{index:7,layout:zN([CN("instruction")])},AuthorizeWithSeed:{index:8,layout:zN([CN("instruction"),mY("newAuthorized"),CN("stakeAuthorizationType"),gY("authoritySeed"),mY("authorityOwner")])}}),UH=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class FH{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||RH.default,o=zY(BH.Initialize,{authorized:{staker:YU(n.staker.toBuffer()),withdrawer:YU(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:YU(i.custodian.toBuffer())}}),a={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:TY,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new EY(a)}static createAccountWithSeed(t){const e=new NY;e.add(HY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new NY;e.add(HY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=zY(BH.Delegate);return(new NY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:CY,isSigner:!1,isWritable:!1},{pubkey:zH,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,a=zY(BH.Authorize,{newAuthorized:YU(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new NY).add({keys:s,programId:this.programId,data:a})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:a,custodianPubkey:s}=t,u=zY(BH.AuthorizeWithSeed,{newAuthorized:YU(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:YU(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:LY,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new NY).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=zY(BH.Split,{lamports:i});return new EY({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new NY;return e.add(HY.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:a}=t,s=new NY;return s.add(HY.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=zY(BH.Merge);return(new NY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:CY,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,a=zY(BH.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:CY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new NY).add({keys:s,programId:this.programId,data:a})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=zY(BH.Deactivate);return(new NY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}FH.programId=new sY("Stake11111111111111111111111111111111111111"),FH.space=200;const{publicKeyCreate:WH,ecdsaSign:YH}=UU,QH=zN([kN("numSignatures"),jN("signatureOffset"),kN("signatureInstructionIndex"),jN("ethAddressOffset"),kN("ethAddressInstructionIndex"),jN("messageDataOffset"),jN("messageDataSize"),kN("messageInstructionIndex"),RN(20,"ethAddress"),RN(64,"signature"),kN("recoveryId")]);class HH{constructor(){}static publicKeyToEthAddress(t){wY(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return f_.from(WU.keccak_256.update(YU(t)).digest()).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return HH.createInstructionWithEthAddress({ethAddress:HH.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?f_.from(e.substr(2),"hex"):f_.from(e,"hex"):e,wY(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const s=12+a.length,u=s+r.length+1,c=f_.alloc(QH.span+n.length);return QH.encode({numSignatures:1,signatureOffset:s,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:o,signature:YU(r),ethAddress:YU(a),recoveryId:i},c),c.fill(YU(n),QH.span),new EY({keys:[],programId:HH.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;wY(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=YU(e),i=WH(t,!1).slice(1),o=f_.from(WU.keccak_256.update(YU(n)).digest()),{signature:a,recid:s}=YH(o,t);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:a,recoveryId:s,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}HH.programId=new sY("KeccakSecp256k11111111111111111111111111111");const GH=new sY("Va1idator1nfo111111111111111111111111111111"),ZH=lL({name:uL(),website:aL(uL()),details:aL(uL()),keybaseUsername:aL(uL())});class VH{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==yY(e))return null;const n=[];for(let t=0;t<2;t++){const t=new sY(e.slice(0,32));e=e.slice(32);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(GH)&&n[1].isSigner){const t=gY().decode(f_.from(e)),r=JSON.parse(t);return qN(r,ZH),new VH(n[1].publicKey,r)}return null}}const qH=new sY("Vote111111111111111111111111111111111111111"),JH=zN([mY("nodePubkey"),mY("authorizedWithdrawer"),kN("commission"),DN(),PN(zN([DN("slot"),CN("confirmationCount")]),IN(CN(),-8),"votes"),kN("rootSlotValid"),DN("rootSlot"),DN(),PN(zN([DN("epoch"),mY("authorizedVoter")]),IN(CN(),-8),"authorizedVoters"),zN([PN(zN([mY("authorizedPubkey"),DN("epochOfLastAuthorizedSwitch"),DN("targetEpoch")]),32,"buf"),DN("idx"),kN("isEmpty")],"priorVoters"),DN(),PN(zN([DN("epoch"),DN("credits"),DN("prevCredits")]),IN(CN(),-8),"epochCredits"),zN([DN("slot"),DN("timestamp")],"lastTimestamp")]);class KH{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=JH.decode(YU(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new KH({nodePubkey:new sY(e.nodePubkey),authorizedWithdrawer:new sY(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(XH),priorVoters:tG(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function XH({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new sY(t)}}function $H({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new sY(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function tG({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map($H),...t.slice(0,e).map($H)]}class eG{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}const nG=Object.freeze({InitializeAccount:{index:0,layout:zN([CN("instruction"),((t="voteInit")=>zN([mY("nodePubkey"),mY("authorizedVoter"),mY("authorizedWithdrawer"),kN("commission")],t))()])},Authorize:{index:1,layout:zN([CN("instruction"),mY("newAuthorized"),CN("voteAuthorizationType")])},Withdraw:{index:3,layout:zN([CN("instruction"),ON("lamports")])}}),rG=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class iG{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=zY(nG.InitializeAccount,{voteInit:{nodePubkey:YU(r.nodePubkey.toBuffer()),authorizedVoter:YU(r.authorizedVoter.toBuffer()),authorizedWithdrawer:YU(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:TY,isSigner:!1,isWritable:!1},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new EY(o)}static createAccount(t){const e=new NY;return e.add(HY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=zY(nG.Authorize,{newAuthorized:YU(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:LY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new NY).add({keys:a,programId:this.programId,data:o})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=zY(nG.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new NY).add({keys:a,programId:this.programId,data:o})}}iG.programId=new sY("Vote111111111111111111111111111111111111111"),iG.space=3731;const oG={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};var aG=Object.freeze({__proto__:null,Account:class{constructor(t){this._keypair=void 0,this._keypair=t?oE.sign.keyPair.fromSecretKey(YU(t)):oE.sign.keyPair()}get publicKey(){return new sY(this._keypair.publicKey)}get secretKey(){return YU(this._keypair.secretKey)}},Authorized:PH,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:fY,BPF_LOADER_PROGRAM_ID:ZY,BpfLoader:class{static getMinNumSignatures(t){return GY.getMinNumSignatures(t)}static load(t,e,n,r,i){return GY.load(t,e,n,i,r)}},COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:VY,ComputeBudgetInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=kN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(VY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=PY(VY.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=PY(VY.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=PY(VY.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=PY(VY.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(qY.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}},ComputeBudgetProgram:qY,Connection:jH,Ed25519Program:OH,Enum:class extends oY{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}},EpochSchedule:eQ,FeeCalculatorLayout:RY,Keypair:CH,LAMPORTS_PER_SOL:1e9,Loader:GY,Lockup:RH,MAX_SEED_LENGTH:32,Message:vY,NONCE_ACCOUNT_LENGTH:UY,NonceAccount:FY,PACKET_DATA_SIZE:pY,PublicKey:sY,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:aY,STAKE_CONFIG_ID:zH,STAKE_INSTRUCTION_LAYOUTS:BH,SYSTEM_INSTRUCTION_LAYOUTS:QY,SYSVAR_CLOCK_PUBKEY:LY,SYSVAR_EPOCH_SCHEDULE_PUBKEY:SY,SYSVAR_INSTRUCTIONS_PUBKEY:AY,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:xY,SYSVAR_RENT_PUBKEY:TY,SYSVAR_REWARDS_PUBKEY:IY,SYSVAR_SLOT_HASHES_PUBKEY:kY,SYSVAR_SLOT_HISTORY_PUBKEY:jY,SYSVAR_STAKE_HISTORY_PUBKEY:CY,Secp256k1Program:HH,SendTransactionError:nQ,SolanaJSONRPCError:rQ,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:UH,StakeInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=CN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(BH))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=PY(BH.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new PH(new sY(e.staker),new sY(e.withdrawer)),lockup:new RH(n.unixTimestamp,n.epoch,new sY(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),PY(BH.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=PY(BH.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new sY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=PY(BH.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new sY(i),newAuthorizedPubkey:new sY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=PY(BH.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),PY(BH.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=PY(BH.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),PY(BH.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(FH.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},StakeProgram:FH,Struct:oY,SystemInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=CN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(QY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=PY(QY.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new sY(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=PY(QY.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=PY(QY.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new sY(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=PY(QY.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=PY(QY.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new sY(e),seed:n,space:r,programId:new sY(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=PY(QY.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new sY(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=PY(QY.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new sY(e),seed:n,programId:new sY(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=PY(QY.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new sY(e),seed:n,lamports:r,space:i,programId:new sY(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=PY(QY.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new sY(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),PY(QY.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=PY(QY.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=PY(QY.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new sY(e)}}static checkProgramId(t){if(!t.equals(HY.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},SystemProgram:HY,Transaction:NY,TransactionExpiredBlockheightExceededError:oQ,TransactionExpiredTimeoutError:aQ,TransactionInstruction:EY,get TransactionStatus(){return MY},VALIDATOR_INFO_KEY:GH,VOTE_PROGRAM_ID:qH,ValidatorInfo:VH,VoteAccount:KH,VoteAuthorizationLayout:rG,VoteInit:eG,VoteInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=CN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(nG))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=PY(nG.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new eG(new sY(e.nodePubkey),new sY(e.authorizedVoter),new sY(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=PY(nG.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new sY(e),voteAuthorizationType:{index:n}}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=PY(nG.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(iG.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},VoteProgram:iG,clusterApiUrl:function(t,e){const n=!1===e?"http":"https";if(!t)return oG[n].devnet;const r=oG[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r},sendAndConfirmRawTransaction:async function(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")?(i=n,o=r):o=n;const a=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},s=await t.sendRawTransaction(e,a),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(s,u),l=(await c).value;if(l.err)throw new Error(`Raw transaction ${s} failed (${JSON.stringify(l)})`);return s},sendAndConfirmTransaction:DY}),sG={};class uG{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function cG(t,e){return e.property?t+"["+e.property+"]":t}sG.Layout=uG,sG.nameWithProperty=cG,sG.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof uG))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class lG extends uG{isCount(){throw new Error("ExternalLayout is abstract")}}class hG extends lG{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class dG extends lG{constructor(t,e,n){if(!(t instanceof uG))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof fG||this.layout instanceof pG}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class fG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}class pG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}class mG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}class gG extends uG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}const yG=Math.pow(2,32);function bG(t){const e=Math.floor(t/yG);return{hi32:e,lo32:t-e*yG}}function vG(t,e){return t*yG+e}class wG extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return vG(t.readUInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}class MG extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return vG(t.readUInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class _G extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return vG(t.readInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}class EG extends uG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return vG(t.readInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=bG(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class NG extends uG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}class LG extends uG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}class SG extends uG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}class AG extends uG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}class xG extends uG{constructor(t,e,n){if(!(t instanceof uG))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof lG&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(e instanceof lG)&&0<t.span&&(r=e*t.span),super(r,n),this.elementLayout=t,this.count=e}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0,r=this.count;if(r instanceof lG&&(r=r.decode(t,e)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let i=0;for(;i<r;)n+=this.elementLayout.getSpan(t,e+n),++i}return n}decode(t,e){void 0===e&&(e=0);const n=[];let r=0,i=this.count;for(i instanceof lG&&(i=i.decode(t,e));r<i;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),r+=1;return n}encode(t,e,n){void 0===n&&(n=0);const r=this.elementLayout,i=t.reduce(((t,i)=>t+r.encode(i,e,n+t)),0);return this.count instanceof lG&&this.count.encode(t.length,e,n),i}}class TG extends uG{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof uG),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let a=r.span;if(o=0<a?a:0,void 0!==r.property){const i=t[r.property];void 0!==i&&(o=r.encode(i,e,n),0>a&&(a=r.getSpan(e,n)))}i=n,n+=a}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<t.length&&(e[n.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}}class IG{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class kG extends IG{constructor(t,e){if(!(t instanceof lG&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class jG extends uG{constructor(t,e,n){const r=t instanceof fG||t instanceof pG;if(r)t=new kG(new dG(t));else if(t instanceof lG&&t.isCount())t=new kG(t);else if(!(t instanceof IG))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof uG))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new CG(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return f_.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class CG extends uG{constructor(t,e,n,r){if(!(t instanceof jG))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof uG))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function DG(t){return 0>t&&(t+=4294967296),t}class OG extends uG{constructor(t,e,n){if(!(t instanceof fG||t instanceof pG))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,n),this.word=t,this.msb=!!e,this.fields=[];let r=0;this._packedSetValue=function(t){return r=DG(t),this},this._packedGetValue=function(){return r}}decode(t,e){const n=this.makeDestinationObject();void 0===e&&(e=0);const r=this.word.decode(t,e);this._packedSetValue(r);for(const t of this.fields)void 0!==t.property&&(n[t.property]=t.decode(r));return n}encode(t,e,n){void 0===n&&(n=0);const r=this.word.decode(e,n);this._packedSetValue(r);for(const e of this.fields)if(void 0!==e.property){const n=t[e.property];void 0!==n&&e.encode(n)}return this.word.encode(this._packedGetValue(),e,n)}addField(t,e){const n=new zG(this,t,e);return this.fields.push(n),n}addBoolean(t){const e=new PG(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}class zG{constructor(t,e,n){if(!(t instanceof OG))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=r-i-e),this.wordMask=DG(this.valueMask<<this.start),this.property=n}decode(){return DG(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if(!Number.isInteger(t)||t!==DG(t&this.valueMask))throw new TypeError(cG("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=DG(t<<this.start);this.container._packedSetValue(DG(e&~this.wordMask)|n)}}class PG extends zG{constructor(t,e){super(t,1,e)}decode(t,e){return!!zG.prototype.decode.call(this,t,e)}encode(t){return"boolean"==typeof t&&(t=+t),zG.prototype.encode.call(this,t)}}class RG extends uG{constructor(t,e){if(!(t instanceof lG&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof lG||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof lG&&(r=t.length),!f_.isBuffer(t)||r!==t.length)throw new TypeError(cG("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof lG&&this.length.encode(r,e,n),r}}class BG extends uG{constructor(t){super(-1,t)}getSpan(t,e){if(!f_.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;n<t.length&&0!==t[n];)n+=1;return 1+n-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);return t.slice(e,e+r-1).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new f_(t,"utf8"),i=r.length;if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class UG extends uG{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!f_.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+r).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new f_(t,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class FG extends uG{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}sG.ExternalLayout=lG,sG.GreedyCount=hG,sG.OffsetLayout=dG,sG.UInt=fG,sG.UIntBE=pG,sG.Int=mG,sG.IntBE=gG,sG.Float=NG,sG.FloatBE=LG,sG.Double=SG,sG.DoubleBE=AG,sG.Sequence=xG,sG.Structure=TG,sG.UnionDiscriminator=IG,sG.UnionLayoutDiscriminator=kG,sG.Union=jG,sG.VariantLayout=CG,sG.BitStructure=OG,sG.BitField=zG,sG.Boolean=PG,sG.Blob=RG,sG.CString=BG,sG.UTF8=UG,sG.Constant=FG,sG.greedy=(t,e)=>new hG(t,e),sG.offset=(t,e,n)=>new dG(t,e,n),sG.u8=t=>new fG(1,t),sG.u16=t=>new fG(2,t),sG.u24=t=>new fG(3,t),sG.u32=t=>new fG(4,t),sG.u40=t=>new fG(5,t),sG.u48=t=>new fG(6,t),sG.nu64=t=>new wG(t),sG.u16be=t=>new pG(2,t),sG.u24be=t=>new pG(3,t),sG.u32be=t=>new pG(4,t),sG.u40be=t=>new pG(5,t),sG.u48be=t=>new pG(6,t),sG.nu64be=t=>new MG(t),sG.s8=t=>new mG(1,t),sG.s16=t=>new mG(2,t),sG.s24=t=>new mG(3,t),sG.s32=t=>new mG(4,t),sG.s40=t=>new mG(5,t),sG.s48=t=>new mG(6,t),sG.ns64=t=>new _G(t),sG.s16be=t=>new gG(2,t),sG.s24be=t=>new gG(3,t),sG.s32be=t=>new gG(4,t),sG.s40be=t=>new gG(5,t),sG.s48be=t=>new gG(6,t),sG.ns64be=t=>new EG(t),sG.f32=t=>new NG(t),sG.f32be=t=>new LG(t),sG.f64=t=>new SG(t),sG.f64be=t=>new AG(t),sG.struct=(t,e,n)=>new TG(t,e,n),sG.bits=(t,e,n)=>new OG(t,e,n);var WG=sG.seq=(t,e,n)=>new xG(t,e,n);sG.union=(t,e,n)=>new jG(t,e,n),sG.unionLayoutDiscriminator=(t,e)=>new kG(t,e);var YG=sG.blob=(t,e)=>new RG(t,e);sG.cstr=t=>new BG(t),sG.utf8=(t,e)=>new UG(t,e),sG.const=(t,e)=>new FG(t,e);var QG={},HG=KM(aG),GG={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$_.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new N(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function L(t){N.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},r(w,v),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,v),r(_,v),r(E,v),E.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},N.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},N.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},N.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},N.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},N.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},N.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},N.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},N.prototype.isqr=function(t){return this.imul(t,t.clone())},N.prototype.sqr=function(t){return this.mul(t,t)},N.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},N.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},N.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},N.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new L(t)},r(L,N),L.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},L.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},L.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},L.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},L.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,JM)}(GG),function(t){var e=JM&&JM.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;const n=sG,r=HG,i=e(GG.exports);var o=sG;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});class a extends n.Layout{constructor(t,e,r){super(t,r),this.blob=n.blob(t),this.signed=e}decode(t,e=0){const n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(t,e,n=0){return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(f_,"le",this.span),e,n)}}function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};class u extends n.Layout{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}t.publicKey=function(t){return new u(n.blob(32),(t=>new r.PublicKey(t)),(t=>t.toBuffer()),t)};class c extends n.Layout{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=n.u8()}encode(t,e,n=0){return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}getSpan(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){const e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(({data:t})=>t),(t=>({data:t})),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){const r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),e)},t.tagged=function(t,e,r){const i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function({tag:e,data:n}){if(!e.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+e.toString("hex"));return n}),(e=>({tag:t,data:e})),r)},t.vecU8=d,t.str=function(t){return new u(d(),(t=>t.toString("utf-8")),(t=>f_.from(t,"utf-8")),t)},t.rustEnum=function(t,e,r){const i=n.union(null!=r?r:n.u8(),e);return t.forEach(((t,e)=>i.addVariant(e,t,t.property))),i},t.array=function(t,e,r){const i=n.struct([n.seq(t,e,"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),r)};class f extends n.Layout{constructor(t,e,n){super(t.span+e.span,n),this.keyLayout=t,this.valueLayout=e}decode(t,e){e=e||0;return[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}encode(t,e,n){n=n||0;const r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}getSpan(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}t.map=function(t,e,r){const i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(({values:t})=>new Map(t)),(t=>({values:Array.from(t.entries())})),r)}}(QG);const ZG=$_.Buffer,VG=tE.exports,qG=QG.struct([QG.publicKey("mint"),QG.publicKey("owner"),QG.u64("amount"),QG.u32("delegateOption"),QG.publicKey("delegate"),QG.u8("state"),QG.u32("isNativeOption"),QG.u64("isNative"),QG.u64("delegatedAmount"),QG.u32("closeAuthorityOption"),QG.publicKey("closeAuthority")]);QG.array;var JG=QG.bool;QG.i128,QG.i16,QG.i32,QG.i64,QG.i8,QG.map;var KG=QG.option,XG=QG.publicKey,$G=QG.rustEnum,tZ=QG.str,eZ=QG.struct;QG.tagged;var nZ=QG.u128,rZ=QG.u16,iZ=QG.u32,oZ=QG.u64,aZ=QG.u8,sZ=QG.vec;QG.vecU8;var uZ=({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new xw(n,o,t),u=s.estimateGas[i],c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});return c?u(...c,{from:e,value:r}):u({from:e,value:r})}};let cZ=["ethereum","bsc","polygon","fantom","velas"];cZ.evm=["ethereum","bsc","polygon","fantom","velas"],cZ.solana=[];class lZ extends FM{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}detectNetwork(){return Promise.resolve(nd(this._network).id)}requestChunk(t,e){const n=t.map((t=>t.request));return Hw(e,JSON.stringify(n)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(r.error){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else t.resolve(r.result)}))})).catch((e=>{if(e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint)}else t.forEach((t=>{t.reject(e)}))}))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=[];for(let n=0;n<Math.ceil(t.length/99);n++)e[n]=t.slice(99*n,99*(n+1));e.forEach((t=>(t.map((t=>t.request)),this.requestChunk(t,this._endpoint))))}),10)),i}}let hZ=()=>"object"==typeof wh?wh:window;const dZ={ethereum:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],bsc:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],polygon:["https://polygon-rpc.com","https://poly-rpc.gateway.pokt.network","https://matic-mainnet.chainstacklabs.com"],fantom:["https://fantom.blockpi.network/v1/rpc/public","https://rpcapi.fantom.network","https://rpc.ftm.tools"],velas:["https://mainnet.velas.com/rpc","https://evmexplorer.velas.com/rpc","https://explorer.velas.com/rpc"]},fZ=()=>(null==hZ()._clientProviders&&(hZ()._clientProviders={}),hZ()._clientProviders),pZ=(t,e)=>{fZ()[t]=e},mZ=async(t,e)=>{let n,r=hZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}pZ(t,new lZ(n,t,e))};var gZ=async t=>{let e=fZ();if(e&&e[t])return e[t];let n=hZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await mZ(t,dZ[t]),e(hZ()._clientProviders[t])}))),await n._getProviderPromise[t]},yZ=mZ;let bZ=()=>(null==hZ()._cacheStore&&wZ(),hZ()._cacheStore),vZ=()=>(null==hZ()._promiseStore&&wZ(),hZ()._promiseStore),wZ=()=>{hZ()._cacheStore={},hZ()._promiseStore={},hZ()._clientProviders={}},MZ=function({key:t}){vZ()[t]=void 0},_Z=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return vZ()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return vZ()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=bZ()[t];if(function(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],o=t[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(e=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...t)=>n.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){bZ()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{MZ({key:e})})).catch((()=>{MZ({key:e})}))}))},EZ=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!cZ.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await(async t=>{if(cZ.evm.includes(t))return await gZ(t);throw"Unknown blockchain: "+t})(t);return await _Z({expires:s||0,key:[t,e,n,r,i,a],call:async()=>uZ({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};let NZ=({address:t,api:e,method:n,params:r,provider:i,block:o})=>{let a=new xw(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r});return a[n](...s,{blockTag:o})};class LZ extends jH{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}}const SZ={solana:["https://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","https://mainnet-beta.solflare.network","https://us-solana1.twnodes.com"]},AZ=()=>(null==hZ()._clientProviders&&(hZ()._clientProviders={}),hZ()._clientProviders),xZ=(t,e)=>{AZ()[t]=e},TZ=async(t,e)=>{let n,r=hZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}xZ(t,new LZ(n,t,e))};var IZ=async t=>{let e=AZ();if(e&&e[t])return e[t];let n=hZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await TZ(t,SZ[t]),e(hZ()._clientProviders[t])}))),await n._getProviderPromise[t]},kZ=TZ;var jZ=async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await IZ(t);return null==r||"getAccountInfo"===r?(null==n&&(n=qG),(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new sY(t));return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o})):"getProgramAccounts"===r?a.getProgramAccounts(new sY(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t)):"getTokenAccountBalance"===r?a.getTokenAccountBalance(new sY(e)):"latestBlockNumber"===r?a.getBlockHeight():"balance"===r?(({address:t,provider:e})=>e.getBalance(new sY(t)))({address:e,provider:a}):void 0};let CZ=["ethereum","bsc","polygon","solana","fantom","velas"];CZ.evm=["ethereum","bsc","polygon","fantom","velas"],CZ.solana=["solana"];let DZ=async function(t,e){let{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?<blockchain>\w+):\/\/(?<part1>[\w\d]+)(\/(?<part2>[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u}=("object"==typeof t?t:e)||{};return await _Z({expires:s||0,key:[n,r,i,a,u],call:async()=>{if(CZ.evm.includes(n))return(async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await gZ(t);return n?NZ({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0})({blockchain:n,address:r,api:o,method:i,params:a,block:u});if(CZ.solana.includes(n))return jZ({blockchain:n,address:r,api:o,method:i,params:a,block:u});throw"Unknown blockchain: "+n}})};const OZ=async t=>{if(CZ.evm.includes(t))return await gZ(t);if(CZ.solana.includes(t))return await IZ(t);throw"Unknown blockchain: "+t};let zZ={ethereum:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"ETH",CURRENCY:"Ether",NAME:"Ethereum",USD:"0xdAC17F958D2ee523a2206206994597C13D831ec7",USD_DECIMALS:6},bsc:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"BNB",CURRENCY:"BNB",NAME:"BNB Smart Chain",USD:"0x55d398326f99059fF775485246999027B3197955",USD_DECIMALS:18},polygon:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"MATIC",CURRENCY:"Polygon",NAME:"Polygon",USD:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",USD_DECIMALS:6},solana:{ZERO:"0",MAXINT:"340282366920938463463374607431768211455",WRAPPED:"So11111111111111111111111111111111111111112",NATIVE:"11111111111111111111111111111111",DECIMALS:9,SYMBOL:"SOL",CURRENCY:"Solana",NAME:"Solana",USD:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",USD_DECIMALS:6},fantom:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"FTM",CURRENCY:"Fantom",NAME:"Fantom",USD:"0x9879aBDea01a879644185341F7aF7d8343556B7a",USD_DECIMALS:18},velas:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"VLX",CURRENCY:"Velas",NAME:"Velas",USD:"0x01445C31581c354b7338AC35693AB2001B50b9aE",USD_DECIMALS:6}};var PZ=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=92)}([function(t,e,n){(function(t){n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"e",(function(){return f})),n.d(e,"d",(function(){return p})),n.d(e,"o",(function(){return m})),n.d(e,"n",(function(){return g})),n.d(e,"p",(function(){return y})),n.d(e,"A",(function(){return b})),n.d(e,"z",(function(){return v})),n.d(e,"B",(function(){return w})),n.d(e,"v",(function(){return M})),n.d(e,"u",(function(){return _})),n.d(e,"s",(function(){return L})),n.d(e,"r",(function(){return S})),n.d(e,"t",(function(){return A})),n.d(e,"q",(function(){return x})),n.d(e,"m",(function(){return T})),n.d(e,"l",(function(){return I})),n.d(e,"k",(function(){return k})),n.d(e,"j",(function(){return j})),n.d(e,"x",(function(){return D})),n.d(e,"a",(function(){return O})),n.d(e,"y",(function(){return z})),n.d(e,"w",(function(){return P}));var r=n(22),i=n.n(r),o=n(49),a=n.n(o);function s(t){return new Uint8Array(t)}function u(t,e=!1){const n=t.toString("hex");return e?O(n):n}function c(t){return t.toString("utf8")}function l(t){return t.readUIntBE(0,t.length)}function h(t){return a()(t)}function d(t,e=!1){return u(h(t),e)}function f(t){return c(h(t))}function p(t){return l(h(t))}function m(e){return t.from(D(e),"hex")}function g(t){return s(m(t))}function y(t){return c(m(t))}function b(e){return t.from(e,"utf8")}function v(t){return s(b(t))}function w(t,e=!1){return u(b(t),e)}function M(t){return h(N(E(t)))}function _(t){return N(E(t))}function E(t){return C((t>>>0).toString(2))}function N(t){return new Uint8Array(function(t,e=8){const n=C(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}(t).map((t=>parseInt(t,2))))}function L(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function S(e){return t.isBuffer(e)}function A(t){return i.a.strict(t)&&!S(t)}function x(t){return!A(t)&&!S(t)&&void 0!==t.byteLength}function T(t){return S(t)?"buffer":A(t)?"typed-array":x(t)?"array-buffer":Array.isArray(t)?"array":typeof t}function I(t){return function(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}(t)?"binary":L(t)?"hex":"utf8"}function k(...e){return t.concat(e)}function j(...t){let e=[];return t.forEach((t=>e=e.concat(Array.from(t)))),new Uint8Array([...e])}function C(t,e=8,n="0"){return function(t,e,n="0"){return function(t,e,n,r="0"){const i=e-t.length;let o=t;if(i>0){const e=r.repeat(i);o=n?e+t:t+e}return o}(t,e,!0,n)}(t,function(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}(t.length,e),n)}function D(t){return t.replace(/^0x/,"")}function O(t){return t.startsWith("0x")?t:"0x"+t}function z(t){return(t=C(t=D(t),2))&&(t=O(t)),t}function P(t){const e=t.startsWith("0x");return t=(t=D(t)).startsWith("0")?t.substring(1):t,e?O(t):t}}).call(this,n(18).Buffer)},function(t,e,n){n.d(e,"g",(function(){return r.detectEnv})),n.d(e,"r",(function(){return r.isMobile})),n.d(e,"m",(function(){return r.isBrowser})),n.d(e,"k",(function(){return r.getLocation})),n.d(e,"i",(function(){return r.getClientMeta})),n.d(e,"B",(function(){return r.setLocal})),n.d(e,"j",(function(){return r.getLocal})),n.d(e,"A",(function(){return r.removeLocal})),n.d(e,"v",(function(){return r.mobileLinkChoiceKey})),n.d(e,"C",(function(){return o})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return l})),n.d(e,"d",(function(){return h})),n.d(e,"e",(function(){return d})),n.d(e,"f",(function(){return f})),n.d(e,"w",(function(){return L})),n.d(e,"x",(function(){return S})),n.d(e,"z",(function(){return g})),n.d(e,"D",(function(){return y})),n.d(e,"h",(function(){return A})),n.d(e,"u",(function(){return j})),n.d(e,"y",(function(){return C})),n.d(e,"l",(function(){return T})),n.d(e,"a",(function(){return I})),n.d(e,"o",(function(){return v})),n.d(e,"q",(function(){return w})),n.d(e,"p",(function(){return M})),n.d(e,"n",(function(){return _})),n.d(e,"s",(function(){return E})),n.d(e,"t",(function(){return N}));var r=n(21);const i=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],o=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var a=n(16),s=n.n(a),u=n(0);function c(t){return u.b(new Uint8Array(t))}function l(t,e){return u.c(new Uint8Array(t),!e)}function h(t){return u.f(t).buffer}function d(t){return u.n(t).buffer}function f(t,e){const n=u.x(u.y(new s.a(t).toString(16)));return e?n:u.a(n)}var p=n(50);function m(t){return u.y(t)}const g=n(51).payloadId;function y(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function b(t,e){return u.s(t,e)}function v(t){return void 0!==t.method}function w(t){return void 0!==t.result}function M(t){return void 0!==t.error}function _(t){return void 0!==t.event}function E(t){return i.includes(t)||t.startsWith("wc_")}function N(t){return!!t.method.startsWith("wc_")||!o.includes(t.method)}function L(t){var e,n;return(n=t)&&n.length&&!b(t[0])&&(t[0]=(e=t[0],u.B(e,!0))),t}function S(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!(e=t.from)||"0x"!==e.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(e)||!/^(0x)?[0-9a-f]{40}$/.test(e)&&!/^(0x)?[0-9A-F]{40}$/.test(e)&&e!==function(t){t=Object(u.x)(t.toLowerCase());const e=Object(u.x)(Object(p.keccak_256)((n=t,u.A(n))));var n;let r="";for(let n=0;n<t.length;n++)parseInt(e[n],16)>7?r+=t[n].toUpperCase():r+=t[n];return Object(u.a)(r)}(e))throw new Error("Transaction object must include a valid 'from' value.");var e;function n(t){let e=t;var n;return("number"==typeof t||"string"==typeof t&&!function(t){return""===t||"string"==typeof t&&""===t.trim()}(t))&&(b(t)?"string"==typeof t&&(e=m(t)):e=f(t)),"string"==typeof e&&(n=e,e=u.w(u.a(n))),e}const r={from:m(t.from),to:void 0===t.to?void 0:m(t.to),gasPrice:void 0===t.gasPrice?"":n(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":n(t.gasLimit):n(t.gas),value:void 0===t.value?"":n(t.value),nonce:void 0===t.nonce?"":n(t.nonce),data:void 0===t.data?"":m(t.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((t=>{(void 0===r[t]||"string"==typeof r[t]&&!r[t].trim().length)&&i.includes(t)&&delete r[t]})),r}function A(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:e};return t.data&&(r.data=t.data),r}var x=n(23);function T(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function I(t,e){let n=k(t);return n=Object.assign(Object.assign({},n),e),function(t){return x.stringify(t)}(n)}function k(t){return x.parse(t)}function j(t){return void 0!==t.bridge}function C(t){const e=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,n)),o=function(t){const e=k(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}},function(t,e,n){n.d(e,"b",(function(){return i})),n.d(e,"g",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"j",(function(){return l})),n.d(e,"h",(function(){return r})),n.d(e,"d",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"l",(function(){return p}));const r=512,i=256,o=256,a="AES-CBC",s="SHA-"+i,u="HMAC",c="SHA-256",l="SHA-512",h="encrypt",d="decrypt",f="sign",p="verify"},function(t,e,n){n.d(e,"b",(function(){return r})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"a",(function(){return u}));const r="INTERNAL_ERROR",i="SERVER_ERROR",o=[-32700,-32600,-32601,-32602,-32603],a=[-32e3,-32099],s={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[r]:{code:-32603,message:"Internal error"},[i]:{code:-32e3,message:"Server error"}},u=i},function(t,e,n){function r(t){let e;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function i(t){const e=r(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=r,e.getFromWindowOrThrow=i,e.getDocumentOrThrow=function(){return i("document")},e.getDocument=function(){return r("document")},e.getNavigatorOrThrow=function(){return i("navigator")},e.getNavigator=function(){return r("navigator")},e.getLocationOrThrow=function(){return i("location")},e.getLocation=function(){return r("location")},e.getCryptoOrThrow=function(){return i("crypto")},e.getCrypto=function(){return r("crypto")},e.getLocalStorageOrThrow=function(){return i("localStorage")},e.getLocalStorage=function(){return r("localStorage")}},function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(67),e),i(n(68),e)},function(t,e,n){n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"f",(function(){return h}));var r=n(5),i=n(2);async function o(t,e=i.a){return r.getSubtleCrypto().importKey("raw",t,function(t){return t===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(e),!0,function(t){return t===i.a?[i.d,i.c]:[i.k,i.l]}(e))}async function a(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.encrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function s(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.decrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function u(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.g,name:i.e},a,e);return new Uint8Array(s)}async function c(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.h,name:i.e},a,e);return new Uint8Array(s)}async function l(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.i},t);return new Uint8Array(n)}async function h(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.j},t);return new Uint8Array(n)}},function(t,e){var n,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return r[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},function(t,e,n){var r=n(44),i=n(45);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return n}}},function(t,e,n){n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));var r=n(3);function i(t){return r.c.includes(t)}function o(t){return Object.keys(r.f).includes(t)?r.f[t]:r.f[r.a]}function a(t){return Object.values(r.f).find((e=>e.code===t))||r.f[r.a]}},function(t,e,n){var r=n(19);o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var i=o.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function o(t,e,n){return o.TYPED_ARRAY_SUPPORT||this instanceof o?"number"==typeof t?u(this,t):function(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;return i=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),o.TYPED_ARRAY_SUPPORT?i.__proto__=o.prototype:i=c(t,i),i}(t,e,n,r):"string"==typeof e?function(t,e){var n=0|h(e),r=s(t,n),i=r.write(e);return i!==n&&(r=r.slice(0,i)),r}(t,e):function(t,e){if(o.isBuffer(e)){var n=0|a(e.length),r=s(t,n);return 0===r.length||e.copy(r,0,0,n),r}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?s(t,0):c(t,e);if("Buffer"===e.type&&Array.isArray(e.data))return c(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}(this,t,e,n):new o(t,e,n)}function a(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function s(t,e){var n;return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e)).__proto__=o.prototype:(null===(n=t)&&(n=new o(e)),n.length=e),n}function u(t,e){var n=s(t,e<0?0:0|a(e));if(!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)n[r]=0;return n}function c(t,e){for(var n=e.length<0?0:0|a(e.length),r=s(t,n),i=0;i<n;i+=1)r[i]=255&e[i];return r}function l(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function h(t){return o.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:l(t).length)}o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),o.prototype.write=function(t,e,n){void 0===e||void 0===n&&"string"==typeof e?(n=this.length,e=0):isFinite(e)&&(e|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(t,e,n,r){return function(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}(l(e,t.length-n),t,n,r)}(this,t,e,n)},o.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),o.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+t]}return n},o.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,a=r-n;if(this===t&&n<e&&e<r)for(i=a-1;i>=0;--i)t[i+e]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+a),e);return a},o.prototype.fill=function(t,e,n){if("string"==typeof t){if("string"==typeof e?(e=0,n=this.length):"string"==typeof n&&(n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=o.isBuffer(t)?t:new o(t),s=a.length;for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this},o.concat=function(t,e){if(!r(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s(null,0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=u(null,e),a=0;for(n=0;n<t.length;++n){var c=t[n];if(!o.isBuffer(c))throw new TypeError('"list" argument must be an Array of Buffers');c.copy(i,a),a+=c.length}return i},o.byteLength=h,o.prototype._isBuffer=!0,o.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.exports.alloc=function(t){var e=new o(t);return e.fill(0),e},t.exports.from=function(t){return new o(t)}},function(t,e,n){var r=n(34);n.d(e,"randomBytes",(function(){return r.a}));var i=n(35);n.d(e,"aesCbcDecrypt",(function(){return i.a})),n.d(e,"aesCbcEncrypt",(function(){return i.b}));var o=n(36);n.d(e,"hmacSha256Sign",(function(){return o.a})),n(41),n(15),n(2)},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.d(e,"a",(function(){return r}));class r{}},function(t,e,n){var r=n(37);n.o(r,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return r.isConstantTime})),n(38);var i=n(39);n.o(i,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return i.isConstantTime}));var o=n(40);n.d(e,"isConstantTime",(function(){return o.a}))},function(t,e,n){(function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=n(55).Buffer}catch(t){}function s(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var a=t.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=t.length-6,r=0;n>=e;n-=6)i=s(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==e&&(i=s(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[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];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:c[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new _(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.call(this,t),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)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<p);var y=this.pow(h,new o(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},i(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(54)(t))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});const r=n(60);r.__exportStar(n(61),e),r.__exportStar(n(62),e)},function(t,e,n){(function(t){
57
57
  /*!
58
58
  * The buffer module from node.js, for the browser.
59
59
  *