1import{o as e,s as t,t as n}from"./chunk-Bj-mKKzh.js";import{n as r,t as i}from"./dist-BuHjWnbt.js";import{_ as a,f as o,g as s,y as c}from"./count-Di9Hz7kC.js";import{n as l,r as u,t as d}from"./dist-djiksfNb.js";import{t as f}from"./bn-C4O2-_hB.js";import{$ as p,P as m,Q as h,R as g,St as _,W as v,_t as y,k as b,p as x,rt as S,vt as C,xt as w}from"./index.browser.esm-CV6Q-YPE.js";import{i as T,r as E}from"./eventemitter3-ZEuErxrW.js";import{t as D}from"./dist-CJTOcd9M.js";import{a as O,i as ee,l as k,r as A,s as te,t as ne}from"./esm-Binww-s_.js";u();var re=t(f()),ie=t(_());E();var j=t(w(),1);C();var ae=`escrow`,oe=`00000000000000000000000000000000000000000000`,se=n(((e,t)=>{var n=/[\p{Lu}]/u,r=/[\p{Ll}]/u,i=/^[\p{Lu}](?![\p{Lu}])/gu,a=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,s=RegExp(`^`+o.source),c=new RegExp(o.source+a.source,`gu`),l=RegExp(`\\d+`+a.source,`gu`),u=(e,t,i)=>{let a=!1,o=!1,s=!1;for(let c=0;c<e.length;c++){let l=e[c];a&&n.test(l)?(e=e.slice(0,c)+`-`+e.slice(c),a=!1,s=o,o=!0,c++):o&&s&&r.test(l)?(e=e.slice(0,c-1)+`-`+e.slice(c-1),s=o,o=!1,a=!0):(a=t(l)===l&&i(l)!==l,s=o,o=i(l)===l&&t(l)!==l)}return e},d=(e,t)=>(i.lastIndex=0,e.replace(i,e=>t(e))),f=(e,t)=>(c.lastIndex=0,l.lastIndex=0,e.replace(c,(e,n)=>t(n)).replace(l,e=>t(e))),p=(e,t)=>{if(!(typeof e==`string`||Array.isArray(e)))throw TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},e=Array.isArray(e)?e.map(e=>e.trim()).filter(e=>e.length).join(`-`):e.trim(),e.length===0)return``;let n=t.locale===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),r=t.locale===!1?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);return e.length===1?t.pascalCase?r(e):n(e):(e!==n(e)&&(e=u(e,n,r)),e=e.replace(s,``),e=t.preserveConsecutiveUppercase?d(e,n):n(e),t.pascalCase&&(e=r(e.charAt(0))+e.slice(1)),f(e,r))};t.exports=p,t.exports.default=p})),ce=n((e=>{var t=class{constructor(e,t){if(!Number.isInteger(e))throw TypeError(`span must be an integer`);this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw Error(`Layout is abstract`)}encode(e,t,n){throw Error(`Layout is abstract`)}getSpan(e,t){if(0>this.span)throw RangeError(`indeterminate span`);return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}};e.Layout=t;function n(e,t){return t.property?e+`[`+t.property+`]`:e}e.nameWithProperty=n;function r(e,n){if(typeof e!=`function`)throw TypeError(`Class must be constructor`);if(e.hasOwnProperty(`layout_`))throw Error(`Class is already bound to a layout`);if(!(n&&n instanceof t))throw TypeError(`layout must be a Layout`);if(n.hasOwnProperty(`boundConstructor_`))throw Error(`layout is already bound to a constructor`);e.layout_=n,n.boundConstructor_=e,n.makeDestinationObject=(()=>new e),Object.defineProperty(e.prototype,`encode`,{value:function(e,t){return n.encode(this,e,t)},writable:!0}),Object.defineProperty(e,`decode`,{value:function(e,t){return n.decode(e,t)},writable:!0})}e.bindConstructorLayout=r;var i=class extends t{isCount(){throw Error(`ExternalLayout is abstract`)}},a=class extends i{constructor(e,t){if(e===void 0&&(e=1),!Number.isInteger(e)||0>=e)throw TypeError(`elementSpan must be a (positive) integer`);super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t){t===void 0&&(t=0);let n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}},o=class extends i{constructor(e,n,r){if(!(e instanceof t))throw TypeError(`layout must be a Layout`);if(n===void 0)n=0;else if(!Number.isInteger(n))throw TypeError(`offset must be integer or undefined`);super(e.span,r||e.property),this.layout=e,this.offset=n}isCount(){return this.layout instanceof s||this.layout instanceof c}decode(e,t){return t===void 0&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return n===void 0&&(n=0),this.layout.encode(e,t,n+this.offset)}},s=class extends t{constructor(e,t){if(super(e,t),6<this.span)throw RangeError(`span must not exceed 6 bytes`)}decode(e,t){return t===void 0&&(t=0),e.readUIntLE(t,this.span)}encode(e,t,n){return n===void 0&&(n=0),t.writeUIntLE(e,n,this.span),this.span}},c=class extends t{constructor(e,t){if(super(e,t),6<this.span)throw RangeError(`span must not exceed 6 bytes`)}decode(e,t){return t===void 0&&(t=0),e.readUIntBE(t,this.span)}encode(e,t,n){return n===void 0&&(n=0),t.writeUIntBE(e,n,this.span),this.span}},l=class extends t{constructor(e,t){if(super(e,t),6<this.span)throw RangeError(`span must not exceed 6 bytes`)}decode(e,t){return t===void 0&&(t=0),e.readIntLE(t,this.span)}encode(e,t,n){return n===void 0&&(n=0),t.writeIntLE(e,n,this.span),this.span}},u=class extends t{constructor(e,t){if(super(e,t),6<this.span)throw RangeError(`span must not exceed 6 bytes`)}decode(e,t){return t===void 0&&(t=0),e.readIntBE(t,this.span)}encode(e,t,n){return n===void 0&&(n=0),t.writeIntBE(e,n,this.span),this.span}},f=2**32;function p(e){let t=Math.floor(e/f);return{hi32:t,lo32:e-t*f}}function m(e,t){return e*f+t}var h=class extends t{constructor(e){super(8,e)}decode(e,t){t===void 0&&(t=0);let n=e.readUInt32LE(t);return m(e.readUInt32LE(t+4),n)}encode(e,t,n){n===void 0&&(n=0);let r=p(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}},g=class extends t{constructor(e){super(8,e)}decode(e,t){return t===void 0&&(t=0),m(e.readUInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){n===void 0&&(n=0);let r=p(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}},_=class extends t{constructor(e){super(8,e)}decode(e,t){t===void 0&&(t=0);let n=e.readUInt32LE(t);return m(e.readInt32LE(t+4),n)}encode(e,t,n){n===void 0&&(n=0);let r=p(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}},v=class extends t{constructor(e){super(8,e)}decode(e,t){return t===void 0&&(t=0),m(e.readInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){n===void 0&&(n=0);let r=p(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}},y=class extends t{constructor(e){super(4,e)}decode(e,t){return t===void 0&&(t=0),e.readFloatLE(t)}encode(e,t,n){return n===void 0&&(n=0),t.writeFloatLE(e,n),4}},b=class extends t{constructor(e){super(4,e)}decode(e,t){return t===void 0&&(t=0),e.readFloatBE(t)}encode(e,t,n){return n===void 0&&(n=0),t.writeFloatBE(e,n),4}},x=class extends t{constructor(e){super(8,e)}decode(e,t){return t===void 0&&(t=0),e.readDoubleLE(t)}encode(e,t,n){return n===void 0&&(n=0),t.writeDoubleLE(e,n),8}},S=class extends t{constructor(e){super(8,e)}decode(e,t){return t===void 0&&(t=0),e.readDoubleBE(t)}encode(e,t,n){return n===void 0&&(n=0),t.writeDoubleBE(e,n),8}},C=class extends t{constructor(e,n,r){if(!(e instanceof t))throw TypeError(`elementLayout must be a Layout`);if(!(n instanceof i&&n.isCount()||Number.isInteger(n)&&0<=n))throw TypeError(`count must be non-negative integer or an unsigned integer ExternalLayout`);let a=-1;!(n instanceof i)&&0<e.span&&(a=n*e.span),super(a,r),this.elementLayout=e,this.count=n}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0,r=this.count;if(r instanceof i&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let i=0;for(;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i}return n}decode(e,t){t===void 0&&(t=0);let n=[],r=0,a=this.count;for(a instanceof i&&(a=a.decode(e,t));r<a;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}encode(e,t,n){n===void 0&&(n=0);let r=this.elementLayout,a=e.reduce((e,i)=>e+r.encode(i,t,n+e),0);return this.count instanceof i&&this.count.encode(e.length,t,n),a}},w=class extends t{constructor(e,n,r){if(!(Array.isArray(e)&&e.reduce((e,n)=>e&&n instanceof t,!0)))throw TypeError(`fields must be array of Layout instances`);typeof n==`boolean`&&r===void 0&&(r=n,n=void 0);for(let t of e)if(0>t.span&&t.property===void 0)throw Error(`fields cannot contain unnamed variable-length layout`);let i=-1;try{i=e.reduce((e,t)=>
1e+t.getSpan(),0)}catch{}super(i,n),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;try{n=this.fields.reduce((n,r)=>{let i=r.getSpan(e,t);return t+=i,n+i},0)}catch{throw RangeError(`indeterminate span`)}return n}decode(e,t){t===void 0&&(t=0);let n=this.makeDestinationObject();for(let r of this.fields)if(r.property!==void 0&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){n===void 0&&(n=0);let r=n,i=0,a=0;for(let r of this.fields){let o=r.span;if(a=0<o?o:0,r.property!==void 0){let i=e[r.property];i!==void 0&&(a=r.encode(i,t,n),0>o&&(o=r.getSpan(t,n)))}i=n,n+=o}return i+a-r}fromArray(e){let t=this.makeDestinationObject();for(let n of this.fields)n.property!==void 0&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if(typeof e!=`string`)throw TypeError(`property must be string`);for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if(typeof e!=`string`)throw TypeError(`property must be string`);let t=0;for(let n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}},T=class{constructor(e){this.property=e}decode(){throw Error(`UnionDiscriminator is abstract`)}encode(){throw Error(`UnionDiscriminator is abstract`)}},E=class extends T{constructor(e,t){if(!(e instanceof i&&e.isCount()))throw TypeError(`layout must be an unsigned integer ExternalLayout`);super(t||e.property||`variant`),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}},D=class extends t{constructor(e,n,r){let a=e instanceof s||e instanceof c;if(a)e=new E(new o(e));else if(e instanceof i&&e.isCount())e=new E(e);else if(!(e instanceof T))throw TypeError(`discr must be a UnionDiscriminator or an unsigned integer layout`);if(n===void 0&&(n=null),!(n===null||n instanceof t))throw TypeError(`defaultLayout must be null or a Layout`);if(n!==null){if(0>n.span)throw Error(`defaultLayout must have constant span`);n.property===void 0&&(n=n.replicate(`content`))}let l=-1;n&&(l=n.span,0<=l&&a&&(l+=e.layout.span)),super(l,r),this.discriminator=e,this.usesPrefixDiscriminator=a,this.defaultLayout=n,this.registry={};let u=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return u(e)},this.configGetSourceVariant=function(e){u=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=this.getVariant(e,t);if(!n)throw Error(`unable to determine span for unrecognized variant`);return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(let t in this.registry){let n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw Error(`unable to infer src variant`)}decode(e,t){t===void 0&&(t=0);let n,r=this.discriminator,i=r.decode(e,t),a=this.registry[i];if(a===void 0){let o=0;a=this.defaultLayout,this.usesPrefixDiscriminator&&(o=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[a.property]=this.defaultLayout.decode(e,t+o)}else n=a.decode(e,t);return n}encode(e,t,n){n===void 0&&(n=0);let r=this.getSourceVariant(e);if(r===void 0){let r=this.discriminator,i=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=r.layout.span),r.encode(e[r.property],t,n),a+i.encode(e[i.property],t,n+a)}return r.encode(e,t,n)}addVariant(e,t,n){let r=new O(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return d.isBuffer(e)&&(t===void 0&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}},O=class extends t{constructor(e,n,r,i){if(!(e instanceof D))throw TypeError(`union must be a Union`);if(!Number.isInteger(n)||0>n)throw TypeError(`variant must be a (non-negative) integer`);if(typeof r==`string`&&i===void 0&&(i=r,r=null),r){if(!(r instanceof t))throw TypeError(`layout must be a Layout`);if(e.defaultLayout!==null&&0<=r.span&&r.span>e.defaultLayout.span)throw Error(`variant span exceeds span of containing union`);if(typeof i!=`string`)throw TypeError(`variant must have a String property`)}let a=e.span;0>e.span&&(a=r?r.span:0,0<=a&&e.usesPrefixDiscriminator&&(a+=e.discriminator.layout.span)),super(a,i),this.union=e,this.variant=n,this.layout=r||null}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){let n=this.makeDestinationObject();if(t===void 0&&(t=0),this!==this.union.getVariant(e,t))throw Error(`variant mismatch`);let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){n===void 0&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw TypeError(`variant lacks property `+this.property);this.union.discriminator.encode(this.variant,t,n);let i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),
10<=this.union.span&&i>this.union.span))throw Error(`encoded variant overruns containing union`);return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};function ee(e){return 0>e&&(e+=4294967296),e}var k=class extends t{constructor(e,t,n){if(!(e instanceof s||e instanceof c))throw TypeError(`word must be a UInt or UIntBE layout`);if(typeof t==`string`&&n===void 0&&(n=t,t=void 0),4<e.span)throw RangeError(`word cannot exceed 32 bits`);super(e.span,n),this.word=e,this.msb=!!t,this.fields=[];let r=0;this._packedSetValue=function(e){return r=ee(e),this},this._packedGetValue=function(){return r}}decode(e,t){let n=this.makeDestinationObject();t===void 0&&(t=0);let r=this.word.decode(e,t);this._packedSetValue(r);for(let e of this.fields)e.property!==void 0&&(n[e.property]=e.decode(r));return n}encode(e,t,n){n===void 0&&(n=0);let r=this.word.decode(t,n);this._packedSetValue(r);for(let t of this.fields)if(t.property!==void 0){let n=e[t.property];n!==void 0&&t.encode(n)}return this.word.encode(this._packedGetValue(),t,n)}addField(e,t){let n=new A(this,e,t);return this.fields.push(n),n}addBoolean(e){let t=new te(this,e);return this.fields.push(t),t}fieldFor(e){if(typeof e!=`string`)throw TypeError(`property must be string`);for(let t of this.fields)if(t.property===e)return t}},A=class{constructor(e,t,n){if(!(e instanceof k))throw TypeError(`container must be a BitStructure`);if(!Number.isInteger(t)||0>=t)throw TypeError(`bits must be positive integer`);let r=8*e.span,i=e.fields.reduce((e,t)=>e+t.bits,0);if(t+i>r)throw Error(`bits too long for span remainder (`+(r-i)+` of `+r+` remain)`);this.container=e,this.bits=t,this.valueMask=(1<<t)-1,t===32&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=r-i-t),this.wordMask=ee(this.valueMask<<this.start),this.property=n}decode(){return ee(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if(!Number.isInteger(e)||e!==ee(e&this.valueMask))throw TypeError(n(`BitField.encode`,this)+` value must be integer not exceeding `+this.valueMask);let t=this.container._packedGetValue(),r=ee(e<<this.start);this.container._packedSetValue(ee(t&~this.wordMask)|r)}},te=class extends A{constructor(e,t){super(e,1,t)}decode(e,t){return!!A.prototype.decode.call(this,e,t)}encode(e){return typeof e==`boolean`&&(e=+e),A.prototype.encode.call(this,e)}},ne=class extends t{constructor(e,t){if(!(e instanceof i&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError(`length must be positive integer or an unsigned integer ExternalLayout`);let n=-1;e instanceof i||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){t===void 0&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,r){let a=this.length;if(this.length instanceof i&&(a=e.length),!(d.isBuffer(e)&&a===e.length))throw TypeError(n(`Blob.encode`,this)+` requires (length `+a+`) Buffer as src`);if(r+a>t.length)throw RangeError(`encoding overruns Buffer`);return t.write(e.toString(`hex`),r,a,`hex`),this.length instanceof i&&this.length.encode(a,t,r),a}},re=class extends t{constructor(e){super(-1,e)}getSpan(e,t){if(!d.isBuffer(e))throw TypeError(`b must be a Buffer`);t===void 0&&(t=0);let n=t;for(;n<e.length&&e[n]!==0;)n+=1;return 1+n-t}decode(e,t,n){t===void 0&&(t=0);let r=this.getSpan(e,t);return e.slice(t,t+r-1).toString(`utf-8`)}encode(e,t,n){n===void 0&&(n=0),typeof e!=`string`&&(e=e.toString());let r=new d(e,`utf8`),i=r.length;if(n+i>t.length)throw RangeError(`encoding overruns Buffer`);return r.copy(t,n),t[n+i]=0,i+1}},ie=class extends t{constructor(e,t){if(typeof e==`string`&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw TypeError(`maxSpan must be an integer`);super(-1,t),this.maxSpan=e}getSpan(e,t){if(!d.isBuffer(e))throw TypeError(`b must be a Buffer`);return t===void 0&&(t=0),e.length-t}decode(e,t,n){t===void 0&&(t=0);let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw RangeError(`text length exceeds maxSpan`);return e.slice(t,t+r).toString(`utf-8`)}encode(e,t,n){n===void 0&&(n=0),typeof e!=`string`&&(e=e.toString());let r=new d(e,`utf8`),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw RangeError(`text length exceeds maxSpan`);if(n+i>t.length)throw RangeError(`encoding overruns Buffer`);return r.copy(t,n),i}},j=class extends t{constructor(e,t){super(0,t),this.value=e}decode(e,t,n){return this.value}encode(e,t,n){return 0}};e.ExternalLayout=i,e.GreedyCount=a,e.OffsetLayout=o,e.UInt=s,e.UIntBE=c,e.Int=l,e.IntBE=u,e.Float=y,e.FloatBE=b,e.Double=x,e.DoubleBE=S,e.Sequence=C,e.Structure=w,e.UnionDiscriminator=T,e.UnionLayoutDiscriminator=E,e.Union=D,e.VariantLayout=O,e.BitStructure=k,e.BitField=A,e.Boolean=te,e.Blob=ne,e.CString=re,e.UTF8=ie,e.Constant=j,e.greedy=((e,t)=>new a(e,t)),e.offset=((e,t,n)=>new o(e,t,n)),e.u8=(e=>new s(1,e)),e.u16=(e=>new s(2,e)),e.u24=(e=>new s(3,e)),e.u32=(e=>new s(4,e)),e.u40=(e=>
1new s(5,e)),e.u48=(e=>new s(6,e)),e.nu64=(e=>new h(e)),e.u16be=(e=>new c(2,e)),e.u24be=(e=>new c(3,e)),e.u32be=(e=>new c(4,e)),e.u40be=(e=>new c(5,e)),e.u48be=(e=>new c(6,e)),e.nu64be=(e=>new g(e)),e.s8=(e=>new l(1,e)),e.s16=(e=>new l(2,e)),e.s24=(e=>new l(3,e)),e.s32=(e=>new l(4,e)),e.s40=(e=>new l(5,e)),e.s48=(e=>new l(6,e)),e.ns64=(e=>new _(e)),e.s16be=(e=>new u(2,e)),e.s24be=(e=>new u(3,e)),e.s32be=(e=>new u(4,e)),e.s40be=(e=>new u(5,e)),e.s48be=(e=>new u(6,e)),e.ns64be=(e=>new v(e)),e.f32=(e=>new y(e)),e.f32be=(e=>new b(e)),e.f64=(e=>new x(e)),e.f64be=(e=>new S(e)),e.struct=((e,t,n)=>new w(e,t,n)),e.bits=((e,t,n)=>new k(e,t,n)),e.seq=((e,t,n)=>new C(e,t,n)),e.union=((e,t,n)=>new D(e,t,n)),e.unionLayoutDiscriminator=((e,t)=>new E(e,t)),e.blob=((e,t)=>new ne(e,t)),e.cstr=(e=>new re(e)),e.utf8=((e,t)=>new ie(e,t)),e.const=((e,t)=>new j(e,t))})),le=n((t=>{u();var n=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,`__esModule`,{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i256=t.u256=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;var r=ce(),i=(C(),e(y)),a=n(f()),o=ce();Object.defineProperty(t,`u8`,{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,`i8`,{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,`u16`,{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,`i16`,{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,`u32`,{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,`i32`,{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,`f32`,{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,`f64`,{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,`struct`,{enumerable:!0,get:function(){return o.struct}});var s=class extends r.Layout{constructor(e,t,n){super(e,n),this.blob=(0,r.blob)(e),this.signed=t}decode(e,t=0){let n=new a.default(this.blob.decode(e,t),10,`le`);return this.signed?n.fromTwos(this.span*8).clone():n}encode(e,t,n=0){return this.signed&&(e=e.toTwos(this.span*8)),this.blob.encode(e.toArrayLike(d,`le`,this.span),t,n)}};function c(e){return new s(8,!1,e)}t.u64=c;function l(e){return new s(8,!0,e)}t.i64=l;function p(e){return new s(16,!1,e)}t.u128=p;function m(e){return new s(16,!0,e)}t.i128=m;function h(e){return new s(32,!1,e)}t.u256=h;function g(e){return new s(32,!0,e)}t.i256=g;var _=class extends r.Layout{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}};function v(e){return new _((0,r.blob)(32),e=>new i.PublicKey(e),e=>e.toBuffer(),e)}t.publicKey=v;var b=class extends r.Layout{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=(0,r.u8)()}encode(e,t,n=0){return e==null?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}decode(e,t=0){let n=this.discriminator.decode(e,t);if(n===0)return null;if(n===1)return this.layout.decode(e,t+1);throw Error(`Invalid option `+this.property)}getSpan(e,t=0){let n=this.discriminator.decode(e,t);if(n===0)return 1;if(n===1)return this.layout.getSpan(e,t+1)+1;throw Error(`Invalid option `+this.property)}};function x(e,t){return new b(e,t)}t.option=x;function S(e){return new _((0,r.u8)(),w,T,e)}t.bool=S;function w(e){if(e===0)return!1;if(e===1)return!0;throw Error(`Invalid bool: `+e)}function T(e){return+!!e}function E(e,t){let n=(0,r.u32)(`length`);return new _((0,r.struct)([n,(0,r.seq)(e,(0,r.offset)(n,-n.span),`values`)]),({values:e})=>e,e=>({values:e}),t)}t.vec=E;function D(e,t,n){let i=(0,r.struct)([c(`tag`),t.replicate(`data`)]);function a({tag:t,data:n}){if(!t.eq(e))throw Error(`Invalid tag, expected: `+e.toString(`hex`)+`, got: `+t.toString(`hex`));return n}return new _(i,a,t=>({tag:e,data:t}),n)}t.tagged=D;function O(e){let t=(0,r.u32)(`length`);return new _((0,r.struct)([t,(0,r.blob)((0,r.offset)(t,-t.span),`data`)]),({data:e})=>e,e=>({data:e}),e)}t.vecU8=O;function ee(e){return new _(O(),e=>e.toString(`utf-8`),e=>d.from(e,`utf-8`),e)}t.str=ee;
1function k(e,t,n){let i=(0,r.union)(n??(0,r.u8)(),t);return e.forEach((e,t)=>i.addVariant(t,e,e.property)),i}t.rustEnum=k;function A(e,t,n){return new _((0,r.struct)([(0,r.seq)(e,t,`values`)]),({values:e})=>e,e=>({values:e}),n)}t.array=A;var te=class extends r.Layout{constructor(e,t,n){super(e.span+t.span,n),this.keyLayout=e,this.valueLayout=t}decode(e,t){return t||=0,[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}encode(e,t,n){n||=0;let r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}getSpan(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}};function ne(e,t,n){let i=(0,r.u32)(`length`);return new _((0,r.struct)([i,(0,r.seq)(new te(e,t),(0,r.offset)(i,-i.span),`values`)]),({values:e})=>new Map(e),e=>({values:Array.from(e.entries())}),n)}t.map=ne}));r();var M=t(se()),N=t(le()),ue=4,de=0,fe=1,pe=2;function me(e){let t=e.length;for(;--t>=0;)e[t]=0}var he=0,ge=1,_e=2,ve=3,ye=258,be=29,xe=256,Se=xe+1+be,Ce=30,we=19,Te=2*Se+1,Ee=15,De=16,Oe=7,ke=256,Ae=16,je=17,Me=18,Ne=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Pe=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Fe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ie=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Le=512,Re=Array((Se+2)*2);me(Re);var ze=Array(Ce*2);me(ze);var Be=Array(Le);me(Be);var Ve=Array(ye-ve+1);me(Ve);var He=Array(be);me(He);var Ue=Array(Ce);me(Ue);function We(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var Ge,Ke,qe;function Je(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var Ye=e=>e<256?Be[e]:Be[256+(e>>>7)],Xe=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},P=(e,t,n)=>{e.bi_valid>De-n?(e.bi_buf|=t<<e.bi_valid&65535,Xe(e,e.bi_buf),e.bi_buf=t>>De-e.bi_valid,e.bi_valid+=n-De):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}
vendor: 6,656 bytes, line 1
1,Ze=(e,t,n)=>{P(e,n[t*2],n[t*2+1])},Qe=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},$e=e=>{e.bi_valid===16?(Xe(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},et=(e,t)=>{let n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=Ee;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<Te;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},tt=(e,t,n)=>{let r=Array(Ee+1),i=0,a,o;for(a=1;a<=Ee;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=Qe(r[t]++,t))}},nt=()=>{let e,t,n,r,i,a=Array(Ee+1);for(n=0,r=0;r<be-1;r++)for(He[r]=n,e=0;e<1<<Ne[r];e++)Ve[n++]=r;for(Ve[n-1]=r,i=0,r=0;r<16;r++)for(Ue[r]=i,e=0;e<1<<Pe[r];e++)Be[i++]=r;for(i>>=7;r<Ce;r++)for(Ue[r]=i<<7,e=0;e<1<<Pe[r]-7;e++)Be[256+ i++]=r;for(t=0;t<=Ee;t++)a[t]=0;for(e=0;e<=143;)Re[e*2+1]=8,e++,a[8]++;for(;e<=255;)Re[e*2+1]=9,e++,a[9]++;for(;e<=279;)Re[e*2+1]=7,e++,a[7]++;for(;e<=287;)Re[e*2+1]=8,e++,a[8]++;for(tt(Re,Se+1,a),e=0;e<Ce;e++)ze[e*2+1]=5,ze[e*2]=Qe(e,5);Ge=new We(Re,Ne,xe+1,Se,Ee),Ke=new We(ze,Pe,0,Ce,Ee),qe=new We([],Fe,0,we,Oe)},rt=e=>{let t;for(t=0;t<Se;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Ce;t++)e.dyn_dtree[t*2]=0;for(t=0;t<we;t++)e.bl_tree[t*2]=0;e.dyn_ltree[ke*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},it=e=>{e.bi_valid>8?Xe(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},at=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]},ot=(e,t,n)=>{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&at(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!at(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},st=(e,t,n)=>{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+ a++]&255,r+=(e.pending_buf[e.sym_buf+ a++]&255)<<8,i=e.pending_buf[e.sym_buf+ a++],r===0?Ze(e,i,t):(o=Ve[i],Ze(e,o+xe+1,t),s=Ne[o],s!==0&&(i-=He[o],P(e,i,s)),r--,o=Ye(r),Ze(e,o,n),s=Pe[o],s!==0&&(r-=Ue[o],P(e,r,s)));while(a<e.sym_next);Ze(e,ke,t)},ct=(e,t)=>{let n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=Te,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)ot(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ot(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,ot(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],et(e,t),tt(n,c,e.bl_count)},lt=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[je*2]++:e.bl_tree[Me*2]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[Ae*2]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},ut=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do Ze(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(Ze(e,je,e.bl_tree),P(e,s-3,3)):(Ze(e,Me,e.bl_tree),P(e,s-11,7)):(a!==i&&(Ze(e,a,e.bl_tree),s--),Ze(e,Ae,e.bl_tree),P(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},dt=e=>{let t;for(lt(e,e.dyn_ltree,e.l_desc.max_code),lt(e,e.dyn_dtree,e.d_desc.max_code),ct(e,e.bl_desc),t=we-1;t>=3&&e.bl_tree[Ie[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},ft=(e,t,n,r)=>{let i;for(P(e,t-257,5),P(e,n-1,5),P(e,r-4,4),i=0;i<r;i++)P(e,e.bl_tree[Ie[i]*2+1],3);ut(e,e.dyn_ltree,t-1),ut(e,e.dyn_dtree,n-1)},pt=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return de;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return fe;for(n=32;n<xe;n++)if(e.dyn_ltree[n*2]!==0)return fe;return de},mt=!1,ht=e=>{mt||=(nt(),!0),e.l_desc=new Je(e.dyn_ltree,Ge),e.d_desc=new Je(e.dyn_dtree,Ke),e.bl_desc=new Je(e.bl_tree,qe),e.bi_buf=0,e.bi_valid=0,rt(e)},gt=(e,t,n,r)=>{P(e,(he<<1)+ +!!r,3),it(e),Xe(e,n),Xe(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},_t={_tr_init:ht,_tr_stored_block:gt,_tr_flush_block:(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===pe&&(e.strm.data_type=pt(e)),ct(e,e.l_desc),ct(e,e.d_desc),o=dt(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?gt(e,t,n,r):e.strategy===ue||a===i?(P(e,(ge<<1)+ +!!r,3),st(e,Re,ze)):(P(e,(_e<<1)+ +!!r,3),ft(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),st(e,e.dyn_ltree,e.dyn_dtree)),rt(e),r&&it(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+ e.sym_next++]=t,e.pending_buf[e.sym_buf+ e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+ e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Ve[n]+xe+1)*2]++,e.dyn_dtree[Ye(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{P(e,ge<<1,3),Ze(e,ke,Re),$e(e)}},vt=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},yt=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t})()),F=(e,t,n,r)=>{let i=yt,a=r+n;e^=-1;for(let n=r;n<a;n++)e=e>>>8^i[(e^t[n])&255];return e^-1},bt={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`},xt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:St,_tr_stored_block:Ct,_tr_flush_block:wt,_tr_tally:Tt,_tr_align:Et}=_t,{Z_NO_FLUSH:Dt,Z_PARTIAL_FLUSH:Ot,Z_FULL_FLUSH:kt,Z_FINISH:I,Z_BLOCK:At,Z_OK:L,Z_STREAM_END:jt,Z_STREAM_ERROR:R,Z_DATA_ERROR:Mt,Z_BUF_ER
vendor: 4,573 bytes, line 1
1ROR:Nt,Z_DEFAULT_COMPRESSION:Pt,Z_FILTERED:Ft,Z_HUFFMAN_ONLY:It,Z_RLE:Lt,Z_FIXED:Rt,Z_DEFAULT_STRATEGY:zt,Z_UNKNOWN:Bt,Z_DEFLATED:Vt}=xt,Ht=9,Ut=15,Wt=8,Gt=286,Kt=30,qt=19,Jt=2*Gt+1,Yt=15,z=3,Xt=258,B=Xt+z+1,Zt=32,Qt=42,$t=57,en=69,tn=73,nn=91,rn=103,an=113,on=666,V=1,sn=2,cn=3,ln=4,un=3,dn=(e,t)=>(e.msg=bt[t],t),fn=e=>e*2-(e>4?9:0),pn=e=>{let t=e.length;for(;--t>=0;)e[t]=0},mn=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},hn=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,H=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},U=(e,t)=>{wt(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,H(e.strm)},W=(e,t)=>{e.pending_buf[e.pending++]=t},gn=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},_n=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=vt(e.adler,t,i,n):e.state.wrap===2&&(e.adler=F(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},vn=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-B?e.strstart-(e.w_size-B):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+Xt,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]!==m||l[i+o-1]!==p||l[i]!==l[r]||l[++i]!==l[r+1])continue;r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=Xt-(f-r),r=f-Xt,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead},yn=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-B)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),mn(e),r+=t),e.strm.avail_in===0)break;if(n=_n(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=z)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=hn(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=hn(e,e.ins_h,e.window[i+z-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<z)););}while(e.lookahead<B&&e.strm.avail_in!==0)},bn=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&t!==I||t===Dt||r!==i+e.strm.avail_in)))break;o=+(t===I&&r===i+e.strm.avail_in),Ct(e,0,0,o),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,H(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(_n(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?ln:t!==Dt&&t!==I&&e.strm.avail_in===0&&e.strstart===e.block_start?sn:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(_n(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>
1e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===I)&&t!==Dt&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=+(t===I&&e.strm.avail_in===0&&r===i),Ct(e,e.block_start,r,o),e.block_start+=r,H(e.strm)),o?cn:V)},xn=(e,t)=>{let n,r;for(;;){if(e.lookahead<B){if(yn(e),e.lookahead<B&&t===Dt)return V;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(e.ins_h=hn(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-B&&(e.match_length=vn(e,n)),e.match_length>=z)if(r=Tt(e,e.strstart-e.match_start,e.match_length-z),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=z){e.match_length--;do e.strstart++,e.ins_h=hn(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=hn(e,e.ins_h,e.window[e.strstart+1]);else r=Tt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(U(e,!1),e.strm.avail_out===0))return V}return e.insert=e.strstart<z-1?e.strstart:z-1,t===I?(U(e,!0),e.strm.avail_out===0?cn:ln):e.sym_next&&(U(e,!1),e.strm.avail_out===0)?V:sn},Sn=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<B){if(yn(e),e.lookahead<B&&t===Dt)return V;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(e.ins_h=hn(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=z-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-B&&(e.match_length=vn(e,n),e.match_length<=5&&(e.strategy===Ft||e.match_length===z&&e.strstart-e.match_start>4096)&&(e.match_length=z-1)),e.prev_length>=z&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-z,r=Tt(e,e.strstart-1-e.prev_match,e.prev_length-z),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=hn(e,e.ins_h,e.window[e.strstart+z-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=z-1,e.strstart++,r&&(U(e,!1),e.strm.avail_out===0))return V}else if(e.match_available){if(r=Tt(e,0,e.window[e.strstart-1]),r&&U(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return V}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=Tt(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<z-1?e.strstart:z-1,t===I?(U(e,!0),e.strm.avail_out===0?cn:ln):e.sym_next&&(U(e,!1),e.strm.avail_out===0)?V:sn},Cn=(e,t)=>{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=Xt){if(yn(e),e.lookahead<=Xt&&t===Dt)return V;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=z&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+Xt;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=Xt-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=z?(n=Tt(e,1,e.match_length-z),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Tt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(U(e,!1),e.strm.avail_out===0))return V}return e.insert=0,t===I?(U(e,!0),e.strm.avail_out===0?cn:ln):e.sym_next&&(U(e,!1),e.strm.avail_out===0)?V:sn},wn=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(yn(e),e.lookahead===0)){if(t===Dt)return V;break}if(e.match_length=0,n=Tt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(U(e,!1),e.strm.avail_out===0))return V}return e.insert=0,t===I?(U(e,!0),e.strm.avail_out===0?cn:ln):e.sym_next&&(U(e,!1),e.strm.avail_out===0)?V:sn};function Tn(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var En=[new Tn(0,0,0,0,bn),new Tn(4,4,8,4,xn),new Tn(4,5,16,8,xn),new Tn(4,6,32,32,xn),new Tn(4,4,16,16,Sn),new Tn(8,16,32,32,Sn),new Tn(8,16,128,128,Sn),new Tn(8,32,128,256,Sn),new Tn(32,128,258,1024,Sn),new Tn(32,258,258,4096,Sn)],Dn=e=>{e.window_size=2*e.w_size,pn(e.head),e.max_lazy_match=En[e.level].max_lazy,e.good_match=En[e.level].good_length,e.nice_match=En[e.level].nice_length,e.max_chain_length=En[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=z-1,e.match_available=0,e.ins_h=0};function On(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Vt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Jt*2),this.dyn_dtree=new Uint16Array((2*Kt+1)*2),this.bl_tree=new Uint16Array((2*qt+1)*2),pn(this.dyn_ltree),pn(this.dyn_dtree),pn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Yt+1),this.heap=new Uint16Array(2*Gt+1),pn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Gt+1),pn(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var kn=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.status!==Qt&&t.status!==$t&&t.status!==en&&t.status!==tn&&t.status!==nn&&t.status!==rn&&t.status!==an&&t.status!==on)},An=e=>{if(kn(e))return dn(e,R);e.total_in=e.total_out=0,e.data_type=Bt;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?$t:t.wrap?Qt:an,e.adler=t.wrap===2?0:1,t.last_flush=-2,St(t),L},jn=e=>{let t=An(e);return t===L&&Dn(e.state),t},Mn=(e,t)=>kn(e)||e.state.wrap!==2?R:(e.state.gzhead=t,L),Nn=(e,t,n,r,i,a)=>
1{if(!e)return R;let o=1;if(t===Pt&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Ht||n!==Vt||r<8||r>15||t<0||t>9||a<0||a>Rt||r===8&&o!==1)return dn(e,R);r===8&&(r=9);let s=new On;return e.state=s,s.strm=e,s.status=Qt,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+z-1)/z),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=t,s.strategy=a,s.method=n,jn(e)},Pn={deflateInit:(e,t)=>Nn(e,t,Vt,Ut,Wt,zt),deflateInit2:Nn,deflateReset:jn,deflateResetKeep:An,deflateSetHeader:Mn,deflate:(e,t)=>{if(kn(e)||t>At||t<0)return e?dn(e,R):R;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===on&&t!==I)return dn(e,e.avail_out===0?Nt:R);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(H(e),e.avail_out===0)return n.last_flush=-1,L}else if(e.avail_in===0&&fn(t)<=fn(r)&&t!==I)return dn(e,Nt);if(n.status===on&&e.avail_in!==0)return dn(e,Nt);if(n.status===Qt&&n.wrap===0&&(n.status=an),n.status===Qt){let t=Vt+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=It||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=Zt),t+=31-t%31,gn(n,t),n.strstart!==0&&(gn(n,e.adler>>>16),gn(n,e.adler&65535)),e.adler=1,n.status=an,H(e),n.pending!==0)return n.last_flush=-1,L}if(n.status===$t){if(e.adler=0,W(n,31),W(n,139),W(n,8),n.gzhead)W(n,+!!n.gzhead.text+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),W(n,n.gzhead.time&255),W(n,n.gzhead.time>>8&255),W(n,n.gzhead.time>>16&255),W(n,n.gzhead.time>>24&255),W(n,n.level===9?2:n.strategy>=It||n.level<2?4:0),W(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(W(n,n.gzhead.extra.length&255),W(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=F(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=en;else if(W(n,0),W(n,0),W(n,0),W(n,0),W(n,0),W(n,n.level===9?2:n.strategy>=It||n.level<2?4:0),W(n,un),n.status=an,H(e),n.pending!==0)return n.last_flush=-1,L}if(n.status===en){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=F(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,H(e),n.pending!==0)return n.last_flush=-1,L;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=F(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=tn}if(n.status===tn){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=F(e.adler,n.pending_buf,n.pending-t,t)),H(e),n.pending!==0)return n.last_flush=-1,L;t=0}r=n.gzindex<n.gzhead.name.length?n.gzhead.name.charCodeAt(n.gzindex++)&255:0,W(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=F(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=nn}
1if(n.status===nn){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=F(e.adler,n.pending_buf,n.pending-t,t)),H(e),n.pending!==0)return n.last_flush=-1,L;t=0}r=n.gzindex<n.gzhead.comment.length?n.gzhead.comment.charCodeAt(n.gzindex++)&255:0,W(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=F(e.adler,n.pending_buf,n.pending-t,t))}n.status=rn}if(n.status===rn){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(H(e),n.pending!==0))return n.last_flush=-1,L;W(n,e.adler&255),W(n,e.adler>>8&255),e.adler=0}if(n.status=an,H(e),n.pending!==0)return n.last_flush=-1,L}if(e.avail_in!==0||n.lookahead!==0||t!==Dt&&n.status!==on){let r=n.level===0?bn(n,t):n.strategy===It?wn(n,t):n.strategy===Lt?Cn(n,t):En[n.level].func(n,t);if((r===cn||r===ln)&&(n.status=on),r===V||r===cn)return e.avail_out===0&&(n.last_flush=-1),L;if(r===sn&&(t===Ot?Et(n):t!==At&&(Ct(n,0,0,!1),t===kt&&(pn(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),H(e),e.avail_out===0))return n.last_flush=-1,L}return t===I?n.wrap<=0?jt:(n.wrap===2?(W(n,e.adler&255),W(n,e.adler>>8&255),W(n,e.adler>>16&255),W(n,e.adler>>24&255),W(n,e.total_in&255),W(n,e.total_in>>8&255),W(n,e.total_in>>16&255),W(n,e.total_in>>24&255)):(gn(n,e.adler>>>16),gn(n,e.adler&65535)),H(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?jt:L):L},deflateEnd:e=>{if(kn(e))return R;let t=e.state.status;return e.state=null,t===an?dn(e,Mt):L},deflateSetDictionary:(e,t)=>{let n=t.length;if(kn(e))return R;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Qt||r.lookahead)return R;if(i===1&&(e.adler=vt(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(pn(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,yn(r);r.lookahead>=z;){let e=r.strstart,t=r.lookahead-(z-1);do r.ins_h=hn(r,r.ins_h,r.window[e+z-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++;while(--t);r.strstart=e,r.lookahead=z-1,yn(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=z-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,L},deflateInfo:`pako deflate (from Nodeca project)`},Fn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),In={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)Fn(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;let n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n}},Ln=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ln=!1}var Rn=new Uint8Array(256);for(let e=0;e<256;e++)Rn[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Rn[254]=Rn[254]=1;var zn=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i<o;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),a=0,i=0;a<s;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},Bn=(e,t)=>{if(t<65534&&e.subarray&&Ln)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n},Vn={string2buf:zn,buf2string:(e,t)=>{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){a[i++]=t;continue}let o=Rn[t];if(o>4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r<n;)t=t<<6|e[r++]&63,o--;if(o>1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return Bn(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+Rn[e[n]]>t?n:t}};function Hn(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}var Un=Hn,Wn=Object.prototype.toString,{Z_NO_FLUSH:Gn,Z_SYNC_FLUSH:Kn,Z_FULL_FLUSH:qn,Z_FINISH:Jn,Z_OK:Yn,Z_STREAM_END:Xn,Z_DEFAULT_COMPRESSION:Zn,Z_DEFAULT_STRATEGY:Qn,Z_DEFLATED:$n}=xt;function er(e){this.options=In.assign({level:Zn,method:$n,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qn},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new Un,this.strm.avail_out=0;let n=Pn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);
1if(n!==Yn)throw Error(bt[n]);if(t.header&&Pn.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?Vn.string2buf(t.dictionary):Wn.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=Pn.deflateSetDictionary(this.strm,e),n!==Yn)throw Error(bt[n]);this._dict_set=!0}}er.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?Jn:Gn,typeof e==`string`?n.input=Vn.string2buf(e):Wn.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===Kn||a===qn)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=Pn.deflate(n,a),i===Xn)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Pn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Yn;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},er.prototype.onData=function(e){this.chunks.push(e)},er.prototype.onEnd=function(e){e===Yn&&(this.result=In.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function tr(e,t){let n=new er(t);if(n.push(e,!0),n.err)throw n.msg||bt[n.err];return n.result}function nr(e,t){return t||={},t.raw=!0,tr(e,t)}function rr(e,t){return t||={},t.gzip=!0,tr(e,t)}var ir={Deflate:er,deflate:tr,deflateRaw:nr,gzip:rr,constants:xt},ar=16209,or=16191,sr=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<<E.lenbits)-1,_=(1<<E.distbits)-1;top:do{p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=m[f&g];dolen:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p<y&&(f+=w[n++]<<p,p+=8),b+=f&(1<<y)-1,f>>>=y,p-=y),p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=h[f&_];dodist:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,p<y&&(f+=w[n++]<<p,p+=8,p<y&&(f+=w[n++]<<p,p+=8)),x+=f&(1<<y)-1,x>s){e.msg=`invalid distance too far back`,E.mode=ar;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=ar;break top}if(S=0,C=d,u===0){if(S+=c-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}else if(u<y){if(S+=c+u-y,y-=u,y<b){b-=y;do T[i++]=d[S++];while(--y);if(S=0,u<b){y=u,b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}}else if(S+=u-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}for(;b>2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=ar;break top}else{v=h[(v&65535)+(f&(1<<y)-1)];continue dodist}break}}else if(!(y&64)){v=m[(v&65535)+(f&(1<<y)-1)];continue dolen}else if(y&32){E.mode=or;break top}else{e.msg=`invalid literal/length code`,E.mode=ar;break top}break}}while(n<r&&i<o);b=p>>3,n-=b,p-=b<<3,f&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?5+(r-n):5-(n-r),e.avail_out=i<o?257+(o-i):257-(i-o),E.hold=f,E.bits=p},cr=15,lr=852,ur=592,dr=0,fr=1,pr=2,mr=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),hr=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),gr=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),_r=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),vr=(e,t,n,r,i,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y,b,x,S,C,w=null,T,E=new Uint16Array(cr+1),D=new Uint16Array(cr+1),O=null,ee,k,A;for(l=0;l<=cr;l++)E[l]=0;for(u=0;
vendor: 9,638 bytes, line 1
1u<r;u++)E[t[n+u]]++;for(p=c,f=cr;f>=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d<f&&E[d]===0;d++);for(p<d&&(p=d),g=1,l=1;l<=cr;l++)if(g<<=1,g-=E[l],g<0)return-1;if(g>0&&(e===dr||f!==1))return-1;for(D[1]=0,l=1;l<cr;l++)D[l+1]=D[l]+E[l];for(u=0;u<r;u++)t[n+u]!==0&&(o[D[t[n+u]]++]=u);if(e===dr?(w=O=o,T=20):e===fr?(w=mr,O=hr,T=257):(w=gr,O=_r,T=0),v=0,u=0,l=d,C=a,m=p,h=0,x=-1,_=1<<p,S=_-1,e===fr&&_>lr||e===pr&&_>ur)return 1;for(;;){ee=l-h,o[u]+1<T?(k=0,A=o[u]):o[u]>=T?(k=O[o[u]-T],A=w[o[u]-T]):(k=96,A=0),y=1<<l-h,b=1<<m,d=b;do b-=y,i[C+(v>>h)+b]=ee<<24|k<<16|A|0;while(b!==0);for(y=1<<l-1;v&y;)y>>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[l]===0){if(l===f)break;l=t[n+o[u]]}if(l>p&&(v&S)!==x){for(h===0&&(h=p),C+=d,m=l-h,g=1<<m;m+h<f&&(g-=E[m+h],!(g<=0));)m++,g<<=1;if(_+=1<<m,e===fr&&_>lr||e===pr&&_>ur)return 1;x=v&S,i[x]=p<<24|m<<16|C-a|0}}return v!==0&&(i[C+v]=l-h<<24|4194304),s.bits=p,0},yr=0,br=1,xr=2,{Z_FINISH:Sr,Z_BLOCK:Cr,Z_TREES:wr,Z_OK:Tr,Z_STREAM_END:Er,Z_NEED_DICT:Dr,Z_STREAM_ERROR:G,Z_DATA_ERROR:Or,Z_MEM_ERROR:kr,Z_BUF_ERROR:Ar,Z_DEFLATED:jr}=xt,Mr=16180,Nr=16181,Pr=16182,Fr=16183,Ir=16184,Lr=16185,Rr=16186,zr=16187,Br=16188,Vr=16189,Hr=16190,Ur=16191,Wr=16192,Gr=16193,Kr=16194,qr=16195,Jr=16196,Yr=16197,Xr=16198,Zr=16199,Qr=16200,$r=16201,ei=16202,ti=16203,ni=16204,ri=16205,ii=16206,ai=16207,oi=16208,K=16209,si=16210,ci=16211,li=852,ui=592,di=15,fi=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function pi(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var mi=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<Mr||t.mode>ci)},hi=e=>{if(mi(e))return G;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=Mr,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(li),t.distcode=t.distdyn=new Int32Array(ui),t.sane=1,t.back=-1,Tr},gi=e=>{if(mi(e))return G;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,hi(e)},_i=(e,t)=>{let n;if(mi(e))return G;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?G:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,gi(e))},vi=(e,t)=>{if(!e)return G;let n=new pi;e.state=n,n.strm=e,n.window=null,n.mode=Mr;let r=_i(e,t);return r!==Tr&&(e.state=null),r},yi=e=>vi(e,di),bi=!0,xi,Si,Ci=e=>{if(bi){xi=new Int32Array(512),Si=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(vr(br,e.lens,0,288,xi,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;vr(xr,e.lens,0,32,Si,0,e.work,{bits:5}),bi=!1}e.lencode=xi,e.lenbits=9,e.distcode=Si,e.distbits=5},wi=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Ti={inflateReset:gi,inflateReset2:_i,inflateResetKeep:hi,inflateInit:yi,inflateInit2:vi,inflate:(e,t)=>{let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g=0,_,v,y,b,x,S,C,w,T=new Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(mi(e)||!e.output||!e.input&&e.avail_in!==0)return G;n=e.state,n.mode===Ur&&(n.mode=Wr),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,f=c,w=Tr;inf_leave:for(;;)switch(n.mode){case Mr:if(n.wrap===0){n.mode=Wr;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=F(n.check,T,2,0),l=0,u=0,n.mode=Nr;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=K;break}if((l&15)!==jr){e.msg=`unknown compression method`,n.mode=K;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=K;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=l&512?Vr:Ur,l=0,u=0;break;case Nr:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==jr){e.msg=`unknown compression method`,n.mode=K;break}if(n.flags&57344){e.msg=`unknown header flags set`,n.mode=K;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=F(n.check,T,2,0)),l=0,u=0,n.mode=Pr;case Pr:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=F(n.check,T,4,0)),l=0,u=0,n.mode=Fr;case Fr:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=F(n.check,T,2,0)),l=0,u=0,n.mode=Ir;case Ir:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=F(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Lr;case Lr:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=F(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=Rr;case Rr:if(n.flags&2048){if(s===0)break inf_leave;p=0;do C=r[a+ p++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=F(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.name=null);n.length=0,n.mode=zr;case zr:if(n.flags&4096){if(s===0)break inf_leave;p=0;do C=r[a+ p++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=F(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.comment=null);n.mode=Br;case Br:if(n.flags&512){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){e.msg=`header crc mismatch`,n.mode=K;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ur;break;case Vr:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}e.adler=n.check=fi(l),l=0,u=0,n.mode=Hr;case Hr:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,Dr;e.adler=n.check=1,n.mode=Ur;case Ur:if(t===Cr||t===wr)break inf_leave;case Wr:if(n.last){l>>>=u&7,u-=u&7,n.mode=ii;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,--u,l&3){case 0:n.mode=Gr;break;case 1:if(Ci(n),n.mode=Zr,t===wr){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=Jr;break;case 3:e.msg=`invalid block type`,n.mode=K}l>>>=2,u-=2;break;case Gr:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if((l&65535)!=(l>>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=K;break}if(n.length=l&65535,l=0,u=0,n.mode=Kr,t===wr)break inf_leave;case Kr:n.mode=qr;case qr:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=Ur;break;case Jr:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg=`too many length or distance symbols`,n.mode=K;break}n.have=0,n.mode=Yr;case Yr:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.lens[O[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},w=vr(yr,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=K;break}n.have=0,n.mode=Xr;case Xr:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l>>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=K;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=11+(l&127),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=K;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===K)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=K;break}if(n.lenbits=9,E={bits:n.lenbits},w=vr(br,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=K;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=vr(xr,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=K;break}if(n.mode=Zr,t===wr)break inf_leave;case Zr:n.mode=Qr;
1case Qr:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,sr(e,f),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===Ur&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(v&&!(v&240)){for(b=_,x=v,S=y;g=n.lencode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=ri;break}if(v&32){n.back=-1,n.mode=Ur;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=K;break}n.extra=v&15,n.mode=$r;case $r:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ei;case ei:for(;g=n.distcode[l&(1<<n.distbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(!(v&240)){for(b=_,x=v,S=y;g=n.distcode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=K;break}n.offset=y,n.extra=v&15,n.mode=ti;case ti:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=K;break}n.mode=ni;case ni:if(c===0)break inf_leave;if(p=f-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=K;break}p>n.wnext?(p-=n.wnext,m=n.wsize-p):m=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,m=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=h[m++];while(--p);n.length===0&&(n.mode=Qr);break;case ri:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=Qr;break;case ii:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?F(n.check,i,f,o-f):vt(n.check,i,f,o-f)),f=c,n.wrap&4&&(n.flags?l:fi(l))!==n.check){e.msg=`incorrect data check`,n.mode=K;break}l=0,u=0}n.mode=ai;case ai:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){e.msg=`incorrect length check`,n.mode=K;break}l=0,u=0}n.mode=oi;case oi:w=Er;break inf_leave;case K:w=Or;break inf_leave;case si:return kr;case ci:default:return G}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<K&&(n.mode<ii||t!==Sr))&&wi(e,e.output,e.next_out,f-e.avail_out),d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?F(n.check,i,f,e.next_out-f):vt(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Ur?128:0)+(n.mode===Zr||n.mode===Kr?256:0),(d===0&&f===0||t===Sr)&&w===Tr&&(w=Ar),w},inflateEnd:e=>{if(mi(e))return G;let t=e.state;return t.window&&=null,e.state=null,Tr},inflateGetHeader:(e,t)=>{if(mi(e))return G;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Tr):G},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return mi(e)||(r=e.state,r.wrap!==0&&r.mode!==Hr)?G:r.mode===Hr&&(i=1,i=vt(i,t,n,0),i!==r.check)?Or:(a=wi(e,t,n,n),a?(r.mode=si,kr):(r.havedict=1,Tr))},inflateInfo:`pako inflate (from Nodeca project)`};function Ei(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var Di=Ei,Oi=Object.prototype.toString,{Z_NO_FLUSH:ki,Z_FINISH:Ai,Z_OK:ji,Z_STREAM_END:Mi,Z_NEED_DICT:Ni,Z_STREAM_ERROR:Pi,Z_DATA_ERROR:Fi,Z_MEM_ERROR:Ii}=xt;function Li(e){this.options=In.assign({chunkSize:1024*64,windowBits:15,to:``},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new Un,this.strm.avail_out=0;let n=Ti.inflateInit2(this.strm,t.windowBits);if(n!==ji||(this.header=new Di,Ti.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=Vn.string2buf(t.dictionary):Oi.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Ti.inflateSetDictionary(this.strm,t.dictionary),n!==ji))))throw Error(bt[n])}Li.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?Ai:ki,Oi.call(e)===`[object ArrayBuffer]`?n.input=new
1Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=Ti.inflate(n,o),a===Ni&&i&&(a=Ti.inflateSetDictionary(n,i),a===ji?a=Ti.inflate(n,o):a===Fi&&(a=Ni));n.avail_in>0&&a===Mi&&n.state.wrap>0&&e[n.next_in]!==0;)Ti.inflateReset(n),a=Ti.inflate(n,o);switch(a){case Pi:case Fi:case Ni:case Ii:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===Mi))if(this.options.to===`string`){let e=Vn.utf8border(n.output,n.next_out),t=n.next_out-e,i=Vn.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===ji&&s===0)){if(a===Mi)return a=Ti.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Li.prototype.onData=function(e){this.chunks.push(e)},Li.prototype.onEnd=function(e){e===ji&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=In.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Ri(e,t){let n=new Li(t);if(n.push(e),n.err)throw n.msg||bt[n.err];return n.result}function zi(e,t){return t||={},t.raw=!0,Ri(e,t)}var Bi={Inflate:Li,inflate:Ri,inflateRaw:zi,ungzip:Ri,constants:xt},{Deflate:Vi,deflate:Hi,deflateRaw:Ui,gzip:Wi}=ir,{Inflate:Gi,inflate:Ki,inflateRaw:qi,ungzip:Ji}=Bi,Yi=Ki,Xi=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}));u();var Zi=t(Xi());function Qi(e,t){return Array.apply(0,Array(Math.ceil(e.length/t))).map((n,r)=>e.slice(r*t,(r+1)*t))}var $i=e=>`version`in e;function ea(e){return e.reduce((e,t)=>
1e+t.toString(16).padStart(2,`0`),`0x`)}function ta(e){e.indexOf(`0x`)===0&&(e=e.substr(2)),e.length%2==1&&(e=`0`+e);let t=e.match(/.{2}/g);return t===null?l.from([]):l.from(t.map(e=>parseInt(e,16)))}var na=Object.freeze({__proto__:null,encode:ea,decode:ta});function ra(e){return new TextDecoder(`utf-8`).decode(e)}function ia(e){return new TextEncoder().encode(e)}var aa=Object.freeze({__proto__:null,decode:ra,encode:ia});function oa(e){return ie.default.encode(e)}function sa(e){return ie.default.decode(e)}var ca=Object.freeze({__proto__:null,encode:oa,decode:sa});function la(e){return e.toString(`base64`)}function ua(e){return l.from(e,`base64`)}var da=Object.freeze({__proto__:null,hex:na,utf8:aa,bs58:ca,base64:Object.freeze({__proto__:null,encode:la,decode:ua})});function fa(e){let t=new Map;return e.errors&&e.errors.forEach(e=>{let n=e.msg??e.name;t.set(e.code,n)}),t}function pa(e,...t){if(e.args.length!=t.length)throw Error(`Invalid argument length`);let n={},r=0;return e.args.forEach(e=>{n[e.name]=t[r],r+=1}),n}function ma(e,t={}){e.forEach(e=>{if(`accounts`in e)ma(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw Error(`Invalid arguments: ${e.name} not provided.`)})}function q(e){return e instanceof b?e:new b(e)}var ha=class extends TypeError{constructor(e,t){let n,{message:r,...i}=e,{path:a}=e,o=a.length===0?r:`At path: `+a.join(`.`)+` -- `+r;super(o),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??=[e,...t()]}};function ga(e){return _a(e)&&typeof e[Symbol.iterator]==`function`}function _a(e){return typeof e==`object`&&!!e}function va(e){return typeof e==`string`?JSON.stringify(e):``+e}function ya(e){let{done:t,value:n}=e.next();return t?void 0:n}function ba(e,t,n,r){if(e===!0)return;e===!1?e={}:typeof e==`string`&&(e={message:e});let{path:i,branch:a}=t,{type:o}=n,{refinement:s,message:c="Expected a value of type `"+o+"`"+(s?" with refinement `"+s+"`":``)+", but received: `"+va(r)+"`"}=e;return{value:r,type:o,refinement:s,key:i[i.length-1],path:i,branch:a,...e,message:c}}function*xa(e,t,n,r){ga(e)||(e=[e]);for(let i of e){let e=ba(i,t,n,r);e&&(yield e)}}function*Sa(e,t,n){n===void 0&&(n={});let{path:r=[],branch:i=[e],coerce:a=!1,mask:o=!1}=n,s={path:r,branch:i};if(a&&(e=t.coercer(e,s),o&&t.type!==`type`&&_a(t.schema)&&_a(e)&&!Array.isArray(e)))for(let n in e)t.schema[n]===void 0&&delete e[n];let c=!0;for(let n of t.validator(e,s))c=!1,yield[n,void 0];for(let[n,l,u]of t.entries(e,s)){let t=Sa(l,u,{path:n===void 0?r:[...r,n],branch:n===void 0?i:[...i,l],coerce:a,mask:o});for(let r of t)r[0]?(c=!1,yield[r[0],void 0]):a&&(l=r[1],n===void 0?e=l:e instanceof Map?e.set(n,l):e instanceof Set?e.add(l):_a(e)&&(e[n]=l))}if(c)for(let n of t.refiner(e,s))c=!1,yield[n,void 0];c&&(yield[void 0,e])}var Ca=class{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;let{type:t,schema:n,validator:r,refiner:i,coercer:a=e=>e,entries:o=function*(){}}=e;this.type=t,this.schema=n,this.entries=o,this.coercer=a,r?this.validator=(e,t)=>xa(r(e,t),t,this,e):this.validator=()=>[],i?this.refiner=(e,t)=>xa(i(e,t),t,this,e):this.refiner=()=>[]}assert(e){return wa(e,this)}create(e){return Ta(e,this)}is(e){return Da(e,this)}mask(e){return Ea(e,this)}validate(e,t){return t===void 0&&(t={}),Oa(e,this,t)}};function wa(e,t){let n=Oa(e,t);if(n[0])throw n[0]}function Ta(e,t){let n=Oa(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function Ea(e,t){let n=Oa(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}function Da(e,t){return!Oa(e,t)[0]}function Oa(e,t,n){n===void 0&&(n={});let r=Sa(e,t,n),i=ya(r);return i[0]?[new ha(i[0],function*(){for(let e of r)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function ka(e,t){return new Ca({type:e,schema:null,validator:t})}function Aa(){return ka(`any`,()=>!0)}function ja(e){return new Ca({type:`array`,schema:e,*entries(t){if(e&&Array.isArray(t))for(let[n,r]of t.entries())yield[n,r,e]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: `+va(e)}})}function Ma(){return ka(`boolean`,e=>typeof e==`boolean`)}function Na(e){let t=va(e),n=typeof e;return new Ca({type:`literal`,schema:n===`string`||n===`number`||n===`boolean`?e:null,validator(n){return n===e||"Expected the literal `"+t+"`, but received: "+va(n)}})}function Pa(e){return new Ca({...e,validator:(t,n)=>t===null||e.validator(t,n),refiner:(t,n)=>t===null||e.refiner(t,n)})}function Fa(){return ka(`number`,e=>typeof e==`number`&&!isNaN(e)||`Expected a number, but received: `+va(e))}function Ia(e){return new Ca({...e,validator:(t,n)=>t===void 0||e.validator(t,n),refiner:(t,n)=>t===void 0||e.refiner(t,n)})}function La(){return ka(`string`,e=>typeof e==`string`||`Expected a string, but received: `+va(e))}function Ra(e){let t=Object.keys(e);return new Ca({type:`type`,schema:e,*entries(n){if(_a(n))for(let r of t)yield[r,n[r],e[r]]},validator(e){return _a(e)||`Expected an object, but received: `+va(e)}})}function za(e){let t=e.map(e=>e.type).join(` | `);return new Ca({type:`union`,schema:null,coercer(t,n){return(e.find(e=>{let[n]=e.validate(t,{coerce:!0});return!n})||Ba()).coercer(t,n)},validator(n,r){let i=[];for(let t of e){let[...e]=Sa(n,t,r),[a]=e;if(a[0])for(let[t]of e)t&&i.push(t);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+va(n),...i]}})}function Ba(){return ka(`unknown`,()=>!0)}function Va(e,t,n){return new Ca({...e,coercer:(r,i)=>Da(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}async function Ha(e,t,n,r){e=q(e),r||=io();let i=new p;if(i.add(new S({programId:e,keys:t??[],data:n})),r.sendAndConfirm===void 0)throw Error(`This function requires 'Provider.sendAndConfirm' to be implemented.`);return await r.sendAndConfirm(i,[])}var Ua=99;async function Wa(e,t,n){return(await Ga(e,t,n)).map(e=>e?{publicKey:e.publicKey,account:e.account}:null)}async function Ga(e,t,n){if(t.length<=Ua)return await Ka(e,t,n);{let r=Qi(t,Ua);return(await Promise.all(r.map(t=>
1Ka(e,t,n)))).flat()}}async function Ka(e,t,n){let r=n??e.commitment,{value:i,context:a}=await e.getMultipleAccountsInfoAndContext(t,r);return i.map((e,n)=>e===null?null:{publicKey:t[n],account:e,context:a})}async function qa(e,t,n,r,i){n&&n.length>0&&t.sign(...n);let a=t._compile(),o=a.serialize(),s=t._serialize(o).toString(`base64`),c={encoding:`base64`,commitment:r??e.commitment};i&&(c.accounts={encoding:`base64`,addresses:(Array.isArray(i)?i:a.nonProgramIds()).map(e=>e.toBase58())}),n&&(c.sigVerify=!0);let l=[s,c],u=Ta(await e._rpcRequest(`simulateTransaction`,l),Qa);if(`error`in u){let e;if(`data`in u.error&&(e=u.error.data?.logs,e&&Array.isArray(e))){let t=` 2 `,n=t+e.join(t);console.error(u.error.message,n)}throw new v(`failed to simulate transaction: `+u.error.message,e)}return u.result}function Ja(e){return Va(Xa(e),Ya,t=>`error`in t?t:{...t,result:Ta(t.result,e)})}var Ya=Xa(Ba());function Xa(e){return za([Ra({jsonrpc:Na(`2.0`),id:La(),result:e}),Ra({jsonrpc:Na(`2.0`),id:La(),error:Ra({code:Ba(),message:La(),data:Ia(Aa())})})])}function Za(e){return Ja(Ra({context:Ra({slot:Fa()}),value:e}))}var Qa=Za(Ra({err:Pa(za([Ra({}),La()])),logs:Pa(ja(La())),accounts:Ia(Pa(ja(Pa(Ra({executable:Ma(),owner:La(),lamports:Fa(),data:ja(La()),rentEpoch:Ia(Fa())}))))),unitsConsumed:Ia(Fa())})),$a=Object.freeze({__proto__:null,invoke:Ha,getMultipleAccounts:Wa,getMultipleAccountsAndContext:Ga,simulateTransaction:qa}),eo=class{constructor(e,t,n){this.connection=e,this.wallet=t,this.opts=n,this.publicKey=t?.publicKey}static defaultOptions(){return{preflightCommitment:`processed`,commitment:`processed`}}static local(e,t){throw Error(`Provider local is not available on browser.`)}static env(){throw Error(`Provider env is not available on browser.`)}async sendAndConfirm(e,t,n){if(n===void 0&&(n=this.opts),$i(e))t&&e.sign(t);else if(e.feePayer=e.feePayer??this.wallet.publicKey,e.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,t)for(let n of t)e.partialSign(n);e=await this.wallet.signTransaction(e);let r=e.serialize();try{return await no(this.connection,r,n)}catch(t){if(t instanceof ro){let n=oa($i(e)?e.signatures?.[0]||new Uint8Array:e.signature??new Uint8Array),r=await this.connection.getTransaction(n,{commitment:`confirmed`});if(r){let e=r.meta?.logMessages;throw e?new v(t.message,e):t}else throw t}else throw t}}async sendAll(e,t){t===void 0&&(t=this.opts);let n=(await this.connection.getLatestBlockhash(t.preflightCommitment)).blockhash,r=e.map(e=>{if($i(e.tx)){let t=e.tx;return e.signers&&t.sign(e.signers),t}else{let t=e.tx,r=e.signers??[];return t.feePayer=t.feePayer??this.wallet.publicKey,t.recentBlockhash=n,r.forEach(e=>{t.partialSign(e)}),t}}),i=await this.wallet.signAllTransactions(r),a=[];for(let e=0;e<r.length;e+=1){let n=i[e],r=n.serialize();try{a.push(await no(this.connection,r,t))}catch(e){if(e instanceof ro){let t=oa($i(n)?n.signatures?.[0]||new Uint8Array:n.signature??new Uint8Array),r=await this.connection.getTransaction(t,{commitment:`confirmed`});if(r){let t=r.meta?.logMessages;throw t?new v(e.message,t):e}else throw e}else throw e}}return a}async simulate(e,t,n,r){let i=(await this.connection.getLatestBlockhash(n??this.connection.commitment)).blockhash,a;if($i(e)?(t&&(e.sign(t),e=await this.wallet.signTransaction(e)),a=await this.connection.simulateTransaction(e,{commitment:n})):(e.feePayer=e.feePayer||this.wallet.publicKey,e.recentBlockhash=i,t&&(e=await this.wallet.signTransaction(e)),a=await qa(this.connection,e,t,n,r)),a.value.err)throw new to(a.value);return a.value}},to=class extends Error{constructor(e,t){super(t),this.simulationResponse=e}};async function no(e,t,n){let r=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment},i=await e.sendRawTransaction(t,r),a=(await e.confirmTransaction(i,n&&n.commitment)).value;if(a.err)throw new ro(`Raw transaction ${i} failed (${JSON.stringify(a)})`);return i}var ro=class extends Error{constructor(e){super(e)}};function io(){return ao===null?eo.local():ao}var ao=null,oo=new Set([`anchor-deprecated-state`,`debug-logs`]),so=new Map;function co(e){if(!oo.has(e))throw Error(`Invalid feature`);so.set(e,!0)}function lo(e){return so.get(e)!==void 0}var uo=Object.freeze({__proto__:null,set:co,isSet:lo}
2),fo=class extends Error{constructor(e){super(e),this.name=`IdlError`}},po=class e{constructor(e){this.stack=e}static parse(t){let n=/^Program (\w*) invoke/,r=/^Program \w* success/,i=[];for(let e=0;e<t.length;e++){if(r.exec(t[e])){i.pop();continue}let a=n.exec(t[e])?.[1];a&&i.push(new b(a))}return new e(i)}},mo=class e extends Error{constructor(e,t,n,r,i,a){super(n.join(` 3`).replace(`Program log: `,``)),this.errorLogs=n,this.logs=r,this.error={errorCode:e,errorMessage:t,comparedValues:a,origin:i},this._programErrorStack=po.parse(r)}static parse(t){if(!t)return null;let n=t.findIndex(e=>e.startsWith(`Program log: AnchorError`));if(n===-1)return null;let r=t[n],i=[r],a;if(n+1<t.length){if(t[n+1]===`Program log: Left:`){let e=/^Program log: (.*)$/,r=e.exec(t[n+2])[1],o=e.exec(t[n+4])[1];a=[new b(r),new b(o)],i.push(...t.slice(n+1,n+5))}else if(t[n+1].startsWith(`Program log: Left:`)){let e=/^Program log: (Left|Right): (.*)$/,r=e.exec(t[n+1])[2],o=e.exec(t[n+2])[2];i.push(...t.slice(n+1,n+3)),a=[r,o]}}let o=/^Program log: AnchorError occurred\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(r),s=/^Program log: AnchorError thrown in (.*):(\d*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(r),c=/^Program log: AnchorError caused by account: (.*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(r);if(o){let[n,r,s]=o.slice(1,4);return new e({code:n,number:parseInt(r)},s,i,t,void 0,a)}else if(s){let[n,r,o,c,l]=s.slice(1,6);return new e({code:o,number:parseInt(c)},l,i,t,{file:n,line:parseInt(r)},a)}else if(c){let[n,r,o,s]=c.slice(1,5);return new e({code:r,number:parseInt(o)},s,i,t,n,a)}else return null}get program(){return this._programErrorStack.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack.stack}toString(){return this.message}},ho=class e extends Error{constructor(e,t,n){super(),this.code=e,this.msg=t,this.logs=n,n&&(this._programErrorStack=po.parse(n))}static parse(t,n){let r=t.toString(),i;if(r.includes(`custom program error:`)){let e=r.split(`custom program error: `);if(e.length!==2)return null;i=e[1]}else{let e=r.match(/"Custom":([0-9]+)}/g);if(!e||e.length>1)return null;i=e[0].match(/([0-9]+)/g)[0]}let a;try{a=parseInt(i)}catch{return null}let o=n.get(a);return o!==void 0||(o=_o.get(a),o!==void 0)?new e(a,o,t.logs):null}get program(){return this._programErrorStack?.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack?.stack}toString(){return this.msg}};function go(e,t){return lo(`debug-logs`)&&console.log(`Translating error:`,e),mo.parse(e.logs)||ho.parse(e,t)||(e.logs?(e.programErrorStack=po.parse(e.logs),new Proxy(e,{get:function(t,n){return n===`programErrorStack`?t.programErrorStack.stack:n===`program`?t.programErrorStack.stack[e.programErrorStack.stack.length-1]:Reflect.get(...arguments)}})):e)}
3var J={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},_o=new Map([[J.InstructionMissing,`8 byte instruction identifier not provided`],[J.InstructionFallbackNotFound,`Fallback functions are not supported`],[J.InstructionDidNotDeserialize,`The program could not deserialize the given instruction`],[J.InstructionDidNotSerialize,`The program could not serialize the given instruction`],[J.IdlInstructionStub,`The program was compiled without idl instructions`],[J.IdlInstructionInvalidProgram,`The transaction was given an invalid program for the IDL instruction`],[J.ConstraintMut,`A mut constraint was violated`],[J.ConstraintHasOne,`A has one constraint was violated`],[J.ConstraintSigner,`A signer constraint was violated`],[J.ConstraintRaw,`A raw constraint was violated`],[J.ConstraintOwner,`An owner constraint was violated`],[J.ConstraintRentExempt,`A rent exemption constraint was violated`],[J.ConstraintSeeds,`A seeds constraint was violated`],[J.ConstraintExecutable,`An executable constraint was violated`],[J.ConstraintState,`Deprecated Error, feel free to replace with something else`],[J.ConstraintAssociated,`An associated constraint was violated`],[J.ConstraintAssociatedInit,`An associated init constraint was violated`],[J.ConstraintClose,`A close constraint was violated`],[J.ConstraintAddress,`An address constraint was violated`],[J.ConstraintZero,`Expected zero account discriminant`],[J.ConstraintTokenMint,`A token mint constraint was violated`],[J.ConstraintTokenOwner,`A token owner constraint was violated`],[J.ConstraintMintMintAuthority,`A mint mint authority constraint was violated`],[J.ConstraintMintFreezeAuthority,`A mint freeze authority constraint was violated`],[J.ConstraintMintDecimals,`A mint decimals constraint was violated`],[J.ConstraintSpace,`A space constraint was violated`],[J.ConstraintAccountIsNone,`A required account for the constraint is None`],[J.RequireViolated,`A require expression was violated`],[J.RequireEqViolated,`A require_eq expression was violated`],[J.RequireKeysEqViolated,`A require_keys_eq expression was violated`],[J.RequireNeqViolated,`A require_neq expression was violated`],[J.RequireKeysNeqViolated,`A require_keys_neq expression was violated`],[J.RequireGtViolated,`A require_gt expression was violated`],[J.RequireGteViolated,`A require_gte expression was violated`],[J.AccountDiscriminatorAlreadySet,`The account discriminator was already set on this account`],[J.AccountDiscriminatorNotFound,`No 8 byte discriminator was found on the account`],[J.AccountDiscriminatorMismatch,`8 byte discriminator did not match what was expected`],[J.AccountDidNotDeserialize,`Failed to deserialize the account`],[J.AccountDidNotSerialize,`Failed to serialize the account`],[J.AccountNotEnoughKeys,`Not enough account keys given to the instruction`],[J.AccountNotMutable,`The given account is not mutable`],[J.AccountOwnedByWrongProgram,`The given account is owned by a different program than expected`],[J.InvalidProgramId,`Program ID was not as expected`],[J.InvalidProgramExecutable,`Program account is not executable`],[J.AccountNotSigner,`The given account did not sign`],[J.A
3ccountNotSystemOwned,`The given account is not owned by the system program`],[J.AccountNotInitialized,`The program expected this account to be already initialized`],[J.AccountNotProgramData,`The given account is not a program data account`],[J.AccountNotAssociatedTokenAccount,`The given account is not the associated token account`],[J.AccountSysvarMismatch,`The given public key does not match the required sysvar`],[J.AccountReallocExceedsLimit,`The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit`],[J.AccountDuplicateReallocs,`The account was duplicated for more than one reallocation`],[J.DeclaredProgramIdMismatch,`The declared program id does not match the actual program id`],[J.Deprecated,`The API being used is deprecated and should no longer be used`]]),vo=function(){return vo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},vo.apply(this,arguments)},yo=function(){return yo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},yo.apply(this,arguments)};function bo(e){return e.toLowerCase()}var xo=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],So=/[^A-Z0-9]+/gi;function Co(e,t){t===void 0&&(t={});for(var n=t.splitRegexp,r=n===void 0?xo:n,i=t.stripRegexp,a=i===void 0?So:i,o=t.transform,s=o===void 0?bo:o,c=t.delimiter,l=c===void 0?` `:c,u=wo(wo(e,r,`$1\0$2`),a,`\0`),d=0,f=u.length;u.charAt(d)===`\0`;)d++;for(;u.charAt(f-1)===`\0`;)f--;return u.slice(d,f).split(`\0`).map(s).join(l)}function wo(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce(function(e,t){return e.replace(t,n)},e)}function To(e,t){return t===void 0&&(t={}),Co(e,yo({delimiter:`.`},t))}function Eo(e,t){return t===void 0&&(t={}),To(e,vo({delimiter:`_`},t))}var Do=class e{static fieldLayout(t,n){let r=t.name===void 0?void 0:(0,M.default)(t.name);switch(t.type){case`bool`:return N.bool(r);case`u8`:return N.u8(r);case`i8`:return N.i8(r);case`u16`:return N.u16(r);case`i16`:return N.i16(r);case`u32`:return N.u32(r);case`i32`:return N.i32(r);case`f32`:return N.f32(r);case`u64`:return N.u64(r);case`i64`:return N.i64(r);case`f64`:return N.f64(r);case`u128`:return N.u128(r);case`i128`:return N.i128(r);case`u256`:return N.u256(r);case`i256`:return N.i256(r);case`bytes`:return N.vecU8(r);case`string`:return N.str(r);case`publicKey`:return N.publicKey(r);default:if(`vec`in t.type)return N.vec(e.fieldLayout({name:void 0,type:t.type.vec},n),r);if(`option`in t.type)return N.option(e.fieldLayout({name:void 0,type:t.type.option},n),r);if(`defined`in t.type){if(!n)throw new fo(`User defined types not provided`);let i=t.type.defined,a=n.filter(e=>e.name===i);if(a.length!==1)throw new fo(`Type not found: ${JSON.stringify(t)}`);return e.typeDefLayout(a[0],n,r)}else if(`array`in t.type){let i=t.type.array[0],a=t.type.array[1],o=e.fieldLayout({name:void 0,type:i},n);return N.array(o,a,r)}else throw Error(`Not yet implemented: ${t}`)}}static typeDefLayout(t,n=[],r){switch(t.type.kind){case`struct`:{let i=t.type.fields.map(t=>e.fieldLayout(t,n));return N.struct(i,r)}case`enum`:{let i=t.type.variants.map(t=>{let r=(0,M.default)(t.name);if(!t.fields)return N.struct([],r);let i=t.fields.map((t,r)=>t?.name?e.fieldLayout(t,n):e.fieldLayout({type:t,name:r.toString()},n));return N.struct(i,r)});return r===void 0?N.rustEnum(i,r):N.rustEnum(i).replicate(r)}case`alias`:return e.fieldLayout({type:t.type.value,name:t.name},n)}}},Oo=`global`,ko=class e{constructor(t){this.idl=t,this.ixLayout=e.parseIxLayout(t);let n=new Map;t.instructions.forEach(e=>{let t=Mo(Oo,e.name);n.set(ie.default.encode(t),{layout:this.ixLayout.get(e.name),name:e.name})}),this.sighashLayouts=n}encode(e,t){return this._encode(Oo,e,t)}_encode(e,t,n){let r=l.alloc(1e3),i=(0,M.default)(t),a=this.ixLayout.get(i);if(!a)throw Error(`Unknown method: ${i}`);let o=a.encode(n,r),s=r.slice(0,o);return l.concat([Mo(e,t),s])}static parseIxLayout(e){let t=e.instructions.map(t=>{let n=t.args.map(t=>
3Do.fieldLayout(t,Array.from([...e.accounts??[],...e.types??[]]))),r=(0,M.default)(t.name);return[r,N.struct(n,r)]});return new Map(t)}decode(e,t=`hex`){typeof e==`string`&&(e=t===`hex`?l.from(e,`hex`):ie.default.decode(e));let n=ie.default.encode(e.slice(0,8)),r=e.slice(8),i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(r),name:i.name}:null}format(e,t){return Ao.format(e,t,this.idl)}},Ao=class e{static format(t,n,r){let i=r.instructions.filter(e=>t.name===e.name)[0];if(i===void 0)return console.error(`Invalid instruction given`),null;let a=i.args.map(n=>({name:n.name,type:e.formatIdlType(n.type),data:e.formatIdlData(n,t.data[n.name],r.types)})),o=e.flattenIdlAccounts(i.accounts);return{args:a,accounts:n.map((e,t)=>t<o.length?{name:o[t].name,...e}:{name:void 0,...e})}}static formatIdlType(e){if(typeof e==`string`)return e;if(`vec`in e)return`Vec<${this.formatIdlType(e.vec)}>`;if(`option`in e)return`Option<${this.formatIdlType(e.option)}>`;if(`defined`in e)return e.defined;if(`array`in e)return`Array<${e.array[0]}; ${e.array[1]}>`;throw Error(`Unknown IDL type: ${e}`)}static formatIdlData(t,n,r){if(typeof t.type==`string`)return n.toString();if(t.type.hasOwnProperty(`vec`))return`[`+n.map(e=>this.formatIdlData({name:``,type:t.type.vec},e)).join(`, `)+`]`;if(t.type.hasOwnProperty(`option`))return n===null?`null`:this.formatIdlData({name:``,type:t.type.option},n,r);if(t.type.hasOwnProperty(`defined`)){if(r===void 0)throw Error(`User defined types not provided`);let i=r.filter(e=>e.name===t.type.defined);if(i.length!==1)throw Error(`Type not found: ${t.type.defined}`);return e.formatIdlDataDefined(i[0],n,r)}return`unknown`}static formatIdlDataDefined(t,n,r){switch(t.type.kind){case`struct`:{let i=t.type;return`{ `+Object.keys(n).map(t=>{let a=i.fields.find(e=>e.name===t);if(!a)throw Error(`Unable to find type`);return t+`: `+e.formatIdlData(a,n[t],r)}).join(`, `)+` }`}case`enum`:if(t.type.variants.length===0)return`{}`;if(t.type.variants[0].name){let i=t.type.variants,a=Object.keys(n)[0],o=n[a],s=Object.keys(o).map(t=>{let n=o[t],s=i[a]?.find(e=>e.name===t);if(!s)throw Error(`Unable to find variant`);return t+`: `+e.formatIdlData(s,n,r)}).join(`, `),c=(0,M.default)(a,{pascalCase:!0});return s.length===0?c:`${c} { ${s} }`}else return`Tuple formatting not yet implemented`;case`alias`:return e.formatIdlType(t.type.value)}}static flattenIdlAccounts(t,n){return t.map(t=>{let r=jo(t.name);if(t.hasOwnProperty(`accounts`)){let i=n?`${n} > ${r}`:r;return e.flattenIdlAccounts(t.accounts,i)}else return{...t,name:n?`${n} > ${r}`:r}}).flat()}};function jo(e){let t=e.replace(/([A-Z])/g,` $1`);return t.charAt(0).toUpperCase()+t.slice(1)}function Mo(e,t){let n=`${e}:${Eo(t)}`;return l.from(T(n).slice(0,8))}function No(e,t){switch(t.type.kind){case`struct`:return t.type.fields.map(t=>Po(e,t.type)).reduce((e,t)=>e+t,0);case`enum`:{let n=t.type.variants.map(t=>t.fields?t.fields.map(t=>typeof t==`object`&&`name`in t?Po(e,t.type):Po(e,t)).reduce((e,t)=>e+t,0):0);return Math.max(...n)+1}case`alias`:return Po(e,t.type.value)}}function Po(e,t){switch(t){case`bool`:return 1;case`u8`:return 1;case`i8`:return 1;case`i16`:return 2;case`u16`:return 2;case`u32`:return 4;case`i32`:return 4;case`f32`:return 4;case`u64`:return 8;case`i64`:return 8;case`f64`:return 8;case`u128`:return 16;case`i128`:return 16;case`u256`:return 32;case`i256`:return 32;case`bytes`:return 1;case`string`:return 1;case`publicKey`:return 32;default:if(`vec`in t)return 1;if(`option`in t)return 1+Po(e,t.option);if(`coption`in t)return 4+Po(e,t.coption);if(`defined`in t){let n=e.types?.filter(e=>e.name===t.defined)??[];if(n.length!==1)throw new fo(`Type not found: ${JSON.stringify(t)}`);let r=n[0];return No(e,r)}if(`array`in t){let n=t.array[0],r=t.array[1];return Po(e,n)*r}throw Error(`Invalid type ${JSON.stringify(t)}`)}}function Fo(e){return d.from(T(e).slice(0,8))}var Io=class e{constructor(e){if(e.accounts===void 0){this.accountLayouts=new Map;return}let t=e.accounts.map(t=>[t.name,Do.typeDefLayout(t,e.types)]);this.accountLayouts=new Map(t),this.idl=e}async encode(t,n){let r=l.alloc(1e3),i=this.accountLayouts.get(t);if(!i)throw Error(`Unknown account: ${t}`);let a=i.encode(n,r),o=r.slice(0,a),s=e.accountDiscriminator(t);return l.concat([s,o])}decode(t,n){if(e.accountDiscriminator(t).compare(n.slice(0,8)))throw Error(`Invalid account discriminator`);return this.decodeUnchecked(t,n)}decodeAny(t){let n=t.slice(0,8),r=Array.from(this.accountLayouts.keys()).find(t=>e.accountDiscriminator(t).equals(n));if(!r)throw Error(`Account descriminator not found`);return this.decodeUnchecked(r,t)}decodeUnchecked(e,t){let n=t.subarray(8),r=this.accountLayouts.get(e);if(!r)throw Error(`Unknown account: ${e}`);return r.decode(n)}memcmp(t,n){let r=e.accountDiscriminator(t);return{offset:0,bytes:ie.default.encode(n?l.concat([r,n]):r)}}size(e){return 8+(No(this.idl,e)??0)}
3static accountDiscriminator(e){return Fo(`account:${(0,M.default)(e,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}},Lo=class{constructor(e){if(e.events===void 0){this.layouts=new Map;return}let t=e.events.map(t=>{let n={name:t.name,type:{kind:`struct`,fields:t.fields.map(e=>({name:e.name,type:e.type}))}};return[t.name,Do.typeDefLayout(n,e.types)]});this.layouts=new Map(t),this.discriminators=new Map(e.events===void 0?[]:e.events.map(e=>[la(Ro(e.name)),e.name]))}decode(e){let t;try{t=ua(e)}catch{return null}let n=la(t.slice(0,8)),r=this.discriminators.get(n);if(r===void 0)return null;let i=this.layouts.get(r);if(!i)throw Error(`Unknown event: ${r}`);return{data:i.decode(t.slice(8)),name:r}}};function Ro(e){return Fo(`event:${e}`)}var zo=class{constructor(e){if(e.types===void 0){this.typeLayouts=new Map;return}let t=e.types.map(t=>[t.name,Do.typeDefLayout(t,e.types)]);this.typeLayouts=new Map(t),this.idl=e}encode(e,t){let n=l.alloc(1e3),r=this.typeLayouts.get(e);if(!r)throw Error(`Unknown type: ${e}`);let i=r.encode(t,n);return n.slice(0,i)}decode(e,t){let n=this.typeLayouts.get(e);if(!n)throw Error(`Unknown type: ${e}`);return n.decode(t)}},Bo=class{constructor(e){this.instruction=new ko(e),this.accounts=new Io(e),this.events=new Lo(e),this.types=new zo(e)}},Vo=typeof globalThis<`u`?globalThis:typeof window<`u`?window:i===void 0?typeof self<`u`?self:{}:i;function Ho(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Y=class{constructor(e,t){if(!Number.isInteger(e))throw TypeError(`span must be an integer`);this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw Error(`Layout is abstract`)}encode(e,t,n){throw Error(`Layout is abstract`)}getSpan(e,t){if(0>this.span)throw RangeError(`indeterminate span`);return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}},Uo=Y;function Wo(e,t){return t.property?e+`[`+t.property+`]`:e}var Go=class extends Y{isCount(){throw Error(`ExternalLayout is abstract`)}},Ko=class extends Go{constructor(e,t,n){if(!(e instanceof Y))throw TypeError(`layout must be a Layout`);if(t===void 0)t=0;else if(!Number.isInteger(t))throw TypeError(`offset must be integer or undefined`);super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof qo||this.layout instanceof Jo}decode(e,t){return t===void 0&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return n===void 0&&(n=0),this.layout.encode(e,t,n+this.offset)}},qo=class extends Y{constructor(e,t){if(super(e,t),6<this.span)throw RangeError(`span must not exceed 6 bytes`)}decode(e,t){return t===void 0&&(t=0),e.readUIntLE(t,this.span)}encode(e,t,n){return n===void 0&&(n=0),t.writeUIntLE(e,n,this.span),this.span}},Jo=class extends Y{constructor(e,t){if(super(e,t),6<this.span)throw RangeError(`span must not exceed 6 bytes`)}decode(e,t){return t===void 0&&(t=0),e.readUIntBE(t,this.span)}encode(e,t,n){return n===void 0&&(n=0),t.writeUIntBE(e,n,this.span),this.span}},Yo=2**32;function Xo(e){let t=Math.floor(e/Yo);return{hi32:t,lo32:e-t*Yo}}function Zo(e,t){return e*Yo+t}var Qo=class extends Y{constructor(e){super(8,e)}decode(e,t){t===void 0&&(t=0);let n=e.readUInt32LE(t);return Zo(e.readUInt32LE(t+4),n)}encode(e,t,n){n===void 0&&(n=0);let r=Xo(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}},$o=class extends Y{constructor(e){super(8,e)}decode(e,t){t===void 0&&(t=0);let n=e.readUInt32LE(t);return Zo(e.readInt32LE(t+4),n)}encode(e,t,n){n===void 0&&(n=0);let r=Xo(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}},es=class extends Y{constructor(e,t,n){if(!(Array.isArray(e)&&e.reduce((e,t)=>e&&t instanceof Y,!0)))throw TypeError(`fields must be array of Layout instances`);typeof t==`boolean`&&n===void 0&&(n=t,t=void 0);for(let t of e)if(0>t.span&&t.property===void 0)throw Error(`fields cannot contain unnamed variable-length layout`);let r=-1;try{r=e.reduce((e,t)=>e+t.getSpan(),0)}catch{}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;try{n=this.fields.reduce((n,r)=>{let i=r.getSpan(e,t);return t+=i,n+i},0)}catch{throw RangeError(`indeterminate span`)}return n}decode(e,t){t===void 0&&(t=0);let n=this.makeDestinationObject();for(let r of this.fields)if(r.property!==void 0&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){n===void 0&&(n=0);let r=n,i=0,a=0;for(let r of this.fields){let o=r.span;if(a=0<o?o:0,r.property!==void 0){let i=e[r.property];i!==void 0&&(a=r.encode(i,t,n),0>o&&(o=r.getSpan(t,n)))}i=n,n+=o}return i+a-r}fromArray(e){let t=this.makeDestinationObject();for(let n of this.fields)n.property!==void 0&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if(typeof e!=`string`)throw TypeError(`property must be string`);for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if(typeof e!=`string`)throw TypeError(`property must be string`);let t=0;for(let n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}},ts=class{constructor(e){this.property=e}decode(){throw Error(`UnionDiscriminator is abstract`)}encode(){throw Error(`UnionDiscriminator is abstract`)}},ns=class extends ts{constructor(e,t){if(!(e instanceof Go&&e.isCount()))throw TypeError(`layout must be an unsigned integer ExternalLayout`);super(t||e.property||`variant`),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}},rs=class extends Y{constructor(e,t,n){let r=e instanceof qo||e instanceof Jo;if(r)e=new ns(new Ko(e));else if(e instanceof Go&&e.isCount())e=new ns(e);else if(!(e instanceof ts))throw TypeError(`discr must be a UnionDiscriminator or an unsigned integer layout`);if(t===void 0&&(t=null),!(t===null||t instanceof Y))throw TypeError(`defaultLayout must be null or a Layout`);if(t!==null){if(0>t.span)throw Error(`defaultLayout must have constant span`);t.property===void 0&&(t=t.replicate(`content`))}let i=-1;t&&(i=t.span,0<=i&&r&&(i+=e.layout.span)),super(i,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let a=this.defaultGetSourceVariant.bind(this);
3this.getSourceVariant=function(e){return a(e)},this.configGetSourceVariant=function(e){a=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=this.getVariant(e,t);if(!n)throw Error(`unable to determine span for unrecognized variant`);return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(let t in this.registry){let n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw Error(`unable to infer src variant`)}decode(e,t){t===void 0&&(t=0);let n,r=this.discriminator,i=r.decode(e,t),a=this.registry[i];if(a===void 0){let o=0;a=this.defaultLayout,this.usesPrefixDiscriminator&&(o=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[a.property]=this.defaultLayout.decode(e,t+o)}else n=a.decode(e,t);return n}encode(e,t,n){n===void 0&&(n=0);let r=this.getSourceVariant(e);if(r===void 0){let r=this.discriminator,i=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=r.layout.span),r.encode(e[r.property],t,n),a+i.encode(e[i.property],t,n+a)}return r.encode(e,t,n)}addVariant(e,t,n){let r=new is(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return d.isBuffer(e)&&(t===void 0&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}},is=class extends Y{constructor(e,t,n,r){if(!(e instanceof rs))throw TypeError(`union must be a Union`);if(!Number.isInteger(t)||0>t)throw TypeError(`variant must be a (non-negative) integer`);if(typeof n==`string`&&r===void 0&&(r=n,n=null),n){if(!(n instanceof Y))throw TypeError(`layout must be a Layout`);if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw Error(`variant span exceeds span of containing union`);if(typeof r!=`string`)throw TypeError(`variant must have a String property`)}let i=e.span;0>e.span&&(i=n?n.span:0,0<=i&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span)),super(i,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){let n=this.makeDestinationObject();if(t===void 0&&(t=0),this!==this.union.getVariant(e,t))throw Error(`variant mismatch`);let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){n===void 0&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw TypeError(`variant lacks property `+this.property);this.union.discriminator.encode(this.variant,t,n);let i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw Error(`encoded variant overruns containing union`);return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}},as=class extends Y{constructor(e,t){if(!(e instanceof Go&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError(`length must be positive integer or an unsigned integer ExternalLayout`);let n=-1;e instanceof Go||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){t===void 0&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof Go&&(r=e.length),!(d.isBuffer(e)&&r===e.length))throw TypeError(Wo(`Blob.encode`,this)+` requires (length `+r+`) Buffer as src`);if(n+r>t.length)throw RangeError(`encoding overruns Buffer`);return t.write(e.toString(`hex`),n,r,`hex`),this.length instanceof Go&&this.length.encode(r,t,n),r}},os=((e,t,n)=>new Ko(e,t,n)),ss=(e=>new qo(1,e)),cs=(e=>new qo(4,e)),ls=(e=>
3new Qo(e)),us=(e=>new $o(e)),X=((e,t,n)=>new es(e,t,n)),ds=((e,t,n)=>new rs(e,t,n)),fs=((e,t)=>new as(e,t)),ps=class extends Uo{constructor(e){super(-1,e),this.property=e,this.layout=X([cs(`length`),cs(`lengthPadding`),fs(os(cs(),-8),`chars`)],this.property)}encode(e,t,n=0){if(e==null)return this.layout.span;let r={chars:d.from(e,`utf8`)};return this.layout.encode(r,t,n)}decode(e,t=0){return this.layout.decode(e,t).chars.toString()}getSpan(e,t=0){return cs().span+cs().span+new re.default(new Uint8Array(e).slice(t,t+4),10,`le`).toNumber()}};function ms(e){return new ps(e)}function Z(e){return fs(32,e)}var Q=ds(cs(`instruction`));Q.addVariant(0,X([us(`lamports`),us(`space`),Z(`owner`)]),`createAccount`),Q.addVariant(1,X([Z(`owner`)]),`assign`),Q.addVariant(2,X([us(`lamports`)]),`transfer`),Q.addVariant(3,X([Z(`base`),ms(`seed`),us(`lamports`),us(`space`),Z(`owner`)]),`createAccountWithSeed`),Q.addVariant(4,X([Z(`authorized`)]),`advanceNonceAccount`),Q.addVariant(5,X([us(`lamports`)]),`withdrawNonceAccount`),Q.addVariant(6,X([Z(`authorized`)]),`initializeNonceAccount`),Q.addVariant(7,X([Z(`authorized`)]),`authorizeNonceAccount`),Q.addVariant(8,X([us(`space`)]),`allocate`),Q.addVariant(9,X([Z(`base`),ms(`seed`),us(`space`),Z(`owner`)]),`allocateWithSeed`),Q.addVariant(10,X([Z(`base`),ms(`seed`),Z(`owner`)]),`assignWithSeed`),Q.addVariant(11,X([us(`lamports`),ms(`seed`),Z(`owner`)]),`transferWithSeed`),Math.max(...Object.values(Q.registry).map(e=>e.span));var hs=class extends Uo{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}};function gs(e){return new hs(fs(32),e=>new b(e),e=>e.toBuffer(),e)}X([cs(`version`),cs(`state`),gs(`authorizedPubkey`),gs(`nonce`),X([ls(`lamportsPerSignature`)],`feeCalculator`)]);function _s(e){return new TextDecoder().decode(T(e))}var vs=Object.freeze({__proto__:null,hash:_s});function ys(e,t,n){return new b(T(l.concat([e.toBuffer(),l.from(t),n.toBuffer()])))}function bs(e,...t){let n=[l.from([97,110,99,104,111,114])];t.forEach(e=>{n.push(e instanceof l?e:q(e).toBuffer())});let[r]=b.findProgramAddressSync(n,q(e));return r}var xs=Object.freeze({__proto__:null,createWithSeedSync:ys,associated:bs}),Ss=new b(`TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`),Cs=new b(`ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`);function ws({mint:e,owner:t}){return b.findProgramAddressSync([t.toBuffer(),Ss.toBuffer(),e.toBuffer()],Cs)[0]}var Ts=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Ss,ASSOCIATED_PROGRAM_ID:Cs,associatedAddress:ws}),Es={exports:{}};(function(e,t){var n=typeof self<`u`?self:Vo,r=(function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e})();(function(e){(function(t){var n={searchParams:`URLSearchParams`in e,iterable:`Symbol`in e&&`iterator`in Symbol,blob:`FileReader`in e&&`Blob`in e&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:`FormData`in e,arrayBuffer:`ArrayBuffer`in e};function r(e){return e&&DataView.prototype.isPrototypeOf(e)}if(n.arrayBuffer)var i=[`[object Int8Array]`,`[object Uint8Array]`,`[object Uint8ClampedArray]`,`[object Int16Array]`,`[object Uint16Array]`,`[object Int32Array]`,`[object Uint32Array]`,`[object Float32Array]`,`[object Float64Array]`],a=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if(typeof e!=`string`&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw TypeError(`Invalid character in header field name`);return e.toLowerCase()}function s(e){return typeof e!=`string`&&(e=String(e)),e}function c(e){var t={next:function(){var t=e.shift();return{done:t===void 0,value:t}}};return n.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}l.prototype.append=function(e,t){e=o(e),t=s(t);var n=this.map[e];this.map[e]=n?n+`, `+t:t},l.prototype.delete=function(e){delete this.map[o(e)]},l.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},l.prototype.set=function(e,t){this.map[o(e)]=s(t)},l.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},l.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),c(e)},l.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),c(e)},l.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),c(e)},n.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);function u(e){if(e.bodyUsed)return Promise.reject(TypeError(`Already read`));e.bodyUsed=!0}function d(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function f(e){var t=new FileReader,n=d(t);return t.readAsArrayBuffer(e),n}function p(e){var t=new FileReader,n=d(t);return t.readAsText(e),n}function m(e){for(var t=new Uint8Array(e),n=Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join(``)}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?typeof e==`string`?this._bodyText=e:n.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:n.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():n.arrayBuffer&&n.blob&&r(e)?(this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||a(e))?this._bodyArrayBuffer=h(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText=``,this.headers.get(`content-type`)||(typeof e==`string`?this.headers.set(`content-type`,`text/plain;charset=UTF-8`):this._bodyBlob&&this._bodyBlob.type?this.headers.set(`content-type`,this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set(`content-type`,`application/x-www-form-urlencoded;charset=UTF-8`))},n.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error(`could not read FormData body as blob`);return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return p(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(this._bodyArrayBuffer));if(this._bodyFormData)throw Error(`could not read FormData body as text`);return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}
3var _=[`DELETE`,`GET`,`HEAD`,`OPTIONS`,`POST`,`PUT`];function v(e){var t=e.toUpperCase();return _.indexOf(t)>-1?t:e}function y(e,t){t||={};var n=t.body;if(e instanceof y){if(e.bodyUsed)throw TypeError(`Already read`);this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!n&&e._bodyInit!=null&&(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||`same-origin`,(t.headers||!this.headers)&&(this.headers=new l(t.headers)),this.method=v(t.method||this.method||`GET`),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,(this.method===`GET`||this.method===`HEAD`)&&n)throw TypeError(`Body not allowed for GET or HEAD requests`);this._initBody(n)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})};function b(e){var t=new FormData;return e.trim().split(`&`).forEach(function(e){if(e){var n=e.split(`=`),r=n.shift().replace(/\+/g,` `),i=n.join(`=`).replace(/\+/g,` `);t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function x(e){var t=new l;return e.replace(/\r?\n[\t ]+/g,` `).split(/\r?\n/).forEach(function(e){var n=e.split(`:`),r=n.shift().trim();if(r){var i=n.join(`:`).trim();t.append(r,i)}}),t}g.call(y.prototype);function S(e,t){t||={},this.type=`default`,this.status=t.status===void 0?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=`statusText`in t?t.statusText:`OK`,this.headers=new l(t.headers),this.url=t.url||``,this._initBody(e)}g.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:``});return e.type=`error`,e};var C=[301,302,303,307,308];S.redirect=function(e,t){if(C.indexOf(t)===-1)throw RangeError(`Invalid status code`);return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch{t.DOMException=function(e,t){this.message=e,this.name=t,this.stack=Error(e).stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function w(e,r){return new Promise(function(i,a){var o=new y(e,r);if(o.signal&&o.signal.aborted)return a(new t.DOMException(`Aborted`,`AbortError`));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var e={status:s.status,statusText:s.statusText,headers:x(s.getAllResponseHeaders()||``)};e.url=`responseURL`in s?s.responseURL:e.headers.get(`X-Request-URL`),i(new S(`response`in s?s.response:s.responseText,e))},s.onerror=function(){a(TypeError(`Network request failed`))},s.ontimeout=function(){a(TypeError(`Network request failed`))},s.onabort=function(){a(new t.DOMException(`Aborted`,`AbortError`))},s.open(o.method,o.url,!0),o.credentials===`include`?s.withCredentials=!0:o.credentials===`omit`&&(s.withCredentials=!1),`responseType`in s&&n.blob&&(s.responseType=`blob`),o.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),o.signal&&(o.signal.addEventListener(`abort`,c),s.onreadystatechange=function(){s.readyState===4&&o.signal.removeEventListener(`abort`,c)}),s.send(o._bodyInit===void 0?null:o._bodyInit)})}return w.polyfill=!0,e.fetch||(e.fetch=w,e.Headers=l,e.Request=y,e.Response=S),t.Headers=l,t.Request=y,t.Response=S,t.fetch=w,Object.defineProperty(t,`__esModule`,{value:!0}),t})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}
3)(Es,Es.exports);var Ds=Ho(Es.exports);async function Os(e,t,n=5){let r=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${n}`,[i,a]=await Promise.all([ks(e,t),Ds(r)]),o=(await a.json()).filter(e=>!e.aborted&&e.state===`Built`&&e.verified===`Verified`);if(o.length===0)return null;let s=o[0];return i.slot.toNumber()===s.verified_slot?s:null}async function ks(e,t){let n=await e.getAccountInfo(t);if(n===null)throw Error(`program account not found`);let{program:r}=js(n.data),i=await e.getAccountInfo(r.programdataAddress);if(i===null)throw Error(`program data account not found`);let{programData:a}=js(i.data);return a}var As=N.rustEnum([N.struct([],`uninitialized`),N.struct([N.option(N.publicKey(),`authorityAddress`)],`buffer`),N.struct([N.publicKey(`programdataAddress`)],`program`),N.struct([N.u64(`slot`),N.option(N.publicKey(),`upgradeAuthorityAddress`)],`programData`)],void 0,N.u32());function js(e){return As.decode(e)}var Ms=Object.freeze({__proto__:null,sha256:vs,rpc:$a,publicKey:xs,bytes:da,token:Ts,features:uo,registry:Object.freeze({__proto__:null,verifiedBuild:Os,fetchData:ks,decodeUpgradeableLoaderState:js})});function Ns(e){return`accounts`in e}async function Ps(e){let t=(await b.findProgramAddress([],e))[0];return await b.createWithSeed(t,Fs(),e)}function Fs(){return`anchor:idl`}var Is=N.struct([N.publicKey(`authority`),N.vecU8(`data`)]);function Ls(e){return Is.decode(e)}function Rs(e,t){let n={},r=e.args?e.args.length:0;if(t.length>r){if(t.length!==r+1)throw Error(`provided too many arguments ${t} to instruction ${e?.name} expecting: ${e.args?.map(e=>e.name)??[]}`);n=t.pop()}return[t,n]}var zs=class e{static build(t,n,r){if(t.name===`_inner`)throw new fo(`the _inner name is reserved`);let i=(...e)=>{let[a,o]=Rs(t,[...e]);ma(t.accounts,o.accounts),[...e];let s=i.accounts(o.accounts);return o.remainingAccounts!==void 0&&s.push(...o.remainingAccounts),lo(`debug-logs`)&&console.log(`Outgoing account metas:`,s),new S({keys:s,programId:r,data:n(t.name,pa(t,...a))})};return i.accounts=n=>e.accountsArray(n,t.accounts,r,t.name),i}static accountsArray(t,n,r,i){return t?n.map(n=>{if((`accounts`in n?n.accounts:void 0)!==void 0){let a=t[n.name];return e.accountsArray(a,n.accounts,r,i).flat()}else{let e=n,a;try{a=q(t[n.name])}catch{throw Error(`Wrong input type for account "${n.name}" in the instruction accounts object${i===void 0?``:` for instruction "`+i+`"`}. Expected PublicKey or string.`)}let o=e.isOptional&&a.equals(r),s=e.isMut&&!o,c=e.isSigner&&!o;return{pubkey:a,isWritable:s,isSigner:c}}}).flat():[]}},Bs=class{static build(e,t){return(...n)=>{var r,i,a;let[,o]=Rs(e,[...n]),s=new p;if(o.preInstructions&&o.instructions)throw Error(`instructions is deprecated, use preInstructions`);return(r=o.preInstructions)==null||r.forEach(e=>s.add(e)),(i=o.instructions)==null||i.forEach(e=>s.add(e)),s.add(t(...n)),(a=o.postInstructions)==null||a.forEach(e=>s.add(e)),s}}},Vs=class{static build(e,t,n,r){return async(...i)=>{let a=t(...i),[,o]=Rs(e,[...i]);if(r.sendAndConfirm===void 0)throw Error(`This function requires 'Provider.sendAndConfirm' to be implemented.`);try{return await r.sendAndConfirm(a,o.signers??[],o.options)}catch(e){throw go(e,n)}}}},Hs=class{static build(e,t,n,r){var i;let a={};return(i=e.accounts)==null||i.forEach(i=>{let o=(0,M.default)(i.name);a[o]=new Us(e,i,n,r,t)}),a}},Us=class{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(e,t,n,r,i){this._idlAccount=t,this._programId=n,this._provider=r??io(),this._coder=i??new Bo(e),this._size=this._coder.accounts.size(t)}async fetchNullable(e,t){let{data:n}=await this.fetchNullableAndContext(e,t);return n}async fetchNullableAndContext(e,t){let{value:n,context:r}=await this.getAccountInfoAndContext(e,t);return{data:n&&n.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,n.data):null,context:r}}async fetch(e,t){let{data:n}=await this.fetchNullableAndContext(e,t);if(n===null)throw Error(`Account does not exist or has no data ${e.toString()}`);return n}async fetchAndContext(e,t){let{data:n,context:r}=await this.fetchNullableAndContext(e,t);if(n===null)throw Error(`Account does not exist ${e.toString()}`);return{data:n,context:r}}async fetchMultiple(e,t){return(await this.fetchMultipleAndContext(e,t)).map(e=>e?e.data:null)}async fetchMultipleAndContext(e,t){return(await Ga(this._provider.connection,e.map(e=>q(e)),t)).map(e=>{if(e==null)return null;let{account:t,context:n}=e;return{data:this._coder.accounts.decode(this._idlAccount.name,t.data),context:n}})}async all(e){let t=this.coder.accounts.memcmp(this._idlAccount.name,e instanceof d?e:void 0),n=[];return t?.offset!=null&&t?.bytes!=null&&n.push({memcmp:{offset:t.offset,bytes:t.bytes}}),t?.dataSize!=null&&n.push({dataSize:t.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(e)?e:[]]})).map(({pubkey:e,account:t})=>({publicKey:e,account:this._coder.accounts.decode(this._idlAccount.name,t.data)}))}subscribe(e,t){let n=Ws.get(e.toString());if(n)return n.ee;let r=new Zi.default;e=q(e);let i=this._provider.connection.onAccountChange(e,e=>{let t=this._coder.accounts.decode(this._idlAccount.name,e.data);r.emit(`change`,t)},t);return Ws.set(e.toString(),{ee:r,listener:i}),r}async unsubscribe(e){let t=Ws.get(e.toString());if(!t){console.warn(`Address is not subscribed`);return}Ws&&await this._provider.connection.removeAccountChangeListener(t.listener).then(()=>{Ws.delete(e.toString())}).catch(console.error)}async createInstruction(e,t){let n=this.size;if(this._provider.publicKey===void 0)throw Error(`This function requires the Provider interface implementor to have a 'publicKey' field.`);return h.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:e.publicKey,space:t??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(t??n),programId:this._programId})}async associated(...e){let t=await this.associatedAddress(...e);return await this.fetch(t)}async associatedAddress(...e){return await bs(this._programId,...e)}async getAccountInfo(e,t){return await this._provider.connection.getAccountInfo(q(e),t)}async getAccountInfoAndContext(e,t){return await this._provider.connection.getAccountInfoAndContext(q(e),t)}},Ws=new Map,Gs=`Program log: `,Ks=`Program data: `,qs=13,Js=14,Ys=class{constructor(e,t,n){this._programId=e,this._provider=t,this._eventParser=new Xs(e,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}
3addEventListener(e,t){let n=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.set(e,(this._eventListeners.get(e)??[]).concat(n)),this._eventCallbacks.set(n,[e,t]),this._onLogsSubscriptionId===void 0&&(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(e,t)=>{if(!e.err)for(let n of this._eventParser.parseLogs(e.logs)){let r=this._eventListeners.get(n.name);r&&r.forEach(r=>{let i=this._eventCallbacks.get(r);if(i){let[,r]=i;r(n.data,t.slot,e.signature)}})}})),n}async removeEventListener(e){let t=this._eventCallbacks.get(e);if(!t)throw Error(`Event listener ${e} doesn't exist!`);let[n]=t,r=this._eventListeners.get(n);if(!r)throw Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(e),r=r.filter(t=>t!==e),this._eventListeners.set(n,r),r.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}},Xs=class{constructor(e,t){this.coder=t,this.programId=e}*parseLogs(e,t=!1){let n=new Qs(e),r=new Zs,i=n.next();for(;i!==null;){let[e,a,o]=this.handleLog(r,i,t);e&&(yield e),a&&r.push(a),o&&r.pop(),i=n.next()}}handleLog(e,t,n){return e.stack.length>0&&e.program()===this.programId.toString()?this.handleProgramLog(t,n):[null,...this.handleSystemLog(t)]}handleProgramLog(e,t){if(e.startsWith(Gs)||e.startsWith(Ks)){let n=e.startsWith(Gs)?e.slice(qs):e.slice(Js),r=this.coder.events.decode(n);if(t&&r===null)throw Error(`Unable to decode event ${n}`);return[r,null,!1]}else return[null,...this.handleSystemLog(e)]}handleSystemLog(e){let t=e.split(`:`)[0];return t.match(/^Program (.*) success/g)===null?t.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:t.includes(`invoke`)?[`cpi`,!1]:[null,!1]:[null,!0]}},Zs=class{constructor(){this.stack=[]}program(){if(!this.stack.length)throw Error(`Expected the stack to have elements`);return this.stack[this.stack.length-1]}push(e){this.stack.push(e)}pop(){if(!this.stack.length)throw Error(`Expected the stack to have elements`);this.stack.pop()}},Qs=class{constructor(e){this.logs=e}next(){if(this.logs.length===0)return null;let e=this.logs[0];return this.logs=this.logs.slice(1),e}},$s=class{static build(e,t,n,r,i,a,o){return async(...s)=>{let c=t(...s),[,l]=Rs(e,[...s]),u;if(r.simulate===void 0)throw Error(`This function requires 'Provider.simulate' to be implemented.`);try{u=await r.simulate(c,l.signers,l.options?.commitment)}catch(e){throw go(e,n)}if(u===void 0)throw Error(`Unable to simulate transaction`);let d=u.logs;if(!d)throw Error(`Simulated logs not found`);let f=[];if(o.events){let e=new Xs(a,i);for(let t of e.parseLogs(d))f.push(t)}return{events:f,raw:d}}}};function ec(e){return new rc(fs(8),e=>ac.fromBuffer(e),e=>e.toBuffer(),e)}function tc(e){return new rc(fs(32),e=>new b(e),e=>e.toBuffer(),e)}function nc(e,t){return new ic(e,t)}var rc=class extends Uo{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}},ic=class extends Uo{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=cs()}encode(e,t,n=0){return e==null?this.layout.span+this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+4)+4)}decode(e,t=0){let n=this.discriminator.decode(e,t);if(n===0)return null;if(n===1)return this.layout.decode(e,t+4);throw Error(`Invalid coption `+this.layout.property)}getSpan(e,t=0){return this.layout.getSpan(e,t+4)+4}},ac=class e extends re.default{toBuffer(){let e=super.toArray().reverse(),t=d.from(e);if(t.length===8)return t;if(t.length>=8)throw Error(`u64 too large`);let n=d.alloc(8);return t.copy(n),n}static fromBuffer(t){if(t.length!==8)throw Error(`Invalid buffer length: ${t.length}`);return new e([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(``),16)}},oc=X([tc(`mint`),tc(`owner`),ec(`amount`),nc(tc(),`delegate`),(e=>{let t=ds(ss(`discriminator`),null,e);return t.addVariant(0,X([]),`uninitialized`),t.addVariant(1,X([]),`initialized`),t.addVariant(2,X([]),`frozen`),t})(`state`),nc(ec(),`isNative`),ec(`delegatedAmount`),nc(tc(),`closeAuthority`)]);function sc(e){return oc.decode(e)}var cc=class e{constructor(e,t,n,r,i,a,o,s){this._accounts=t,this._provider=n,this._programId=r,this._idlIx=i,this._idlTypes=o,this._customResolver=s,this._args=e,this._accountStore=new lc(n,a,this._programId)}args(e){this._args=e}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}
3async resolveCustom(){if(this._customResolver){let{accounts:e,resolved:t}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=e,t}return 0}resolveOptionalsHelper(e,t){let n={};for(let r of t){let t=r.name,i=e[t];i!==void 0&&(dc(i)?Ns(r)?n[t]=this.resolveOptionalsHelper(i,r.accounts):n[t]=fc(i,!0):i===null?r.isOptional&&(n[t]=this._programId):n[t]=q(i))}return n}resolveOptionals(e){Object.assign(this._accounts,this.resolveOptionalsHelper(e,this._idlIx.accounts))}get(e){let t=e.reduce((e,t)=>e&&e[t],this._accounts);if(t&&t.toBase58)return t}set(e,t){let n=this._accounts;e.forEach((r,i)=>{i==e.length-1&&(n[r]=t),n[r]=n[r]||{},n=n[r]})}async resolveConst(t,n=[]){for(let r=0;r<t.length;r+=1){let i=t[r],a=i.accounts;a&&await this.resolveConst(a,[...n,(0,M.default)(i.name)]);let o=i,s=(0,M.default)(i.name);if(o.isSigner&&!this.get([...n,s])){if(this._provider.wallet===void 0)throw Error(`This function requires the Provider interface implementor to have a 'wallet' field.`);this.set([...n,s],this._provider.wallet.publicKey)}Reflect.has(e.CONST_ACCOUNTS,s)&&!this.get([...n,s])&&this.set([...n,s],e.CONST_ACCOUNTS[s])}}_resolveEventCpi(e,t=[]){for(let n in e){let r=e[n],i=r.accounts;i&&this._resolveEventCpi(i,[...t,(0,M.default)(r.name)]);let a=+n+1;if(a===e.length)return;let o=(0,M.default)(e[n].name),s=(0,M.default)(e[a].name);if(o===`eventAuthority`&&s===`program`){let e=[...t,o],n=[...t,s];this.get(e)||this.set(e,b.findProgramAddressSync([d.from(`__event_authority`)],this._programId)[0]),this.get(n)||this.set(n,this._programId);return}}}async resolvePdas(e,t=[]){let n=0;for(let r=0;r<e.length;r+=1){let i=e[r],a=i.accounts;a&&(n+=await this.resolvePdas(a,[...t,(0,M.default)(i.name)]));let o=i,s=(0,M.default)(i.name);o.pda&&o.pda.seeds.length>0&&!this.get([...t,s])&&await this.autoPopulatePda(o,t)&&(n+=1)}return n}async resolveRelations(e,t=[]){let n=0;for(let r=0;r<e.length;r+=1){let i=e[r],a=i.accounts;a&&(n+=await this.resolveRelations(a,[...t,(0,M.default)(i.name)]));let o=i.relations||[],s=(0,M.default)(i.name),c=[...t,s],l=this.get(c);if(l){let e=o.filter(e=>!this.get([...t,(0,M.default)(e)]));if(n+=e.length,e.length>0){let n=await this._accountStore.fetchAccount({publicKey:l});await Promise.all(e.map(async e=>{let r=(0,M.default)(e);return this.set([...t,r],n[r]),n[r]}))}}}return n}async autoPopulatePda(e,t=[]){if(!e.pda||!e.pda.seeds)throw Error(`Must have seeds`);let n=await Promise.all(e.pda.seeds.map(e=>this.toBuffer(e,t)));if(n.some(e=>e===void 0))return;let r=await this.parseProgramId(e,t);if(!r)return;let[i]=await b.findProgramAddress(n,r);this.set([...t,(0,M.default)(e.name)],i)}async parseProgramId(e,t=[]){if(!e.pda?.programId)return this._programId;switch(e.pda.programId.kind){case`const`:return new b(this.toBufferConst(e.pda.programId.value));case`arg`:return this.argValue(e.pda.programId);case`account`:return await this.accountValue(e.pda.programId,t);default:throw Error(`Unexpected program seed kind: ${e.pda.programId.kind}`)}}async toBuffer(e,t=[]){switch(e.kind){case`const`:return this.toBufferConst(e);case`arg`:return await this.toBufferArg(e);case`account`:return await this.toBufferAccount(e,t);default:throw Error(`Unexpected seed kind: ${e.kind}`)}}getType(e,t=[]){if(t.length>0&&e.defined){let n=this._idlTypes.find(t=>t.name===e.defined);if(!n)throw Error(`Cannot find type ${e.defined}`);let r=n.type.fields.find(e=>e.name===t[0]);return this.getType(r.type,t.slice(1))}return e}toBufferConst(e){return this.toBufferValue(this.getType(e.type,(e.path||``).split(`.`).slice(1)),e.value)}async toBufferArg(e){let t=this.argValue(e);if(t!==void 0)return this.toBufferValue(this.getType(e.type,(e.path||``).split(`.`).slice(1)),t)}argValue(e){let t=e.path.split(`.`),n=(0,M.default)(t[0]),r=this._idlIx.args.findIndex(e=>e.name===n);if(r===-1)throw Error(`Unable to find argument for seed: ${n}`);return t.slice(1).reduce((e,t)=>(e||{})[t],this._args[r])}async toBufferAccount(e,t=[]){let n=await this.accountValue(e,t);if(n)return this.toBufferValue(e.type,n)}async accountValue(e,t=[]){let n=e.path.split(`.`),r=n[0],i=this.get([...t,(0,M.default)(r)]);if(i===null)throw Error(`fieldPubkey is null`);if(n.length===1)return i;let a=await this._accountStore.fetchAccount({publicKey:i,name:e.account});return this.parseAccountValue(a,n.slice(1))}parseAccountValue(e,t){let n;for(;t.length>0;)n=e[(0,M.default)(t[0])],t=t.slice(1);return n}toBufferValue(e,t){switch(e){case`u8`:return d.from([t]);case`u16`:let n=d.alloc(2);return n.writeUInt16LE(t),n;case`u32`:let r=d.alloc(4);return r.writeUInt32LE(t),r;case`u64`:let i=d.alloc(8);return i.writeBigUInt64LE(BigInt(t)),i;case`string`:return d.from(ia(t));case`publicKey`:return t.toBuffer();default:if(e.array)return d.from(t);throw Error(`Unexpected seed type: ${e}`)}}};cc.CONST_ACCOUNTS={associatedTokenProgram:Cs,rent:g,systemProgram:h.programId,tokenProgram:Ss,clock:m};var lc=class{constructor(e,t,n){this._provider=e,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=t}async ensureIdl(e){if(!this._idls[e.toBase58()]){let t=await gc.fetchIdl(e,this._provider);if(t){let n=new gc(t,e,this._provider);this._idls[e.toBase58()]=n.account}}return this._idls[e.toBase58()]}async fetchAccount({publicKey:e,name:t,programId:n=this._programId}){let r=e.toString();if(!this._cache.has(r))if(t===`TokenAccount`){let t=await this._provider.connection.getAccountInfo(e);if(t===null)throw Error(`invalid account info for ${r}`);let n=sc(t.data);this._cache.set(r,n)}else if(t){let i=await this.ensureIdl(n);if(i){let n=i[(0,M.default)(t)];if(n){let t=await n.fetch(e);this._cache.set(r,t)}}}else{let t=await this._provider.connection.getAccountInfo(e);if(t===null)throw Error(`invalid account info for ${r}`);let n=t.data,i=await this.ensureIdl(t.owner);if(i){let e=Object.values(i)[0];if(!e)throw Error(`No accounts for this program`);let t=e.coder.accounts.decodeAny(n);this._cache.set(r,t)}}return this._cache.get(r)}},uc=class{static build(e,t,n,r,i,a,o,s,c,l,u){return(...d)=>new pc(d,r,i,a,o,s,e,t,n,c,l,u)}};function dc(e){return typeof e==`object`&&!!e&&!(`_bn`in e)}function fc(e,t){let n={};for(let r in e){let i=e[r];if(i===null){if(t)throw Error(`Failed to resolve optionals due to IDL type mismatch with input accounts!`);continue}n[r]=dc(i)?fc(i,!0):q(i)}return n}var pc=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d){this._ixFn=t,this._txFn=n,this._rpcFn=r,this._simulateFn=i,this._viewFn=a,this._programId=s,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=e,this._accountsResolver=new cc(e,this._accounts,o,s,c,l,u,d)}args(e){this._args=e,this._accountsResolver.args(e)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(e){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(e),this}accountsStrict(e){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(e),this}signers(e){return this._signers=this._signers.concat(e),this}remainingAccounts(e){return this._remainingAccounts=this._remainingAccounts.concat(e),this}preInstructions(e){return this._preInstructions=this._preInstructions.concat(e),this}postInstructions(e){return this._postInstructions=this._postInstructions.concat(e),this}async rpc(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async rpcAndKeys(e){return{pubkeys:await this.pubkeys(),signature:await this.rpc(e)}}async view(e){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw Error(`Method does not support views`);return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async simulate(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}},mc=class{static build(e,t,n,r){let i=t.accounts.find(e=>e.isMut),a=!!t.returns;return i||!a?void 0:async(...i)=>{let a=await n(...i),o=`Program return: ${e} `,s=a.raw.find(e=>e.startsWith(o));if(!s)throw Error(`View expected return log`);let c=ua(s.slice(o.length)),l=t.returns;if(!l)throw Error(`View expected return type`);return Do.fieldLayout({type:l}
3,Array.from([...r.accounts??[],...r.types??[]])).decode(c)}}},hc=class{static build(e,t,n,r,i){let a={},o={},s={},c={},l={},u={},d=fa(e),f=e.accounts?Hs.build(e,t,n,r):{};return e.instructions.forEach(p=>{let m=zs.build(p,(e,n)=>t.instruction.encode(e,n),n),h=Bs.build(p,m),g=Vs.build(p,h,d,r),_=$s.build(p,h,d,r,t,n,e),v=mc.build(n,p,_,e),y=uc.build(r,n,p,m,h,g,_,v,f,e.types||[],i&&i(p)),b=(0,M.default)(p.name);o[b]=m,s[b]=h,a[b]=g,c[b]=_,l[b]=y,v&&(u[b]=v)}),[a,o,s,f,c,l,u]}},gc=class e{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(e,t,n,r,i){t=q(t),n||=io(),this._idl=e,this._provider=n,this._programId=t,this._coder=r??new Bo(e),this._events=new Ys(this._programId,n,this._coder);let[a,o,s,c,l,u,d]=hc.build(e,this._coder,t,n,i??(()=>void 0));this.rpc=a,this.instruction=o,this.transaction=s,this.account=c,this.simulate=l,this.methods=u,this.views=d}static async at(t,n){let r=q(t),i=await e.fetchIdl(r,n);if(!i)throw Error(`IDL not found for program: ${t.toString()}`);return new e(i,r,n)}static async fetchIdl(e,t){t??=io();let n=await Ps(q(e)),r=await t.connection.getAccountInfo(n);if(!r)return null;let i=Yi(Ls(r.data.slice(8)).data);return JSON.parse(ra(i))}addEventListener(e,t){return this._events.addEventListener(e,t)}async removeEventListener(e){return await this._events.removeEventListener(e)}};new b(`11111111111111111111111111111111`);var _c=e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)}),vc=n((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0});var t;function n(e){{let t=d.from(e);t.reverse();let n=t.toString(`hex`);return n.length===0?BigInt(0):BigInt(`0x${n}`)}return t.toBigInt(e,!1)}e.toBigIntLE=n;function r(e){{let t=e.toString(`hex`);return t.length===0?BigInt(0):BigInt(`0x${t}`)}return t.toBigInt(e,!0)}e.toBigIntBE=r;function i(e,n){{let t=e.toString(16),r=d.from(t.padStart(n*2,`0`).slice(0,n*2),`hex`);return r.reverse(),r}return t.fromBigInt(e,d.allocUnsafe(n),!1)}e.toBufferLE=i;function a(e,n){{let t=e.toString(16);return d.from(t.padStart(n*2,`0`).slice(0,n*2),`hex`)}return t.fromBigInt(e,d.allocUnsafe(n),!0)}e.toBufferBE=a}));u();var yc=vc(),bc=(e=>t=>{let n=(0,j.blob)(e,t),{encode:r,decode:i}=_c(n),a=n;return a.decode=(e,t)=>{let n=i(e,t);return(0,yc.toBigIntLE)(d.from(n))},a.encode=(t,n,i)=>r((0,yc.toBufferLE)(t,e),n,i),a})(8),xc=e=>{let t=(0,j.u8)(e),{encode:n,decode:r}=_c(t),i=t;return i.decode=(e,t)=>!!r(e,t),i.encode=(e,t,r)=>n(Number(e),t,r),i};C();var $=e=>{let t=(0,j.blob)(32,e),{encode:n,decode:r}=_c(t),i=t;return i.decode=(e,t)=>new b(r(e,t)),i.encode=(e,t,r)=>n(e.toBuffer(),t,r),i},Sc;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Mint=1]=`Mint`,e[e.Account=2]=`Account`})(Sc||={});var Cc=(0,j.struct)([(0,j.u8)(`m`),(0,j.u8)(`n`),xc(`isInitialized`),$(`signer1`),$(`signer2`),$(`signer3`),$(`signer4`),$(`signer5`),$(`signer6`),$(`signer7`),$(`signer8`),$(`signer9`),$(`signer10`),$(`signer11`)]),wc=Cc.span;u();var Tc;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initialized=1]=`Initialized`,e[e.Frozen=2]=`Frozen`})(Tc||={});var Ec=(0,j.struct)([$(`mint`),$(`owner`),bc(`amount`),(0,j.u32)(`delegateOption`),$(`delegate`),(0,j.u8)(`state`),(0,j.u32)(`isNativeOption`),bc(`isNative`),bc(`delegatedAmount`),(0,j.u32)(`closeAuthorityOption`),$(`closeAuthority`)]),Dc=Ec.span;async function Oc(e,t,n,r=k){return kc(t,await e.getAccountInfo(t,n),r)}function kc(e,t,n=k){if(!t)throw new ne;if(!t.owner.equals(n))throw new ee;if(t.data.length<Dc)throw new O;let r=Ec.decode(t.data.slice(0,Dc)),i=d.alloc(0);if(t.data.length>Dc){if(t.data.length===wc)throw new O;if(t.data[Dc]!=Sc.Account)throw new A;i=t.data.slice(Dc+1)}return{address:e,mint:r.mint,owner:r.owner,amount:r.amount,delegate:r.delegateOption?r.delegate:null,delegatedAmount:r.delegatedAmount,isInitialized:r.state!==Tc.Uninitialized,isFrozen:r.state===Tc.Frozen,isNative:!!r.isNativeOption,rentExemptReserve:r.isNativeOption?r.isNative:null,closeAuthority:r.closeAuthorityOption?r.closeAuthority:null,tlvData:i}}u(),C();function Ac(e,t,n,r,i=k,a=te){return jc(e,t,n,r,d.alloc(0),i,a)}
3function jc(e,t,n,r,i,a=k,o=te){return new S({keys:[{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:h.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}],programId:o,data:i})}C();var Mc=(e,t,n)=>{let[r]=b.findProgramAddressSync([D.from(Ms.bytes.utf8.encode(n||`escrow`)),e.toBuffer()],t);return r},Nc=e=>{let[t]=b.findProgramAddressSync([D.from(Ms.bytes.utf8.encode(ae))],e);return t},Pc=e=>{let t=e.trim(),n=new Uint8Array(t.length/2);for(let e=0,r=0;e<t.length;e+=2,r++)n[r]=parseInt(t.substr(e,2),16);return n},Fc=async(e,t,n,r)=>{let i=(await e.getParsedTokenAccountsByOwner(t,{mint:n})).value.map(e=>({amount:e.account.data.parsed.info.tokenAmount.amount,publicKey:e.pubkey})).filter(e=>e.amount&&e.amount!==`0`).sort((e,t)=>a(e.amount,t.amount)?-1:1),l=[],u=r;for(let e of i){let t=u;if(u=o(u,e.amount),c(u,`0`)){l.push({publicKey:e.publicKey,amountInWei:t});break}else l.push({publicKey:e.publicKey,amountInWei:e.amount})}return s(u,`0`)?[]:l},Ic=async(e,t,n,r,i)=>{try{return await Oc(e,i,`confirmed`),null}catch(e){if(console.error(e),typeof e==`object`&&e.name===`TokenAccountNotFoundError`)return Ac(t,i,r,n,k,te);throw e}},Lc=e=>new x(`https://docs-demo.solana-mainnet.quiknode.pro/`,{commitment:`confirmed`});export{oe as S,xc as _,Fc as a,gc as b,Dc as c,Oc as d,kc as f,$ as g,Sc as h,Lc as i,Ec as l,Cc as m,Mc as n,Pc as o,wc as p,Nc as r,Ac as s,Ic as t,Tc as u,bc as v,re as x,eo as y};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.