edge-currency-accountbased 0.22.21 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/android/src/main/assets/edge-currency-accountbased/{645.chunk.js → 216.chunk.js} +6 -6
- package/android/src/main/assets/edge-currency-accountbased/244.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/387.chunk.js +9 -0
- package/android/src/main/assets/edge-currency-accountbased/491.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/549.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/94.chunk.js +8 -9
- package/android/src/main/assets/edge-currency-accountbased/bnb.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/eos.chunk.js +11 -11
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +9 -9
- package/android/src/main/assets/edge-currency-accountbased/fio.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/hedera.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/polkadot.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/ripple.chunk.js +5 -4
- package/android/src/main/assets/edge-currency-accountbased/solana.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/stellar.chunk.js +6 -6
- package/android/src/main/assets/edge-currency-accountbased/tezos.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/tron.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/zcash.chunk.js +2 -2
- package/lib/binance/bnbEngine.js +28 -16
- package/lib/binance/bnbTypes.js +11 -0
- package/lib/common/engine.js +47 -3
- package/lib/common/types.js +20 -0
- package/lib/declare-modules.d.js +0 -22
- package/lib/eos/eosEngine.js +32 -21
- package/lib/eos/eosTypes.js +16 -0
- package/lib/eos/info/eosInfo.js +3 -1
- package/lib/ethereum/ethEngine.js +90 -140
- package/lib/ethereum/ethTypes.js +64 -0
- package/lib/fio/fioConst.js +26 -55
- package/lib/fio/fioEngine.js +830 -609
- package/lib/fio/fioError.js +15 -22
- package/lib/fio/fioInfo.js +13 -23
- package/lib/fio/fioPlugin.js +85 -94
- package/lib/fio/fioTypes.js +180 -1
- package/lib/hedera/hederaEngine.js +24 -12
- package/lib/hedera/hederaTypes.js +37 -0
- package/lib/polkadot/polkadotEngine.js +30 -10
- package/lib/polkadot/polkadotTypes.js +37 -0
- package/lib/solana/solanaEngine.js +25 -27
- package/lib/solana/solanaTypes.js +37 -0
- package/lib/stellar/stellarEngine.js +21 -19
- package/lib/stellar/stellarTypes.js +10 -0
- package/lib/tezos/tezosEngine.js +23 -18
- package/lib/tezos/tezosTypes.js +16 -0
- package/lib/tron/tronEngine.js +14 -7
- package/lib/tron/tronPlugin.js +1 -1
- package/lib/tron/tronTypes.js +15 -11
- package/lib/xrp/xrpEngine.js +86 -59
- package/lib/xrp/xrpTypes.js +16 -0
- package/lib/zcash/zecEngine.js +33 -27
- package/lib/zcash/zecInfo.js +4 -1
- package/lib/zcash/zecPlugin.js +20 -6
- package/lib/zcash/zecTypes.js +57 -1
- package/package.json +3 -3
- package/android/src/main/assets/edge-currency-accountbased/206.chunk.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[
|
|
1
|
+
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[216],{39386:function(Ae,g,K){"use strict";/**
|
|
2
2
|
* Support for translating between Uint8Array instances and JavaScript
|
|
3
3
|
* native types.
|
|
4
4
|
*
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
* @license MIT
|
|
106
106
|
* @author Peter A. Bigot
|
|
107
107
|
* @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}
|
|
108
|
-
*/var j=this&&this.__extends||function(){var m=function(b,l){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,y){u.__proto__=y}||function(u,y){for(var P in y)Object.prototype.hasOwnProperty.call(y,P)&&(u[P]=y[P])},m(b,l)};return function(b,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");m(b,l);function u(){this.constructor=b}b.prototype=l===null?Object.create(l):(u.prototype=l.prototype,new u)}}();g.__esModule=!0,g.s16=g.s8=g.nu64be=g.u48be=g.u40be=g.u32be=g.u24be=g.u16be=g.nu64=g.u48=g.u40=g.u32=g.u24=g.u16=g.u8=g.offset=g.greedy=g.Constant=g.UTF8=g.CString=g.Blob=g.Boolean=g.BitField=g.BitStructure=g.VariantLayout=g.Union=g.UnionLayoutDiscriminator=g.UnionDiscriminator=g.Structure=g.Sequence=g.DoubleBE=g.Double=g.FloatBE=g.Float=g.NearInt64BE=g.NearInt64=g.NearUInt64BE=g.NearUInt64=g.IntBE=g.Int=g.UIntBE=g.UInt=g.OffsetLayout=g.GreedyCount=g.ExternalLayout=g.bindConstructorLayout=g.nameWithProperty=g.Layout=g.uint8ArrayToBuffer=g.checkUint8Array=void 0,g.constant=g.utf8=g.cstr=g.blob=g.unionLayoutDiscriminator=g.union=g.seq=g.bits=g.struct=g.f64be=g.f64=g.f32be=g.f32=g.ns64be=g.s48be=g.s40be=g.s32be=g.s24be=g.s16be=g.ns64=g.s48=g.s40=g.s32=g.s24=void 0;var X=z(28779);function C(m){if(!(m instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}g.checkUint8Array=C;function W(m){return C(m),X.Buffer.from(m.buffer,m.byteOffset,m.length)}g.uint8ArrayToBuffer=W;var L=function(){function m(b,l){if(!Number.isInteger(b))throw new TypeError("span must be an integer");this.span=b,this.property=l}return m.prototype.makeDestinationObject=function(){return{}},m.prototype.decode=function(b,l){throw new Error("Layout is abstract")},m.prototype.encode=function(b,l,u){throw new Error("Layout is abstract")},m.prototype.getSpan=function(b,l){if(0>this.span)throw new RangeError("indeterminate span");return this.span},m.prototype.replicate=function(b){var l=Object.create(this.constructor.prototype);return Object.assign(l,this),l.property=b,l},m.prototype.fromArray=function(b){},m}();g.Layout=L;function I(m,b){return b.property?m+"["+b.property+"]":m}g.nameWithProperty=I;function h(m,b){if(typeof m!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(m,"layout_"))throw new Error("Class is already bound to a layout");if(!(b&&b instanceof L))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(b,"boundConstructor_"))throw new Error("layout is already bound to a constructor");m.layout_=b,b.boundConstructor_=m,b.makeDestinationObject=function(){return new m},Object.defineProperty(m.prototype,"encode",{value:function(l,u){return b.encode(this,l,u)},writable:!0}),Object.defineProperty(m,"decode",{value:function(l,u){return b.decode(l,u)},writable:!0})}g.bindConstructorLayout=h;var v=function(m){j(b,m);function b(){return m!==null&&m.apply(this,arguments)||this}return b.prototype.isCount=function(){throw new Error("ExternalLayout is abstract")},b}(L);g.ExternalLayout=v;var f=function(m){j(b,m);function b(l,u){var y=this;if(l===void 0&&(l=1),!Number.isInteger(l)||0>=l)throw new TypeError("elementSpan must be a (positive) integer");return y=m.call(this,-1,u)||this,y.elementSpan=l,y}return b.prototype.isCount=function(){return!0},b.prototype.decode=function(l,u){C(l),u===void 0&&(u=0);var y=l.length-u;return Math.floor(y/this.elementSpan)},b.prototype.encode=function(l,u,y){return 0},b}(v);g.GreedyCount=f;var T=function(m){j(b,m);function b(l,u,y){var P=this;if(!(l instanceof L))throw new TypeError("layout must be a Layout");if(u===void 0)u=0;else if(!Number.isInteger(u))throw new TypeError("offset must be integer or undefined");return P=m.call(this,l.span,y||l.property)||this,P.layout=l,P.offset=u,P}return b.prototype.isCount=function(){return this.layout instanceof _||this.layout instanceof F},b.prototype.decode=function(l,u){return u===void 0&&(u=0),this.layout.decode(l,u+this.offset)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),this.layout.encode(l,u,y+this.offset)},b}(v);g.OffsetLayout=T;var _=function(m){j(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readUIntLE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeUIntLE(l,y,this.span),this.span},b}(L);g.UInt=_;var F=function(m){j(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readUIntBE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeUIntBE(l,y,this.span),this.span},b}(L);g.UIntBE=F;var B=function(m){j(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readIntLE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeIntLE(l,y,this.span),this.span},b}(L);g.Int=B;var w=function(m){j(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readIntBE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeIntBE(l,y,this.span),this.span},b}(L);g.IntBE=w;var U=Math.pow(2,32);function D(m){var b=Math.floor(m/U),l=m-b*U;return{hi32:b,lo32:l}}function R(m,b){return m*U+b}var G=function(m){j(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readUInt32LE(u),O=y.readUInt32LE(u+4);return R(O,P)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeUInt32LE(P.lo32,y),O.writeUInt32LE(P.hi32,y+4),8},b}(L);g.NearUInt64=G;var H=function(m){j(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readUInt32BE(u),O=y.readUInt32BE(u+4);return R(P,O)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeUInt32BE(P.hi32,y),O.writeUInt32BE(P.lo32,y+4),8},b}(L);g.NearUInt64BE=H;var ae=function(m){j(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readUInt32LE(u),O=y.readInt32LE(u+4);return R(O,P)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeUInt32LE(P.lo32,y),O.writeInt32LE(P.hi32,y+4),8},b}(L);g.NearInt64=ae;var x=function(m){j(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readInt32BE(u),O=y.readUInt32BE(u+4);return R(P,O)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeInt32BE(P.hi32,y),O.writeUInt32BE(P.lo32,y+4),8},b}(L);g.NearInt64BE=x;var be=function(m){j(b,m);function b(l){return m.call(this,4,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readFloatLE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeFloatLE(l,y),4},b}(L);g.Float=be;var Y=function(m){j(b,m);function b(l){return m.call(this,4,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readFloatBE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeFloatBE(l,y),4},b}(L);g.FloatBE=Y;var ue=function(m){j(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readDoubleLE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeDoubleLE(l,y),8},b}(L);g.Double=ue;var oe=function(m){j(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readDoubleBE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeDoubleBE(l,y),8},b}(L);g.DoubleBE=oe;var fe=function(m){j(b,m);function b(l,u,y){var P=this;if(!(l instanceof L))throw new TypeError("elementLayout must be a Layout");if(!(u instanceof v&&u.isCount()||Number.isInteger(u)&&0<=u))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var O=-1;return!(u instanceof v)&&0<l.span&&(O=u*l.span),P=m.call(this,O,y)||this,P.elementLayout=l,P.count=u,P}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0,P=this.count;if(P instanceof v&&(P=P.decode(l,u)),0<this.elementLayout.span)y=P*this.elementLayout.span;else for(var O=0;O<P;)y+=this.elementLayout.getSpan(l,u+y),++O;return y},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=[],P=0,O=this.count;for(O instanceof v&&(O=O.decode(l,u));P<O;)y.push(this.elementLayout.decode(l,u)),u+=this.elementLayout.getSpan(l,u),P+=1;return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=this.elementLayout,O=l.reduce(function(k,ve){return k+P.encode(ve,u,y+k)},0);return this.count instanceof v&&this.count.encode(l.length,u,y),O},b}(L);g.Sequence=fe;var Z=function(m){j(b,m);function b(l,u,y){var P=this;if(!(Array.isArray(l)&&l.reduce(function(De,it){return De&&it instanceof L},!0)))throw new TypeError("fields must be array of Layout instances");typeof u=="boolean"&&y===void 0&&(y=u,u=void 0);for(var O=0,k=l;O<k.length;O++){var ve=k[O];if(0>ve.span&&ve.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout")}var ye=-1;try{ye=l.reduce(function(De,it){return De+it.getSpan()},0)}catch{}return P=m.call(this,ye,u)||this,P.fields=l,P.decodePrefixes=!!y,P}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0;try{y=this.fields.reduce(function(P,O){var k=O.getSpan(l,u);return u+=k,P+k},0)}catch{throw new RangeError("indeterminate span")}return y},b.prototype.decode=function(l,u){C(l),u===void 0&&(u=0);for(var y=this.makeDestinationObject(),P=0,O=this.fields;P<O.length;P++){var k=O[P];if(k.property!==void 0&&(y[k.property]=k.decode(l,u)),u+=k.getSpan(l,u),this.decodePrefixes&&l.length===u)break}return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);for(var P=y,O=0,k=0,ve=0,ye=this.fields;ve<ye.length;ve++){var De=ye[ve],it=De.span;if(k=0<it?it:0,De.property!==void 0){var Wt=l[De.property];Wt!==void 0&&(k=De.encode(Wt,u,y),0>it&&(it=De.getSpan(u,y)))}O=y,y+=it}return O+k-P},b.prototype.fromArray=function(l){for(var u=this.makeDestinationObject(),y=0,P=this.fields;y<P.length;y++){var O=P[y];O.property!==void 0&&0<l.length&&(u[O.property]=l.shift())}return u},b.prototype.layoutFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=this.fields;u<y.length;u++){var P=y[u];if(P.property===l)return P}},b.prototype.offsetOf=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=0,P=this.fields;y<P.length;y++){var O=P[y];if(O.property===l)return u;0>O.span?u=-1:0<=u&&(u+=O.span)}},b}(L);g.Structure=Z;var M=function(){function m(b){this.property=b}return m.prototype.decode=function(b,l){throw new Error("UnionDiscriminator is abstract")},m.prototype.encode=function(b,l,u){throw new Error("UnionDiscriminator is abstract")},m}();g.UnionDiscriminator=M;var re=function(m){j(b,m);function b(l,u){var y=this;if(!(l instanceof v&&l.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return y=m.call(this,u||l.property||"variant")||this,y.layout=l,y}return b.prototype.decode=function(l,u){return this.layout.decode(l,u)},b.prototype.encode=function(l,u,y){return this.layout.encode(l,u,y)},b}(M);g.UnionLayoutDiscriminator=re;var ie=function(m){j(b,m);function b(l,u,y){var P=this,O=l instanceof _||l instanceof F,k;if(O)k=new re(new T(l));else if(l instanceof v&&l.isCount())k=new re(l);else if(l instanceof M)k=l;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(u===void 0&&(u=null),!(u===null||u instanceof L))throw new TypeError("defaultLayout must be null or a Layout");if(u!==null){if(0>u.span)throw new Error("defaultLayout must have constant span");u.property===void 0&&(u=u.replicate("content"))}var ve=-1;u&&(ve=u.span,0<=ve&&O&&(ve+=k.layout.span)),P=m.call(this,ve,y)||this,P.discriminator=k,P.usesPrefixDiscriminator=O,P.defaultLayout=u,P.registry={};var ye=P.defaultGetSourceVariant.bind(P);return P.getSourceVariant=function(De){return ye(De)},P.configGetSourceVariant=function(De){ye=De.bind(this)},P}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=this.getVariant(l,u);if(!y)throw new Error("unable to determine span for unrecognized variant");return y.getSpan(l,u)},b.prototype.defaultGetSourceVariant=function(l){if(Object.prototype.hasOwnProperty.call(l,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(l,this.defaultLayout.property))return;var u=this.registry[l[this.discriminator.property]];if(u&&(!u.layout||u.property&&Object.prototype.hasOwnProperty.call(l,u.property)))return u}else for(var y in this.registry){var u=this.registry[y];if(u.property&&Object.prototype.hasOwnProperty.call(l,u.property))return u}throw new Error("unable to infer src variant")},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y,P=this.discriminator,O=P.decode(l,u),k=this.registry[O];if(k===void 0){var ve=this.defaultLayout,ye=0;this.usesPrefixDiscriminator&&(ye=P.layout.span),y=this.makeDestinationObject(),y[P.property]=O,y[ve.property]=ve.decode(l,u+ye)}else y=k.decode(l,u);return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=this.getSourceVariant(l);if(P===void 0){var O=this.discriminator,k=this.defaultLayout,ve=0;return this.usesPrefixDiscriminator&&(ve=O.layout.span),O.encode(l[O.property],u,y),ve+k.encode(l[k.property],u,y+ve)}return P.encode(l,u,y)},b.prototype.addVariant=function(l,u,y){var P=new ge(this,l,u,y);return this.registry[l]=P,P},b.prototype.getVariant=function(l,u){var y;return l instanceof Uint8Array?(u===void 0&&(u=0),y=this.discriminator.decode(l,u)):y=l,this.registry[y]},b}(L);g.Union=ie;var ge=function(m){j(b,m);function b(l,u,y,P){var O=this;if(!(l instanceof ie))throw new TypeError("union must be a Union");if(!Number.isInteger(u)||0>u)throw new TypeError("variant must be a (non-negative) integer");if(typeof y=="string"&&P===void 0&&(P=y,y=null),y){if(!(y instanceof L))throw new TypeError("layout must be a Layout");if(l.defaultLayout!==null&&0<=y.span&&y.span>l.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof P!="string")throw new TypeError("variant must have a String property")}var k=l.span;return 0>l.span&&(k=y?y.span:0,0<=k&&l.usesPrefixDiscriminator&&(k+=l.discriminator.layout.span)),O=m.call(this,k,P)||this,O.union=l,O.variant=u,O.layout=y||null,O}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0;this.union.usesPrefixDiscriminator&&(y=this.union.discriminator.layout.span);var P=0;return this.layout&&(P=this.layout.getSpan(l,u+y)),y+P},b.prototype.decode=function(l,u){var y=this.makeDestinationObject();if(u===void 0&&(u=0),this!==this.union.getVariant(l,u))throw new Error("variant mismatch");var P=0;this.union.usesPrefixDiscriminator&&(P=this.union.discriminator.layout.span);var O=this.property;return this.layout?y[O]=this.layout.decode(l,u+P):O?y[O]=!0:this.union.usesPrefixDiscriminator&&(y[this.union.discriminator.property]=this.variant),y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=0;this.union.usesPrefixDiscriminator&&(P=this.union.discriminator.layout.span);var O=this.property;if(this.layout&&!Object.prototype.hasOwnProperty.call(l,O))throw new TypeError("variant lacks property "+O);this.union.discriminator.encode(this.variant,u,y);var k=P;if(this.layout&&(this.layout.encode(l[O],u,y+P),k+=this.layout.getSpan(u,y+P),0<=this.union.span&&k>this.union.span))throw new Error("encoded variant overruns containing union");return k},b.prototype.fromArray=function(l){if(this.layout)return this.layout.fromArray(l)},b}(L);g.VariantLayout=ge;function me(m){return 0>m&&(m+=4294967296),m}var Oe=function(m){j(b,m);function b(l,u,y){var P=this;if(!(l instanceof _||l instanceof F))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof u=="string"&&y===void 0&&(y=u,u=!1),4<l.span)throw new RangeError("word cannot exceed 32 bits");P=m.call(this,l.span,y)||this,P.word=l,P.msb=!!u,P.fields=[];var O=0;return P._packedSetValue=function(k){return O=me(k),this},P._packedGetValue=function(){return O},P}return b.prototype.decode=function(l,u){var y=this.makeDestinationObject();u===void 0&&(u=0);var P=this.word.decode(l,u);this._packedSetValue(P);for(var O=0,k=this.fields;O<k.length;O++){var ve=k[O];ve.property!==void 0&&(y[ve.property]=ve.decode(P))}return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=this.word.decode(u,y);this._packedSetValue(P);for(var O=0,k=this.fields;O<k.length;O++){var ve=k[O];if(ve.property!==void 0){var ye=l[ve.property];ye!==void 0&&ve.encode(ye)}}return this.word.encode(this._packedGetValue(),u,y)},b.prototype.addField=function(l,u){var y=new Ge(this,l,u);return this.fields.push(y),y},b.prototype.addBoolean=function(l){var u=new le(this,l);return this.fields.push(u),u},b.prototype.fieldFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=this.fields;u<y.length;u++){var P=y[u];if(P.property===l)return P}},b}(L);g.BitStructure=Oe;var Ge=function(){function m(b,l,u){if(!(b instanceof Oe))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(l)||0>=l)throw new TypeError("bits must be positive integer");var y=8*b.span,P=b.fields.reduce(function(O,k){return O+k.bits},0);if(l+P>y)throw new Error("bits too long for span remainder ("+(y-P)+" of "+y+" remain)");this.container=b,this.bits=l,this.valueMask=(1<<l)-1,l===32&&(this.valueMask=4294967295),this.start=P,this.container.msb&&(this.start=y-P-l),this.wordMask=me(this.valueMask<<this.start),this.property=u}return m.prototype.decode=function(b,l){var u=this.container._packedGetValue(),y=me(u&this.wordMask),P=y>>>this.start;return P},m.prototype.encode=function(b){if(!Number.isInteger(b)||b!==me(b&this.valueMask))throw new TypeError(I("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var l=this.container._packedGetValue(),u=me(b<<this.start);this.container._packedSetValue(me(l&~this.wordMask)|u)},m}();g.BitField=Ge;var le=function(m){j(b,m);function b(l,u){return m.call(this,l,1,u)||this}return b.prototype.decode=function(l,u){return!!Ge.prototype.decode.call(this,l,u)},b.prototype.encode=function(l){return typeof l=="boolean"&&(l=+l),Ge.prototype.encode.call(this,l)},b}(Ge);g.Boolean=le;var Je=function(m){j(b,m);function b(l,u){var y=this;if(!(l instanceof v&&l.isCount()||Number.isInteger(l)&&0<=l))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var P=-1;return l instanceof v||(P=l),y=m.call(this,P,u)||this,y.length=l,y}return b.prototype.getSpan=function(l,u){var y=this.span;return 0>y&&(y=this.length.decode(l,u)),y},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.span;return 0>y&&(y=this.length.decode(l,u)),W(l).slice(u,u+y)},b.prototype.encode=function(l,u,y){var P=this.length;if(this.length instanceof v&&(P=l.length),!(l instanceof Uint8Array&&P===l.length))throw new TypeError(I("Blob.encode",this)+" requires (length "+P+") Uint8Array as src");if(y+P>u.length)throw new RangeError("encoding overruns Uint8Array");var O=W(l);return W(u).write(O.toString("hex"),y,P,"hex"),this.length instanceof v&&this.length.encode(P,u,y),P},b}(L);g.Blob=Je;var Fe=function(m){j(b,m);function b(l){return m.call(this,-1,l)||this}return b.prototype.getSpan=function(l,u){C(l),u===void 0&&(u=0);for(var y=u;y<l.length&&l[y]!==0;)y+=1;return 1+y-u},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.getSpan(l,u);return W(l).slice(u,u+y-1).toString("utf-8")},b.prototype.encode=function(l,u,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var P=X.Buffer.from(l,"utf8"),O=P.length;if(y+O>u.length)throw new RangeError("encoding overruns Buffer");var k=W(u);return P.copy(k,y),k[y+O]=0,O+1},b}(L);g.CString=Fe;var $e=function(m){j(b,m);function b(l,u){var y=this;if(typeof l=="string"&&u===void 0&&(u=l,l=void 0),l===void 0)l=-1;else if(!Number.isInteger(l))throw new TypeError("maxSpan must be an integer");return y=m.call(this,-1,u)||this,y.maxSpan=l,y}return b.prototype.getSpan=function(l,u){return C(l),u===void 0&&(u=0),l.length-u},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.getSpan(l,u);if(0<=this.maxSpan&&this.maxSpan<y)throw new RangeError("text length exceeds maxSpan");return W(l).slice(u,u+y).toString("utf-8")},b.prototype.encode=function(l,u,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var P=X.Buffer.from(l,"utf8"),O=P.length;if(0<=this.maxSpan&&this.maxSpan<O)throw new RangeError("text length exceeds maxSpan");if(y+O>u.length)throw new RangeError("encoding overruns Buffer");return P.copy(W(u),y),O},b}(L);g.UTF8=$e;var Rt=function(m){j(b,m);function b(l,u){var y=m.call(this,0,u)||this;return y.value=l,y}return b.prototype.decode=function(l,u){return this.value},b.prototype.encode=function(l,u,y){return 0},b}(L);g.Constant=Rt,g.greedy=function(m,b){return new f(m,b)},g.offset=function(m,b,l){return new T(m,b,l)},g.u8=function(m){return new _(1,m)},g.u16=function(m){return new _(2,m)},g.u24=function(m){return new _(3,m)},g.u32=function(m){return new _(4,m)},g.u40=function(m){return new _(5,m)},g.u48=function(m){return new _(6,m)},g.nu64=function(m){return new G(m)},g.u16be=function(m){return new F(2,m)},g.u24be=function(m){return new F(3,m)},g.u32be=function(m){return new F(4,m)},g.u40be=function(m){return new F(5,m)},g.u48be=function(m){return new F(6,m)},g.nu64be=function(m){return new H(m)},g.s8=function(m){return new B(1,m)},g.s16=function(m){return new B(2,m)},g.s24=function(m){return new B(3,m)},g.s32=function(m){return new B(4,m)},g.s40=function(m){return new B(5,m)},g.s48=function(m){return new B(6,m)},g.ns64=function(m){return new ae(m)},g.s16be=function(m){return new w(2,m)},g.s24be=function(m){return new w(3,m)},g.s32be=function(m){return new w(4,m)},g.s40be=function(m){return new w(5,m)},g.s48be=function(m){return new w(6,m)},g.ns64be=function(m){return new x(m)},g.f32=function(m){return new be(m)},g.f32be=function(m){return new Y(m)},g.f64=function(m){return new ue(m)},g.f64be=function(m){return new oe(m)},g.struct=function(m,b,l){return new Z(m,b,l)},g.bits=function(m,b,l){return new Oe(m,b,l)},g.seq=function(m,b,l){return new fe(m,b,l)},g.union=function(m,b,l){return new ie(m,b,l)},g.unionLayoutDiscriminator=function(m,b){return new re(m,b)},g.blob=function(m,b){return new Je(m,b)},g.cstr=function(m){return new Fe(m)},g.utf8=function(m,b){return new $e(m,b)},g.constant=function(m,b){return new Rt(m,b)}},28779:function(Ae,g,z){"use strict";/*!
|
|
108
|
+
*/var M=this&&this.__extends||function(){var m=function(b,l){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,y){u.__proto__=y}||function(u,y){for(var P in y)Object.prototype.hasOwnProperty.call(y,P)&&(u[P]=y[P])},m(b,l)};return function(b,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");m(b,l);function u(){this.constructor=b}b.prototype=l===null?Object.create(l):(u.prototype=l.prototype,new u)}}();g.__esModule=!0,g.s16=g.s8=g.nu64be=g.u48be=g.u40be=g.u32be=g.u24be=g.u16be=g.nu64=g.u48=g.u40=g.u32=g.u24=g.u16=g.u8=g.offset=g.greedy=g.Constant=g.UTF8=g.CString=g.Blob=g.Boolean=g.BitField=g.BitStructure=g.VariantLayout=g.Union=g.UnionLayoutDiscriminator=g.UnionDiscriminator=g.Structure=g.Sequence=g.DoubleBE=g.Double=g.FloatBE=g.Float=g.NearInt64BE=g.NearInt64=g.NearUInt64BE=g.NearUInt64=g.IntBE=g.Int=g.UIntBE=g.UInt=g.OffsetLayout=g.GreedyCount=g.ExternalLayout=g.bindConstructorLayout=g.nameWithProperty=g.Layout=g.uint8ArrayToBuffer=g.checkUint8Array=void 0,g.constant=g.utf8=g.cstr=g.blob=g.unionLayoutDiscriminator=g.union=g.seq=g.bits=g.struct=g.f64be=g.f64=g.f32be=g.f32=g.ns64be=g.s48be=g.s40be=g.s32be=g.s24be=g.s16be=g.ns64=g.s48=g.s40=g.s32=g.s24=void 0;var X=K(28779);function C(m){if(!(m instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}g.checkUint8Array=C;function W(m){return C(m),X.Buffer.from(m.buffer,m.byteOffset,m.length)}g.uint8ArrayToBuffer=W;var N=function(){function m(b,l){if(!Number.isInteger(b))throw new TypeError("span must be an integer");this.span=b,this.property=l}return m.prototype.makeDestinationObject=function(){return{}},m.prototype.decode=function(b,l){throw new Error("Layout is abstract")},m.prototype.encode=function(b,l,u){throw new Error("Layout is abstract")},m.prototype.getSpan=function(b,l){if(0>this.span)throw new RangeError("indeterminate span");return this.span},m.prototype.replicate=function(b){var l=Object.create(this.constructor.prototype);return Object.assign(l,this),l.property=b,l},m.prototype.fromArray=function(b){},m}();g.Layout=N;function _(m,b){return b.property?m+"["+b.property+"]":m}g.nameWithProperty=_;function h(m,b){if(typeof m!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(m,"layout_"))throw new Error("Class is already bound to a layout");if(!(b&&b instanceof N))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(b,"boundConstructor_"))throw new Error("layout is already bound to a constructor");m.layout_=b,b.boundConstructor_=m,b.makeDestinationObject=function(){return new m},Object.defineProperty(m.prototype,"encode",{value:function(l,u){return b.encode(this,l,u)},writable:!0}),Object.defineProperty(m,"decode",{value:function(l,u){return b.decode(l,u)},writable:!0})}g.bindConstructorLayout=h;var v=function(m){M(b,m);function b(){return m!==null&&m.apply(this,arguments)||this}return b.prototype.isCount=function(){throw new Error("ExternalLayout is abstract")},b}(N);g.ExternalLayout=v;var f=function(m){M(b,m);function b(l,u){var y=this;if(l===void 0&&(l=1),!Number.isInteger(l)||0>=l)throw new TypeError("elementSpan must be a (positive) integer");return y=m.call(this,-1,u)||this,y.elementSpan=l,y}return b.prototype.isCount=function(){return!0},b.prototype.decode=function(l,u){C(l),u===void 0&&(u=0);var y=l.length-u;return Math.floor(y/this.elementSpan)},b.prototype.encode=function(l,u,y){return 0},b}(v);g.GreedyCount=f;var T=function(m){M(b,m);function b(l,u,y){var P=this;if(!(l instanceof N))throw new TypeError("layout must be a Layout");if(u===void 0)u=0;else if(!Number.isInteger(u))throw new TypeError("offset must be integer or undefined");return P=m.call(this,l.span,y||l.property)||this,P.layout=l,P.offset=u,P}return b.prototype.isCount=function(){return this.layout instanceof I||this.layout instanceof F},b.prototype.decode=function(l,u){return u===void 0&&(u=0),this.layout.decode(l,u+this.offset)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),this.layout.encode(l,u,y+this.offset)},b}(v);g.OffsetLayout=T;var I=function(m){M(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readUIntLE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeUIntLE(l,y,this.span),this.span},b}(N);g.UInt=I;var F=function(m){M(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readUIntBE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeUIntBE(l,y,this.span),this.span},b}(N);g.UIntBE=F;var B=function(m){M(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readIntLE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeIntLE(l,y,this.span),this.span},b}(N);g.Int=B;var w=function(m){M(b,m);function b(l,u){var y=m.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readIntBE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeIntBE(l,y,this.span),this.span},b}(N);g.IntBE=w;var U=Math.pow(2,32);function D(m){var b=Math.floor(m/U),l=m-b*U;return{hi32:b,lo32:l}}function R(m,b){return m*U+b}var G=function(m){M(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readUInt32LE(u),O=y.readUInt32LE(u+4);return R(O,P)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeUInt32LE(P.lo32,y),O.writeUInt32LE(P.hi32,y+4),8},b}(N);g.NearUInt64=G;var H=function(m){M(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readUInt32BE(u),O=y.readUInt32BE(u+4);return R(P,O)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeUInt32BE(P.hi32,y),O.writeUInt32BE(P.lo32,y+4),8},b}(N);g.NearUInt64BE=H;var ae=function(m){M(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readUInt32LE(u),O=y.readInt32LE(u+4);return R(O,P)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeUInt32LE(P.lo32,y),O.writeInt32LE(P.hi32,y+4),8},b}(N);g.NearInt64=ae;var x=function(m){M(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=W(l),P=y.readInt32BE(u),O=y.readUInt32BE(u+4);return R(P,O)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=D(l),O=W(u);return O.writeInt32BE(P.hi32,y),O.writeUInt32BE(P.lo32,y+4),8},b}(N);g.NearInt64BE=x;var be=function(m){M(b,m);function b(l){return m.call(this,4,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readFloatLE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeFloatLE(l,y),4},b}(N);g.Float=be;var Y=function(m){M(b,m);function b(l){return m.call(this,4,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readFloatBE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeFloatBE(l,y),4},b}(N);g.FloatBE=Y;var ue=function(m){M(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readDoubleLE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeDoubleLE(l,y),8},b}(N);g.Double=ue;var oe=function(m){M(b,m);function b(l){return m.call(this,8,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),W(l).readDoubleBE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),W(u).writeDoubleBE(l,y),8},b}(N);g.DoubleBE=oe;var fe=function(m){M(b,m);function b(l,u,y){var P=this;if(!(l instanceof N))throw new TypeError("elementLayout must be a Layout");if(!(u instanceof v&&u.isCount()||Number.isInteger(u)&&0<=u))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var O=-1;return!(u instanceof v)&&0<l.span&&(O=u*l.span),P=m.call(this,O,y)||this,P.elementLayout=l,P.count=u,P}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0,P=this.count;if(P instanceof v&&(P=P.decode(l,u)),0<this.elementLayout.span)y=P*this.elementLayout.span;else for(var O=0;O<P;)y+=this.elementLayout.getSpan(l,u+y),++O;return y},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=[],P=0,O=this.count;for(O instanceof v&&(O=O.decode(l,u));P<O;)y.push(this.elementLayout.decode(l,u)),u+=this.elementLayout.getSpan(l,u),P+=1;return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=this.elementLayout,O=l.reduce(function(k,ve){return k+P.encode(ve,u,y+k)},0);return this.count instanceof v&&this.count.encode(l.length,u,y),O},b}(N);g.Sequence=fe;var Z=function(m){M(b,m);function b(l,u,y){var P=this;if(!(Array.isArray(l)&&l.reduce(function(De,it){return De&&it instanceof N},!0)))throw new TypeError("fields must be array of Layout instances");typeof u=="boolean"&&y===void 0&&(y=u,u=void 0);for(var O=0,k=l;O<k.length;O++){var ve=k[O];if(0>ve.span&&ve.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout")}var ye=-1;try{ye=l.reduce(function(De,it){return De+it.getSpan()},0)}catch{}return P=m.call(this,ye,u)||this,P.fields=l,P.decodePrefixes=!!y,P}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0;try{y=this.fields.reduce(function(P,O){var k=O.getSpan(l,u);return u+=k,P+k},0)}catch{throw new RangeError("indeterminate span")}return y},b.prototype.decode=function(l,u){C(l),u===void 0&&(u=0);for(var y=this.makeDestinationObject(),P=0,O=this.fields;P<O.length;P++){var k=O[P];if(k.property!==void 0&&(y[k.property]=k.decode(l,u)),u+=k.getSpan(l,u),this.decodePrefixes&&l.length===u)break}return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);for(var P=y,O=0,k=0,ve=0,ye=this.fields;ve<ye.length;ve++){var De=ye[ve],it=De.span;if(k=0<it?it:0,De.property!==void 0){var Wt=l[De.property];Wt!==void 0&&(k=De.encode(Wt,u,y),0>it&&(it=De.getSpan(u,y)))}O=y,y+=it}return O+k-P},b.prototype.fromArray=function(l){for(var u=this.makeDestinationObject(),y=0,P=this.fields;y<P.length;y++){var O=P[y];O.property!==void 0&&0<l.length&&(u[O.property]=l.shift())}return u},b.prototype.layoutFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=this.fields;u<y.length;u++){var P=y[u];if(P.property===l)return P}},b.prototype.offsetOf=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=0,P=this.fields;y<P.length;y++){var O=P[y];if(O.property===l)return u;0>O.span?u=-1:0<=u&&(u+=O.span)}},b}(N);g.Structure=Z;var $=function(){function m(b){this.property=b}return m.prototype.decode=function(b,l){throw new Error("UnionDiscriminator is abstract")},m.prototype.encode=function(b,l,u){throw new Error("UnionDiscriminator is abstract")},m}();g.UnionDiscriminator=$;var re=function(m){M(b,m);function b(l,u){var y=this;if(!(l instanceof v&&l.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return y=m.call(this,u||l.property||"variant")||this,y.layout=l,y}return b.prototype.decode=function(l,u){return this.layout.decode(l,u)},b.prototype.encode=function(l,u,y){return this.layout.encode(l,u,y)},b}($);g.UnionLayoutDiscriminator=re;var ie=function(m){M(b,m);function b(l,u,y){var P=this,O=l instanceof I||l instanceof F,k;if(O)k=new re(new T(l));else if(l instanceof v&&l.isCount())k=new re(l);else if(l instanceof $)k=l;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(u===void 0&&(u=null),!(u===null||u instanceof N))throw new TypeError("defaultLayout must be null or a Layout");if(u!==null){if(0>u.span)throw new Error("defaultLayout must have constant span");u.property===void 0&&(u=u.replicate("content"))}var ve=-1;u&&(ve=u.span,0<=ve&&O&&(ve+=k.layout.span)),P=m.call(this,ve,y)||this,P.discriminator=k,P.usesPrefixDiscriminator=O,P.defaultLayout=u,P.registry={};var ye=P.defaultGetSourceVariant.bind(P);return P.getSourceVariant=function(De){return ye(De)},P.configGetSourceVariant=function(De){ye=De.bind(this)},P}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=this.getVariant(l,u);if(!y)throw new Error("unable to determine span for unrecognized variant");return y.getSpan(l,u)},b.prototype.defaultGetSourceVariant=function(l){if(Object.prototype.hasOwnProperty.call(l,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(l,this.defaultLayout.property))return;var u=this.registry[l[this.discriminator.property]];if(u&&(!u.layout||u.property&&Object.prototype.hasOwnProperty.call(l,u.property)))return u}else for(var y in this.registry){var u=this.registry[y];if(u.property&&Object.prototype.hasOwnProperty.call(l,u.property))return u}throw new Error("unable to infer src variant")},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y,P=this.discriminator,O=P.decode(l,u),k=this.registry[O];if(k===void 0){var ve=this.defaultLayout,ye=0;this.usesPrefixDiscriminator&&(ye=P.layout.span),y=this.makeDestinationObject(),y[P.property]=O,y[ve.property]=ve.decode(l,u+ye)}else y=k.decode(l,u);return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=this.getSourceVariant(l);if(P===void 0){var O=this.discriminator,k=this.defaultLayout,ve=0;return this.usesPrefixDiscriminator&&(ve=O.layout.span),O.encode(l[O.property],u,y),ve+k.encode(l[k.property],u,y+ve)}return P.encode(l,u,y)},b.prototype.addVariant=function(l,u,y){var P=new ge(this,l,u,y);return this.registry[l]=P,P},b.prototype.getVariant=function(l,u){var y;return l instanceof Uint8Array?(u===void 0&&(u=0),y=this.discriminator.decode(l,u)):y=l,this.registry[y]},b}(N);g.Union=ie;var ge=function(m){M(b,m);function b(l,u,y,P){var O=this;if(!(l instanceof ie))throw new TypeError("union must be a Union");if(!Number.isInteger(u)||0>u)throw new TypeError("variant must be a (non-negative) integer");if(typeof y=="string"&&P===void 0&&(P=y,y=null),y){if(!(y instanceof N))throw new TypeError("layout must be a Layout");if(l.defaultLayout!==null&&0<=y.span&&y.span>l.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof P!="string")throw new TypeError("variant must have a String property")}var k=l.span;return 0>l.span&&(k=y?y.span:0,0<=k&&l.usesPrefixDiscriminator&&(k+=l.discriminator.layout.span)),O=m.call(this,k,P)||this,O.union=l,O.variant=u,O.layout=y||null,O}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0;this.union.usesPrefixDiscriminator&&(y=this.union.discriminator.layout.span);var P=0;return this.layout&&(P=this.layout.getSpan(l,u+y)),y+P},b.prototype.decode=function(l,u){var y=this.makeDestinationObject();if(u===void 0&&(u=0),this!==this.union.getVariant(l,u))throw new Error("variant mismatch");var P=0;this.union.usesPrefixDiscriminator&&(P=this.union.discriminator.layout.span);var O=this.property;return this.layout?y[O]=this.layout.decode(l,u+P):O?y[O]=!0:this.union.usesPrefixDiscriminator&&(y[this.union.discriminator.property]=this.variant),y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=0;this.union.usesPrefixDiscriminator&&(P=this.union.discriminator.layout.span);var O=this.property;if(this.layout&&!Object.prototype.hasOwnProperty.call(l,O))throw new TypeError("variant lacks property "+O);this.union.discriminator.encode(this.variant,u,y);var k=P;if(this.layout&&(this.layout.encode(l[O],u,y+P),k+=this.layout.getSpan(u,y+P),0<=this.union.span&&k>this.union.span))throw new Error("encoded variant overruns containing union");return k},b.prototype.fromArray=function(l){if(this.layout)return this.layout.fromArray(l)},b}(N);g.VariantLayout=ge;function me(m){return 0>m&&(m+=4294967296),m}var Oe=function(m){M(b,m);function b(l,u,y){var P=this;if(!(l instanceof I||l instanceof F))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof u=="string"&&y===void 0&&(y=u,u=!1),4<l.span)throw new RangeError("word cannot exceed 32 bits");P=m.call(this,l.span,y)||this,P.word=l,P.msb=!!u,P.fields=[];var O=0;return P._packedSetValue=function(k){return O=me(k),this},P._packedGetValue=function(){return O},P}return b.prototype.decode=function(l,u){var y=this.makeDestinationObject();u===void 0&&(u=0);var P=this.word.decode(l,u);this._packedSetValue(P);for(var O=0,k=this.fields;O<k.length;O++){var ve=k[O];ve.property!==void 0&&(y[ve.property]=ve.decode(P))}return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var P=this.word.decode(u,y);this._packedSetValue(P);for(var O=0,k=this.fields;O<k.length;O++){var ve=k[O];if(ve.property!==void 0){var ye=l[ve.property];ye!==void 0&&ve.encode(ye)}}return this.word.encode(this._packedGetValue(),u,y)},b.prototype.addField=function(l,u){var y=new Ge(this,l,u);return this.fields.push(y),y},b.prototype.addBoolean=function(l){var u=new le(this,l);return this.fields.push(u),u},b.prototype.fieldFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=this.fields;u<y.length;u++){var P=y[u];if(P.property===l)return P}},b}(N);g.BitStructure=Oe;var Ge=function(){function m(b,l,u){if(!(b instanceof Oe))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(l)||0>=l)throw new TypeError("bits must be positive integer");var y=8*b.span,P=b.fields.reduce(function(O,k){return O+k.bits},0);if(l+P>y)throw new Error("bits too long for span remainder ("+(y-P)+" of "+y+" remain)");this.container=b,this.bits=l,this.valueMask=(1<<l)-1,l===32&&(this.valueMask=4294967295),this.start=P,this.container.msb&&(this.start=y-P-l),this.wordMask=me(this.valueMask<<this.start),this.property=u}return m.prototype.decode=function(b,l){var u=this.container._packedGetValue(),y=me(u&this.wordMask),P=y>>>this.start;return P},m.prototype.encode=function(b){if(!Number.isInteger(b)||b!==me(b&this.valueMask))throw new TypeError(_("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var l=this.container._packedGetValue(),u=me(b<<this.start);this.container._packedSetValue(me(l&~this.wordMask)|u)},m}();g.BitField=Ge;var le=function(m){M(b,m);function b(l,u){return m.call(this,l,1,u)||this}return b.prototype.decode=function(l,u){return!!Ge.prototype.decode.call(this,l,u)},b.prototype.encode=function(l){return typeof l=="boolean"&&(l=+l),Ge.prototype.encode.call(this,l)},b}(Ge);g.Boolean=le;var Je=function(m){M(b,m);function b(l,u){var y=this;if(!(l instanceof v&&l.isCount()||Number.isInteger(l)&&0<=l))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var P=-1;return l instanceof v||(P=l),y=m.call(this,P,u)||this,y.length=l,y}return b.prototype.getSpan=function(l,u){var y=this.span;return 0>y&&(y=this.length.decode(l,u)),y},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.span;return 0>y&&(y=this.length.decode(l,u)),W(l).slice(u,u+y)},b.prototype.encode=function(l,u,y){var P=this.length;if(this.length instanceof v&&(P=l.length),!(l instanceof Uint8Array&&P===l.length))throw new TypeError(_("Blob.encode",this)+" requires (length "+P+") Uint8Array as src");if(y+P>u.length)throw new RangeError("encoding overruns Uint8Array");var O=W(l);return W(u).write(O.toString("hex"),y,P,"hex"),this.length instanceof v&&this.length.encode(P,u,y),P},b}(N);g.Blob=Je;var Fe=function(m){M(b,m);function b(l){return m.call(this,-1,l)||this}return b.prototype.getSpan=function(l,u){C(l),u===void 0&&(u=0);for(var y=u;y<l.length&&l[y]!==0;)y+=1;return 1+y-u},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.getSpan(l,u);return W(l).slice(u,u+y-1).toString("utf-8")},b.prototype.encode=function(l,u,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var P=X.Buffer.from(l,"utf8"),O=P.length;if(y+O>u.length)throw new RangeError("encoding overruns Buffer");var k=W(u);return P.copy(k,y),k[y+O]=0,O+1},b}(N);g.CString=Fe;var $e=function(m){M(b,m);function b(l,u){var y=this;if(typeof l=="string"&&u===void 0&&(u=l,l=void 0),l===void 0)l=-1;else if(!Number.isInteger(l))throw new TypeError("maxSpan must be an integer");return y=m.call(this,-1,u)||this,y.maxSpan=l,y}return b.prototype.getSpan=function(l,u){return C(l),u===void 0&&(u=0),l.length-u},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.getSpan(l,u);if(0<=this.maxSpan&&this.maxSpan<y)throw new RangeError("text length exceeds maxSpan");return W(l).slice(u,u+y).toString("utf-8")},b.prototype.encode=function(l,u,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var P=X.Buffer.from(l,"utf8"),O=P.length;if(0<=this.maxSpan&&this.maxSpan<O)throw new RangeError("text length exceeds maxSpan");if(y+O>u.length)throw new RangeError("encoding overruns Buffer");return P.copy(W(u),y),O},b}(N);g.UTF8=$e;var Rt=function(m){M(b,m);function b(l,u){var y=m.call(this,0,u)||this;return y.value=l,y}return b.prototype.decode=function(l,u){return this.value},b.prototype.encode=function(l,u,y){return 0},b}(N);g.Constant=Rt,g.greedy=function(m,b){return new f(m,b)},g.offset=function(m,b,l){return new T(m,b,l)},g.u8=function(m){return new I(1,m)},g.u16=function(m){return new I(2,m)},g.u24=function(m){return new I(3,m)},g.u32=function(m){return new I(4,m)},g.u40=function(m){return new I(5,m)},g.u48=function(m){return new I(6,m)},g.nu64=function(m){return new G(m)},g.u16be=function(m){return new F(2,m)},g.u24be=function(m){return new F(3,m)},g.u32be=function(m){return new F(4,m)},g.u40be=function(m){return new F(5,m)},g.u48be=function(m){return new F(6,m)},g.nu64be=function(m){return new H(m)},g.s8=function(m){return new B(1,m)},g.s16=function(m){return new B(2,m)},g.s24=function(m){return new B(3,m)},g.s32=function(m){return new B(4,m)},g.s40=function(m){return new B(5,m)},g.s48=function(m){return new B(6,m)},g.ns64=function(m){return new ae(m)},g.s16be=function(m){return new w(2,m)},g.s24be=function(m){return new w(3,m)},g.s32be=function(m){return new w(4,m)},g.s40be=function(m){return new w(5,m)},g.s48be=function(m){return new w(6,m)},g.ns64be=function(m){return new x(m)},g.f32=function(m){return new be(m)},g.f32be=function(m){return new Y(m)},g.f64=function(m){return new ue(m)},g.f64be=function(m){return new oe(m)},g.struct=function(m,b,l){return new Z(m,b,l)},g.bits=function(m,b,l){return new Oe(m,b,l)},g.seq=function(m,b,l){return new fe(m,b,l)},g.union=function(m,b,l){return new ie(m,b,l)},g.unionLayoutDiscriminator=function(m,b){return new re(m,b)},g.blob=function(m,b){return new Je(m,b)},g.cstr=function(m){return new Fe(m)},g.utf8=function(m,b){return new $e(m,b)},g.constant=function(m,b){return new Rt(m,b)}},28779:function(Ae,g,K){"use strict";/*!
|
|
109
109
|
* The buffer module from node.js, for the browser.
|
|
110
110
|
*
|
|
111
111
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
112
112
|
* @license MIT
|
|
113
|
-
*/const j=z(79742),X=z(80645),C=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;g.Buffer=h,g.SlowBuffer=G,g.INSPECT_MAX_BYTES=50;const W=2147483647;g.kMaxLength=W,h.TYPED_ARRAY_SUPPORT=L(),!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function L(){try{const c=new Uint8Array(1),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(c,s),c.foo()===42}catch{return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.byteOffset}});function I(c){if(c>W)throw new RangeError('The value "'+c+'" is invalid for option "size"');const s=new Uint8Array(c);return Object.setPrototypeOf(s,h.prototype),s}function h(c,s,o){if(typeof c=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(c)}return v(c,s,o)}h.poolSize=8192;function v(c,s,o){if(typeof c=="string")return F(c,s);if(ArrayBuffer.isView(c))return w(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(je(c,ArrayBuffer)||c&&je(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(je(c,SharedArrayBuffer)||c&&je(c.buffer,SharedArrayBuffer)))return U(c,s,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const p=c.valueOf&&c.valueOf();if(p!=null&&p!==c)return h.from(p,s,o);const S=D(c);if(S)return S;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return h.from(c[Symbol.toPrimitive]("string"),s,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}h.from=function(c,s,o){return v(c,s,o)},Object.setPrototypeOf(h.prototype,Uint8Array.prototype),Object.setPrototypeOf(h,Uint8Array);function f(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function T(c,s,o){return f(c),c<=0?I(c):s!==void 0?typeof o=="string"?I(c).fill(s,o):I(c).fill(s):I(c)}h.alloc=function(c,s,o){return T(c,s,o)};function _(c){return f(c),I(c<0?0:R(c)|0)}h.allocUnsafe=function(c){return _(c)},h.allocUnsafeSlow=function(c){return _(c)};function F(c,s){if((typeof s!="string"||s==="")&&(s="utf8"),!h.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const o=H(c,s)|0;let p=I(o);const S=p.write(c,s);return S!==o&&(p=p.slice(0,S)),p}function B(c){const s=c.length<0?0:R(c.length)|0,o=I(s);for(let p=0;p<s;p+=1)o[p]=c[p]&255;return o}function w(c){if(je(c,Uint8Array)){const s=new Uint8Array(c);return U(s.buffer,s.byteOffset,s.byteLength)}return B(c)}function U(c,s,o){if(s<0||c.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<s+(o||0))throw new RangeError('"length" is outside of buffer bounds');let p;return s===void 0&&o===void 0?p=new Uint8Array(c):o===void 0?p=new Uint8Array(c,s):p=new Uint8Array(c,s,o),Object.setPrototypeOf(p,h.prototype),p}function D(c){if(h.isBuffer(c)){const s=R(c.length)|0,o=I(s);return o.length===0||c.copy(o,0,0,s),o}if(c.length!==void 0)return typeof c.length!="number"||Qt(c.length)?I(0):B(c);if(c.type==="Buffer"&&Array.isArray(c.data))return B(c.data)}function R(c){if(c>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return c|0}function G(c){return+c!=c&&(c=0),h.alloc(+c)}h.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==h.prototype},h.compare=function(s,o){if(je(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),je(o,Uint8Array)&&(o=h.from(o,o.offset,o.byteLength)),!h.isBuffer(s)||!h.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===o)return 0;let p=s.length,S=o.length;for(let N=0,V=Math.min(p,S);N<V;++N)if(s[N]!==o[N]){p=s[N],S=o[N];break}return p<S?-1:S<p?1:0},h.isEncoding=function(s){switch(String(s).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(s,o){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return h.alloc(0);let p;if(o===void 0)for(o=0,p=0;p<s.length;++p)o+=s[p].length;const S=h.allocUnsafe(o);let N=0;for(p=0;p<s.length;++p){let V=s[p];if(je(V,Uint8Array))N+V.length>S.length?(h.isBuffer(V)||(V=h.from(V)),V.copy(S,N)):Uint8Array.prototype.set.call(S,V,N);else if(h.isBuffer(V))V.copy(S,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=V.length}return S};function H(c,s){if(h.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||je(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);const o=c.length,p=arguments.length>2&&arguments[2]===!0;if(!p&&o===0)return 0;let S=!1;for(;;)switch(s){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return se(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Ze(c).length;default:if(S)return p?-1:se(c).length;s=(""+s).toLowerCase(),S=!0}}h.byteLength=H;function ae(c,s,o){let p=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,s>>>=0,o<=s))return"";for(c||(c="utf8");;)switch(c){case"hex":return le(this,s,o);case"utf8":case"utf-8":return ie(this,s,o);case"ascii":return Oe(this,s,o);case"latin1":case"binary":return Ge(this,s,o);case"base64":return re(this,s,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Je(this,s,o);default:if(p)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),p=!0}}h.prototype._isBuffer=!0;function x(c,s,o){const p=c[s];c[s]=c[o],c[o]=p}h.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<s;o+=2)x(this,o,o+1);return this},h.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<s;o+=4)x(this,o,o+3),x(this,o+1,o+2);return this},h.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<s;o+=8)x(this,o,o+7),x(this,o+1,o+6),x(this,o+2,o+5),x(this,o+3,o+4);return this},h.prototype.toString=function(){const s=this.length;return s===0?"":arguments.length===0?ie(this,0,s):ae.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(s){if(!h.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:h.compare(this,s)===0},h.prototype.inspect=function(){let s="";const o=g.INSPECT_MAX_BYTES;return s=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(s+=" ... "),"<Buffer "+s+">"},C&&(h.prototype[C]=h.prototype.inspect),h.prototype.compare=function(s,o,p,S,N){if(je(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),!h.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(o===void 0&&(o=0),p===void 0&&(p=s?s.length:0),S===void 0&&(S=0),N===void 0&&(N=this.length),o<0||p>s.length||S<0||N>this.length)throw new RangeError("out of range index");if(S>=N&&o>=p)return 0;if(S>=N)return-1;if(o>=p)return 1;if(o>>>=0,p>>>=0,S>>>=0,N>>>=0,this===s)return 0;let V=N-S,Ee=p-o;const Ue=Math.min(V,Ee),Be=this.slice(S,N),Pe=s.slice(o,p);for(let ce=0;ce<Ue;++ce)if(Be[ce]!==Pe[ce]){V=Be[ce],Ee=Pe[ce];break}return V<Ee?-1:Ee<V?1:0};function be(c,s,o,p,S){if(c.length===0)return-1;if(typeof o=="string"?(p=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Qt(o)&&(o=S?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(S)return-1;o=c.length-1}else if(o<0)if(S)o=0;else return-1;if(typeof s=="string"&&(s=h.from(s,p)),h.isBuffer(s))return s.length===0?-1:Y(c,s,o,p,S);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?S?Uint8Array.prototype.indexOf.call(c,s,o):Uint8Array.prototype.lastIndexOf.call(c,s,o):Y(c,[s],o,p,S);throw new TypeError("val must be string, number or Buffer")}function Y(c,s,o,p,S){let N=1,V=c.length,Ee=s.length;if(p!==void 0&&(p=String(p).toLowerCase(),p==="ucs2"||p==="ucs-2"||p==="utf16le"||p==="utf-16le")){if(c.length<2||s.length<2)return-1;N=2,V/=2,Ee/=2,o/=2}function Ue(Pe,ce){return N===1?Pe[ce]:Pe.readUInt16BE(ce*N)}let Be;if(S){let Pe=-1;for(Be=o;Be<V;Be++)if(Ue(c,Be)===Ue(s,Pe===-1?0:Be-Pe)){if(Pe===-1&&(Pe=Be),Be-Pe+1===Ee)return Pe*N}else Pe!==-1&&(Be-=Be-Pe),Pe=-1}else for(o+Ee>V&&(o=V-Ee),Be=o;Be>=0;Be--){let Pe=!0;for(let ce=0;ce<Ee;ce++)if(Ue(c,Be+ce)!==Ue(s,ce)){Pe=!1;break}if(Pe)return Be}return-1}h.prototype.includes=function(s,o,p){return this.indexOf(s,o,p)!==-1},h.prototype.indexOf=function(s,o,p){return be(this,s,o,p,!0)},h.prototype.lastIndexOf=function(s,o,p){return be(this,s,o,p,!1)};function ue(c,s,o,p){o=Number(o)||0;const S=c.length-o;p?(p=Number(p),p>S&&(p=S)):p=S;const N=s.length;p>N/2&&(p=N/2);let V;for(V=0;V<p;++V){const Ee=parseInt(s.substr(V*2,2),16);if(Qt(Ee))return V;c[o+V]=Ee}return V}function oe(c,s,o,p){return st(se(s,c.length-o),c,o,p)}function fe(c,s,o,p){return st(Jt(s),c,o,p)}function Z(c,s,o,p){return st(Ze(s),c,o,p)}function M(c,s,o,p){return st(Q(s,c.length-o),c,o,p)}h.prototype.write=function(s,o,p,S){if(o===void 0)S="utf8",p=this.length,o=0;else if(p===void 0&&typeof o=="string")S=o,p=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(p)?(p=p>>>0,S===void 0&&(S="utf8")):(S=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const N=this.length-o;if((p===void 0||p>N)&&(p=N),s.length>0&&(p<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");let V=!1;for(;;)switch(S){case"hex":return ue(this,s,o,p);case"utf8":case"utf-8":return oe(this,s,o,p);case"ascii":case"latin1":case"binary":return fe(this,s,o,p);case"base64":return Z(this,s,o,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,s,o,p);default:if(V)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),V=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function re(c,s,o){return s===0&&o===c.length?j.fromByteArray(c):j.fromByteArray(c.slice(s,o))}function ie(c,s,o){o=Math.min(c.length,o);const p=[];let S=s;for(;S<o;){const N=c[S];let V=null,Ee=N>239?4:N>223?3:N>191?2:1;if(S+Ee<=o){let Ue,Be,Pe,ce;switch(Ee){case 1:N<128&&(V=N);break;case 2:Ue=c[S+1],(Ue&192)===128&&(ce=(N&31)<<6|Ue&63,ce>127&&(V=ce));break;case 3:Ue=c[S+1],Be=c[S+2],(Ue&192)===128&&(Be&192)===128&&(ce=(N&15)<<12|(Ue&63)<<6|Be&63,ce>2047&&(ce<55296||ce>57343)&&(V=ce));break;case 4:Ue=c[S+1],Be=c[S+2],Pe=c[S+3],(Ue&192)===128&&(Be&192)===128&&(Pe&192)===128&&(ce=(N&15)<<18|(Ue&63)<<12|(Be&63)<<6|Pe&63,ce>65535&&ce<1114112&&(V=ce))}}V===null?(V=65533,Ee=1):V>65535&&(V-=65536,p.push(V>>>10&1023|55296),V=56320|V&1023),p.push(V),S+=Ee}return me(p)}const ge=4096;function me(c){const s=c.length;if(s<=ge)return String.fromCharCode.apply(String,c);let o="",p=0;for(;p<s;)o+=String.fromCharCode.apply(String,c.slice(p,p+=ge));return o}function Oe(c,s,o){let p="";o=Math.min(c.length,o);for(let S=s;S<o;++S)p+=String.fromCharCode(c[S]&127);return p}function Ge(c,s,o){let p="";o=Math.min(c.length,o);for(let S=s;S<o;++S)p+=String.fromCharCode(c[S]);return p}function le(c,s,o){const p=c.length;(!s||s<0)&&(s=0),(!o||o<0||o>p)&&(o=p);let S="";for(let N=s;N<o;++N)S+=$r[c[N]];return S}function Je(c,s,o){const p=c.slice(s,o);let S="";for(let N=0;N<p.length-1;N+=2)S+=String.fromCharCode(p[N]+p[N+1]*256);return S}h.prototype.slice=function(s,o){const p=this.length;s=~~s,o=o===void 0?p:~~o,s<0?(s+=p,s<0&&(s=0)):s>p&&(s=p),o<0?(o+=p,o<0&&(o=0)):o>p&&(o=p),o<s&&(o=s);const S=this.subarray(s,o);return Object.setPrototypeOf(S,h.prototype),S};function Fe(c,s,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+s>o)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=this[s],N=1,V=0;for(;++V<o&&(N*=256);)S+=this[s+V]*N;return S},h.prototype.readUintBE=h.prototype.readUIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=this[s+--o],N=1;for(;o>0&&(N*=256);)S+=this[s+--o]*N;return S},h.prototype.readUint8=h.prototype.readUInt8=function(s,o){return s=s>>>0,o||Fe(s,1,this.length),this[s]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(s,o){return s=s>>>0,o||Fe(s,2,this.length),this[s]|this[s+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(s,o){return s=s>>>0,o||Fe(s,2,this.length),this[s]<<8|this[s+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},h.prototype.readBigUInt64LE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,N=this[++s]+this[++s]*2**8+this[++s]*2**16+p*2**24;return BigInt(S)+(BigInt(N)<<BigInt(32))}),h.prototype.readBigUInt64BE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=o*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],N=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p;return(BigInt(S)<<BigInt(32))+BigInt(N)}),h.prototype.readIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=this[s],N=1,V=0;for(;++V<o&&(N*=256);)S+=this[s+V]*N;return N*=128,S>=N&&(S-=Math.pow(2,8*o)),S},h.prototype.readIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=o,N=1,V=this[s+--S];for(;S>0&&(N*=256);)V+=this[s+--S]*N;return N*=128,V>=N&&(V-=Math.pow(2,8*o)),V},h.prototype.readInt8=function(s,o){return s=s>>>0,o||Fe(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},h.prototype.readInt16LE=function(s,o){s=s>>>0,o||Fe(s,2,this.length);const p=this[s]|this[s+1]<<8;return p&32768?p|4294901760:p},h.prototype.readInt16BE=function(s,o){s=s>>>0,o||Fe(s,2,this.length);const p=this[s+1]|this[s]<<8;return p&32768?p|4294901760:p},h.prototype.readInt32LE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},h.prototype.readInt32BE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},h.prototype.readBigInt64LE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(p<<24);return(BigInt(S)<<BigInt(32))+BigInt(o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),h.prototype.readBigInt64BE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=(o<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(S)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p)}),h.prototype.readFloatLE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),X.read(this,s,!0,23,4)},h.prototype.readFloatBE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),X.read(this,s,!1,23,4)},h.prototype.readDoubleLE=function(s,o){return s=s>>>0,o||Fe(s,8,this.length),X.read(this,s,!0,52,8)},h.prototype.readDoubleBE=function(s,o){return s=s>>>0,o||Fe(s,8,this.length),X.read(this,s,!1,52,8)};function $e(c,s,o,p,S,N){if(!h.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>S||s<N)throw new RangeError('"value" argument is out of bounds');if(o+p>c.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(s,o,p,S){if(s=+s,o=o>>>0,p=p>>>0,!S){const Ee=Math.pow(2,8*p)-1;$e(this,s,o,p,Ee,0)}let N=1,V=0;for(this[o]=s&255;++V<p&&(N*=256);)this[o+V]=s/N&255;return o+p},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(s,o,p,S){if(s=+s,o=o>>>0,p=p>>>0,!S){const Ee=Math.pow(2,8*p)-1;$e(this,s,o,p,Ee,0)}let N=p-1,V=1;for(this[o+N]=s&255;--N>=0&&(V*=256);)this[o+N]=s/V&255;return o+p},h.prototype.writeUint8=h.prototype.writeUInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,255,0),this[o]=s&255,o+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o+3]=s>>>24,this[o+2]=s>>>16,this[o+1]=s>>>8,this[o]=s&255,o+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4};function Rt(c,s,o,p,S){ve(s,p,S,c,o,7);let N=Number(s&BigInt(4294967295));c[o++]=N,N=N>>8,c[o++]=N,N=N>>8,c[o++]=N,N=N>>8,c[o++]=N;let V=Number(s>>BigInt(32)&BigInt(4294967295));return c[o++]=V,V=V>>8,c[o++]=V,V=V>>8,c[o++]=V,V=V>>8,c[o++]=V,o}function m(c,s,o,p,S){ve(s,p,S,c,o,7);let N=Number(s&BigInt(4294967295));c[o+7]=N,N=N>>8,c[o+6]=N,N=N>>8,c[o+5]=N,N=N>>8,c[o+4]=N;let V=Number(s>>BigInt(32)&BigInt(4294967295));return c[o+3]=V,V=V>>8,c[o+2]=V,V=V>>8,c[o+1]=V,V=V>>8,c[o]=V,o+8}h.prototype.writeBigUInt64LE=yt(function(s,o=0){return Rt(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=yt(function(s,o=0){return m(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(s,o,p,S){if(s=+s,o=o>>>0,!S){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let N=0,V=1,Ee=0;for(this[o]=s&255;++N<p&&(V*=256);)s<0&&Ee===0&&this[o+N-1]!==0&&(Ee=1),this[o+N]=(s/V>>0)-Ee&255;return o+p},h.prototype.writeIntBE=function(s,o,p,S){if(s=+s,o=o>>>0,!S){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let N=p-1,V=1,Ee=0;for(this[o+N]=s&255;--N>=0&&(V*=256);)s<0&&Ee===0&&this[o+N+1]!==0&&(Ee=1),this[o+N]=(s/V>>0)-Ee&255;return o+p},h.prototype.writeInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,127,-128),s<0&&(s=255+s+1),this[o]=s&255,o+1},h.prototype.writeInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),this[o]=s&255,this[o+1]=s>>>8,this[o+2]=s>>>16,this[o+3]=s>>>24,o+4},h.prototype.writeInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4},h.prototype.writeBigInt64LE=yt(function(s,o=0){return Rt(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=yt(function(s,o=0){return m(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function b(c,s,o,p,S,N){if(o+p>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function l(c,s,o,p,S){return s=+s,o=o>>>0,S||b(c,s,o,4,34028234663852886e22,-34028234663852886e22),X.write(c,s,o,p,23,4),o+4}h.prototype.writeFloatLE=function(s,o,p){return l(this,s,o,!0,p)},h.prototype.writeFloatBE=function(s,o,p){return l(this,s,o,!1,p)};function u(c,s,o,p,S){return s=+s,o=o>>>0,S||b(c,s,o,8,17976931348623157e292,-17976931348623157e292),X.write(c,s,o,p,52,8),o+8}h.prototype.writeDoubleLE=function(s,o,p){return u(this,s,o,!0,p)},h.prototype.writeDoubleBE=function(s,o,p){return u(this,s,o,!1,p)},h.prototype.copy=function(s,o,p,S){if(!h.isBuffer(s))throw new TypeError("argument should be a Buffer");if(p||(p=0),!S&&S!==0&&(S=this.length),o>=s.length&&(o=s.length),o||(o=0),S>0&&S<p&&(S=p),S===p||s.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),s.length-o<S-p&&(S=s.length-o+p);const N=S-p;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,p,S):Uint8Array.prototype.set.call(s,this.subarray(p,S),o),N},h.prototype.fill=function(s,o,p,S){if(typeof s=="string"){if(typeof o=="string"?(S=o,o=0,p=this.length):typeof p=="string"&&(S=p,p=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!h.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(s.length===1){const V=s.charCodeAt(0);(S==="utf8"&&V<128||S==="latin1")&&(s=V)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));if(o<0||this.length<o||this.length<p)throw new RangeError("Out of range index");if(p<=o)return this;o=o>>>0,p=p===void 0?this.length:p>>>0,s||(s=0);let N;if(typeof s=="number")for(N=o;N<p;++N)this[N]=s;else{const V=h.isBuffer(s)?s:h.from(s,S),Ee=V.length;if(Ee===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(N=0;N<p-o;++N)this[N+o]=V[N%Ee]}return this};const y={};function P(c,s,o){y[c]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${c}]`,this.stack,delete this.name}get code(){return c}set code(S){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:S,writable:!0})}toString(){return`${this.name} [${c}]: ${this.message}`}}}P("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),P("ERR_INVALID_ARG_TYPE",function(c,s){return`The "${c}" argument must be of type number. Received type ${typeof s}`},TypeError),P("ERR_OUT_OF_RANGE",function(c,s,o){let p=`The value of "${c}" is out of range.`,S=o;return Number.isInteger(o)&&Math.abs(o)>2**32?S=O(String(o)):typeof o=="bigint"&&(S=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(S=O(S)),S+="n"),p+=` It must be ${s}. Received ${S}`,p},RangeError);function O(c){let s="",o=c.length;const p=c[0]==="-"?1:0;for(;o>=p+4;o-=3)s=`_${c.slice(o-3,o)}${s}`;return`${c.slice(0,o)}${s}`}function k(c,s,o){ye(s,"offset"),(c[s]===void 0||c[s+o]===void 0)&&De(s,c.length-(o+1))}function ve(c,s,o,p,S,N){if(c>o||c<s){const V=typeof s=="bigint"?"n":"";let Ee;throw N>3?s===0||s===BigInt(0)?Ee=`>= 0${V} and < 2${V} ** ${(N+1)*8}${V}`:Ee=`>= -(2${V} ** ${(N+1)*8-1}${V}) and < 2 ** ${(N+1)*8-1}${V}`:Ee=`>= ${s}${V} and <= ${o}${V}`,new y.ERR_OUT_OF_RANGE("value",Ee,c)}k(p,S,N)}function ye(c,s){if(typeof c!="number")throw new y.ERR_INVALID_ARG_TYPE(s,"number",c)}function De(c,s,o){throw Math.floor(c)!==c?(ye(c,o),new y.ERR_OUT_OF_RANGE(o||"offset","an integer",c)):s<0?new y.ERR_BUFFER_OUT_OF_BOUNDS:new y.ERR_OUT_OF_RANGE(o||"offset",`>= ${o?1:0} and <= ${s}`,c)}const it=/[^+/0-9A-Za-z-_]/g;function Wt(c){if(c=c.split("=")[0],c=c.trim().replace(it,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function se(c,s){s=s||1/0;let o;const p=c.length;let S=null;const N=[];for(let V=0;V<p;++V){if(o=c.charCodeAt(V),o>55295&&o<57344){if(!S){if(o>56319){(s-=3)>-1&&N.push(239,191,189);continue}else if(V+1===p){(s-=3)>-1&&N.push(239,191,189);continue}S=o;continue}if(o<56320){(s-=3)>-1&&N.push(239,191,189),S=o;continue}o=(S-55296<<10|o-56320)+65536}else S&&(s-=3)>-1&&N.push(239,191,189);if(S=null,o<128){if((s-=1)<0)break;N.push(o)}else if(o<2048){if((s-=2)<0)break;N.push(o>>6|192,o&63|128)}else if(o<65536){if((s-=3)<0)break;N.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((s-=4)<0)break;N.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return N}function Jt(c){const s=[];for(let o=0;o<c.length;++o)s.push(c.charCodeAt(o)&255);return s}function Q(c,s){let o,p,S;const N=[];for(let V=0;V<c.length&&!((s-=2)<0);++V)o=c.charCodeAt(V),p=o>>8,S=o%256,N.push(S),N.push(p);return N}function Ze(c){return j.toByteArray(Wt(c))}function st(c,s,o,p){let S;for(S=0;S<p&&!(S+o>=s.length||S>=c.length);++S)s[S+o]=c[S];return S}function je(c,s){return c instanceof s||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===s.name}function Qt(c){return c!==c}const $r=function(){const c="0123456789abcdef",s=new Array(256);for(let o=0;o<16;++o){const p=o*16;for(let S=0;S<16;++S)s[p+S]=c[o]+c[S]}return s}();function yt(c){return typeof BigInt>"u"?jr:c}function jr(){throw new Error("BigInt not supported")}},75885:function(Ae,g,z){"use strict";z.r(g),z.d(g,{Account:function(){return Fs},Authorized:function(){return Vn},BLOCKHASH_CACHE_TIMEOUT_MS:function(){return Tn},BPF_LOADER_DEPRECATED_PROGRAM_ID:function(){return Ds},BPF_LOADER_PROGRAM_ID:function(){return Zs},BpfLoader:function(){return Xs},Connection:function(){return ca},Ed25519Program:function(){return dr},Enum:function(){return Cs},EpochSchedule:function(){return Rn},FeeCalculatorLayout:function(){return An},Keypair:function(){return Dt},LAMPORTS_PER_SOL:function(){return va},Loader:function(){return It},Lockup:function(){return Zt},MAX_SEED_LENGTH:function(){return vn},Message:function(){return vt},NONCE_ACCOUNT_LENGTH:function(){return Pr},NonceAccount:function(){return ur},PACKET_DATA_SIZE:function(){return Ht},PublicKey:function(){return he},SOLANA_SCHEMA:function(){return Vt},STAKE_CONFIG_ID:function(){return jn},STAKE_INSTRUCTION_LAYOUTS:function(){return Ve},SYSTEM_INSTRUCTION_LAYOUTS:function(){return Re},SYSVAR_CLOCK_PUBKEY:function(){return kt},SYSVAR_EPOCH_SCHEDULE_PUBKEY:function(){return $s},SYSVAR_INSTRUCTIONS_PUBKEY:function(){return js},SYSVAR_RECENT_BLOCKHASHES_PUBKEY:function(){return sr},SYSVAR_RENT_PUBKEY:function(){return qt},SYSVAR_REWARDS_PUBKEY:function(){return Vs},SYSVAR_SLOT_HASHES_PUBKEY:function(){return Gs},SYSVAR_SLOT_HISTORY_PUBKEY:function(){return Hs},SYSVAR_STAKE_HISTORY_PUBKEY:function(){return or},Secp256k1Program:function(){return Kt},SendTransactionError:function(){return Cr},StakeAuthorizationLayout:function(){return fa},StakeInstruction:function(){return ua},StakeProgram:function(){return pr},Struct:function(){return Rr},SystemInstruction:function(){return qs},SystemProgram:function(){return et},Transaction:function(){return Ce},TransactionInstruction:function(){return Xe},VALIDATOR_INFO_KEY:function(){return qn},VOTE_PROGRAM_ID:function(){return ya},ValidatorInfo:function(){return zr},VoteAccount:function(){return Wr},clusterApiUrl:function(){return Sa},sendAndConfirmRawTransaction:function(){return Ea},sendAndConfirmTransaction:function(){return ar}});var j=z(50780),X=z.n(j),C=z(48764),W=z(13550),L=z.n(W),I=z(77191),h=z.n(I),v=z(25532),f=z(39386);class T extends TypeError{constructor(e,t){let r;const{message:n,...a}=e,{path:d}=e,E=d.length===0?n:"At path: "+d.join(".")+" -- "+n;super(E),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var A;return(A=r)!=null?A:r=[e,...t()]}}}function _(i){return F(i)&&typeof i[Symbol.iterator]=="function"}function F(i){return typeof i=="object"&&i!=null}function B(i){if(Object.prototype.toString.call(i)!=="[object Object]")return!1;const e=Object.getPrototypeOf(i);return e===null||e===Object.prototype}function w(i){return typeof i=="string"?JSON.stringify(i):""+i}function U(i){const{done:e,value:t}=i.next();return e?void 0:t}function D(i,e,t,r){if(i===!0)return;i===!1?i={}:typeof i=="string"&&(i={message:i});const{path:n,branch:a}=e,{type:d}=t,{refinement:E,message:A="Expected a value of type `"+d+"`"+(E?" with refinement `"+E+"`":"")+", but received: `"+w(r)+"`"}=i;return{value:r,type:d,refinement:E,key:n[n.length-1],path:n,branch:a,...i,message:A}}function*R(i,e,t,r){_(i)||(i=[i]);for(const n of i){const a=D(n,e,t,r);a&&(yield a)}}function*G(i,e,t={}){const{path:r=[],branch:n=[i],coerce:a=!1,mask:d=!1}=t,E={path:r,branch:n};if(a&&(i=e.coercer(i,E),d&&e.type!=="type"&&F(e.schema)&&F(i)&&!Array.isArray(i)))for(const K in i)e.schema[K]===void 0&&delete i[K];let A=!0;for(const K of e.validator(i,E))A=!1,yield[K,void 0];for(let[K,q,J]of e.entries(i,E)){const ne=G(q,J,{path:K===void 0?r:[...r,K],branch:K===void 0?n:[...n,q],coerce:a,mask:d});for(const te of ne)te[0]?(A=!1,yield[te[0],void 0]):a&&(q=te[1],K===void 0?i=q:i instanceof Map?i.set(K,q):i instanceof Set?i.add(q):F(i)&&(i[K]=q))}if(A)for(const K of e.refiner(i,E))A=!1,yield[K,void 0];A&&(yield[void 0,i])}class H{constructor(e){const{type:t,schema:r,validator:n,refiner:a,coercer:d=A=>A,entries:E=function*(){}}=e;this.type=t,this.schema=r,this.entries=E,this.coercer=d,n?this.validator=(A,K)=>{const q=n(A,K);return R(q,K,this,A)}:this.validator=()=>[],a?this.refiner=(A,K)=>{const q=a(A,K);return R(q,K,this,A)}:this.refiner=()=>[]}assert(e){return ae(e,this)}create(e){return x(e,this)}is(e){return Y(e,this)}mask(e){return be(e,this)}validate(e,t={}){return ue(e,this,t)}}function ae(i,e){const t=ue(i,e);if(t[0])throw t[0]}function x(i,e){const t=ue(i,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function be(i,e){const t=ue(i,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Y(i,e){return!ue(i,e)[0]}function ue(i,e,t={}){const r=G(i,e,t),n=U(r);return n[0]?[new T(n[0],function*(){for(const d of r)d[0]&&(yield d[0])}),void 0]:[void 0,n[1]]}function oe(...i){const e=i.map(r=>r.schema),t=Object.assign({},...e);return ve(t)}function fe(i,e){return new H({type:i,schema:null,validator:e})}function Z(i,e){return new H({...i,refiner:(t,r)=>t===void 0||i.refiner(t,r),validator(t,r){return t===void 0?!0:(e(t,r),i.validator(t,r))}})}function M(i){return new H({type:"dynamic",schema:null,*entries(e,t){yield*i(e,t).entries(e,t)},validator(e,t){return i(e,t).validator(e,t)},coercer(e,t){return i(e,t).coercer(e,t)}})}function re(i){let e;return new H({type:"lazy",schema:null,*entries(t,r){var n;(n=e)!=null||(e=i()),yield*e.entries(t,r)},validator(t,r){var n;return(n=e)!=null||(e=i()),e.validator(t,r)},coercer(t,r){var n;return(n=e)!=null||(e=i()),e.coercer(t,r)}})}function ie(i,e){const{schema:t}=i,r={...t};for(const n of e)delete r[n];return ve(r)}function ge(i){const e=i instanceof H?{...i.schema}:{...i};for(const t in e)e[t]=ye(e[t]);return ve(e)}function me(i,e){const{schema:t}=i,r={};for(const n of e)r[n]=t[n];return ve(r)}function Oe(i,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),fe(i,e)}function Ge(){return fe("any",()=>!0)}function le(i){return new H({type:"array",schema:i,*entries(e){if(i&&Array.isArray(e))for(const[t,r]of e.entries())yield[t,r,i]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+w(e)}})}function Je(){return fe("boolean",i=>typeof i=="boolean")}function Fe(){return fe("date",i=>i instanceof Date&&!isNaN(i.getTime())||"Expected a valid `Date` object, but received: "+w(i))}function $e(i){const e={},t=i.map(r=>w(r)).join();for(const r of i)e[r]=r;return new H({type:"enums",schema:e,validator(r){return i.includes(r)||"Expected one of `"+t+"`, but received: "+w(r)}})}function Rt(){return fe("func",i=>typeof i=="function"||"Expected a function, but received: "+w(i))}function m(i){return fe("instance",e=>e instanceof i||"Expected a `"+i.name+"` instance, but received: "+w(e))}function b(){return fe("integer",i=>typeof i=="number"&&!isNaN(i)&&Number.isInteger(i)||"Expected an integer, but received: "+w(i))}function l(i){return new H({type:"intersection",schema:null,*entries(e,t){for(const r of i)yield*r.entries(e,t)},*validator(e,t){for(const r of i)yield*r.validator(e,t)},*refiner(e,t){for(const r of i)yield*r.refiner(e,t)}})}function u(i){const e=w(i),t=typeof i;return new H({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?i:null,validator(r){return r===i||"Expected the literal `"+e+"`, but received: "+w(r)}})}function y(i,e){return new H({type:"map",schema:null,*entries(t){if(i&&e&&t instanceof Map)for(const[r,n]of t.entries())yield[r,r,i],yield[r,n,e]},coercer(t){return t instanceof Map?new Map(t):t},validator(t){return t instanceof Map||"Expected a `Map` object, but received: "+w(t)}})}function P(){return fe("never",()=>!1)}function O(i){return new H({...i,validator:(e,t)=>e===null||i.validator(e,t),refiner:(e,t)=>e===null||i.refiner(e,t)})}function k(){return fe("number",i=>typeof i=="number"&&!isNaN(i)||"Expected a number, but received: "+w(i))}function ve(i){const e=i?Object.keys(i):[],t=P();return new H({type:"object",schema:i||null,*entries(r){if(i&&F(r)){const n=new Set(Object.keys(r));for(const a of e)n.delete(a),yield[a,r[a],i[a]];for(const a of n)yield[a,r[a],t]}},validator(r){return F(r)||"Expected an object, but received: "+w(r)},coercer(r){return F(r)?{...r}:r}})}function ye(i){return new H({...i,validator:(e,t)=>e===void 0||i.validator(e,t),refiner:(e,t)=>e===void 0||i.refiner(e,t)})}function De(i,e){return new H({type:"record",schema:null,*entries(t){if(F(t))for(const r in t){const n=t[r];yield[r,r,i],yield[r,n,e]}},validator(t){return F(t)||"Expected an object, but received: "+w(t)}})}function it(){return fe("regexp",i=>i instanceof RegExp)}function Wt(i){return new H({type:"set",schema:null,*entries(e){if(i&&e instanceof Set)for(const t of e)yield[t,t,i]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||"Expected a `Set` object, but received: "+w(e)}})}function se(){return fe("string",i=>typeof i=="string"||"Expected a string, but received: "+w(i))}function Jt(i){const e=P();return new H({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const r=Math.max(i.length,t.length);for(let n=0;n<r;n++)yield[n,t[n],i[n]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+w(t)}})}function Q(i){const e=Object.keys(i);return new H({type:"type",schema:i,*entries(t){if(F(t))for(const r of e)yield[r,t[r],i[r]]},validator(t){return F(t)||"Expected an object, but received: "+w(t)}})}function Ze(i){const e=i.map(t=>t.type).join(" | ");return new H({type:"union",schema:null,validator(t,r){const n=[];for(const a of i){const[...d]=G(t,a,r),[E]=d;if(E[0])for(const[A]of d)A&&n.push(A);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+w(t),...n]}})}function st(){return fe("unknown",()=>!0)}function je(i,e,t){return new H({...i,coercer:(r,n)=>Y(r,e)?i.coercer(t(r,n),n):i.coercer(r,n)})}function Qt(i,e,t={}){return je(i,st(),r=>{const n=typeof e=="function"?e():e;if(r===void 0)return n;if(!t.strict&&B(r)&&B(n)){const a={...r};let d=!1;for(const E in n)a[E]===void 0&&(a[E]=n[E],d=!0);if(d)return a}return r})}function $r(i){return je(i,se(),e=>e.trim())}function yt(i){const e="Expected an empty "+i.type;return p(i,"empty",t=>{if(t instanceof Map||t instanceof Set){const{size:r}=t;return r===0||e+" but received one with a size of `"+r+"`"}else{const{length:r}=t;return r===0||e+" but received one with a length of `"+r+"`"}})}function jr(i,e,t={}){const{exclusive:r}=t;return p(i,"max",n=>r?n<e:n<=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function c(i,e,t={}){const{exclusive:r}=t;return p(i,"min",n=>r?n>e:n>=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function s(i,e){return p(i,"pattern",t=>e.test(t)||"Expected a "+i.type+" matching `/"+e.source+'/` but received "'+t+'"')}function o(i,e,t=e){const r="Expected a "+i.type,n=e===t?"of `"+e+"`":"between `"+e+"` and `"+t+"`";return p(i,"size",a=>{if(typeof a=="number"||a instanceof Date)return e<=a&&a<=t||r+" "+n+" but received `"+a+"`";if(a instanceof Map||a instanceof Set){const{size:d}=a;return e<=d&&d<=t||r+" with a size "+n+" but received one with a size of `"+d+"`"}else{const{length:d}=a;return e<=d&&d<=t||r+" with a length "+n+" but received one with a length of `"+d+"`"}})}function p(i,e,t){return new H({...i,*refiner(r,n){yield*i.refiner(r,n);const a=t(r,n),d=R(a,n,i,r);for(const E of d)yield{...E,refinement:e}}})}var S=z(83937),N=z(31198),V=z.n(N),Ee=z(75134),Ue=z.n(Ee),Be=z(91094),Pe=z.n(Be);const ce=i=>C.Buffer.isBuffer(i)?i:i instanceof Uint8Array?C.Buffer.from(i.buffer,i.byteOffset,i.byteLength):C.Buffer.from(i);var Zn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof z.g<"u"?z.g:typeof self<"u"?self:{};function Xn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Vr={},ke={},Mt=Gr;function Gr(i,e){if(!i)throw new Error(e||"Assertion failed")}Gr.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var wr={exports:{}};typeof Object.create=="function"?wr.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:wr.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var Jn=Mt,Qn=wr.exports;ke.inherits=Qn;function ei(i,e){return(i.charCodeAt(e)&64512)!==55296||e<0||e+1>=i.length?!1:(i.charCodeAt(e+1)&64512)===56320}function ti(i,e){if(Array.isArray(i))return i.slice();if(!i)return[];var t=[];if(typeof i=="string")if(e){if(e==="hex")for(i=i.replace(/[^a-z0-9]+/ig,""),i.length%2!==0&&(i="0"+i),n=0;n<i.length;n+=2)t.push(parseInt(i[n]+i[n+1],16))}else for(var r=0,n=0;n<i.length;n++){var a=i.charCodeAt(n);a<128?t[r++]=a:a<2048?(t[r++]=a>>6|192,t[r++]=a&63|128):ei(i,n)?(a=65536+((a&1023)<<10)+(i.charCodeAt(++n)&1023),t[r++]=a>>18|240,t[r++]=a>>12&63|128,t[r++]=a>>6&63|128,t[r++]=a&63|128):(t[r++]=a>>12|224,t[r++]=a>>6&63|128,t[r++]=a&63|128)}else for(n=0;n<i.length;n++)t[n]=i[n]|0;return t}ke.toArray=ti;function ri(i){for(var e="",t=0;t<i.length;t++)e+=qr(i[t].toString(16));return e}ke.toHex=ri;function Hr(i){var e=i>>>24|i>>>8&65280|i<<8&16711680|(i&255)<<24;return e>>>0}ke.htonl=Hr;function ni(i,e){for(var t="",r=0;r<i.length;r++){var n=i[r];e==="little"&&(n=Hr(n)),t+=Yr(n.toString(16))}return t}ke.toHex32=ni;function qr(i){return i.length===1?"0"+i:i}ke.zero2=qr;function Yr(i){return i.length===7?"0"+i:i.length===6?"00"+i:i.length===5?"000"+i:i.length===4?"0000"+i:i.length===3?"00000"+i:i.length===2?"000000"+i:i.length===1?"0000000"+i:i}ke.zero8=Yr;function ii(i,e,t,r){var n=t-e;Jn(n%4===0);for(var a=new Array(n/4),d=0,E=e;d<a.length;d++,E+=4){var A;r==="big"?A=i[E]<<24|i[E+1]<<16|i[E+2]<<8|i[E+3]:A=i[E+3]<<24|i[E+2]<<16|i[E+1]<<8|i[E],a[d]=A>>>0}return a}ke.join32=ii;function si(i,e){for(var t=new Array(i.length*4),r=0,n=0;r<i.length;r++,n+=4){var a=i[r];e==="big"?(t[n]=a>>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}ke.split32=si;function oi(i,e){return i>>>e|i<<32-e}ke.rotr32=oi;function ai(i,e){return i<<e|i>>>32-e}ke.rotl32=ai;function ci(i,e){return i+e>>>0}ke.sum32=ci;function ui(i,e,t){return i+e+t>>>0}ke.sum32_3=ui;function fi(i,e,t,r){return i+e+t+r>>>0}ke.sum32_4=fi;function li(i,e,t,r,n){return i+e+t+r+n>>>0}ke.sum32_5=li;function hi(i,e,t,r){var n=i[e],a=i[e+1],d=r+a>>>0,E=(d<r?1:0)+t+n;i[e]=E>>>0,i[e+1]=d}ke.sum64=hi;function di(i,e,t,r){var n=e+r>>>0,a=(n<e?1:0)+i+t;return a>>>0}ke.sum64_hi=di;function pi(i,e,t,r){var n=e+r;return n>>>0}ke.sum64_lo=pi;function yi(i,e,t,r,n,a,d,E){var A=0,K=e;K=K+r>>>0,A+=K<e?1:0,K=K+a>>>0,A+=K<a?1:0,K=K+E>>>0,A+=K<E?1:0;var q=i+t+n+d+A;return q>>>0}ke.sum64_4_hi=yi;function gi(i,e,t,r,n,a,d,E){var A=e+r+a+E;return A>>>0}ke.sum64_4_lo=gi;function bi(i,e,t,r,n,a,d,E,A,K){var q=0,J=e;J=J+r>>>0,q+=J<e?1:0,J=J+a>>>0,q+=J<a?1:0,J=J+E>>>0,q+=J<E?1:0,J=J+K>>>0,q+=J<K?1:0;var ne=i+t+n+d+A+q;return ne>>>0}ke.sum64_5_hi=bi;function mi(i,e,t,r,n,a,d,E,A,K){var q=e+r+a+E+K;return q>>>0}ke.sum64_5_lo=mi;function wi(i,e,t){var r=e<<32-t|i>>>t;return r>>>0}ke.rotr64_hi=wi;function Ei(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.rotr64_lo=Ei;function Si(i,e,t){return i>>>t}ke.shr64_hi=Si;function vi(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.shr64_lo=vi;var Pt={},Zr=ke,ki=Mt;function er(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Pt.BlockHash=er,er.prototype.update=function(e,t){if(e=Zr.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Zr.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},er.prototype.digest=function(e){return this.update(this._pad()),ki(this.pending===null),this._digest(e)},er.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var a=1;a<r;a++)n[a]=0;if(e<<=3,this.endian==="big"){for(var d=8;d<this.padLength;d++)n[a++]=0;n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=e>>>24&255,n[a++]=e>>>16&255,n[a++]=e>>>8&255,n[a++]=e&255}else for(n[a++]=e&255,n[a++]=e>>>8&255,n[a++]=e>>>16&255,n[a++]=e>>>24&255,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,d=8;d<this.padLength;d++)n[a++]=0;return n};var Tt={},ct={},Ii=ke,ut=Ii.rotr32;function _i(i,e,t,r){if(i===0)return Xr(e,t,r);if(i===1||i===3)return Qr(e,t,r);if(i===2)return Jr(e,t,r)}ct.ft_1=_i;function Xr(i,e,t){return i&e^~i&t}ct.ch32=Xr;function Jr(i,e,t){return i&e^i&t^e&t}ct.maj32=Jr;function Qr(i,e,t){return i^e^t}ct.p32=Qr;function Ai(i){return ut(i,2)^ut(i,13)^ut(i,22)}ct.s0_256=Ai;function xi(i){return ut(i,6)^ut(i,11)^ut(i,25)}ct.s1_256=xi;function Bi(i){return ut(i,7)^ut(i,18)^i>>>3}ct.g0_256=Bi;function Ri(i){return ut(i,17)^ut(i,19)^i>>>10}ct.g1_256=Ri;var Ut=ke,Pi=Pt,Ti=ct,Er=Ut.rotl32,$t=Ut.sum32,Ui=Ut.sum32_5,Ci=Ti.ft_1,en=Pi.BlockHash,Oi=[1518500249,1859775393,2400959708,3395469782];function ft(){if(!(this instanceof ft))return new ft;en.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ut.inherits(ft,en);var Ni=ft;ft.blockSize=512,ft.outSize=160,ft.hmacStrength=80,ft.padLength=64,ft.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Er(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var a=this.h[0],d=this.h[1],E=this.h[2],A=this.h[3],K=this.h[4];for(n=0;n<r.length;n++){var q=~~(n/20),J=Ui(Er(a,5),Ci(q,d,E,A),K,r[n],Oi[q]);K=A,A=E,E=Er(d,30),d=a,a=J}this.h[0]=$t(this.h[0],a),this.h[1]=$t(this.h[1],d),this.h[2]=$t(this.h[2],E),this.h[3]=$t(this.h[3],A),this.h[4]=$t(this.h[4],K)},ft.prototype._digest=function(e){return e==="hex"?Ut.toHex32(this.h,"big"):Ut.split32(this.h,"big")};var Ct=ke,Li=Pt,Ot=ct,Fi=Mt,ot=Ct.sum32,Di=Ct.sum32_4,Ki=Ct.sum32_5,zi=Ot.ch32,Wi=Ot.maj32,Mi=Ot.s0_256,$i=Ot.s1_256,ji=Ot.g0_256,Vi=Ot.g1_256,tn=Li.BlockHash,Gi=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function lt(){if(!(this instanceof lt))return new lt;tn.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Gi,this.W=new Array(64)}Ct.inherits(lt,tn);var rn=lt;lt.blockSize=512,lt.outSize=256,lt.hmacStrength=192,lt.padLength=64,lt.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Di(Vi(r[n-2]),r[n-7],ji(r[n-15]),r[n-16]);var a=this.h[0],d=this.h[1],E=this.h[2],A=this.h[3],K=this.h[4],q=this.h[5],J=this.h[6],ne=this.h[7];for(Fi(this.k.length===r.length),n=0;n<r.length;n++){var te=Ki(ne,$i(K),zi(K,q,J),this.k[n],r[n]),de=ot(Mi(a),Wi(a,d,E));ne=J,J=q,q=K,K=ot(A,te),A=E,E=d,d=a,a=ot(te,de)}this.h[0]=ot(this.h[0],a),this.h[1]=ot(this.h[1],d),this.h[2]=ot(this.h[2],E),this.h[3]=ot(this.h[3],A),this.h[4]=ot(this.h[4],K),this.h[5]=ot(this.h[5],q),this.h[6]=ot(this.h[6],J),this.h[7]=ot(this.h[7],ne)},lt.prototype._digest=function(e){return e==="hex"?Ct.toHex32(this.h,"big"):Ct.split32(this.h,"big")};var Sr=ke,nn=rn;function gt(){if(!(this instanceof gt))return new gt;nn.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Sr.inherits(gt,nn);var Hi=gt;gt.blockSize=512,gt.outSize=224,gt.hmacStrength=192,gt.padLength=64,gt.prototype._digest=function(e){return e==="hex"?Sr.toHex32(this.h.slice(0,7),"big"):Sr.split32(this.h.slice(0,7),"big")};var Qe=ke,qi=Pt,Yi=Mt,ht=Qe.rotr64_hi,dt=Qe.rotr64_lo,sn=Qe.shr64_hi,on=Qe.shr64_lo,wt=Qe.sum64,vr=Qe.sum64_hi,kr=Qe.sum64_lo,Zi=Qe.sum64_4_hi,Xi=Qe.sum64_4_lo,Ji=Qe.sum64_5_hi,Qi=Qe.sum64_5_lo,an=qi.BlockHash,es=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function at(){if(!(this instanceof at))return new at;an.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=es,this.W=new Array(160)}Qe.inherits(at,an);var cn=at;at.blockSize=1024,at.outSize=512,at.hmacStrength=192,at.padLength=128,at.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var a=ls(r[n-4],r[n-3]),d=hs(r[n-4],r[n-3]),E=r[n-14],A=r[n-13],K=us(r[n-30],r[n-29]),q=fs(r[n-30],r[n-29]),J=r[n-32],ne=r[n-31];r[n]=Zi(a,d,E,A,K,q,J,ne),r[n+1]=Xi(a,d,E,A,K,q,J,ne)}},at.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],a=this.h[1],d=this.h[2],E=this.h[3],A=this.h[4],K=this.h[5],q=this.h[6],J=this.h[7],ne=this.h[8],te=this.h[9],de=this.h[10],pe=this.h[11],Ie=this.h[12],Le=this.h[13],tt=this.h[14],At=this.h[15];Yi(this.k.length===r.length);for(var mt=0;mt<r.length;mt+=2){var Et=tt,xt=At,Bt=as(ne,te),rt=cs(ne,te),yr=ts(ne,te,de,pe,Ie),gr=rs(ne,te,de,pe,Ie,Le),nt=this.k[mt],br=this.k[mt+1],zt=r[mt],$=r[mt+1],ee=Ji(Et,xt,Bt,rt,yr,gr,nt,br,zt,$),we=Qi(Et,xt,Bt,rt,yr,gr,nt,br,zt,$);Et=ss(n,a),xt=os(n,a),Bt=ns(n,a,d,E,A),rt=is(n,a,d,E,A,K);var Me=vr(Et,xt,Bt,rt),We=kr(Et,xt,Bt,rt);tt=Ie,At=Le,Ie=de,Le=pe,de=ne,pe=te,ne=vr(q,J,ee,we),te=kr(J,J,ee,we),q=A,J=K,A=d,K=E,d=n,E=a,n=vr(ee,we,Me,We),a=kr(ee,we,Me,We)}wt(this.h,0,n,a),wt(this.h,2,d,E),wt(this.h,4,A,K),wt(this.h,6,q,J),wt(this.h,8,ne,te),wt(this.h,10,de,pe),wt(this.h,12,Ie,Le),wt(this.h,14,tt,At)},at.prototype._digest=function(e){return e==="hex"?Qe.toHex32(this.h,"big"):Qe.split32(this.h,"big")};function ts(i,e,t,r,n){var a=i&t^~i&n;return a<0&&(a+=4294967296),a}function rs(i,e,t,r,n,a){var d=e&r^~e&a;return d<0&&(d+=4294967296),d}function ns(i,e,t,r,n){var a=i&t^i&n^t&n;return a<0&&(a+=4294967296),a}function is(i,e,t,r,n,a){var d=e&r^e&a^r&a;return d<0&&(d+=4294967296),d}function ss(i,e){var t=ht(i,e,28),r=ht(e,i,2),n=ht(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function os(i,e){var t=dt(i,e,28),r=dt(e,i,2),n=dt(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function as(i,e){var t=ht(i,e,14),r=ht(i,e,18),n=ht(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function cs(i,e){var t=dt(i,e,14),r=dt(i,e,18),n=dt(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function us(i,e){var t=ht(i,e,1),r=ht(i,e,8),n=sn(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function fs(i,e){var t=dt(i,e,1),r=dt(i,e,8),n=on(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function ls(i,e){var t=ht(i,e,19),r=ht(e,i,29),n=sn(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}function hs(i,e){var t=dt(i,e,19),r=dt(e,i,29),n=on(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}var Ir=ke,un=cn;function bt(){if(!(this instanceof bt))return new bt;un.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ir.inherits(bt,un);var ds=bt;bt.blockSize=1024,bt.outSize=384,bt.hmacStrength=192,bt.padLength=128,bt.prototype._digest=function(e){return e==="hex"?Ir.toHex32(this.h.slice(0,12),"big"):Ir.split32(this.h.slice(0,12),"big")},Tt.sha1=Ni,Tt.sha224=Hi,Tt.sha256=rn,Tt.sha384=ds,Tt.sha512=cn;var fn={},St=ke,ps=Pt,tr=St.rotl32,ln=St.sum32,jt=St.sum32_3,hn=St.sum32_4,dn=ps.BlockHash;function pt(){if(!(this instanceof pt))return new pt;dn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}St.inherits(pt,dn),fn.ripemd160=pt,pt.blockSize=512,pt.outSize=160,pt.hmacStrength=192,pt.padLength=64,pt.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],a=this.h[2],d=this.h[3],E=this.h[4],A=r,K=n,q=a,J=d,ne=E,te=0;te<80;te++){var de=ln(tr(hn(r,pn(te,n,a,d),e[bs[te]+t],ys(te)),ws[te]),E);r=E,E=d,d=tr(a,10),a=n,n=de,de=ln(tr(hn(A,pn(79-te,K,q,J),e[ms[te]+t],gs(te)),Es[te]),ne),A=ne,ne=J,J=tr(q,10),q=K,K=de}de=jt(this.h[1],a,J),this.h[1]=jt(this.h[2],d,ne),this.h[2]=jt(this.h[3],E,A),this.h[3]=jt(this.h[4],r,K),this.h[4]=jt(this.h[0],n,q),this.h[0]=de},pt.prototype._digest=function(e){return e==="hex"?St.toHex32(this.h,"little"):St.split32(this.h,"little")};function pn(i,e,t,r){return i<=15?e^t^r:i<=31?e&t|~e&r:i<=47?(e|~t)^r:i<=63?e&r|t&~r:e^(t|~r)}function ys(i){return i<=15?0:i<=31?1518500249:i<=47?1859775393:i<=63?2400959708:2840853838}function gs(i){return i<=15?1352829926:i<=31?1548603684:i<=47?1836072691:i<=63?2053994217:0}var bs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ms=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ws=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Es=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Ss=ke,vs=Mt;function Nt(i,e,t){if(!(this instanceof Nt))return new Nt(i,e,t);this.Hash=i,this.blockSize=i.blockSize/8,this.outSize=i.outSize/8,this.inner=null,this.outer=null,this._init(Ss.toArray(e,t))}var ks=Nt;Nt.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),vs(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Nt.prototype.update=function(e,t){return this.inner.update(e,t),this},Nt.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(i){var e=i;e.utils=ke,e.common=Pt,e.sha=Tt,e.ripemd=fn,e.hmac=ks,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Vr);var Is=Vr;const _s="logger/5.5.0";let yn=!1,gn=!1;const rr={debug:1,default:2,info:2,warning:3,error:4,off:5};let bn=rr.default,_r=null;function As(){try{const i=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{i.push(e)}}),i.length)throw new Error("missing "+i.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(i){return i.message}return null}const mn=As();var Ar;(function(i){i.DEBUG="DEBUG",i.INFO="INFO",i.WARNING="WARNING",i.ERROR="ERROR",i.OFF="OFF"})(Ar||(Ar={}));var xr;(function(i){i.UNKNOWN_ERROR="UNKNOWN_ERROR",i.NOT_IMPLEMENTED="NOT_IMPLEMENTED",i.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",i.NETWORK_ERROR="NETWORK_ERROR",i.SERVER_ERROR="SERVER_ERROR",i.TIMEOUT="TIMEOUT",i.BUFFER_OVERRUN="BUFFER_OVERRUN",i.NUMERIC_FAULT="NUMERIC_FAULT",i.MISSING_NEW="MISSING_NEW",i.INVALID_ARGUMENT="INVALID_ARGUMENT",i.MISSING_ARGUMENT="MISSING_ARGUMENT",i.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",i.CALL_EXCEPTION="CALL_EXCEPTION",i.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",i.NONCE_EXPIRED="NONCE_EXPIRED",i.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",i.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",i.TRANSACTION_REPLACED="TRANSACTION_REPLACED"})(xr||(xr={}));const wn="0123456789abcdef";class Ne{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();rr[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(bn>rr[r])&&console.log.apply(console,t)}debug(...e){this._log(Ne.levels.DEBUG,e)}info(...e){this._log(Ne.levels.INFO,e)}warn(...e){this._log(Ne.levels.WARNING,e)}makeError(e,t,r){if(gn)return this.makeError("censored error",t,{});t||(t=Ne.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(E=>{const A=r[E];try{if(A instanceof Uint8Array){let K="";for(let q=0;q<A.length;q++)K+=wn[A[q]>>4],K+=wn[A[q]&15];n.push(E+"=Uint8Array(0x"+K+")")}else n.push(E+"="+JSON.stringify(A))}catch{n.push(E+"="+JSON.stringify(r[E].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const a=e;n.length&&(e+=" ("+n.join(", ")+")");const d=new Error(e);return d.reason=a,d.code=t,Object.keys(r).forEach(function(E){d[E]=r[E]}),d}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Ne.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){mn&&this.throwError("platform missing String.prototype.normalize",Ne.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:mn})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Ne.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Ne.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",e<t&&this.throwError("missing argument"+r,Ne.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,Ne.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Ne.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Ne.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Ne.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return _r||(_r=new Ne(_s)),_r}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Ne.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),yn){if(!e)return;this.globalLogger().throwError("error censorship permanent",Ne.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gn=!!e,yn=!!t}static setLogLevel(e){const t=rr[e.toLowerCase()];if(t==null){Ne.globalLogger().warn("invalid log level - "+e);return}bn=t}static from(e){return new Ne(e)}}Ne.errors=xr,Ne.levels=Ar;const xs="bytes/5.5.0",Br=new Ne(xs);function Bs(i){return!!i.toHexString}function nr(i){return i.slice||(i.slice=function(){const e=Array.prototype.slice.call(arguments);return nr(new Uint8Array(Array.prototype.slice.apply(i,e)))}),i}function En(i){return typeof i=="number"&&i==i&&i%1===0}function Rs(i){if(i==null)return!1;if(i.constructor===Uint8Array)return!0;if(typeof i=="string"||!En(i.length)||i.length<0)return!1;for(let e=0;e<i.length;e++){const t=i[e];if(!En(t)||t<0||t>=256)return!1}return!0}function Ps(i,e){if(e||(e={}),typeof i=="number"){Br.checkSafeUint53(i,"invalid arrayify value");const t=[];for(;i;)t.unshift(i&255),i=parseInt(String(i/256));return t.length===0&&t.push(0),nr(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof i=="string"&&i.substring(0,2)!=="0x"&&(i="0x"+i),Bs(i)&&(i=i.toHexString()),Ts(i)){let t=i.substring(2);t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Br.throwArgumentError("hex data is odd-length","value",i));const r=[];for(let n=0;n<t.length;n+=2)r.push(parseInt(t.substring(n,n+2),16));return nr(new Uint8Array(r))}return Rs(i)?nr(new Uint8Array(i)):Br.throwArgumentError("invalid arrayify value","value",i)}function Ts(i,e){return!(typeof i!="string"||!i.match(/^0x[0-9A-Fa-f]*$/)||e&&i.length!==2+2*e)}const Us="sha2/5.5.0";new Ne(Us);function Sn(i){return"0x"+Is.sha256().update(Ps(i)).digest("hex")}class Rr{constructor(e){Object.assign(this,e)}encode(){return C.Buffer.from((0,v.serialize)(Vt,this))}static decode(e){return(0,v.deserialize)(Vt,this,e)}static decodeUnchecked(e){return(0,v.deserializeUnchecked)(Vt,this,e)}}class Cs extends Rr{constructor(e){if(super(e),this.enum="",Object.keys(e).length!==1)throw new Error("Enum can only take single value");Object.keys(e).map(t=>{this.enum=t})}}const Vt=new Map,vn=32;function Os(i){return i._bn!==void 0}class he extends Rr{constructor(e){if(super({}),this._bn=void 0,Os(e))this._bn=e._bn;else{if(typeof e=="string"){const t=h().decode(e);if(t.length!=32)throw new Error("Invalid public key input");this._bn=new(L())(t)}else this._bn=new(L())(e);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(e){return this._bn.eq(e._bn)}toBase58(){return h().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const e=this._bn.toArrayLike(C.Buffer);if(e.length===32)return e;const t=C.Buffer.alloc(32);return e.copy(t,32-e.length),t}toString(){return this.toBase58()}static async createWithSeed(e,t,r){const n=C.Buffer.concat([e.toBuffer(),C.Buffer.from(t),r.toBuffer()]),a=Sn(new Uint8Array(n)).slice(2);return new he(C.Buffer.from(a,"hex"))}static async createProgramAddress(e,t){let r=C.Buffer.alloc(0);e.forEach(function(d){if(d.length>vn)throw new TypeError("Max seed length exceeded");r=C.Buffer.concat([r,ce(d)])}),r=C.Buffer.concat([r,t.toBuffer(),C.Buffer.from("ProgramDerivedAddress")]);let n=Sn(new Uint8Array(r)).slice(2),a=new(L())(n,16).toArray(void 0,32);if(kn(a))throw new Error("Invalid seeds, address must fall off the curve");return new he(a)}static async findProgramAddress(e,t){let r=255,n;for(;r!=0;){try{const a=e.concat(C.Buffer.from([r]));n=await this.createProgramAddress(a,t)}catch(a){if(a instanceof TypeError)throw a;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static isOnCurve(e){return kn(e)==1}}he.default=new he("11111111111111111111111111111111"),Vt.set(he,{kind:"struct",fields:[["_bn","u256"]]});let Se=X().lowlevel;function kn(i){var e=[Se.gf(),Se.gf(),Se.gf(),Se.gf()],t=Se.gf(),r=Se.gf(),n=Se.gf(),a=Se.gf(),d=Se.gf(),E=Se.gf(),A=Se.gf();return Se.set25519(e[2],Ns),Se.unpack25519(e[1],i),Se.S(n,e[1]),Se.M(a,n,Se.D),Se.Z(n,n,e[2]),Se.A(a,e[2],a),Se.S(d,a),Se.S(E,d),Se.M(A,E,d),Se.M(t,A,n),Se.M(t,t,a),Se.pow2523(t,t),Se.M(t,t,n),Se.M(t,t,a),Se.M(t,t,a),Se.M(e[0],t,a),Se.S(r,e[0]),Se.M(r,r,a),In(r,n)&&Se.M(e[0],e[0],Ls),Se.S(r,e[0]),Se.M(r,r,a),In(r,n)?0:1}let Ns=Se.gf([1]),Ls=Se.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function In(i,e){var t=new Uint8Array(32),r=new Uint8Array(32);return Se.pack25519(t,i),Se.pack25519(r,e),Se.crypto_verify_32(t,0,r,0)}class Fs{constructor(e){this._keypair=void 0,e?this._keypair=X().sign.keyPair.fromSecretKey(ce(e)):this._keypair=X().sign.keyPair()}get publicKey(){return new he(this._keypair.publicKey)}get secretKey(){return ce(this._keypair.secretKey)}}const Ds=new he("BPFLoader1111111111111111111111111111111111"),Te=(i="publicKey")=>f.blob(32,i),Lt=(i="string")=>{const e=f.struct([f.u32("length"),f.u32("lengthPadding"),f.blob(f.offset(f.u32(),-8),"chars")],i),t=e.decode.bind(e),r=e.encode.bind(e);return e.decode=(n,a)=>t(n,a).chars.toString("utf8"),e.encode=(n,a,d)=>{const E={chars:C.Buffer.from(n,"utf8")};return r(E,a,d)},e.alloc=n=>f.u32().span+f.u32().span+C.Buffer.from(n,"utf8").length,e},Ks=(i="authorized")=>f.struct([Te("staker"),Te("withdrawer")],i),zs=(i="lockup")=>f.struct([f.ns64("unixTimestamp"),f.ns64("epoch"),Te("custodian")],i);function Ws(i,e){let t=0;return i.layout.fields.forEach(r=>{r.span>=0?t+=r.span:typeof r.alloc=="function"&&(t+=r.alloc(e[r.property]))}),t}function Ft(i){let e=0,t=0;for(;;){let r=i.shift();if(e|=(r&127)<<t*7,t+=1,(r&128)===0)break}return e}function Gt(i,e){let t=e;for(;;){let r=t&127;if(t>>=7,t==0){i.push(r);break}else r|=128,i.push(r)}}const ir=32;class vt{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(t=>new he(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){return e<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||e>=this.header.numRequiredSignatures&&e<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];Gt(t,e);const r=this.instructions.map(J=>{const{accounts:ne,programIdIndex:te}=J,de=h().decode(J.data);let pe=[];Gt(pe,ne.length);let Ie=[];return Gt(Ie,de.length),{programIdIndex:te,keyIndicesCount:C.Buffer.from(pe),keyIndices:C.Buffer.from(ne),dataLength:C.Buffer.from(Ie),data:de}});let n=[];Gt(n,r.length);let a=C.Buffer.alloc(Ht);C.Buffer.from(n).copy(a);let d=n.length;r.forEach(J=>{const te=f.struct([f.u8("programIdIndex"),f.blob(J.keyIndicesCount.length,"keyIndicesCount"),f.seq(f.u8("keyIndex"),J.keyIndices.length,"keyIndices"),f.blob(J.dataLength.length,"dataLength"),f.seq(f.u8("userdatum"),J.data.length,"data")]).encode(J,a,d);d+=te}),a=a.slice(0,d);const E=f.struct([f.blob(1,"numRequiredSignatures"),f.blob(1,"numReadonlySignedAccounts"),f.blob(1,"numReadonlyUnsignedAccounts"),f.blob(t.length,"keyCount"),f.seq(Te("key"),e,"keys"),Te("recentBlockhash")]),A={numRequiredSignatures:C.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:C.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:C.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:C.Buffer.from(t),keys:this.accountKeys.map(J=>ce(J.toBytes())),recentBlockhash:h().decode(this.recentBlockhash)};let K=C.Buffer.alloc(2048);const q=E.encode(A,K);return a.copy(K,q),K.slice(0,q+a.length)}static from(e){let t=[...e];const r=t.shift(),n=t.shift(),a=t.shift(),d=Ft(t);let E=[];for(let ne=0;ne<d;ne++){const te=t.slice(0,ir);t=t.slice(ir),E.push(h().encode(C.Buffer.from(te)))}const A=t.slice(0,ir);t=t.slice(ir);const K=Ft(t);let q=[];for(let ne=0;ne<K;ne++){const te=t.shift(),de=Ft(t),pe=t.slice(0,de);t=t.slice(de);const Ie=Ft(t),Le=t.slice(0,Ie),tt=h().encode(C.Buffer.from(Le));t=t.slice(Ie),q.push({programIdIndex:te,accounts:pe,data:tt})}const J={header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:a},recentBlockhash:h().encode(C.Buffer.from(A)),accountKeys:E,instructions:q};return new vt(J)}}function He(i,e){if(!i)throw new Error(e||"Assertion failed")}const Ms=C.Buffer.alloc(64).fill(0),Ht=1280-40-8,_n=64;class Xe{constructor(e){this.keys=void 0,this.programId=void 0,this.data=C.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}}class Ce{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.nonceInfo=void 0,e&&Object.assign(this,e)}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new Xe(t))}),this}compileMessage(){const{nonceInfo:e}=this;e&&this.instructions[0]!=e.nonceInstruction&&(this.recentBlockhash=e.nonce,this.instructions.unshift(e.nonceInstruction));const{recentBlockhash:t}=this;if(!t)throw new Error("Transaction recentBlockhash required");this.instructions.length<1&&console.warn("No instructions provided");let r;if(this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let pe=0;pe<this.instructions.length;pe++)if(this.instructions[pe].programId===void 0)throw new Error(`Transaction instruction index ${pe} has undefined program id`);const n=[],a=[];this.instructions.forEach(pe=>{pe.keys.forEach(Le=>{a.push({...Le})});const Ie=pe.programId.toString();n.includes(Ie)||n.push(Ie)}),n.forEach(pe=>{a.push({pubkey:new he(pe),isSigner:!1,isWritable:!1})}),a.sort(function(pe,Ie){const Le=pe.pubkey.toBase58().localeCompare(Ie.pubkey.toBase58()),tt=pe.isSigner===Ie.isSigner?0:pe.isSigner?-1:1,At=pe.isWritable===Ie.isWritable?Le:pe.isWritable?-1:1;return tt||At});const d=[];a.forEach(pe=>{const Ie=pe.pubkey.toString(),Le=d.findIndex(tt=>tt.pubkey.toString()===Ie);Le>-1?d[Le].isWritable=d[Le].isWritable||pe.isWritable:d.push(pe)});const E=d.findIndex(pe=>pe.pubkey.equals(r));if(E>-1){const[pe]=d.splice(E,1);pe.isSigner=!0,pe.isWritable=!0,d.unshift(pe)}else d.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const pe of this.signatures){const Ie=d.findIndex(Le=>Le.pubkey.equals(pe.publicKey));if(Ie>-1)d[Ie].isSigner||(d[Ie].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 new Error(`unknown signer: ${pe.publicKey.toString()}`)}let A=0,K=0,q=0;const J=[],ne=[];d.forEach(({pubkey:pe,isSigner:Ie,isWritable:Le})=>{Ie?(J.push(pe.toString()),A+=1,Le||(K+=1)):(ne.push(pe.toString()),Le||(q+=1))});const te=J.concat(ne),de=this.instructions.map(pe=>{const{data:Ie,programId:Le}=pe;return{programIdIndex:te.indexOf(Le.toString()),accounts:pe.keys.map(tt=>te.indexOf(tt.pubkey.toString())),data:h().encode(Ie)}});return de.forEach(pe=>{He(pe.programIdIndex>=0),pe.accounts.forEach(Ie=>He(Ie>=0))}),new vt({header:{numRequiredSignatures:A,numReadonlySignedAccounts:K,numReadonlyUnsignedAccounts:q},accountKeys:te,recentBlockhash:t,instructions:de})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((n,a)=>t[a].equals(n.publicKey))||(this.signatures=t.map(r=>({signature:null,publicKey:r}))),e}serializeMessage(){return this._compile().serialize()}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(r=>{const n=r.toString();return t.has(n)?!1:(t.add(n),!0)}).map(r=>({signature:null,publicKey:r}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}this.signatures=r.map(a=>({signature:null,publicKey:a.publicKey}));const n=this._compile();this._partialSign(n,...r),this._verifySignatures(n.serialize(),!0)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}const n=this._compile();this._partialSign(n,...r)}_partialSign(e,...t){const r=e.serialize();t.forEach(n=>{const a=X().sign.detached(r,n.secretKey);this._addSignature(n.publicKey,ce(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){He(t.length===64);const r=this.signatures.findIndex(n=>e.equals(n.publicKey));if(r<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=C.Buffer.from(t)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(e,t){for(const{signature:r,publicKey:n}of this.signatures)if(r===null){if(t)return!1}else if(!X().sign.detached.verify(e,r,n.toBuffer()))return!1;return!0}serialize(e){const{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r&&!this._verifySignatures(n,t))throw new Error("Signature verification failed");return this._serialize(n)}_serialize(e){const{signatures:t}=this,r=[];Gt(r,t.length);const n=r.length+t.length*64+e.length,a=C.Buffer.alloc(n);return He(t.length<256),C.Buffer.from(r).copy(a,0),t.forEach(({signature:d},E)=>{d!==null&&(He(d.length===64,"signature has invalid length"),C.Buffer.from(d).copy(a,r.length+E*64))}),e.copy(a,r.length+t.length*64),He(a.length<=Ht,`Transaction too large: ${a.length} > ${Ht}`),a}get keys(){return He(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return He(this.instructions.length===1),this.instructions[0].programId}get data(){return He(this.instructions.length===1),this.instructions[0].data}static from(e){let t=[...e];const r=Ft(t);let n=[];for(let a=0;a<r;a++){const d=t.slice(0,_n);t=t.slice(_n),n.push(h().encode(C.Buffer.from(d)))}return Ce.populate(vt.from(t),n)}static populate(e,t=[]){const r=new Ce;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((n,a)=>{const d={signature:n==h().encode(Ms)?null:h().decode(n),publicKey:e.accountKeys[a]};r.signatures.push(d)}),e.instructions.forEach(n=>{const a=n.accounts.map(d=>{const E=e.accountKeys[d];return{pubkey:E,isSigner:r.signatures.some(A=>A.publicKey.toString()===E.toString())||e.isAccountSigner(d),isWritable:e.isAccountWritable(d)}});r.instructions.push(new Xe({keys:a,programId:e.accountKeys[n.programIdIndex],data:h().decode(n.data)}))}),r}}const kt=new he("SysvarC1ock11111111111111111111111111111111"),$s=new he("SysvarEpochSchedu1e111111111111111111111111"),js=new he("Sysvar1nstructions1111111111111111111111111"),sr=new he("SysvarRecentB1ockHashes11111111111111111111"),qt=new he("SysvarRent111111111111111111111111111111111"),Vs=new he("SysvarRewards111111111111111111111111111111"),Gs=new he("SysvarS1otHashes111111111111111111111111111"),Hs=new he("SysvarS1otHistory11111111111111111111111111"),or=new he("SysvarStakeHistory1111111111111111111111111");async function ar(i,e,t,r){const n=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment},a=await i.sendTransaction(e,t,n),d=(await i.confirmTransaction(a,r&&r.commitment)).value;if(d.err)throw new Error(`Transaction ${a} failed (${JSON.stringify(d)})`);return a}function cr(i){return new Promise(e=>setTimeout(e,i))}function Ke(i,e){const t=i.layout.span>=0?i.layout.span:Ws(i,e),r=C.Buffer.alloc(t),n=Object.assign({instruction:i.index},e);return i.layout.encode(n,r),r}function ze(i,e){let t;try{t=i.layout.decode(e)}catch(r){throw new Error("invalid instruction; "+r)}if(t.instruction!==i.index)throw new Error(`invalid instruction; instruction index mismatch ${t.instruction} != ${i.index}`);return t}const An=f.nu64("lamportsPerSignature"),xn=f.struct([f.u32("version"),f.u32("state"),Te("authorizedPubkey"),Te("nonce"),f.struct([An],"feeCalculator")]),Pr=xn.span;class ur{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){const t=xn.decode(ce(e),0);return new ur({authorizedPubkey:new he(t.authorizedPubkey),nonce:new he(t.nonce).toString(),feeCalculator:t.feeCalculator})}}class qs{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=f.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(Re))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t,space:r,programId:n}=ze(Re.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:r,programId:new he(n)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t}=ze(Re.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);const{lamports:t,seed:r,programId:n}=ze(Re.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 he(n)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:t}=ze(Re.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,space:n,programId:a}=ze(Re.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new he(t),seed:r,space:n,programId:new he(a)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:t}=ze(Re.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new he(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,programId:n}=ze(Re.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new he(t),seed:r,programId:new he(n)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:t,seed:r,lamports:n,space:a,programId:d}=ze(Re.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new he(t),seed:r,lamports:n,space:a,programId:new he(d)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:t}=ze(Re.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new he(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ze(Re.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);const{lamports:t}=ze(Re.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);const{authorized:t}=ze(Re.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new he(t)}}static checkProgramId(e){if(!e.equals(et.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const Re=Object.freeze({Create:{index:0,layout:f.struct([f.u32("instruction"),f.ns64("lamports"),f.ns64("space"),Te("programId")])},Assign:{index:1,layout:f.struct([f.u32("instruction"),Te("programId")])},Transfer:{index:2,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},CreateWithSeed:{index:3,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),f.ns64("lamports"),f.ns64("space"),Te("programId")])},AdvanceNonceAccount:{index:4,layout:f.struct([f.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:f.struct([f.u32("instruction"),Te("authorized")])},AuthorizeNonceAccount:{index:7,layout:f.struct([f.u32("instruction"),Te("authorized")])},Allocate:{index:8,layout:f.struct([f.u32("instruction"),f.ns64("space")])},AllocateWithSeed:{index:9,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),f.ns64("space"),Te("programId")])},AssignWithSeed:{index:10,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),Te("programId")])},TransferWithSeed:{index:11,layout:f.struct([f.u32("instruction"),f.ns64("lamports"),Lt("seed"),Te("programId")])}});class et{constructor(){}static createAccount(e){const t=Re.Create,r=Ke(t,{lamports:e.lamports,space:e.space,programId:ce(e.programId.toBuffer())});return new Xe({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:r})}static transfer(e){let t,r;if("basePubkey"in e){const n=Re.TransferWithSeed;t=Ke(n,{lamports:e.lamports,seed:e.seed,programId:ce(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}]}else{const n=Re.Transfer;t=Ke(n,{lamports:e.lamports}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new Xe({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;if("basePubkey"in e){const n=Re.AssignWithSeed;t=Ke(n,{base:ce(e.basePubkey.toBuffer()),seed:e.seed,programId:ce(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Re.Assign;t=Ke(n,{programId:ce(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Xe({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=Re.CreateWithSeed,r=Ke(t,{base:ce(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:ce(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new Xe({keys:n,programId:this.programId,data:r})}static createNonceAccount(e){const t=new Ce;"basePubkey"in e&&"seed"in e?t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:Pr,programId:this.programId})):t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:Pr,programId:this.programId}));const r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){const t=Re.InitializeNonceAccount,r=Ke(t,{authorized:ce(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:sr,isSigner:!1,isWritable:!1},{pubkey:qt,isSigner:!1,isWritable:!1}],programId:this.programId,data:r};return new Xe(n)}static nonceAdvance(e){const t=Re.AdvanceNonceAccount,r=Ke(t),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:sr,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r};return new Xe(n)}static nonceWithdraw(e){const t=Re.WithdrawNonceAccount,r=Ke(t,{lamports:e.lamports});return new Xe({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:sr,isSigner:!1,isWritable:!1},{pubkey:qt,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static nonceAuthorize(e){const t=Re.AuthorizeNonceAccount,r=Ke(t,{authorized:ce(e.newAuthorizedPubkey.toBuffer())});return new Xe({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static allocate(e){let t,r;if("basePubkey"in e){const n=Re.AllocateWithSeed;t=Ke(n,{base:ce(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:ce(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Re.Allocate;t=Ke(n,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Xe({keys:r,programId:this.programId,data:t})}}et.programId=new he("11111111111111111111111111111111");const Ys=Ht-300;class It{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/It.chunkSize)+1+1)}static async load(e,t,r,n,a){{const J=await e.getMinimumBalanceForRentExemption(a.length),ne=await e.getAccountInfo(r.publicKey,"confirmed");let te=null;if(ne!==null){if(ne.executable)return console.error("Program load failed, account is already executable"),!1;ne.data.length!==a.length&&(te=te||new Ce,te.add(et.allocate({accountPubkey:r.publicKey,space:a.length}))),ne.owner.equals(n)||(te=te||new Ce,te.add(et.assign({accountPubkey:r.publicKey,programId:n}))),ne.lamports<J&&(te=te||new Ce,te.add(et.transfer({fromPubkey:t.publicKey,toPubkey:r.publicKey,lamports:J-ne.lamports})))}else te=new Ce().add(et.createAccount({fromPubkey:t.publicKey,newAccountPubkey:r.publicKey,lamports:J>0?J:1,space:a.length,programId:n}));te!==null&&await ar(e,te,[t,r],{commitment:"confirmed"})}const d=f.struct([f.u32("instruction"),f.u32("offset"),f.u32("bytesLength"),f.u32("bytesLengthPadding"),f.seq(f.u8("byte"),f.offset(f.u32(),-8),"bytes")]),E=It.chunkSize;let A=0,K=a,q=[];for(;K.length>0;){const J=K.slice(0,E),ne=C.Buffer.alloc(E+16);d.encode({instruction:0,offset:A,bytes:J},ne);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:n,data:ne});q.push(ar(e,te,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await cr(1e3/4),A+=E,K=K.slice(E)}await Promise.all(q);{const J=f.struct([f.u32("instruction")]),ne=C.Buffer.alloc(J.span);J.encode({instruction:1},ne);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:qt,isSigner:!1,isWritable:!1}],programId:n,data:ne});await ar(e,te,[t,r],{commitment:"confirmed"})}return!0}}It.chunkSize=Ys;const Zs=new he("BPFLoader2111111111111111111111111111111111");class Xs{static getMinNumSignatures(e){return It.getMinNumSignatures(e)}static load(e,t,r,n,a){return It.load(e,t,r,a,n)}}var Tr={exports:{}};(function(i,e){var t=typeof self<"u"?self:Zn,r=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(d){var E={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function A($){return $&&DataView.prototype.isPrototypeOf($)}if(E.arrayBuffer)var K=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],q=ArrayBuffer.isView||function($){return $&&K.indexOf(Object.prototype.toString.call($))>-1};function J($){if(typeof $!="string"&&($=String($)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test($))throw new TypeError("Invalid character in header field name");return $.toLowerCase()}function ne($){return typeof $!="string"&&($=String($)),$}function te($){var ee={next:function(){var we=$.shift();return{done:we===void 0,value:we}}};return E.iterable&&(ee[Symbol.iterator]=function(){return ee}),ee}function de($){this.map={},$ instanceof de?$.forEach(function(ee,we){this.append(we,ee)},this):Array.isArray($)?$.forEach(function(ee){this.append(ee[0],ee[1])},this):$&&Object.getOwnPropertyNames($).forEach(function(ee){this.append(ee,$[ee])},this)}de.prototype.append=function($,ee){$=J($),ee=ne(ee);var we=this.map[$];this.map[$]=we?we+", "+ee:ee},de.prototype.delete=function($){delete this.map[J($)]},de.prototype.get=function($){return $=J($),this.has($)?this.map[$]:null},de.prototype.has=function($){return this.map.hasOwnProperty(J($))},de.prototype.set=function($,ee){this.map[J($)]=ne(ee)},de.prototype.forEach=function($,ee){for(var we in this.map)this.map.hasOwnProperty(we)&&$.call(ee,this.map[we],we,this)},de.prototype.keys=function(){var $=[];return this.forEach(function(ee,we){$.push(we)}),te($)},de.prototype.values=function(){var $=[];return this.forEach(function(ee){$.push(ee)}),te($)},de.prototype.entries=function(){var $=[];return this.forEach(function(ee,we){$.push([we,ee])}),te($)},E.iterable&&(de.prototype[Symbol.iterator]=de.prototype.entries);function pe($){if($.bodyUsed)return Promise.reject(new TypeError("Already read"));$.bodyUsed=!0}function Ie($){return new Promise(function(ee,we){$.onload=function(){ee($.result)},$.onerror=function(){we($.error)}})}function Le($){var ee=new FileReader,we=Ie(ee);return ee.readAsArrayBuffer($),we}function tt($){var ee=new FileReader,we=Ie(ee);return ee.readAsText($),we}function At($){for(var ee=new Uint8Array($),we=new Array(ee.length),Me=0;Me<ee.length;Me++)we[Me]=String.fromCharCode(ee[Me]);return we.join("")}function mt($){if($.slice)return $.slice(0);var ee=new Uint8Array($.byteLength);return ee.set(new Uint8Array($)),ee.buffer}function Et(){return this.bodyUsed=!1,this._initBody=function($){this._bodyInit=$,$?typeof $=="string"?this._bodyText=$:E.blob&&Blob.prototype.isPrototypeOf($)?this._bodyBlob=$:E.formData&&FormData.prototype.isPrototypeOf($)?this._bodyFormData=$:E.searchParams&&URLSearchParams.prototype.isPrototypeOf($)?this._bodyText=$.toString():E.arrayBuffer&&E.blob&&A($)?(this._bodyArrayBuffer=mt($.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):E.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf($)||q($))?this._bodyArrayBuffer=mt($):this._bodyText=$=Object.prototype.toString.call($):this._bodyText="",this.headers.get("content-type")||(typeof $=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):E.searchParams&&URLSearchParams.prototype.isPrototypeOf($)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},E.blob&&(this.blob=function(){var $=pe(this);if($)return $;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?pe(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Le)}),this.text=function(){var $=pe(this);if($)return $;if(this._bodyBlob)return tt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(At(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},E.formData&&(this.formData=function(){return this.text().then(yr)}),this.json=function(){return this.text().then(JSON.parse)},this}var xt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Bt($){var ee=$.toUpperCase();return xt.indexOf(ee)>-1?ee:$}function rt($,ee){ee=ee||{};var we=ee.body;if($ instanceof rt){if($.bodyUsed)throw new TypeError("Already read");this.url=$.url,this.credentials=$.credentials,ee.headers||(this.headers=new de($.headers)),this.method=$.method,this.mode=$.mode,this.signal=$.signal,!we&&$._bodyInit!=null&&(we=$._bodyInit,$.bodyUsed=!0)}else this.url=String($);if(this.credentials=ee.credentials||this.credentials||"same-origin",(ee.headers||!this.headers)&&(this.headers=new de(ee.headers)),this.method=Bt(ee.method||this.method||"GET"),this.mode=ee.mode||this.mode||null,this.signal=ee.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&we)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(we)}rt.prototype.clone=function(){return new rt(this,{body:this._bodyInit})};function yr($){var ee=new FormData;return $.trim().split("&").forEach(function(we){if(we){var Me=we.split("="),We=Me.shift().replace(/\+/g," "),xe=Me.join("=").replace(/\+/g," ");ee.append(decodeURIComponent(We),decodeURIComponent(xe))}}),ee}function gr($){var ee=new de,we=$.replace(/\r?\n[\t ]+/g," ");return we.split(/\r?\n/).forEach(function(Me){var We=Me.split(":"),xe=We.shift().trim();if(xe){var mr=We.join(":").trim();ee.append(xe,mr)}}),ee}Et.call(rt.prototype);function nt($,ee){ee||(ee={}),this.type="default",this.status=ee.status===void 0?200:ee.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in ee?ee.statusText:"OK",this.headers=new de(ee.headers),this.url=ee.url||"",this._initBody($)}Et.call(nt.prototype),nt.prototype.clone=function(){return new nt(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new de(this.headers),url:this.url})},nt.error=function(){var $=new nt(null,{status:0,statusText:""});return $.type="error",$};var br=[301,302,303,307,308];nt.redirect=function($,ee){if(br.indexOf(ee)===-1)throw new RangeError("Invalid status code");return new nt(null,{status:ee,headers:{location:$}})},d.DOMException=a.DOMException;try{new d.DOMException}catch{d.DOMException=function(ee,we){this.message=ee,this.name=we;var Me=Error(ee);this.stack=Me.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function zt($,ee){return new Promise(function(we,Me){var We=new rt($,ee);if(We.signal&&We.signal.aborted)return Me(new d.DOMException("Aborted","AbortError"));var xe=new XMLHttpRequest;function mr(){xe.abort()}xe.onload=function(){var Xt={status:xe.status,statusText:xe.statusText,headers:gr(xe.getAllResponseHeaders()||"")};Xt.url="responseURL"in xe?xe.responseURL:Xt.headers.get("X-Request-URL");var Mr="response"in xe?xe.response:xe.responseText;we(new nt(Mr,Xt))},xe.onerror=function(){Me(new TypeError("Network request failed"))},xe.ontimeout=function(){Me(new TypeError("Network request failed"))},xe.onabort=function(){Me(new d.DOMException("Aborted","AbortError"))},xe.open(We.method,We.url,!0),We.credentials==="include"?xe.withCredentials=!0:We.credentials==="omit"&&(xe.withCredentials=!1),"responseType"in xe&&E.blob&&(xe.responseType="blob"),We.headers.forEach(function(Xt,Mr){xe.setRequestHeader(Mr,Xt)}),We.signal&&(We.signal.addEventListener("abort",mr),xe.onreadystatechange=function(){xe.readyState===4&&We.signal.removeEventListener("abort",mr)}),xe.send(typeof We._bodyInit>"u"?null:We._bodyInit)})}return zt.polyfill=!0,a.fetch||(a.fetch=zt,a.Headers=de,a.Request=rt,a.Response=nt),d.Headers=de,d.Request=rt,d.Response=nt,d.fetch=zt,Object.defineProperty(d,"__esModule",{value:!0}),d})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var n=r;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,i.exports=e})(Tr,Tr.exports);var Bn=Xn(Tr.exports);const Yt=32;function Ur(i){let e=0;for(;i>1;)i/=2,e++;return e}function Js(i){return i===0?1:(i--,i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,i|=i>>32,i+1)}class Rn{constructor(e,t,r,n,a){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=n,this.firstNormalSlot=a}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const t=Ur(Js(e+Yt+1))-Ur(Yt)-1,r=this.getSlotsInEpoch(t),n=e-(r-Yt);return[t,n]}else{const t=e-this.firstNormalSlot,r=Math.floor(t/this.slotsPerEpoch),n=this.firstNormalEpoch+r,a=t%this.slotsPerEpoch;return[n,a]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*Yt:(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+Ur(Yt)):this.slotsPerEpoch}}class Cr extends Error{constructor(e,t){super(e),this.logs=void 0,this.logs=t}}const Qs=1e3/(160/64);function eo(i,e){let t;const r=new Promise(n=>{t=setTimeout(()=>n(null),e)});return Promise.race([i,r]).then(n=>(clearTimeout(t),n))}function to(i){let e=new URL(i);const t=e.protocol==="https:";return e.protocol=t?"wss:":"ws:",e.host="",e.port!==""&&(e.port=String(Number(e.port)+1)),e.toString()}const qe=je(m(he),se(),i=>new he(i)),Pn=Jt([se(),u("base64")]),Or=je(m(C.Buffer),Pn,i=>C.Buffer.from(i[0],"base64")),Tn=30*1e3;function Un(i){return Ze([Q({jsonrpc:u("2.0"),id:se(),result:i}),Q({jsonrpc:u("2.0"),id:se(),error:Q({code:st(),message:se(),data:ye(Ge())})})])}const ro=Un(st());function _e(i){return je(Un(i),ro,e=>"error"in e?e:{...e,result:x(e.result,i)})}function Ye(i){return _e(Q({context:Q({slot:k()}),value:i}))}function fr(i){return Q({context:Q({slot:k()}),value:i})}const no=Q({foundation:k(),foundationTerm:k(),initial:k(),taper:k(),terminal:k()}),io=_e(le(O(Q({epoch:k(),effectiveSlot:k(),amount:k(),postBalance:k()})))),so=Q({epoch:k(),slotIndex:k(),slotsInEpoch:k(),absoluteSlot:k(),blockHeight:ye(k()),transactionCount:ye(k())}),oo=Q({slotsPerEpoch:k(),leaderScheduleSlotOffset:k(),warmup:Je(),firstNormalEpoch:k(),firstNormalSlot:k()}),ao=De(se(),le(k())),_t=O(Ze([Q({}),se()])),co=Q({err:_t}),uo=u("receivedSignature"),fo=Q({"solana-core":se(),"feature-set":ye(k())}),lo=Ye(Q({err:O(Ze([Q({}),se()])),logs:O(le(se())),accounts:ye(O(le(Q({executable:Je(),owner:se(),lamports:k(),data:le(se()),rentEpoch:ye(k())})))),unitsConsumed:ye(k())}));function ho(i,e,t,r,n){let a;return r&&(a=async(E,A)=>{const K=await new Promise((q,J)=>{try{r(E,A,(ne,te)=>q([ne,te]))}catch(ne){J(ne)}});return await Bn(...K)}),new(V())(async(E,A)=>{const q={method:"POST",body:E,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{})};try{let J=5,ne,te=500;for(;a?ne=await a(i,q):ne=await Bn(i,q),!(ne.status!==429||n===!0||(J-=1,J===0));)console.log(`Server responded with ${ne.status} ${ne.statusText}. Retrying after ${te}ms delay...`),await cr(te),te*=2;const de=await ne.text();ne.ok?A(null,de):A(new Error(`${ne.status} ${ne.statusText}: ${de}`))}catch(J){J instanceof Error&&A(J)}finally{}},{})}function po(i){return(e,t)=>new Promise((r,n)=>{i.request(e,t,(a,d)=>{if(a){n(a);return}r(d)})})}function yo(i){return e=>new Promise((t,r)=>{e.length===0&&t([]);const n=e.map(a=>i.request(a.methodName,a.args));i.request(n,(a,d)=>{if(a){r(a);return}t(d)})})}const go=_e(no),bo=_e(so),mo=_e(oo),wo=_e(ao),Eo=_e(k()),So=Ye(Q({total:k(),circulating:k(),nonCirculating:k(),nonCirculatingAccounts:le(qe)})),Nr=Q({amount:se(),uiAmount:O(k()),decimals:k(),uiAmountString:ye(se())}),vo=Ye(le(Q({address:qe,amount:se(),uiAmount:O(k()),decimals:k(),uiAmountString:ye(se())}))),ko=Ye(le(Q({pubkey:qe,account:Q({executable:Je(),owner:qe,lamports:k(),data:Or,rentEpoch:k()})}))),Lr=Q({program:se(),parsed:st(),space:k()}),Io=Ye(le(Q({pubkey:qe,account:Q({executable:Je(),owner:qe,lamports:k(),data:Lr,rentEpoch:k()})}))),_o=Ye(le(Q({lamports:k(),address:qe}))),lr=Q({executable:Je(),owner:qe,lamports:k(),data:Or,rentEpoch:k()}),Ao=Q({pubkey:qe,account:lr}),xo=je(Ze([m(C.Buffer),Lr]),Ze([Pn,Lr]),i=>Array.isArray(i)?x(i,Or):i),Fr=Q({executable:Je(),owner:qe,lamports:k(),data:xo,rentEpoch:k()}),Bo=Q({pubkey:qe,account:Fr}),Ro=Q({state:Ze([u("active"),u("inactive"),u("activating"),u("deactivating")]),active:k(),inactive:k()}),Po=_e(le(Q({signature:se(),slot:k(),err:_t,memo:O(se()),blockTime:ye(O(k()))}))),To=_e(le(Q({signature:se(),slot:k(),err:_t,memo:O(se()),blockTime:ye(O(k()))}))),Uo=Q({subscription:k(),result:fr(lr)}),Co=Q({pubkey:qe,account:lr}),Oo=Q({subscription:k(),result:fr(Co)}),No=Q({parent:k(),slot:k(),root:k()}),Lo=Q({subscription:k(),result:No}),Fo=Ze([Q({type:Ze([u("firstShredReceived"),u("completed"),u("optimisticConfirmation"),u("root")]),slot:k(),timestamp:k()}),Q({type:u("createdBank"),parent:k(),slot:k(),timestamp:k()}),Q({type:u("frozen"),slot:k(),timestamp:k(),stats:Q({numTransactionEntries:k(),numSuccessfulTransactions:k(),numFailedTransactions:k(),maxTransactionsPerEntry:k()})}),Q({type:u("dead"),slot:k(),timestamp:k(),err:se()})]),Do=Q({subscription:k(),result:Fo}),Ko=Q({subscription:k(),result:fr(Ze([co,uo]))}),zo=Q({subscription:k(),result:k()}),Wo=Q({pubkey:se(),gossip:O(se()),tpu:O(se()),rpc:O(se()),version:O(se())}),Cn=Q({votePubkey:se(),nodePubkey:se(),activatedStake:k(),epochVoteAccount:Je(),epochCredits:le(Jt([k(),k(),k()])),commission:k(),lastVote:k(),rootSlot:O(k())}),Mo=_e(Q({current:le(Cn),delinquent:le(Cn)})),$o=Ze([u("processed"),u("confirmed"),u("finalized")]),jo=Q({slot:k(),confirmations:O(k()),err:_t,confirmationStatus:ye($o)}),Vo=Ye(le(O(jo))),Go=_e(k()),On=Q({signatures:le(se()),message:Q({accountKeys:le(se()),header:Q({numRequiredSignatures:k(),numReadonlySignedAccounts:k(),numReadonlyUnsignedAccounts:k()}),instructions:le(Q({accounts:le(k()),data:se(),programIdIndex:k()})),recentBlockhash:se()})}),Nn=Q({parsed:st(),program:se(),programId:qe}),Ln=Q({accounts:le(qe),data:se(),programId:qe}),Ho=Ze([Ln,Nn]),qo=Ze([Q({parsed:st(),program:se(),programId:se()}),Q({accounts:le(se()),data:se(),programId:se()})]),Fn=je(Ho,qo,i=>"accounts"in i?x(i,Ln):x(i,Nn)),Yo=Q({signatures:le(se()),message:Q({accountKeys:le(Q({pubkey:qe,signer:Je(),writable:Je()})),instructions:le(Fn),recentBlockhash:se()})}),hr=Q({accountIndex:k(),mint:se(),owner:ye(se()),uiTokenAmount:Nr}),Dn=Q({err:_t,fee:k(),innerInstructions:ye(O(le(Q({index:k(),instructions:le(Q({accounts:le(k()),data:se(),programIdIndex:k()}))})))),preBalances:le(k()),postBalances:le(k()),logMessages:ye(O(le(se()))),preTokenBalances:ye(O(le(hr))),postTokenBalances:ye(O(le(hr)))}),Zo=Q({err:_t,fee:k(),innerInstructions:ye(O(le(Q({index:k(),instructions:le(Fn)})))),preBalances:le(k()),postBalances:le(k()),logMessages:ye(O(le(se()))),preTokenBalances:ye(O(le(hr))),postTokenBalances:ye(O(le(hr)))}),Xo=_e(O(Q({blockhash:se(),previousBlockhash:se(),parentSlot:k(),transactions:le(Q({transaction:On,meta:O(Dn)})),rewards:ye(le(Q({pubkey:se(),lamports:k(),postBalance:O(k()),rewardType:O(se())}))),blockTime:O(k())}))),Jo=_e(O(Q({blockhash:se(),previousBlockhash:se(),parentSlot:k(),signatures:le(se()),blockTime:O(k())}))),Qo=_e(O(Q({slot:k(),meta:Dn,blockTime:ye(O(k())),transaction:On}))),Kn=_e(O(Q({slot:k(),transaction:Yo,meta:O(Zo),blockTime:ye(O(k()))}))),ea=Ye(Q({blockhash:se(),feeCalculator:Q({lamportsPerSignature:k()})})),ta=Q({slot:k(),numTransactions:k(),numSlots:k(),samplePeriodSecs:k()}),ra=_e(le(ta)),na=Ye(O(Q({feeCalculator:Q({lamportsPerSignature:k()})}))),ia=_e(se()),sa=_e(se()),oa=Q({err:_t,logs:le(se()),signature:se()}),aa=Q({result:fr(oa),subscription:k()});class ca{constructor(e,t){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._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={recentBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._accountChangeSubscriptionCounter=0,this._accountChangeSubscriptions={},this._programAccountChangeSubscriptionCounter=0,this._programAccountChangeSubscriptions={},this._rootSubscriptionCounter=0,this._rootSubscriptions={},this._signatureSubscriptionCounter=0,this._signatureSubscriptions={},this._slotSubscriptionCounter=0,this._slotSubscriptions={},this._logsSubscriptionCounter=0,this._logsSubscriptions={},this._slotUpdateSubscriptionCounter=0,this._slotUpdateSubscriptions={};let r=new URL(e);const n=r.protocol==="https:";let a,d,E,A;t&&typeof t=="string"?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,a=t.wsEndpoint,d=t.httpHeaders,E=t.fetchMiddleware,A=t.disableRetryOnRateLimit),this._rpcEndpoint=e,this._rpcWsEndpoint=a||to(e),this._rpcClient=ho(r.toString(),n,d,E,A),this._rpcRequest=po(this._rpcClient),this._rpcBatchRequest=yo(this._rpcClient),this._rpcWebSocket=new S.K(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}async getBalanceAndContext(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getBalance",r),a=x(n,Ye(k()));if("error"in a)throw new Error("failed to get balance for "+e.toBase58()+": "+a.error.message);return a.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+r)})}async getBlockTime(e){const t=await this._rpcRequest("getBlockTime",[e]),r=x(t,_e(O(k())));if("error"in r)throw new Error("failed to get block time for slot "+e+": "+r.error.message);return r.result}async getMinimumLedgerSlot(){const e=await this._rpcRequest("minimumLedgerSlot",[]),t=x(e,_e(k()));if("error"in t)throw new Error("failed to get minimum ledger slot: "+t.error.message);return t.result}async getFirstAvailableBlock(){const e=await this._rpcRequest("getFirstAvailableBlock",[]),t=x(e,Eo);if("error"in t)throw new Error("failed to get first available block: "+t.error.message);return t.result}async getSupply(e){let t={};typeof e=="string"?t={commitment:e}:e?t={...e,commitment:e&&e.commitment||this.commitment}:t={commitment:this.commitment};const r=await this._rpcRequest("getSupply",[t]),n=x(r,So);if("error"in n)throw new Error("failed to get supply: "+n.error.message);return n.result}async getTokenSupply(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenSupply",r),a=x(n,Ye(Nr));if("error"in a)throw new Error("failed to get token supply: "+a.error.message);return a.result}async getTokenAccountBalance(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenAccountBalance",r),a=x(n,Ye(Nr));if("error"in a)throw new Error("failed to get token account balance: "+a.error.message);return a.result}async getTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"base64"),d=await this._rpcRequest("getTokenAccountsByOwner",a),E=x(d,ko);if("error"in E)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+E.error.message);return E.result}async getParsedTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"jsonParsed"),d=await this._rpcRequest("getTokenAccountsByOwner",a),E=x(d,Io);if("error"in E)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+E.error.message);return E.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},r=t.filter||t.commitment?[t]:[],n=await this._rpcRequest("getLargestAccounts",r),a=x(n,_o);if("error"in a)throw new Error("failed to get largest accounts: "+a.error.message);return a.result}async getTokenLargestAccounts(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenLargestAccounts",r),a=x(n,vo);if("error"in a)throw new Error("failed to get token largest accounts: "+a.error.message);return a.result}async getAccountInfoAndContext(e,t){const r=this._buildArgs([e.toBase58()],t,"base64"),n=await this._rpcRequest("getAccountInfo",r),a=x(n,Ye(O(lr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getParsedAccountInfo(e,t){const r=this._buildArgs([e.toBase58()],t,"jsonParsed"),n=await this._rpcRequest("getAccountInfo",r),a=x(n,Ye(O(Fr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(r){throw new Error("failed to get info about account "+e.toBase58()+": "+r)}}async getMultipleAccountsInfo(e,t){const r=e.map(K=>K.toBase58());let n,a="base64";t&&(typeof t=="string"?(n=t,a="base64"):(n=t.commitment,a=t.encoding||"base64"));const d=this._buildArgs([r],n,a),E=await this._rpcRequest("getMultipleAccounts",d),A=x(E,Ye(le(O(Fr))));if("error"in A)throw new Error("failed to get info for accounts "+r+": "+A.error.message);return A.result.value}async getStakeActivation(e,t,r){const n=this._buildArgs([e.toBase58()],t,void 0,r!==void 0?{epoch:r}:void 0),a=await this._rpcRequest("getStakeActivation",n),d=x(a,_e(Ro));if("error"in d)throw new Error(`failed to get Stake Activation ${e.toBase58()}: ${d.error.message}`);return d.result}async getProgramAccounts(e,t){const r={};let n,a;t&&(typeof t=="string"?n=t:(n=t.commitment,a=t.encoding,t.dataSlice&&(r.dataSlice=t.dataSlice),t.filters&&(r.filters=t.filters)));const d=this._buildArgs([e.toBase58()],n,a||"base64",r),E=await this._rpcRequest("getProgramAccounts",d),A=x(E,_e(le(Ao)));if("error"in A)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+A.error.message);return A.result}async getParsedProgramAccounts(e,t){const r={};let n;t&&(typeof t=="string"?n=t:(n=t.commitment,t.filters&&(r.filters=t.filters)));const a=this._buildArgs([e.toBase58()],n,"jsonParsed",r),d=await this._rpcRequest("getProgramAccounts",a),E=x(d,_e(le(Bo)));if("error"in E)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+E.error.message);return E.result}async confirmTransaction(e,t){let r;try{r=h().decode(e)}catch{throw new Error("signature must be base58 encoded: "+e)}He(r.length===64,"signature has invalid length");const n=Date.now(),a=t||this.commitment;let d,E=null;const A=new Promise((q,J)=>{try{d=this.onSignature(e,(ne,te)=>{d=void 0,E={context:te,value:ne},q(null)},a)}catch(ne){J(ne)}});let K=this._confirmTransactionInitialTimeout||60*1e3;switch(a){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{K=this._confirmTransactionInitialTimeout||30*1e3;break}}try{await eo(A,K)}finally{d&&this.removeSignatureListener(d)}if(E===null){const q=(Date.now()-n)/1e3;throw new Error(`Transaction was not confirmed in ${q.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`)}return E}async getClusterNodes(){const e=await this._rpcRequest("getClusterNodes",[]),t=x(e,_e(le(Wo)));if("error"in t)throw new Error("failed to get cluster nodes: "+t.error.message);return t.result}async getVoteAccounts(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getVoteAccounts",t),n=x(r,Mo);if("error"in n)throw new Error("failed to get vote accounts: "+n.error.message);return n.result}async getSlot(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlot",t),n=x(r,_e(k()));if("error"in n)throw new Error("failed to get slot: "+n.error.message);return n.result}async getSlotLeader(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlotLeader",t),n=x(r,_e(se()));if("error"in n)throw new Error("failed to get slot leader: "+n.error.message);return n.result}async getSlotLeaders(e,t){const r=[e,t],n=await this._rpcRequest("getSlotLeaders",r),a=x(n,_e(le(qe)));if("error"in a)throw new Error("failed to get slot leaders: "+a.error.message);return a.result}async getSignatureStatus(e,t){const{context:r,value:n}=await this.getSignatureStatuses([e],t);He(n.length===1);const a=n[0];return{context:r,value:a}}async getSignatureStatuses(e,t){const r=[e];t&&r.push(t);const n=await this._rpcRequest("getSignatureStatuses",r),a=x(n,Vo);if("error"in a)throw new Error("failed to get signature status: "+a.error.message);return a.result}async getTransactionCount(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getTransactionCount",t),n=x(r,_e(k()));if("error"in n)throw new Error("failed to get transaction count: "+n.error.message);return n.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getInflationGovernor",t),n=x(r,go);if("error"in n)throw new Error("failed to get inflation: "+n.error.message);return n.result}async getInflationReward(e,t,r){const n=this._buildArgs([e.map(E=>E.toBase58())],r,void 0,{epoch:t}),a=await this._rpcRequest("getInflationReward",n),d=x(a,io);if("error"in d)throw new Error("failed to get inflation reward: "+d.error.message);return d.result}async getEpochInfo(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getEpochInfo",t),n=x(r,bo);if("error"in n)throw new Error("failed to get epoch info: "+n.error.message);return n.result}async getEpochSchedule(){const e=await this._rpcRequest("getEpochSchedule",[]),t=x(e,mo);if("error"in t)throw new Error("failed to get epoch schedule: "+t.error.message);const r=t.result;return new Rn(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot)}async getLeaderSchedule(){const e=await this._rpcRequest("getLeaderSchedule",[]),t=x(e,wo);if("error"in t)throw new Error("failed to get leader schedule: "+t.error.message);return t.result}async getMinimumBalanceForRentExemption(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getMinimumBalanceForRentExemption",r),a=x(n,Go);return"error"in a?(console.warn("Unable to fetch minimum balance for rent exemption"),0):a.result}async getRecentBlockhashAndContext(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getRecentBlockhash",t),n=x(r,ea);if("error"in n)throw new Error("failed to get recent blockhash: "+n.error.message);return n.result}async getRecentPerformanceSamples(e){const t=this._buildArgs(e?[e]:[]),r=await this._rpcRequest("getRecentPerformanceSamples",t),n=x(r,ra);if("error"in n)throw new Error("failed to get recent performance samples: "+n.error.message);return n.result}async getFeeCalculatorForBlockhash(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getFeeCalculatorForBlockhash",r),a=x(n,na);if("error"in a)throw new Error("failed to get fee calculator: "+a.error.message);const{context:d,value:E}=a.result;return{context:d,value:E!==null?E.feeCalculator:null}}async getFeeForMessage(e,t){const r=e.serialize().toString("base64"),n=this._buildArgs([r],t),a=await this._rpcRequest("getFeeForMessage",n),d=x(a,Ye(O(k())));if("error"in d)throw new Error("failed to get slot: "+d.error.message);if(d.result===null)throw new Error("invalid blockhash");return d.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getVersion(){const e=await this._rpcRequest("getVersion",[]),t=x(e,_e(fo));if("error"in t)throw new Error("failed to get version: "+t.error.message);return t.result}async getGenesisHash(){const e=await this._rpcRequest("getGenesisHash",[]),t=x(e,_e(se()));if("error"in t)throw new Error("failed to get genesis hash: "+t.error.message);return t.result}async getBlock(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedBlock",r),a=x(n,Xo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;return d&&{...d,transactions:d.transactions.map(({transaction:E,meta:A})=>{const K=new vt(E.message);return{meta:A,transaction:{...E,message:K}}})}}async getTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedTransaction",r),a=x(n,Qo);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);const d=a.result;return d&&{...d,transaction:{...d.transaction,message:new vt(d.transaction.message)}}}async getConfirmedBlock(e,t){const r=await this.getBlock(e,{commitment:t});if(!r)throw new Error("Confirmed block "+e+" not found");return{...r,transactions:r.transactions.map(({transaction:n,meta:a})=>({meta:a,transaction:Ce.populate(n.message,n.signatures)}))}}async getBlocks(e,t,r){const n=this._buildArgsAtLeastConfirmed(t!==void 0?[e,t]:[e],r),a=await this._rpcRequest("getConfirmedBlocks",n),d=x(a,_e(le(k())));if("error"in d)throw new Error("failed to get blocks: "+d.error.message);return d.result}async getConfirmedBlockSignatures(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=await this._rpcRequest("getConfirmedBlock",r),a=x(n,Jo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;if(!d)throw new Error("Confirmed block "+e+" not found");return d}async getConfirmedTransaction(e,t){const r=await this.getTransaction(e,{commitment:t});if(!r)return r;const{message:n,signatures:a}=r.transaction;return{...r,transaction:Ce.populate(n,a)}}async getParsedConfirmedTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),n=await this._rpcRequest("getConfirmedTransaction",r),a=x(n,Kn);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);return a.result}async getParsedConfirmedTransactions(e,t){const r=e.map(d=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([d],t,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(d=>{const E=x(d,Kn);if("error"in E)throw new Error("failed to get confirmed transactions: "+E.error.message);return E.result})}async getConfirmedSignaturesForAddress(e,t,r){let n={},a=await this.getFirstAvailableBlock();for(;!("until"in n)&&(t--,!(t<=0||t<a));)try{const A=await this.getConfirmedBlockSignatures(t,"finalized");A.signatures.length>0&&(n.until=A.signatures[A.signatures.length-1].toString())}catch(A){if(A instanceof Error&&A.message.includes("skipped"))continue;throw A}let d=await this.getSlot("finalized");for(;!("before"in n)&&(r++,!(r>d));)try{const A=await this.getConfirmedBlockSignatures(r);A.signatures.length>0&&(n.before=A.signatures[A.signatures.length-1].toString())}catch(A){if(A instanceof Error&&A.message.includes("skipped"))continue;throw A}return(await this.getConfirmedSignaturesForAddress2(e,n)).map(A=>A.signature)}async getConfirmedSignaturesForAddress2(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getConfirmedSignaturesForAddress2",n),d=x(a,Po);if("error"in d)throw new Error("failed to get confirmed signatures for address: "+d.error.message);return d.result}async getSignaturesForAddress(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getSignaturesForAddress",n),d=x(a,To);if("error"in d)throw new Error("failed to get signatures for address: "+d.error.message);return d.result}async getNonceAndContext(e,t){const{context:r,value:n}=await this.getAccountInfoAndContext(e,t);let a=null;return n!==null&&(a=ur.fromAccountData(n.data)),{context:r,value:a}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+r)})}async requestAirdrop(e,t){const r=await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),n=x(r,ia);if("error"in n)throw new Error("airdrop to "+e.toBase58()+" failed: "+n.error.message);return n.result}async _recentBlockhash(e){if(!e){for(;this._pollingBlockhash;)await cr(100);const r=Date.now()-this._blockhashInfo.lastFetch>=Tn;if(this._blockhashInfo.recentBlockhash!==null&&!r)return this._blockhashInfo.recentBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now();for(let t=0;t<50;t++){const{blockhash:r}=await this.getRecentBlockhash("finalized");if(this._blockhashInfo.recentBlockhash!=r)return this._blockhashInfo={recentBlockhash:r,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},r;await cr(Qs/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(e,t,r){let n;if(e instanceof Ce?n=e:n=Ce.populate(e),n.nonceInfo&&t)n.sign(...t);else{let te=this._disableBlockhashCaching;for(;n.recentBlockhash=await this._recentBlockhash(te),!!t;){if(n.sign(...t),!n.signature)throw new Error("!signature");const de=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(de)&&!this._blockhashInfo.transactionSignatures.includes(de)){this._blockhashInfo.simulatedSignatures.push(de);break}else te=!0}}const a=n._compile(),d=a.serialize(),A=n._serialize(d).toString("base64"),K={encoding:"base64",commitment:this.commitment};if(r){const te=(Array.isArray(r)?r:a.nonProgramIds()).map(de=>de.toBase58());K.accounts={encoding:"base64",addresses:te}}t&&(K.sigVerify=!0);const q=[A,K],J=await this._rpcRequest("simulateTransaction",q),ne=x(J,lo);if("error"in ne){let te;if("data"in ne.error&&(te=ne.error.data.logs,te&&Array.isArray(te))){const de=`
|
|
114
|
-
`,pe=de+te.join(de);console.error(ne.error.message,pe)}throw new Cr("failed to simulate transaction: "+ne.error.message,te)}return ne.result}async sendTransaction(e,t,r){if(e.nonceInfo)e.sign(...t);else{let a=this._disableBlockhashCaching;for(;;){if(e.recentBlockhash=await this._recentBlockhash(a),e.sign(...t),!e.signature)throw new Error("!signature");const d=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(d))a=!0;else{this._blockhashInfo.transactionSignatures.push(d);break}}}const n=e.serialize();return await this.sendRawTransaction(n,r)}async sendRawTransaction(e,t){const r=ce(e).toString("base64");return await this.sendEncodedTransaction(r,t)}async sendEncodedTransaction(e,t){const r={encoding:"base64"},n=t&&t.skipPreflight,a=t&&t.preflightCommitment||this.commitment;n&&(r.skipPreflight=n),a&&(r.preflightCommitment=a);const d=[e,r],E=await this._rpcRequest("sendTransaction",d),A=x(E,sa);if("error"in A){let
|
|
115
|
-
`,J=q+K.join(q);console.error(A.error.message,J)}throw new Cr("failed to send transaction: "+A.error.message,K)}return A.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{this._rpcWebSocket.notify("ping").catch(()=>{})},5e3),this._updateSubscriptions()}_wsOnError(e){console.error("ws error:",e.message)}_wsOnClose(e){if(this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),e===1e3){this._updateSubscriptions();return}this._resetSubscriptions()}async _subscribe(e,t,r){if(e.subscriptionId==null){e.subscriptionId="subscribing";try{const n=await this._rpcWebSocket.call(t,r);typeof n=="number"&&e.subscriptionId==="subscribing"&&(e.subscriptionId=n)}catch(n){e.subscriptionId==="subscribing"&&(e.subscriptionId=null),n instanceof Error&&console.error(`${t} error for argument`,r,n.message)}}}async _unsubscribe(e,t){const r=e.subscriptionId;if(r!=null&&typeof r!="string"){const n=r;try{await this._rpcWebSocket.call(t,[n])}catch(a){a instanceof Error&&console.error(`${t} error:`,a.message)}}}_resetSubscriptions(){Object.values(this._accountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._programAccountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._rootSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._signatureSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotUpdateSubscriptions).forEach(e=>e.subscriptionId=null)}_updateSubscriptions(){const e=Object.keys(this._accountChangeSubscriptions).map(Number),t=Object.keys(this._programAccountChangeSubscriptions).map(Number),r=Object.keys(this._slotSubscriptions).map(Number),n=Object.keys(this._slotUpdateSubscriptions).map(Number),a=Object.keys(this._signatureSubscriptions).map(Number),d=Object.keys(this._rootSubscriptions).map(Number),E=Object.keys(this._logsSubscriptions).map(Number);if(e.length===0&&t.length===0&&r.length===0&&n.length===0&&a.length===0&&d.length===0&&E.length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null,this._rpcWebSocket.close()},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}for(let A of e){const K=this._accountChangeSubscriptions[A];this._subscribe(K,"accountSubscribe",this._buildArgs([K.publicKey],K.commitment,"base64"))}for(let A of t){const K=this._programAccountChangeSubscriptions[A];this._subscribe(K,"programSubscribe",this._buildArgs([K.programId],K.commitment,"base64",{filters:K.filters}))}for(let A of r){const K=this._slotSubscriptions[A];this._subscribe(K,"slotSubscribe",[])}for(let A of n){const K=this._slotUpdateSubscriptions[A];this._subscribe(K,"slotsUpdatesSubscribe",[])}for(let A of a){const K=this._signatureSubscriptions[A],q=[K.signature];K.options&&q.push(K.options),this._subscribe(K,"signatureSubscribe",q)}for(let A of d){const K=this._rootSubscriptions[A];this._subscribe(K,"rootSubscribe",[])}for(let A of E){const K=this._logsSubscriptions[A];let q;typeof K.filter=="object"?q={mentions:[K.filter.toString()]}:q=K.filter,this._subscribe(K,"logsSubscribe",this._buildArgs([q],K.commitment))}}_wsOnAccountNotification(e){const t=x(e,Uo);for(const r of Object.values(this._accountChangeSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result.value,t.result.context);return}}onAccountChange(e,t,r){const n=++this._accountChangeSubscriptionCounter;return this._accountChangeSubscriptions[n]={publicKey:e.toBase58(),callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeAccountChangeListener(e){if(this._accountChangeSubscriptions[e]){const t=this._accountChangeSubscriptions[e];delete this._accountChangeSubscriptions[e],await this._unsubscribe(t,"accountUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown account change id: ${e}`)}_wsOnProgramAccountNotification(e){const t=x(e,Oo);for(const r of Object.values(this._programAccountChangeSubscriptions))if(r.subscriptionId===t.subscription){const{value:n,context:a}=t.result;r.callback({accountId:n.pubkey,accountInfo:n.account},a);return}}onProgramAccountChange(e,t,r,n){const a=++this._programAccountChangeSubscriptionCounter;return this._programAccountChangeSubscriptions[a]={programId:e.toBase58(),callback:t,commitment:r,subscriptionId:null,filters:n},this._updateSubscriptions(),a}async removeProgramAccountChangeListener(e){if(this._programAccountChangeSubscriptions[e]){const t=this._programAccountChangeSubscriptions[e];delete this._programAccountChangeSubscriptions[e],await this._unsubscribe(t,"programUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown program account change id: ${e}`)}onLogs(e,t,r){const n=++this._logsSubscriptionCounter;return this._logsSubscriptions[n]={filter:e,callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeOnLogsListener(e){if(!this._logsSubscriptions[e])throw new Error(`Unknown logs id: ${e}`);const t=this._logsSubscriptions[e];delete this._logsSubscriptions[e],await this._unsubscribe(t,"logsUnsubscribe"),this._updateSubscriptions()}_wsOnLogsNotification(e){const t=x(e,aa),r=Object.keys(this._logsSubscriptions).map(Number);for(let n of r){const a=this._logsSubscriptions[n];if(a.subscriptionId===t.subscription){a.callback(t.result.value,t.result.context);return}}}_wsOnSlotNotification(e){const t=x(e,Lo);for(const r of Object.values(this._slotSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotChange(e){const t=++this._slotSubscriptionCounter;return this._slotSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotChangeListener(e){if(this._slotSubscriptions[e]){const t=this._slotSubscriptions[e];delete this._slotSubscriptions[e],await this._unsubscribe(t,"slotUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot change id: ${e}`)}_wsOnSlotUpdatesNotification(e){const t=x(e,Do);for(const r of Object.values(this._slotUpdateSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotUpdate(e){const t=++this._slotUpdateSubscriptionCounter;return this._slotUpdateSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotUpdateListener(e){if(this._slotUpdateSubscriptions[e]){const t=this._slotUpdateSubscriptions[e];delete this._slotUpdateSubscriptions[e],await this._unsubscribe(t,"slotsUpdatesUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot update id: ${e}`)}_buildArgs(e,t,r,n){const a=t||this._commitment;if(a||r||n){let d={};r&&(d.encoding=r),a&&(d.commitment=a),n&&(d=Object.assign(d,n)),e.push(d)}return e}_buildArgsAtLeastConfirmed(e,t,r,n){const a=t||this._commitment;if(a&&!["confirmed","finalized"].includes(a))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,r,n)}_wsOnSignatureNotification(e){const t=x(e,Ko);for(const[r,n]of Object.entries(this._signatureSubscriptions))if(n.subscriptionId===t.subscription){t.result.value==="receivedSignature"?n.callback({type:"received"},t.result.context):(delete this._signatureSubscriptions[Number(r)],this._updateSubscriptions(),n.callback({type:"status",result:t.result.value},t.result.context));return}}onSignature(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:(a,d)=>{a.type==="status"&&t(a.result,d)},options:{commitment:r},subscriptionId:null},this._updateSubscriptions(),n}onSignatureWithOptions(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:t,options:r,subscriptionId:null},this._updateSubscriptions(),n}async removeSignatureListener(e){if(this._signatureSubscriptions[e]){const t=this._signatureSubscriptions[e];delete this._signatureSubscriptions[e],await this._unsubscribe(t,"signatureUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown signature result id: ${e}`)}_wsOnRootNotification(e){const t=x(e,zo);for(const r of Object.values(this._rootSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onRootChange(e){const t=++this._rootSubscriptionCounter;return this._rootSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeRootChangeListener(e){if(this._rootSubscriptions[e]){const t=this._rootSubscriptions[e];delete this._rootSubscriptions[e],await this._unsubscribe(t,"rootUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown root change id: ${e}`)}}class Dt{constructor(e){this._keypair=void 0,e?this._keypair=e:this._keypair=X().sign.keyPair()}static generate(){return new Dt(X().sign.keyPair())}static fromSecretKey(e,t){const r=X().sign.keyPair.fromSecretKey(e);if(!t||!t.skipValidation){const a=new TextEncoder().encode("@solana/web3.js-validation-v1"),d=X().sign.detached(a,r.secretKey);if(!X().sign.detached.verify(a,d,r.publicKey))throw new Error("provided secretKey is invalid")}return new Dt(r)}static fromSeed(e){return new Dt(X().sign.keyPair.fromSeed(e))}get publicKey(){return new he(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const zn=64,Wn=32,Mn=64,$n=f.struct([f.u8("numSignatures"),f.u8("padding"),f.u16("signatureOffset"),f.u16("signatureInstructionIndex"),f.u16("publicKeyOffset"),f.u16("publicKeyInstructionIndex"),f.u16("messageDataOffset"),f.u16("messageDataSize"),f.u16("messageInstructionIndex")]);class dr{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,instructionIndex:a}=e;He(t.length===Wn,`Public Key must be ${Wn} bytes but received ${t.length} bytes`),He(n.length===Mn,`Signature must be ${Mn} bytes but received ${n.length} bytes`);const d=$n.span,E=d+t.length,A=E+n.length,K=1,q=C.Buffer.alloc(A+r.length);return $n.encode({numSignatures:K,padding:0,signatureOffset:E,signatureInstructionIndex:a,publicKeyOffset:d,publicKeyInstructionIndex:a,messageDataOffset:A,messageDataSize:r.length,messageInstructionIndex:a},q),q.fill(t,d),q.fill(n,E),q.fill(r,A),new Xe({keys:[],programId:dr.programId,data:q})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;He(t.length===zn,`Private key must be ${zn} bytes but received ${t.length} bytes`);try{const a=Dt.fromSecretKey(t),d=a.publicKey.toBytes(),E=X().sign.detached(r,a.secretKey);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:E,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}dr.programId=new he("Ed25519SigVerify111111111111111111111111111");const jn=new he("StakeConfig11111111111111111111111111111111");class Vn{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class Zt{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}}Zt.default=new Zt(0,0,he.default);class ua{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=f.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(Ve))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t,lockup:r}=ze(Ve.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new Vn(new he(t.staker),new he(t.withdrawer)),lockup:new Zt(r.unixTimestamp,r.epoch,new he(r.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),ze(Ve.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);const{newAuthorized:t,stakeAuthorizationType:r}=ze(Ve.Authorize,e.data),n={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new he(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(n.custodianPubkey=e.keys[3].pubkey),n}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:t,stakeAuthorizationType:r,authoritySeed:n,authorityOwner:a}=ze(Ve.AuthorizeWithSeed,e.data),d={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:n,authorityOwner:new he(a),newAuthorizedPubkey:new he(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(d.custodianPubkey=e.keys[3].pubkey),d}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=ze(Ve.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),ze(Ve.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);const{lamports:t}=ze(Ve.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),ze(Ve.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(pr.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const Ve=Object.freeze({Initialize:{index:0,layout:f.struct([f.u32("instruction"),Ks(),zs()])},Authorize:{index:1,layout:f.struct([f.u32("instruction"),Te("newAuthorized"),f.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:f.struct([f.u32("instruction")])},Split:{index:3,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},Withdraw:{index:4,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},Deactivate:{index:5,layout:f.struct([f.u32("instruction")])},Merge:{index:7,layout:f.struct([f.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:f.struct([f.u32("instruction"),Te("newAuthorized"),f.u32("stakeAuthorizationType"),Lt("authoritySeed"),Te("authorityOwner")])}}),fa=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class pr{constructor(){}static initialize(e){const{stakePubkey:t,authorized:r,lockup:n}=e,a=n||Zt.default,d=Ve.Initialize,E=Ke(d,{authorized:{staker:ce(r.staker.toBuffer()),withdrawer:ce(r.withdrawer.toBuffer())},lockup:{unixTimestamp:a.unixTimestamp,epoch:a.epoch,custodian:ce(a.custodian.toBuffer())}}),A={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:qt,isSigner:!1,isWritable:!1}],programId:this.programId,data:E};return new Xe(A)}static createAccountWithSeed(e){const t=new Ce;t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static createAccount(e){const t=new Ce;t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:r,votePubkey:n}=e,a=Ve.Delegate,d=Ke(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:jn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static authorize(e){const{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:a,custodianPubkey:d}=e,E=Ve.Authorize,A=Ke(E,{newAuthorized:ce(n.toBuffer()),stakeAuthorizationType:a.index}),K=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&K.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:K,programId:this.programId,data:A})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:r,authoritySeed:n,authorityOwner:a,newAuthorizedPubkey:d,stakeAuthorizationType:E,custodianPubkey:A}=e,K=Ve.AuthorizeWithSeed,q=Ke(K,{newAuthorized:ce(d.toBuffer()),stakeAuthorizationType:E.index,authoritySeed:n,authorityOwner:ce(a.toBuffer())}),J=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:kt,isSigner:!1,isWritable:!1}];return A&&J.push({pubkey:A,isSigner:!1,isWritable:!1}),new Ce().add({keys:J,programId:this.programId,data:q})}static split(e){const{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:n,lamports:a}=e,d=new Ce;d.add(et.createAccount({fromPubkey:r,newAccountPubkey:n,lamports:0,space:this.space,programId:this.programId}));const E=Ve.Split,A=Ke(E,{lamports:a});return d.add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:A})}static merge(e){const{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:n}=e,a=Ve.Merge,d=Ke(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:r,toPubkey:n,lamports:a,custodianPubkey:d}=e,E=Ve.Withdraw,A=Ke(E,{lamports:a}),K=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&K.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:K,programId:this.programId,data:A})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:r}=e,n=Ve.Deactivate,a=Ke(n);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}}pr.programId=new he("Stake11111111111111111111111111111111111111"),pr.space=200;const{publicKeyCreate:la,ecdsaSign:ha}=Ue(),Gn=32,Dr=20,Hn=64,da=11,Kr=f.struct([f.u8("numSignatures"),f.u16("signatureOffset"),f.u8("signatureInstructionIndex"),f.u16("ethAddressOffset"),f.u8("ethAddressInstructionIndex"),f.u16("messageDataOffset"),f.u16("messageDataSize"),f.u8("messageInstructionIndex"),f.blob(20,"ethAddress"),f.blob(64,"signature"),f.u8("recoveryId")]);class Kt{constructor(){}static publicKeyToEthAddress(e){He(e.length===Hn,`Public key must be ${Hn} bytes but received ${e.length} bytes`);try{return C.Buffer.from(Pe().keccak_256.update(ce(e)).digest()).slice(-Dr)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,recoveryId:a,instructionIndex:d}=e;return Kt.createInstructionWithEthAddress({ethAddress:Kt.publicKeyToEthAddress(t),message:r,signature:n,recoveryId:a,instructionIndex:d})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:r,signature:n,recoveryId:a,instructionIndex:d=0}=e;let E;typeof t=="string"?t.startsWith("0x")?E=C.Buffer.from(t.substr(2),"hex"):E=C.Buffer.from(t,"hex"):E=t,He(E.length===Dr,`Address must be ${Dr} bytes but received ${E.length} bytes`);const A=1+da,K=A,q=A+E.length,J=q+n.length+1,ne=1,te=C.Buffer.alloc(Kr.span+r.length);return Kr.encode({numSignatures:ne,signatureOffset:q,signatureInstructionIndex:d,ethAddressOffset:K,ethAddressInstructionIndex:d,messageDataOffset:J,messageDataSize:r.length,messageInstructionIndex:d,signature:ce(n),ethAddress:ce(E),recoveryId:a},te),te.fill(ce(r),Kr.span),new Xe({keys:[],programId:Kt.programId,data:te})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;He(t.length===Gn,`Private key must be ${Gn} bytes but received ${t.length} bytes`);try{const a=ce(t),d=la(a,!1).slice(1),E=C.Buffer.from(Pe().keccak_256.update(ce(r)).digest()),{signature:A,recid:K}=ha(E,a);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:A,recoveryId:K,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}Kt.programId=new he("KeccakSecp256k11111111111111111111111111111");const qn=new he("Va1idator1nfo111111111111111111111111111111"),pa=Q({name:se(),website:ye(se()),details:ye(se()),keybaseUsername:ye(se())});class zr{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let r=[...e];if(Ft(r)!==2)return null;const a=[];for(let d=0;d<2;d++){const E=new he(r.slice(0,32));r=r.slice(32);const A=r.slice(0,1)[0]===1;r=r.slice(1),a.push({publicKey:E,isSigner:A})}if(a[0].publicKey.equals(qn)&&a[1].isSigner){const d=Lt().decode(C.Buffer.from(r)),E=JSON.parse(d);return ae(E,pa),new zr(a[1].publicKey,E)}return null}}const ya=new he("Vote111111111111111111111111111111111111111"),ga=f.struct([Te("nodePubkey"),Te("authorizedWithdrawer"),f.u8("commission"),f.nu64(),f.seq(f.struct([f.nu64("slot"),f.u32("confirmationCount")]),f.offset(f.u32(),-8),"votes"),f.u8("rootSlotValid"),f.nu64("rootSlot"),f.nu64(),f.seq(f.struct([f.nu64("epoch"),Te("authorizedVoter")]),f.offset(f.u32(),-8),"authorizedVoters"),f.struct([f.seq(f.struct([Te("authorizedPubkey"),f.nu64("epochOfLastAuthorizedSwitch"),f.nu64("targetEpoch")]),32,"buf"),f.nu64("idx"),f.u8("isEmpty")],"priorVoters"),f.nu64(),f.seq(f.struct([f.nu64("epoch"),f.nu64("credits"),f.nu64("prevCredits")]),f.offset(f.u32(),-8),"epochCredits"),f.struct([f.nu64("slot"),f.nu64("timestamp")],"lastTimestamp")]);class Wr{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){const r=ga.decode(ce(e),4);let n=r.rootSlot;return r.rootSlotValid||(n=null),new Wr({nodePubkey:new he(r.nodePubkey),authorizedWithdrawer:new he(r.authorizedWithdrawer),commission:r.commission,votes:r.votes,rootSlot:n,authorizedVoters:r.authorizedVoters.map(ba),priorVoters:wa(r.priorVoters),epochCredits:r.epochCredits,lastTimestamp:r.lastTimestamp})}}function ba({epoch:i,authorizedVoter:e}){return{epoch:i,authorizedVoter:new he(e)}}function ma({authorizedPubkey:i,epochOfLastAuthorizedSwitch:e,targetEpoch:t}){return{authorizedPubkey:new he(i),epochOfLastAuthorizedSwitch:e,targetEpoch:t}}function wa({buf:i,idx:e,isEmpty:t}){return t?[]:[...i.slice(e+1).map(ma),...i.slice(0,e)]}async function Ea(i,e,t){const r=t&&{skipPreflight:t.skipPreflight,preflightCommitment:t.preflightCommitment||t.commitment},n=await i.sendRawTransaction(e,r),a=(await i.confirmTransaction(n,t&&t.commitment)).value;if(a.err)throw new Error(`Raw transaction ${n} failed (${JSON.stringify(a)})`);return n}const Yn={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"}};function Sa(i,e){const t=e===!1?"http":"https";if(!i)return Yn[t].devnet;const r=Yn[t][i];if(!r)throw new Error(`Unknown ${t} cluster: ${i}`);return r}const va=1e9},75134:function(Ae,g,z){Ae.exports=z(81003)(z(44027))},44027:function(Ae,g,z){const j=z(86266).ec,X=new j("secp256k1"),C=X.curve,W=C.n.constructor;function L(f,T){let _=new W(T);if(_.cmp(C.p)>=0)return null;_=_.toRed(C.red);let F=_.redSqr().redIMul(_).redIAdd(C.b).redSqrt();return f===3!==F.isOdd()&&(F=F.redNeg()),X.keyPair({pub:{x:_,y:F}})}function I(f,T,_){let F=new W(T),B=new W(_);if(F.cmp(C.p)>=0||B.cmp(C.p)>=0||(F=F.toRed(C.red),B=B.toRed(C.red),(f===6||f===7)&&B.isOdd()!==(f===7)))return null;const w=F.redSqr().redIMul(F);return B.redSqr().redISub(w.redIAdd(C.b)).isZero()?X.keyPair({pub:{x:F,y:B}}):null}function h(f){const T=f[0];switch(T){case 2:case 3:return f.length!==33?null:L(T,f.subarray(1,33));case 4:case 6:case 7:return f.length!==65?null:I(T,f.subarray(1,33),f.subarray(33,65));default:return null}}function v(f,T){const _=T.encode(null,f.length===33);for(let F=0;F<f.length;++F)f[F]=_[F]}Ae.exports={contextRandomize(){return 0},privateKeyVerify(f){const T=new W(f);return T.cmp(C.n)<0&&!T.isZero()?0:1},privateKeyNegate(f){const T=new W(f),_=C.n.sub(T).umod(C.n).toArrayLike(Uint8Array,"be",32);return f.set(_),0},privateKeyTweakAdd(f,T){const _=new W(T);if(_.cmp(C.n)>=0||(_.iadd(new W(f)),_.cmp(C.n)>=0&&_.isub(C.n),_.isZero()))return 1;const F=_.toArrayLike(Uint8Array,"be",32);return f.set(F),0},privateKeyTweakMul(f,T){let _=new W(T);if(_.cmp(C.n)>=0||_.isZero())return 1;_.imul(new W(f)),_.cmp(C.n)>=0&&(_=_.umod(C.n));const F=_.toArrayLike(Uint8Array,"be",32);return f.set(F),0},publicKeyVerify(f){return h(f)===null?1:0},publicKeyCreate(f,T){const _=new W(T);if(_.cmp(C.n)>=0||_.isZero())return 1;const F=X.keyFromPrivate(T).getPublic();return v(f,F),0},publicKeyConvert(f,T){const _=h(T);if(_===null)return 1;const F=_.getPublic();return v(f,F),0},publicKeyNegate(f,T){const _=h(T);if(_===null)return 1;const F=_.getPublic();return F.y=F.y.redNeg(),v(f,F),0},publicKeyCombine(f,T){const _=new Array(T.length);for(let B=0;B<T.length;++B)if(_[B]=h(T[B]),_[B]===null)return 1;let F=_[0].getPublic();for(let B=1;B<_.length;++B)F=F.add(_[B].pub);return F.isInfinity()?2:(v(f,F),0)},publicKeyTweakAdd(f,T,_){const F=h(T);if(F===null)return 1;if(_=new W(_),_.cmp(C.n)>=0)return 2;const B=F.getPublic().add(C.g.mul(_));return B.isInfinity()?2:(v(f,B),0)},publicKeyTweakMul(f,T,_){const F=h(T);if(F===null)return 1;if(_=new W(_),_.cmp(C.n)>=0||_.isZero())return 2;const B=F.getPublic().mul(_);return v(f,B),0},signatureNormalize(f){const T=new W(f.subarray(0,32)),_=new W(f.subarray(32,64));return T.cmp(C.n)>=0||_.cmp(C.n)>=0?1:(_.cmp(X.nh)===1&&f.set(C.n.sub(_).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(f,T){const _=T.subarray(0,32),F=T.subarray(32,64);if(new W(_).cmp(C.n)>=0||new W(F).cmp(C.n)>=0)return 1;const{output:B}=f;let w=B.subarray(4,4+33);w[0]=0,w.set(_,1);let U=33,D=0;for(;U>1&&w[D]===0&&!(w[D+1]&128);--U,++D);if(w=w.subarray(D),w[0]&128||U>1&&w[0]===0&&!(w[1]&128))return 1;let R=B.subarray(6+33,6+33+33);R[0]=0,R.set(F,1);let G=33,H=0;for(;G>1&&R[H]===0&&!(R[H+1]&128);--G,++H);return R=R.subarray(H),R[0]&128||G>1&&R[0]===0&&!(R[1]&128)?1:(f.outputlen=6+U+G,B[0]=48,B[1]=f.outputlen-2,B[2]=2,B[3]=w.length,B.set(w,4),B[4+U]=2,B[5+U]=R.length,B.set(R,6+U),0)},signatureImport(f,T){if(T.length<8||T.length>72||T[0]!==48||T[1]!==T.length-2||T[2]!==2)return 1;const _=T[3];if(_===0||5+_>=T.length||T[4+_]!==2)return 1;const F=T[5+_];if(F===0||6+_+F!==T.length||T[4]&128||_>1&&T[4]===0&&!(T[5]&128)||T[_+6]&128||F>1&&T[_+6]===0&&!(T[_+7]&128))return 1;let B=T.subarray(4,4+_);if(B.length===33&&B[0]===0&&(B=B.subarray(1)),B.length>32)return 1;let w=T.subarray(6+_);if(w.length===33&&w[0]===0&&(w=w.slice(1)),w.length>32)throw new Error("S length is too long");let U=new W(B);U.cmp(C.n)>=0&&(U=new W(0));let D=new W(T.subarray(6+_));return D.cmp(C.n)>=0&&(D=new W(0)),f.set(U.toArrayLike(Uint8Array,"be",32),0),f.set(D.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(f,T,_,F,B){if(B){const D=B;B=R=>{const G=D(T,_,null,F,R);if(!(G instanceof Uint8Array&&G.length===32))throw new Error("This is the way");return new W(G)}}const w=new W(_);if(w.cmp(C.n)>=0||w.isZero())return 1;let U;try{U=X.sign(T,_,{canonical:!0,k:B,pers:F})}catch{return 1}return f.signature.set(U.r.toArrayLike(Uint8Array,"be",32),0),f.signature.set(U.s.toArrayLike(Uint8Array,"be",32),32),f.recid=U.recoveryParam,0},ecdsaVerify(f,T,_){const F={r:f.subarray(0,32),s:f.subarray(32,64)},B=new W(F.r),w=new W(F.s);if(B.cmp(C.n)>=0||w.cmp(C.n)>=0)return 1;if(w.cmp(X.nh)===1||B.isZero()||w.isZero())return 3;const U=h(_);if(U===null)return 2;const D=U.getPublic();return X.verify(T,F,D)?0:3},ecdsaRecover(f,T,_,F){const B={r:T.slice(0,32),s:T.slice(32,64)},w=new W(B.r),U=new W(B.s);if(w.cmp(C.n)>=0||U.cmp(C.n)>=0)return 1;if(w.isZero()||U.isZero())return 2;let D;try{D=X.recoverPubKey(F,B,_)}catch{return 2}return v(f,D),0},ecdh(f,T,_,F,B,w,U){const D=h(T);if(D===null)return 1;const R=new W(_);if(R.cmp(C.n)>=0||R.isZero())return 2;const G=D.getPublic().mul(R);if(B===void 0){const H=G.encode(null,!0),ae=X.hash().update(H).digest();for(let x=0;x<32;++x)f[x]=ae[x]}else{w||(w=new Uint8Array(32));const H=G.getX().toArray("be",32);for(let Y=0;Y<32;++Y)w[Y]=H[Y];U||(U=new Uint8Array(32));const ae=G.getY().toArray("be",32);for(let Y=0;Y<32;++Y)U[Y]=ae[Y];const x=B(w,U,F);if(!(x instanceof Uint8Array&&x.length===f.length))return 2;f.set(x)}return 0}}},81003:function(Ae){const g={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function z(L,I){if(!L)throw new Error(I)}function j(L,I,h){if(z(I instanceof Uint8Array,`Expected ${L} to be an Uint8Array`),h!==void 0)if(Array.isArray(h)){const v=h.join(", "),f=`Expected ${L} to be an Uint8Array with length [${v}]`;z(h.includes(I.length),f)}else{const v=`Expected ${L} to be an Uint8Array with length ${h}`;z(I.length===h,v)}}function X(L){z(W(L)==="Boolean","Expected compressed to be a Boolean")}function C(L=h=>new Uint8Array(h),I){return typeof L=="function"&&(L=L(I)),j("output",L,I),L}function W(L){return Object.prototype.toString.call(L).slice(8,-1)}Ae.exports=L=>({contextRandomize(I){switch(z(I===null||I instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),I!==null&&j("seed",I,32),L.contextRandomize(I)){case 1:throw new Error(g.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(I){return j("private key",I,32),L.privateKeyVerify(I)===0},privateKeyNegate(I){switch(j("private key",I,32),L.privateKeyNegate(I)){case 0:return I;case 1:throw new Error(g.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(I,h){switch(j("private key",I,32),j("tweak",h,32),L.privateKeyTweakAdd(I,h)){case 0:return I;case 1:throw new Error(g.TWEAK_ADD)}},privateKeyTweakMul(I,h){switch(j("private key",I,32),j("tweak",h,32),L.privateKeyTweakMul(I,h)){case 0:return I;case 1:throw new Error(g.TWEAK_MUL)}},publicKeyVerify(I){return j("public key",I,[33,65]),L.publicKeyVerify(I)===0},publicKeyCreate(I,h=!0,v){switch(j("private key",I,32),X(h),v=C(v,h?33:65),L.publicKeyCreate(v,I)){case 0:return v;case 1:throw new Error(g.SECKEY_INVALID);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyConvert(I,h=!0,v){switch(j("public key",I,[33,65]),X(h),v=C(v,h?33:65),L.publicKeyConvert(v,I)){case 0:return v;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyNegate(I,h=!0,v){switch(j("public key",I,[33,65]),X(h),v=C(v,h?33:65),L.publicKeyNegate(v,I)){case 0:return v;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyCombine(I,h=!0,v){z(Array.isArray(I),"Expected public keys to be an Array"),z(I.length>0,"Expected public keys array will have more than zero items");for(const f of I)j("public key",f,[33,65]);switch(X(h),v=C(v,h?33:65),L.publicKeyCombine(v,I)){case 0:return v;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_COMBINE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(I,h,v=!0,f){switch(j("public key",I,[33,65]),j("tweak",h,32),X(v),f=C(f,v?33:65),L.publicKeyTweakAdd(f,I,h)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_ADD)}},publicKeyTweakMul(I,h,v=!0,f){switch(j("public key",I,[33,65]),j("tweak",h,32),X(v),f=C(f,v?33:65),L.publicKeyTweakMul(f,I,h)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_MUL)}},signatureNormalize(I){switch(j("signature",I,64),L.signatureNormalize(I)){case 0:return I;case 1:throw new Error(g.SIG_PARSE)}},signatureExport(I,h){j("signature",I,64),h=C(h,72);const v={output:h,outputlen:72};switch(L.signatureExport(v,I)){case 0:return h.slice(0,v.outputlen);case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},signatureImport(I,h){switch(j("signature",I),h=C(h,64),L.signatureImport(h,I)){case 0:return h;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaSign(I,h,v={},f){j("message",I,32),j("private key",h,32),z(W(v)==="Object","Expected options to be an Object"),v.data!==void 0&&j("options.data",v.data),v.noncefn!==void 0&&z(W(v.noncefn)==="Function","Expected options.noncefn to be a Function"),f=C(f,64);const T={signature:f,recid:null};switch(L.ecdsaSign(T,I,h,v.data,v.noncefn)){case 0:return T;case 1:throw new Error(g.SIGN);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaVerify(I,h,v){switch(j("signature",I,64),j("message",h,32),j("public key",v,[33,65]),L.ecdsaVerify(I,h,v)){case 0:return!0;case 3:return!1;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.PUBKEY_PARSE)}},ecdsaRecover(I,h,v,f=!0,T){switch(j("signature",I,64),z(W(h)==="Number"&&h>=0&&h<=3,"Expected recovery id to be a Number within interval [0, 3]"),j("message",v,32),X(f),T=C(T,f?33:65),L.ecdsaRecover(T,I,h,v)){case 0:return T;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.RECOVER);case 3:throw new Error(g.IMPOSSIBLE_CASE)}},ecdh(I,h,v={},f){switch(j("public key",I,[33,65]),j("private key",h,32),z(W(v)==="Object","Expected options to be an Object"),v.data!==void 0&&j("options.data",v.data),v.hashfn!==void 0?(z(W(v.hashfn)==="Function","Expected options.hashfn to be a Function"),v.xbuf!==void 0&&j("options.xbuf",v.xbuf,32),v.ybuf!==void 0&&j("options.ybuf",v.ybuf,32),j("output",f)):f=C(f,32),L.ecdh(f,I,h,v.data,v.hashfn,v.xbuf,v.ybuf)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.ECDH)}}})},25532:function(Ae,g,z){"use strict";var j=z(48764).Buffer,X=this&&this.__createBinding||(Object.create?function(Z,M,re,ie){ie===void 0&&(ie=re),Object.defineProperty(Z,ie,{enumerable:!0,get:function(){return M[re]}})}:function(Z,M,re,ie){ie===void 0&&(ie=re),Z[ie]=M[re]}),C=this&&this.__setModuleDefault||(Object.create?function(Z,M){Object.defineProperty(Z,"default",{enumerable:!0,value:M})}:function(Z,M){Z.default=M}),W=this&&this.__decorate||function(Z,M,re,ie){var ge=arguments.length,me=ge<3?M:ie===null?ie=Object.getOwnPropertyDescriptor(M,re):ie,Oe;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")me=Reflect.decorate(Z,M,re,ie);else for(var Ge=Z.length-1;Ge>=0;Ge--)(Oe=Z[Ge])&&(me=(ge<3?Oe(me):ge>3?Oe(M,re,me):Oe(M,re))||me);return ge>3&&me&&Object.defineProperty(M,re,me),me},L=this&&this.__importStar||function(Z){if(Z&&Z.__esModule)return Z;var M={};if(Z!=null)for(var re in Z)re!=="default"&&Object.hasOwnProperty.call(Z,re)&&X(M,Z,re);return C(M,Z),M},I=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(g,"__esModule",{value:!0}),g.deserializeUnchecked=g.deserialize=g.serialize=g.BinaryReader=g.BinaryWriter=g.BorshError=g.baseDecode=g.baseEncode=void 0;const h=I(z(13550)),v=I(z(77191)),f=L(z(11379)),T=typeof z.g.TextDecoder!="function"?f.TextDecoder:z.g.TextDecoder,_=new T("utf-8",{fatal:!0});function F(Z){return typeof Z=="string"&&(Z=j.from(Z,"utf8")),v.default.encode(j.from(Z))}g.baseEncode=F;function B(Z){return j.from(v.default.decode(Z))}g.baseDecode=B;const w=1024;class U extends Error{constructor(M){super(M),this.fieldPath=[],this.originalMessage=M}addToFieldPath(M){this.fieldPath.splice(0,0,M),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}g.BorshError=U;class D{constructor(){this.buf=j.alloc(w),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=j.concat([this.buf,j.alloc(w)]))}writeU8(M){this.maybeResize(),this.buf.writeUInt8(M,this.length),this.length+=1}writeU16(M){this.maybeResize(),this.buf.writeUInt16LE(M,this.length),this.length+=2}writeU32(M){this.maybeResize(),this.buf.writeUInt32LE(M,this.length),this.length+=4}writeU64(M){this.maybeResize(),this.writeBuffer(j.from(new h.default(M).toArray("le",8)))}writeU128(M){this.maybeResize(),this.writeBuffer(j.from(new h.default(M).toArray("le",16)))}writeU256(M){this.maybeResize(),this.writeBuffer(j.from(new h.default(M).toArray("le",32)))}writeU512(M){this.maybeResize(),this.writeBuffer(j.from(new h.default(M).toArray("le",64)))}writeBuffer(M){this.buf=j.concat([j.from(this.buf.subarray(0,this.length)),M,j.alloc(w)]),this.length+=M.length}writeString(M){this.maybeResize();const re=j.from(M,"utf8");this.writeU32(re.length),this.writeBuffer(re)}writeFixedArray(M){this.writeBuffer(j.from(M))}writeArray(M,re){this.maybeResize(),this.writeU32(M.length);for(const ie of M)this.maybeResize(),re(ie)}toArray(){return this.buf.subarray(0,this.length)}}g.BinaryWriter=D;function R(Z,M,re){const ie=re.value;re.value=function(...ge){try{return ie.apply(this,ge)}catch(me){if(me instanceof RangeError){const Oe=me.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(Oe)>=0)throw new U("Reached the end of buffer when deserializing")}throw me}}}class G{constructor(M){this.buf=M,this.offset=0}readU8(){const M=this.buf.readUInt8(this.offset);return this.offset+=1,M}readU16(){const M=this.buf.readUInt16LE(this.offset);return this.offset+=2,M}readU32(){const M=this.buf.readUInt32LE(this.offset);return this.offset+=4,M}readU64(){const M=this.readBuffer(8);return new h.default(M,"le")}readU128(){const M=this.readBuffer(16);return new h.default(M,"le")}readU256(){const M=this.readBuffer(32);return new h.default(M,"le")}readU512(){const M=this.readBuffer(64);return new h.default(M,"le")}readBuffer(M){if(this.offset+M>this.buf.length)throw new U(`Expected buffer length ${M} isn't within bounds`);const re=this.buf.slice(this.offset,this.offset+M);return this.offset+=M,re}readString(){const M=this.readU32(),re=this.readBuffer(M);try{return _.decode(re)}catch(ie){throw new U(`Error decoding UTF-8 string: ${ie}`)}}readFixedArray(M){return new Uint8Array(this.readBuffer(M))}readArray(M){const re=this.readU32(),ie=Array();for(let ge=0;ge<re;++ge)ie.push(M());return ie}}W([R],G.prototype,"readU8",null),W([R],G.prototype,"readU16",null),W([R],G.prototype,"readU32",null),W([R],G.prototype,"readU64",null),W([R],G.prototype,"readU128",null),W([R],G.prototype,"readU256",null),W([R],G.prototype,"readU512",null),W([R],G.prototype,"readString",null),W([R],G.prototype,"readFixedArray",null),W([R],G.prototype,"readArray",null),g.BinaryReader=G;function H(Z){return Z.charAt(0).toUpperCase()+Z.slice(1)}function ae(Z,M,re,ie,ge){try{if(typeof ie=="string")ge[`write${H(ie)}`](re);else if(ie instanceof Array)if(typeof ie[0]=="number"){if(re.length!==ie[0])throw new U(`Expecting byte array of length ${ie[0]}, but got ${re.length} bytes`);ge.writeFixedArray(re)}else ge.writeArray(re,me=>{ae(Z,M,me,ie[0],ge)});else if(ie.kind!==void 0)switch(ie.kind){case"option":{re==null?ge.writeU8(0):(ge.writeU8(1),ae(Z,M,re,ie.type,ge));break}default:throw new U(`FieldType ${ie} unrecognized`)}else x(Z,re,ge)}catch(me){throw me instanceof U&&me.addToFieldPath(M),me}}function x(Z,M,re){const ie=Z.get(M.constructor);if(!ie)throw new U(`Class ${M.constructor.name} is missing in schema`);if(ie.kind==="struct")ie.fields.map(([ge,me])=>{ae(Z,ge,M[ge],me,re)});else if(ie.kind==="enum"){const ge=M[ie.field];for(let me=0;me<ie.values.length;++me){const[Oe,Ge]=ie.values[me];if(Oe===ge){re.writeU8(me),ae(Z,Oe,M[Oe],Ge,re);break}}}else throw new U(`Unexpected schema kind: ${ie.kind} for ${M.constructor.name}`)}function be(Z,M){const re=new D;return x(Z,M,re),re.toArray()}g.serialize=be;function Y(Z,M,re,ie){try{return typeof re=="string"?ie[`read${H(re)}`]():re instanceof Array?typeof re[0]=="number"?ie.readFixedArray(re[0]):ie.readArray(()=>Y(Z,M,re[0],ie)):re.kind==="option"?ie.readU8()?Y(Z,M,re.type,ie):void 0:ue(Z,re,ie)}catch(ge){throw ge instanceof U&&ge.addToFieldPath(M),ge}}function ue(Z,M,re){const ie=Z.get(M);if(!ie)throw new U(`Class ${M.name} is missing in schema`);if(ie.kind==="struct"){const ge={};for(const[me,Oe]of Z.get(M).fields)ge[me]=Y(Z,me,Oe,re);return new M(ge)}if(ie.kind==="enum"){const ge=re.readU8();if(ge>=ie.values.length)throw new U(`Enum index: ${ge} is out of range`);const[me,Oe]=ie.values[ge],Ge=Y(Z,me,Oe,re);return new M({[me]:Ge})}throw new U(`Unexpected schema kind: ${ie.kind} for ${M.constructor.name}`)}function oe(Z,M,re){const ie=new G(re),ge=ue(Z,M,ie);if(ie.offset<re.length)throw new U(`Unexpected ${re.length-ie.offset} bytes after deserialized data`);return ge}g.deserialize=oe;function fe(Z,M,re){const ie=new G(re);return ue(Z,M,ie)}g.deserializeUnchecked=fe},37953:function(Ae){/*!
|
|
113
|
+
*/const M=K(79742),X=K(80645),C=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;g.Buffer=h,g.SlowBuffer=G,g.INSPECT_MAX_BYTES=50;const W=2147483647;g.kMaxLength=W,h.TYPED_ARRAY_SUPPORT=N(),!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function N(){try{const c=new Uint8Array(1),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(c,s),c.foo()===42}catch{return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.byteOffset}});function _(c){if(c>W)throw new RangeError('The value "'+c+'" is invalid for option "size"');const s=new Uint8Array(c);return Object.setPrototypeOf(s,h.prototype),s}function h(c,s,o){if(typeof c=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(c)}return v(c,s,o)}h.poolSize=8192;function v(c,s,o){if(typeof c=="string")return F(c,s);if(ArrayBuffer.isView(c))return w(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(je(c,ArrayBuffer)||c&&je(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(je(c,SharedArrayBuffer)||c&&je(c.buffer,SharedArrayBuffer)))return U(c,s,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const p=c.valueOf&&c.valueOf();if(p!=null&&p!==c)return h.from(p,s,o);const S=D(c);if(S)return S;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return h.from(c[Symbol.toPrimitive]("string"),s,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}h.from=function(c,s,o){return v(c,s,o)},Object.setPrototypeOf(h.prototype,Uint8Array.prototype),Object.setPrototypeOf(h,Uint8Array);function f(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function T(c,s,o){return f(c),c<=0?_(c):s!==void 0?typeof o=="string"?_(c).fill(s,o):_(c).fill(s):_(c)}h.alloc=function(c,s,o){return T(c,s,o)};function I(c){return f(c),_(c<0?0:R(c)|0)}h.allocUnsafe=function(c){return I(c)},h.allocUnsafeSlow=function(c){return I(c)};function F(c,s){if((typeof s!="string"||s==="")&&(s="utf8"),!h.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const o=H(c,s)|0;let p=_(o);const S=p.write(c,s);return S!==o&&(p=p.slice(0,S)),p}function B(c){const s=c.length<0?0:R(c.length)|0,o=_(s);for(let p=0;p<s;p+=1)o[p]=c[p]&255;return o}function w(c){if(je(c,Uint8Array)){const s=new Uint8Array(c);return U(s.buffer,s.byteOffset,s.byteLength)}return B(c)}function U(c,s,o){if(s<0||c.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<s+(o||0))throw new RangeError('"length" is outside of buffer bounds');let p;return s===void 0&&o===void 0?p=new Uint8Array(c):o===void 0?p=new Uint8Array(c,s):p=new Uint8Array(c,s,o),Object.setPrototypeOf(p,h.prototype),p}function D(c){if(h.isBuffer(c)){const s=R(c.length)|0,o=_(s);return o.length===0||c.copy(o,0,0,s),o}if(c.length!==void 0)return typeof c.length!="number"||Qt(c.length)?_(0):B(c);if(c.type==="Buffer"&&Array.isArray(c.data))return B(c.data)}function R(c){if(c>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return c|0}function G(c){return+c!=c&&(c=0),h.alloc(+c)}h.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==h.prototype},h.compare=function(s,o){if(je(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),je(o,Uint8Array)&&(o=h.from(o,o.offset,o.byteLength)),!h.isBuffer(s)||!h.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===o)return 0;let p=s.length,S=o.length;for(let L=0,V=Math.min(p,S);L<V;++L)if(s[L]!==o[L]){p=s[L],S=o[L];break}return p<S?-1:S<p?1:0},h.isEncoding=function(s){switch(String(s).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(s,o){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return h.alloc(0);let p;if(o===void 0)for(o=0,p=0;p<s.length;++p)o+=s[p].length;const S=h.allocUnsafe(o);let L=0;for(p=0;p<s.length;++p){let V=s[p];if(je(V,Uint8Array))L+V.length>S.length?(h.isBuffer(V)||(V=h.from(V)),V.copy(S,L)):Uint8Array.prototype.set.call(S,V,L);else if(h.isBuffer(V))V.copy(S,L);else throw new TypeError('"list" argument must be an Array of Buffers');L+=V.length}return S};function H(c,s){if(h.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||je(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);const o=c.length,p=arguments.length>2&&arguments[2]===!0;if(!p&&o===0)return 0;let S=!1;for(;;)switch(s){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return se(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Ze(c).length;default:if(S)return p?-1:se(c).length;s=(""+s).toLowerCase(),S=!0}}h.byteLength=H;function ae(c,s,o){let p=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,s>>>=0,o<=s))return"";for(c||(c="utf8");;)switch(c){case"hex":return le(this,s,o);case"utf8":case"utf-8":return ie(this,s,o);case"ascii":return Oe(this,s,o);case"latin1":case"binary":return Ge(this,s,o);case"base64":return re(this,s,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Je(this,s,o);default:if(p)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),p=!0}}h.prototype._isBuffer=!0;function x(c,s,o){const p=c[s];c[s]=c[o],c[o]=p}h.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<s;o+=2)x(this,o,o+1);return this},h.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<s;o+=4)x(this,o,o+3),x(this,o+1,o+2);return this},h.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<s;o+=8)x(this,o,o+7),x(this,o+1,o+6),x(this,o+2,o+5),x(this,o+3,o+4);return this},h.prototype.toString=function(){const s=this.length;return s===0?"":arguments.length===0?ie(this,0,s):ae.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(s){if(!h.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:h.compare(this,s)===0},h.prototype.inspect=function(){let s="";const o=g.INSPECT_MAX_BYTES;return s=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(s+=" ... "),"<Buffer "+s+">"},C&&(h.prototype[C]=h.prototype.inspect),h.prototype.compare=function(s,o,p,S,L){if(je(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),!h.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(o===void 0&&(o=0),p===void 0&&(p=s?s.length:0),S===void 0&&(S=0),L===void 0&&(L=this.length),o<0||p>s.length||S<0||L>this.length)throw new RangeError("out of range index");if(S>=L&&o>=p)return 0;if(S>=L)return-1;if(o>=p)return 1;if(o>>>=0,p>>>=0,S>>>=0,L>>>=0,this===s)return 0;let V=L-S,Ee=p-o;const Ue=Math.min(V,Ee),Be=this.slice(S,L),Pe=s.slice(o,p);for(let ce=0;ce<Ue;++ce)if(Be[ce]!==Pe[ce]){V=Be[ce],Ee=Pe[ce];break}return V<Ee?-1:Ee<V?1:0};function be(c,s,o,p,S){if(c.length===0)return-1;if(typeof o=="string"?(p=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Qt(o)&&(o=S?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(S)return-1;o=c.length-1}else if(o<0)if(S)o=0;else return-1;if(typeof s=="string"&&(s=h.from(s,p)),h.isBuffer(s))return s.length===0?-1:Y(c,s,o,p,S);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?S?Uint8Array.prototype.indexOf.call(c,s,o):Uint8Array.prototype.lastIndexOf.call(c,s,o):Y(c,[s],o,p,S);throw new TypeError("val must be string, number or Buffer")}function Y(c,s,o,p,S){let L=1,V=c.length,Ee=s.length;if(p!==void 0&&(p=String(p).toLowerCase(),p==="ucs2"||p==="ucs-2"||p==="utf16le"||p==="utf-16le")){if(c.length<2||s.length<2)return-1;L=2,V/=2,Ee/=2,o/=2}function Ue(Pe,ce){return L===1?Pe[ce]:Pe.readUInt16BE(ce*L)}let Be;if(S){let Pe=-1;for(Be=o;Be<V;Be++)if(Ue(c,Be)===Ue(s,Pe===-1?0:Be-Pe)){if(Pe===-1&&(Pe=Be),Be-Pe+1===Ee)return Pe*L}else Pe!==-1&&(Be-=Be-Pe),Pe=-1}else for(o+Ee>V&&(o=V-Ee),Be=o;Be>=0;Be--){let Pe=!0;for(let ce=0;ce<Ee;ce++)if(Ue(c,Be+ce)!==Ue(s,ce)){Pe=!1;break}if(Pe)return Be}return-1}h.prototype.includes=function(s,o,p){return this.indexOf(s,o,p)!==-1},h.prototype.indexOf=function(s,o,p){return be(this,s,o,p,!0)},h.prototype.lastIndexOf=function(s,o,p){return be(this,s,o,p,!1)};function ue(c,s,o,p){o=Number(o)||0;const S=c.length-o;p?(p=Number(p),p>S&&(p=S)):p=S;const L=s.length;p>L/2&&(p=L/2);let V;for(V=0;V<p;++V){const Ee=parseInt(s.substr(V*2,2),16);if(Qt(Ee))return V;c[o+V]=Ee}return V}function oe(c,s,o,p){return st(se(s,c.length-o),c,o,p)}function fe(c,s,o,p){return st(Jt(s),c,o,p)}function Z(c,s,o,p){return st(Ze(s),c,o,p)}function $(c,s,o,p){return st(Q(s,c.length-o),c,o,p)}h.prototype.write=function(s,o,p,S){if(o===void 0)S="utf8",p=this.length,o=0;else if(p===void 0&&typeof o=="string")S=o,p=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(p)?(p=p>>>0,S===void 0&&(S="utf8")):(S=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const L=this.length-o;if((p===void 0||p>L)&&(p=L),s.length>0&&(p<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");let V=!1;for(;;)switch(S){case"hex":return ue(this,s,o,p);case"utf8":case"utf-8":return oe(this,s,o,p);case"ascii":case"latin1":case"binary":return fe(this,s,o,p);case"base64":return Z(this,s,o,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,s,o,p);default:if(V)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),V=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function re(c,s,o){return s===0&&o===c.length?M.fromByteArray(c):M.fromByteArray(c.slice(s,o))}function ie(c,s,o){o=Math.min(c.length,o);const p=[];let S=s;for(;S<o;){const L=c[S];let V=null,Ee=L>239?4:L>223?3:L>191?2:1;if(S+Ee<=o){let Ue,Be,Pe,ce;switch(Ee){case 1:L<128&&(V=L);break;case 2:Ue=c[S+1],(Ue&192)===128&&(ce=(L&31)<<6|Ue&63,ce>127&&(V=ce));break;case 3:Ue=c[S+1],Be=c[S+2],(Ue&192)===128&&(Be&192)===128&&(ce=(L&15)<<12|(Ue&63)<<6|Be&63,ce>2047&&(ce<55296||ce>57343)&&(V=ce));break;case 4:Ue=c[S+1],Be=c[S+2],Pe=c[S+3],(Ue&192)===128&&(Be&192)===128&&(Pe&192)===128&&(ce=(L&15)<<18|(Ue&63)<<12|(Be&63)<<6|Pe&63,ce>65535&&ce<1114112&&(V=ce))}}V===null?(V=65533,Ee=1):V>65535&&(V-=65536,p.push(V>>>10&1023|55296),V=56320|V&1023),p.push(V),S+=Ee}return me(p)}const ge=4096;function me(c){const s=c.length;if(s<=ge)return String.fromCharCode.apply(String,c);let o="",p=0;for(;p<s;)o+=String.fromCharCode.apply(String,c.slice(p,p+=ge));return o}function Oe(c,s,o){let p="";o=Math.min(c.length,o);for(let S=s;S<o;++S)p+=String.fromCharCode(c[S]&127);return p}function Ge(c,s,o){let p="";o=Math.min(c.length,o);for(let S=s;S<o;++S)p+=String.fromCharCode(c[S]);return p}function le(c,s,o){const p=c.length;(!s||s<0)&&(s=0),(!o||o<0||o>p)&&(o=p);let S="";for(let L=s;L<o;++L)S+=$r[c[L]];return S}function Je(c,s,o){const p=c.slice(s,o);let S="";for(let L=0;L<p.length-1;L+=2)S+=String.fromCharCode(p[L]+p[L+1]*256);return S}h.prototype.slice=function(s,o){const p=this.length;s=~~s,o=o===void 0?p:~~o,s<0?(s+=p,s<0&&(s=0)):s>p&&(s=p),o<0?(o+=p,o<0&&(o=0)):o>p&&(o=p),o<s&&(o=s);const S=this.subarray(s,o);return Object.setPrototypeOf(S,h.prototype),S};function Fe(c,s,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+s>o)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=this[s],L=1,V=0;for(;++V<o&&(L*=256);)S+=this[s+V]*L;return S},h.prototype.readUintBE=h.prototype.readUIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=this[s+--o],L=1;for(;o>0&&(L*=256);)S+=this[s+--o]*L;return S},h.prototype.readUint8=h.prototype.readUInt8=function(s,o){return s=s>>>0,o||Fe(s,1,this.length),this[s]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(s,o){return s=s>>>0,o||Fe(s,2,this.length),this[s]|this[s+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(s,o){return s=s>>>0,o||Fe(s,2,this.length),this[s]<<8|this[s+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},h.prototype.readBigUInt64LE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,L=this[++s]+this[++s]*2**8+this[++s]*2**16+p*2**24;return BigInt(S)+(BigInt(L)<<BigInt(32))}),h.prototype.readBigUInt64BE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=o*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],L=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p;return(BigInt(S)<<BigInt(32))+BigInt(L)}),h.prototype.readIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=this[s],L=1,V=0;for(;++V<o&&(L*=256);)S+=this[s+V]*L;return L*=128,S>=L&&(S-=Math.pow(2,8*o)),S},h.prototype.readIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||Fe(s,o,this.length);let S=o,L=1,V=this[s+--S];for(;S>0&&(L*=256);)V+=this[s+--S]*L;return L*=128,V>=L&&(V-=Math.pow(2,8*o)),V},h.prototype.readInt8=function(s,o){return s=s>>>0,o||Fe(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},h.prototype.readInt16LE=function(s,o){s=s>>>0,o||Fe(s,2,this.length);const p=this[s]|this[s+1]<<8;return p&32768?p|4294901760:p},h.prototype.readInt16BE=function(s,o){s=s>>>0,o||Fe(s,2,this.length);const p=this[s+1]|this[s]<<8;return p&32768?p|4294901760:p},h.prototype.readInt32LE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},h.prototype.readInt32BE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},h.prototype.readBigInt64LE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(p<<24);return(BigInt(S)<<BigInt(32))+BigInt(o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),h.prototype.readBigInt64BE=yt(function(s){s=s>>>0,ye(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&De(s,this.length-8);const S=(o<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(S)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p)}),h.prototype.readFloatLE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),X.read(this,s,!0,23,4)},h.prototype.readFloatBE=function(s,o){return s=s>>>0,o||Fe(s,4,this.length),X.read(this,s,!1,23,4)},h.prototype.readDoubleLE=function(s,o){return s=s>>>0,o||Fe(s,8,this.length),X.read(this,s,!0,52,8)},h.prototype.readDoubleBE=function(s,o){return s=s>>>0,o||Fe(s,8,this.length),X.read(this,s,!1,52,8)};function $e(c,s,o,p,S,L){if(!h.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>S||s<L)throw new RangeError('"value" argument is out of bounds');if(o+p>c.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(s,o,p,S){if(s=+s,o=o>>>0,p=p>>>0,!S){const Ee=Math.pow(2,8*p)-1;$e(this,s,o,p,Ee,0)}let L=1,V=0;for(this[o]=s&255;++V<p&&(L*=256);)this[o+V]=s/L&255;return o+p},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(s,o,p,S){if(s=+s,o=o>>>0,p=p>>>0,!S){const Ee=Math.pow(2,8*p)-1;$e(this,s,o,p,Ee,0)}let L=p-1,V=1;for(this[o+L]=s&255;--L>=0&&(V*=256);)this[o+L]=s/V&255;return o+p},h.prototype.writeUint8=h.prototype.writeUInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,255,0),this[o]=s&255,o+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o+3]=s>>>24,this[o+2]=s>>>16,this[o+1]=s>>>8,this[o]=s&255,o+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4};function Rt(c,s,o,p,S){ve(s,p,S,c,o,7);let L=Number(s&BigInt(4294967295));c[o++]=L,L=L>>8,c[o++]=L,L=L>>8,c[o++]=L,L=L>>8,c[o++]=L;let V=Number(s>>BigInt(32)&BigInt(4294967295));return c[o++]=V,V=V>>8,c[o++]=V,V=V>>8,c[o++]=V,V=V>>8,c[o++]=V,o}function m(c,s,o,p,S){ve(s,p,S,c,o,7);let L=Number(s&BigInt(4294967295));c[o+7]=L,L=L>>8,c[o+6]=L,L=L>>8,c[o+5]=L,L=L>>8,c[o+4]=L;let V=Number(s>>BigInt(32)&BigInt(4294967295));return c[o+3]=V,V=V>>8,c[o+2]=V,V=V>>8,c[o+1]=V,V=V>>8,c[o]=V,o+8}h.prototype.writeBigUInt64LE=yt(function(s,o=0){return Rt(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=yt(function(s,o=0){return m(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(s,o,p,S){if(s=+s,o=o>>>0,!S){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let L=0,V=1,Ee=0;for(this[o]=s&255;++L<p&&(V*=256);)s<0&&Ee===0&&this[o+L-1]!==0&&(Ee=1),this[o+L]=(s/V>>0)-Ee&255;return o+p},h.prototype.writeIntBE=function(s,o,p,S){if(s=+s,o=o>>>0,!S){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let L=p-1,V=1,Ee=0;for(this[o+L]=s&255;--L>=0&&(V*=256);)s<0&&Ee===0&&this[o+L+1]!==0&&(Ee=1),this[o+L]=(s/V>>0)-Ee&255;return o+p},h.prototype.writeInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,127,-128),s<0&&(s=255+s+1),this[o]=s&255,o+1},h.prototype.writeInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),this[o]=s&255,this[o+1]=s>>>8,this[o+2]=s>>>16,this[o+3]=s>>>24,o+4},h.prototype.writeInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4},h.prototype.writeBigInt64LE=yt(function(s,o=0){return Rt(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=yt(function(s,o=0){return m(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function b(c,s,o,p,S,L){if(o+p>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function l(c,s,o,p,S){return s=+s,o=o>>>0,S||b(c,s,o,4,34028234663852886e22,-34028234663852886e22),X.write(c,s,o,p,23,4),o+4}h.prototype.writeFloatLE=function(s,o,p){return l(this,s,o,!0,p)},h.prototype.writeFloatBE=function(s,o,p){return l(this,s,o,!1,p)};function u(c,s,o,p,S){return s=+s,o=o>>>0,S||b(c,s,o,8,17976931348623157e292,-17976931348623157e292),X.write(c,s,o,p,52,8),o+8}h.prototype.writeDoubleLE=function(s,o,p){return u(this,s,o,!0,p)},h.prototype.writeDoubleBE=function(s,o,p){return u(this,s,o,!1,p)},h.prototype.copy=function(s,o,p,S){if(!h.isBuffer(s))throw new TypeError("argument should be a Buffer");if(p||(p=0),!S&&S!==0&&(S=this.length),o>=s.length&&(o=s.length),o||(o=0),S>0&&S<p&&(S=p),S===p||s.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),s.length-o<S-p&&(S=s.length-o+p);const L=S-p;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,p,S):Uint8Array.prototype.set.call(s,this.subarray(p,S),o),L},h.prototype.fill=function(s,o,p,S){if(typeof s=="string"){if(typeof o=="string"?(S=o,o=0,p=this.length):typeof p=="string"&&(S=p,p=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!h.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(s.length===1){const V=s.charCodeAt(0);(S==="utf8"&&V<128||S==="latin1")&&(s=V)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));if(o<0||this.length<o||this.length<p)throw new RangeError("Out of range index");if(p<=o)return this;o=o>>>0,p=p===void 0?this.length:p>>>0,s||(s=0);let L;if(typeof s=="number")for(L=o;L<p;++L)this[L]=s;else{const V=h.isBuffer(s)?s:h.from(s,S),Ee=V.length;if(Ee===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(L=0;L<p-o;++L)this[L+o]=V[L%Ee]}return this};const y={};function P(c,s,o){y[c]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${c}]`,this.stack,delete this.name}get code(){return c}set code(S){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:S,writable:!0})}toString(){return`${this.name} [${c}]: ${this.message}`}}}P("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),P("ERR_INVALID_ARG_TYPE",function(c,s){return`The "${c}" argument must be of type number. Received type ${typeof s}`},TypeError),P("ERR_OUT_OF_RANGE",function(c,s,o){let p=`The value of "${c}" is out of range.`,S=o;return Number.isInteger(o)&&Math.abs(o)>2**32?S=O(String(o)):typeof o=="bigint"&&(S=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(S=O(S)),S+="n"),p+=` It must be ${s}. Received ${S}`,p},RangeError);function O(c){let s="",o=c.length;const p=c[0]==="-"?1:0;for(;o>=p+4;o-=3)s=`_${c.slice(o-3,o)}${s}`;return`${c.slice(0,o)}${s}`}function k(c,s,o){ye(s,"offset"),(c[s]===void 0||c[s+o]===void 0)&&De(s,c.length-(o+1))}function ve(c,s,o,p,S,L){if(c>o||c<s){const V=typeof s=="bigint"?"n":"";let Ee;throw L>3?s===0||s===BigInt(0)?Ee=`>= 0${V} and < 2${V} ** ${(L+1)*8}${V}`:Ee=`>= -(2${V} ** ${(L+1)*8-1}${V}) and < 2 ** ${(L+1)*8-1}${V}`:Ee=`>= ${s}${V} and <= ${o}${V}`,new y.ERR_OUT_OF_RANGE("value",Ee,c)}k(p,S,L)}function ye(c,s){if(typeof c!="number")throw new y.ERR_INVALID_ARG_TYPE(s,"number",c)}function De(c,s,o){throw Math.floor(c)!==c?(ye(c,o),new y.ERR_OUT_OF_RANGE(o||"offset","an integer",c)):s<0?new y.ERR_BUFFER_OUT_OF_BOUNDS:new y.ERR_OUT_OF_RANGE(o||"offset",`>= ${o?1:0} and <= ${s}`,c)}const it=/[^+/0-9A-Za-z-_]/g;function Wt(c){if(c=c.split("=")[0],c=c.trim().replace(it,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function se(c,s){s=s||1/0;let o;const p=c.length;let S=null;const L=[];for(let V=0;V<p;++V){if(o=c.charCodeAt(V),o>55295&&o<57344){if(!S){if(o>56319){(s-=3)>-1&&L.push(239,191,189);continue}else if(V+1===p){(s-=3)>-1&&L.push(239,191,189);continue}S=o;continue}if(o<56320){(s-=3)>-1&&L.push(239,191,189),S=o;continue}o=(S-55296<<10|o-56320)+65536}else S&&(s-=3)>-1&&L.push(239,191,189);if(S=null,o<128){if((s-=1)<0)break;L.push(o)}else if(o<2048){if((s-=2)<0)break;L.push(o>>6|192,o&63|128)}else if(o<65536){if((s-=3)<0)break;L.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((s-=4)<0)break;L.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return L}function Jt(c){const s=[];for(let o=0;o<c.length;++o)s.push(c.charCodeAt(o)&255);return s}function Q(c,s){let o,p,S;const L=[];for(let V=0;V<c.length&&!((s-=2)<0);++V)o=c.charCodeAt(V),p=o>>8,S=o%256,L.push(S),L.push(p);return L}function Ze(c){return M.toByteArray(Wt(c))}function st(c,s,o,p){let S;for(S=0;S<p&&!(S+o>=s.length||S>=c.length);++S)s[S+o]=c[S];return S}function je(c,s){return c instanceof s||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===s.name}function Qt(c){return c!==c}const $r=function(){const c="0123456789abcdef",s=new Array(256);for(let o=0;o<16;++o){const p=o*16;for(let S=0;S<16;++S)s[p+S]=c[o]+c[S]}return s}();function yt(c){return typeof BigInt>"u"?jr:c}function jr(){throw new Error("BigInt not supported")}},75885:function(Ae,g,K){"use strict";K.r(g),K.d(g,{Account:function(){return Fs},Authorized:function(){return Vn},BLOCKHASH_CACHE_TIMEOUT_MS:function(){return Tn},BPF_LOADER_DEPRECATED_PROGRAM_ID:function(){return Ds},BPF_LOADER_PROGRAM_ID:function(){return Zs},BpfLoader:function(){return Xs},Connection:function(){return ca},Ed25519Program:function(){return dr},Enum:function(){return Cs},EpochSchedule:function(){return Rn},FeeCalculatorLayout:function(){return An},Keypair:function(){return Dt},LAMPORTS_PER_SOL:function(){return va},Loader:function(){return _t},Lockup:function(){return Zt},MAX_SEED_LENGTH:function(){return vn},Message:function(){return vt},NONCE_ACCOUNT_LENGTH:function(){return Pr},NonceAccount:function(){return ur},PACKET_DATA_SIZE:function(){return Ht},PublicKey:function(){return he},SOLANA_SCHEMA:function(){return Vt},STAKE_CONFIG_ID:function(){return jn},STAKE_INSTRUCTION_LAYOUTS:function(){return Ve},SYSTEM_INSTRUCTION_LAYOUTS:function(){return Re},SYSVAR_CLOCK_PUBKEY:function(){return kt},SYSVAR_EPOCH_SCHEDULE_PUBKEY:function(){return $s},SYSVAR_INSTRUCTIONS_PUBKEY:function(){return js},SYSVAR_RECENT_BLOCKHASHES_PUBKEY:function(){return sr},SYSVAR_RENT_PUBKEY:function(){return qt},SYSVAR_REWARDS_PUBKEY:function(){return Vs},SYSVAR_SLOT_HASHES_PUBKEY:function(){return Gs},SYSVAR_SLOT_HISTORY_PUBKEY:function(){return Hs},SYSVAR_STAKE_HISTORY_PUBKEY:function(){return or},Secp256k1Program:function(){return Kt},SendTransactionError:function(){return Cr},StakeAuthorizationLayout:function(){return fa},StakeInstruction:function(){return ua},StakeProgram:function(){return pr},Struct:function(){return Rr},SystemInstruction:function(){return qs},SystemProgram:function(){return et},Transaction:function(){return Ce},TransactionInstruction:function(){return Xe},VALIDATOR_INFO_KEY:function(){return qn},VOTE_PROGRAM_ID:function(){return ya},ValidatorInfo:function(){return zr},VoteAccount:function(){return Wr},clusterApiUrl:function(){return Sa},sendAndConfirmRawTransaction:function(){return Ea},sendAndConfirmTransaction:function(){return ar}});var M=K(50780),X=K.n(M),C=K(48764),W=K(13550),N=K.n(W),_=K(77191),h=K.n(_),v=K(25532),f=K(39386);class T extends TypeError{constructor(e,t){let r;const{message:n,...a}=e,{path:d}=e,E=d.length===0?n:"At path: "+d.join(".")+" -- "+n;super(E),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var A;return(A=r)!=null?A:r=[e,...t()]}}}function I(i){return F(i)&&typeof i[Symbol.iterator]=="function"}function F(i){return typeof i=="object"&&i!=null}function B(i){if(Object.prototype.toString.call(i)!=="[object Object]")return!1;const e=Object.getPrototypeOf(i);return e===null||e===Object.prototype}function w(i){return typeof i=="string"?JSON.stringify(i):""+i}function U(i){const{done:e,value:t}=i.next();return e?void 0:t}function D(i,e,t,r){if(i===!0)return;i===!1?i={}:typeof i=="string"&&(i={message:i});const{path:n,branch:a}=e,{type:d}=t,{refinement:E,message:A="Expected a value of type `"+d+"`"+(E?" with refinement `"+E+"`":"")+", but received: `"+w(r)+"`"}=i;return{value:r,type:d,refinement:E,key:n[n.length-1],path:n,branch:a,...i,message:A}}function*R(i,e,t,r){I(i)||(i=[i]);for(const n of i){const a=D(n,e,t,r);a&&(yield a)}}function*G(i,e,t={}){const{path:r=[],branch:n=[i],coerce:a=!1,mask:d=!1}=t,E={path:r,branch:n};if(a&&(i=e.coercer(i,E),d&&e.type!=="type"&&F(e.schema)&&F(i)&&!Array.isArray(i)))for(const z in i)e.schema[z]===void 0&&delete i[z];let A=!0;for(const z of e.validator(i,E))A=!1,yield[z,void 0];for(let[z,q,J]of e.entries(i,E)){const ne=G(q,J,{path:z===void 0?r:[...r,z],branch:z===void 0?n:[...n,q],coerce:a,mask:d});for(const te of ne)te[0]?(A=!1,yield[te[0],void 0]):a&&(q=te[1],z===void 0?i=q:i instanceof Map?i.set(z,q):i instanceof Set?i.add(q):F(i)&&(i[z]=q))}if(A)for(const z of e.refiner(i,E))A=!1,yield[z,void 0];A&&(yield[void 0,i])}class H{constructor(e){const{type:t,schema:r,validator:n,refiner:a,coercer:d=A=>A,entries:E=function*(){}}=e;this.type=t,this.schema=r,this.entries=E,this.coercer=d,n?this.validator=(A,z)=>{const q=n(A,z);return R(q,z,this,A)}:this.validator=()=>[],a?this.refiner=(A,z)=>{const q=a(A,z);return R(q,z,this,A)}:this.refiner=()=>[]}assert(e){return ae(e,this)}create(e){return x(e,this)}is(e){return Y(e,this)}mask(e){return be(e,this)}validate(e,t={}){return ue(e,this,t)}}function ae(i,e){const t=ue(i,e);if(t[0])throw t[0]}function x(i,e){const t=ue(i,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function be(i,e){const t=ue(i,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Y(i,e){return!ue(i,e)[0]}function ue(i,e,t={}){const r=G(i,e,t),n=U(r);return n[0]?[new T(n[0],function*(){for(const d of r)d[0]&&(yield d[0])}),void 0]:[void 0,n[1]]}function oe(...i){const e=i.map(r=>r.schema),t=Object.assign({},...e);return ve(t)}function fe(i,e){return new H({type:i,schema:null,validator:e})}function Z(i,e){return new H({...i,refiner:(t,r)=>t===void 0||i.refiner(t,r),validator(t,r){return t===void 0?!0:(e(t,r),i.validator(t,r))}})}function $(i){return new H({type:"dynamic",schema:null,*entries(e,t){yield*i(e,t).entries(e,t)},validator(e,t){return i(e,t).validator(e,t)},coercer(e,t){return i(e,t).coercer(e,t)}})}function re(i){let e;return new H({type:"lazy",schema:null,*entries(t,r){var n;(n=e)!=null||(e=i()),yield*e.entries(t,r)},validator(t,r){var n;return(n=e)!=null||(e=i()),e.validator(t,r)},coercer(t,r){var n;return(n=e)!=null||(e=i()),e.coercer(t,r)}})}function ie(i,e){const{schema:t}=i,r={...t};for(const n of e)delete r[n];return ve(r)}function ge(i){const e=i instanceof H?{...i.schema}:{...i};for(const t in e)e[t]=ye(e[t]);return ve(e)}function me(i,e){const{schema:t}=i,r={};for(const n of e)r[n]=t[n];return ve(r)}function Oe(i,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),fe(i,e)}function Ge(){return fe("any",()=>!0)}function le(i){return new H({type:"array",schema:i,*entries(e){if(i&&Array.isArray(e))for(const[t,r]of e.entries())yield[t,r,i]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+w(e)}})}function Je(){return fe("boolean",i=>typeof i=="boolean")}function Fe(){return fe("date",i=>i instanceof Date&&!isNaN(i.getTime())||"Expected a valid `Date` object, but received: "+w(i))}function $e(i){const e={},t=i.map(r=>w(r)).join();for(const r of i)e[r]=r;return new H({type:"enums",schema:e,validator(r){return i.includes(r)||"Expected one of `"+t+"`, but received: "+w(r)}})}function Rt(){return fe("func",i=>typeof i=="function"||"Expected a function, but received: "+w(i))}function m(i){return fe("instance",e=>e instanceof i||"Expected a `"+i.name+"` instance, but received: "+w(e))}function b(){return fe("integer",i=>typeof i=="number"&&!isNaN(i)&&Number.isInteger(i)||"Expected an integer, but received: "+w(i))}function l(i){return new H({type:"intersection",schema:null,*entries(e,t){for(const r of i)yield*r.entries(e,t)},*validator(e,t){for(const r of i)yield*r.validator(e,t)},*refiner(e,t){for(const r of i)yield*r.refiner(e,t)}})}function u(i){const e=w(i),t=typeof i;return new H({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?i:null,validator(r){return r===i||"Expected the literal `"+e+"`, but received: "+w(r)}})}function y(i,e){return new H({type:"map",schema:null,*entries(t){if(i&&e&&t instanceof Map)for(const[r,n]of t.entries())yield[r,r,i],yield[r,n,e]},coercer(t){return t instanceof Map?new Map(t):t},validator(t){return t instanceof Map||"Expected a `Map` object, but received: "+w(t)}})}function P(){return fe("never",()=>!1)}function O(i){return new H({...i,validator:(e,t)=>e===null||i.validator(e,t),refiner:(e,t)=>e===null||i.refiner(e,t)})}function k(){return fe("number",i=>typeof i=="number"&&!isNaN(i)||"Expected a number, but received: "+w(i))}function ve(i){const e=i?Object.keys(i):[],t=P();return new H({type:"object",schema:i||null,*entries(r){if(i&&F(r)){const n=new Set(Object.keys(r));for(const a of e)n.delete(a),yield[a,r[a],i[a]];for(const a of n)yield[a,r[a],t]}},validator(r){return F(r)||"Expected an object, but received: "+w(r)},coercer(r){return F(r)?{...r}:r}})}function ye(i){return new H({...i,validator:(e,t)=>e===void 0||i.validator(e,t),refiner:(e,t)=>e===void 0||i.refiner(e,t)})}function De(i,e){return new H({type:"record",schema:null,*entries(t){if(F(t))for(const r in t){const n=t[r];yield[r,r,i],yield[r,n,e]}},validator(t){return F(t)||"Expected an object, but received: "+w(t)}})}function it(){return fe("regexp",i=>i instanceof RegExp)}function Wt(i){return new H({type:"set",schema:null,*entries(e){if(i&&e instanceof Set)for(const t of e)yield[t,t,i]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||"Expected a `Set` object, but received: "+w(e)}})}function se(){return fe("string",i=>typeof i=="string"||"Expected a string, but received: "+w(i))}function Jt(i){const e=P();return new H({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const r=Math.max(i.length,t.length);for(let n=0;n<r;n++)yield[n,t[n],i[n]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+w(t)}})}function Q(i){const e=Object.keys(i);return new H({type:"type",schema:i,*entries(t){if(F(t))for(const r of e)yield[r,t[r],i[r]]},validator(t){return F(t)||"Expected an object, but received: "+w(t)}})}function Ze(i){const e=i.map(t=>t.type).join(" | ");return new H({type:"union",schema:null,validator(t,r){const n=[];for(const a of i){const[...d]=G(t,a,r),[E]=d;if(E[0])for(const[A]of d)A&&n.push(A);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+w(t),...n]}})}function st(){return fe("unknown",()=>!0)}function je(i,e,t){return new H({...i,coercer:(r,n)=>Y(r,e)?i.coercer(t(r,n),n):i.coercer(r,n)})}function Qt(i,e,t={}){return je(i,st(),r=>{const n=typeof e=="function"?e():e;if(r===void 0)return n;if(!t.strict&&B(r)&&B(n)){const a={...r};let d=!1;for(const E in n)a[E]===void 0&&(a[E]=n[E],d=!0);if(d)return a}return r})}function $r(i){return je(i,se(),e=>e.trim())}function yt(i){const e="Expected an empty "+i.type;return p(i,"empty",t=>{if(t instanceof Map||t instanceof Set){const{size:r}=t;return r===0||e+" but received one with a size of `"+r+"`"}else{const{length:r}=t;return r===0||e+" but received one with a length of `"+r+"`"}})}function jr(i,e,t={}){const{exclusive:r}=t;return p(i,"max",n=>r?n<e:n<=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function c(i,e,t={}){const{exclusive:r}=t;return p(i,"min",n=>r?n>e:n>=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function s(i,e){return p(i,"pattern",t=>e.test(t)||"Expected a "+i.type+" matching `/"+e.source+'/` but received "'+t+'"')}function o(i,e,t=e){const r="Expected a "+i.type,n=e===t?"of `"+e+"`":"between `"+e+"` and `"+t+"`";return p(i,"size",a=>{if(typeof a=="number"||a instanceof Date)return e<=a&&a<=t||r+" "+n+" but received `"+a+"`";if(a instanceof Map||a instanceof Set){const{size:d}=a;return e<=d&&d<=t||r+" with a size "+n+" but received one with a size of `"+d+"`"}else{const{length:d}=a;return e<=d&&d<=t||r+" with a length "+n+" but received one with a length of `"+d+"`"}})}function p(i,e,t){return new H({...i,*refiner(r,n){yield*i.refiner(r,n);const a=t(r,n),d=R(a,n,i,r);for(const E of d)yield{...E,refinement:e}}})}var S=K(83937),L=K(31198),V=K.n(L),Ee=K(75134),Ue=K.n(Ee),Be=K(91094),Pe=K.n(Be);const ce=i=>C.Buffer.isBuffer(i)?i:i instanceof Uint8Array?C.Buffer.from(i.buffer,i.byteOffset,i.byteLength):C.Buffer.from(i);var Zn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof K.g<"u"?K.g:typeof self<"u"?self:{};function Xn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Vr={},ke={},Mt=Gr;function Gr(i,e){if(!i)throw new Error(e||"Assertion failed")}Gr.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var wr={exports:{}};typeof Object.create=="function"?wr.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:wr.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var Jn=Mt,Qn=wr.exports;ke.inherits=Qn;function ei(i,e){return(i.charCodeAt(e)&64512)!==55296||e<0||e+1>=i.length?!1:(i.charCodeAt(e+1)&64512)===56320}function ti(i,e){if(Array.isArray(i))return i.slice();if(!i)return[];var t=[];if(typeof i=="string")if(e){if(e==="hex")for(i=i.replace(/[^a-z0-9]+/ig,""),i.length%2!==0&&(i="0"+i),n=0;n<i.length;n+=2)t.push(parseInt(i[n]+i[n+1],16))}else for(var r=0,n=0;n<i.length;n++){var a=i.charCodeAt(n);a<128?t[r++]=a:a<2048?(t[r++]=a>>6|192,t[r++]=a&63|128):ei(i,n)?(a=65536+((a&1023)<<10)+(i.charCodeAt(++n)&1023),t[r++]=a>>18|240,t[r++]=a>>12&63|128,t[r++]=a>>6&63|128,t[r++]=a&63|128):(t[r++]=a>>12|224,t[r++]=a>>6&63|128,t[r++]=a&63|128)}else for(n=0;n<i.length;n++)t[n]=i[n]|0;return t}ke.toArray=ti;function ri(i){for(var e="",t=0;t<i.length;t++)e+=qr(i[t].toString(16));return e}ke.toHex=ri;function Hr(i){var e=i>>>24|i>>>8&65280|i<<8&16711680|(i&255)<<24;return e>>>0}ke.htonl=Hr;function ni(i,e){for(var t="",r=0;r<i.length;r++){var n=i[r];e==="little"&&(n=Hr(n)),t+=Yr(n.toString(16))}return t}ke.toHex32=ni;function qr(i){return i.length===1?"0"+i:i}ke.zero2=qr;function Yr(i){return i.length===7?"0"+i:i.length===6?"00"+i:i.length===5?"000"+i:i.length===4?"0000"+i:i.length===3?"00000"+i:i.length===2?"000000"+i:i.length===1?"0000000"+i:i}ke.zero8=Yr;function ii(i,e,t,r){var n=t-e;Jn(n%4===0);for(var a=new Array(n/4),d=0,E=e;d<a.length;d++,E+=4){var A;r==="big"?A=i[E]<<24|i[E+1]<<16|i[E+2]<<8|i[E+3]:A=i[E+3]<<24|i[E+2]<<16|i[E+1]<<8|i[E],a[d]=A>>>0}return a}ke.join32=ii;function si(i,e){for(var t=new Array(i.length*4),r=0,n=0;r<i.length;r++,n+=4){var a=i[r];e==="big"?(t[n]=a>>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}ke.split32=si;function oi(i,e){return i>>>e|i<<32-e}ke.rotr32=oi;function ai(i,e){return i<<e|i>>>32-e}ke.rotl32=ai;function ci(i,e){return i+e>>>0}ke.sum32=ci;function ui(i,e,t){return i+e+t>>>0}ke.sum32_3=ui;function fi(i,e,t,r){return i+e+t+r>>>0}ke.sum32_4=fi;function li(i,e,t,r,n){return i+e+t+r+n>>>0}ke.sum32_5=li;function hi(i,e,t,r){var n=i[e],a=i[e+1],d=r+a>>>0,E=(d<r?1:0)+t+n;i[e]=E>>>0,i[e+1]=d}ke.sum64=hi;function di(i,e,t,r){var n=e+r>>>0,a=(n<e?1:0)+i+t;return a>>>0}ke.sum64_hi=di;function pi(i,e,t,r){var n=e+r;return n>>>0}ke.sum64_lo=pi;function yi(i,e,t,r,n,a,d,E){var A=0,z=e;z=z+r>>>0,A+=z<e?1:0,z=z+a>>>0,A+=z<a?1:0,z=z+E>>>0,A+=z<E?1:0;var q=i+t+n+d+A;return q>>>0}ke.sum64_4_hi=yi;function gi(i,e,t,r,n,a,d,E){var A=e+r+a+E;return A>>>0}ke.sum64_4_lo=gi;function bi(i,e,t,r,n,a,d,E,A,z){var q=0,J=e;J=J+r>>>0,q+=J<e?1:0,J=J+a>>>0,q+=J<a?1:0,J=J+E>>>0,q+=J<E?1:0,J=J+z>>>0,q+=J<z?1:0;var ne=i+t+n+d+A+q;return ne>>>0}ke.sum64_5_hi=bi;function mi(i,e,t,r,n,a,d,E,A,z){var q=e+r+a+E+z;return q>>>0}ke.sum64_5_lo=mi;function wi(i,e,t){var r=e<<32-t|i>>>t;return r>>>0}ke.rotr64_hi=wi;function Ei(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.rotr64_lo=Ei;function Si(i,e,t){return i>>>t}ke.shr64_hi=Si;function vi(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.shr64_lo=vi;var Pt={},Zr=ke,ki=Mt;function er(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Pt.BlockHash=er,er.prototype.update=function(e,t){if(e=Zr.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Zr.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},er.prototype.digest=function(e){return this.update(this._pad()),ki(this.pending===null),this._digest(e)},er.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var a=1;a<r;a++)n[a]=0;if(e<<=3,this.endian==="big"){for(var d=8;d<this.padLength;d++)n[a++]=0;n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=e>>>24&255,n[a++]=e>>>16&255,n[a++]=e>>>8&255,n[a++]=e&255}else for(n[a++]=e&255,n[a++]=e>>>8&255,n[a++]=e>>>16&255,n[a++]=e>>>24&255,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,d=8;d<this.padLength;d++)n[a++]=0;return n};var Tt={},ct={},_i=ke,ut=_i.rotr32;function Ii(i,e,t,r){if(i===0)return Xr(e,t,r);if(i===1||i===3)return Qr(e,t,r);if(i===2)return Jr(e,t,r)}ct.ft_1=Ii;function Xr(i,e,t){return i&e^~i&t}ct.ch32=Xr;function Jr(i,e,t){return i&e^i&t^e&t}ct.maj32=Jr;function Qr(i,e,t){return i^e^t}ct.p32=Qr;function Ai(i){return ut(i,2)^ut(i,13)^ut(i,22)}ct.s0_256=Ai;function xi(i){return ut(i,6)^ut(i,11)^ut(i,25)}ct.s1_256=xi;function Bi(i){return ut(i,7)^ut(i,18)^i>>>3}ct.g0_256=Bi;function Ri(i){return ut(i,17)^ut(i,19)^i>>>10}ct.g1_256=Ri;var Ut=ke,Pi=Pt,Ti=ct,Er=Ut.rotl32,$t=Ut.sum32,Ui=Ut.sum32_5,Ci=Ti.ft_1,en=Pi.BlockHash,Oi=[1518500249,1859775393,2400959708,3395469782];function ft(){if(!(this instanceof ft))return new ft;en.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ut.inherits(ft,en);var Ni=ft;ft.blockSize=512,ft.outSize=160,ft.hmacStrength=80,ft.padLength=64,ft.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Er(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var a=this.h[0],d=this.h[1],E=this.h[2],A=this.h[3],z=this.h[4];for(n=0;n<r.length;n++){var q=~~(n/20),J=Ui(Er(a,5),Ci(q,d,E,A),z,r[n],Oi[q]);z=A,A=E,E=Er(d,30),d=a,a=J}this.h[0]=$t(this.h[0],a),this.h[1]=$t(this.h[1],d),this.h[2]=$t(this.h[2],E),this.h[3]=$t(this.h[3],A),this.h[4]=$t(this.h[4],z)},ft.prototype._digest=function(e){return e==="hex"?Ut.toHex32(this.h,"big"):Ut.split32(this.h,"big")};var Ct=ke,Li=Pt,Ot=ct,Fi=Mt,ot=Ct.sum32,Di=Ct.sum32_4,Ki=Ct.sum32_5,zi=Ot.ch32,Wi=Ot.maj32,Mi=Ot.s0_256,$i=Ot.s1_256,ji=Ot.g0_256,Vi=Ot.g1_256,tn=Li.BlockHash,Gi=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function lt(){if(!(this instanceof lt))return new lt;tn.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Gi,this.W=new Array(64)}Ct.inherits(lt,tn);var rn=lt;lt.blockSize=512,lt.outSize=256,lt.hmacStrength=192,lt.padLength=64,lt.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Di(Vi(r[n-2]),r[n-7],ji(r[n-15]),r[n-16]);var a=this.h[0],d=this.h[1],E=this.h[2],A=this.h[3],z=this.h[4],q=this.h[5],J=this.h[6],ne=this.h[7];for(Fi(this.k.length===r.length),n=0;n<r.length;n++){var te=Ki(ne,$i(z),zi(z,q,J),this.k[n],r[n]),de=ot(Mi(a),Wi(a,d,E));ne=J,J=q,q=z,z=ot(A,te),A=E,E=d,d=a,a=ot(te,de)}this.h[0]=ot(this.h[0],a),this.h[1]=ot(this.h[1],d),this.h[2]=ot(this.h[2],E),this.h[3]=ot(this.h[3],A),this.h[4]=ot(this.h[4],z),this.h[5]=ot(this.h[5],q),this.h[6]=ot(this.h[6],J),this.h[7]=ot(this.h[7],ne)},lt.prototype._digest=function(e){return e==="hex"?Ct.toHex32(this.h,"big"):Ct.split32(this.h,"big")};var Sr=ke,nn=rn;function gt(){if(!(this instanceof gt))return new gt;nn.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Sr.inherits(gt,nn);var Hi=gt;gt.blockSize=512,gt.outSize=224,gt.hmacStrength=192,gt.padLength=64,gt.prototype._digest=function(e){return e==="hex"?Sr.toHex32(this.h.slice(0,7),"big"):Sr.split32(this.h.slice(0,7),"big")};var Qe=ke,qi=Pt,Yi=Mt,ht=Qe.rotr64_hi,dt=Qe.rotr64_lo,sn=Qe.shr64_hi,on=Qe.shr64_lo,wt=Qe.sum64,vr=Qe.sum64_hi,kr=Qe.sum64_lo,Zi=Qe.sum64_4_hi,Xi=Qe.sum64_4_lo,Ji=Qe.sum64_5_hi,Qi=Qe.sum64_5_lo,an=qi.BlockHash,es=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function at(){if(!(this instanceof at))return new at;an.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=es,this.W=new Array(160)}Qe.inherits(at,an);var cn=at;at.blockSize=1024,at.outSize=512,at.hmacStrength=192,at.padLength=128,at.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var a=ls(r[n-4],r[n-3]),d=hs(r[n-4],r[n-3]),E=r[n-14],A=r[n-13],z=us(r[n-30],r[n-29]),q=fs(r[n-30],r[n-29]),J=r[n-32],ne=r[n-31];r[n]=Zi(a,d,E,A,z,q,J,ne),r[n+1]=Xi(a,d,E,A,z,q,J,ne)}},at.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],a=this.h[1],d=this.h[2],E=this.h[3],A=this.h[4],z=this.h[5],q=this.h[6],J=this.h[7],ne=this.h[8],te=this.h[9],de=this.h[10],pe=this.h[11],_e=this.h[12],Le=this.h[13],tt=this.h[14],At=this.h[15];Yi(this.k.length===r.length);for(var mt=0;mt<r.length;mt+=2){var Et=tt,xt=At,Bt=as(ne,te),rt=cs(ne,te),yr=ts(ne,te,de,pe,_e),gr=rs(ne,te,de,pe,_e,Le),nt=this.k[mt],br=this.k[mt+1],zt=r[mt],j=r[mt+1],ee=Ji(Et,xt,Bt,rt,yr,gr,nt,br,zt,j),we=Qi(Et,xt,Bt,rt,yr,gr,nt,br,zt,j);Et=ss(n,a),xt=os(n,a),Bt=ns(n,a,d,E,A),rt=is(n,a,d,E,A,z);var Me=vr(Et,xt,Bt,rt),We=kr(Et,xt,Bt,rt);tt=_e,At=Le,_e=de,Le=pe,de=ne,pe=te,ne=vr(q,J,ee,we),te=kr(J,J,ee,we),q=A,J=z,A=d,z=E,d=n,E=a,n=vr(ee,we,Me,We),a=kr(ee,we,Me,We)}wt(this.h,0,n,a),wt(this.h,2,d,E),wt(this.h,4,A,z),wt(this.h,6,q,J),wt(this.h,8,ne,te),wt(this.h,10,de,pe),wt(this.h,12,_e,Le),wt(this.h,14,tt,At)},at.prototype._digest=function(e){return e==="hex"?Qe.toHex32(this.h,"big"):Qe.split32(this.h,"big")};function ts(i,e,t,r,n){var a=i&t^~i&n;return a<0&&(a+=4294967296),a}function rs(i,e,t,r,n,a){var d=e&r^~e&a;return d<0&&(d+=4294967296),d}function ns(i,e,t,r,n){var a=i&t^i&n^t&n;return a<0&&(a+=4294967296),a}function is(i,e,t,r,n,a){var d=e&r^e&a^r&a;return d<0&&(d+=4294967296),d}function ss(i,e){var t=ht(i,e,28),r=ht(e,i,2),n=ht(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function os(i,e){var t=dt(i,e,28),r=dt(e,i,2),n=dt(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function as(i,e){var t=ht(i,e,14),r=ht(i,e,18),n=ht(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function cs(i,e){var t=dt(i,e,14),r=dt(i,e,18),n=dt(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function us(i,e){var t=ht(i,e,1),r=ht(i,e,8),n=sn(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function fs(i,e){var t=dt(i,e,1),r=dt(i,e,8),n=on(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function ls(i,e){var t=ht(i,e,19),r=ht(e,i,29),n=sn(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}function hs(i,e){var t=dt(i,e,19),r=dt(e,i,29),n=on(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}var _r=ke,un=cn;function bt(){if(!(this instanceof bt))return new bt;un.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}_r.inherits(bt,un);var ds=bt;bt.blockSize=1024,bt.outSize=384,bt.hmacStrength=192,bt.padLength=128,bt.prototype._digest=function(e){return e==="hex"?_r.toHex32(this.h.slice(0,12),"big"):_r.split32(this.h.slice(0,12),"big")},Tt.sha1=Ni,Tt.sha224=Hi,Tt.sha256=rn,Tt.sha384=ds,Tt.sha512=cn;var fn={},St=ke,ps=Pt,tr=St.rotl32,ln=St.sum32,jt=St.sum32_3,hn=St.sum32_4,dn=ps.BlockHash;function pt(){if(!(this instanceof pt))return new pt;dn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}St.inherits(pt,dn),fn.ripemd160=pt,pt.blockSize=512,pt.outSize=160,pt.hmacStrength=192,pt.padLength=64,pt.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],a=this.h[2],d=this.h[3],E=this.h[4],A=r,z=n,q=a,J=d,ne=E,te=0;te<80;te++){var de=ln(tr(hn(r,pn(te,n,a,d),e[bs[te]+t],ys(te)),ws[te]),E);r=E,E=d,d=tr(a,10),a=n,n=de,de=ln(tr(hn(A,pn(79-te,z,q,J),e[ms[te]+t],gs(te)),Es[te]),ne),A=ne,ne=J,J=tr(q,10),q=z,z=de}de=jt(this.h[1],a,J),this.h[1]=jt(this.h[2],d,ne),this.h[2]=jt(this.h[3],E,A),this.h[3]=jt(this.h[4],r,z),this.h[4]=jt(this.h[0],n,q),this.h[0]=de},pt.prototype._digest=function(e){return e==="hex"?St.toHex32(this.h,"little"):St.split32(this.h,"little")};function pn(i,e,t,r){return i<=15?e^t^r:i<=31?e&t|~e&r:i<=47?(e|~t)^r:i<=63?e&r|t&~r:e^(t|~r)}function ys(i){return i<=15?0:i<=31?1518500249:i<=47?1859775393:i<=63?2400959708:2840853838}function gs(i){return i<=15?1352829926:i<=31?1548603684:i<=47?1836072691:i<=63?2053994217:0}var bs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ms=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ws=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Es=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Ss=ke,vs=Mt;function Nt(i,e,t){if(!(this instanceof Nt))return new Nt(i,e,t);this.Hash=i,this.blockSize=i.blockSize/8,this.outSize=i.outSize/8,this.inner=null,this.outer=null,this._init(Ss.toArray(e,t))}var ks=Nt;Nt.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),vs(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Nt.prototype.update=function(e,t){return this.inner.update(e,t),this},Nt.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(i){var e=i;e.utils=ke,e.common=Pt,e.sha=Tt,e.ripemd=fn,e.hmac=ks,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Vr);var _s=Vr;const Is="logger/5.5.0";let yn=!1,gn=!1;const rr={debug:1,default:2,info:2,warning:3,error:4,off:5};let bn=rr.default,Ir=null;function As(){try{const i=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{i.push(e)}}),i.length)throw new Error("missing "+i.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(i){return i.message}return null}const mn=As();var Ar;(function(i){i.DEBUG="DEBUG",i.INFO="INFO",i.WARNING="WARNING",i.ERROR="ERROR",i.OFF="OFF"})(Ar||(Ar={}));var xr;(function(i){i.UNKNOWN_ERROR="UNKNOWN_ERROR",i.NOT_IMPLEMENTED="NOT_IMPLEMENTED",i.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",i.NETWORK_ERROR="NETWORK_ERROR",i.SERVER_ERROR="SERVER_ERROR",i.TIMEOUT="TIMEOUT",i.BUFFER_OVERRUN="BUFFER_OVERRUN",i.NUMERIC_FAULT="NUMERIC_FAULT",i.MISSING_NEW="MISSING_NEW",i.INVALID_ARGUMENT="INVALID_ARGUMENT",i.MISSING_ARGUMENT="MISSING_ARGUMENT",i.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",i.CALL_EXCEPTION="CALL_EXCEPTION",i.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",i.NONCE_EXPIRED="NONCE_EXPIRED",i.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",i.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",i.TRANSACTION_REPLACED="TRANSACTION_REPLACED"})(xr||(xr={}));const wn="0123456789abcdef";class Ne{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();rr[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(bn>rr[r])&&console.log.apply(console,t)}debug(...e){this._log(Ne.levels.DEBUG,e)}info(...e){this._log(Ne.levels.INFO,e)}warn(...e){this._log(Ne.levels.WARNING,e)}makeError(e,t,r){if(gn)return this.makeError("censored error",t,{});t||(t=Ne.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(E=>{const A=r[E];try{if(A instanceof Uint8Array){let z="";for(let q=0;q<A.length;q++)z+=wn[A[q]>>4],z+=wn[A[q]&15];n.push(E+"=Uint8Array(0x"+z+")")}else n.push(E+"="+JSON.stringify(A))}catch{n.push(E+"="+JSON.stringify(r[E].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const a=e;n.length&&(e+=" ("+n.join(", ")+")");const d=new Error(e);return d.reason=a,d.code=t,Object.keys(r).forEach(function(E){d[E]=r[E]}),d}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Ne.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){mn&&this.throwError("platform missing String.prototype.normalize",Ne.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:mn})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Ne.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Ne.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",e<t&&this.throwError("missing argument"+r,Ne.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,Ne.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Ne.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Ne.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Ne.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Ir||(Ir=new Ne(Is)),Ir}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Ne.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),yn){if(!e)return;this.globalLogger().throwError("error censorship permanent",Ne.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gn=!!e,yn=!!t}static setLogLevel(e){const t=rr[e.toLowerCase()];if(t==null){Ne.globalLogger().warn("invalid log level - "+e);return}bn=t}static from(e){return new Ne(e)}}Ne.errors=xr,Ne.levels=Ar;const xs="bytes/5.5.0",Br=new Ne(xs);function Bs(i){return!!i.toHexString}function nr(i){return i.slice||(i.slice=function(){const e=Array.prototype.slice.call(arguments);return nr(new Uint8Array(Array.prototype.slice.apply(i,e)))}),i}function En(i){return typeof i=="number"&&i==i&&i%1===0}function Rs(i){if(i==null)return!1;if(i.constructor===Uint8Array)return!0;if(typeof i=="string"||!En(i.length)||i.length<0)return!1;for(let e=0;e<i.length;e++){const t=i[e];if(!En(t)||t<0||t>=256)return!1}return!0}function Ps(i,e){if(e||(e={}),typeof i=="number"){Br.checkSafeUint53(i,"invalid arrayify value");const t=[];for(;i;)t.unshift(i&255),i=parseInt(String(i/256));return t.length===0&&t.push(0),nr(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof i=="string"&&i.substring(0,2)!=="0x"&&(i="0x"+i),Bs(i)&&(i=i.toHexString()),Ts(i)){let t=i.substring(2);t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Br.throwArgumentError("hex data is odd-length","value",i));const r=[];for(let n=0;n<t.length;n+=2)r.push(parseInt(t.substring(n,n+2),16));return nr(new Uint8Array(r))}return Rs(i)?nr(new Uint8Array(i)):Br.throwArgumentError("invalid arrayify value","value",i)}function Ts(i,e){return!(typeof i!="string"||!i.match(/^0x[0-9A-Fa-f]*$/)||e&&i.length!==2+2*e)}const Us="sha2/5.5.0";new Ne(Us);function Sn(i){return"0x"+_s.sha256().update(Ps(i)).digest("hex")}class Rr{constructor(e){Object.assign(this,e)}encode(){return C.Buffer.from((0,v.serialize)(Vt,this))}static decode(e){return(0,v.deserialize)(Vt,this,e)}static decodeUnchecked(e){return(0,v.deserializeUnchecked)(Vt,this,e)}}class Cs extends Rr{constructor(e){if(super(e),this.enum="",Object.keys(e).length!==1)throw new Error("Enum can only take single value");Object.keys(e).map(t=>{this.enum=t})}}const Vt=new Map,vn=32;function Os(i){return i._bn!==void 0}class he extends Rr{constructor(e){if(super({}),this._bn=void 0,Os(e))this._bn=e._bn;else{if(typeof e=="string"){const t=h().decode(e);if(t.length!=32)throw new Error("Invalid public key input");this._bn=new(N())(t)}else this._bn=new(N())(e);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(e){return this._bn.eq(e._bn)}toBase58(){return h().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const e=this._bn.toArrayLike(C.Buffer);if(e.length===32)return e;const t=C.Buffer.alloc(32);return e.copy(t,32-e.length),t}toString(){return this.toBase58()}static async createWithSeed(e,t,r){const n=C.Buffer.concat([e.toBuffer(),C.Buffer.from(t),r.toBuffer()]),a=Sn(new Uint8Array(n)).slice(2);return new he(C.Buffer.from(a,"hex"))}static async createProgramAddress(e,t){let r=C.Buffer.alloc(0);e.forEach(function(d){if(d.length>vn)throw new TypeError("Max seed length exceeded");r=C.Buffer.concat([r,ce(d)])}),r=C.Buffer.concat([r,t.toBuffer(),C.Buffer.from("ProgramDerivedAddress")]);let n=Sn(new Uint8Array(r)).slice(2),a=new(N())(n,16).toArray(void 0,32);if(kn(a))throw new Error("Invalid seeds, address must fall off the curve");return new he(a)}static async findProgramAddress(e,t){let r=255,n;for(;r!=0;){try{const a=e.concat(C.Buffer.from([r]));n=await this.createProgramAddress(a,t)}catch(a){if(a instanceof TypeError)throw a;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static isOnCurve(e){return kn(e)==1}}he.default=new he("11111111111111111111111111111111"),Vt.set(he,{kind:"struct",fields:[["_bn","u256"]]});let Se=X().lowlevel;function kn(i){var e=[Se.gf(),Se.gf(),Se.gf(),Se.gf()],t=Se.gf(),r=Se.gf(),n=Se.gf(),a=Se.gf(),d=Se.gf(),E=Se.gf(),A=Se.gf();return Se.set25519(e[2],Ns),Se.unpack25519(e[1],i),Se.S(n,e[1]),Se.M(a,n,Se.D),Se.Z(n,n,e[2]),Se.A(a,e[2],a),Se.S(d,a),Se.S(E,d),Se.M(A,E,d),Se.M(t,A,n),Se.M(t,t,a),Se.pow2523(t,t),Se.M(t,t,n),Se.M(t,t,a),Se.M(t,t,a),Se.M(e[0],t,a),Se.S(r,e[0]),Se.M(r,r,a),_n(r,n)&&Se.M(e[0],e[0],Ls),Se.S(r,e[0]),Se.M(r,r,a),_n(r,n)?0:1}let Ns=Se.gf([1]),Ls=Se.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _n(i,e){var t=new Uint8Array(32),r=new Uint8Array(32);return Se.pack25519(t,i),Se.pack25519(r,e),Se.crypto_verify_32(t,0,r,0)}class Fs{constructor(e){this._keypair=void 0,e?this._keypair=X().sign.keyPair.fromSecretKey(ce(e)):this._keypair=X().sign.keyPair()}get publicKey(){return new he(this._keypair.publicKey)}get secretKey(){return ce(this._keypair.secretKey)}}const Ds=new he("BPFLoader1111111111111111111111111111111111"),Te=(i="publicKey")=>f.blob(32,i),Lt=(i="string")=>{const e=f.struct([f.u32("length"),f.u32("lengthPadding"),f.blob(f.offset(f.u32(),-8),"chars")],i),t=e.decode.bind(e),r=e.encode.bind(e);return e.decode=(n,a)=>t(n,a).chars.toString("utf8"),e.encode=(n,a,d)=>{const E={chars:C.Buffer.from(n,"utf8")};return r(E,a,d)},e.alloc=n=>f.u32().span+f.u32().span+C.Buffer.from(n,"utf8").length,e},Ks=(i="authorized")=>f.struct([Te("staker"),Te("withdrawer")],i),zs=(i="lockup")=>f.struct([f.ns64("unixTimestamp"),f.ns64("epoch"),Te("custodian")],i);function Ws(i,e){let t=0;return i.layout.fields.forEach(r=>{r.span>=0?t+=r.span:typeof r.alloc=="function"&&(t+=r.alloc(e[r.property]))}),t}function Ft(i){let e=0,t=0;for(;;){let r=i.shift();if(e|=(r&127)<<t*7,t+=1,(r&128)===0)break}return e}function Gt(i,e){let t=e;for(;;){let r=t&127;if(t>>=7,t==0){i.push(r);break}else r|=128,i.push(r)}}const ir=32;class vt{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(t=>new he(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){return e<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||e>=this.header.numRequiredSignatures&&e<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];Gt(t,e);const r=this.instructions.map(J=>{const{accounts:ne,programIdIndex:te}=J,de=h().decode(J.data);let pe=[];Gt(pe,ne.length);let _e=[];return Gt(_e,de.length),{programIdIndex:te,keyIndicesCount:C.Buffer.from(pe),keyIndices:C.Buffer.from(ne),dataLength:C.Buffer.from(_e),data:de}});let n=[];Gt(n,r.length);let a=C.Buffer.alloc(Ht);C.Buffer.from(n).copy(a);let d=n.length;r.forEach(J=>{const te=f.struct([f.u8("programIdIndex"),f.blob(J.keyIndicesCount.length,"keyIndicesCount"),f.seq(f.u8("keyIndex"),J.keyIndices.length,"keyIndices"),f.blob(J.dataLength.length,"dataLength"),f.seq(f.u8("userdatum"),J.data.length,"data")]).encode(J,a,d);d+=te}),a=a.slice(0,d);const E=f.struct([f.blob(1,"numRequiredSignatures"),f.blob(1,"numReadonlySignedAccounts"),f.blob(1,"numReadonlyUnsignedAccounts"),f.blob(t.length,"keyCount"),f.seq(Te("key"),e,"keys"),Te("recentBlockhash")]),A={numRequiredSignatures:C.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:C.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:C.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:C.Buffer.from(t),keys:this.accountKeys.map(J=>ce(J.toBytes())),recentBlockhash:h().decode(this.recentBlockhash)};let z=C.Buffer.alloc(2048);const q=E.encode(A,z);return a.copy(z,q),z.slice(0,q+a.length)}static from(e){let t=[...e];const r=t.shift(),n=t.shift(),a=t.shift(),d=Ft(t);let E=[];for(let ne=0;ne<d;ne++){const te=t.slice(0,ir);t=t.slice(ir),E.push(h().encode(C.Buffer.from(te)))}const A=t.slice(0,ir);t=t.slice(ir);const z=Ft(t);let q=[];for(let ne=0;ne<z;ne++){const te=t.shift(),de=Ft(t),pe=t.slice(0,de);t=t.slice(de);const _e=Ft(t),Le=t.slice(0,_e),tt=h().encode(C.Buffer.from(Le));t=t.slice(_e),q.push({programIdIndex:te,accounts:pe,data:tt})}const J={header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:a},recentBlockhash:h().encode(C.Buffer.from(A)),accountKeys:E,instructions:q};return new vt(J)}}function He(i,e){if(!i)throw new Error(e||"Assertion failed")}const Ms=C.Buffer.alloc(64).fill(0),Ht=1280-40-8,In=64;class Xe{constructor(e){this.keys=void 0,this.programId=void 0,this.data=C.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}}class Ce{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.nonceInfo=void 0,e&&Object.assign(this,e)}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new Xe(t))}),this}compileMessage(){const{nonceInfo:e}=this;e&&this.instructions[0]!=e.nonceInstruction&&(this.recentBlockhash=e.nonce,this.instructions.unshift(e.nonceInstruction));const{recentBlockhash:t}=this;if(!t)throw new Error("Transaction recentBlockhash required");this.instructions.length<1&&console.warn("No instructions provided");let r;if(this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let pe=0;pe<this.instructions.length;pe++)if(this.instructions[pe].programId===void 0)throw new Error(`Transaction instruction index ${pe} has undefined program id`);const n=[],a=[];this.instructions.forEach(pe=>{pe.keys.forEach(Le=>{a.push({...Le})});const _e=pe.programId.toString();n.includes(_e)||n.push(_e)}),n.forEach(pe=>{a.push({pubkey:new he(pe),isSigner:!1,isWritable:!1})}),a.sort(function(pe,_e){const Le=pe.pubkey.toBase58().localeCompare(_e.pubkey.toBase58()),tt=pe.isSigner===_e.isSigner?0:pe.isSigner?-1:1,At=pe.isWritable===_e.isWritable?Le:pe.isWritable?-1:1;return tt||At});const d=[];a.forEach(pe=>{const _e=pe.pubkey.toString(),Le=d.findIndex(tt=>tt.pubkey.toString()===_e);Le>-1?d[Le].isWritable=d[Le].isWritable||pe.isWritable:d.push(pe)});const E=d.findIndex(pe=>pe.pubkey.equals(r));if(E>-1){const[pe]=d.splice(E,1);pe.isSigner=!0,pe.isWritable=!0,d.unshift(pe)}else d.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const pe of this.signatures){const _e=d.findIndex(Le=>Le.pubkey.equals(pe.publicKey));if(_e>-1)d[_e].isSigner||(d[_e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${pe.publicKey.toString()}`)}let A=0,z=0,q=0;const J=[],ne=[];d.forEach(({pubkey:pe,isSigner:_e,isWritable:Le})=>{_e?(J.push(pe.toString()),A+=1,Le||(z+=1)):(ne.push(pe.toString()),Le||(q+=1))});const te=J.concat(ne),de=this.instructions.map(pe=>{const{data:_e,programId:Le}=pe;return{programIdIndex:te.indexOf(Le.toString()),accounts:pe.keys.map(tt=>te.indexOf(tt.pubkey.toString())),data:h().encode(_e)}});return de.forEach(pe=>{He(pe.programIdIndex>=0),pe.accounts.forEach(_e=>He(_e>=0))}),new vt({header:{numRequiredSignatures:A,numReadonlySignedAccounts:z,numReadonlyUnsignedAccounts:q},accountKeys:te,recentBlockhash:t,instructions:de})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((n,a)=>t[a].equals(n.publicKey))||(this.signatures=t.map(r=>({signature:null,publicKey:r}))),e}serializeMessage(){return this._compile().serialize()}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(r=>{const n=r.toString();return t.has(n)?!1:(t.add(n),!0)}).map(r=>({signature:null,publicKey:r}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}this.signatures=r.map(a=>({signature:null,publicKey:a.publicKey}));const n=this._compile();this._partialSign(n,...r),this._verifySignatures(n.serialize(),!0)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}const n=this._compile();this._partialSign(n,...r)}_partialSign(e,...t){const r=e.serialize();t.forEach(n=>{const a=X().sign.detached(r,n.secretKey);this._addSignature(n.publicKey,ce(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){He(t.length===64);const r=this.signatures.findIndex(n=>e.equals(n.publicKey));if(r<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=C.Buffer.from(t)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(e,t){for(const{signature:r,publicKey:n}of this.signatures)if(r===null){if(t)return!1}else if(!X().sign.detached.verify(e,r,n.toBuffer()))return!1;return!0}serialize(e){const{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r&&!this._verifySignatures(n,t))throw new Error("Signature verification failed");return this._serialize(n)}_serialize(e){const{signatures:t}=this,r=[];Gt(r,t.length);const n=r.length+t.length*64+e.length,a=C.Buffer.alloc(n);return He(t.length<256),C.Buffer.from(r).copy(a,0),t.forEach(({signature:d},E)=>{d!==null&&(He(d.length===64,"signature has invalid length"),C.Buffer.from(d).copy(a,r.length+E*64))}),e.copy(a,r.length+t.length*64),He(a.length<=Ht,`Transaction too large: ${a.length} > ${Ht}`),a}get keys(){return He(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return He(this.instructions.length===1),this.instructions[0].programId}get data(){return He(this.instructions.length===1),this.instructions[0].data}static from(e){let t=[...e];const r=Ft(t);let n=[];for(let a=0;a<r;a++){const d=t.slice(0,In);t=t.slice(In),n.push(h().encode(C.Buffer.from(d)))}return Ce.populate(vt.from(t),n)}static populate(e,t=[]){const r=new Ce;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((n,a)=>{const d={signature:n==h().encode(Ms)?null:h().decode(n),publicKey:e.accountKeys[a]};r.signatures.push(d)}),e.instructions.forEach(n=>{const a=n.accounts.map(d=>{const E=e.accountKeys[d];return{pubkey:E,isSigner:r.signatures.some(A=>A.publicKey.toString()===E.toString())||e.isAccountSigner(d),isWritable:e.isAccountWritable(d)}});r.instructions.push(new Xe({keys:a,programId:e.accountKeys[n.programIdIndex],data:h().decode(n.data)}))}),r}}const kt=new he("SysvarC1ock11111111111111111111111111111111"),$s=new he("SysvarEpochSchedu1e111111111111111111111111"),js=new he("Sysvar1nstructions1111111111111111111111111"),sr=new he("SysvarRecentB1ockHashes11111111111111111111"),qt=new he("SysvarRent111111111111111111111111111111111"),Vs=new he("SysvarRewards111111111111111111111111111111"),Gs=new he("SysvarS1otHashes111111111111111111111111111"),Hs=new he("SysvarS1otHistory11111111111111111111111111"),or=new he("SysvarStakeHistory1111111111111111111111111");async function ar(i,e,t,r){const n=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment},a=await i.sendTransaction(e,t,n),d=(await i.confirmTransaction(a,r&&r.commitment)).value;if(d.err)throw new Error(`Transaction ${a} failed (${JSON.stringify(d)})`);return a}function cr(i){return new Promise(e=>setTimeout(e,i))}function Ke(i,e){const t=i.layout.span>=0?i.layout.span:Ws(i,e),r=C.Buffer.alloc(t),n=Object.assign({instruction:i.index},e);return i.layout.encode(n,r),r}function ze(i,e){let t;try{t=i.layout.decode(e)}catch(r){throw new Error("invalid instruction; "+r)}if(t.instruction!==i.index)throw new Error(`invalid instruction; instruction index mismatch ${t.instruction} != ${i.index}`);return t}const An=f.nu64("lamportsPerSignature"),xn=f.struct([f.u32("version"),f.u32("state"),Te("authorizedPubkey"),Te("nonce"),f.struct([An],"feeCalculator")]),Pr=xn.span;class ur{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){const t=xn.decode(ce(e),0);return new ur({authorizedPubkey:new he(t.authorizedPubkey),nonce:new he(t.nonce).toString(),feeCalculator:t.feeCalculator})}}class qs{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=f.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(Re))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t,space:r,programId:n}=ze(Re.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:r,programId:new he(n)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t}=ze(Re.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);const{lamports:t,seed:r,programId:n}=ze(Re.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 he(n)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:t}=ze(Re.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,space:n,programId:a}=ze(Re.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new he(t),seed:r,space:n,programId:new he(a)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:t}=ze(Re.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new he(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,programId:n}=ze(Re.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new he(t),seed:r,programId:new he(n)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:t,seed:r,lamports:n,space:a,programId:d}=ze(Re.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new he(t),seed:r,lamports:n,space:a,programId:new he(d)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:t}=ze(Re.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new he(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ze(Re.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);const{lamports:t}=ze(Re.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);const{authorized:t}=ze(Re.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new he(t)}}static checkProgramId(e){if(!e.equals(et.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const Re=Object.freeze({Create:{index:0,layout:f.struct([f.u32("instruction"),f.ns64("lamports"),f.ns64("space"),Te("programId")])},Assign:{index:1,layout:f.struct([f.u32("instruction"),Te("programId")])},Transfer:{index:2,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},CreateWithSeed:{index:3,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),f.ns64("lamports"),f.ns64("space"),Te("programId")])},AdvanceNonceAccount:{index:4,layout:f.struct([f.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:f.struct([f.u32("instruction"),Te("authorized")])},AuthorizeNonceAccount:{index:7,layout:f.struct([f.u32("instruction"),Te("authorized")])},Allocate:{index:8,layout:f.struct([f.u32("instruction"),f.ns64("space")])},AllocateWithSeed:{index:9,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),f.ns64("space"),Te("programId")])},AssignWithSeed:{index:10,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),Te("programId")])},TransferWithSeed:{index:11,layout:f.struct([f.u32("instruction"),f.ns64("lamports"),Lt("seed"),Te("programId")])}});class et{constructor(){}static createAccount(e){const t=Re.Create,r=Ke(t,{lamports:e.lamports,space:e.space,programId:ce(e.programId.toBuffer())});return new Xe({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:r})}static transfer(e){let t,r;if("basePubkey"in e){const n=Re.TransferWithSeed;t=Ke(n,{lamports:e.lamports,seed:e.seed,programId:ce(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}]}else{const n=Re.Transfer;t=Ke(n,{lamports:e.lamports}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new Xe({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;if("basePubkey"in e){const n=Re.AssignWithSeed;t=Ke(n,{base:ce(e.basePubkey.toBuffer()),seed:e.seed,programId:ce(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Re.Assign;t=Ke(n,{programId:ce(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Xe({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=Re.CreateWithSeed,r=Ke(t,{base:ce(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:ce(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new Xe({keys:n,programId:this.programId,data:r})}static createNonceAccount(e){const t=new Ce;"basePubkey"in e&&"seed"in e?t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:Pr,programId:this.programId})):t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:Pr,programId:this.programId}));const r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){const t=Re.InitializeNonceAccount,r=Ke(t,{authorized:ce(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:sr,isSigner:!1,isWritable:!1},{pubkey:qt,isSigner:!1,isWritable:!1}],programId:this.programId,data:r};return new Xe(n)}static nonceAdvance(e){const t=Re.AdvanceNonceAccount,r=Ke(t),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:sr,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r};return new Xe(n)}static nonceWithdraw(e){const t=Re.WithdrawNonceAccount,r=Ke(t,{lamports:e.lamports});return new Xe({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:sr,isSigner:!1,isWritable:!1},{pubkey:qt,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static nonceAuthorize(e){const t=Re.AuthorizeNonceAccount,r=Ke(t,{authorized:ce(e.newAuthorizedPubkey.toBuffer())});return new Xe({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static allocate(e){let t,r;if("basePubkey"in e){const n=Re.AllocateWithSeed;t=Ke(n,{base:ce(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:ce(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Re.Allocate;t=Ke(n,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Xe({keys:r,programId:this.programId,data:t})}}et.programId=new he("11111111111111111111111111111111");const Ys=Ht-300;class _t{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/_t.chunkSize)+1+1)}static async load(e,t,r,n,a){{const J=await e.getMinimumBalanceForRentExemption(a.length),ne=await e.getAccountInfo(r.publicKey,"confirmed");let te=null;if(ne!==null){if(ne.executable)return console.error("Program load failed, account is already executable"),!1;ne.data.length!==a.length&&(te=te||new Ce,te.add(et.allocate({accountPubkey:r.publicKey,space:a.length}))),ne.owner.equals(n)||(te=te||new Ce,te.add(et.assign({accountPubkey:r.publicKey,programId:n}))),ne.lamports<J&&(te=te||new Ce,te.add(et.transfer({fromPubkey:t.publicKey,toPubkey:r.publicKey,lamports:J-ne.lamports})))}else te=new Ce().add(et.createAccount({fromPubkey:t.publicKey,newAccountPubkey:r.publicKey,lamports:J>0?J:1,space:a.length,programId:n}));te!==null&&await ar(e,te,[t,r],{commitment:"confirmed"})}const d=f.struct([f.u32("instruction"),f.u32("offset"),f.u32("bytesLength"),f.u32("bytesLengthPadding"),f.seq(f.u8("byte"),f.offset(f.u32(),-8),"bytes")]),E=_t.chunkSize;let A=0,z=a,q=[];for(;z.length>0;){const J=z.slice(0,E),ne=C.Buffer.alloc(E+16);d.encode({instruction:0,offset:A,bytes:J},ne);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:n,data:ne});q.push(ar(e,te,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await cr(1e3/4),A+=E,z=z.slice(E)}await Promise.all(q);{const J=f.struct([f.u32("instruction")]),ne=C.Buffer.alloc(J.span);J.encode({instruction:1},ne);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:qt,isSigner:!1,isWritable:!1}],programId:n,data:ne});await ar(e,te,[t,r],{commitment:"confirmed"})}return!0}}_t.chunkSize=Ys;const Zs=new he("BPFLoader2111111111111111111111111111111111");class Xs{static getMinNumSignatures(e){return _t.getMinNumSignatures(e)}static load(e,t,r,n,a){return _t.load(e,t,r,a,n)}}var Tr={exports:{}};(function(i,e){var t=typeof self<"u"?self:Zn,r=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(d){var E={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function A(j){return j&&DataView.prototype.isPrototypeOf(j)}if(E.arrayBuffer)var z=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],q=ArrayBuffer.isView||function(j){return j&&z.indexOf(Object.prototype.toString.call(j))>-1};function J(j){if(typeof j!="string"&&(j=String(j)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(j))throw new TypeError("Invalid character in header field name");return j.toLowerCase()}function ne(j){return typeof j!="string"&&(j=String(j)),j}function te(j){var ee={next:function(){var we=j.shift();return{done:we===void 0,value:we}}};return E.iterable&&(ee[Symbol.iterator]=function(){return ee}),ee}function de(j){this.map={},j instanceof de?j.forEach(function(ee,we){this.append(we,ee)},this):Array.isArray(j)?j.forEach(function(ee){this.append(ee[0],ee[1])},this):j&&Object.getOwnPropertyNames(j).forEach(function(ee){this.append(ee,j[ee])},this)}de.prototype.append=function(j,ee){j=J(j),ee=ne(ee);var we=this.map[j];this.map[j]=we?we+", "+ee:ee},de.prototype.delete=function(j){delete this.map[J(j)]},de.prototype.get=function(j){return j=J(j),this.has(j)?this.map[j]:null},de.prototype.has=function(j){return this.map.hasOwnProperty(J(j))},de.prototype.set=function(j,ee){this.map[J(j)]=ne(ee)},de.prototype.forEach=function(j,ee){for(var we in this.map)this.map.hasOwnProperty(we)&&j.call(ee,this.map[we],we,this)},de.prototype.keys=function(){var j=[];return this.forEach(function(ee,we){j.push(we)}),te(j)},de.prototype.values=function(){var j=[];return this.forEach(function(ee){j.push(ee)}),te(j)},de.prototype.entries=function(){var j=[];return this.forEach(function(ee,we){j.push([we,ee])}),te(j)},E.iterable&&(de.prototype[Symbol.iterator]=de.prototype.entries);function pe(j){if(j.bodyUsed)return Promise.reject(new TypeError("Already read"));j.bodyUsed=!0}function _e(j){return new Promise(function(ee,we){j.onload=function(){ee(j.result)},j.onerror=function(){we(j.error)}})}function Le(j){var ee=new FileReader,we=_e(ee);return ee.readAsArrayBuffer(j),we}function tt(j){var ee=new FileReader,we=_e(ee);return ee.readAsText(j),we}function At(j){for(var ee=new Uint8Array(j),we=new Array(ee.length),Me=0;Me<ee.length;Me++)we[Me]=String.fromCharCode(ee[Me]);return we.join("")}function mt(j){if(j.slice)return j.slice(0);var ee=new Uint8Array(j.byteLength);return ee.set(new Uint8Array(j)),ee.buffer}function Et(){return this.bodyUsed=!1,this._initBody=function(j){this._bodyInit=j,j?typeof j=="string"?this._bodyText=j:E.blob&&Blob.prototype.isPrototypeOf(j)?this._bodyBlob=j:E.formData&&FormData.prototype.isPrototypeOf(j)?this._bodyFormData=j:E.searchParams&&URLSearchParams.prototype.isPrototypeOf(j)?this._bodyText=j.toString():E.arrayBuffer&&E.blob&&A(j)?(this._bodyArrayBuffer=mt(j.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):E.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(j)||q(j))?this._bodyArrayBuffer=mt(j):this._bodyText=j=Object.prototype.toString.call(j):this._bodyText="",this.headers.get("content-type")||(typeof j=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):E.searchParams&&URLSearchParams.prototype.isPrototypeOf(j)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},E.blob&&(this.blob=function(){var j=pe(this);if(j)return j;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?pe(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Le)}),this.text=function(){var j=pe(this);if(j)return j;if(this._bodyBlob)return tt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(At(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},E.formData&&(this.formData=function(){return this.text().then(yr)}),this.json=function(){return this.text().then(JSON.parse)},this}var xt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Bt(j){var ee=j.toUpperCase();return xt.indexOf(ee)>-1?ee:j}function rt(j,ee){ee=ee||{};var we=ee.body;if(j instanceof rt){if(j.bodyUsed)throw new TypeError("Already read");this.url=j.url,this.credentials=j.credentials,ee.headers||(this.headers=new de(j.headers)),this.method=j.method,this.mode=j.mode,this.signal=j.signal,!we&&j._bodyInit!=null&&(we=j._bodyInit,j.bodyUsed=!0)}else this.url=String(j);if(this.credentials=ee.credentials||this.credentials||"same-origin",(ee.headers||!this.headers)&&(this.headers=new de(ee.headers)),this.method=Bt(ee.method||this.method||"GET"),this.mode=ee.mode||this.mode||null,this.signal=ee.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&we)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(we)}rt.prototype.clone=function(){return new rt(this,{body:this._bodyInit})};function yr(j){var ee=new FormData;return j.trim().split("&").forEach(function(we){if(we){var Me=we.split("="),We=Me.shift().replace(/\+/g," "),xe=Me.join("=").replace(/\+/g," ");ee.append(decodeURIComponent(We),decodeURIComponent(xe))}}),ee}function gr(j){var ee=new de,we=j.replace(/\r?\n[\t ]+/g," ");return we.split(/\r?\n/).forEach(function(Me){var We=Me.split(":"),xe=We.shift().trim();if(xe){var mr=We.join(":").trim();ee.append(xe,mr)}}),ee}Et.call(rt.prototype);function nt(j,ee){ee||(ee={}),this.type="default",this.status=ee.status===void 0?200:ee.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in ee?ee.statusText:"OK",this.headers=new de(ee.headers),this.url=ee.url||"",this._initBody(j)}Et.call(nt.prototype),nt.prototype.clone=function(){return new nt(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new de(this.headers),url:this.url})},nt.error=function(){var j=new nt(null,{status:0,statusText:""});return j.type="error",j};var br=[301,302,303,307,308];nt.redirect=function(j,ee){if(br.indexOf(ee)===-1)throw new RangeError("Invalid status code");return new nt(null,{status:ee,headers:{location:j}})},d.DOMException=a.DOMException;try{new d.DOMException}catch{d.DOMException=function(ee,we){this.message=ee,this.name=we;var Me=Error(ee);this.stack=Me.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function zt(j,ee){return new Promise(function(we,Me){var We=new rt(j,ee);if(We.signal&&We.signal.aborted)return Me(new d.DOMException("Aborted","AbortError"));var xe=new XMLHttpRequest;function mr(){xe.abort()}xe.onload=function(){var Xt={status:xe.status,statusText:xe.statusText,headers:gr(xe.getAllResponseHeaders()||"")};Xt.url="responseURL"in xe?xe.responseURL:Xt.headers.get("X-Request-URL");var Mr="response"in xe?xe.response:xe.responseText;we(new nt(Mr,Xt))},xe.onerror=function(){Me(new TypeError("Network request failed"))},xe.ontimeout=function(){Me(new TypeError("Network request failed"))},xe.onabort=function(){Me(new d.DOMException("Aborted","AbortError"))},xe.open(We.method,We.url,!0),We.credentials==="include"?xe.withCredentials=!0:We.credentials==="omit"&&(xe.withCredentials=!1),"responseType"in xe&&E.blob&&(xe.responseType="blob"),We.headers.forEach(function(Xt,Mr){xe.setRequestHeader(Mr,Xt)}),We.signal&&(We.signal.addEventListener("abort",mr),xe.onreadystatechange=function(){xe.readyState===4&&We.signal.removeEventListener("abort",mr)}),xe.send(typeof We._bodyInit>"u"?null:We._bodyInit)})}return zt.polyfill=!0,a.fetch||(a.fetch=zt,a.Headers=de,a.Request=rt,a.Response=nt),d.Headers=de,d.Request=rt,d.Response=nt,d.fetch=zt,Object.defineProperty(d,"__esModule",{value:!0}),d})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var n=r;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,i.exports=e})(Tr,Tr.exports);var Bn=Xn(Tr.exports);const Yt=32;function Ur(i){let e=0;for(;i>1;)i/=2,e++;return e}function Js(i){return i===0?1:(i--,i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,i|=i>>32,i+1)}class Rn{constructor(e,t,r,n,a){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=n,this.firstNormalSlot=a}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const t=Ur(Js(e+Yt+1))-Ur(Yt)-1,r=this.getSlotsInEpoch(t),n=e-(r-Yt);return[t,n]}else{const t=e-this.firstNormalSlot,r=Math.floor(t/this.slotsPerEpoch),n=this.firstNormalEpoch+r,a=t%this.slotsPerEpoch;return[n,a]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*Yt:(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+Ur(Yt)):this.slotsPerEpoch}}class Cr extends Error{constructor(e,t){super(e),this.logs=void 0,this.logs=t}}const Qs=1e3/(160/64);function eo(i,e){let t;const r=new Promise(n=>{t=setTimeout(()=>n(null),e)});return Promise.race([i,r]).then(n=>(clearTimeout(t),n))}function to(i){let e=new URL(i);const t=e.protocol==="https:";return e.protocol=t?"wss:":"ws:",e.host="",e.port!==""&&(e.port=String(Number(e.port)+1)),e.toString()}const qe=je(m(he),se(),i=>new he(i)),Pn=Jt([se(),u("base64")]),Or=je(m(C.Buffer),Pn,i=>C.Buffer.from(i[0],"base64")),Tn=30*1e3;function Un(i){return Ze([Q({jsonrpc:u("2.0"),id:se(),result:i}),Q({jsonrpc:u("2.0"),id:se(),error:Q({code:st(),message:se(),data:ye(Ge())})})])}const ro=Un(st());function Ie(i){return je(Un(i),ro,e=>"error"in e?e:{...e,result:x(e.result,i)})}function Ye(i){return Ie(Q({context:Q({slot:k()}),value:i}))}function fr(i){return Q({context:Q({slot:k()}),value:i})}const no=Q({foundation:k(),foundationTerm:k(),initial:k(),taper:k(),terminal:k()}),io=Ie(le(O(Q({epoch:k(),effectiveSlot:k(),amount:k(),postBalance:k()})))),so=Q({epoch:k(),slotIndex:k(),slotsInEpoch:k(),absoluteSlot:k(),blockHeight:ye(k()),transactionCount:ye(k())}),oo=Q({slotsPerEpoch:k(),leaderScheduleSlotOffset:k(),warmup:Je(),firstNormalEpoch:k(),firstNormalSlot:k()}),ao=De(se(),le(k())),It=O(Ze([Q({}),se()])),co=Q({err:It}),uo=u("receivedSignature"),fo=Q({"solana-core":se(),"feature-set":ye(k())}),lo=Ye(Q({err:O(Ze([Q({}),se()])),logs:O(le(se())),accounts:ye(O(le(Q({executable:Je(),owner:se(),lamports:k(),data:le(se()),rentEpoch:ye(k())})))),unitsConsumed:ye(k())}));function ho(i,e,t,r,n){let a;return r&&(a=async(E,A)=>{const z=await new Promise((q,J)=>{try{r(E,A,(ne,te)=>q([ne,te]))}catch(ne){J(ne)}});return await Bn(...z)}),new(V())(async(E,A)=>{const q={method:"POST",body:E,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{})};try{let J=5,ne,te=500;for(;a?ne=await a(i,q):ne=await Bn(i,q),!(ne.status!==429||n===!0||(J-=1,J===0));)console.log(`Server responded with ${ne.status} ${ne.statusText}. Retrying after ${te}ms delay...`),await cr(te),te*=2;const de=await ne.text();ne.ok?A(null,de):A(new Error(`${ne.status} ${ne.statusText}: ${de}`))}catch(J){J instanceof Error&&A(J)}finally{}},{})}function po(i){return(e,t)=>new Promise((r,n)=>{i.request(e,t,(a,d)=>{if(a){n(a);return}r(d)})})}function yo(i){return e=>new Promise((t,r)=>{e.length===0&&t([]);const n=e.map(a=>i.request(a.methodName,a.args));i.request(n,(a,d)=>{if(a){r(a);return}t(d)})})}const go=Ie(no),bo=Ie(so),mo=Ie(oo),wo=Ie(ao),Eo=Ie(k()),So=Ye(Q({total:k(),circulating:k(),nonCirculating:k(),nonCirculatingAccounts:le(qe)})),Nr=Q({amount:se(),uiAmount:O(k()),decimals:k(),uiAmountString:ye(se())}),vo=Ye(le(Q({address:qe,amount:se(),uiAmount:O(k()),decimals:k(),uiAmountString:ye(se())}))),ko=Ye(le(Q({pubkey:qe,account:Q({executable:Je(),owner:qe,lamports:k(),data:Or,rentEpoch:k()})}))),Lr=Q({program:se(),parsed:st(),space:k()}),_o=Ye(le(Q({pubkey:qe,account:Q({executable:Je(),owner:qe,lamports:k(),data:Lr,rentEpoch:k()})}))),Io=Ye(le(Q({lamports:k(),address:qe}))),lr=Q({executable:Je(),owner:qe,lamports:k(),data:Or,rentEpoch:k()}),Ao=Q({pubkey:qe,account:lr}),xo=je(Ze([m(C.Buffer),Lr]),Ze([Pn,Lr]),i=>Array.isArray(i)?x(i,Or):i),Fr=Q({executable:Je(),owner:qe,lamports:k(),data:xo,rentEpoch:k()}),Bo=Q({pubkey:qe,account:Fr}),Ro=Q({state:Ze([u("active"),u("inactive"),u("activating"),u("deactivating")]),active:k(),inactive:k()}),Po=Ie(le(Q({signature:se(),slot:k(),err:It,memo:O(se()),blockTime:ye(O(k()))}))),To=Ie(le(Q({signature:se(),slot:k(),err:It,memo:O(se()),blockTime:ye(O(k()))}))),Uo=Q({subscription:k(),result:fr(lr)}),Co=Q({pubkey:qe,account:lr}),Oo=Q({subscription:k(),result:fr(Co)}),No=Q({parent:k(),slot:k(),root:k()}),Lo=Q({subscription:k(),result:No}),Fo=Ze([Q({type:Ze([u("firstShredReceived"),u("completed"),u("optimisticConfirmation"),u("root")]),slot:k(),timestamp:k()}),Q({type:u("createdBank"),parent:k(),slot:k(),timestamp:k()}),Q({type:u("frozen"),slot:k(),timestamp:k(),stats:Q({numTransactionEntries:k(),numSuccessfulTransactions:k(),numFailedTransactions:k(),maxTransactionsPerEntry:k()})}),Q({type:u("dead"),slot:k(),timestamp:k(),err:se()})]),Do=Q({subscription:k(),result:Fo}),Ko=Q({subscription:k(),result:fr(Ze([co,uo]))}),zo=Q({subscription:k(),result:k()}),Wo=Q({pubkey:se(),gossip:O(se()),tpu:O(se()),rpc:O(se()),version:O(se())}),Cn=Q({votePubkey:se(),nodePubkey:se(),activatedStake:k(),epochVoteAccount:Je(),epochCredits:le(Jt([k(),k(),k()])),commission:k(),lastVote:k(),rootSlot:O(k())}),Mo=Ie(Q({current:le(Cn),delinquent:le(Cn)})),$o=Ze([u("processed"),u("confirmed"),u("finalized")]),jo=Q({slot:k(),confirmations:O(k()),err:It,confirmationStatus:ye($o)}),Vo=Ye(le(O(jo))),Go=Ie(k()),On=Q({signatures:le(se()),message:Q({accountKeys:le(se()),header:Q({numRequiredSignatures:k(),numReadonlySignedAccounts:k(),numReadonlyUnsignedAccounts:k()}),instructions:le(Q({accounts:le(k()),data:se(),programIdIndex:k()})),recentBlockhash:se()})}),Nn=Q({parsed:st(),program:se(),programId:qe}),Ln=Q({accounts:le(qe),data:se(),programId:qe}),Ho=Ze([Ln,Nn]),qo=Ze([Q({parsed:st(),program:se(),programId:se()}),Q({accounts:le(se()),data:se(),programId:se()})]),Fn=je(Ho,qo,i=>"accounts"in i?x(i,Ln):x(i,Nn)),Yo=Q({signatures:le(se()),message:Q({accountKeys:le(Q({pubkey:qe,signer:Je(),writable:Je()})),instructions:le(Fn),recentBlockhash:se()})}),hr=Q({accountIndex:k(),mint:se(),owner:ye(se()),uiTokenAmount:Nr}),Dn=Q({err:It,fee:k(),innerInstructions:ye(O(le(Q({index:k(),instructions:le(Q({accounts:le(k()),data:se(),programIdIndex:k()}))})))),preBalances:le(k()),postBalances:le(k()),logMessages:ye(O(le(se()))),preTokenBalances:ye(O(le(hr))),postTokenBalances:ye(O(le(hr)))}),Zo=Q({err:It,fee:k(),innerInstructions:ye(O(le(Q({index:k(),instructions:le(Fn)})))),preBalances:le(k()),postBalances:le(k()),logMessages:ye(O(le(se()))),preTokenBalances:ye(O(le(hr))),postTokenBalances:ye(O(le(hr)))}),Xo=Ie(O(Q({blockhash:se(),previousBlockhash:se(),parentSlot:k(),transactions:le(Q({transaction:On,meta:O(Dn)})),rewards:ye(le(Q({pubkey:se(),lamports:k(),postBalance:O(k()),rewardType:O(se())}))),blockTime:O(k())}))),Jo=Ie(O(Q({blockhash:se(),previousBlockhash:se(),parentSlot:k(),signatures:le(se()),blockTime:O(k())}))),Qo=Ie(O(Q({slot:k(),meta:Dn,blockTime:ye(O(k())),transaction:On}))),Kn=Ie(O(Q({slot:k(),transaction:Yo,meta:O(Zo),blockTime:ye(O(k()))}))),ea=Ye(Q({blockhash:se(),feeCalculator:Q({lamportsPerSignature:k()})})),ta=Q({slot:k(),numTransactions:k(),numSlots:k(),samplePeriodSecs:k()}),ra=Ie(le(ta)),na=Ye(O(Q({feeCalculator:Q({lamportsPerSignature:k()})}))),ia=Ie(se()),sa=Ie(se()),oa=Q({err:It,logs:le(se()),signature:se()}),aa=Q({result:fr(oa),subscription:k()});class ca{constructor(e,t){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._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={recentBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._accountChangeSubscriptionCounter=0,this._accountChangeSubscriptions={},this._programAccountChangeSubscriptionCounter=0,this._programAccountChangeSubscriptions={},this._rootSubscriptionCounter=0,this._rootSubscriptions={},this._signatureSubscriptionCounter=0,this._signatureSubscriptions={},this._slotSubscriptionCounter=0,this._slotSubscriptions={},this._logsSubscriptionCounter=0,this._logsSubscriptions={},this._slotUpdateSubscriptionCounter=0,this._slotUpdateSubscriptions={};let r=new URL(e);const n=r.protocol==="https:";let a,d,E,A;t&&typeof t=="string"?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,a=t.wsEndpoint,d=t.httpHeaders,E=t.fetchMiddleware,A=t.disableRetryOnRateLimit),this._rpcEndpoint=e,this._rpcWsEndpoint=a||to(e),this._rpcClient=ho(r.toString(),n,d,E,A),this._rpcRequest=po(this._rpcClient),this._rpcBatchRequest=yo(this._rpcClient),this._rpcWebSocket=new S.K(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}async getBalanceAndContext(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getBalance",r),a=x(n,Ye(k()));if("error"in a)throw new Error("failed to get balance for "+e.toBase58()+": "+a.error.message);return a.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+r)})}async getBlockTime(e){const t=await this._rpcRequest("getBlockTime",[e]),r=x(t,Ie(O(k())));if("error"in r)throw new Error("failed to get block time for slot "+e+": "+r.error.message);return r.result}async getMinimumLedgerSlot(){const e=await this._rpcRequest("minimumLedgerSlot",[]),t=x(e,Ie(k()));if("error"in t)throw new Error("failed to get minimum ledger slot: "+t.error.message);return t.result}async getFirstAvailableBlock(){const e=await this._rpcRequest("getFirstAvailableBlock",[]),t=x(e,Eo);if("error"in t)throw new Error("failed to get first available block: "+t.error.message);return t.result}async getSupply(e){let t={};typeof e=="string"?t={commitment:e}:e?t={...e,commitment:e&&e.commitment||this.commitment}:t={commitment:this.commitment};const r=await this._rpcRequest("getSupply",[t]),n=x(r,So);if("error"in n)throw new Error("failed to get supply: "+n.error.message);return n.result}async getTokenSupply(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenSupply",r),a=x(n,Ye(Nr));if("error"in a)throw new Error("failed to get token supply: "+a.error.message);return a.result}async getTokenAccountBalance(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenAccountBalance",r),a=x(n,Ye(Nr));if("error"in a)throw new Error("failed to get token account balance: "+a.error.message);return a.result}async getTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"base64"),d=await this._rpcRequest("getTokenAccountsByOwner",a),E=x(d,ko);if("error"in E)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+E.error.message);return E.result}async getParsedTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"jsonParsed"),d=await this._rpcRequest("getTokenAccountsByOwner",a),E=x(d,_o);if("error"in E)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+E.error.message);return E.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},r=t.filter||t.commitment?[t]:[],n=await this._rpcRequest("getLargestAccounts",r),a=x(n,Io);if("error"in a)throw new Error("failed to get largest accounts: "+a.error.message);return a.result}async getTokenLargestAccounts(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenLargestAccounts",r),a=x(n,vo);if("error"in a)throw new Error("failed to get token largest accounts: "+a.error.message);return a.result}async getAccountInfoAndContext(e,t){const r=this._buildArgs([e.toBase58()],t,"base64"),n=await this._rpcRequest("getAccountInfo",r),a=x(n,Ye(O(lr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getParsedAccountInfo(e,t){const r=this._buildArgs([e.toBase58()],t,"jsonParsed"),n=await this._rpcRequest("getAccountInfo",r),a=x(n,Ye(O(Fr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(r){throw new Error("failed to get info about account "+e.toBase58()+": "+r)}}async getMultipleAccountsInfo(e,t){const r=e.map(z=>z.toBase58());let n,a="base64";t&&(typeof t=="string"?(n=t,a="base64"):(n=t.commitment,a=t.encoding||"base64"));const d=this._buildArgs([r],n,a),E=await this._rpcRequest("getMultipleAccounts",d),A=x(E,Ye(le(O(Fr))));if("error"in A)throw new Error("failed to get info for accounts "+r+": "+A.error.message);return A.result.value}async getStakeActivation(e,t,r){const n=this._buildArgs([e.toBase58()],t,void 0,r!==void 0?{epoch:r}:void 0),a=await this._rpcRequest("getStakeActivation",n),d=x(a,Ie(Ro));if("error"in d)throw new Error(`failed to get Stake Activation ${e.toBase58()}: ${d.error.message}`);return d.result}async getProgramAccounts(e,t){const r={};let n,a;t&&(typeof t=="string"?n=t:(n=t.commitment,a=t.encoding,t.dataSlice&&(r.dataSlice=t.dataSlice),t.filters&&(r.filters=t.filters)));const d=this._buildArgs([e.toBase58()],n,a||"base64",r),E=await this._rpcRequest("getProgramAccounts",d),A=x(E,Ie(le(Ao)));if("error"in A)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+A.error.message);return A.result}async getParsedProgramAccounts(e,t){const r={};let n;t&&(typeof t=="string"?n=t:(n=t.commitment,t.filters&&(r.filters=t.filters)));const a=this._buildArgs([e.toBase58()],n,"jsonParsed",r),d=await this._rpcRequest("getProgramAccounts",a),E=x(d,Ie(le(Bo)));if("error"in E)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+E.error.message);return E.result}async confirmTransaction(e,t){let r;try{r=h().decode(e)}catch{throw new Error("signature must be base58 encoded: "+e)}He(r.length===64,"signature has invalid length");const n=Date.now(),a=t||this.commitment;let d,E=null;const A=new Promise((q,J)=>{try{d=this.onSignature(e,(ne,te)=>{d=void 0,E={context:te,value:ne},q(null)},a)}catch(ne){J(ne)}});let z=this._confirmTransactionInitialTimeout||60*1e3;switch(a){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{z=this._confirmTransactionInitialTimeout||30*1e3;break}}try{await eo(A,z)}finally{d&&this.removeSignatureListener(d)}if(E===null){const q=(Date.now()-n)/1e3;throw new Error(`Transaction was not confirmed in ${q.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`)}return E}async getClusterNodes(){const e=await this._rpcRequest("getClusterNodes",[]),t=x(e,Ie(le(Wo)));if("error"in t)throw new Error("failed to get cluster nodes: "+t.error.message);return t.result}async getVoteAccounts(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getVoteAccounts",t),n=x(r,Mo);if("error"in n)throw new Error("failed to get vote accounts: "+n.error.message);return n.result}async getSlot(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlot",t),n=x(r,Ie(k()));if("error"in n)throw new Error("failed to get slot: "+n.error.message);return n.result}async getSlotLeader(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlotLeader",t),n=x(r,Ie(se()));if("error"in n)throw new Error("failed to get slot leader: "+n.error.message);return n.result}async getSlotLeaders(e,t){const r=[e,t],n=await this._rpcRequest("getSlotLeaders",r),a=x(n,Ie(le(qe)));if("error"in a)throw new Error("failed to get slot leaders: "+a.error.message);return a.result}async getSignatureStatus(e,t){const{context:r,value:n}=await this.getSignatureStatuses([e],t);He(n.length===1);const a=n[0];return{context:r,value:a}}async getSignatureStatuses(e,t){const r=[e];t&&r.push(t);const n=await this._rpcRequest("getSignatureStatuses",r),a=x(n,Vo);if("error"in a)throw new Error("failed to get signature status: "+a.error.message);return a.result}async getTransactionCount(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getTransactionCount",t),n=x(r,Ie(k()));if("error"in n)throw new Error("failed to get transaction count: "+n.error.message);return n.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getInflationGovernor",t),n=x(r,go);if("error"in n)throw new Error("failed to get inflation: "+n.error.message);return n.result}async getInflationReward(e,t,r){const n=this._buildArgs([e.map(E=>E.toBase58())],r,void 0,{epoch:t}),a=await this._rpcRequest("getInflationReward",n),d=x(a,io);if("error"in d)throw new Error("failed to get inflation reward: "+d.error.message);return d.result}async getEpochInfo(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getEpochInfo",t),n=x(r,bo);if("error"in n)throw new Error("failed to get epoch info: "+n.error.message);return n.result}async getEpochSchedule(){const e=await this._rpcRequest("getEpochSchedule",[]),t=x(e,mo);if("error"in t)throw new Error("failed to get epoch schedule: "+t.error.message);const r=t.result;return new Rn(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot)}async getLeaderSchedule(){const e=await this._rpcRequest("getLeaderSchedule",[]),t=x(e,wo);if("error"in t)throw new Error("failed to get leader schedule: "+t.error.message);return t.result}async getMinimumBalanceForRentExemption(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getMinimumBalanceForRentExemption",r),a=x(n,Go);return"error"in a?(console.warn("Unable to fetch minimum balance for rent exemption"),0):a.result}async getRecentBlockhashAndContext(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getRecentBlockhash",t),n=x(r,ea);if("error"in n)throw new Error("failed to get recent blockhash: "+n.error.message);return n.result}async getRecentPerformanceSamples(e){const t=this._buildArgs(e?[e]:[]),r=await this._rpcRequest("getRecentPerformanceSamples",t),n=x(r,ra);if("error"in n)throw new Error("failed to get recent performance samples: "+n.error.message);return n.result}async getFeeCalculatorForBlockhash(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getFeeCalculatorForBlockhash",r),a=x(n,na);if("error"in a)throw new Error("failed to get fee calculator: "+a.error.message);const{context:d,value:E}=a.result;return{context:d,value:E!==null?E.feeCalculator:null}}async getFeeForMessage(e,t){const r=e.serialize().toString("base64"),n=this._buildArgs([r],t),a=await this._rpcRequest("getFeeForMessage",n),d=x(a,Ye(O(k())));if("error"in d)throw new Error("failed to get slot: "+d.error.message);if(d.result===null)throw new Error("invalid blockhash");return d.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getVersion(){const e=await this._rpcRequest("getVersion",[]),t=x(e,Ie(fo));if("error"in t)throw new Error("failed to get version: "+t.error.message);return t.result}async getGenesisHash(){const e=await this._rpcRequest("getGenesisHash",[]),t=x(e,Ie(se()));if("error"in t)throw new Error("failed to get genesis hash: "+t.error.message);return t.result}async getBlock(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedBlock",r),a=x(n,Xo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;return d&&{...d,transactions:d.transactions.map(({transaction:E,meta:A})=>{const z=new vt(E.message);return{meta:A,transaction:{...E,message:z}}})}}async getTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedTransaction",r),a=x(n,Qo);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);const d=a.result;return d&&{...d,transaction:{...d.transaction,message:new vt(d.transaction.message)}}}async getConfirmedBlock(e,t){const r=await this.getBlock(e,{commitment:t});if(!r)throw new Error("Confirmed block "+e+" not found");return{...r,transactions:r.transactions.map(({transaction:n,meta:a})=>({meta:a,transaction:Ce.populate(n.message,n.signatures)}))}}async getBlocks(e,t,r){const n=this._buildArgsAtLeastConfirmed(t!==void 0?[e,t]:[e],r),a=await this._rpcRequest("getConfirmedBlocks",n),d=x(a,Ie(le(k())));if("error"in d)throw new Error("failed to get blocks: "+d.error.message);return d.result}async getConfirmedBlockSignatures(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=await this._rpcRequest("getConfirmedBlock",r),a=x(n,Jo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;if(!d)throw new Error("Confirmed block "+e+" not found");return d}async getConfirmedTransaction(e,t){const r=await this.getTransaction(e,{commitment:t});if(!r)return r;const{message:n,signatures:a}=r.transaction;return{...r,transaction:Ce.populate(n,a)}}async getParsedConfirmedTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),n=await this._rpcRequest("getConfirmedTransaction",r),a=x(n,Kn);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);return a.result}async getParsedConfirmedTransactions(e,t){const r=e.map(d=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([d],t,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(d=>{const E=x(d,Kn);if("error"in E)throw new Error("failed to get confirmed transactions: "+E.error.message);return E.result})}async getConfirmedSignaturesForAddress(e,t,r){let n={},a=await this.getFirstAvailableBlock();for(;!("until"in n)&&(t--,!(t<=0||t<a));)try{const A=await this.getConfirmedBlockSignatures(t,"finalized");A.signatures.length>0&&(n.until=A.signatures[A.signatures.length-1].toString())}catch(A){if(A instanceof Error&&A.message.includes("skipped"))continue;throw A}let d=await this.getSlot("finalized");for(;!("before"in n)&&(r++,!(r>d));)try{const A=await this.getConfirmedBlockSignatures(r);A.signatures.length>0&&(n.before=A.signatures[A.signatures.length-1].toString())}catch(A){if(A instanceof Error&&A.message.includes("skipped"))continue;throw A}return(await this.getConfirmedSignaturesForAddress2(e,n)).map(A=>A.signature)}async getConfirmedSignaturesForAddress2(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getConfirmedSignaturesForAddress2",n),d=x(a,Po);if("error"in d)throw new Error("failed to get confirmed signatures for address: "+d.error.message);return d.result}async getSignaturesForAddress(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getSignaturesForAddress",n),d=x(a,To);if("error"in d)throw new Error("failed to get signatures for address: "+d.error.message);return d.result}async getNonceAndContext(e,t){const{context:r,value:n}=await this.getAccountInfoAndContext(e,t);let a=null;return n!==null&&(a=ur.fromAccountData(n.data)),{context:r,value:a}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+r)})}async requestAirdrop(e,t){const r=await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),n=x(r,ia);if("error"in n)throw new Error("airdrop to "+e.toBase58()+" failed: "+n.error.message);return n.result}async _recentBlockhash(e){if(!e){for(;this._pollingBlockhash;)await cr(100);const r=Date.now()-this._blockhashInfo.lastFetch>=Tn;if(this._blockhashInfo.recentBlockhash!==null&&!r)return this._blockhashInfo.recentBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now();for(let t=0;t<50;t++){const{blockhash:r}=await this.getRecentBlockhash("finalized");if(this._blockhashInfo.recentBlockhash!=r)return this._blockhashInfo={recentBlockhash:r,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},r;await cr(Qs/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(e,t,r){let n;if(e instanceof Ce?n=e:n=Ce.populate(e),n.nonceInfo&&t)n.sign(...t);else{let te=this._disableBlockhashCaching;for(;n.recentBlockhash=await this._recentBlockhash(te),!!t;){if(n.sign(...t),!n.signature)throw new Error("!signature");const de=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(de)&&!this._blockhashInfo.transactionSignatures.includes(de)){this._blockhashInfo.simulatedSignatures.push(de);break}else te=!0}}const a=n._compile(),d=a.serialize(),A=n._serialize(d).toString("base64"),z={encoding:"base64",commitment:this.commitment};if(r){const te=(Array.isArray(r)?r:a.nonProgramIds()).map(de=>de.toBase58());z.accounts={encoding:"base64",addresses:te}}t&&(z.sigVerify=!0);const q=[A,z],J=await this._rpcRequest("simulateTransaction",q),ne=x(J,lo);if("error"in ne){let te;if("data"in ne.error&&(te=ne.error.data.logs,te&&Array.isArray(te))){const de=`
|
|
114
|
+
`,pe=de+te.join(de);console.error(ne.error.message,pe)}throw new Cr("failed to simulate transaction: "+ne.error.message,te)}return ne.result}async sendTransaction(e,t,r){if(e.nonceInfo)e.sign(...t);else{let a=this._disableBlockhashCaching;for(;;){if(e.recentBlockhash=await this._recentBlockhash(a),e.sign(...t),!e.signature)throw new Error("!signature");const d=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(d))a=!0;else{this._blockhashInfo.transactionSignatures.push(d);break}}}const n=e.serialize();return await this.sendRawTransaction(n,r)}async sendRawTransaction(e,t){const r=ce(e).toString("base64");return await this.sendEncodedTransaction(r,t)}async sendEncodedTransaction(e,t){const r={encoding:"base64"},n=t&&t.skipPreflight,a=t&&t.preflightCommitment||this.commitment;n&&(r.skipPreflight=n),a&&(r.preflightCommitment=a);const d=[e,r],E=await this._rpcRequest("sendTransaction",d),A=x(E,sa);if("error"in A){let z;if("data"in A.error&&(z=A.error.data.logs,z&&Array.isArray(z))){const q=`
|
|
115
|
+
`,J=q+z.join(q);console.error(A.error.message,J)}throw new Cr("failed to send transaction: "+A.error.message,z)}return A.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{this._rpcWebSocket.notify("ping").catch(()=>{})},5e3),this._updateSubscriptions()}_wsOnError(e){console.error("ws error:",e.message)}_wsOnClose(e){if(this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),e===1e3){this._updateSubscriptions();return}this._resetSubscriptions()}async _subscribe(e,t,r){if(e.subscriptionId==null){e.subscriptionId="subscribing";try{const n=await this._rpcWebSocket.call(t,r);typeof n=="number"&&e.subscriptionId==="subscribing"&&(e.subscriptionId=n)}catch(n){e.subscriptionId==="subscribing"&&(e.subscriptionId=null),n instanceof Error&&console.error(`${t} error for argument`,r,n.message)}}}async _unsubscribe(e,t){const r=e.subscriptionId;if(r!=null&&typeof r!="string"){const n=r;try{await this._rpcWebSocket.call(t,[n])}catch(a){a instanceof Error&&console.error(`${t} error:`,a.message)}}}_resetSubscriptions(){Object.values(this._accountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._programAccountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._rootSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._signatureSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotUpdateSubscriptions).forEach(e=>e.subscriptionId=null)}_updateSubscriptions(){const e=Object.keys(this._accountChangeSubscriptions).map(Number),t=Object.keys(this._programAccountChangeSubscriptions).map(Number),r=Object.keys(this._slotSubscriptions).map(Number),n=Object.keys(this._slotUpdateSubscriptions).map(Number),a=Object.keys(this._signatureSubscriptions).map(Number),d=Object.keys(this._rootSubscriptions).map(Number),E=Object.keys(this._logsSubscriptions).map(Number);if(e.length===0&&t.length===0&&r.length===0&&n.length===0&&a.length===0&&d.length===0&&E.length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null,this._rpcWebSocket.close()},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}for(let A of e){const z=this._accountChangeSubscriptions[A];this._subscribe(z,"accountSubscribe",this._buildArgs([z.publicKey],z.commitment,"base64"))}for(let A of t){const z=this._programAccountChangeSubscriptions[A];this._subscribe(z,"programSubscribe",this._buildArgs([z.programId],z.commitment,"base64",{filters:z.filters}))}for(let A of r){const z=this._slotSubscriptions[A];this._subscribe(z,"slotSubscribe",[])}for(let A of n){const z=this._slotUpdateSubscriptions[A];this._subscribe(z,"slotsUpdatesSubscribe",[])}for(let A of a){const z=this._signatureSubscriptions[A],q=[z.signature];z.options&&q.push(z.options),this._subscribe(z,"signatureSubscribe",q)}for(let A of d){const z=this._rootSubscriptions[A];this._subscribe(z,"rootSubscribe",[])}for(let A of E){const z=this._logsSubscriptions[A];let q;typeof z.filter=="object"?q={mentions:[z.filter.toString()]}:q=z.filter,this._subscribe(z,"logsSubscribe",this._buildArgs([q],z.commitment))}}_wsOnAccountNotification(e){const t=x(e,Uo);for(const r of Object.values(this._accountChangeSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result.value,t.result.context);return}}onAccountChange(e,t,r){const n=++this._accountChangeSubscriptionCounter;return this._accountChangeSubscriptions[n]={publicKey:e.toBase58(),callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeAccountChangeListener(e){if(this._accountChangeSubscriptions[e]){const t=this._accountChangeSubscriptions[e];delete this._accountChangeSubscriptions[e],await this._unsubscribe(t,"accountUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown account change id: ${e}`)}_wsOnProgramAccountNotification(e){const t=x(e,Oo);for(const r of Object.values(this._programAccountChangeSubscriptions))if(r.subscriptionId===t.subscription){const{value:n,context:a}=t.result;r.callback({accountId:n.pubkey,accountInfo:n.account},a);return}}onProgramAccountChange(e,t,r,n){const a=++this._programAccountChangeSubscriptionCounter;return this._programAccountChangeSubscriptions[a]={programId:e.toBase58(),callback:t,commitment:r,subscriptionId:null,filters:n},this._updateSubscriptions(),a}async removeProgramAccountChangeListener(e){if(this._programAccountChangeSubscriptions[e]){const t=this._programAccountChangeSubscriptions[e];delete this._programAccountChangeSubscriptions[e],await this._unsubscribe(t,"programUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown program account change id: ${e}`)}onLogs(e,t,r){const n=++this._logsSubscriptionCounter;return this._logsSubscriptions[n]={filter:e,callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeOnLogsListener(e){if(!this._logsSubscriptions[e])throw new Error(`Unknown logs id: ${e}`);const t=this._logsSubscriptions[e];delete this._logsSubscriptions[e],await this._unsubscribe(t,"logsUnsubscribe"),this._updateSubscriptions()}_wsOnLogsNotification(e){const t=x(e,aa),r=Object.keys(this._logsSubscriptions).map(Number);for(let n of r){const a=this._logsSubscriptions[n];if(a.subscriptionId===t.subscription){a.callback(t.result.value,t.result.context);return}}}_wsOnSlotNotification(e){const t=x(e,Lo);for(const r of Object.values(this._slotSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotChange(e){const t=++this._slotSubscriptionCounter;return this._slotSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotChangeListener(e){if(this._slotSubscriptions[e]){const t=this._slotSubscriptions[e];delete this._slotSubscriptions[e],await this._unsubscribe(t,"slotUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot change id: ${e}`)}_wsOnSlotUpdatesNotification(e){const t=x(e,Do);for(const r of Object.values(this._slotUpdateSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotUpdate(e){const t=++this._slotUpdateSubscriptionCounter;return this._slotUpdateSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotUpdateListener(e){if(this._slotUpdateSubscriptions[e]){const t=this._slotUpdateSubscriptions[e];delete this._slotUpdateSubscriptions[e],await this._unsubscribe(t,"slotsUpdatesUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot update id: ${e}`)}_buildArgs(e,t,r,n){const a=t||this._commitment;if(a||r||n){let d={};r&&(d.encoding=r),a&&(d.commitment=a),n&&(d=Object.assign(d,n)),e.push(d)}return e}_buildArgsAtLeastConfirmed(e,t,r,n){const a=t||this._commitment;if(a&&!["confirmed","finalized"].includes(a))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,r,n)}_wsOnSignatureNotification(e){const t=x(e,Ko);for(const[r,n]of Object.entries(this._signatureSubscriptions))if(n.subscriptionId===t.subscription){t.result.value==="receivedSignature"?n.callback({type:"received"},t.result.context):(delete this._signatureSubscriptions[Number(r)],this._updateSubscriptions(),n.callback({type:"status",result:t.result.value},t.result.context));return}}onSignature(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:(a,d)=>{a.type==="status"&&t(a.result,d)},options:{commitment:r},subscriptionId:null},this._updateSubscriptions(),n}onSignatureWithOptions(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:t,options:r,subscriptionId:null},this._updateSubscriptions(),n}async removeSignatureListener(e){if(this._signatureSubscriptions[e]){const t=this._signatureSubscriptions[e];delete this._signatureSubscriptions[e],await this._unsubscribe(t,"signatureUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown signature result id: ${e}`)}_wsOnRootNotification(e){const t=x(e,zo);for(const r of Object.values(this._rootSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onRootChange(e){const t=++this._rootSubscriptionCounter;return this._rootSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeRootChangeListener(e){if(this._rootSubscriptions[e]){const t=this._rootSubscriptions[e];delete this._rootSubscriptions[e],await this._unsubscribe(t,"rootUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown root change id: ${e}`)}}class Dt{constructor(e){this._keypair=void 0,e?this._keypair=e:this._keypair=X().sign.keyPair()}static generate(){return new Dt(X().sign.keyPair())}static fromSecretKey(e,t){const r=X().sign.keyPair.fromSecretKey(e);if(!t||!t.skipValidation){const a=new TextEncoder().encode("@solana/web3.js-validation-v1"),d=X().sign.detached(a,r.secretKey);if(!X().sign.detached.verify(a,d,r.publicKey))throw new Error("provided secretKey is invalid")}return new Dt(r)}static fromSeed(e){return new Dt(X().sign.keyPair.fromSeed(e))}get publicKey(){return new he(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const zn=64,Wn=32,Mn=64,$n=f.struct([f.u8("numSignatures"),f.u8("padding"),f.u16("signatureOffset"),f.u16("signatureInstructionIndex"),f.u16("publicKeyOffset"),f.u16("publicKeyInstructionIndex"),f.u16("messageDataOffset"),f.u16("messageDataSize"),f.u16("messageInstructionIndex")]);class dr{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,instructionIndex:a}=e;He(t.length===Wn,`Public Key must be ${Wn} bytes but received ${t.length} bytes`),He(n.length===Mn,`Signature must be ${Mn} bytes but received ${n.length} bytes`);const d=$n.span,E=d+t.length,A=E+n.length,z=1,q=C.Buffer.alloc(A+r.length);return $n.encode({numSignatures:z,padding:0,signatureOffset:E,signatureInstructionIndex:a,publicKeyOffset:d,publicKeyInstructionIndex:a,messageDataOffset:A,messageDataSize:r.length,messageInstructionIndex:a},q),q.fill(t,d),q.fill(n,E),q.fill(r,A),new Xe({keys:[],programId:dr.programId,data:q})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;He(t.length===zn,`Private key must be ${zn} bytes but received ${t.length} bytes`);try{const a=Dt.fromSecretKey(t),d=a.publicKey.toBytes(),E=X().sign.detached(r,a.secretKey);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:E,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}dr.programId=new he("Ed25519SigVerify111111111111111111111111111");const jn=new he("StakeConfig11111111111111111111111111111111");class Vn{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class Zt{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}}Zt.default=new Zt(0,0,he.default);class ua{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=f.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(Ve))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t,lockup:r}=ze(Ve.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new Vn(new he(t.staker),new he(t.withdrawer)),lockup:new Zt(r.unixTimestamp,r.epoch,new he(r.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),ze(Ve.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);const{newAuthorized:t,stakeAuthorizationType:r}=ze(Ve.Authorize,e.data),n={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new he(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(n.custodianPubkey=e.keys[3].pubkey),n}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:t,stakeAuthorizationType:r,authoritySeed:n,authorityOwner:a}=ze(Ve.AuthorizeWithSeed,e.data),d={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:n,authorityOwner:new he(a),newAuthorizedPubkey:new he(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(d.custodianPubkey=e.keys[3].pubkey),d}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=ze(Ve.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),ze(Ve.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);const{lamports:t}=ze(Ve.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),ze(Ve.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(pr.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const Ve=Object.freeze({Initialize:{index:0,layout:f.struct([f.u32("instruction"),Ks(),zs()])},Authorize:{index:1,layout:f.struct([f.u32("instruction"),Te("newAuthorized"),f.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:f.struct([f.u32("instruction")])},Split:{index:3,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},Withdraw:{index:4,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},Deactivate:{index:5,layout:f.struct([f.u32("instruction")])},Merge:{index:7,layout:f.struct([f.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:f.struct([f.u32("instruction"),Te("newAuthorized"),f.u32("stakeAuthorizationType"),Lt("authoritySeed"),Te("authorityOwner")])}}),fa=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class pr{constructor(){}static initialize(e){const{stakePubkey:t,authorized:r,lockup:n}=e,a=n||Zt.default,d=Ve.Initialize,E=Ke(d,{authorized:{staker:ce(r.staker.toBuffer()),withdrawer:ce(r.withdrawer.toBuffer())},lockup:{unixTimestamp:a.unixTimestamp,epoch:a.epoch,custodian:ce(a.custodian.toBuffer())}}),A={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:qt,isSigner:!1,isWritable:!1}],programId:this.programId,data:E};return new Xe(A)}static createAccountWithSeed(e){const t=new Ce;t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static createAccount(e){const t=new Ce;t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:r,votePubkey:n}=e,a=Ve.Delegate,d=Ke(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:jn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static authorize(e){const{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:a,custodianPubkey:d}=e,E=Ve.Authorize,A=Ke(E,{newAuthorized:ce(n.toBuffer()),stakeAuthorizationType:a.index}),z=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&z.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:z,programId:this.programId,data:A})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:r,authoritySeed:n,authorityOwner:a,newAuthorizedPubkey:d,stakeAuthorizationType:E,custodianPubkey:A}=e,z=Ve.AuthorizeWithSeed,q=Ke(z,{newAuthorized:ce(d.toBuffer()),stakeAuthorizationType:E.index,authoritySeed:n,authorityOwner:ce(a.toBuffer())}),J=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:kt,isSigner:!1,isWritable:!1}];return A&&J.push({pubkey:A,isSigner:!1,isWritable:!1}),new Ce().add({keys:J,programId:this.programId,data:q})}static split(e){const{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:n,lamports:a}=e,d=new Ce;d.add(et.createAccount({fromPubkey:r,newAccountPubkey:n,lamports:0,space:this.space,programId:this.programId}));const E=Ve.Split,A=Ke(E,{lamports:a});return d.add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:A})}static merge(e){const{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:n}=e,a=Ve.Merge,d=Ke(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:r,toPubkey:n,lamports:a,custodianPubkey:d}=e,E=Ve.Withdraw,A=Ke(E,{lamports:a}),z=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&z.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:z,programId:this.programId,data:A})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:r}=e,n=Ve.Deactivate,a=Ke(n);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:kt,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}}pr.programId=new he("Stake11111111111111111111111111111111111111"),pr.space=200;const{publicKeyCreate:la,ecdsaSign:ha}=Ue(),Gn=32,Dr=20,Hn=64,da=11,Kr=f.struct([f.u8("numSignatures"),f.u16("signatureOffset"),f.u8("signatureInstructionIndex"),f.u16("ethAddressOffset"),f.u8("ethAddressInstructionIndex"),f.u16("messageDataOffset"),f.u16("messageDataSize"),f.u8("messageInstructionIndex"),f.blob(20,"ethAddress"),f.blob(64,"signature"),f.u8("recoveryId")]);class Kt{constructor(){}static publicKeyToEthAddress(e){He(e.length===Hn,`Public key must be ${Hn} bytes but received ${e.length} bytes`);try{return C.Buffer.from(Pe().keccak_256.update(ce(e)).digest()).slice(-Dr)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,recoveryId:a,instructionIndex:d}=e;return Kt.createInstructionWithEthAddress({ethAddress:Kt.publicKeyToEthAddress(t),message:r,signature:n,recoveryId:a,instructionIndex:d})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:r,signature:n,recoveryId:a,instructionIndex:d=0}=e;let E;typeof t=="string"?t.startsWith("0x")?E=C.Buffer.from(t.substr(2),"hex"):E=C.Buffer.from(t,"hex"):E=t,He(E.length===Dr,`Address must be ${Dr} bytes but received ${E.length} bytes`);const A=1+da,z=A,q=A+E.length,J=q+n.length+1,ne=1,te=C.Buffer.alloc(Kr.span+r.length);return Kr.encode({numSignatures:ne,signatureOffset:q,signatureInstructionIndex:d,ethAddressOffset:z,ethAddressInstructionIndex:d,messageDataOffset:J,messageDataSize:r.length,messageInstructionIndex:d,signature:ce(n),ethAddress:ce(E),recoveryId:a},te),te.fill(ce(r),Kr.span),new Xe({keys:[],programId:Kt.programId,data:te})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;He(t.length===Gn,`Private key must be ${Gn} bytes but received ${t.length} bytes`);try{const a=ce(t),d=la(a,!1).slice(1),E=C.Buffer.from(Pe().keccak_256.update(ce(r)).digest()),{signature:A,recid:z}=ha(E,a);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:A,recoveryId:z,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}Kt.programId=new he("KeccakSecp256k11111111111111111111111111111");const qn=new he("Va1idator1nfo111111111111111111111111111111"),pa=Q({name:se(),website:ye(se()),details:ye(se()),keybaseUsername:ye(se())});class zr{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let r=[...e];if(Ft(r)!==2)return null;const a=[];for(let d=0;d<2;d++){const E=new he(r.slice(0,32));r=r.slice(32);const A=r.slice(0,1)[0]===1;r=r.slice(1),a.push({publicKey:E,isSigner:A})}if(a[0].publicKey.equals(qn)&&a[1].isSigner){const d=Lt().decode(C.Buffer.from(r)),E=JSON.parse(d);return ae(E,pa),new zr(a[1].publicKey,E)}return null}}const ya=new he("Vote111111111111111111111111111111111111111"),ga=f.struct([Te("nodePubkey"),Te("authorizedWithdrawer"),f.u8("commission"),f.nu64(),f.seq(f.struct([f.nu64("slot"),f.u32("confirmationCount")]),f.offset(f.u32(),-8),"votes"),f.u8("rootSlotValid"),f.nu64("rootSlot"),f.nu64(),f.seq(f.struct([f.nu64("epoch"),Te("authorizedVoter")]),f.offset(f.u32(),-8),"authorizedVoters"),f.struct([f.seq(f.struct([Te("authorizedPubkey"),f.nu64("epochOfLastAuthorizedSwitch"),f.nu64("targetEpoch")]),32,"buf"),f.nu64("idx"),f.u8("isEmpty")],"priorVoters"),f.nu64(),f.seq(f.struct([f.nu64("epoch"),f.nu64("credits"),f.nu64("prevCredits")]),f.offset(f.u32(),-8),"epochCredits"),f.struct([f.nu64("slot"),f.nu64("timestamp")],"lastTimestamp")]);class Wr{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){const r=ga.decode(ce(e),4);let n=r.rootSlot;return r.rootSlotValid||(n=null),new Wr({nodePubkey:new he(r.nodePubkey),authorizedWithdrawer:new he(r.authorizedWithdrawer),commission:r.commission,votes:r.votes,rootSlot:n,authorizedVoters:r.authorizedVoters.map(ba),priorVoters:wa(r.priorVoters),epochCredits:r.epochCredits,lastTimestamp:r.lastTimestamp})}}function ba({epoch:i,authorizedVoter:e}){return{epoch:i,authorizedVoter:new he(e)}}function ma({authorizedPubkey:i,epochOfLastAuthorizedSwitch:e,targetEpoch:t}){return{authorizedPubkey:new he(i),epochOfLastAuthorizedSwitch:e,targetEpoch:t}}function wa({buf:i,idx:e,isEmpty:t}){return t?[]:[...i.slice(e+1).map(ma),...i.slice(0,e)]}async function Ea(i,e,t){const r=t&&{skipPreflight:t.skipPreflight,preflightCommitment:t.preflightCommitment||t.commitment},n=await i.sendRawTransaction(e,r),a=(await i.confirmTransaction(n,t&&t.commitment)).value;if(a.err)throw new Error(`Raw transaction ${n} failed (${JSON.stringify(a)})`);return n}const Yn={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"}};function Sa(i,e){const t=e===!1?"http":"https";if(!i)return Yn[t].devnet;const r=Yn[t][i];if(!r)throw new Error(`Unknown ${t} cluster: ${i}`);return r}const va=1e9},75134:function(Ae,g,K){Ae.exports=K(81003)(K(44027))},44027:function(Ae,g,K){const M=K(86266).ec,X=new M("secp256k1"),C=X.curve,W=C.n.constructor;function N(f,T){let I=new W(T);if(I.cmp(C.p)>=0)return null;I=I.toRed(C.red);let F=I.redSqr().redIMul(I).redIAdd(C.b).redSqrt();return f===3!==F.isOdd()&&(F=F.redNeg()),X.keyPair({pub:{x:I,y:F}})}function _(f,T,I){let F=new W(T),B=new W(I);if(F.cmp(C.p)>=0||B.cmp(C.p)>=0||(F=F.toRed(C.red),B=B.toRed(C.red),(f===6||f===7)&&B.isOdd()!==(f===7)))return null;const w=F.redSqr().redIMul(F);return B.redSqr().redISub(w.redIAdd(C.b)).isZero()?X.keyPair({pub:{x:F,y:B}}):null}function h(f){const T=f[0];switch(T){case 2:case 3:return f.length!==33?null:N(T,f.subarray(1,33));case 4:case 6:case 7:return f.length!==65?null:_(T,f.subarray(1,33),f.subarray(33,65));default:return null}}function v(f,T){const I=T.encode(null,f.length===33);for(let F=0;F<f.length;++F)f[F]=I[F]}Ae.exports={contextRandomize(){return 0},privateKeyVerify(f){const T=new W(f);return T.cmp(C.n)<0&&!T.isZero()?0:1},privateKeyNegate(f){const T=new W(f),I=C.n.sub(T).umod(C.n).toArrayLike(Uint8Array,"be",32);return f.set(I),0},privateKeyTweakAdd(f,T){const I=new W(T);if(I.cmp(C.n)>=0||(I.iadd(new W(f)),I.cmp(C.n)>=0&&I.isub(C.n),I.isZero()))return 1;const F=I.toArrayLike(Uint8Array,"be",32);return f.set(F),0},privateKeyTweakMul(f,T){let I=new W(T);if(I.cmp(C.n)>=0||I.isZero())return 1;I.imul(new W(f)),I.cmp(C.n)>=0&&(I=I.umod(C.n));const F=I.toArrayLike(Uint8Array,"be",32);return f.set(F),0},publicKeyVerify(f){return h(f)===null?1:0},publicKeyCreate(f,T){const I=new W(T);if(I.cmp(C.n)>=0||I.isZero())return 1;const F=X.keyFromPrivate(T).getPublic();return v(f,F),0},publicKeyConvert(f,T){const I=h(T);if(I===null)return 1;const F=I.getPublic();return v(f,F),0},publicKeyNegate(f,T){const I=h(T);if(I===null)return 1;const F=I.getPublic();return F.y=F.y.redNeg(),v(f,F),0},publicKeyCombine(f,T){const I=new Array(T.length);for(let B=0;B<T.length;++B)if(I[B]=h(T[B]),I[B]===null)return 1;let F=I[0].getPublic();for(let B=1;B<I.length;++B)F=F.add(I[B].pub);return F.isInfinity()?2:(v(f,F),0)},publicKeyTweakAdd(f,T,I){const F=h(T);if(F===null)return 1;if(I=new W(I),I.cmp(C.n)>=0)return 2;const B=F.getPublic().add(C.g.mul(I));return B.isInfinity()?2:(v(f,B),0)},publicKeyTweakMul(f,T,I){const F=h(T);if(F===null)return 1;if(I=new W(I),I.cmp(C.n)>=0||I.isZero())return 2;const B=F.getPublic().mul(I);return v(f,B),0},signatureNormalize(f){const T=new W(f.subarray(0,32)),I=new W(f.subarray(32,64));return T.cmp(C.n)>=0||I.cmp(C.n)>=0?1:(I.cmp(X.nh)===1&&f.set(C.n.sub(I).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(f,T){const I=T.subarray(0,32),F=T.subarray(32,64);if(new W(I).cmp(C.n)>=0||new W(F).cmp(C.n)>=0)return 1;const{output:B}=f;let w=B.subarray(4,4+33);w[0]=0,w.set(I,1);let U=33,D=0;for(;U>1&&w[D]===0&&!(w[D+1]&128);--U,++D);if(w=w.subarray(D),w[0]&128||U>1&&w[0]===0&&!(w[1]&128))return 1;let R=B.subarray(6+33,6+33+33);R[0]=0,R.set(F,1);let G=33,H=0;for(;G>1&&R[H]===0&&!(R[H+1]&128);--G,++H);return R=R.subarray(H),R[0]&128||G>1&&R[0]===0&&!(R[1]&128)?1:(f.outputlen=6+U+G,B[0]=48,B[1]=f.outputlen-2,B[2]=2,B[3]=w.length,B.set(w,4),B[4+U]=2,B[5+U]=R.length,B.set(R,6+U),0)},signatureImport(f,T){if(T.length<8||T.length>72||T[0]!==48||T[1]!==T.length-2||T[2]!==2)return 1;const I=T[3];if(I===0||5+I>=T.length||T[4+I]!==2)return 1;const F=T[5+I];if(F===0||6+I+F!==T.length||T[4]&128||I>1&&T[4]===0&&!(T[5]&128)||T[I+6]&128||F>1&&T[I+6]===0&&!(T[I+7]&128))return 1;let B=T.subarray(4,4+I);if(B.length===33&&B[0]===0&&(B=B.subarray(1)),B.length>32)return 1;let w=T.subarray(6+I);if(w.length===33&&w[0]===0&&(w=w.slice(1)),w.length>32)throw new Error("S length is too long");let U=new W(B);U.cmp(C.n)>=0&&(U=new W(0));let D=new W(T.subarray(6+I));return D.cmp(C.n)>=0&&(D=new W(0)),f.set(U.toArrayLike(Uint8Array,"be",32),0),f.set(D.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(f,T,I,F,B){if(B){const D=B;B=R=>{const G=D(T,I,null,F,R);if(!(G instanceof Uint8Array&&G.length===32))throw new Error("This is the way");return new W(G)}}const w=new W(I);if(w.cmp(C.n)>=0||w.isZero())return 1;let U;try{U=X.sign(T,I,{canonical:!0,k:B,pers:F})}catch{return 1}return f.signature.set(U.r.toArrayLike(Uint8Array,"be",32),0),f.signature.set(U.s.toArrayLike(Uint8Array,"be",32),32),f.recid=U.recoveryParam,0},ecdsaVerify(f,T,I){const F={r:f.subarray(0,32),s:f.subarray(32,64)},B=new W(F.r),w=new W(F.s);if(B.cmp(C.n)>=0||w.cmp(C.n)>=0)return 1;if(w.cmp(X.nh)===1||B.isZero()||w.isZero())return 3;const U=h(I);if(U===null)return 2;const D=U.getPublic();return X.verify(T,F,D)?0:3},ecdsaRecover(f,T,I,F){const B={r:T.slice(0,32),s:T.slice(32,64)},w=new W(B.r),U=new W(B.s);if(w.cmp(C.n)>=0||U.cmp(C.n)>=0)return 1;if(w.isZero()||U.isZero())return 2;let D;try{D=X.recoverPubKey(F,B,I)}catch{return 2}return v(f,D),0},ecdh(f,T,I,F,B,w,U){const D=h(T);if(D===null)return 1;const R=new W(I);if(R.cmp(C.n)>=0||R.isZero())return 2;const G=D.getPublic().mul(R);if(B===void 0){const H=G.encode(null,!0),ae=X.hash().update(H).digest();for(let x=0;x<32;++x)f[x]=ae[x]}else{w||(w=new Uint8Array(32));const H=G.getX().toArray("be",32);for(let Y=0;Y<32;++Y)w[Y]=H[Y];U||(U=new Uint8Array(32));const ae=G.getY().toArray("be",32);for(let Y=0;Y<32;++Y)U[Y]=ae[Y];const x=B(w,U,F);if(!(x instanceof Uint8Array&&x.length===f.length))return 2;f.set(x)}return 0}}},81003:function(Ae){const g={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function K(N,_){if(!N)throw new Error(_)}function M(N,_,h){if(K(_ instanceof Uint8Array,`Expected ${N} to be an Uint8Array`),h!==void 0)if(Array.isArray(h)){const v=h.join(", "),f=`Expected ${N} to be an Uint8Array with length [${v}]`;K(h.includes(_.length),f)}else{const v=`Expected ${N} to be an Uint8Array with length ${h}`;K(_.length===h,v)}}function X(N){K(W(N)==="Boolean","Expected compressed to be a Boolean")}function C(N=h=>new Uint8Array(h),_){return typeof N=="function"&&(N=N(_)),M("output",N,_),N}function W(N){return Object.prototype.toString.call(N).slice(8,-1)}Ae.exports=N=>({contextRandomize(_){switch(K(_===null||_ instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),_!==null&&M("seed",_,32),N.contextRandomize(_)){case 1:throw new Error(g.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(_){return M("private key",_,32),N.privateKeyVerify(_)===0},privateKeyNegate(_){switch(M("private key",_,32),N.privateKeyNegate(_)){case 0:return _;case 1:throw new Error(g.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(_,h){switch(M("private key",_,32),M("tweak",h,32),N.privateKeyTweakAdd(_,h)){case 0:return _;case 1:throw new Error(g.TWEAK_ADD)}},privateKeyTweakMul(_,h){switch(M("private key",_,32),M("tweak",h,32),N.privateKeyTweakMul(_,h)){case 0:return _;case 1:throw new Error(g.TWEAK_MUL)}},publicKeyVerify(_){return M("public key",_,[33,65]),N.publicKeyVerify(_)===0},publicKeyCreate(_,h=!0,v){switch(M("private key",_,32),X(h),v=C(v,h?33:65),N.publicKeyCreate(v,_)){case 0:return v;case 1:throw new Error(g.SECKEY_INVALID);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyConvert(_,h=!0,v){switch(M("public key",_,[33,65]),X(h),v=C(v,h?33:65),N.publicKeyConvert(v,_)){case 0:return v;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyNegate(_,h=!0,v){switch(M("public key",_,[33,65]),X(h),v=C(v,h?33:65),N.publicKeyNegate(v,_)){case 0:return v;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyCombine(_,h=!0,v){K(Array.isArray(_),"Expected public keys to be an Array"),K(_.length>0,"Expected public keys array will have more than zero items");for(const f of _)M("public key",f,[33,65]);switch(X(h),v=C(v,h?33:65),N.publicKeyCombine(v,_)){case 0:return v;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_COMBINE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(_,h,v=!0,f){switch(M("public key",_,[33,65]),M("tweak",h,32),X(v),f=C(f,v?33:65),N.publicKeyTweakAdd(f,_,h)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_ADD)}},publicKeyTweakMul(_,h,v=!0,f){switch(M("public key",_,[33,65]),M("tweak",h,32),X(v),f=C(f,v?33:65),N.publicKeyTweakMul(f,_,h)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_MUL)}},signatureNormalize(_){switch(M("signature",_,64),N.signatureNormalize(_)){case 0:return _;case 1:throw new Error(g.SIG_PARSE)}},signatureExport(_,h){M("signature",_,64),h=C(h,72);const v={output:h,outputlen:72};switch(N.signatureExport(v,_)){case 0:return h.slice(0,v.outputlen);case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},signatureImport(_,h){switch(M("signature",_),h=C(h,64),N.signatureImport(h,_)){case 0:return h;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaSign(_,h,v={},f){M("message",_,32),M("private key",h,32),K(W(v)==="Object","Expected options to be an Object"),v.data!==void 0&&M("options.data",v.data),v.noncefn!==void 0&&K(W(v.noncefn)==="Function","Expected options.noncefn to be a Function"),f=C(f,64);const T={signature:f,recid:null};switch(N.ecdsaSign(T,_,h,v.data,v.noncefn)){case 0:return T;case 1:throw new Error(g.SIGN);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaVerify(_,h,v){switch(M("signature",_,64),M("message",h,32),M("public key",v,[33,65]),N.ecdsaVerify(_,h,v)){case 0:return!0;case 3:return!1;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.PUBKEY_PARSE)}},ecdsaRecover(_,h,v,f=!0,T){switch(M("signature",_,64),K(W(h)==="Number"&&h>=0&&h<=3,"Expected recovery id to be a Number within interval [0, 3]"),M("message",v,32),X(f),T=C(T,f?33:65),N.ecdsaRecover(T,_,h,v)){case 0:return T;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.RECOVER);case 3:throw new Error(g.IMPOSSIBLE_CASE)}},ecdh(_,h,v={},f){switch(M("public key",_,[33,65]),M("private key",h,32),K(W(v)==="Object","Expected options to be an Object"),v.data!==void 0&&M("options.data",v.data),v.hashfn!==void 0?(K(W(v.hashfn)==="Function","Expected options.hashfn to be a Function"),v.xbuf!==void 0&&M("options.xbuf",v.xbuf,32),v.ybuf!==void 0&&M("options.ybuf",v.ybuf,32),M("output",f)):f=C(f,32),N.ecdh(f,_,h,v.data,v.hashfn,v.xbuf,v.ybuf)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.ECDH)}}})},25532:function(Ae,g,K){"use strict";var M=K(48764).Buffer,X=this&&this.__createBinding||(Object.create?function(Z,$,re,ie){ie===void 0&&(ie=re),Object.defineProperty(Z,ie,{enumerable:!0,get:function(){return $[re]}})}:function(Z,$,re,ie){ie===void 0&&(ie=re),Z[ie]=$[re]}),C=this&&this.__setModuleDefault||(Object.create?function(Z,$){Object.defineProperty(Z,"default",{enumerable:!0,value:$})}:function(Z,$){Z.default=$}),W=this&&this.__decorate||function(Z,$,re,ie){var ge=arguments.length,me=ge<3?$:ie===null?ie=Object.getOwnPropertyDescriptor($,re):ie,Oe;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")me=Reflect.decorate(Z,$,re,ie);else for(var Ge=Z.length-1;Ge>=0;Ge--)(Oe=Z[Ge])&&(me=(ge<3?Oe(me):ge>3?Oe($,re,me):Oe($,re))||me);return ge>3&&me&&Object.defineProperty($,re,me),me},N=this&&this.__importStar||function(Z){if(Z&&Z.__esModule)return Z;var $={};if(Z!=null)for(var re in Z)re!=="default"&&Object.hasOwnProperty.call(Z,re)&&X($,Z,re);return C($,Z),$},_=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(g,"__esModule",{value:!0}),g.deserializeUnchecked=g.deserialize=g.serialize=g.BinaryReader=g.BinaryWriter=g.BorshError=g.baseDecode=g.baseEncode=void 0;const h=_(K(13550)),v=_(K(77191)),f=N(K(11379)),T=typeof K.g.TextDecoder!="function"?f.TextDecoder:K.g.TextDecoder,I=new T("utf-8",{fatal:!0});function F(Z){return typeof Z=="string"&&(Z=M.from(Z,"utf8")),v.default.encode(M.from(Z))}g.baseEncode=F;function B(Z){return M.from(v.default.decode(Z))}g.baseDecode=B;const w=1024;class U extends Error{constructor($){super($),this.fieldPath=[],this.originalMessage=$}addToFieldPath($){this.fieldPath.splice(0,0,$),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}g.BorshError=U;class D{constructor(){this.buf=M.alloc(w),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=M.concat([this.buf,M.alloc(w)]))}writeU8($){this.maybeResize(),this.buf.writeUInt8($,this.length),this.length+=1}writeU16($){this.maybeResize(),this.buf.writeUInt16LE($,this.length),this.length+=2}writeU32($){this.maybeResize(),this.buf.writeUInt32LE($,this.length),this.length+=4}writeU64($){this.maybeResize(),this.writeBuffer(M.from(new h.default($).toArray("le",8)))}writeU128($){this.maybeResize(),this.writeBuffer(M.from(new h.default($).toArray("le",16)))}writeU256($){this.maybeResize(),this.writeBuffer(M.from(new h.default($).toArray("le",32)))}writeU512($){this.maybeResize(),this.writeBuffer(M.from(new h.default($).toArray("le",64)))}writeBuffer($){this.buf=M.concat([M.from(this.buf.subarray(0,this.length)),$,M.alloc(w)]),this.length+=$.length}writeString($){this.maybeResize();const re=M.from($,"utf8");this.writeU32(re.length),this.writeBuffer(re)}writeFixedArray($){this.writeBuffer(M.from($))}writeArray($,re){this.maybeResize(),this.writeU32($.length);for(const ie of $)this.maybeResize(),re(ie)}toArray(){return this.buf.subarray(0,this.length)}}g.BinaryWriter=D;function R(Z,$,re){const ie=re.value;re.value=function(...ge){try{return ie.apply(this,ge)}catch(me){if(me instanceof RangeError){const Oe=me.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(Oe)>=0)throw new U("Reached the end of buffer when deserializing")}throw me}}}class G{constructor($){this.buf=$,this.offset=0}readU8(){const $=this.buf.readUInt8(this.offset);return this.offset+=1,$}readU16(){const $=this.buf.readUInt16LE(this.offset);return this.offset+=2,$}readU32(){const $=this.buf.readUInt32LE(this.offset);return this.offset+=4,$}readU64(){const $=this.readBuffer(8);return new h.default($,"le")}readU128(){const $=this.readBuffer(16);return new h.default($,"le")}readU256(){const $=this.readBuffer(32);return new h.default($,"le")}readU512(){const $=this.readBuffer(64);return new h.default($,"le")}readBuffer($){if(this.offset+$>this.buf.length)throw new U(`Expected buffer length ${$} isn't within bounds`);const re=this.buf.slice(this.offset,this.offset+$);return this.offset+=$,re}readString(){const $=this.readU32(),re=this.readBuffer($);try{return I.decode(re)}catch(ie){throw new U(`Error decoding UTF-8 string: ${ie}`)}}readFixedArray($){return new Uint8Array(this.readBuffer($))}readArray($){const re=this.readU32(),ie=Array();for(let ge=0;ge<re;++ge)ie.push($());return ie}}W([R],G.prototype,"readU8",null),W([R],G.prototype,"readU16",null),W([R],G.prototype,"readU32",null),W([R],G.prototype,"readU64",null),W([R],G.prototype,"readU128",null),W([R],G.prototype,"readU256",null),W([R],G.prototype,"readU512",null),W([R],G.prototype,"readString",null),W([R],G.prototype,"readFixedArray",null),W([R],G.prototype,"readArray",null),g.BinaryReader=G;function H(Z){return Z.charAt(0).toUpperCase()+Z.slice(1)}function ae(Z,$,re,ie,ge){try{if(typeof ie=="string")ge[`write${H(ie)}`](re);else if(ie instanceof Array)if(typeof ie[0]=="number"){if(re.length!==ie[0])throw new U(`Expecting byte array of length ${ie[0]}, but got ${re.length} bytes`);ge.writeFixedArray(re)}else ge.writeArray(re,me=>{ae(Z,$,me,ie[0],ge)});else if(ie.kind!==void 0)switch(ie.kind){case"option":{re==null?ge.writeU8(0):(ge.writeU8(1),ae(Z,$,re,ie.type,ge));break}default:throw new U(`FieldType ${ie} unrecognized`)}else x(Z,re,ge)}catch(me){throw me instanceof U&&me.addToFieldPath($),me}}function x(Z,$,re){const ie=Z.get($.constructor);if(!ie)throw new U(`Class ${$.constructor.name} is missing in schema`);if(ie.kind==="struct")ie.fields.map(([ge,me])=>{ae(Z,ge,$[ge],me,re)});else if(ie.kind==="enum"){const ge=$[ie.field];for(let me=0;me<ie.values.length;++me){const[Oe,Ge]=ie.values[me];if(Oe===ge){re.writeU8(me),ae(Z,Oe,$[Oe],Ge,re);break}}}else throw new U(`Unexpected schema kind: ${ie.kind} for ${$.constructor.name}`)}function be(Z,$){const re=new D;return x(Z,$,re),re.toArray()}g.serialize=be;function Y(Z,$,re,ie){try{return typeof re=="string"?ie[`read${H(re)}`]():re instanceof Array?typeof re[0]=="number"?ie.readFixedArray(re[0]):ie.readArray(()=>Y(Z,$,re[0],ie)):re.kind==="option"?ie.readU8()?Y(Z,$,re.type,ie):void 0:ue(Z,re,ie)}catch(ge){throw ge instanceof U&&ge.addToFieldPath($),ge}}function ue(Z,$,re){const ie=Z.get($);if(!ie)throw new U(`Class ${$.name} is missing in schema`);if(ie.kind==="struct"){const ge={};for(const[me,Oe]of Z.get($).fields)ge[me]=Y(Z,me,Oe,re);return new $(ge)}if(ie.kind==="enum"){const ge=re.readU8();if(ge>=ie.values.length)throw new U(`Enum index: ${ge} is out of range`);const[me,Oe]=ie.values[ge],Ge=Y(Z,me,Oe,re);return new $({[me]:Ge})}throw new U(`Unexpected schema kind: ${ie.kind} for ${$.constructor.name}`)}function oe(Z,$,re){const ie=new G(re),ge=ue(Z,$,ie);if(ie.offset<re.length)throw new U(`Unexpected ${re.length-ie.offset} bytes after deserialized data`);return ge}g.deserialize=oe;function fe(Z,$,re){const ie=new G(re);return ue(Z,$,ie)}g.deserializeUnchecked=fe},37953:function(Ae){/*!
|
|
116
116
|
Copyright (C) 2013-2017 by Andrea Giammarchi - @WebReflection
|
|
117
117
|
|
|
118
118
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
@@ -133,4 +133,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
133
133
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
134
134
|
THE SOFTWARE.
|
|
135
135
|
|
|
136
|
-
*/var g="~",z="\\x"+("0"+g.charCodeAt(0).toString(16)).slice(-2),j="\\"+z,X=new RegExp(z,"g"),C=new RegExp(j,"g"),W=new RegExp("(?:^|([^\\\\]))"+j),L=[].indexOf||function(w){for(var U=this.length;U--&&this[U]!==w;);return U},I=String;function h(w,U,D){var R=!1,G=!!U,H=[],ae=[w],x=[w],be=[D?g:"[Circular]"],Y=w,ue=1,oe,fe;return G&&(fe=typeof U=="object"?function(Z,M){return Z!==""&&U.indexOf(Z)<0?void 0:M}:U),function(Z,M){return G&&(M=fe.call(this,Z,M)),R?(Y!==this&&(oe=ue-L.call(ae,this)-1,ue-=oe,ae.splice(ue,ae.length),H.splice(ue-1,H.length),Y=this),typeof M=="object"&&M?(L.call(ae,M)<0&&ae.push(Y=M),ue=ae.length,oe=L.call(x,M),oe<0?(oe=x.push(M)-1,D?(H.push((""+Z).replace(X,z)),be[oe]=g+H.join(g)):be[oe]=be[0]):M=be[oe]):typeof M=="string"&&D&&(M=M.replace(z,j).replace(g,z))):R=!0,M}}function v(w,U){for(var D=0,R=U.length;D<R;w=w[U[D++].replace(C,g)]);return w}function f(w){return function(U,D){var R=typeof D=="string";return R&&D.charAt(0)===g?new I(D.slice(1)):(U===""&&(D=F(D,D,{})),R&&(D=D.replace(W,"$1"+g).replace(j,z)),w?w.call(this,U,D):D)}}function T(w,U,D){for(var R=0,G=U.length;R<G;R++)U[R]=F(w,U[R],D);return U}function _(w,U,D){for(var R in U)U.hasOwnProperty(R)&&(U[R]=F(w,U[R],D));return U}function F(w,U,D){return U instanceof Array?T(w,U,D):U instanceof I?U.length?D.hasOwnProperty(U)?D[U]:D[U]=v(w,U.split(g)):w:U instanceof Object?_(w,U,D):U}var B={stringify:function(U,D,R,G){return B.parser.stringify(U,h(U,D,!G),R)},parse:function(U,D){return B.parser.parse(U,f(D))},parser:JSON};Ae.exports=B},58355:function(Ae,g,z){"use strict";var j=z(35717),X=z(51031),C=z(71027),W=z(89509).Buffer,L=z(78028),I=z(79785),h=z(89072),v=W.alloc(128);function f(T,_){C.call(this,"digest"),typeof _=="string"&&(_=W.from(_));var F=T==="sha512"||T==="sha384"?128:64;if(this._alg=T,this._key=_,_.length>F){var B=T==="rmd160"?new I:h(T);_=B.update(_).digest()}else _.length<F&&(_=W.concat([_,v],F));for(var w=this._ipad=W.allocUnsafe(F),U=this._opad=W.allocUnsafe(F),D=0;D<F;D++)w[D]=_[D]^54,U[D]=_[D]^92;this._hash=T==="rmd160"?new I:h(T),this._hash.update(w)}j(f,C),f.prototype._update=function(T){this._hash.update(T)},f.prototype._final=function(){var T=this._hash.digest(),_=this._alg==="rmd160"?new I:h(this._alg);return _.update(this._opad).update(T).digest()},Ae.exports=function(_,F){return _=_.toLowerCase(),_==="rmd160"||_==="ripemd160"?new f("rmd160",F):_==="md5"?new X(L,F):new f(_,F)}},51031:function(Ae,g,z){"use strict";var j=z(35717),X=z(89509).Buffer,C=z(71027),W=X.alloc(128),L=64;function I(h,v){C.call(this,"digest"),typeof v=="string"&&(v=X.from(v)),this._alg=h,this._key=v,v.length>L?v=h(v):v.length<L&&(v=X.concat([v,W],L));for(var f=this._ipad=X.allocUnsafe(L),T=this._opad=X.allocUnsafe(L),_=0;_<L;_++)f[_]=v[_]^54,T[_]=v[_]^92;this._hash=[f]}j(I,C),I.prototype._update=function(h){this._hash.push(h)},I.prototype._final=function(){var h=this._alg(X.concat(this._hash));return this._alg(X.concat([this._opad,h]))},Ae.exports=I},62678:function(Ae,g,z){"use strict";var j=z(48764).Buffer;Object.defineProperty(g,"__esModule",{value:!0}),g.derivePath=g.isValidPath=g.getPublicKey=g.CKDPriv=g.getMasterKeyFromSeed=void 0;const X=z(58355),C=z(50780),W=z(91110),L="ed25519 seed",I=2147483648;g.getMasterKeyFromSeed=h=>{const f=X("sha512",L).update(j.from(h,"hex")).digest(),T=f.slice(0,32),_=f.slice(32);return{key:T,chainCode:_}},g.CKDPriv=({key:h,chainCode:v},f)=>{const T=j.allocUnsafe(4);T.writeUInt32BE(f,0);const _=j.concat([j.alloc(1,0),h,T]),F=X("sha512",v).update(_).digest(),B=F.slice(0,32),w=F.slice(32);return{key:B,chainCode:w}},g.getPublicKey=(h,v=!0)=>{const T=C.sign.keyPair.fromSeed(h).secretKey.subarray(32),_=j.alloc(1,0);return v?j.concat([_,j.from(T)]):j.from(T)},g.isValidPath=h=>W.pathRegex.test(h)?!h.split("/").slice(1).map(W.replaceDerive).some(isNaN):!1,g.derivePath=(h,v,f=I)=>{if(!g.isValidPath(h))throw new Error("Invalid derivation path");const{key:T,chainCode:_}=g.getMasterKeyFromSeed(v);return h.split("/").slice(1).map(W.replaceDerive).map(B=>parseInt(B,10)).reduce((B,w)=>g.CKDPriv(B,w+f),{key:T,chainCode:_})}},91110:function(Ae,g){"use strict";Object.defineProperty(g,"__esModule",{value:!0}),g.replaceDerive=g.pathRegex=void 0,g.pathRegex=new RegExp("^m(\\/[0-9]+')+$"),g.replaceDerive=z=>z.replace("'","")},26729:function(Ae){"use strict";var g=Object.prototype.hasOwnProperty,z="~";function j(){}Object.create&&(j.prototype=Object.create(null),new j().__proto__||(z=!1));function X(I,h,v){this.fn=I,this.context=h,this.once=v||!1}function C(I,h,v,f,T){if(typeof v!="function")throw new TypeError("The listener must be a function");var _=new X(v,f||I,T),F=z?z+h:h;return I._events[F]?I._events[F].fn?I._events[F]=[I._events[F],_]:I._events[F].push(_):(I._events[F]=_,I._eventsCount++),I}function W(I,h){--I._eventsCount===0?I._events=new j:delete I._events[h]}function L(){this._events=new j,this._eventsCount=0}L.prototype.eventNames=function(){var h=[],v,f;if(this._eventsCount===0)return h;for(f in v=this._events)g.call(v,f)&&h.push(z?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(v)):h},L.prototype.listeners=function(h){var v=z?z+h:h,f=this._events[v];if(!f)return[];if(f.fn)return[f.fn];for(var T=0,_=f.length,F=new Array(_);T<_;T++)F[T]=f[T].fn;return F},L.prototype.listenerCount=function(h){var v=z?z+h:h,f=this._events[v];return f?f.fn?1:f.length:0},L.prototype.emit=function(h,v,f,T,_,F){var B=z?z+h:h;if(!this._events[B])return!1;var w=this._events[B],U=arguments.length,D,R;if(w.fn){switch(w.once&&this.removeListener(h,w.fn,void 0,!0),U){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,v),!0;case 3:return w.fn.call(w.context,v,f),!0;case 4:return w.fn.call(w.context,v,f,T),!0;case 5:return w.fn.call(w.context,v,f,T,_),!0;case 6:return w.fn.call(w.context,v,f,T,_,F),!0}for(R=1,D=new Array(U-1);R<U;R++)D[R-1]=arguments[R];w.fn.apply(w.context,D)}else{var G=w.length,H;for(R=0;R<G;R++)switch(w[R].once&&this.removeListener(h,w[R].fn,void 0,!0),U){case 1:w[R].fn.call(w[R].context);break;case 2:w[R].fn.call(w[R].context,v);break;case 3:w[R].fn.call(w[R].context,v,f);break;case 4:w[R].fn.call(w[R].context,v,f,T);break;default:if(!D)for(H=1,D=new Array(U-1);H<U;H++)D[H-1]=arguments[H];w[R].fn.apply(w[R].context,D)}}return!0},L.prototype.on=function(h,v,f){return C(this,h,v,f,!1)},L.prototype.once=function(h,v,f){return C(this,h,v,f,!0)},L.prototype.removeListener=function(h,v,f,T){var _=z?z+h:h;if(!this._events[_])return this;if(!v)return W(this,_),this;var F=this._events[_];if(F.fn)F.fn===v&&(!T||F.once)&&(!f||F.context===f)&&W(this,_);else{for(var B=0,w=[],U=F.length;B<U;B++)(F[B].fn!==v||T&&!F[B].once||f&&F[B].context!==f)&&w.push(F[B]);w.length?this._events[_]=w.length===1?w[0]:w:W(this,_)}return this},L.prototype.removeAllListeners=function(h){var v;return h?(v=z?z+h:h,this._events[v]&&W(this,v)):(this._events=new j,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=z,L.EventEmitter=L,Ae.exports=L},31198:function(Ae,g,z){"use strict";const j=z(55877).v4,X=z(17741),C=function(W,L){if(!(this instanceof C))return new C(W,L);L||(L={}),this.options={reviver:typeof L.reviver<"u"?L.reviver:null,replacer:typeof L.replacer<"u"?L.replacer:null,generator:typeof L.generator<"u"?L.generator:function(){return j()},version:typeof L.version<"u"?L.version:2,notificationIdNull:typeof L.notificationIdNull=="boolean"?L.notificationIdNull:!1},this.callServer=W};Ae.exports=C,C.prototype.request=function(W,L,I,h){const v=this;let f=null;const T=Array.isArray(W)&&typeof L=="function";if(this.options.version===1&&T)throw new TypeError("JSON-RPC 1.0 does not support batching");if(T||!T&&W&&typeof W=="object"&&typeof L=="function")h=L,f=W;else{typeof I=="function"&&(h=I,I=void 0);const B=typeof h=="function";try{f=X(W,L,I,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(w){if(B)return h(w);throw w}if(!B)return f}let F;try{F=JSON.stringify(f,this.options.replacer)}catch(B){return h(B)}return this.callServer(F,function(B,w){v._parseResponse(B,w,h)}),f},C.prototype._parseResponse=function(W,L,I){if(W){I(W);return}if(!L)return I();let h;try{h=JSON.parse(L,this.options.reviver)}catch(v){return I(v)}if(I.length===3)if(Array.isArray(h)){const v=function(T){return typeof T.error<"u"},f=function(T){return!v(T)};return I(null,h.filter(v),h.filter(f))}else return I(null,h.error,h.result);I(null,h)}},17741:function(Ae,g,z){"use strict";const j=z(55877).v4,X=function(C,W,L,I){if(typeof C!="string")throw new TypeError(C+" must be a string");I=I||{};const h=typeof I.version=="number"?I.version:2;if(h!==1&&h!==2)throw new TypeError(h+" must be 1 or 2");const v={method:C};if(h===2&&(v.jsonrpc="2.0"),W){if(typeof W!="object"&&!Array.isArray(W))throw new TypeError(W+" must be an object, array or omitted");v.params=W}if(typeof L>"u"){const f=typeof I.generator=="function"?I.generator:function(){return j()};v.id=f(v,I)}else h===2&&L===null?I.notificationIdNull&&(v.id=null):v.id=L;return v};Ae.exports=X},83937:function(Ae,g,z){"use strict";var j,X=z(64836);j={value:!0},g.K=void 0;var C=X(z(56690)),W=X(z(61655)),L=X(z(94993)),I=X(z(73808)),h=X(z(89062)),v=X(z(66855));function f(F){var B=T();return function(){var U=(0,I.default)(F),D;if(B){var R=(0,I.default)(this).constructor;D=Reflect.construct(U,arguments,R)}else D=U.apply(this,arguments);return(0,L.default)(this,D)}}function T(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var _=function(F){(0,W.default)(w,F);var B=f(w);function w(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"ws://localhost:8080",D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=D.autoconnect,G=R===void 0?!0:R,H=D.reconnect,ae=H===void 0?!0:H,x=D.reconnect_interval,be=x===void 0?1e3:x,Y=D.max_reconnects,ue=Y===void 0?5:Y,oe=arguments.length>2?arguments[2]:void 0;return(0,C.default)(this,w),B.call(this,h.default,U,{autoconnect:G,reconnect:ae,reconnect_interval:be,max_reconnects:ue},oe)}return w}(v.default);g.K=_},66855:function(Ae,g,z){"use strict";var j=z(48764).Buffer,X=z(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=void 0;var C=X(z(64687)),W=X(z(17156)),L=X(z(18698)),I=X(z(56690)),h=X(z(89728)),v=X(z(61655)),f=X(z(94993)),T=X(z(73808)),_=z(26729),F=X(z(37953));function B(R){var G=w();return function(){var ae=(0,T.default)(R),x;if(G){var be=(0,T.default)(this).constructor;x=Reflect.construct(ae,arguments,be)}else x=ae.apply(this,arguments);return(0,f.default)(this,x)}}function w(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var U=function(R,G){var H={};for(var ae in R)Object.prototype.hasOwnProperty.call(R,ae)&&G.indexOf(ae)<0&&(H[ae]=R[ae]);if(R!=null&&typeof Object.getOwnPropertySymbols=="function")for(var x=0,ae=Object.getOwnPropertySymbols(R);x<ae.length;x++)G.indexOf(ae[x])<0&&Object.prototype.propertyIsEnumerable.call(R,ae[x])&&(H[ae[x]]=R[ae[x]]);return H},D=function(R){(0,v.default)(H,R);var G=B(H);function H(ae){var x,be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ue=arguments.length>3?arguments[3]:void 0;(0,I.default)(this,H);var oe=Y.autoconnect,fe=oe===void 0?!0:oe,Z=Y.reconnect,M=Z===void 0?!0:Z,re=Y.reconnect_interval,ie=re===void 0?1e3:re,ge=Y.max_reconnects,me=ge===void 0?5:ge,Oe=U(Y,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return x=G.call(this),x.webSocketFactory=ae,x.queue={},x.rpc_id=0,x.address=be,x.autoconnect=fe,x.ready=!1,x.reconnect=M,x.reconnect_interval=ie,x.max_reconnects=me,x.rest_options=Oe,x.current_reconnects=0,x.generate_request_id=ue||function(){return++x.rpc_id},x.autoconnect&&x._connect(x.address,Object.assign({autoconnect:x.autoconnect,reconnect:x.reconnect,reconnect_interval:x.reconnect_interval,max_reconnects:x.max_reconnects},x.rest_options)),x}return(0,h.default)(H,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(x,be,Y,ue){var oe=this;return!ue&&(0,L.default)(Y)==="object"&&(ue=Y,Y=null),new Promise(function(fe,Z){if(!oe.ready)return Z(new Error("socket not ready"));var M=oe.generate_request_id(x,be),re={jsonrpc:"2.0",method:x,params:be||null,id:M};oe.socket.send(JSON.stringify(re),ue,function(ie){if(ie)return Z(ie);oe.queue[M]={promise:[fe,Z]},Y&&(oe.queue[M].timeout=setTimeout(function(){delete oe.queue[M],Z(new Error("reply timeout"))},Y))})})}},{key:"login",value:function(){var ae=(0,W.default)(C.default.mark(function be(Y){var ue;return C.default.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,this.call("rpc.login",Y);case 2:if(ue=fe.sent,ue){fe.next=5;break}throw new Error("authentication failed");case 5:return fe.abrupt("return",ue);case 6:case"end":return fe.stop()}},be,this)}));function x(be){return ae.apply(this,arguments)}return x}()},{key:"listMethods",value:function(){var ae=(0,W.default)(C.default.mark(function be(){return C.default.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return ue.next=2,this.call("__listMethods");case 2:return ue.abrupt("return",ue.sent);case 3:case"end":return ue.stop()}},be,this)}));function x(){return ae.apply(this,arguments)}return x}()},{key:"notify",value:function(x,be){var Y=this;return new Promise(function(ue,oe){if(!Y.ready)return oe(new Error("socket not ready"));var fe={jsonrpc:"2.0",method:x,params:be||null};Y.socket.send(JSON.stringify(fe),function(Z){if(Z)return oe(Z);ue()})})}},{key:"subscribe",value:function(){var ae=(0,W.default)(C.default.mark(function be(Y){var ue;return C.default.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return typeof Y=="string"&&(Y=[Y]),fe.next=3,this.call("rpc.on",Y);case 3:if(ue=fe.sent,!(typeof Y=="string"&&ue[Y]!=="ok")){fe.next=6;break}throw new Error("Failed subscribing to an event '"+Y+"' with: "+ue[Y]);case 6:return fe.abrupt("return",ue);case 7:case"end":return fe.stop()}},be,this)}));function x(be){return ae.apply(this,arguments)}return x}()},{key:"unsubscribe",value:function(){var ae=(0,W.default)(C.default.mark(function be(Y){var ue;return C.default.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return typeof Y=="string"&&(Y=[Y]),fe.next=3,this.call("rpc.off",Y);case 3:if(ue=fe.sent,!(typeof Y=="string"&&ue[Y]!=="ok")){fe.next=6;break}throw new Error("Failed unsubscribing from an event with: "+ue);case 6:return fe.abrupt("return",ue);case 7:case"end":return fe.stop()}},be,this)}));function x(be){return ae.apply(this,arguments)}return x}()},{key:"close",value:function(x,be){this.socket.close(x||1e3,be)}},{key:"_connect",value:function(x,be){var Y=this;this.socket=this.webSocketFactory(x,be),this.socket.addEventListener("open",function(){Y.ready=!0,Y.emit("open"),Y.current_reconnects=0}),this.socket.addEventListener("message",function(ue){var oe=ue.data;oe instanceof ArrayBuffer&&(oe=j.from(oe).toString());try{oe=F.default.parse(oe)}catch{return}if(oe.notification&&Y.listeners(oe.notification).length){if(!Object.keys(oe.params).length)return Y.emit(oe.notification);var fe=[oe.notification];if(oe.params.constructor===Object)fe.push(oe.params);else for(var Z=0;Z<oe.params.length;Z++)fe.push(oe.params[Z]);return Promise.resolve().then(function(){Y.emit.apply(Y,fe)})}if(!Y.queue[oe.id])return oe.method&&oe.params?Promise.resolve().then(function(){Y.emit(oe.method,oe.params)}):void 0;"error"in oe=="result"in oe&&Y.queue[oe.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),Y.queue[oe.id].timeout&&clearTimeout(Y.queue[oe.id].timeout),oe.error?Y.queue[oe.id].promise[1](oe.error):Y.queue[oe.id].promise[0](oe.result),delete Y.queue[oe.id]}),this.socket.addEventListener("error",function(ue){return Y.emit("error",ue)}),this.socket.addEventListener("close",function(ue){var oe=ue.code,fe=ue.reason;Y.ready&&setTimeout(function(){return Y.emit("close",oe,fe)},0),Y.ready=!1,Y.socket=void 0,oe!==1e3&&(Y.current_reconnects++,Y.reconnect&&(Y.max_reconnects>Y.current_reconnects||Y.max_reconnects===0)&&setTimeout(function(){return Y._connect(x,be)},Y.reconnect_interval))})}}]),H}(_.EventEmitter);g.default=D},89062:function(Ae,g,z){"use strict";var j=z(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=_;var X=j(z(56690)),C=j(z(89728)),W=j(z(61655)),L=j(z(94993)),I=j(z(73808)),h=z(26729);function v(F){var B=f();return function(){var U=(0,I.default)(F),D;if(B){var R=(0,I.default)(this).constructor;D=Reflect.construct(U,arguments,R)}else D=U.apply(this,arguments);return(0,L.default)(this,D)}}function f(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var T=function(F){(0,W.default)(w,F);var B=v(w);function w(U,D,R){var G;return(0,X.default)(this,w),G=B.call(this),G.socket=new window.WebSocket(U,R),G.socket.onopen=function(){return G.emit("open")},G.socket.onmessage=function(H){return G.emit("message",H.data)},G.socket.onerror=function(H){return G.emit("error",H)},G.socket.onclose=function(H){G.emit("close",H.code,H.reason)},G}return(0,C.default)(w,[{key:"send",value:function(D,R,G){var H=G||R;try{this.socket.send(D),H()}catch(ae){H(ae)}}},{key:"close",value:function(D,R){this.socket.close(D,R)}},{key:"addEventListener",value:function(D,R,G){this.socket.addEventListener(D,R,G)}}]),w}(h.EventEmitter);function _(F,B){return new T(F,B)}},11379:function(Ae,g){"use strict";function z(B,w,U){return w<=B&&B<=U}function j(B){if(B===void 0)return{};if(B===Object(B))return B;throw TypeError("Could not convert argument to dictionary")}function X(B){for(var w=String(B),U=w.length,D=0,R=[];D<U;){var G=w.charCodeAt(D);if(G<55296||G>57343)R.push(G);else if(56320<=G&&G<=57343)R.push(65533);else if(55296<=G&&G<=56319)if(D===U-1)R.push(65533);else{var H=B.charCodeAt(D+1);if(56320<=H&&H<=57343){var ae=G&1023,x=H&1023;R.push(65536+(ae<<10)+x),D+=1}else R.push(65533)}D+=1}return R}function C(B){for(var w="",U=0;U<B.length;++U){var D=B[U];D<=65535?w+=String.fromCharCode(D):(D-=65536,w+=String.fromCharCode((D>>10)+55296,(D&1023)+56320))}return w}var W=-1;function L(B){this.tokens=[].slice.call(B)}L.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():W},prepend:function(B){if(Array.isArray(B))for(var w=B;w.length;)this.tokens.unshift(w.pop());else this.tokens.unshift(B)},push:function(B){if(Array.isArray(B))for(var w=B;w.length;)this.tokens.push(w.shift());else this.tokens.push(B)}};var I=-1;function h(B,w){if(B)throw TypeError("Decoder error");return w||65533}var v="utf-8";function f(B,w){if(!(this instanceof f))return new f(B,w);if(B=B!==void 0?String(B).toLowerCase():v,B!==v)throw new Error("Encoding not supported. Only utf-8 is supported");w=j(w),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(w.fatal),this._ignoreBOM=Boolean(w.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}f.prototype={decode:function(w,U){var D;typeof w=="object"&&w instanceof ArrayBuffer?D=new Uint8Array(w):typeof w=="object"&&"buffer"in w&&w.buffer instanceof ArrayBuffer?D=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):D=new Uint8Array(0),U=j(U),this._streaming||(this._decoder=new _({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(U.stream);for(var R=new L(D),G=[],H;!R.endOfStream()&&(H=this._decoder.handler(R,R.read()),H!==I);)H!==null&&(Array.isArray(H)?G.push.apply(G,H):G.push(H));if(!this._streaming){do{if(H=this._decoder.handler(R,R.read()),H===I)break;H!==null&&(Array.isArray(H)?G.push.apply(G,H):G.push(H))}while(!R.endOfStream());this._decoder=null}return G.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(G[0]===65279?(this._BOMseen=!0,G.shift()):this._BOMseen=!0),C(G)}};function T(B,w){if(!(this instanceof T))return new T(B,w);if(B=B!==void 0?String(B).toLowerCase():v,B!==v)throw new Error("Encoding not supported. Only utf-8 is supported");w=j(w),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(w.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}T.prototype={encode:function(w,U){w=w?String(w):"",U=j(U),this._streaming||(this._encoder=new F(this._options)),this._streaming=Boolean(U.stream);for(var D=[],R=new L(X(w)),G;!R.endOfStream()&&(G=this._encoder.handler(R,R.read()),G!==I);)Array.isArray(G)?D.push.apply(D,G):D.push(G);if(!this._streaming){for(;G=this._encoder.handler(R,R.read()),G!==I;)Array.isArray(G)?D.push.apply(D,G):D.push(G);this._encoder=null}return new Uint8Array(D)}};function _(B){var w=B.fatal,U=0,D=0,R=0,G=128,H=191;this.handler=function(ae,x){if(x===W&&R!==0)return R=0,h(w);if(x===W)return I;if(R===0){if(z(x,0,127))return x;if(z(x,194,223))R=1,U=x-192;else if(z(x,224,239))x===224&&(G=160),x===237&&(H=159),R=2,U=x-224;else if(z(x,240,244))x===240&&(G=144),x===244&&(H=143),R=3,U=x-240;else return h(w);return U=U<<6*R,null}if(!z(x,G,H))return U=R=D=0,G=128,H=191,ae.prepend(x),h(w);if(G=128,H=191,D+=1,U+=x-128<<6*(R-D),D!==R)return null;var be=U;return U=R=D=0,be}}function F(B){var w=B.fatal;this.handler=function(U,D){if(D===W)return I;if(z(D,0,127))return D;var R,G;z(D,128,2047)?(R=1,G=192):z(D,2048,65535)?(R=2,G=224):z(D,65536,1114111)&&(R=3,G=240);for(var H=[(D>>6*R)+G];R>0;){var ae=D>>6*(R-1);H.push(128|ae&63),R-=1}return H}}g.TextEncoder=T,g.TextDecoder=f}}]);
|
|
136
|
+
*/var g="~",K="\\x"+("0"+g.charCodeAt(0).toString(16)).slice(-2),M="\\"+K,X=new RegExp(K,"g"),C=new RegExp(M,"g"),W=new RegExp("(?:^|([^\\\\]))"+M),N=[].indexOf||function(w){for(var U=this.length;U--&&this[U]!==w;);return U},_=String;function h(w,U,D){var R=!1,G=!!U,H=[],ae=[w],x=[w],be=[D?g:"[Circular]"],Y=w,ue=1,oe,fe;return G&&(fe=typeof U=="object"?function(Z,$){return Z!==""&&U.indexOf(Z)<0?void 0:$}:U),function(Z,$){return G&&($=fe.call(this,Z,$)),R?(Y!==this&&(oe=ue-N.call(ae,this)-1,ue-=oe,ae.splice(ue,ae.length),H.splice(ue-1,H.length),Y=this),typeof $=="object"&&$?(N.call(ae,$)<0&&ae.push(Y=$),ue=ae.length,oe=N.call(x,$),oe<0?(oe=x.push($)-1,D?(H.push((""+Z).replace(X,K)),be[oe]=g+H.join(g)):be[oe]=be[0]):$=be[oe]):typeof $=="string"&&D&&($=$.replace(K,M).replace(g,K))):R=!0,$}}function v(w,U){for(var D=0,R=U.length;D<R;w=w[U[D++].replace(C,g)]);return w}function f(w){return function(U,D){var R=typeof D=="string";return R&&D.charAt(0)===g?new _(D.slice(1)):(U===""&&(D=F(D,D,{})),R&&(D=D.replace(W,"$1"+g).replace(M,K)),w?w.call(this,U,D):D)}}function T(w,U,D){for(var R=0,G=U.length;R<G;R++)U[R]=F(w,U[R],D);return U}function I(w,U,D){for(var R in U)U.hasOwnProperty(R)&&(U[R]=F(w,U[R],D));return U}function F(w,U,D){return U instanceof Array?T(w,U,D):U instanceof _?U.length?D.hasOwnProperty(U)?D[U]:D[U]=v(w,U.split(g)):w:U instanceof Object?I(w,U,D):U}var B={stringify:function(U,D,R,G){return B.parser.stringify(U,h(U,D,!G),R)},parse:function(U,D){return B.parser.parse(U,f(D))},parser:JSON};Ae.exports=B},58355:function(Ae,g,K){"use strict";var M=K(35717),X=K(51031),C=K(71027),W=K(89509).Buffer,N=K(78028),_=K(79785),h=K(89072),v=W.alloc(128);function f(T,I){C.call(this,"digest"),typeof I=="string"&&(I=W.from(I));var F=T==="sha512"||T==="sha384"?128:64;if(this._alg=T,this._key=I,I.length>F){var B=T==="rmd160"?new _:h(T);I=B.update(I).digest()}else I.length<F&&(I=W.concat([I,v],F));for(var w=this._ipad=W.allocUnsafe(F),U=this._opad=W.allocUnsafe(F),D=0;D<F;D++)w[D]=I[D]^54,U[D]=I[D]^92;this._hash=T==="rmd160"?new _:h(T),this._hash.update(w)}M(f,C),f.prototype._update=function(T){this._hash.update(T)},f.prototype._final=function(){var T=this._hash.digest(),I=this._alg==="rmd160"?new _:h(this._alg);return I.update(this._opad).update(T).digest()},Ae.exports=function(I,F){return I=I.toLowerCase(),I==="rmd160"||I==="ripemd160"?new f("rmd160",F):I==="md5"?new X(N,F):new f(I,F)}},51031:function(Ae,g,K){"use strict";var M=K(35717),X=K(89509).Buffer,C=K(71027),W=X.alloc(128),N=64;function _(h,v){C.call(this,"digest"),typeof v=="string"&&(v=X.from(v)),this._alg=h,this._key=v,v.length>N?v=h(v):v.length<N&&(v=X.concat([v,W],N));for(var f=this._ipad=X.allocUnsafe(N),T=this._opad=X.allocUnsafe(N),I=0;I<N;I++)f[I]=v[I]^54,T[I]=v[I]^92;this._hash=[f]}M(_,C),_.prototype._update=function(h){this._hash.push(h)},_.prototype._final=function(){var h=this._alg(X.concat(this._hash));return this._alg(X.concat([this._opad,h]))},Ae.exports=_},62678:function(Ae,g,K){"use strict";var M=K(48764).Buffer;Object.defineProperty(g,"__esModule",{value:!0}),g.derivePath=g.isValidPath=g.getPublicKey=g.CKDPriv=g.getMasterKeyFromSeed=void 0;const X=K(58355),C=K(50780),W=K(91110),N="ed25519 seed",_=2147483648;g.getMasterKeyFromSeed=h=>{const f=X("sha512",N).update(M.from(h,"hex")).digest(),T=f.slice(0,32),I=f.slice(32);return{key:T,chainCode:I}},g.CKDPriv=({key:h,chainCode:v},f)=>{const T=M.allocUnsafe(4);T.writeUInt32BE(f,0);const I=M.concat([M.alloc(1,0),h,T]),F=X("sha512",v).update(I).digest(),B=F.slice(0,32),w=F.slice(32);return{key:B,chainCode:w}},g.getPublicKey=(h,v=!0)=>{const T=C.sign.keyPair.fromSeed(h).secretKey.subarray(32),I=M.alloc(1,0);return v?M.concat([I,M.from(T)]):M.from(T)},g.isValidPath=h=>W.pathRegex.test(h)?!h.split("/").slice(1).map(W.replaceDerive).some(isNaN):!1,g.derivePath=(h,v,f=_)=>{if(!g.isValidPath(h))throw new Error("Invalid derivation path");const{key:T,chainCode:I}=g.getMasterKeyFromSeed(v);return h.split("/").slice(1).map(W.replaceDerive).map(B=>parseInt(B,10)).reduce((B,w)=>g.CKDPriv(B,w+f),{key:T,chainCode:I})}},91110:function(Ae,g){"use strict";Object.defineProperty(g,"__esModule",{value:!0}),g.replaceDerive=g.pathRegex=void 0,g.pathRegex=new RegExp("^m(\\/[0-9]+')+$"),g.replaceDerive=K=>K.replace("'","")},26729:function(Ae){"use strict";var g=Object.prototype.hasOwnProperty,K="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(K=!1));function X(_,h,v){this.fn=_,this.context=h,this.once=v||!1}function C(_,h,v,f,T){if(typeof v!="function")throw new TypeError("The listener must be a function");var I=new X(v,f||_,T),F=K?K+h:h;return _._events[F]?_._events[F].fn?_._events[F]=[_._events[F],I]:_._events[F].push(I):(_._events[F]=I,_._eventsCount++),_}function W(_,h){--_._eventsCount===0?_._events=new M:delete _._events[h]}function N(){this._events=new M,this._eventsCount=0}N.prototype.eventNames=function(){var h=[],v,f;if(this._eventsCount===0)return h;for(f in v=this._events)g.call(v,f)&&h.push(K?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(v)):h},N.prototype.listeners=function(h){var v=K?K+h:h,f=this._events[v];if(!f)return[];if(f.fn)return[f.fn];for(var T=0,I=f.length,F=new Array(I);T<I;T++)F[T]=f[T].fn;return F},N.prototype.listenerCount=function(h){var v=K?K+h:h,f=this._events[v];return f?f.fn?1:f.length:0},N.prototype.emit=function(h,v,f,T,I,F){var B=K?K+h:h;if(!this._events[B])return!1;var w=this._events[B],U=arguments.length,D,R;if(w.fn){switch(w.once&&this.removeListener(h,w.fn,void 0,!0),U){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,v),!0;case 3:return w.fn.call(w.context,v,f),!0;case 4:return w.fn.call(w.context,v,f,T),!0;case 5:return w.fn.call(w.context,v,f,T,I),!0;case 6:return w.fn.call(w.context,v,f,T,I,F),!0}for(R=1,D=new Array(U-1);R<U;R++)D[R-1]=arguments[R];w.fn.apply(w.context,D)}else{var G=w.length,H;for(R=0;R<G;R++)switch(w[R].once&&this.removeListener(h,w[R].fn,void 0,!0),U){case 1:w[R].fn.call(w[R].context);break;case 2:w[R].fn.call(w[R].context,v);break;case 3:w[R].fn.call(w[R].context,v,f);break;case 4:w[R].fn.call(w[R].context,v,f,T);break;default:if(!D)for(H=1,D=new Array(U-1);H<U;H++)D[H-1]=arguments[H];w[R].fn.apply(w[R].context,D)}}return!0},N.prototype.on=function(h,v,f){return C(this,h,v,f,!1)},N.prototype.once=function(h,v,f){return C(this,h,v,f,!0)},N.prototype.removeListener=function(h,v,f,T){var I=K?K+h:h;if(!this._events[I])return this;if(!v)return W(this,I),this;var F=this._events[I];if(F.fn)F.fn===v&&(!T||F.once)&&(!f||F.context===f)&&W(this,I);else{for(var B=0,w=[],U=F.length;B<U;B++)(F[B].fn!==v||T&&!F[B].once||f&&F[B].context!==f)&&w.push(F[B]);w.length?this._events[I]=w.length===1?w[0]:w:W(this,I)}return this},N.prototype.removeAllListeners=function(h){var v;return h?(v=K?K+h:h,this._events[v]&&W(this,v)):(this._events=new M,this._eventsCount=0),this},N.prototype.off=N.prototype.removeListener,N.prototype.addListener=N.prototype.on,N.prefixed=K,N.EventEmitter=N,Ae.exports=N},31198:function(Ae,g,K){"use strict";const M=K(55877).v4,X=K(17741),C=function(W,N){if(!(this instanceof C))return new C(W,N);N||(N={}),this.options={reviver:typeof N.reviver<"u"?N.reviver:null,replacer:typeof N.replacer<"u"?N.replacer:null,generator:typeof N.generator<"u"?N.generator:function(){return M()},version:typeof N.version<"u"?N.version:2,notificationIdNull:typeof N.notificationIdNull=="boolean"?N.notificationIdNull:!1},this.callServer=W};Ae.exports=C,C.prototype.request=function(W,N,_,h){const v=this;let f=null;const T=Array.isArray(W)&&typeof N=="function";if(this.options.version===1&&T)throw new TypeError("JSON-RPC 1.0 does not support batching");if(T||!T&&W&&typeof W=="object"&&typeof N=="function")h=N,f=W;else{typeof _=="function"&&(h=_,_=void 0);const B=typeof h=="function";try{f=X(W,N,_,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(w){if(B)return h(w);throw w}if(!B)return f}let F;try{F=JSON.stringify(f,this.options.replacer)}catch(B){return h(B)}return this.callServer(F,function(B,w){v._parseResponse(B,w,h)}),f},C.prototype._parseResponse=function(W,N,_){if(W){_(W);return}if(!N)return _();let h;try{h=JSON.parse(N,this.options.reviver)}catch(v){return _(v)}if(_.length===3)if(Array.isArray(h)){const v=function(T){return typeof T.error<"u"},f=function(T){return!v(T)};return _(null,h.filter(v),h.filter(f))}else return _(null,h.error,h.result);_(null,h)}},17741:function(Ae,g,K){"use strict";const M=K(55877).v4,X=function(C,W,N,_){if(typeof C!="string")throw new TypeError(C+" must be a string");_=_||{};const h=typeof _.version=="number"?_.version:2;if(h!==1&&h!==2)throw new TypeError(h+" must be 1 or 2");const v={method:C};if(h===2&&(v.jsonrpc="2.0"),W){if(typeof W!="object"&&!Array.isArray(W))throw new TypeError(W+" must be an object, array or omitted");v.params=W}if(typeof N>"u"){const f=typeof _.generator=="function"?_.generator:function(){return M()};v.id=f(v,_)}else h===2&&N===null?_.notificationIdNull&&(v.id=null):v.id=N;return v};Ae.exports=X},83937:function(Ae,g,K){"use strict";var M,X=K(64836);M={value:!0},g.K=void 0;var C=X(K(56690)),W=X(K(61655)),N=X(K(94993)),_=X(K(73808)),h=X(K(89062)),v=X(K(66855));function f(F){var B=T();return function(){var U=(0,_.default)(F),D;if(B){var R=(0,_.default)(this).constructor;D=Reflect.construct(U,arguments,R)}else D=U.apply(this,arguments);return(0,N.default)(this,D)}}function T(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var I=function(F){(0,W.default)(w,F);var B=f(w);function w(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"ws://localhost:8080",D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=D.autoconnect,G=R===void 0?!0:R,H=D.reconnect,ae=H===void 0?!0:H,x=D.reconnect_interval,be=x===void 0?1e3:x,Y=D.max_reconnects,ue=Y===void 0?5:Y,oe=arguments.length>2?arguments[2]:void 0;return(0,C.default)(this,w),B.call(this,h.default,U,{autoconnect:G,reconnect:ae,reconnect_interval:be,max_reconnects:ue},oe)}return w}(v.default);g.K=I},66855:function(Ae,g,K){"use strict";var M=K(48764).Buffer,X=K(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=void 0;var C=X(K(64687)),W=X(K(17156)),N=X(K(18698)),_=X(K(56690)),h=X(K(89728)),v=X(K(61655)),f=X(K(94993)),T=X(K(73808)),I=K(26729),F=X(K(37953));function B(R){var G=w();return function(){var ae=(0,T.default)(R),x;if(G){var be=(0,T.default)(this).constructor;x=Reflect.construct(ae,arguments,be)}else x=ae.apply(this,arguments);return(0,f.default)(this,x)}}function w(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var U=function(R,G){var H={};for(var ae in R)Object.prototype.hasOwnProperty.call(R,ae)&&G.indexOf(ae)<0&&(H[ae]=R[ae]);if(R!=null&&typeof Object.getOwnPropertySymbols=="function")for(var x=0,ae=Object.getOwnPropertySymbols(R);x<ae.length;x++)G.indexOf(ae[x])<0&&Object.prototype.propertyIsEnumerable.call(R,ae[x])&&(H[ae[x]]=R[ae[x]]);return H},D=function(R){(0,v.default)(H,R);var G=B(H);function H(ae){var x,be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ue=arguments.length>3?arguments[3]:void 0;(0,_.default)(this,H);var oe=Y.autoconnect,fe=oe===void 0?!0:oe,Z=Y.reconnect,$=Z===void 0?!0:Z,re=Y.reconnect_interval,ie=re===void 0?1e3:re,ge=Y.max_reconnects,me=ge===void 0?5:ge,Oe=U(Y,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return x=G.call(this),x.webSocketFactory=ae,x.queue={},x.rpc_id=0,x.address=be,x.autoconnect=fe,x.ready=!1,x.reconnect=$,x.reconnect_interval=ie,x.max_reconnects=me,x.rest_options=Oe,x.current_reconnects=0,x.generate_request_id=ue||function(){return++x.rpc_id},x.autoconnect&&x._connect(x.address,Object.assign({autoconnect:x.autoconnect,reconnect:x.reconnect,reconnect_interval:x.reconnect_interval,max_reconnects:x.max_reconnects},x.rest_options)),x}return(0,h.default)(H,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(x,be,Y,ue){var oe=this;return!ue&&(0,N.default)(Y)==="object"&&(ue=Y,Y=null),new Promise(function(fe,Z){if(!oe.ready)return Z(new Error("socket not ready"));var $=oe.generate_request_id(x,be),re={jsonrpc:"2.0",method:x,params:be||null,id:$};oe.socket.send(JSON.stringify(re),ue,function(ie){if(ie)return Z(ie);oe.queue[$]={promise:[fe,Z]},Y&&(oe.queue[$].timeout=setTimeout(function(){delete oe.queue[$],Z(new Error("reply timeout"))},Y))})})}},{key:"login",value:function(){var ae=(0,W.default)(C.default.mark(function be(Y){var ue;return C.default.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,this.call("rpc.login",Y);case 2:if(ue=fe.sent,ue){fe.next=5;break}throw new Error("authentication failed");case 5:return fe.abrupt("return",ue);case 6:case"end":return fe.stop()}},be,this)}));function x(be){return ae.apply(this,arguments)}return x}()},{key:"listMethods",value:function(){var ae=(0,W.default)(C.default.mark(function be(){return C.default.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return ue.next=2,this.call("__listMethods");case 2:return ue.abrupt("return",ue.sent);case 3:case"end":return ue.stop()}},be,this)}));function x(){return ae.apply(this,arguments)}return x}()},{key:"notify",value:function(x,be){var Y=this;return new Promise(function(ue,oe){if(!Y.ready)return oe(new Error("socket not ready"));var fe={jsonrpc:"2.0",method:x,params:be||null};Y.socket.send(JSON.stringify(fe),function(Z){if(Z)return oe(Z);ue()})})}},{key:"subscribe",value:function(){var ae=(0,W.default)(C.default.mark(function be(Y){var ue;return C.default.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return typeof Y=="string"&&(Y=[Y]),fe.next=3,this.call("rpc.on",Y);case 3:if(ue=fe.sent,!(typeof Y=="string"&&ue[Y]!=="ok")){fe.next=6;break}throw new Error("Failed subscribing to an event '"+Y+"' with: "+ue[Y]);case 6:return fe.abrupt("return",ue);case 7:case"end":return fe.stop()}},be,this)}));function x(be){return ae.apply(this,arguments)}return x}()},{key:"unsubscribe",value:function(){var ae=(0,W.default)(C.default.mark(function be(Y){var ue;return C.default.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return typeof Y=="string"&&(Y=[Y]),fe.next=3,this.call("rpc.off",Y);case 3:if(ue=fe.sent,!(typeof Y=="string"&&ue[Y]!=="ok")){fe.next=6;break}throw new Error("Failed unsubscribing from an event with: "+ue);case 6:return fe.abrupt("return",ue);case 7:case"end":return fe.stop()}},be,this)}));function x(be){return ae.apply(this,arguments)}return x}()},{key:"close",value:function(x,be){this.socket.close(x||1e3,be)}},{key:"_connect",value:function(x,be){var Y=this;this.socket=this.webSocketFactory(x,be),this.socket.addEventListener("open",function(){Y.ready=!0,Y.emit("open"),Y.current_reconnects=0}),this.socket.addEventListener("message",function(ue){var oe=ue.data;oe instanceof ArrayBuffer&&(oe=M.from(oe).toString());try{oe=F.default.parse(oe)}catch{return}if(oe.notification&&Y.listeners(oe.notification).length){if(!Object.keys(oe.params).length)return Y.emit(oe.notification);var fe=[oe.notification];if(oe.params.constructor===Object)fe.push(oe.params);else for(var Z=0;Z<oe.params.length;Z++)fe.push(oe.params[Z]);return Promise.resolve().then(function(){Y.emit.apply(Y,fe)})}if(!Y.queue[oe.id])return oe.method&&oe.params?Promise.resolve().then(function(){Y.emit(oe.method,oe.params)}):void 0;"error"in oe=="result"in oe&&Y.queue[oe.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),Y.queue[oe.id].timeout&&clearTimeout(Y.queue[oe.id].timeout),oe.error?Y.queue[oe.id].promise[1](oe.error):Y.queue[oe.id].promise[0](oe.result),delete Y.queue[oe.id]}),this.socket.addEventListener("error",function(ue){return Y.emit("error",ue)}),this.socket.addEventListener("close",function(ue){var oe=ue.code,fe=ue.reason;Y.ready&&setTimeout(function(){return Y.emit("close",oe,fe)},0),Y.ready=!1,Y.socket=void 0,oe!==1e3&&(Y.current_reconnects++,Y.reconnect&&(Y.max_reconnects>Y.current_reconnects||Y.max_reconnects===0)&&setTimeout(function(){return Y._connect(x,be)},Y.reconnect_interval))})}}]),H}(I.EventEmitter);g.default=D},89062:function(Ae,g,K){"use strict";var M=K(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=I;var X=M(K(56690)),C=M(K(89728)),W=M(K(61655)),N=M(K(94993)),_=M(K(73808)),h=K(26729);function v(F){var B=f();return function(){var U=(0,_.default)(F),D;if(B){var R=(0,_.default)(this).constructor;D=Reflect.construct(U,arguments,R)}else D=U.apply(this,arguments);return(0,N.default)(this,D)}}function f(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var T=function(F){(0,W.default)(w,F);var B=v(w);function w(U,D,R){var G;return(0,X.default)(this,w),G=B.call(this),G.socket=new window.WebSocket(U,R),G.socket.onopen=function(){return G.emit("open")},G.socket.onmessage=function(H){return G.emit("message",H.data)},G.socket.onerror=function(H){return G.emit("error",H)},G.socket.onclose=function(H){G.emit("close",H.code,H.reason)},G}return(0,C.default)(w,[{key:"send",value:function(D,R,G){var H=G||R;try{this.socket.send(D),H()}catch(ae){H(ae)}}},{key:"close",value:function(D,R){this.socket.close(D,R)}},{key:"addEventListener",value:function(D,R,G){this.socket.addEventListener(D,R,G)}}]),w}(h.EventEmitter);function I(F,B){return new T(F,B)}},11379:function(Ae,g){"use strict";function K(B,w,U){return w<=B&&B<=U}function M(B){if(B===void 0)return{};if(B===Object(B))return B;throw TypeError("Could not convert argument to dictionary")}function X(B){for(var w=String(B),U=w.length,D=0,R=[];D<U;){var G=w.charCodeAt(D);if(G<55296||G>57343)R.push(G);else if(56320<=G&&G<=57343)R.push(65533);else if(55296<=G&&G<=56319)if(D===U-1)R.push(65533);else{var H=B.charCodeAt(D+1);if(56320<=H&&H<=57343){var ae=G&1023,x=H&1023;R.push(65536+(ae<<10)+x),D+=1}else R.push(65533)}D+=1}return R}function C(B){for(var w="",U=0;U<B.length;++U){var D=B[U];D<=65535?w+=String.fromCharCode(D):(D-=65536,w+=String.fromCharCode((D>>10)+55296,(D&1023)+56320))}return w}var W=-1;function N(B){this.tokens=[].slice.call(B)}N.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():W},prepend:function(B){if(Array.isArray(B))for(var w=B;w.length;)this.tokens.unshift(w.pop());else this.tokens.unshift(B)},push:function(B){if(Array.isArray(B))for(var w=B;w.length;)this.tokens.push(w.shift());else this.tokens.push(B)}};var _=-1;function h(B,w){if(B)throw TypeError("Decoder error");return w||65533}var v="utf-8";function f(B,w){if(!(this instanceof f))return new f(B,w);if(B=B!==void 0?String(B).toLowerCase():v,B!==v)throw new Error("Encoding not supported. Only utf-8 is supported");w=M(w),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(w.fatal),this._ignoreBOM=Boolean(w.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}f.prototype={decode:function(w,U){var D;typeof w=="object"&&w instanceof ArrayBuffer?D=new Uint8Array(w):typeof w=="object"&&"buffer"in w&&w.buffer instanceof ArrayBuffer?D=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):D=new Uint8Array(0),U=M(U),this._streaming||(this._decoder=new I({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(U.stream);for(var R=new N(D),G=[],H;!R.endOfStream()&&(H=this._decoder.handler(R,R.read()),H!==_);)H!==null&&(Array.isArray(H)?G.push.apply(G,H):G.push(H));if(!this._streaming){do{if(H=this._decoder.handler(R,R.read()),H===_)break;H!==null&&(Array.isArray(H)?G.push.apply(G,H):G.push(H))}while(!R.endOfStream());this._decoder=null}return G.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(G[0]===65279?(this._BOMseen=!0,G.shift()):this._BOMseen=!0),C(G)}};function T(B,w){if(!(this instanceof T))return new T(B,w);if(B=B!==void 0?String(B).toLowerCase():v,B!==v)throw new Error("Encoding not supported. Only utf-8 is supported");w=M(w),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(w.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}T.prototype={encode:function(w,U){w=w?String(w):"",U=M(U),this._streaming||(this._encoder=new F(this._options)),this._streaming=Boolean(U.stream);for(var D=[],R=new N(X(w)),G;!R.endOfStream()&&(G=this._encoder.handler(R,R.read()),G!==_);)Array.isArray(G)?D.push.apply(D,G):D.push(G);if(!this._streaming){for(;G=this._encoder.handler(R,R.read()),G!==_;)Array.isArray(G)?D.push.apply(D,G):D.push(G);this._encoder=null}return new Uint8Array(D)}};function I(B){var w=B.fatal,U=0,D=0,R=0,G=128,H=191;this.handler=function(ae,x){if(x===W&&R!==0)return R=0,h(w);if(x===W)return _;if(R===0){if(K(x,0,127))return x;if(K(x,194,223))R=1,U=x-192;else if(K(x,224,239))x===224&&(G=160),x===237&&(H=159),R=2,U=x-224;else if(K(x,240,244))x===240&&(G=144),x===244&&(H=143),R=3,U=x-240;else return h(w);return U=U<<6*R,null}if(!K(x,G,H))return U=R=D=0,G=128,H=191,ae.prepend(x),h(w);if(G=128,H=191,D+=1,U+=x-128<<6*(R-D),D!==R)return null;var be=U;return U=R=D=0,be}}function F(B){var w=B.fatal;this.handler=function(U,D){if(D===W)return _;if(K(D,0,127))return D;var R,G;K(D,128,2047)?(R=1,G=192):K(D,2048,65535)?(R=2,G=224):K(D,65536,1114111)&&(R=3,G=240);for(var H=[(D>>6*R)+G];R>0;){var ae=D>>6*(R-1);H.push(128|ae&63),R-=1}return H}}g.TextEncoder=T,g.TextDecoder=f},35620:function(Ae,g,K){"use strict";K.d(g,{US:function(){return N},YU:function(){return X}});var M=K(79911);const X=M.base16,C=M.base32,W=M.base32hex,N=M.base64,_=M.base64url,h=M.codec;var v=null}}]);
|