You are viewing a single comment's thread from:

RE: Propolis Wallet v1 (EN)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Propolis Wallet</title>
  <script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const c of s.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function e(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=e(i);fetch(i.href,s)}})();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ke(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Pt(n,t=""){if(!Number.isSafeInteger(n)||n<0){const e=t&&`"${t}" `;throw new Error(`${e}expected integer >= 0, got ${n}`)}}function Z(n,t,e=""){const r=Ke(n),i=n?.length,s=t!==void 0;if(!r||s&&i!==t){const c=e&&`"${e}" `,a=s?` of length ${t}`:"",o=r?`length=${i}`:`type=${typeof n}`;throw new Error(c+"expected Uint8Array"+a+", got "+o)}return n}function Ln(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Pt(n.outputLen),Pt(n.blockLen)}function ge(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 Ir(n,t){Z(n,void 0,"digestInto() output");const e=t.outputLen;if(n.length<e)throw new Error('"digestInto() output" expected to be of length >='+e)}function Nt(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function Ie(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function mt(n,t){return n<<32-t|n>>>t}function ce(n,t){return n<<t|n>>>32-t>>>0}const Bn=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Lr=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function yt(n){if(Z(n),Bn)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Lr[n[e]];return t}const _t={_0:48,_9:57,A:65,F:70,a:97,f:102};function sn(n){if(n>=_t._0&&n<=_t._9)return n-_t._0;if(n>=_t.A&&n<=_t.F)return n-(_t.A-10);if(n>=_t.a&&n<=_t.f)return n-(_t.a-10)}function gt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(Bn)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const c=sn(n.charCodeAt(s)),a=sn(n.charCodeAt(s+1));if(c===void 0||a===void 0){const o=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+o+'" at index '+s)}r[i]=c*16+a}return r}function Ct(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];Z(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}function Pe(n,t={}){const e=(i,s)=>n(s).update(i).digest(),r=n(void 0);return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=i=>n(i),Object.assign(e,t),Object.freeze(e)}function Un(n=32){const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(n))}const kn=n=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,n])});/**
 * @license bytebuffer.ts (c) 2015 Daniel Wirtz <dcode@dcode.io>
 * Backing buffer: ArrayBuffer, Accessor: DataView
 * Released under the Apache License, Version 2.0
 * see: https://github.com/dcodeIO/bytebuffer.ts for details
 * modified by @xmcl/bytebuffer
 * And customized for hive-tx
 */const ae=new ArrayBuffer(0),Br=new TextEncoder,on=new TextDecoder;class O{constructor(t=O.DEFAULT_CAPACITY,e=O.DEFAULT_ENDIAN){this.readUInt32=this.readUint32,this.buffer=t===0?ae:new ArrayBuffer(t),this.view=t===0?new DataView(ae):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e}static allocate(t,e){return new O(t,e)}static concat(t,e){let r=0;for(let a=0;a<t.length;++a){const o=t[a];if(o instanceof O)r+=o.limit-o.offset;else if(o instanceof Uint8Array)r+=o.length;else if(o instanceof ArrayBuffer)r+=o.byteLength;else if(Array.isArray(o))r+=o.length;else throw TypeError("Illegal buffer")}if(r===0)return new O(0,e);const i=new O(r,e),s=new Uint8Array(i.buffer);let c=0;for(let a=0;a<t.length;++a){let o=t[a];o instanceof O?(s.set(new Uint8Array(o.buffer,o.offset,o.limit-o.offset),c),c+=o.limit-o.offset):o instanceof Uint8Array?(s.set(o,c),c+=o.length):o instanceof ArrayBuffer?(s.set(new Uint8Array(o),c),c+=o.byteLength):(s.set(o,c),c+=o.length)}return i.limit=i.offset=c,i.offset=0,i}static wrap(t,e){if(t instanceof O){const i=t.clone();return i.markedOffset=-1,i}let r;if(t instanceof Uint8Array)r=new O(0,e),t.length>0&&(r.buffer=t.buffer,r.offset=t.byteOffset,r.limit=t.byteOffset+t.byteLength,r.view=new DataView(t.buffer));else if(t instanceof ArrayBuffer)r=new O(0,e),t.byteLength>0&&(r.buffer=t,r.offset=0,r.limit=t.byteLength,r.view=t.byteLength>0?new DataView(t):new DataView(ae));else if(Array.isArray(t))r=new O(t.length,e),r.limit=t.length,new Uint8Array(r.buffer).set(t);else throw TypeError("Illegal buffer");return r}writeBytes(t,e){return this.append(t,e)}writeInt8(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+1>this.buffer.byteLength&&this.resize(e+1),this.view.setInt8(e,t),r&&(this.offset+=1),this}writeByte(t,e){return this.writeInt8(t,e)}writeUint8(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+1>this.buffer.byteLength&&this.resize(e+1),this.view.setUint8(e,t),r&&(this.offset+=1),this}writeUInt8(t,e){return this.writeUint8(t,e)}readUint8(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getUint8(t);return e&&(this.offset+=1),r}readUInt8(t){return this.readUint8(t)}writeInt16(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+2>this.buffer.byteLength&&this.resize(e+2),this.view.setInt16(e,t,this.littleEndian),r&&(this.offset+=2),this}writeShort(t,e){return this.writeInt16(t,e)}writeUint16(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+2>this.buffer.byteLength&&this.resize(e+2),this.view.setUint16(e,t,this.littleEndian),r&&(this.offset+=2),this}writeUInt16(t,e){return this.writeUint16(t,e)}writeInt32(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+4>this.buffer.byteLength&&this.resize(e+4),this.view.setInt32(e,t,this.littleEndian),r&&(this.offset+=4),this}writeInt(t,e){return this.writeInt32(t,e)}writeUint32(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+4>this.buffer.byteLength&&this.resize(e+4),this.view.setUint32(e,t,this.littleEndian),r&&(this.offset+=4),this}writeUInt32(t,e){return this.writeUint32(t,e)}readUint32(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getUint32(t,this.littleEndian);return e&&(this.offset+=4),r}append(t,e){const r=typeof e>"u";r?e=this.offset:e=e;let i;return t instanceof O?(i=new Uint8Array(t.buffer,t.offset,t.limit-t.offset),t.offset+=i.length):t instanceof Uint8Array?i=t:t instanceof ArrayBuffer?i=new Uint8Array(t):i=new Uint8Array(t),i.length<=0?this:(e+i.length>this.buffer.byteLength&&this.resize(e+i.length),new Uint8Array(this.buffer).set(i,e),r&&(this.offset+=i.length),this)}clone(t){const e=new O(0,this.littleEndian);return t?(e.buffer=new ArrayBuffer(this.buffer.byteLength),new Uint8Array(e.buffer).set(new Uint8Array(this.buffer)),e.view=new DataView(e.buffer)):(e.buffer=this.buffer,e.view=this.view),e.offset=this.offset,e.markedOffset=this.markedOffset,e.limit=this.limit,e}copy(t,e){if(t===void 0&&(t=this.offset),e===void 0&&(e=this.limit),t===e)return new O(0,this.littleEndian);const r=e-t,i=new O(r,this.littleEndian);return i.offset=0,i.limit=r,new Uint8Array(i.buffer).set(new Uint8Array(this.buffer).subarray(t,e),0),i}copyTo(t,e,r,i){const s=typeof e>"u",c=typeof r>"u";e=s?t.offset:e,r=c?this.offset:r,i=i===void 0?this.limit:i;const a=i-r;return a===0?t:(t.ensureCapacity(e+a),new Uint8Array(t.buffer).set(new Uint8Array(this.buffer).subarray(r,i),e),c&&(this.offset+=a),s&&(t.offset+=a),this)}ensureCapacity(t){let e=this.buffer.byteLength;return e<t?this.resize((e*=2)>t?e:t):this}flip(){return this.limit=this.offset,this.offset=0,this}resize(t){if(this.buffer.byteLength<t){const e=new ArrayBuffer(t);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}return this}skip(t){return this.offset+=t,this}writeInt64(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,typeof t=="number"&&(t=BigInt(t)),e+8>this.buffer.byteLength&&this.resize(e+8),this.view.setBigInt64(e,t,this.littleEndian),r&&(this.offset+=8),this}writeLong(t,e){return this.writeInt64(t,e)}readInt64(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getBigInt64(t,this.littleEndian);return e&&(this.offset+=8),r}readLong(t){return this.readInt64(t)}writeUint64(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,typeof t=="number"&&(t=BigInt(t)),e+8>this.buffer.byteLength&&this.resize(e+8),this.view.setBigUint64(e,t,this.littleEndian),r&&(this.offset+=8),this}writeUInt64(t,e){return this.writeUint64(t,e)}readUint64(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getBigUint64(t,this.littleEndian);return e&&(this.offset+=8),r}readUInt64(t){return this.readUint64(t)}toBuffer(t){const e=this.offset,r=this.limit;return!t&&e===0&&r===this.buffer.byteLength?this.buffer:e===r?ae:this.buffer.slice(e,r)}toArrayBuffer(t){return this.toBuffer(t)}writeVarint32(t,e){const r=typeof e>"u";r?e=this.offset:e=e;const i=this.calculateVarint32(t);for(e+i>this.buffer.byteLength&&this.resize(e+i),t>>>=0;t>=128;)this.view.setUint8(e++,t&127|128),t>>>=7;return this.view.setUint8(e++,t),r?(this.offset=e,this):i}readVarint32(t){const e=typeof t>"u";typeof t>"u"&&(t=this.offset);let r=0,i=0,s;do s=this.view.getUint8(t++),r<5&&(i|=(s&127)<<7*r),++r;while((s&128)!==0);return i|=0,e?(this.offset=t,i):{value:i,length:r}}calculateVarint32(t){return t=t>>>0,t<128?1:t<16384?2:t<1<<21?3:t<1<<28?4:5}writeVString(t,e){const r=typeof e>"u";let i=r?this.offset:e;const s=Br.encode(t),c=s.length,a=this.calculateVarint32(c);return i+a+c>this.buffer.byteLength&&this.resize(i+a+c),this.writeVarint32(c,i),i+=a,new Uint8Array(this.buffer).set(s,i),i+=c,r?(this.offset=i,this):i-(e||0)}readVString(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=t,i=this.readVarint32(t),s=i.value,c=i.length;t+=c;const a=on.decode(new Uint8Array(this.buffer,t,s));return t+=s,e?(this.offset=t,a):{string:a,length:t-r}}readUTF8String(t,e){const r=typeof e>"u";r?e=this.offset:e=e;const i=on.decode(new Uint8Array(this.buffer,e,t));return r?(this.offset+=t,i):{string:i,length:t}}}O.LITTLE_ENDIAN=!0;O.BIG_ENDIAN=!1;O.DEFAULT_CAPACITY=16;O.DEFAULT_ENDIAN=O.BIG_ENDIAN;function Ur(n,t,e){return n&t^~n&e}function kr(n,t,e){return n&t^n&e^t&e}class Fe{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,r,i){this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Ie(this.buffer)}update(t){ge(this),Z(t);const{view:e,buffer:r,blockLen:i}=this,s=t.length;for(let c=0;c<s;){const a=Math.min(i-this.pos,s-c);if(a===i){const o=Ie(t);for(;i<=s-c;c+=i)this.process(o,c);continue}r.set(t.subarray(c,c+a),this.pos),this.pos+=a,c+=a,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ge(this),Ir(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:s}=this;let{pos:c}=this;e[c++]=128,Nt(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(r,0),c=0);for(let u=c;u<i;u++)e[u]=0;r.setBigUint64(i-8,BigInt(this.length*8),s),this.process(r,0);const a=Ie(t),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const l=o/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,d[u],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:s,destroyed:c,pos:a}=this;return t.destroyed=c,t.finished=s,t.length=i,t.pos=a,i%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Lt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Q=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),$r=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),$n=Uint8Array.from(new Array(16).fill(0).map((n,t)=>t)),Tr=$n.map(n=>(9*n+5)%16),Tn=(()=>{const e=[[$n],[Tr]];for(let r=0;r<4;r++)for(let i of e)i.push(i[r].map(s=>$r[s]));return e})(),Cn=Tn[0],Dn=Tn[1],Rn=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(n=>Uint8Array.from(n)),Cr=Cn.map((n,t)=>n.map(e=>Rn[t][e])),Dr=Dn.map((n,t)=>n.map(e=>Rn[t][e])),Rr=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Or=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function cn(n,t,e,r){return n===0?t^e^r:n===1?t&e|~t&r:n===2?(t|~e)^r:n===3?t&r|e&~r:t^(e|~r)}const le=new Uint32Array(16);class Nr extends Fe{h0=1732584193;h1=-271733879;h2=-1732584194;h3=271733878;h4=-1009589776;constructor(){super(64,20,8,!0)}get(){const{h0:t,h1:e,h2:r,h3:i,h4:s}=this;return[t,e,r,i,s]}set(t,e,r,i,s){this.h0=t|0,this.h1=e|0,this.h2=r|0,this.h3=i|0,this.h4=s|0}process(t,e){for(let f=0;f<16;f++,e+=4)le[f]=t.getUint32(e,!0);let r=this.h0|0,i=r,s=this.h1|0,c=s,a=this.h2|0,o=a,l=this.h3|0,d=l,u=this.h4|0,h=u;for(let f=0;f<5;f++){const w=4-f,b=Rr[f],y=Or[f],x=Cn[f],E=Dn[f],S=Cr[f],R=Dr[f];for(let N=0;N<16;N++){const z=ce(r+cn(f,s,a,l)+le[x[N]]+b,S[N])+u|0;r=u,u=l,l=ce(a,10)|0,a=s,s=z}for(let N=0;N<16;N++){const z=ce(i+cn(w,c,o,d)+le[E[N]]+y,R[N])+h|0;i=h,h=d,d=ce(o,10)|0,o=c,c=z}}this.set(this.h1+a+d|0,this.h2+l+h|0,this.h3+u+i|0,this.h4+r+c|0,this.h0+s+o|0)}roundClean(){Nt(le)}destroy(){this.destroyed=!0,Nt(this.buffer),this.set(0,0,0,0,0)}}const qr=Pe(()=>new Nr);function Hr(n){if(n.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let l=0;l<t.length;l++)t[l]=255;for(let l=0;l<n.length;l++){const d=n.charAt(l),u=d.charCodeAt(0);if(t[u]!==255)throw new TypeError(d+" is ambiguous");t[u]=l}const e=n.length,r=n.charAt(0),i=Math.log(e)/Math.log(256),s=Math.log(256)/Math.log(e);function c(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let d=0,u=0,h=0;const f=l.length;for(;h!==f&&l[h]===0;)h++,d++;const w=(f-h)*s+1>>>0,b=new Uint8Array(w);for(;h!==f;){let E=l[h],S=0;for(let R=w-1;(E!==0||S<u)&&R!==-1;R--,S++)E+=256*b[R]>>>0,b[R]=E%e>>>0,E=E/e>>>0;if(E!==0)throw new Error("Non-zero carry");u=S,h++}let y=w-u;for(;y!==w&&b[y]===0;)y++;let x=r.repeat(d);for(;y<w;++y)x+=n.charAt(b[y]);return x}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,u=0,h=0;for(;l[d]===r;)u++,d++;const f=(l.length-d)*i+1>>>0,w=new Uint8Array(f);for(;d<l.length;){const E=l.charCodeAt(d);if(E>255)return;let S=t[E];if(S===255)return;let R=0;for(let N=f-1;(S!==0||R<h)&&N!==-1;N--,R++)S+=e*w[N]>>>0,w[N]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");h=R,d++}let b=f-h;for(;b!==f&&w[b]===0;)b++;const y=new Uint8Array(u+(f-b));let x=u;for(;b!==f;)y[x++]=w[b++];return y}function o(l){const d=a(l);if(d)return d;throw new Error("Non-base"+e+" character")}return{encode:c,decodeUnsafe:a,decode:o}}var Mr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const ee=Hr(Mr),ut={nodes:["https://api.hive.blog","https://api.deathwing.me","https://api.openhive.network","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],restNodes:["https://api.hive.blog","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],chain_id:"beeab0de00000000000000000000000000000000000000000000000000000000",address_prefix:"STM",timeout:1e4,retry:8},de=BigInt(2**32-1),an=BigInt(32);function Vr(n,t=!1){return t?{h:Number(n&de),l:Number(n>>an&de)}:{h:Number(n>>an&de)|0,l:Number(n&de)|0}}function zr(n,t=!1){const e=n.length;let r=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:c,l:a}=Vr(n[s],t);[r[s],i[s]]=[c,a]}return[r,i]}const ln=(n,t,e)=>n>>>e,dn=(n,t,e)=>n<<32-e|t>>>e,Zt=(n,t,e)=>n>>>e|t<<32-e,Wt=(n,t,e)=>n<<32-e|t>>>e,ue=(n,t,e)=>n<<64-e|t>>>e-32,fe=(n,t,e)=>n>>>e-32|t<<64-e;function vt(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const Kr=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Pr=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Fr=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),jr=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,Zr=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),Wr=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,Yr=Uint32Array.from([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]),Bt=new Uint32Array(64);class Gr extends Fe{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:i,E:s,F:c,G:a,H:o}=this;return[t,e,r,i,s,c,a,o]}set(t,e,r,i,s,c,a,o){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=c|0,this.G=a|0,this.H=o|0}process(t,e){for(let u=0;u<16;u++,e+=4)Bt[u]=t.getUint32(e,!1);for(let u=16;u<64;u++){const h=Bt[u-15],f=Bt[u-2],w=mt(h,7)^mt(h,18)^h>>>3,b=mt(f,17)^mt(f,19)^f>>>10;Bt[u]=b+Bt[u-7]+w+Bt[u-16]|0}let{A:r,B:i,C:s,D:c,E:a,F:o,G:l,H:d}=this;for(let u=0;u<64;u++){const h=mt(a,6)^mt(a,11)^mt(a,25),f=d+h+Ur(a,o,l)+Yr[u]+Bt[u]|0,b=(mt(r,2)^mt(r,13)^mt(r,22))+kr(r,i,s)|0;d=l,l=o,o=a,a=c+f|0,c=s,s=i,i=r,r=f+b|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,c=c+this.D|0,a=a+this.E|0,o=o+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(r,i,s,c,a,o,l,d)}roundClean(){Nt(Bt)}destroy(){this.set(0,0,0,0,0,0,0,0),Nt(this.buffer)}}class Xr extends Gr{A=Lt[0]|0;B=Lt[1]|0;C=Lt[2]|0;D=Lt[3]|0;E=Lt[4]|0;F=Lt[5]|0;G=Lt[6]|0;H=Lt[7]|0;constructor(){super(32)}}const On=zr(["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))),Jr=On[0],Qr=On[1],Ut=new Uint32Array(80),kt=new Uint32Array(80);class ti extends Fe{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:e,Bh:r,Bl:i,Ch:s,Cl:c,Dh:a,Dl:o,Eh:l,El:d,Fh:u,Fl:h,Gh:f,Gl:w,Hh:b,Hl:y}=this;return[t,e,r,i,s,c,a,o,l,d,u,h,f,w,b,y]}set(t,e,r,i,s,c,a,o,l,d,u,h,f,w,b,y){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=c|0,this.Dh=a|0,this.Dl=o|0,this.Eh=l|0,this.El=d|0,this.Fh=u|0,this.Fl=h|0,this.Gh=f|0,this.Gl=w|0,this.Hh=b|0,this.Hl=y|0}process(t,e){for(let S=0;S<16;S++,e+=4)Ut[S]=t.getUint32(e),kt[S]=t.getUint32(e+=4);for(let S=16;S<80;S++){const R=Ut[S-15]|0,N=kt[S-15]|0,z=Zt(R,N,1)^Zt(R,N,8)^ln(R,N,7),nt=Wt(R,N,1)^Wt(R,N,8)^dn(R,N,7),W=Ut[S-2]|0,$=kt[S-2]|0,at=Zt(W,$,19)^ue(W,$,61)^ln(W,$,6),it=Wt(W,$,19)^fe(W,$,61)^dn(W,$,6),H=Fr(nt,it,kt[S-7],kt[S-16]),v=jr(H,z,at,Ut[S-7],Ut[S-16]);Ut[S]=v|0,kt[S]=H|0}let{Ah:r,Al:i,Bh:s,Bl:c,Ch:a,Cl:o,Dh:l,Dl:d,Eh:u,El:h,Fh:f,Fl:w,Gh:b,Gl:y,Hh:x,Hl:E}=this;for(let S=0;S<80;S++){const R=Zt(u,h,14)^Zt(u,h,18)^ue(u,h,41),N=Wt(u,h,14)^Wt(u,h,18)^fe(u,h,41),z=u&f^~u&b,nt=h&w^~h&y,W=Zr(E,N,nt,Qr[S],kt[S]),$=Wr(W,x,R,z,Jr[S],Ut[S]),at=W|0,it=Zt(r,i,28)^ue(r,i,34)^ue(r,i,39),H=Wt(r,i,28)^fe(r,i,34)^fe(r,i,39),v=r&s^r&a^s&a,_=i&c^i&o^c&o;x=b|0,E=y|0,b=f|0,y=w|0,f=u|0,w=h|0,{h:u,l:h}=vt(l|0,d|0,$|0,at|0),l=a|0,d=o|0,a=s|0,o=c|0,s=r|0,c=i|0;const g=Kr(at,H,_);r=Pr(g,$,it,v),i=g|0}({h:r,l:i}=vt(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:c}=vt(this.Bh|0,this.Bl|0,s|0,c|0),{h:a,l:o}=vt(this.Ch|0,this.Cl|0,a|0,o|0),{h:l,l:d}=vt(this.Dh|0,this.Dl|0,l|0,d|0),{h:u,l:h}=vt(this.Eh|0,this.El|0,u|0,h|0),{h:f,l:w}=vt(this.Fh|0,this.Fl|0,f|0,w|0),{h:b,l:y}=vt(this.Gh|0,this.Gl|0,b|0,y|0),{h:x,l:E}=vt(this.Hh|0,this.Hl|0,x|0,E|0),this.set(r,i,s,c,a,o,l,d,u,h,f,w,b,y,x,E)}roundClean(){Nt(Ut,kt)}destroy(){Nt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class ei extends ti{Ah=Q[0]|0;Al=Q[1]|0;Bh=Q[2]|0;Bl=Q[3]|0;Ch=Q[4]|0;Cl=Q[5]|0;Dh=Q[6]|0;Dl=Q[7]|0;Eh=Q[8]|0;El=Q[9]|0;Fh=Q[10]|0;Fl=Q[11]|0;Gh=Q[12]|0;Gl=Q[13]|0;Hh=Q[14]|0;Hl=Q[15]|0;constructor(){super(64)}}const Ft=Pe(()=>new Xr,kn(1)),Nn=Pe(()=>new ei,kn(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const je=BigInt(0),Oe=BigInt(1);function be(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}" `;throw new Error(e+"expected boolean, got type="+typeof n)}return n}function qn(n){if(typeof n=="bigint"){if(!we(n))throw new Error("positive bigint expected, got "+n)}else Pt(n);return n}function he(n){const t=qn(n).toString(16);return t.length&1?"0"+t:t}function Hn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?je:BigInt("0x"+n)}function Ee(n){return Hn(yt(n))}function Mn(n){return Hn(yt(ni(Z(n)).reverse()))}function Ze(n,t){Pt(t),n=qn(n);const e=gt(n.toString(16).padStart(t*2,"0"));if(e.length!==t)throw new Error("number too large");return e}function Vn(n,t){return Ze(n,t).reverse()}function ni(n){return Uint8Array.from(n)}const we=n=>typeof n=="bigint"&&je<=n;function ri(n,t,e){return we(n)&&we(t)&&we(e)&&t<=n&&n<e}function ii(n,t,e,r){if(!ri(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function si(n){let t;for(t=0;n>je;n>>=Oe,t+=1);return t}const We=n=>(Oe<<BigInt(n))-Oe;function oi(n,t,e){if(Pt(n,"hashLen"),Pt(t,"qByteLen"),typeof e!="function")throw new Error("hmacFn must be a function");const r=y=>new Uint8Array(y),i=Uint8Array.of(),s=Uint8Array.of(0),c=Uint8Array.of(1),a=1e3;let o=r(n),l=r(n),d=0;const u=()=>{o.fill(1),l.fill(0),d=0},h=(...y)=>e(l,Ct(o,...y)),f=(y=i)=>{l=h(s,y),o=h(),y.length!==0&&(l=h(c,y),o=h())},w=()=>{if(d++>=a)throw new Error("drbg: tried max amount of iterations");let y=0;const x=[];for(;y<t;){o=h();const E=o.slice();x.push(E),y+=o.length}return Ct(...x)};return(y,x)=>{u(),f(y);let E;for(;!(E=x(w()));)f();return u(),E}}function Ye(n,t={},e={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(s,c,a){const o=n[s];if(a&&o===void 0)return;const l=typeof o;if(l!==c||o===null)throw new Error(`param "${s}" is invalid: expected ${c}, got ${l}`)}const i=(s,c)=>Object.entries(s).forEach(([a,o])=>r(a,o,c));i(t,!1),i(e,!0)}function un(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(i!==void 0)return i;const s=n(e,...r);return t.set(e,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const rt=BigInt(0),et=BigInt(1),Ht=BigInt(2),zn=BigInt(3),Kn=BigInt(4),Pn=BigInt(5),ci=BigInt(7),Fn=BigInt(8),ai=BigInt(9),jn=BigInt(16);function lt(n,t){const e=n%t;return e>=rt?e:t+e}function st(n,t,e){let r=n;for(;t-- >rt;)r*=r,r%=e;return r}function fn(n,t){if(n===rt)throw new Error("invert: expected non-zero number");if(t<=rt)throw new Error("invert: expected positive modulus, got "+t);let e=lt(n,t),r=t,i=rt,s=et;for(;e!==rt;){const a=r/e,o=r%e,l=i-s*a;r=e,e=o,i=s,s=l}if(r!==et)throw new Error("invert: does not exist");return lt(i,t)}function Ge(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function Zn(n,t){const e=(n.ORDER+et)/Kn,r=n.pow(t,e);return Ge(n,r,t),r}function li(n,t){const e=(n.ORDER-Pn)/Fn,r=n.mul(t,Ht),i=n.pow(r,e),s=n.mul(t,i),c=n.mul(n.mul(s,Ht),i),a=n.mul(s,n.sub(c,n.ONE));return Ge(n,a,t),a}function di(n){const t=Se(n),e=Wn(n),r=e(t,t.neg(t.ONE)),i=e(t,r),s=e(t,t.neg(r)),c=(n+ci)/jn;return(a,o)=>{let l=a.pow(o,c),d=a.mul(l,r);const u=a.mul(l,i),h=a.mul(l,s),f=a.eql(a.sqr(d),o),w=a.eql(a.sqr(u),o);l=a.cmov(l,d,f),d=a.cmov(h,u,w);const b=a.eql(a.sqr(d),o),y=a.cmov(l,d,b);return Ge(a,y,o),y}}function Wn(n){if(n<zn)throw new Error("sqrt is not defined for small field");let t=n-et,e=0;for(;t%Ht===rt;)t/=Ht,e++;let r=Ht;const i=Se(n);for(;hn(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return Zn;let s=i.pow(r,t);const c=(t+et)/Ht;return function(o,l){if(o.is0(l))return l;if(hn(o,l)!==1)throw new Error("Cannot find square root");let d=e,u=o.mul(o.ONE,s),h=o.pow(l,t),f=o.pow(l,c);for(;!o.eql(h,o.ONE);){if(o.is0(h))return o.ZERO;let w=1,b=o.sqr(h);for(;!o.eql(b,o.ONE);)if(w++,b=o.sqr(b),w===d)throw new Error("Cannot find square root");const y=et<<BigInt(d-w-1),x=o.pow(u,y);d=w,u=o.sqr(x),h=o.mul(h,u),f=o.mul(f,x)}return f}}function ui(n){return n%Kn===zn?Zn:n%Fn===Pn?li:n%jn===ai?di(n):Wn(n)}const fi=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function hi(n){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=fi.reduce((r,i)=>(r[i]="function",r),t);return Ye(n,e),n}function pi(n,t,e){if(e<rt)throw new Error("invalid exponent, negatives unsupported");if(e===rt)return n.ONE;if(e===et)return t;let r=n.ONE,i=t;for(;e>rt;)e&et&&(r=n.mul(r,i)),i=n.sqr(i),e>>=et;return r}function Yn(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),i=t.reduce((c,a,o)=>n.is0(a)?c:(r[o]=c,n.mul(c,a)),n.ONE),s=n.inv(i);return t.reduceRight((c,a,o)=>n.is0(a)?c:(r[o]=n.mul(c,r[o]),n.mul(c,a)),s),r}function hn(n,t){const e=(n.ORDER-et)/Ht,r=n.pow(t,e),i=n.eql(r,n.ONE),s=n.eql(r,n.ZERO),c=n.eql(r,n.neg(n.ONE));if(!i&&!s&&!c)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function mi(n,t){t!==void 0&&Pt(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}class wi{ORDER;BITS;BYTES;isLE;ZERO=rt;ONE=et;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=rt)throw new Error("invalid field: expected ORDER > 0, got "+t);let r;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(r=e.BITS),typeof e.sqrt=="function"&&(this.sqrt=e.sqrt),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=e.allowedLengths?.slice()),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));const{nBitLength:i,nByteLength:s}=mi(t,r);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return lt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return rt<=t&&t<this.ORDER}is0(t){return t===rt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&et)===et}neg(t){return lt(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return lt(t*t,this.ORDER)}add(t,e){return lt(t+e,this.ORDER)}sub(t,e){return lt(t-e,this.ORDER)}mul(t,e){return lt(t*e,this.ORDER)}pow(t,e){return pi(this,t,e)}div(t,e){return lt(t*fn(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return fn(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=ui(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Vn(t,this.BYTES):Ze(t,this.BYTES)}fromBytes(t,e=!1){Z(t);const{_lengths:r,BYTES:i,isLE:s,ORDER:c,_mod:a}=this;if(r){if(!r.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const l=new Uint8Array(i);l.set(t,s?0:l.length-t.length),t=l}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let o=s?Mn(t):Ee(t);if(a&&(o=lt(o,c)),!e&&!this.isValid(o))throw new Error("invalid field element: outside of range 0..ORDER");return o}invertBatch(t){return Yn(this,t)}cmov(t,e,r){return r?e:t}}function Se(n,t={}){return new wi(n,t)}function Gn(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 Xn(n){const t=Gn(n);return t+Math.ceil(t/2)}function yi(n,t,e=!1){Z(n);const r=n.length,i=Gn(t),s=Xn(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=e?Mn(n):Ee(n),a=lt(c,t-et)+et;return e?Vn(a,i):Ze(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const te=BigInt(0),Mt=BigInt(1);function _e(n,t){const e=t.negate();return n?e:t}function pn(n,t){const e=Yn(n.Fp,t.map(r=>r.Z));return t.map((r,i)=>n.fromAffine(r.toAffine(e[i])))}function Jn(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Le(n,t){Jn(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=We(n),c=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:c}}function mn(n,t,e){const{windowSize:r,mask:i,maxNumber:s,shiftBy:c}=e;let a=Number(n&i),o=n>>c;a>r&&(a-=s,o+=Mt);const l=t*r,d=l+Math.abs(a)-1,u=a===0,h=a<0,f=t%2!==0;return{nextN:o,offset:d,isZero:u,isNeg:h,isNegF:f,offsetF:l}}const Be=new WeakMap,Qn=new WeakMap;function Ue(n){return Qn.get(n)||1}function wn(n){if(n!==te)throw new Error("invalid wNAF")}class gi{BASE;ZERO;Fn;bits;constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,r=this.ZERO){let i=t;for(;e>te;)e&Mt&&(r=r.add(i)),i=i.double(),e>>=Mt;return r}precomputeWindow(t,e){const{windows:r,windowSize:i}=Le(e,this.bits),s=[];let c=t,a=c;for(let o=0;o<r;o++){a=c,s.push(a);for(let l=1;l<i;l++)a=a.add(c),s.push(a);c=a.double()}return s}wNAF(t,e,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE;const c=Le(t,this.bits);for(let a=0;a<c.windows;a++){const{nextN:o,offset:l,isZero:d,isNeg:u,isNegF:h,offsetF:f}=mn(r,a,c);r=o,d?s=s.add(_e(h,e[f])):i=i.add(_e(u,e[l]))}return wn(r),{p:i,f:s}}wNAFUnsafe(t,e,r,i=this.ZERO){const s=Le(t,this.bits);for(let c=0;c<s.windows&&r!==te;c++){const{nextN:a,offset:o,isZero:l,isNeg:d}=mn(r,c,s);if(r=a,!l){const u=e[o];i=i.add(d?u.negate():u)}}return wn(r),i}getPrecomputes(t,e,r){let i=Be.get(e);return i||(i=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(i=r(i)),Be.set(e,i))),i}cached(t,e,r){const i=Ue(t);return this.wNAF(i,this.getPrecomputes(i,t,r),e)}unsafe(t,e,r,i){const s=Ue(t);return s===1?this._unsafeLadder(t,e,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),e,i)}createCache(t,e){Jn(e,this.bits),Qn.set(t,e),Be.delete(t)}hasCache(t){return Ue(t)!==1}}function bi(n,t,e,r){let i=t,s=n.ZERO,c=n.ZERO;for(;e>te||r>te;)e&Mt&&(s=s.add(i)),r&Mt&&(c=c.add(i)),i=i.double(),e>>=Mt,r>>=Mt;return{p1:s,p2:c}}function yn(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return hi(t),t}else return Se(n,{isLE:e})}function _i(n,t,e={},r){if(r===void 0&&(r=n==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const o of["p","n","h"]){const l=t[o];if(!(typeof l=="bigint"&&l>te))throw new Error(`CURVE.${o} must be positive bigint`)}const i=yn(t.p,e.Fp,r),s=yn(t.n,e.Fn,r),a=["Gx","Gy","a","b"];for(const o of a)if(!i.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:s}}function vi(n,t){return function(r){const i=n(r);return{secretKey:i,publicKey:t(i)}}}class tr{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,e){if(Ln(t),Z(e,void 0,"key"),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 r=this.blockLen,i=new Uint8Array(r);i.set(e.length>r?t.create().update(e).digest():e);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),Nt(i)}update(t){return ge(this),this.iHash.update(t),this}digestInto(t){ge(this),Z(t,this.outputLen,"output"),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||=Object.create(Object.getPrototypeOf(this),{});const{oHash:e,iHash:r,finished:i,destroyed:s,blockLen:c,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=c,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const er=(n,t,e)=>new tr(n,t).update(e).digest();er.create=(n,t)=>new tr(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gn=(n,t)=>(n+(n>=0?t:-t)/nr)/t;function xi(n,t,e){const[[r,i],[s,c]]=t,a=gn(c*n,e),o=gn(-i*n,e);let l=n-a*r-o*s,d=-a*i-o*c;const u=l<At,h=d<At;u&&(l=-l),h&&(d=-d);const f=We(Math.ceil(si(e)/2))+Jt;if(l<At||l>=f||d<At||d>=f)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:u,k1:l,k2neg:h,k2:d}}function Ne(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function ke(n,t){const e={};for(let r of Object.keys(t))e[r]=n[r]===void 0?t[r]:n[r];return be(e.lowS,"lowS"),be(e.prehash,"prehash"),e.format!==void 0&&Ne(e.format),e}class Ei extends Error{constructor(t=""){super(t)}}const Tt={Err:Ei,_tlv:{encode:(n,t)=>{const{Err:e}=Tt;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=he(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?he(i.length/2|128):"";return he(n)+s+i+t},decode(n,t){const{Err:e}=Tt;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let c=0;if(!s)c=i;else{const o=i&127;if(!o)throw new e("tlv.decode(long): indefinite length not supported");if(o>4)throw new e("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+o);if(l.length!==o)throw new e("tlv.decode: length bytes not complete");if(l[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const d of l)c=c<<8|d;if(r+=o,c<128)throw new e("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+c);if(a.length!==c)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+c)}}},_int:{encode(n){const{Err:t}=Tt;if(n<At)throw new t("integer: negative integers are not allowed");let e=he(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Tt;if(n[0]&128)throw new t("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ee(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Tt,i=Z(n,void 0,"signature"),{v:s,l:c}=r.decode(48,i);if(c.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:o}=r.decode(2,s),{v:l,l:d}=r.decode(2,o);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(l)}},hexFromSig(n){const{_tlv:t,_int:e}=Tt,r=t.encode(2,e.encode(n.r)),i=t.encode(2,e.encode(n.s)),s=r+i;return t.encode(48,s)}},At=BigInt(0),Jt=BigInt(1),nr=BigInt(2),pe=BigInt(3),Si=BigInt(4);function Ai(n,t={}){const e=_i("weierstrass",n,t),{Fp:r,Fn:i}=e;let s=e.CURVE;const{h:c,n:a}=s;Ye(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:o}=t;if(o&&(!r.is0(s.a)||typeof o.beta!="bigint"||!Array.isArray(o.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=ir(r,i);function d(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(H,v,_){const{x:g,y:A}=v.toAffine(),L=r.toBytes(g);if(be(_,"isCompressed"),_){d();const U=!r.isOdd(A);return Ct(rr(U),L)}else return Ct(Uint8Array.of(4),L,r.toBytes(A))}function h(H){Z(H,void 0,"Point");const{publicKey:v,publicKeyUncompressed:_}=l,g=H.length,A=H[0],L=H.subarray(1);if(g===v&&(A===2||A===3)){const U=r.fromBytes(L);if(!r.isValid(U))throw new Error("bad point: is not on curve, wrong x");const B=b(U);let I;try{I=r.sqrt(B)}catch(Y){const K=Y instanceof Error?": "+Y.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}d();const D=r.isOdd(I);return(A&1)===1!==D&&(I=r.neg(I)),{x:U,y:I}}else if(g===_&&A===4){const U=r.BYTES,B=r.fromBytes(L.subarray(0,U)),I=r.fromBytes(L.subarray(U,U*2));if(!y(B,I))throw new Error("bad point: is not on curve");return{x:B,y:I}}else throw new Error(`bad point: got length ${g}, expected compressed=${v} or uncompressed=${_}`)}const f=t.toBytes||u,w=t.fromBytes||h;function b(H){const v=r.sqr(H),_=r.mul(v,H);return r.add(r.add(_,r.mul(H,s.a)),s.b)}function y(H,v){const _=r.sqr(v),g=b(H);return r.eql(_,g)}if(!y(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const x=r.mul(r.pow(s.a,pe),Si),E=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(x,E)))throw new Error("bad curve params: a or b");function S(H,v,_=!1){if(!r.isValid(v)||_&&r.is0(v))throw new Error(`bad point coordinate ${H}`);return v}function R(H){if(!(H instanceof $))throw new Error("Weierstrass Point expected")}function N(H){if(!o||!o.basises)throw new Error("no endo");return xi(H,o.basises,i.ORDER)}const z=un((H,v)=>{const{X:_,Y:g,Z:A}=H;if(r.eql(A,r.ONE))return{x:_,y:g};const L=H.is0();v==null&&(v=L?r.ONE:r.inv(A));const U=r.mul(_,v),B=r.mul(g,v),I=r.mul(A,v);if(L)return{x:r.ZERO,y:r.ZERO};if(!r.eql(I,r.ONE))throw new Error("invZ was invalid");return{x:U,y:B}}),nt=un(H=>{if(H.is0()){if(t.allowInfinityPoint&&!r.is0(H.Y))return;throw new Error("bad point: ZERO")}const{x:v,y:_}=H.toAffine();if(!r.isValid(v)||!r.isValid(_))throw new Error("bad point: x or y not field elements");if(!y(v,_))throw new Error("bad point: equation left != right");if(!H.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function W(H,v,_,g,A){return _=new $(r.mul(_.X,H),_.Y,_.Z),v=_e(g,v),_=_e(A,_),v.add(_)}class ${static BASE=new $(s.Gx,s.Gy,r.ONE);static ZERO=new $(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(v,_,g){this.X=S("x",v),this.Y=S("y",_,!0),this.Z=S("z",g),Object.freeze(this)}static CURVE(){return s}static fromAffine(v){const{x:_,y:g}=v||{};if(!v||!r.isValid(_)||!r.isValid(g))throw new Error("invalid affine point");if(v instanceof $)throw new Error("projective point not allowed");return r.is0(_)&&r.is0(g)?$.ZERO:new $(_,g,r.ONE)}static fromBytes(v){const _=$.fromAffine(w(Z(v,void 0,"point")));return _.assertValidity(),_}static fromHex(v){return $.fromBytes(gt(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,_=!0){return it.createCache(this,v),_||this.multiply(pe),this}assertValidity(){nt(this)}hasEvenY(){const{y:v}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(v)}equals(v){R(v);const{X:_,Y:g,Z:A}=this,{X:L,Y:U,Z:B}=v,I=r.eql(r.mul(_,B),r.mul(L,A)),D=r.eql(r.mul(g,B),r.mul(U,A));return I&&D}negate(){return new $(this.X,r.neg(this.Y),this.Z)}double(){const{a:v,b:_}=s,g=r.mul(_,pe),{X:A,Y:L,Z:U}=this;let B=r.ZERO,I=r.ZERO,D=r.ZERO,q=r.mul(A,A),Y=r.mul(L,L),K=r.mul(U,U),M=r.mul(A,L);return M=r.add(M,M),D=r.mul(A,U),D=r.add(D,D),B=r.mul(v,D),I=r.mul(g,K),I=r.add(B,I),B=r.sub(Y,I),I=r.add(Y,I),I=r.mul(B,I),B=r.mul(M,B),D=r.mul(g,D),K=r.mul(v,K),M=r.sub(q,K),M=r.mul(v,M),M=r.add(M,D),D=r.add(q,q),q=r.add(D,q),q=r.add(q,K),q=r.mul(q,M),I=r.add(I,q),K=r.mul(L,U),K=r.add(K,K),q=r.mul(K,M),B=r.sub(B,q),D=r.mul(K,Y),D=r.add(D,D),D=r.add(D,D),new $(B,I,D)}add(v){R(v);const{X:_,Y:g,Z:A}=this,{X:L,Y:U,Z:B}=v;let I=r.ZERO,D=r.ZERO,q=r.ZERO;const Y=s.a,K=r.mul(s.b,pe);let M=r.mul(_,L),P=r.mul(g,U),X=r.mul(A,B),pt=r.add(_,g),F=r.add(L,U);pt=r.mul(pt,F),F=r.add(M,P),pt=r.sub(pt,F),F=r.add(_,A);let J=r.add(L,B);return F=r.mul(F,J),J=r.add(M,X),F=r.sub(F,J),J=r.add(g,A),I=r.add(U,B),J=r.mul(J,I),I=r.add(P,X),J=r.sub(J,I),q=r.mul(Y,F),I=r.mul(K,X),q=r.add(I,q),I=r.sub(P,q),q=r.add(P,q),D=r.mul(I,q),P=r.add(M,M),P=r.add(P,M),X=r.mul(Y,X),F=r.mul(K,F),P=r.add(P,X),X=r.sub(M,X),X=r.mul(Y,X),F=r.add(F,X),M=r.mul(P,F),D=r.add(D,M),M=r.mul(J,F),I=r.mul(pt,I),I=r.sub(I,M),M=r.mul(pt,P),q=r.mul(J,q),q=r.add(q,M),new $(I,D,q)}subtract(v){return this.add(v.negate())}is0(){return this.equals($.ZERO)}multiply(v){const{endo:_}=t;if(!i.isValidNot0(v))throw new Error("invalid scalar: out of range");let g,A;const L=U=>it.cached(this,U,B=>pn($,B));if(_){const{k1neg:U,k1:B,k2neg:I,k2:D}=N(v),{p:q,f:Y}=L(B),{p:K,f:M}=L(D);A=Y.add(M),g=W(_.beta,q,K,U,I)}else{const{p:U,f:B}=L(v);g=U,A=B}return pn($,[g,A])[0]}multiplyUnsafe(v){const{endo:_}=t,g=this;if(!i.isValid(v))throw new Error("invalid scalar: out of range");if(v===At||g.is0())return $.ZERO;if(v===Jt)return g;if(it.hasCache(this))return this.multiply(v);if(_){const{k1neg:A,k1:L,k2neg:U,k2:B}=N(v),{p1:I,p2:D}=bi($,g,L,B);return W(_.beta,I,D,A,U)}else return it.unsafe(g,v)}toAffine(v){return z(this,v)}isTorsionFree(){const{isTorsionFree:v}=t;return c===Jt?!0:v?v($,this):it.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:v}=t;return c===Jt?this:v?v($,this):this.multiplyUnsafe(c)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}toBytes(v=!0){return be(v,"isCompressed"),this.assertValidity(),f($,this,v)}toHex(v=!0){return yt(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const at=i.BITS,it=new gi($,t.endo?Math.ceil(at/2):at);return $.BASE.precompute(8),$}function rr(n){return Uint8Array.of(n?2:3)}function ir(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Ii(n,t={}){const{Fn:e}=n,r=t.randomBytes||Un,i=Object.assign(ir(n.Fp,e),{seed:Xn(e.ORDER)});function s(f){try{const w=e.fromBytes(f);return e.isValidNot0(w)}catch{return!1}}function c(f,w){const{publicKey:b,publicKeyUncompressed:y}=i;try{const x=f.length;return w===!0&&x!==b||w===!1&&x!==y?!1:!!n.fromBytes(f)}catch{return!1}}function a(f=r(i.seed)){return yi(Z(f,i.seed,"seed"),e.ORDER)}function o(f,w=!0){return n.BASE.multiply(e.fromBytes(f)).toBytes(w)}function l(f){const{secretKey:w,publicKey:b,publicKeyUncompressed:y}=i;if(!Ke(f)||"_lengths"in e&&e._lengths||w===b)return;const x=Z(f,void 0,"key").length;return x===b||x===y}function d(f,w,b=!0){if(l(f)===!0)throw new Error("first arg must be private key");if(l(w)===!1)throw new Error("second arg must be public key");const y=e.fromBytes(f);return n.fromBytes(w).multiply(y).toBytes(b)}const u={isValidSecretKey:s,isValidPublicKey:c,randomSecretKey:a},h=vi(a,o);return Object.freeze({getPublicKey:o,getSharedSecret:d,keygen:h,Point:n,utils:u,lengths:i})}function Li(n,t,e={}){Ln(t),Ye(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),e=Object.assign({},e);const r=e.randomBytes||Un,i=e.hmac||((_,g)=>er(t,_,g)),{Fp:s,Fn:c}=n,{ORDER:a,BITS:o}=c,{keygen:l,getPublicKey:d,getSharedSecret:u,utils:h,lengths:f}=Ii(n,e),w={prehash:!0,lowS:typeof e.lowS=="boolean"?e.lowS:!0,format:"compact",extraEntropy:!1},b=a*nr<s.ORDER;function y(_){const g=a>>Jt;return _>g}function x(_,g){if(!c.isValidNot0(g))throw new Error(`invalid signature ${_}: out of range 1..Point.Fn.ORDER`);return g}function E(){if(b)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function S(_,g){Ne(g);const A=f.signature,L=g==="compact"?A:g==="recovered"?A+1:void 0;return Z(_,L)}class R{r;s;recovery;constructor(g,A,L){if(this.r=x("r",g),this.s=x("s",A),L!=null){if(E(),![0,1,2,3].includes(L))throw new Error("invalid recovery id");this.recovery=L}Object.freeze(this)}static fromBytes(g,A=w.format){S(g,A);let L;if(A==="der"){const{r:D,s:q}=Tt.toSig(Z(g));return new R(D,q)}A==="recovered"&&(L=g[0],A="compact",g=g.subarray(1));const U=f.signature/2,B=g.subarray(0,U),I=g.subarray(U,U*2);return new R(c.fromBytes(B),c.fromBytes(I),L)}static fromHex(g,A){return this.fromBytes(gt(g),A)}assertRecovery(){const{recovery:g}=this;if(g==null)throw new Error("invalid recovery id: must be present");return g}addRecoveryBit(g){return new R(this.r,this.s,g)}recoverPublicKey(g){const{r:A,s:L}=this,U=this.assertRecovery(),B=U===2||U===3?A+a:A;if(!s.isValid(B))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const I=s.toBytes(B),D=n.fromBytes(Ct(rr((U&1)===0),I)),q=c.inv(B),Y=z(Z(g,void 0,"msgHash")),K=c.create(-Y*q),M=c.create(L*q),P=n.BASE.multiplyUnsafe(K).add(D.multiplyUnsafe(M));if(P.is0())throw new Error("invalid recovery: point at infinify");return P.assertValidity(),P}hasHighS(){return y(this.s)}toBytes(g=w.format){if(Ne(g),g==="der")return gt(Tt.hexFromSig(this));const{r:A,s:L}=this,U=c.toBytes(A),B=c.toBytes(L);return g==="recovered"?(E(),Ct(Uint8Array.of(this.assertRecovery()),U,B)):Ct(U,B)}toHex(g){return yt(this.toBytes(g))}}const N=e.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const A=Ee(g),L=g.length*8-o;return L>0?A>>BigInt(L):A},z=e.bits2int_modN||function(g){return c.create(N(g))},nt=We(o);function W(_){return ii("num < 2^"+o,_,At,nt),c.toBytes(_)}function $(_,g){return Z(_,void 0,"message"),g?Z(t(_),void 0,"prehashed message"):_}function at(_,g,A){const{lowS:L,prehash:U,extraEntropy:B}=ke(A,w);_=$(_,U);const I=z(_),D=c.fromBytes(g);if(!c.isValidNot0(D))throw new Error("invalid private key");const q=[W(D),W(I)];if(B!=null&&B!==!1){const P=B===!0?r(f.secretKey):B;q.push(Z(P,void 0,"extraEntropy"))}const Y=Ct(...q),K=I;function M(P){const X=N(P);if(!c.isValidNot0(X))return;const pt=c.inv(X),F=n.BASE.multiply(X).toAffine(),J=c.create(F.x);if(J===At)return;const oe=c.create(pt*c.create(K+J*D));if(oe===At)return;let nn=(F.x===J?0:2)|Number(F.y&Jt),rn=oe;return L&&y(oe)&&(rn=c.neg(oe),nn^=1),new R(J,rn,b?void 0:nn)}return{seed:Y,k2sig:M}}function it(_,g,A={}){const{seed:L,k2sig:U}=at(_,g,A);return oi(t.outputLen,c.BYTES,i)(L,U).toBytes(A.format)}function H(_,g,A,L={}){const{lowS:U,prehash:B,format:I}=ke(L,w);if(A=Z(A,void 0,"publicKey"),g=$(g,B),!Ke(_)){const D=_ instanceof R?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+D)}S(_,I);try{const D=R.fromBytes(_,I),q=n.fromBytes(A);if(U&&D.hasHighS())return!1;const{r:Y,s:K}=D,M=z(g),P=c.inv(K),X=c.create(M*P),pt=c.create(Y*P),F=n.BASE.multiplyUnsafe(X).add(q.multiplyUnsafe(pt));return F.is0()?!1:c.create(F.x)===Y}catch{return!1}}function v(_,g,A={}){const{prehash:L}=ke(A,w);return g=$(g,L),R.fromBytes(_,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:u,utils:h,lengths:f,Point:n,sign:it,verify:H,recoverPublicKey:v,Signature:R,hash:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xe={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Bi={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},bn=BigInt(2);function Ui(n){const t=Xe.p,e=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),c=BigInt(23),a=BigInt(44),o=BigInt(88),l=n*n*n%t,d=l*l*n%t,u=st(d,e,t)*d%t,h=st(u,e,t)*d%t,f=st(h,bn,t)*l%t,w=st(f,i,t)*f%t,b=st(w,s,t)*w%t,y=st(b,a,t)*b%t,x=st(y,o,t)*y%t,E=st(x,a,t)*b%t,S=st(E,e,t)*d%t,R=st(S,c,t)*w%t,N=st(R,r,t)*l%t,z=st(N,bn,t);if(!qe.eql(qe.sqr(z),n))throw new Error("Cannot find square root");return z}const qe=Se(Xe.p,{sqrt:Ui}),ki=Ai(Xe,{Fp:qe,endo:Bi}),St=Li(ki,Ft);class Ae{constructor(t,e,r){this.data=t,this.recovery=e,this.compressed=r??!0}static from(t){if(typeof t=="string"){const e=gt(t);let r=parseInt(yt(e.subarray(0,1)),16)-31,i=!0;r<0&&(i=!1,r=r+4);const s=e.subarray(1);return new Ae(s,r,i)}else throw new Error("Expected string for data")}toBuffer(){const t=new Uint8Array(65).fill(0);return this.compressed?t[0]=this.recovery+31&255:t[0]=this.recovery+27&255,t.set(this.data,1),t}customToString(){return yt(this.toBuffer())}getPublicKey(t){if(t instanceof Uint8Array&&t.length!==32||typeof t=="string"&&t.length!==64)throw new Error("Expected a valid sha256 hash as message");typeof t=="string"&&(t=gt(t));const e=St.Signature.fromBytes(this.data,"compact"),r=new St.Signature(e.r,e.s,this.recovery);return new ot(r.recoverPublicKey(t).toBytes())}}const $i=ut.address_prefix;class ot{constructor(t,e){this.key=t,this.prefix=e??$i}static fromString(t){const{key:e,prefix:r}=Ci(t);return new ot(e,r)}static from(t){return t instanceof ot?t:ot.fromString(t)}verify(t,e){return typeof e=="string"&&(e=Ae.from(e)),St.verify(e.data,t,this.key,{prehash:!1,format:"compact"})}toString(){return Ti(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return`PublicKey: ${this.toString()}`}}const Ti=(n,t)=>{const e=qr(n);return t+ee.encode(new Uint8Array([...n,...e.subarray(0,4)]))},Ci=n=>{const t=n.slice(0,3);n=n.slice(3);const e=ee.decode(n);return{key:e.subarray(0,e.length-4),prefix:t}};class Yt{constructor(t,e){this.amount=t,this.symbol=e==="HIVE"?"STEEM":e==="HBD"?"SBD":e}static fromString(t,e=null){const[r,i]=t.split(" ");if(["STEEM","VESTS","SBD","TESTS","TBD","HIVE","HBD"].indexOf(i)===-1)throw new Error(`Invalid asset symbol: ${i}`);if(e&&i!==e)throw new Error(`Invalid asset, expected symbol: ${e} got: ${i}`);const s=Number.parseFloat(r);if(!Number.isFinite(s))throw new Error(`Invalid asset amount: ${r}`);return new Yt(s,i)}static from(t,e){if(t instanceof Yt){if(e&&t.symbol!==e)throw new Error(`Invalid asset, expected symbol: ${e} got: ${t.symbol}`);return t}else{if(typeof t=="number"&&Number.isFinite(t))return new Yt(t,e||"STEEM");if(typeof t=="string")return Yt.fromString(t,e);throw new Error(`Invalid asset '${String(t)}'`)}}getPrecision(){switch(this.symbol){case"TESTS":case"TBD":case"STEEM":case"SBD":case"HBD":case"HIVE":return 3;case"VESTS":return 6;default:return 3}}toString(){return`${this.amount.toFixed(this.getPrecision())} ${this.symbol}`}toJSON(){return this.toString()}}class Gt{static from(t){return t instanceof Gt?t:t instanceof Uint8Array?new Gt(t):typeof t=="string"?new Gt(gt(t)):new Gt(new Uint8Array(t))}constructor(t){this.buffer=t}toString(){return yt(this.buffer)}toJSON(){return this.toString()}}const T={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,custom:15,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49},ct=()=>{throw new Error("Void can not be serialized")},p=(n,t)=>{n.writeVString(t)},Di=(n,t)=>{n.writeInt16(t)},sr=(n,t)=>{n.writeInt64(t)},_n=(n,t)=>{n.writeUint8(t)},ft=(n,t)=>{n.writeUint16(t)},tt=(n,t)=>{n.writeUint32(t)},or=(n,t)=>{n.writeUint64(t)},It=(n,t)=>{n.writeByte(t?1:0)},cr=n=>(t,e)=>{const[r,i]=e;t.writeVarint32(r),n[r](t,i)},V=(n,t)=>{const e=Yt.from(t),r=e.getPrecision();n.writeInt64(Math.round(e.amount*Math.pow(10,r))),n.writeUint8(r);for(let i=0;i<7;i++)n.writeUint8(e.symbol.charCodeAt(i)||0)},qt=(n,t)=>{n.writeUint32(Math.floor(new Date(t+"Z").getTime()/1e3))},bt=(n,t)=>{t===null||typeof t=="string"&&t.slice(-39)==="1111111111111111111111111111111114T1Anm"?n.append(new Uint8Array(33).fill(0)):n.append(ot.from(t).key)},ar=(n=null)=>(t,e)=>{e=Gt.from(e);const r=e.buffer.length;if(n){if(r!==n)throw new Error(`Unable to serialize binary. Expected ${n} bytes, got ${r}`)}else t.write