1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="bd518c37-e8de-d166-b723-857fe5eee30b")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,390530,(e,t,r)=>{"use strict";var i=e.r(840369).Buffer;t.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=n}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function d(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,s=0;e[r]===c;)n++,r++;for(var o=(e.length-r)*u+1>>>0,l=new Uint8Array(o);r<e.length;){var d=e.charCodeAt(r);if(d>255)return;var h=t[d];if(255===h)return;for(var f=0,p=o-1;(0!==h||f<s)&&-1!==p;p--,f++)h+=a*l[p]>>>0,l[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");s=f,r++}for(var g=o-s;g!==o&&0===l[g];)g++;var y=i.allocUnsafe(n+(o-g));y.fill(0,0,n);for(var m=n;g!==o;)y[m++]=l[g++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var u=(o-s)*l+1>>>0,d=new Uint8Array(u);s!==o;){for(var h=t[s],f=0,p=u-1;(0!==h||f<n)&&-1!==p;p--,f++)h+=256*d[p]>>>0,d[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");n=f,s++}for(var g=u-n;g!==u&&0===d[g];)g++;for(var y=c.repeat(r);g<u;++g)y+=e.charAt(d[g]);return y},decodeUnsafe:d,decode:function(e){var t=d(e);if(t)return t;throw Error("Non-base"+a+" character")}}}},55463,(e,t,r)=>{t.exports=e.r(390530)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},479582,(e,t,r)=>{"use strict";function i(e,t,r){return t<=e&&e<=r}function n(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function s(e){this.tokens=[].slice.call(e)}function o(e,t){if(e)throw TypeError("Decoder error");return t||65533}s.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.push(e.shift());else this.tokens.push(e)}};var a="utf-8";function c(e,t){if(!(this instanceof c))return new c(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function u(e,t){if(!(this instanceof u))return new u(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(e){var t=e.fatal,r=0,n=0,s=0,a=128,c=191;this.handler=function(e,u){if(-1===u&&0!==s)return s=0,o(t);if(-1===u)return -1;if(0===s){if(i(u,0,127))return u;if(i(u,194,223))s=1,r=u-192;else if(i(u,224,239))224===u&&(a=160),237===u&&(c=159),s=2,r=u-224;else{if(!i(u,240,244))return o(t);240===u&&(a=144),244===u&&(c=143),s=3,r=u-240}return r<<=6*s,null}if(!i(u,a,c))return r=s=n=0,a=128,c=191,e.prepend(u),o(t);if(a=128,c=191,n+=1,r+=u-128<<6*(s-n),n!==s)return null;var l=r;return r=s=n=0,l}}function d(e){e.fatal,this.handler=function(e,t){if(-1===t)return -1;if(i(t,0,127))return t;i(t,128,2047)?(r=1,n=192):i(t,2048,65535)?(r=2,n=224):i(t,65536,1114111)&&(r=3,n=240);for(var r,n,s=[(t>>6*r)+n];r>0;){var o=t>>6*(r-1);s.push(128|63&o),r-=1}return s}}c.prototype={decode:function(e,t){r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=n(t),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.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 c="",u=0;u<a.length;++u){var d=a[u];d<=65535?c+=String.fromCharCode(d):(d-=65536,c+=String.fromCharCode((d>>10)+55296,(1023&d)+56320))}return c}},u.prototype={encode:function(e,t){e=e?String(e):"",t=n(t),this._streaming||(this._encoder=new d(this._options)),this._streaming=!!t.stream;for(var r,i=[],o=new s(function(e){for(var t=String(e),r=t.length,i=0,n=[];i<r;){var s=t.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=e.charCodeAt(i+1);if(56320<=o&&o<=57343){var a=1023&s,c=1023&o;n.push(65536+(a<<10)+c),i+=1}else n.push(65533)}i+=1}return n}(e));!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=u,r.TextDecoder=c},541014,(e,t,r)=>{"use strict";var i=e.i(329470),n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),s=e.e&&e.e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e.e&&e.e.__decorate||function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
vendor: 5,423 bytes, line 2
2);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},a=e.e&&e.e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return s(t,e),t},c=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};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 u=c(e.r(93340)),l=c(e.r(55463)),d=a(e.r(479582)),h=new("function"!=typeof TextDecoder?d.TextDecoder:TextDecoder)("utf-8",{fatal:!0});r.baseEncode=function(e){return"string"==typeof e&&(e=i.Buffer.from(e,"utf8")),l.default.encode(i.Buffer.from(e))},r.baseDecode=function(e){return i.Buffer.from(l.default.decode(e))};class f extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}r.BorshError=f;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(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(i.Buffer.from(new u.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(i.Buffer.from(new u.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(i.Buffer.from(new u.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(i.Buffer.from(new u.default(e).toArray("le",64)))}writeBuffer(e){this.buf=i.Buffer.concat([i.Buffer.from(this.buf.subarray(0,this.length)),e,i.Buffer.alloc(1024)]),this.length+=e.length}writeString(e){this.maybeResize();let t=i.Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(i.Buffer.from(e))}writeArray(e,t){for(let r of(this.maybeResize(),this.writeU32(e.length),e))this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}}function g(e,t,r){let i=r.value;r.value=function(...e){try{return i.apply(this,e)}catch(e){if(e instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e.code)>=0)throw new f("Reached the end of buffer when deserializing");throw e}}}r.BinaryWriter=p;class y{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new u.default(e,"le")}readU128(){let e=this.readBuffer(16);return new u.default(e,"le")}readU256(){let e=this.readBuffer(32);return new u.default(e,"le")}readU512(){let e=this.readBuffer(64);return new u.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new f(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return h.decode(t)}catch(e){throw new f(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=[];for(let i=0;i<t;++i)r.push(e());return r}}function m(e){return e.charAt(0).toUpperCase()+e.slice(1)}function b(e,t,r,i,n){try{if("string"==typeof i)n[`write${m(i)}`](r);else if(i instanceof Array)if("number"==typeof i[0]){if(r.length!==i[0])throw new f(`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 f(`Expecting byte array of length ${i[1]}, but got ${r.length} bytes`);for(let t=0;t<i[1];t++)b(e,null,r[t],i[0],n)}else n.writeArray(r,r=>{b(e,t,r,i[0],n)});else if(void 0!==i.kind)switch(i.kind){case"option":null==r?n.writeU8(0):(n.writeU8(1),b(e,t,r,i.type,n));break;case"map":n.writeU32(r.size),r.forEach((r,s)=>{b(e,t,s,i.key,n),b(e,t,r,i.value,n)});break;default:throw new f(`FieldType ${i} unrecognized`)}else k(e,r,n)}catch(e){throw e instanceof f&&e.addToFieldPath(t),e}}function k(e,t,r){if("function"==typeof t.borshSerialize)return void t.borshSerialize(r);let i=e.get(t.constructor);if(!i)throw new f(`Class ${t.constructor.name} is missing in schema`);if("struct"===i.kind)i.fields.map(([i,n])=>{b(e,i,t[i],n,r)});else if("enum"===i.kind){let n=t[i.field];for(let s=0;s<i.values.length;++s){let[o,a]=i.values[s];if(o===n){r.writeU8(s),b(e,o,t[o],a,r);break}}}else throw new f(`Unexpected schema kind: ${i.kind} for ${t.constructor.name}`)}function w(e,t,r,i){try{if("string"==typeof r)return i[`read${m(r)}`]();if(r instanceof Array)if("number"==typeof r[0])return i.readFixedArray(r[0]);else{if("number"!=typeof r[1])return i.readArray(()=>w(e,t,r[0],i));let n=[];for(let t=0;t<r[1];t++)n.push(w(e,null,r[0],i));return n}if("option"===r.kind){if(i.readU8())return w(e,t,r.type,i);return}if("map"===r.kind){let n=new Map,s=i.readU32();for(let o=0;o<s;o++){let s=w(e,t,r.key,i),o=w(e,t,r.value,i);n.set(s,o)}return n}
2return S(e,r,i)}catch(e){throw e instanceof f&&e.addToFieldPath(t),e}}function S(e,t,r){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(r);let i=e.get(t);if(!i)throw new f(`Class ${t.name} is missing in schema`);if("struct"===i.kind){let i={};for(let[n,s]of e.get(t).fields)i[n]=w(e,n,s,r);return new t(i)}if("enum"===i.kind){let n=r.readU8();if(n>=i.values.length)throw new f(`Enum index: ${n} is out of range`);let[s,o]=i.values[n],a=w(e,s,o,r);return new t({[s]:a})}throw new f(`Unexpected schema kind: ${i.kind} for ${t.constructor.name}`)}o([g],y.prototype,"readU8",null),o([g],y.prototype,"readU16",null),o([g],y.prototype,"readU32",null),o([g],y.prototype,"readU64",null),o([g],y.prototype,"readU128",null),o([g],y.prototype,"readU256",null),o([g],y.prototype,"readU512",null),o([g],y.prototype,"readString",null),o([g],y.prototype,"readFixedArray",null),o([g],y.prototype,"readArray",null),r.BinaryReader=y,r.serialize=function(e,t,r=p){let i=new r;return k(e,t,i),i.toArray()},r.deserialize=function(e,t,r,i=y){let n=new i(r),s=S(e,t,n);if(n.offset<r.length)throw new f(`Unexpected ${r.length-n.offset} bytes after deserialized data`);return s},r.deserializeUnchecked=function(e,t,r,i=y){return S(e,t,new i(r))}},543505,(e,t,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=e.r(956376);function n(e){if(!(e instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(e){return n(e),i.Buffer.from(e.buffer,e.byteOffset,e.length)}r.checkUint8Array=n,r.uint8ArrayToBuffer=s;class o{constructor(e,t){if(!Number.isInteger(e))throw TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function a(e,t){return t.property?e+"["+t.property+"]":e}r.Layout=o,r.nameWithProperty=a,r.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw Error("Class is already bound to a layout");if(!(t&&t instanceof o))throw TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(e,"decode",{value:(e,r)=>t.decode(e,r),writable:!0})};class c extends o{isCount(){throw Error("ExternalLayout is abstract")}}r.ExternalLayout=c;class u extends c{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){return n(e),Math.floor((e.length-t)/this.elementSpan)}encode(e,t,r){return 0}}r.GreedyCount=u;class l extends c{constructor(e,t=0,r){if(!(e instanceof o))throw TypeError("layout must be a Layout");if(!Number.isInteger(t))throw TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof d||this.layout instanceof h}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}r.OffsetLayout=l;class d extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntLE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntLE(e,r,this.span),this.span}}r.UInt=d;class h extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntBE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntBE(e,r,this.span),this.span}}r.UIntBE=h;class f extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readIntLE(t,this.span)}encode(e,t,r=0){return s(t).writeIntLE(e,r,this.span),this.span}}r.Int=f;class p extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readIntBE(t,this.span)}encode(e,t,r=0){return s(t).writeIntBE(e,r,this.span),this.span}}function g(e){let t=Math.floor(e/0x100000000);return{hi32:t,lo32:e-0x100000000*t}}function y(e,t){return 0x100000000*e+t}r.IntBE=p;class m extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),i=r.readUInt32LE(t);return y(r.readUInt32LE(t+4),i)}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeUInt32LE(i.lo32,r),n.writeUInt32LE(i.hi32,r+4),8}}r.NearUInt64=m;class b extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e);return y(r.readUInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeUInt32BE(i.hi32,r),n.writeUInt32BE(i.lo32,r+4),8}}r.NearUInt64BE=b;class k extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),i=r.readUInt32LE(t);return y(r.readInt32LE(t+4),i)}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeUInt32LE(i.lo32,r),n.writeInt32LE(i.hi32,r+4),8}}r.NearInt64=k;class w extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e);return y(r.readInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeInt32BE(i.hi32,r),n.writeUInt32BE(i.lo32,r+4),8}}r.NearInt64BE=w;class S extends o{constructor(e){super(4,e)}decode(e,t=0){return s(e).readFloatLE(t)}encode(e,t,r=0){return s(t).writeFloatLE(e,r),4}}r.Float=S;class v extends o{constructor(e){super(4,e)}decode(e,t=0){return s(e).readFloatBE(t)}encode(e,t,r=0){return s(t).writeFloatBE(e,r),4}}r.FloatBE=v;class I extends o{constructor(e){super(8,e)}decode(e,t=0){return s(e).readDoubleLE(t)}encode(e,t,r=0){return s(t).writeDoubleLE(e,r),8}}r.Double=I;class _ extends o{constructor(e){super(8,e)}decode(e,t=0){return s(e).readDoubleBE(t)}encode(e,t,r=0){return s(t).writeDoubleBE(e,r),8}}r.DoubleBE=_;class A extends o{constructor(e,t,r){if(!(e instanceof o))throw TypeError("elementLayout must be a Layout");if(!(t instanceof c&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;t instanceof c||!(0<e.span)||(i=t*e.span),super(i,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,i=this.count;if(i instanceof c&&(i=i.decode(e,t)),0<this.elementLayout.span)r=i*this.elementLayout.span;else{let n=0;for(;n<i;)r+=this.elementLayout.getSpan(e,t+r),++n}return r}decode(e,t=0){let r=[],i=0,n=this.count;for(n instanceof c&&(n=n.decode(e,t));i<n;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),i+=1;return r}encode(e,t,r=0){let i=this.elementLayout,n=e.reduce((e,n)=>e+i.encode(n,t,r+e),0);return this.count instanceof c&&this.count.encode(e.length,t,r),n}}r.Sequence=A;class E extends o{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((e,t)=>
2e&&t instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(const i of("boolean"==typeof t&&void 0===r&&(r=t,t=void 0),e))if(0>i.span&&void 0===i.property)throw Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((e,t)=>e+t.getSpan(),0)}catch(e){}super(i,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,i)=>{let n=i.getSpan(e,t);return t+=n,r+n},0)}catch(e){throw RangeError("indeterminate span")}return r}decode(e,t=0){n(e);let r=this.makeDestinationObject();for(let i of this.fields)if(void 0!==i.property&&(r[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,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=e[i.property];void 0!==n&&(s=i.encode(n,t,r),0>o&&(o=i.getSpan(t,r)))}n=r,r+=o}return n+s-i}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}r.Structure=E;class x{constructor(e){this.property=e}decode(e,t){throw Error("UnionDiscriminator is abstract")}encode(e,t,r){throw Error("UnionDiscriminator is abstract")}}r.UnionDiscriminator=x;class B extends x{constructor(e,t){if(!(e instanceof c&&e.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}}r.UnionLayoutDiscriminator=B;class P extends o{constructor(e,t,r){let i;if(e instanceof d||e instanceof h)i=new B(new l(e));else if(e instanceof c&&e.isCount())i=new B(e);else if(e instanceof x)i=e;else throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof o))throw TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let n=-1;t&&0<=(n=t.span)&&(e instanceof d||e instanceof h)&&(n+=i.layout.span),super(n,r),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof d||e instanceof h,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return s(e)},this.configGetSourceVariant=function(e){s=e.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw Error("unable to infer src variant")}decode(e,t=0){let r,i=this.discriminator,n=i.decode(e,t),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(e,t+o)}else r=s.decode(e,t);return r}encode(e,t,r=0){let i=this.getSourceVariant(e);if(void 0===i){let i=this.discriminator,n=this.defaultLayout,s=0;return this.usesPrefixDiscriminator&&(s=i.layout.span),i.encode(e[i.property],t,r),s+n.encode(e[n.property],t,r+s)}return i.encode(e,t,r)}addVariant(e,t,r){let i=new T(this,e,t,r);return this.registry[e]=i,i}getVariant(e,t=0){let r;return r=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[r]}}r.Union=P;
2class T extends o{constructor(e,t,r,i){if(!(e instanceof P))throw TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)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");if(null!==e.defaultLayout&&0<=r.span&&r.span>e.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=e.span;0>e.span&&0<=(n=r?r.span:0)&&e.usesPrefixDiscriminator&&(n+=e.discriminator.layout.span),super(n,i),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=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(e,t+r)),r+i}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))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(e,t+i):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let n=i;if(this.layout&&(this.layout.encode(e[this.property],t,r+i),n+=this.layout.getSpan(t,r+i),0<=this.union.span&&n>this.union.span))throw Error("encoded variant overruns containing union");return n}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function R(e){return 0>e&&(e+=0x100000000),e}r.VariantLayout=T;class C extends o{constructor(e,t,r){if(!(e instanceof d||e instanceof h))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4<e.span)throw RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let i=0;this._packedSetValue=function(e){return i=R(e),this},this._packedGetValue=function(){return i}}decode(e,t=0){let r=this.makeDestinationObject(),i=this.word.decode(e,t);for(let t of(this._packedSetValue(i),this.fields))void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t,r=0){let i=this.word.decode(t,r);for(let t of(this._packedSetValue(i),this.fields))if(void 0!==t.property){let r=e[t.property];void 0!==r&&t.encode(r)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new L(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new O(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}}r.BitStructure=C;class L{constructor(e,t,r){if(!(e instanceof C))throw TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw TypeError("bits must be positive integer");const i=8*e.span,n=e.fields.reduce((e,t)=>e+t.bits,0);if(t+n>i)throw Error("bits too long for span remainder ("+(i-n)+" of "+i+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=0xffffffff),this.start=n,this.container.msb&&(this.start=i-n-t),this.wordMask=R(this.valueMask<<this.start),this.property=r}decode(e,t){return R(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==R(e&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=R(e<<this.start);this.container._packedSetValue(R(t&~this.wordMask)|r)}}r.BitField=L;class O extends L{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e*=1),super.encode(e)}}r.Boolean=O;class z extends o{constructor(e,t){if(!(e instanceof c&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof c||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),s(e).slice(t,t+r)}encode(e,t,r){let i=this.length;if(this.length instanceof c&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw TypeError(a("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(r+i>t.length)throw RangeError("encoding overruns Uint8Array");let n=s(e);return s(t).write(n.toString("hex"),r,i,"hex"),this.length instanceof c&&this.length.encode(i,t,r),i}}r.Blob=z;class N extends o{constructor(e){super(-1,e)}getSpan(e,t=0){n(e);let r=t;for(;r<e.length&&0!==e[r];)r+=1;return 1+r-t}decode(e,t=0){let r=this.getSpan(e,t);return s(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));let n=i.Buffer.from(e,"utf8"),o=n.length;if(r+o>t.length)throw RangeError("encoding overruns Buffer");let a=s(t);return n.copy(a,r),a[r+o]=0,o+1}}r.CString=N;class U extends o{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return n(e),e.length-t}decode(e,t=0){let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw RangeError("text length exceeds maxSpan");return s(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));let n=i.Buffer.from(e,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw RangeError("text length exceeds maxSpan");if(r+o>t.length)throw RangeError("encoding overruns Buffer");return n.copy(s(t),r),o}}r.UTF8=U;class W extends o{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}}r.Constant=W,r.greedy=(e,t)=>new u(e,t),r.offset=(e,t,r)=>new l(e,t,r),r.u8=e=>
2new d(1,e),r.u16=e=>new d(2,e),r.u24=e=>new d(3,e),r.u32=e=>new d(4,e),r.u40=e=>new d(5,e),r.u48=e=>new d(6,e),r.nu64=e=>new m(e),r.u16be=e=>new h(2,e),r.u24be=e=>new h(3,e),r.u32be=e=>new h(4,e),r.u40be=e=>new h(5,e),r.u48be=e=>new h(6,e),r.nu64be=e=>new b(e),r.s8=e=>new f(1,e),r.s16=e=>new f(2,e),r.s24=e=>new f(3,e),r.s32=e=>new f(4,e),r.s40=e=>new f(5,e),r.s48=e=>new f(6,e),r.ns64=e=>new k(e),r.s16be=e=>new p(2,e),r.s24be=e=>new p(3,e),r.s32be=e=>new p(4,e),r.s40be=e=>new p(5,e),r.s48be=e=>new p(6,e),r.ns64be=e=>new w(e),r.f32=e=>new S(e),r.f32be=e=>new v(e),r.f64=e=>new I(e),r.f64be=e=>new _(e),r.struct=(e,t,r)=>new E(e,t,r),r.bits=(e,t,r)=>new C(e,t,r),r.seq=(e,t,r)=>new A(e,t,r),r.union=(e,t,r)=>new P(e,t,r),r.unionLayoutDiscriminator=(e,t)=>new B(e,t),r.blob=(e,t)=>new z(e,t),r.cstr=e=>new N(e),r.utf8=(e,t)=>new U(e,t),r.constant=(e,t)=>new W(e,t)},861250,e=>{"use strict";e.s([],857595),e.i(857595);var t,r,i,n=new Uint8Array(16);function s(){if(!t&&!(t="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 t(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(e){return"string"==typeof e&&o.test(e)};for(var c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));let l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!a(r))throw TypeError("Stringified UUID is invalid");return r};var d=0,h=0;let f=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/0x10000000000&255,r[11]=t/0x100000000&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};function p(e,t,r){function i(e,i,n,s){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof i&&(i=f(i)),16!==i.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(i),o.set(e,i.length),(o=r(o))[6]=15&o[6]|t,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 l(o)}try{i.name=e}catch(e){}return i.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",i.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",i}function g(e){return(e+64>>>9<<4)+14+1}function y(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function m(e,t,r,i,n,s){var o;return y((o=y(y(t,e),y(i,s)))<<n|o>>>32-n,r)}function b(e,t,r,i,n,s,o){return m(t&r|~t&i,e,t,n,s,o)}function k(e,t,r,i,n,s,o){return m(t&i|r&~i,e,t,n,s,o)}function w(e,t,r,i,n,s,o){return m(t^r^i,e,t,n,s,o)}function S(e,t,r,i,n,s,o){return m(r^(t|~i),e,t,n,s,o)}var v=p("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,i="0123456789abcdef",n=0;n<r;n+=8){var s=e[n>>5]>>>n%32&255,o=parseInt(i.charAt(s>>>4&15)+i.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[g(t)-1]=t;for(var r=0x67452301,i=-0x10325477,n=-0x67452302,s=0x10325476,o=0;o<e.length;o+=16){var a=r,c=i,u=n,l=s;r=b(r,i,n,s,e[o],7,-0x28955b88),s=b(s,r,i,n,e[o+1],12,-0x173848aa),n=b(n,s,r,i,e[o+2],17,0x242070db),i=b(i,n,s,r,e[o+3],22,-0x3e423112),r=b(r,i,n,s,e[o+4],7,-0xa83f051),s=b(s,r,i,n,e[o+5],12,0x4787c62a),n=b(n,s,r,i,e[o+6],17,-0x57cfb9ed),i=b(i,n,s,r,e[o+7],22,-0x2b96aff),r=b(r,i,n,s,e[o+8],7,0x698098d8),s=b(s,r,i,n,e[o+9],12,-0x74bb0851),n=b(n,s,r,i,e[o+10],17,-42063),i=b(i,n,s,r,e[o+11],22,-0x76a32842),r=b(r,i,n,s,e[o+12],7,0x6b901122),s=b(s,r,i,n,e[o+13],12,-0x2678e6d),n=b(n,s,r,i,e[o+14],17,-0x5986bc72),i=b(i,n,s,r,e[o+15],22,0x49b40821),r=k(r,i,n,s,e[o+1],5,-0x9e1da9e),s=k(s,r,i,n,e[o+6],9,-0x3fbf4cc0),n=k(n,s,r,i,e[o+11],14,0x265e5a51),i=k(i,n,s,r,e[o],20,-0x16493856),r=k(r,i,n,s,e[o+5],5,-0x29d0efa3),s=k(s,r,i,n,e[o+10],9,0x2441453),n=k(n,s,r,i,e[o+15],14,-0x275e197f),i=k(i,n,s,r,e[o+4],20,-0x182c0438),r=k(r,i,n,s,e[o+9],5,0x21e1cde6),s=k(s,r,i,n,e[o+14],9,-0x3cc8f82a),n=k(n,s,r,i,e[o+3],14,-0xb2af279),i=k(i,n,s,r,e[o+8],20,0x455a14ed),r=k(r,i,n,s,e[o+13],5,-0x561c16fb),s=k(s,r,i,n,e[o+2],9,-0x3105c08),n=k(n,s,r,i,e[o+7],14,0x676f02d9),i=k(i,n,s,r,e[o+12],20,-0x72d5b376),r=w(r,i,n,s,e[o+5],4,-378558),s=w(s,r,i,n,e[o+8],11,-0x788e097f),n=w(n,s,r,i,e[o+11],16,0x6d9d6122),i=w(i,n,s,r,e[o+14],23,-0x21ac7f4),r=w(r,i,n,s,e[o+1],4,-0x5b4115bc),s=w(s,r,i,n,e[o+4],11,0x4bdecfa9),n=w(n,s,r,i,e[o+7],16,-0x944b4a0),i=w(i,n,s,r,e[o+10],23,-0x41404390),r=w(r,i,n,s,e[o+13],4,0x289b7ec6),s=w(s,r,i,n,e[o],11,-0x155ed806),n=w(n,s,r,i,e[o+3],16,-0x2b10cf7b),i=w(i,n,s,r,e[o+6],23,0x4881d05
2),r=w(r,i,n,s,e[o+9],4,-0x262b2fc7),s=w(s,r,i,n,e[o+12],11,-0x1924661b),n=w(n,s,r,i,e[o+15],16,0x1fa27cf8),i=w(i,n,s,r,e[o+2],23,-0x3b53a99b),r=S(r,i,n,s,e[o],6,-0xbd6ddbc),s=S(s,r,i,n,e[o+7],10,0x432aff97),n=S(n,s,r,i,e[o+14],15,-0x546bdc59),i=S(i,n,s,r,e[o+5],21,-0x36c5fc7),r=S(r,i,n,s,e[o+12],6,0x655b59c3),s=S(s,r,i,n,e[o+3],10,-0x70f3336e),n=S(n,s,r,i,e[o+10],15,-1051523),i=S(i,n,s,r,e[o+1],21,-0x7a7ba22f),r=S(r,i,n,s,e[o+8],6,0x6fa87e4f),s=S(s,r,i,n,e[o+15],10,-0x1d31920),n=S(n,s,r,i,e[o+6],15,-0x5cfebcec),i=S(i,n,s,r,e[o+13],21,0x4e0811a1),r=S(r,i,n,s,e[o+4],6,-0x8ac817e),s=S(s,r,i,n,e[o+11],10,-0x42c50dcb),n=S(n,s,r,i,e[o+2],15,0x2ad7d2bb),i=S(i,n,s,r,e[o+9],21,-0x14792c6f),r=y(r,a),i=y(i,c),n=y(n,u),s=y(s,l)}return[r,i,n,s]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(g(t)),i=0;i<t;i+=8)r[i>>5]|=(255&e[i/8])<<i%32;return r}(e),8*e.length))});function I(e,t){return e<<t|e>>>32-t}var _=p("v5",80,function(e){var t=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6],r=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0];if("string"==typeof e){var i=unescape(encodeURIComponent(e));e=[];for(var n=0;n<i.length;++n)e.push(i.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var s=Math.ceil((e.length/4+2)/16),o=Array(s),a=0;a<s;++a){for(var c=new Uint32Array(16),u=0;u<16;++u)c[u]=e[64*a+4*u]<<24|e[64*a+4*u+1]<<16|e[64*a+4*u+2]<<8|e[64*a+4*u+3];o[a]=c}o[s-1][14]=(e.length-1)*8/0x100000000,o[s-1][14]=Math.floor(o[s-1][14]),o[s-1][15]=(e.length-1)*8|0;for(var l=0;l<s;++l){for(var d=new Uint32Array(80),h=0;h<16;++h)d[h]=o[l][h];for(var f=16;f<80;++f)d[f]=I(d[f-3]^d[f-8]^d[f-14]^d[f-16],1);for(var p=r[0],g=r[1],y=r[2],m=r[3],b=r[4],k=0;k<80;++k){var w=Math.floor(k/20),S=I(p,5)+function(e,t,r,i){switch(e){case 0:return t&r^~t&i;case 1:case 3:return t^r^i;case 2:return t&r^t&i^r&i}}(w,g,y,m)+b+t[w]+d[k]>>>0;b=m,m=y,y=I(g,30)>>>0,g=p,p=S}r[0]=r[0]+p>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+m>>>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]]});e.s(["NIL",0,"00000000-0000-0000-0000-000000000000","parse",0,f,"stringify",0,l,"v1",0,function(e,t,n){var o=t&&n||0,a=t||Array(16),c=(e=e||{}).node||r,u=void 0!==e.clockseq?e.clockseq:i;if(null==c||null==u){var f=e.random||(e.rng||s)();null==c&&(c=r=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==u&&(u=i=(f[6]<<8|f[7])&16383)}var p=void 0!==e.msecs?e.msecs:Date.now(),g=void 0!==e.nsecs?e.nsecs:h+1,y=p-d+(g-h)/1e4;if(y<0&&void 0===e.clockseq&&(u=u+1&16383),(y<0||p>d)&&void 0===e.nsecs&&(g=0),g>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");d=p,h=g,i=u;var m=((0xfffffff&(p+=122192928e5))*1e4+g)%0x100000000;a[o++]=m>>>24&255,a[o++]=m>>>16&255,a[o++]=m>>>8&255,a[o++]=255&m;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++]=u>>>8|128,a[o++]=255&u;for(var k=0;k<6;++k)a[o+k]=c[k];return t||l(a)},"v3",0,v,"v4",0,function(e,t,r){var i=(e=e||{}).random||(e.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=i[n];return t}return l(i)},"v5",0,_,"validate",0,a,"version",0,function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}],861250)},278314,(e,t,r)=>{"use strict";let i=e.r(861250).v4;t.exports=function(e,t,r,n){if("string"!=typeof e)throw TypeError(e+" 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:e};if(2===s&&(o.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw TypeError(t+" must be an object, array or omitted");o.params=t}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}},544033,(e,t,r)=>{"use strict";let i=e.r(861250).v4,n=e.r(278314),s=function(e,t){if(!(this instanceof s))return new s(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return i()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};t.exports=s,s.prototype.request=function(e,t,r,i){let s,o=this,a=null,c=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&c)throw TypeError("JSON-RPC 1.0 does not support batching");let u=!c&&e&&"object"==typeof e&&"function"==typeof t;if(c||u)i=t,a=e;else{"function"==typeof r&&(i=r,r=void 0);let s="function"==typeof i;try{a=n(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(s)return void i(e);throw e}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(e){i(e);return}return this.callServer(s,function(e,t){o._parseResponse(e,t,i)}),a},s.prototype._parseResponse=function(e,t,r){let i;if(e)return void r(e);if(!t)return void r();try{i=JSON.parse(t,this.options.reviver)}catch(e){r(e);return}if(3===r.length)if(!Array.isArray(i))return void r(null,i.error,
2i.result);else{let e=function(e){return void 0!==e.error};r(null,i.filter(e),i.filter(function(t){return!e(t)}));return}r(null,i)}},679844,865587,649162,876990,e=>{"use strict";var t,r,i,n,s,o=e.i(956376),a=e.i(117956),c=e.i(351824),u=e.i(962754),l=e.i(582050),d=e.i(698917);let h=BigInt(0),f=BigInt(1),p=BigInt(2),g=BigInt(8),y={zip215:!0};var m=e.i(517677);BigInt(0),BigInt(1),BigInt(2);let b=BigInt(0),k=BigInt(1),w=BigInt(2),S=BigInt(3),v=BigInt(5),I=BigInt(8),_={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:I,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")},A=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function E(e,t){var r;let i,n,s,o,a,c,u,l,h,f,p,g,y,m,b,S=_.p,I=(0,d.mod)(t*t*t,S),E=(r=e*(0,d.mod)(I*I*t,S),i=BigInt(10),n=BigInt(20),s=BigInt(40),o=BigInt(80),c=r*r%(a=_.p)*r%a,u=(0,d.pow2)(c,w,a)*c%a,l=(0,d.pow2)(u,k,a)*r%a,h=(0,d.pow2)(l,v,a)*l%a,f=(0,d.pow2)(h,i,a)*h%a,p=(0,d.pow2)(f,n,a)*f%a,g=(0,d.pow2)(p,s,a)*p%a,y=(0,d.pow2)(g,o,a)*g%a,m=(0,d.pow2)(y,o,a)*g%a,b=(0,d.pow2)(m,i,a)*h%a,{pow_p_5_8:(0,d.pow2)(b,w,a)*r%a,b2:c}).pow_p_5_8,x=(0,d.mod)(e*I*E,S),B=(0,d.mod)(t*x*x,S),P=x,T=(0,d.mod)(x*A,S),R=B===e,C=B===(0,d.mod)(-e,S),L=B===(0,d.mod)(-e*A,S);return R&&(x=P),(C||L)&&(x=T),(0,d.isNegativeLE)(x,S)&&(x=(0,d.mod)(-x,S)),{isValid:R||C,value:x}}let x=(0,d.Field)(_.p,void 0,!0),B=function(e){let t,r,{CURVE:i,curveOpts:n,eddsaOpts:s}=(t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r={Fp:e.Fp,Fn:(0,d.Field)(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},{CURVE:t,curveOpts:r,eddsaOpts:{hash:e.hash,randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve}}),o=function(e,t){(0,l._validateObject)(t,{hash:"function"},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:r,hash:i}=t,{BASE:n,Fp:s,Fn:o}=e,a=o.ORDER,u=t.randomBytes||c.randomBytes,d=t.adjustScalarBytes||(e=>e),f=t.domain||((e,t,r)=>{if((0,l.abool)("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function p(e){var t;return t=(0,l.bytesToNumberLE)(e),o.create(t)}function g(e){var t;let r,o,a,c,u,{head:h,prefix:f,scalar:g}=(t=e,r=s.BYTES,t=(0,l.ensureBytes)("private key",t,r),a=d((o=(0,l.ensureBytes)("hashed private key",i(t),2*r)).slice(0,r)),c=o.slice(r,2*r),u=p(a),{head:a,prefix:c,scalar:u}),y=n.multiply(g),m=y.toBytes();return{head:h,prefix:f,scalar:g,point:y,pointBytes:m}}function m(e=Uint8Array.of(),...t){return p(i(f((0,c.concatBytes)(...t),(0,l.ensureBytes)("context",e),!!r)))}return n.precompute(8),{getPublicKey:function(e){return g(e).pointBytes},sign:function(e,t,i={}){var u;e=(0,l.ensureBytes)("message",e),r&&(e=r(e));let{prefix:d,scalar:f,pointBytes:p}=g(t),y=m(i.context,d,e),b=n.multiply(y).toBytes(),k=(u=y+m(i.context,b,p,e)*f,o.create(u));(0,l.aInRange)("signature.s",k,h,a);let w=s.BYTES,S=(0,c.concatBytes)(b,(0,l.numberToBytesLE)(k,w));return(0,l.ensureBytes)("result",S,2*w)},verify:function(t,i,o,a=y){let c,u,d,{context:h,zip215:f}=a,p=s.BYTES;t=(0,l.ensureBytes)("signature",t,2*p),i=(0,l.ensureBytes)("message",i),o=(0,l.ensureBytes)("publicKey",o,p),void 0!==f&&(0,l.abool)("zip215",f),r&&(i=r(i));let g=(0,l.bytesToNumberLE)(t.slice(p,2*p));try{c=e.fromHex(o,f),u=e.fromHex(t.slice(0,p),f),d=n.multiplyUnsafe(g)}catch(e){return!1}if(!f&&c.isSmallOrder())return!1;let b=m(h,u.toBytes(),c.toBytes(),i);return u.add(c.multiplyUnsafe(b)).subtract(d).clearCofactor().is0()},utils:{getExtendedPublicKey:g,randomPrivateKey:()=>u(s.BYTES),precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)},Point:e}}(function(e,t={}){var r,i;let n,s,o,a,d,{Fp:y,Fn:m}=(0,u._createCurveFields)("edwards",e,t),{h:b,n:k}=e;(0,l._validateObject)(t,{},{uvRatio:"function"});let w=p<<BigInt(8*m.BYTES)-f,S=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:y.sqrt(y.div(e,t))}}catch(e){return{isValid:!1,value:h}}});if(r=e.Gx,i=e.Gy,n=y.sqr(r),s=y.sqr(i),o=y.add(y.mul(e.a,n),s),a=y.add(y.ONE,y.mul(e.d,y.mul(n,s))),!y.eql(o,a))throw Error("bad curve params: generator point");function v(e,t,r=!1){let i=r?f:h;return(0,l.aInRange)("coordinate "+e,t,i,w),t}function I(e){if(!(e instanceof E))throw Error("ExtendedPoint expected")}let _=(0,l.memoized)((e,t)=>{let r,i,n,{ex:s,ey:o,ez:a}=e,c=e.is0();null==t&&(t=c?g:y.inv(a));let u=(r=s*t,y.create(r)),l=(i=o*t,y.create(i)),d=(n=a*t,y.create(n));if(c)return{x:h,y:f};
vendor: 2,100 bytes, line 2
2if(d!==f)throw Error("invZ was invalid");return{x:u,y:l}}),A=(0,l.memoized)(t=>{let r,i,n,s,o,a,c,u,l,d,h,f,{a:p,d:g}=e;if(t.is0())throw Error("bad point: ZERO");let{ex:m,ey:b,ez:k,et:w}=t,S=(r=m*m,y.create(r)),v=(i=b*b,y.create(i)),I=(n=k*k,y.create(n)),_=(s=I*I,y.create(s));if(c=I*(o=S*p,a=y.create(o)+v,y.create(a)),y.create(c)!==(d=_+(l=g*(u=S*v,y.create(u)),y.create(l)),y.create(d)))throw Error("bad point: equation left != right (1)");if(h=m*b,y.create(h)!==(f=k*w,y.create(f)))throw Error("bad point: equation left != right (2)");return!0});class E{constructor(e,t,r,i){this.ex=v("x",e),this.ey=v("y",t),this.ez=v("z",r,!0),this.et=v("t",i),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){let t;if(e instanceof E)throw Error("extended point not allowed");let{x:r,y:i}=e||{};return v("x",r),v("y",i),new E(r,i,f,(t=r*i,y.create(t)))}static normalizeZ(e){return(0,u.normalizeZ)(E,"ez",e)}static msm(e,t){return(0,u.pippenger)(E,m,e,t)}_setWindowSize(e){this.precompute(e)}precompute(e=8,t=!0){return x.setWindowSize(this,e),t||this.multiply(p),this}assertValidity(){A(this)}equals(e){let t,r,i,n;I(e);let{ex:s,ey:o,ez:a}=this,{ex:c,ey:u,ez:l}=e,d=(t=s*l,y.create(t)),h=(r=c*a,y.create(r)),f=(i=o*l,y.create(i)),p=(n=u*a,y.create(n));return d===h&&f===p}is0(){return this.equals(E.ZERO)}negate(){let e,t;return new E((e=-this.ex,y.create(e)),this.ey,this.ez,(t=-this.et,y.create(t)))}double(){let t,r,i,n,s,o,a,c,u,l,d,{a:h}=e,{ex:f,ey:g,ez:m}=this,b=(t=f*f,y.create(t)),k=(r=g*g,y.create(r)),w=(n=p*(i=m*m,y.create(i)),y.create(n)),S=(s=h*b,y.create(s)),v=f+g,I=(o=v*v,a=y.create(o)-b-k,y.create(a)),_=S+k,A=_-w,x=S-k,B=(c=I*A,y.create(c)),P=(u=_*x,y.create(u)),T=(l=I*x,y.create(l));return new E(B,P,(d=A*_,y.create(d)),T)}add(t){let r,i,n,s,o,a,c,u,l,d;I(t);let{a:h,d:f}=e,{ex:p,ey:g,ez:m,et:b}=this,{ex:k,ey:w,ez:S,et:v}=t,_=(r=p*k,y.create(r)),A=(i=g*w,y.create(i)),x=(n=b*f*v,y.create(n)),B=(s=m*S,y.create(s)),P=(o=(p+g)*(k+w)-_-A,y.create(o)),T=B-x,R=B+x,C=(a=A-h*_,y.create(a)),L=(c=P*T,y.create(c)),O=(u=R*C,y.create(u)),z=(l
2=P*C,y.create(l));return new E(L,O,(d=T*R,y.create(d)),z)}subtract(e){return this.add(e.negate())}multiply(e){(0,l.aInRange)("scalar",e,f,k);let{p:t,f:r}=x.wNAFCached(this,e,E.normalizeZ);return E.normalizeZ([t,r])[0]}multiplyUnsafe(e,t=E.ZERO){return((0,l.aInRange)("scalar",e,h,k),e===h)?E.ZERO:this.is0()||e===f?this:x.wNAFCachedUnsafe(this,e,E.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(b).is0()}isTorsionFree(){return x.wNAFCachedUnsafe(this,k).is0()}toAffine(e){return _(this,e)}clearCofactor(){return b===f?this:this.multiplyUnsafe(b)}static fromBytes(e,t=!1){return(0,c.abytes)(e),this.fromHex(e,t)}static fromHex(t,r=!1){let i,n,s,o,{d:a,a:c}=e,u=y.BYTES;t=(0,l.ensureBytes)("pointHex",t,u),(0,l.abool)("zip215",r);let d=t.slice(),p=t[u-1];d[u-1]=-129&p;let g=(0,l.bytesToNumberLE)(d),m=r?w:y.ORDER;(0,l.aInRange)("pointHex.y",g,h,m);let b=(i=g*g,y.create(i)),{isValid:k,value:v}=S((n=b-f,y.create(n)),(s=a*b-c,y.create(s)));if(!k)throw Error("Point.fromHex: invalid y coordinate");let I=(v&f)===f,_=(128&p)!=0;if(!r&&v===h&&_)throw Error("Point.fromHex: x=0 and x_0=1");return _!==I&&(o=-v,v=y.create(o)),E.fromAffine({x:v,y:g})}static fromPrivateScalar(e){return E.BASE.multiply(e)}toBytes(){let{x:e,y:t}=this.toAffine(),r=(0,l.numberToBytesLE)(t,y.BYTES);return r[r.length-1]|=e&f?128:0,r}toRawBytes(){return this.toBytes()}toHex(){return(0,c.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}E.BASE=new E(e.Gx,e.Gy,f,(d=e.Gx*e.Gy,y.create(d))),E.ZERO=new E(h,f,f,h),E.Fp=y,E.Fn=m;let x=(0,u.wNAF)(E,8*m.BYTES);return E}(i,n),s);return Object.assign({},o,{ExtendedPoint:o.Point,CURVE:e})}({..._,Fp:x,hash:a.sha512,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:E}),P=(x.ORDER+S)/I,T=x.pow(w,P),R=x.sqrt(x.neg(x.ONE)),C=(0,d.FpSqrtEven)(x,x.neg(BigInt(486664)));(0,m.createHasher)(B.Point,e=>
2(function(e){let t,r,i,n,s,o,a,c,u,l,h,f,p,g,y,m,b,S,_,A,E,B,P,{xMn:L,xMd:O,yMn:z,yMd:N}=(t=(x.ORDER-v)/I,r=BigInt(486662),i=x.sqr(e),i=x.mul(i,w),n=x.add(i,x.ONE),s=x.neg(r),o=x.sqr(n),a=x.mul(o,n),c=x.mul(i,r),c=x.mul(c,s),c=x.add(c,o),c=x.mul(c,s),u=x.sqr(a),o=x.sqr(u),u=x.mul(u,a),u=x.mul(u,c),o=x.mul(o,u),l=x.pow(o,t),l=x.mul(l,u),h=x.mul(l,R),o=x.sqr(l),o=x.mul(o,a),f=x.eql(o,c),p=x.cmov(h,l,f),g=x.mul(s,i),y=x.mul(l,e),y=x.mul(y,T),m=x.mul(y,R),b=x.mul(c,i),o=x.sqr(y),o=x.mul(o,a),S=x.eql(o,b),_=x.cmov(m,y,S),o=x.sqr(p),o=x.mul(o,a),A=x.eql(o,c),E=x.cmov(g,s,A),B=x.cmov(_,p,A),P=x.isOdd(B),{xMn:E,xMd:n,yMn:B=x.cmov(B,x.neg(B),A!==P),yMd:k}),U=x.mul(L,N);U=x.mul(U,C);let W=x.mul(O,z),K=x.sub(L,O),q=x.add(L,O),M=x.mul(W,q),D=x.eql(M,x.ZERO);U=x.cmov(U,x.ZERO,D),W=x.cmov(W,x.ONE,D),K=x.cmov(K,x.ONE,D),q=x.cmov(q,x.ONE,D);let[F,V]=(0,d.FpInvertBatch)(x,[W,q],!0);return{x:x.mul(U,F),y:x.mul(K,V)}})(e[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:x.ORDER,m:1,k:128,expand:"xmd",hash:a.sha512});e.s(["ed25519",0,B],865587);var L=e.i(93340),O=e.i(55463),z=e.i(198537),N=e.i(541014),U=e.i(543505);function W([e,t]){return`${e}=${function e(t){return Array.isArray(t)?"%5B"+t.map(e).join("%2C%20")+"%5D":"bigint"==typeof t?`${t}n`:encodeURIComponent(String(null!=t&&null===Object.getPrototypeOf(t)?{...t}:t))}(t)}`}e.i(335292);var K=class extends Error{cause=this.cause;context;constructor(...[e,t]){let r,i;if(t){const{cause:e,...n}=t;e&&(i={cause:e}),Object.keys(n).length>0&&(r=n)}super(function(e,t={}){{let r=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(r+=` '${btoa(Object.entries(t).map(W).join("&"))}'`),`${r}\``}}(e,r),i),this.context={__code:e,...r},this.name="SolanaError"}};function q(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}var M=((t=M||{})[t.Little=0]="Little",t[t.Big=1]="Big",t);function D(e){return e?.endian!==1}var F=(e={})=>{var t,r;return Object.freeze({...r={fixedSize:(t={config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}).size,write(e,r,i){t.range&&function(e,t,r,i){if(i<t||i>r)throw new K(8078011,{codecDescription:e,max:r,min:t,value:i})}(t.name,t.range[0],t.range[1],e);let n=new ArrayBuffer(t.size);return t.set(new DataView(n),e,D(t.config)),r.set(new Uint8Array(n),i),i+t.size}},encode:e=>{let t=new Uint8Array("fixedSize"in r?r.fixedSize:r.getSizeFromValue(e));return r.write(e,t,0),t}})};class V extends TypeError{constructor(e,t){let r;const{message:i,explanation:n,...s}=e,{path:o}=e,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=[e,...t()])}}function $(e){return"object"==typeof e&&null!=e}function j(e){return $(e)&&!Array.isArray(e)}function H(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*G(e,t,r,i){var n;for(let s of($(n=e)&&"function"==typeof n[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,r,i){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:n,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${H(i)}\``}=e;return{value:i,type:o,refinement:a,key:n[n.length-1],path:n,branch:s,...e,message:c}}(s,t,r,i);e&&(yield e)}}function*J(e,t,r={}){let{path:i=[],branch:n=[e],coerce:s=!1,mask:o=!1}=r,a={path:i,branch:n,mask:o};s&&(e=t.coercer(e,a));let c="valid";for(let i of t.validator(e,a))i.explanation=r.message,c="not_valid",yield[i,void 0];for(let[u,l,d]of t.entries(e,a))for(let t of J(l,d,{path:void 0===u?i:[...i,u],branch:void 0===u?n:[...n,l],coerce:s,mask:o,message:r.message}))t[0]?(c=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):s&&(l=t[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):$(e)&&(void 0!==l||u in e)&&(e[u]=l));if("not_valid"!==c)for(let i of t.refiner(e,a))i.explanation=r.message,c="not_refined",yield[i,void 0];"valid"===c&&(yield[void 0,e])}class Y{constructor(e){const{type:t,schema:r,validator:i,refiner:n,coercer:s=e=>e,entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=s,i?this.validator=(e,t)=>
vendor: 8,015 bytes, line 2
2G(i(e,t),t,this,e):this.validator=()=>[],n?this.refiner=(e,t)=>G(n(e,t),t,this,e):this.refiner=()=>[]}assert(e,t){return Z(e,this,t)}create(e,t){return X(e,this,t)}is(e){var t,r;return t=e,r=this,!Q(t,r)[0]}mask(e,t){var r=e,i=this,n=t;let s=Q(r,i,{coerce:!0,mask:!0,message:n});if(!s[0])return s[1];throw s[0]}validate(e,t={}){return Q(e,this,t)}}function Z(e,t,r){let i=Q(e,t,{message:r});if(i[0])throw i[0]}function X(e,t,r){let i=Q(e,t,{coerce:!0,message:r});if(!i[0])return i[1];throw i[0]}function Q(e,t,r={}){let i=J(e,t,r),n=function(e){let{done:t,value:r}=e.next();return t?void 0:r}(i);return n[0]?[new V(n[0],function*(){for(let e of i)e[0]&&(yield e[0])}),void 0]:[void 0,n[1]]}function ee(e,t){return new Y({type:e,schema:null,validator:t})}function et(){return ee("any",()=>!0)}function er(e){return new Y({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[r,i]of t.entries())yield[r,i,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${H(e)}`})}function ei(){return ee("boolean",e=>"boolean"==typeof e)}function en(e){return ee("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${H(t)}`)}function es(e){let t=H(e),r=typeof e;return new Y({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${H(r)}`})}function eo(e){return new Y({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function ea(){return ee("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${H(e)}`)}function ec(e){return new Y({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function eu(e,t){return new Y({type:"record",schema:null,*entries(r){if($(r))for(let i in r){let n=r[i];yield[i,i,e],yield[i,n,t]}},validator:e=>j(e)||`Expected an object, but received: ${H(e)}`,coercer:e=>j(e)?{...e}:e})}function el(){return ee("string",e=>"string"==typeof e||`Expected a string, but received: ${H(e)}`)}function ed(e){let t=ee("never",()=>!1);return new Y({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let i=Math.max(e.length,r.length);for(let n=0;n<i;n++)yield[n,r[n],e[n]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${H(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function eh(e){let t=Object.keys(e);return new Y({type:"type",schema:e,*entries(r){if($(r))for(let i of t)yield[i,r[i],e[i]]},validator:e=>j(e)||`Expected an object, but received: ${H(e)}`,coercer:e=>j(e)?{...e}:e})}function ef(e){let t=e.map(e=>e.type).join(" | ");return new Y({type:"union",schema:null,coercer(t,r){for(let i of e){let[e,n]=i.validate(t,{coerce:!0,mask:r.mask});if(!e)return n}return t},validator(r,i){let n=[];for(let t of e){let[...e]=J(r,t,i),[s]=e;if(!s[0])return[];for(let[t]of e)t&&n.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${H(r)}`,...n]}})}function ep(){return ee("unknown",()=>!0)}function eg(e,t,r){return new Y({...e,coercer:(i,n)=>Q(i,t)[0]?e.coercer(i,n):e.coercer(r(i,n),n)})}e.s(["any",0,et,"array",0,er,"assert",0,Z,"boolean",0,ei,"coerce",0,eg,"create",0,X,"instance",0,en,"literal",0,es,"nullable",0,eo,"number",0,ea,"optional",0,ec,"record",0,eu,"string",0,el,"tuple",0,ed,"type",0,eh,"union",0,ef,"unknown",0,ep],649162);var ey=e.i(544033);e.i(948053);var em=e.i(757784),em=em,eb=class extends em.default{socket;constructor(e,t){super(),this.socket=new window.WebSocket(e,t.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,r){let i=r||t;try{this.socket.send(e),i()}catch(e){i(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,r){this.socket.addEventListener(e,t,r)}};function ek(e,t){return new eb(e,t)}var ew=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},eS=class extends em.default{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:i=!0,reconnect_interval:n=1e3,max_reconnects:s=5,...o}={},a,c){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,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),c?this.dataPack=c:this.dataPack=new ew,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,r,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(e,t);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t||void 0,id:o}),i,e=>{if(e)return s(e);this.queue[o]={promise:[n,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(Error("reply timeout"))},r))})})}async login(e){let t=await this.call("rpc.login",e);if(!t)throw Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise((r,i)=>{if(!this.ready)return i(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t}),e=>{if(e)return i(e);r()})})}async subscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket&&this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}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(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=o.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);let t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let r=0;r<e.params.length;r++)t.push(e.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,t)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,e?.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>this.emit("error",e)),this.socket.addEventListener("close",({code:r,reason:i})=>{this.ready&&setTimeout(()=>
2this.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(e,t),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,i),1))})}};e.s(["CommonClient",0,eS,"WebSocket",0,ek],876990);var ev=e.i(96157),eI=e.i(859442);let e_=B.utils.randomPrivateKey,eA=()=>{let e=B.utils.randomPrivateKey(),t=eE(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),{publicKey:t,secretKey:r}},eE=B.getPublicKey;function ex(e){try{return B.ExtendedPoint.fromHex(e),!0}catch{return!1}}let eB=(e,t)=>B.sign(e,t.slice(0,32)),eP=B.verify,eT=e=>o.Buffer.isBuffer(e)?e:e instanceof Uint8Array?o.Buffer.from(e.buffer,e.byteOffset,e.byteLength):o.Buffer.from(e);class eR{constructor(e){Object.assign(this,e)}encode(){return o.Buffer.from((0,N.serialize)(eC,this))}static decode(e){return(0,N.deserialize)(eC,this,e)}static decodeUnchecked(e){return(0,N.deserializeUnchecked)(eC,this,e)}}let eC=new Map,eL=1;class eO extends eR{constructor(e){if(super({}),this._bn=void 0,function(e){return void 0!==e._bn}(e))this._bn=e._bn;else{if("string"==typeof e){const t=O.default.decode(e);if(32!=t.length)throw Error("Invalid public key input");this._bn=new L.default(t)}else this._bn=new L.default(e);if(this._bn.byteLength()>32)throw Error("Invalid public key input")}}static unique(){let e=new eO(eL);return eL+=1,new eO(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return O.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){let e=this._bn.toArrayLike(o.Buffer);if(32===e.length)return e;let t=o.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,r){let i=o.Buffer.concat([e.toBuffer(),o.Buffer.from(t),r.toBuffer()]);return new eO((0,z.sha256)(i))}static createProgramAddressSync(e,t){let r=o.Buffer.alloc(0);e.forEach(function(e){if(e.length>32)throw TypeError("Max seed length exceeded");r=o.Buffer.concat([r,eT(e)])}),r=o.Buffer.concat([r,t.toBuffer(),o.Buffer.from("ProgramDerivedAddress")]);let i=(0,z.sha256)(r);if(ex(i))throw Error("Invalid seeds, address must fall off the curve");return new eO(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let r,i=255;for(;0!=i;){try{let n=e.concat(o.Buffer.from([i]));r=this.createProgramAddressSync(n,t)}catch(e){if(e instanceof TypeError)throw e;i--;continue}return[r,i]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return ex(new eO(e).toBytes())}}eO.default=new eO("11111111111111111111111111111111"),eC.set(eO,{kind:"struct",fields:[["_bn","u256"]]});let ez=new eO("BPFLoader1111111111111111111111111111111111");class eN extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(eN.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class eU extends Error{constructor(e,t){super(`Transaction was not confirmed in ${t.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(eU.prototype,"name",{value:"TransactionExpiredTimeoutError"});class eW extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(eW.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class eK{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){let e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(let t of this.keySegments())if(e<t.length)return t[e];else e-=t.length}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw Error("Account index overflow encountered during compilation");let t=new Map;
vendor: 18,166 bytes, line 2
2this.keySegments().flat().forEach((e,r)=>{t.set(e.toBase58(),r)});let r=e=>{let r=t.get(e.toBase58());if(void 0===r)throw Error("Encountered an unknown instruction account key during compilation");return r};return e.map(e=>({programIdIndex:r(e.programId),accountKeyIndexes:e.keys.map(e=>r(e.pubkey)),data:e.data}))}}let eq=(e="publicKey")=>U.blob(32,e),eM=(e="string")=>{let t=U.struct([U.u32("length"),U.u32("lengthPadding"),U.blob(U.offset(U.u32(),-8),"chars")],e),r=t.decode.bind(t),i=t.encode.bind(t);return t.decode=(e,t)=>r(e,t).chars.toString(),t.encode=(e,t,r)=>i({chars:o.Buffer.from(e,"utf8")},t,r),t.alloc=e=>U.u32().span+U.u32().span+o.Buffer.from(e,"utf8").length,t};function eD(e){let t=0,r=0;for(;;){let i=e.shift();if(t|=(127&i)<<7*r,r+=1,(128&i)==0)break}return t}function eF(e,t){let r=t;for(;;){let t=127&r;if(0==(r>>=7)){e.push(t);break}t|=128,e.push(t)}}function eV(e,t){if(!e)throw Error(t||"Assertion failed")}class e${constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){let r=new Map,i=e=>{let t=e.toBase58(),i=r.get(t);return void 0===i&&(i={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,i)),i},n=i(t);for(let t of(n.isSigner=!0,n.isWritable=!0,e))for(let e of(i(t.programId).isInvoked=!0,t.keys)){let t=i(e.pubkey);t.isSigner||=e.isSigner,t.isWritable||=e.isWritable}return new e$(t,r)}getMessageComponents(){let e=[...this.keyMetaMap.entries()];eV(e.length<=256,"Max static account keys length exceeded");let t=e.filter(([,e])=>e.isSigner&&e.isWritable),r=e.filter(([,e])=>e.isSigner&&!e.isWritable),i=e.filter(([,e])=>!e.isSigner&&e.isWritable),n=e.filter(([,e])=>!e.isSigner&&!e.isWritable),s={numRequiredSignatures:t.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:n.length};{eV(t.length>0,"Expected at least one writable signer key");let[e]=t[0];eV(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...t.map(([e])=>new eO(e)),...r.map(([e])=>new eO(e)),...i.map(([e])=>new eO(e)),...n.map(([e])=>new eO(e))]]}extractTableLookup(e){let[t,r]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&e.isWritable),[i,n]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&!e.isWritable);if(0!==t.length||0!==i.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:i},{writable:r,readonly:n}]}drainKeysFoundInLookupTable(e,t){let r=[],i=[];for(let[n,s]of this.keyMetaMap.entries())if(t(s)){let t=new eO(n),s=e.findIndex(e=>e.equals(t));s>=0&&(eV(s<256,"Max lookup table index exceeded"),r.push(s),i.push(t),this.keyMetaMap.delete(n))}return[r,i]}}let ej="Reached end of buffer unexpectedly";function eH(e){if(0===e.length)throw Error(ej);return e.shift()}function eG(e,...t){let[r]=t;if(2===t.length?r+(t[1]??0)>e.length:r>=e.length)throw Error(ej);return e.splice(...t)}class eJ{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(e=>new eO(e)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:O.default.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new eK(this.staticAccountKeys)}static compile(e){let[t,r]=e$.compile(e.instructions,e.payerKey).getMessageComponents(),i=new eK(r).compileInstructions(e.instructions).map(e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:O.default.encode(e.data)}));return new eJ({header:t,accountKeys:r,recentBlockhash:e.recentBlockhash,instructions:i})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let t=this.header.numRequiredSignatures;if(!(e>=this.header.numRequiredSignatures))return e<t-this.header.numReadonlySignedAccounts;{let r=this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts;return e-t<r}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){let e=this.accountKeys.length,t=[];eF(t,e);let r=this.instructions.map(e=>{let{accounts:t,programIdIndex:r}=e,i=Array.from(O.default.decode(e.data)),n=[];eF(n,t.length);let s=[];return eF(s,i.length),{programIdIndex:r,keyIndicesCount:o.Buffer.from(n),keyIndices:t,dataLength:o.Buffer.from(s),data:i}}),i=[];eF(i,r.length);let n=o.Buffer.alloc(1232);o.Buffer.from(i).copy(n);let s=i.length;r.forEach(e=>{let t=U.struct([U.u8("programIdIndex"),U.blob(e.keyIndicesCount.length,"keyIndicesCount"),U.seq(U.u8("keyIndex"),e.keyIndices.length,"keyIndices"),U.blob(e.dataLength.length,"dataLength"),U.seq(U.u8("userdatum"),e.data.length,"data")]).encode(e,n,s);s+=t}),n=n.slice(0,s);let a=U.struct([U.blob(1,"numRequiredSignatures"),U.blob(1,"numReadonlySignedAccounts"),U.blob(1,"numReadonlyUnsignedAccounts"),U.blob(t.length,"keyCount"),U.seq(eq("key"),e,"keys"),eq("recentBlockhash")]),c={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(t),keys:this.accountKeys.map(e=>eT(e.toBytes())),recentBlockhash:O.default.decode(this.recentBlockhash)},u=o.Buffer.alloc(2048),l=a.encode(c,u);return n.copy(u,l),u.slice(0,l+n.length)}static from(e){let t=[...e],r=eH(t);if(r!==(127&r))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=eH(t),n=eH(t),s=eD(t),a=[];for(let e=0;e<s;e++){let e=eG(t,0,32);a.push(new eO(o.Buffer.from(e)))}let c=eG(t,0,32),u=eD(t),l=[];for(let e=0;e<u;e++){let e=eH(t),r=eD(t),i=eG(t,0,r),n=eD(t),s=eG(t,0,n),a=O.default.encode(o.Buffer.from(s));l.push({programIdIndex:e,accounts:i,data:a})}return new eJ({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:n},recentBlockhash:O.default.encode(o.Buffer.from(c)),accountKeys:a,instructions:l})}}class eY{constructor(e){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(let t of this.addressTableLookups)e+=t.readonlyIndexes.length+t.writableIndexes.length;return e}getAccountKeys(e){let t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw Error("Failed to get account keys because address table lookups were not resolved");return new eK(this.staticAccountKeys,t)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let t=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(e>=r)return e-r<this.addressTableLookups.reduce((e,t)=>e+t.writableIndexes.length,0);if(!(e>=this.header.numRequiredSignatures))return e<t-this.header.numReadonlySignedAccounts;{let i=r-t-this.header.numReadonlyUnsignedAccounts;return e-t<i}}resolveAddressTableLookups(e){let t={writable:[],readonly:[]};for(let r of this.addressTableLookups){let i=e.find(e=>e.key.equals(r.accountKey));if(!i)throw Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(let e of r.writableIndexes)if(e<i.state.addresses.length)t.writable.push(i.state.addresses[e]);else throw Error(`Failed to find address for index ${e} in address lookup table ${r.accountKey.toBase58()}`);for(let e of r.readonlyIndexes)if(e<i.state.addresses.length)t.readonly.push(i.state.addresses[e]);else throw Error(`Failed to find address for index ${e} in address lookup table ${r.accountKey.toBase58()}`)}return t}static compile(e){let t=e$.compile(e.instructions,e.payerKey),r=[],i={writable:[],readonly:[]};for(let n of e.addressLookupTableAccounts||[]){let e=t.extractTableLookup(n);if(void 0!==e){let[t,{writable:n,readonly:s}]=e;r.push(t),i.writable.push(...n),i.readonly.push(...s)}}let[n,s]=t.getMessageComponents(),o=new eK(s,i).compileInstructions(e.instructions);return new eY({header:n,staticAccountKeys:s,recentBlockhash:e.recentBlockhash,compiledInstructions:o,addressTableLookups:r})}serialize(){let e=[];eF(e,this.staticAccountKeys.length);let t=this.serializeInstructions(),r=[];eF(r,this.compiledInstructions.length);let i=this.serializeAddressTableLookups(),n=[];eF(n,this.addressTableLookups.length);let s=U.struct([U.u8("prefix"),U.struct([U.u8("numRequiredSignatures"),U.u8("numReadonlySignedAccounts"),U.u8("numReadonlyUnsignedAccounts")],"header"),U.blob(e.length,"staticAccountKeysLength"),U.seq(eq(),this.staticAccountKeys.length,"staticAccountKeys"),eq("recentBlockhash"),U.blob(r.length,"instructionsLength"),U.blob(t.length,"serializedInstructions"),U.blob(n.length,"addressTableLookupsLength"),U.blob(i.length,"serializedAddressTableLookups")]),o=new Uint8Array(1232),a=s.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(e=>e.toBytes()),recentBlockhash:O.default.decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(n),serializedAddressTableLookups:i},o);return o.slice(0,a)}serializeInstructions(){let e=0,t=new Uint8Array(1232);for(let r of this.compiledInstructions){let i=[];eF(i,r.accountKeyIndexes.length);let n=[];eF(n,r.data.length);let s=U.struct([U.u8("programIdIndex"),U.blob(i.length,"encodedAccountKeyIndexesLength"),U.seq(U.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),U.blob(n.length,"encodedDataLength"),U.blob(r.data.length,"data")]);e+=s.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(n),data:r.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0,t=new Uint8Array(1232);for(let r of this.addressTableLookups){let i=[];eF(i,r.writableIndexes.length);let n=[];eF(n,r.readonlyIndexes.length);let s=U.struct([eq("accountKey"),U.blob(i.length,"encodedWritableIndexesLength"),U.seq(U.u8(),r.writableIndexes.length,"writableIndexes"),U.blob(n.length,"encodedReadonlyIndexesLength"),U.seq(U.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);e+=s.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(n),readonlyIndexes:r.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e],r=eH(t),i=127&r;eV(r!==i,"Expected versioned message but received legacy message"),eV(0===i,`Expected versioned message with version 0 but found version ${i}`);let n={numRequiredSignatures:eH(t),numReadonlySignedAccounts:eH(t),numReadonlyUnsignedAccounts:eH(t)},s=[],o=eD(t);for(let e=0;e<o;e++)s.push(new eO(eG(t,0,32)));let a=O.default.encode(eG(t,0,32)),c=eD(t),u=[];for(let e=0;e<c;e++){let e=eH(t),r=eD(t),i=eG(t,0,r),n=eD(t),s=new Uint8Array(eG(t,0,n));u.push({programIdIndex:e,accountKeyIndexes:i,data:s})}let l=eD(t),d=[];for(let e=0;e<l;e++){let e=new eO(eG(t,0,32)),r=eD(t),i=eG(t,0,r),n=eD(t),s=eG(t,0,n);d.push({accountKey:e,writableIndexes:i,readonlyIndexes:s})}return new eY({header:n,staticAccountKeys:s,recentBlockhash:a,compiledInstructions:u,addressTableLookups:d})}}let eZ={deserializeMessageVersion(e){let t=e[0],r=127&t;return r===t?"legacy":r},deserialize:e=>{let t=eZ.deserializeMessageVersion(e);if("legacy"===t)return eJ.from(e);if(0===t)return eY.deserialize(e);throw Error(`Transaction message version ${t} deserialization is not supported`)}},eX=((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),eQ=o.Buffer.alloc(64).fill(0);class e0{constructor(e){this.keys=void 0,this.programId=void 0,this.data=o.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:r})=>({pubkey:e.toJSON(),isSigner:t,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}class e1{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){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,!e)return;if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:r}=e;this.minNonceContextSlot=t,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:r}=e;this.recentBlockhash=t,this.lastValidBlockHeight=r}else{const{recentBlockhash:t,nonceInfo:r}=e;r&&(this.nonceInfo=r),this.recentBlockhash=t}}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(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(0===e.length)throw Error("No instructions");return e.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new e0(e))}),this}compileMessage(){let e,t,r;if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw Error("Transaction recentBlockhash required");if(t.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 e=0;e<t.length;e++)if(void 0===t[e].programId)throw Error(`Transaction instruction index ${e} has undefined program id`);let i=[],n=[];t.forEach(e=>{e.keys.forEach(e=>{n.push({...e})});let t=e.programId.toString();i.includes(t)||i.push(t)}),i.forEach(e=>{n.push({pubkey:new eO(e),isSigner:!1,isWritable:!1})});let s=[];n.forEach(e=>{let t=e.pubkey.toString(),r=s.findIndex(e=>e.pubkey.toString()===t);r>-1?(s[r].isWritable=s[r].isWritable||e.isWritable,s[r].isSigner=s[r].isSigner||e.isSigner):s.push(e)}),s.sort(function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});let o=s.findIndex(e=>e.pubkey.equals(r));if(o>-1){let[e]=s.splice(o,1);e.isSigner=!0,e.isWritable=!0,s.unshift(e)}else s.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let e of this.signatures){let t=s.findIndex(t=>t.pubkey.equals(e.publicKey));if(t>-1)s[t].isSigner||(s[t].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: ${e.publicKey.toString()}`)}let a=0,c=0,u=0,l=[],d=[];s.forEach(({pubkey:e,isSigner:t,isWritable:r})=>{t?(l.push(e.toString()),a+=1,r||(c+=1)):(d.push(e.toString()),r||(u+=1))});let h=l.concat(d),f=t.map(e=>{let{data:t,programId:r}=e;return{programIdIndex:h.indexOf(r.toString()),accounts:e.keys.map(e=>h.indexOf(e.pubkey.toString())),data:O.default.encode(t)}});return f.forEach(e=>{eV(e.programIdIndex>=0),e.accounts.forEach(e=>eV(e>=0))}),new eJ({header:{numRequiredSignatures:a,numReadonlySignedAccounts:c,numReadonlyUnsignedAccounts:u},accountKeys:h,recentBlockhash:e,instructions:f})}_compile(){let e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((e,r)=>t[r].equals(e.publicKey))?e:(this.signatures=t.map(e=>({signature:null,publicKey:e})),e)}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(0===e.length)throw Error("No signers");let t=new Set;this.signatures=e.filter(e=>{let r=e.toString();return!t.has(r)&&(t.add(r),!0)}).map(e=>({signature:null,publicKey:e}))}sign(...e){if(0===e.length)throw Error("No signers");let t=new Set,r=[];for(let i of e){let e=i.publicKey.toString();t.has(e)||(t.add(e),r.push(i))}this.signatures=r.map(e=>({signature:null,publicKey:e.publicKey}));let i=this._compile();this._partialSign(i,...r)}partialSign(...e){if(0===e.length)throw Error("No signers");let t=new Set,r=[];for(let i of e){let e=i.publicKey.toString();t.has(e)||(t.add(e),r.push(i))}let i=this._compile();this._partialSign(i,...r)}_partialSign(e,...t){let r=e.serialize();
2t.forEach(e=>{let t=eB(r,e.secretKey);this._addSignature(e.publicKey,eT(t))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){eV(64===t.length);let r=this.signatures.findIndex(t=>e.equals(t.publicKey));if(r<0)throw Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=o.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){let r={};for(let{signature:i,publicKey:n}of this.signatures)null===i?t&&(r.missing||=[]).push(n):eP(i,e,n.toBytes())||(r.invalid||=[]).push(n);return r.invalid||r.missing?r:void 0}serialize(e){let{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(r){let e=this._getMessageSignednessErrors(i,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+=` 3Invalid signature for public key${1===e.invalid.length?"":"(s)"} [\`${e.invalid.map(e=>e.toBase58()).join("`, `")}\`].`),e.missing&&(t+=` 4Missing signature for public key${1===e.missing.length?"":"(s)"} [\`${e.missing.map(e=>e.toBase58()).join("`, `")}\`].`),Error(t)}}return this._serialize(i)}_serialize(e){let{signatures:t}=this,r=[];eF(r,t.length);let i=r.length+64*t.length+e.length,n=o.Buffer.alloc(i);return eV(t.length<256),o.Buffer.from(r).copy(n,0),t.forEach(({signature:e},t)=>{null!==e&&(eV(64===e.length,"signature has invalid length"),o.Buffer.from(e).copy(n,r.length+64*t))}),e.copy(n,r.length+64*t.length),eV(n.length<=1232,`Transaction too large: ${n.length} > 1232`),n}get keys(){return eV(1===this.instructions.length),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return eV(1===this.instructions.length),this.instructions[0].programId}get data(){return eV(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e],r=eD(t),i=[];for(let e=0;e<r;e++){let e=eG(t,0,64);i.push(O.default.encode(o.Buffer.from(e)))}return e1.populate(eJ.from(t),i)}static populate(e,t=[]){let r=new e1;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((t,i)=>{let n={signature:t==O.default.encode(eQ)?null:O.default.decode(t),publicKey:e.accountKeys[i]};r.signatures.push(n)}),e.instructions.forEach(t=>{let i=t.accounts.map(t=>{let i=e.accountKeys[t];return{pubkey:i,isSigner:r.signatures.some(e=>e.publicKey.toString()===i.toString())||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}});r.instructions.push(new e0({keys:i,programId:e.accountKeys[t.programIdIndex],data:O.default.decode(t.data)}))}),r._message=e,r._json=r.toJSON(),r}}class e2{constructor(e){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}static decompile(e,t){let{header:r,compiledInstructions:i,recentBlockhash:n}=e,{numRequiredSignatures:s,numReadonlySignedAccounts:o,numReadonlyUnsignedAccounts:a}=r,c=s-o;eV(c>0,"Message header is invalid");let u=e.staticAccountKeys.length-s-a;eV(u>=0,"Message header is invalid");let l=e.getAccountKeys(t),d=l.get(0);if(void 0===d)throw Error("Failed to decompile message because no account keys were found");let h=[];for(let e of i){let t=[];for(let i of e.accountKeyIndexes){let e,n=l.get(i);if(void 0===n)throw Error(`Failed to find key for account key index ${i}`);e=i<s?i<c:i<l.staticAccountKeys.length?i-s<u:i-l.staticAccountKeys.length<l.accountKeysFromLookups.writable.length,t.push({pubkey:n,isSigner:i<r.numRequiredSignatures,isWritable:e})}let i=l.get(e.programIdIndex);if(void 0===i)throw Error(`Failed to find program id for program id index ${e.programIdIndex}`);h.push(new e0({programId:i,data:eT(e.data),keys:t}))}return new e2({payerKey:d,instructions:h,recentBlockhash:n})}compileToLegacyMessage(){return eJ.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}compileToV0Message(e){return eY.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}}class e6{get version(){return this.message.version}constructor(e,t){if(this.signatures=void 0,this.message=void 0,void 0!==t)eV(t.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=t;else{const t=[];for(let r=0;r<e.header.numRequiredSignatures;r++)t.push(new Uint8Array(64));this.signatures=t}this.message=e}serialize(){let e=this.message.serialize(),t=[];eF(t,this.signatures.length);let r=U.struct([U.blob(t.length,"encodedSignaturesLength"),U.seq(((e="signature")=>U.blob(64,e))(),this.signatures.length,"signatures"),U.blob(e.length,"serializedMessage")]),i=new Uint8Array(2048),n=r.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},i);return i.slice(0,n)}static deserialize(e){let t=[...e],r=[],i=eD(t);for(let e=0;e<i;e++)r.push(new Uint8Array(eG(t,0,64)));return new e6(eZ.deserialize(new Uint8Array(t)),r)}sign(e){let t=this.message.serialize(),r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let i of e){let e=r.findIndex(e=>e.equals(i.publicKey));eV(e>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[e]=eB(t,i.secretKey)}}addSignature(e,t){eV(64===t.byteLength,"Signature must be 64 bytes long");let r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(t=>t.equals(e));eV(r>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[r]=t}}let e5=new eO("SysvarC1ock11111111111111111111111111111111"),e3=new eO("SysvarEpochSchedu1e111111111111111111111111"),e8=new eO("Sysvar1nstructions1111111111111111111111111"),e4=new eO("SysvarRecentB1ockHashes11111111111111111111"),e7=new eO("SysvarRent111111111111111111111111111111111"),e9=ne
vendor: 24,564 bytes, lines 4-8
4w eO("SysvarRewards111111111111111111111111111111"),te=new eO("SysvarS1otHashes111111111111111111111111111"),tt=new eO("SysvarS1otHistory11111111111111111111111111"),tr=new eO("SysvarStakeHistory1111111111111111111111111");class ti extends Error{constructor({action:e,signature:t,transactionMessage:r,logs:i}){let n;const s=i?`Logs: 5${JSON.stringify(i.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";switch(e){case"send":n=`Transaction ${t} resulted in an error. 6${r}. `+s+o;break;case"simulate":n=`Simulation failed. 7Message: ${r}. 8`+s+o;break;default:n=`Unknown action '${(e=>e)(e)}'`}super(n),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=t,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 e=this.transactionLogs;if(null==e||"object"!=typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((t,r)=>{e.getTransaction(this.signature).then(e=>{if(e&&e.meta&&e.meta.logMessages){let r=e.meta.logMessages;this.transactionLogs=r,t(r)}else r(Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}}class tn extends Error{constructor({code:e,message:t,data:r},i){super(null!=i?`${i}: ${t}`:t),this.code=void 0,this.data=void 0,this.code=e,this.data=r,this.name="SolanaJSONRPCError"}}async function ts(e,t,r,i){let n,s=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},o=await e.sendTransaction(t,r,s);if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)n=(await e.confirmTransaction({abortSignal:i?.abortSignal,signature:o,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},i&&i.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){let{nonceInstruction:r}=t.nonceInfo,s=r.keys[0].pubkey;n=(await e.confirmTransaction({abortSignal:i?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:s,nonceValue:t.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 e.confirmTransaction(o,i&&i.commitment)).value;if(n.err){if(null!=o)throw new ti({action:"send",signature:o,transactionMessage:`Status: (${JSON.stringify(n)})`});throw Error(`Transaction ${o} failed (${JSON.stringify(n)})`)}return o}function to(e){return new Promise(t=>setTimeout(t,e))}function ta(e,t){let r=e.layout.span>=0?e.layout.span:function e(t,r){let i=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(r[t.property]);if("count"in t&&"elementLayout"in t){let e=r[t.property];if(Array.isArray(e))return e.length*i(t.elementLayout)}else if("fields"in t)return e({layout:t},r[t.property]);return 0},n=0;return t.layout.fields.forEach(e=>{n+=i(e)}),n}(e,t),i=o.Buffer.alloc(r),n=Object.assign({instruction:e.index},t);return e.layout.encode(n,i),i}function tc(e,t){let r;try{r=e.layout.decode(t)}catch(e){throw Error("invalid instruction; "+e)}if(r.instruction!==e.index)throw Error(`invalid instruction; instruction index mismatch ${r.instruction} != ${e.index}`);return r}let tu=U.nu64("lamportsPerSignature"),tl=U.struct([U.u32("version"),U.u32("state"),eq("authorizedPubkey"),eq("nonce"),U.struct([tu],"feeCalculator")]),td=tl.span;class th{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){let t=tl.decode(eT(e),0);return new th({authorizedPubkey:new eO(t.authorizedPubkey),nonce:new eO(t.nonce).toString(),feeCalculator:t.feeCalculator})}}function tf(e){let t=(0,U.blob)(8,e),r=t.decode.bind(t),i=t.encode.bind(t),n=((e={})=>(function(e,t){if(q(e)!==q(t))throw new K(8078004);if(q(e)&&q(t)&&e.fixedSize!==t.fixedSize)throw new K(8078005,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!q(e)&&!q(t)&&e.maxSize!==t.maxSize)throw new K(8078006,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}})(F(e),((e={})=>{var t,r;return Object.freeze({...r={fixedSize:(t={config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}).size,read(e,r=0){var i,n,s;let o,a;!function(e,t,r=0){if(t.length-r<=0)throw new K(8078e3,{codecDescription:e})}(t.name,e,r),function(e,t,r,i=0){let n=r.length-i;if(n<t)throw new K(8078001,{bytesLength:n,codecDescription:e,expected:t})}(t.name,t.size,e,r);let c=new DataView((i=e,n=r,s=t.size,o=i.byteOffset+(n??0),a=s??i.byteLength,i.buffer.slice(o,o+a)));return[t.get(c,D(t.config)),r+t.size]}},decode:(e,t=0)=>r.read(e,t)[0]})})(e)))();return t.decode=(e,t)=>{let i=r(e,t);return n.decode(i)},t.encode=(e,t,r)=>i(n.encode(e),t,r),t}let tp=Object.freeze({Create:{index:0,layout:U.struct([U.u32("instruction"),U.ns64("lamports"),U.ns64("space"),eq("programId")])},Assign:{index:1,layout:U.struct([U.u32("instruction"),eq("programId")])},Transfer:{index:2,layout:U.struct([U.u32("instruction"),tf("lamports")])},CreateWithSeed:{index:3,layout:U.struct([U.u32("instruction"),eq("base"),eM("seed"),U.ns64("lamports"),U.ns64("space"),eq("programId")])},AdvanceNonceAccount:{index:4,layout:U.struct([U.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:U.struct([U.u32("instruction"),U.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:U.struct([U.u32("instruction"),eq("authorized")])},AuthorizeNonceAccount:{index:7,layout:U.struct([U.u32("instruction"),eq("authorized")])},Allocate:{index:8,layout:U.struct([U.u32("instruction"),U.ns64("space")])},AllocateWithSeed:{index:9,layout:U.struct([U.u32("instruction"),eq("base"),eM("seed"),U.ns64("space"),eq("programId")])},AssignWithSeed:{index:10,layout:U.struct([U.u32("instruction"),eq("base"),eM("seed"),eq("programId")])},TransferWithSeed:{index:11,layout:U.struct([U.u32("instruction"),tf("lamports"),eM("seed"),eq("programId")])},UpgradeNonceAccount:{index:12,layout:U.struct([U.u32("instruction")])}});class tg{static createAccount(e){let t=ta(tp.Create,{lamports:e.lamports,space:e.space,programId:eT(e.programId.toBuffer())});return new e0({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}static transfer(e){let t,r;return"basePubkey"in e?(t=ta(tp.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:eT(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=ta(tp.Transfer,{lamports:BigInt(e.lamports)}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]),new e0({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;return"basePubkey"in e?(t=ta(tp.AssignWithSeed,{base:eT(e.basePubkey.toBuffer()),seed:e.seed,programId:eT(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=ta(tp.Assign,{programId:eT(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new e0({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){let t=ta(tp.CreateWithSeed,{base:eT(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:eT(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||r.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new e0({keys:r,programId:this.programId,data:t})}static createNonceAccount(e){let t=new e1;"basePubkey"in e&&"seed"in e?t.add(tg.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:td,programId:this.programId})):t.add(tg.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:td,programId:this.programId}));let r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){let t=ta(tp.InitializeNonceAccount,{authorized:eT(e.authorizedPubkey.toBuffer())});return new e0({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e4,isSigner:!1,isWritable:!1},{pubkey:e7,isSigner:!1,isWritable:!1}],programId:this.programId,data:t})}static nonceAdvance(e){let t=ta(tp.AdvanceNonceAccount);return new e0({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e4,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceWithdraw(e){let t=ta(tp.WithdrawNonceAccount,{lamports:e.lamports});return new e0({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:e4,isSigner:!1,isWritable:!1},{pubkey:e7,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){let t=ta(tp.AuthorizeNonceAccount,{authorized:eT(e.newAuthorizedPubkey.toBuffer())});return new e0({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static allocate(e){let t,r;return"basePubkey"in e?(t=ta(tp.AllocateWithSeed,{base:eT(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:eT(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=ta(tp.Allocate,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new e0({keys:r,programId:this.programId,data:t})}}tg.programId=new eO("11111111111111111111111111111111");class ty{static getMinNumSignatures(e){return 2*(Math.ceil(e/ty.chunkSize)+1+1)}static async load(e,t,r,i,n){{let s=await e.getMinimumBalanceForRentExemption(n.length),o=await e.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 e1).add(tg.allocate({accountPubkey:r.publicKey,space:n.length})),o.owner.equals(i)||(a=a||new e1).add(tg.assign({accountPubkey:r.publicKey,programId:i})),o.lamports<s&&(a=a||new e1).add(tg.transfer({fromPubkey:t.publicKey,toPubkey:r.publicKey,lamports:s-o.lamports}))}else a=new e1().add(tg.createAccount({fromPubkey:t.publicKey,newAccountPubkey:r.publicKey,lamports:s>0?s:1,space:n.length,programId:i}));null!==a&&await ts(e,a,[t,r],{commitment:"confirmed"})}let s=U.struct([U.u32("instruction"),U.u32("offset"),U.u32("bytesLength"),U.u32("bytesLengthPadding"),U.seq(U.u8("byte"),U.offset(U.u32(),-8),"bytes")]),a=ty.chunkSize,c=0,u=n,l=[];for(;u.length>0;){let n=u.slice(0,a),d=o.Buffer.alloc(a+16);s.encode({instruction:0,offset:c,bytes:n,bytesLength:0,bytesLengthPadding:0},d);let h=new e1().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:d});l.push(ts(e,h,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await to(250),c+=a,u=u.slice(a)}await Promise.all(l);{let n=U.struct([U.u32("instruction")]),s=o.Buffer.alloc(n.span);n.encode({instruction:1},s);let a=new e1().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:e7,isSigner:!1,isWritable:!1}],programId:i,data:s}),c="processed",u=await e.sendTransaction(a,[t,r],{preflightCommitment:c}),{context:l,value:d}=await e.confirmTransaction({signature:u,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},c);if(d.err)throw Error(`Transaction ${u} failed (${JSON.stringify(d)})`);for(;;){try{if(await e.getSlot({commitment:c})>l.slot)break}catch{}await new Promise(e=>setTimeout(e,Math.round(200)))}}return!0}}ty.chunkSize=932;let tm=new eO("BPFLoader2111111111111111111111111111111111");var tb=(i=function(){if(s)return n;s=1;var e=Object.prototype.toString,t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};return n=function(r){var i=function r(i,n){var s,o,a,c,u,l,d;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]"===(d=e.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]"!==d)return JSON.stringify(i);for(o=(c=t(i).sort()).length,a="",s=0;s<o;)void 0!==(l=r(i[u=c[s]],!1))&&(a&&(a+=","),a+=JSON.stringify(u)+":"+l),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 tk(e){let t=0;for(;e>1;)e/=2,t++;return t}class tw{constructor(e,t,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=e,this.leaderScheduleSlotOffset=t,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=n}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){var t;let r=tk(0===(t=e+32+1)?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,(t|=t>>32)+1))-tk(32)-1,i=this.getSlotsInEpoch(r);return[r,e-(i-32)]}{let t=e-this.firstNormalSlot,r=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+r,t%this.slotsPerEpoch]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*32:(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+tk(32)):this.slotsPerEpoch}}var tS=globalThis.fetch;class tv extends eS{constructor(e,t,r){super(e=>{let r=ek(e,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...t});return"socket"in r?this.underlyingSocket=r.socket:this.underlyingSocket=r,r},e,t,r),this.underlyingSocket=void 0}call(...e){let t=this.underlyingSocket?.readyState;return 1===t?super.call(...e):Promise.reject(Error("Tried to call a JSON-RPC method `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}notify(...e){let t=this.underlyingSocket?.readyState;return 1===t?super.notify(...e):Promise.reject(Error("Tried to send a JSON-RPC notification `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}}class tI{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){let e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){let t=function(e,t){let r;try{r=e.layout.decode(t)}catch(e){throw Error("invalid instruction; "+e)}if(r.typeIndex!==e.index)throw Error(`invalid account data; account type mismatch ${r.typeIndex} != ${e.index}`);return r}(t_,e),r=e.length-56;eV(r>=0,"lookup table is invalid"),eV(r%32==0,"lookup table is invalid");let{addresses:i}=U.struct([U.seq(eq(),r/32,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new eO(t.authority[0]):void 0,addresses:i.map(e=>new eO(e))}}}let t_={index:1,layout:U.struct([U.u32("typeIndex"),tf("deactivationSlot"),U.nu64("lastExtendedSlot"),U.u8("lastExtendedStartIndex"),U.u8(),U.seq(eq(),U.offset(U.u8(),-1),"authority")])},tA=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,tE=eg(en(eO),el(),e=>new eO(e)),tx=ed([el(),es("base64")]),tB=eg(en(o.Buffer),tx,e=>o.Buffer.from(e[0],"base64"));function tP(e){let t,r;if("string"==typeof e)t=e;else if(e){let{commitment:i,...n}=e;t=i,r=n}return{commitment:t,config:r}}function tT(e){return e.map(e=>"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:e.memcmp.encoding??"base58"}}:e)}function tR(e){return ef([eh({jsonrpc:es("2.0"),id:el(),result:e}),eh({jsonrpc:es("2.0"),id:el(),error:eh({code:ep(),message:el(),data:ec(et())})})])}let tC=tR(ep());function tL(e){return eg(tR(e),tC,t=>"error"in t?t:{...t,result:X(t.result,e)})}function tO(e){return tL(eh({context:eh({slot:ea()}),value:e}))}function tz(e){return eh({context:eh({slot:ea()}),value:e})}function tN(e,t){return 0===e?new eY({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new eO(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:O.default.decode(e.data)})),addressTableLookups:t.addressTableLookups}):new eJ(t)}let tU=eh({foundation:ea(),foundationTerm:ea(),initial:ea(),taper:ea(),terminal:ea()}),tW=tL(er(eo(eh({epoch:ea(),effectiveSlot:ea(),amount:ea(),postBalance:ea(),commission:ec(eo(ea()))})))),tK=er(eh({slot:ea(),prioritizationFee:ea()})),tq=eh({total:ea(),validator:ea(),foundation:ea(),epoch:ea()}),tM=eh({epoch:ea(),slotIndex:ea(),slotsInEpoch:ea(),absoluteSlot:ea(),blockHeight:ec(ea()),transactionCount:ec(ea())}),tD=eh({slotsPerEpoch:ea(),leaderScheduleSlotOffset:ea(),warmup:ei(),firstNormalEpoch:ea(),firstNormalSlot:ea()}),tF=eu(el(),er(ea())),tV=eo(ef([eh({}),el()])),t$=eh({err:tV}),tj=es("receivedSignature"),tH=eh({"solana-core":el(),"feature-set":ec(ea())}),tG=eh({program:el(),programId:tE,parsed:ep()}),tJ=eh({programId:tE,accounts:er(tE),data:el()}),tY=tO(eh({err:eo(ef([eh({}),el()])),logs:eo(er(el())),accounts:ec(eo(er(eo(eh({executable:ei(),owner:el(),lamports:ea(),data:er(el()),rentEpoch:ec(ea())}))))),unitsConsumed:ec(ea()),returnData:ec(eo(eh({programId:el(),data:ed([el(),es("base64")])}))),innerInstructions:ec(eo(er(eh({index:ea(),instructions:er(ef([tG,tJ]))}))))})),tZ=tO(eh({byIdentity:eu(el(),er(ea())),range:eh({firstSlot:ea(),lastSlot:ea()})})),tX=tL(tU),tQ=tL(tq),t0=tL(tK),t1=tL(tM),t2=tL(tD),t6=tL(tF),t5=tL(ea()),t3=tO(eh({total:ea(),circulating:ea(),nonCirculating:ea(),nonCirculatingAccounts:er(tE)})),t8=eh({amount:el(),uiAmount:eo(ea()),decimals:ea(),uiAmountString:ec(el())}),t4=tO(er(eh({address:tE,amount:el(),uiAmount:eo(ea()),decimals:ea(),uiAmountString:ec(el())}))),t7=tO(er(eh({pubkey:tE,account:eh({executable:ei(),owner:tE,lamports:ea(),data:tB,rentEpoch:ea()})}))),t9=eh({program:el(),parsed:ep(),space:ea()}),re=tO(er(eh({pubkey:tE,account:eh({executable:ei(),owner:tE,lamports:ea(),data:t9,rentEpoch:ea()})}))),rt=tO(er(eh({lamports:ea(),address:tE}))),rr=eh({executable:ei(),owner:tE,lamports:ea(),data:tB,rentEpoch:ea()}),ri=eh({pubkey:tE,account:rr}),rn=eg(ef([en(o.Buffer),t9]),ef([tx,t9]),e=>Array.isArray(e)?X(e,tB):e),rs=eh({executable:ei(),owner:tE,lamports:ea(),data:rn,rentEpoch:ea()}),ro=eh({pubkey:tE,account:rs}),ra=eh({state:ef([es("active"),es("inactive"),es("activating"),es("deactivating")]),active:ea(),inactive:ea()}),rc=tL(er(eh({signature:el(),slot:ea(),err:tV,memo:eo(el()),blockTime:ec(eo(ea()))}))),ru=tL(er(eh({signature:el(),slot:ea(),err:tV,memo:eo(el()),blockTime:ec(eo(ea()))}))),rl=eh({subscription:ea(),result:tz(rr)}),rd=eh({pubkey:tE,account:rr}),rh=eh({subscription:ea(),result:tz(rd)}),rf=eh({parent:ea(),slot:ea(),root:ea()}),rp=eh({subscription:ea(),result:rf}),rg=ef([eh({type:ef([es("firstShredReceived"),es("completed"),es("optimisticConfirmation"),es("root")]),slot:ea(),timestamp:ea()}),eh({type:es("createdBank"),parent:ea(),slot:ea(),timestamp:ea()}),eh({type:es("frozen"),slot:ea(),timestamp:ea(),stats:eh({numTransactionEntries:ea(),numSuccessfulTransactions:ea(),numFailedTransactions:ea(),maxTransactionsPerEntry:ea()})}),eh({type:es("dead"),slot:ea(),timestamp:ea(),err:el()})]),ry=eh({subscription:ea(),result:rg}),rm=eh({subscription:ea(),result:tz(ef([t$,tj]))}),rb=eh({subscription:ea(),result:ea()}),rk=eh({pubkey:el(),gossip:eo(el()),tpu:eo(el()),rpc:eo(el()),version:eo(el())}),rw=eh({votePubkey:el(),nodePubkey:el(),activatedStake:ea(),epochVoteAccount:ei(),epochCredits:er(ed([ea(),ea(),ea()])),commission:ea(),lastVote:ea(),rootSlot:eo(ea())}),rS=tL(eh({current:er(rw),delinquent:er(rw)})),rv=ef([es("processed"),es("confirmed"),es("finalized")]),rI=eh({slot:ea(),confirmations:eo(ea()),err:tV,confirmationStatus:ec(rv)}),r_=tO(er(eo(rI))),rA=tL(ea()),rE=eh({accountKey:tE,writableIndexes:er(ea()),readonlyIndexes:er(ea())}),rx=eh({signatures:er(el()),message:eh({accountKeys:er(el()),header:eh({numRequiredSignatures:ea(),numReadonlySignedAccounts:ea(),numReadonlyUnsignedAccounts:ea()}),instructions:er(eh({accounts:er(ea()),data:el(),programIdIndex:ea()})),recentBlockhash:el(),addressTableLookups:ec(er(rE))})}),rB=eh({pubkey:tE,signer:ei(),writable:ei(),source:ec(ef([es("transaction"),es("lookupTable")]))}),rP=eh({accountKeys:er(rB),signatures:er(el())}),rT=eh({parsed:ep(),program:el(),programId:tE}),rR=eh({accounts:er(tE),data:el(),programId:tE}),rC=eg(ef([rR,rT]),ef([eh({parsed:ep(),program:el(),programId:el()}),eh({accounts:er(el()),data:el(),programId:el()})]),e=>"accounts"in e?X(e,rR):X(e,rT)),rL=eh({signatures:er(el()),message:eh({accountKeys:er(rB),instructions:er(rC),recentBlockhash:el(),addressTableLookups:ec(eo(er(rE)))})}),rO=eh({accountIndex:ea(),mint:el(),owner:ec(el()),programId:ec(el()),uiTokenAmount:t8}),rz=eh({writable:er(tE),readonly:er(tE)}),rN=eh({err:tV,fee:ea(),innerInstructions:ec(eo(er(eh({index:ea(),instructions:er(eh({accounts:er(ea()),data:el(),programIdIndex:ea()}))})))),preBalances:er(ea()),postBalances:er(ea()),logMessages:ec(eo(er(el()))),preTokenBalances:ec(eo(er(rO))),postTokenBalances:ec(eo(er(rO))),loadedAddresses:ec(rz),computeUnitsConsumed:ec(ea())}),rU=eh({err:tV,fee:ea(),innerInstructions:ec(eo(er(eh({index:ea(),instructions:er(rC)})))),preBalances:er(ea()),postBalances:er(ea()),logMessages:ec(eo(er(el()))),preTokenBalances:ec(eo(er(rO))),postTokenBalances:ec(eo(er(rO))),loadedAddresses:ec(rz),computeUnitsConsumed:ec(ea())}),rW=ef([es(0),es("legacy")]),rK=eh({pubkey:el(),lamports:ea(),postBalance:eo(ea()),rewardType:eo(el()),commission:ec(eo(ea()))}),rq=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),transactions:er(eh({transaction:rx,meta:eo(rN),version:ec(rW)})),rewards:ec(er(rK)),blockTime:eo(ea()),blockHeight:eo(ea())}))),rM=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),rewards:ec(er(rK)),blockTime:eo(ea()),blockHeight:eo(ea())}))),rD=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),transactions:er(eh({transaction:rP,meta:eo(rN),version:ec(rW)})),rewards:ec(er(rK)),blockTime:eo(ea()),blockHeight:eo(ea())}))),rF=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),transactions:er(eh({transaction:rL,meta:eo(rU),version:ec(rW)})),rewards:ec(er(rK)),blockTime:eo(ea()),blockHeight:eo(ea())}))),rV=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),transactions:er(eh({transaction:rP,meta:eo(rU),version:ec(rW)})),rewards:ec(er(rK)),blockTime:eo(ea()),blockHeight:eo(ea())}))),r$=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),rewards:ec(er(rK)),blockTime:eo(ea()),blockHeight:eo(ea())}))),rj=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),transactions:er(eh({transaction:rx,meta:eo(rN)})),rewards:ec(er(rK)),blockTime:eo(ea())}))),rH=tL(eo(eh({blockhash:el(),previousBlockhash:el(),parentSlot:ea(),signatures:er(el()),blockTime:eo(ea())}))),rG=tL(eo(eh({slot:ea(),meta:eo(rN),blockTime:ec(eo(ea())),transaction:rx,version:ec(rW)}))),rJ=tL(eo(eh({slot:ea(),transaction:rL,meta:eo(rU),blockTime:ec(eo(ea())),version:ec(rW)}))),rY=tO(eh({blockhash:el(),lastValidBlockHeight:ea()})),rZ=tO(ei()),rX=tL(er(eh({slot:ea(),numTransactions:ea(),numSlots:ea(),samplePeriodSecs:ea()}))),rQ=tO(eo(eh({feeCalculator:eh({lamportsPerSignature:ea()})}))),r0=tL(el()),r1=tL(el()),r2=eh({err:tV,logs:er(el()),signature:el()}),r6=eh({result:tz(r2),subscription:ea()}),r5={"solana-client":"js/1.0.0-maintenance"};class r3{constructor(e){this._keypair=void 0,this._keypair=e??eA()}static generate(){return new r3(eA())}static fromSecretKey(e,t){if(64!==e.byteLength)throw Error("bad secret key size");let r=e.slice(32,64);if(!t||!t.skipValidation){let t=eE(e.slice(0,32));for(let e=0;e<32;
8e++)if(r[e]!==t[e])throw Error("provided secretKey is invalid")}return new r3({publicKey:r,secretKey:e})}static fromSeed(e){let t=eE(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),new r3({publicKey:t,secretKey:r})}get publicKey(){return new eO(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}let r8=Object.freeze({CreateLookupTable:{index:0,layout:U.struct([U.u32("instruction"),tf("recentSlot"),U.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:U.struct([U.u32("instruction")])},ExtendLookupTable:{index:2,layout:U.struct([U.u32("instruction"),tf(),U.seq(eq(),U.offset(U.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:U.struct([U.u32("instruction")])},CloseLookupTable:{index:4,layout:U.struct([U.u32("instruction")])}});class r4{static createLookupTable(e){let[t,r]=eO.findProgramAddressSync([e.authority.toBuffer(),F().encode(e.recentSlot)],this.programId),i=ta(r8.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:r}),n=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:tg.programId,isSigner:!1,isWritable:!1}];return[new e0({programId:this.programId,keys:n,data:i}),t]}static freezeLookupTable(e){let t=ta(r8.FreezeLookupTable),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new e0({programId:this.programId,keys:r,data:t})}static extendLookupTable(e){let t=ta(r8.ExtendLookupTable,{addresses:e.addresses.map(e=>e.toBytes())}),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&r.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:tg.programId,isSigner:!1,isWritable:!1}),new e0({programId:this.programId,keys:r,data:t})}static deactivateLookupTable(e){let t=ta(r8.DeactivateLookupTable),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new e0({programId:this.programId,keys:r,data:t})}static closeLookupTable(e){let t=ta(r8.CloseLookupTable),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new e0({programId:this.programId,keys:r,data:t})}}r4.programId=new eO("AddressLookupTab1e1111111111111111111111111");let r7=Object.freeze({RequestUnits:{index:0,layout:U.struct([U.u8("instruction"),U.u32("units"),U.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:U.struct([U.u8("instruction"),U.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:U.struct([U.u8("instruction"),U.u32("units")])},SetComputeUnitPrice:{index:3,layout:U.struct([U.u8("instruction"),tf("microLamports")])}});class r9{static requestUnits(e){let t=ta(r7.RequestUnits,e);return new e0({keys:[],programId:this.programId,data:t})}static requestHeapFrame(e){let t=ta(r7.RequestHeapFrame,e);return new e0({keys:[],programId:this.programId,data:t})}static setComputeUnitLimit(e){let t=ta(r7.SetComputeUnitLimit,e);return new e0({keys:[],programId:this.programId,data:t})}static setComputeUnitPrice(e){let t=ta(r7.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new e0({keys:[],programId:this.programId,data:t})}}r9.programId=new eO("ComputeBudget111111111111111111111111111111");let ie=U.struct([U.u8("numSignatures"),U.u8("padding"),U.u16("signatureOffset"),U.u16("signatureInstructionIndex"),U.u16("publicKeyOffset"),U.u16("publicKeyInstructionIndex"),U.u16("messageDataOffset"),U.u16("messageDataSize"),U.u16("messageInstructionIndex")]);class it{static createInstructionWithPublicKey(e){let{publicKey:t,message:r,signature:i,instructionIndex:n}=e;eV(32===t.length,`Public Key must be 32 bytes but received ${t.length} bytes`),eV(64===i.length,`Signature must be 64 bytes but received ${i.length} bytes`);let s=ie.span,a=s+t.length,c=a+i.length,u=o.Buffer.alloc(c+r.length),l=null==n?65535:n;return ie.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:l,publicKeyOffset:s,publicKeyInstructionIndex:l,messageDataOffset:c,messageDataSize:r.length,messageInstructionIndex:l},u),u.fill(t,s),u.fill(i,a),u.fill(r,c),new e0({keys:[],programId:it.programId,data:u})}static createInstructionWithPrivateKey(e){let{privateKey:t,message:r,instructionIndex:i}=e;eV(64===t.length,`Private key must be 64 bytes but received ${t.length} bytes`);try{let e=r3.fromSecretKey(t),n=e.publicKey.toBytes(),s=eB(r,e.secretKey);return this.createInstructionWithPublicKey({publicKey:n,message:r,signature:s,instructionIndex:i})}catch(e){throw Error(`Error creating instruction; ${e}`)}}}it.programId=new eO("Ed25519SigVerify111111111111111111111111111"),eI.secp256k1.utils.isValidPrivateKey;let ir=eI.secp256k1.getPublicKey,ii=U.struct([U.u8("numSignatures"),U.u16("signatureOffset"),U.u8("signatureInstructionIndex"),U.u16("ethAddressOffset"),U.u8("ethAddressInstructionIndex"),U.u16("messageDataOffset"),U.u16("messageDataSize"),U.u8("messageInstructionIndex"),U.blob(20,"ethAddress"),U.blob(64,"signature"),U.u8("recoveryId")]);class is{static publicKeyToEthAddress(e){eV(64===e.length,`Public key must be 64 bytes but received ${e.length} bytes`);try{return o.Buffer.from((0,ev.keccak_256)(eT(e))).slice(-20)}
vendor: 7,222 bytes, line 8
8catch(e){throw Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(e){let{publicKey:t,message:r,signature:i,recoveryId:n,instructionIndex:s}=e;return is.createInstructionWithEthAddress({ethAddress:is.publicKeyToEthAddress(t),message:r,signature:i,recoveryId:n,instructionIndex:s})}static createInstructionWithEthAddress(e){let t,{ethAddress:r,message:i,signature:n,recoveryId:s,instructionIndex:a=0}=e;eV(20===(t="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 ${t.length} bytes`);let c=12+t.length,u=c+n.length+1,l=o.Buffer.alloc(ii.span+i.length);return ii.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:a,ethAddressOffset:12,ethAddressInstructionIndex:a,messageDataOffset:u,messageDataSize:i.length,messageInstructionIndex:a,signature:eT(n),ethAddress:eT(t),recoveryId:s},l),l.fill(eT(i),ii.span),new e0({keys:[],programId:is.programId,data:l})}static createInstructionWithPrivateKey(e){let{privateKey:t,message:r,instructionIndex:i}=e;eV(32===t.length,`Private key must be 32 bytes but received ${t.length} bytes`);try{var n;let e,s=eT(t),a=ir(s,!1).slice(1),[c,u]=(n=o.Buffer.from((0,ev.keccak_256)(eT(r))),[(e=eI.secp256k1.sign(n,s)).toCompactRawBytes(),e.recovery]);return this.createInstructionWithPublicKey({publicKey:a,message:r,signature:c,recoveryId:u,instructionIndex:i})}catch(e){throw Error(`Error creating instruction; ${e}`)}}}is.programId=new eO("KeccakSecp256k11111111111111111111111111111");let io=new eO("StakeConfig11111111111111111111111111111111");class ia{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class ic{constructor(e,t,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=r}}ic.default=new ic(0,0,eO.default);let iu=Object.freeze({Initialize:{index:0,layout:U.struct([U.u32("instruction"),((e="authorized")=>U.struct([eq("staker"),eq("withdrawer")],e))(),((e="lockup")=>U.struct([U.ns64("unixTimestamp"),U.ns64("epoch"),eq("custodian")],e))()])},Authorize:{index:1,layout:U.struct([U.u32("instruction"),eq("newAuthorized"),U.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:U.struct([U.u32("instruction")])},Split:{index:3,layout:U.struct([U.u32("instruction"),U.ns64("lamports")])},Withdraw:{index:4,layout:U.struct([U.u32("instruction"),U.ns64("lamports")])},Deactivate:{index:5,layout:U.struct([U.u32("instruction")])},Merge:{index:7,layout:U.struct([U.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:U.struct([U.u32("instruction"),eq("newAuthorized"),U.u32("stakeAuthorizationType"),eM("authoritySeed"),eq("authorityOwner")])}}),il=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class id{static initialize(e){let{stakePubkey:t,authorized:r,lockup:i}=e,n=i||ic.default,s=ta(iu.Initialize,{authorized:{staker:eT(r.staker.toBuffer()),withdrawer:eT(r.withdrawer.toBuffer())},lockup:{unixTimestamp:n.unixTimestamp,epoch:n.epoch,custodian:eT(n.custodian.toBuffer())}});return new e0({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e7,isSigner:!1,isWritable:!1}],programId:this.programId,data:s})}static createAccountWithSeed(e){let t=new e1;t.add(tg.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=e;return t.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static createAccount(e){let t=new e1;t.add(tg.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=e;return t.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static delegate(e){let{stakePubkey:t,authorizedPubkey:r,votePubkey:i}=e,n=ta(iu.Delegate);return new e1().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:e5,isSigner:!1,isWritable:!1},{pubkey:tr,isSigner:!1,isWritable:!1},{pubkey:io,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static authorize(e){let{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:i,stakeAuthorizationType:n,custodianPubkey:s}=e,o=ta(iu.Authorize,{newAuthorized:eT(i.toBuffer()),stakeAuthorizationType:n.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e5,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new e1().add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(e){let{stakePubkey:t,authorityBase:r,authoritySeed:i,authorityOwner:n,newAuthorizedPubkey:s,stakeAuthorizationType:o,custodianPubkey:a}=e,c=ta(iu.AuthorizeWithSeed,{newAuthorized:eT(s.toBuffer()),stakeAuthorizationType:o.index,authoritySeed:i,authorityOwner:eT(n.toBuffer())}),u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:e5,isSigner:!1,isWritable:!1}];return a&&u.push({pubkey:a,isSigner:!0,isWritable:!1}),new e1().add({keys:u,programId:this.programId,data:c})}static splitInstruction(e){let{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:i,lamports:n}=e,s=ta(iu.Split,{lamports:n});return new e0({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(e,t){let r=new e1;return r.add(tg.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space:this.space,programId:this.programId})),r.add(this.splitInstruction(e))}static splitWithSeed(e,t){let{stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,basePubkey:s,seed:o,lamports:a}=e,c=new e1;return c.add(tg.allocate({accountPubkey:n,basePubkey:s,seed:o,space:this.space,programId:this.programId})),t&&t>0&&c.add(tg.transfer({fromPubkey:e.authorizedPubkey,toPubkey:n,lamports:t})),c.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,lamports:a}))}static merge(e){let{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:i}=e,n=ta(iu.Merge);return new e1().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:e5,isSigner:!1,isWritable:!1},{pubkey:tr,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static withdraw(e){let{stakePubkey:t,authorizedPubkey:r,toPubkey:i,lamports:n,custodianPubkey:s}=e,o=ta(iu.Withdraw,{lamports:n}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:e5,isSigner:!1,isWritable:!1},{pubkey:tr,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new e1().add({keys:a,programId:this.programId,data:o})}static deactivate(e){let{stakePubkey:t,authorizedPubkey:r}=e,i=ta(iu.Deactivate);return new e1().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e5,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}}id.programId=new eO("Stake11111111111111111111111111111111111111"),id.space=200;
8class ih{constructor(e,t,r,i){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=t,this.authorizedWithdrawer=r,this.commission=i}}let ip=Object.freeze({InitializeAccount:{index:0,layout:U.struct([U.u32("instruction"),((e="voteInit")=>U.struct([eq("nodePubkey"),eq("authorizedVoter"),eq("authorizedWithdrawer"),U.u8("commission")],e))()])},Authorize:{index:1,layout:U.struct([U.u32("instruction"),eq("newAuthorized"),U.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:U.struct([U.u32("instruction"),U.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:U.struct([U.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:U.struct([U.u32("instruction"),((e="voteAuthorizeWithSeedArgs")=>U.struct([U.u32("voteAuthorizationType"),eq("currentAuthorityDerivedKeyOwnerPubkey"),eM("currentAuthorityDerivedKeySeed"),eq("newAuthorized")],e))()])}}),ig=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class iy{static initializeAccount(e){let{votePubkey:t,nodePubkey:r,voteInit:i}=e,n=ta(ip.InitializeAccount,{voteInit:{nodePubkey:eT(i.nodePubkey.toBuffer()),authorizedVoter:eT(i.authorizedVoter.toBuffer()),authorizedWithdrawer:eT(i.authorizedWithdrawer.toBuffer()),commission:i.commission}});return new e0({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e7,isSigner:!1,isWritable:!1},{pubkey:e5,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static createAccount(e){let t=new e1;return t.add(tg.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){let{votePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:i,voteAuthorizationType:n}=e,s=ta(ip.Authorize,{newAuthorized:eT(i.toBuffer()),voteAuthorizationType:n.index}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e5,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return new e1().add({keys:o,programId:this.programId,data:s})}static authorizeWithSeed(e){let{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:n,voteAuthorizationType:s,votePubkey:o}=e,a=ta(ip.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:eT(r.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:eT(n.toBuffer()),voteAuthorizationType:s.index}}),c=[{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:e5,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return new e1().add({keys:c,programId:this.programId,data:a})}static withdraw(e){let{votePubkey:t,authorizedWithdrawerPubkey:r,lamports:i,toPubkey:n}=e,s=ta(ip.Withdraw,{lamports:i});return new e1().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static safeWithdraw(e,t,r){if(e.lamports>t-r)throw Error("Withdraw will leave vote account with insufficient funds.");return iy.withdraw(e)}static updateValidatorIdentity(e){let{votePubkey:t,authorizedWithdrawerPubkey:r,nodePubkey:i}=e,n=ta(ip.UpdateValidatorIdentity);return new e1().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}}iy.programId=new eO("Vote111111111111111111111111111111111111111"),iy.space=3762;let im=new eO("Va1idator1nfo111111111111111111111111111111"),ib=eh({name:el(),website:ec(el()),details:ec(el()),iconUrl:ec(el()),keybaseUsername:ec(el())});class ik{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let t=[...e];if(2!==eD(t))return null;let r=[];for(let e=0;e<2;e++){let e=new eO(eG(t,0,32)),i=1===eH(t);r.push({publicKey:e,isSigner:i})}if(r[0].publicKey.equals(im)&&r[1].isSigner){let e=JSON.parse(eM().decode(o.Buffer.from(t)));return Z(e,ib),new ik(r[1].publicKey,e)}return null}}let iw=new eO("Vote111111111111111111111111111111111111111"),iS=U.struct([eq("nodePubkey"),eq("authorizedWithdrawer"),U.u8("commission"),U.nu64(),U.seq(U.struct([U.nu64("slot"),U.u32("confirmationCount")]),U.offset(U.u32(),-8),"votes"),U.u8("rootSlotValid"),U.nu64("rootSlot"),U.nu64(),U.seq(U.struct([U.nu64("epoch"),eq("authorizedVoter")]),U.offset(U.u32(),-8),"authorizedVoters"),U.struct([U.seq(U.struct([eq("authorizedPubkey"),U.nu64("epochOfLastAuthorizedSwitch"),U.nu64("targetEpoch")]),32,"buf"),U.nu64("idx"),U.u8("isEmpty")],"priorVoters"),U.nu64(),U.seq(U.struct([U.nu64("epoch"),U.nu64("credits"),U.nu64("prevCredits")]),U.offset(U.u32(),-8),"epochCredits"),U.struct([U.nu64("slot"),U.nu64("timestamp")],"lastTimestamp")]);class iv{constructor(e){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){let t=iS.decode(eT(e),4),r=t.rootSlot;return t.rootSlotValid||(r=null),new iv({nodePubkey:new eO(t.nodePubkey),authorizedWithdrawer:new eO(t.authorizedWithdrawer),commission:t.commission,votes:t.votes,rootSlot:r,authorizedVoters:t.authorizedVoters.map(iI),priorVoters:function({buf:e,idx:t,isEmpty:r}){return r?[]:[...e.slice(t+1).map(i_),...e.slice(0,t).map(i_)]}(t.priorVoters),epochCredits:t.epochCredits,lastTimestamp:t.lastTimestamp})}}function iI({authorizedVoter:e,epoch:t}){return{epoch:t,authorizedVoter:new eO(e)}}function i_({authorizedPubkey:e,epochOfLastAuthorizedSwitch:t,targetEpoch:r}){return{authorizedPubkey:new eO(e),epochOfLastAuthorizedSwitch:t,targetEpoch:r}}let iA={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};async function iE(e,t,r,i){let n,s;r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(n=r,s=i):s=r;let o=s&&{skipPreflight:s.skipPreflight,preflightCommitment:s.preflightCommitment||s.commitment,minContextSlot:s.minContextSlot},a=await e.sendRawTransaction(t,o),c=s&&s.commitment,u=n?e.confirmTransaction(n,c):e.confirmTransaction(a,c),l=(await u).value;if(l.err){if(null!=a)throw new ti({action:o?.skipPreflight?"send":"simulate",signature:a,transactionMessage:`Status: (${JSON.stringify(l)})`});throw Error(`Raw transaction ${a} failed (${JSON.stringify(l)})`)}return a}e.s(["Account",0,class{constructor(e){if(this._publicKey=void 0,this._secretKey=void 0,e){const t=eT(e);
8if(64!==e.length)throw Error("bad secret key size");this._publicKey=t.slice(32,64),this._secretKey=t.slice(0,32)}else this._secretKey=eT(e_()),this._publicKey=eT(eE(this._secretKey))}get publicKey(){return new eO(this._publicKey)}get secretKey(){return o.Buffer.concat([this._secretKey,this._publicKey],64)}},"AddressLookupTableAccount",0,tI,"AddressLookupTableInstruction",0,class{static decodeInstructionType(e){let t;this.checkProgramId(e.programId);let r=U.u32("instruction").decode(e.data);for(let[e,i]of Object.entries(r8))if(i.index==r){t=e;break}if(!t)throw Error("Invalid Instruction. Should be a LookupTable Instruction");return t}static decodeCreateLookupTable(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);let{recentSlot:t}=tc(r8.CreateLookupTable,e.data);return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}static decodeExtendLookupTable(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw Error(`invalid instruction; found ${e.keys.length} keys, expected at least 2`);let{addresses:t}=tc(r8.ExtendLookupTable,e.data);return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map(e=>new eO(e))}}static decodeCloseLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}static decodeFreezeLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static decodeDeactivateLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(r4.programId))throw Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(e,t){if(e.length<t)throw Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},"AddressLookupTableProgram",0,r4,"Authorized",0,ia,"BLOCKHASH_CACHE_TIMEOUT_MS",0,3e4,"BPF_LOADER_DEPRECATED_PROGRAM_ID",0,ez,"BPF_LOADER_PROGRAM_ID",0,tm,"BpfLoader",0,class{static getMinNumSignatures(e){return ty.getMinNumSignatures(e)}static load(e,t,r,i,n){return ty.load(e,t,r,n,i)}},"COMPUTE_BUDGET_INSTRUCTION_LAYOUTS",0,r7,"ComputeBudgetInstruction",0,class{static decodeInstructionType(e){let t;this.checkProgramId(e.programId);let r=U.u8("instruction").decode(e.data);for(let[e,i]of Object.entries(r7))if(i.index==r){t=e;break}if(!t)throw Error("Instruction type incorrect; not a ComputeBudgetInstruction");return t}static decodeRequestUnits(e){this.checkProgramId(e.programId);let{units:t,additionalFee:r}=tc(r7.RequestUnits,e.data);return{units:t,additionalFee:r}}static decodeRequestHeapFrame(e){this.checkProgramId(e.programId);let{bytes:t}=tc(r7.RequestHeapFrame,e.data);return{bytes:t}}static decodeSetComputeUnitLimit(e){this.checkProgramId(e.programId);let{units:t}=tc(r7.SetComputeUnitLimit,e.data);return{units:t}}static decodeSetComputeUnitPrice(e){this.checkProgramId(e.programId);let{microLamports:t}=tc(r7.SetComputeUnitPrice,e.data);return{microLamports:t}}static checkProgramId(e){if(!e.equals(r9.programId))throw Error("invalid instruction; programId is not ComputeBudgetProgram")}},"ComputeBudgetProgram",0,r9,"Connection",0,class{constructor(e,t){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 e={};return async t=>{let{commitment:r,config:i}=tP(t),n=this._buildArgs([],r,void 0,i),s=tb(n);return e[s]=e[s]??(async()=>{try{let e=await this._rpcRequest("getBlockHeight",n),t=X(e,tL(ea()));if("error"in t)throw new tn(t.error,"failed to get block height information");return t.result}finally{delete e[s]}})(),await e[s]}})(),t&&"string"==typeof t?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,r=t.wsEndpoint,i=t.httpHeaders,n=t.fetch,s=t.fetchMiddleware,o=t.disableRetryOnRateLimit,a=t.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(e),this._rpcWsEndpoint=r||function(e){let t=e.match(tA);if(null==t)throw TypeError(`Failed to validate endpoint URL \`${e}\``);let[r,i,n,s]=t,o=e.startsWith("https:")?"wss:":"ws:",a=null==n?null:parseInt(n.slice(1),10),c=null==a?"":`:${a+1}`;return`${o}//${i}${c}${s}`}(e),this._rpcClient=function(e,t,r,i,n,s){let o,a,c=r||tS;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(e,t)=>{let r=await new Promise((r,n)=>{try{i(e,t,(e,t)=>r([e,t]))}catch(e){n(e)}});return await c(...r)}),new ey.default(async(r,i)=>{let s={method:"POST",body:r,agent:o,headers:Object.assign({"Content-Type":"application/json"},t||{},r5)};try{let t,r=5,o=500;for(;(t=a?await a(e,s):await c(e,s),429===t.status&&!0!==n)&&(r-=1,0!==r);){;console.error(`Server responded with ${t.status} ${t.statusText}. Retrying after ${o}ms delay...`),await to(o),o*=2}let u=await t.text();t.ok?i(null,u):i(Error(`${t.status} ${t.statusText}: ${u}`))}catch(e){e instanceof Error&&i(e)}},{})}(e,i,n,s,o,a),this._rpcRequest=function(e){return(t,r)=>new Promise((i,n)=>{e.request(t,r,(e,t)=>{e?n(e):i(t)})})}(this._rpcClient),this._rpcBatchRequest=function(e){return t=>new Promise((r,i)=>{0===t.length&&r([]);let n=t.map(t=>e.request(t.methodName,t.args));e.request(n,(e,t)=>{e?i(e):r(t)})})}(this._rpcClient),this._rpcWebSocket=new tv(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}
vendor: 34,235 bytes, line 8
8async getBalanceAndContext(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgs([e.toBase58()],r,void 0,i),s=X(await this._rpcRequest("getBalance",n),tO(ea()));if("error"in s)throw new tn(s.error,`failed to get balance for ${e.toBase58()}`);return s.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(e=>e.value).catch(t=>{throw Error("failed to get balance of account "+e.toBase58()+": "+t)})}async getBlockTime(e){let t=X(await this._rpcRequest("getBlockTime",[e]),tL(eo(ea())));if("error"in t)throw new tn(t.error,`failed to get block time for slot ${e}`);return t.result}async getMinimumLedgerSlot(){let e=X(await this._rpcRequest("minimumLedgerSlot",[]),tL(ea()));if("error"in e)throw new tn(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){let e=X(await this._rpcRequest("getFirstAvailableBlock",[]),t5);if("error"in e)throw new tn(e.error,"failed to get first available block");return e.result}async getSupply(e){let t={};t="string"==typeof e?{commitment:e}:e?{...e,commitment:e&&e.commitment||this.commitment}:{commitment:this.commitment};let r=X(await this._rpcRequest("getSupply",[t]),t3);if("error"in r)throw new tn(r.error,"failed to get supply");return r.result}async getTokenSupply(e,t){let r=this._buildArgs([e.toBase58()],t),i=X(await this._rpcRequest("getTokenSupply",r),tO(t8));if("error"in i)throw new tn(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(e,t){let r=this._buildArgs([e.toBase58()],t),i=X(await this._rpcRequest("getTokenAccountBalance",r),tO(t8));if("error"in i)throw new tn(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(e,t,r){let{commitment:i,config:n}=tP(r),s=[e.toBase58()];"mint"in t?s.push({mint:t.mint.toBase58()}):s.push({programId:t.programId.toBase58()});let o=this._buildArgs(s,i,"base64",n),a=X(await this._rpcRequest("getTokenAccountsByOwner",o),t7);if("error"in a)throw new tn(a.error,`failed to get token accounts owned by account ${e.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(e,t,r){let i=[e.toBase58()];"mint"in t?i.push({mint:t.mint.toBase58()}):i.push({programId:t.programId.toBase58()});let n=this._buildArgs(i,r,"jsonParsed"),s=X(await this._rpcRequest("getTokenAccountsByOwner",n),re);if("error"in s)throw new tn(s.error,`failed to get token accounts owned by account ${e.toBase58()}`);return s.result}async getLargestAccounts(e){let t={...e,commitment:e&&e.commitment||this.commitment},r=t.filter||t.commitment?[t]:[],i=X(await this._rpcRequest("getLargestAccounts",r),rt);if("error"in i)throw new tn(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(e,t){let r=this._buildArgs([e.toBase58()],t),i=X(await this._rpcRequest("getTokenLargestAccounts",r),t4);if("error"in i)throw new tn(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgs([e.toBase58()],r,"base64",i),s=X(await this._rpcRequest("getAccountInfo",n),tO(eo(rr)));if("error"in s)throw new tn(s.error,`failed to get info about account ${e.toBase58()}`);return s.result}async getParsedAccountInfo(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgs([e.toBase58()],r,"jsonParsed",i),s=X(await this._rpcRequest("getAccountInfo",n),tO(eo(rs)));if("error"in s)throw new tn(s.error,`failed to get info about account ${e.toBase58()}`);return s.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(t){throw Error("failed to get info about account "+e.toBase58()+": "+t)}}async getMultipleParsedAccounts(e,t){let{commitment:r,config:i}=tP(t),n=e.map(e=>e.toBase58()),s=this._buildArgs([n],r,"jsonParsed",i),o=X(await this._rpcRequest("getMultipleAccounts",s),tO(er(eo(rs))));if("error"in o)throw new tn(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfoAndContext(e,t){let{commitment:r,config:i}=tP(t),n=e.map(e=>e.toBase58()),s=this._buildArgs([n],r,"base64",i),o=X(await this._rpcRequest("getMultipleAccounts",s),tO(er(eo(rr))));if("error"in o)throw new tn(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfo(e,t){return(await this.getMultipleAccountsInfoAndContext(e,t)).value}async getStakeActivation(e,t,r){let{commitment:i,config:n}=tP(t),s=this._buildArgs([e.toBase58()],i,void 0,{...n,epoch:null!=r?r:n?.epoch}),o=X(await this._rpcRequest("getStakeActivation",s),tL(ra));if("error"in o)throw new tn(o.error,`failed to get Stake Activation ${e.toBase58()}`);return o.result}async getProgramAccounts(e,t){let{commitment:r,config:i}=tP(t),{encoding:n,...s}=i||{},o=this._buildArgs([e.toBase58()],r,n||"base64",{...s,...s.filters?{filters:tT(s.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",o),c=er(ri),u=!0===s.withContext?X(a,tO(c)):X(a,tL(c));if("error"in u)throw new tn(u.error,`failed to get accounts owned by program ${e.toBase58()}`);return u.result}async getParsedProgramAccounts(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgs([e.toBase58()],r,"jsonParsed",i),s=X(await this._rpcRequest("getProgramAccounts",n),tL(er(ro)));if("error"in s)throw new tn(s.error,`failed to get accounts owned by program ${e.toBase58()}`);return s.result}async confirmTransaction(e,t){let r,i;if("string"==typeof e)r=e;else{if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);r=e.signature}try{i=O.default.decode(r)}catch(e){throw Error("signature must be base58 encoded: "+r)}return(eV(64===i.length,"signature has invalid length"),"string"==typeof e)?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:r}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise((t,r)=>{null!=e&&(e.aborted?r(e.reason):e.addEventListener("abort",()=>{r(e.reason)}))})}getTransactionConfirmationPromise({commitment:e,signature:t}){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(t,(e,t)=>{r=void 0,s({__type:eX.PROCESSED,response:{context:t,value:e}})},e);let a=new Promise(e=>{null==r?e():i=this._onSubscriptionStateChange(r,t=>{"subscribed"===t&&e()})});(async()=>{if(await a,n)return;let r=await this.getSignatureStatus(t);if(n||null==r)return;let{context:i,value:c}=r;if(null!=c)if(c?.err)o(c.err);else{switch(e){case"confirmed":case"single":case"singleGossip":if("processed"===c.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===c.confirmationStatus||"confirmed"===c.confirmationStatus)return}n=!0,s({__type:eX.PROCESSED,response:{context:i,value:c}})}})()}catch(e){o(e)}})}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:t,lastValidBlockHeight:r,signature:i}}){let n,s=!1,o=new Promise(t=>{let i=async()=>{try{return await this.getBlockHeight(e)}catch(e){return -1}};(async()=>{let e=await i();if(!s){for(;e<=r;)if(await to(1e3),s||(e=await i(),s))return;t({__type:eX.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:e,signature:i}),u=this.getCancellationPromise(t);try{let e=await Promise.race([u,c,o]);if(e.__type===eX.PROCESSED)n=e.response;else throw new eN(i)}finally{s=!0,a()}return n}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:t,minContextSlot:r,nonceAccountPubkey:i,nonceValue:n,signature:s}}){let o,a=!1,c=new Promise(t=>{let s=n,o=null,c=async()=>{try{let{context:t,value:n}=await this.getNonceAndContext(i,{commitment:e,minContextSlot:r});return o=t.slot,n?.nonce}catch(e){return s}};(async()=>{if(s=await c(),!a)for(;;){if(n!==s)return void t({__type:eX.NONCE_INVALID,slotInWhichNonceDidAdvance:o});if(await to(2e3),a||(s=await c(),a))return}})()}),{abortConfirmation:u,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:e,signature:s}),d=this.getCancellationPromise(t);try{let t=await Promise.race([d,l,c]);if(t.__type===eX.PROCESSED)o=t.response;else{let i;for(;;){let e=await this.getSignatureStatus(s);if(null==e)break;if(e.context.slot<(t.slotInWhichNonceDidAdvance??r)){await to(400);continue}i=e;break}if(i?.value){let t=e||"finalized",{confirmationStatus:r}=i.value;switch(t){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new eW(s);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new eW(s);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new eW(s)}o={context:i.context,value:{err:i.value.err}}}else throw new eW(s)}}finally{a=!0,u()}return o}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:t}){let r,i,n=new Promise(t=>{let i=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":i=this._confirmTransactionInitialTimeout||3e4}r=setTimeout(()=>t({__type:eX.TIMED_OUT,timeoutMs:i}),i)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:e,signature:t});try{let e=await Promise.race([o,n]);if(e.__type===eX.PROCESSED)i=e.response;else throw new eU(t,e.timeoutMs/1e3)}finally{clearTimeout(r),s()}return i}async getClusterNodes(){let e=X(await this._rpcRequest("getClusterNodes",[]),tL(er(rk)));if("error"in e)throw new tn(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(e){let t=this._buildArgs([],e),r=X(await this._rpcRequest("getVoteAccounts",t),rS);if("error"in r)throw new tn(r.error,"failed to get vote accounts");return r.result}async getSlot(e){let{commitment:t,config:r}=tP(e),i=this._buildArgs([],t,void 0,r),n=X(await this._rpcRequest("getSlot",i),tL(ea()));if("error"in n)throw new tn(n.error,"failed to get slot");return n.result}async getSlotLeader(e){let{commitment:t,config:r}=tP(e),i=this._buildArgs([],t,void 0,r),n=X(await this._rpcRequest("getSlotLeader",i),tL(el()));if("error"in n)throw new tn(n.error,"failed to get slot leader");return n.result}async getSlotLeaders(e,t){let r=X(await this._rpcRequest("getSlotLeaders",[e,t]),tL(er(tE)));if("error"in r)throw new tn(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(e,t){let{context:r,value:i}=await this.getSignatureStatuses([e],t);return eV(1===i.length),{context:r,value:i[0]}}async getSignatureStatuses(e,t){let r=[e];t&&r.push(t);let i=X(await this._rpcRequest("getSignatureStatuses",r),r_);if("error"in i)throw new tn(i.error,"failed to get signature status");return i.result}async getTransactionCount(e){let{commitment:t,config:r}=tP(e),i=this._buildArgs([],t,void 0,r),n=X(await this._rpcRequest("getTransactionCount",i),tL(ea()));if("error"in n)throw new tn(n.error,"failed to get transaction count");return n.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){let t=this._buildArgs([],e),r=X(await this._rpcRequest("getInflationGovernor",t),tX);if("error"in r)throw new tn(r.error,"failed to get inflation");return r.result}async getInflationReward(e,t,r){let{commitment:i,config:n}=tP(r),s=this._buildArgs([e.map(e=>e.toBase58())],i,void 0,{...n,epoch:null!=t?t:n?.epoch}),o=X(await this._rpcRequest("getInflationReward",s),tW);if("error"in o)throw new tn(o.error,"failed to get inflation reward");return o.result}async getInflationRate(){let e=X(await this._rpcRequest("getInflationRate",[]),tQ);if("error"in e)throw new tn(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(e){let{commitment:t,config:r}=tP(e),i=this._buildArgs([],t,void 0,r),n=X(await this._rpcRequest("getEpochInfo",i),t1);if("error"in n)throw new tn(n.error,"failed to get epoch info");return n.result}async getEpochSchedule(){let e=X(await this._rpcRequest("getEpochSchedule",[]),t2);if("error"in e)throw new tn(e.error,"failed to get epoch schedule");let t=e.result;return new tw(t.slotsPerEpoch,t.leaderScheduleSlotOffset,t.warmup,t.firstNormalEpoch,t.firstNormalSlot)}async getLeaderSchedule(){let e=X(await this._rpcRequest("getLeaderSchedule",[]),t6);if("error"in e)throw new tn(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(e,t){let r=this._buildArgs([e],t),i=X(await this._rpcRequest("getMinimumBalanceForRentExemption",r),rA);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(e){let{context:t,value:{blockhash:r}}=await this.getLatestBlockhashAndContext(e);return{context:t,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(e){let t=X(await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),rX);if("error"in t)throw new tn(t.error,"failed to get recent performance samples");return t.result}async getFeeCalculatorForBlockhash(e,t){let r=this._buildArgs([e],t),i=X(await this._rpcRequest("getFeeCalculatorForBlockhash",r),rQ);if("error"in i)throw new tn(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(e,t){let r=eT(e.serialize()).toString("base64"),i=this._buildArgs([r],t),n=X(await this._rpcRequest("getFeeForMessage",i),tO(eo(ea())));if("error"in n)throw new tn(n.error,"failed to get fee for message");if(null===n.result)throw Error("invalid blockhash");return n.result}async getRecentPrioritizationFees(e){let t=e?.lockedWritableAccounts?.map(e=>e.toBase58()),r=t?.length?[t]:[],i=X(await this._rpcRequest("getRecentPrioritizationFees",r),t0);if("error"in i)throw new tn(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(e){throw Error("failed to get recent blockhash: "+e)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(e){throw Error("failed to get recent blockhash: "+e)}}async getLatestBlockhashAndContext(e){let{commitment:t,config:r}=tP(e),i=this._buildArgs([],t,void 0,r),n=X(await this._rpcRequest("getLatestBlockhash",i),rY);if("error"in n)throw new tn(n.error,"failed to get latest blockhash");return n.result}async isBlockhashValid(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgs([e],r,void 0,i),s=X(await this._rpcRequest("isBlockhashValid",n),rZ);if("error"in s)throw new tn(s.error,"failed to determine if the blockhash `"+e+"`is valid");return s.result}async getVersion(){let e=X(await this._rpcRequest("getVersion",[]),tL(tH));if("error"in e)throw new tn(e.error,"failed to get version");return e.result}async getGenesisHash(){let e=X(await this._rpcRequest("getGenesisHash",[]),tL(el()));if("error"in e)throw new tn(e.error,"failed to get genesis hash");return e.result}async getBlock(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgsAtLeastConfirmed([e],r,void 0,i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let e=X(s,rD);if("error"in e)throw e.error;return e.result}case"none":{let e=X(s,rM);if("error"in e)throw e.error;return e.result}default:{let e=X(s,rq);if("error"in e)throw e.error;let{result:t}=e;return t?{...t,transactions:t.transactions.map(({transaction:e,meta:t,version:r})=>({meta:t,transaction:{...e,message:tN(r,e.message)},version:r}))}:null}}}catch(e){throw new tn(e,"failed to get confirmed block")}}async getParsedBlock(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let e=X(s,rV);if("error"in e)throw e.error;return e.result}case"none":{let e=X(s,r$);if("error"in e)throw e.error;return e.result}default:{let e=X(s,rF);if("error"in e)throw e.error;return e.result}}}catch(e){throw new tn(e,"failed to get block")}}async getBlockProduction(e){let t,r;if("string"==typeof e)r=e;else if(e){let{commitment:i,...n}=e;r=i,t=n}let i=this._buildArgs([],r,"base64",t),n=X(await this._rpcRequest("getBlockProduction",i),tZ);if("error"in n)throw new tn(n.error,"failed to get block production information");return n.result}async getTransaction(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgsAtLeastConfirmed([e],r,void 0,i),s=X(await this._rpcRequest("getTransaction",n),rG);if("error"in s)throw new tn(s.error,"failed to get transaction");let o=s.result;return o?{...o,transaction:{...o.transaction,message:tN(o.version,o.transaction.message)}}:o}async getParsedTransaction(e,t){let{commitment:r,config:i}=tP(t),n=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",i),s=X(await this._rpcRequest("getTransaction",n),rJ);if("error"in s)throw new tn(s.error,"failed to get transaction");return s.result}async getParsedTransactions(e,t){let{commitment:r,config:i}=tP(t),n=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",i)}));return(await this._rpcBatchRequest(n)).map(e=>{let t=X(e,rJ);if("error"in t)throw new tn(t.error,"failed to get transactions");return t.result})}async getTransactions(e,t){let{commitment:r,config:i}=tP(t),n=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],r,void 0,i)}));return(await this._rpcBatchRequest(n)).map(e=>{let t=X(e,rG);if("error"in t)throw new tn(t.error,"failed to get transactions");let r=t.result;return r?{...r,transaction:{...r.transaction,message:tN(r.version,r.transaction.message)}}:r})}async getConfirmedBlock(e,t){let r=this._buildArgsAtLeastConfirmed([e],t),i=X(await this._rpcRequest("getBlock",r),rj);if("error"in i)throw new tn(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+e+" not found");let s={...n,transactions:n.transactions.map(({transaction:e,meta:t})=>{let r=new eJ(e.message);return{meta:t,transaction:{...e,message:r}}})};return{...s,transactions:s.transactions.map(({transaction:e,meta:t})=>({meta:t,transaction:e1.populate(e.message,e.signatures)}))}}async getBlocks(e,t,r){let i=this._buildArgsAtLeastConfirmed(void 0!==t?[e,t]:[e],r),n=X(await this._rpcRequest("getBlocks",i),tL(er(ea())));if("error"in n)throw new tn(n.error,"failed to get blocks");return n.result}async getBlockSignatures(e,t){let r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),i=X(await this._rpcRequest("getBlock",r),rH);if("error"in i)throw new tn(i.error,"failed to get block");let n=i.result;if(!n)throw Error("Block "+e+" not found");return n}async getConfirmedBlockSignatures(e,t){let r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),i=X(await this._rpcRequest("getBlock",r),rH);if("error"in i)throw new tn(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+e+" not found");return n}async getConfirmedTransaction(e,t){let r=this._buildArgsAtLeastConfirmed([e],t),i=X(await this._rpcRequest("getTransaction",r),rG);if("error"in i)throw new tn(i.error,"failed to get transaction");let n=i.result;if(!n)return n;let s=new eJ(n.transaction.message),o=n.transaction.signatures;return{...n,transaction:e1.populate(s,o)}}async getParsedConfirmedTransaction(e,t){let r=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),i=X(await this._rpcRequest("getTransaction",r),rJ);if("error"in i)throw new tn(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(e,t){let r=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],t,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(e=>{let t=X(e,rJ);if("error"in t)throw new tn(t.error,"failed to get confirmed transactions");return t.result})}async getConfirmedSignaturesForAddress(e,t,r){let i={},n=await this.getFirstAvailableBlock();for(;!("until"in i)&&!(--t<=0)&&!(t<n);)try{let e=await this.getConfirmedBlockSignatures(t,"finalized");e.signatures.length>0&&(i.until=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}let s=await this.getSlot("finalized");for(;!("before"in i)&&!(++r>s);)try{let e=await this.getConfirmedBlockSignatures(r);e.signatures.length>0&&(i.before=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}return(await this.getConfirmedSignaturesForAddress2(e,i)).map(e=>e.signature)}async getConfirmedSignaturesForAddress2(e,t,r){let i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),n=X(await this._rpcRequest("getConfirmedSignaturesForAddress2",i),rc);if("error"in n)throw new tn(n.error,"failed to get confirmed signatures for address");return n.result}async getSignaturesForAddress(e,t,r){let i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),n=X(await this._rpcRequest("getSignaturesForAddress",i),ru);if("error"in n)throw new tn(n.error,"failed to get signatures for address");return n.result}async getAddressLookupTable(e,t){let{context:r,value:i}=await this.getAccountInfoAndContext(e,t),n=null;return null!==i&&(n=new tI({key:e,state:tI.deserialize(i.data)})),{context:r,value:n}}async getNonceAndContext(e,t){let{context:r,value:i}=await this.getAccountInfoAndContext(e,t),n=null;return null!==i&&(n=th.fromAccountData(i.data)),{context:r,value:n}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(e=>e.value).catch(t=>{throw Error("failed to get nonce for account "+e.toBase58()+": "+t)})}async requestAirdrop(e,t){let r=X(await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),r0);if("error"in r)throw new tn(r.error,`airdrop to ${e.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await to(100);let e=Date.now()-this._blockhashInfo.lastFetch;if(null!==this._blockhashInfo.latestBlockhash&&!(e>=3e4))return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let e=Date.now(),t=this._blockhashInfo.latestBlockhash,r=t?t.blockhash:null;for(let e=0;e<50;e++){let e=await this.getLatestBlockhash("finalized");if(r!==e.blockhash)return this._blockhashInfo={latestBlockhash:e,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e;await to(200)}throw Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){let{commitment:t,config:r}=tP(e),i=this._buildArgs([],t,"base64",r),n=X(await this._rpcRequest("getStakeMinimumDelegation",i),tO(ea()));if("error"in n)throw new tn(n.error,"failed to get stake minimum delegation");return n.result}async simulateTransaction(e,t,r){let i;if("message"in e){let i=e.serialize(),n=o.Buffer.from(i).toString("base64");if(Array.isArray(t)||void 0!==r)throw Error("Invalid arguments");let s=t||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment),t&&"object"==typeof t&&"innerInstructions"in t&&(s.innerInstructions=t.innerInstructions);let a=[n,s],c=X(await this._rpcRequest("simulateTransaction",a),tY);if("error"in c)throw Error("failed to simulate transaction: "+c.error.message);return c.result}if(e instanceof e1?((i=new e1).feePayer=e.feePayer,i.instructions=e.instructions,i.nonceInfo=e.nonceInfo,i.signatures=e.signatures):(i=e1.populate(e))._message=i._json=void 0,void 0!==t&&!Array.isArray(t))throw Error("Invalid arguments");if(i.nonceInfo&&t)i.sign(...t);else{let e=this._disableBlockhashCaching;for(;;){let r=await this._blockhashWithExpiryBlockHeight(e);if(i.lastValidBlockHeight=r.lastValidBlockHeight,i.recentBlockhash=r.blockhash,!t)break;if(i.sign(...t),!i.signature)throw Error("!signature");let n=i.signature.toString("base64");if(this._blockhashInfo.simulatedSignatures.includes(n)||this._blockhashInfo.transactionSignatures.includes(n))e=!0;else{this._blockhashInfo.simulatedSignatures.push(n);break}}}let n=i._compile(),s=n.serialize(),a=i._serialize(s).toString("base64"),c={encoding:"base64",commitment:this.commitment};r&&(c.accounts={encoding:"base64",addresses:(Array.isArray(r)?r:n.nonProgramIds()).map(e=>e.toBase58())}),t&&(c.sigVerify=!0),t&&"object"==typeof t&&"innerInstructions"in t&&(c.innerInstructions=t.innerInstructions);let u=[a,c],l=X(await this._rpcRequest("simulateTransaction",u),tY);if("error"in l){let e;if("data"in l.error&&(e=l.error.data.logs)&&Array.isArray(e)){let t="\n ",r=t+e.join(t);console.error(l.error.message,r)}throw new ti({action:"simulate",signature:"",transactionMessage:l.error.message,logs:e})}return l.result}async sendTransaction(e,t,r){if("version"in e){if(t&&Array.isArray(t))throw Error("Invalid arguments");let r=e.serialize();return await this.sendRawTransaction(r,t)}if(void 0===t||!Array.isArray(t))throw Error("Invalid arguments");if(e.nonceInfo)e.sign(...t);else{let r=this._disableBlockhashCaching;for(;;){let i=await this._blockhashWithExpiryBlockHeight(r);if(e.lastValidBlockHeight=i.lastValidBlockHeight,e.recentBlockhash=i.blockhash,e.sign(...t),!e.signature)throw Error("!signature");let n=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(n))r=!0;else{this._blockhashInfo.transactionSignatures.push(n);break}}}let i=e.serialize();return await this.sendRawTransaction(i,r)}async sendRawTransaction(e,t){let r=eT(e).toString("base64");return await this.sendEncodedTransaction(r,t)}async sendEncodedTransaction(e,t){let r={encoding:"base64"},i=t&&t.skipPreflight,n=!0===i?"processed":t&&t.preflightCommitment||this.commitment;t&&null!=t.maxRetries&&(r.maxRetries=t.maxRetries),t&&null!=t.minContextSlot&&(r.minContextSlot=t.minContextSlot),i&&(r.skipPreflight=i),n&&(r.preflightCommitment=n);let s=[e,r],o=X(await this._rpcRequest("sendTransaction",s),r1);if("error"in o){let e;throw"data"in o.error&&(e=o.error.data.logs),new ti({action:i?"send":"simulate",signature:"",transactionMessage:o.error.message,logs:e})}return o.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){(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===e)?this._updateSubscriptions():(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([e,t])=>{this._setSubscription(e,{...t,state:"pending"})}))}_setSubscription(e,t){let r=this._subscriptionsByHash[e]?.state;if(this._subscriptionsByHash[e]=t,r!==t.state){let r=this._subscriptionStateChangeCallbacksByHash[e];r&&r.forEach(e=>{try{e(t.state)}catch{}})}}_onSubscriptionStateChange(e,t){let r=this._subscriptionHashByClientSubscriptionId[e];if(null==r)return()=>{};let i=this._subscriptionStateChangeCallbacksByHash[r]||=new Set;return i.add(t),()=>{i.delete(t),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(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}},500));return}if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();let e=this._rpcWebSocketGeneration,t=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async e=>{let r=this._subscriptionsByHash[e];if(void 0!==r)switch(r.state){case"pending":case"unsubscribed":if(0===r.callbacks.size){delete this._subscriptionsByHash[e],"unsubscribed"===r.state&&delete this._subscriptionCallbacksByServerSubscriptionId[r.serverSubscriptionId],await this._updateSubscriptions();return}await (async()=>{let{args:i,method:n}=r;try{this._setSubscription(e,{...r,state:"subscribing"});let t=await this._rpcWebSocket.call(n,i);this._setSubscription(e,{...r,serverSubscriptionId:t,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[t]=r.callbacks,await this._updateSubscriptions()}catch(s){if(console.error(`Received ${s instanceof Error?"":"JSON-RPC "}error calling \`${n}\``,{args:i,error:s}),!t())return;this._setSubscription(e,{...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(e,{...r,state:"unsubscribing"}),this._setSubscription(e,{...r,state:"unsubscribing"});try{await this._rpcWebSocket.call(n,[i])}catch(i){if(i instanceof Error&&console.error(`${n} error:`,i.message),!t())return;this._setSubscription(e,{...r,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(e,{...r,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(e,t){let r=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==r&&r.forEach(e=>{try{e(...t)}catch(e){console.error(e)}})}_wsOnAccountNotification(e){let{result:t,subscription:r}=X(e,rl);this._handleServerNotification(r,[t.value,t.context])}_makeSubscription(e,t){let r=this._nextClientSubscriptionId++,i=tb([e.method,t]),n=this._subscriptionsByHash[i];return void 0===n?this._subscriptionsByHash[i]={...e,args:t,callbacks:new Set([e.callback]),state:"pending"}:n.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];let t=this._subscriptionsByHash[i];eV(void 0!==t,`Could not find a \`Subscription\` when tearing down client subscription #${r}`),t.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(e,t,r){let{commitment:i,config:n}=tP(r),s=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",n);return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},s)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){let{result:t,subscription:r}=X(e,rh);this._handleServerNotification(r,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(e,t,r,i){let{commitment:n,config:s}=tP(r),o=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64",s||(i?{filters:tT(i)}:void 0));return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},o)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,t,r){let i=this._buildArgs(["object"==typeof e?{mentions:[e.toString()]}:e],r||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){let{result:t,subscription:r}=X(e,r6);this._handleServerNotification(r,[t.value,t.context])}_wsOnSlotNotification(e){let{result:t,subscription:r}=X(e,rp);this._handleServerNotification(r,[t])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){let{result:t,subscription:r}=X(e,ry);this._handleServerNotification(r,[t])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,t){let r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];r?await r():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${t}' events could not be found.`)}_buildArgs(e,t,r,i){let n=t||this._commitment;if(n||r||i){let t={};r&&(t.encoding=r),n&&(t.commitment=n),i&&(t=Object.assign(t,i)),e.push(t)}return e}_buildArgsAtLeastConfirmed(e,t,r,i){let n=t||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(e,t,r,i)}_wsOnSignatureNotification(e){let{result:t,subscription:r}=X(e,rm);"receivedSignature"!==t.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===t.value?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(e,t,r){let i=this._buildArgs([e],r||this._commitment||"finalized"),n=this._makeSubscription({callback:(e,r)=>{if("status"===e.type){t(e.result,r);try{this.removeSignatureListener(n)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return n}
8onSignatureWithOptions(e,t,r){let{commitment:i,...n}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},s=this._buildArgs([e],i,void 0,n),o=this._makeSubscription({callback:(e,r)=>{t(e,r);try{this.removeSignatureListener(o)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return o}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){let{result:t,subscription:r}=X(e,rb);this._handleServerNotification(r,[t])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}},"Ed25519Program",0,it,"Enum",0,class extends eR{constructor(e){if(super(e),this.enum="",1!==Object.keys(e).length)throw Error("Enum can only take single value");Object.keys(e).map(e=>{this.enum=e})}},"EpochSchedule",0,tw,"FeeCalculatorLayout",0,tu,"Keypair",0,r3,"LAMPORTS_PER_SOL",0,1e9,"LOOKUP_TABLE_INSTRUCTION_LAYOUTS",0,r8,"Loader",0,ty,"Lockup",0,ic,"MAX_SEED_LENGTH",0,32,"Message",0,eJ,"MessageAccountKeys",0,eK,"MessageV0",0,eY,"NONCE_ACCOUNT_LENGTH",0,td,"NonceAccount",0,th,"PACKET_DATA_SIZE",0,1232,"PUBLIC_KEY_LENGTH",0,32,"PublicKey",0,eO,"SIGNATURE_LENGTH_IN_BYTES",0,64,"SOLANA_SCHEMA",0,eC,"STAKE_CONFIG_ID",0,io,"STAKE_INSTRUCTION_LAYOUTS",0,iu,"SYSTEM_INSTRUCTION_LAYOUTS",0,tp,"SYSVAR_CLOCK_PUBKEY",0,e5,"SYSVAR_EPOCH_SCHEDULE_PUBKEY",0,e3,"SYSVAR_INSTRUCTIONS_PUBKEY",0,e8,"SYSVAR_RECENT_BLOCKHASHES_PUBKEY",0,e4,"SYSVAR_RENT_PUBKEY",0,e7,"SYSVAR_REWARDS_PUBKEY",0,e9,"SYSVAR_SLOT_HASHES_PUBKEY",0,te,"SYSVAR_SLOT_HISTORY_PUBKEY",0,tt,"SYSVAR_STAKE_HISTORY_PUBKEY",0,tr,"Secp256k1Program",0,is,"SendTransactionError",0,ti,"SolanaJSONRPCError",0,tn,"SolanaJSONRPCErrorCode",0,{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},"StakeAuthorizationLayout",0,il,"StakeInstruction",0,class{static decodeInstructionType(e){let t;this.checkProgramId(e.programId);let r=U.u32("instruction").decode(e.data);for(let[e,i]of Object.entries(iu))if(i.index==r){t=e;break}if(!t)throw Error("Instruction type incorrect; not a StakeInstruction");return t}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{authorized:t,lockup:r}=tc(iu.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new ia(new eO(t.staker),new eO(t.withdrawer)),lockup:new ic(r.unixTimestamp,r.epoch,new eO(r.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),tc(iu.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{newAuthorized:t,stakeAuthorizationType:r}=tc(iu.Authorize,e.data),i={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new eO(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(i.custodianPubkey=e.keys[3].pubkey),i}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{newAuthorized:t,stakeAuthorizationType:r,authoritySeed:i,authorityOwner:n}=tc(iu.AuthorizeWithSeed,e.data),s={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:i,authorityOwner:new eO(n),newAuthorizedPubkey:new eO(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(s.custodianPubkey=e.keys[3].pubkey),s}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{lamports:t}=tc(iu.Split,e.data);return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}static decodeMerge(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),tc(iu.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);let{lamports:t}=tc(iu.Withdraw,e.data),r={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(r.custodianPubkey=e.keys[5].pubkey),r}static decodeDeactivate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),tc(iu.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(id.programId))throw Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.length<t)throw Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},"StakeProgram",0,id,"Struct",0,eR,"SystemInstruction",0,class{static decodeInstructionType(e){let t;this.checkProgramId(e.programId);let r=U.u32("instruction").decode(e.data);for(let[e,i]of Object.entries(tp))if(i.index==r){t=e;break}if(!t)throw Error("Instruction type incorrect; not a SystemInstruction");return t}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);
8let{lamports:t,space:r,programId:i}=tc(tp.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:r,programId:new eO(i)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{lamports:t}=tc(tp.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{lamports:t,seed:r,programId:i}=tc(tp.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:t,seed:r,programId:new eO(i)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{space:t}=tc(tp.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{base:t,seed:r,space:i,programId:n}=tc(tp.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new eO(t),seed:r,space:i,programId:new eO(n)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{programId:t}=tc(tp.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new eO(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);let{base:t,seed:r,programId:i}=tc(tp.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new eO(t),seed:r,programId:new eO(i)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{base:t,seed:r,lamports:i,space:n,programId:s}=tc(tp.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new eO(t),seed:r,lamports:i,space:n,programId:new eO(s)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{authorized:t}=tc(tp.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new eO(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),tc(tp.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);let{lamports:t}=tc(tp.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);let{authorized:t}=tc(tp.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new eO(t)}}static checkProgramId(e){if(!e.equals(tg.programId))throw Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length<t)throw Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},"SystemProgram",0,tg,"Transaction",0,e1,"TransactionExpiredBlockheightExceededError",0,eN,"TransactionExpiredNonceInvalidError",0,eW,"TransactionExpiredTimeoutError",0,eU,"TransactionInstruction",0,e0,"TransactionMessage",0,e2,"TransactionStatus",0,eX,"VALIDATOR_INFO_KEY",0,im,"VERSION_PREFIX_MASK",0,127,"VOTE_PROGRAM_ID",0,iw,"ValidatorInfo",0,ik,"VersionedMessage",0,eZ,"VersionedTransaction",0,e6,"VoteAccount",0,iv,"VoteAuthorizationLayout",0,ig,"VoteInit",0,ih,"VoteInstruction",0,class{static decodeInstructionType(e){let t;this.checkProgramId(e.programId);let r=U.u32("instruction").decode(e.data);for(let[e,i]of Object.entries(ip))if(i.index==r){t=e;break}if(!t)throw Error("Instruction type incorrect; not a VoteInstruction");return t}static decodeInitializeAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);let{voteInit:t}=tc(ip.InitializeAccount,e.data);return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new ih(new eO(t.nodePubkey),new eO(t.authorizedVoter),new eO(t.authorizedWithdrawer),t.commission)}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{newAuthorized:t,voteAuthorizationType:r}=tc(ip.Authorize,e.data);return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new eO(t),voteAuthorizationType:{index:r}}}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:t,currentAuthorityDerivedKeySeed:r,newAuthorized:i,voteAuthorizationType:n}}=tc(ip.AuthorizeWithSeed,e.data);return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new eO(t),currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:new eO(i),voteAuthorizationType:{index:n},votePubkey:e.keys[0].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);let{lamports:t}=tc(ip.Withdraw,e.data);return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(iy.programId))throw Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(e,t){if(e.length<t)throw Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},"VoteProgram",0,iy,"clusterApiUrl",0,function(e,t){let r=!1===t?"http":"https";if(!e)return iA[r].devnet;let i=iA[r][e];if(!i)throw Error(`Unknown ${r} cluster: ${e}`);return i},"sendAndConfirmRawTransaction",0,iE,"sendAndConfirmTransaction",0,ts],679844)}]); 9 10//# debugId=bd518c37-e8de-d166-b723-857fe5eee30b 11//# sourceMappingURL=0ife2i-bbktf_.js.map
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.