Propolis Wallet v2 (ZH)

in #propolis-wallet5 days ago (edited)

Propolis Wallet v2 (ZH)

Self-contained Hive wallet distributed on-chain.

SHA-256: 352055f38588bdb81c69c05abb508b4c2870c0301730cc1973dfb239c607ae09
Size: 109.0 KB
Parts: 3

This post and its comments contain the complete wallet application.
Use the Propolis bootstrap loader or the reassemble script to build the wallet from these parts.


Published by @propolis-dev using Propolis distribution tools.

Sort:  
<!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 We(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function jt(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=We(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 Nn(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash must wrapped by utils.createHasher");jt(n.outputLen),jt(n.blockLen)}function xe(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 zr(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 Ue(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function wt(n,t){return n<<32-t|n>>>t}function le(n,t){return n<<t|n>>>32-t>>>0}const qn=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Kr=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function yt(n){if(Z(n),qn)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Kr[n[e]];return t}const vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function fn(n){if(n>=vt._0&&n<=vt._9)return n-vt._0;if(n>=vt.A&&n<=vt.F)return n-(vt.A-10);if(n>=vt.a&&n<=vt.f)return n-(vt.a-10)}function gt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(qn)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=fn(n.charCodeAt(s)),a=fn(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 Ye(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 Hn(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 Mn=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 de=new ArrayBuffer(0),Pr=new TextEncoder,hn=new TextDecoder;class N{constructor(t=N.DEFAULT_CAPACITY,e=N.DEFAULT_ENDIAN){this.readUInt32=this.readUint32,this.buffer=t===0?de:new ArrayBuffer(t),this.view=t===0?new DataView(de):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e}static allocate(t,e){return new N(t,e)}static concat(t,e){let r=0;for(let a=0;a<t.length;++a){const o=t[a];if(o instanceof N)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 N(0,e);const i=new N(r,e),s=new Uint8Array(i.buffer);let c=0;for(let a=0;a<t.length;++a){let o=t[a];o instanceof N?(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 N){const i=t.clone();return i.markedOffset=-1,i}let r;if(t instanceof Uint8Array)r=new N(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 N(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(de));else if(Array.isArray(t))r=new N(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 N?(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 N(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 N(0,this.littleEndian);const r=e-t,i=new N(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?de: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=Pr.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=hn.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=hn.decode(new Uint8Array(this.buffer,e,t));return r?(this.offset+=t,i):{string:i,length:t}}}N.LITTLE_ENDIAN=!0;N.BIG_ENDIAN=!1;N.DEFAULT_CAPACITY=16;N.DEFAULT_ENDIAN=N.BIG_ENDIAN;function Fr(n,t,e){return n&t^~n&e}function jr(n,t,e){return n&t^n&e^t&e}class Ge{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=Ue(this.buffer)}update(t){xe(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=Ue(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){xe(this),zr(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 f=c;f<i;f++)e[f]=0;r.setBigUint64(i-8,BigInt(this.length*8),s),this.process(r,0);const a=Ue(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 f=0;f<l;f++)a.setUint32(4*f,d[f],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 $t=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),et=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Zr=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Vn=Uint8Array.from(new Array(16).fill(0).map((n,t)=>t)),Wr=Vn.map(n=>(9*n+5)%16),zn=(()=>{const e=[[Vn],[Wr]];for(let r=0;r<4;r++)for(let i of e)i.push(i[r].map(s=>Zr[s]));return e})(),Kn=zn[0],Pn=zn[1],Fn=[[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)),Yr=Kn.map((n,t)=>n.map(e=>Fn[t][e])),Gr=Pn.map((n,t)=>n.map(e=>Fn[t][e])),Jr=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Xr=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function pn(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 ue=new Uint32Array(16);class Qr extends Ge{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 h=0;h<16;h++,e+=4)ue[h]=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,f=this.h4|0,m=f;for(let h=0;h<5;h++){const b=4-h,y=Jr[h],p=Xr[h],_=Kn[h],v=Pn[h],S=Yr[h],L=Gr[h];for(let I=0;I<16;I++){const q=le(r+pn(h,s,a,l)+ue[_[I]]+y,S[I])+f|0;r=f,f=l,l=le(a,10)|0,a=s,s=q}for(let I=0;I<16;I++){const q=le(i+pn(b,c,o,d)+ue[v[I]]+p,L[I])+m|0;i=m,m=d,d=le(o,10)|0,o=c,c=q}}this.set(this.h1+a+d|0,this.h2+l+m|0,this.h3+f+i|0,this.h4+r+c|0,this.h0+s+o|0)}roundClean(){Nt(ue)}destroy(){this.destroyed=!0,Nt(this.buffer),this.set(0,0,0,0,0)}}const ti=Ye(()=>new Qr);function ei(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),f=d.charCodeAt(0);if(t[f]!==255)throw new TypeError(d+" is ambiguous");t[f]=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,f=0,m=0;const h=l.length;for(;m!==h&&l[m]===0;)m++,d++;const b=(h-m)*s+1>>>0,y=new Uint8Array(b);for(;m!==h;){let v=l[m],S=0;for(let L=b-1;(v!==0||S<f)&&L!==-1;L--,S++)v+=256*y[L]>>>0,y[L]=v%e>>>0,v=v/e>>>0;if(v!==0)throw new Error("Non-zero carry");f=S,m++}let p=b-f;for(;p!==b&&y[p]===0;)p++;let _=r.repeat(d);for(;p<b;++p)_+=n.charAt(y[p]);return _}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,f=0,m=0;for(;l[d]===r;)f++,d++;const h=(l.length-d)*i+1>>>0,b=new Uint8Array(h);for(;d<l.length;){const v=l.charCodeAt(d);if(v>255)return;let S=t[v];if(S===255)return;let L=0;for(let I=h-1;(S!==0||L<m)&&I!==-1;I--,L++)S+=e*b[I]>>>0,b[I]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");m=L,d++}let y=h-m;for(;y!==h&&b[y]===0;)y++;const p=new Uint8Array(f+(h-y));let _=f;for(;y!==h;)p[_++]=b[y++];return p}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 ni="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const re=ei(ni),ft={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},fe=BigInt(2**32-1),mn=BigInt(32);function ri(n,t=!1){return t?{h:Number(n&fe),l:Number(n>>mn&fe)}:{h:Number(n>>mn&fe)|0,l:Number(n&fe)|0}}function ii(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}=ri(n[s],t);[r[s],i[s]]=[c,a]}return[r,i]}const wn=(n,t,e)=>n>>>e,bn=(n,t,e)=>n<<32-e|t>>>e,Yt=(n,t,e)=>n>>>e|t<<32-e,Gt=(n,t,e)=>n<<32-e|t>>>e,he=(n,t,e)=>n<<64-e|t>>>e-32,pe=(n,t,e)=>n>>>e-32|t<<64-e;function xt(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const si=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),oi=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,ci=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),ai=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,li=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),di=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,ui=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 fi extends Ge{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 f=0;f<16;f++,e+=4)Bt[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){const m=Bt[f-15],h=Bt[f-2],b=wt(m,7)^wt(m,18)^m>>>3,y=wt(h,17)^wt(h,19)^h>>>10;Bt[f]=y+Bt[f-7]+b+Bt[f-16]|0}let{A:r,B:i,C:s,D:c,E:a,F:o,G:l,H:d}=this;for(let f=0;f<64;f++){const m=wt(a,6)^wt(a,11)^wt(a,25),h=d+m+Fr(a,o,l)+ui[f]+Bt[f]|0,y=(wt(r,2)^wt(r,13)^wt(r,22))+jr(r,i,s)|0;d=l,l=o,o=a,a=c+h|0,c=s,s=i,i=r,r=h+y|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 hi extends fi{A=$t[0]|0;B=$t[1]|0;C=$t[2]|0;D=$t[3]|0;E=$t[4]|0;F=$t[5]|0;G=$t[6]|0;H=$t[7]|0;constructor(){super(32)}}const jn=ii(["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))),pi=jn[0],mi=jn[1],kt=new Uint32Array(80),Ut=new Uint32Array(80);class wi extends Ge{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:f,Fl:m,Gh:h,Gl:b,Hh:y,Hl:p}=this;return[t,e,r,i,s,c,a,o,l,d,f,m,h,b,y,p]}set(t,e,r,i,s,c,a,o,l,d,f,m,h,b,y,p){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=f|0,this.Fl=m|0,this.Gh=h|0,this.Gl=b|0,this.Hh=y|0,this.Hl=p|0}process(t,e){for(let S=0;S<16;S++,e+=4)kt[S]=t.getUint32(e),Ut[S]=t.getUint32(e+=4);for(let S=16;S<80;S++){const L=kt[S-15]|0,I=Ut[S-15]|0,q=Yt(L,I,1)^Yt(L,I,8)^wn(L,I,7),Q=Gt(L,I,1)^Gt(L,I,8)^bn(L,I,7),W=kt[S-2]|0,C=Ut[S-2]|0,dt=Yt(W,C,19)^he(W,C,61)^wn(W,C,6),ot=Gt(W,C,19)^pe(W,C,61)^bn(W,C,6),M=ci(Q,ot,Ut[S-7],Ut[S-16]),E=ai(M,q,dt,kt[S-7],kt[S-16]);kt[S]=E|0,Ut[S]=M|0}let{Ah:r,Al:i,Bh:s,Bl:c,Ch:a,Cl:o,Dh:l,Dl:d,Eh:f,El:m,Fh:h,Fl:b,Gh:y,Gl:p,Hh:_,Hl:v}=this;for(let S=0;S<80;S++){const L=Yt(f,m,14)^Yt(f,m,18)^he(f,m,41),I=Gt(f,m,14)^Gt(f,m,18)^pe(f,m,41),q=f&h^~f&y,Q=m&b^~m&p,W=li(v,I,Q,mi[S],Ut[S]),C=di(W,_,L,q,pi[S],kt[S]),dt=W|0,ot=Yt(r,i,28)^he(r,i,34)^he(r,i,39),M=Gt(r,i,28)^pe(r,i,34)^pe(r,i,39),E=r&s^r&a^s&a,x=i&c^i&o^c&o;_=y|0,v=p|0,y=h|0,p=b|0,h=f|0,b=m|0,{h:f,l:m}=xt(l|0,d|0,C|0,dt|0),l=a|0,d=o|0,a=s|0,o=c|0,s=r|0,c=i|0;const g=si(dt,M,x);r=oi(g,C,ot,E),i=g|0}({h:r,l:i}=xt(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:c}=xt(this.Bh|0,this.Bl|0,s|0,c|0),{h:a,l:o}=xt(this.Ch|0,this.Cl|0,a|0,o|0),{h:l,l:d}=xt(this.Dh|0,this.Dl|0,l|0,d|0),{h:f,l:m}=xt(this.Eh|0,this.El|0,f|0,m|0),{h,l:b}=xt(this.Fh|0,this.Fl|0,h|0,b|0),{h:y,l:p}=xt(this.Gh|0,this.Gl|0,y|0,p|0),{h:_,l:v}=xt(this.Hh|0,this.Hl|0,_|0,v|0),this.set(r,i,s,c,a,o,l,d,f,m,h,b,y,p,_,v)}roundClean(){Nt(kt,Ut)}destroy(){Nt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class bi extends wi{Ah=et[0]|0;Al=et[1]|0;Bh=et[2]|0;Bl=et[3]|0;Ch=et[4]|0;Cl=et[5]|0;Dh=et[6]|0;Dl=et[7]|0;Eh=et[8]|0;El=et[9]|0;Fh=et[10]|0;Fl=et[11]|0;Gh=et[12]|0;Gl=et[13]|0;Hh=et[14]|0;Hl=et[15]|0;constructor(){super(64)}}const Zt=Ye(()=>new hi,Mn(1)),Zn=Ye(()=>new bi,Mn(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Je=BigInt(0),Ve=BigInt(1);function Ee(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}" `;throw new Error(e+"expected boolean, got type="+typeof n)}return n}function Wn(n){if(typeof n=="bigint"){if(!ge(n))throw new Error("positive bigint expected, got "+n)}else jt(n);return n}function me(n){const t=Wn(n).toString(16);return t.length&1?"0"+t:t}function Yn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Je:BigInt("0x"+n)}function $e(n){return Yn(yt(n))}function Gn(n){return Yn(yt(yi(Z(n)).reverse()))}function Xe(n,t){jt(t),n=Wn(n);const e=gt(n.toString(16).padStart(t*2,"0"));if(e.length!==t)throw new Error("number too large");return e}function Jn(n,t){return Xe(n,t).reverse()}function yi(n){return Uint8Array.from(n)}const ge=n=>typeof n=="bigint"&&Je<=n;function gi(n,t,e){return ge(n)&&ge(t)&&ge(e)&&t<=n&&n<e}function _i(n,t,e,r){if(!gi(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function vi(n){let t;for(t=0;n>Je;n>>=Ve,t+=1);return t}const Qe=n=>(Ve<<BigInt(n))-Ve;function xi(n,t,e){if(jt(n,"hashLen"),jt(t,"qByteLen"),typeof e!="function")throw new Error("hmacFn must be a function");const r=p=>new Uint8Array(p),i=Uint8Array.of(),s=Uint8Array.of(0),c=Uint8Array.of(1),a=1e3;let o=r(n),l=r(n),d=0;const f=()=>{o.fill(1),l.fill(0),d=0},m=(...p)=>e(l,Ct(o,...p)),h=(p=i)=>{l=m(s,p),o=m(),p.length!==0&&(l=m(c,p),o=m())},b=()=>{if(d++>=a)throw new Error("drbg: tried max amount of iterations");let p=0;const _=[];for(;p<t;){o=m();const v=o.slice();_.push(v),p+=o.length}return Ct(..._)};return(p,_)=>{f(),h(p);let v;for(;!(v=_(b()));)h();return f(),v}}function tn(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 yn(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 st=BigInt(0),rt=BigInt(1),Mt=BigInt(2),Xn=BigInt(3),Qn=BigInt(4),tr=BigInt(5),Ei=BigInt(7),er=BigInt(8),Si=BigInt(9),nr=BigInt(16);function ut(n,t){const e=n%t;return e>=st?e:t+e}function ct(n,t,e){let r=n;for(;t-- >st;)r*=r,r%=e;return r}function gn(n,t){if(n===st)throw new Error("invert: expected non-zero number");if(t<=st)throw new Error("invert: expected positive modulus, got "+t);let e=ut(n,t),r=t,i=st,s=rt;for(;e!==st;){const a=r/e,o=r%e,l=i-s*a;r=e,e=o,i=s,s=l}if(r!==rt)throw new Error("invert: does not exist");return ut(i,t)}function en(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function rr(n,t){const e=(n.ORDER+rt)/Qn,r=n.pow(t,e);return en(n,r,t),r}function Ai(n,t){const e=(n.ORDER-tr)/er,r=n.mul(t,Mt),i=n.pow(r,e),s=n.mul(t,i),c=n.mul(n.mul(s,Mt),i),a=n.mul(s,n.sub(c,n.ONE));return en(n,a,t),a}function Li(n){const t=Be(n),e=ir(n),r=e(t,t.neg(t.ONE)),i=e(t,r),s=e(t,t.neg(r)),c=(n+Ei)/nr;return(a,o)=>{let l=a.pow(o,c),d=a.mul(l,r);const f=a.mul(l,i),m=a.mul(l,s),h=a.eql(a.sqr(d),o),b=a.eql(a.sqr(f),o);l=a.cmov(l,d,h),d=a.cmov(m,f,b);const y=a.eql(a.sqr(d),o),p=a.cmov(l,d,y);return en(a,p,o),p}}function ir(n){if(n<Xn)throw new Error("sqrt is not defined for small field");let t=n-rt,e=0;for(;t%Mt===st;)t/=Mt,e++;let r=Mt;const i=Be(n);for(;_n(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return rr;let s=i.pow(r,t);const c=(t+rt)/Mt;return function(o,l){if(o.is0(l))return l;if(_n(o,l)!==1)throw new Error("Cannot find square root");let d=e,f=o.mul(o.ONE,s),m=o.pow(l,t),h=o.pow(l,c);for(;!o.eql(m,o.ONE);){if(o.is0(m))return o.ZERO;let b=1,y=o.sqr(m);for(;!o.eql(y,o.ONE);)if(b++,y=o.sqr(y),b===d)throw new Error("Cannot find square root");const p=rt<<BigInt(d-b-1),_=o.pow(f,p);d=b,f=o.sqr(_),m=o.mul(m,f),h=o.mul(h,_)}return h}}function Ii(n){return n%Qn===Xn?rr:n%er===tr?Ai:n%nr===Si?Li(n):ir(n)}const $i=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Bi(n){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=$i.reduce((r,i)=>(r[i]="function",r),t);return tn(n,e),n}function ki(n,t,e){if(e<st)throw new Error("invalid exponent, negatives unsupported");if(e===st)return n.ONE;if(e===rt)return t;let r=n.ONE,i=t;for(;e>st;)e&rt&&(r=n.mul(r,i)),i=n.sqr(i),e>>=rt;return r}function sr(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 _n(n,t){const e=(n.ORDER-rt)/Mt,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 Ui(n,t){t!==void 0&&jt(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}class Ti{ORDER;BITS;BYTES;isLE;ZERO=st;ONE=rt;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=st)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}=Ui(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 ut(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return st<=t&&t<this.ORDER}is0(t){return t===st}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&rt)===rt}neg(t){return ut(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return ut(t*t,this.ORDER)}add(t,e){return ut(t+e,this.ORDER)}sub(t,e){return ut(t-e,this.ORDER)}mul(t,e){return ut(t*e,this.ORDER)}pow(t,e){return ki(this,t,e)}div(t,e){return ut(t*gn(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 gn(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=Ii(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Jn(t,this.BYTES):Xe(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?Gn(t):$e(t);if(a&&(o=ut(o,c)),!e&&!this.isValid(o))throw new Error("invalid field element: outside of range 0..ORDER");return o}invertBatch(t){return sr(this,t)}cmov(t,e,r){return r?e:t}}function Be(n,t={}){return new Ti(n,t)}function or(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 cr(n){const t=or(n);return t+Math.ceil(t/2)}function Ci(n,t,e=!1){Z(n);const r=n.length,i=or(t),s=cr(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=e?Gn(n):$e(n),a=ut(c,t-rt)+rt;return e?Jn(a,i):Xe(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ne=BigInt(0),Vt=BigInt(1);function Se(n,t){const e=t.negate();return n?e:t}function vn(n,t){const e=sr(n.Fp,t.map(r=>r.Z));return t.map((r,i)=>n.fromAffine(r.toAffine(e[i])))}function ar(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Te(n,t){ar(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=Qe(n),c=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:c}}function xn(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+=Vt);const l=t*r,d=l+Math.abs(a)-1,f=a===0,m=a<0,h=t%2!==0;return{nextN:o,offset:d,isZero:f,isNeg:m,isNegF:h,offsetF:l}}const Ce=new WeakMap,lr=new WeakMap;function Oe(n){return lr.get(n)||1}function En(n){if(n!==ne)throw new Error("invalid wNAF")}class Oi{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>ne;)e&Vt&&(r=r.add(i)),i=i.double(),e>>=Vt;return r}precomputeWindow(t,e){const{windows:r,windowSize:i}=Te(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=Te(t,this.bits);for(let a=0;a<c.windows;a++){const{nextN:o,offset:l,isZero:d,isNeg:f,isNegF:m,offsetF:h}=xn(r,a,c);r=o,d?s=s.add(Se(m,e[h])):i=i.add(Se(f,e[l]))}return En(r),{p:i,f:s}}wNAFUnsafe(t,e,r,i=this.ZERO){const s=Te(t,this.bits);for(let c=0;c<s.windows&&r!==ne;c++){const{nextN:a,offset:o,isZero:l,isNeg:d}=xn(r,c,s);if(r=a,!l){const f=e[o];i=i.add(d?f.negate():f)}}return En(r),i}getPrecomputes(t,e,r){let i=Ce.get(e);return i||(i=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(i=r(i)),Ce.set(e,i))),i}cached(t,e,r){const i=Oe(t);return this.wNAF(i,this.getPrecomputes(i,t,r),e)}unsafe(t,e,r,i){const s=Oe(t);return s===1?this._unsafeLadder(t,e,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),e,i)}createCache(t,e){ar(e,this.bits),lr.set(t,e),Ce.delete(t)}hasCache(t){return Oe(t)!==1}}function Ri(n,t,e,r){let i=t,s=n.ZERO,c=n.ZERO;for(;e>ne||r>ne;)e&Vt&&(s=s.add(i)),r&Vt&&(c=c.add(i)),i=i.double(),e>>=Vt,r>>=Vt;return{p1:s,p2:c}}function Sn(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Bi(t),t}else return Be(n,{isLE:e})}function Di(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>ne))throw new Error(`CURVE.${o} must be positive bigint`)}const i=Sn(t.p,e.Fp,r),s=Sn(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 Ni(n,t){return function(r){const i=n(r);return{secretKey:i,publicKey:t(i)}}}class dr{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,e){if(Nn(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 xe(this),this.iHash.update(t),this}digestInto(t){xe(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 ur=(n,t,e)=>new dr(n,t).update(e).digest();ur.create=(n,t)=>new dr(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const An=(n,t)=>(n+(n>=0?t:-t)/fr)/t;function qi(n,t,e){const[[r,i],[s,c]]=t,a=An(c*n,e),o=An(-i*n,e);let l=n-a*r-o*s,d=-a*i-o*c;const f=l<Lt,m=d<Lt;f&&(l=-l),m&&(d=-d);const h=Qe(Math.ceil(vi(e)/2))+te;if(l<Lt||l>=h||d<Lt||d>=h)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:f,k1:l,k2neg:m,k2:d}}function ze(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function Re(n,t){const e={};for(let r of Object.keys(t))e[r]=n[r]===void 0?t[r]:n[r];return Ee(e.lowS,"lowS"),Ee(e.prehash,"prehash"),e.format!==void 0&&ze(e.format),e}class Hi extends Error{constructor(t=""){super(t)}}const Tt={Err:Hi,_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=me(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?me(i.length/2|128):"";return me(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<Lt)throw new t("integer: negative integers are not allowed");let e=me(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 $e(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)}},Lt=BigInt(0),te=BigInt(1),fr=BigInt(2),we=BigInt(3),Mi=BigInt(4);function Vi(n,t={}){const e=Di("weierstrass",n,t),{Fp:r,Fn:i}=e;let s=e.CURVE;const{h:c,n:a}=s;tn(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=pr(r,i);function d(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(M,E,x){const{x:g,y:A}=E.toAffine(),B=r.toBytes(g);if(Ee(x,"isCompressed"),x){d();const U=!r.isOdd(A);return Ct(hr(U),B)}else return Ct(Uint8Array.of(4),B,r.toBytes(A))}function m(M){Z(M,void 0,"Point");const{publicKey:E,publicKeyUncompressed:x}=l,g=M.length,A=M[0],B=M.subarray(1);if(g===E&&(A===2||A===3)){const U=r.fromBytes(B);if(!r.isValid(U))throw new Error("bad point: is not on curve, wrong x");const k=y(U);let $;try{$=r.sqrt(k)}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($);return(A&1)===1!==D&&($=r.neg($)),{x:U,y:$}}else if(g===x&&A===4){const U=r.BYTES,k=r.fromBytes(B.subarray(0,U)),$=r.fromBytes(B.subarray(U,U*2));if(!p(k,$))throw new Error("bad point: is not on curve");return{x:k,y:$}}else throw new Error(`bad point: got length ${g}, expected compressed=${E} or uncompressed=${x}`)}const h=t.toBytes||f,b=t.fromBytes||m;function y(M){const E=r.sqr(M),x=r.mul(E,M);return r.add(r.add(x,r.mul(M,s.a)),s.b)}function p(M,E){const x=r.sqr(E),g=y(M);return r.eql(x,g)}if(!p(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const _=r.mul(r.pow(s.a,we),Mi),v=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(_,v)))throw new Error("bad curve params: a or b");function S(M,E,x=!1){if(!r.isValid(E)||x&&r.is0(E))throw new Error(`bad point coordinate ${M}`);return E}function L(M){if(!(M instanceof C))throw new Error("Weierstrass Point expected")}function I(M){if(!o||!o.basises)throw new Error("no endo");return qi(M,o.basises,i.ORDER)}const q=yn((M,E)=>{const{X:x,Y:g,Z:A}=M;if(r.eql(A,r.ONE))return{x,y:g};const B=M.is0();E==null&&(E=B?r.ONE:r.inv(A));const U=r.mul(x,E),k=r.mul(g,E),$=r.mul(A,E);if(B)return{x:r.ZERO,y:r.ZERO};if(!r.eql($,r.ONE))throw new Error("invZ was invalid");return{x:U,y:k}}),Q=yn(M=>{if(M.is0()){if(t.allowInfinityPoint&&!r.is0(M.Y))return;throw new Error("bad point: ZERO")}const{x:E,y:x}=M.toAffine();if(!r.isValid(E)||!r.isValid(x))throw new Error("bad point: x or y not field elements");if(!p(E,x))throw new Error("bad point: equation left != right");if(!M.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function W(M,E,x,g,A){return x=new C(r.mul(x.X,M),x.Y,x.Z),E=Se(g,E),x=Se(A,x),E.add(x)}class C{static BASE=new C(s.Gx,s.Gy,r.ONE);static ZERO=new C(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(E,x,g){this.X=S("x",E),this.Y=S("y",x,!0),this.Z=S("z",g),Object.freeze(this)}static CURVE(){return s}static fromAffine(E){const{x,y:g}=E||{};if(!E||!r.isValid(x)||!r.isValid(g))throw new Error("invalid affine point");if(E instanceof C)throw new Error("projective point not allowed");return r.is0(x)&&r.is0(g)?C.ZERO:new C(x,g,r.ONE)}static fromBytes(E){const x=C.fromAffine(b(Z(E,void 0,"point")));return x.assertValidity(),x}static fromHex(E){return C.fromBytes(gt(E))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(E=8,x=!0){return ot.createCache(this,E),x||this.multiply(we),this}assertValidity(){Q(this)}hasEvenY(){const{y:E}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(E)}equals(E){L(E);const{X:x,Y:g,Z:A}=this,{X:B,Y:U,Z:k}=E,$=r.eql(r.mul(x,k),r.mul(B,A)),D=r.eql(r.mul(g,k),r.mul(U,A));return $&&D}negate(){return new C(this.X,r.neg(this.Y),this.Z)}double(){const{a:E,b:x}=s,g=r.mul(x,we),{X:A,Y:B,Z:U}=this;let k=r.ZERO,$=r.ZERO,D=r.ZERO,H=r.mul(A,A),Y=r.mul(B,B),K=r.mul(U,U),V=r.mul(A,B);return V=r.add(V,V),D=r.mul(A,U),D=r.add(D,D),k=r.mul(E,D),$=r.mul(g,K),$=r.add(k,$),k=r.sub(Y,$),$=r.add(Y,$),$=r.mul(k,$),k=r.mul(V,k),D=r.mul(g,D),K=r.mul(E,K),V=r.sub(H,K),V=r.mul(E,V),V=r.add(V,D),D=r.add(H,H),H=r.add(D,H),H=r.add(H,K),H=r.mul(H,V),$=r.add($,H),K=r.mul(B,U),K=r.add(K,K),H=r.mul(K,V),k=r.sub(k,H),D=r.mul(K,Y),D=r.add(D,D),D=r.add(D,D),new C(k,$,D)}add(E){L(E);const{X:x,Y:g,Z:A}=this,{X:B,Y:U,Z:k}=E;let $=r.ZERO,D=r.ZERO,H=r.ZERO;const Y=s.a,K=r.mul(s.b,we);let V=r.mul(x,B),P=r.mul(g,U),X=r.mul(A,k),mt=r.add(x,g),F=r.add(B,U);mt=r.mul(mt,F),F=r.add(V,P),mt=r.sub(mt,F),F=r.add(x,A);let tt=r.add(B,k);return F=r.mul(F,tt),tt=r.add(V,X),F=r.sub(F,tt),tt=r.add(g,A),$=r.add(U,k),tt=r.mul(tt,$),$=r.add(P,X),tt=r.sub(tt,$),H=r.mul(Y,F),$=r.mul(K,X),H=r.add($,H),$=r.sub(P,H),H=r.add(P,H),D=r.mul($,H),P=r.add(V,V),P=r.add(P,V),X=r.mul(Y,X),F=r.mul(K,F),P=r.add(P,X),X=r.sub(V,X),X=r.mul(Y,X),F=r.add(F,X),V=r.mul(P,F),D=r.add(D,V),V=r.mul(tt,F),$=r.mul(mt,$),$=r.sub($,V),V=r.mul(mt,P),H=r.mul(tt,H),H=r.add(H,V),new C($,D,H)}subtract(E){return this.add(E.negate())}is0(){return this.equals(C.ZERO)}multiply(E){const{endo:x}=t;if(!i.isValidNot0(E))throw new Error("invalid scalar: out of range");let g,A;const B=U=>ot.cached(this,U,k=>vn(C,k));if(x){const{k1neg:U,k1:k,k2neg:$,k2:D}=I(E),{p:H,f:Y}=B(k),{p:K,f:V}=B(D);A=Y.add(V),g=W(x.beta,H,K,U,$)}else{const{p:U,f:k}=B(E);g=U,A=k}return vn(C,[g,A])[0]}multiplyUnsafe(E){const{endo:x}=t,g=this;if(!i.isValid(E))throw new Error("invalid scalar: out of range");if(E===Lt||g.is0())return C.ZERO;if(E===te)return g;if(ot.hasCache(this))return this.multiply(E);if(x){const{k1neg:A,k1:B,k2neg:U,k2:k}=I(E),{p1:$,p2:D}=Ri(C,g,B,k);return W(x.beta,$,D,A,U)}else return ot.unsafe(g,E)}toAffine(E){return q(this,E)}isTorsionFree(){const{isTorsionFree:E}=t;return c===te?!0:E?E(C,this):ot.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:E}=t;return c===te?this:E?E(C,this):this.multiplyUnsafe(c)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}toBytes(E=!0){return Ee(E,"isCompressed"),this.assertValidity(),h(C,this,E)}toHex(E=!0){return yt(this.toBytes(E))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const dt=i.BITS,ot=new Oi(C,t.endo?Math.ceil(dt/2):dt);return C.BASE.precompute(8),C}function hr(n){return Uint8Array.of(n?2:3)}function pr(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function zi(n,t={}){const{Fn:e}=n,r=t.randomBytes||Hn,i=Object.assign(pr(n.Fp,e),{seed:cr(e.ORDER)});function s(h){try{const b=e.fromBytes(h);return e.isValidNot0(b)}catch{return!1}}function c(h,b){const{publicKey:y,publicKeyUncompressed:p}=i;try{const _=h.length;return b===!0&&_!==y||b===!1&&_!==p?!1:!!n.fromBytes(h)}catch{return!1}}function a(h=r(i.seed)){return Ci(Z(h,i.seed,"seed"),e.ORDER)}function o(h,b=!0){return n.BASE.multiply(e.fromBytes(h)).toBytes(b)}function l(h){const{secretKey:b,publicKey:y,publicKeyUncompressed:p}=i;if(!We(h)||"_lengths"in e&&e._lengths||b===y)return;const _=Z(h,void 0,"key").length;return _===y||_===p}function d(h,b,y=!0){if(l(h)===!0)throw new Error("first arg must be private key");if(l(b)===!1)throw new Error("second arg must be public key");const p=e.fromBytes(h);return n.fromBytes(b).multiply(p).toBytes(y)}const f={isValidSecretKey:s,isValidPublicKey:c,randomSecretKey:a},m=Ni(a,o);return Object.freeze({getPublicKey:o,getSharedSecret:d,keygen:m,Point:n,utils:f,lengths:i})}function Ki(n,t,e={}){Nn(t),tn(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),e=Object.assign({},e);const r=e.randomBytes||Hn,i=e.hmac||((x,g)=>ur(t,x,g)),{Fp:s,Fn:c}=n,{ORDER:a,BITS:o}=c,{keygen:l,getPublicKey:d,getSharedSecret:f,utils:m,lengths:h}=zi(n,e),b={prehash:!0,lowS:typeof e.lowS=="boolean"?e.lowS:!0,format:"compact",extraEntropy:!1},y=a*fr<s.ORDER;function p(x){const g=a>>te;return x>g}function _(x,g){if(!c.isValidNot0(g))throw new Error(`invalid signature ${x}: out of range 1..Point.Fn.ORDER`);return g}function v(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function S(x,g){ze(g);const A=h.signature,B=g==="compact"?A:g==="recovered"?A+1:void 0;return Z(x,B)}class L{r;s;recovery;constructor(g,A,B){if(this.r=_("r",g),this.s=_("s",A),B!=null){if(v(),![0,1,2,3].includes(B))throw new Error("invalid recovery id");this.recovery=B}Object.freeze(this)}static fromBytes(g,A=b.format){S(g,A);let B;if(A==="der"){const{r:D,s:H}=Tt.toSig(Z(g));return new L(D,H)}A==="recovered"&&(B=g[0],A="compact",g=g.subarray(1));const U=h.signature/2,k=g.subarray(0,U),$=g.subarray(U,U*2);return new L(c.fromBytes(k),c.fromBytes($),B)}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 L(this.r,this.s,g)}recoverPublicKey(g){const{r:A,s:B}=this,U=this.assertRecovery(),k=U===2||U===3?A+a:A;if(!s.isValid(k))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const $=s.toBytes(k),D=n.fromBytes(Ct(hr((U&1)===0),$)),H=c.inv(k),Y=q(Z(g,void 0,"msgHash")),K=c.create(-Y*H),V=c.create(B*H),P=n.BASE.multiplyUnsafe(K).add(D.multiplyUnsafe(V));if(P.is0())throw new Error("invalid recovery: point at infinify");return P.assertValidity(),P}hasHighS(){return p(this.s)}toBytes(g=b.format){if(ze(g),g==="der")return gt(Tt.hexFromSig(this));const{r:A,s:B}=this,U=c.toBytes(A),k=c.toBytes(B);return g==="recovered"?(v(),Ct(Uint8Array.of(this.assertRecovery()),U,k)):Ct(U,k)}toHex(g){return yt(this.toBytes(g))}}const I=e.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const A=$e(g),B=g.length*8-o;return B>0?A>>BigInt(B):A},q=e.bits2int_modN||function(g){return c.create(I(g))},Q=Qe(o);function W(x){return _i("num < 2^"+o,x,Lt,Q),c.toBytes(x)}function C(x,g){return Z(x,void 0,"message"),g?Z(t(x),void 0,"prehashed message"):x}function dt(x,g,A){const{lowS:B,prehash:U,extraEntropy:k}=Re(A,b);x=C(x,U);const $=q(x),D=c.fromBytes(g);if(!c.isValidNot0(D))throw new Error("invalid private key");const H=[W(D),W($)];if(k!=null&&k!==!1){const P=k===!0?r(h.secretKey):k;H.push(Z(P,void 0,"extraEntropy"))}const Y=Ct(...H),K=$;function V(P){const X=I(P);if(!c.isValidNot0(X))return;const mt=c.inv(X),F=n.BASE.multiply(X).toAffine(),tt=c.create(F.x);if(tt===Lt)return;const ae=c.create(mt*c.create(K+tt*D));if(ae===Lt)return;let dn=(F.x===tt?0:2)|Number(F.y&te),un=ae;return B&&p(ae)&&(un=c.neg(ae),dn^=1),new L(tt,un,y?void 0:dn)}return{seed:Y,k2sig:V}}function ot(x,g,A={}){const{seed:B,k2sig:U}=dt(x,g,A);return xi(t.outputLen,c.BYTES,i)(B,U).toBytes(A.format)}function M(x,g,A,B={}){const{lowS:U,prehash:k,format:$}=Re(B,b);if(A=Z(A,void 0,"publicKey"),g=C(g,k),!We(x)){const D=x instanceof L?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+D)}S(x,$);try{const D=L.fromBytes(x,$),H=n.fromBytes(A);if(U&&D.hasHighS())return!1;const{r:Y,s:K}=D,V=q(g),P=c.inv(K),X=c.create(V*P),mt=c.create(Y*P),F=n.BASE.multiplyUnsafe(X).add(H.multiplyUnsafe(mt));return F.is0()?!1:c.create(F.x)===Y}catch{return!1}}function E(x,g,A={}){const{prehash:B}=Re(A,b);return g=C(g,B),L.fromBytes(x,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:f,utils:m,lengths:h,Point:n,sign:ot,verify:M,recoverPublicKey:E,Signature:L,hash:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nn={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Pi={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Ln=BigInt(2);function Fi(n){const t=nn.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,f=ct(d,e,t)*d%t,m=ct(f,e,t)*d%t,h=ct(m,Ln,t)*l%t,b=ct(h,i,t)*h%t,y=ct(b,s,t)*b%t,p=ct(y,a,t)*y%t,_=ct(p,o,t)*p%t,v=ct(_,a,t)*y%t,S=ct(v,e,t)*d%t,L=ct(S,c,t)*b%t,I=ct(L,r,t)*l%t,q=ct(I,Ln,t);if(!Ke.eql(Ke.sqr(q),n))throw new Error("Cannot find square root");return q}const Ke=Be(nn.p,{sqrt:Fi}),ji=Vi(nn,{Fp:Ke,endo:Pi}),At=Ki(ji,Zt);class ke{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 ke(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=At.Signature.fromBytes(this.data,"compact"),r=new At.Signature(e.r,e.s,this.recovery);return new at(r.recoverPublicKey(t).toBytes())}}const Zi=ft.address_prefix;class at{constructor(t,e){this.key=t,this.prefix=e??Zi}static fromString(t){const{key:e,prefix:r}=Yi(t);return new at(e,r)}static from(t){return t instanceof at?t:at.fromString(t)}verify(t,e){return typeof e=="string"&&(e=ke.from(e)),At.verify(e.data,t,this.key,{prehash:!1,format:"compact"})}toString(){return Wi(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return`PublicKey: ${this.toString()}`}}const Wi=(n,t)=>{const e=ti(n);return t+re.encode(new Uint8Array([...n,...e.subarray(0,4)]))},Yi=n=>{const t=n.slice(0,3);n=n.slice(3);const e=re.decode(n);return{key:e.subarray(0,e.length-4),prefix:t}};class Jt{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 Jt(s,i)}static from(t,e){if(t instanceof Jt){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 Jt(t,e||"STEEM");if(typeof t=="string")return Jt.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 Xt{static from(t){return t instanceof Xt?t:t instanceof Uint8Array?new Xt(t):typeof t=="string"?new Xt(gt(t)):new Xt(new Uint8Array(t))}constructor(t){this.buffer=t}toString(){return yt(this.buffer)}toJSON(){return this.toString()}}const O={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},lt=()=>{throw new Error("Void can not be serialized")},w=(n,t)=>{n.writeVString(t)},Gi=(n,t)=>{n.writeInt16(t)},mr=(n,t)=>{n.writeInt64(t)},In=(n,t)=>{n.writeUint8(t)},ht=(n,t)=>{n.writeUint16(t)},nt=(n,t)=>{n.writeUint32(t)},wr=(n,t)=>{n.writeUint64(t)},It=(n,t)=>{n.writeByte(t?1:0)},br=n=>(t,e)=>{const[r,i]=e;t.writeVarint32(r),n[r](t,i)},z=(n,t)=>{const e=Jt.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))},_t=(n,t)=>{t===null||typeof t=="string"&&t.slice(-39)==="1111111111111111111111111111111114T1Anm"?n.append(new Uint8Array(33).fill(0)):n.append(at.from(t).key)},yr=(n=null)=>(t,e)=>{e=Xt.from(e);const r=e.buffer.length;if(n){if(r!==n)throw new Error(`Unable to serialize binary. Expected ${n} bytes, got 
Loading...
gin-bottom:16px;overflow-x:auto}nav a{color:var(--tm);text-decoration:none;padding:8px 12px;border-radius:var(--r);font-size:.85rem;white-space:nowrap}nav a.active{background:var(--sf);color:var(--tx)}nav a:hover{color:var(--tx)}.hidden{display:none}</style>
</head>
<body>
  <div id="app"></div>
</body>
</html>

<!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 We(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function jt(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=We(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 Nn(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash must wrapped by utils.createHasher");jt(n.outputLen),jt(n.blockLen)}function xe(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 zr(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 Ue(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function wt(n,t){return n<<32-t|n>>>t}function le(n,t){return n<<t|n>>>32-t>>>0}const qn=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Kr=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function yt(n){if(Z(n),qn)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Kr[n[e]];return t}const vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function fn(n){if(n>=vt._0&&n<=vt._9)return n-vt._0;if(n>=vt.A&&n<=vt.F)return n-(vt.A-10);if(n>=vt.a&&n<=vt.f)return n-(vt.a-10)}function gt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(qn)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=fn(n.charCodeAt(s)),a=fn(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 Ye(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 Hn(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 Mn=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 de=new ArrayBuffer(0),Pr=new TextEncoder,hn=new TextDecoder;class N{constructor(t=N.DEFAULT_CAPACITY,e=N.DEFAULT_ENDIAN){this.readUInt32=this.readUint32,this.buffer=t===0?de:new ArrayBuffer(t),this.view=t===0?new DataView(de):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e}static allocate(t,e){return new N(t,e)}static concat(t,e){let r=0;for(let a=0;a<t.length;++a){const o=t[a];if(o instanceof N)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 N(0,e);const i=new N(r,e),s=new Uint8Array(i.buffer);let c=0;for(let a=0;a<t.length;++a){let o=t[a];o instanceof N?(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 N){const i=t.clone();return i.markedOffset=-1,i}let r;if(t instanceof Uint8Array)r=new N(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 N(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(de));else if(Array.isArray(t))r=new N(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 N?(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 N(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 N(0,this.littleEndian);const r=e-t,i=new N(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?de: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=Pr.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=hn.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=hn.decode(new Uint8Array(this.buffer,e,t));return r?(this.offset+=t,i):{string:i,length:t}}}N.LITTLE_ENDIAN=!0;N.BIG_ENDIAN=!1;N.DEFAULT_CAPACITY=16;N.DEFAULT_ENDIAN=N.BIG_ENDIAN;function Fr(n,t,e){return n&t^~n&e}function jr(n,t,e){return n&t^n&e^t&e}class Ge{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=Ue(this.buffer)}update(t){xe(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=Ue(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){xe(this),zr(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 f=c;f<i;f++)e[f]=0;r.setBigUint64(i-8,BigInt(this.length*8),s),this.process(r,0);const a=Ue(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 f=0;f<l;f++)a.setUint32(4*f,d[f],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 $t=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),et=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Zr=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Vn=Uint8Array.from(new Array(16).fill(0).map((n,t)=>t)),Wr=Vn.map(n=>(9*n+5)%16),zn=(()=>{const e=[[Vn],[Wr]];for(let r=0;r<4;r++)for(let i of e)i.push(i[r].map(s=>Zr[s]));return e})(),Kn=zn[0],Pn=zn[1],Fn=[[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)),Yr=Kn.map((n,t)=>n.map(e=>Fn[t][e])),Gr=Pn.map((n,t)=>n.map(e=>Fn[t][e])),Jr=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Xr=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function pn(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 ue=new Uint32Array(16);class Qr extends Ge{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 h=0;h<16;h++,e+=4)ue[h]=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,f=this.h4|0,m=f;for(let h=0;h<5;h++){const b=4-h,y=Jr[h],p=Xr[h],_=Kn[h],v=Pn[h],S=Yr[h],L=Gr[h];for(let I=0;I<16;I++){const q=le(r+pn(h,s,a,l)+ue[_[I]]+y,S[I])+f|0;r=f,f=l,l=le(a,10)|0,a=s,s=q}for(let I=0;I<16;I++){const q=le(i+pn(b,c,o,d)+ue[v[I]]+p,L[I])+m|0;i=m,m=d,d=le(o,10)|0,o=c,c=q}}this.set(this.h1+a+d|0,this.h2+l+m|0,this.h3+f+i|0,this.h4+r+c|0,this.h0+s+o|0)}roundClean(){Nt(ue)}destroy(){this.destroyed=!0,Nt(this.buffer),this.set(0,0,0,0,0)}}const ti=Ye(()=>new Qr);function ei(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),f=d.charCodeAt(0);if(t[f]!==255)throw new TypeError(d+" is ambiguous");t[f]=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,f=0,m=0;const h=l.length;for(;m!==h&&l[m]===0;)m++,d++;const b=(h-m)*s+1>>>0,y=new Uint8Array(b);for(;m!==h;){let v=l[m],S=0;for(let L=b-1;(v!==0||S<f)&&L!==-1;L--,S++)v+=256*y[L]>>>0,y[L]=v%e>>>0,v=v/e>>>0;if(v!==0)throw new Error("Non-zero carry");f=S,m++}let p=b-f;for(;p!==b&&y[p]===0;)p++;let _=r.repeat(d);for(;p<b;++p)_+=n.charAt(y[p]);return _}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,f=0,m=0;for(;l[d]===r;)f++,d++;const h=(l.length-d)*i+1>>>0,b=new Uint8Array(h);for(;d<l.length;){const v=l.charCodeAt(d);if(v>255)return;let S=t[v];if(S===255)return;let L=0;for(let I=h-1;(S!==0||L<m)&&I!==-1;I--,L++)S+=e*b[I]>>>0,b[I]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");m=L,d++}let y=h-m;for(;y!==h&&b[y]===0;)y++;const p=new Uint8Array(f+(h-y));let _=f;for(;y!==h;)p[_++]=b[y++];return p}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 ni="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const re=ei(ni),ft={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},fe=BigInt(2**32-1),mn=BigInt(32);function ri(n,t=!1){return t?{h:Number(n&fe),l:Number(n>>mn&fe)}:{h:Number(n>>mn&fe)|0,l:Number(n&fe)|0}}function ii(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}=ri(n[s],t);[r[s],i[s]]=[c,a]}return[r,i]}const wn=(n,t,e)=>n>>>e,bn=(n,t,e)=>n<<32-e|t>>>e,Yt=(n,t,e)=>n>>>e|t<<32-e,Gt=(n,t,e)=>n<<32-e|t>>>e,he=(n,t,e)=>n<<64-e|t>>>e-32,pe=(n,t,e)=>n>>>e-32|t<<64-e;function xt(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const si=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),oi=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,ci=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),ai=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,li=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),di=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,ui=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 fi extends Ge{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 f=0;f<16;f++,e+=4)Bt[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){const m=Bt[f-15],h=Bt[f-2],b=wt(m,7)^wt(m,18)^m>>>3,y=wt(h,17)^wt(h,19)^h>>>10;Bt[f]=y+Bt[f-7]+b+Bt[f-16]|0}let{A:r,B:i,C:s,D:c,E:a,F:o,G:l,H:d}=this;for(let f=0;f<64;f++){const m=wt(a,6)^wt(a,11)^wt(a,25),h=d+m+Fr(a,o,l)+ui[f]+Bt[f]|0,y=(wt(r,2)^wt(r,13)^wt(r,22))+jr(r,i,s)|0;d=l,l=o,o=a,a=c+h|0,c=s,s=i,i=r,r=h+y|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 hi extends fi{A=$t[0]|0;B=$t[1]|0;C=$t[2]|0;D=$t[3]|0;E=$t[4]|0;F=$t[5]|0;G=$t[6]|0;H=$t[7]|0;constructor(){super(32)}}const jn=ii(["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))),pi=jn[0],mi=jn[1],kt=new Uint32Array(80),Ut=new Uint32Array(80);class wi extends Ge{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:f,Fl:m,Gh:h,Gl:b,Hh:y,Hl:p}=this;return[t,e,r,i,s,c,a,o,l,d,f,m,h,b,y,p]}set(t,e,r,i,s,c,a,o,l,d,f,m,h,b,y,p){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=f|0,this.Fl=m|0,this.Gh=h|0,this.Gl=b|0,this.Hh=y|0,this.Hl=p|0}process(t,e){for(let S=0;S<16;S++,e+=4)kt[S]=t.getUint32(e),Ut[S]=t.getUint32(e+=4);for(let S=16;S<80;S++){const L=kt[S-15]|0,I=Ut[S-15]|0,q=Yt(L,I,1)^Yt(L,I,8)^wn(L,I,7),Q=Gt(L,I,1)^Gt(L,I,8)^bn(L,I,7),W=kt[S-2]|0,C=Ut[S-2]|0,dt=Yt(W,C,19)^he(W,C,61)^wn(W,C,6),ot=Gt(W,C,19)^pe(W,C,61)^bn(W,C,6),M=ci(Q,ot,Ut[S-7],Ut[S-16]),E=ai(M,q,dt,kt[S-7],kt[S-16]);kt[S]=E|0,Ut[S]=M|0}let{Ah:r,Al:i,Bh:s,Bl:c,Ch:a,Cl:o,Dh:l,Dl:d,Eh:f,El:m,Fh:h,Fl:b,Gh:y,Gl:p,Hh:_,Hl:v}=this;for(let S=0;S<80;S++){const L=Yt(f,m,14)^Yt(f,m,18)^he(f,m,41),I=Gt(f,m,14)^Gt(f,m,18)^pe(f,m,41),q=f&h^~f&y,Q=m&b^~m&p,W=li(v,I,Q,mi[S],Ut[S]),C=di(W,_,L,q,pi[S],kt[S]),dt=W|0,ot=Yt(r,i,28)^he(r,i,34)^he(r,i,39),M=Gt(r,i,28)^pe(r,i,34)^pe(r,i,39),E=r&s^r&a^s&a,x=i&c^i&o^c&o;_=y|0,v=p|0,y=h|0,p=b|0,h=f|0,b=m|0,{h:f,l:m}=xt(l|0,d|0,C|0,dt|0),l=a|0,d=o|0,a=s|0,o=c|0,s=r|0,c=i|0;const g=si(dt,M,x);r=oi(g,C,ot,E),i=g|0}({h:r,l:i}=xt(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:c}=xt(this.Bh|0,this.Bl|0,s|0,c|0),{h:a,l:o}=xt(this.Ch|0,this.Cl|0,a|0,o|0),{h:l,l:d}=xt(this.Dh|0,this.Dl|0,l|0,d|0),{h:f,l:m}=xt(this.Eh|0,this.El|0,f|0,m|0),{h,l:b}=xt(this.Fh|0,this.Fl|0,h|0,b|0),{h:y,l:p}=xt(this.Gh|0,this.Gl|0,y|0,p|0),{h:_,l:v}=xt(this.Hh|0,this.Hl|0,_|0,v|0),this.set(r,i,s,c,a,o,l,d,f,m,h,b,y,p,_,v)}roundClean(){Nt(kt,Ut)}destroy(){Nt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class bi extends wi{Ah=et[0]|0;Al=et[1]|0;Bh=et[2]|0;Bl=et[3]|0;Ch=et[4]|0;Cl=et[5]|0;Dh=et[6]|0;Dl=et[7]|0;Eh=et[8]|0;El=et[9]|0;Fh=et[10]|0;Fl=et[11]|0;Gh=et[12]|0;Gl=et[13]|0;Hh=et[14]|0;Hl=et[15]|0;constructor(){super(64)}}const Zt=Ye(()=>new hi,Mn(1)),Zn=Ye(()=>new bi,Mn(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Je=BigInt(0),Ve=BigInt(1);function Ee(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}" `;throw new Error(e+"expected boolean, got type="+typeof n)}return n}function Wn(n){if(typeof n=="bigint"){if(!ge(n))throw new Error("positive bigint expected, got "+n)}else jt(n);return n}function me(n){const t=Wn(n).toString(16);return t.length&1?"0"+t:t}function Yn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Je:BigInt("0x"+n)}function $e(n){return Yn(yt(n))}function Gn(n){return Yn(yt(yi(Z(n)).reverse()))}function Xe(n,t){jt(t),n=Wn(n);const e=gt(n.toString(16).padStart(t*2,"0"));if(e.length!==t)throw new Error("number too large");return e}function Jn(n,t){return Xe(n,t).reverse()}function yi(n){return Uint8Array.from(n)}const ge=n=>typeof n=="bigint"&&Je<=n;function gi(n,t,e){return ge(n)&&ge(t)&&ge(e)&&t<=n&&n<e}function _i(n,t,e,r){if(!gi(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function vi(n){let t;for(t=0;n>Je;n>>=Ve,t+=1);return t}const Qe=n=>(Ve<<BigInt(n))-Ve;function xi(n,t,e){if(jt(n,"hashLen"),jt(t,"qByteLen"),typeof e!="function")throw new Error("hmacFn must be a function");const r=p=>new Uint8Array(p),i=Uint8Array.of(),s=Uint8Array.of(0),c=Uint8Array.of(1),a=1e3;let o=r(n),l=r(n),d=0;const f=()=>{o.fill(1),l.fill(0),d=0},m=(...p)=>e(l,Ct(o,...p)),h=(p=i)=>{l=m(s,p),o=m(),p.length!==0&&(l=m(c,p),o=m())},b=()=>{if(d++>=a)throw new Error("drbg: tried max amount of iterations");let p=0;const _=[];for(;p<t;){o=m();const v=o.slice();_.push(v),p+=o.length}return Ct(..._)};return(p,_)=>{f(),h(p);let v;for(;!(v=_(b()));)h();return f(),v}}function tn(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 yn(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 st=BigInt(0),rt=BigInt(1),Mt=BigInt(2),Xn=BigInt(3),Qn=BigInt(4),tr=BigInt(5),Ei=BigInt(7),er=BigInt(8),Si=BigInt(9),nr=BigInt(16);function ut(n,t){const e=n%t;return e>=st?e:t+e}function ct(n,t,e){let r=n;for(;t-- >st;)r*=r,r%=e;return r}function gn(n,t){if(n===st)throw new Error("invert: expected non-zero number");if(t<=st)throw new Error("invert: expected positive modulus, got "+t);let e=ut(n,t),r=t,i=st,s=rt;for(;e!==st;){const a=r/e,o=r%e,l=i-s*a;r=e,e=o,i=s,s=l}if(r!==rt)throw new Error("invert: does not exist");return ut(i,t)}function en(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function rr(n,t){const e=(n.ORDER+rt)/Qn,r=n.pow(t,e);return en(n,r,t),r}function Ai(n,t){const e=(n.ORDER-tr)/er,r=n.mul(t,Mt),i=n.pow(r,e),s=n.mul(t,i),c=n.mul(n.mul(s,Mt),i),a=n.mul(s,n.sub(c,n.ONE));return en(n,a,t),a}function Li(n){const t=Be(n),e=ir(n),r=e(t,t.neg(t.ONE)),i=e(t,r),s=e(t,t.neg(r)),c=(n+Ei)/nr;return(a,o)=>{let l=a.pow(o,c),d=a.mul(l,r);const f=a.mul(l,i),m=a.mul(l,s),h=a.eql(a.sqr(d),o),b=a.eql(a.sqr(f),o);l=a.cmov(l,d,h),d=a.cmov(m,f,b);const y=a.eql(a.sqr(d),o),p=a.cmov(l,d,y);return en(a,p,o),p}}function ir(n){if(n<Xn)throw new Error("sqrt is not defined for small field");let t=n-rt,e=0;for(;t%Mt===st;)t/=Mt,e++;let r=Mt;const i=Be(n);for(;_n(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return rr;let s=i.pow(r,t);const c=(t+rt)/Mt;return function(o,l){if(o.is0(l))return l;if(_n(o,l)!==1)throw new Error("Cannot find square root");let d=e,f=o.mul(o.ONE,s),m=o.pow(l,t),h=o.pow(l,c);for(;!o.eql(m,o.ONE);){if(o.is0(m))return o.ZERO;let b=1,y=o.sqr(m);for(;!o.eql(y,o.ONE);)if(b++,y=o.sqr(y),b===d)throw new Error("Cannot find square root");const p=rt<<BigInt(d-b-1),_=o.pow(f,p);d=b,f=o.sqr(_),m=o.mul(m,f),h=o.mul(h,_)}return h}}function Ii(n){return n%Qn===Xn?rr:n%er===tr?Ai:n%nr===Si?Li(n):ir(n)}const $i=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Bi(n){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=$i.reduce((r,i)=>(r[i]="function",r),t);return tn(n,e),n}function ki(n,t,e){if(e<st)throw new Error("invalid exponent, negatives unsupported");if(e===st)return n.ONE;if(e===rt)return t;let r=n.ONE,i=t;for(;e>st;)e&rt&&(r=n.mul(r,i)),i=n.sqr(i),e>>=rt;return r}function sr(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 _n(n,t){const e=(n.ORDER-rt)/Mt,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 Ui(n,t){t!==void 0&&jt(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}class Ti{ORDER;BITS;BYTES;isLE;ZERO=st;ONE=rt;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=st)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}=Ui(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 ut(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return st<=t&&t<this.ORDER}is0(t){return t===st}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&rt)===rt}neg(t){return ut(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return ut(t*t,this.ORDER)}add(t,e){return ut(t+e,this.ORDER)}sub(t,e){return ut(t-e,this.ORDER)}mul(t,e){return ut(t*e,this.ORDER)}pow(t,e){return ki(this,t,e)}div(t,e){return ut(t*gn(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 gn(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=Ii(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Jn(t,this.BYTES):Xe(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?Gn(t):$e(t);if(a&&(o=ut(o,c)),!e&&!this.isValid(o))throw new Error("invalid field element: outside of range 0..ORDER");return o}invertBatch(t){return sr(this,t)}cmov(t,e,r){return r?e:t}}function Be(n,t={}){return new Ti(n,t)}function or(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 cr(n){const t=or(n);return t+Math.ceil(t/2)}function Ci(n,t,e=!1){Z(n);const r=n.length,i=or(t),s=cr(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=e?Gn(n):$e(n),a=ut(c,t-rt)+rt;return e?Jn(a,i):Xe(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ne=BigInt(0),Vt=BigInt(1);function Se(n,t){const e=t.negate();return n?e:t}function vn(n,t){const e=sr(n.Fp,t.map(r=>r.Z));return t.map((r,i)=>n.fromAffine(r.toAffine(e[i])))}function ar(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Te(n,t){ar(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=Qe(n),c=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:c}}function xn(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+=Vt);const l=t*r,d=l+Math.abs(a)-1,f=a===0,m=a<0,h=t%2!==0;return{nextN:o,offset:d,isZero:f,isNeg:m,isNegF:h,offsetF:l}}const Ce=new WeakMap,lr=new WeakMap;function Oe(n){return lr.get(n)||1}function En(n){if(n!==ne)throw new Error("invalid wNAF")}class Oi{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>ne;)e&Vt&&(r=r.add(i)),i=i.double(),e>>=Vt;return r}precomputeWindow(t,e){const{windows:r,windowSize:i}=Te(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=Te(t,this.bits);for(let a=0;a<c.windows;a++){const{nextN:o,offset:l,isZero:d,isNeg:f,isNegF:m,offsetF:h}=xn(r,a,c);r=o,d?s=s.add(Se(m,e[h])):i=i.add(Se(f,e[l]))}return En(r),{p:i,f:s}}wNAFUnsafe(t,e,r,i=this.ZERO){const s=Te(t,this.bits);for(let c=0;c<s.windows&&r!==ne;c++){const{nextN:a,offset:o,isZero:l,isNeg:d}=xn(r,c,s);if(r=a,!l){const f=e[o];i=i.add(d?f.negate():f)}}return En(r),i}getPrecomputes(t,e,r){let i=Ce.get(e);return i||(i=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(i=r(i)),Ce.set(e,i))),i}cached(t,e,r){const i=Oe(t);return this.wNAF(i,this.getPrecomputes(i,t,r),e)}unsafe(t,e,r,i){const s=Oe(t);return s===1?this._unsafeLadder(t,e,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),e,i)}createCache(t,e){ar(e,this.bits),lr.set(t,e),Ce.delete(t)}hasCache(t){return Oe(t)!==1}}function Ri(n,t,e,r){let i=t,s=n.ZERO,c=n.ZERO;for(;e>ne||r>ne;)e&Vt&&(s=s.add(i)),r&Vt&&(c=c.add(i)),i=i.double(),e>>=Vt,r>>=Vt;return{p1:s,p2:c}}function Sn(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Bi(t),t}else return Be(n,{isLE:e})}function Di(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>ne))throw new Error(`CURVE.${o} must be positive bigint`)}const i=Sn(t.p,e.Fp,r),s=Sn(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 Ni(n,t){return function(r){const i=n(r);return{secretKey:i,publicKey:t(i)}}}class dr{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,e){if(Nn(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 xe(this),this.iHash.update(t),this}digestInto(t){xe(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 ur=(n,t,e)=>new dr(n,t).update(e).digest();ur.create=(n,t)=>new dr(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const An=(n,t)=>(n+(n>=0?t:-t)/fr)/t;function qi(n,t,e){const[[r,i],[s,c]]=t,a=An(c*n,e),o=An(-i*n,e);let l=n-a*r-o*s,d=-a*i-o*c;const f=l<Lt,m=d<Lt;f&&(l=-l),m&&(d=-d);const h=Qe(Math.ceil(vi(e)/2))+te;if(l<Lt||l>=h||d<Lt||d>=h)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:f,k1:l,k2neg:m,k2:d}}function ze(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function Re(n,t){const e={};for(let r of Object.keys(t))e[r]=n[r]===void 0?t[r]:n[r];return Ee(e.lowS,"lowS"),Ee(e.prehash,"prehash"),e.format!==void 0&&ze(e.format),e}class Hi extends Error{constructor(t=""){super(t)}}const Tt={Err:Hi,_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=me(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?me(i.length/2|128):"";return me(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<Lt)throw new t("integer: negative integers are not allowed");let e=me(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 $e(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)}},Lt=BigInt(0),te=BigInt(1),fr=BigInt(2),we=BigInt(3),Mi=BigInt(4);function Vi(n,t={}){const e=Di("weierstrass",n,t),{Fp:r,Fn:i}=e;let s=e.CURVE;const{h:c,n:a}=s;tn(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=pr(r,i);function d(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(M,E,x){const{x:g,y:A}=E.toAffine(),B=r.toBytes(g);if(Ee(x,"isCompressed"),x){d();const U=!r.isOdd(A);return Ct(hr(U),B)}else return Ct(Uint8Array.of(4),B,r.toBytes(A))}function m(M){Z(M,void 0,"Point");const{publicKey:E,publicKeyUncompressed:x}=l,g=M.length,A=M[0],B=M.subarray(1);if(g===E&&(A===2||A===3)){const U=r.fromBytes(B);if(!r.isValid(U))throw new Error("bad point: is not on curve, wrong x");const k=y(U);let $;try{$=r.sqrt(k)}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($);return(A&1)===1!==D&&($=r.neg($)),{x:U,y:$}}else if(g===x&&A===4){const U=r.BYTES,k=r.fromBytes(B.subarray(0,U)),$=r.fromBytes(B.subarray(U,U*2));if(!p(k,$))throw new Error("bad point: is not on curve");return{x:k,y:$}}else throw new Error(`bad point: got length ${g}, expected compressed=${E} or uncompressed=${x}`)}const h=t.toBytes||f,b=t.fromBytes||m;function y(M){const E=r.sqr(M),x=r.mul(E,M);return r.add(r.add(x,r.mul(M,s.a)),s.b)}function p(M,E){const x=r.sqr(E),g=y(M);return r.eql(x,g)}if(!p(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const _=r.mul(r.pow(s.a,we),Mi),v=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(_,v)))throw new Error("bad curve params: a or b");function S(M,E,x=!1){if(!r.isValid(E)||x&&r.is0(E))throw new Error(`bad point coordinate ${M}`);return E}function L(M){if(!(M instanceof C))throw new Error("Weierstrass Point expected")}function I(M){if(!o||!o.basises)throw new Error("no endo");return qi(M,o.basises,i.ORDER)}const q=yn((M,E)=>{const{X:x,Y:g,Z:A}=M;if(r.eql(A,r.ONE))return{x,y:g};const B=M.is0();E==null&&(E=B?r.ONE:r.inv(A));const U=r.mul(x,E),k=r.mul(g,E),$=r.mul(A,E);if(B)return{x:r.ZERO,y:r.ZERO};if(!r.eql($,r.ONE))throw new Error("invZ was invalid");return{x:U,y:k}}),Q=yn(M=>{if(M.is0()){if(t.allowInfinityPoint&&!r.is0(M.Y))return;throw new Error("bad point: ZERO")}const{x:E,y:x}=M.toAffine();if(!r.isValid(E)||!r.isValid(x))throw new Error("bad point: x or y not field elements");if(!p(E,x))throw new Error("bad point: equation left != right");if(!M.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function W(M,E,x,g,A){return x=new C(r.mul(x.X,M),x.Y,x.Z),E=Se(g,E),x=Se(A,x),E.add(x)}class C{static BASE=new C(s.Gx,s.Gy,r.ONE);static ZERO=new C(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(E,x,g){this.X=S("x",E),this.Y=S("y",x,!0),this.Z=S("z",g),Object.freeze(this)}static CURVE(){return s}static fromAffine(E){const{x,y:g}=E||{};if(!E||!r.isValid(x)||!r.isValid(g))throw new Error("invalid affine point");if(E instanceof C)throw new Error("projective point not allowed");return r.is0(x)&&r.is0(g)?C.ZERO:new C(x,g,r.ONE)}static fromBytes(E){const x=C.fromAffine(b(Z(E,void 0,"point")));return x.assertValidity(),x}static fromHex(E){return C.fromBytes(gt(E))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(E=8,x=!0){return ot.createCache(this,E),x||this.multiply(we),this}assertValidity(){Q(this)}hasEvenY(){const{y:E}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(E)}equals(E){L(E);const{X:x,Y:g,Z:A}=this,{X:B,Y:U,Z:k}=E,$=r.eql(r.mul(x,k),r.mul(B,A)),D=r.eql(r.mul(g,k),r.mul(U,A));return $&&D}negate(){return new C(this.X,r.neg(this.Y),this.Z)}double(){const{a:E,b:x}=s,g=r.mul(x,we),{X:A,Y:B,Z:U}=this;let k=r.ZERO,$=r.ZERO,D=r.ZERO,H=r.mul(A,A),Y=r.mul(B,B),K=r.mul(U,U),V=r.mul(A,B);return V=r.add(V,V),D=r.mul(A,U),D=r.add(D,D),k=r.mul(E,D),$=r.mul(g,K),$=r.add(k,$),k=r.sub(Y,$),$=r.add(Y,$),$=r.mul(k,$),k=r.mul(V,k),D=r.mul(g,D),K=r.mul(E,K),V=r.sub(H,K),V=r.mul(E,V),V=r.add(V,D),D=r.add(H,H),H=r.add(D,H),H=r.add(H,K),H=r.mul(H,V),$=r.add($,H),K=r.mul(B,U),K=r.add(K,K),H=r.mul(K,V),k=r.sub(k,H),D=r.mul(K,Y),D=r.add(D,D),D=r.add(D,D),new C(k,$,D)}add(E){L(E);const{X:x,Y:g,Z:A}=this,{X:B,Y:U,Z:k}=E;let $=r.ZERO,D=r.ZERO,H=r.ZERO;const Y=s.a,K=r.mul(s.b,we);let V=r.mul(x,B),P=r.mul(g,U),X=r.mul(A,k),mt=r.add(x,g),F=r.add(B,U);mt=r.mul(mt,F),F=r.add(V,P),mt=r.sub(mt,F),F=r.add(x,A);let tt=r.add(B,k);return F=r.mul(F,tt),tt=r.add(V,X),F=r.sub(F,tt),tt=r.add(g,A),$=r.add(U,k),tt=r.mul(tt,$),$=r.add(P,X),tt=r.sub(tt,$),H=r.mul(Y,F),$=r.mul(K,X),H=r.add($,H),$=r.sub(P,H),H=r.add(P,H),D=r.mul($,H),P=r.add(V,V),P=r.add(P,V),X=r.mul(Y,X),F=r.mul(K,F),P=r.add(P,X),X=r.sub(V,X),X=r.mul(Y,X),F=r.add(F,X),V=r.mul(P,F),D=r.add(D,V),V=r.mul(tt,F),$=r.mul(mt,$),$=r.sub($,V),V=r.mul(mt,P),H=r.mul(tt,H),H=r.add(H,V),new C($,D,H)}subtract(E){return this.add(E.negate())}is0(){return this.equals(C.ZERO)}multiply(E){const{endo:x}=t;if(!i.isValidNot0(E))throw new Error("invalid scalar: out of range");let g,A;const B=U=>ot.cached(this,U,k=>vn(C,k));if(x){const{k1neg:U,k1:k,k2neg:$,k2:D}=I(E),{p:H,f:Y}=B(k),{p:K,f:V}=B(D);A=Y.add(V),g=W(x.beta,H,K,U,$)}else{const{p:U,f:k}=B(E);g=U,A=k}return vn(C,[g,A])[0]}multiplyUnsafe(E){const{endo:x}=t,g=this;if(!i.isValid(E))throw new Error("invalid scalar: out of range");if(E===Lt||g.is0())return C.ZERO;if(E===te)return g;if(ot.hasCache(this))return this.multiply(E);if(x){const{k1neg:A,k1:B,k2neg:U,k2:k}=I(E),{p1:$,p2:D}=Ri(C,g,B,k);return W(x.beta,$,D,A,U)}else return ot.unsafe(g,E)}toAffine(E){return q(this,E)}isTorsionFree(){const{isTorsionFree:E}=t;return c===te?!0:E?E(C,this):ot.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:E}=t;return c===te?this:E?E(C,this):this.multiplyUnsafe(c)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}toBytes(E=!0){return Ee(E,"isCompressed"),this.assertValidity(),h(C,this,E)}toHex(E=!0){return yt(this.toBytes(E))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const dt=i.BITS,ot=new Oi(C,t.endo?Math.ceil(dt/2):dt);return C.BASE.precompute(8),C}function hr(n){return Uint8Array.of(n?2:3)}function pr(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function zi(n,t={}){const{Fn:e}=n,r=t.randomBytes||Hn,i=Object.assign(pr(n.Fp,e),{seed:cr(e.ORDER)});function s(h){try{const b=e.fromBytes(h);return e.isValidNot0(b)}catch{return!1}}function c(h,b){const{publicKey:y,publicKeyUncompressed:p}=i;try{const _=h.length;return b===!0&&_!==y||b===!1&&_!==p?!1:!!n.fromBytes(h)}catch{return!1}}function a(h=r(i.seed)){return Ci(Z(h,i.seed,"seed"),e.ORDER)}function o(h,b=!0){return n.BASE.multiply(e.fromBytes(h)).toBytes(b)}function l(h){const{secretKey:b,publicKey:y,publicKeyUncompressed:p}=i;if(!We(h)||"_lengths"in e&&e._lengths||b===y)return;const _=Z(h,void 0,"key").length;return _===y||_===p}function d(h,b,y=!0){if(l(h)===!0)throw new Error("first arg must be private key");if(l(b)===!1)throw new Error("second arg must be public key");const p=e.fromBytes(h);return n.fromBytes(b).multiply(p).toBytes(y)}const f={isValidSecretKey:s,isValidPublicKey:c,randomSecretKey:a},m=Ni(a,o);return Object.freeze({getPublicKey:o,getSharedSecret:d,keygen:m,Point:n,utils:f,lengths:i})}function Ki(n,t,e={}){Nn(t),tn(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),e=Object.assign({},e);const r=e.randomBytes||Hn,i=e.hmac||((x,g)=>ur(t,x,g)),{Fp:s,Fn:c}=n,{ORDER:a,BITS:o}=c,{keygen:l,getPublicKey:d,getSharedSecret:f,utils:m,lengths:h}=zi(n,e),b={prehash:!0,lowS:typeof e.lowS=="boolean"?e.lowS:!0,format:"compact",extraEntropy:!1},y=a*fr<s.ORDER;function p(x){const g=a>>te;return x>g}function _(x,g){if(!c.isValidNot0(g))throw new Error(`invalid signature ${x}: out of range 1..Point.Fn.ORDER`);return g}function v(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function S(x,g){ze(g);const A=h.signature,B=g==="compact"?A:g==="recovered"?A+1:void 0;return Z(x,B)}class L{r;s;recovery;constructor(g,A,B){if(this.r=_("r",g),this.s=_("s",A),B!=null){if(v(),![0,1,2,3].includes(B))throw new Error("invalid recovery id");this.recovery=B}Object.freeze(this)}static fromBytes(g,A=b.format){S(g,A);let B;if(A==="der"){const{r:D,s:H}=Tt.toSig(Z(g));return new L(D,H)}A==="recovered"&&(B=g[0],A="compact",g=g.subarray(1));const U=h.signature/2,k=g.subarray(0,U),$=g.subarray(U,U*2);return new L(c.fromBytes(k),c.fromBytes($),B)}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 L(this.r,this.s,g)}recoverPublicKey(g){const{r:A,s:B}=this,U=this.assertRecovery(),k=U===2||U===3?A+a:A;if(!s.isValid(k))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const $=s.toBytes(k),D=n.fromBytes(Ct(hr((U&1)===0),$)),H=c.inv(k),Y=q(Z(g,void 0,"msgHash")),K=c.create(-Y*H),V=c.create(B*H),P=n.BASE.multiplyUnsafe(K).add(D.multiplyUnsafe(V));if(P.is0())throw new Error("invalid recovery: point at infinify");return P.assertValidity(),P}hasHighS(){return p(this.s)}toBytes(g=b.format){if(ze(g),g==="der")return gt(Tt.hexFromSig(this));const{r:A,s:B}=this,U=c.toBytes(A),k=c.toBytes(B);return g==="recovered"?(v(),Ct(Uint8Array.of(this.assertRecovery()),U,k)):Ct(U,k)}toHex(g){return yt(this.toBytes(g))}}const I=e.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const A=$e(g),B=g.length*8-o;return B>0?A>>BigInt(B):A},q=e.bits2int_modN||function(g){return c.create(I(g))},Q=Qe(o);function W(x){return _i("num < 2^"+o,x,Lt,Q),c.toBytes(x)}function C(x,g){return Z(x,void 0,"message"),g?Z(t(x),void 0,"prehashed message"):x}function dt(x,g,A){const{lowS:B,prehash:U,extraEntropy:k}=Re(A,b);x=C(x,U);const $=q(x),D=c.fromBytes(g);if(!c.isValidNot0(D))throw new Error("invalid private key");const H=[W(D),W($)];if(k!=null&&k!==!1){const P=k===!0?r(h.secretKey):k;H.push(Z(P,void 0,"extraEntropy"))}const Y=Ct(...H),K=$;function V(P){const X=I(P);if(!c.isValidNot0(X))return;const mt=c.inv(X),F=n.BASE.multiply(X).toAffine(),tt=c.create(F.x);if(tt===Lt)return;const ae=c.create(mt*c.create(K+tt*D));if(ae===Lt)return;let dn=(F.x===tt?0:2)|Number(F.y&te),un=ae;return B&&p(ae)&&(un=c.neg(ae),dn^=1),new L(tt,un,y?void 0:dn)}return{seed:Y,k2sig:V}}function ot(x,g,A={}){const{seed:B,k2sig:U}=dt(x,g,A);return xi(t.outputLen,c.BYTES,i)(B,U).toBytes(A.format)}function M(x,g,A,B={}){const{lowS:U,prehash:k,format:$}=Re(B,b);if(A=Z(A,void 0,"publicKey"),g=C(g,k),!We(x)){const D=x instanceof L?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+D)}S(x,$);try{const D=L.fromBytes(x,$),H=n.fromBytes(A);if(U&&D.hasHighS())return!1;const{r:Y,s:K}=D,V=q(g),P=c.inv(K),X=c.create(V*P),mt=c.create(Y*P),F=n.BASE.multiplyUnsafe(X).add(H.multiplyUnsafe(mt));return F.is0()?!1:c.create(F.x)===Y}catch{return!1}}function E(x,g,A={}){const{prehash:B}=Re(A,b);return g=C(g,B),L.fromBytes(x,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:f,utils:m,lengths:h,Point:n,sign:ot,verify:M,recoverPublicKey:E,Signature:L,hash:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nn={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Pi={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Ln=BigInt(2);function Fi(n){const t=nn.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,f=ct(d,e,t)*d%t,m=ct(f,e,t)*d%t,h=ct(m,Ln,t)*l%t,b=ct(h,i,t)*h%t,y=ct(b,s,t)*b%t,p=ct(y,a,t)*y%t,_=ct(p,o,t)*p%t,v=ct(_,a,t)*y%t,S=ct(v,e,t)*d%t,L=ct(S,c,t)*b%t,I=ct(L,r,t)*l%t,q=ct(I,Ln,t);if(!Ke.eql(Ke.sqr(q),n))throw new Error("Cannot find square root");return q}const Ke=Be(nn.p,{sqrt:Fi}),ji=Vi(nn,{Fp:Ke,endo:Pi}),At=Ki(ji,Zt);class ke{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 ke(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=At.Signature.fromBytes(this.data,"compact"),r=new At.Signature(e.r,e.s,this.recovery);return new at(r.recoverPublicKey(t).toBytes())}}const Zi=ft.address_prefix;class at{constructor(t,e){this.key=t,this.prefix=e??Zi}static fromString(t){const{key:e,prefix:r}=Yi(t);return new at(e,r)}static from(t){return t instanceof at?t:at.fromString(t)}verify(t,e){return typeof e=="string"&&(e=ke.from(e)),At.verify(e.data,t,this.key,{prehash:!1,format:"compact"})}toString(){return Wi(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return`PublicKey: ${this.toString()}`}}const Wi=(n,t)=>{const e=ti(n);return t+re.encode(new Uint8Array([...n,...e.subarray(0,4)]))},Yi=n=>{const t=n.slice(0,3);n=n.slice(3);const e=re.decode(n);return{key:e.subarray(0,e.length-4),prefix:t}};class Jt{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 Jt(s,i)}static from(t,e){if(t instanceof Jt){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 Jt(t,e||"STEEM");if(typeof t=="string")return Jt.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 Xt{static from(t){return t instanceof Xt?t:t instanceof Uint8Array?new Xt(t):typeof t=="string"?new Xt(gt(t)):new Xt(new Uint8Array(t))}constructor(t){this.buffer=t}toString(){return yt(this.buffer)}toJSON(){return this.toString()}}const O={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},lt=()=>{throw new Error("Void can not be serialized")},w=(n,t)=>{n.writeVString(t)},Gi=(n,t)=>{n.writeInt16(t)},mr=(n,t)=>{n.writeInt64(t)},In=(n,t)=>{n.writeUint8(t)},ht=(n,t)=>{n.writeUint16(t)},nt=(n,t)=>{n.writeUint32(t)},wr=(n,t)=>{n.writeUint64(t)},It=(n,t)=>{n.writeByte(t?1:0)},br=n=>(t,e)=>{const[r,i]=e;t.writeVarint32(r),n[r](t,i)},z=(n,t)=>{const e=Jt.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))},_t=(n,t)=>{t===null||typeof t=="string"&&t.slice(-39)==="1111111111111111111111111111111114T1Anm"?n.append(new Uint8Array(33).fill(0)):n.append(at.from(t).key)},yr=(n=null)=>(t,e)=>{e=Xt.from(e);const r=e.buffer.length;if(n){if(r!==n)throw new Error(`Unable to serialize binary. Expected ${n} bytes, got 
Loading...
gin-bottom:16px;overflow-x:auto}nav a{color:var(--tm);text-decoration:none;padding:8px 12px;border-radius:var(--r);font-size:.85rem;white-space:nowrap}nav a.active{background:var(--sf);color:var(--tx)}nav a:hover{color:var(--tx)}.hidden{display:none}</style>
</head>
<body>
  <div id="app"></div>
</body>
</html>