UNPKG

@toruslabs/solana-embed

Version:
2 lines 399 kB
/*! For license information please see solanaEmbed.umd.min.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SolanaEmbed=e():t.SolanaEmbed=e()}(self,()=>(()=>{var t={22:(t,e,r)=>{"use strict";const n=r(8341).v4,i=r(3289),o=function(t,e){if(!(this instanceof o))return new o(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return n()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};t.exports=o,o.prototype.request=function(t,e,r,n){const o=this;let s=null;const a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&t&&"object"==typeof t&&"function"==typeof e)n=e,s=t;else{"function"==typeof r&&(n=r,r=void 0);const o="function"==typeof n;try{s=i(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(o)return n(t);throw t}if(!o)return s}let u;try{u=JSON.stringify(s,this.options.replacer)}catch(t){return n(t)}return this.callServer(u,function(t,e){o._parseResponse(t,e,n)}),s},o.prototype._parseResponse=function(t,e,r){if(t)return void r(t);if(!e)return r();let n;try{n=JSON.parse(e,this.options.reviver)}catch(t){return r(t)}if(3===r.length){if(Array.isArray(n)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return r(null,n.filter(t),n.filter(e))}return r(null,n.error,n.result)}r(null,n)}},41:(t,e,r)=>{"use strict";var n=r(655),i=r(8068),o=r(9675),s=r(5795);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new o("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],h=!!s&&s(t,e);if(n)n(t,e,{configurable:null===l&&h?h.configurable:!l,enumerable:null===a&&h?h.enumerable:!a,value:r,writable:null===u&&h?h.writable:!u});else{if(!c&&(a||u||l))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},76:t=>{"use strict";t.exports=Function.prototype.call},228:t=>{"use strict";var e=Object.prototype.hasOwnProperty,r="~";function n(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||t,s),u=r?r+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],a]:t._events[u].push(a):(t._events[u]=a,t._eventsCount++),t}function s(t,e){0===--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,i=[];if(0===this._eventsCount)return i;for(n in t=this._events)e.call(t,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,i,o,s){var a=r?r+t:t;if(!this._events[a])return!1;var u,l,c=this._events[a],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,i),!0;case 5:return c.fn.call(c.context,e,n,i,o),!0;case 6:return c.fn.call(c.context,e,n,i,o,s),!0}for(l=1,u=new Array(h-1);l<h;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var f,d=c.length;for(l=0;l<d;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),h){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,n);break;case 4:c[l].fn.call(c[l].context,e,n,i);break;default:if(!u)for(f=1,u=new Array(h-1);f<h;f++)u[f-1]=arguments[f];c[l].fn.apply(c[l].context,u)}}return!0},a.prototype.on=function(t,e,r){return o(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return o(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,n,i){var o=r?r+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var u=0,l=[],c=a.length;u<c;u++)(a[u].fn!==e||i&&!a[u].once||n&&a[u].context!==n)&&l.push(a[u]);l.length?this._events[o]=1===l.length?l[0]:l:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a},251:(t,e)=>{e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,l=u>>1,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+t[e+h],h+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=l}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,l=8*o-i-1,c=(1<<l)-1,h=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[r+d]=255&s,d+=p,s/=256,l-=8);t[r+d-p]|=128*g}},277:(t,e,r)=>{"use strict";const{ArrayIsArray:n,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:s,NumberIsInteger:a,NumberIsNaN:u,NumberMAX_SAFE_INTEGER:l,NumberMIN_SAFE_INTEGER:c,NumberParseInt:h,ObjectPrototypeHasOwnProperty:f,RegExpPrototypeExec:d,String:p,StringPrototypeToUpperCase:g,StringPrototypeTrim:y}=r(4134),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:b,ERR_INVALID_ARG_TYPE:w,ERR_INVALID_ARG_VALUE:v,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:_}}=r(6371),{normalizeEncoding:E}=r(7760),{isAsyncFunction:A,isArrayBufferView:I}=r(7760).types,k={},x=/^[0-7]+$/,M=m((t,e,r=c,n=l)=>{if("number"!=typeof t)throw new w(e,"number",t);if(!a(t))throw new S(e,"an integer",t);if(t<r||t>n)throw new S(e,`>= ${r} && <= ${n}`,t)}),B=m((t,e,r=-2147483648,n=2147483647)=>{if("number"!=typeof t)throw new w(e,"number",t);if(!a(t))throw new S(e,"an integer",t);if(t<r||t>n)throw new S(e,`>= ${r} && <= ${n}`,t)}),R=m((t,e,r=!1)=>{if("number"!=typeof t)throw new w(e,"number",t);if(!a(t))throw new S(e,"an integer",t);const n=r?1:0,i=4294967295;if(t<n||t>i)throw new S(e,`>= ${n} && <= ${i}`,t)});function O(t,e){if("string"!=typeof t)throw new w(e,"string",t)}const T=m((t,e,r)=>{if(!i(r,t)){const n=o(s(r,t=>"string"==typeof t?`'${t}'`:p(t)),", ");throw new v(e,t,"must be one of: "+n)}});function P(t,e){if("boolean"!=typeof t)throw new w(e,"boolean",t)}function L(t,e,r){return null!=t&&f(t,e)?t[e]:r}const N=m((t,e,r=null)=>{const i=L(r,"allowArray",!1),o=L(r,"allowFunction",!1);if(!L(r,"nullable",!1)&&null===t||!i&&n(t)||"object"!=typeof t&&(!o||"function"!=typeof t))throw new w(e,"Object",t)}),C=m((t,e)=>{if(null!=t&&"object"!=typeof t&&"function"!=typeof t)throw new w(e,"a dictionary",t)}),U=m((t,e,r=0)=>{if(!n(t))throw new w(e,"Array",t);if(t.length<r)throw new v(e,t,`must be longer than ${r}`)}),j=m((t,e="buffer")=>{if(!I(t))throw new w(e,["Buffer","TypedArray","DataView"],t)}),D=m((t,e)=>{if(void 0!==t&&(null===t||"object"!=typeof t||!("aborted"in t)))throw new w(e,"AbortSignal",t)}),W=m((t,e)=>{if("function"!=typeof t)throw new w(e,"Function",t)}),F=m((t,e)=>{if("function"!=typeof t||A(t))throw new w(e,"Function",t)}),z=m((t,e)=>{if(void 0!==t)throw new w(e,"undefined",t)}),$=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function H(t,e){if(void 0===t||!d($,t))throw new v(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:function(t){return t===(0|t)},isUint32:function(t){return t===t>>>0},parseFileMode:function(t,e,r){if(void 0===t&&(t=r),"string"==typeof t){if(null===d(x,t))throw new v(e,t,"must be a 32-bit unsigned integer or an octal string");t=h(t,8)}return R(t,e),t},validateArray:U,validateStringArray:function(t,e){U(t,e);for(let r=0;r<t.length;r++)O(t[r],`${e}[${r}]`)},validateBooleanArray:function(t,e){U(t,e);for(let r=0;r<t.length;r++)P(t[r],`${e}[${r}]`)},validateAbortSignalArray:function(t,e){U(t,e);for(let r=0;r<t.length;r++){const n=t[r],i=`${e}[${r}]`;if(null==n)throw new w(i,"AbortSignal",n);D(n,i)}},validateBoolean:P,validateBuffer:j,validateDictionary:C,validateEncoding:function(t,e){const r=E(e),n=t.length;if("hex"===r&&n%2!=0)throw new v("encoding",e,`is invalid for data of length ${n}`)},validateFunction:W,validateInt32:B,validateInteger:M,validateNumber:function(t,e,r=void 0,n){if("number"!=typeof t)throw new w(e,"number",t);if(null!=r&&t<r||null!=n&&t>n||(null!=r||null!=n)&&u(t))throw new S(e,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,t)},validateObject:N,validateOneOf:T,validatePlainFunction:F,validatePort:function(t,e="Port",r=!0){if("number"!=typeof t&&"string"!=typeof t||"string"==typeof t&&0===y(t).length||+t!==+t>>>0||t>65535||0===t&&!r)throw new b(e,t,r);return 0|t},validateSignalName:function(t,e="signal"){if(O(t,e),void 0===k[t]){if(void 0!==k[g(t)])throw new _(t+" (signals must use all capital letters)");throw new _(t)}},validateString:O,validateUint32:R,validateUndefined:z,validateUnion:function(t,e,r){if(!i(r,t))throw new w(e,`('${o(r,"|")}')`,t)},validateAbortSignal:D,validateLinkHeaderValue:function(t){if("string"==typeof t)return H(t,"hints"),t;if(n(t)){const e=t.length;let r="";if(0===e)return r;for(let n=0;n<e;n++){const i=t[n];H(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new v("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}},345:(t,e,r)=>{"use strict";const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:s}=r(4134),{Buffer:a}=r(8287),{inspect:u}=r(7760);t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){const e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}unshift(t){const e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}shift(){if(0===this.length)return;const t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(0===this.length)return"";let e=this.head,r=""+e.data;for(;null!==(e=e.next);)r+=t+e.data;return r}concat(t){if(0===this.length)return a.alloc(0);const e=a.allocUnsafe(t>>>0);let r=this.head,n=0;for(;r;)o(e,r.data,n),n+=r.data.length,r=r.next;return e}consume(t,e){const r=this.head.data;if(t<r.length){const e=r.slice(0,t);return this.head.data=r.slice(t),e}return t===r.length?this.shift():e?this._getString(t):this._getBuffer(t)}first(){return this.head.data}*[i](){for(let t=this.head;t;t=t.next)yield t.data}_getString(t){let e="",r=this.head,i=0;do{const o=r.data;if(!(t>o.length)){t===o.length?(e+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(e+=n(o,0,t),this.head=r,r.data=n(o,t));break}e+=o,t-=o.length,++i}while(null!==(r=r.next));return this.length-=i,e}_getBuffer(t){const e=a.allocUnsafe(t),r=t;let n=this.head,i=0;do{const a=n.data;if(!(t>a.length)){t===a.length?(o(e,a,r-t),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(e,new s(a.buffer,a.byteOffset,t),r-t),this.head=n,n.data=a.slice(t));break}o(e,a,r-t),t-=a.length,++i}while(null!==(n=n.next));return this.length-=i,e}[Symbol.for("nodejs.util.inspect.custom")](t,e){return u(this,{...e,depth:0,customInspect:!1})}}},414:t=>{"use strict";t.exports=Math.round},453:(t,e,r)=>{"use strict";var n,i=r(9612),o=r(9383),s=r(1237),a=r(9290),u=r(9538),l=r(8068),c=r(9675),h=r(5345),f=r(1514),d=r(8968),p=r(6188),g=r(8002),y=r(5880),m=r(414),b=r(3093),w=Function,v=function(t){try{return w('"use strict"; return ('+t+").constructor;")()}catch(t){}},S=r(5795),_=r(655),E=function(){throw new c},A=S?function(){try{return E}catch(t){try{return S(arguments,"callee").get}catch(t){return E}}}():E,I=r(4039)(),k=r(3628),x=r(1064),M=r(8648),B=r(1002),R=r(76),O={},T="undefined"!=typeof Uint8Array&&k?k(Uint8Array):n,P={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":I&&k?k([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":O,"%AsyncGenerator%":O,"%AsyncGeneratorFunction%":O,"%AsyncIteratorPrototype%":O,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":s,"%Float16Array%":"undefined"==typeof Float16Array?n:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":w,"%GeneratorFunction%":O,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":I&&k?k(k([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&I&&k?k((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":a,"%ReferenceError%":u,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&I&&k?k((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":I&&k?k(""[Symbol.iterator]()):n,"%Symbol%":I?Symbol:n,"%SyntaxError%":l,"%ThrowTypeError%":A,"%TypedArray%":T,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":h,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet,"%Function.prototype.call%":R,"%Function.prototype.apply%":B,"%Object.defineProperty%":_,"%Object.getPrototypeOf%":x,"%Math.abs%":f,"%Math.floor%":d,"%Math.max%":p,"%Math.min%":g,"%Math.pow%":y,"%Math.round%":m,"%Math.sign%":b,"%Reflect.getPrototypeOf%":M};if(k)try{null.error}catch(t){var L=k(k(t));P["%Error.prototype%"]=L}var N=function t(e){var r;if("%AsyncFunction%"===e)r=v("async function () {}");else if("%GeneratorFunction%"===e)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=v("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&k&&(r=k(i.prototype))}return P[e]=r,r},C={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},U=r(6743),j=r(9957),D=U.call(R,Array.prototype.concat),W=U.call(B,Array.prototype.splice),F=U.call(R,String.prototype.replace),z=U.call(R,String.prototype.slice),$=U.call(R,RegExp.prototype.exec),H=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,q=/\\(\\)?/g,K=function(t,e){var r,n=t;if(j(C,n)&&(n="%"+(r=C[n])[0]+"%"),j(P,n)){var i=P[n];if(i===O&&(i=N(n)),void 0===i&&!e)throw new c("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new l("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new c('"allowMissing" argument must be a boolean');if(null===$(/^%?[^%]*%?$/,t))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=z(t,0,1),r=z(t,-1);if("%"===e&&"%"!==r)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new l("invalid intrinsic syntax, expected opening `%`");var n=[];return F(t,H,function(t,e,r,i){n[n.length]=r?F(i,q,"$1"):e||t}),n}(t),n=r.length>0?r[0]:"",i=K("%"+n+"%",e),o=i.name,s=i.value,a=!1,u=i.alias;u&&(n=u[0],W(r,D([0,1],u)));for(var h=1,f=!0;h<r.length;h+=1){var d=r[h],p=z(d,0,1),g=z(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===g||"'"===g||"`"===g)&&p!==g)throw new l("property names with quotes must have matching quotes");if("constructor"!==d&&f||(a=!0),j(P,o="%"+(n+="."+d)+"%"))s=P[o];else if(null!=s){if(!(d in s)){if(!e)throw new c("base intrinsic for "+t+" exists, but the property is not available.");return}if(S&&h+1>=r.length){var y=S(s,d);s=(f=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:s[d]}else f=j(s,d),s=s[d];f&&!a&&(P[o]=s)}}return s}},487:(t,e,r)=>{"use strict";var n=r(6897),i=r(655),o=r(3126),s=r(2205);t.exports=function(t){var e=o(arguments),r=t.length-(arguments.length-1);return n(e,1+(r>0?r:0),!0)},i?i(t.exports,"apply",{value:s}):t.exports.apply=s},592:(t,e,r)=>{"use strict";var n=r(655),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},601:(t,e,r)=>{"use strict";e.I0=e.DH=e.NX=e.u8=e.cY=void 0,e.av=e.O6=e.w3=e.Wg=void 0;const n=r(8287);function i(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function o(t){return i(t),n.Buffer.from(t.buffer,t.byteOffset,t.length)}class s{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function a(t,e){return e.property?t+"["+e.property+"]":t}class u extends s{isCount(){throw new Error("ExternalLayout is abstract")}}class l extends u{constructor(t,e=0,r){if(!(t instanceof s))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof c||this.layout instanceof h}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}class c extends s{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return o(t).readUIntLE(e,this.span)}encode(t,e,r=0){return o(e).writeUIntLE(t,r,this.span),this.span}}class h extends s{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return o(t).readUIntBE(e,this.span)}encode(t,e,r=0){return o(e).writeUIntBE(t,r,this.span),this.span}}const f=Math.pow(2,32);function d(t){const e=Math.floor(t/f);return{hi32:e,lo32:t-e*f}}function p(t,e){return t*f+e}class g extends s{constructor(t){super(8,t)}decode(t,e=0){const r=o(t),n=r.readUInt32LE(e);return p(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=d(t),i=o(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}class y extends s{constructor(t){super(8,t)}decode(t,e=0){const r=o(t),n=r.readUInt32LE(e);return p(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=d(t),i=o(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}class m extends s{constructor(t,e,r){if(!(t instanceof s))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof u&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(e instanceof u)&&0<t.span&&(n=e*t.span),super(n,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof u&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(t,e+r),++i}return r}decode(t,e=0){const r=[];let n=0,i=this.count;for(i instanceof u&&(i=i.decode(t,e));n<i;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),n+=1;return r}encode(t,e,r=0){const n=this.elementLayout,i=t.reduce((t,i)=>t+n.encode(i,e,r+t),0);return this.count instanceof u&&this.count.encode(t.length,e,r),i}}class b extends s{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce((t,e)=>t&&e instanceof s,!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===r&&(r=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce((t,e)=>t+e.getSpan(),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,n)=>{const i=n.getSpan(t,e);return e+=i,r+i},0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){i(t);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){const n=r;let i=0,o=0;for(const n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){const i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-n}fromArray(t){const e=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}class w extends s{constructor(t,e){if(!(t instanceof u&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof u||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),o(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof u&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(a("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const i=o(t);return o(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof u&&this.length.encode(n,e,r),n}}e.cY=(t,e,r)=>new l(t,e,r),e.u8=t=>new c(1,t),e.NX=t=>new c(2,t),e.DH=t=>new c(4,t),e.I0=t=>new g(t),e.Wg=t=>new y(t),e.w3=(t,e,r)=>new b(t,e,r),e.O6=(t,e,r)=>new m(t,e,r),e.av=(t,e)=>new w(t,e)},655:t=>{"use strict";var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}t.exports=e},815:(t,e,r)=>{var n,i=r(5606),o=r(3519),s=r(6611);try{n=r(2376)}catch(t){}var a=function(){},u=void 0!==i&&/^v?\.0/.test(i.version),l=function(t){return"function"==typeof t},c=function(t){t()},h=function(t,e){return t.pipe(e)};t.exports=function(){var t,e=Array.prototype.slice.call(arguments),r=l(e[e.length-1]||a)&&e.pop()||a;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var i=e.map(function(h,f){var d=f<e.length-1;return function(t,e,r,i){i=o(i);var c=!1;t.on("close",function(){c=!0}),s(t,{readable:e,writable:r},function(t){if(t)return i(t);c=!0,i()});var h=!1;return function(e){if(!c&&!h)return h=!0,function(t){return!!u&&!!n&&(t instanceof(n.ReadStream||a)||t instanceof(n.WriteStream||a))&&l(t.close)}(t)?t.close(a):function(t){return t.setHeader&&l(t.abort)}(t)?t.abort():l(t.destroy)?t.destroy():void i(e||new Error("stream was destroyed"))}}(h,d,f>0,function(e){t||(t=e),e&&i.forEach(c),d||(i.forEach(c),r(t))})});return e.reduce(h)}},823:(t,e,r)=>{"use strict";const n=globalThis.AbortController||r(5568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:a},AbortError:u}=r(6371),{validateAbortSignal:l,validateInteger:c,validateObject:h}=r(277),f=r(4134).Symbol("kWeak"),d=r(4134).Symbol("kResistStopPropagation"),{finished:p}=r(6238),g=r(7830),{addAbortSignalNoValidate:y}=r(4147),{isWritable:m,isNodeStream:b}=r(6115),{deprecate:w}=r(7760),{ArrayPrototypePush:v,Boolean:S,MathFloor:_,Number:E,NumberIsNaN:A,Promise:I,PromiseReject:k,PromiseResolve:x,PromisePrototypeThen:M,Symbol:B}=r(4134),R=B("kEmpty"),O=B("kEof");function T(t,e){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);null!=e&&h(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal");let n=1;null!=(null==e?void 0:e.concurrency)&&(n=_(e.concurrency));let i=n-1;return null!=(null==e?void 0:e.highWaterMark)&&(i=_(e.highWaterMark)),c(n,"options.concurrency",1),c(i,"options.highWaterMark",0),i+=n,async function*(){const o=r(7760).AbortSignalAny([null==e?void 0:e.signal].filter(S)),s=this,a=[],l={signal:o};let c,h,f=!1,d=0;function p(){f=!0,g()}function g(){d-=1,y()}function y(){h&&!f&&d<n&&a.length<i&&(h(),h=null)}!async function(){try{for await(let e of s){if(f)return;if(o.aborted)throw new u;try{if(e=t(e,l),e===R)continue;e=x(e)}catch(t){e=k(t)}d+=1,M(e,g,p),a.push(e),c&&(c(),c=null),!f&&(a.length>=i||d>=n)&&await new I(t=>{h=t})}a.push(O)}catch(t){const e=k(t);M(e,g,p),a.push(e)}finally{f=!0,c&&(c(),c=null)}}();try{for(;;){for(;a.length>0;){const t=await a[0];if(t===O)return;if(o.aborted)throw new u;t!==R&&(yield t),a.shift(),y()}await new I(t=>{c=t})}}finally{f=!0,h&&(h(),h=null)}}.call(this)}async function P(t,e=void 0){for await(const r of L.call(this,t,e))return!0;return!1}function L(t,e){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);return T.call(this,async function(e,r){return await t(e,r)?e:R},e)}class N extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function C(t){if(t=E(t),A(t))return 0;if(t<0)throw new a("number",">= 0",t);return t}t.exports.streamReturningOperators={asIndexedPairs:w(function(t=void 0){return null!=t&&h(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),async function*(){let e=0;for await(const n of this){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new u({cause:t.signal.reason});yield[e++,n]}}.call(this)},"readable.asIndexedPairs will be removed in a future version."),drop:function(t,e=void 0){return null!=e&&h(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),t=C(t),async function*(){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new u;for await(const r of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new u;t--<=0&&(yield r)}}.call(this)},filter:L,flatMap:function(t,e){const r=T.call(this,t,e);return async function*(){for await(const t of r)yield*t}.call(this)},map:T,take:function(t,e=void 0){return null!=e&&h(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),t=C(t),async function*(){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new u;for await(const r of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new u;if(t-- >0&&(yield r),t<=0)return}}.call(this)},compose:function(t,e){if(null!=e&&h(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),b(t)&&!m(t))throw new i("stream",t,"must be writable");const r=g(this,t);return null!=e&&e.signal&&y(e.signal,r),r}},t.exports.promiseReturningOperators={every:async function(t,e=void 0){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);return!await P.call(this,async(...e)=>!await t(...e),e)},forEach:async function(t,e){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);for await(const r of T.call(this,async function(e,r){return await t(e,r),R},e));},reduce:async function(t,e,r){var i;if("function"!=typeof t)throw new o("reducer",["Function","AsyncFunction"],t);null!=r&&h(r,"options"),null!=(null==r?void 0:r.signal)&&l(r.signal,"options.signal");let s=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const t=new u(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await p(this.destroy(t)),t}const a=new n,c=a.signal;if(null!=r&&r.signal){const t={once:!0,[f]:this,[d]:!0};r.signal.addEventListener("abort",()=>a.abort(),t)}let g=!1;try{for await(const n of this){var y;if(g=!0,null!=r&&null!==(y=r.signal)&&void 0!==y&&y.aborted)throw new u;s?e=await t(e,n,{signal:c}):(e=n,s=!0)}if(!g&&!s)throw new N}finally{a.abort()}return e},toArray:async function(t){null!=t&&h(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal");const e=[];for await(const n of this){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new u(void 0,{cause:t.signal.reason});v(e,n)}return e},some:P,find:async function(t,e){for await(const r of L.call(this,t,e))return r}}},1002:t=>{"use strict";t.exports=Function.prototype.apply},1064:(t,e,r)=>{"use strict";var n=r(9612);t.exports=n.getPrototypeOf||null},1093:t=>{"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),n}},1189:(t,e,r)=>{"use strict";var n=Array.prototype.slice,i=r(1093),o=Object.keys,s=o?function(t){return o(t)}:r(8875),a=Object.keys;s.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return i(t)?a(n.call(t)):a(t)})}else Object.keys=s;return Object.keys||s},t.exports=s},1237:t=>{"use strict";t.exports=EvalError},1333:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var n in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},1514:t=>{"use strict";t.exports=Math.abs},2017:t=>{"use strict";t.exports=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if((n=e.length)!=r.length)return!1;for(i=n;0!==i--;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((n=(o=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(i=n;0!==i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!==i--;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!=e&&r!=r}},2205:(t,e,r)=>{"use strict";var n=r(6743),i=r(1002),o=r(3144);t.exports=function(){return o(n,i,arguments)}},2376:()=>{},2755:function(t,e,r){"use strict";var n=r(8287).Buffer,i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__decorate||function(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return o(e,t),e},u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeUnchecked=e.deserialize=e.serialize=e.BinaryReader=e.BinaryWriter=e.BorshError=e.baseDecode=e.baseEncode=void 0;const l=u(r(9404)),c=u(r(6763)),h=a(r(4281)),f=new("function"!=typeof TextDecoder?h.TextDecoder:TextDecoder)("utf-8",{fatal:!0});e.baseEncode=function(t){return"string"==typeof t&&(t=n.from(t,"utf8")),c.default.encode(n.from(t))},e.baseDecode=function(t){return n.from(c.default.decode(t))};const d=1024;class p extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}e.BorshError=p;class g{constructor(){this.buf=n.alloc(d),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=n.concat([this.buf,n.alloc(d)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(n.from(new l.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(n.from(new l.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(n.from(new l.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(n.from(new l.default(t).toArray("le",64)))}writeBuffer(t){this.buf=n.concat([n.from(this.buf.subarray(0,this.length)),t,n.alloc(d)]),this.length+=t.length}writeString(t){this.maybeResize();const e=n.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(n.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const r of t)this.maybeResize(),e(r)}toArray(){return this.buf.subarray(0,this.length)}}function y(t,e,r){const n=r.value;r.value=function(...t){try{return n.apply(this,t)}catch(t){if(t instanceof RangeError){const e=t.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e)>=0)throw new p("Reached the end of buffer when deserializing")}throw t}}}e.BinaryWriter=g;class m{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new l.default(t,"le")}readU128(){const t=this.readBuffer(16);return new l.default(t,"le")}readU256(){const t=this.readBuffer(32);return new l.default(t,"le")}readU512(){const t=this.readBuffer(64);return new l.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new p(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return f.decode(e)}catch(t){throw new p(`Error decoding UTF-8 string: ${t}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),r=Array();for(let n=0;n<e;++n)r.push(t());return r}}function b(t){return t.charAt(0).toUpperCase()+t.slice(1)}function w(t,e,r,n,i){try{if("string"==typeof n)i[`write${b(n)}`](r);else if(n instanceof Array)if("number"==typeof n[0]){if(r.length!==n[0])throw new p(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(2===n.length&&"number"==typeof n[1]){if(r.length!==n[1])throw new p(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let e=0;e<n[1];e++)w(t,null,r[e],n[0],i)}else i.writeArray(r,r=>{w(t,e,r,n[0],i)});else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),w(t,e,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach((r,o)=>{w(t,e,o,n.key,i),w(t,e,r,n.value,i)});break;default:throw new p(`FieldType ${n} unrecognized`)}else v(t,r,i)}catch(t){throw t instanceof p&&t.addToFieldPath(e),t}}function v(t,e,r){if("function"==typeof e.borshSerialize)return void e.borshSerialize(r);const n=t.get(e.constructor);if(!n)throw new p(`Class ${e.constructor.name} is missing in schema`);if("struct"===n.kind)n.fields.map(([n,i])=>{w(t,n,e[n],i,r)});else{if("enum"!==n.kind)throw new p(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`);{const i=e[n.field];for(let o=0;o<n.values.length;++o){const[s,a]=n.values[o];if(s===i){r.writeU8(o),w(t,s,e[s],a,r);break}}}}}function S(t,e,r,n){try{if("string"==typeof r)return n[`read${b(r)}`]();if(r instanceof Array){if("number"==typeof r[0])return n.readFixedArray(r[0]);if("number"==typeof r[1]){const e=[];for(let i=0;i<r[1];i++)e.push(S(t,null,r[0],n));return e}return n.readArray(()=>S(t,e,r[0],n))}if("option"===r.kind)return n.readU8()?S(t,e,r.type,n):void 0;if("map"===r.kind){let i=new Map;const o=n.readU32();for(let s=0;s<o;s++){const o=S(t,e,r.key,n),s=S(t,e,r.value,n);i.set(o,s)}return i}return _(t,r,n)}catch(t){throw t instanceof p&&t.addToFieldPath(e),t}}function _(t,e,r){if("function"==typeof e.borshDeserialize)return e.borshDeserialize(r);const n=t.get(e);if(!n)throw new p(`Class ${e.name} is missing in schema`);if("struct"===n.kind){const n={};for(const[i,o]of t.get(e).fields)n[i]=S(t,i,o,r);return new e(n)}if("enum"===n.kind){const i=r.readU8();if(i>=n.values.length)throw new p(`Enum index: ${i} is out of range`);const[o,s]=n.values[i],a=S(t,o,s,r);return new e({[o]:a})}throw new p(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}s([y],m.prototype,"readU8",null),s([y],m.prototype,"readU16",null),s([y],m.prototype,"readU32",null),s([y],m.prototype,"readU64",null),s([y],m.prototype,"readU128",null),s([y],m.prototype,"readU256",null),s([y],m.prototype,"readU512",null),s([y],m.prototype,"readString",null),s([y],m.prototype,"readFixedArray",null),s([y],m.prototype,"readArray",null),e.BinaryReader=m,e.serialize=function(t,e,r=g){const n=new r;return v(t,e,n),n.toArray()},e.deserialize=function(t,e,r,n=m){const i=new n(r),o=_(t,e,i);if(i.offset<r.length)throw new p(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return o},e.deserializeUnchecked=function(t,e,r,n=m){return _(t,e,new n(r))}},2861:(t,e,r)=>{var n=r(8287),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},3065:function(t,e,r){var n,i;!function(){"use strict";n=function(){var t=function(){},e="undefined",r=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],i={},o=null;function s(t,e){var r=t[e];if("function"==typeof r.bind)return r.bind(t);try{return Function.prototype.bind.call(r,t)}catch(e){return function(){return Function.prototype.apply.apply(r,[t,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(){for(var r=this.getLevel(),i=0;i<n.length;i++){var o=n[i];this[o]=i<r?t:this.methodFactory(o,r,this.name)}if(this.log=this.debug,typeof console===e&&r<this.levels.SILENT)return"No console available for logging"}function l(t){return function(){typeof console!==e&&(u.call(this),this[t].apply(this,arguments))}}function c(n,i,o){return function(n){return"debug"===n&&(n="log"),typeof console!==e&&("trace"===n&&r?a:void 0!==console[n]?s(console,n):void 0!==console.log?s(console,"log"):t)}(n)||l.apply(this,arguments)}function h(t,r){var s,a,l,h=this,f="loglevel";function d(){var t;if(typeof window!==e&&f){try{t=window.localStorage[f]}catch(t){}if(typeof t===e)try{var r=window.document.cookie,n=encodeURIComponent(f),i=r.indexOf(n+"=");-1!==i&&(t=/^([^;]+)/.exec(r.slice(i+n.length+1))[1])}catch(t){}return void 0===h.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==h.levels[e.toUpperCase()]&&(e=h.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=h.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?f+=":"+t:"symbol"==typeof t&&(f=void 0),h.name=t,h.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},h.methodFactory=r||c,h.getLevel=function(){return null!=l?l:null!=a?a:s},h.setLevel=function(t,r){return l=p(t),!1!==r&&function(t){var r=(n[t]||"silent").toUpperCase();if(typeof window!==e&&f){try{return void(window.localStorage[f]=r)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"="+r+";"}catch(t){}}}(l),u.call(h)},h.setDefaultLevel=function(t){a=p(t),d()||h.setLevel(t,!1)},h.resetLevel=function(){l=null,function(){if(typeof window!==e&&f){try{window.localStorage.removeItem(f)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),u.call(h)},h.enableAll=function(t){h.setLevel(h.levels.TRACE,t)},h.disableAll=function(t){h.setLevel(h.levels.SILENT,t)},h.rebuild=function(){if(o!==h&&(s=p(o.getLevel())),u.call(h),o===h)for(var t in i)i[t].rebuild()},s=p(o?o.getLevel():"WARN");var g=d();null!=g&&(l=p(g)),u.call(h)}(o=new h).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=i[t];return e||(e=i[t]=new h(t,o.methodFactory)),e};var f=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=f),o},o.getLoggers=function(){return i},o.default=o,o},void 0===(i=n.call(e,r,e,t))||(t.exports=i)}()},3093:(t,e,r)=>{"use strict";var n=r(4459);t.exports=function(t){return n(t)||0===t?t:t<0?-1:1}},3095:(t,e,r)=>{"use strict";const{ArrayPrototypePop:n,Promise:i}=r(4134),{isIterable:o,isNodeStream:s,isWebStream:a}=r(6115),{pipelineImpl:u}=r(7758),{finished:l}=r(6238);r(5506),t.exports={finished:l,pipeline:function(...t){return new i((e,r)=>{let i,l;const c=t[t.length-1];if(c&&"object"==typeof c&&!s(c)&&!o(c)&&!a(c)){const e=n(t);i=e.signal,l=e.end}u(t,(t,n)=>{t?r(t):e(n)},{signal:i,end:l})})}}},3126:(t,e,r)=>{"use strict";var n=r(6743),i=r(9675),o=r(76),s=r(3144);t.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new i("a function is required");return s(n,o,t)}},3141:(t,e,r)=>{"use strict";var n=r(2861).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=h,e=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=