@surec/oracle
Version:
Typescript SDK for the Sure Oracle to be used to bring off-chain data on-chain
12 lines • 639 kB
JavaScript
var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getAugmentedNamespace(t){var e=t.default;if("function"==typeof e){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),r}var buffer={},base64Js={};base64Js.byteLength=byteLength;for(var toByteArray_1=base64Js.toByteArray=toByteArray,fromByteArray_1=base64Js.fromByteArray=fromByteArray,lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i$1=0,len=code.length;i$1<len;++i$1)lookup[i$1]=code[i$1],revLookup[code.charCodeAt(i$1)]=i$1;function getLens(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function byteLength(t){var e=getLens(t),r=e[0],n=e[1];return 3*(r+n)/4-n}function _byteLength(t,e,r){return 3*(e+r)/4-r}function toByteArray(t){var e,r,n=getLens(t),o=n[0],i=n[1],s=new Arr(_byteLength(t,o,i)),a=0,u=i>0?o-4:o;for(r=0;r<u;r+=4)e=revLookup[t.charCodeAt(r)]<<18|revLookup[t.charCodeAt(r+1)]<<12|revLookup[t.charCodeAt(r+2)]<<6|revLookup[t.charCodeAt(r+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===i&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,s[a++]=255&e),1===i&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[63&t]}function encodeChunk(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(tripletToBase64(n));return o.join("")}function fromByteArray(t){for(var e,r=t.length,n=r%3,o=[],i=16383,s=0,a=r-n;s<a;s+=i)o.push(encodeChunk(t,s,s+i>a?a:s+i));return 1===n?(e=t[r-1],o.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),o.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var ieee754={};
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function number$1(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function bool$1(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function bytes(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function hash(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(t.outputLen),number$1(t.blockLen)}function exists(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function output(t,e){bytes(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}ieee754.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,c=u>>1,l=-7,d=r?o-1:0,h=r?-1:1,f=t[e+d];for(d+=h,i=f&(1<<-l)-1,f>>=-l,l+=a;l>0;i=256*i+t[e+d],d+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+t[e+d],d+=h,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),i-=c}return(f?-1:1)*s*Math.pow(2,i-n)},ieee754.write=function(t,e,r,n,o,i){var s,a,u,c=8*i-o-1,l=(1<<c)-1,d=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,p=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(s++,u/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(e*u-1)*Math.pow(2,o),s+=d):(a=e*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;t[r+f]=255&a,f+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[r+f]=255&s,f+=p,s/=256,c-=8);t[r+f-p]|=128*y},
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
function(t){const e=base64Js,r=ieee754,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function i(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|f(t,e);let n=i(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(W(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return s.from(n,e,r);const o=function(t){if(s.isBuffer(t)){const e=0|h(t.length),r=i(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||G(t.length)?i(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return u(t),i(t<0?0:0|h(t))}function l(t){const e=t.length<0?0:0|h(t.length),r=i(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function h(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function f(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(o)return n?-1:j(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),G(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,o){let i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<a;i++)if(c(t,i)===c(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===u)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){let r=!0;for(let n=0;n<u;n++)if(c(t,i+n)!==c(e,n)){r=!1;break}if(r)return i}return-1}function b(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(G(n))return s;t[r+s]=n}return s}function _(t,e,r,n){return V(j(e,t.length-r),t,r,n)}function w(t,e,r,n){return V(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function S(t,e,r,n){return V(q(e),t,r,n)}function v(t,e,r,n){return V(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function E(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function A(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(i=u));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}t.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return a(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?i(t):void 0!==e?"string"==typeof r?i(t).fill(e,r):i(t).fill(e):i(t)}(t,e,r)},s.allocUnsafe=function(t){return c(t)},s.allocUnsafeSlow=function(t){return c(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(W(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=s.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))o+e.length>n.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)y(this,e,e+1);return this},s.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},s.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},s.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,o){if(W(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const u=Math.min(i,a),c=this.slice(n,o),l=t.slice(e,r);for(let t=0;t<u;++t)if(c[t]!==l[t]){i=c[t],a=l[t];break}return i<a?-1:a<i?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return w(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function R(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function I(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function k(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=Y[t[n]];return o}function O(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n,o){H(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function L(t,e,r,n,o){H(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function $(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,n,o,i){return e=+e,n>>>=0,i||$(t,0,n,4),r.write(t,e,n,o,23,4),n+4}function M(t,e,n,o,i){return e=+e,n>>>=0,i||$(t,0,n,8),r.write(t,e,n,o,52,8),n+8}s.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||z(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),s.prototype.readBigUInt64BE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||z(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||z(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||z(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Z((function(t,e=0){return x(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Z((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=Z((function(t,e=0){return x(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Z((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=s.isBuffer(t)?t:s.from(t,n),a=i.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%a]}return this};const N={};function U(t,e,r){N[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function D(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function H(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new N.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){K(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||z(e,t.length-(r+1))}(n,o,i)}function K(t,e){if("number"!=typeof t)throw new N.ERR_INVALID_ARG_TYPE(e,"number",t)}function z(t,e,r){if(Math.floor(t)!==t)throw K(t,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=D(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=D(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n}),RangeError);const F=/[^+/0-9A-Za-z-_]/g;function j(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const Y=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function Z(t){return"undefined"==typeof BigInt?X:t}function X(){throw new Error("BigInt not supported")}}(buffer);const assert$3={number:number$1,bool:bool$1,bytes:bytes,hash:hash,exists:exists,output:output},createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),rotr=(t,e)=>t<<32-e|t>>>e,isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}function toBytes(t){if("string"==typeof t&&(t=utf8ToBytes(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));class Hash{clone(){return this._cloneInto()}}function wrapConstructor(t){const e=e=>t().update(toBytes(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function setBigUint64(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}class SHA2 extends Hash{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=createView(this.buffer)}update(t){assert$3.exists(this);const{view:e,buffer:r,blockLen:n}=this,o=(t=toBytes(t)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=createView(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){assert$3.exists(this),assert$3.output(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:o}=this;let{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let t=i;t<n;t++)e[t]=0;setBigUint64(r,n-8,BigInt(8*this.length),o),this.process(r,0);const s=createView(t);this.get().forEach(((t,e)=>s.setUint32(4*e,t,o)))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return t.length=n,t.pos=s,t.finished=o,t.destroyed=i,n%e&&t.buffer.set(r),t}}const U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(t,e=!1){return e?{h:Number(t&U32_MASK64),l:Number(t>>_32n&U32_MASK64)}:{h:0|Number(t>>_32n&U32_MASK64),l:0|Number(t&U32_MASK64)}}function split(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:i,l:s}=fromBig(t[o],e);[r[o],n[o]]=[i,s]}return[r,n]}const toBig=(t,e)=>BigInt(t>>>0)<<_32n|BigInt(e>>>0),shrSH=(t,e,r)=>t>>>r,shrSL=(t,e,r)=>t<<32-r|e>>>r,rotrSH=(t,e,r)=>t>>>r|e<<32-r,rotrSL=(t,e,r)=>t<<32-r|e>>>r,rotrBH=(t,e,r)=>t<<64-r|e>>>r-32,rotrBL=(t,e,r)=>t>>>r-32|e<<64-r,rotr32H=(t,e)=>e,rotr32L=(t,e)=>t,rotlSH=(t,e,r)=>t<<r|e>>>32-r,rotlSL=(t,e,r)=>e<<r|t>>>32-r,rotlBH=(t,e,r)=>e<<r-32|t>>>64-r,rotlBL=(t,e,r)=>t<<r-32|e>>>64-r;function add(t,e,r,n){const o=(e>>>0)+(n>>>0);return{h:t+r+(o/2**32|0)|0,l:0|o}}const add3L=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),add3H=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,add4L=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),add4H=(t,e,r,n,o)=>e+r+n+o+(t/2**32|0)|0,add5L=(t,e,r,n,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(o>>>0),add5H=(t,e,r,n,o,i)=>e+r+n+o+i+(t/2**32|0)|0,u64$2={fromBig:fromBig,split:split,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:add5H,add5L:add5L},[SHA512_Kh,SHA512_Kl]=u64$2.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:a,Eh:u,El:c,Fh:l,Fl:d,Gh:h,Gl:f,Hh:p,Hl:y}=this;return[t,e,r,n,o,i,s,a,u,c,l,d,h,f,p,y]}set(t,e,r,n,o,i,s,a,u,c,l,d,h,f,p,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|l,this.Fl=0|d,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)SHA512_W_H[r]=t.getUint32(e),SHA512_W_L[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|SHA512_W_H[t-15],r=0|SHA512_W_L[t-15],n=u64$2.rotrSH(e,r,1)^u64$2.rotrSH(e,r,8)^u64$2.shrSH(e,r,7),o=u64$2.rotrSL(e,r,1)^u64$2.rotrSL(e,r,8)^u64$2.shrSL(e,r,7),i=0|SHA512_W_H[t-2],s=0|SHA512_W_L[t-2],a=u64$2.rotrSH(i,s,19)^u64$2.rotrBH(i,s,61)^u64$2.shrSH(i,s,6),u=u64$2.rotrSL(i,s,19)^u64$2.rotrBL(i,s,61)^u64$2.shrSL(i,s,6),c=u64$2.add4L(o,u,SHA512_W_L[t-7],SHA512_W_L[t-16]),l=u64$2.add4H(c,n,a,SHA512_W_H[t-7],SHA512_W_H[t-16]);SHA512_W_H[t]=0|l,SHA512_W_L[t]=0|c}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:u,Dl:c,Eh:l,El:d,Fh:h,Fl:f,Gh:p,Gl:y,Hh:m,Hl:g}=this;for(let t=0;t<80;t++){const e=u64$2.rotrSH(l,d,14)^u64$2.rotrSH(l,d,18)^u64$2.rotrBH(l,d,41),b=u64$2.rotrSL(l,d,14)^u64$2.rotrSL(l,d,18)^u64$2.rotrBL(l,d,41),_=l&h^~l&p,w=d&f^~d&y,S=u64$2.add5L(g,b,w,SHA512_Kl[t],SHA512_W_L[t]),v=u64$2.add5H(S,m,e,_,SHA512_Kh[t],SHA512_W_H[t]),E=0|S,A=u64$2.rotrSH(r,n,28)^u64$2.rotrBH(r,n,34)^u64$2.rotrBH(r,n,39),T=u64$2.rotrSL(r,n,28)^u64$2.rotrBL(r,n,34)^u64$2.rotrBL(r,n,39),R=r&o^r&s^o&s,I=n&i^n&a^i&a;m=0|p,g=0|y,p=0|h,y=0|f,h=0|l,f=0|d,({h:l,l:d}=u64$2.add(0|u,0|c,0|v,0|E)),u=0|s,c=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const k=u64$2.add3L(E,T,I);r=u64$2.add3H(k,v,A,R),n=0|k}({h:r,l:n}=u64$2.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=u64$2.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=u64$2.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=u64$2.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:l,l:d}=u64$2.add(0|this.Eh,0|this.El,0|l,0|d)),({h:h,l:f}=u64$2.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:y}=u64$2.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:m,l:g}=u64$2.add(0|this.Hh,0|this.Hl,0|m,0|g)),this.set(r,n,o,i,s,a,u,c,l,d,h,f,p,y,m,g)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class SHA512_256 extends SHA512{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class SHA384 extends SHA512{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}const sha512=wrapConstructor((()=>new SHA512));wrapConstructor((()=>new SHA512_256)),wrapConstructor((()=>new SHA384));var _nodeResolve_empty={},nodeCrypto=Object.freeze({__proto__:null,default:_nodeResolve_empty});
/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
const _0n$1=BigInt(0),_1n$1=BigInt(1),_2n$1=BigInt(2),_255n=BigInt(255),CURVE_ORDER=_2n$1**BigInt(252)+BigInt("27742317777372353535851937790883648493"),CURVE$1=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:_2n$1**_255n-BigInt(19),l:CURVE_ORDER,n:CURVE_ORDER,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),MAX_256B=_2n$1**BigInt(256),SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const SQRT_AD_MINUS_ONE=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),INVSQRT_A_MINUS_D=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ONE_MINUS_D_SQ=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),D_MINUS_ONE_SQ=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class ExtendedPoint{constructor(t,e,r,n){this.x=t,this.y=e,this.z=r,this.t=n}static fromAffine(t){if(!(t instanceof Point$1))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(Point$1.ZERO)?ExtendedPoint.ZERO:new ExtendedPoint(t.x,t.y,_1n$1,mod$1(t.x*t.y))}static toAffineBatch(t){const e=invertBatch$1(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return this.toAffineBatch(t).map(this.fromAffine)}equals(t){assertExtPoint(t);const{x:e,y:r,z:n}=this,{x:o,y:i,z:s}=t,a=mod$1(e*s),u=mod$1(o*n),c=mod$1(r*s),l=mod$1(i*n);return a===u&&c===l}negate(){return new ExtendedPoint(mod$1(-this.x),this.y,this.z,mod$1(-this.t))}double(){const{x:t,y:e,z:r}=this,{a:n}=CURVE$1,o=mod$1(t**_2n$1),i=mod$1(e**_2n$1),s=mod$1(_2n$1*mod$1(r**_2n$1)),a=mod$1(n*o),u=mod$1(mod$1((t+e)**_2n$1)-o-i),c=a+i,l=c-s,d=a-i,h=mod$1(u*l),f=mod$1(c*d),p=mod$1(u*d),y=mod$1(l*c);return new ExtendedPoint(h,f,y,p)}add(t){assertExtPoint(t);const{x:e,y:r,z:n,t:o}=this,{x:i,y:s,z:a,t:u}=t,c=mod$1((r-e)*(s+i)),l=mod$1((r+e)*(s-i)),d=mod$1(l-c);if(d===_0n$1)return this.double();const h=mod$1(n*_2n$1*u),f=mod$1(o*_2n$1*a),p=f+h,y=l+c,m=f-h,g=mod$1(p*d),b=mod$1(y*m),_=mod$1(p*m),w=mod$1(d*y);return new ExtendedPoint(g,b,w,_)}subtract(t){return this.add(t.negate())}precomputeWindow(t){const e=1+256/t,r=[];let n=this,o=n;for(let i=0;i<e;i++){o=n,r.push(o);for(let e=1;e<2**(t-1);e++)o=o.add(n),r.push(o);n=o.double()}return r}wNAF(t,e){!e&&this.equals(ExtendedPoint.BASE)&&(e=Point$1.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&pointPrecomputes$1.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=ExtendedPoint.normalizeZ(n),pointPrecomputes$1.set(e,n)));let o=ExtendedPoint.ZERO,i=ExtendedPoint.ZERO;const s=1+256/r,a=2**(r-1),u=BigInt(2**r-1),c=2**r,l=BigInt(r);for(let e=0;e<s;e++){const r=e*a;let s=Number(t&u);if(t>>=l,s>a&&(s-=c,t+=_1n$1),0===s){let t=n[r];e%2&&(t=t.negate()),i=i.add(t)}else{let t=n[r+Math.abs(s)-1];s<0&&(t=t.negate()),o=o.add(t)}}return ExtendedPoint.normalizeZ([o,i])[0]}multiply(t,e){return this.wNAF(normalizeScalar$1(t,CURVE$1.l),e)}multiplyUnsafe(t){let e=normalizeScalar$1(t,CURVE$1.l,!1);const r=ExtendedPoint.BASE,n=ExtendedPoint.ZERO;if(e===_0n$1)return n;if(this.equals(n)||e===_1n$1)return this;if(this.equals(r))return this.wNAF(e);let o=n,i=this;for(;e>_0n$1;)e&_1n$1&&(o=o.add(i)),i=i.double(),e>>=_1n$1;return o}isSmallOrder(){return this.multiplyUnsafe(CURVE$1.h).equals(ExtendedPoint.ZERO)}isTorsionFree(){return this.multiplyUnsafe(CURVE$1.l).equals(ExtendedPoint.ZERO)}toAffine(t=invert$1(this.z)){const{x:e,y:r,z:n}=this,o=mod$1(e*t),i=mod$1(r*t);if(mod$1(n*t)!==_1n$1)throw new Error("invZ was invalid");return new Point$1(o,i)}fromRistrettoBytes(){legacyRist()}toRistrettoBytes(){legacyRist()}fromRistrettoHash(){legacyRist()}}function assertExtPoint(t){if(!(t instanceof ExtendedPoint))throw new TypeError("ExtendedPoint expected")}function assertRstPoint(t){if(!(t instanceof RistrettoPoint))throw new TypeError("RistrettoPoint expected")}function legacyRist(){throw new Error("Legacy method: switch to RistrettoPoint")}ExtendedPoint.BASE=new ExtendedPoint(CURVE$1.Gx,CURVE$1.Gy,_1n$1,mod$1(CURVE$1.Gx*CURVE$1.Gy)),ExtendedPoint.ZERO=new ExtendedPoint(_0n$1,_1n$1,_1n$1,_0n$1);class RistrettoPoint{constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){const{d:e}=CURVE$1,r=mod$1(SQRT_M1*t*t),n=mod$1((r+_1n$1)*ONE_MINUS_D_SQ);let o=BigInt(-1);const i=mod$1((o-e*r)*mod$1(r+e));let{isValid:s,value:a}=uvRatio(n,i),u=mod$1(a*t);edIsNegative(u)||(u=mod$1(-u)),s||(a=u),s||(o=r);const c=mod$1(o*(r-_1n$1)*D_MINUS_ONE_SQ-i),l=a*a,d=mod$1((a+a)*i),h=mod$1(c*SQRT_AD_MINUS_ONE),f=mod$1(_1n$1-l),p=mod$1(_1n$1+l);return new ExtendedPoint(mod$1(d*p),mod$1(f*h),mod$1(h*p),mod$1(d*f))}static hashToCurve(t){const e=bytes255ToNumberLE((t=ensureBytes$1(t,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(e),n=bytes255ToNumberLE(t.slice(32,64)),o=this.calcElligatorRistrettoMap(n);return new RistrettoPoint(r.add(o))}static fromHex(t){t=ensureBytes$1(t,32);const{a:e,d:r}=CURVE$1,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",o=bytes255ToNumberLE(t);if(!equalBytes(numberTo32BytesLE(o),t)||edIsNegative(o))throw new Error(n);const i=mod$1(o*o),s=mod$1(_1n$1+e*i),a=mod$1(_1n$1-e*i),u=mod$1(s*s),c=mod$1(a*a),l=mod$1(e*r*u-c),{isValid:d,value:h}=invertSqrt(mod$1(l*c)),f=mod$1(h*a),p=mod$1(h*f*l);let y=mod$1((o+o)*f);edIsNegative(y)&&(y=mod$1(-y));const m=mod$1(s*p),g=mod$1(y*m);if(!d||edIsNegative(g)||m===_0n$1)throw new Error(n);return new RistrettoPoint(new ExtendedPoint(y,m,_1n$1,g))}toRawBytes(){let{x:t,y:e,z:r,t:n}=this.ep;const o=mod$1(mod$1(r+e)*mod$1(r-e)),i=mod$1(t*e),{value:s}=invertSqrt(mod$1(o*i**_2n$1)),a=mod$1(s*o),u=mod$1(s*i),c=mod$1(a*u*n);let l;if(edIsNegative(n*c)){let r=mod$1(e*SQRT_M1),n=mod$1(t*SQRT_M1);t=r,e=n,l=mod$1(a*INVSQRT_A_MINUS_D)}else l=u;edIsNegative(t*c)&&(e=mod$1(-e));let d=mod$1((r-e)*l);return edIsNegative(d)&&(d=mod$1(-d)),numberTo32BytesLE(d)}toHex(){return bytesToHex$1(this.toRawBytes())}toString(){return this.toHex()}equals(t){assertRstPoint(t);const e=this.ep,r=t.ep,n=mod$1(e.x*r.y)===mod$1(e.y*r.x),o=mod$1(e.y*r.y)===mod$1(e.x*r.x);return n||o}add(t){return assertRstPoint(t),new RistrettoPoint(this.ep.add(t.ep))}subtract(t){return assertRstPoint(t),new RistrettoPoint(this.ep.subtract(t.ep))}multiply(t){return new RistrettoPoint(this.ep.multiply(t))}multiplyUnsafe(t){return new RistrettoPoint(this.ep.multiplyUnsafe(t))}}RistrettoPoint.BASE=new RistrettoPoint(ExtendedPoint.BASE),RistrettoPoint.ZERO=new RistrettoPoint(ExtendedPoint.ZERO);const pointPrecomputes$1=new WeakMap;class Point$1{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,pointPrecomputes$1.delete(this)}static fromHex(t,e=!0){const{d:r,P:n}=CURVE$1,o=(t=ensureBytes$1(t,32)).slice();o[31]=-129&t[31];const i=bytesToNumberLE(o);if(e&&i>=n)throw new Error("Expected 0 < hex < P");if(!e&&i>=MAX_256B)throw new Error("Expected 0 < hex < 2**256");const s=mod$1(i*i),a=mod$1(s-_1n$1),u=mod$1(r*s+_1n$1);let{isValid:c,value:l}=uvRatio(a,u);if(!c)throw new Error("Point.fromHex: invalid y coordinate");const d=(l&_1n$1)===_1n$1;return 0!=(128&t[31])!==d&&(l=mod$1(-l)),new Point$1(l,i)}static async fromPrivateKey(t){return(await getExtendedPublicKey(t)).point}toRawBytes(){const t=numberTo32BytesLE(this.y);return t[31]|=this.x&_1n$1?128:0,t}toHex(){return bytesToHex$1(this.toRawBytes())}toX25519(){const{y:t}=this;return numberTo32BytesLE(mod$1((_1n$1+t)*invert$1(_1n$1-t)))}isTorsionFree(){return ExtendedPoint.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new Point$1(mod$1(-this.x),this.y)}add(t){return ExtendedPoint.fromAffine(this).add(ExtendedPoint.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return ExtendedPoint.fromAffine(this).multiply(t,this).toAffine()}}Point$1.BASE=new Point$1(CURVE$1.Gx,CURVE$1.Gy),Point$1.ZERO=new Point$1(_0n$1,_1n$1);class Signature$1{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=ensureBytes$1(t,64),r=Point$1.fromHex(e.slice(0,32),!1),n=bytesToNumberLE(e.slice(32,64));return new Signature$1(r,n)}assertValidity(){const{r:t,s:e}=this;if(!(t instanceof Point$1))throw new Error("Expected Point instance");return normalizeScalar$1(e,CURVE$1.l,!1),this}toRawBytes(){const t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(numberTo32BytesLE(this.s),32),t}toHex(){return bytesToHex$1(this.toRawBytes())}}function concatBytes$1(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const o=t[e];r.set(o,n),n+=o.length}return r}const hexes$1=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function bytesToHex$1(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=hexes$1[t[r]];return e}function hexToBytes$1(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,o=t.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[r]=i}return e}function numberTo32BytesBE(t){return hexToBytes$1(t.toString(16).padStart(64,"0"))}function numberTo32BytesLE(t){return numberTo32BytesBE(t).reverse()}function edIsNegative(t){return(mod$1(t)&_1n$1)===_1n$1}function bytesToNumberLE(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+bytesToHex$1(Uint8Array.from(t).reverse()))}function bytes255ToNumberLE(t){return mod$1(bytesToNumberLE(t)&_2n$1**_255n-_1n$1)}function mod$1(t,e=CURVE$1.P){const r=t%e;return r>=_0n$1?r:e+r}function invert$1(t,e=CURVE$1.P){if(t===_0n$1||e<=_0n$1)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=mod$1(t,e),n=e,o=_0n$1,i=_1n$1;for(;r!==_0n$1;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==_1n$1)throw new Error("invert: does not exist");return mod$1(o,e)}function invertBatch$1(t,e=CURVE$1.P){const r=new Array(t.length),n=t.reduce(((t,n,o)=>n===_0n$1?t:(r[o]=t,mod$1(t*n,e))),_1n$1),o=invert$1(n,e);return t.reduceRight(((t,n,o)=>n===_0n$1?t:(r[o]=mod$1(t*r[o],e),mod$1(t*n,e))),o),r}function pow2$1(t,e){const{P:r}=CURVE$1;let n=t;for(;e-- >_0n$1;)n*=n,n%=r;return n}function pow_2_252_3(t){const{P:e}=CURVE$1,r=BigInt(5),n=BigInt(10),o=BigInt(20),i=BigInt(40),s=BigInt(80),a=t*t%e*t%e,u=pow2$1(a,_2n$1)*a%e,c=pow2$1(u,_1n$1)*t%e,l=pow2$1(c,r)*c%e,d=pow2$1(l,n)*l%e,h=pow2$1(d,o)*d%e,f=pow2$1(h,i)*h%e,p=pow2$1(f,s)*f%e,y=pow2$1(p,s)*f%e,m=pow2$1(y,n)*l%e;return{pow_p_5_8:pow2$1(m,_2n$1)*t%e,b2:a}}function uvRatio(t,e){const r=mod$1(e*e*e),n=mod$1(r*r*e);let o=mod$1(t*r*pow_