1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,210102,(t,e,r)=>{"use strict";r.byteLength=function(t){var e=l(t),r=e[0],i=e[1];return(r+i)*3/4-i},r.toByteArray=function(t){var e,r,i=l(t),o=i[0],a=i[1],u=new s((o+a)*3/4-a),c=0,h=a>0?o-4:o;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],u[c++]=e>>16&255,u[c++]=e>>8&255,u[c++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[c++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e),u},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s=[],o=0,a=r-n;o<a;o+=16383)s.push(function(t,e,r){for(var n,s=[],o=e;o<r;o+=3)n=(t[o]<<16&0xff0000)+(t[o+1]<<8&65280)+(255&t[o+2]),s.push(i[n>>18&63]+i[n>>12&63]+i[n>>6&63]+i[63&n]);return s.join("")}(t,o,o+16383>a?a:o+16383));return 1===n?s.push(i[(e=t[r-1])>>2]+i[e<<4&63]+"=="):2===n&&s.push(i[(e=(t[r-2]<<8)+t[r-1])>>10]+i[e>>4&63]+i[e<<2&63]+"="),s.join("")};for(var i=[],n=[],s="u">typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a<u;++a)i[a]=o[a],n[o.charCodeAt(a)]=a;function l(t){var e=t.length;if(e%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");-1===r&&(r=e);var i=r===e?0:4-r%4;return[r,i]}n[45]=62,n[95]=63},962866,(t,e,r)=>{r.read=function(t,e,r,i,n){var s,o,a=8*n-i-1,u=(1<<a)-1,l=u>>1,c=-7,h=r?n-1:0,f=r?-1:1,d=t[e+h];for(h+=f,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=256*s+t[e+h],h+=f,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),s-=l}return(d?-1:1)*o*Math.pow(2,s-i)},r.write=function(t,e,r,i,n,s){var o,a,u,l=8*s-n-1,c=(1<<l)-1,h=c>>1,f=5960464477539062e-23*(23===n),d=i?0:s-1,p=i?1:-1,g=+(e<0||0===e&&1/e<0);for(isNaN(e=Math.abs(e))||e===1/0?(a=+!!isNaN(e),o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+h>=1?e+=f/u:e+=f*Math.pow(2,1-h),e*u>=2&&(o++,u/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(e*u-1)*Math.pow(2,n),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&a,d+=p,a/=256,n-=8);for(o=o<<n|a,l+=n;l>0;t[r+d]=255&o,d+=p,o/=256,l-=8);t[r+d-p]|=128*g}},259390,(t,e,r)=>{"use strict";let i=t.r(210102),n=t.r(962866),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t){var i=t,n=e;if(("string"!=typeof n||""===n)&&(n="utf8"),!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);let r=0|p(i,n),s=o(r),u=s.write(i,n);return u!==r&&(s=s.slice(0,u)),s}if(ArrayBuffer.isView(t)){var s=t;if(z(s,Uint8Array)){let t=new Uint8Array(s);return f(t.buffer,t.byteOffset,t.byteLength)}return h(s)}if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(z(t,ArrayBuffer)||t&&z(t.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(z(t,SharedArrayBuffer)||t&&z(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');let u=t.valueOf&&t.valueOf();if(null!=u&&u!==t)return a.from(u,e,r);let l=function(t){if(a.isBuffer(t)){let e=0|d(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||function(t){return t!=t}(t.length)?o(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(l)return l;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');
vendor: 67,993 bytes, line 1
1if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),o(t<0?0:0|d(t))}function h(t){let e=t.length<0?0:0|d(t.length),r=o(e);for(let i=0;i<e;i+=1)r[i]=255&t[i];return r}function f(t,e,r){let i;if(e<0||t.byteLength<e)throw RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),a.prototype),i}function d(t){if(t>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function p(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return C(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(n)return i?-1:C(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=e;i<r;++i)n+=N[t[i]];return n}(this,e,r);case"utf8":case"utf-8":return w(this,e,r);case"ascii":return function(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}(this,e,r);case"latin1":case"binary":return function(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}(this,e,r);case"base64":var s,o,a;return s=this,o=e,a=r,0===o&&a===s.length?i.fromByteArray(s):i.fromByteArray(s.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){let i=t.slice(e,r),n="";for(let t=0;t<i.length-1;t+=2)n+=String.fromCharCode(i[t]+256*i[t+1]);return n}(this,e,r);default:if(n)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){var s;if(0===t.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(n)return -1;else r=t.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof e&&(e=a.from(e,i)),a.isBuffer(e))return 0===e.length?-1:b(t,e,r,i,n);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return b(t,[e],r,i,n)}throw TypeError("val must be string, number or Buffer")}function b(t,e,r,i,n){let s,o=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return -1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){let i=-1;for(s=r;s<a;s++)if(l(t,s)===l(e,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===u)return i*o}else -1!==i&&(s-=s-i),i=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){let r=!0;for(let i=0;i<u;i++)if(l(t,s+i)!==l(e,i)){r=!1;break}if(r)return s}return -1}function w(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let e=t[n],s=null,o=e>239?4:e>223?3:e>191?2:1;if(n+o<=r){let r,i,a,u;switch(o){case 1:e<128&&(s=e);break;case 2:(192&(r=t[n+1]))==128&&(u=(31&e)<<6|63&r)>127&&(s=u);break;case 3:r=t[n+1],i=t[n+2],(192&r)==128&&(192&i)==128&&(u=(15&e)<<12|(63&r)<<6|63&i)>2047&&(u<55296||u>57343)&&(s=u);break;case 4:r=t[n+1],i=t[n+2],a=t[n+3],(192&r)==128&&(192&i)==128&&(192&a)==128&&(u=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&a)>65535&&u<1114112&&(s=u)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}var s=i;let o=s.length;if(o<=4096)return String.fromCharCode.apply(String,s);let a="",u=0;for(;u<o;)a+=String.fromCharCode.apply(String,s.slice(u,u+=4096));return a}function v(t,e,r){if(t%1!=0||t<0)throw RangeError("offset is not uint");if(t+e>r)throw RangeError("Trying to access beyond buffer length")}function k(t,e,r,i,n,s){if(!a.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw RangeError('"value" argument is out of bounds');if(r+i>t.length)throw RangeError("Index out of range")}function S(t,e,r,i,n){T(e,i,n,t,r,7);let s=Number(e&BigInt(0xffffffff));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,r}function x(t,e,r,i,n){T(e,i,n,t,r,7);let s=Number(e&BigInt(0xffffffff));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r+3]=o,o>>=8,t[r+2]=o,o>>=8,t[r+1]=o,o>>=8,t[r]=o,r+8}function _(t,e,r,i,n,s){if(r+i>t.length||r<0)throw RangeError("Index out of range")}function B(t,e,r,i,s){return e*=1,r>>>=0,s||_(t,e,r,4,34028234663852886e22,-34028234663852886e22),n.write(t,e,r,i,23,4),r+4}function I(t,e,r,i,s){return e*=1,r>>>=0,s||_(t,e,r,8,17976931348623157e292,-17976931348623157e292),n.write(t,e,r,i,52,8),r+8}r.Buffer=a,r.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},r.INSPECT_MAX_BYTES=50,r.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{let 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}}(),!a.TYPED_ARRAY_SUPPORT&&"u">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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return(l(t),t<=0)?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(z(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,i=e.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:+(i<r)},a.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}},a.concat=function(t,e){let r;if(!Array.isArray(t))throw TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);if(void 0===e)for(r=0,e=0;r<t.length;++r)e+=t[r].length;let i=a.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){let e=t[r];if(z(e,Uint8Array))n+e.length>i.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else if(a.isBuffer(e))e.copy(i,n);else throw TypeError('"list" argument must be an Array of Buffers');n+=e.length}return i},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){let t=this.length;return 0===t?"":0==arguments.length?w(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(t,e,r,i,n){if(z(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw 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===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,n>>>=0,this===t)return 0;let s=n-i,o=r-e,u=Math.min(s,o),l=this.slice(i,n),c=t.slice(e,r);for(let t=0;t<u;++t)if(l[t]!==c[t]){s=l[t],o=c[t];break}return s<o?-1:+(o<s)},a.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,i){var n,s,o,a,u,l,c,h;if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let f=this.length-e;if((void 0===r||r>f)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let d=!1;for(;;)switch(i){case"hex":return function(t,e,r,i){let n;r=Number(r)||0;let s=t.length-r;i?(i=Number(i))>s&&(i=s):i=s;let o=e.length;for(i>o/2&&(i=o/2),n=0;n<i;++n){var a;let i=parseInt(e.substr(2*n,2),16);if((a=i)!=a)break;t[r+n]=i}return n}(this,t,e,r);case"utf8":case"utf-8":return n=e,s=r,O(C(t,this.length-n),this,n,s);case"ascii":case"latin1":case"binary":return o=e,a=r,O(function(t){let e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(t),this,o,a);case"base64":return u=e,l=r,O(U(t),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=e,h=r,O(function(t,e){let r,i,n=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n.push(r%256),n.push(i);return n}(t,this.length-c),this,c,h);default:if(d)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(t,e){let r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return i},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||v(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=W(function(t){P(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&R(t,this.length-8);let i=e+256*this[++t]+65536*this[++t]+0x1000000*this[++t],n=this[++t]+256*this[++t]+65536*this[++t]+0x1000000*r;return BigInt(i)+(BigInt(n)<<BigInt(32))}),a.prototype.readBigUInt64BE=W(function(t){P(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&R(t,this.length-8);let i=0x1000000*e+65536*this[++t]+256*this[++t]+this[++t],n=0x1000000*this[++t]+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)}),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=e,n=1,s=this[t+--i];for(;i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},a.prototype.readInt8=function(t,e){return(t>>>=0,e||v(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||v(t,2,this.length);let r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||v(t,2,this.length);let r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=W(function(t){P(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&R(t,this.length-8),(BigInt(this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24))<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+0x1000000*this[++t])}),a.prototype.readBigInt64BE=W(function(t){P(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&R(t,this.length-8),(BigInt((e<<24)+65536*this[++t]+256*this[++t]+this[++t])<<BigInt(32))+BigInt(0x1000000*this[++t]+65536*this[++t]+256*this[++t]+r)}),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}let n=1,s=0;for(this[e]=255&t;++s<r&&(n*=256);)this[e+s]=t/n&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}let n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=W(function(t,e=0){return S(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=W(function(t,e=0){return x(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(t,e,r,i){if(t*=1,e>>>=0,!i){let i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}let n=0,s=1,o=0;for(this[e]=255&t;++n<r&&(s*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/s|0)-o&255;return e+r},a.prototype.writeIntBE=function(t,e,r,i){if(t*=1,e>>>=0,!i){let i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[e+n]=255&t;--n>=0&&(s*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/s|0)-o&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=W(function(t,e=0){return S(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=W(function(t,e=0){return x(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,i){if(!a.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||0===t.length||0===this.length)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);let n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},a.prototype.fill=function(t,e,r,i){let n;if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===t.length){let e=t.charCodeAt(0);("utf8"===i&&e<128||"latin1"===i)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw RangeError("Out of range index");if(r<=e)return this;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{let s=a.isBuffer(t)?t:a.from(t,i),o=s.length;if(0===o)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=s[n%o]}return this};let A={};function E(t,e,r){A[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 M(t){let e="",r=t.length,i=+("-"===t[0]);for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function T(t,e,r,i,n,s){if(t>r||t<e){let i,n="bigint"==typeof e?"n":"";throw i=s>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${(s+1)*8}${n}`:`>= -(2${n} ** ${(s+1)*8-1}${n}) and < 2 ** ${(s+1)*8-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new A.ERR_OUT_OF_RANGE("value",i,t)}P(n,"offset"),(void 0===i[n]||void 0===i[n+s])&&R(n,i.length-(s+1))}function P(t,e){if("number"!=typeof t)throw new A.ERR_INVALID_ARG_TYPE(e,"number",t)}function R(t,e,r){if(Math.floor(t)!==t)throw P(t,r),new A.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new A.ERR_BUFFER_OUT_OF_BOUNDS;throw new A.ERR_OUT_OF_RANGE(r||"offset",`>= ${+!!r} and <= ${e}`,t)}E("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),E("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),E("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>0x100000000?n=M(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=M(n)),n+="n"),i+=` It must be ${e}. Received ${n}`},RangeError);let L=/[^+/0-9A-Za-z-_]/g;function C(t,e){let r;e=e||1/0;let i=t.length,n=null,s=[];for(let o=0;o<i;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319||o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function U(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function O(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length)&&!(n>=t.length);++n)e[n+r]=t[n];return n}function z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}let N=function(){let t="0123456789abcdef",e=Array(256);for(let r=0;r<16;++r){let i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function W(t){return"u"<typeof BigInt?q:t}function q(){throw Error("BigInt not supported")}},424509,(t,e,r)=>{!function(t,e){"use strict";function r(t,e){if(!t)throw Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(("le"===e||"be"===e)&&(r=e,e=10),this._init(t||0,e||10,r||"be"))}t.exports=n,n.BN=n,n.wordSize=26;try{c="u">typeof window&&void 0!==window.Buffer?window.Buffer:void 0}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function o(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function a(t,e,i,n){for(var s=0,o=0,a=Math.min(t.length,i),u=e;u<a;u++){var l=t.charCodeAt(u)-48;s*=n,o=l>=49?l-49+10:l>=17?l-17+10:l,r(l>=0&&o<n,"Invalid character"),s+=o}return s}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return 0>t.cmp(e)?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<0x4000000?(this.words=[0x3ffffff&t],this.length=1):t<0x10000000000000?(this.words=[0x3ffffff&t,t/0x4000000&0x3ffffff],this.length=2):(r(t<0x20000000000000),this.words=[0x3ffffff&t,t/0x4000000&0x3ffffff,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var n,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===i)for(o=t.length-1,n=0;o>=0;o-=3)s=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);else if("le"===i)for(o=0,n=0;o<t.length;o+=3)s=t[o]|t[o+1]<<8|t[o+2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var i,n=0;n<this.length;n++)this.words[n]=0;var s=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=o(t,e,n)<<s,this.words[a]|=0x3ffffff&i,s>=18?(s-=18,a+=1,this.words[a]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=o(t,e,n)<<s,this.words[a]|=0x3ffffff&i,s>=18?(s-=18,a+=1,this.words[a]|=i>>>26):s+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=0x3ffffff;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,u=Math.min(s,s-o)+r,l=0,c=r;c<u;c+=i)l=a(t,c,c+i,e),this.imuln(n),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l);if(0!==o){var h=1;for(l=a(t,c,t.length,e),c=0;c<o;c++)h*=e;this.imuln(h),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l)}this._strip()},n.prototype.copy=function(t){t.words=Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"u">typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c,h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,0x2000000,0x290d741,0x1000000,0x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];function p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=0x3ffffff&o,u=o/0x4000000|0;r.words[0]=a;for(var l=1;l<i;l++){for(var c=u>>>26,h=0x3ffffff&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;c+=(o=(n=0|t.words[p])*(s=0|e.words[d])+h)/0x4000000|0,h=0x3ffffff&o}r.words[l]=0|h,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}n.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){for(var i="",n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=((a<<n|s)&0xffffff).toString(16);s=a>>>24-n&0xffffff,(n+=2)>=26&&(n-=26,o--),i=0!==s||o!==this.length-1?h[6-u.length]+u+i:u+i}for(0!==s&&(i=s.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],c=d[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modrn(c).toString(t);i=(p=p.idivn(c)).isZero()?g+i:h[l-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=0x4000000*this.words[1]:3===this.length&&1===this.words[2]?t+=0x10000000000000+0x4000000*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},c&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(c,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),s=i||Math.max(1,n);r(n<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0");var o=t.allocUnsafe?t.allocUnsafe(s):new t(s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r++]=255&o,r<t.length&&(t[r++]=o>>8&255),r<t.length&&(t[r++]=o>>16&255),6===s?(r<t.length&&(t[r++]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r--]=255&o,r>=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return(8191&e)==0&&(r+=13,e>>>=13),(127&e)==0&&(r+=7,e>>>=7),(15&e)==0&&(r+=4,e>>>=4),(3&e)==0&&(r+=2,e>>>=2),(1&e)==0&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return(this.length-1)*26+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r((this.negative|t.negative)==0),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r((this.negative|t.negative)==0),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){this.length>t.length?(e=this,r=t):(e=t,r=this);for(var e,r,i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r((this.negative|t.negative)==0),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=0x3ffffff&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&0x3ffffff>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),e?this.words[i]=this.words[i]|1<<n:this.words[i]=this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e,r,i,n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=0x3ffffff&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=0x3ffffff&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e,r,i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(e=this,r=t):(e=t,r=this);for(var s=0,o=0;o<r.length;o++)s=(i=(0|e.words[o])-(0|r.words[o])+s)>>26,this.words[o]=0x3ffffff&i;for(;0!==s&&o<e.length;o++)s=(i=(0|e.words[o])+s)>>26,this.words[o]=0x3ffffff&i;if(0===s&&o<e.length&&e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this.length=Math.max(this.length,o),e!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var i,n,s,o=t.words,a=e.words,u=r.words,l=0,c=0|o[0],h=8191&c,f=c>>>13,d=0|o[1],p=8191&d,g=d>>>13,m=0|o[2],y=8191&m,b=m>>>13,w=0|o[3],v=8191&w,k=w>>>13,S=0|o[4],x=8191&S,_=S>>>13,B=0|o[5],I=8191&B,A=B>>>13,E=0|o[6],M=8191&E,T=E>>>13,P=0|o[7],R=8191&P,L=P>>>13,C=0|o[8],U=8191&C,O=C>>>13,z=0|o[9],N=8191&z,W=z>>>13,q=0|a[0],K=8191&q,$=q>>>13,j=0|a[1],F=8191&j,D=j>>>13,H=0|a[2],V=8191&H,G=H>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,te=0|a[5],tr=8191&te,ti=te>>>13,tn=0|a[6],ts=8191&tn,to=tn>>>13,ta=0|a[7],tu=8191&ta,tl=ta>>>13,tc=0|a[8],th=8191&tc,tf=tc>>>13,td=0|a[9],tp=8191&td,tg=td>>>13;r.negative=t.negative^e.negative,r.length=19,i=Math.imul(h,K);var tm=(l+i|0)+((8191&(n=(n=Math.imul(h,$))+Math.imul(f,K)|0))<<13)|0;l=((s=Math.imul(f,$))+(n>>>13)|0)+(tm>>>26)|0,tm&=0x3ffffff,i=Math.imul(p,K),n=(n=Math.imul(p,$))+Math.imul(g,K)|0,s=Math.imul(g,$),i=i+Math.imul(h,F)|0;var ty=(l+i|0)+((8191&(n=(n=n+Math.imul(h,D)|0)+Math.imul(f,F)|0))<<13)|0;l=((s=s+Math.imul(f,D)|0)+(n>>>13)|0)+(ty>>>26)|0,ty&=0x3ffffff,i=Math.imul(y,K),n=(n=Math.imul(y,$))+Math.imul(b,K)|0,s=Math.imul(b,$),i=i+Math.imul(p,F)|0,n=(n=n+Math.imul(p,D)|0)+Math.imul(g,F)|0,s=s+Math.imul(g,D)|0,i=i+Math.imul(h,V)|0;var tb=(l+i|0)+((8191&(n=(n=n+Math.imul(h,G)|0)+Math.imul(f,V)|0))<<13)|0;l=((s=s+Math.imul(f,G)|0)+(n>>>13)|0)+(tb>>>26)|0,tb&=0x3ffffff,i=Math.imul(v,K),n=(n=Math.imul(v,$))+Math.imul(k,K)|0,s=Math.imul(k,$),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,D)|0)+Math.imul(b,F)|0,s=s+Math.imul(b,D)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,V)|0,s=s+Math.imul(g,G)|0,i=i+Math.imul(h,J)|0;var tw=(l+i|0)+((8191&(n=(n=n+Math.imul(h,Y)|0)+Math.imul(f,J)|0))<<13)|0;l=((s=s+Math.imul(f,Y)|0)+(n>>>13)|0)+(tw>>>26)|0,tw&=0x3ffffff,i=Math.imul(x,K),n=(n=Math.imul(x,$))+Math.imul(_,K)|0,s=Math.imul(_,$),i=i+Math.imul(v,F)|0,n=(n=n+Math.imul(v,D)|0)+Math.imul(k,F)|0,s=s+Math.imul(k,D)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,Y)|0,i=i+Math.imul(h,Q)|0;var tv=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((s=s+Math.imul(f,tt)|0)+(n>>>13)|0)+(tv>>>26)|0,tv&=0x3ffffff,i=Math.imul(I,K),n=(n=Math.imul(I,$))+Math.imul(A,K)|0,s=Math.imul(A,$),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,D)|0)+Math.imul(_,F)|0,s=s+Math.imul(_,D)|0,i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,G)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(g,Q)|0,s=s+Math.imul(g,tt)|0,i=i+Math.imul(h,tr)|0;var tk=(l+i|0)+((8191&(n=(n=n+Math.imul(h,ti)|0)+Math.imul(f,tr)|0))<<13)|0;l=((s=s+Math.imul(f,ti)|0)+(n>>>13)|0)+(tk>>>26)|0,tk&=0x3ffffff,i=Math.imul(M,K),n=(n=Math.imul(M,$))+Math.imul(T,K)|0,s=Math.imul(T,$),i=i+Math.imul(I,F)|0,n=(n=n+Math.imul(I,D)|0)+Math.imul(A,F)|0,s=s+Math.imul(A,D)|0,i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,G)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,G)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(k,J)|0,s=s+Math.imul(k,Y)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,i=i+Math.imul(p,tr)|0,n=(n=n+Math.imul(p,ti)|0)+Math.imul(g,tr)|0,s=s+Math.imul(g,ti)|0,i=i+Math.imul(h,ts)|0;var tS=(l+i|0)+((8191&(n=(n=n+Math.imul(h,to)|0)+Math.imul(f,ts)|0))<<13)|0;l=((s=s+Math.imul(f,to)|0)+(n>>>13)|0)+(tS>>>26)|0,tS&=0x3ffffff,i=Math.imul(R,K),n=(n=Math.imul(R,$))+Math.imul(L,K)|0,s=Math.imul(L,$),i=i+Math.imul(M,F)|0,n=(n=n+Math.imul(M,D)|0)+Math.imul(T,F)|0,s=s+Math.imul(T,D)|0,i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,G)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,G)|0,i=i+Math.imul(x,J)|0,n=(n=n+Math.imul(x,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,tt)|0,i=i+Math.imul(y,tr)|0,n=(n=n+Math.imul(y,ti)|0)+Math.imul(b,tr)|0,s=s+Math.imul(b,ti)|0,i=i+Math.imul(p,ts)|0,n=(n=n+Math.imul(p,to)|0)+Math.imul(g,ts)|0,s=s+Math.imul(g,to)|0,i=i+Math.imul(h,tu)|0;var tx=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tl)|0)+Math.imul(f,tu)|0))<<13)|0;l=((s=s+Math.imul(f,tl)|0)+(n>>>13)|0)+(tx>>>26)|0,tx&=0x3ffffff,i=Math.imul(U,K),n=(n=Math.imul(U,$))+Math.imul(O,K)|0,s=Math.imul(O,$),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,D)|0)+Math.imul(L,F)|0,s=s+Math.imul(L,D)|0,i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,G)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,G)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(A,J)|0,s=s+Math.imul(A,Y)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(v,tr)|0,n=(n=n+Math.imul(v,ti)|0)+Math.imul(k,tr)|0,s=s+Math.imul(k,ti)|0,i=i+Math.imul(y,ts)|0,n=(n=n+Math.imul(y,to)|0)+Math.imul(b,ts)|0,s=s+Math.imul(b,to)|0,i=i+Math.imul(p,tu)|0,n=(n=n+Math.imul(p,tl)|0)+Math.imul(g,tu)|0,s=s+Math.imul(g,tl)|0,i=i+Math.imul(h,th)|0;var t_=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tf)|0)+Math.imul(f,th)|0))<<13)|0;l=((s=s+Math.imul(f,tf)|0)+(n>>>13)|0)+(t_>>>26)|0,t_&=0x3ffffff,i=Math.imul(N,K),n=(n=Math.imul(N,$))+Math.imul(W,K)|0,s=Math.imul(W,$),i=i+Math.imul(U,F)|0,n=(n=n+Math.imul(U,D)|0)+Math.imul(O,F)|0,s=s+Math.imul(O,D)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(L,V)|0,s=s+Math.imul(L,G)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(x,tr)|0,n=(n=n+Math.imul(x,ti)|0)+Math.imul(_,tr)|0,s=s+Math.imul(_,ti)|0,i=i+Math.imul(v,ts)|0,n=(n=n+Math.imul(v,to)|0)+Math.imul(k,ts)|0,s=s+Math.imul(k,to)|0,i=i+Math.imul(y,tu)|0,n=(n=n+Math.imul(y,tl)|0)+Math.imul(b,tu)|0,s=s+Math.imul(b,tl)|0,i=i+Math.imul(p,th)|0,n=(n=n+Math.imul(p,tf)|0)+Math.imul(g,th)|0,s=s+Math.imul(g,tf)|0,i=i+Math.imul(h,tp)|0;var tB=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tg)|0)+Math.imul(f,tp)|0))<<13)|0;l=((s=s+Math.imul(f,tg)|0)+(n>>>13)|0)+(tB>>>26)|0,tB&=0x3ffffff,i=Math.imul(N,F),n=(n=Math.imul(N,D))+Math.imul(W,F)|0,s=Math.imul(W,D),i=i+Math.imul(U,V)|0,n=(n=n+Math.imul(U,G)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,G)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(L,J)|0,s=s+Math.imul(L,Y)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(I,tr)|0,n=(n=n+Math.imul(I,ti)|0)+Math.imul(A,tr)|0,s=s+Math.imul(A,ti)|0,i=i+Math.imul(x,ts)|0,n=(n=n+Math.imul(x,to)|0)+Math.imul(_,ts)|0,s=s+Math.imul(_,to)|0,i=i+Math.imul(v,tu)|0,n=(n=n+Math.imul(v,tl)|0)+Math.imul(k,tu)|0,s=s+Math.imul(k,tl)|0,i=i+Math.imul(y,th)|0,n=(n=n+Math.imul(y,tf)|0)+Math.imul(b,th)|0,s=s+Math.imul(b,tf)|0,i=i+Math.imul(p,tp)|0;var tI=(l+i|0)+((8191&(n=(n=n+Math.imul(p,tg)|0)+Math.imul(g,tp)|0))<<13)|0;l=((s=s+Math.imul(g,tg)|0)+(n>>>13)|0)+(tI>>>26)|0,tI&=0x3ffffff,i=Math.imul(N,V),n=(n=Math.imul(N,G))+Math.imul(W,V)|0,s=Math.imul(W,G),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,Y)|0)+Math.imul(O,J)|0,s=s+Math.imul(O,Y)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(L,Q)|0,s=s+Math.imul(L,tt)|0,i=i+Math.imul(M,tr)|0,n=(n=n+Math.imul(M,ti)|0)+Math.imul(T,tr)|0,s=s+Math.imul(T,ti)|0,i=i+Math.imul(I,ts)|0,n=(n=n+Math.imul(I,to)|0)+Math.imul(A,ts)|0,s=s+Math.imul(A,to)|0,i=i+Math.imul(x,tu)|0,n=(n=n+Math.imul(x,tl)|0)+Math.imul(_,tu)|0,s=s+Math.imul(_,tl)|0,i=i+Math.imul(v,th)|0,n=(n=n+Math.imul(v,tf)|0)+Math.imul(k,th)|0,s=s+Math.imul(k,tf)|0,i=i+Math.imul(y,tp)|0;var tA=(l+i|0)+((8191&(n=(n=n+Math.imul(y,tg)|0)+Math.imul(b,tp)|0))<<13)|0;l=((s=s+Math.imul(b,tg)|0)+(n>>>13)|0)+(tA>>>26)|0,tA&=0x3ffffff,i=Math.imul(N,J),n=(n=Math.imul(N,Y))+Math.imul(W,J)|0,s=Math.imul(W,Y),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(R,tr)|0,n=(n=n+Math.imul(R,ti)|0)+Math.imul(L,tr)|0,s=s+Math.imul(L,ti)|0,i=i+Math.imul(M,ts)|0,n=(n=n+Math.imul(M,to)|0)+Math.imul(T,ts)|0,s=s+Math.imul(T,to)|0,i=i+Math.imul(I,tu)|0,n=(n=n+Math.imul(I,tl)|0)+Math.imul(A,tu)|0,s=s+Math.imul(A,tl)|0,i=i+Math.imul(x,th)|0,n=(n=n+Math.imul(x,tf)|0)+Math.imul(_,th)|0,s=s+Math.imul(_,tf)|0,i=i+Math.imul(v,tp)|0;var tE=(l+i|0)+((8191&(n=(n=n+Math.imul(v,tg)|0)+Math.imul(k,tp)|0))<<13)|0;l=((s=s+Math.imul(k,tg)|0)+(n>>>13)|0)+(tE>>>26)|0,tE&=0x3ffffff,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(W,Q)|0,s=Math.imul(W,tt),i=i+Math.imul(U,tr)|0,n=(n=n+Math.imul(U,ti)|0)+Math.imul(O,tr)|0,s=s+Math.imul(O,ti)|0,i=i+Math.imul(R,ts)|0,n=(n=n+Math.imul(R,to)|0)+Math.imul(L,ts)|0,s=s+Math.imul(L,to)|0,i=i+Math.imul(M,tu)|0,n=(n=n+Math.imul(M,tl)|0)+Math.imul(T,tu)|0,s=s+Math.imul(T,tl)|0,i=i+Math.imul(I,th)|0,n=(n=n+Math.imul(I,tf)|0)+Math.imul(A,th)|0,s=s+Math.imul(A,tf)|0,i=i+Math.imul(x,tp)|0;var tM=(l+i|0)+((8191&(n=(n=n+Math.imul(x,tg)|0)+Math.imul(_,tp)|0))<<13)|0;l=((s=s+Math.imul(_,tg)|0)+(n>>>13)|0)+(tM>>>26)|0,tM&=0x3ffffff,i=Math.imul(N,tr),n=(n=Math.imul(N,ti))+Math.imul(W,tr)|0,s=Math.imul(W,ti),i=i+Math.imul(U,ts)|0,n=(n=n+Math.imul(U,to)|0)+Math.imul(O,ts)|0,s=s+Math.imul(O,to)|0,i=i+Math.imul(R,tu)|0,n=(n=n+Math.imul(R,tl)|0)+Math.imul(L,tu)|0,s=s+Math.imul(L,tl)|0,i=i+Math.imul(M,th)|0,n=(n=n+Math.imul(M,tf)|0)+Math.imul(T,th)|0,s=s+Math.imul(T,tf)|0,i=i+Math.imul(I,tp)|0;var tT=(l+i|0)+((8191&(n=(n=n+Math.imul(I,tg)|0)+Math.imul(A,tp)|0))<<13)|0;l=((s=s+Math.imul(A,tg)|0)+(n>>>13)|0)+(tT>>>26)|0,tT&=0x3ffffff,i=Math.imul(N,ts),n=(n=Math.imul(N,to))+Math.imul(W,ts)|0,s=Math.imul(W,to),i=i+Math.imul(U,tu)|0,n=(n=n+Math.imul(U,tl)|0)+Math.imul(O,tu)|0,s=s+Math.imul(O,tl)|0,i=i+Math.imul(R,th)|0,n=(n=n+Math.imul(R,tf)|0)+Math.imul(L,th)|0,s=s+Math.imul(L,tf)|0,i=i+Math.imul(M,tp)|0;var tP=(l+i|0)+((8191&(n=(n=n+Math.imul(M,tg)|0)+Math.imul(T,tp)|0))<<13)|0;l=((s=s+Math.imul(T,tg)|0)+(n>>>13)|0)+(tP>>>26)|0,tP&=0x3ffffff,i=Math.imul(N,tu),n=(n=Math.imul(N,tl))+Math.imul(W,tu)|0,s=Math.imul(W,tl),i=i+Math.imul(U,th)|0,n=(n=n+Math.imul(U,tf)|0)+Math.imul(O,th)|0,s=s+Math.imul(O,tf)|0,i=i+Math.imul(R,tp)|0;var tR=(l+i|0)+((8191&(n=(n=n+Math.imul(R,tg)|0)+Math.imul(L,tp)|0))<<13)|0;l=((s=s+Math.imul(L,tg)|0)+(n>>>13)|0)+(tR>>>26)|0,tR&=0x3ffffff,i=Math.imul(N,th),n=(n=Math.imul(N,tf))+Math.imul(W,th)|0,s=Math.imul(W,tf),i=i+Math.imul(U,tp)|0;var tL=(l+i|0)+((8191&(n=(n=n+Math.imul(U,tg)|0)+Math.imul(O,tp)|0))<<13)|0;l=((s=s+Math.imul(O,tg)|0)+(n>>>13)|0)+(tL>>>26)|0,tL&=0x3ffffff,i=Math.imul(N,tp);var tC=(l+i|0)+((8191&(n=(n=Math.imul(N,tg))+Math.imul(W,tp)|0))<<13)|0;return l=((s=Math.imul(W,tg))+(n>>>13)|0)+(tC>>>26)|0,tC&=0x3ffffff,u[0]=tm,u[1]=ty,u[2]=tb,u[3]=tw,u[4]=tv,u[5]=tk,u[6]=tS,u[7]=tx,u[8]=t_,u[9]=tB,u[10]=tI,u[11]=tA,u[12]=tE,u[13]=tM,u[14]=tT,u[15]=tP,u[16]=tR,u[17]=tL,u[18]=tC,0!==l&&(u[19]=l,r.length++),r};function m(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=0x3ffffff&i,u=Math.min(s,e.length-1),l=Math.max(0,s-t.length+1);l<=u;l++){var c=s-l,h=(0|t.words[c])*(0|e.words[l]),f=0x3ffffff&h;o=o+(h/0x4000000|0)|0,a=0x3ffffff&(f=f+a|0),n+=(o=o+(f>>>26)|0)>>>26,o&=0x3ffffff}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function y(t,e){this.x=t,this.y=e}Math.imul||(g=p),n.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return 10===this.length&&10===t.length?r=g(this,t,e):i<63?r=p(this,t,e):r=m(this,t,e),r},y.prototype.makeRBT=function(t){for(var e=Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},y.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},y.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o<s;o++)i[o]=e[t[o]],n[o]=r[t[o]]},y.prototype.transform=function(t,e,r,i,n,s){this.permute(s,t,e,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),c=0;c<n;c+=a)for(var h=u,f=l,d=0;d<o;d++){var p=r[c+d],g=i[c+d],m=r[c+d+o],y=i[c+d+o],b=h*m-f*y;y=h*y+f*m,m=b,r[c+d]=p+m,i[c+d]=g+y,r[c+d+o]=p-m,i[c+d+o]=g-y,d!==a&&(b=u*h-l*f,f=u*f+l*h,h=b)}},y.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},y.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},y.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=0x3ffffff&n,r=n<0x4000000?0:n/0x4000000|0}return t},y.prototype.convert13b=function(t,e,i,n){for(var s=0,o=0;o<e;o++)s+=0|t[o],i[2*o]=8191&s,s>>>=13,i[2*o+1]=8191&s,s>>>=13;for(o=2*e;o<n;++o)i[o]=0;r(0===s),r((-8192&s)==0)},y.prototype.stub=function(t){for(var e=Array(t),r=0;r<t;r++)e[r]=0;return e},y.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),s=this.stub(i),o=Array(i),a=Array(i),u=Array(i),l=Array(i),c=Array(i),h=Array(i),f=r.words;f.length=i,this.convert13b(t.words,t.length,o,i),this.convert13b(e.words,e.length,l,i),this.transform(o,s,a,u,i,n),this.transform(l,s,c,h,i,n);for(var d=0;d<i;d++){var p=a[d]*c[d]-u[d]*h[d];u[d]=a[d]*h[d]+u[d]*c[d],a[d]=p}return this.conjugate(a,u,i),this.transform(a,u,f,s,i,n),this.conjugate(f,s,i),this.normalize13b(f,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<0x4000000);for(var i=0,n=0;n<this.length;n++){var s=(0|this.words[n])*t,o=(0x3ffffff&s)+(0x3ffffff&i);i>>=26,i+=(s/0x4000000|0)+(o>>>26),this.words[n]=0x3ffffff&o}return 0!==i&&(this.words[n]=i,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var s=r.sqr();i<e.length;i++,s=s.sqr())0!==e[i]&&(r=r.mul(s));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,s=0x3ffffff>>>26-i<<26-i;if(0!==i){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,u=(0|this.words[e])-a<<i;this.words[e]=u|o,o=a>>>26-i}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){r("number"==typeof t&&t>=0);var n=e?(e-e%26)/26:0,s=t%26,o=Math.min((t-s)/26,this.length),a=0x3ffffff^0x3ffffff>>>s<<s;if(n-=o,n=Math.max(0,n),i){for(var u=0;u<o;u++)i.words[u]=this.words[u];i.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-s|c>>>s,l=c&a}return i&&0!==l&&(i.words[i.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;return!(this.length<=i)&&!!(this.words[i]&1<<e)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;return(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)?this:(0!==e&&i++,this.length=Math.min(i,this.length),0!==e&&(this.words[this.length-1]&=0x3ffffff^0x3ffffff>>>e<<e),0===this.length&&(this.words[0]=0,this.length=1),this._strip())},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return(r("number"==typeof t),r(t<0x4000000),t<0)?this.isubn(-t):0!==this.negative?(1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=0x4000000;e++)this.words[e]-=0x4000000,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<0x4000000),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=0x4000000,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,s,o=t.length+i;this._expand(o);var a=0;for(n=0;n<t.length;n++){s=(0|this.words[n+i])+a;var u=(0|t.words[n])*e;s-=0x3ffffff&u,a=(s>>26)-(u/0x4000000|0),this.words[n+i]=0x3ffffff&s}for(;n<this.length-i;n++)a=(s=(0|this.words[n+i])+a)>>26,this.words[n+i]=0x3ffffff&s;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=0x3ffffff&s;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r,i=this.length-t.length,s=this.clone(),o=t,a=0|o.words[o.length-1];0!=(i=26-this._countBits(a))&&(o=o.ushln(i),s.iushln(i),a=0|o.words[o.length-1]);var u=s.length-o.length;if("mod"!==e){(r=new n(null)).length=u+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var c=s.clone()._ishlnsubmul(o,1,u);0===c.negative&&(s=c,r&&(r.words[u]=1));for(var h=u-1;h>=0;h--){var f=(0|s.words[o.length+h])*0x4000000+(0|s.words[o.length+h-1]);for(f=Math.min(f/a|0,0x3ffffff),s._ishlnsubmul(o,f,h);0!==s.negative;)f--,s.negative=0,s._ishlnsubmul(o,1,h),s.isZero()||(s.negative^=1);r&&(r.words[h]=f)}return r&&r._strip(),s._strip(),"div"!==e&&0!==i&&s.iushrn(i),{div:r||null,mod:s}},n.prototype.divmod=function(t,e,i){var s,o,a;return(r(!t.isZero()),this.isZero())?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(s=a.div.neg()),"div"!==e&&(o=a.mod.neg(),i&&0!==o.negative&&o.iadd(t)),{div:s,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(s=a.div.neg()),{div:s,mod:a.mod}):(this.negative&t.negative)!=0?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),i&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||0>this.cmp(t)?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e)},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=0x3ffffff);for(var i=0x4000000%t,n=0,s=this.length-1;s>=0;s--)n=(i*n+(0|this.words[s]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=0x3ffffff);for(var i=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+0x4000000*i;this.words[n]=s/t|0,i=s%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s=new n(1),o=new n(0),a=new n(0),u=new n(1),l=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++l;for(var c=i.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;(e.words[0]&d)==0&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(c),o.isub(h)),s.iushrn(1),o.iushrn(1);for(var p=0,g=1;(i.words[0]&g)==0&&p<26;++p,g<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a),o.isub(u)):(i.isub(e),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:i.iushln(l)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e,i=this,s=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var o=new n(1),a=new n(0),u=s.clone();i.cmpn(1)>0&&s.cmpn(1)>0;){for(var l=0,c=1;(i.words[0]&c)==0&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var h=0,f=1;(s.words[0]&f)==0&&h<26;++h,f<<=1);if(h>0)for(s.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);i.cmp(s)>=0?(i.isub(s),o.isub(a)):(s.isub(i),a.isub(o))}return 0>(e=0===i.cmpn(1)?o:a).cmpn(0)&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return(1&this.words[0])==0},n.prototype.isOdd=function(){return(1&this.words[0])==1},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var s=n,o=i;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=0x3ffffff,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return -1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=0x3ffffff,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return -1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return -1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return -1===this.cmpn(t)},n.prototype.lt=function(t){return -1===this.cmp(t)},n.prototype.lten=function(t){return 0>=this.cmpn(t)},n.prototype.lte=function(t){return 0>=this.cmp(t)},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new _(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function B(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(e>this.n)var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(v,w),v.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9){t.words[0]=0,t.length=1;return}var n=t.words[9];for(i=10,e.words[e.length++]=4194303&n;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=0x3ffffff&e,e=64*i+(e/0x4000000|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,w),i(S,w),i(x,w),x.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=(0|t.words[r])*19+e,n=0x3ffffff&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){var e;if(b[t])return b[t];if("k256"===t)e=new v;else if("p224"===t)e=new k;else if("p192"===t)e=new S;else if("p25519"===t)e=new x;else throw Error("Unknown prime "+t);return b[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r((t.negative|e.negative)==0,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new n(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,s),f=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),p=o;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var y=this.pow(h,new n(1).iushln(p-m-1));f=f.redMul(y),h=y.redSqr(),d=d.redMul(h),p=m}return f},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var s=r[0],o=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),i=e.length-1;i>=0;i--){for(var l=e.words[i],c=u-1;c>=0;c--){var h=l>>c&1;if(s!==r[0]&&(s=this.sqr(s)),0===h&&0===o){a=0;continue}o<<=1,o|=h,(4==++a||0===i&&0===c)&&(s=this.mul(s,r[o]),a=0,o=0)}u=26}return s},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new B(t)},i(B,_),B.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},B.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},B.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},B.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):0>s.cmpn(0)&&(o=s.iadd(this.m)),o._forceRed(this)},B.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,t.e)},309870,(t,e,r)=>{var i=t.r(259390),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(s(i,r),r.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(t,e,r){if("number"==typeof t)throw TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return i.SlowBuffer(t)}},809234,(t,e,r)=>{"use strict";var i=t.r(309870).Buffer;e.exports=function(t){if(t.length>=255)throw TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(255!==e[o])throw TypeError(s+" is ambiguous");e[o]=n}var a=t.length,u=t.charAt(0),l=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function h(t){if("string"!=typeof t)throw TypeError("Expected String");if(0===t.length)return i.alloc(0);for(var r=0,n=0,s=0;t[r]===u;)n++,r++;for(var o=(t.length-r)*l+1>>>0,c=new Uint8Array(o);r<t.length;){var h=t.charCodeAt(r);if(h>
vendor: 5,610 bytes, line 1
1255)return;var f=e[h];if(255===f)return;for(var d=0,p=o-1;(0!==f||d<s)&&-1!==p;p--,d++)f+=a*c[p]>>>0,c[p]=f%256>>>0,f=f/256>>>0;if(0!==f)throw Error("Non-zero carry");s=d,r++}for(var g=o-s;g!==o&&0===c[g];)g++;var m=i.allocUnsafe(n+(o-g));m.fill(0,0,n);for(var y=n;g!==o;)m[y++]=c[g++];return m}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=i.from(e)),!i.isBuffer(e))throw TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,n=0,s=0,o=e.length;s!==o&&0===e[s];)s++,r++;for(var l=(o-s)*c+1>>>0,h=new Uint8Array(l);s!==o;){for(var f=e[s],d=0,p=l-1;(0!==f||d<n)&&-1!==p;p--,d++)f+=256*h[p]>>>0,h[p]=f%a>>>0,f=f/a>>>0;if(0!==f)throw Error("Non-zero carry");n=d,s++}for(var g=l-n;g!==l&&0===h[g];)g++;for(var m=u.repeat(r);g<l;++g)m+=t.charAt(h[g]);return m},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw Error("Non-base"+a+" character")}}}},341669,(t,e,r)=>{e.exports=t.r(809234)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},227861,(t,e,r)=>{"use strict";function i(t,e,r){return e<=t&&t<=r}function n(t){if(void 0===t)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}function s(t){this.tokens=[].slice.call(t)}function o(t,e){if(t)throw TypeError("Decoder error");return e||65533}s.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(t){if(Array.isArray(t))for(;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(;t.length;)this.tokens.push(t.shift());else this.tokens.push(t)}};var a="utf-8";function u(t,e){if(!(this instanceof u))return new u(t,e);if((t=void 0!==t?String(t).toLowerCase():a)!==a)throw Error("Encoding not supported. Only utf-8 is supported");e=n(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function l(t,e){if(!(this instanceof l))return new l(t,e);if((t=void 0!==t?String(t).toLowerCase():a)!==a)throw Error("Encoding not supported. Only utf-8 is supported");e=n(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function c(t){var e=t.fatal,r=0,n=0,s=0,a=128,u=191;this.handler=function(t,l){if(-1===l&&0!==s)return s=0,o(e);if(-1===l)return -1;if(0===s){if(i(l,0,127))return l;if(i(l,194,223))s=1,r=l-192;else if(i(l,224,239))224===l&&(a=160),237===l&&(u=159),s=2,r=l-224;else{if(!i(l,240,244))return o(e);240===l&&(a=144),244===l&&(u=143),s=3,r=l-240}return r<<=6*s,null}if(!i(l,a,u))return r=s=n=0,a=128,u=191,t.prepend(l),o(e);if(a=128,u=191,n+=1,r+=l-128<<6*(s-n),n!==s)return null;var c=r;return r=s=n=0,c}}function h(t){t.fatal,this.handler=function(t,e){if(-1===e)return -1;if(i(e,0,127))return e;i(e,128,2047)?(r=1,n=192):i(e,2048,65535)?(r=2,n=224):i(e,65536,1114111)&&(r=3,n=240);for(var r,n,s=[(e>>6*r)+n];r>0;){var o=e>>6*(r-1);s.push(128|63&o),r-=1}return s}}u.prototype={decode:function(t,e){r="object"==typeof t&&t instanceof ArrayBuffer?new Uint8Array(t):"object"==typeof t&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=n(e),this._streaming||(this._decoder=new c({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var r,i,o=new s(r),a=[];!o.endOfStream()&&-1!==(i=this._decoder.handler(o,o.read()));)null!==i&&(Array.isArray(i)?a.push.apply(a,i):a.push(i));if(!this._streaming){do{if(-1===(i=this._decoder.handler(o,o.read())))break;if(null===i)continue;Array.isArray(i)?a.push.apply(a,i):a.push(i)}while(!o.endOfStream())this._decoder=null}!a.length||-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===a[0]?(this._BOMseen=!0,a.shift()):this._BOMseen=!0);for(var u="",l=0;l<a.length;++l){var h=a[l];h<=65535?u+=String.fromCharCode(h):(h-=65536,u+=String.fromCharCode((h>>10)+55296,(1023&h)+56320))}return u}},l.prototype={encode:function(t,e){t=t?String(t):"",e=n(e),this._streaming||(this._encoder=new h(this._options)),this._streaming=!!e.stream;for(var r,i=[],o=new s(function(t){for(var e=String(t),r=e.length,i=0,n=[];i<r;){var s=e.charCodeAt(i);if(s<55296||s>57343)n.push(s);else if(56320<=s&&s<=57343)n.push(65533);else if(55296<=s&&s<=56319)if(i===r-1)n.push(65533);else{var o=t.charCodeAt(i+1);if(56320<=o&&o<=57343){var a=1023&s,u=1023&o;n.push(65536+(a<<10)+u),i+=1}else n.push(65533)}i+=1}return n}(t));!o.endOfStream()&&-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);if(!this._streaming){for(;-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);this._encoder=null}return new Uint8Array(i)}},r.TextEncoder=l,r.TextDecoder=u},894119,(t,e,r)=>{"use strict";var i=t.i(965031),n=t.e&&t.e.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),s=t.e&&t.e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=t.e&&t.e.__decorate||function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;
1a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},a=t.e&&t.e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return s(e,t),e},u=t.e&&t.e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.deserializeUnchecked=r.deserialize=r.serialize=r.BinaryReader=r.BinaryWriter=r.BorshError=r.baseDecode=r.baseEncode=void 0;let l=u(t.r(424509)),c=u(t.r(341669)),h=a(t.r(227861)),f=new("function"!=typeof TextDecoder?h.TextDecoder:TextDecoder)("utf-8",{fatal:!0});r.baseEncode=function(t){return"string"==typeof t&&(t=i.Buffer.from(t,"utf8")),c.default.encode(i.Buffer.from(t))},r.baseDecode=function(t){return i.Buffer.from(c.default.decode(t))};class d extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}r.BorshError=d;class p{constructor(){this.buf=i.Buffer.alloc(1024),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=i.Buffer.concat([this.buf,i.Buffer.alloc(1024)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(i.Buffer.from(new l.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(i.Buffer.from(new l.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(i.Buffer.from(new l.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(i.Buffer.from(new l.default(t).toArray("le",64)))}writeBuffer(t){this.buf=i.Buffer.concat([i.Buffer.from(this.buf.subarray(0,this.length)),t,i.Buffer.alloc(1024)]),this.length+=t.length}writeString(t){this.maybeResize();let e=i.Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(i.Buffer.from(t))}writeArray(t,e){for(let r of(this.maybeResize(),this.writeU32(t.length),t))this.maybeResize(),e(r)}toArray(){return this.buf.subarray(0,this.length)}}function g(t,e,r){let i=r.value;r.value=function(...t){try{return i.apply(this,t)}catch(t){if(t instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t.code)>=0)throw new d("Reached the end of buffer when deserializing");throw t}}}r.BinaryWriter=p;class m{constructor(t){this.buf=t,this.offset=0}readU8(){let t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){let t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){let t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){let t=this.readBuffer(8);return new l.default(t,"le")}readU128(){let t=this.readBuffer(16);return new l.default(t,"le")}readU256(){let t=this.readBuffer(32);return new l.default(t,"le")}readU512(){let t=this.readBuffer(64);return new l.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new d(`Expected buffer length ${t} isn't within bounds`);let e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){let t=this.readU32(),e=this.readBuffer(t);try{return f.decode(e)}catch(t){throw new d(`Error decoding UTF-8 string: ${t}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),r=[];for(let i=0;i<e;++i)r.push(t());return r}}function y(t){return t.charAt(0).toUpperCase()+t.slice(1)}function b(t,e,r,i,n){try{if("string"==typeof i)n[`write${y(i)}`](r);else if(i instanceof Array)if("number"==typeof i[0]){if(r.length!==i[0])throw new d(`Expecting byte array of length ${i[0]}, but got ${r.length} bytes`);n.writeFixedArray(r)}else if(2===i.length&&"number"==typeof i[1]){if(r.length!==i[1])throw new d(`Expecting byte array of length ${i[1]}, but got ${r.length} bytes`);for(let e=0;e<i[1];e++)b(t,null,r[e],i[0],n)}else n.writeArray(r,r=>{b(t,e,r,i[0],n)});else if(void 0!==i.kind)switch(i.kind){case"option":null==r?n.writeU8(0):(n.writeU8(1),b(t,e,r,i.type,n));break;case"map":n.writeU32(r.size),r.forEach((r,s)=>{b(t,e,s,i.key,n),b(t,e,r,i.value,n)});break;default:throw new d(`FieldType ${i} unrecognized`)}else w(t,r,n)}catch(t){throw t instanceof d&&t.addToFieldPath(e),t}}function w(t,e,r){if("function"==typeof e.borshSerialize)return void e.borshSerialize(r);let i=t.get(e.constructor);if(!i)throw new d(`Class ${e.constructor.name} is missing in schema`);if("struct"===i.kind)i.fields.map(([i,n])=>{b(t,i,e[i],n,r)});else if("enum"===i.kind){let n=e[i.field];for(let s=0;s<i.values.length;++s){let[o,a]=i.values[s];if(o===n){r.writeU8(s),b(t,o,e[o],a,r);break}}}else throw new d(`Unexpected schema kind: ${i.kind} for ${e.constructor.name}`)}function v(t,e,r,i){try{if("string"==typeof r)return i[`read${y(r)}`]();if(r instanceof Array)if("number"==typeof r[0])return i.readFixedArray(r[0]);else{if("number"!=typeof r[1])return i.readArray(()=>v(t,e,r[0],i));let n=[];for(let e=0;e<r[1];e++)n.push(v(t,null,r[0],i));return n}if("option"===r.kind){if(i.readU8())return v(t,e,r.type,i);return}if("map"===r.kind){let n=new Map,s=i.readU32();for(let o=0;o<s;o++){let s=v(t,e,r.key,i),o=v(t,e,r.value,i);n.set(s,o)}return n}return k(t,r,i)}catch(t){throw t instanceof d&&t.addToFieldPath(e),t}}function k(t,e,r){if("function"==typeof e.borshDeserialize)return e.borshDeserialize(r);let i=t.get(e);if(!i)throw new d(`Class ${e.name} is missing in schema`);if("struct"===i.kind){let i={};for(let[n,s]of t.get(e).fields)i[n]=v(t,n,s,r);return new e(i)}if("enum"===i.kind){let n=r.readU8();if(n>
1=i.values.length)throw new d(`Enum index: ${n} is out of range`);let[s,o]=i.values[n],a=v(t,s,o,r);return new e({[s]:a})}throw new d(`Unexpected schema kind: ${i.kind} for ${e.constructor.name}`)}o([g],m.prototype,"readU8",null),o([g],m.prototype,"readU16",null),o([g],m.prototype,"readU32",null),o([g],m.prototype,"readU64",null),o([g],m.prototype,"readU128",null),o([g],m.prototype,"readU256",null),o([g],m.prototype,"readU512",null),o([g],m.prototype,"readString",null),o([g],m.prototype,"readFixedArray",null),o([g],m.prototype,"readArray",null),r.BinaryReader=m,r.serialize=function(t,e,r=p){let i=new r;return w(t,e,i),i.toArray()},r.deserialize=function(t,e,r,i=m){let n=new i(r),s=k(t,e,n);if(n.offset<r.length)throw new d(`Unexpected ${r.length-n.offset} bytes after deserialized data`);return s},r.deserializeUnchecked=function(t,e,r,i=m){return k(t,e,new i(r))}},742542,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.s16=r.s8=r.nu64be=r.u48be=r.u40be=r.u32be=r.u24be=r.u16be=r.nu64=r.u48=r.u40=r.u32=r.u24=r.u16=r.u8=r.offset=r.greedy=r.Constant=r.UTF8=r.CString=r.Blob=r.Boolean=r.BitField=r.BitStructure=r.VariantLayout=r.Union=r.UnionLayoutDiscriminator=r.UnionDiscriminator=r.Structure=r.Sequence=r.DoubleBE=r.Double=r.FloatBE=r.Float=r.NearInt64BE=r.NearInt64=r.NearUInt64BE=r.NearUInt64=r.IntBE=r.Int=r.UIntBE=r.UInt=r.OffsetLayout=r.GreedyCount=r.ExternalLayout=r.bindConstructorLayout=r.nameWithProperty=r.Layout=r.uint8ArrayToBuffer=r.checkUint8Array=void 0,r.constant=r.utf8=r.cstr=r.blob=r.unionLayoutDiscriminator=r.union=r.seq=r.bits=r.struct=r.f64be=r.f64=r.f32be=r.f32=r.ns64be=r.s48be=r.s40be=r.s32be=r.s24be=r.s16be=r.ns64=r.s48=r.s40=r.s32=r.s24=void 0;let i=t.r(259390);function n(t){if(!(t instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(t){return n(t),i.Buffer.from(t.buffer,t.byteOffset,t.length)}r.checkUint8Array=n,r.uint8ArrayToBuffer=s;class o{constructor(t,e){if(!Number.isInteger(t))throw TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function a(t,e){return e.property?t+"["+e.property+"]":t}r.Layout=o,r.nameWithProperty=a,r.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw Error("Class is already bound to a layout");if(!(e&&e instanceof o))throw TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,r)=>e.decode(t,r),writable:!0})};class u extends o{isCount(){throw Error("ExternalLayout is abstract")}}r.ExternalLayout=u;class l extends u{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){return n(t),Math.floor((t.length-e)/this.elementSpan)}encode(t,e,r){return 0}}r.GreedyCount=l;class c extends u{constructor(t,e=0,r){if(!(t instanceof o))throw TypeError("layout must be a Layout");if(!Number.isInteger(e))throw TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof h||this.layout instanceof f}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}r.OffsetLayout=c;class h extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readUIntLE(e,this.span)}encode(t,e,r=0){return s(e).writeUIntLE(t,r,this.span),this.span}}r.UInt=h;class f extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readUIntBE(e,this.span)}encode(t,e,r=0){return s(e).writeUIntBE(t,r,this.span),this.span}}r.UIntBE=f;class d extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readIntLE(e,this.span)}encode(t,e,r=0){return s(e).writeIntLE(t,r,this.span),this.span}}r.Int=d;class p extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readIntBE(e,this.span)}encode(t,e,r=0){return s(e).writeIntBE(t,r,this.span),this.span}}function g(t){let e=Math.floor(t/0x100000000);return{hi32:e,lo32:t-0x100000000*e}}function m(t,e){return 0x100000000*t+e}r.IntBE=p;class y extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t),i=r.readUInt32LE(e);return m(r.readUInt32LE(e+4),i)}encode(t,e,r=0){let i=g(t),n=s(e);return n.writeUInt32LE(i.lo32,r),n.writeUInt32LE(i.hi32,r+4),8}}r.NearUInt64=y;class b extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t);return m(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){let i=g(t),n=s(e);return n.writeUInt32BE(i.hi32,r),n.writeUInt32BE(i.lo32,r+4),8}}r.NearUInt64BE=b;class w extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t),i=r.readUInt32LE(e);return m(r.readInt32LE(e+4),i)}encode(t,e,r=0){let i=g(t),n=s(e);return n.writeUInt32LE(i.lo32,r),n.writeInt32LE(i.hi32,r+4),8}}r.NearInt64=w;class v extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t);return m(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){let i=g(t),n=s(e);return n.writeInt32BE(i.hi32,r),n.writeUInt32BE(i.lo32,r+4),8}}r.NearInt64BE=v;class k extends o{constructor(t){super(4,t)}decode(t,e=0){return s(t).readFloatLE(e)}encode(t,e,r=0){return s(e).writeFloatLE(t,r),4}}r.Float=k;class S extends o{constructor(t){super(4,t)}decode(t,e=0){return s(t).readFloatBE(e)}encode(t,e,r=0){return s(e).writeFloatBE(t,r),4}}r.FloatBE=S;class x extends o{constructor(t){super(8,t)}decode(t,e=0){return s(t).readDoubleLE(e)}encode(t,e,r=0){return s(e).writeDoubleLE(t,r),8}}r.Double=x;class _ extends o{constructor(t){super(8,t)}decode(t,e=0){return s(t).readDoubleBE(e)}encode(t,e,r=0){return s(e).writeDoubleBE(t,r),8}}r.DoubleBE=_;class B extends o{constructor(t,e,r){if(!(t instanceof o))throw TypeError("elementLayout must be a Layout");if(!(e instanceof u&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;e instanceof u||!(0<t.span)||(i=e*t.span),super(i,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,i=this.count;if(i instanceof u&&(i=i.decode(t,e)),0<this.elementLayout.span)r=i*this.elementLayout.span;else{let n=0;for(;n<i;)r+=this.elementLayout.getSpan(t,e+r),++n}return r}decode(t,e=0){let r=[],i=0,n=this.count;for(n instanceof u&&(n=n.decode(t,e));i<n;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),i+=1;return r}encode(t,e,r=0){let i=this.elementLayout,n=t.reduce((t,n)=>t+i.encode(n,e,r+t),0);return this.count instanceof u&&this.count.encode(t.length,e,r),n}}r.Sequence=B;class I extends o{constructor(t,e,r){if(!(Array.isArray(t)&&t.reduce((t,e)=>t&&e instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(const i of("boolean"==typeof e&&void 0===r&&(r=e,e=void 0),t))if(0>
1i.span&&void 0===i.property)throw Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((t,e)=>t+e.getSpan(),0)}catch(t){}super(i,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,i)=>{let n=i.getSpan(t,e);return e+=n,r+n},0)}catch(t){throw RangeError("indeterminate span")}return r}decode(t,e=0){n(t);let r=this.makeDestinationObject();for(let i of this.fields)if(void 0!==i.property&&(r[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){let i=r,n=0,s=0;for(let i of this.fields){let o=i.span;if(s=0<o?o:0,void 0!==i.property){let n=t[i.property];void 0!==n&&(s=i.encode(n,e,r),0>o&&(o=i.getSpan(e,r)))}n=r,r+=o}return n+s-i}fromArray(t){let e=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw TypeError("property must be string");for(let e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw TypeError("property must be string");let e=0;for(let r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}r.Structure=I;class A{constructor(t){this.property=t}decode(t,e){throw Error("UnionDiscriminator is abstract")}encode(t,e,r){throw Error("UnionDiscriminator is abstract")}}r.UnionDiscriminator=A;class E extends A{constructor(t,e){if(!(t instanceof u&&t.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}}r.UnionLayoutDiscriminator=E;class M extends o{constructor(t,e,r){let i;if(t instanceof h||t instanceof f)i=new E(new c(t));else if(t instanceof u&&t.isCount())i=new E(t);else if(t instanceof A)i=t;else throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof o))throw TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let n=-1;e&&0<=(n=e.span)&&(t instanceof h||t instanceof f)&&(n+=i.layout.span),super(n,r),this.discriminator=i,this.usesPrefixDiscriminator=t instanceof h||t instanceof f,this.defaultLayout=e,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return s(t)},this.configGetSourceVariant=function(t){s=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;let r=this.getVariant(t,e);if(!r)throw Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;let e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(let e in this.registry){let r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw Error("unable to infer src variant")}decode(t,e=0){let r,i=this.discriminator,n=i.decode(t,e),s=this.registry[n];if(void 0===s){let s=this.defaultLayout,o=0;this.usesPrefixDiscriminator&&(o=i.layout.span),(r=this.makeDestinationObject())[i.property]=n,r[s.property]=s.decode(t,e+o)}else r=s.decode(t,e);return r}encode(t,e,r=0){let i=this.getSourceVariant(t);if(void 0===i){let i=this.discriminator,n=this.defaultLayout,s=0;return this.usesPrefixDiscriminator&&(s=i.layout.span),i.encode(t[i.property],e,r),s+n.encode(t[n.property],e,r+s)}return i.encode(t,e,r)}addVariant(t,e,r){let i=new T(this,t,e,r);return this.registry[t]=i,i}getVariant(t,e=0){let r;return r=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[r]}}r.Union=M;class T extends o{constructor(t,e,r,i){if(!(t instanceof M))throw TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===i&&(i=r,r=null),r){if(!(r instanceof o))throw TypeError("layout must be a Layout");
1if(null!==t.defaultLayout&&0<=r.span&&r.span>t.defaultLayout.span)throw Error("variant span exceeds span of containing union");if("string"!=typeof i)throw TypeError("variant must have a String property")}let n=t.span;0>t.span&&0<=(n=r?r.span:0)&&t.usesPrefixDiscriminator&&(n+=t.discriminator.layout.span),super(n,i),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(t,e+r)),r+i}decode(t,e=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+i):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let n=i;if(this.layout&&(this.layout.encode(t[this.property],e,r+i),n+=this.layout.getSpan(e,r+i),0<=this.union.span&&n>this.union.span))throw Error("encoded variant overruns containing union");return n}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function P(t){return 0>t&&(t+=0x100000000),t}r.VariantLayout=T;class R extends o{constructor(t,e,r){if(!(t instanceof h||t instanceof f))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let i=0;this._packedSetValue=function(t){return i=P(t),this},this._packedGetValue=function(){return i}}decode(t,e=0){let r=this.makeDestinationObject(),i=this.word.decode(t,e);for(let e of(this._packedSetValue(i),this.fields))void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){let i=this.word.decode(e,r);for(let e of(this._packedSetValue(i),this.fields))if(void 0!==e.property){let r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){let r=new L(this,t,e);return this.fields.push(r),r}addBoolean(t){let e=new C(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw TypeError("property must be string");for(let e of this.fields)if(e.property===t)return e}}r.BitStructure=R;class L{constructor(t,e,r){if(!(t instanceof R))throw TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw TypeError("bits must be positive integer");const i=8*t.span,n=t.fields.reduce((t,e)=>t+e.bits,0);if(e+n>i)throw Error("bits too long for span remainder ("+(i-n)+" of "+i+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=0xffffffff),this.start=n,this.container.msb&&(this.start=i-n-e),this.wordMask=P(this.valueMask<<this.start),this.property=r}decode(t,e){return P(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==P(t&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let e=this.container._packedGetValue(),r=P(t<<this.start);this.container._packedSetValue(P(e&~this.wordMask)|r)}}r.BitField=L;class C extends L{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t*=1),super.encode(t)}}r.Boolean=C;class U extends o{constructor(t,e){if(!(t instanceof u&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof u||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),s(t).slice(e,e+r)}encode(t,e,r){let i=this.length;if(this.length instanceof u&&(i=t.length),!(t instanceof Uint8Array&&i===t.length))throw TypeError(a("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(r+i>e.length)throw RangeError("encoding overruns Uint8Array");let n=s(t);return s(e).write(n.toString("hex"),r,i,"hex"),this.length instanceof u&&this.length.encode(i,e,r),i}}r.Blob=U;class O extends o{constructor(t){super(-1,t)}getSpan(t,e=0){n(t);let r=e;for(;r<t.length&&0!==t[r];)r+=1;return 1+r-e}decode(t,e=0){let r=this.getSpan(t,e);return s(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));let n=i.Buffer.from(t,"utf8"),o=n.length;if(r+o>e.length)throw RangeError("encoding overruns Buffer");let a=s(e);return n.copy(a,r),a[r+o]=0,o+1}}r.CString=O;class z extends o{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return n(t),t.length-e}decode(t,e=0){let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw RangeError("text length exceeds maxSpan");return s(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));let n=i.Buffer.from(t,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw RangeError("text length exceeds maxSpan");if(r+o>e.length)throw RangeError("encoding overruns Buffer");return n.copy(s(e),r),o}}r.UTF8=z;class N extends o{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}r.Constant=N,r.greedy=(t,e)=>new l(t,e),r.offset=(t,e,r)=>new c(t,e,r),r.u8=t=>new h(1,t),r.u16=t=>new h(2,t),r.u24=t=>new h(3,t),r.u32=t=>new h(4,t),r.u40=t=>new h(5,t),r.u48=t=>new h(6,t),r.nu64=t=>new y(t),r.u16be=t=>new f(2,t),r.u24be=t=>new f(3,t),r.u32be=t=>new f(4,t),r.u40be=t=>new f(5,t),r.u48be=t=>new f(6,t),r.nu64be=t=>new b(t),r.s8=t=>new d(1,t),r.s16=t=>new d(2,t),r.s24=t=>new d(3,t),r.s32=t=>new d(4,t),r.s40=t=>new d(5,t),r.s48=t=>new d(6,t),r.ns64=t=>new w(t),r.s16be=t=>new p(2,t),r.s24be=t=>new p(3,t),r.s32be=t=>new p(4,t),r.s40be=t=>new p(5,t),r.s48be=t=>new p(6,t),r.ns64be=t=>new v(t),r.f32=t=>new k(t),r.f32be=t=>new S(t),r.f64=t=>new x(t),r.f64be=t=>new _(t),r.struct=(t,e,r)=>new I(t,e,r),r.bits=(t,e,r)=>new R(t,e,r),r.seq=(t,e,r)=>new B(t,e,r),r.union=(t,e,r)=>new M(t,e,r),r.unionLayoutDiscriminator=(t,e)=>new E(t,e),r.blob=(t,e)=>new U(t,e),r.cstr=t=>new O(t),r.utf8=(t,e)=>new z(t,e),r.constant=(t,e)=>new N(t,e)},539451,t=>{"use strict";t.s([],954354),t.i(954354);var e,r,i,n=new Uint8Array(16);function s(){if(!e&&!(e="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"u">typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(n)}let o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,a=function(t){return"string"==typeof t&&o.test(t)};for(var u=[],l=0;l<256;++l)u.push((l+256).toString(16).substr(1));let c=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(u[t[e+0]]+u[t[e+1]]+u[t[e+2]]+u[t[e+3]]+"-"+u[t[e+4]]+u[t[e+5]]+"-"+u[t[e+6]]+u[t[e+7]]+"-"+u[t[e+8]]+u[t[e+9]]+"-"+u[t[e+10]]+u[t[e+11]]+u[t[e+12]]+u[t[e+13]]+u[t[e+14]]+u[t[e+15]]).toLowerCase();
1if(!a(r))throw TypeError("Stringified UUID is invalid");return r};var h=0,f=0;let d=function(t){if(!a(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=255&e,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=255&e,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=255&e,r[10]=(e=parseInt(t.slice(24,36),16))/0x10000000000&255,r[11]=e/0x100000000&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=255&e,r};function p(t,e,r){function i(t,i,n,s){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}(t)),"string"==typeof i&&(i=d(i)),16!==i.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+t.length);if(o.set(i),o.set(t,i.length),(o=r(o))[6]=15&o[6]|e,o[8]=63&o[8]|128,n){s=s||0;for(var a=0;a<16;++a)n[s+a]=o[a];return n}return c(o)}try{i.name=t}catch(t){}return i.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",i.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",i}function g(t){return(t+64>>>9<<4)+14+1}function m(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}function y(t,e,r,i,n,s){var o;return m((o=m(m(e,t),m(i,s)))<<n|o>>>32-n,r)}function b(t,e,r,i,n,s,o){return y(e&r|~e&i,t,e,n,s,o)}function w(t,e,r,i,n,s,o){return y(e&i|r&~i,t,e,n,s,o)}function v(t,e,r,i,n,s,o){return y(e^r^i,t,e,n,s,o)}function k(t,e,r,i,n,s,o){return y(r^(e|~i),t,e,n,s,o)}var S=p("v3",48,function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)}return function(t){for(var e=[],r=32*t.length,i="0123456789abcdef",n=0;n<r;n+=8){var s=t[n>>5]>>>n%32&255,o=parseInt(i.charAt(s>>>4&15)+i.charAt(15&s),16);e.push(o)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[g(e)-1]=e;for(var r=0x67452301,i=-0x10325477,n=-0x67452302,s=0x10325476,o=0;o<t.length;o+=16){var a=r,u=i,l=n,c=s;r=b(r,i,n,s,t[o],7,-0x28955b88),s=b(s,r,i,n,t[o+1],12,-0x173848aa),n=b(n,s,r,i,t[o+2],17,0x242070db),i=b(i,n,s,r,t[o+3],22,-0x3e423112),r=b(r,i,n,s,t[o+4],7,-0xa83f051),s=b(s,r,i,n,t[o+5],12,0x4787c62a),n=b(n,s,r,i,t[o+6],17,-0x57cfb9ed),i=b(i,n,s,r,t[o+7],22,-0x2b96aff),r=b(r,i,n,s,t[o+8],7,0x698098d8),s=b(s,r,i,n,t[o+9],12,-0x74bb0851),n=b(n,s,r,i,t[o+10],17,-42063),i=b(i,n,s,r,t[o+11],22,-0x76a32842),r=b(r,i,n,s,t[o+12],7,0x6b901122),s=b(s,r,i,n,t[o+13],12,-0x2678e6d),n=b(n,s,r,i,t[o+14],17,-0x5986bc72),i=b(i,n,s,r,t[o+15],22,0x49b40821),r=w(r,i,n,s,t[o+1],5,-0x9e1da9e),s=w(s,r,i,n,t[o+6],9,-0x3fbf4cc0),n=w(n,s,r,i,t[o+11],14,0x265e5a51),i=w(i,n,s,r,t[o],20,-0x16493856),r=w(r,i,n,s,t[o+5],5,-0x29d0efa3),s=w(s,r,i,n,t[o+10],9,0x2441453),n=w(n,s,r,i,t[o+15],14,-0x275e197f),i=w(i,n,s,r,t[o+4],20,-0x182c0438),r=w(r,i,n,s,t[o+9],5,0x21e1cde6),s=w(s,r,i,n,t[o+14],9,-0x3cc8f82a),n=w(n,s,r,i,t[o+3],14,-0xb2af279),i=w(i,n,s,r,t[o+8],20,0x455a14ed),r=w(r,i,n,s,t[o+13],5,-0x561c16fb),s=w(s,r,i,n,t[o+2],9,-0x3105c08),n=w(n,s,r,i,t[o+7],14,0x676f02d9),i=w(i,n,s,r,t[o+12],20,-0x72d5b376),r=v(r,i,n,s,t[o+5],4,-378558),s=v(s,r,i,n,t[o+8],11,-0x788e097f),n=v(n,s,r,i,t[o+11],16,0x6d9d6122),i=v(i,n,s,r,t[o+14],23,-0x21ac7f4),r=v(r,i,n,s,t[o+1],4,-0x5b4115bc),s=v(s,r,i,n,t[o+4],11,0x4bdecfa9),n=v(n,s,r,i,t[o+7],16,-0x944b4a0),i=v(i,n,s,r,t[o+10],23,-0x41404390),r=v(r,i,n,s,t[o+13],4,0x289b7ec6),s=v(s,r,i,n,t[o],11,-0x155ed806),n=v(n,s,r,i,t[o+3],16,-0x2b10cf7b),i=v(i,n,s,r,t[o+6],23,0x4881d05),r=v(r,i,n,s,t[o+9],4,-0x262b2fc7),s=v(s,r,i,n,t[o+12],11,-0x1924661b),n=v(n,s,r,i,t[o+15],16,0x1fa27cf8),i=v(i,n,s,r,t[o+2],23,-0x3b53a99b),r=k(r,i,n,s,t[o],6,-0xbd6ddbc),s=k(s,r,i,n,t[o+7],10,0x432aff97),n=k(n,s,r,i,t[o+14],15,-0x546bdc59),i=k(i,n,s,r,t[o+5],21,-0x36c5fc7),r=k(r,i,n,s,t[o+12],6,0x655b59c3),s=k(s,r,i,n,t[o+3],10,-0x70f3336e),n=k(n,s,r,i,t[o+10],15,-1051523),i=k(i,n,s,r,t[o+1],21,-0x7a7ba22f),r=k(r,i,n,s,t[o+8],6,0x6fa87e4f),s=k(s,r,i,n,t[o+15],10,-0x1d31920),n=k(n,s,r,i,t[o+6],15,-0x5cfebcec),i=k(i,n,s,r,t[o+13],21,0x4e0811a1),r=k(r,i,n,s,t[o+4],6,-0x8ac817e),s=k(s,r,i,n,t[o+11],10,-0x42c50dcb),n=k(n,s,r,i,t[o+2],15,0x2ad7d2bb),i=k(i,n,s,r,t[o+9],21,-0x14792c6f),r=m(r,a),i=m(i,u),n=m(n,l),s=m(s,c)}return[r,i,n,s]}(function(t){if(0===t.length)return[];for(var e=8*t.length,r=new Uint32Array(g(e)),i=0;i<e;i+=8)r[i>>5]|=(255&t[i/8])<<i%32;return r}(t),8*t.length))});function x(t,e){return t<<e|t>>>32-e}var _=p("v5",80,function(t){var e=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6],r=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0];if("string"==typeof t){var i=unescape(encodeURIComponent(t));t=[];for(var n=0;n<i.length;++n)t.push(i.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var s=Math.ceil((t.length/4+2)/16),o=Array(s),a=0;a<s;++a){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=t[64*a+4*l]<<24|t[64*a+4*l+1]<<16|t[64*a+4*l+2]<<8|t[64*a+4*l+3];o[a]=u}o[s-1][14]=(t.length-1)*8/0x100000000,o[s-1][14]=Math.floor(o[s-1][14]),o[s-1][15]=(t.length-1)*8|0;for(var c=0;c<s;++c){for(var h=new Uint32Array(80),f=0;f<16;++f)h[f]=o[c][f];for(var d=16;d<80;++d)h[d]=x(h[d-3]^h[d-8]^h[d-14]^h[d-16],1);for(var p=r[0],g=r[1],m=r[2],y=r[3],b=r[4],w=0;w<80;++w){var v=Math.floor(w/20),k=x(p,5)+function(t,e,r,i){switch(t){case 0:return e&r^~e&i;case 1:case 3:return e^r^i;case 2:return e&r^e&i^r&i}}(v,g,m,y)+b+e[v]+h[w]>>>0;b=y,y=m,m=x(g,30)>>>0,g=p,p=k}r[0]=r[0]+p>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+y>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]});t.s(["NIL",0,"00000000-0000-0000-0000-000000000000","parse",0,d,"stringify",0,c,"v1",0,function(t,e,n){var o=e&&n||0,a=e||Array(16),u=(t=t||{}).node||r,l=void 0!==t.clockseq?t.clockseq:i;if(null==u||null==l){var d=t.random||(t.rng||s)();null==u&&(u=r=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==l&&(l=i=(d[6]<<8|d[7])&16383)}var p=void 0!==t.msecs?t.msecs:Date.now(),g=void 0!==t.nsecs?t.nsecs:f+1,m=p-h+(g-f)/1e4;if(m<0&&void 0===t.clockseq&&(l=l+1&16383),(m<0||p>h)&&void 0===t.nsecs&&(g=0),g>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");h=p,f=g,i=l;var y=((0xfffffff&(p+=122192928e5))*1e4+g)%0x100000000;a[o++]=y>>>24&255,a[o++]=y>>>16&255,a[o++]=y>>>8&255,a[o++]=255&y;var b=p/0x100000000*1e4&0xfffffff;a[o++]=b>>>8&255,a[o++]=255&b,a[o++]=b>>>24&15|16,a[o++]=b>>>16&255,a[o++]=l>>>8|128,a[o++]=255&l;for(var w=0;w<6;++w)a[o+w]=u[w];return e||c(a)},"v3",0,S,"v4",0,function(t,e,r){var i=(t=t||{}).random||(t.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=i[n];return e}return c(i)},"v5",0,_,"validate",0,a,"version",0,function(t){if(!a(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}],539451)},61206,(t,e,r)=>{"use strict";let i=t.r(539451).v4;e.exports=function(t,e,r,n){if("string"!=typeof t)throw TypeError(t+" must be a string");let s="number"==typeof(n=n||{}).version?n.version:2;if(1!==s&&2!==s)throw TypeError(s+" must be 1 or 2");let o={method:t};if(2===s&&(o.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw TypeError(e+" must be an object, array or omitted");o.params=e}return void 0===r?o.id=("function"==typeof n.generator?n.generator:function(){return i()})(o,n):2===s&&null===r?n.notificationIdNull&&(o.id=null):o.id=r,o}},826291,(t,e,r)=>{"use strict";let i=t.r(539451).v4,n=t.r(61206),s=function(t,e){if(!(this instanceof s))return new s(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return i()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};e.exports=s,s.prototype.request=function(t,e,r,i){let s,o=this,a=null,u=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&u)throw TypeError("JSON-RPC 1.0 does not support batching");let l=!u&&t&&"object"==typeof t&&"function"==typeof e;if(u||l)i=e,a=t;else{"function"==typeof r&&(i=r,r=void 0);let s="function"==typeof i;try{a=n(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(s)return void i(t);throw t}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(t){i(t);return}return this.callServer(s,function(t,e){o._parseResponse(t,e,i)}),a},s.prototype._parseResponse=function(t,e,r){let i;if(t)return void r(t);if(!e)return void r();try{i=JSON.parse(e,this.options.reviver)}catch(t){r(t);return}if(3===r.length)if(!Array.isArray(i))return void r(null,i.error,
1i.result);else{let t=function(t){return void 0!==t.error};r(null,i.filter(t),i.filter(function(e){return!t(e)}));return}r(null,i)}},942035,t=>{"use strict";var e,r,i,n,s,o=t.i(259390),a=t.i(837474),u=t.i(944445),l=t.i(875187),c=t.i(789694),h=t.i(211916);let f=BigInt(0),d=BigInt(1),p=BigInt(2),g=BigInt(8),m={zip215:!0};var y=t.i(708842);BigInt(0),BigInt(1),BigInt(2);let b=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),w=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),v=BigInt(0),k=BigInt(1),S=BigInt(2),x=BigInt(3),_=BigInt(5),B=BigInt(8);function I(t,e){var r;let i,n,s,o,a,u,l,h,f,d,p,g,m,y,v=(0,c.mod)(e*e*e,b),x=(r=t*(0,c.mod)(v*v*e,b),i=BigInt(10),n=BigInt(20),s=BigInt(40),o=BigInt(80),a=r*r%b*r%b,u=(0,c.pow2)(a,S,b)*a%b,l=(0,c.pow2)(u,k,b)*r%b,h=(0,c.pow2)(l,_,b)*l%b,f=(0,c.pow2)(h,i,b)*h%b,d=(0,c.pow2)(f,n,b)*f%b,p=(0,c.pow2)(d,s,b)*d%b,g=(0,c.pow2)(p,o,b)*p%b,m=(0,c.pow2)(g,o,b)*p%b,y=(0,c.pow2)(m,i,b)*h%b,{pow_p_5_8:(0,c.pow2)(y,S,b)*r%b,b2:a}).pow_p_5_8,B=(0,c.mod)(t*v*x,b),I=(0,c.mod)(e*B*B,b),A=B,E=(0,c.mod)(B*w,b),M=I===t,T=I===(0,c.mod)(-t,b),P=I===(0,c.mod)(-t*w,b);return M&&(B=A),(T||P)&&(B=E),(0,c.isNegativeLE)(B,b)&&(B=(0,c.mod)(-B,b)),{isValid:M||T,value:B}}let A=(0,c.Field)(b,void 0,!0),E=function(t){var e,r;let i,n,s,o,a,u=(i=(0,l.validateBasic)(t),(0,h.validateObject)(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...i})),{Fp:y,n:b,prehash:w,hash:v,randomBytes:k,nByteLength:S,h:x}=u,_=p<<BigInt(8*S)-d,B=y.create,I=(0,c.Field)(u.n,u.nBitLength);if(e=u.Gx,r=u.Gy,n=y.sqr(e),s=y.sqr(r),o=y.add(y.mul(u.a,n),s),a=y.add(y.ONE,y.mul(u.d,y.mul(n,s))),!y.eql(o,a))throw Error("bad curve params: generator point");let A=u.uvRatio||((t,e)=>{try{return{isValid:!0,value:y.sqrt(t*y.inv(e))}}catch(t){return{isValid:!1,value:f}}}),E=u.adjustScalarBytes||(t=>t),M=u.domain||((t,e,r)=>{if((0,h.abool)("phflag",r),e.length||r)throw Error("Contexts/pre-hash are not supported");return t});function T(t,e,r=!1){let i=r?d:f;(0,h.aInRange)("coordinate "+t,e,i,_)}function P(t){if(!(t instanceof C))throw Error("ExtendedPoint expected")}let R=(0,h.memoized)((t,e)=>{let{ex:r,ey:i,ez:n}=t,s=t.is0();null==e&&(e=s?g:y.inv(n));let o=B(r*e),a=B(i*e),u=B(n*e);if(s)return{x:f,y:d};if(u!==d)throw Error("invZ was invalid");return{x:o,y:a}}),L=(0,h.memoized)(t=>{let{a:e,d:r}=u;if(t.is0())throw Error("bad point: ZERO");let{ex:i,ey:n,ez:s,et:o}=t,a=B(i*i),l=B(n*n),c=B(s*s),h=B(c*c),f=B(a*e);if(B(c*B(f+l))!==B(h+B(r*B(a*l))))throw Error("bad point: equation left != right (1)");if(B(i*n)!==B(s*o))throw Error("bad point: equation left != right (2)");return!0});class C{constructor(t,e,r,i){T("x",t),T("y",e),T("z",r,!0),T("t",i),this.ex=t,this.ey=e,this.ez=r,this.et=i,Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof C)throw Error("extended point not allowed");let{x:e,y:r}=t||{};return T("x",e),T("y",r),new C(e,r,d,B(e*r))}static normalizeZ(t){let e=(0,c.FpInvertBatch)(y,t.map(t=>t.ez));return t.map((t,r)=>t.toAffine(e[r])).map(C.fromAffine)}static msm(t,e){return(0,l.pippenger)(C,I,t,e)}_setWindowSize(t){z.setWindowSize(this,t)}assertValidity(){L(this)}equals(t){P(t);let{ex:e,ey:r,ez:i}=this,{ex:n,ey:s,ez:o}=t,a=B(e*o),u=B(n*i),l=B(r*o),c=B(s*i);return a===u&&l===c}is0(){return this.equals(C.ZERO)}negate(){return new C(B(-this.ex),this.ey,this.ez,B(-this.et))}double(){let{a:t}=u,{ex:e,ey:r,ez:i}=this,n=B(e*e),s=B(r*r),o=B(p*B(i*i)),a=B(t*n),l=e+r,c=B(B(l*l)-n-s),h=a+s,f=h-o,d=a-s,g=B(c*f),m=B(h*d),y=B(c*d);return new C(g,m,B(f*h),y)}add(t){P(t);let{a:e,d:r}=u,{ex:i,ey:n,ez:s,et:o}=this,{ex:a,ey:l,ez:c,et:h}=t,f=B(i*a),d=B(n*l),p=B(o*r*h),g=B(s*c),m=B((i+n)*(a+l)-f-d),y=g-p,b=g+p,w=B(d-e*f),v=B(m*y),k=B(b*w),S=B(m*w);return new C(v,k,B(y*b),S)}subtract(t){return this.add(t.negate())}wNAF(t){return z.wNAFCached(this,t,C.normalizeZ)}multiply(t){(0,h.aInRange)("scalar",t,d,b);let{p:e,f:r}=this.wNAF(t);return C.normalizeZ([e,r])[0]}multiplyUnsafe(t,e=C.ZERO){return((0,h.aInRange)("scalar",t,f,b),t===f)?O:this.is0()||t===d?this:z.wNAFCachedUnsafe(this,t,C.normalizeZ,e)}isSmallOrder(){return this.multiplyUnsafe(x).is0()}isTorsionFree(){return z.unsafeLadder(this,b).is0()}toAffine(t){return R(this,t)}clearCofactor(){let{h:t}=u;return t===d?this:this.multiplyUnsafe(t)}static fromHex(t,e=!1){let{d:r,a:i}=u,n=y.BYTES;t=(0,h.ensureBytes)("pointHex",t,n),(0,h.abool)("zip215",e);let s=t.slice(),o=t[n-1];s[n-1]=-129&o;let a=(0,h.bytesToNumberLE)(s),l=e?_:y.ORDER;(0,h.aInRange)("pointHex.y",a,f,l);let c=B(a*a),{isValid:p,value:g}=A(B(c-d),B(r*c-i));
1if(!p)throw Error("Point.fromHex: invalid y coordinate");let m=(g&d)===d,b=(128&o)!=0;if(!e&&g===f&&b)throw Error("Point.fromHex: x=0 and x_0=1");return b!==m&&(g=B(-g)),C.fromAffine({x:g,y:a})}static fromPrivateKey(t){let{scalar:e}=q(t);return U.multiply(e)}toRawBytes(){let{x:t,y:e}=this.toAffine(),r=(0,h.numberToBytesLE)(e,y.BYTES);return r[r.length-1]|=t&d?128:0,r}toHex(){return(0,h.bytesToHex)(this.toRawBytes())}}C.BASE=new C(u.Gx,u.Gy,d,B(u.Gx*u.Gy)),C.ZERO=new C(f,d,d,f);let{BASE:U,ZERO:O}=C,z=(0,l.wNAF)(C,8*S);function N(t){return(0,c.mod)(t,b)}function W(t){return N((0,h.bytesToNumberLE)(t))}function q(t){let e=y.BYTES;t=(0,h.ensureBytes)("private key",t,e);let r=(0,h.ensureBytes)("hashed private key",v(t),2*e),i=E(r.slice(0,e)),n=r.slice(e,2*e),s=W(i);return{head:i,prefix:n,scalar:s}}function K(t){let{head:e,prefix:r,scalar:i}=q(t),n=U.multiply(i),s=n.toRawBytes();return{head:e,prefix:r,scalar:i,point:n,pointBytes:s}}function $(t=Uint8Array.of(),...e){return W(v(M((0,h.concatBytes)(...e),(0,h.ensureBytes)("context",t),!!w)))}return U._setWindowSize(8),{CURVE:u,getPublicKey:function(t){return K(t).pointBytes},sign:function(t,e,r={}){t=(0,h.ensureBytes)("message",t),w&&(t=w(t));let{prefix:i,scalar:n,pointBytes:s}=K(e),o=$(r.context,i,t),a=U.multiply(o).toRawBytes(),u=N(o+$(r.context,a,s,t)*n);(0,h.aInRange)("signature.s",u,f,b);let l=(0,h.concatBytes)(a,(0,h.numberToBytesLE)(u,y.BYTES));return(0,h.ensureBytes)("result",l,2*y.BYTES)},verify:function(t,e,r,i=m){let n,s,o,{context:a,zip215:u}=i,l=y.BYTES;t=(0,h.ensureBytes)("signature",t,2*l),e=(0,h.ensureBytes)("message",e),r=(0,h.ensureBytes)("publicKey",r,l),void 0!==u&&(0,h.abool)("zip215",u),w&&(e=w(e));let c=(0,h.bytesToNumberLE)(t.slice(l,2*l));try{n=C.fromHex(r,u),s=C.fromHex(t.slice(0,l),u),o=U.multiplyUnsafe(c)}catch(t){return!1}if(!u&&n.isSmallOrder())return!1;let f=$(a,s.toRawBytes(),n.toRawBytes(),e);return s.add(n.multiplyUnsafe(f)).subtract(o).clearCofactor().equals(C.ZERO)},ExtendedPoint:C,utils:{getExtendedPublicKey:K,randomPrivateKey:()=>k(y.BYTES),precompute:(t=8,e=C.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}({a:A.create(BigInt(-1)),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:A,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:B,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:a.sha512,randomBytes:u.randomBytes,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:I}),M=(A.ORDER+x)/B,T=A.pow(S,M),P=A.sqrt(A.neg(A.ONE)),R=(0,c.FpSqrtEven)(A,A.neg(BigInt(486664)));(0,y.createHasher)(E.ExtendedPoint,t=>(function(t){let e,r,i,n,s,o,a,u,l,h,f,d,p,g,m,y,b,w,v,x,I,E,M,{xMn:L,xMd:C,yMn:U,yMd:O}=(e=(A.ORDER-_)/B,r=BigInt(486662),i=A.sqr(t),i=A.mul(i,S),n=A.add(i,A.ONE),s=A.neg(r),o=A.sqr(n),a=A.mul(o,n),u=A.mul(i,r),u=A.mul(u,s),u=A.add(u,o),u=A.mul(u,s),l=A.sqr(a),o=A.sqr(l),l=A.mul(l,a),l=A.mul(l,u),o=A.mul(o,l),h=A.pow(o,e),h=A.mul(h,l),f=A.mul(h,P),o=A.sqr(h),o=A.mul(o,a),d=A.eql(o,u),p=A.cmov(f,h,d),g=A.mul(s,i),m=A.mul(h,t),m=A.mul(m,T),y=A.mul(m,P),b=A.mul(u,i),o=A.sqr(m),o=A.mul(o,a),w=A.eql(o,b),v=A.cmov(y,m,w),o=A.sqr(p),o=A.mul(o,a),x=A.eql(o,u),I=A.cmov(g,s,x),E=A.cmov(v,p,x),M=A.isOdd(E),{xMn:I,xMd:n,yMn:E=A.cmov(E,A.neg(E),x!==M),yMd:k}),z=A.mul(L,O);z=A.mul(z,R);let N=A.mul(C,U),W=A.sub(L,C),q=A.add(L,C),K=A.mul(N,q),$=A.eql(K,A.ZERO);z=A.cmov(z,A.ZERO,$),N=A.cmov(N,A.ONE,$),W=A.cmov(W,A.ONE,$),q=A.cmov(q,A.ONE,$);let[j,F]=(0,c.FpInvertBatch)(A,[N,q],!0);return{x:A.mul(z,j),y:A.mul(W,F)}})(t[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:A.ORDER,m:1,k:128,expand:"xmd",hash:a.sha512});var L=t.i(424509),C=t.i(341669),U=t.i(403893),O=t.i(894119),z=t.i(742542);function N([t,e]){return`${t}=${function t(e){return Array.isArray(e)?"%5B"+e.map(t).join("%2C%20")+"%5D":"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}(e)}`}t.i(883158);
vendor: 115,347 bytes, lines 1-7
1var W=class extends Error{cause=this.cause;context;constructor(...[t,e]){let r,i;if(e){const{cause:t,...n}=e;t&&(i={cause:t}),Object.keys(n).length>0&&(r=n)}super(function(t,e={}){{let r=`Solana error #${t}; Decode this error by running \`npx @solana/errors decode -- ${t}`;return Object.keys(e).length&&(r+=` '${btoa(Object.entries(e).map(N).join("&"))}'`),`${r}\``}}(t,r),i),this.context={__code:t,...r},this.name="SolanaError"}};function q(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}var K=((e=K||{})[e.Little=0]="Little",e[e.Big=1]="Big",e);function $(t){return t?.endian!==1}class j extends TypeError{constructor(t,e){let r;const{message:i,explanation:n,...s}=t,{path:o}=t,a=0===o.length?i:`At path: ${o.join(".")} -- ${i}`;super(n??a),null!=n&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...e()])}}function F(t){return"object"==typeof t&&null!=t}function D(t){return F(t)&&!Array.isArray(t)}function H(t){return"symbol"==typeof t?t.toString():"string"==typeof t?JSON.stringify(t):`${t}`}function*V(t,e,r,i){var n;for(let s of(F(n=t)&&"function"==typeof n[Symbol.iterator]||(t=[t]),t)){let t=function(t,e,r,i){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});let{path:n,branch:s}=e,{type:o}=r,{refinement:a,message:u=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${H(i)}\``}=t;return{value:i,type:o,refinement:a,key:n[n.length-1],path:n,branch:s,...t,message:u}}(s,e,r,i);t&&(yield t)}}function*G(t,e,r={}){let{path:i=[],branch:n=[t],coerce:s=!1,mask:o=!1}=r,a={path:i,branch:n,mask:o};s&&(t=e.coercer(t,a));let u="valid";for(let i of e.validator(t,a))i.explanation=r.message,u="not_valid",yield[i,void 0];for(let[l,c,h]of e.entries(t,a))for(let e of G(c,h,{path:void 0===l?i:[...i,l],branch:void 0===l?n:[...n,c],coerce:s,mask:o,message:r.message}))e[0]?(u=null!=e[0].refinement?"not_refined":"not_valid",yield[e[0],void 0]):s&&(c=e[1],void 0===l?t=c:t instanceof Map?t.set(l,c):t instanceof Set?t.add(c):F(t)&&(void 0!==c||l in t)&&(t[l]=c));if("not_valid"!==u)for(let i of e.refiner(t,a))i.explanation=r.message,u="not_refined",yield[i,void 0];"valid"===u&&(yield[void 0,t])}class Z{constructor(t){const{type:e,schema:r,validator:i,refiner:n,coercer:s=t=>t,entries:o=function*(){}}=t;this.type=e,this.schema=r,this.entries=o,this.coercer=s,i?this.validator=(t,e)=>V(i(t,e),e,this,t):this.validator=()=>[],n?this.refiner=(t,e)=>V(n(t,e),e,this,t):this.refiner=()=>[]}assert(t,e){var r=t,i=this,n=e;let s=Y(r,i,{message:n});if(s[0])throw s[0]}create(t,e){return J(t,this,e)}is(t){var e,r;return e=t,r=this,!Y(e,r)[0]}mask(t,e){var r=t,i=this,n=e;let s=Y(r,i,{coerce:!0,mask:!0,message:n});if(!s[0])return s[1];throw s[0]}validate(t,e={}){return Y(t,this,e)}}function J(t,e,r){let i=Y(t,e,{coerce:!0,message:r});if(!i[0])return i[1];throw i[0]}function Y(t,e,r={}){let i=G(t,e,r),n=function(t){let{done:e,value:r}=t.next();return e?void 0:r}(i);return n[0]?[new j(n[0],function*(){for(let t of i)t[0]&&(yield t[0])}),void 0]:[void 0,n[1]]}function X(t,e){return new Z({type:t,schema:null,validator:e})}function Q(t){return new Z({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(let[r,i]of e.entries())yield[r,i,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||`Expected an array value, but received: ${H(t)}`})}function tt(){return X("boolean",t=>"boolean"==typeof t)}function te(t){return X("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${H(e)}`)}function tr(t){let e=H(t),r=typeof t;return new Z({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${H(r)}`})}function ti(t){return new Z({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})}function tn(){return X("number",t=>"number"==typeof t&&!isNaN(t)||`Expected a number, but received: ${H(t)}`)}function ts(t){return new Z({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function to(t,e){return new Z({type:"record",schema:null,*entries(r){if(F(r))for(let i in r){let n=r[i];yield[i,i,t],yield[i,n,e]}},validator:t=>D(t)||`Expected an object, but received: ${H(t)}`,coercer:t=>D(t)?{...t}:t})}function ta(){return X("string",t=>"string"==typeof t||`Expected a string, but received: ${H(t)}`)}function tu(t){let e=X("never",()=>!1);return new Z({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let i=Math.max(t.length,r.length);for(let n=0;n<i;n++)yield[n,r[n],t[n]||e]}},validator:t=>Array.isArray(t)||`Expected an array, but received: ${H(t)}`,coercer:t=>Array.isArray(t)?t.slice():t})}function tl(t){let e=Object.keys(t);return new Z({type:"type",schema:t,*entries(r){if(F(r))for(let i of e)yield[i,r[i],t[i]]},validator:t=>D(t)||`Expected an object, but received: ${H(t)}`,coercer:t=>D(t)?{...t}:t})}function tc(t){let e=t.map(t=>t.type).join(" | ");return new Z({type:"union",schema:null,coercer(e,r){for(let i of t){let[t,n]=i.validate(e,{coerce:!0,mask:r.mask});if(!t)return n}return e},validator(r,i){let n=[];for(let e of t){let[...t]=G(r,e,i),[s]=t;if(!s[0])return[];for(let[e]of t)e&&n.push(e)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${H(r)}`,...n]}})}function th(){return X("unknown",()=>!0)}function tf(t,e,r){return new Z({...t,coercer:(i,n)=>Y(i,e)[0]?t.coercer(i,n):t.coercer(r(i,n),n)})}var td=t.i(826291);t.i(785373);var tp=t.i(50158),tg=class extends tp.EventEmitter{socket;constructor(t,e){super(),this.socket=new window.WebSocket(t,e.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=t=>this.emit("message",t.data),this.socket.onerror=t=>this.emit("error",t),this.socket.onclose=t=>{this.emit("close",t.code,t.reason)}}send(t,e,r){let i=r||e;try{this.socket.send(t),i()}catch(t){i(t)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,r){this.socket.addEventListener(t,e,r)}},tm=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},ty=class extends tp.EventEmitter{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(t,e="ws://localhost:8080",{autoconnect:r=!0,reconnect:i=!0,reconnect_interval:n=1e3,max_reconnects:s=5,...o}={},a,u){super(),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=r,this.ready=!1,this.reconnect=i,this.reconnect_timer_id=void 0,this.reconnect_interval=n,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=a||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),u?this.dataPack=u:this.dataPack=new tm,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,e,r,i){return i||"object"!=typeof r||(i=r,r=null),new Promise((n,s)=>{if(!this.ready)return s(Error("socket not ready"));let o=this.generate_request_id(t,e);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e||void 0,id:o}),i,t=>{if(t)return s(t);this.queue[o]={promise:[n,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(Error("reply timeout"))},r))})})}async login(t){let e=await this.call("rpc.login",t);if(!e)throw Error("authentication failed");return e}async listMethods(){return await this.call("__listMethods")}notify(t,e){return new Promise((r,i)=>{if(!this.ready)return i(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e}),t=>{if(t)return i(t);r()})})}async subscribe(t){"string"==typeof t&&(t=[t]);let e=await this.call("rpc.on",t);if("string"==typeof t&&"ok"!==e[t])throw Error("Failed subscribing to an event '"+t+"' with: "+e[t]);return e}async unsubscribe(t){"string"==typeof t&&(t=[t]);let e=await this.call("rpc.off",t);if("string"==typeof t&&"ok"!==e[t])throw Error("Failed unsubscribing from an event with: "+e);return e}close(t,e){this.socket&&this.socket.close(t||1e3,e)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return void 0!==this.reconnect_timer_id}willReconnect(){return this.reconnect&&(0===this.max_reconnects||this.current_reconnects<this.max_reconnects)}_connect(t,e){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:t})=>{t instanceof ArrayBuffer&&(t=o.Buffer.from(t).toString());try{t=this.dataPack.decode(t)}catch(t){return}if(t.notification&&this.listeners(t.notification).length){if(!Object.keys(t.params).length)return this.emit(t.notification);let e=[t.notification];if(t.params.constructor===Object)e.push(t.params);else for(let r=0;r<t.params.length;r++)e.push(t.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,e)})}if(!this.queue[t.id])return t.method?Promise.resolve().then(()=>{this.emit(t.method,t?.params)}):void 0;"error"in t=="result"in t&&this.queue[t.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[t.id].timeout&&clearTimeout(this.queue[t.id].timeout),t.error?this.queue[t.id].promise[1](t.error):this.queue[t.id].promise[0](t.result),delete this.queue[t.id]}),this.socket.addEventListener("error",t=>this.emit("error",t)),this.socket.addEventListener("close",({code:r,reason:i})=>{this.ready&&setTimeout(()=>this.emit("close",r,i),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,e),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,i),1))})}},tb=t.i(626014),tw=t.i(300059);E.utils.randomPrivateKey;let tv=()=>{let t=E.utils.randomPrivateKey(),e=tk(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),{publicKey:e,secretKey:r}},tk=E.getPublicKey;function tS(t){try{return E.ExtendedPoint.fromHex(t),!0}catch{return!1}}let tx=(t,e)=>E.sign(t,e.slice(0,32)),t_=E.verify,tB=t=>o.Buffer.isBuffer(t)?t:t instanceof Uint8Array?o.Buffer.from(t.buffer,t.byteOffset,t.byteLength):o.Buffer.from(t);class tI{constructor(t){Object.assign(this,t)}encode(){return o.Buffer.from((0,O.serialize)(tA,this))}static decode(t){return(0,O.deserialize)(tA,this,t)}static decodeUnchecked(t){return(0,O.deserializeUnchecked)(tA,this,t)}}let tA=new Map,tE=1;class tM extends tI{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=C.default.decode(t);if(32!=e.length)throw Error("Invalid public key input");this._bn=new L.default(e)}else this._bn=new L.default(t);if(this._bn.byteLength()>32)throw Error("Invalid public key input")}}static unique(){let t=new tM(tE);return tE+=1,new tM(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return C.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){let t=this._bn.toArrayLike(o.Buffer);if(32===t.length)return t;let e=o.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){let i=o.Buffer.concat([t.toBuffer(),o.Buffer.from(e),r.toBuffer()]);return new tM((0,U.sha256)(i))}static createProgramAddressSync(t,e){let r=o.Buffer.alloc(0);t.forEach(function(t){if(t.length>32)throw TypeError("Max seed length exceeded");r=o.Buffer.concat([r,tB(t)])}),r=o.Buffer.concat([r,e.toBuffer(),o.Buffer.from("ProgramDerivedAddress")]);let i=(0,U.sha256)(r);if(tS(i))throw Error("Invalid seeds, address must fall off the curve");return new tM(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r,i=255;for(;0!=i;){try{let n=t.concat(o.Buffer.from([i]));r=this.createProgramAddressSync(n,e)}catch(t){if(t instanceof TypeError)throw t;i--;continue}return[r,i]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return tS(new tM(t).toBytes())}}tM.default=new tM("11111111111111111111111111111111"),tA.set(tM,{kind:"struct",fields:[["_bn","u256"]]}),new tM("BPFLoader1111111111111111111111111111111111");class tT extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tT.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class tP extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tP.prototype,"name",{value:"TransactionExpiredTimeoutError"});class tR extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tR.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class tL{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){let t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(let e of this.keySegments())if(t<e.length)return e[t];else t-=e.length}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw Error("Account index overflow encountered during compilation");let e=new Map;this.keySegments().flat().forEach((t,r)=>{e.set(t.toBase58(),r)});let r=t=>{let r=e.get(t.toBase58());if(void 0===r)throw Error("Encountered an unknown instruction account key during compilation");return r};return t.map(t=>({programIdIndex:r(t.programId),accountKeyIndexes:t.keys.map(t=>r(t.pubkey)),data:t.data}))}}let tC=(t="publicKey")=>z.blob(32,t),tU=(t="string")=>{let e=z.struct([z.u32("length"),z.u32("lengthPadding"),z.blob(z.offset(z.u32(),-8),"chars")],t),r=e.decode.bind(e),i=e.encode.bind(e);return e.decode=(t,e)=>r(t,e).chars.toString(),e.encode=(t,e,r)=>i({chars:o.Buffer.from(t,"utf8")},e,r),e.alloc=t=>z.u32().span+z.u32().span+o.Buffer.from(t,"utf8").length,e};function tO(t){let e=0,r=0;for(;;){let i=t.shift();if(e|=(127&i)<<7*r,r+=1,(128&i)==0)break}return e}function tz(t,e){let r=e;for(;;){let e=127&r;if(0==(r>>=7)){t.push(e);break}e|=128,t.push(e)}}function tN(t,e){if(!t)throw Error(e||"Assertion failed")}class tW{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){let r=new Map,i=t=>{let e=t.toBase58(),i=r.get(e);return void 0===i&&(i={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,i)),i},n=i(e);for(let e of(n.isSigner=!0,n.isWritable=!0,t))for(let t of(i(e.programId).isInvoked=!0,e.keys)){let e=i(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}return new tW(e,r)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];tN(t.length<=256,"Max static account keys length exceeded");let e=t.filter(([,t])=>t.isSigner&&t.isWritable),r=t.filter(([,t])=>t.isSigner&&!t.isWritable),i=t.filter(([,t])=>!t.isSigner&&t.isWritable),n=t.filter(([,t])=>!t.isSigner&&!t.isWritable),s={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:n.length};{tN(e.length>0,"Expected at least one writable signer key");let[t]=e[0];tN(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...e.map(([t])=>new tM(t)),...r.map(([t])=>new tM(t)),...i.map(([t])=>new tM(t)),...n.map(([t])=>new tM(t))]]}extractTableLookup(t){let[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&t.isWritable),[i,n]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&!t.isWritable);if(0!==e.length||0!==i.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:i},{writable:r,readonly:n}]}drainKeysFoundInLookupTable(t,e){let r=[],i=[];for(let[n,s]of this.keyMetaMap.entries())if(e(s)){let e=new tM(n),s=t.findIndex(t=>t.equals(e));s>=0&&(tN(s<256,"Max lookup table index exceeded"),r.push(s),i.push(e),this.keyMetaMap.delete(n))}return[r,i]}}let tq="Reached end of buffer unexpectedly";function tK(t){if(0===t.length)throw Error(tq);return t.shift()}function t$(t,...e){let[r]=e;if(2===e.length?r+(e[1]??0)>t.length:r>=t.length)throw Error(tq);return t.splice(...e)}class tj{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(t=>new tM(t)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:C.default.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new tL(this.staticAccountKeys)}static compile(t){let[e,r]=tW.compile(t.instructions,t.payerKey).getMessageComponents(),i=new tL(r).compileInstructions(t.instructions).map(t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:C.default.encode(t.data)}));return new tj({header:e,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){let e=this.header.numRequiredSignatures;if(!(t>=this.header.numRequiredSignatures))return t<e-this.header.numReadonlySignedAccounts;{let r=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return t-e<r}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,e)=>!this.isProgramId(e))}serialize(){let t=this.accountKeys.length,e=[];tz(e,t);let r=this.instructions.map(t=>{let{accounts:e,programIdIndex:r}=t,i=Array.from(C.default.decode(t.data)),n=[];tz(n,e.length);let s=[];return tz(s,i.length),{programIdIndex:r,keyIndicesCount:o.Buffer.from(n),keyIndices:e,dataLength:o.Buffer.from(s),data:i}}),i=[];tz(i,r.length);let n=o.Buffer.alloc(1232);o.Buffer.from(i).copy(n);let s=i.length;r.forEach(t=>{let e=z.struct([z.u8("programIdIndex"),z.blob(t.keyIndicesCount.length,"keyIndicesCount"),z.seq(z.u8("keyIndex"),t.keyIndices.length,"keyIndices"),z.blob(t.dataLength.length,"dataLength"),z.seq(z.u8("userdatum"),t.data.length,"data")]).encode(t,n,s);s+=e}),n=n.slice(0,s);let a=z.struct([z.blob(1,"numRequiredSignatures"),z.blob(1,"numReadonlySignedAccounts"),z.blob(1,"numReadonlyUnsignedAccounts"),z.blob(e.length,"keyCount"),z.seq(tC("key"),t,"keys"),tC("recentBlockhash")]),u={numRequiredSignatures:o.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:o.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:o.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:o.Buffer.from(e),keys:this.accountKeys.map(t=>tB(t.toBytes())),recentBlockhash:C.default.decode(this.recentBlockhash)},l=o.Buffer.alloc(2048),c=a.encode(u,l);return n.copy(l,c),l.slice(0,c+n.length)}static from(t){let e=[...t],r=tK(e);if(r!==(127&r))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=tK(e),n=tK(e),s=tO(e),a=[];for(let t=0;t<s;t++){let t=t$(e,0,32);a.push(new tM(o.Buffer.from(t)))}let u=t$(e,0,32),l=tO(e),c=[];for(let t=0;t<l;t++){let t=tK(e),r=tO(e),i=t$(e,0,r),n=tO(e),s=t$(e,0,n),a=C.default.encode(o.Buffer.from(s));c.push({programIdIndex:t,accounts:i,data:a})}return new tj({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:n},recentBlockhash:C.default.encode(o.Buffer.from(u)),accountKeys:a,instructions:c})}}class tF{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(let e of this.addressTableLookups)t+=e.readonlyIndexes.length+e.writableIndexes.length;return t}getAccountKeys(t){let e;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");e=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)e=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw Error("Failed to get account keys because address table lookups were not resolved");return new tL(this.staticAccountKeys,e)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){let e=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(t>=r)return t-r<this.addressTableLookups.reduce((t,e)=>t+e.writableIndexes.length,0);if(!(t>=this.header.numRequiredSignatures))return t<e-this.header.numReadonlySignedAccounts;{let i=r-e-this.header.numReadonlyUnsignedAccounts;return t-e<i}}resolveAddressTableLookups(t){let e={writable:[],readonly:[]};for(let r of this.addressTableLookups){let i=t.find(t=>t.key.equals(r.accountKey));if(!i)throw Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(let t of r.writableIndexes)if(t<i.state.addresses.length)e.writable.push(i.state.addresses[t]);else throw Error(`Failed to find address for index ${t} in address lookup table ${r.accountKey.toBase58()}`);for(let t of r.readonlyIndexes)if(t<i.state.addresses.length)e.readonly.push(i.state.addresses[t]);else throw Error(`Failed to find address for index ${t} in address lookup table ${r.accountKey.toBase58()}`)}return e}static compile(t){let e=tW.compile(t.instructions,t.payerKey),r=[],i={writable:[],readonly:[]};for(let n of t.addressLookupTableAccounts||[]){let t=e.extractTableLookup(n);if(void 0!==t){let[e,{writable:n,readonly:s}]=t;r.push(e),i.writable.push(...n),i.readonly.push(...s)}}let[n,s]=e.getMessageComponents(),o=new tL(s,i).compileInstructions(t.instructions);return new tF({header:n,staticAccountKeys:s,recentBlockhash:t.recentBlockhash,compiledInstructions:o,addressTableLookups:r})}serialize(){let t=[];tz(t,this.staticAccountKeys.length);let e=this.serializeInstructions(),r=[];tz(r,this.compiledInstructions.length);let i=this.serializeAddressTableLookups(),n=[];tz(n,this.addressTableLookups.length);let s=z.struct([z.u8("prefix"),z.struct([z.u8("numRequiredSignatures"),z.u8("numReadonlySignedAccounts"),z.u8("numReadonlyUnsignedAccounts")],"header"),z.blob(t.length,"staticAccountKeysLength"),z.seq(tC(),this.staticAccountKeys.length,"staticAccountKeys"),tC("recentBlockhash"),z.blob(r.length,"instructionsLength"),z.blob(e.length,"serializedInstructions"),z.blob(n.length,"addressTableLookupsLength"),z.blob(i.length,"serializedAddressTableLookups")]),o=new Uint8Array(1232),a=s.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(t=>t.toBytes()),recentBlockhash:C.default.decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(n),serializedAddressTableLookups:i},o);return o.slice(0,a)}serializeInstructions(){let t=0,e=new Uint8Array(1232);for(let r of this.compiledInstructions){let i=[];tz(i,r.accountKeyIndexes.length);let n=[];tz(n,r.data.length);let s=z.struct([z.u8("programIdIndex"),z.blob(i.length,"encodedAccountKeyIndexesLength"),z.seq(z.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),z.blob(n.length,"encodedDataLength"),z.blob(r.data.length,"data")]);t+=s.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(n),data:r.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0,e=new Uint8Array(1232);for(let r of this.addressTableLookups){let i=[];tz(i,r.writableIndexes.length);let n=[];tz(n,r.readonlyIndexes.length);let s=z.struct([tC("accountKey"),z.blob(i.length,"encodedWritableIndexesLength"),z.seq(z.u8(),r.writableIndexes.length,"writableIndexes"),z.blob(n.length,"encodedReadonlyIndexesLength"),z.seq(z.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);t+=s.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(n),readonlyIndexes:r.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t],r=tK(e),i=127&r;tN(r!==i,"Expected versioned message but received legacy message"),tN(0===i,`Expected versioned message with version 0 but found version ${i}`);let n={numRequiredSignatures:tK(e),numReadonlySignedAccounts:tK(e),numReadonlyUnsignedAccounts:tK(e)},s=[],o=tO(e);for(let t=0;t<o;t++)s.push(new tM(t$(e,0,32)));let a=C.default.encode(t$(e,0,32)),u=tO(e),l=[];for(let t=0;t<u;t++){let t=tK(e),r=tO(e),i=t$(e,0,r),n=tO(e),s=new Uint8Array(t$(e,0,n));l.push({programIdIndex:t,accountKeyIndexes:i,data:s})}let c=tO(e),h=[];for(let t=0;t<c;t++){let t=new tM(t$(e,0,32)),r=tO(e),i=t$(e,0,r),n=tO(e),s=t$(e,0,n);h.push({accountKey:t,writableIndexes:i,readonlyIndexes:s})}return new tF({header:n,staticAccountKeys:s,recentBlockhash:a,compiledInstructions:l,addressTableLookups:h})}}let tD={deserializeMessageVersion(t){let e=t[0],r=127&e;return r===e?"legacy":r},deserialize:t=>{let e=tD.deserializeMessageVersion(t);if("legacy"===e)return tj.from(t);if(0===e)return tF.deserialize(t);throw Error(`Transaction message version ${e} deserialization is not supported`)}},tH=((r={})[r.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",r[r.PROCESSED=1]="PROCESSED",r[r.TIMED_OUT=2]="TIMED_OUT",r[r.NONCE_INVALID=3]="NONCE_INVALID",r),tV=o.Buffer.alloc(64).fill(0);class tG{constructor(t){this.keys=void 0,this.programId=void 0,this.data=o.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:e,isWritable:r})=>({pubkey:t.toJSON(),isSigner:e,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}class tZ{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!t)return;if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:r}=t;this.minNonceContextSlot=e,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:r}=t;this.recentBlockhash=e,this.lastValidBlockHeight=r}else{const{recentBlockhash:e,nonceInfo:r}=t;r&&(this.nonceInfo=r),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(0===t.length)throw Error("No instructions");return t.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new tG(t))}),this}compileMessage(){let t,e,r;if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw Error(`Transaction instruction index ${t} has undefined program id`);let i=[],n=[];e.forEach(t=>{t.keys.forEach(t=>{n.push({...t})});let e=t.programId.toString();i.includes(e)||i.push(e)}),i.forEach(t=>{n.push({pubkey:new tM(t),isSigner:!1,isWritable:!1})});let s=[];n.forEach(t=>{let e=t.pubkey.toString(),r=s.findIndex(t=>t.pubkey.toString()===e);r>-1?(s[r].isWritable=s[r].isWritable||t.isWritable,s[r].isSigner=s[r].isSigner||t.isSigner):s.push(t)}),s.sort(function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});let o=s.findIndex(t=>t.pubkey.equals(r));if(o>-1){let[t]=s.splice(o,1);t.isSigner=!0,t.isWritable=!0,s.unshift(t)}else s.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let t of this.signatures){let e=s.findIndex(e=>e.pubkey.equals(t.publicKey));if(e>-1)s[e].isSigner||(s[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw Error(`unknown signer: ${t.publicKey.toString()}`)}let a=0,u=0,l=0,c=[],h=[];s.forEach(({pubkey:t,isSigner:e,isWritable:r})=>{e?(c.push(t.toString()),a+=1,r||(u+=1)):(h.push(t.toString()),r||(l+=1))});let f=c.concat(h),d=e.map(t=>{let{data:e,programId:r}=t;return{programIdIndex:f.indexOf(r.toString()),accounts:t.keys.map(t=>f.indexOf(t.pubkey.toString())),data:C.default.encode(e)}});return d.forEach(t=>{tN(t.programIdIndex>=0),t.accounts.forEach(t=>tN(t>=0))}),new tj({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:l},accountKeys:f,recentBlockhash:t,instructions:d})}_compile(){let t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((t,r)=>e[r].equals(t.publicKey))?t:(this.signatures=e.map(t=>({signature:null,publicKey:t})),t)}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw Error("No signers");let e=new Set;this.signatures=t.filter(t=>{let r=t.toString();return!e.has(r)&&(e.add(r),!0)}).map(t=>({signature:null,publicKey:t}))}sign(...t){if(0===t.length)throw Error("No signers");let e=new Set,r=[];for(let i of t){let t=i.publicKey.toString();e.has(t)||(e.add(t),r.push(i))}this.signatures=r.map(t=>({signature:null,publicKey:t.publicKey}));let i=this._compile();this._partialSign(i,...r)}partialSign(...t){if(0===t.length)throw Error("No signers");let e=new Set,r=[];for(let i of t){let t=i.publicKey.toString();e.has(t)||(e.add(t),r.push(i))}let i=this._compile();this._partialSign(i,...r)}_partialSign(t,...e){let r=t.serialize();e.forEach(t=>{let e=tx(r,t.secretKey);this._addSignature(t.publicKey,tB(e))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){tN(64===e.length);let r=this.signatures.findIndex(e=>t.equals(e.publicKey));if(r<0)throw Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=o.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let r={};for(let{signature:i,publicKey:n}of this.signatures)null===i?e&&(r.missing||=[]).push(n):t_(i,t,n.toBytes())||(r.invalid||=[]).push(n);return r.invalid||r.missing?r:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),i=this.serializeMessage();if(r){let t=this._getMessageSignednessErrors(i,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=` 2Invalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map(t=>t.toBase58()).join("`, `")}\`].`),t.missing&&(e+=` 3Missing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map(t=>t.toBase58()).join("`, `")}\`].`),Error(e)}}return this._serialize(i)}_serialize(t){let{signatures:e}=this,r=[];tz(r,e.length);let i=r.length+64*e.length+t.length,n=o.Buffer.alloc(i);return tN(e.length<256),o.Buffer.from(r).copy(n,0),e.forEach(({signature:t},e)=>{null!==t&&(tN(64===t.length,"signature has invalid length"),o.Buffer.from(t).copy(n,r.length+64*e))}),t.copy(n,r.length+64*e.length),tN(n.length<=1232,`Transaction too large: ${n.length} > 1232`),n}get keys(){return tN(1===this.instructions.length),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return tN(1===this.instructions.length),this.instructions[0].programId}get data(){return tN(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t],r=tO(e),i=[];for(let t=0;t<r;t++){let t=t$(e,0,64);i.push(C.default.encode(o.Buffer.from(t)))}return tZ.populate(tj.from(e),i)}static populate(t,e=[]){let r=new tZ;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),e.forEach((e,i)=>{let n={signature:e==C.default.encode(tV)?null:C.default.decode(e),publicKey:t.accountKeys[i]};r.signatures.push(n)}),t.instructions.forEach(e=>{let i=e.accounts.map(e=>{let i=t.accountKeys[e];return{pubkey:i,isSigner:r.signatures.some(t=>t.publicKey.toString()===i.toString())||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}});r.instructions.push(new tG({keys:i,programId:t.accountKeys[e.programIdIndex],data:C.default.decode(e.data)}))}),r._message=t,r._json=r.toJSON(),r}}class tJ{get version(){return this.message.version}constructor(t,e){if(this.signatures=void 0,this.message=void 0,void 0!==e)tN(e.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=e;else{const e=[];for(let r=0;r<t.header.numRequiredSignatures;r++)e.push(new Uint8Array(64));this.signatures=e}this.message=t}serialize(){let t=this.message.serialize(),e=[];tz(e,this.signatures.length);let r=z.struct([z.blob(e.length,"encodedSignaturesLength"),z.seq(((t="signature")=>z.blob(64,t))(),this.signatures.length,"signatures"),z.blob(t.length,"serializedMessage")]),i=new Uint8Array(2048),n=r.encode({encodedSignaturesLength:new Uint8Array(e),signatures:this.signatures,serializedMessage:t},i);return i.slice(0,n)}static deserialize(t){let e=[...t],r=[],i=tO(e);for(let t=0;t<i;t++)r.push(new Uint8Array(t$(e,0,64)));return new tJ(tD.deserialize(new Uint8Array(e)),r)}sign(t){let e=this.message.serialize(),r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let i of t){let t=r.findIndex(t=>t.equals(i.publicKey));tN(t>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[t]=tx(e,i.secretKey)}}addSignature(t,e){tN(64===e.byteLength,"Signature must be 64 bytes long");let r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(e=>e.equals(t));tN(r>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[r]=e}}let tY=new tM("SysvarC1ock11111111111111111111111111111111");new tM("SysvarEpochSchedu1e111111111111111111111111"),new tM("Sysvar1nstructions1111111111111111111111111");let tX=new tM("SysvarRecentB1ockHashes11111111111111111111"),tQ=new tM("SysvarRent111111111111111111111111111111111");new tM("SysvarRewards111111111111111111111111111111"),new tM("SysvarS1otHashes111111111111111111111111111"),new tM("SysvarS1otHistory11111111111111111111111111");let t0=new tM("SysvarStakeHistory1111111111111111111111111");class t1 extends Error{constructor({action:t,signature:e,transactionMessage:r,logs:i}){let n;const s=i?`Logs: 4${JSON.stringify(i.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";switch(t){case"send":n=`Transaction ${e} resulted in an error. 5${r}. `+s+o;break;case"simulate":n=`Simulation failed. 6Message: ${r}. 7`+s+o;break;default:n=`Unknown action '${(t=>t)(t)}'`}super(n),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=r,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let t=this.transactionLogs;if(null==t||"object"!=typeof t||!("then"in t))return t}async getLogs(t){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((e,r)=>{t.getTransaction(this.signature).then(t=>{if(t&&t.meta&&t.meta.logMessages){let r=t.meta.logMessages;this.transactionLogs=r,e(r)}else r(Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}}class t2 extends Error{constructor({code:t,message:e,data:r},i){super(null!=i?`${i}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=r,this.name="SolanaJSONRPCError"}}async function t6(t,e,r,i){let n,s=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},o=await t.sendTransaction(e,r,s);if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)n=(await t.confirmTransaction({abortSignal:i?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},i&&i.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){let{nonceInstruction:r}=e.nonceInfo,s=r.keys[0].pubkey;n=(await t.confirmTransaction({abortSignal:i?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:s,nonceValue:e.nonceInfo.nonce,signature:o},i&&i.commitment)).value}else i?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),n=(await t.confirmTransaction(o,i&&i.commitment)).value;if(n.err){if(null!=o)throw new t1({action:"send",signature:o,transactionMessage:`Status: (${JSON.stringify(n)})`});throw Error(`Transaction ${o} failed (${JSON.stringify(n)})`)}return o}function t3(t){return new Promise(e=>setTimeout(e,t))}function t5(t,e){let r=t.layout.span>=0?t.layout.span:function t(e,r){let i=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(r[e.property]);if("count"in e&&"elementLayout"in e){let t=r[e.property];if(Array.isArray(t))return t.length*i(e.elementLayout)}else if("fields"in e)return t({layout:e},r[e.property]);return 0},n=0;return e.layout.fields.forEach(t=>{n+=i(t)}),n}(t,e),i=o.Buffer.alloc(r),n=Object.assign({instruction:t.index},e);return t.layout.encode(n,i),i}let t8=z.nu64("lamportsPerSignature"),t4=z.struct([z.u32("version"),z.u32("state"),tC("authorizedPubkey"),tC("nonce"),z.struct([t8],"feeCalculator")]),t9=t4.span;class t7{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){let e=t4.decode(tB(t),0);return new t7({authorizedPubkey:new tM(e.authorizedPubkey),nonce:new tM(e.nonce).toString(),feeCalculator:e.feeCalculator})}}function et(t){let e=(0,z.blob)(8,t),r=e.decode.bind(e),i=e.encode.bind(e),n=((t={})=>(function(t,e){if(q(t)!==q(e))throw new W(8078004);if(q(t)&&q(e)&&t.fixedSize!==e.fixedSize)throw new W(8078005,{decoderFixedSize:e.fixedSize,encoderFixedSize:t.fixedSize});if(!q(t)&&!q(e)&&t.maxSize!==e.maxSize)throw new W(8078006,{decoderMaxSize:e.maxSize,encoderMaxSize:t.maxSize});return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}})(((t={})=>{var e,r;return Object.freeze({...r={fixedSize:(e={config:t,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}).size,write(t,r,i){e.range&&function(t,e,r,i){if(i<e||i>r)throw new W(8078011,{codecDescription:t,max:r,min:e,value:i})}(e.name,e.range[0],e.range[1],t);let n=new ArrayBuffer(e.size);return e.set(new DataView(n),t,$(e.config)),r.set(new Uint8Array(n),i),i+e.size}},encode:t=>{let e=new Uint8Array("fixedSize"in r?r.fixedSize:r.getSizeFromValue(t));return r.write(t,e,0),e}})})(t),((t={})=>{var e,r;return Object.freeze({...r={fixedSize:(e={config:t,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}).size,read(t,r=0){var i,n,s;let o,a;!function(t,e,r=0){if(e.length-r<=0)throw new W(8078e3,{codecDescription:t})}(e.name,t,r),function(t,e,r,i=0){let n=r.length-i;if(n<e)throw new W(8078001,{bytesLength:n,codecDescription:t,expected:e})}(e.name,e.size,t,r);let u=new DataView((i=t,n=r,s=e.size,o=i.byteOffset+(n??0),a=s??i.byteLength,i.buffer.slice(o,o+a)));return[e.get(u,$(e.config)),r+e.size]}},decode:(t,e=0)=>r.read(t,e)[0]})})(t)))();return e.decode=(t,e)=>{let i=r(t,e);return n.decode(i)},e.encode=(t,e,r)=>i(n.encode(t),e,r),e}let ee=Object.freeze({Create:{index:0,layout:z.struct([z.u32("instruction"),z.ns64("lamports"),z.ns64("space"),tC("programId")])},Assign:{index:1,layout:z.struct([z.u32("instruction"),tC("programId")])},Transfer:{index:2,layout:z.struct([z.u32("instruction"),et("lamports")])},CreateWithSeed:{index:3,layout:z.struct([z.u32("instruction"),tC("base"),tU("seed"),z.ns64("lamports"),z.ns64("space"),tC("programId")])},AdvanceNonceAccount:{index:4,layout:z.struct([z.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:z.struct([z.u32("instruction"),tC("authorized")])},AuthorizeNonceAccount:{index:7,layout:z.struct([z.u32("instruction"),tC("authorized")])},Allocate:{index:8,layout:z.struct([z.u32("instruction"),z.ns64("space")])},AllocateWithSeed:{index:9,layout:z.struct([z.u32("instruction"),tC("base"),tU("seed"),z.ns64("space"),tC("programId")])},AssignWithSeed:{index:10,layout:z.struct([z.u32("instruction"),tC("base"),tU("seed"),tC("programId")])},TransferWithSeed:{index:11,layout:z.struct([z.u32("instruction"),et("lamports"),tU("seed"),tC("programId")])},UpgradeNonceAccount:{index:12,layout:z.struct([z.u32("instruction")])}});class er{static createAccount(t){let e=t5(ee.Create,{lamports:t.lamports,space:t.space,programId:tB(t.programId.toBuffer())});return new tG({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,r;return"basePubkey"in t?(e=t5(ee.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:tB(t.programId.toBuffer())}),r=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=t5(ee.Transfer,{lamports:BigInt(t.lamports)}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new tG({keys:r,programId:this.programId,data:e})}static assign(t){let e,r;return"basePubkey"in t?(e=t5(ee.AssignWithSeed,{base:tB(t.basePubkey.toBuffer()),seed:t.seed,programId:tB(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=t5(ee.Assign,{programId:tB(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tG({keys:r,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=t5(ee.CreateWithSeed,{base:tB(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:tB(t.programId.toBuffer())}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey.equals(t.fromPubkey)||r.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new tG({keys:r,programId:this.programId,data:e})}static createNonceAccount(t){let e=new tZ;"basePubkey"in t&&"seed"in t?e.add(er.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:t9,programId:this.programId})):e.add(er.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:t9,programId:this.programId}));let r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(r)),e}static nonceInitialize(t){let e=t5(ee.InitializeNonceAccount,{authorized:tB(t.authorizedPubkey.toBuffer())});return new tG({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tX,isSigner:!1,isWritable:!1},{pubkey:tQ,isSigner:!1,isWritable:!1}],programId:this.programId,data:e})}static nonceAdvance(t){let e=t5(ee.AdvanceNonceAccount);return new tG({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tX,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceWithdraw(t){let e=t5(ee.WithdrawNonceAccount,{lamports:t.lamports});return new tG({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:tX,isSigner:!1,isWritable:!1},{pubkey:tQ,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){let e=t5(ee.AuthorizeNonceAccount,{authorized:tB(t.newAuthorizedPubkey.toBuffer())});return new tG({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,r;return"basePubkey"in t?(e=t5(ee.AllocateWithSeed,{base:tB(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:tB(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=t5(ee.Allocate,{space:t.space}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tG({keys:r,programId:this.programId,data:e})}}er.programId=new tM("11111111111111111111111111111111");class ei{static getMinNumSignatures(t){return 2*(Math.ceil(t/ei.chunkSize)+1+1)}static async load(t,e,r,i,n){{let s=await t.getMinimumBalanceForRentExemption(n.length),o=await t.getAccountInfo(r.publicKey,"confirmed"),a=null;if(null!==o){if(o.executable)return console.error("Program load failed, account is already executable"),!1;o.data.length!==n.length&&(a=a||new tZ).add(er.allocate({accountPubkey:r.publicKey,space:n.length})),o.owner.equals(i)||(a=a||new tZ).add(er.assign({accountPubkey:r.publicKey,programId:i})),o.lamports<s&&(a=a||new tZ).add(er.transfer({fromPubkey:e.publicKey,toPubkey:r.publicKey,lamports:s-o.lamports}))}else a=new tZ().add(er.createAccount({fromPubkey:e.publicKey,newAccountPubkey:r.publicKey,lamports:s>0?s:1,space:n.length,programId:i}));null!==a&&await t6(t,a,[e,r],{commitment:"confirmed"})}let s=z.struct([z.u32("instruction"),z.u32("offset"),z.u32("bytesLength"),z.u32("bytesLengthPadding"),z.seq(z.u8("byte"),z.offset(z.u32(),-8),"bytes")]),a=ei.chunkSize,u=0,l=n,c=[];for(;l.length>0;){let n=l.slice(0,a),h=o.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:n,bytesLength:0,bytesLengthPadding:0},h);let f=new tZ().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:h});c.push(t6(t,f,[e,r],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await t3(250),u+=a,l=l.slice(a)}await Promise.all(c);{let n=z.struct([z.u32("instruction")]),s=o.Buffer.alloc(n.span);n.encode({instruction:1},s);let a=new tZ().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:tQ,isSigner:!1,isWritable:!1}],programId:i,data:s}),u="processed",l=await t.sendTransaction(a,[e,r],{preflightCommitment:u}),{context:c,value:h}=await t.confirmTransaction({signature:l,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(h.err)throw Error(`Transaction ${l} failed (${JSON.stringify(h)})`);for(;;){try{if(await t.getSlot({commitment:u})>c.slot)break}catch{}await new Promise(t=>setTimeout(t,Math.round(200)))}}return!0}}ei.chunkSize=932,new tM("BPFLoader2111111111111111111111111111111111");var en=(i=function(){if(s)return n;s=1;var t=Object.prototype.toString,e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};return n=function(r){var i=function r(i,n){var s,o,a,u,l,c,h;if(!0===i)return"true";if(!1===i)return"false";switch(typeof i){case"object":if(null===i)return null;if(i.toJSON&&"function"==typeof i.toJSON)return r(i.toJSON(),n);if("[object Array]"===(h=t.call(i))){for(s=0,a="[",o=i.length-1;s<o;s++)a+=r(i[s],!0)+",";return o>-1&&(a+=r(i[s],!0)),a+"]"}if("[object Object]"!==h)return JSON.stringify(i);for(o=(u=e(i).sort()).length,a="",s=0;s<o;)void 0!==(c=r(i[l=u[s]],!1))&&(a&&(a+=","),a+=JSON.stringify(l)+":"+c),s++;return"{"+a+"}";case"function":case"undefined":return n?null:void 0;case"string":return JSON.stringify(i);default:return isFinite(i)?i:null}}(r,!1);if(void 0!==i)return""+i}}())&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;function es(t){let e=0;for(;t>1;)t/=2,e++;return e}class eo{constructor(t,e,r,i,n){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=n}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){var e;let r=es(0===(e=t+32+1)?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,(e|=e>>32)+1))-es(32)-1,i=this.getSlotsInEpoch(r);return[r,t-(i-32)]}{let e=t-this.firstNormalSlot,r=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+r,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?(Math.pow(2,t)-1)*32:(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t<this.firstNormalEpoch?Math.pow(2,t+es(32)):this.slotsPerEpoch}}var ea=globalThis.fetch;class eu extends ty{constructor(t,e,r){super(t=>{let r=new tg(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return"socket"in r?this.underlyingSocket=r.socket:this.underlyingSocket=r,r},t,e,r),this.underlyingSocket=void 0}call(...t){let e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){let e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class el{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){let t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){let e=function(t,e){let r;try{r=t.layout.decode(e)}catch(t){throw Error("invalid instruction; "+t)}if(r.typeIndex!==t.index)throw Error(`invalid account data; account type mismatch ${r.typeIndex} != ${t.index}`);return r}(ec,t),r=t.length-56;tN(r>=0,"lookup table is invalid"),tN(r%32==0,"lookup table is invalid");let{addresses:i}=z.struct([z.seq(tC(),r/32,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new tM(e.authority[0]):void 0,addresses:i.map(t=>new tM(t))}}}let ec={index:1,layout:z.struct([z.u32("typeIndex"),et("deactivationSlot"),z.nu64("lastExtendedSlot"),z.u8("lastExtendedStartIndex"),z.u8(),z.seq(tC(),z.offset(z.u8(),-1),"authority")])},eh=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,ef=tf(te(tM),ta(),t=>new tM(t)),ed=tu([ta(),tr("base64")]),ep=tf(te(o.Buffer),ed,t=>o.Buffer.from(t[0],"base64"));function eg(t){let e,r;if("string"==typeof t)e=t;else if(t){let{commitment:i,...n}=t;e=i,r=n}return{commitment:e,config:r}}function em(t){return t.map(t=>"memcmp"in t?{...t,memcmp:{...t.memcmp,encoding:t.memcmp.encoding??"base58"}}:t)}function ey(t){return tc([tl({jsonrpc:tr("2.0"),id:ta(),result:t}),tl({jsonrpc:tr("2.0"),id:ta(),error:tl({code:th(),message:ta(),data:ts(X("any",()=>!0))})})])}let eb=ey(th());function ew(t){return tf(ey(t),eb,e=>"error"in e?e:{...e,result:J(e.result,t)})}function ev(t){return ew(tl({context:tl({slot:tn()}),value:t}))}function ek(t){return tl({context:tl({slot:tn()}),value:t})}function eS(t,e){return 0===t?new tF({header:e.header,staticAccountKeys:e.accountKeys.map(t=>new tM(t)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:C.default.decode(t.data)})),addressTableLookups:e.addressTableLookups}):new tj(e)}let ex=tl({foundation:tn(),foundationTerm:tn(),initial:tn(),taper:tn(),terminal:tn()}),e_=ew(Q(ti(tl({epoch:tn(),effectiveSlot:tn(),amount:tn(),postBalance:tn(),commission:ts(ti(tn()))})))),eB=Q(tl({slot:tn(),prioritizationFee:tn()})),eI=tl({total:tn(),validator:tn(),foundation:tn(),epoch:tn()}),eA=tl({epoch:tn(),slotIndex:tn(),slotsInEpoch:tn(),absoluteSlot:tn(),blockHeight:ts(tn()),transactionCount:ts(tn())}),eE=tl({slotsPerEpoch:tn(),leaderScheduleSlotOffset:tn(),warmup:tt(),firstNormalEpoch:tn(),firstNormalSlot:tn()}),eM=to(ta(),Q(tn())),eT=ti(tc([tl({}),ta()])),eP=tl({err:eT}),eR=tr("receivedSignature"),eL=tl({"solana-core":ta(),"feature-set":ts(tn())}),eC=tl({program:ta(),programId:ef,parsed:th()}),eU=tl({programId:ef,accounts:Q(ef),data:ta()}),eO=ev(tl({err:ti(tc([tl({}),ta()])),logs:ti(Q(ta())),accounts:ts(ti(Q(ti(tl({executable:tt(),owner:ta(),lamports:tn(),data:Q(ta()),rentEpoch:ts(tn())}))))),unitsConsumed:ts(tn()),returnData:ts(ti(tl({programId:ta(),data:tu([ta(),tr("base64")])}))),innerInstructions:ts(ti(Q(tl({index:tn(),instructions:Q(tc([eC,eU]))}))))})),ez=ev(tl({byIdentity:to(ta(),Q(tn())),range:tl({firstSlot:tn(),lastSlot:tn()})})),eN=ew(ex),eW=ew(eI),eq=ew(eB),eK=ew(eA),e$=ew(eE),ej=ew(eM),eF=ew(tn()),eD=ev(tl({total:tn(),circulating:tn(),nonCirculating:tn(),nonCirculatingAccounts:Q(ef)})),eH=tl({amount:ta(),uiAmount:ti(tn()),decimals:tn(),uiAmountString:ts(ta())}),eV=ev(Q(tl({address:ef,amount:ta(),uiAmount:ti(tn()),decimals:tn(),uiAmountString:ts(ta())}))),eG=ev(Q(tl({pubkey:ef,account:tl({executable:tt(),owner:ef,lamports:tn(),data:ep,rentEpoch:tn()})}))),eZ=tl({program:ta(),parsed:th(),space:tn()}),eJ=ev(Q(tl({pubkey:ef,account:tl({executable:tt(),owner:ef,lamports:tn(),data:eZ,rentEpoch:tn()})}))),eY=ev(Q(tl({lamports:tn(),address:ef}))),eX=tl({executable:tt(),owner:ef,lamports:tn(),data:ep,rentEpoch:tn()}),eQ=tl({pubkey:ef,account:eX}),e0=tf(tc([te(o.Buffer),eZ]),tc([ed,eZ]),t=>Array.isArray(t)?J(t,ep):t),e1=tl({executable:tt(),owner:ef,lamports:tn(),data:e0,rentEpoch:tn()}),e2=tl({pubkey:ef,account:e1}),e6=tl({state:tc([tr("active"),tr("inactive"),tr("activating"),tr("deactivating")]),active:tn(),inactive:tn()}),e3=ew(Q(tl({signature:ta(),slot:tn(),err:eT,memo:ti(ta()),blockTime:ts(ti(tn()))}))),e5=ew(Q(tl({signature:ta(),slot:tn(),err:eT,memo:ti(ta()),blockTime:ts(ti(tn()))}))),e8=tl({subscription:tn(),result:ek(eX)}),e4=tl({pubkey:ef,account:eX}),e9=tl({subscription:tn(),result:ek(e4)}),e7=tl({parent:tn(),slot:tn(),root:tn()}),rt=tl({subscription:tn(),result:e7}),re=tc([tl({type:tc([tr("firstShredReceived"),tr("completed"),tr("optimisticConfirmation"),tr("root")]),slot:tn(),timestamp:tn()}),tl({type:tr("createdBank"),parent:tn(),slot:tn(),timestamp:tn()}),tl({type:tr("frozen"),slot:tn(),timestamp:tn(),stats:tl({numTransactionEntries:tn(),numSuccessfulTransactions:tn(),numFailedTransactions:tn(),maxTransactionsPerEntry:tn()})}),tl({type:tr("dead"),slot:tn(),timestamp:tn(),err:ta()})]),rr=tl({subscription:tn(),result:re}),ri=tl({subscription:tn(),result:ek(tc([eP,eR]))}),rn=tl({subscription:tn(),result:tn()}),rs=tl({pubkey:ta(),gossip:ti(ta()),tpu:ti(ta()),rpc:ti(ta()),version:ti(ta())}),ro=tl({votePubkey:ta(),nodePubkey:ta(),activatedStake:tn(),epochVoteAccount:tt(),epochCredits:Q(tu([tn(),tn(),tn()])),commission:tn(),lastVote:tn(),rootSlot:ti(tn())}),ra=ew(tl({current:Q(ro),delinquent:Q(ro)})),ru=tc([tr("processed"),tr("confirmed"),tr("finalized")]),rl=tl({slot:tn(),confirmations:ti(tn()),err:eT,confirmationStatus:ts(ru)}),rc=ev(Q(ti(rl))),rh=ew(tn()),rf=tl({accountKey:ef,writableIndexes:Q(tn()),readonlyIndexes:Q(tn())}),rd=tl({signatures:Q(ta()),message:tl({accountKeys:Q(ta()),header:tl({numRequiredSignatures:tn(),numReadonlySignedAccounts:tn(),numReadonlyUnsignedAccounts:tn()}),instructions:Q(tl({accounts:Q(tn()),data:ta(),programIdIndex:tn()})),recentBlockhash:ta(),addressTableLookups:ts(Q(rf))})}),rp=tl({pubkey:ef,signer:tt(),writable:tt(),source:ts(tc([tr("transaction"),tr("lookupTable")]))}),rg=tl({accountKeys:Q(rp),signatures:Q(ta())}),rm=tl({parsed:th(),program:ta(),programId:ef}),ry=tl({accounts:Q(ef),data:ta(),programId:ef}),rb=tf(tc([ry,rm]),tc([tl({parsed:th(),program:ta(),programId:ta()}),tl({accounts:Q(ta()),data:ta(),programId:ta()})]),t=>"accounts"in t?J(t,ry):J(t,rm)),rw=tl({signatures:Q(ta()),message:tl({accountKeys:Q(rp),instructions:Q(rb),recentBlockhash:ta(),addressTableLookups:ts(ti(Q(rf)))})}),rv=tl({accountIndex:tn(),mint:ta(),owner:ts(ta()),programId:ts(ta()),uiTokenAmount:eH}),rk=tl({writable:Q(ef),readonly:Q(ef)}),rS=tl({err:eT,fee:tn(),innerInstructions:ts(ti(Q(tl({index:tn(),instructions:Q(tl({accounts:Q(tn()),data:ta(),programIdIndex:tn()}))})))),preBalances:Q(tn()),postBalances:Q(tn()),logMessages:ts(ti(Q(ta()))),preTokenBalances:ts(ti(Q(rv))),postTokenBalances:ts(ti(Q(rv))),loadedAddresses:ts(rk),computeUnitsConsumed:ts(tn()),costUnits:ts(tn())}),rx=tl({err:eT,fee:tn(),innerInstructions:ts(ti(Q(tl({index:tn(),instructions:Q(rb)})))),preBalances:Q(tn()),postBalances:Q(tn()),logMessages:ts(ti(Q(ta()))),preTokenBalances:ts(ti(Q(rv))),postTokenBalances:ts(ti(Q(rv))),loadedAddresses:ts(rk),computeUnitsConsumed:ts(tn()),costUnits:ts(tn())}),r_=tc([tr(0),tr("legacy")]),rB=tl({pubkey:ta(),lamports:tn(),postBalance:ti(tn()),rewardType:ti(ta()),commission:ts(ti(tn()))}),rI=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),transactions:Q(tl({transaction:rd,meta:ti(rS),version:ts(r_)})),rewards:ts(Q(rB)),blockTime:ti(tn()),blockHeight:ti(tn())}))),rA=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),rewards:ts(Q(rB)),blockTime:ti(tn()),blockHeight:ti(tn())}))),rE=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),transactions:Q(tl({transaction:rg,meta:ti(rS),version:ts(r_)})),rewards:ts(Q(rB)),blockTime:ti(tn()),blockHeight:ti(tn())}))),rM=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),transactions:Q(tl({transaction:rw,meta:ti(rx),version:ts(r_)})),rewards:ts(Q(rB)),blockTime:ti(tn()),blockHeight:ti(tn())}))),rT=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),transactions:Q(tl({transaction:rg,meta:ti(rx),version:ts(r_)})),rewards:ts(Q(rB)),blockTime:ti(tn()),blockHeight:ti(tn())}))),rP=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),rewards:ts(Q(rB)),blockTime:ti(tn()),blockHeight:ti(tn())}))),rR=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),transactions:Q(tl({transaction:rd,meta:ti(rS)})),rewards:ts(Q(rB)),blockTime:ti(tn())}))),rL=ew(ti(tl({blockhash:ta(),previousBlockhash:ta(),parentSlot:tn(),signatures:Q(ta()),blockTime:ti(tn())}))),rC=ew(ti(tl({slot:tn(),meta:ti(rS),blockTime:ts(ti(tn())),transaction:rd,version:ts(r_)}))),rU=ew(ti(tl({slot:tn(),transaction:rw,meta:ti(rx),blockTime:ts(ti(tn())),version:ts(r_)}))),rO=ev(tl({blockhash:ta(),lastValidBlockHeight:tn()})),rz=ev(tt()),rN=ew(Q(tl({slot:tn(),numTransactions:tn(),numSlots:tn(),samplePeriodSecs:tn()}))),rW=ev(ti(tl({feeCalculator:tl({lamportsPerSignature:tn()})}))),rq=ew(ta()),rK=ew(ta()),r$=tl({err:eT,logs:Q(ta()),signature:ta()}),rj=tl({result:ek(r$),subscription:tn()}),rF={"solana-client":"js/1.0.0-maintenance"};class rD{constructor(t){this._keypair=void 0,this._keypair=t??tv()}static generate(){return new rD(tv())}static fromSecretKey(t,e){if(64!==t.byteLength)throw Error("bad secret key size");let r=t.slice(32,64);if(!e||!e.skipValidation){let e=tk(t.slice(0,32));for(let t=0;t<32;t++)if(r[t]!==e[t])throw Error("provided secretKey is invalid")}return new rD({publicKey:r,secretKey:t})}static fromSeed(t){let e=tk(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),new rD({publicKey:e,secretKey:r})}get publicKey(){return new tM(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:z.struct([z.u32("instruction"),et("recentSlot"),z.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:z.struct([z.u32("instruction")])},ExtendLookupTable:{index:2,layout:z.struct([z.u32("instruction"),et(),z.seq(tC(),z.offset(z.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:z.struct([z.u32("instruction")])},CloseLookupTable:{index:4,layout:z.struct([z.u32("instruction")])}}),new tM("AddressLookupTab1e1111111111111111111111111");let rH=Object.freeze({RequestUnits:{index:0,layout:z.struct([z.u8("instruction"),z.u32("units"),z.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:z.struct([z.u8("instruction"),z.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:z.struct([z.u8("instruction"),z.u32("units")])},SetComputeUnitPrice:{index:3,layout:z.struct([z.u8("instruction"),et("microLamports")])}});class rV{static requestUnits(t){let e=t5(rH.RequestUnits,t);return new tG({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){let e=t5(rH.RequestHeapFrame,t);return new tG({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){let e=t5(rH.SetComputeUnitLimit,t);return new tG({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){let e=t5(rH.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new tG({keys:[],programId:this.programId,data:e})}}rV.programId=new tM("ComputeBudget111111111111111111111111111111");let rG=z.struct([z.u8("numSignatures"),z.u8("padding"),z.u16("signatureOffset"),z.u16("signatureInstructionIndex"),z.u16("publicKeyOffset"),z.u16("publicKeyInstructionIndex"),z.u16("messageDataOffset"),z.u16("messageDataSize"),z.u16("messageInstructionIndex")]);class rZ{static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,instructionIndex:n}=t;tN(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),tN(64===i.length,`Signature must be 64 bytes but received ${i.length} bytes`);let s=rG.span,a=s+e.length,u=a+i.length,l=o.Buffer.alloc(u+r.length),c=null==n?65535:n;return rG.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:c,publicKeyOffset:s,publicKeyInstructionIndex:c,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:c},l),l.fill(e,s),l.fill(i,a),l.fill(r,u),new tG({keys:[],programId:rZ.programId,data:l})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;tN(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{let t=rD.fromSecretKey(e),n=t.publicKey.toBytes(),s=tx(r,t.secretKey);return this.createInstructionWithPublicKey({publicKey:n,message:r,signature:s,instructionIndex:i})}catch(t){throw Error(`Error creating instruction; ${t}`)}}}rZ.programId=new tM("Ed25519SigVerify111111111111111111111111111"),tw.secp256k1.utils.isValidPrivateKey;let rJ=tw.secp256k1.getPublicKey,rY=z.struct([z.u8("numSignatures"),z.u16("signatureOffset"),z.u8("signatureInstructionIndex"),z.u16("ethAddressOffset"),z.u8("ethAddressInstructionIndex"),z.u16("messageDataOffset"),z.u16("messageDataSize"),z.u8("messageInstructionIndex"),z.blob(20,"ethAddress"),z.blob(64,"signature"),z.u8("recoveryId")]);class rX{static publicKeyToEthAddress(t){tN(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return o.Buffer.from((0,tb.keccak_256)(tB(t))).slice(-20)}catch(t){throw Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,recoveryId:n,instructionIndex:s}=t;return rX.createInstructionWithEthAddress({ethAddress:rX.publicKeyToEthAddress(e),message:r,signature:i,recoveryId:n,instructionIndex:s})}static createInstructionWithEthAddress(t){let e,{ethAddress:r,message:i,signature:n,recoveryId:s,instructionIndex:a=0}=t;tN(20===(e="string"==typeof r?r.startsWith("0x")?o.Buffer.from(r.substr(2),"hex"):o.Buffer.from(r,"hex"):r).length,`Address must be 20 bytes but received ${e.length} bytes`);let u=12+e.length,l=u+n.length+1,c=o.Buffer.alloc(rY.span+i.length);return rY.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:a,ethAddressOffset:12,ethAddressInstructionIndex:a,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:a,signature:tB(n),ethAddress:tB(e),recoveryId:s},c),c.fill(tB(i),rY.span),new tG({keys:[],programId:rX.programId,data:c})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;tN(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{var n;let t,s=tB(e),a=rJ(s,!1).slice(1),[u,l]=(n=o.Buffer.from((0,tb.keccak_256)(tB(r))),[(t=tw.secp256k1.sign(n,s)).toCompactRawBytes(),t.recovery]);return this.createInstructionWithPublicKey({publicKey:a,message:r,signature:u,recoveryId:l,instructionIndex:i})}catch(t){throw Error(`Error creating instruction; ${t}`)}}}rX.programId=new tM("KeccakSecp256k11111111111111111111111111111");let rQ=new tM("StakeConfig11111111111111111111111111111111");class r0{constructor(t,e,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=r}}r0.default=new r0(0,0,tM.default);let r1=Object.freeze({Initialize:{index:0,layout:z.struct([z.u32("instruction"),((t="authorized")=>z.struct([tC("staker"),tC("withdrawer")],t))(),((t="lockup")=>z.struct([z.ns64("unixTimestamp"),z.ns64("epoch"),tC("custodian")],t))()])},Authorize:{index:1,layout:z.struct([z.u32("instruction"),tC("newAuthorized"),z.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:z.struct([z.u32("instruction")])},Split:{index:3,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},Withdraw:{index:4,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},Deactivate:{index:5,layout:z.struct([z.u32("instruction")])},Merge:{index:7,layout:z.struct([z.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:z.struct([z.u32("instruction"),tC("newAuthorized"),z.u32("stakeAuthorizationType"),tU("authoritySeed"),tC("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class r2{static initialize(t){let{stakePubkey:e,authorized:r,lockup:i}=t,n=i||r0.default,s=t5(r1.Initialize,{authorized:{staker:tB(r.staker.toBuffer()),withdrawer:tB(r.withdrawer.toBuffer())},lockup:{unixTimestamp:n.unixTimestamp,epoch:n.epoch,custodian:tB(n.custodian.toBuffer())}});return new tG({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tQ,isSigner:!1,isWritable:!1}],programId:this.programId,data:s})}static createAccountWithSeed(t){let e=new tZ;e.add(er.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static createAccount(t){let e=new tZ;e.add(er.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:r,votePubkey:i}=t,n=t5(r1.Delegate);return new tZ().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:tY,isSigner:!1,isWritable:!1},{pubkey:t0,isSigner:!1,isWritable:!1},{pubkey:rQ,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static authorize(t){let{stakePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,stakeAuthorizationType:n,custodianPubkey:s}=t,o=t5(r1.Authorize,{newAuthorized:tB(i.toBuffer()),stakeAuthorizationType:n.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tY,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new tZ().add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:r,authoritySeed:i,authorityOwner:n,newAuthorizedPubkey:s,stakeAuthorizationType:o,custodianPubkey:a}=t,u=t5(r1.AuthorizeWithSeed,{newAuthorized:tB(s.toBuffer()),stakeAuthorizationType:o.index,authoritySeed:i,authorityOwner:tB(n.toBuffer())}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:tY,isSigner:!1,isWritable:!1}];return a&&l.push({pubkey:a,isSigner:!0,isWritable:!1}),new tZ().add({keys:l,programId:this.programId,data:u})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:r,splitStakePubkey:i,lamports:n}=t,s=t5(r1.Split,{lamports:n});return new tG({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(t,e){let r=new tZ;return r.add(er.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),r.add(this.splitInstruction(t))}static splitWithSeed(t,e){let{stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,basePubkey:s,seed:o,lamports:a}=t,u=new tZ;return u.add(er.allocate({accountPubkey:n,basePubkey:s,seed:o,space:this.space,programId:this.programId})),e&&e>0&&u.add(er.transfer({fromPubkey:t.authorizedPubkey,toPubkey:n,lamports:e})),u.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,lamports:a}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:r,authorizedPubkey:i}=t,n=t5(r1.Merge);return new tZ().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:tY,isSigner:!1,isWritable:!1},{pubkey:t0,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:r,toPubkey:i,lamports:n,custodianPubkey:s}=t,o=t5(r1.Withdraw,{lamports:n}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:tY,isSigner:!1,isWritable:!1},{pubkey:t0,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new tZ().add({keys:a,programId:this.programId,data:o})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:r}=t,i=t5(r1.Deactivate);return new tZ().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tY,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}}r2.programId=new tM("Stake11111111111111111111111111111111111111"),r2.space=200;let r6=Object.freeze({InitializeAccount:{index:0,layout:z.struct([z.u32("instruction"),((t="voteInit")=>z.struct([tC("nodePubkey"),tC("authorizedVoter"),tC("authorizedWithdrawer"),z.u8("commission")],t))()])},Authorize:{index:1,layout:z.struct([z.u32("instruction"),tC("newAuthorized"),z.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:z.struct([z.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:z.struct([z.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>z.struct([z.u32("voteAuthorizationType"),tC("currentAuthorityDerivedKeyOwnerPubkey"),tU("currentAuthorityDerivedKeySeed"),tC("newAuthorized")],t))()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class r3{static initializeAccount(t){let{votePubkey:e,nodePubkey:r,voteInit:i}=t,n=t5(r6.InitializeAccount,{voteInit:{nodePubkey:tB(i.nodePubkey.toBuffer()),authorizedVoter:tB(i.authorizedVoter.toBuffer()),authorizedWithdrawer:tB(i.authorizedWithdrawer.toBuffer()),commission:i.commission}});return new tG({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tQ,isSigner:!1,isWritable:!1},{pubkey:tY,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static createAccount(t){let e=new tZ;return e.add(er.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){let{votePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,voteAuthorizationType:n}=t,s=t5(r6.Authorize,{newAuthorized:tB(i.toBuffer()),voteAuthorizationType:n.index});return new tZ().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tY,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:n,voteAuthorizationType:s,votePubkey:o}=t,a=t5(r6.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:tB(r.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:tB(n.toBuffer()),voteAuthorizationType:s.index}});return new tZ().add({keys:[{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:tY,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,lamports:i,toPubkey:n}=t,s=t5(r6.Withdraw,{lamports:i});return new tZ().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static safeWithdraw(t,e,r){if(t.lamports>e-r)throw Error("Withdraw will leave vote account with insufficient funds.");return r3.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,nodePubkey:i}=t,n=t5(r6.UpdateValidatorIdentity);return new tZ().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}}r3.programId=new tM("Vote111111111111111111111111111111111111111"),r3.space=3762,new tM("Va1idator1nfo111111111111111111111111111111"),tl({name:ta(),website:ts(ta()),details:ts(ta()),iconUrl:ts(ta()),keybaseUsername:ts(ta())}),new tM("Vote111111111111111111111111111111111111111"),z.struct([tC("nodePubkey"),tC("authorizedWithdrawer"),z.u8("commission"),z.nu64(),z.seq(z.struct([z.nu64("slot"),z.u32("confirmationCount")]),z.offset(z.u32(),-8),"votes"),z.u8("rootSlotValid"),z.nu64("rootSlot"),z.nu64(),z.seq(z.struct([z.nu64("epoch"),tC("authorizedVoter")]),z.offset(z.u32(),-8),"authorizedVoters"),z.struct([z.seq(z.struct([tC("authorizedPubkey"),z.nu64("epochOfLastAuthorizedSwitch"),z.nu64("targetEpoch")]),32,"buf"),z.nu64("idx"),z.u8("isEmpty")],"priorVoters"),z.nu64(),z.seq(z.struct([z.nu64("epoch"),z.nu64("credits"),z.nu64("prevCredits")]),z.offset(z.u32(),-8),"epochCredits"),z.struct([z.nu64("slot"),z.nu64("timestamp")],"lastTimestamp")]),t.s(["ComputeBudgetProgram",0,rV,"Connection",0,class{constructor(t,e){let r,i,n,s,o,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{let t={};return async e=>{let{commitment:r,config:i}=eg(e),n=this._buildArgs([],r,void 0,i),s=en(n);return t[s]=t[s]??(async()=>{try{let t=await this._rpcRequest("getBlockHeight",n),e=J(t,ew(tn()));if("error"in e)throw new t2(e.error,"failed to get block height information");return e.result}finally{delete t[s]}})(),await t[s]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,r=e.wsEndpoint,i=e.httpHeaders,n=e.fetch,s=e.fetchMiddleware,o=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=r||function(t){let e=t.match(eh);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);let[r,i,n,s]=e,o=t.startsWith("https:")?"wss:":"ws:",a=null==n?null:parseInt(n.slice(1),10),u=null==a?"":`:${a+1}`;return`${o}//${i}${u}${s}`}(t),this._rpcClient=function(t,e,r,i,n,s){let o,a,u=r||ea;return null!=s&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),i&&(a=async(t,e)=>{let r=await new Promise((r,n)=>{try{i(t,e,(t,e)=>r([t,e]))}catch(t){n(t)}});return await u(...r)}),new td.default(async(r,i)=>{let s={method:"POST",body:r,agent:o,headers:Object.assign({"Content-Type":"application/json"},e||{},rF)};try{let e,r=5,o=500;for(;(e=a?await a(t,s):await u(t,s),429===e.status&&!0!==n)&&(r-=1,0!==r);){;console.error(`Server responded with ${e.status} ${e.statusText}. Retrying after ${o}ms delay...`),await t3(o),o*=2}let l=await e.text();e.ok?i(null,l):i(Error(`${e.status} ${e.statusText}: ${l}`))}catch(t){t instanceof Error&&i(t)}},{})}(t,i,n,s,o,a),this._rpcRequest=function(t){return(e,r)=>new Promise((i,n)=>{t.request(e,r,(t,e)=>{t?n(t):i(e)})})}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise((r,i)=>{0===e.length&&r([]);let n=e.map(e=>t.request(e.methodName,e.args));t.request(n,(t,e)=>{t?i(t):r(e)})})}(this._rpcClient),this._rpcWebSocket=new eu(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgs([t.toBase58()],r,void 0,i),s=J(await this._rpcRequest("getBalance",n),ev(tn()));if("error"in s)throw new t2(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then(t=>t.value).catch(e=>{throw Error("failed to get balance of account "+t.toBase58()+": "+e)})}async getBlockTime(t){let e=J(await this._rpcRequest("getBlockTime",[t]),ew(ti(tn())));if("error"in e)throw new t2(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){let t=J(await this._rpcRequest("minimumLedgerSlot",[]),ew(tn()));if("error"in t)throw new t2(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){let t=J(await this._rpcRequest("getFirstAvailableBlock",[]),eF);if("error"in t)throw new t2(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};let r=J(await this._rpcRequest("getSupply",[e]),eD);if("error"in r)throw new t2(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){let r=this._buildArgs([t.toBase58()],e),i=J(await this._rpcRequest("getTokenSupply",r),ev(eH));if("error"in i)throw new t2(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){let r=this._buildArgs([t.toBase58()],e),i=J(await this._rpcRequest("getTokenAccountBalance",r),ev(eH));if("error"in i)throw new t2(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,r){let{commitment:i,config:n}=eg(r),s=[t.toBase58()];"mint"in e?s.push({mint:e.mint.toBase58()}):s.push({programId:e.programId.toBase58()});let o=this._buildArgs(s,i,"base64",n),a=J(await this._rpcRequest("getTokenAccountsByOwner",o),eG);if("error"in a)throw new t2(a.error,`failed to get token accounts owned by account ${t.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(t,e,r){let i=[t.toBase58()];"mint"in e?i.push({mint:e.mint.toBase58()}):i.push({programId:e.programId.toBase58()});let n=this._buildArgs(i,r,"jsonParsed"),s=J(await this._rpcRequest("getTokenAccountsByOwner",n),eJ);if("error"in s)throw new t2(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){let e={...t,commitment:t&&t.commitment||this.commitment},r=e.filter||e.commitment?[e]:[],i=J(await this._rpcRequest("getLargestAccounts",r),eY);if("error"in i)throw new t2(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){let r=this._buildArgs([t.toBase58()],e),i=J(await this._rpcRequest("getTokenLargestAccounts",r),eV);if("error"in i)throw new t2(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgs([t.toBase58()],r,"base64",i),s=J(await this._rpcRequest("getAccountInfo",n),ev(ti(eX)));if("error"in s)throw new t2(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgs([t.toBase58()],r,"jsonParsed",i),s=J(await this._rpcRequest("getAccountInfo",n),ev(ti(e1)));if("error"in s)throw new t2(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){let{commitment:r,config:i}=eg(e),n=t.map(t=>t.toBase58()),s=this._buildArgs([n],r,"jsonParsed",i),o=J(await this._rpcRequest("getMultipleAccounts",s),ev(Q(ti(e1))));if("error"in o)throw new t2(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfoAndContext(t,e){let{commitment:r,config:i}=eg(e),n=t.map(t=>t.toBase58()),s=this._buildArgs([n],r,"base64",i),o=J(await this._rpcRequest("getMultipleAccounts",s),ev(Q(ti(eX))));if("error"in o)throw new t2(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,r){let{commitment:i,config:n}=eg(e),s=this._buildArgs([t.toBase58()],i,void 0,{...n,epoch:null!=r?r:n?.epoch}),o=J(await this._rpcRequest("getStakeActivation",s),ew(e6));if("error"in o)throw new t2(o.error,`failed to get Stake Activation ${t.toBase58()}`);return o.result}async getProgramAccounts(t,e){let{commitment:r,config:i}=eg(e),{encoding:n,...s}=i||{},o=this._buildArgs([t.toBase58()],r,n||"base64",{...s,...s.filters?{filters:em(s.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",o),u=Q(eQ),l=!0===s.withContext?J(a,ev(u)):J(a,ew(u));if("error"in l)throw new t2(l.error,`failed to get accounts owned by program ${t.toBase58()}`);return l.result}async getParsedProgramAccounts(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgs([t.toBase58()],r,"jsonParsed",i),s=J(await this._rpcRequest("getProgramAccounts",n),ew(Q(e2)));if("error"in s)throw new t2(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let r,i;if("string"==typeof t)r=t;else{if(t.abortSignal?.aborted)return Promise.reject(t.abortSignal.reason);r=t.signature}try{i=C.default.decode(r)}catch(t){throw Error("signature must be base58 encoded: "+r)}return(tN(64===i.length,"signature has invalid length"),"string"==typeof t)?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:r}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise((e,r)=>{null!=t&&(t.aborted?r(t.reason):t.addEventListener("abort",()=>{r(t.reason)}))})}getTransactionConfirmationPromise({commitment:t,signature:e}){let r,i,n=!1;return{abortConfirmation:()=>{i&&(i(),i=void 0),null!=r&&(this.removeSignatureListener(r),r=void 0)},confirmationPromise:new Promise((s,o)=>{try{r=this.onSignature(e,(t,e)=>{r=void 0,s({__type:tH.PROCESSED,response:{context:e,value:t}})},t);let a=new Promise(t=>{null==r?t():i=this._onSubscriptionStateChange(r,e=>{"subscribed"===e&&t()})});(async()=>{if(await a,n)return;let r=await this.getSignatureStatus(e);if(n||null==r)return;let{context:i,value:u}=r;if(null!=u)if(u?.err)o(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}n=!0,s({__type:tH.PROCESSED,response:{context:i,value:u}})}})()}catch(t){o(t)}})}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:r,signature:i}}){let n,s=!1,o=new Promise(e=>{let i=async()=>{try{return await this.getBlockHeight(t)}catch(t){return -1}};(async()=>{let t=await i();if(!s){for(;t<=r;)if(await t3(1e3),s||(t=await i(),s))return;e({__type:tH.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),l=this.getCancellationPromise(e);try{let t=await Promise.race([l,u,o]);if(t.__type===tH.PROCESSED)n=t.response;else throw new tT(i)}finally{s=!0,a()}return n}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:r,nonceAccountPubkey:i,nonceValue:n,signature:s}}){let o,a=!1,u=new Promise(e=>{let s=n,o=null,u=async()=>{try{let{context:e,value:n}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:r});return o=e.slot,n?.nonce}catch(t){return s}};(async()=>{if(s=await u(),!a)for(;;){if(n!==s)return void e({__type:tH.NONCE_INVALID,slotInWhichNonceDidAdvance:o});if(await t3(2e3),a||(s=await u(),a))return}})()}),{abortConfirmation:l,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:s}),h=this.getCancellationPromise(e);try{let e=await Promise.race([h,c,u]);if(e.__type===tH.PROCESSED)o=e.response;else{let i;for(;;){let t=await this.getSignatureStatus(s);if(null==t)break;if(t.context.slot<(e.slotInWhichNonceDidAdvance??r)){await t3(400);continue}i=t;break}if(i?.value){let e=t||"finalized",{confirmationStatus:r}=i.value;switch(e){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new tR(s);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new tR(s);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new tR(s)}o={context:i.context,value:{err:i.value.err}}}else throw new tR(s)}}finally{a=!0,l()}return o}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let r,i,n=new Promise(e=>{let i=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":i=this._confirmTransactionInitialTimeout||3e4}r=setTimeout(()=>e({__type:tH.TIMED_OUT,timeoutMs:i}),i)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});try{let t=await Promise.race([o,n]);if(t.__type===tH.PROCESSED)i=t.response;else throw new tP(e,t.timeoutMs/1e3)}finally{clearTimeout(r),s()}return i}async getClusterNodes(){let t=J(await this._rpcRequest("getClusterNodes",[]),ew(Q(rs)));if("error"in t)throw new t2(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){let e=this._buildArgs([],t),r=J(await this._rpcRequest("getVoteAccounts",e),ra);if("error"in r)throw new t2(r.error,"failed to get vote accounts");return r.result}async getSlot(t){let{commitment:e,config:r}=eg(t),i=this._buildArgs([],e,void 0,r),n=J(await this._rpcRequest("getSlot",i),ew(tn()));if("error"in n)throw new t2(n.error,"failed to get slot");return n.result}async getSlotLeader(t){let{commitment:e,config:r}=eg(t),i=this._buildArgs([],e,void 0,r),n=J(await this._rpcRequest("getSlotLeader",i),ew(ta()));if("error"in n)throw new t2(n.error,"failed to get slot leader");return n.result}async getSlotLeaders(t,e){let r=J(await this._rpcRequest("getSlotLeaders",[t,e]),ew(Q(ef)));if("error"in r)throw new t2(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){let{context:r,value:i}=await this.getSignatureStatuses([t],e);return tN(1===i.length),{context:r,value:i[0]}}async getSignatureStatuses(t,e){let r=[t];e&&r.push(e);let i=J(await this._rpcRequest("getSignatureStatuses",r),rc);if("error"in i)throw new t2(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){let{commitment:e,config:r}=eg(t),i=this._buildArgs([],e,void 0,r),n=J(await this._rpcRequest("getTransactionCount",i),ew(tn()));if("error"in n)throw new t2(n.error,"failed to get transaction count");return n.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){let e=this._buildArgs([],t),r=J(await this._rpcRequest("getInflationGovernor",e),eN);if("error"in r)throw new t2(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,r){let{commitment:i,config:n}=eg(r),s=this._buildArgs([t.map(t=>t.toBase58())],i,void 0,{...n,epoch:null!=e?e:n?.epoch}),o=J(await this._rpcRequest("getInflationReward",s),e_);if("error"in o)throw new t2(o.error,"failed to get inflation reward");return o.result}async getInflationRate(){let t=J(await this._rpcRequest("getInflationRate",[]),eW);if("error"in t)throw new t2(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(t){let{commitment:e,config:r}=eg(t),i=this._buildArgs([],e,void 0,r),n=J(await this._rpcRequest("getEpochInfo",i),eK);if("error"in n)throw new t2(n.error,"failed to get epoch info");return n.result}async getEpochSchedule(){let t=J(await this._rpcRequest("getEpochSchedule",[]),e$);if("error"in t)throw new t2(t.error,"failed to get epoch schedule");let e=t.result;return new eo(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){let t=J(await this._rpcRequest("getLeaderSchedule",[]),ej);if("error"in t)throw new t2(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){let r=this._buildArgs([t],e),i=J(await this._rpcRequest("getMinimumBalanceForRentExemption",r),rh);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){let{context:e,value:{blockhash:r}}=await this.getLatestBlockhashAndContext(t);return{context:e,value:{blockhash:r,feeCalculator:{get lamportsPerSignature(){throw Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(t){let e=J(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),rN);if("error"in e)throw new t2(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){let r=this._buildArgs([t],e),i=J(await this._rpcRequest("getFeeCalculatorForBlockhash",r),rW);if("error"in i)throw new t2(i.error,"failed to get fee calculator");let{context:n,value:s}=i.result;return{context:n,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){let r=tB(t.serialize()).toString("base64"),i=this._buildArgs([r],e),n=J(await this._rpcRequest("getFeeForMessage",i),ev(ti(tn())));if("error"in n)throw new t2(n.error,"failed to get fee for message");if(null===n.result)throw Error("invalid blockhash");return n.result}async getRecentPrioritizationFees(t){let e=t?.lockedWritableAccounts?.map(t=>t.toBase58()),r=e?.length?[e]:[],i=J(await this._rpcRequest("getRecentPrioritizationFees",r),eq);if("error"in i)throw new t2(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){let{commitment:e,config:r}=eg(t),i=this._buildArgs([],e,void 0,r),n=J(await this._rpcRequest("getLatestBlockhash",i),rO);if("error"in n)throw new t2(n.error,"failed to get latest blockhash");return n.result}async isBlockhashValid(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgs([t],r,void 0,i),s=J(await this._rpcRequest("isBlockhashValid",n),rz);if("error"in s)throw new t2(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){let t=J(await this._rpcRequest("getVersion",[]),ew(eL));if("error"in t)throw new t2(t.error,"failed to get version");return t.result}async getGenesisHash(){let t=J(await this._rpcRequest("getGenesisHash",[]),ew(ta()));if("error"in t)throw new t2(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgsAtLeastConfirmed([t],r,void 0,i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let t=J(s,rE);if("error"in t)throw t.error;return t.result}case"none":{let t=J(s,rA);if("error"in t)throw t.error;return t.result}default:{let t=J(s,rI);if("error"in t)throw t.error;let{result:e}=t;return e?{...e,transactions:e.transactions.map(({transaction:t,meta:e,version:r})=>({meta:e,transaction:{...t,message:eS(r,t.message)},version:r}))}:null}}}catch(t){throw new t2(t,"failed to get confirmed block")}}async getParsedBlock(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let t=J(s,rT);if("error"in t)throw t.error;return t.result}case"none":{let t=J(s,rP);if("error"in t)throw t.error;return t.result}default:{let t=J(s,rM);if("error"in t)throw t.error;return t.result}}}catch(t){throw new t2(t,"failed to get block")}}async getBlockProduction(t){let e,r;if("string"==typeof t)r=t;else if(t){let{commitment:i,...n}=t;r=i,e=n}let i=this._buildArgs([],r,"base64",e),n=J(await this._rpcRequest("getBlockProduction",i),ez);if("error"in n)throw new t2(n.error,"failed to get block production information");return n.result}async getTransaction(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgsAtLeastConfirmed([t],r,void 0,i),s=J(await this._rpcRequest("getTransaction",n),rC);if("error"in s)throw new t2(s.error,"failed to get transaction");let o=s.result;return o?{...o,transaction:{...o.transaction,message:eS(o.version,o.transaction.message)}}:o}async getParsedTransaction(t,e){let{commitment:r,config:i}=eg(e),n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),s=J(await this._rpcRequest("getTransaction",n),rU);if("error"in s)throw new t2(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){let{commitment:r,config:i}=eg(e),n=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i)}));return(await this._rpcBatchRequest(n)).map(t=>{let e=J(t,rU);if("error"in e)throw new t2(e.error,"failed to get transactions");return e.result})}async getTransactions(t,e){let{commitment:r,config:i}=eg(e),n=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,void 0,i)}));return(await this._rpcBatchRequest(n)).map(t=>{let e=J(t,rC);if("error"in e)throw new t2(e.error,"failed to get transactions");let r=e.result;return r?{...r,transaction:{...r.transaction,message:eS(r.version,r.transaction.message)}}:r})}async getConfirmedBlock(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=J(await this._rpcRequest("getBlock",r),rR);if("error"in i)throw new t2(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+t+" not found");let s={...n,transactions:n.transactions.map(({transaction:t,meta:e})=>{let r=new tj(t.message);return{meta:e,transaction:{...t,message:r}}})};return{...s,transactions:s.transactions.map(({transaction:t,meta:e})=>({meta:e,transaction:tZ.populate(t.message,t.signatures)}))}}async getBlocks(t,e,r){let i=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],r),n=J(await this._rpcRequest("getBlocks",i),ew(Q(tn())));if("error"in n)throw new t2(n.error,"failed to get blocks");return n.result}async getBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=J(await this._rpcRequest("getBlock",r),rL);if("error"in i)throw new t2(i.error,"failed to get block");let n=i.result;if(!n)throw Error("Block "+t+" not found");return n}async getConfirmedBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=J(await this._rpcRequest("getBlock",r),rL);if("error"in i)throw new t2(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+t+" not found");return n}async getConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=J(await this._rpcRequest("getTransaction",r),rC);if("error"in i)throw new t2(i.error,"failed to get transaction");let n=i.result;if(!n)return n;let s=new tj(n.transaction.message),o=n.transaction.signatures;return{...n,transaction:tZ.populate(s,o)}}async getParsedConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),i=J(await this._rpcRequest("getTransaction",r),rU);if("error"in i)throw new t2(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){let r=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(t=>{let e=J(t,rU);if("error"in e)throw new t2(e.error,"failed to get confirmed transactions");return e.result})}async getConfirmedSignaturesForAddress(t,e,r){let i={},n=await this.getFirstAvailableBlock();for(;!("until"in i)&&!(--e<=0)&&!(e<n);)try{let t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(i.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let s=await this.getSlot("finalized");for(;!("before"in i)&&!(++r>s);)try{let t=await this.getConfirmedBlockSignatures(r);t.signatures.length>0&&(i.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,i)).map(t=>t.signature)}async getConfirmedSignaturesForAddress2(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),n=J(await this._rpcRequest("getConfirmedSignaturesForAddress2",i),e3);if("error"in n)throw new t2(n.error,"failed to get confirmed signatures for address");return n.result}async getSignaturesForAddress(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),n=J(await this._rpcRequest("getSignaturesForAddress",i),e5);if("error"in n)throw new t2(n.error,"failed to get signatures for address");return n.result}async getAddressLookupTable(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),n=null;return null!==i&&(n=new el({key:t,state:el.deserialize(i.data)})),{context:r,value:n}}async getNonceAndContext(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),n=null;return null!==i&&(n=t7.fromAccountData(i.data)),{context:r,value:n}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then(t=>t.value).catch(e=>{throw Error("failed to get nonce for account "+t.toBase58()+": "+e)})}async requestAirdrop(t,e){let r=J(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),rq);if("error"in r)throw new t2(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await t3(100);let t=Date.now()-this._blockhashInfo.lastFetch;if(null!==this._blockhashInfo.latestBlockhash&&!(t>=3e4))return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let t=Date.now(),e=this._blockhashInfo.latestBlockhash,r=e?e.blockhash:null;for(let t=0;t<50;t++){let t=await this.getLatestBlockhash("finalized");if(r!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await t3(200)}throw Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){let{commitment:e,config:r}=eg(t),i=this._buildArgs([],e,"base64",r),n=J(await this._rpcRequest("getStakeMinimumDelegation",i),ev(tn()));if("error"in n)throw new t2(n.error,"failed to get stake minimum delegation");return n.result}async simulateTransaction(t,e,r){let i;if("message"in t){let i=t.serialize(),n=o.Buffer.from(i).toString("base64");if(Array.isArray(e)||void 0!==r)throw Error("Invalid arguments");let s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment),e&&"object"==typeof e&&"innerInstructions"in e&&(s.innerInstructions=e.innerInstructions);let a=[n,s],u=J(await this._rpcRequest("simulateTransaction",a),eO);if("error"in u)throw Error("failed to simulate transaction: "+u.error.message);return u.result}if(t instanceof tZ?((i=new tZ).feePayer=t.feePayer,i.instructions=t.instructions,i.nonceInfo=t.nonceInfo,i.signatures=t.signatures):(i=tZ.populate(t))._message=i._json=void 0,void 0!==e&&!Array.isArray(e))throw Error("Invalid arguments");if(i.nonceInfo&&e)i.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){let r=await this._blockhashWithExpiryBlockHeight(t);if(i.lastValidBlockHeight=r.lastValidBlockHeight,i.recentBlockhash=r.blockhash,!e)break;if(i.sign(...e),!i.signature)throw Error("!signature");let n=i.signature.toString("base64");if(this._blockhashInfo.simulatedSignatures.includes(n)||this._blockhashInfo.transactionSignatures.includes(n))t=!0;else{this._blockhashInfo.simulatedSignatures.push(n);break}}}let n=i._compile(),s=n.serialize(),a=i._serialize(s).toString("base64"),u={encoding:"base64",commitment:this.commitment};r&&(u.accounts={encoding:"base64",addresses:(Array.isArray(r)?r:n.nonProgramIds()).map(t=>t.toBase58())}),e&&(u.sigVerify=!0),e&&"object"==typeof e&&"innerInstructions"in e&&(u.innerInstructions=e.innerInstructions);let l=[a,u],c=J(await this._rpcRequest("simulateTransaction",l),eO);if("error"in c){let t;if("data"in c.error&&(t=c.error.data.logs)&&Array.isArray(t)){let e="\n ",r=e+t.join(e);console.error(c.error.message,r)}throw new t1({action:"simulate",signature:"",transactionMessage:c.error.message,logs:t})}return c.result}async sendTransaction(t,e,r){if("version"in t){if(e&&Array.isArray(e))throw Error("Invalid arguments");let r=t.serialize();return await this.sendRawTransaction(r,e)}if(void 0===e||!Array.isArray(e))throw Error("Invalid arguments");if(t.nonceInfo)t.sign(...e);else{let r=this._disableBlockhashCaching;for(;;){let i=await this._blockhashWithExpiryBlockHeight(r);if(t.lastValidBlockHeight=i.lastValidBlockHeight,t.recentBlockhash=i.blockhash,t.sign(...e),!t.signature)throw Error("!signature");let n=t.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(n))r=!0;else{this._blockhashInfo.transactionSignatures.push(n);break}}}let i=t.serialize();return await this.sendRawTransaction(i,r)}async sendRawTransaction(t,e){let r=tB(t).toString("base64");return await this.sendEncodedTransaction(r,e)}async sendEncodedTransaction(t,e){let r={encoding:"base64"},i=e&&e.skipPreflight,n=!0===i?"processed":e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(r.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(r.minContextSlot=e.minContextSlot),i&&(r.skipPreflight=i),n&&(r.preflightCommitment=n);let s=[t,r],o=J(await this._rpcRequest("sendTransaction",s),rK);if("error"in o){let t;throw"data"in o.error&&(t=o.error.data.logs),new t1({action:i?"send":"simulate",signature:"",transactionMessage:o.error.message,logs:t})}return o.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3===t)?this._updateSubscriptions():(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))}_setSubscription(t,e){let r=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,r!==e.state){let r=this._subscriptionStateChangeCallbacksByHash[t];r&&r.forEach(t=>{try{t(e.state)}catch{}})}}_onSubscriptionStateChange(t,e){let r=this._subscriptionHashByClientSubscriptionId[t];if(null==r)return()=>{};let i=this._subscriptionStateChangeCallbacksByHash[r]||=new Set;return i.add(e),()=>{i.delete(e),0===i.size&&delete this._subscriptionStateChangeCallbacksByHash[r]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}},500));return}if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();let t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async t=>{let r=this._subscriptionsByHash[t];if(void 0!==r)switch(r.state){case"pending":case"unsubscribed":if(0===r.callbacks.size){delete this._subscriptionsByHash[t],"unsubscribed"===r.state&&delete this._subscriptionCallbacksByServerSubscriptionId[r.serverSubscriptionId],await this._updateSubscriptions();return}await (async()=>{let{args:i,method:n}=r;try{this._setSubscription(t,{...r,state:"subscribing"});let e=await this._rpcWebSocket.call(n,i);this._setSubscription(t,{...r,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=r.callbacks,await this._updateSubscriptions()}catch(s){if(console.error(`Received ${s instanceof Error?"":"JSON-RPC "}error calling \`${n}\``,{args:i,error:s}),!e())return;this._setSubscription(t,{...r,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===r.callbacks.size&&await (async()=>{let{serverSubscriptionId:i,unsubscribeMethod:n}=r;if(this._subscriptionsAutoDisposedByRpc.has(i))this._subscriptionsAutoDisposedByRpc.delete(i);else{this._setSubscription(t,{...r,state:"unsubscribing"}),this._setSubscription(t,{...r,state:"unsubscribing"});try{await this._rpcWebSocket.call(n,[i])}catch(i){if(i instanceof Error&&console.error(`${n} error:`,i.message),!e())return;this._setSubscription(t,{...r,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(t,{...r,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(t,e){let r=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==r&&r.forEach(t=>{try{t(...e)}catch(t){console.error(t)}})}_wsOnAccountNotification(t){let{result:e,subscription:r}=J(t,e8);this._handleServerNotification(r,[e.value,e.context])}_makeSubscription(t,e){let r=this._nextClientSubscriptionId++,i=en([t.method,e]),n=this._subscriptionsByHash[i];return void 0===n?this._subscriptionsByHash[i]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:n.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];let e=this._subscriptionsByHash[i];tN(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${r}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(t,e,r){let{commitment:i,config:n}=eg(r),s=this._buildArgs([t.toBase58()],i||this._commitment||"finalized","base64",n);return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},s)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){let{result:e,subscription:r}=J(t,e9);this._handleServerNotification(r,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,r,i){let{commitment:n,config:s}=eg(r),o=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",s||(i?{filters:em(i)}:void 0));return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},o)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,r){let i=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],r||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){let{result:e,subscription:r}=J(t,rj);this._handleServerNotification(r,[e.value,e.context])}_wsOnSlotNotification(t){let{result:e,subscription:r}=J(t,rt);this._handleServerNotification(r,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){let{result:e,subscription:r}=J(t,rr);this._handleServerNotification(r,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){let r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];r?await r():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,r,i){let n=e||this._commitment;if(n||r||i){let e={};r&&(e.encoding=r),n&&(e.commitment=n),i&&(e=Object.assign(e,i)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,r,i){let n=e||this._commitment;if(n&&!["confirmed","finalized"].includes(n))throw Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,r,i)}_wsOnSignatureNotification(t){let{result:e,subscription:r}=J(t,ri);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,r){let i=this._buildArgs([t],r||this._commitment||"finalized"),n=this._makeSubscription({callback:(t,r)=>{if("status"===t.type){e(t.result,r);try{this.removeSignatureListener(n)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return n}
7onSignatureWithOptions(t,e,r){let{commitment:i,...n}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},s=this._buildArgs([t],i,void 0,n),o=this._makeSubscription({callback:(t,r)=>{e(t,r);try{this.removeSignatureListener(o)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return o}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){let{result:e,subscription:r}=J(t,rn);this._handleServerNotification(r,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}},"LAMPORTS_PER_SOL",0,1e9,"PublicKey",0,tM,"SendTransactionError",0,t1,"SystemProgram",0,er,"Transaction",0,tZ,"TransactionInstruction",0,tG,"VersionedTransaction",0,tJ],942035)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.