import{aH as rs,aI as os,av as ss,aJ as is,K as as,I as Fr,P as jt,aK as cs,G as yt,aL as us,aM as at,aN as yr}from"./index-F5308wi0.js";var Tr=rs,_e=os;Tr("%WeakMap%",!0);Tr("%Map%",!0);_e("WeakMap.prototype.get",!0);_e("WeakMap.prototype.set",!0);_e("WeakMap.prototype.has",!0);_e("Map.prototype.get",!0);_e("Map.prototype.set",!0);_e("Map.prototype.has",!0);var fs=String.prototype.replace,ls=/%20/g,wn={RFC1738:"RFC1738",RFC3986:"RFC3986"},Cr={default:wn.RFC3986,formatters:{RFC1738:function(n){return fs.call(n,ls,"+")},RFC3986:function(n){return String(n)}},RFC1738:wn.RFC1738,RFC3986:wn.RFC3986},ds=Cr,bn=Object.prototype.hasOwnProperty,se=Array.isArray,qt=function(){for(var n=[],t=0;t<256;++t)n.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return n}(),hs=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(se(r)){for(var o=[],s=0;s<r.length;++s)typeof r[s]<"u"&&o.push(r[s]);e.obj[e.prop]=o}}},Nr=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},o=0;o<t.length;++o)typeof t[o]<"u"&&(r[o]=t[o]);return r},ps=function n(t,e,r){if(!e)return t;if(typeof e!="object"){if(se(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!bn.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var o=t;return se(t)&&!se(e)&&(o=Nr(t,r)),se(t)&&se(e)?(e.forEach(function(s,i){if(bn.call(t,i)){var c=t[i];c&&typeof c=="object"&&s&&typeof s=="object"?t[i]=n(c,s,r):t.push(s)}else t[i]=s}),t):Object.keys(e).reduce(function(s,i){var c=e[i];return bn.call(s,i)?s[i]=n(s[i],c,r):s[i]=c,s},o)},ys=function(t,e){return Object.keys(e).reduce(function(r,o){return r[o]=e[o],r},t)},gs=function(n,t,e){var r=n.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},ws=function(t,e,r,o,s){if(t.length===0)return t;var i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var c="",a=0;a<i.length;++a){var u=i.charCodeAt(a);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||s===ds.RFC1738&&(u===40||u===41)){c+=i.charAt(a);continue}if(u<128){c=c+qt[u];continue}if(u<2048){c=c+(qt[192|u>>6]+qt[128|u&63]);continue}if(u<55296||u>=57344){c=c+(qt[224|u>>12]+qt[128|u>>6&63]+qt[128|u&63]);continue}a+=1,u=65536+((u&1023)<<10|i.charCodeAt(a)&1023),c+=qt[240|u>>18]+qt[128|u>>12&63]+qt[128|u>>6&63]+qt[128|u&63]}return c},bs=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],o=0;o<e.length;++o)for(var s=e[o],i=s.obj[s.prop],c=Object.keys(i),a=0;a<c.length;++a){var u=c[a],f=i[u];typeof f=="object"&&f!==null&&r.indexOf(f)===-1&&(e.push({obj:i,prop:u}),r.push(f))}return hs(e),t},ms=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},xs=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},vs=function(t,e){return[].concat(t,e)},Es=function(t,e){if(se(t)){for(var r=[],o=0;o<t.length;o+=1)r.push(e(t[o]));return r}return e(t)},Dr={arrayToObject:Nr,assign:ys,combine:vs,compact:bs,decode:gs,encode:ws,isBuffer:xs,isRegExp:ms,maybeMap:Es,merge:ps},Bs=Dr,zr=Cr,Ss=Date.prototype.toISOString,gr=zr.default;Bs.encode,zr.formatters[gr];var As=Dr;As.decode;const jc=ss((n,t,e={top:0})=>{if(!t||!n)return;const r=n.clientHeight/2,s=t.getBoundingClientRect().top-r,i=n.scrollTop+s-e.top;n.scrollTo({top:i,behavior:"smooth"})},50);function wr(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`positive integer expected, not ${n}`)}function Is(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function sn(n,...t){if(!Is(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${n.length}`)}function Us(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");wr(n.outputLen),wr(n.blockLen)}function Ye(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function _s(n,t){sn(n);const e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}const mn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xn=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Mt=(n,t)=>n<<32-t|n>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];function Os(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Hn(n){return typeof n=="string"&&(n=Os(n)),sn(n),n}function Rs(...n){let t=0;for(let r=0;r<n.length;r++){const o=n[r];sn(o),t+=o.length}const e=new Uint8Array(t);for(let r=0,o=0;r<n.length;r++){const s=n[r];e.set(s,o),o+=s.length}return e}class Hr{clone(){return this._cloneInto()}}function $r(n){const t=r=>n().update(Hn(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Pr(n=32){if(mn&&typeof mn.getRandomValues=="function")return mn.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}function Ls(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),a=r?4:0,u=r?0:4;n.setUint32(t+a,i,r),n.setUint32(t+u,c,r)}const ks=(n,t,e)=>n&t^~n&e,Fs=(n,t,e)=>n&t^n&e^t&e;class qr extends Hr{constructor(t,e,r,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=xn(this.buffer)}update(t){Ye(this);const{view:e,buffer:r,blockLen:o}=this;t=Hn(t);const s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=xn(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ye(this),_s(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let l=i;l<o;l++)e[l]=0;Ls(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=xn(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)c.setUint32(4*l,f[l],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(r),t}}const qe=BigInt(2**32-1),Ln=BigInt(32);function Mr(n,t=!1){return t?{h:Number(n&qe),l:Number(n>>Ln&qe)}:{h:Number(n>>Ln&qe)|0,l:Number(n&qe)|0}}function Ts(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let o=0;o<n.length;o++){const{h:s,l:i}=Mr(n[o],t);[e[o],r[o]]=[s,i]}return[e,r]}const Cs=(n,t)=>BigInt(n>>>0)<<Ln|BigInt(t>>>0),Ns=(n,t,e)=>n>>>e,Ds=(n,t,e)=>n<<32-e|t>>>e,zs=(n,t,e)=>n>>>e|t<<32-e,Hs=(n,t,e)=>n<<32-e|t>>>e,$s=(n,t,e)=>n<<64-e|t>>>e-32,Ps=(n,t,e)=>n>>>e-32|t<<64-e,qs=(n,t)=>t,Ms=(n,t)=>n,js=(n,t,e)=>n<<e|t>>>32-e,Vs=(n,t,e)=>t<<e|n>>>32-e,Gs=(n,t,e)=>t<<e-32|n>>>64-e,Zs=(n,t,e)=>n<<e-32|t>>>64-e;function Ks(n,t,e,r){const o=(t>>>0)+(r>>>0);return{h:n+e+(o/2**32|0)|0,l:o|0}}const Ws=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Ys=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Xs=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Js=(n,t,e,r,o)=>t+e+r+o+(n/2**32|0)|0,Qs=(n,t,e,r,o)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0),ti=(n,t,e,r,o,s)=>t+e+r+o+s+(n/2**32|0)|0,P={fromBig:Mr,split:Ts,toBig:Cs,shrSH:Ns,shrSL:Ds,rotrSH:zs,rotrSL:Hs,rotrBH:$s,rotrBL:Ps,rotr32H:qs,rotr32L:Ms,rotlSH:js,rotlSL:Vs,rotlBH:Gs,rotlBL:Zs,add:Ks,add3L:Ws,add3H:Ys,add4L:Xs,add4H:Js,add5H:ti,add5L:Qs},[ei,ni]=P.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Jt=new Uint32Array(80),Qt=new Uint32Array(80);class ri extends qr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:o,Ch:s,Cl:i,Dh:c,Dl:a,Eh:u,El:f,Fh:l,Fl:E,Gh:x,Gl:w,Hh:y,Hl:p}=this;return[t,e,r,o,s,i,c,a,u,f,l,E,x,w,y,p]}set(t,e,r,o,s,i,c,a,u,f,l,E,x,w,y,p){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=a|0,this.Eh=u|0,this.El=f|0,this.Fh=l|0,this.Fl=E|0,this.Gh=x|0,this.Gl=w|0,this.Hh=y|0,this.Hl=p|0}process(t,e){for(let g=0;g<16;g++,e+=4)Jt[g]=t.getUint32(e),Qt[g]=t.getUint32(e+=4);for(let g=16;g<80;g++){const F=Jt[g-15]|0,B=Qt[g-15]|0,_=P.rotrSH(F,B,1)^P.rotrSH(F,B,8)^P.shrSH(F,B,7),T=P.rotrSL(F,B,1)^P.rotrSL(F,B,8)^P.shrSL(F,B,7),C=Jt[g-2]|0,et=Qt[g-2]|0,K=P.rotrSH(C,et,19)^P.rotrBH(C,et,61)^P.shrSH(C,et,6),q=P.rotrSL(C,et,19)^P.rotrBL(C,et,61)^P.shrSL(C,et,6),lt=P.add4L(T,q,Qt[g-7],Qt[g-16]),ut=P.add4H(lt,_,K,Jt[g-7],Jt[g-16]);Jt[g]=ut|0,Qt[g]=lt|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:a,Dh:u,Dl:f,Eh:l,El:E,Fh:x,Fl:w,Gh:y,Gl:p,Hh:v,Hl:U}=this;for(let g=0;g<80;g++){const F=P.rotrSH(l,E,14)^P.rotrSH(l,E,18)^P.rotrBH(l,E,41),B=P.rotrSL(l,E,14)^P.rotrSL(l,E,18)^P.rotrBL(l,E,41),_=l&x^~l&y,T=E&w^~E&p,C=P.add5L(U,B,T,ni[g],Qt[g]),et=P.add5H(C,v,F,_,ei[g],Jt[g]),K=C|0,q=P.rotrSH(r,o,28)^P.rotrBH(r,o,34)^P.rotrBH(r,o,39),lt=P.rotrSL(r,o,28)^P.rotrBL(r,o,34)^P.rotrBL(r,o,39),ut=r&s^r&c^s&c,Ft=o&i^o&a^i&a;v=y|0,U=p|0,y=x|0,p=w|0,x=l|0,w=E|0,{h:l,l:E}=P.add(u|0,f|0,et|0,K|0),u=c|0,f=a|0,c=s|0,a=i|0,s=r|0,i=o|0;const A=P.add3L(K,lt,Ft);r=P.add3H(A,et,q,ut),o=A|0}({h:r,l:o}=P.add(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:i}=P.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:a}=P.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:u,l:f}=P.add(this.Dh|0,this.Dl|0,u|0,f|0),{h:l,l:E}=P.add(this.Eh|0,this.El|0,l|0,E|0),{h:x,l:w}=P.add(this.Fh|0,this.Fl|0,x|0,w|0),{h:y,l:p}=P.add(this.Gh|0,this.Gl|0,y|0,p|0),{h:v,l:U}=P.add(this.Hh|0,this.Hl|0,v|0,U|0),this.set(r,o,s,i,c,a,u,f,l,E,x,w,y,p,v,U)}roundClean(){Jt.fill(0),Qt.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const oi=$r(()=>new ri);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const jr=BigInt(0),an=BigInt(1),si=BigInt(2);function he(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function De(n){if(!he(n))throw new Error("Uint8Array expected")}const ii=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function pe(n){De(n);let t="";for(let e=0;e<n.length;e++)t+=ii[n[e]];return t}function Vr(n){const t=n.toString(16);return t.length&1?`0${t}`:t}function $n(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}const Wt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function br(n){if(n>=Wt._0&&n<=Wt._9)return n-Wt._0;if(n>=Wt._A&&n<=Wt._F)return n-(Wt._A-10);if(n>=Wt._a&&n<=Wt._f)return n-(Wt._a-10)}function Be(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){const i=br(n.charCodeAt(s)),c=br(n.charCodeAt(s+1));if(i===void 0||c===void 0){const a=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+c}return r}function le(n){return $n(pe(n))}function Ee(n){return De(n),$n(pe(Uint8Array.from(n).reverse()))}function Se(n,t){return Be(n.toString(16).padStart(t*2,"0"))}function Ce(n,t){return Se(n,t).reverse()}function ai(n){return Be(Vr(n))}function pt(n,t,e){let r;if(typeof t=="string")try{r=Be(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(he(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);const o=r.length;if(typeof e=="number"&&o!==e)throw new Error(`${n} expected ${e} bytes, got ${o}`);return r}function ye(...n){let t=0;for(let r=0;r<n.length;r++){const o=n[r];De(o),t+=o.length}const e=new Uint8Array(t);for(let r=0,o=0;r<n.length;r++){const s=n[r];e.set(s,o),o+=s.length}return e}function ci(n,t){if(n.length!==t.length)return!1;let e=0;for(let r=0;r<n.length;r++)e|=n[r]^t[r];return e===0}function ui(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function fi(n){let t;for(t=0;n>jr;n>>=an,t+=1);return t}function li(n,t){return n>>BigInt(t)&an}function di(n,t,e){return n|(e?an:jr)<<BigInt(t)}const Pn=n=>(si<<BigInt(n-1))-an,vn=n=>new Uint8Array(n),mr=n=>Uint8Array.from(n);function Gr(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=vn(n),o=vn(n),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},c=(...l)=>e(o,r,...l),a=(l=vn())=>{o=c(mr([0]),l),r=c(),l.length!==0&&(o=c(mr([1]),l),r=c())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let l=0;const E=[];for(;l<t;){r=c();const x=r.slice();E.push(x),l+=r.length}return ye(...E)};return(l,E)=>{i(),a(l);let x;for(;!(x=E(u()));)a();return i(),x}}const hi={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||he(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function Oe(n,t,e={}){const r=(o,s,i)=>{const c=hi[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);const a=n[o];if(!(i&&a===void 0)&&!c(a,n))throw new Error(`Invalid param ${String(o)}=${a} (${typeof a}), expected ${s}`)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(e))r(o,s,!0);return n}const pi=Object.freeze(Object.defineProperty({__proto__:null,abytes:De,bitGet:li,bitLen:fi,bitMask:Pn,bitSet:di,bytesToHex:pe,bytesToNumberBE:le,bytesToNumberLE:Ee,concatBytes:ye,createHmacDrbg:Gr,ensureBytes:pt,equalBytes:ci,hexToBytes:Be,hexToNumber:$n,isBytes:he,numberToBytesBE:Se,numberToBytesLE:Ce,numberToHexUnpadded:Vr,numberToVarBytesBE:ai,utf8ToBytes:ui,validateObject:Oe},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gt=BigInt(0),ot=BigInt(1),ie=BigInt(2),yi=BigInt(3),kn=BigInt(4),xr=BigInt(5),vr=BigInt(8);BigInt(9);BigInt(16);function nt(n,t){const e=n%t;return e>=gt?e:t+e}function gi(n,t,e){if(e<=gt||t<gt)throw new Error("Expected power/modulo > 0");if(e===ot)return gt;let r=ot;for(;t>gt;)t&ot&&(r=r*n%e),n=n*n%e,t>>=ot;return r}function it(n,t,e){let r=n;for(;t-- >gt;)r*=r,r%=e;return r}function Fn(n,t){if(n===gt||t<=gt)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=nt(n,t),r=t,o=gt,s=ot;for(;e!==gt;){const c=r/e,a=r%e,u=o-s*c;r=e,e=a,o=s,s=u}if(r!==ot)throw new Error("invert: does not exist");return nt(o,t)}function wi(n){const t=(n-ot)/ie;let e,r,o;for(e=n-ot,r=0;e%ie===gt;e/=ie,r++);for(o=ie;o<n&&gi(o,t,n)!==n-ot;o++);if(r===1){const i=(n+ot)/kn;return function(a,u){const f=a.pow(u,i);if(!a.eql(a.sqr(f),u))throw new Error("Cannot find square root");return f}}const s=(e+ot)/ie;return function(c,a){if(c.pow(a,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let u=r,f=c.pow(c.mul(c.ONE,o),e),l=c.pow(a,s),E=c.pow(a,e);for(;!c.eql(E,c.ONE);){if(c.eql(E,c.ZERO))return c.ZERO;let x=1;for(let y=c.sqr(E);x<u&&!c.eql(y,c.ONE);x++)y=c.sqr(y);const w=c.pow(f,ot<<BigInt(u-x-1));f=c.sqr(w),l=c.mul(l,w),E=c.mul(E,f),u=x}return l}}function bi(n){if(n%kn===yi){const t=(n+ot)/kn;return function(r,o){const s=r.pow(o,t);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%vr===xr){const t=(n-xr)/vr;return function(r,o){const s=r.mul(o,ie),i=r.pow(s,t),c=r.mul(o,i),a=r.mul(r.mul(c,ie),i),u=r.mul(c,r.sub(a,r.ONE));if(!r.eql(r.sqr(u),o))throw new Error("Cannot find square root");return u}}return wi(n)}const mi=(n,t)=>(nt(n,t)&ot)===ot,xi=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vi(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=xi.reduce((r,o)=>(r[o]="function",r),t);return Oe(n,e)}function Ei(n,t,e){if(e<gt)throw new Error("Expected power > 0");if(e===gt)return n.ONE;if(e===ot)return t;let r=n.ONE,o=t;for(;e>gt;)e&ot&&(r=n.mul(r,o)),o=n.sqr(o),e>>=ot;return r}function Bi(n,t){const e=new Array(t.length),r=t.reduce((s,i,c)=>n.is0(i)?s:(e[c]=s,n.mul(s,i)),n.ONE),o=n.inv(r);return t.reduceRight((s,i,c)=>n.is0(i)?s:(e[c]=n.mul(s,e[c]),n.mul(s,i)),o),e}function Zr(n,t){const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function Kr(n,t,e=!1,r={}){if(n<=gt)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:o,nByteLength:s}=Zr(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=bi(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:Pn(o),ZERO:gt,ONE:ot,create:a=>nt(a,n),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return gt<=a&&a<n},is0:a=>a===gt,isOdd:a=>(a&ot)===ot,neg:a=>nt(-a,n),eql:(a,u)=>a===u,sqr:a=>nt(a*a,n),add:(a,u)=>nt(a+u,n),sub:(a,u)=>nt(a-u,n),mul:(a,u)=>nt(a*u,n),pow:(a,u)=>Ei(c,a,u),div:(a,u)=>nt(a*Fn(u,n),n),sqrN:a=>a*a,addN:(a,u)=>a+u,subN:(a,u)=>a-u,mulN:(a,u)=>a*u,inv:a=>Fn(a,n),sqrt:r.sqrt||(a=>i(c,a)),invertBatch:a=>Bi(c,a),cmov:(a,u,f)=>f?u:a,toBytes:a=>e?Ce(a,s):Se(a,s),fromBytes:a=>{if(a.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${a.length}`);return e?Ee(a):le(a)}});return Object.freeze(c)}function Wr(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Yr(n){const t=Wr(n);return t+Math.ceil(t/2)}function Si(n,t,e=!1){const r=n.length,o=Wr(t),s=Yr(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);const i=e?le(n):Ee(n),c=nt(i,t-ot)+ot;return e?Ce(c,o):Se(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ai=BigInt(0),En=BigInt(1);function Xr(n,t){const e=(o,s)=>{const i=s.negate();return o?i:s},r=o=>{const s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=n.ZERO,c=o;for(;s>Ai;)s&En&&(i=i.add(c)),c=c.double(),s>>=En;return i},precomputeWindow(o,s){const{windows:i,windowSize:c}=r(s),a=[];let u=o,f=u;for(let l=0;l<i;l++){f=u,a.push(f);for(let E=1;E<c;E++)f=f.add(u),a.push(f);u=f.double()}return a},wNAF(o,s,i){const{windows:c,windowSize:a}=r(o);let u=n.ZERO,f=n.BASE;const l=BigInt(2**o-1),E=2**o,x=BigInt(o);for(let w=0;w<c;w++){const y=w*a;let p=Number(i&l);i>>=x,p>a&&(p-=E,i+=En);const v=y,U=y+Math.abs(p)-1,g=w%2!==0,F=p<0;p===0?f=f.add(e(g,s[v])):u=u.add(e(F,s[U]))}return{p:u,f}},wNAFCached(o,s,i,c){const a=o._WINDOW_SIZE||1;let u=s.get(o);return u||(u=this.precomputeWindow(o,a),a!==1&&s.set(o,c(u))),this.wNAF(a,u,i)}}}function qn(n){return vi(n.Fp),Oe(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Zr(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ht=BigInt(0),Rt=BigInt(1),Me=BigInt(2),Ii=BigInt(8),Ui={zip215:!0};function _i(n){const t=qn(n);return Oe(n,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Oi(n){const t=_i(n),{Fp:e,n:r,prehash:o,hash:s,randomBytes:i,nByteLength:c,h:a}=t,u=Me<<BigInt(c*8)-Rt,f=e.create,l=t.uvRatio||((I,b)=>{try{return{isValid:!0,value:e.sqrt(I*e.inv(b))}}catch{return{isValid:!1,value:Ht}}}),E=t.adjustScalarBytes||(I=>I),x=t.domain||((I,b,L)=>{if(b.length||L)throw new Error("Contexts/pre-hash are not supported");return I}),w=I=>typeof I=="bigint"&&Ht<I,y=(I,b)=>w(I)&&w(b)&&I<b,p=I=>I===Ht||y(I,u);function v(I,b){if(y(I,b))return I;throw new Error(`Expected valid scalar < ${b}, got ${typeof I} ${I}`)}function U(I){return I===Ht?I:v(I,r)}const g=new Map;function F(I){if(!(I instanceof B))throw new Error("ExtendedPoint expected")}class B{constructor(b,L,N,$){if(this.ex=b,this.ey=L,this.ez=N,this.et=$,!p(b))throw new Error("x required");if(!p(L))throw new Error("y required");if(!p(N))throw new Error("z required");if(!p($))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(b){if(b instanceof B)throw new Error("extended point not allowed");const{x:L,y:N}=b||{};if(!p(L)||!p(N))throw new Error("invalid affine point");return new B(L,N,Rt,f(L*N))}static normalizeZ(b){const L=e.invertBatch(b.map(N=>N.ez));return b.map((N,$)=>N.toAffine(L[$])).map(B.fromAffine)}_setWindowSize(b){this._WINDOW_SIZE=b,g.delete(this)}assertValidity(){const{a:b,d:L}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:N,ey:$,ez:j,et:V}=this,X=f(N*N),G=f($*$),W=f(j*j),dt=f(W*W),st=f(X*b),wt=f(W*f(st+G)),bt=f(dt+f(L*f(X*G)));if(wt!==bt)throw new Error("bad point: equation left != right (1)");const It=f(N*$),ft=f(j*V);if(It!==ft)throw new Error("bad point: equation left != right (2)")}equals(b){F(b);const{ex:L,ey:N,ez:$}=this,{ex:j,ey:V,ez:X}=b,G=f(L*X),W=f(j*$),dt=f(N*X),st=f(V*$);return G===W&&dt===st}is0(){return this.equals(B.ZERO)}negate(){return new B(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){const{a:b}=t,{ex:L,ey:N,ez:$}=this,j=f(L*L),V=f(N*N),X=f(Me*f($*$)),G=f(b*j),W=L+N,dt=f(f(W*W)-j-V),st=G+V,wt=st-X,bt=G-V,It=f(dt*wt),ft=f(st*bt),zt=f(dt*bt),oe=f(wt*st);return new B(It,ft,oe,zt)}add(b){F(b);const{a:L,d:N}=t,{ex:$,ey:j,ez:V,et:X}=this,{ex:G,ey:W,ez:dt,et:st}=b;if(L===BigInt(-1)){const cr=f((j-$)*(W+G)),ur=f((j+$)*(W-G)),gn=f(ur-cr);if(gn===Ht)return this.double();const fr=f(V*Me*st),lr=f(X*Me*dt),dr=lr+fr,hr=ur+cr,pr=lr-fr,Qo=f(dr*gn),ts=f(hr*pr),es=f(dr*pr),ns=f(gn*hr);return new B(Qo,ts,ns,es)}const wt=f($*G),bt=f(j*W),It=f(X*N*st),ft=f(V*dt),zt=f(($+j)*(G+W)-wt-bt),oe=ft-It,Te=ft+It,ar=f(bt-L*wt),Wo=f(zt*oe),Yo=f(Te*ar),Xo=f(zt*ar),Jo=f(oe*Te);return new B(Wo,Yo,Jo,Xo)}subtract(b){return this.add(b.negate())}wNAF(b){return C.wNAFCached(this,g,b,B.normalizeZ)}multiply(b){const{p:L,f:N}=this.wNAF(v(b,r));return B.normalizeZ([L,N])[0]}multiplyUnsafe(b){let L=U(b);return L===Ht?T:this.equals(T)||L===Rt?this:this.equals(_)?this.wNAF(L).p:C.unsafeLadder(this,L)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return C.unsafeLadder(this,r).is0()}toAffine(b){const{ex:L,ey:N,ez:$}=this,j=this.is0();b==null&&(b=j?Ii:e.inv($));const V=f(L*b),X=f(N*b),G=f($*b);if(j)return{x:Ht,y:Rt};if(G!==Rt)throw new Error("invZ was invalid");return{x:V,y:X}}clearCofactor(){const{h:b}=t;return b===Rt?this:this.multiplyUnsafe(b)}static fromHex(b,L=!1){const{d:N,a:$}=t,j=e.BYTES;b=pt("pointHex",b,j);const V=b.slice(),X=b[j-1];V[j-1]=X&-129;const G=Ee(V);G===Ht||(L?v(G,u):v(G,e.ORDER));const W=f(G*G),dt=f(W-Rt),st=f(N*W-$);let{isValid:wt,value:bt}=l(dt,st);if(!wt)throw new Error("Point.fromHex: invalid y coordinate");const It=(bt&Rt)===Rt,ft=(X&128)!==0;if(!L&&bt===Ht&&ft)throw new Error("Point.fromHex: x=0 and x_0=1");return ft!==It&&(bt=f(-bt)),B.fromAffine({x:bt,y:G})}static fromPrivateKey(b){return q(b).point}toRawBytes(){const{x:b,y:L}=this.toAffine(),N=Ce(L,e.BYTES);return N[N.length-1]|=b&Rt?128:0,N}toHex(){return pe(this.toRawBytes())}}B.BASE=new B(t.Gx,t.Gy,Rt,f(t.Gx*t.Gy)),B.ZERO=new B(Ht,Rt,Rt,Ht);const{BASE:_,ZERO:T}=B,C=Xr(B,c*8);function et(I){return nt(I,r)}function K(I){return et(Ee(I))}function q(I){const b=c;I=pt("private key",I,b);const L=pt("hashed private key",s(I),2*b),N=E(L.slice(0,b)),$=L.slice(b,2*b),j=K(N),V=_.multiply(j),X=V.toRawBytes();return{head:N,prefix:$,scalar:j,point:V,pointBytes:X}}function lt(I){return q(I).pointBytes}function ut(I=new Uint8Array,...b){const L=ye(...b);return K(s(x(L,pt("context",I),!!o)))}function Ft(I,b,L={}){I=pt("message",I),o&&(I=o(I));const{prefix:N,scalar:$,pointBytes:j}=q(b),V=ut(L.context,N,I),X=_.multiply(V).toRawBytes(),G=ut(L.context,X,j,I),W=et(V+G*$);U(W);const dt=ye(X,Ce(W,e.BYTES));return pt("result",dt,c*2)}const A=Ui;function k(I,b,L,N=A){const{context:$,zip215:j}=N,V=e.BYTES;I=pt("signature",I,2*V),b=pt("message",b),o&&(b=o(b));const X=Ee(I.slice(V,2*V));let G,W,dt;try{G=B.fromHex(L,j),W=B.fromHex(I.slice(0,V),j),dt=_.multiplyUnsafe(X)}catch{return!1}if(!j&&G.isSmallOrder())return!1;const st=ut($,W.toRawBytes(),G.toRawBytes(),b);return W.add(G.multiplyUnsafe(st)).subtract(dt).clearCofactor().equals(B.ZERO)}return _._setWindowSize(8),{CURVE:t,getPublicKey:lt,sign:Ft,verify:k,ExtendedPoint:B,utils:{getExtendedPublicKey:q,randomPrivateKey:()=>i(e.BYTES),precompute(I=8,b=B.BASE){return b._setWindowSize(I),b.multiply(BigInt(3)),b}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Er=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Ri=BigInt(1),Br=BigInt(2);BigInt(3);const Li=BigInt(5),ki=BigInt(8);function Fi(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),o=BigInt(80),s=Mn,c=n*n%s*n%s,a=it(c,Br,s)*c%s,u=it(a,Ri,s)*n%s,f=it(u,Li,s)*u%s,l=it(f,t,s)*f%s,E=it(l,e,s)*l%s,x=it(E,r,s)*E%s,w=it(x,o,s)*x%s,y=it(w,o,s)*x%s,p=it(y,t,s)*f%s;return{pow_p_5_8:it(p,Br,s)*n%s,b2:c}}function Ti(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}function Ci(n,t){const e=Mn,r=nt(t*t*t,e),o=nt(r*r*t,e),s=Fi(n*o).pow_p_5_8;let i=nt(n*r*s,e);const c=nt(t*i*i,e),a=i,u=nt(i*Er,e),f=c===n,l=c===nt(-n,e),E=c===nt(-n*Er,e);return f&&(i=a),(l||E)&&(i=u),mi(i,e)&&(i=nt(-i,e)),{isValid:f||l,value:i}}const Ni=Kr(Mn,void 0,!0),Di={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ni,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:ki,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:oi,randomBytes:Pr,adjustScalarBytes:Ti,uvRatio:Ci},zi=Oi(Di);var je=is.Buffer;function Hi(n){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e<t.length;e++)t[e]=255;for(var r=0;r<n.length;r++){var o=n.charAt(r),s=o.charCodeAt(0);if(t[s]!==255)throw new TypeError(o+" is ambiguous");t[s]=r}var i=n.length,c=n.charAt(0),a=Math.log(i)/Math.log(256),u=Math.log(256)/Math.log(i);function f(x){if((Array.isArray(x)||x instanceof Uint8Array)&&(x=je.from(x)),!je.isBuffer(x))throw new TypeError("Expected Buffer");if(x.length===0)return"";for(var w=0,y=0,p=0,v=x.length;p!==v&&x[p]===0;)p++,w++;for(var U=(v-p)*u+1>>>0,g=new Uint8Array(U);p!==v;){for(var F=x[p],B=0,_=U-1;(F!==0||B<y)&&_!==-1;_--,B++)F+=256*g[_]>>>0,g[_]=F%i>>>0,F=F/i>>>0;if(F!==0)throw new Error("Non-zero carry");y=B,p++}for(var T=U-y;T!==U&&g[T]===0;)T++;for(var C=c.repeat(w);T<U;++T)C+=n.charAt(g[T]);return C}function l(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return je.alloc(0);for(var w=0,y=0,p=0;x[w]===c;)y++,w++;for(var v=(x.length-w)*a+1>>>0,U=new Uint8Array(v);w<x.length;){var g=t[x.charCodeAt(w)];if(g===255)return;for(var F=0,B=v-1;(g!==0||F<p)&&B!==-1;B--,F++)g+=i*U[B]>>>0,U[B]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");p=F,w++}for(var _=v-p;_!==v&&U[_]===0;)_++;var T=je.allocUnsafe(y+(v-_));T.fill(0,0,y);for(var C=y;_!==v;)T[C++]=U[_++];return T}function E(x){var w=l(x);if(w)return w;throw new Error("Non-base"+i+" character")}return{encode:f,decodeUnsafe:l,decode:E}}var $i=Hi,Pi=$i,qi="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Jr=Pi(qi);const Sr=as(Jr),Mi=new Uint32Array([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]),te=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ee=new Uint32Array(64);class ji extends qr{constructor(){super(64,32,8,!1),this.A=te[0]|0,this.B=te[1]|0,this.C=te[2]|0,this.D=te[3]|0,this.E=te[4]|0,this.F=te[5]|0,this.G=te[6]|0,this.H=te[7]|0}get(){const{A:t,B:e,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,e,r,o,s,i,c,a]}set(t,e,r,o,s,i,c,a){this.A=t|0,this.B=e|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,e){for(let l=0;l<16;l++,e+=4)ee[l]=t.getUint32(e,!1);for(let l=16;l<64;l++){const E=ee[l-15],x=ee[l-2],w=Mt(E,7)^Mt(E,18)^E>>>3,y=Mt(x,17)^Mt(x,19)^x>>>10;ee[l]=y+ee[l-7]+w+ee[l-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:f}=this;for(let l=0;l<64;l++){const E=Mt(c,6)^Mt(c,11)^Mt(c,25),x=f+E+ks(c,a,u)+Mi[l]+ee[l]|0,y=(Mt(r,2)^Mt(r,13)^Mt(r,22))+Fs(r,o,s)|0;f=u,u=a,a=c,c=i+x|0,i=s,s=o,o=r,r=x+y|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,o,s,i,c,a,u,f)}roundClean(){ee.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Tn=$r(()=>new ji);var vt={};function Yt(n,t,e){return t<=n&&n<=e}function cn(n){if(n===void 0)return{};if(n===Object(n))return n;throw TypeError("Could not convert argument to dictionary")}function Vi(n){for(var t=String(n),e=t.length,r=0,o=[];r<e;){var s=t.charCodeAt(r);if(s<55296||s>57343)o.push(s);else if(56320<=s&&s<=57343)o.push(65533);else if(55296<=s&&s<=56319)if(r===e-1)o.push(65533);else{var i=n.charCodeAt(r+1);if(56320<=i&&i<=57343){var c=s&1023,a=i&1023;o.push(65536+(c<<10)+a),r+=1}else o.push(65533)}r+=1}return o}function Gi(n){for(var t="",e=0;e<n.length;++e){var r=n[e];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return t}var Xe=-1;function jn(n){this.tokens=[].slice.call(n)}jn.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():Xe},prepend:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(n)},push:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.push(t.shift());else this.tokens.push(n)}};var Ae=-1;function Bn(n,t){if(n)throw TypeError("Decoder error");return t||65533}var Je="utf-8";function Qe(n,t){if(!(this instanceof Qe))return new Qe(n,t);if(n=n!==void 0?String(n).toLowerCase():Je,n!==Je)throw new Error("Encoding not supported. Only utf-8 is supported");t=cn(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}Qe.prototype={decode:function(t,e){var r;typeof t=="object"&&t instanceof ArrayBuffer?r=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):r=new Uint8Array(0),e=cn(e),this._streaming||(this._decoder=new Zi({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var o=new jn(r),s=[],i;!o.endOfStream()&&(i=this._decoder.handler(o,o.read()),i!==Ae);)i!==null&&(Array.isArray(i)?s.push.apply(s,i):s.push(i));if(!this._streaming){do{if(i=this._decoder.handler(o,o.read()),i===Ae)break;i!==null&&(Array.isArray(i)?s.push.apply(s,i):s.push(i))}while(!o.endOfStream());this._decoder=null}return s.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(s[0]===65279?(this._BOMseen=!0,s.shift()):this._BOMseen=!0),Gi(s)}};function tn(n,t){if(!(this instanceof tn))return new tn(n,t);if(n=n!==void 0?String(n).toLowerCase():Je,n!==Je)throw new Error("Encoding not supported. Only utf-8 is supported");t=cn(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}tn.prototype={encode:function(t,e){t=t?String(t):"",e=cn(e),this._streaming||(this._encoder=new Ki(this._options)),this._streaming=!!e.stream;for(var r=[],o=new jn(Vi(t)),s;!o.endOfStream()&&(s=this._encoder.handler(o,o.read()),s!==Ae);)Array.isArray(s)?r.push.apply(r,s):r.push(s);if(!this._streaming){for(;s=this._encoder.handler(o,o.read()),s!==Ae;)Array.isArray(s)?r.push.apply(r,s):r.push(s);this._encoder=null}return new Uint8Array(r)}};function Zi(n){var t=n.fatal,e=0,r=0,o=0,s=128,i=191;this.handler=function(c,a){if(a===Xe&&o!==0)return o=0,Bn(t);if(a===Xe)return Ae;if(o===0){if(Yt(a,0,127))return a;if(Yt(a,194,223))o=1,e=a-192;else if(Yt(a,224,239))a===224&&(s=160),a===237&&(i=159),o=2,e=a-224;else if(Yt(a,240,244))a===240&&(s=144),a===244&&(i=143),o=3,e=a-240;else return Bn(t);return e=e<<6*o,null}if(!Yt(a,s,i))return e=o=r=0,s=128,i=191,c.prepend(a),Bn(t);if(s=128,i=191,r+=1,e+=a-128<<6*(o-r),r!==o)return null;var u=e;return e=o=r=0,u}}function Ki(n){n.fatal,this.handler=function(t,e){if(e===Xe)return Ae;if(Yt(e,0,127))return e;var r,o;Yt(e,128,2047)?(r=1,o=192):Yt(e,2048,65535)?(r=2,o=224):Yt(e,65536,1114111)&&(r=3,o=240);for(var s=[(e>>6*r)+o];r>0;){var i=e>>6*(r-1);s.push(128|i&63),r-=1}return s}}const Wi=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:Qe,TextEncoder:tn},Symbol.toStringTag,{value:"Module"})),Yi=Fr(Wi);var Xi=jt&&jt.__createBinding||(Object.create?function(n,t,e,r){r===void 0&&(r=e),Object.defineProperty(n,r,{enumerable:!0,get:function(){return t[e]}})}:function(n,t,e,r){r===void 0&&(r=e),n[r]=t[e]}),Ji=jt&&jt.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),Gt=jt&&jt.__decorate||function(n,t,e,r){var o=arguments.length,s=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(i=n[c])&&(s=(o<3?i(s):o>3?i(t,e,s):i(t,e))||s);return o>3&&s&&Object.defineProperty(t,e,s),s},Qi=jt&&jt.__importStar||function(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)e!=="default"&&Object.hasOwnProperty.call(n,e)&&Xi(t,n,e);return Ji(t,n),t},Qr=jt&&jt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(vt,"__esModule",{value:!0});var to=vt.deserializeUnchecked=io=vt.deserialize=so=vt.serialize=vt.BinaryReader=vt.BinaryWriter=vt.BorshError=vt.baseDecode=vt.baseEncode=void 0;const ne=Qr(cs),eo=Qr(Jr),ta=Qi(Yi),ea=typeof TextDecoder!="function"?ta.TextDecoder:TextDecoder,na=new ea("utf-8",{fatal:!0});function ra(n){return typeof n=="string"&&(n=yt.from(n,"utf8")),eo.default.encode(yt.from(n))}vt.baseEncode=ra;function oa(n){return yt.from(eo.default.decode(n))}vt.baseDecode=oa;const Sn=1024;class Ut extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}vt.BorshError=Ut;class no{constructor(){this.buf=yt.alloc(Sn),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=yt.concat([this.buf,yt.alloc(Sn)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(yt.from(new ne.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(yt.from(new ne.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(yt.from(new ne.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(yt.from(new ne.default(t).toArray("le",64)))}writeBuffer(t){this.buf=yt.concat([yt.from(this.buf.subarray(0,this.length)),t,yt.alloc(Sn)]),this.length+=t.length}writeString(t){this.maybeResize();const e=yt.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(yt.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const r of t)this.maybeResize(),e(r)}toArray(){return this.buf.subarray(0,this.length)}}vt.BinaryWriter=no;function Zt(n,t,e){const r=e.value;e.value=function(...o){try{return r.apply(this,o)}catch(s){if(s instanceof RangeError){const i=s.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(i)>=0)throw new Ut("Reached the end of buffer when deserializing")}throw s}}}class kt{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new ne.default(t,"le")}readU128(){const t=this.readBuffer(16);return new ne.default(t,"le")}readU256(){const t=this.readBuffer(32);return new ne.default(t,"le")}readU512(){const t=this.readBuffer(64);return new ne.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new Ut(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return na.decode(e)}catch(r){throw new Ut(`Error decoding UTF-8 string: ${r}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),r=Array();for(let o=0;o<e;++o)r.push(t());return r}}Gt([Zt],kt.prototype,"readU8",null);Gt([Zt],kt.prototype,"readU16",null);Gt([Zt],kt.prototype,"readU32",null);Gt([Zt],kt.prototype,"readU64",null);Gt([Zt],kt.prototype,"readU128",null);Gt([Zt],kt.prototype,"readU256",null);Gt([Zt],kt.prototype,"readU512",null);Gt([Zt],kt.prototype,"readString",null);Gt([Zt],kt.prototype,"readFixedArray",null);Gt([Zt],kt.prototype,"readArray",null);vt.BinaryReader=kt;function ro(n){return n.charAt(0).toUpperCase()+n.slice(1)}function ae(n,t,e,r,o){try{if(typeof r=="string")o[`write${ro(r)}`](e);else if(r instanceof Array)if(typeof r[0]=="number"){if(e.length!==r[0])throw new Ut(`Expecting byte array of length ${r[0]}, but got ${e.length} bytes`);o.writeFixedArray(e)}else if(r.length===2&&typeof r[1]=="number"){if(e.length!==r[1])throw new Ut(`Expecting byte array of length ${r[1]}, but got ${e.length} bytes`);for(let s=0;s<r[1];s++)ae(n,null,e[s],r[0],o)}else o.writeArray(e,s=>{ae(n,t,s,r[0],o)});else if(r.kind!==void 0)switch(r.kind){case"option":{e==null?o.writeU8(0):(o.writeU8(1),ae(n,t,e,r.type,o));break}case"map":{o.writeU32(e.size),e.forEach((s,i)=>{ae(n,t,i,r.key,o),ae(n,t,s,r.value,o)});break}default:throw new Ut(`FieldType ${r} unrecognized`)}else oo(n,e,o)}catch(s){throw s instanceof Ut&&s.addToFieldPath(t),s}}function oo(n,t,e){if(typeof t.borshSerialize=="function"){t.borshSerialize(e);return}const r=n.get(t.constructor);if(!r)throw new Ut(`Class ${t.constructor.name} is missing in schema`);if(r.kind==="struct")r.fields.map(([o,s])=>{ae(n,o,t[o],s,e)});else if(r.kind==="enum"){const o=t[r.field];for(let s=0;s<r.values.length;++s){const[i,c]=r.values[s];if(i===o){e.writeU8(s),ae(n,i,t[i],c,e);break}}}else throw new Ut(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}function sa(n,t,e=no){const r=new e;return oo(n,t,r),r.toArray()}var so=vt.serialize=sa;function ce(n,t,e,r){try{if(typeof e=="string")return r[`read${ro(e)}`]();if(e instanceof Array){if(typeof e[0]=="number")return r.readFixedArray(e[0]);if(typeof e[1]=="number"){const o=[];for(let s=0;s<e[1];s++)o.push(ce(n,null,e[0],r));return o}else return r.readArray(()=>ce(n,t,e[0],r))}if(e.kind==="option")return r.readU8()?ce(n,t,e.type,r):void 0;if(e.kind==="map"){let o=new Map;const s=r.readU32();for(let i=0;i<s;i++){const c=ce(n,t,e.key,r),a=ce(n,t,e.value,r);o.set(c,a)}return o}return Vn(n,e,r)}catch(o){throw o instanceof Ut&&o.addToFieldPath(t),o}}function Vn(n,t,e){if(typeof t.borshDeserialize=="function")return t.borshDeserialize(e);const r=n.get(t);if(!r)throw new Ut(`Class ${t.name} is missing in schema`);if(r.kind==="struct"){const o={};for(const[s,i]of n.get(t).fields)o[s]=ce(n,s,i,e);return new t(o)}if(r.kind==="enum"){const o=e.readU8();if(o>=r.values.length)throw new Ut(`Enum index: ${o} is out of range`);const[s,i]=r.values[o],c=ce(n,s,i,e);return new t({[s]:c})}throw new Ut(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}function ia(n,t,e,r=kt){const o=new r(e),s=Vn(n,t,o);if(o.offset<e.length)throw new Ut(`Unexpected ${e.length-o.offset} bytes after deserialized data`);return s}var io=vt.deserialize=ia;function aa(n,t,e,r=kt){const o=new r(e);return Vn(n,t,o)}to=vt.deserializeUnchecked=aa;var h={};Object.defineProperty(h,"__esModule",{value:!0});h.s16=h.s8=h.nu64be=h.u48be=h.u40be=h.u32be=h.u24be=h.u16be=xt=h.nu64=h.u48=h.u40=D=h.u32=h.u24=Ct=h.u16=ht=h.u8=de=h.offset=h.greedy=h.Constant=h.UTF8=h.CString=h.Blob=h.Boolean=h.BitField=h.BitStructure=h.VariantLayout=h.Union=h.UnionLayoutDiscriminator=h.UnionDiscriminator=h.Structure=h.Sequence=h.DoubleBE=h.Double=h.FloatBE=h.Float=h.NearInt64BE=h.NearInt64=h.NearUInt64BE=h.NearUInt64=h.IntBE=h.Int=h.UIntBE=h.UInt=h.OffsetLayout=h.GreedyCount=h.ExternalLayout=h.bindConstructorLayout=h.nameWithProperty=h.Layout=h.uint8ArrayToBuffer=h.checkUint8Array=void 0;h.constant=h.utf8=h.cstr=Ie=h.blob=h.unionLayoutDiscriminator=h.union=ue=h.seq=h.bits=z=h.struct=h.f64be=h.f64=h.f32be=h.f32=h.ns64be=h.s48be=h.s40be=h.s32be=h.s24be=h.s16be=Lt=h.ns64=h.s48=h.s40=h.s32=h.s24=void 0;const Gn=us;function Re(n){if(!(n instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}h.checkUint8Array=Re;function Y(n){return Re(n),Gn.Buffer.from(n.buffer,n.byteOffset,n.length)}h.uint8ArrayToBuffer=Y;class Q{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}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){}}h.Layout=Q;function Zn(n,t){return t.property?n+"["+t.property+"]":n}h.nameWithProperty=Zn;function ca(n,t){if(typeof n!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(n,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Q))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");n.layout_=t,t.boundConstructor_=n,t.makeDestinationObject=()=>new n,Object.defineProperty(n.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(n,"decode",{value(e,r){return t.decode(e,r)},writable:!0})}h.bindConstructorLayout=ca;class Ot extends Q{isCount(){throw new Error("ExternalLayout is abstract")}}h.ExternalLayout=Ot;class ao extends Ot{constructor(t=1,e){if(!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=0){Re(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}h.GreedyCount=ao;class Kn extends Ot{constructor(t,e=0,r){if(!(t instanceof Q))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Nt||this.layout instanceof $t}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}h.OffsetLayout=Kn;class Nt extends Q{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Y(t).readUIntLE(e,this.span)}encode(t,e,r=0){return Y(e).writeUIntLE(t,r,this.span),this.span}}h.UInt=Nt;class $t extends Q{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Y(t).readUIntBE(e,this.span)}encode(t,e,r=0){return Y(e).writeUIntBE(t,r,this.span),this.span}}h.UIntBE=$t;class ge extends Q{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Y(t).readIntLE(e,this.span)}encode(t,e,r=0){return Y(e).writeIntLE(t,r,this.span),this.span}}h.Int=ge;class Le extends Q{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Y(t).readIntBE(e,this.span)}encode(t,e,r=0){return Y(e).writeIntBE(t,r,this.span),this.span}}h.IntBE=Le;const Cn=Math.pow(2,32);function un(n){const t=Math.floor(n/Cn),e=n-t*Cn;return{hi32:t,lo32:e}}function fn(n,t){return n*Cn+t}class co extends Q{constructor(t){super(8,t)}decode(t,e=0){const r=Y(t),o=r.readUInt32LE(e),s=r.readUInt32LE(e+4);return fn(s,o)}encode(t,e,r=0){const o=un(t),s=Y(e);return s.writeUInt32LE(o.lo32,r),s.writeUInt32LE(o.hi32,r+4),8}}h.NearUInt64=co;class uo extends Q{constructor(t){super(8,t)}decode(t,e=0){const r=Y(t),o=r.readUInt32BE(e),s=r.readUInt32BE(e+4);return fn(o,s)}encode(t,e,r=0){const o=un(t),s=Y(e);return s.writeUInt32BE(o.hi32,r),s.writeUInt32BE(o.lo32,r+4),8}}h.NearUInt64BE=uo;class fo extends Q{constructor(t){super(8,t)}decode(t,e=0){const r=Y(t),o=r.readUInt32LE(e),s=r.readInt32LE(e+4);return fn(s,o)}encode(t,e,r=0){const o=un(t),s=Y(e);return s.writeUInt32LE(o.lo32,r),s.writeInt32LE(o.hi32,r+4),8}}h.NearInt64=fo;class lo extends Q{constructor(t){super(8,t)}decode(t,e=0){const r=Y(t),o=r.readInt32BE(e),s=r.readUInt32BE(e+4);return fn(o,s)}encode(t,e,r=0){const o=un(t),s=Y(e);return s.writeInt32BE(o.hi32,r),s.writeUInt32BE(o.lo32,r+4),8}}h.NearInt64BE=lo;class ho extends Q{constructor(t){super(4,t)}decode(t,e=0){return Y(t).readFloatLE(e)}encode(t,e,r=0){return Y(e).writeFloatLE(t,r),4}}h.Float=ho;class po extends Q{constructor(t){super(4,t)}decode(t,e=0){return Y(t).readFloatBE(e)}encode(t,e,r=0){return Y(e).writeFloatBE(t,r),4}}h.FloatBE=po;class yo extends Q{constructor(t){super(8,t)}decode(t,e=0){return Y(t).readDoubleLE(e)}encode(t,e,r=0){return Y(e).writeDoubleLE(t,r),8}}h.Double=yo;class go extends Q{constructor(t){super(8,t)}decode(t,e=0){return Y(t).readDoubleBE(e)}encode(t,e,r=0){return Y(e).writeDoubleBE(t,r),8}}h.DoubleBE=go;class wo extends Q{constructor(t,e,r){if(!(t instanceof Q))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof Ot&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let o=-1;!(e instanceof Ot)&&0<t.span&&(o=e*t.span),super(o,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,o=this.count;if(o instanceof Ot&&(o=o.decode(t,e)),0<this.elementLayout.span)r=o*this.elementLayout.span;else{let s=0;for(;s<o;)r+=this.elementLayout.getSpan(t,e+r),++s}return r}decode(t,e=0){const r=[];let o=0,s=this.count;for(s instanceof Ot&&(s=s.decode(t,e));o<s;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),o+=1;return r}encode(t,e,r=0){const o=this.elementLayout,s=t.reduce((i,c)=>i+o.encode(c,e,r+i),0);return this.count instanceof Ot&&this.count.encode(t.length,e,r),s}}h.Sequence=wo;class bo extends Q{constructor(t,e,r){if(!(Array.isArray(t)&&t.reduce((s,i)=>s&&i instanceof Q,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&r===void 0&&(r=e,e=void 0);for(const s of t)if(0>s.span&&s.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=t.reduce((s,i)=>s+i.getSpan(),0)}catch{}super(o,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((o,s)=>{const i=s.getSpan(t,e);return e+=i,o+i},0)}catch{throw new RangeError("indeterminate span")}return r}decode(t,e=0){Re(t);const r=this.makeDestinationObject();for(const o of this.fields)if(o.property!==void 0&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){const o=r;let s=0,i=0;for(const c of this.fields){let a=c.span;if(i=0<a?a:0,c.property!==void 0){const u=t[c.property];u!==void 0&&(i=c.encode(u,e,r),0>a&&(a=c.getSpan(e,r)))}s=r,r+=a}return s+i-o}fromArray(t){const e=this.makeDestinationObject();for(const r of this.fields)r.property!==void 0&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let e=0;for(const r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}h.Structure=bo;class Wn{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}h.UnionDiscriminator=Wn;class en extends Wn{constructor(t,e){if(!(t instanceof Ot&&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,r){return this.layout.encode(t,e,r)}}h.UnionLayoutDiscriminator=en;class Yn extends Q{constructor(t,e,r){let o;if(t instanceof Nt||t instanceof $t)o=new en(new Kn(t));else if(t instanceof Ot&&t.isCount())o=new en(t);else if(t instanceof Wn)o=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Q))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let s=-1;e&&(s=e.span,0<=s&&(t instanceof Nt||t instanceof $t)&&(s+=o.layout.span)),super(s,r),this.discriminator=o,this.usesPrefixDiscriminator=t instanceof Nt||t instanceof $t,this.defaultLayout=e,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return i(c)},this.configGetSourceVariant=function(c){i=c.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const r=this.getVariant(t,e);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}decode(t,e=0){let r;const o=this.discriminator,s=o.decode(t,e),i=this.registry[s];if(i===void 0){const c=this.defaultLayout;let a=0;this.usesPrefixDiscriminator&&(a=o.layout.span),r=this.makeDestinationObject(),r[o.property]=s,r[c.property]=c.decode(t,e+a)}else r=i.decode(t,e);return r}encode(t,e,r=0){const o=this.getSourceVariant(t);if(o===void 0){const s=this.discriminator,i=this.defaultLayout;let c=0;return this.usesPrefixDiscriminator&&(c=s.layout.span),s.encode(t[s.property],e,r),c+i.encode(t[i.property],e,r+c)}return o.encode(t,e,r)}addVariant(t,e,r){const o=new mo(this,t,e,r);return this.registry[t]=o,o}getVariant(t,e=0){let r;return t instanceof Uint8Array?r=this.discriminator.decode(t,e):r=t,this.registry[r]}}h.Union=Yn;class mo extends Q{constructor(t,e,r,o){if(!(t instanceof Yn))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(typeof r=="string"&&o===void 0&&(o=r,r=null),r){if(!(r instanceof Q))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=r.span&&r.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let s=t.span;0>t.span&&(s=r?r.span:0,0<=s&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span)),super(s,o),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(t,e+r)),r+o}decode(t,e=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+o):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let s=o;if(this.layout&&(this.layout.encode(t[this.property],e,r+o),s+=this.layout.getSpan(e,r+o),0<=this.union.span&&s>this.union.span))throw new Error("encoded variant overruns containing union");return s}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}h.VariantLayout=mo;function xe(n){return 0>n&&(n+=4294967296),n}class Xn extends Q{constructor(t,e,r){if(!(t instanceof Nt||t instanceof $t))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&r===void 0&&(r=e,e=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let o=0;this._packedSetValue=function(s){return o=xe(s),this},this._packedGetValue=function(){return o}}decode(t,e=0){const r=this.makeDestinationObject(),o=this.word.decode(t,e);this._packedSetValue(o);for(const s of this.fields)s.property!==void 0&&(r[s.property]=s.decode(t));return r}encode(t,e,r=0){const o=this.word.decode(e,r);this._packedSetValue(o);for(const s of this.fields)if(s.property!==void 0){const i=t[s.property];i!==void 0&&s.encode(i)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){const r=new Jn(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new xo(this,t);return this.fields.push(e),e}fieldFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}h.BitStructure=Xn;class Jn{constructor(t,e,r){if(!(t instanceof Xn))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const o=8*t.span,s=t.fields.reduce((i,c)=>i+c.bits,0);if(e+s>o)throw new Error("bits too long for span remainder ("+(o-s)+" of "+o+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,e===32&&(this.valueMask=4294967295),this.start=s,this.container.msb&&(this.start=o-s-e),this.wordMask=xe(this.valueMask<<this.start),this.property=r}decode(t,e){const r=this.container._packedGetValue();return xe(r&this.wordMask)>>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==xe(t&this.valueMask))throw new TypeError(Zn("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=xe(t<<this.start);this.container._packedSetValue(xe(e&~this.wordMask)|r)}}h.BitField=Jn;let xo=class extends Jn{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){typeof t=="boolean"&&(t=+t),super.encode(t)}};h.Boolean=xo;class vo extends Q{constructor(t,e){if(!(t instanceof Ot&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof Ot||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),Y(t).slice(e,e+r)}encode(t,e,r){let o=this.length;if(this.length instanceof Ot&&(o=t.length),!(t instanceof Uint8Array&&o===t.length))throw new TypeError(Zn("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(r+o>e.length)throw new RangeError("encoding overruns Uint8Array");const s=Y(t);return Y(e).write(s.toString("hex"),r,o,"hex"),this.length instanceof Ot&&this.length.encode(o,e,r),o}}h.Blob=vo;class Eo extends Q{constructor(t){super(-1,t)}getSpan(t,e=0){Re(t);let r=e;for(;r<t.length&&t[r]!==0;)r+=1;return 1+r-e}decode(t,e=0){const r=this.getSpan(t,e);return Y(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){typeof t!="string"&&(t=String(t));const o=Gn.Buffer.from(t,"utf8"),s=o.length;if(r+s>e.length)throw new RangeError("encoding overruns Buffer");const i=Y(e);return o.copy(i,r),i[r+s]=0,s+1}}h.CString=Eo;class Bo extends Q{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return Re(t),t.length-e}decode(t,e=0){const r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return Y(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){typeof t!="string"&&(t=String(t));const o=Gn.Buffer.from(t,"utf8"),s=o.length;if(0<=this.maxSpan&&this.maxSpan<s)throw new RangeError("text length exceeds maxSpan");if(r+s>e.length)throw new RangeError("encoding overruns Buffer");return o.copy(Y(e),r),s}}h.UTF8=Bo;class So extends Q{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}h.Constant=So;h.greedy=(n,t)=>new ao(n,t);var de=h.offset=(n,t,e)=>new Kn(n,t,e),ht=h.u8=n=>new Nt(1,n),Ct=h.u16=n=>new Nt(2,n);h.u24=n=>new Nt(3,n);var D=h.u32=n=>new Nt(4,n);h.u40=n=>new Nt(5,n);h.u48=n=>new Nt(6,n);var xt=h.nu64=n=>new co(n);h.u16be=n=>new $t(2,n);h.u24be=n=>new $t(3,n);h.u32be=n=>new $t(4,n);h.u40be=n=>new $t(5,n);h.u48be=n=>new $t(6,n);h.nu64be=n=>new uo(n);h.s8=n=>new ge(1,n);h.s16=n=>new ge(2,n);h.s24=n=>new ge(3,n);h.s32=n=>new ge(4,n);h.s40=n=>new ge(5,n);h.s48=n=>new ge(6,n);var Lt=h.ns64=n=>new fo(n);h.s16be=n=>new Le(2,n);h.s24be=n=>new Le(3,n);h.s32be=n=>new Le(4,n);h.s40be=n=>new Le(5,n);h.s48be=n=>new Le(6,n);h.ns64be=n=>new lo(n);h.f32=n=>new ho(n);h.f32be=n=>new po(n);h.f64=n=>new yo(n);h.f64be=n=>new go(n);var z=h.struct=(n,t,e)=>new bo(n,t,e);h.bits=(n,t,e)=>new Xn(n,t,e);var ue=h.seq=(n,t,e)=>new wo(n,t,e);h.union=(n,t,e)=>new Yn(n,t,e);h.unionLayoutDiscriminator=(n,t)=>new en(n,t);var Ie=h.blob=(n,t)=>new vo(n,t);h.cstr=n=>new Eo(n);h.utf8=(n,t)=>new Bo(n,t);h.constant=(n,t)=>new So(n,t);var ze={};Object.defineProperty(ze,"__esModule",{value:!0});function ua(n){{const t=yt.from(n);t.reverse();const e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}}var fa=ze.toBigIntLE=ua;function la(n){{const t=n.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}ze.toBigIntBE=la;function da(n,t){{const e=n.toString(16),r=yt.from(e.padStart(t*2,"0").slice(0,t*2),"hex");return r.reverse(),r}}var ha=ze.toBufferLE=da;function pa(n,t){{const e=n.toString(16);return yt.from(e.padStart(t*2,"0").slice(0,t*2),"hex")}}ze.toBufferBE=pa;class ya extends TypeError{constructor(t,e){let r;const{message:o,explanation:s,...i}=t,{path:c}=t,a=c.length===0?o:`At path: ${c.join(".")} -- ${o}`;super(s??a),s!=null&&(this.cause=a),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...e()])}}function ga(n){return He(n)&&typeof n[Symbol.iterator]=="function"}function He(n){return typeof n=="object"&&n!=null}function nn(n){return He(n)&&!Array.isArray(n)}function Pt(n){return typeof n=="symbol"?n.toString():typeof n=="string"?JSON.stringify(n):`${n}`}function wa(n){const{done:t,value:e}=n.next();return t?void 0:e}function ba(n,t,e,r){if(n===!0)return;n===!1?n={}:typeof n=="string"&&(n={message:n});const{path:o,branch:s}=t,{type:i}=e,{refinement:c,message:a=`Expected a value of type \`${i}\`${c?` with refinement \`${c}\``:""}, but received: \`${Pt(r)}\``}=n;return{value:r,type:i,refinement:c,key:o[o.length-1],path:o,branch:s,...n,message:a}}function*Ar(n,t,e,r){ga(n)||(n=[n]);for(const o of n){const s=ba(o,t,e,r);s&&(yield s)}}function*Qn(n,t,e={}){const{path:r=[],branch:o=[n],coerce:s=!1,mask:i=!1}=e,c={path:r,branch:o,mask:i};s&&(n=t.coercer(n,c));let a="valid";for(const u of t.validator(n,c))u.explanation=e.message,a="not_valid",yield[u,void 0];for(let[u,f,l]of t.entries(n,c)){const E=Qn(f,l,{path:u===void 0?r:[...r,u],branch:u===void 0?o:[...o,f],coerce:s,mask:i,message:e.message});for(const x of E)x[0]?(a=x[0].refinement!=null?"not_refined":"not_valid",yield[x[0],void 0]):s&&(f=x[1],u===void 0?n=f:n instanceof Map?n.set(u,f):n instanceof Set?n.add(f):He(n)&&(f!==void 0||u in n)&&(n[u]=f))}if(a!=="not_valid")for(const u of t.refiner(n,c))u.explanation=e.message,a="not_refined",yield[u,void 0];a==="valid"&&(yield[void 0,n])}let Kt=class{constructor(t){const{type:e,schema:r,validator:o,refiner:s,coercer:i=a=>a,entries:c=function*(){}}=t;this.type=e,this.schema=r,this.entries=c,this.coercer=i,o?this.validator=(a,u)=>{const f=o(a,u);return Ar(f,u,this,a)}:this.validator=()=>[],s?this.refiner=(a,u)=>{const f=s(a,u);return Ar(f,u,this,a)}:this.refiner=()=>[]}assert(t,e){return ma(t,this,e)}create(t,e){return Ne(t,this,e)}is(t){return Ao(t,this)}mask(t,e){return xa(t,this,e)}validate(t,e={}){return $e(t,this,e)}};function ma(n,t,e){const r=$e(n,t,{message:e});if(r[0])throw r[0]}function Ne(n,t,e){const r=$e(n,t,{coerce:!0,message:e});if(r[0])throw r[0];return r[1]}function xa(n,t,e){const r=$e(n,t,{coerce:!0,mask:!0,message:e});if(r[0])throw r[0];return r[1]}function Ao(n,t){return!$e(n,t)[0]}function $e(n,t,e={}){const r=Qn(n,t,e),o=wa(r);return o[0]?[new ya(o[0],function*(){for(const i of r)i[0]&&(yield i[0])}),void 0]:[void 0,o[1]]}function we(n,t){return new Kt({type:n,schema:null,validator:t})}function va(){return we("any",()=>!0)}function O(n){return new Kt({type:"array",schema:n,*entries(t){if(n&&Array.isArray(t))for(const[e,r]of t.entries())yield[e,r,n]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Pt(t)}`}})}function Vt(){return we("boolean",n=>typeof n=="boolean")}function tr(n){return we("instance",t=>t instanceof n||`Expected a \`${n.name}\` instance, but received: ${Pt(t)}`)}function rt(n){const t=Pt(n),e=typeof n;return new Kt({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?n:null,validator(r){return r===n||`Expected the literal \`${t}\`, but received: ${Pt(r)}`}})}function Ea(){return we("never",()=>!1)}function R(n){return new Kt({...n,validator:(t,e)=>t===null||n.validator(t,e),refiner:(t,e)=>t===null||n.refiner(t,e)})}function d(){return we("number",n=>typeof n=="number"&&!isNaN(n)||`Expected a number, but received: ${Pt(n)}`)}function H(n){return new Kt({...n,validator:(t,e)=>t===void 0||n.validator(t,e),refiner:(t,e)=>t===void 0||n.refiner(t,e)})}function Io(n,t){return new Kt({type:"record",schema:null,*entries(e){if(He(e))for(const r in e){const o=e[r];yield[r,r,n],yield[r,o,t]}},validator(e){return nn(e)||`Expected an object, but received: ${Pt(e)}`},coercer(e){return nn(e)?{...e}:e}})}function S(){return we("string",n=>typeof n=="string"||`Expected a string, but received: ${Pt(n)}`)}function er(n){const t=Ea();return new Kt({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const r=Math.max(n.length,e.length);for(let o=0;o<r;o++)yield[o,e[o],n[o]||t]}},validator(e){return Array.isArray(e)||`Expected an array, but received: ${Pt(e)}`},coercer(e){return Array.isArray(e)?e.slice():e}})}function m(n){const t=Object.keys(n);return new Kt({type:"type",schema:n,*entries(e){if(He(e))for(const r of t)yield[r,e[r],n[r]]},validator(e){return nn(e)||`Expected an object, but received: ${Pt(e)}`},coercer(e){return nn(e)?{...e}:e}})}function _t(n){const t=n.map(e=>e.type).join(" | ");return new Kt({type:"union",schema:null,coercer(e,r){for(const o of n){const[s,i]=o.validate(e,{coerce:!0,mask:r.mask});if(!s)return i}return e},validator(e,r){const o=[];for(const s of n){const[...i]=Qn(e,s,r),[c]=i;if(c[0])for(const[a]of i)a&&o.push(a);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Pt(e)}`,...o]}})}function ke(){return we("unknown",()=>!0)}function Pe(n,t,e){return new Kt({...n,coercer:(r,o)=>Ao(r,t)?n.coercer(e(r,o),o):n.coercer(r,o)})}var Ve,Ba=new Uint8Array(16);function Uo(){if(!Ve&&(Ve=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ve))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ve(Ba)}const Sa=/^(?:[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 ln(n){return typeof n=="string"&&Sa.test(n)}var mt=[];for(var An=0;An<256;++An)mt.push((An+256).toString(16).substr(1));function dn(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(mt[n[t+0]]+mt[n[t+1]]+mt[n[t+2]]+mt[n[t+3]]+"-"+mt[n[t+4]]+mt[n[t+5]]+"-"+mt[n[t+6]]+mt[n[t+7]]+"-"+mt[n[t+8]]+mt[n[t+9]]+"-"+mt[n[t+10]]+mt[n[t+11]]+mt[n[t+12]]+mt[n[t+13]]+mt[n[t+14]]+mt[n[t+15]]).toLowerCase();if(!ln(e))throw TypeError("Stringified UUID is invalid");return e}var Ir,In,Un=0,_n=0;function Aa(n,t,e){var r=t&&e||0,o=t||new Array(16);n=n||{};var s=n.node||Ir,i=n.clockseq!==void 0?n.clockseq:In;if(s==null||i==null){var c=n.random||(n.rng||Uo)();s==null&&(s=Ir=[c[0]|1,c[1],c[2],c[3],c[4],c[5]]),i==null&&(i=In=(c[6]<<8|c[7])&16383)}var a=n.msecs!==void 0?n.msecs:Date.now(),u=n.nsecs!==void 0?n.nsecs:_n+1,f=a-Un+(u-_n)/1e4;if(f<0&&n.clockseq===void 0&&(i=i+1&16383),(f<0||a>Un)&&n.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Un=a,_n=u,In=i,a+=122192928e5;var l=((a&268435455)*1e4+u)%4294967296;o[r++]=l>>>24&255,o[r++]=l>>>16&255,o[r++]=l>>>8&255,o[r++]=l&255;var E=a/4294967296*1e4&268435455;o[r++]=E>>>8&255,o[r++]=E&255,o[r++]=E>>>24&15|16,o[r++]=E>>>16&255,o[r++]=i>>>8|128,o[r++]=i&255;for(var x=0;x<6;++x)o[r+x]=s[x];return t||dn(o)}function _o(n){if(!ln(n))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(n.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(n.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(n.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(n.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(n.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}function Ia(n){n=unescape(encodeURIComponent(n));for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e));return t}var Ua="6ba7b810-9dad-11d1-80b4-00c04fd430c8",_a="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Oo(n,t,e){function r(o,s,i,c){if(typeof o=="string"&&(o=Ia(o)),typeof s=="string"&&(s=_o(s)),s.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+o.length);if(a.set(s),a.set(o,s.length),a=e(a),a[6]=a[6]&15|t,a[8]=a[8]&63|128,i){c=c||0;for(var u=0;u<16;++u)i[c+u]=a[u];return i}return dn(a)}try{r.name=n}catch{}return r.DNS=Ua,r.URL=_a,r}function Oa(n){if(typeof n=="string"){var t=unescape(encodeURIComponent(n));n=new Uint8Array(t.length);for(var e=0;e<t.length;++e)n[e]=t.charCodeAt(e)}return Ra(La(ka(n),n.length*8))}function Ra(n){for(var t=[],e=n.length*32,r="0123456789abcdef",o=0;o<e;o+=8){var s=n[o>>5]>>>o%32&255,i=parseInt(r.charAt(s>>>4&15)+r.charAt(s&15),16);t.push(i)}return t}function Ro(n){return(n+64>>>9<<4)+14+1}function La(n,t){n[t>>5]|=128<<t%32,n[Ro(t)-1]=t;for(var e=1732584193,r=-271733879,o=-1732584194,s=271733878,i=0;i<n.length;i+=16){var c=e,a=r,u=o,f=s;e=Et(e,r,o,s,n[i],7,-680876936),s=Et(s,e,r,o,n[i+1],12,-389564586),o=Et(o,s,e,r,n[i+2],17,606105819),r=Et(r,o,s,e,n[i+3],22,-1044525330),e=Et(e,r,o,s,n[i+4],7,-176418897),s=Et(s,e,r,o,n[i+5],12,1200080426),o=Et(o,s,e,r,n[i+6],17,-1473231341),r=Et(r,o,s,e,n[i+7],22,-45705983),e=Et(e,r,o,s,n[i+8],7,1770035416),s=Et(s,e,r,o,n[i+9],12,-1958414417),o=Et(o,s,e,r,n[i+10],17,-42063),r=Et(r,o,s,e,n[i+11],22,-1990404162),e=Et(e,r,o,s,n[i+12],7,1804603682),s=Et(s,e,r,o,n[i+13],12,-40341101),o=Et(o,s,e,r,n[i+14],17,-1502002290),r=Et(r,o,s,e,n[i+15],22,1236535329),e=Bt(e,r,o,s,n[i+1],5,-165796510),s=Bt(s,e,r,o,n[i+6],9,-1069501632),o=Bt(o,s,e,r,n[i+11],14,643717713),r=Bt(r,o,s,e,n[i],20,-373897302),e=Bt(e,r,o,s,n[i+5],5,-701558691),s=Bt(s,e,r,o,n[i+10],9,38016083),o=Bt(o,s,e,r,n[i+15],14,-660478335),r=Bt(r,o,s,e,n[i+4],20,-405537848),e=Bt(e,r,o,s,n[i+9],5,568446438),s=Bt(s,e,r,o,n[i+14],9,-1019803690),o=Bt(o,s,e,r,n[i+3],14,-187363961),r=Bt(r,o,s,e,n[i+8],20,1163531501),e=Bt(e,r,o,s,n[i+13],5,-1444681467),s=Bt(s,e,r,o,n[i+2],9,-51403784),o=Bt(o,s,e,r,n[i+7],14,1735328473),r=Bt(r,o,s,e,n[i+12],20,-1926607734),e=St(e,r,o,s,n[i+5],4,-378558),s=St(s,e,r,o,n[i+8],11,-2022574463),o=St(o,s,e,r,n[i+11],16,1839030562),r=St(r,o,s,e,n[i+14],23,-35309556),e=St(e,r,o,s,n[i+1],4,-1530992060),s=St(s,e,r,o,n[i+4],11,1272893353),o=St(o,s,e,r,n[i+7],16,-155497632),r=St(r,o,s,e,n[i+10],23,-1094730640),e=St(e,r,o,s,n[i+13],4,681279174),s=St(s,e,r,o,n[i],11,-358537222),o=St(o,s,e,r,n[i+3],16,-722521979),r=St(r,o,s,e,n[i+6],23,76029189),e=St(e,r,o,s,n[i+9],4,-640364487),s=St(s,e,r,o,n[i+12],11,-421815835),o=St(o,s,e,r,n[i+15],16,530742520),r=St(r,o,s,e,n[i+2],23,-995338651),e=At(e,r,o,s,n[i],6,-198630844),s=At(s,e,r,o,n[i+7],10,1126891415),o=At(o,s,e,r,n[i+14],15,-1416354905),r=At(r,o,s,e,n[i+5],21,-57434055),e=At(e,r,o,s,n[i+12],6,1700485571),s=At(s,e,r,o,n[i+3],10,-1894986606),o=At(o,s,e,r,n[i+10],15,-1051523),r=At(r,o,s,e,n[i+1],21,-2054922799),e=At(e,r,o,s,n[i+8],6,1873313359),s=At(s,e,r,o,n[i+15],10,-30611744),o=At(o,s,e,r,n[i+6],15,-1560198380),r=At(r,o,s,e,n[i+13],21,1309151649),e=At(e,r,o,s,n[i+4],6,-145523070),s=At(s,e,r,o,n[i+11],10,-1120210379),o=At(o,s,e,r,n[i+2],15,718787259),r=At(r,o,s,e,n[i+9],21,-343485551),e=re(e,c),r=re(r,a),o=re(o,u),s=re(s,f)}return[e,r,o,s]}function ka(n){if(n.length===0)return[];for(var t=n.length*8,e=new Uint32Array(Ro(t)),r=0;r<t;r+=8)e[r>>5]|=(n[r/8]&255)<<r%32;return e}function re(n,t){var e=(n&65535)+(t&65535),r=(n>>16)+(t>>16)+(e>>16);return r<<16|e&65535}function Fa(n,t){return n<<t|n>>>32-t}function hn(n,t,e,r,o,s){return re(Fa(re(re(t,n),re(r,s)),o),e)}function Et(n,t,e,r,o,s,i){return hn(t&e|~t&r,n,t,o,s,i)}function Bt(n,t,e,r,o,s,i){return hn(t&r|e&~r,n,t,o,s,i)}function St(n,t,e,r,o,s,i){return hn(t^e^r,n,t,o,s,i)}function At(n,t,e,r,o,s,i){return hn(e^(t|~r),n,t,o,s,i)}var Ta=Oo("v3",48,Oa);const Ca=Ta;function Na(n,t,e){n=n||{};var r=n.random||(n.rng||Uo)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){e=e||0;for(var o=0;o<16;++o)t[e+o]=r[o];return t}return dn(r)}function Da(n,t,e,r){switch(n){case 0:return t&e^~t&r;case 1:return t^e^r;case 2:return t&e^t&r^e&r;case 3:return t^e^r}}function On(n,t){return n<<t|n>>>32-t}function za(n){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof n=="string"){var r=unescape(encodeURIComponent(n));n=[];for(var o=0;o<r.length;++o)n.push(r.charCodeAt(o))}else Array.isArray(n)||(n=Array.prototype.slice.call(n));n.push(128);for(var s=n.length/4+2,i=Math.ceil(s/16),c=new Array(i),a=0;a<i;++a){for(var u=new Uint32Array(16),f=0;f<16;++f)u[f]=n[a*64+f*4]<<24|n[a*64+f*4+1]<<16|n[a*64+f*4+2]<<8|n[a*64+f*4+3];c[a]=u}c[i-1][14]=(n.length-1)*8/Math.pow(2,32),c[i-1][14]=Math.floor(c[i-1][14]),c[i-1][15]=(n.length-1)*8&4294967295;for(var l=0;l<i;++l){for(var E=new Uint32Array(80),x=0;x<16;++x)E[x]=c[l][x];for(var w=16;w<80;++w)E[w]=On(E[w-3]^E[w-8]^E[w-14]^E[w-16],1);for(var y=e[0],p=e[1],v=e[2],U=e[3],g=e[4],F=0;F<80;++F){var B=Math.floor(F/20),_=On(y,5)+Da(B,p,v,U)+g+t[B]+E[F]>>>0;g=U,U=v,v=On(p,30)>>>0,p=y,y=_}e[0]=e[0]+y>>>0,e[1]=e[1]+p>>>0,e[2]=e[2]+v>>>0,e[3]=e[3]+U>>>0,e[4]=e[4]+g>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var Ha=Oo("v5",80,za);const $a=Ha,Pa="00000000-0000-0000-0000-000000000000";function qa(n){if(!ln(n))throw TypeError("Invalid UUID");return parseInt(n.substr(14,1),16)}const Ma=Object.freeze(Object.defineProperty({__proto__:null,NIL:Pa,parse:_o,stringify:dn,v1:Aa,v3:Ca,v4:Na,v5:$a,validate:ln,version:qa},Symbol.toStringTag,{value:"Module"})),Lo=Fr(Ma),ja=Lo.v4,Va=function(n,t,e,r){if(typeof n!="string")throw new TypeError(n+" must be a string");r=r||{};const o=typeof r.version=="number"?r.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");const s={method:n};if(o===2&&(s.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");s.params=t}if(typeof e>"u"){const i=typeof r.generator=="function"?r.generator:function(){return ja()};s.id=i(s,r)}else o===2&&e===null?r.notificationIdNull&&(s.id=null):s.id=e;return s};var Ga=Va;const Za=Lo.v4,Ka=Ga,rn=function(n,t){if(!(this instanceof rn))return new rn(n,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return Za()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=n};rn.prototype.request=function(n,t,e,r){const o=this;let s=null;const i=Array.isArray(n)&&typeof t=="function";if(this.options.version===1&&i)throw new TypeError("JSON-RPC 1.0 does not support batching");if(i||!i&&n&&typeof n=="object"&&typeof t=="function")r=t,s=n;else{typeof e=="function"&&(r=e,e=void 0);const u=typeof r=="function";try{s=Ka(n,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(f){if(u)return r(f);throw f}if(!u)return s}let a;try{a=JSON.stringify(s,this.options.replacer)}catch(u){return r(u)}return this.callServer(a,function(u,f){o._parseResponse(u,f,r)}),s};rn.prototype._parseResponse=function(n,t,e){if(n){e(n);return}if(!t)return e();let r;try{r=JSON.parse(t,this.options.reviver)}catch(o){return e(o)}if(e.length===3)if(Array.isArray(r)){const o=function(i){return typeof i.error<"u"},s=function(i){return!o(i)};return e(null,r.filter(o),r.filter(s))}else return e(null,r.error,r.result);e(null,r)};var Wa={exports:{}};(function(n){var t=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function o(a,u,f){this.fn=a,this.context=u,this.once=f||!1}function s(a,u,f,l,E){if(typeof f!="function")throw new TypeError("The listener must be a function");var x=new o(f,l||a,E),w=e?e+u:u;return a._events[w]?a._events[w].fn?a._events[w]=[a._events[w],x]:a._events[w].push(x):(a._events[w]=x,a._eventsCount++),a}function i(a,u){--a._eventsCount===0?a._events=new r:delete a._events[u]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var u=[],f,l;if(this._eventsCount===0)return u;for(l in f=this._events)t.call(f,l)&&u.push(e?l.slice(1):l);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},c.prototype.listeners=function(u){var f=e?e+u:u,l=this._events[f];if(!l)return[];if(l.fn)return[l.fn];for(var E=0,x=l.length,w=new Array(x);E<x;E++)w[E]=l[E].fn;return w},c.prototype.listenerCount=function(u){var f=e?e+u:u,l=this._events[f];return l?l.fn?1:l.length:0},c.prototype.emit=function(u,f,l,E,x,w){var y=e?e+u:u;if(!this._events[y])return!1;var p=this._events[y],v=arguments.length,U,g;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),v){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,f),!0;case 3:return p.fn.call(p.context,f,l),!0;case 4:return p.fn.call(p.context,f,l,E),!0;case 5:return p.fn.call(p.context,f,l,E,x),!0;case 6:return p.fn.call(p.context,f,l,E,x,w),!0}for(g=1,U=new Array(v-1);g<v;g++)U[g-1]=arguments[g];p.fn.apply(p.context,U)}else{var F=p.length,B;for(g=0;g<F;g++)switch(p[g].once&&this.removeListener(u,p[g].fn,void 0,!0),v){case 1:p[g].fn.call(p[g].context);break;case 2:p[g].fn.call(p[g].context,f);break;case 3:p[g].fn.call(p[g].context,f,l);break;case 4:p[g].fn.call(p[g].context,f,l,E);break;default:if(!U)for(B=1,U=new Array(v-1);B<v;B++)U[B-1]=arguments[B];p[g].fn.apply(p[g].context,U)}}return!0},c.prototype.on=function(u,f,l){return s(this,u,f,l,!1)},c.prototype.once=function(u,f,l){return s(this,u,f,l,!0)},c.prototype.removeListener=function(u,f,l,E){var x=e?e+u:u;if(!this._events[x])return this;if(!f)return i(this,x),this;var w=this._events[x];if(w.fn)w.fn===f&&(!E||w.once)&&(!l||w.context===l)&&i(this,x);else{for(var y=0,p=[],v=w.length;y<v;y++)(w[y].fn!==f||E&&!w[y].once||l&&w[y].context!==l)&&p.push(w[y]);p.length?this._events[x]=p.length===1?p[0]:p:i(this,x)}return this},c.prototype.removeAllListeners=function(u){var f;return u?(f=e?e+u:u,this._events[f]&&i(this,f)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,n.exports=c})(Wa);class ko extends Hr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Us(t);const r=Hn(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return Ye(this),this.iHash.update(t),this}digestInto(t){Ye(this),sn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Fo=(n,t,e)=>new ko(n,t).update(e).digest();Fo.create=(n,t)=>new ko(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ya(n){const t=qn(n);Oe(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:e,Fp:r,a:o}=t;if(e){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Xa,hexToBytes:Ja}=pi,fe={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){const{Err:t}=fe;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");const e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Xa(r),l:n.subarray(e+2)}},toSig(n){const{Err:t}=fe,e=typeof n=="string"?Ja(n):n;De(e);let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:o,l:s}=fe._parseInt(e.subarray(2)),{d:i,l:c}=fe._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(n){const t=u=>Number.parseInt(u[0],16)&8?"00"+u:u,e=u=>{const f=u.toString(16);return f.length&1?`0${f}`:f},r=t(e(n.s)),o=t(e(n.r)),s=r.length/2,i=o.length/2,c=e(s),a=e(i);return`30${e(i+s+4)}02${a}${o}02${c}${r}`}},Xt=BigInt(0),Tt=BigInt(1);BigInt(2);const Ur=BigInt(3);BigInt(4);function Qa(n){const t=Ya(n),{Fp:e}=t,r=t.toBytes||((w,y,p)=>{const v=y.toAffine();return ye(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(w=>{const y=w.subarray(1),p=e.fromBytes(y.subarray(0,e.BYTES)),v=e.fromBytes(y.subarray(e.BYTES,2*e.BYTES));return{x:p,y:v}});function s(w){const{a:y,b:p}=t,v=e.sqr(w),U=e.mul(v,w);return e.add(e.add(U,e.mul(w,y)),p)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(w){return typeof w=="bigint"&&Xt<w&&w<t.n}function c(w){if(!i(w))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function a(w){const{allowedPrivateKeyLengths:y,nByteLength:p,wrapPrivateKey:v,n:U}=t;if(y&&typeof w!="bigint"){if(he(w)&&(w=pe(w)),typeof w!="string"||!y.includes(w.length))throw new Error("Invalid key");w=w.padStart(p*2,"0")}let g;try{g=typeof w=="bigint"?w:le(pt("private key",w,p))}catch{throw new Error(`private key must be ${p} bytes, hex or bigint, not ${typeof w}`)}return v&&(g=nt(g,U)),c(g),g}const u=new Map;function f(w){if(!(w instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(y,p,v){if(this.px=y,this.py=p,this.pz=v,y==null||!e.isValid(y))throw new Error("x required");if(p==null||!e.isValid(p))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required")}static fromAffine(y){const{x:p,y:v}=y||{};if(!y||!e.isValid(p)||!e.isValid(v))throw new Error("invalid affine point");if(y instanceof l)throw new Error("projective point not allowed");const U=g=>e.eql(g,e.ZERO);return U(p)&&U(v)?l.ZERO:new l(p,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){const p=e.invertBatch(y.map(v=>v.pz));return y.map((v,U)=>v.toAffine(p[U])).map(l.fromAffine)}static fromHex(y){const p=l.fromAffine(o(pt("pointHex",y)));return p.assertValidity(),p}static fromPrivateKey(y){return l.BASE.multiply(a(y))}_setWindowSize(y){this._WINDOW_SIZE=y,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:y,y:p}=this.toAffine();if(!e.isValid(y)||!e.isValid(p))throw new Error("bad point: x or y not FE");const v=e.sqr(p),U=s(y);if(!e.eql(v,U))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y}=this.toAffine();if(e.isOdd)return!e.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){f(y);const{px:p,py:v,pz:U}=this,{px:g,py:F,pz:B}=y,_=e.eql(e.mul(p,B),e.mul(g,U)),T=e.eql(e.mul(v,B),e.mul(F,U));return _&&T}negate(){return new l(this.px,e.neg(this.py),this.pz)}double(){const{a:y,b:p}=t,v=e.mul(p,Ur),{px:U,py:g,pz:F}=this;let B=e.ZERO,_=e.ZERO,T=e.ZERO,C=e.mul(U,U),et=e.mul(g,g),K=e.mul(F,F),q=e.mul(U,g);return q=e.add(q,q),T=e.mul(U,F),T=e.add(T,T),B=e.mul(y,T),_=e.mul(v,K),_=e.add(B,_),B=e.sub(et,_),_=e.add(et,_),_=e.mul(B,_),B=e.mul(q,B),T=e.mul(v,T),K=e.mul(y,K),q=e.sub(C,K),q=e.mul(y,q),q=e.add(q,T),T=e.add(C,C),C=e.add(T,C),C=e.add(C,K),C=e.mul(C,q),_=e.add(_,C),K=e.mul(g,F),K=e.add(K,K),C=e.mul(K,q),B=e.sub(B,C),T=e.mul(K,et),T=e.add(T,T),T=e.add(T,T),new l(B,_,T)}add(y){f(y);const{px:p,py:v,pz:U}=this,{px:g,py:F,pz:B}=y;let _=e.ZERO,T=e.ZERO,C=e.ZERO;const et=t.a,K=e.mul(t.b,Ur);let q=e.mul(p,g),lt=e.mul(v,F),ut=e.mul(U,B),Ft=e.add(p,v),A=e.add(g,F);Ft=e.mul(Ft,A),A=e.add(q,lt),Ft=e.sub(Ft,A),A=e.add(p,U);let k=e.add(g,B);return A=e.mul(A,k),k=e.add(q,ut),A=e.sub(A,k),k=e.add(v,U),_=e.add(F,B),k=e.mul(k,_),_=e.add(lt,ut),k=e.sub(k,_),C=e.mul(et,A),_=e.mul(K,ut),C=e.add(_,C),_=e.sub(lt,C),C=e.add(lt,C),T=e.mul(_,C),lt=e.add(q,q),lt=e.add(lt,q),ut=e.mul(et,ut),A=e.mul(K,A),lt=e.add(lt,ut),ut=e.sub(q,ut),ut=e.mul(et,ut),A=e.add(A,ut),q=e.mul(lt,A),T=e.add(T,q),q=e.mul(k,A),_=e.mul(Ft,_),_=e.sub(_,q),q=e.mul(Ft,lt),C=e.mul(k,C),C=e.add(C,q),new l(_,T,C)}subtract(y){return this.add(y.negate())}is0(){return this.equals(l.ZERO)}wNAF(y){return x.wNAFCached(this,u,y,p=>{const v=e.invertBatch(p.map(U=>U.pz));return p.map((U,g)=>U.toAffine(v[g])).map(l.fromAffine)})}multiplyUnsafe(y){const p=l.ZERO;if(y===Xt)return p;if(c(y),y===Tt)return this;const{endo:v}=t;if(!v)return x.unsafeLadder(this,y);let{k1neg:U,k1:g,k2neg:F,k2:B}=v.splitScalar(y),_=p,T=p,C=this;for(;g>Xt||B>Xt;)g&Tt&&(_=_.add(C)),B&Tt&&(T=T.add(C)),C=C.double(),g>>=Tt,B>>=Tt;return U&&(_=_.negate()),F&&(T=T.negate()),T=new l(e.mul(T.px,v.beta),T.py,T.pz),_.add(T)}multiply(y){c(y);let p=y,v,U;const{endo:g}=t;if(g){const{k1neg:F,k1:B,k2neg:_,k2:T}=g.splitScalar(p);let{p:C,f:et}=this.wNAF(B),{p:K,f:q}=this.wNAF(T);C=x.constTimeNegate(F,C),K=x.constTimeNegate(_,K),K=new l(e.mul(K.px,g.beta),K.py,K.pz),v=C.add(K),U=et.add(q)}else{const{p:F,f:B}=this.wNAF(p);v=F,U=B}return l.normalizeZ([v,U])[0]}multiplyAndAddUnsafe(y,p,v){const U=l.BASE,g=(B,_)=>_===Xt||_===Tt||!B.equals(U)?B.multiplyUnsafe(_):B.multiply(_),F=g(this,p).add(g(y,v));return F.is0()?void 0:F}toAffine(y){const{px:p,py:v,pz:U}=this,g=this.is0();y==null&&(y=g?e.ONE:e.inv(U));const F=e.mul(p,y),B=e.mul(v,y),_=e.mul(U,y);if(g)return{x:e.ZERO,y:e.ZERO};if(!e.eql(_,e.ONE))throw new Error("invZ was invalid");return{x:F,y:B}}isTorsionFree(){const{h:y,isTorsionFree:p}=t;if(y===Tt)return!0;if(p)return p(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:y,clearCofactor:p}=t;return y===Tt?this:p?p(l,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),r(l,this,y)}toHex(y=!0){return pe(this.toRawBytes(y))}}l.BASE=new l(t.Gx,t.Gy,e.ONE),l.ZERO=new l(e.ZERO,e.ONE,e.ZERO);const E=t.nBitLength,x=Xr(l,t.endo?Math.ceil(E/2):E);return{CURVE:t,ProjectivePoint:l,normPrivateKeyToScalar:a,weierstrassEquation:s,isWithinCurveOrder:i}}function tc(n){const t=qn(n);return Oe(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function ec(n){const t=tc(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(A){return Xt<A&&A<e.ORDER}function c(A){return nt(A,r)}function a(A){return Fn(A,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:l,isWithinCurveOrder:E}=Qa({...t,toBytes(A,k,M){const I=k.toAffine(),b=e.toBytes(I.x),L=ye;return M?L(Uint8Array.from([k.hasEvenY()?2:3]),b):L(Uint8Array.from([4]),b,e.toBytes(I.y))},fromBytes(A){const k=A.length,M=A[0],I=A.subarray(1);if(k===o&&(M===2||M===3)){const b=le(I);if(!i(b))throw new Error("Point is not on curve");const L=l(b);let N;try{N=e.sqrt(L)}catch(V){const X=V instanceof Error?": "+V.message:"";throw new Error("Point is not on curve"+X)}const $=(N&Tt)===Tt;return(M&1)===1!==$&&(N=e.neg(N)),{x:b,y:N}}else if(k===s&&M===4){const b=e.fromBytes(I.subarray(0,e.BYTES)),L=e.fromBytes(I.subarray(e.BYTES,2*e.BYTES));return{x:b,y:L}}else throw new Error(`Point of length ${k} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),x=A=>pe(Se(A,t.nByteLength));function w(A){const k=r>>Tt;return A>k}function y(A){return w(A)?c(-A):A}const p=(A,k,M)=>le(A.slice(k,M));class v{constructor(k,M,I){this.r=k,this.s=M,this.recovery=I,this.assertValidity()}static fromCompact(k){const M=t.nByteLength;return k=pt("compactSignature",k,M*2),new v(p(k,0,M),p(k,M,2*M))}static fromDER(k){const{r:M,s:I}=fe.toSig(pt("DER",k));return new v(M,I)}assertValidity(){if(!E(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!E(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(k){return new v(this.r,this.s,k)}recoverPublicKey(k){const{r:M,s:I,recovery:b}=this,L=T(pt("msgHash",k));if(b==null||![0,1,2,3].includes(b))throw new Error("recovery id invalid");const N=b===2||b===3?M+t.n:M;if(N>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const $=b&1?"03":"02",j=u.fromHex($+x(N)),V=a(N),X=c(-L*V),G=c(I*V),W=u.BASE.multiplyAndAddUnsafe(j,X,G);if(!W)throw new Error("point at infinify");return W.assertValidity(),W}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Be(this.toDERHex())}toDERHex(){return fe.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Be(this.toCompactHex())}toCompactHex(){return x(this.r)+x(this.s)}}const U={isValidPrivateKey(A){try{return f(A),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const A=Yr(t.n);return Si(t.randomBytes(A),t.n)},precompute(A=8,k=u.BASE){return k._setWindowSize(A),k.multiply(BigInt(3)),k}};function g(A,k=!0){return u.fromPrivateKey(A).toRawBytes(k)}function F(A){const k=he(A),M=typeof A=="string",I=(k||M)&&A.length;return k?I===o||I===s:M?I===2*o||I===2*s:A instanceof u}function B(A,k,M=!0){if(F(A))throw new Error("first arg must be private key");if(!F(k))throw new Error("second arg must be public key");return u.fromHex(k).multiply(f(A)).toRawBytes(M)}const _=t.bits2int||function(A){const k=le(A),M=A.length*8-t.nBitLength;return M>0?k>>BigInt(M):k},T=t.bits2int_modN||function(A){return c(_(A))},C=Pn(t.nBitLength);function et(A){if(typeof A!="bigint")throw new Error("bigint expected");if(!(Xt<=A&&A<C))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Se(A,t.nByteLength)}function K(A,k,M=q){if(["recovered","canonical"].some(st=>st in M))throw new Error("sign() legacy options not supported");const{hash:I,randomBytes:b}=t;let{lowS:L,prehash:N,extraEntropy:$}=M;L==null&&(L=!0),A=pt("msgHash",A),N&&(A=pt("prehashed msgHash",I(A)));const j=T(A),V=f(k),X=[et(V),et(j)];if($!=null&&$!==!1){const st=$===!0?b(e.BYTES):$;X.push(pt("extraEntropy",st))}const G=ye(...X),W=j;function dt(st){const wt=_(st);if(!E(wt))return;const bt=a(wt),It=u.BASE.multiply(wt).toAffine(),ft=c(It.x);if(ft===Xt)return;const zt=c(bt*c(W+ft*V));if(zt===Xt)return;let oe=(It.x===ft?0:2)|Number(It.y&Tt),Te=zt;return L&&w(zt)&&(Te=y(zt),oe^=1),new v(ft,Te,oe)}return{seed:G,k2sig:dt}}const q={lowS:t.lowS,prehash:!1},lt={lowS:t.lowS,prehash:!1};function ut(A,k,M=q){const{seed:I,k2sig:b}=K(A,k,M),L=t;return Gr(L.hash.outputLen,L.nByteLength,L.hmac)(I,b)}u.BASE._setWindowSize(8);function Ft(A,k,M,I=lt){var It;const b=A;if(k=pt("msgHash",k),M=pt("publicKey",M),"strict"in I)throw new Error("options.strict was renamed to lowS");const{lowS:L,prehash:N}=I;let $,j;try{if(typeof b=="string"||he(b))try{$=v.fromDER(b)}catch(ft){if(!(ft instanceof fe.Err))throw ft;$=v.fromCompact(b)}else if(typeof b=="object"&&typeof b.r=="bigint"&&typeof b.s=="bigint"){const{r:ft,s:zt}=b;$=new v(ft,zt)}else throw new Error("PARSE");j=u.fromHex(M)}catch(ft){if(ft.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(L&&$.hasHighS())return!1;N&&(k=t.hash(k));const{r:V,s:X}=$,G=T(k),W=a(X),dt=c(G*W),st=c(V*W),wt=(It=u.BASE.multiplyAndAddUnsafe(j,dt,st))==null?void 0:It.toAffine();return wt?c(wt.x)===V:!1}return{CURVE:t,getPublicKey:g,getSharedSecret:B,sign:ut,verify:Ft,ProjectivePoint:u,Signature:v,utils:U}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function nc(n){return{hash:n,hmac:(t,...e)=>Fo(n,t,Rs(...e)),randomBytes:Pr}}function rc(n,t){const e=r=>ec({...n,...nc(r)});return Object.freeze({...e(t),create:e})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const To=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),_r=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),oc=BigInt(1),Nn=BigInt(2),Or=(n,t)=>(n+t/Nn)/t;function sc(n){const t=To,e=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=n*n*n%t,f=u*u*n%t,l=it(f,e,t)*f%t,E=it(l,e,t)*f%t,x=it(E,Nn,t)*u%t,w=it(x,o,t)*x%t,y=it(w,s,t)*w%t,p=it(y,c,t)*y%t,v=it(p,a,t)*p%t,U=it(v,c,t)*y%t,g=it(U,e,t)*f%t,F=it(g,i,t)*w%t,B=it(F,r,t)*u%t,_=it(B,Nn,t);if(!Dn.eql(Dn.sqr(_),n))throw new Error("Cannot find square root");return _}const Dn=Kr(To,void 0,void 0,{sqrt:sc}),nr=rc({a:BigInt(0),b:BigInt(7),Fp:Dn,n:_r,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const t=_r,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-oc*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=Or(s*n,t),a=Or(-r*n,t);let u=nt(n-c*e-a*o,t),f=nt(-c*r-a*s,t);const l=u>i,E=f>i;if(l&&(u=t-u),E&&(f=t-f),u>i||f>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:l,k1:u,k2neg:E,k2:f}}}},Tn);BigInt(0);nr.ProjectivePoint;function Rr(n){try{return zi.ExtendedPoint.fromHex(n),!0}catch{return!1}}const ic=n=>at.isBuffer(n)?n:n instanceof Uint8Array?at.from(n.buffer,n.byteOffset,n.byteLength):at.from(n);class ac{constructor(t){Object.assign(this,t)}encode(){return at.from(so(We,this))}static decode(t){return io(We,this,t)}static decodeUnchecked(t){return to(We,this,t)}}const We=new Map;var Co;const cc=32,Rn=32;function uc(n){return n._bn!==void 0}let Lr=1;class Z extends ac{constructor(t){if(super({}),this._bn=void 0,uc(t))this._bn=t._bn;else{if(typeof t=="string"){const e=Sr.decode(t);if(e.length!=Rn)throw new Error("Invalid public key input");this._bn=new yr(e)}else this._bn=new yr(t);if(this._bn.byteLength()>Rn)throw new Error("Invalid public key input")}}static unique(){const t=new Z(Lr);return Lr+=1,new Z(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Sr.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(at);if(t.length===Rn)return t;const e=at.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){const o=at.concat([t.toBuffer(),at.from(e),r.toBuffer()]),s=Tn(o);return new Z(s)}static createProgramAddressSync(t,e){let r=at.alloc(0);t.forEach(function(s){if(s.length>cc)throw new TypeError("Max seed length exceeded");r=at.concat([r,ic(s)])}),r=at.concat([r,e.toBuffer(),at.from("ProgramDerivedAddress")]);const o=Tn(r);if(Rr(o))throw new Error("Invalid seeds, address must fall off the curve");return new Z(o)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r=255,o;for(;r!=0;){try{const s=t.concat(at.from([r]));o=this.createProgramAddressSync(s,e)}catch(s){if(s instanceof TypeError)throw s;r--;continue}return[o,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){const e=new Z(t);return Rr(e.toBytes())}}Co=Z;Z.default=new Co("11111111111111111111111111111111");We.set(Z,{kind:"struct",fields:[["_bn","u256"]]});new Z("BPFLoader1111111111111111111111111111111111");const fc=64,J=(n="publicKey")=>Ie(32,n),ve=(n="string")=>{const t=z([D("length"),D("lengthPadding"),Ie(de(D(),-8),"chars")],n),e=t.decode.bind(t),r=t.encode.bind(t),o=t;return o.decode=(s,i)=>e(s,i).chars.toString(),o.encode=(s,i,c)=>{const a={chars:at.from(s,"utf8")};return r(a,i,c)},o.alloc=s=>D().span+D().span+at.from(s,"utf8").length,o},lc=(n="authorized")=>z([J("staker"),J("withdrawer")],n),dc=(n="lockup")=>z([Lt("unixTimestamp"),Lt("epoch"),J("custodian")],n),hc=(n="voteInit")=>z([J("nodePubkey"),J("authorizedVoter"),J("authorizedWithdrawer"),ht("commission")],n),pc=(n="voteAuthorizeWithSeedArgs")=>z([D("voteAuthorizationType"),J("currentAuthorityDerivedKeyOwnerPubkey"),ve("currentAuthorityDerivedKeySeed"),J("newAuthorized")],n);function No(n,t){const e=o=>{if(o.span>=0)return o.span;if(typeof o.alloc=="function")return o.alloc(t[o.property]);if("count"in o&&"elementLayout"in o){const s=t[o.property];if(Array.isArray(s))return s.length*e(o.elementLayout)}else if("fields"in o)return No({layout:o},t[o.property]);return 0};let r=0;return n.layout.fields.forEach(o=>{r+=e(o)}),r}at.alloc(fc).fill(0);class Ge{constructor(t){this.keys=void 0,this.programId=void 0,this.data=at.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:r})=>({pubkey:t.toJSON(),isSigner:e,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}new Z("SysvarC1ock11111111111111111111111111111111");new Z("SysvarEpochSchedu1e111111111111111111111111");new Z("Sysvar1nstructions1111111111111111111111111");new Z("SysvarRecentB1ockHashes11111111111111111111");new Z("SysvarRent111111111111111111111111111111111");new Z("SysvarRewards111111111111111111111111111111");new Z("SysvarS1otHashes111111111111111111111111111");new Z("SysvarS1otHistory11111111111111111111111111");new Z("SysvarStakeHistory1111111111111111111111111");function Ze(n,t){const e=n.layout.span>=0?n.layout.span:No(n,t),r=at.alloc(e),o=Object.assign({instruction:n.index},t);return n.layout.encode(o,r),r}const yc=xt("lamportsPerSignature"),gc=z([D("version"),D("state"),J("authorizedPubkey"),J("nonce"),z([yc],"feeCalculator")]);gc.span;const wc=n=>{const t=n.decode.bind(n),e=n.encode.bind(n);return{decode:t,encode:e}},bc=n=>t=>{const e=Ie(n,t),{encode:r,decode:o}=wc(e),s=e;return s.decode=(i,c)=>{const a=o(i,c);return fa(at.from(a))},s.encode=(i,c,a)=>{const u=ha(i,n);return r(u,c,a)},s},Ue=bc(8);Object.freeze({Create:{index:0,layout:z([D("instruction"),Lt("lamports"),Lt("space"),J("programId")])},Assign:{index:1,layout:z([D("instruction"),J("programId")])},Transfer:{index:2,layout:z([D("instruction"),Ue("lamports")])},CreateWithSeed:{index:3,layout:z([D("instruction"),J("base"),ve("seed"),Lt("lamports"),Lt("space"),J("programId")])},AdvanceNonceAccount:{index:4,layout:z([D("instruction")])},WithdrawNonceAccount:{index:5,layout:z([D("instruction"),Lt("lamports")])},InitializeNonceAccount:{index:6,layout:z([D("instruction"),J("authorized")])},AuthorizeNonceAccount:{index:7,layout:z([D("instruction"),J("authorized")])},Allocate:{index:8,layout:z([D("instruction"),Lt("space")])},AllocateWithSeed:{index:9,layout:z([D("instruction"),J("base"),ve("seed"),Lt("space"),J("programId")])},AssignWithSeed:{index:10,layout:z([D("instruction"),J("base"),ve("seed"),J("programId")])},TransferWithSeed:{index:11,layout:z([D("instruction"),Ue("lamports"),ve("seed"),J("programId")])},UpgradeNonceAccount:{index:12,layout:z([D("instruction")])}});new Z("11111111111111111111111111111111");new Z("BPFLoader2111111111111111111111111111111111");z([D("typeIndex"),Ue("deactivationSlot"),xt("lastExtendedSlot"),ht("lastExtendedStartIndex"),ht(),ue(J(),de(ht(),-1),"authority")]);const ct=Pe(tr(Z),S(),n=>new Z(n)),Do=er([S(),rt("base64")]),rr=Pe(tr(at),Do,n=>at.from(n[0],"base64"));function zo(n){return _t([m({jsonrpc:rt("2.0"),id:S(),result:n}),m({jsonrpc:rt("2.0"),id:S(),error:m({code:ke(),message:S(),data:H(va())})})])}const mc=zo(ke());function tt(n){return Pe(zo(n),mc,t=>"error"in t?t:{...t,result:Ne(t.result,n)})}function Dt(n){return tt(m({context:m({slot:d()}),value:n}))}function pn(n){return m({context:m({slot:d()}),value:n})}const xc=m({foundation:d(),foundationTerm:d(),initial:d(),taper:d(),terminal:d()});tt(O(R(m({epoch:d(),effectiveSlot:d(),amount:d(),postBalance:d(),commission:H(R(d()))}))));const vc=O(m({slot:d(),prioritizationFee:d()})),Ec=m({total:d(),validator:d(),foundation:d(),epoch:d()}),Bc=m({epoch:d(),slotIndex:d(),slotsInEpoch:d(),absoluteSlot:d(),blockHeight:H(d()),transactionCount:H(d())}),Sc=m({slotsPerEpoch:d(),leaderScheduleSlotOffset:d(),warmup:Vt(),firstNormalEpoch:d(),firstNormalSlot:d()}),Ac=Io(S(),O(d())),be=R(_t([m({}),S()])),Ic=m({err:be}),Uc=rt("receivedSignature");m({"solana-core":S(),"feature-set":H(d())});const _c=m({program:S(),programId:ct,parsed:ke()}),Oc=m({programId:ct,accounts:O(ct),data:S()});Dt(m({err:R(_t([m({}),S()])),logs:R(O(S())),accounts:H(R(O(R(m({executable:Vt(),owner:S(),lamports:d(),data:O(S()),rentEpoch:H(d())}))))),unitsConsumed:H(d()),returnData:H(R(m({programId:S(),data:er([S(),rt("base64")])}))),innerInstructions:H(R(O(m({index:d(),instructions:O(_t([_c,Oc]))}))))}));Dt(m({byIdentity:Io(S(),O(d())),range:m({firstSlot:d(),lastSlot:d()})}));tt(xc);tt(Ec);tt(vc);tt(Bc);tt(Sc);tt(Ac);tt(d());Dt(m({total:d(),circulating:d(),nonCirculating:d(),nonCirculatingAccounts:O(ct)}));const Rc=m({amount:S(),uiAmount:R(d()),decimals:d(),uiAmountString:H(S())});Dt(O(m({address:ct,amount:S(),uiAmount:R(d()),decimals:d(),uiAmountString:H(S())})));Dt(O(m({pubkey:ct,account:m({executable:Vt(),owner:ct,lamports:d(),data:rr,rentEpoch:d()})})));const zn=m({program:S(),parsed:ke(),space:d()});Dt(O(m({pubkey:ct,account:m({executable:Vt(),owner:ct,lamports:d(),data:zn,rentEpoch:d()})})));Dt(O(m({lamports:d(),address:ct})));const or=m({executable:Vt(),owner:ct,lamports:d(),data:rr,rentEpoch:d()});m({pubkey:ct,account:or});const Lc=Pe(_t([tr(at),zn]),_t([Do,zn]),n=>Array.isArray(n)?Ne(n,rr):n),kc=m({executable:Vt(),owner:ct,lamports:d(),data:Lc,rentEpoch:d()});m({pubkey:ct,account:kc});m({state:_t([rt("active"),rt("inactive"),rt("activating"),rt("deactivating")]),active:d(),inactive:d()});tt(O(m({signature:S(),slot:d(),err:be,memo:R(S()),blockTime:H(R(d()))})));tt(O(m({signature:S(),slot:d(),err:be,memo:R(S()),blockTime:H(R(d()))})));m({subscription:d(),result:pn(or)});const Fc=m({pubkey:ct,account:or});m({subscription:d(),result:pn(Fc)});const Tc=m({parent:d(),slot:d(),root:d()});m({subscription:d(),result:Tc});const Cc=_t([m({type:_t([rt("firstShredReceived"),rt("completed"),rt("optimisticConfirmation"),rt("root")]),slot:d(),timestamp:d()}),m({type:rt("createdBank"),parent:d(),slot:d(),timestamp:d()}),m({type:rt("frozen"),slot:d(),timestamp:d(),stats:m({numTransactionEntries:d(),numSuccessfulTransactions:d(),numFailedTransactions:d(),maxTransactionsPerEntry:d()})}),m({type:rt("dead"),slot:d(),timestamp:d(),err:S()})]);m({subscription:d(),result:Cc});m({subscription:d(),result:pn(_t([Ic,Uc]))});m({subscription:d(),result:d()});m({pubkey:S(),gossip:R(S()),tpu:R(S()),rpc:R(S()),version:R(S())});const kr=m({votePubkey:S(),nodePubkey:S(),activatedStake:d(),epochVoteAccount:Vt(),epochCredits:O(er([d(),d(),d()])),commission:d(),lastVote:d(),rootSlot:R(d())});tt(m({current:O(kr),delinquent:O(kr)}));const Nc=_t([rt("processed"),rt("confirmed"),rt("finalized")]),Dc=m({slot:d(),confirmations:R(d()),err:be,confirmationStatus:H(Nc)});Dt(O(R(Dc)));tt(d());const Ho=m({accountKey:ct,writableIndexes:O(d()),readonlyIndexes:O(d())}),sr=m({signatures:O(S()),message:m({accountKeys:O(S()),header:m({numRequiredSignatures:d(),numReadonlySignedAccounts:d(),numReadonlyUnsignedAccounts:d()}),instructions:O(m({accounts:O(d()),data:S(),programIdIndex:d()})),recentBlockhash:S(),addressTableLookups:H(O(Ho))})}),$o=m({pubkey:ct,signer:Vt(),writable:Vt(),source:H(_t([rt("transaction"),rt("lookupTable")]))}),Po=m({accountKeys:O($o),signatures:O(S())}),qo=m({parsed:ke(),program:S(),programId:ct}),Mo=m({accounts:O(ct),data:S(),programId:ct}),zc=_t([Mo,qo]),Hc=_t([m({parsed:ke(),program:S(),programId:S()}),m({accounts:O(S()),data:S(),programId:S()})]),jo=Pe(zc,Hc,n=>"accounts"in n?Ne(n,Mo):Ne(n,qo)),Vo=m({signatures:O(S()),message:m({accountKeys:O($o),instructions:O(jo),recentBlockhash:S(),addressTableLookups:H(R(O(Ho)))})}),on=m({accountIndex:d(),mint:S(),owner:H(S()),uiTokenAmount:Rc}),Go=m({writable:O(ct),readonly:O(ct)}),yn=m({err:be,fee:d(),innerInstructions:H(R(O(m({index:d(),instructions:O(m({accounts:O(d()),data:S(),programIdIndex:d()}))})))),preBalances:O(d()),postBalances:O(d()),logMessages:H(R(O(S()))),preTokenBalances:H(R(O(on))),postTokenBalances:H(R(O(on))),loadedAddresses:H(Go),computeUnitsConsumed:H(d())}),ir=m({err:be,fee:d(),innerInstructions:H(R(O(m({index:d(),instructions:O(jo)})))),preBalances:O(d()),postBalances:O(d()),logMessages:H(R(O(S()))),preTokenBalances:H(R(O(on))),postTokenBalances:H(R(O(on))),loadedAddresses:H(Go),computeUnitsConsumed:H(d())}),Fe=_t([rt(0),rt("legacy")]),me=m({pubkey:S(),lamports:d(),postBalance:R(d()),rewardType:R(S()),commission:H(R(d()))});tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),transactions:O(m({transaction:sr,meta:R(yn),version:H(Fe)})),rewards:H(O(me)),blockTime:R(d()),blockHeight:R(d())})));tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),rewards:H(O(me)),blockTime:R(d()),blockHeight:R(d())})));tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),transactions:O(m({transaction:Po,meta:R(yn),version:H(Fe)})),rewards:H(O(me)),blockTime:R(d()),blockHeight:R(d())})));tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),transactions:O(m({transaction:Vo,meta:R(ir),version:H(Fe)})),rewards:H(O(me)),blockTime:R(d()),blockHeight:R(d())})));tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),transactions:O(m({transaction:Po,meta:R(ir),version:H(Fe)})),rewards:H(O(me)),blockTime:R(d()),blockHeight:R(d())})));tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),rewards:H(O(me)),blockTime:R(d()),blockHeight:R(d())})));tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),transactions:O(m({transaction:sr,meta:R(yn)})),rewards:H(O(me)),blockTime:R(d())})));tt(R(m({blockhash:S(),previousBlockhash:S(),parentSlot:d(),signatures:O(S()),blockTime:R(d())})));tt(R(m({slot:d(),meta:R(yn),blockTime:H(R(d())),transaction:sr,version:H(Fe)})));tt(R(m({slot:d(),transaction:Vo,meta:R(ir),blockTime:H(R(d())),version:H(Fe)})));Dt(m({blockhash:S(),feeCalculator:m({lamportsPerSignature:d()})}));Dt(m({blockhash:S(),lastValidBlockHeight:d()}));Dt(Vt());const $c=m({slot:d(),numTransactions:d(),numSlots:d(),samplePeriodSecs:d()});tt(O($c));Dt(R(m({feeCalculator:m({lamportsPerSignature:d()})})));tt(S());tt(S());const Pc=m({err:be,logs:O(S()),signature:S()});m({result:pn(Pc),subscription:d()});Object.freeze({CreateLookupTable:{index:0,layout:z([D("instruction"),Ue("recentSlot"),ht("bumpSeed")])},FreezeLookupTable:{index:1,layout:z([D("instruction")])},ExtendLookupTable:{index:2,layout:z([D("instruction"),Ue(),ue(J(),de(D(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:z([D("instruction")])},CloseLookupTable:{index:4,layout:z([D("instruction")])}});new Z("AddressLookupTab1e1111111111111111111111111");const Ke=Object.freeze({RequestUnits:{index:0,layout:z([ht("instruction"),D("units"),D("additionalFee")])},RequestHeapFrame:{index:1,layout:z([ht("instruction"),D("bytes")])},SetComputeUnitLimit:{index:2,layout:z([ht("instruction"),D("units")])},SetComputeUnitPrice:{index:3,layout:z([ht("instruction"),Ue("microLamports")])}});class qc{constructor(){}static requestUnits(t){const e=Ke.RequestUnits,r=Ze(e,t);return new Ge({keys:[],programId:this.programId,data:r})}static requestHeapFrame(t){const e=Ke.RequestHeapFrame,r=Ze(e,t);return new Ge({keys:[],programId:this.programId,data:r})}static setComputeUnitLimit(t){const e=Ke.SetComputeUnitLimit,r=Ze(e,t);return new Ge({keys:[],programId:this.programId,data:r})}static setComputeUnitPrice(t){const e=Ke.SetComputeUnitPrice,r=Ze(e,{microLamports:BigInt(t.microLamports)});return new Ge({keys:[],programId:this.programId,data:r})}}qc.programId=new Z("ComputeBudget111111111111111111111111111111");z([ht("numSignatures"),ht("padding"),Ct("signatureOffset"),Ct("signatureInstructionIndex"),Ct("publicKeyOffset"),Ct("publicKeyInstructionIndex"),Ct("messageDataOffset"),Ct("messageDataSize"),Ct("messageInstructionIndex")]);new Z("Ed25519SigVerify111111111111111111111111111");nr.utils.isValidPrivateKey;nr.getPublicKey;z([ht("numSignatures"),Ct("signatureOffset"),ht("signatureInstructionIndex"),Ct("ethAddressOffset"),ht("ethAddressInstructionIndex"),Ct("messageDataOffset"),Ct("messageDataSize"),ht("messageInstructionIndex"),Ie(20,"ethAddress"),Ie(64,"signature"),ht("recoveryId")]);new Z("KeccakSecp256k11111111111111111111111111111");var Zo;new Z("StakeConfig11111111111111111111111111111111");class Ko{constructor(t,e,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=r}}Zo=Ko;Ko.default=new Zo(0,0,Z.default);Object.freeze({Initialize:{index:0,layout:z([D("instruction"),lc(),dc()])},Authorize:{index:1,layout:z([D("instruction"),J("newAuthorized"),D("stakeAuthorizationType")])},Delegate:{index:2,layout:z([D("instruction")])},Split:{index:3,layout:z([D("instruction"),Lt("lamports")])},Withdraw:{index:4,layout:z([D("instruction"),Lt("lamports")])},Deactivate:{index:5,layout:z([D("instruction")])},Merge:{index:7,layout:z([D("instruction")])},AuthorizeWithSeed:{index:8,layout:z([D("instruction"),J("newAuthorized"),D("stakeAuthorizationType"),ve("authoritySeed"),J("authorityOwner")])}});new Z("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:z([D("instruction"),hc()])},Authorize:{index:1,layout:z([D("instruction"),J("newAuthorized"),D("voteAuthorizationType")])},Withdraw:{index:3,layout:z([D("instruction"),Lt("lamports")])},UpdateValidatorIdentity:{index:4,layout:z([D("instruction")])},AuthorizeWithSeed:{index:10,layout:z([D("instruction"),pc()])}});new Z("Vote111111111111111111111111111111111111111");new Z("Va1idator1nfo111111111111111111111111111111");m({name:S(),website:H(S()),details:H(S()),iconUrl:H(S()),keybaseUsername:H(S())});new Z("Vote111111111111111111111111111111111111111");z([J("nodePubkey"),J("authorizedWithdrawer"),ht("commission"),xt(),ue(z([xt("slot"),D("confirmationCount")]),de(D(),-8),"votes"),ht("rootSlotValid"),xt("rootSlot"),xt(),ue(z([xt("epoch"),J("authorizedVoter")]),de(D(),-8),"authorizedVoters"),z([ue(z([J("authorizedPubkey"),xt("epochOfLastAuthorizedSwitch"),xt("targetEpoch")]),32,"buf"),xt("idx"),ht("isEmpty")],"priorVoters"),xt(),ue(z([xt("epoch"),xt("credits"),xt("prevCredits")]),de(D(),-8),"epochCredits"),z([xt("slot"),xt("timestamp")],"lastTimestamp")]);export{qc as C,jc as c};