@web3auth/wallet-connect-v2-adapter
Version:
wallet connect v2 adapter for web3auth
2 lines • 890 kB
JavaScript
/*! For license information please see walletConnectV2Adapter.umd.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.WalletConnectV2Adapter=t():e.WalletConnectV2Adapter=t()}(self,(()=>(()=>{var e={3035:(e,t,r)=>{"use strict";t.I0=t.DH=t.NX=t.u8=t.cY=void 0,t.av=t.O6=t.w3=t.Wg=void 0;const n=r(1429);function i(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function o(e){return i(e),n.Buffer.from(e.buffer,e.byteOffset,e.length)}class s{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function a(e,t){return t.property?e+"["+t.property+"]":e}class c extends s{isCount(){throw new Error("ExternalLayout is abstract")}}class u extends c{constructor(e,t=0,r){if(!(e instanceof s))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof h||this.layout instanceof l}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}class h extends s{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return o(e).readUIntLE(t,this.span)}encode(e,t,r=0){return o(t).writeUIntLE(e,r,this.span),this.span}}class l extends s{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return o(e).readUIntBE(t,this.span)}encode(e,t,r=0){return o(t).writeUIntBE(e,r,this.span),this.span}}const d=Math.pow(2,32);function f(e){const t=Math.floor(e/d);return{hi32:t,lo32:e-t*d}}function p(e,t){return e*d+t}class g extends s{constructor(e){super(8,e)}decode(e,t=0){const r=o(e),n=r.readUInt32LE(t);return p(r.readUInt32LE(t+4),n)}encode(e,t,r=0){const n=f(e),i=o(t);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}class y extends s{constructor(e){super(8,e)}decode(e,t=0){const r=o(e),n=r.readUInt32LE(t);return p(r.readInt32LE(t+4),n)}encode(e,t,r=0){const n=f(e),i=o(t);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}class b extends s{constructor(e,t,r){if(!(e instanceof s))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof c&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(t instanceof c)&&0<e.span&&(n=t*e.span),super(n,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof c&&(n=n.decode(e,t)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(e,t+r),++i}return r}decode(e,t=0){const r=[];let n=0,i=this.count;for(i instanceof c&&(i=i.decode(e,t));n<i;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),n+=1;return r}encode(e,t,r=0){const n=this.elementLayout,i=e.reduce(((e,i)=>e+n.encode(i,t,r+e)),0);return this.count instanceof c&&this.count.encode(e.length,t,r),i}}class m extends s{constructor(e,t,r){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof s),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===r&&(r=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(n,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const i=n.getSpan(e,t);return t+=i,r+i}),0)}catch(e){throw new RangeError("indeterminate span")}return r}decode(e,t=0){i(e);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){const n=r;let i=0,o=0;for(const n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){const i=e[n.property];void 0!==i&&(o=n.encode(i,t,r),0>s&&(s=n.getSpan(t,r)))}i=r,r+=s}return i+o-n}fromArray(e){const t=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}class w extends s{constructor(e,t){if(!(e instanceof c&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof c||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),o(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof c&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw new TypeError(a("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw new RangeError("encoding overruns Uint8Array");const i=o(e);return o(t).write(i.toString("hex"),r,n,"hex"),this.length instanceof c&&this.length.encode(n,t,r),n}}t.cY=(e,t,r)=>new u(e,t,r),t.u8=e=>new h(1,e),t.NX=e=>new h(2,e),t.DH=e=>new h(4,e),t.I0=e=>new g(e),t.Wg=e=>new y(e),t.w3=(e,t,r)=>new m(e,t,r),t.O6=(e,t,r)=>new b(e,t,r),t.av=(e,t)=>new w(e,t)},3893:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Account:()=>zr,AddressLookupTableAccount:()=>Qn,AddressLookupTableInstruction:()=>Jo,AddressLookupTableProgram:()=>Xo,Authorized:()=>cs,BLOCKHASH_CACHE_TIMEOUT_MS:()=>oi,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>qr,BPF_LOADER_PROGRAM_ID:()=>$n,BpfLoader:()=>Fn,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>Qo,ComputeBudgetInstruction:()=>Zo,ComputeBudgetProgram:()=>es,Connection:()=>Vo,Ed25519Program:()=>rs,Enum:()=>Mr,EpochSchedule:()=>Jn,FeeCalculatorLayout:()=>Nn,Keypair:()=>Go,LAMPORTS_PER_SOL:()=>Ts,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>Yo,Loader:()=>qn,Lockup:()=>us,MAX_SEED_LENGTH:()=>Lr,Message:()=>an,MessageAccountKeys:()=>Gr,MessageV0:()=>cn,NONCE_ACCOUNT_LENGTH:()=>Cn,NonceAccount:()=>Bn,PACKET_DATA_SIZE:()=>$r,PUBLIC_KEY_LENGTH:()=>Ur,PublicKey:()=>jr,SIGNATURE_LENGTH_IN_BYTES:()=>Wr,SOLANA_SCHEMA:()=>Cr,STAKE_CONFIG_ID:()=>as,STAKE_INSTRUCTION_LAYOUTS:()=>ls,SYSTEM_INSTRUCTION_LAYOUTS:()=>Dn,SYSVAR_CLOCK_PUBKEY:()=>yn,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>bn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>mn,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>wn,SYSVAR_RENT_PUBKEY:()=>vn,SYSVAR_REWARDS_PUBKEY:()=>Sn,SYSVAR_SLOT_HASHES_PUBKEY:()=>_n,SYSVAR_SLOT_HISTORY_PUBKEY:()=>En,SYSVAR_STAKE_HISTORY_PUBKEY:()=>In,Secp256k1Program:()=>os,SendTransactionError:()=>An,SolanaJSONRPCError:()=>xn,SolanaJSONRPCErrorCode:()=>kn,StakeAuthorizationLayout:()=>ds,StakeInstruction:()=>hs,StakeProgram:()=>fs,Struct:()=>Nr,SystemInstruction:()=>Un,SystemProgram:()=>jn,Transaction:()=>fn,TransactionExpiredBlockheightExceededError:()=>Kr,TransactionExpiredNonceInvalidError:()=>Vr,TransactionExpiredTimeoutError:()=>Hr,TransactionInstruction:()=>dn,TransactionMessage:()=>pn,TransactionStatus:()=>hn,VALIDATOR_INFO_KEY:()=>ws,VERSION_PREFIX_MASK:()=>Fr,VOTE_PROGRAM_ID:()=>_s,ValidatorInfo:()=>Ss,VersionedMessage:()=>un,VersionedTransaction:()=>gn,VoteAccount:()=>Is,VoteAuthorizationLayout:()=>bs,VoteInit:()=>ps,VoteInstruction:()=>gs,VoteProgram:()=>ms,clusterApiUrl:()=>Os,sendAndConfirmRawTransaction:()=>Rs,sendAndConfirmTransaction:()=>Pn});var n={};r.r(n),r.d(n,{aK:()=>re,e8:()=>z,DO:()=>j,dJ:()=>ne,OG:()=>ie,My:()=>$,Ph:()=>G,lX:()=>Y,Id:()=>Q,fg:()=>ae,qj:()=>Z,aT:()=>V,r4:()=>te,aY:()=>D,x:()=>he,lq:()=>J,z:()=>X,zW:()=>F,Q5:()=>ue});var i=r(1429);function o(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function s(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function a(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function c(e,t){s(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const u="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function h(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function l(e,t){return e<<32-t|e>>>t}const d=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function f(e){for(let r=0;r<e.length;r++)e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function p(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),s(e),e}class g{clone(){return this._cloneInto()}}function y(e){const t=t=>e().update(p(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function b(e=32){if(u&&"function"==typeof u.getRandomValues)return u.getRandomValues(new Uint8Array(e));if(u&&"function"==typeof u.randomBytes)return u.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function m(e,t,r){return e&t^e&r^t&r}class w extends g{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=h(this.buffer)}update(e){a(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=p(e)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=h(e);for(;n<=i-o;o+=n)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){a(this),c(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=h(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)s.setUint32(4*e,d[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}const v=BigInt(2**32-1),S=BigInt(32);function _(e,t=!1){return t?{h:Number(e&v),l:Number(e>>S&v)}:{h:0|Number(e>>S&v),l:0|Number(e&v)}}function E(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=_(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}const I=(e,t,r)=>e<<r|t>>>32-r,A=(e,t,r)=>t<<r|e>>>32-r,k=(e,t,r)=>t<<r-32|e>>>64-r,x=(e,t,r)=>e<<r-32|t>>>64-r,P={fromBig:_,split:E,toBig:(e,t)=>BigInt(e>>>0)<<S|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:I,rotlSL:A,rotlBH:k,rotlBL:x,add:function(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},[O,R]=(()=>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((e=>BigInt(e)))))(),T=new Uint32Array(80),N=new Uint32Array(80);class M extends w{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:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:u,Fh:h,Fl:l,Gh:d,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,n,i,o,s,a,c,u,h,l,d,f,p,g]}set(e,t,r,n,i,o,s,a,c,u,h,l,d,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|h,this.Fl=0|l,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)T[r]=e.getUint32(t),N[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|T[e-15],r=0|N[e-15],n=P.rotrSH(t,r,1)^P.rotrSH(t,r,8)^P.shrSH(t,r,7),i=P.rotrSL(t,r,1)^P.rotrSL(t,r,8)^P.shrSL(t,r,7),o=0|T[e-2],s=0|N[e-2],a=P.rotrSH(o,s,19)^P.rotrBH(o,s,61)^P.shrSH(o,s,6),c=P.rotrSL(o,s,19)^P.rotrBL(o,s,61)^P.shrSL(o,s,6),u=P.add4L(i,c,N[e-7],N[e-16]),h=P.add4H(u,n,a,T[e-7],T[e-16]);T[e]=0|h,N[e]=0|u}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:u,Eh:h,El:l,Fh:d,Fl:f,Gh:p,Gl:g,Hh:y,Hl:b}=this;for(let e=0;e<80;e++){const t=P.rotrSH(h,l,14)^P.rotrSH(h,l,18)^P.rotrBH(h,l,41),m=P.rotrSL(h,l,14)^P.rotrSL(h,l,18)^P.rotrBL(h,l,41),w=h&d^~h&p,v=l&f^~l&g,S=P.add5L(b,m,v,R[e],N[e]),_=P.add5H(S,y,t,w,O[e],T[e]),E=0|S,I=P.rotrSH(r,n,28)^P.rotrBH(r,n,34)^P.rotrBH(r,n,39),A=P.rotrSL(r,n,28)^P.rotrBL(r,n,34)^P.rotrBL(r,n,39),k=r&i^r&s^i&s,x=n&o^n&a^o&a;y=0|p,b=0|g,p=0|d,g=0|f,d=0|h,f=0|l,({h,l}=P.add(0|c,0|u,0|_,0|E)),c=0|s,u=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const M=P.add3L(E,A,x);r=P.add3H(M,_,I,k),n=0|M}({h:r,l:n}=P.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=P.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=P.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=P.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h,l}=P.add(0|this.Eh,0|this.El,0|h,0|l)),({h:d,l:f}=P.add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:g}=P.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:b}=P.add(0|this.Hh,0|this.Hl,0|y,0|b)),this.set(r,n,i,o,s,a,c,u,h,l,d,f,p,g,y,b)}roundClean(){T.fill(0),N.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 C=y((()=>new M)),B=BigInt(0),L=BigInt(1),U=BigInt(2);function D(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function j(e){if(!D(e))throw new Error("Uint8Array expected")}function z(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}const q=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function $(e){j(e);let t="";for(let r=0;r<e.length;r++)t+=q[e[r]];return t}function F(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function W(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?B:BigInt("0x"+e)}const K={_0:48,_9:57,A:65,F:70,a:97,f:102};function H(e){return e>=K._0&&e<=K._9?e-K._0:e>=K.A&&e<=K.F?e-(K.A-10):e>=K.a&&e<=K.f?e-(K.a-10):void 0}function V(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=H(e.charCodeAt(i)),o=H(e.charCodeAt(i+1));if(void 0===r||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+o}return n}function G(e){return W($(e))}function Y(e){return j(e),W($(Uint8Array.from(e).reverse()))}function J(e,t){return V(e.toString(16).padStart(2*t,"0"))}function X(e,t){return J(e,t).reverse()}function Z(e,t,r){let n;if("string"==typeof t)try{n=V(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!D(t))throw new Error(e+" must be hex string or Uint8Array");n=Uint8Array.from(t)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(e+" of length "+r+" expected, got "+i);return n}function Q(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];j(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const ee=e=>"bigint"==typeof e&&B<=e;function te(e,t,r){return ee(e)&&ee(t)&&ee(r)&&t<=e&&e<r}function re(e,t,r,n){if(!te(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function ne(e){let t;for(t=0;e>B;e>>=L,t+=1);return t}const ie=e=>(U<<BigInt(e-1))-L,oe=e=>new Uint8Array(e),se=e=>Uint8Array.from(e);function ae(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=oe(e),i=oe(e),o=0;const s=()=>{n.fill(1),i.fill(0),o=0},a=(...e)=>r(i,n,...e),c=(e=oe())=>{i=a(se([0]),e),n=a(),0!==e.length&&(i=a(se([1]),e),n=a())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=a();const t=n.slice();r.push(t),e+=n.length}return Q(...r)};return(e,t)=>{let r;for(s(),c(e);!(r=t(u()));)c();return s(),r}}const ce={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||D(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function ue(e,t,r={}){const n=(t,r,n)=>{const i=ce[r];if("function"!=typeof i)throw new Error("invalid validator function");const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error("param "+String(t)+" is invalid. Expected "+r+", got "+o)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}function he(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const o=e(r,...n);return t.set(r,o),o}}const le=BigInt(0),de=BigInt(1),fe=BigInt(2),pe=BigInt(3),ge=BigInt(4),ye=BigInt(5),be=BigInt(8);function me(e,t){const r=e%t;return r>=le?r:t+r}function we(e,t,r){if(t<le)throw new Error("invalid exponent, negatives unsupported");if(r<=le)throw new Error("invalid modulus");if(r===de)return le;let n=de;for(;t>le;)t&de&&(n=n*e%r),e=e*e%r,t>>=de;return n}function ve(e,t,r){let n=e;for(;t-- >le;)n*=n,n%=r;return n}function Se(e,t){if(e===le)throw new Error("invert: expected non-zero number");if(t<=le)throw new Error("invert: expected positive modulus, got "+t);let r=me(e,t),n=t,i=le,o=de,s=de,a=le;for(;r!==le;){const e=n/r,t=n%r,c=i-s*e,u=o-a*e;n=r,r=t,i=s,o=a,s=c,a=u}if(n!==de)throw new Error("invert: does not exist");return me(i,t)}const _e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ee(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function Ie(e,t,r=!1,n={}){if(e<=le)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:o}=Ee(e,t);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const a=Object.freeze({ORDER:e,isLE:r,BITS:i,BYTES:o,MASK:ie(i),ZERO:le,ONE:de,create:t=>me(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return le<=t&&t<e},is0:e=>e===le,isOdd:e=>(e&de)===de,neg:t=>me(-t,e),eql:(e,t)=>e===t,sqr:t=>me(t*t,e),add:(t,r)=>me(t+r,e),sub:(t,r)=>me(t-r,e),mul:(t,r)=>me(t*r,e),pow:(e,t)=>function(e,t,r){if(r<le)throw new Error("invalid exponent, negatives unsupported");if(r===le)return e.ONE;if(r===de)return t;let n=e.ONE,i=t;for(;r>le;)r&de&&(n=e.mul(n,i)),i=e.sqr(i),r>>=de;return n}(a,e,t),div:(t,r)=>me(t*Se(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Se(t,e),sqrt:n.sqrt||(t=>(s||(s=function(e){if(e%ge===pe){const t=(e+de)/ge;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%be===ye){const t=(e-ye)/be;return function(e,r){const n=e.mul(r,fe),i=e.pow(n,t),o=e.mul(r,i),s=e.mul(e.mul(o,fe),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-de)/fe;let r,n,i;for(r=e-de,n=0;r%fe===le;r/=fe,n++);for(i=fe;i<e&&we(i,t,e)!==e-de;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===n){const t=(e+de)/ge;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const o=(r+de)/fe;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=n,c=e.pow(e.mul(e.ONE,i),r),u=e.pow(s,o),h=e.pow(s,r);for(;!e.eql(h,e.ONE);){if(e.eql(h,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(h);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const r=e.pow(c,de<<BigInt(a-t-1));c=e.sqr(r),u=e.mul(u,r),h=e.mul(h,c),a=t}return u}}(e)}(e)),s(a,t))),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?X(e,o):J(e,o),fromBytes:e=>{if(e.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?Y(e):G(e)}});return Object.freeze(a)}function Ae(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function ke(e){const t=Ae(e);return t+Math.ceil(t/2)}const xe=BigInt(0),Pe=BigInt(1);function Oe(e,t){const r=t.negate();return e?r:t}function Re(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Te(e,t){return Re(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}const Ne=new WeakMap,Me=new WeakMap;function Ce(e){return Me.get(e)||1}function Be(e,t){return{constTimeNegate:Oe,hasPrecomputes:e=>1!==Ce(e),unsafeLadder(t,r,n=e.ZERO){let i=t;for(;r>xe;)r&Pe&&(n=n.add(i)),i=i.double(),r>>=Pe;return n},precomputeWindow(e,r){const{windows:n,windowSize:i}=Te(r,t),o=[];let s=e,a=s;for(let e=0;e<n;e++){a=s,o.push(a);for(let e=1;e<i;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(r,n,i){const{windows:o,windowSize:s}=Te(r,t);let a=e.ZERO,c=e.BASE;const u=BigInt(2**r-1),h=2**r,l=BigInt(r);for(let e=0;e<o;e++){const t=e*s;let r=Number(i&u);i>>=l,r>s&&(r-=h,i+=Pe);const o=t,d=t+Math.abs(r)-1,f=e%2!=0,p=r<0;0===r?c=c.add(Oe(f,n[o])):a=a.add(Oe(p,n[d]))}return{p:a,f:c}},wNAFUnsafe(r,n,i,o=e.ZERO){const{windows:s,windowSize:a}=Te(r,t),c=BigInt(2**r-1),u=2**r,h=BigInt(r);for(let e=0;e<s;e++){const t=e*a;if(i===xe)break;let r=Number(i&c);if(i>>=h,r>a&&(r-=u,i+=Pe),0===r)continue;let s=n[t+Math.abs(r)-1];r<0&&(s=s.negate()),o=o.add(s)}return o},getPrecomputes(e,t,r){let n=Ne.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&Ne.set(t,r(n))),n},wNAFCached(e,t,r){const n=Ce(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)},wNAFCachedUnsafe(e,t,r,n){const i=Ce(e);return 1===i?this.unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)},setWindowSize(e,r){Re(r,t),Me.set(e,r),Ne.delete(e)}}}function Le(e,t,r,n){if(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)}))}(r,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)}))}(n,t),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,o=ne(BigInt(r.length)),s=o>12?o-3:o>4?o-2:o?2:1,a=(1<<s)-1,c=new Array(a+1).fill(i);let u=i;for(let e=Math.floor((t.BITS-1)/s)*s;e>=0;e-=s){c.fill(i);for(let t=0;t<n.length;t++){const i=n[t],o=Number(i>>BigInt(e)&BigInt(a));c[o]=c[o].add(r[t])}let t=i;for(let e=c.length-1,r=i;e>0;e--)r=r.add(c[e]),t=t.add(r);if(u=u.add(t),0!==e)for(let e=0;e<s;e++)u=u.double()}return u}function Ue(e){return ue(e.Fp,_e.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),ue(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ee(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const De=BigInt(0),je=BigInt(1),ze=BigInt(2),qe=BigInt(8),$e={zip215:!0};const Fe=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),We=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Ke=(BigInt(0),BigInt(1)),He=BigInt(2),Ve=(BigInt(3),BigInt(5)),Ge=BigInt(8);function Ye(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function Je(e,t){const r=Fe,n=me(t*t*t,r),i=me(n*n*t,r);let o=me(e*n*function(e){const t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=Fe,s=e*e%o*e%o,a=ve(s,He,o)*s%o,c=ve(a,Ke,o)*e%o,u=ve(c,Ve,o)*c%o,h=ve(u,t,o)*u%o,l=ve(h,r,o)*h%o,d=ve(l,n,o)*l%o,f=ve(d,i,o)*d%o,p=ve(f,i,o)*d%o,g=ve(p,t,o)*u%o;return{pow_p_5_8:ve(g,He,o)*e%o,b2:s}}(e*i).pow_p_5_8,r);const s=me(t*o*o,r),a=o,c=me(o*We,r),u=s===e,h=s===me(-e,r),l=s===me(-e*We,r);return u&&(o=a),(h||l)&&(o=c),(me(o,r)&de)===de&&(o=me(-o,r)),{isValid:u||h,value:o}}const Xe=(()=>Ie(Fe,void 0,!0))(),Ze=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Xe,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Ge,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:C,randomBytes:b,adjustScalarBytes:Ye,uvRatio:Je}))(),Qe=(()=>function(e){const t=function(e){const t=Ue(e);return ue(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=t,u=ze<<BigInt(8*a)-je,h=r.create,l=Ie(t.n,t.nBitLength),d=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:De}}}),f=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,r)=>{if(z("phflag",r),t.length||r)throw new Error("Contexts/pre-hash are not supported");return e});function g(e,t){re("coordinate "+e,t,De,u)}function y(e){if(!(e instanceof w))throw new Error("ExtendedPoint expected")}const b=he(((e,t)=>{const{ex:n,ey:i,ez:o}=e,s=e.is0();null==t&&(t=s?qe:r.inv(o));const a=h(n*t),c=h(i*t),u=h(o*t);if(s)return{x:De,y:je};if(u!==je)throw new Error("invZ was invalid");return{x:a,y:c}})),m=he((e=>{const{a:r,d:n}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:i,ey:o,ez:s,et:a}=e,c=h(i*i),u=h(o*o),l=h(s*s),d=h(l*l),f=h(c*r);if(h(l*h(f+u))!==h(d+h(n*h(c*u))))throw new Error("bad point: equation left != right (1)");if(h(i*o)!==h(s*a))throw new Error("bad point: equation left != right (2)");return!0}));class w{constructor(e,t,r,n){this.ex=e,this.ey=t,this.ez=r,this.et=n,g("x",e),g("y",t),g("z",r),g("t",n),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof w)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};return g("x",t),g("y",r),new w(t,r,je,h(t*r))}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.ez)));return e.map(((e,r)=>e.toAffine(t[r]))).map(w.fromAffine)}static msm(e,t){return Le(w,l,e,t)}_setWindowSize(e){_.setWindowSize(this,e)}assertValidity(){m(this)}equals(e){y(e);const{ex:t,ey:r,ez:n}=this,{ex:i,ey:o,ez:s}=e,a=h(t*s),c=h(i*n),u=h(r*s),l=h(o*n);return a===c&&u===l}is0(){return this.equals(w.ZERO)}negate(){return new w(h(-this.ex),this.ey,this.ez,h(-this.et))}double(){const{a:e}=t,{ex:r,ey:n,ez:i}=this,o=h(r*r),s=h(n*n),a=h(ze*h(i*i)),c=h(e*o),u=r+n,l=h(h(u*u)-o-s),d=c+s,f=d-a,p=c-s,g=h(l*f),y=h(d*p),b=h(l*p),m=h(f*d);return new w(g,y,m,b)}add(e){y(e);const{a:r,d:n}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:c,ey:u,ez:l,et:d}=e;if(r===BigInt(-1)){const e=h((o-i)*(u+c)),t=h((o+i)*(u-c)),r=h(t-e);if(r===De)return this.double();const n=h(s*ze*d),f=h(a*ze*l),p=f+n,g=t+e,y=f-n,b=h(p*r),m=h(g*y),v=h(p*y),S=h(r*g);return new w(b,m,S,v)}const f=h(i*c),p=h(o*u),g=h(a*n*d),b=h(s*l),m=h((i+o)*(c+u)-f-p),v=b-g,S=b+g,_=h(p-r*f),E=h(m*v),I=h(S*_),A=h(m*_),k=h(v*S);return new w(E,I,k,A)}subtract(e){return this.add(e.negate())}wNAF(e){return _.wNAFCached(this,e,w.normalizeZ)}multiply(e){const t=e;re("scalar",t,je,n);const{p:r,f:i}=this.wNAF(t);return w.normalizeZ([r,i])[0]}multiplyUnsafe(e,t=w.ZERO){const r=e;return re("scalar",r,De,n),r===De?S:this.is0()||r===je?this:_.wNAFCachedUnsafe(this,r,w.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,n).is0()}toAffine(e){return b(this,e)}clearCofactor(){const{h:e}=t;return e===je?this:this.multiplyUnsafe(e)}static fromHex(e,n=!1){const{d:i,a:o}=t,s=r.BYTES;e=Z("pointHex",e,s),z("zip215",n);const a=e.slice(),c=e[s-1];a[s-1]=-129&c;const l=Y(a),f=n?u:r.ORDER;re("pointHex.y",l,De,f);const p=h(l*l),g=h(p-je),y=h(i*p-o);let{isValid:b,value:m}=d(g,y);if(!b)throw new Error("Point.fromHex: invalid y coordinate");const v=(m&je)===je,S=!!(128&c);if(!n&&m===De&&S)throw new Error("Point.fromHex: x=0 and x_0=1");return S!==v&&(m=h(-m)),w.fromAffine({x:m,y:l})}static fromPrivateKey(e){return A(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=X(t,r.BYTES);return n[n.length-1]|=e&je?128:0,n}toHex(){return $(this.toRawBytes())}}w.BASE=new w(t.Gx,t.Gy,je,h(t.Gx*t.Gy)),w.ZERO=new w(De,je,je,De);const{BASE:v,ZERO:S}=w,_=Be(w,8*a);function E(e){return me(e,n)}function I(e){return E(Y(e))}function A(e){const t=r.BYTES;e=Z("private key",e,t);const n=Z("hashed private key",o(e),2*t),i=f(n.slice(0,t)),s=n.slice(t,2*t),a=I(i),c=v.multiply(a),u=c.toRawBytes();return{head:i,prefix:s,scalar:a,point:c,pointBytes:u}}function k(e=new Uint8Array,...t){const r=Q(...t);return I(o(p(r,Z("context",e),!!i)))}const x=$e;return v._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return A(e).pointBytes},sign:function(e,t,o={}){e=Z("message",e),i&&(e=i(e));const{prefix:s,scalar:a,pointBytes:c}=A(t),u=k(o.context,s,e),h=v.multiply(u).toRawBytes(),l=E(u+k(o.context,h,c,e)*a);return re("signature.s",l,De,n),Z("result",Q(h,X(l,r.BYTES)),2*r.BYTES)},verify:function(e,t,n,o=x){const{context:s,zip215:a}=o,c=r.BYTES;e=Z("signature",e,2*c),t=Z("message",t),n=Z("publicKey",n,c),void 0!==a&&z("zip215",a),i&&(t=i(t));const u=Y(e.slice(c,2*c));let h,l,d;try{h=w.fromHex(n,a),l=w.fromHex(e.slice(0,c),a),d=v.multiplyUnsafe(u)}catch(e){return!1}if(!a&&h.isSmallOrder())return!1;const f=k(s,l.toRawBytes(),h.toRawBytes(),t);return l.add(h.multiplyUnsafe(f)).subtract(d).clearCofactor().equals(w.ZERO)},ExtendedPoint:w,utils:{getExtendedPublicKey:A,randomPrivateKey:()=>s(r.BYTES),precompute:(e=8,t=w.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}(Ze))();var et=r(5530),tt=r.n(et),rt=r(2112),nt=r.n(rt);const it=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]),ot=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),st=new Uint32Array(64);class at extends w{constructor(){super(64,32,8,!1),this.A=0|ot[0],this.B=0|ot[1],this.C=0|ot[2],this.D=0|ot[3],this.E=0|ot[4],this.F=0|ot[5],this.G=0|ot[6],this.H=0|ot[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)st[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=st[e-15],r=st[e-2],n=l(t,7)^l(t,18)^t>>>3,i=l(r,17)^l(r,19)^r>>>10;st[e]=i+st[e-7]+n+st[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(l(s,6)^l(s,11)^l(s,25))+((h=s)&a^~h&c)+it[e]+st[e]|0,d=(l(r,2)^l(r,13)^l(r,22))+m(r,n,i)|0;u=c,c=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+d|0}var h;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,s,a,c,u)}roundClean(){st.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ct=y((()=>new at));var ut=r(9461),ht=r(3035),lt=r(2550);class dt extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...o}=e,{path:s}=e,a=0===s.length?n:`At path: ${s.join(".")} -- ${n}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function ft(e){return"object"==typeof e&&null!=e}function pt(e){return ft(e)&&!Array.isArray(e)}function gt(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function yt(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=r,{refinement:a,message:c=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${gt(n)}\``}=e;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*bt(e,t,r,n){var i;ft(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=yt(i,t,r,n);e&&(yield e)}}function*mt(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:s=!1}=r,a={path:n,branch:i,mask:s};o&&(e=t.coercer(e,a));let c="valid";for(const n of t.validator(e,a))n.explanation=r.message,c="not_valid",yield[n,void 0];for(let[u,h,l]of t.entries(e,a)){const t=mt(h,l,{path:void 0===u?n:[...n,u],branch:void 0===u?i:[...i,h],coerce:o,mask:s,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):o&&(h=r[1],void 0===u?e=h:e instanceof Map?e.set(u,h):e instanceof Set?e.add(h):ft(e)&&(void 0!==h||u in e)&&(e[u]=h))}if("not_valid"!==c)for(const n of t.refiner(e,a))n.explanation=r.message,c="not_refined",yield[n,void 0];"valid"===c&&(yield[void 0,e])}class wt{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:o=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=r,this.entries=s,this.coercer=o,this.validator=n?(e,t)=>bt(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>bt(i(e,t),t,this,e):()=>[]}assert(e,t){return vt(e,this,t)}create(e,t){return St(e,this,t)}is(e){return _t(e,this)}mask(e,t){return function(e,t,r){const n=Et(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}(e,this,t)}validate(e,t={}){return Et(e,this,t)}}function vt(e,t,r){const n=Et(e,t,{message:r});if(n[0])throw n[0]}function St(e,t,r){const n=Et(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function _t(e,t){return!Et(e,t)[0]}function Et(e,t,r={}){const n=mt(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);return i[0]?[new dt(i[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]:[void 0,i[1]]}function It(e,t){return new wt({type:e,schema:null,validator:t})}function At(e){return new wt({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${gt(e)}`})}function kt(){return It("boolean",(e=>"boolean"==typeof e))}function xt(e){return It("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${gt(t)}`))}function Pt(e){const t=gt(e),r=typeof e;return new wt({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${gt(r)}`})}function Ot(e){return new wt({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function Rt(){return It("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${gt(e)}`))}function Tt(e){return new wt({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function Nt(e,t){return new wt({type:"record",schema:null,*entries(r){if(ft(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>pt(e)||`Expected an object, but received: ${gt(e)}`,coercer:e=>pt(e)?{...e}:e})}function Mt(){return It("string",(e=>"string"==typeof e||`Expected a string, but received: ${gt(e)}`))}function Ct(e){const t=It("never",(()=>!1));return new wt({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${gt(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function Bt(e){const t=Object.keys(e);return new wt({type:"type",schema:e,*entries(r){if(ft(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>pt(e)||`Expected an object, but received: ${gt(e)}`,coercer:e=>pt(e)?{...e}:e})}function Lt(e){const t=e.map((e=>e.type)).join(" | ");return new wt({type:"union",schema:null,coercer(t,r){for(const n of e){const[e,i]=n.validate(t,{coerce:!0,mask:r.mask});if(!e)return i}return t},validator(r,n){const i=[];for(const t of e){const[...e]=mt(r,t,n),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${gt(r)}`,...i]}})}function Ut(){return It("unknown",(()=>!0))}function Dt(e,t,r){return new wt({...e,coercer:(n,i)=>_t(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}var jt=r(5864),zt=r.n(jt),qt=r(2646),$t=class extends qt{socket;constructor(e,t,r){super(),this.socket=new window.WebSocket(e,r),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,r){const n=r||t;try{this.socket.send(e),n()}catch(e){n(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,r){this.socket.addEventListener(e,t,r)}};var Ft=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},Wt=class extends qt{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:n=!0,reconnect_interval:i=1e3,max_reconnects:o=5,...s}={},a,c){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=n,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=o,this.rest_options=s,this.current_reconnects=0,this.generate_request_id=a||(()=>++this.rpc_id),this.dataPack=c||new Ft,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,r,n){return n||"object"!=typeof r||(n=r,r=null),new Promise(((i,o)=>{if(!this.ready)return o(new Error("socket not ready"));const s=this.generate_request_id(e,t),a={jsonrpc:"2.0",method:e,params:t||void 0,id:s};this.socket.send(this.dataPack.encode(a),n,(e=>{if(e)return o(e);this.queue[s]={promise:[i,o]},r&&(this.queue[s].timeout=setTimeout((()=>{delete this.queue[s],o(new Error("reply timeout"))}),r))}))}))}async login(e){const t=await this.call("rpc.login",e);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise(((r,n)=>{if(!this.ready)return n(new Error("socket not ready"));const i={jsonrpc:"2.0",method:e,params:t};this.socket.send(this.dataPack.encode(i),(e=>{if(e)return n(e);r()}))}))}async subscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",(()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0})),this.socket.addEventListener("message",(({data:e})=>{e instanceof ArrayBuffer&&(e=i.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);const t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let r=0;r<e.params.length;r++)t.push(e.params[r]);return Promise.resolve().then((()=>{this.emit.apply(this,t)}))}if(!this.queue[e.id])return e.method?Promise.resolve().then((()=>{this.emit(e.method,e?.params)})):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]})),this.socket.addEventListener("error",(e=>this.emit("error",e))),this.socket.addEventListener("close",(({code:r,reason:n})=>{this.ready&&setTimeout((()=>this.emit("close",r,n)),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)&&(this.reconnect_timer_id=setTimeout((()=>this._connect(e,t)),this.reconnect_interval)))}))}};const Kt=[],Ht=[],Vt=[],Gt=BigInt(0),Yt=BigInt(1),Jt=BigInt(2),Xt=BigInt(7),Zt=BigInt(256),Qt=BigInt(113);for(let e=0,t=Yt,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Kt.push(2*(5*n+r)),Ht.push((e+1)*(e+2)/2%64);let i=Gt;for(let e=0;e<7;e++)t=(t<<Yt^(t>>Xt)*Qt)%Zt,t&Jt&&(i^=Yt<<(Yt<<BigInt(e))-Yt);Vt.push(i)}const[er,tr]=E(Vt,!0),rr=(e,t,r)=>r>32?k(e,t,r):I(e,t,r),nr=(e,t,r)=>r>32?x(e,t,r):A(e,t,r);class ir extends g{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,o(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){d||f(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=rr(o,s,1)^r[n],c=nr(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Ht[r],o=rr(t,i,n),s=nr(t,i,n),a=Kt[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=er[n],e[1]^=tr[n]}r.fill(0)}(this.state32,this.rounds),d||f(this.state32),this.posOut=0,this.pos=0}update(e){a(this);const{blockLen:t,state:r}=this,n=(e=p(e)).length;for(let i=0;i<n;){const o=Math.min(t-this.pos,n-i);for(let t=0;t<o;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){a(this,!1),s(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return o(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(c(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new ir(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}const or=((e,t,r)=>y((()=>new ir(t,e,r))))(1,136,32);class sr extends g{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(e.outputLen),o(e.blockLen)}(e);const r=p(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return a(this),this.iHash.update(e),this}digestInto(e){a(this),s(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ar=(e,t,r)=>new sr(e,t).update(r).digest();function cr(e){void 0!==e.lowS&&z("lowS",e.lowS),void 0!==e.prehash&&z("prehash",e.prehash)}ar.create=(e,t)=>new sr(e,t);const{Ph:ur,aT:hr}=n;class lr extends Error{constructor(e=""){super(e)}}const dr={Err:lr,_tlv:{encode:(e,t)=>{const{Err:r}=dr;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");const n=t.length/2,i=F(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const o=n>127?F(i.length/2|128):"";return F(e)+o+i+t},decode(e,t){const{Err:r}=dr;let n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");const i=t[n++];let o=0;if(128&i){const e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const s=t.subarray(n,n+e);if(s.length!==e)throw new r("tlv.decode: length bytes not complete");