polkadot-api 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -798,4 +798,4 @@ type TxCallData = {
798
798
  */
799
799
  declare function createClient(provider: JsonRpcProvider): PolkadotClient;
800
800
 
801
- export { type ApisTypedef, type ChainDefinition, CompatibilityToken, type ConstFromPalletsDef, type DescriptorEntry, type ErrorsFromPalletsDef, type EventPhase, type EventsFromPalletsDef, type FixedSizeArray, InvalidTxError, type PalletsTypedef, type PlainDescriptor, type PolkadotClient, type QueryFromPalletsDef, type RuntimeDescriptor, type StorageDescriptor, type Transaction, type TransactionValidityError, type TxBestBlocksState, type TxBroadcastEvent, type TxBroadcasted, type TxCall, type TxCallData, type TxDescriptor, type TxEntry, type TxEvent, type TxEventsPayload, type TxFinalized, type TxFinalizedPayload, type TxFromPalletsDef, type TxInBestBlocksFound, type TxInBestBlocksNotFound, type TxObservable, type TxOptions, type TxPromise, type TxSignFn, type TxSigned, type TypedApi, type UnsafeTransaction, type UnsafeTxCall, type UnsafeTxEntry, createClient };
801
+ export { type ApisTypedef, type ChainDefinition, CompatibilityToken, type ConstFromPalletsDef, type DescriptorEntry, type ErrorsFromPalletsDef, type EventPhase, type EventsFromPalletsDef, type FixedSizeArray, InvalidTxError, type PalletsTypedef, type PlainDescriptor, type PolkadotClient, type QueryFromPalletsDef, type RuntimeDescriptor, RuntimeToken, type StorageDescriptor, type Transaction, type TransactionValidityError, type TxBestBlocksState, type TxBroadcastEvent, type TxBroadcasted, type TxCall, type TxCallData, type TxDescriptor, type TxEntry, type TxEvent, type TxEventsPayload, type TxFinalized, type TxFinalizedPayload, type TxFromPalletsDef, type TxInBestBlocksFound, type TxInBestBlocksNotFound, type TxObservable, type TxOptions, type TxPromise, type TxSignFn, type TxSigned, type TypedApi, type UnsafeTransaction, type UnsafeTxCall, type UnsafeTxEntry, createClient };
@@ -1,3 +1,3 @@
1
- (function(he,yt){typeof exports=="object"&&typeof module<"u"?yt(exports):typeof define=="function"&&define.amd?define(["exports"],yt):(he=typeof globalThis<"u"?globalThis:he||self,yt(he.papi={}))})(this,function(he){"use strict";var yt=Object.defineProperty,es=(e,t,n)=>t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pr=(e,t,n)=>(es(e,typeof t!="symbol"?t+"":t,n),n),dn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ts(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,o=new Uint8Array(r);t&&(o[0]=0|dn[e[2]]);for(let i=0;i<r;){const s=n+i*2,a=dn[e[s]],c=dn[e[s+1]];o[t+i++]=a<<4|c}return o}var vr=class extends Uint8Array{constructor(e){super(e),pr(this,"i",0),pr(this,"v"),this.v=new DataView(e)}},ye=e=>t=>e(t instanceof vr?t:new vr(t instanceof Uint8Array?t.buffer:typeof t=="string"?ts(t).buffer:t)),xe=e=>{const t=e.length;let n=0;for(let o=0;o<t;o++)n+=e[o].byteLength;const r=new Uint8Array(n);for(let o=0,i=0;o<t;o++){const s=e[o];r.set(s,i),i+=s.byteLength}return r};function Ut(e,t){const n=Object.keys(e),r=n.length,o={};for(let i=0;i<r;i++){const s=n[i];o[s]=t(e[s],s)}return o}var pn=ye,M=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},bt=(e,t)=>n=>e(t(n)),Rt=(e,t)=>n=>t(e(n)),st=([e,t],n,r)=>M(bt(e,n),Rt(t,r));function ns(e,t){return ye(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function rs(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function Ue(e,t,n){return M(rs(e,n),ns(e,t))}var q=Ue(1,"getUint8","setUint8"),Ze=Ue(2,"getUint16","setUint16"),be=Ue(4,"getUint32","setUint32"),mt=Ue(8,"getBigUint64","setBigUint64"),os=Ue(1,"getInt8","setInt8"),is=Ue(2,"getInt16","setInt16"),ss=Ue(4,"getInt32","setInt32"),as=Ue(8,"getBigInt64","setBigInt64"),yr=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},br=e=>ye(t=>{const{v:n,i:r}=t,o=n.getBigUint64(r,!0),i=n[e](r+8,!0);return t.i+=16,i<<64n|o}),cs=M(yr,br("getBigUint64")),us=M(yr,br("getBigInt64")),mr=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},gr=e=>ye(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n}),ls=M(mr,gr("getBigUint64")),fs=M(mr,gr("getBigInt64")),vn=st(q,e=>e?1:0,Boolean),hs=[q[1],Ze[1],be[1]],ds=ye(e=>{const t=e[e.i],n=t&3;if(n<3)return hs[n](e)>>>2;const r=(t>>>2)+4;e.i++;let o=0n;const i=r/8|0;let s=0n;for(let c=0;c<i;c++)o=mt[1](e)<<s|o,s+=64n;let a=r%8;return a>3&&(o=BigInt(be[1](e))<<s|o,s+=32n,a-=4),a>1&&(o=BigInt(Ze[1](e))<<s|o,s+=16n,a-=2),a&&(o=BigInt(q[1](e))<<s|o),o}),ps=1n<<56n,vs=1<<24,ys=256,bs=4294967295n,ms=64,gs=16384,ws=1<<30,ks=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<ms)return q[0](t);if(e<gs)return Ze[0](t|1);if(e<ws)return be[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=ps;)n.push(mt[0](r)),r>>=64n;r>=vs&&(n.push(be[0](Number(r&bs))),r>>=32n);let o=Number(r);o>=ys&&(n.push(Ze[0](o)),o>>=16),o&&n.push(q[0](o));const i=xe(n);return i[0]=i.length-5<<2|3,i},V=M(ks,ds),xs=new TextEncoder,Es=e=>{const t=xs.encode(e);return xe([V.enc(t.length),t])},Ss=new TextDecoder,As=ye(e=>{let t=V.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,Ss.decode(n)}),Z=M(Es,As),Is=()=>{},Bs=new Uint8Array(0),T=M(()=>Bs,Is),wr=e=>e===void 0?t=>xe([V.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),kr=e=>ye(t=>{const n=e===void 0?V.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),W=e=>M(wr(e),kr(e));W.enc=wr,W.dec=kr;var xr=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((i,s)=>[n[s],i])??n.map((i,s)=>[i,s])),o=i=>r.get(i);return({tag:i,value:s})=>xe([q.enc(o(i)),e[i](s)])},Er=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,i)=>[o,n[i]])??n.map((o,i)=>[i,o]));return ye(o=>{const i=q.dec(o),s=r.get(i),a=e[s];return{tag:s,value:a(o)}})},Ee=(e,...t)=>M(xr(Ut(e,([n])=>n),...t),Er(Ut(e,([,n])=>n),...t));Ee.enc=xr,Ee.dec=Er;var Sr=e=>ye(t=>{const n=q.dec(t);if(n!==0)return e===vn[1]?n===1:e(t)}),Ar=e=>t=>{const n=new Uint8Array(1);return t===void 0?(n[0]=0,n):(n[0]=1,e===vn[0]?(n[0]=t?1:2,n):xe([n,e(t)]))},Q=e=>M(Ar(e[0]),Sr(e[1]));Q.enc=Ar,Q.dec=Sr;var Ir=(e,t)=>ye(n=>{const r=q[1](n)===0,i=(r?e:t)(n);return{success:r,value:i}}),Br=(e,t)=>({success:n,value:r})=>xe([q[0](n?0:1),(n?e:t)(r)]),Mt=(e,t)=>M(Br(e[0],t[0]),Ir(e[1],t[1]));Mt.dec=Ir,Mt.enc=Br;var _r=(...e)=>ye(t=>e.map(n=>n(t))),Or=(...e)=>t=>xe(e.map((n,r)=>n(t[r]))),te=(...e)=>M(Or(...e.map(([t])=>t)),_r(...e.map(([,t])=>t)));te.enc=Or,te.dec=_r;var Cr=e=>{const t=Object.keys(e);return bt(te.enc(...Object.values(e)),n=>t.map(r=>n[r]))},$r=e=>{const t=Object.keys(e);return Rt(te.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,o)=>[t[o],r])))},C=e=>M(Cr(Ut(e,t=>t[0])),$r(Ut(e,t=>t[1])));C.enc=Cr,C.dec=$r;var Tr=(e,t)=>t>=0?n=>xe(n.map(e)):n=>xe([V.enc(n.length),xe(n.map(e))]),Pr=(e,t)=>ye(n=>{const r=t>=0?t:V.dec(n),o=new Array(r);for(let i=0;i<r;i++)o[i]=e(n);return o}),P=(e,t)=>M(Tr(e[0],t),Pr(e[1],t));P.enc=Tr,P.dec=Pr;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function _s(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Os(...e){const t=i=>i,n=(i,s)=>a=>i(s(a)),r=e.map(i=>i.encode).reduceRight(n,t),o=e.map(i=>i.decode).reduce(n,t);return{encode:r,decode:o}}function Cs(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(n=>{if(n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=e.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})}}}function $s(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function Lr(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],i=Array.from(e);for(i.forEach(s=>{if(s<0||s>=t)throw new Error(`Wrong integer: ${s}`)});;){let s=0,a=!0;for(let c=r;c<i.length;c++){const u=i[c],l=t*s+u;if(!Number.isSafeInteger(l)||t*s/t!==s||l-u!==t*s)throw new Error("convertRadix: carry overflow");s=l%n;const d=Math.floor(l/n);if(i[c]=d,!Number.isSafeInteger(d)||d*n+s!==l)throw new Error("convertRadix: carry overflow");if(a)d?a=!1:r=c;else continue}if(o.push(s),a)break}for(let s=0;s<e.length-1&&e[s]===0;s++)o.push(0);return o.reverse()}function Ts(e){return{encode:t=>{if(!_s(t))throw new Error("radix.encode input should be Uint8Array");return Lr(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(Lr(t,e,2**8))}}}const Ur=(e=>Os(Ts(58),Cs(e),$s("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function Je(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function Ps(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function zt(e,...t){if(!Ps(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function gt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function yn(e,t){zt(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ls=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Qe=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Dt=(e,t)=>e<<32-t|e>>>t,ne=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Rr=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,Be=ne?e=>e:e=>Rr(e);function re(e){for(let t=0;t<e.length;t++)e[t]=Rr(e[t])}function Us(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function _e(e){return typeof e=="string"&&(e=Us(e)),zt(e),e}class Mr{clone(){return this._cloneInto()}}function Rs(e){const t=r=>e().update(_e(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ms(e){const t=(r,o)=>e(o).update(_e(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function zs(e){const t=(r,o)=>e(o).update(_e(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Ds=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class zr extends Mr{constructor(t,n,r={},o,i,s){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,Je(t),Je(n),Je(o),n<0||n>o)throw new Error("outputLen bigger than keyLen");if(r.key!==void 0&&(r.key.length<1||r.key.length>o))throw new Error(`key must be up 1..${o} byte long or undefined`);if(r.salt!==void 0&&r.salt.length!==i)throw new Error(`salt must be ${i} byte long or undefined`);if(r.personalization!==void 0&&r.personalization.length!==s)throw new Error(`personalization must be ${s} byte long or undefined`);this.buffer32=Qe(this.buffer=new Uint8Array(t))}update(t){gt(this);const{blockLen:n,buffer:r,buffer32:o}=this;t=_e(t);const i=t.length,s=t.byteOffset,a=t.buffer;for(let c=0;c<i;){this.pos===n&&(ne||re(o),this.compress(o,0,!1),ne||re(o),this.pos=0);const u=Math.min(n-this.pos,i-c),l=s+c;if(u===n&&!(l%4)&&c+u<i){const d=new Uint32Array(a,l,Math.floor((i-c)/4));ne||re(d);for(let f=0;c+n<i;f+=o.length,c+=n)this.length+=n,this.compress(d,f,!1);ne||re(d);continue}r.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){gt(this),yn(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,this.buffer.subarray(n).fill(0),ne||re(r),this.compress(r,0,!0),ne||re(r);const o=Qe(t);this.get().forEach((i,s)=>o[s]=Be(i))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:o,destroyed:i,outputLen:s,pos:a}=this;return t||(t=new this.constructor({dkLen:s})),t.set(...this.get()),t.length=r,t.finished=o,t.destroyed=i,t.outputLen=s,t.buffer.set(n),t.pos=a,t}}const Ht=BigInt(2**32-1),bn=BigInt(32);function Ft(e,t=!1){return t?{h:Number(e&Ht),l:Number(e>>bn&Ht)}:{h:Number(e>>bn&Ht)|0,l:Number(e&Ht)|0}}function Dr(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:s}=Ft(e[o],t);[n[o],r[o]]=[i,s]}return[n,r]}const Hs=(e,t)=>BigInt(e>>>0)<<bn|BigInt(t>>>0),Fs=(e,t,n)=>e>>>n,Vs=(e,t,n)=>e<<32-n|t>>>n,js=(e,t,n)=>e>>>n|t<<32-n,qs=(e,t,n)=>e<<32-n|t>>>n,Ws=(e,t,n)=>e<<64-n|t>>>n-32,Xs=(e,t,n)=>e>>>n-32|t<<64-n,Gs=(e,t)=>t,Ks=(e,t)=>e,Hr=(e,t,n)=>e<<n|t>>>32-n,Fr=(e,t,n)=>t<<n|e>>>32-n,Vr=(e,t,n)=>t<<n-32|e>>>64-n,jr=(e,t,n)=>e<<n-32|t>>>64-n;function Ys(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:o|0}}const oe={fromBig:Ft,split:Dr,toBig:Hs,shrSH:Fs,shrSL:Vs,rotrSH:js,rotrSL:qs,rotrBH:Ws,rotrBL:Xs,rotr32H:Gs,rotr32L:Ks,rotlSH:Hr,rotlSL:Fr,rotlBH:Vr,rotlBL:jr,add:Ys,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5H:(e,t,n,r,o,i)=>t+n+r+o+i+(e/2**32|0)|0,add5L:(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0)},X=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),g=new Uint32Array(32);function Re(e,t,n,r,o,i){const s=o[i],a=o[i+1];let c=g[2*e],u=g[2*e+1],l=g[2*t],d=g[2*t+1],f=g[2*n],h=g[2*n+1],p=g[2*r],v=g[2*r+1],y=oe.add3L(c,l,s);u=oe.add3H(y,u,d,a),c=y|0,{Dh:v,Dl:p}={Dh:v^u,Dl:p^c},{Dh:v,Dl:p}={Dh:oe.rotr32H(v,p),Dl:oe.rotr32L(v,p)},{h,l:f}=oe.add(h,f,v,p),{Bh:d,Bl:l}={Bh:d^h,Bl:l^f},{Bh:d,Bl:l}={Bh:oe.rotrSH(d,l,24),Bl:oe.rotrSL(d,l,24)},g[2*e]=c,g[2*e+1]=u,g[2*t]=l,g[2*t+1]=d,g[2*n]=f,g[2*n+1]=h,g[2*r]=p,g[2*r+1]=v}function Me(e,t,n,r,o,i){const s=o[i],a=o[i+1];let c=g[2*e],u=g[2*e+1],l=g[2*t],d=g[2*t+1],f=g[2*n],h=g[2*n+1],p=g[2*r],v=g[2*r+1],y=oe.add3L(c,l,s);u=oe.add3H(y,u,d,a),c=y|0,{Dh:v,Dl:p}={Dh:v^u,Dl:p^c},{Dh:v,Dl:p}={Dh:oe.rotrSH(v,p,16),Dl:oe.rotrSL(v,p,16)},{h,l:f}=oe.add(h,f,v,p),{Bh:d,Bl:l}={Bh:d^h,Bl:l^f},{Bh:d,Bl:l}={Bh:oe.rotrBH(d,l,63),Bl:oe.rotrBL(d,l,63)},g[2*e]=c,g[2*e+1]=u,g[2*t]=l,g[2*t+1]=d,g[2*n]=f,g[2*n+1]=h,g[2*r]=p,g[2*r+1]=v}class Zs extends zr{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=X[0]|0,this.v0h=X[1]|0,this.v1l=X[2]|0,this.v1h=X[3]|0,this.v2l=X[4]|0,this.v2h=X[5]|0,this.v3l=X[6]|0,this.v3h=X[7]|0,this.v4l=X[8]|0,this.v4h=X[9]|0,this.v5l=X[10]|0,this.v5h=X[11]|0,this.v6l=X[12]|0,this.v6h=X[13]|0,this.v7l=X[14]|0,this.v7h=X[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|1<<24,t.salt){const r=Qe(_e(t.salt));this.v4l^=Be(r[0]),this.v4h^=Be(r[1]),this.v5l^=Be(r[2]),this.v5h^=Be(r[3])}if(t.personalization){const r=Qe(_e(t.personalization));this.v6l^=Be(r[0]),this.v6h^=Be(r[1]),this.v7l^=Be(r[2]),this.v7h^=Be(r[3])}if(t.key){const r=new Uint8Array(this.blockLen);r.set(_e(t.key)),this.update(r)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:o,v2l:i,v2h:s,v3l:a,v3h:c,v4l:u,v4h:l,v5l:d,v5h:f,v6l:h,v6h:p,v7l:v,v7h:y}=this;return[t,n,r,o,i,s,a,c,u,l,d,f,h,p,v,y]}set(t,n,r,o,i,s,a,c,u,l,d,f,h,p,v,y){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=o|0,this.v2l=i|0,this.v2h=s|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=d|0,this.v5h=f|0,this.v6l=h|0,this.v6h=p|0,this.v7l=v|0,this.v7h=y|0}compress(t,n,r){this.get().forEach((c,u)=>g[u]=c),g.set(X,16);let{h:o,l:i}=oe.fromBig(BigInt(this.length));g[24]=X[8]^i,g[25]=X[9]^o,r&&(g[28]=~g[28],g[29]=~g[29]);let s=0;const a=Ds;for(let c=0;c<12;c++)Re(0,4,8,12,t,n+2*a[s++]),Me(0,4,8,12,t,n+2*a[s++]),Re(1,5,9,13,t,n+2*a[s++]),Me(1,5,9,13,t,n+2*a[s++]),Re(2,6,10,14,t,n+2*a[s++]),Me(2,6,10,14,t,n+2*a[s++]),Re(3,7,11,15,t,n+2*a[s++]),Me(3,7,11,15,t,n+2*a[s++]),Re(0,5,10,15,t,n+2*a[s++]),Me(0,5,10,15,t,n+2*a[s++]),Re(1,6,11,12,t,n+2*a[s++]),Me(1,6,11,12,t,n+2*a[s++]),Re(2,7,8,13,t,n+2*a[s++]),Me(2,7,8,13,t,n+2*a[s++]),Re(3,4,9,14,t,n+2*a[s++]),Me(3,4,9,14,t,n+2*a[s++]);this.v0l^=g[0]^g[16],this.v0h^=g[1]^g[17],this.v1l^=g[2]^g[18],this.v1h^=g[3]^g[19],this.v2l^=g[4]^g[20],this.v2h^=g[5]^g[21],this.v3l^=g[6]^g[22],this.v3h^=g[7]^g[23],this.v4l^=g[8]^g[24],this.v4h^=g[9]^g[25],this.v5l^=g[10]^g[26],this.v5h^=g[11]^g[27],this.v6l^=g[12]^g[28],this.v6h^=g[13]^g[29],this.v7l^=g[14]^g[30],this.v7h^=g[15]^g[31],g.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Vt=Ms(e=>new Zs(e)),qr=new TextEncoder().encode("SS58PRE"),mn=2,gn=e=>{try{const t=Ur.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-mn),o=t.subarray(n.length+r.length),i=Vt(Uint8Array.of(...qr,...n,...r),{dkLen:64}).subarray(0,mn);return o[0]===i[0]&&o[1]===i[1]?{isValid:!0,ss58Format:Js(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},Js=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},Wr=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=Vt(Uint8Array.of(...qr,...t,...n),{dkLen:64}).subarray(0,mn);return Ur.encode(Uint8Array.of(...t,...n,...r))}};function Qs(e,t){return n=>{const r=gn(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:o}=r;if(o.length!==e)throw new Error("Invalid public key length");return o}}const at=(e=42,t=32)=>st(W(t),Qs(t),Wr(e)),Xr="0123456789abcdef";function ie(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Xr[r>>4]+Xr[r&15]}return t.join("")}const wn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ge(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,o=new Uint8Array(r);t&&(o[0]=0|wn[e[2]]);for(let i=0;i<r;){const s=n+i*2,a=wn[e[s]],c=wn[e[s+1]];o[t+i++]=a<<4|c}return o}function kn(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}const de=(...e)=>{const t=e.reduce((r,o)=>r+o.byteLength,0),n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const i=e[r];n.set(i,o),o+=i.byteLength}return n},wt=Function.prototype;class Gr extends Error{constructor(){super("Abort Error"),this.name="AbortError"}}var Ns=Object.defineProperty,Kr=e=>{throw TypeError(e)},ea=(e,t,n)=>t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>ea(e,typeof t!="symbol"?t+"":t,n),Yr=(e,t,n)=>t.has(e)||Kr("Cannot "+n),Oe=(e,t,n)=>(Yr(e,t,"read from private field"),n?n.call(e):t.get(e)),xt=(e,t,n)=>t.has(e)?Kr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ne=(e,t,n,r)=>(Yr(e,t,"write to private field"),t.set(e,n),n),Ce,Et,jt,qt,Wt;const ta=new TextEncoder,na=new TextDecoder,ra=te(V,W(1/0))[1];class ze{constructor(t,n=!1){if(xt(this,Ce),xt(this,Et,null),xt(this,jt,null),xt(this,qt,null),xt(this,Wt,null),kt(this,"asText",()=>Oe(this,Wt)??Ne(this,Wt,na.decode(Oe(this,Ce)))),kt(this,"asHex",()=>Oe(this,jt)||Ne(this,jt,ie(Oe(this,Ce)))),kt(this,"asOpaqueHex",()=>Oe(this,qt)||Ne(this,qt,ie(this.asBytes()))),kt(this,"asBytes",()=>Oe(this,Ce)),kt(this,"asOpaqueBytes",()=>Oe(this,Et)||Ne(this,Et,de(V[0](Oe(this,Ce).length),Oe(this,Ce)))),n){try{const[r,o]=ra(t);if(r===o.length){Ne(this,Ce,o),Ne(this,Et,t);return}}catch{}throw new Error("Invalid opaque bytes")}else Ne(this,Ce,t)}static fromText(t){return new this(ta.encode(t))}static fromHex(t){return new this(ge(t))}static fromOpaqueHex(t){return new this(ge(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}Ce=new WeakMap,Et=new WeakMap,jt=new WeakMap,qt=new WeakMap,Wt=new WeakMap;class xn extends ze{constructor(t){super(t)}static fromArray(t){return new this(new Uint8Array(t))}}const Zr=e=>{const t=W.enc(e);return n=>t(n.asBytes())},Jr=e=>{const t=W.dec(e),n=e==null?ze:xn;return r=>n.fromBytes(t(r))},St=e=>M(Zr(e),Jr(e));St.enc=Zr,St.dec=Jr;const _=V,Qr=V,oa=pn(e=>{const t=_.dec(e),n=Math.ceil(t/8);return{bytes:W(n).dec(e),bitsLen:t}}),Nr=M(e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=_.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},oa),ia=st(q,e=>e.charCodeAt(0),String.fromCharCode),eo=e=>{const t=W.enc(e);return n=>t(ge(n))},to=e=>{const t=W.dec(e);return n=>ie(t(n))},De=e=>M(eo(e),to(e));De.enc=eo,De.dec=to;const sa=new TextEncoder,aa=new TextDecoder,ca=e=>st(W(e),t=>sa.encode(t),t=>aa.decode(t)),no=e=>{let t=n=>{const r=e();return t=r,r(n)};return n=>t(n)},ro=e=>{let t=n=>{const r=e(),o=r;return t=r,o(n)};return n=>t(n)},En=e=>M(no(()=>e().enc),ro(()=>e().dec)),At=Object.assign((e,t)=>({type:e,value:t}),{is(e,t){return e.type===t},as(e,t){if(t!==e.type)throw new Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),oo=new Proxy({},{get(e,t){return n=>At(t,n)}}),io=(...e)=>{const t=Ee.enc(...e);return n=>t({tag:n.type,value:n.value})},so=(...e)=>{const t=Ee.dec(...e);return n=>{const{tag:r,value:o}=t(n);return At(r,o)}},$e=(e,...t)=>M(io(kn(e,([n])=>n),...t),so(kn(e,([,n])=>n),...t));$e.enc=io,$e.dec=so;const ao=[],co=[],uo=[],ua=BigInt(0),It=BigInt(1),la=BigInt(2),fa=BigInt(7),ha=BigInt(256),da=BigInt(113);for(let e=0,t=It,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ao.push(2*(5*r+n)),co.push((e+1)*(e+2)/2%64);let o=ua;for(let i=0;i<7;i++)t=(t<<It^(t>>fa)*da)%ha,t&la&&(o^=It<<(It<<BigInt(i))-It);uo.push(o)}const[pa,va]=Dr(uo,!0),lo=(e,t,n)=>n>32?Vr(e,t,n):Hr(e,t,n),fo=(e,t,n)=>n>32?jr(e,t,n):Fr(e,t,n);function ya(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){const a=(s+8)%10,c=(s+2)%10,u=n[c],l=n[c+1],d=lo(u,l,1)^n[a],f=fo(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[s+h]^=d,e[s+h+1]^=f}let o=e[2],i=e[3];for(let s=0;s<24;s++){const a=co[s],c=lo(o,i,a),u=fo(o,i,a),l=ao[s];o=e[l],i=e[l+1],e[l]=c,e[l+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=pa[r],e[1]^=va[r]}n.fill(0)}class Sn extends Mr{constructor(t,n,r,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Je(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Qe(this.state)}keccak(){ne||re(this.state32),ya(this.state32,this.rounds),ne||re(this.state32),this.posOut=0,this.pos=0}update(t){gt(this);const{blockLen:n,state:r}=this;t=_e(t);const o=t.length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){gt(this,!1),zt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Je(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(yn(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new Sn(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}}const ba=((e,t,n)=>Rs(()=>new Sn(t,e,n)))(1,136,256/8),ho=e=>{const t=e.slice(2),n=ie(ba(t)).slice(2),r=new Array(40);for(let o=0;o<40;o++){const i=parseInt(n[o],16),s=t[o];r[o]=i>7?s.toUpperCase():s}return`0x${r.join("")}`},ma=W(20)[1],po=M(e=>{const t=ge(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);const n=ie(t);if(e===n||e===n.toUpperCase())return t;if(ho(n)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},pn(e=>ho(ie(ma(e))))),vo=new TextEncoder,yo=new TextDecoder,ga=st(W(4),vo.encode.bind(vo),yo.decode.bind(yo)),An=C({engine:ga,payload:De()}),wa=$e({consensus:An,seal:An,preRuntime:An,runtimeUpdated:T},[4,5,6,8]),In=De(32),bo=C({parentHash:In,number:_,stateRoot:In,extrinsicRoot:In,digests:P(wa)}),Te=P(Z),mo=Q(Z),ka=Ee({bool:T,char:T,str:T,u8:T,u16:T,u32:T,u64:T,u128:T,u256:T,i8:T,i16:T,i32:T,i64:T,i128:T,i256:T}),go=P(C({name:mo,type:_,typeName:mo,docs:Te})),xa=C({len:be,type:_}),Ea=C({bitStoreType:_,bitOrderType:_}),Sa=P(C({name:Z,fields:go,index:q,docs:Te})),Aa=Ee({composite:go,variant:Sa,sequence:_,array:xa,tuple:P(_),primitive:ka,compact:_,bitSequence:Ea}),Ia=C({name:Z,type:Q(_)}),Ba=P(Ia),_a=C({id:_,path:Te,params:Ba,def:Aa,docs:Te}),Bn=P(_a),Oa=Ee({Blake2128:T,Blake2256:T,Blake2128Concat:T,Twox128:T,Twox256:T,Twox64Concat:T,Identity:T}),Ca=P(Oa),$a=C({hashers:Ca,key:_,value:_}),Ta=C({name:Z,modifier:q,type:Ee({plain:_,map:$a}),fallback:De(),docs:Te}),Pa=Q(C({prefix:Z,items:P(Ta)})),wo={name:Z,storage:Pa,calls:Q(_),events:Q(_),constants:P(C({name:Z,type:_,value:De(),docs:Te})),errors:Q(_),index:q},La={...wo,docs:Te},Ua=new Uint8Array,ko=e=>M(()=>Ua,()=>e),Ra=C({type:_,version:q,signedExtensions:P(C({identifier:Z,type:_,additionalSigned:_}))}),xo=C({lookup:Bn,pallets:P(C({...wo,docs:ko([])})),extrinsic:Ra,type:_,apis:ko([])}),Ma=C({name:Z,methods:P(C({name:Z,inputs:P(C({name:Z,type:_})),output:_,docs:Te})),docs:Te}),za=C({version:q,address:_,call:_,signature:_,extra:_,signedExtensions:P(C({identifier:Z,type:_,additionalSigned:_}))}),Eo=C({lookup:Bn,pallets:P(C(La)),extrinsic:za,type:_,apis:P(Ma),outerEnums:C({call:_,event:_,error:_}),custom:P(te(Z,C({type:_,value:De()})))}),So=()=>{throw new Error("Unsupported metadata version!")},ce=M(So,So),et=C({magicNumber:be,metadata:Ee({v0:ce,v1:ce,v2:ce,v3:ce,v4:ce,v5:ce,v6:ce,v7:ce,v8:ce,v9:ce,v10:ce,v11:ce,v12:ce,v13:ce,v14:xo,v15:Eo})}),_n=W(),Da=Q(_n),Ha=te(V,_n),Ao=e=>{try{return et.dec(e)}catch{}try{return et.dec(Da.dec(e))}catch{}try{return et.dec(_n.dec(e))}catch{}try{return et.dec(Ha.dec(e)[1])}catch{}throw null},Fa={dkLen:32},On=e=>Vt(e,Fa),Va={dkLen:16},Io=e=>Vt(e,Va),Bo=e=>de(Io(e),e),Pe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function He(e,t,n,r,o){return e=e+t+o|0,r=Dt(r^e,16),n=n+r|0,t=Dt(t^n,12),{a:e,b:t,c:n,d:r}}function Fe(e,t,n,r,o){return e=e+t+o|0,r=Dt(r^e,8),n=n+r|0,t=Dt(t^n,7),{a:e,b:t,c:n,d:r}}function _o(e,t,n,r,o,i,s,a,c,u,l,d,f,h,p,v,y,b,w,x){let m=0;for(let E=0;E<r;E++)({a:o,b:c,c:f,d:y}=He(o,c,f,y,n[t+e[m++]])),{a:o,b:c,c:f,d:y}=Fe(o,c,f,y,n[t+e[m++]]),{a:i,b:u,c:h,d:b}=He(i,u,h,b,n[t+e[m++]]),{a:i,b:u,c:h,d:b}=Fe(i,u,h,b,n[t+e[m++]]),{a:s,b:l,c:p,d:w}=He(s,l,p,w,n[t+e[m++]]),{a:s,b:l,c:p,d:w}=Fe(s,l,p,w,n[t+e[m++]]),{a,b:d,c:v,d:x}=He(a,d,v,x,n[t+e[m++]]),{a,b:d,c:v,d:x}=Fe(a,d,v,x,n[t+e[m++]]),{a:o,b:u,c:p,d:x}=He(o,u,p,x,n[t+e[m++]]),{a:o,b:u,c:p,d:x}=Fe(o,u,p,x,n[t+e[m++]]),{a:i,b:l,c:v,d:y}=He(i,l,v,y,n[t+e[m++]]),{a:i,b:l,c:v,d:y}=Fe(i,l,v,y,n[t+e[m++]]),{a:s,b:d,c:f,d:b}=He(s,d,f,b,n[t+e[m++]]),{a:s,b:d,c:f,d:b}=Fe(s,d,f,b,n[t+e[m++]]),{a,b:c,c:h,d:w}=He(a,c,h,w,n[t+e[m++]]),{a,b:c,c:h,d:w}=Fe(a,c,h,w,n[t+e[m++]]);return{v0:o,v1:i,v2:s,v3:a,v4:c,v5:u,v6:l,v7:d,v8:f,v9:h,v10:p,v11:v,v12:y,v13:b,v14:w,v15:x}}const Oo=(()=>{const e=Array.from({length:16},(r,o)=>o),t=r=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(o=>r[o]),n=[];for(let r=0,o=e;r<7;r++,o=t(o))n.push(...o);return Uint8Array.from(n)})();class Cn extends zr{constructor(t={},n=0){if(super(64,t.dkLen===void 0?32:t.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=t.dkLen===void 0?32:t.dkLen,Je(this.outputLen),t.key!==void 0&&t.context!==void 0)throw new Error("Blake3: only key or context can be specified at same time");if(t.key!==void 0){const r=_e(t.key).slice();if(r.length!==32)throw new Error("Blake3: key should be 32 byte");this.IV=Qe(r),ne||re(this.IV),this.flags=n|16}else if(t.context!==void 0){const r=new Cn({dkLen:32},32).update(t.context).digest();this.IV=Qe(r),ne||re(this.IV),this.flags=n|64}else this.IV=Pe.slice(),this.flags=n;this.state=this.IV.slice(),this.bufferOut=Ls(this.bufferOut32)}get(){return[]}set(){}b2Compress(t,n,r,o=0){const{state:i,pos:s}=this,{h:a,l:c}=Ft(BigInt(t),!0),{v0:u,v1:l,v2:d,v3:f,v4:h,v5:p,v6:v,v7:y,v8:b,v9:w,v10:x,v11:m,v12:E,v13:S,v14:A,v15:O}=_o(Oo,o,r,7,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],Pe[0],Pe[1],Pe[2],Pe[3],a,c,s,n);i[0]=u^b,i[1]=l^w,i[2]=d^x,i[3]=f^m,i[4]=h^E,i[5]=p^S,i[6]=v^A,i[7]=y^O}compress(t,n=0,r=!1){let o=this.flags;if(this.chunkPos||(o|=1),(this.chunkPos===15||r)&&(o|=2),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,o,t,n),this.chunkPos+=1,this.chunkPos===16||r){let i=this.state;this.state=this.IV.slice();for(let s,a=this.chunksDone+1;(r||!(a&1))&&(s=this.stack.pop());a>>=1)this.buffer32.set(s,0),this.buffer32.set(i,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|4,this.buffer32,0),i=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(i)}this.pos=0}_cloneInto(t){t=super._cloneInto(t);const{IV:n,flags:r,state:o,chunkPos:i,posOut:s,chunkOut:a,stack:c,chunksDone:u}=this;return t.state.set(o.slice()),t.stack=c.map(l=>Uint32Array.from(l)),t.IV.set(n),t.flags=r,t.chunkPos=i,t.chunksDone=u,t.posOut=s,t.chunkOut=a,t.enableXOF=this.enableXOF,t.bufferOut32.set(this.bufferOut32),t}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let t of this.stack)t.fill(0)}b2CompressOut(){const{state:t,pos:n,flags:r,buffer32:o,bufferOut32:i}=this,{h:s,l:a}=Ft(BigInt(this.chunkOut++));ne||re(o);const{v0:c,v1:u,v2:l,v3:d,v4:f,v5:h,v6:p,v7:v,v8:y,v9:b,v10:w,v11:x,v12:m,v13:E,v14:S,v15:A}=_o(Oo,0,o,7,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],Pe[0],Pe[1],Pe[2],Pe[3],a,s,n,r);i[0]=c^y,i[1]=u^b,i[2]=l^w,i[3]=d^x,i[4]=f^m,i[5]=h^E,i[6]=p^S,i[7]=v^A,i[8]=t[0]^y,i[9]=t[1]^b,i[10]=t[2]^w,i[11]=t[3]^x,i[12]=t[4]^m,i[13]=t[5]^E,i[14]=t[6]^S,i[15]=t[7]^A,ne||(re(o),re(i)),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let t=this.flags|8;this.stack.length?(t|=4,ne||re(this.buffer32),this.compress(this.buffer32,0,!0),ne||re(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):t|=(this.chunkPos?0:1)|2,this.flags=t,this.b2CompressOut()}writeInto(t){gt(this,!1),zt(t),this.finish();const{blockLen:n,bufferOut:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.b2CompressOut();const s=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(t)}xof(t){return Je(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(yn(t,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const ja=zs(e=>new Cn(e)),qa={dkLen:32},Co=e=>ja(e,qa),Wa=e=>de(Co(e),e),$o=e=>e,tt=(e,t,n,r)=>new DataView(new Uint16Array([e,t,n,r]).buffer).getBigUint64(0,!0),$n=2n**64n-1n,N=(e,t)=>e<<t&$n|e>>64n-t,U=(e,t)=>e*t&$n,K=(e,t)=>e+t&$n,Y=11400714785074694791n,pe=14029467366897019727n,To=1609587929392839161n,Bt=9650029242287828579n,Po=2870177450012600261n;function Ve(e,t=0n){let n=K(K(t,Y),pe),r=K(t,pe),o=t,i=t-Y,s=e.length,a=0,c=null;(function(){let h=0,p=h+s;if(s){if(c=new Uint8Array(32),s<32){c.set(e.subarray(0,s),a),a+=s;return}if(h<=p-32){const v=p-32;do{let y;y=tt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),n=U(N(K(n,U(y,pe)),31n),Y),h+=8,y=tt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),r=U(N(K(r,U(y,pe)),31n),Y),h+=8,y=tt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),o=U(N(K(o,U(y,pe)),31n),Y),h+=8,y=tt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),i=U(N(K(i,U(y,pe)),31n),Y),h+=8}while(h<=v)}h<p&&(c.set(e.subarray(h,p),a),a=p-h)}})(),e=c||e;let u,l=0;for(s>=32?(u=N(n,1n),u=K(u,N(r,7n)),u=K(u,N(o,12n)),u=K(u,N(i,18n)),n=U(N(U(n,pe),31n),Y),u=u^n,u=K(U(u,Y),Bt),r=U(N(U(r,pe),31n),Y),u=u^r,u=K(U(u,Y),Bt),o=U(N(U(o,pe),31n),Y),u=u^o,u=K(U(u,Y),Bt),i=U(N(U(i,pe),31n),Y),u=u^i,u=K(U(u,Y),Bt)):u=K(t,Po),u=K(u,BigInt(s));l<=a-8;){let f=tt(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]);f=U(N(U(f,pe),31n),Y),u=K(U(N(u^f,27n),Y),Bt),l+=8}if(l+4<=a){let f=U(tt(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],0,0),Y);u=K(U(N(u^f,23n),pe),To),l+=4}for(;l<a;){const f=U(tt(e[l++],0,0,0),Po);u=U(N(u^f,11n),Y)}let d=u>>33n;return u=U(u^d,pe),d=u>>29n,u=U(u^d,To),d=u>>32n,u^=d,u}const Tn=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,Ve(e),!0),n.setBigUint64(8,Ve(e,1n),!0),t},Xa=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,Ve(e),!0),n.setBigUint64(8,Ve(e,1n),!0),n.setBigUint64(16,Ve(e,2n),!0),n.setBigUint64(24,Ve(e,3n),!0),t},Pn=e=>de(mt.enc(Ve(e)),e),Lo=new TextEncoder,Ln=e=>{const t=Tn(Lo.encode(e));return(n,r,...o)=>{const i=de(t,Tn(Lo.encode(n))),s=ie(i),a=o.map(d=>d[1]).map(d=>{switch(d){case $o:return 0;case Pn:return 8;case Bo:return 16;default:return null}}).filter(d=>d!==null),c=d=>{if(!d.startsWith(s))throw new Error(`key does not match this storage (${e}.${n})`);if(a.length!==o.length)throw new Error("Impossible to decode this key");if(o.length===0)return[];const f=d.slice(s.length),h=new Array(o.length);for(let p=0,v=0;p<a.length;p++){const y=o[p][0];v+=a[p],h[p]=y.dec(f.slice(v*2)),v+=y.enc(h[p]).length}return h},u=o.map(([{enc:d},f])=>h=>f(d(h)));return{enc:(...d)=>ie(de(i,...d.map((f,h)=>u[h](f)))),dec:r,keyDecoder:c}}};var Uo=Object.freeze({__proto__:null,AccountId:at,Bin:St,Binary:ze,Blake2128:Io,Blake2128Concat:Bo,Blake2256:On,Blake3256:Co,Blake3256Concat:Wa,Bytes:W,Enum:At,FixedSizeBinary:xn,Hex:De,Identity:$o,Option:Q,Result:Mt,ScaleEnum:Ee,Self:En,Storage:Ln,Struct:C,Tuple:te,Twox128:Tn,Twox256:Xa,Twox64Concat:Pn,Variant:$e,Vector:P,_Enum:oo,_void:T,bitSequence:Nr,blockHeader:bo,bool:vn,char:ia,compact:V,compactBn:Qr,compactNumber:_,createCodec:M,createDecoder:pn,decAnyMetadata:Ao,enhanceCodec:st,enhanceDecoder:Rt,enhanceEncoder:bt,ethAccount:po,fixedStr:ca,fromBufferToBase58:Wr,getSs58AddressInfo:gn,h64:Ve,i128:us,i16:is,i256:fs,i32:ss,i64:as,i8:os,metadata:et,selfDecoder:ro,selfEncoder:no,str:Z,u128:cs,u16:Ze,u256:ls,u32:be,u64:mt,u8:q,v14:xo,v14Lookup:Bn,v15:Eo});const nt=V,Ga=P(te(Z,nt)),L={bool:"boolean",str:"string",num:"number",big:"bigint",numeric:"numeric",bits:"bitseq",void:"void"},Ka=$e(Object.fromEntries(Object.values(L).map(e=>[e,T]))),Ya=P(te(Z,Q(En(()=>Un)))),Za=P(nt),Ja=C({typeRef:nt,length:Q(nt)}),Qa=Q(V),Na=nt,ec=C({ok:nt,ko:nt}),Un=$e({struct:Ga,terminal:Ka,enum:Ya,tuple:Za,array:Ja,binary:Qa,option:Na,result:ec}),tc={i256:L.big,i128:L.big,i64:L.big,i32:L.num,i16:L.num,i8:L.num,u256:L.big,u128:L.big,u64:L.big,u32:L.num,u16:L.num,u8:L.num,bool:L.bool,char:L.str,str:L.str},_t=e=>({type:"terminal",value:{type:e}});function Ot(e,t=()=>{}){switch(e.type){case"AccountId20":case"AccountId32":return _t(L.str);case"array":return e.value.type==="primitive"&&e.value.value==="u8"?{type:"binary",value:e.len}:(t(e.value.id),{type:"array",value:{typeRef:e.value.id,length:e.len}});case"bitSequence":return _t(L.bits);case"compact":return _t(e.isBig===null?L.numeric:e.isBig?L.big:L.num);case"enum":return{type:"enum",value:Object.entries(e.value).map(([n,r])=>(r.type==="lookupEntry"&&t(r.value.id),[n,r.type==="lookupEntry"?Ot(r.value,t):Ot(r,t)]))};case"struct":{const n=Object.entries(e.value).map(([r,o])=>[r,o.id]);return n.forEach(([,r])=>t(r)),{type:"struct",value:n}}case"tuple":{const n=e.value.map(r=>r.id);return n.forEach(t),{type:"tuple",value:n}}case"option":return t(e.value.id),{type:"option",value:e.value.id};case"primitive":return _t(tc[e.value]);case"result":return t(e.value.ok.id),t(e.value.ko.id),{type:"result",value:{ok:e.value.ok.id,ko:e.value.ko.id}};case"sequence":return e.value.type==="primitive"&&e.value.value==="u8"?{type:"binary",value:void 0}:(t(e.value.id),{type:"array",value:{typeRef:e.value.id}});case"void":return _t(L.void)}}function Rn(e,t,n){if(t.type==="option"&&e==null)return!0;const r=(i,s)=>Rn(i,s,n),o=i=>{switch(i.value.type){case L.str:case L.big:case L.bool:case L.num:return typeof e===i.value.type;case L.bits:return typeof e=="object"&&e!=null&&typeof e.bitsLen=="number"&&e.bytes instanceof Uint8Array;case L.numeric:return typeof e=="number"||typeof e=="bigint";case L.void:return!0}};switch(t.type){case"terminal":return o(t);case"binary":return e instanceof ze&&(t.value==null||e.asBytes().length>=t.value);case"array":if(!Array.isArray(e))return!1;const i=e;return t.value.length!=null&&i.length<t.value.length?!1:i.slice(0,t.value.length).every(u=>r(u,n(t.value.typeRef)));case"enum":if(!e)return!1;const s=e,a=Object.fromEntries(t.value);if(!(s.type in a))return!1;const c=a[s.type];return c==null?!0:r(s.value,c);case"option":return e==null?!0:r(e,n(t.value));case"struct":return e?t.value.every(([u,l])=>r(e[u],n(l))):!1;case"tuple":return e?t.value.every((u,l)=>r(e[l],n(u))):!1;case"result":return"success"in e&&"value"in e?r(e.value,n(e.success?t.value.ok:t.value.ko)):!1}}var nc=Object.defineProperty,rc=(e,t,n)=>t in e?nc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oc=(e,t,n)=>rc(e,t+"",n);class Ro{constructor(t=[]){oc(this,"value",new Map),t.forEach(([n,r])=>this.add(n,r))}has(t,n){return this.value.get(t)?.has(n)??!1}add(t,n){this.value.has(t)||this.value.set(t,new Set),this.value.get(t).add(n)}addAll(t){t.forEach(([n,r])=>this.add(n,r))}delete(t,n){if(!this.value.has(t))return;const r=this.value.get(t);r.delete(n),r.size||this.value.delete(t)}isEmpty(){return!this.value.size}get values(){return Array.from(this.value).flatMap(([t,n])=>Array.from(n).map(r=>[t,r]))}}var Se=(e=>(e[e.Incompatible=0]="Incompatible",e[e.Partial=1]="Partial",e[e.BackwardsCompatible=2]="BackwardsCompatible",e[e.Identical=3]="Identical",e))(Se||{});function Mn(e,t,n,r,o){if(!n&&!e)return ue(3);if(!n)return ue(2);if(!e)return ue(n.type==="option"?2:0);o.has(n)||o.set(n,new Map);const i=o.get(n);if(i.has(e)){const a=i.get(e);return a===null?{level:3,assumptions:new Ro([[e,n]])}:ue(a)}i.set(e,null);const s=ic(e,n,(a,c)=>Mn(typeof a=="number"?t(a):a,t,typeof c=="number"?r(c):c,r,o));return s.assumptions.delete(e,n),s.assumptions.isEmpty()||s.level===0?i.set(e,s.level):i.delete(e),s}function ic(e,t,n){if(e.type!==t.type)return t.type==="option"?Xt(n(e,t.value),2):e.type==="option"?Xt(n(e.value,t),1):ue(0);switch(t.type){case"terminal":return ue(t.value.type===e.value.type?3:0);case"binary":return ue(zo(e.value,t.value));case"array":const o=e,i=ue(zo(o.value.length,t.value.length));return zn([i,()=>n(o.value.typeRef,t.value.typeRef)]);case"enum":{const l=e,d=Object.fromEntries(t.value),f=l.value.length===t.value.length?3:2;return Xt(Mo(l.value.map(([h,p])=>()=>h in d?n(p,d[h]):ue(0))),f)}case"option":return n(e.value,t.value);case"struct":const s=e,a=Object.fromEntries(s.value),c=s.value.length===t.value.length?3:2;return Xt(zn(t.value.map(([l,d])=>()=>n(a[l],d))),c);case"tuple":{const l=e,d=ue(ac(l.value,t.value));return zn([d,...t.value.map((f,h)=>()=>n(l.value[h],f))])}case"result":const u=e;return Mo([n(u.value.ok,t.value.ok),n(u.value.ko,t.value.ko)])}}const Xt=(e,t)=>({...e,level:Math.min(e.level,t)}),sc=new Ro,ue=e=>({level:e,assumptions:sc}),zn=e=>{let t=ue(3);for(const n of e){const r=typeof n=="function"?n():n;if(r.level===0)return r;t.assumptions.addAll(r.assumptions.values),t.level=Math.min(t.level,r.level)}return t},Mo=e=>{if(!e.length)return ue(3);let t=!1,n=ue(3);for(const r of e){const o=typeof r=="function"?r():r;if(o.level===0){n.level=Math.min(n.level,1);continue}t=!0,n.assumptions.addAll(o.assumptions.values),n.level=Math.min(n.level,o.level)}return t?n:ue(0)},ac=(e,t)=>t.length===e.length?3:e.length>=t.length?2:0,zo=(e,t)=>t===e?3:t==null||e>=t?2:e==null?1:0,Do=$e({lookup:V,typedef:Un}),ct=e=>({type:"lookup",value:e}),Dn=e=>({type:"typedef",value:e}),Gt=Dn({type:"terminal",value:{type:L.void}}),cc=C({args:Do,values:Do});function uc(e){if(e.type.tag==="plain")return{args:Gt,values:ct(e.type.value)};const{key:t,value:n}=e.type.value;return{args:ct(t),values:ct(n)}}function lc(e){return{args:Dn({type:"tuple",value:e.inputs.map(t=>t.type)}),values:ct(e.output)}}function fc(e){return e.type==="lookupEntry"?ct(e.value.id):Dn(Ot(e))}function hc(e){return{args:Gt,values:ct(e)}}function dc(e,t,n,r,o){const i=(s,a)=>s.type==="lookup"?a(s.value):s.value;return{args:Mn(i(e.args,t),t,i(n.args,r),r,o).level,values:Mn(i(n.values,r),r,i(e.values,t),t,o).level}}function Ho(e,t,n){const r=e.type==="lookup"?t(e.value):e.value;return Rn(n,r,t)}const ut=()=>{},me={body:"",call:"",continue:"",follow:"",header:"",stopOperation:"",storage:"",unfollow:"",unpin:"",followEvent:""},Kt={chainName:"",genesisHash:"",properties:""},Hn={broadcast:"",stop:""};Object.entries({chainHead:me,chainSpec:Kt,transaction:Hn}).forEach(([e,t])=>{Object.keys(t).forEach(n=>{t[n]=`${e}_v1_${n}`})});const pc=e=>(t,n)=>{let r=e(Hn.broadcast,[t],{onSuccess:o=>{r=o===null?ut:()=>{e(Hn.stop,[o])},o===null&&n(new Error("Max # of broadcasted transactions has been reached"))},onError:n});return()=>{r()}};class Fo extends Error{constructor(){super("ChainHead stopped"),this.name="StopError"}}class Yt extends Error{constructor(){super("ChainHead disjointed"),this.name="DisjointError"}}class Zt extends Error{constructor(){super("ChainHead operations limit reached"),this.name="OperationLimitError"}}class Vo extends Error{constructor(t){super(t),this.name="OperationError"}}class Fn extends Error{constructor(){super("ChainHead operation inaccessible"),this.name="OperationInaccessibleError"}}function vc(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),res:e,rej:t}}const jo=()=>{const e=new Map;return{has:e.has.bind(e),subscribe(t,n){e.set(t,n)},unsubscribe(t){e.delete(t)},next(t,n){e.get(t)?.next(n)},error(t,n){const r=e.get(t);r&&(e.delete(t),r.error(n))},errorAll(t){const n=[...e.values()];e.clear(),n.forEach(r=>{r.error(t)})}}},Jt=e=>(...t)=>new Promise((n,r)=>{let o=wt;const[i,s]=t[t.length-1]instanceof AbortSignal?[t.slice(0,t.length-1),t[t.length-1]]:[t],a=()=>{o(),r(new Gr)};s?.addEventListener("abort",a,{once:!0});const c=u=>l=>{o=wt,s?.removeEventListener("abort",a),u(l)};o=e(c(n),c(r),...i)}),qo=(e,t)=>n=>Jt((r,o,...i)=>{let s=!0,a=()=>{s=!1};const[c,u]=t(...i);return n(e,c,{onSuccess:(l,d)=>{if(l.result==="limitReached")return o(new Zt);const{operationId:f}=l,h=()=>{n(me.stopOperation,[f])};if(!s)return h();let p=ut;const v=b=>{s=!1,p(),r(b)},y=b=>{s=!1,p(),o(b)};p=d(f,{next:b=>{const w=b;w.event==="operationError"?o(new Vo(w.error)):w.event==="operationInaccessible"?o(new Fn):u(b,v,y)},error:y}),a=()=>{s&&(p(),h())}},onError:o}),()=>{a()}}),yc=qo(me.body,e=>[[e],(t,n)=>{n(t.value)}]),bc=qo(me.call,(e,t,n)=>[[e,t,n],(r,o)=>{o(r.output)}]),mc=e=>t=>new Promise((n,r)=>{e(me.header,[t],{onSuccess:n,onError:r})}),Wo=e=>(t,n,r,o,i,s,a)=>{if(n.length===0)return s(),wt;let c=!0,u=()=>{c=!1};return e(me.storage,[t,n,r],{onSuccess:(l,d)=>{if(l.result==="limitReached"||l.discardedItems===n.length)return i(new Zt);const{operationId:f}=l,h=()=>{e(me.stopOperation,[f])};if(!c)return h();const p=d(l.operationId,{next:b=>{switch(b.event){case"operationStorageItems":{o(b.items);break}case"operationStorageDone":{y();break}case"operationError":{v(new Vo(b.error));break}case"operationInaccessible":{v(new Fn);break}default:e(me.continue,[b.operationId])}},error:i});u=()=>{p(),e(me.stopOperation,[l.operationId])};const v=b=>{u=wt,p(),i(b)},y=()=>{u=wt,p(),s()};a(l.discardedItems)},onError:i}),()=>{u()}},gc=e=>{const t=Wo(e);return Jt((n,r,o,i,s,a)=>{const c=i.startsWith("descendants");let u=c?[]:null;const d=t(o,[{key:s,type:i}],a??null,c?f=>{u.push(f)}:f=>{u=f[0]?.[i]},r,()=>{try{n(c?u.flat():u)}catch(f){r(f)}},f=>{f>0&&(d(),r(new Zt))});return d})},wc=e=>t=>t.length>0?new Promise((n,r)=>{e(me.unpin,[t],{onSuccess(){n()},onError:r})}):Promise.resolve();class Qt extends Error{constructor(){super("Client destroyed"),this.name="DestroyedError"}}function kc(e){return e.operationId!==void 0}function xc(e){return(t,n,r)=>{const o=jo(),i=new Set,s=vc();let a=s.promise;const c=p=>{if(kc(p))return o.has(p.operationId)||console.warn("Uknown operationId on",p),o.next(p.operationId,p);if(p.event!=="stop"){if(p.event==="initialized")return n({type:p.event,finalizedBlockHashes:p.finalizedBlockHashes,finalizedBlockRuntime:p.finalizedBlockRuntime});const{event:v,...y}=p;return n({type:v,...y})}r(new Fo),f(!1)},u=p=>{r(p),f(!(p instanceof Qt))},l=(p,v)=>{const y=v(p,{next:c,error:u});f=(b=!0)=>{a=null,f=ut,y(),b&&e(me.unfollow,[p]),o.errorAll(new Yt),i.forEach(w=>{w()}),i.clear()},a=p,s.res(p)},d=p=>{p instanceof Qt?f(!1):r(p),a=null,s.res(p)};let f=e(me.follow,[t],{onSuccess:l,onError:d});const h=(p,v,y)=>{const b=()=>{y?.onError(new Yt)};if(a===null)return b(),ut;const w=m=>{if(!y)return e(p,[m,...v]);i.add(b);const E=(A,O)=>a===null?(O.error(new Yt),ut):(o.subscribe(A,O),()=>{o.unsubscribe(A)}),S=e(p,[m,...v],{onSuccess:A=>{i.delete(b),y.onSuccess(A,E)},onError:A=>{i.delete(b),y.onError(A)}});return()=>{i.delete(b),S()}};if(typeof a=="string")return w(a);let x=ut;return a.then(m=>{if(m instanceof Error)return b();a&&(x=w(m))}),()=>{x()}};return{unfollow(){f(),a=null},body:yc(h),call:bc(h),header:mc(h),storage:gc(h),storageSubscription:Wo(h),unpin:wc(h),_request:h}}}var Ec=Object.defineProperty,Sc=(e,t,n)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xo=(e,t,n)=>Sc(e,typeof t!="symbol"?t+"":t,n);class Go extends Error{constructor(t){super(t.message),Xo(this,"code"),Xo(this,"data"),this.code=t.code,this.data=t.data,this.name="RpcError"}}let Ac=1;const Ic=e=>{let t=Ac++;const n=new Map,r=jo();let o=null;const i=(l,d,f)=>{o.send(JSON.stringify({jsonrpc:"2.0",id:l,method:d,params:f}))};function s(l){try{let d,f,h,p,v;if({id:d,result:f,error:h,params:p}=JSON.parse(l),d){const w=n.get(d);return w?(n.delete(d),h?w.onError(new Go(h)):w.onSuccess(f,(x,m)=>{const E=x;return r.subscribe(E,m),()=>{r.unsubscribe(E)}})):void 0}if({subscription:v,result:f,error:h}=p,!v||!h&&!Object.hasOwn(p,"result"))throw 0;const b=v;h?r.error(b,new Go(h)):r.next(b,f)}catch(d){console.warn("Error parsing incomming message: "+l),console.error(d)}}o=e(s);const a=()=>{o?.disconnect(),o=null,r.errorAll(new Qt),n.forEach(l=>l.onError(new Qt)),n.clear()};let c=1;return{request:(l,d,f)=>{if(!o)throw new Error("Not connected");const h=`${t}-${c++}`;return f&&n.set(h,f),i(h,l,d),()=>{n.delete(h)}},disconnect:a}},Bc=e=>{const t=Jt((r,o,i,s)=>e(i,s,{onSuccess:r,onError:o}));let n=null;return async()=>n||(n=Promise.all([t(Kt.chainName,[]),t(Kt.genesisHash,[]),t(Kt.properties,[])]).then(([r,o,i])=>({name:r,genesisHash:o,properties:i})))},_c=e=>{const{request:t,disconnect:n}=Ic(e);return{chainHead:xc(t),transaction:pc(t),getChainSpecData:Bc(t),destroy:n,request:Jt((r,o,i,s)=>t(i,s,{onSuccess:r,onError:o})),_request:t}};var Vn=function(e,t){return Vn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Vn(e,t)};function Le(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Vn(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Oc(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(l){try{u(r.next(l))}catch(d){s(d)}}function c(l){try{u(r.throw(l))}catch(d){s(d)}}function u(l){l.done?i(l.value):o(l.value).then(a,c)}u((r=r.apply(e,t||[])).next())})}function Ko(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(n=0)),n;)try{if(r=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,o=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){n.label=u[1];break}if(u[0]===6&&n.label<i[1]){n.label=i[1],i=u;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(u);break}i[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],o=0}finally{r=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function lt(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function je(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return i}function qe(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function ft(e){return this instanceof ft?(this.v=e,this):new ft(e)}function Cc(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(p){return Promise.resolve(p).then(h,d)}}function a(h,p){r[h]&&(o[h]=function(v){return new Promise(function(y,b){i.push([h,v,y,b])>1||c(h,v)})},p&&(o[h]=p(o[h])))}function c(h,p){try{u(r[h](p))}catch(v){f(i[0][3],v)}}function u(h){h.value instanceof ft?Promise.resolve(h.value.v).then(l,d):f(i[0][2],h)}function l(h){c("next",h)}function d(h){c("throw",h)}function f(h,p){h(p),i.shift(),i.length&&c(i[0][0],i[0][1])}}function $c(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof lt=="function"?lt(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=e[i]&&function(s){return new Promise(function(a,c){s=e[i](s),o(a,c,s.done,s.value)})}}function o(i,s,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function H(e){return typeof e=="function"}function jn(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var qn=jn(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ (function(he,yt){typeof exports=="object"&&typeof module<"u"?yt(exports):typeof define=="function"&&define.amd?define(["exports"],yt):(he=typeof globalThis<"u"?globalThis:he||self,yt(he.papi={}))})(this,function(he){"use strict";var yt=Object.defineProperty,es=(e,t,n)=>t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pr=(e,t,n)=>(es(e,typeof t!="symbol"?t+"":t,n),n),dn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ts(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,o=new Uint8Array(r);t&&(o[0]=0|dn[e[2]]);for(let i=0;i<r;){const s=n+i*2,a=dn[e[s]],c=dn[e[s+1]];o[t+i++]=a<<4|c}return o}var vr=class extends Uint8Array{constructor(e){super(e),pr(this,"i",0),pr(this,"v"),this.v=new DataView(e)}},ye=e=>t=>e(t instanceof vr?t:new vr(t instanceof Uint8Array?t.buffer:typeof t=="string"?ts(t).buffer:t)),xe=e=>{const t=e.length;let n=0;for(let o=0;o<t;o++)n+=e[o].byteLength;const r=new Uint8Array(n);for(let o=0,i=0;o<t;o++){const s=e[o];r.set(s,i),i+=s.byteLength}return r};function Ut(e,t){const n=Object.keys(e),r=n.length,o={};for(let i=0;i<r;i++){const s=n[i];o[s]=t(e[s],s)}return o}var pn=ye,M=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},bt=(e,t)=>n=>e(t(n)),Rt=(e,t)=>n=>t(e(n)),st=([e,t],n,r)=>M(bt(e,n),Rt(t,r));function ns(e,t){return ye(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function rs(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function Ue(e,t,n){return M(rs(e,n),ns(e,t))}var q=Ue(1,"getUint8","setUint8"),Je=Ue(2,"getUint16","setUint16"),be=Ue(4,"getUint32","setUint32"),mt=Ue(8,"getBigUint64","setBigUint64"),os=Ue(1,"getInt8","setInt8"),is=Ue(2,"getInt16","setInt16"),ss=Ue(4,"getInt32","setInt32"),as=Ue(8,"getBigInt64","setBigInt64"),yr=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},br=e=>ye(t=>{const{v:n,i:r}=t,o=n.getBigUint64(r,!0),i=n[e](r+8,!0);return t.i+=16,i<<64n|o}),cs=M(yr,br("getBigUint64")),us=M(yr,br("getBigInt64")),mr=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},gr=e=>ye(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n}),ls=M(mr,gr("getBigUint64")),fs=M(mr,gr("getBigInt64")),vn=st(q,e=>e?1:0,Boolean),hs=[q[1],Je[1],be[1]],ds=ye(e=>{const t=e[e.i],n=t&3;if(n<3)return hs[n](e)>>>2;const r=(t>>>2)+4;e.i++;let o=0n;const i=r/8|0;let s=0n;for(let c=0;c<i;c++)o=mt[1](e)<<s|o,s+=64n;let a=r%8;return a>3&&(o=BigInt(be[1](e))<<s|o,s+=32n,a-=4),a>1&&(o=BigInt(Je[1](e))<<s|o,s+=16n,a-=2),a&&(o=BigInt(q[1](e))<<s|o),o}),ps=1n<<56n,vs=1<<24,ys=256,bs=4294967295n,ms=64,gs=16384,ws=1<<30,ks=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<ms)return q[0](t);if(e<gs)return Je[0](t|1);if(e<ws)return be[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=ps;)n.push(mt[0](r)),r>>=64n;r>=vs&&(n.push(be[0](Number(r&bs))),r>>=32n);let o=Number(r);o>=ys&&(n.push(Je[0](o)),o>>=16),o&&n.push(q[0](o));const i=xe(n);return i[0]=i.length-5<<2|3,i},V=M(ks,ds),xs=new TextEncoder,Es=e=>{const t=xs.encode(e);return xe([V.enc(t.length),t])},Ss=new TextDecoder,As=ye(e=>{let t=V.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,Ss.decode(n)}),Z=M(Es,As),Is=()=>{},Bs=new Uint8Array(0),T=M(()=>Bs,Is),wr=e=>e===void 0?t=>xe([V.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),kr=e=>ye(t=>{const n=e===void 0?V.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),W=e=>M(wr(e),kr(e));W.enc=wr,W.dec=kr;var xr=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((i,s)=>[n[s],i])??n.map((i,s)=>[i,s])),o=i=>r.get(i);return({tag:i,value:s})=>xe([q.enc(o(i)),e[i](s)])},Er=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,i)=>[o,n[i]])??n.map((o,i)=>[i,o]));return ye(o=>{const i=q.dec(o),s=r.get(i),a=e[s];return{tag:s,value:a(o)}})},Ee=(e,...t)=>M(xr(Ut(e,([n])=>n),...t),Er(Ut(e,([,n])=>n),...t));Ee.enc=xr,Ee.dec=Er;var Sr=e=>ye(t=>{const n=q.dec(t);if(n!==0)return e===vn[1]?n===1:e(t)}),Ar=e=>t=>{const n=new Uint8Array(1);return t===void 0?(n[0]=0,n):(n[0]=1,e===vn[0]?(n[0]=t?1:2,n):xe([n,e(t)]))},Q=e=>M(Ar(e[0]),Sr(e[1]));Q.enc=Ar,Q.dec=Sr;var Ir=(e,t)=>ye(n=>{const r=q[1](n)===0,i=(r?e:t)(n);return{success:r,value:i}}),Br=(e,t)=>({success:n,value:r})=>xe([q[0](n?0:1),(n?e:t)(r)]),Mt=(e,t)=>M(Br(e[0],t[0]),Ir(e[1],t[1]));Mt.dec=Ir,Mt.enc=Br;var _r=(...e)=>ye(t=>e.map(n=>n(t))),Or=(...e)=>t=>xe(e.map((n,r)=>n(t[r]))),te=(...e)=>M(Or(...e.map(([t])=>t)),_r(...e.map(([,t])=>t)));te.enc=Or,te.dec=_r;var Cr=e=>{const t=Object.keys(e);return bt(te.enc(...Object.values(e)),n=>t.map(r=>n[r]))},$r=e=>{const t=Object.keys(e);return Rt(te.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,o)=>[t[o],r])))},C=e=>M(Cr(Ut(e,t=>t[0])),$r(Ut(e,t=>t[1])));C.enc=Cr,C.dec=$r;var Tr=(e,t)=>t>=0?n=>xe(n.map(e)):n=>xe([V.enc(n.length),xe(n.map(e))]),Pr=(e,t)=>ye(n=>{const r=t>=0?t:V.dec(n),o=new Array(r);for(let i=0;i<r;i++)o[i]=e(n);return o}),P=(e,t)=>M(Tr(e[0],t),Pr(e[1],t));P.enc=Tr,P.dec=Pr;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function _s(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Os(...e){const t=i=>i,n=(i,s)=>a=>i(s(a)),r=e.map(i=>i.encode).reduceRight(n,t),o=e.map(i=>i.decode).reduce(n,t);return{encode:r,decode:o}}function Cs(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(n=>{if(n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=e.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})}}}function $s(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function Lr(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],i=Array.from(e);for(i.forEach(s=>{if(s<0||s>=t)throw new Error(`Wrong integer: ${s}`)});;){let s=0,a=!0;for(let c=r;c<i.length;c++){const u=i[c],l=t*s+u;if(!Number.isSafeInteger(l)||t*s/t!==s||l-u!==t*s)throw new Error("convertRadix: carry overflow");s=l%n;const d=Math.floor(l/n);if(i[c]=d,!Number.isSafeInteger(d)||d*n+s!==l)throw new Error("convertRadix: carry overflow");if(a)d?a=!1:r=c;else continue}if(o.push(s),a)break}for(let s=0;s<e.length-1&&e[s]===0;s++)o.push(0);return o.reverse()}function Ts(e){return{encode:t=>{if(!_s(t))throw new Error("radix.encode input should be Uint8Array");return Lr(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(Lr(t,e,2**8))}}}const Ur=(e=>Os(Ts(58),Cs(e),$s("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function Qe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function Ps(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function zt(e,...t){if(!Ps(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function gt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function yn(e,t){zt(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ls=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ne=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Dt=(e,t)=>e<<32-t|e>>>t,ne=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Rr=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,Be=ne?e=>e:e=>Rr(e);function re(e){for(let t=0;t<e.length;t++)e[t]=Rr(e[t])}function Us(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function _e(e){return typeof e=="string"&&(e=Us(e)),zt(e),e}class Mr{clone(){return this._cloneInto()}}function Rs(e){const t=r=>e().update(_e(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ms(e){const t=(r,o)=>e(o).update(_e(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function zs(e){const t=(r,o)=>e(o).update(_e(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Ds=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class zr extends Mr{constructor(t,n,r={},o,i,s){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,Qe(t),Qe(n),Qe(o),n<0||n>o)throw new Error("outputLen bigger than keyLen");if(r.key!==void 0&&(r.key.length<1||r.key.length>o))throw new Error(`key must be up 1..${o} byte long or undefined`);if(r.salt!==void 0&&r.salt.length!==i)throw new Error(`salt must be ${i} byte long or undefined`);if(r.personalization!==void 0&&r.personalization.length!==s)throw new Error(`personalization must be ${s} byte long or undefined`);this.buffer32=Ne(this.buffer=new Uint8Array(t))}update(t){gt(this);const{blockLen:n,buffer:r,buffer32:o}=this;t=_e(t);const i=t.length,s=t.byteOffset,a=t.buffer;for(let c=0;c<i;){this.pos===n&&(ne||re(o),this.compress(o,0,!1),ne||re(o),this.pos=0);const u=Math.min(n-this.pos,i-c),l=s+c;if(u===n&&!(l%4)&&c+u<i){const d=new Uint32Array(a,l,Math.floor((i-c)/4));ne||re(d);for(let f=0;c+n<i;f+=o.length,c+=n)this.length+=n,this.compress(d,f,!1);ne||re(d);continue}r.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){gt(this),yn(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,this.buffer.subarray(n).fill(0),ne||re(r),this.compress(r,0,!0),ne||re(r);const o=Ne(t);this.get().forEach((i,s)=>o[s]=Be(i))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:o,destroyed:i,outputLen:s,pos:a}=this;return t||(t=new this.constructor({dkLen:s})),t.set(...this.get()),t.length=r,t.finished=o,t.destroyed=i,t.outputLen=s,t.buffer.set(n),t.pos=a,t}}const Ht=BigInt(2**32-1),bn=BigInt(32);function Ft(e,t=!1){return t?{h:Number(e&Ht),l:Number(e>>bn&Ht)}:{h:Number(e>>bn&Ht)|0,l:Number(e&Ht)|0}}function Dr(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:s}=Ft(e[o],t);[n[o],r[o]]=[i,s]}return[n,r]}const Hs=(e,t)=>BigInt(e>>>0)<<bn|BigInt(t>>>0),Fs=(e,t,n)=>e>>>n,Vs=(e,t,n)=>e<<32-n|t>>>n,js=(e,t,n)=>e>>>n|t<<32-n,qs=(e,t,n)=>e<<32-n|t>>>n,Ws=(e,t,n)=>e<<64-n|t>>>n-32,Xs=(e,t,n)=>e>>>n-32|t<<64-n,Gs=(e,t)=>t,Ks=(e,t)=>e,Hr=(e,t,n)=>e<<n|t>>>32-n,Fr=(e,t,n)=>t<<n|e>>>32-n,Vr=(e,t,n)=>t<<n-32|e>>>64-n,jr=(e,t,n)=>e<<n-32|t>>>64-n;function Ys(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:o|0}}const oe={fromBig:Ft,split:Dr,toBig:Hs,shrSH:Fs,shrSL:Vs,rotrSH:js,rotrSL:qs,rotrBH:Ws,rotrBL:Xs,rotr32H:Gs,rotr32L:Ks,rotlSH:Hr,rotlSL:Fr,rotlBH:Vr,rotlBL:jr,add:Ys,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5H:(e,t,n,r,o,i)=>t+n+r+o+i+(e/2**32|0)|0,add5L:(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0)},X=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),g=new Uint32Array(32);function Re(e,t,n,r,o,i){const s=o[i],a=o[i+1];let c=g[2*e],u=g[2*e+1],l=g[2*t],d=g[2*t+1],f=g[2*n],h=g[2*n+1],p=g[2*r],v=g[2*r+1],y=oe.add3L(c,l,s);u=oe.add3H(y,u,d,a),c=y|0,{Dh:v,Dl:p}={Dh:v^u,Dl:p^c},{Dh:v,Dl:p}={Dh:oe.rotr32H(v,p),Dl:oe.rotr32L(v,p)},{h,l:f}=oe.add(h,f,v,p),{Bh:d,Bl:l}={Bh:d^h,Bl:l^f},{Bh:d,Bl:l}={Bh:oe.rotrSH(d,l,24),Bl:oe.rotrSL(d,l,24)},g[2*e]=c,g[2*e+1]=u,g[2*t]=l,g[2*t+1]=d,g[2*n]=f,g[2*n+1]=h,g[2*r]=p,g[2*r+1]=v}function Me(e,t,n,r,o,i){const s=o[i],a=o[i+1];let c=g[2*e],u=g[2*e+1],l=g[2*t],d=g[2*t+1],f=g[2*n],h=g[2*n+1],p=g[2*r],v=g[2*r+1],y=oe.add3L(c,l,s);u=oe.add3H(y,u,d,a),c=y|0,{Dh:v,Dl:p}={Dh:v^u,Dl:p^c},{Dh:v,Dl:p}={Dh:oe.rotrSH(v,p,16),Dl:oe.rotrSL(v,p,16)},{h,l:f}=oe.add(h,f,v,p),{Bh:d,Bl:l}={Bh:d^h,Bl:l^f},{Bh:d,Bl:l}={Bh:oe.rotrBH(d,l,63),Bl:oe.rotrBL(d,l,63)},g[2*e]=c,g[2*e+1]=u,g[2*t]=l,g[2*t+1]=d,g[2*n]=f,g[2*n+1]=h,g[2*r]=p,g[2*r+1]=v}class Zs extends zr{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=X[0]|0,this.v0h=X[1]|0,this.v1l=X[2]|0,this.v1h=X[3]|0,this.v2l=X[4]|0,this.v2h=X[5]|0,this.v3l=X[6]|0,this.v3h=X[7]|0,this.v4l=X[8]|0,this.v4h=X[9]|0,this.v5l=X[10]|0,this.v5h=X[11]|0,this.v6l=X[12]|0,this.v6h=X[13]|0,this.v7l=X[14]|0,this.v7h=X[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|1<<24,t.salt){const r=Ne(_e(t.salt));this.v4l^=Be(r[0]),this.v4h^=Be(r[1]),this.v5l^=Be(r[2]),this.v5h^=Be(r[3])}if(t.personalization){const r=Ne(_e(t.personalization));this.v6l^=Be(r[0]),this.v6h^=Be(r[1]),this.v7l^=Be(r[2]),this.v7h^=Be(r[3])}if(t.key){const r=new Uint8Array(this.blockLen);r.set(_e(t.key)),this.update(r)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:o,v2l:i,v2h:s,v3l:a,v3h:c,v4l:u,v4h:l,v5l:d,v5h:f,v6l:h,v6h:p,v7l:v,v7h:y}=this;return[t,n,r,o,i,s,a,c,u,l,d,f,h,p,v,y]}set(t,n,r,o,i,s,a,c,u,l,d,f,h,p,v,y){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=o|0,this.v2l=i|0,this.v2h=s|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=d|0,this.v5h=f|0,this.v6l=h|0,this.v6h=p|0,this.v7l=v|0,this.v7h=y|0}compress(t,n,r){this.get().forEach((c,u)=>g[u]=c),g.set(X,16);let{h:o,l:i}=oe.fromBig(BigInt(this.length));g[24]=X[8]^i,g[25]=X[9]^o,r&&(g[28]=~g[28],g[29]=~g[29]);let s=0;const a=Ds;for(let c=0;c<12;c++)Re(0,4,8,12,t,n+2*a[s++]),Me(0,4,8,12,t,n+2*a[s++]),Re(1,5,9,13,t,n+2*a[s++]),Me(1,5,9,13,t,n+2*a[s++]),Re(2,6,10,14,t,n+2*a[s++]),Me(2,6,10,14,t,n+2*a[s++]),Re(3,7,11,15,t,n+2*a[s++]),Me(3,7,11,15,t,n+2*a[s++]),Re(0,5,10,15,t,n+2*a[s++]),Me(0,5,10,15,t,n+2*a[s++]),Re(1,6,11,12,t,n+2*a[s++]),Me(1,6,11,12,t,n+2*a[s++]),Re(2,7,8,13,t,n+2*a[s++]),Me(2,7,8,13,t,n+2*a[s++]),Re(3,4,9,14,t,n+2*a[s++]),Me(3,4,9,14,t,n+2*a[s++]);this.v0l^=g[0]^g[16],this.v0h^=g[1]^g[17],this.v1l^=g[2]^g[18],this.v1h^=g[3]^g[19],this.v2l^=g[4]^g[20],this.v2h^=g[5]^g[21],this.v3l^=g[6]^g[22],this.v3h^=g[7]^g[23],this.v4l^=g[8]^g[24],this.v4h^=g[9]^g[25],this.v5l^=g[10]^g[26],this.v5h^=g[11]^g[27],this.v6l^=g[12]^g[28],this.v6h^=g[13]^g[29],this.v7l^=g[14]^g[30],this.v7h^=g[15]^g[31],g.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Vt=Ms(e=>new Zs(e)),qr=new TextEncoder().encode("SS58PRE"),mn=2,gn=e=>{try{const t=Ur.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-mn),o=t.subarray(n.length+r.length),i=Vt(Uint8Array.of(...qr,...n,...r),{dkLen:64}).subarray(0,mn);return o[0]===i[0]&&o[1]===i[1]?{isValid:!0,ss58Format:Js(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},Js=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},Wr=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=Vt(Uint8Array.of(...qr,...t,...n),{dkLen:64}).subarray(0,mn);return Ur.encode(Uint8Array.of(...t,...n,...r))}};function Qs(e,t){return n=>{const r=gn(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:o}=r;if(o.length!==e)throw new Error("Invalid public key length");return o}}const at=(e=42,t=32)=>st(W(t),Qs(t),Wr(e)),Xr="0123456789abcdef";function ie(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Xr[r>>4]+Xr[r&15]}return t.join("")}const wn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ge(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,o=new Uint8Array(r);t&&(o[0]=0|wn[e[2]]);for(let i=0;i<r;){const s=n+i*2,a=wn[e[s]],c=wn[e[s+1]];o[t+i++]=a<<4|c}return o}function kn(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}const de=(...e)=>{const t=e.reduce((r,o)=>r+o.byteLength,0),n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const i=e[r];n.set(i,o),o+=i.byteLength}return n},wt=Function.prototype;class Gr extends Error{constructor(){super("Abort Error"),this.name="AbortError"}}var Ns=Object.defineProperty,Kr=e=>{throw TypeError(e)},ea=(e,t,n)=>t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>ea(e,typeof t!="symbol"?t+"":t,n),Yr=(e,t,n)=>t.has(e)||Kr("Cannot "+n),Oe=(e,t,n)=>(Yr(e,t,"read from private field"),n?n.call(e):t.get(e)),xt=(e,t,n)=>t.has(e)?Kr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),et=(e,t,n,r)=>(Yr(e,t,"write to private field"),t.set(e,n),n),Ce,Et,jt,qt,Wt;const ta=new TextEncoder,na=new TextDecoder,ra=te(V,W(1/0))[1];class ze{constructor(t,n=!1){if(xt(this,Ce),xt(this,Et,null),xt(this,jt,null),xt(this,qt,null),xt(this,Wt,null),kt(this,"asText",()=>Oe(this,Wt)??et(this,Wt,na.decode(Oe(this,Ce)))),kt(this,"asHex",()=>Oe(this,jt)||et(this,jt,ie(Oe(this,Ce)))),kt(this,"asOpaqueHex",()=>Oe(this,qt)||et(this,qt,ie(this.asBytes()))),kt(this,"asBytes",()=>Oe(this,Ce)),kt(this,"asOpaqueBytes",()=>Oe(this,Et)||et(this,Et,de(V[0](Oe(this,Ce).length),Oe(this,Ce)))),n){try{const[r,o]=ra(t);if(r===o.length){et(this,Ce,o),et(this,Et,t);return}}catch{}throw new Error("Invalid opaque bytes")}else et(this,Ce,t)}static fromText(t){return new this(ta.encode(t))}static fromHex(t){return new this(ge(t))}static fromOpaqueHex(t){return new this(ge(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}Ce=new WeakMap,Et=new WeakMap,jt=new WeakMap,qt=new WeakMap,Wt=new WeakMap;class xn extends ze{constructor(t){super(t)}static fromArray(t){return new this(new Uint8Array(t))}}const Zr=e=>{const t=W.enc(e);return n=>t(n.asBytes())},Jr=e=>{const t=W.dec(e),n=e==null?ze:xn;return r=>n.fromBytes(t(r))},St=e=>M(Zr(e),Jr(e));St.enc=Zr,St.dec=Jr;const _=V,Qr=V,oa=pn(e=>{const t=_.dec(e),n=Math.ceil(t/8);return{bytes:W(n).dec(e),bitsLen:t}}),Nr=M(e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=_.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},oa),ia=st(q,e=>e.charCodeAt(0),String.fromCharCode),eo=e=>{const t=W.enc(e);return n=>t(ge(n))},to=e=>{const t=W.dec(e);return n=>ie(t(n))},De=e=>M(eo(e),to(e));De.enc=eo,De.dec=to;const sa=new TextEncoder,aa=new TextDecoder,ca=e=>st(W(e),t=>sa.encode(t),t=>aa.decode(t)),no=e=>{let t=n=>{const r=e();return t=r,r(n)};return n=>t(n)},ro=e=>{let t=n=>{const r=e(),o=r;return t=r,o(n)};return n=>t(n)},En=e=>M(no(()=>e().enc),ro(()=>e().dec)),At=Object.assign((e,t)=>({type:e,value:t}),{is(e,t){return e.type===t},as(e,t){if(t!==e.type)throw new Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),oo=new Proxy({},{get(e,t){return n=>At(t,n)}}),io=(...e)=>{const t=Ee.enc(...e);return n=>t({tag:n.type,value:n.value})},so=(...e)=>{const t=Ee.dec(...e);return n=>{const{tag:r,value:o}=t(n);return At(r,o)}},$e=(e,...t)=>M(io(kn(e,([n])=>n),...t),so(kn(e,([,n])=>n),...t));$e.enc=io,$e.dec=so;const ao=[],co=[],uo=[],ua=BigInt(0),It=BigInt(1),la=BigInt(2),fa=BigInt(7),ha=BigInt(256),da=BigInt(113);for(let e=0,t=It,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ao.push(2*(5*r+n)),co.push((e+1)*(e+2)/2%64);let o=ua;for(let i=0;i<7;i++)t=(t<<It^(t>>fa)*da)%ha,t&la&&(o^=It<<(It<<BigInt(i))-It);uo.push(o)}const[pa,va]=Dr(uo,!0),lo=(e,t,n)=>n>32?Vr(e,t,n):Hr(e,t,n),fo=(e,t,n)=>n>32?jr(e,t,n):Fr(e,t,n);function ya(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){const a=(s+8)%10,c=(s+2)%10,u=n[c],l=n[c+1],d=lo(u,l,1)^n[a],f=fo(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[s+h]^=d,e[s+h+1]^=f}let o=e[2],i=e[3];for(let s=0;s<24;s++){const a=co[s],c=lo(o,i,a),u=fo(o,i,a),l=ao[s];o=e[l],i=e[l+1],e[l]=c,e[l+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=pa[r],e[1]^=va[r]}n.fill(0)}class Sn extends Mr{constructor(t,n,r,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Qe(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Ne(this.state)}keccak(){ne||re(this.state32),ya(this.state32,this.rounds),ne||re(this.state32),this.posOut=0,this.pos=0}update(t){gt(this);const{blockLen:n,state:r}=this;t=_e(t);const o=t.length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){gt(this,!1),zt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Qe(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(yn(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new Sn(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}}const ba=((e,t,n)=>Rs(()=>new Sn(t,e,n)))(1,136,256/8),ho=e=>{const t=e.slice(2),n=ie(ba(t)).slice(2),r=new Array(40);for(let o=0;o<40;o++){const i=parseInt(n[o],16),s=t[o];r[o]=i>7?s.toUpperCase():s}return`0x${r.join("")}`},ma=W(20)[1],po=M(e=>{const t=ge(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);const n=ie(t);if(e===n||e===n.toUpperCase())return t;if(ho(n)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},pn(e=>ho(ie(ma(e))))),vo=new TextEncoder,yo=new TextDecoder,ga=st(W(4),vo.encode.bind(vo),yo.decode.bind(yo)),An=C({engine:ga,payload:De()}),wa=$e({consensus:An,seal:An,preRuntime:An,runtimeUpdated:T},[4,5,6,8]),In=De(32),bo=C({parentHash:In,number:_,stateRoot:In,extrinsicRoot:In,digests:P(wa)}),Te=P(Z),mo=Q(Z),ka=Ee({bool:T,char:T,str:T,u8:T,u16:T,u32:T,u64:T,u128:T,u256:T,i8:T,i16:T,i32:T,i64:T,i128:T,i256:T}),go=P(C({name:mo,type:_,typeName:mo,docs:Te})),xa=C({len:be,type:_}),Ea=C({bitStoreType:_,bitOrderType:_}),Sa=P(C({name:Z,fields:go,index:q,docs:Te})),Aa=Ee({composite:go,variant:Sa,sequence:_,array:xa,tuple:P(_),primitive:ka,compact:_,bitSequence:Ea}),Ia=C({name:Z,type:Q(_)}),Ba=P(Ia),_a=C({id:_,path:Te,params:Ba,def:Aa,docs:Te}),Bn=P(_a),Oa=Ee({Blake2128:T,Blake2256:T,Blake2128Concat:T,Twox128:T,Twox256:T,Twox64Concat:T,Identity:T}),Ca=P(Oa),$a=C({hashers:Ca,key:_,value:_}),Ta=C({name:Z,modifier:q,type:Ee({plain:_,map:$a}),fallback:De(),docs:Te}),Pa=Q(C({prefix:Z,items:P(Ta)})),wo={name:Z,storage:Pa,calls:Q(_),events:Q(_),constants:P(C({name:Z,type:_,value:De(),docs:Te})),errors:Q(_),index:q},La={...wo,docs:Te},Ua=new Uint8Array,ko=e=>M(()=>Ua,()=>e),Ra=C({type:_,version:q,signedExtensions:P(C({identifier:Z,type:_,additionalSigned:_}))}),xo=C({lookup:Bn,pallets:P(C({...wo,docs:ko([])})),extrinsic:Ra,type:_,apis:ko([])}),Ma=C({name:Z,methods:P(C({name:Z,inputs:P(C({name:Z,type:_})),output:_,docs:Te})),docs:Te}),za=C({version:q,address:_,call:_,signature:_,extra:_,signedExtensions:P(C({identifier:Z,type:_,additionalSigned:_}))}),Eo=C({lookup:Bn,pallets:P(C(La)),extrinsic:za,type:_,apis:P(Ma),outerEnums:C({call:_,event:_,error:_}),custom:P(te(Z,C({type:_,value:De()})))}),So=()=>{throw new Error("Unsupported metadata version!")},ce=M(So,So),tt=C({magicNumber:be,metadata:Ee({v0:ce,v1:ce,v2:ce,v3:ce,v4:ce,v5:ce,v6:ce,v7:ce,v8:ce,v9:ce,v10:ce,v11:ce,v12:ce,v13:ce,v14:xo,v15:Eo})}),_n=W(),Da=Q(_n),Ha=te(V,_n),Ao=e=>{try{return tt.dec(e)}catch{}try{return tt.dec(Da.dec(e))}catch{}try{return tt.dec(_n.dec(e))}catch{}try{return tt.dec(Ha.dec(e)[1])}catch{}throw null},Fa={dkLen:32},On=e=>Vt(e,Fa),Va={dkLen:16},Io=e=>Vt(e,Va),Bo=e=>de(Io(e),e),Pe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function He(e,t,n,r,o){return e=e+t+o|0,r=Dt(r^e,16),n=n+r|0,t=Dt(t^n,12),{a:e,b:t,c:n,d:r}}function Fe(e,t,n,r,o){return e=e+t+o|0,r=Dt(r^e,8),n=n+r|0,t=Dt(t^n,7),{a:e,b:t,c:n,d:r}}function _o(e,t,n,r,o,i,s,a,c,u,l,d,f,h,p,v,y,b,w,x){let m=0;for(let E=0;E<r;E++)({a:o,b:c,c:f,d:y}=He(o,c,f,y,n[t+e[m++]])),{a:o,b:c,c:f,d:y}=Fe(o,c,f,y,n[t+e[m++]]),{a:i,b:u,c:h,d:b}=He(i,u,h,b,n[t+e[m++]]),{a:i,b:u,c:h,d:b}=Fe(i,u,h,b,n[t+e[m++]]),{a:s,b:l,c:p,d:w}=He(s,l,p,w,n[t+e[m++]]),{a:s,b:l,c:p,d:w}=Fe(s,l,p,w,n[t+e[m++]]),{a,b:d,c:v,d:x}=He(a,d,v,x,n[t+e[m++]]),{a,b:d,c:v,d:x}=Fe(a,d,v,x,n[t+e[m++]]),{a:o,b:u,c:p,d:x}=He(o,u,p,x,n[t+e[m++]]),{a:o,b:u,c:p,d:x}=Fe(o,u,p,x,n[t+e[m++]]),{a:i,b:l,c:v,d:y}=He(i,l,v,y,n[t+e[m++]]),{a:i,b:l,c:v,d:y}=Fe(i,l,v,y,n[t+e[m++]]),{a:s,b:d,c:f,d:b}=He(s,d,f,b,n[t+e[m++]]),{a:s,b:d,c:f,d:b}=Fe(s,d,f,b,n[t+e[m++]]),{a,b:c,c:h,d:w}=He(a,c,h,w,n[t+e[m++]]),{a,b:c,c:h,d:w}=Fe(a,c,h,w,n[t+e[m++]]);return{v0:o,v1:i,v2:s,v3:a,v4:c,v5:u,v6:l,v7:d,v8:f,v9:h,v10:p,v11:v,v12:y,v13:b,v14:w,v15:x}}const Oo=(()=>{const e=Array.from({length:16},(r,o)=>o),t=r=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(o=>r[o]),n=[];for(let r=0,o=e;r<7;r++,o=t(o))n.push(...o);return Uint8Array.from(n)})();class Cn extends zr{constructor(t={},n=0){if(super(64,t.dkLen===void 0?32:t.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=t.dkLen===void 0?32:t.dkLen,Qe(this.outputLen),t.key!==void 0&&t.context!==void 0)throw new Error("Blake3: only key or context can be specified at same time");if(t.key!==void 0){const r=_e(t.key).slice();if(r.length!==32)throw new Error("Blake3: key should be 32 byte");this.IV=Ne(r),ne||re(this.IV),this.flags=n|16}else if(t.context!==void 0){const r=new Cn({dkLen:32},32).update(t.context).digest();this.IV=Ne(r),ne||re(this.IV),this.flags=n|64}else this.IV=Pe.slice(),this.flags=n;this.state=this.IV.slice(),this.bufferOut=Ls(this.bufferOut32)}get(){return[]}set(){}b2Compress(t,n,r,o=0){const{state:i,pos:s}=this,{h:a,l:c}=Ft(BigInt(t),!0),{v0:u,v1:l,v2:d,v3:f,v4:h,v5:p,v6:v,v7:y,v8:b,v9:w,v10:x,v11:m,v12:E,v13:S,v14:A,v15:O}=_o(Oo,o,r,7,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],Pe[0],Pe[1],Pe[2],Pe[3],a,c,s,n);i[0]=u^b,i[1]=l^w,i[2]=d^x,i[3]=f^m,i[4]=h^E,i[5]=p^S,i[6]=v^A,i[7]=y^O}compress(t,n=0,r=!1){let o=this.flags;if(this.chunkPos||(o|=1),(this.chunkPos===15||r)&&(o|=2),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,o,t,n),this.chunkPos+=1,this.chunkPos===16||r){let i=this.state;this.state=this.IV.slice();for(let s,a=this.chunksDone+1;(r||!(a&1))&&(s=this.stack.pop());a>>=1)this.buffer32.set(s,0),this.buffer32.set(i,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|4,this.buffer32,0),i=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(i)}this.pos=0}_cloneInto(t){t=super._cloneInto(t);const{IV:n,flags:r,state:o,chunkPos:i,posOut:s,chunkOut:a,stack:c,chunksDone:u}=this;return t.state.set(o.slice()),t.stack=c.map(l=>Uint32Array.from(l)),t.IV.set(n),t.flags=r,t.chunkPos=i,t.chunksDone=u,t.posOut=s,t.chunkOut=a,t.enableXOF=this.enableXOF,t.bufferOut32.set(this.bufferOut32),t}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let t of this.stack)t.fill(0)}b2CompressOut(){const{state:t,pos:n,flags:r,buffer32:o,bufferOut32:i}=this,{h:s,l:a}=Ft(BigInt(this.chunkOut++));ne||re(o);const{v0:c,v1:u,v2:l,v3:d,v4:f,v5:h,v6:p,v7:v,v8:y,v9:b,v10:w,v11:x,v12:m,v13:E,v14:S,v15:A}=_o(Oo,0,o,7,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],Pe[0],Pe[1],Pe[2],Pe[3],a,s,n,r);i[0]=c^y,i[1]=u^b,i[2]=l^w,i[3]=d^x,i[4]=f^m,i[5]=h^E,i[6]=p^S,i[7]=v^A,i[8]=t[0]^y,i[9]=t[1]^b,i[10]=t[2]^w,i[11]=t[3]^x,i[12]=t[4]^m,i[13]=t[5]^E,i[14]=t[6]^S,i[15]=t[7]^A,ne||(re(o),re(i)),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let t=this.flags|8;this.stack.length?(t|=4,ne||re(this.buffer32),this.compress(this.buffer32,0,!0),ne||re(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):t|=(this.chunkPos?0:1)|2,this.flags=t,this.b2CompressOut()}writeInto(t){gt(this,!1),zt(t),this.finish();const{blockLen:n,bufferOut:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.b2CompressOut();const s=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(t)}xof(t){return Qe(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(yn(t,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const ja=zs(e=>new Cn(e)),qa={dkLen:32},Co=e=>ja(e,qa),Wa=e=>de(Co(e),e),$o=e=>e,nt=(e,t,n,r)=>new DataView(new Uint16Array([e,t,n,r]).buffer).getBigUint64(0,!0),$n=2n**64n-1n,N=(e,t)=>e<<t&$n|e>>64n-t,L=(e,t)=>e*t&$n,K=(e,t)=>e+t&$n,Y=11400714785074694791n,pe=14029467366897019727n,To=1609587929392839161n,Bt=9650029242287828579n,Po=2870177450012600261n;function Ve(e,t=0n){let n=K(K(t,Y),pe),r=K(t,pe),o=t,i=t-Y,s=e.length,a=0,c=null;(function(){let h=0,p=h+s;if(s){if(c=new Uint8Array(32),s<32){c.set(e.subarray(0,s),a),a+=s;return}if(h<=p-32){const v=p-32;do{let y;y=nt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),n=L(N(K(n,L(y,pe)),31n),Y),h+=8,y=nt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),r=L(N(K(r,L(y,pe)),31n),Y),h+=8,y=nt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),o=L(N(K(o,L(y,pe)),31n),Y),h+=8,y=nt(e[h+1]<<8|e[h],e[h+3]<<8|e[h+2],e[h+5]<<8|e[h+4],e[h+7]<<8|e[h+6]),i=L(N(K(i,L(y,pe)),31n),Y),h+=8}while(h<=v)}h<p&&(c.set(e.subarray(h,p),a),a=p-h)}})(),e=c||e;let u,l=0;for(s>=32?(u=N(n,1n),u=K(u,N(r,7n)),u=K(u,N(o,12n)),u=K(u,N(i,18n)),n=L(N(L(n,pe),31n),Y),u=u^n,u=K(L(u,Y),Bt),r=L(N(L(r,pe),31n),Y),u=u^r,u=K(L(u,Y),Bt),o=L(N(L(o,pe),31n),Y),u=u^o,u=K(L(u,Y),Bt),i=L(N(L(i,pe),31n),Y),u=u^i,u=K(L(u,Y),Bt)):u=K(t,Po),u=K(u,BigInt(s));l<=a-8;){let f=nt(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]);f=L(N(L(f,pe),31n),Y),u=K(L(N(u^f,27n),Y),Bt),l+=8}if(l+4<=a){let f=L(nt(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],0,0),Y);u=K(L(N(u^f,23n),pe),To),l+=4}for(;l<a;){const f=L(nt(e[l++],0,0,0),Po);u=L(N(u^f,11n),Y)}let d=u>>33n;return u=L(u^d,pe),d=u>>29n,u=L(u^d,To),d=u>>32n,u^=d,u}const Tn=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,Ve(e),!0),n.setBigUint64(8,Ve(e,1n),!0),t},Xa=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,Ve(e),!0),n.setBigUint64(8,Ve(e,1n),!0),n.setBigUint64(16,Ve(e,2n),!0),n.setBigUint64(24,Ve(e,3n),!0),t},Pn=e=>de(mt.enc(Ve(e)),e),Lo=new TextEncoder,Ln=e=>{const t=Tn(Lo.encode(e));return(n,r,...o)=>{const i=de(t,Tn(Lo.encode(n))),s=ie(i),a=o.map(d=>d[1]).map(d=>{switch(d){case $o:return 0;case Pn:return 8;case Bo:return 16;default:return null}}).filter(d=>d!==null),c=d=>{if(!d.startsWith(s))throw new Error(`key does not match this storage (${e}.${n})`);if(a.length!==o.length)throw new Error("Impossible to decode this key");if(o.length===0)return[];const f=d.slice(s.length),h=new Array(o.length);for(let p=0,v=0;p<a.length;p++){const y=o[p][0];v+=a[p],h[p]=y.dec(f.slice(v*2)),v+=y.enc(h[p]).length}return h},u=o.map(([{enc:d},f])=>h=>f(d(h)));return{enc:(...d)=>ie(de(i,...d.map((f,h)=>u[h](f)))),dec:r,keyDecoder:c}}};var Uo=Object.freeze({__proto__:null,AccountId:at,Bin:St,Binary:ze,Blake2128:Io,Blake2128Concat:Bo,Blake2256:On,Blake3256:Co,Blake3256Concat:Wa,Bytes:W,Enum:At,FixedSizeBinary:xn,Hex:De,Identity:$o,Option:Q,Result:Mt,ScaleEnum:Ee,Self:En,Storage:Ln,Struct:C,Tuple:te,Twox128:Tn,Twox256:Xa,Twox64Concat:Pn,Variant:$e,Vector:P,_Enum:oo,_void:T,bitSequence:Nr,blockHeader:bo,bool:vn,char:ia,compact:V,compactBn:Qr,compactNumber:_,createCodec:M,createDecoder:pn,decAnyMetadata:Ao,enhanceCodec:st,enhanceDecoder:Rt,enhanceEncoder:bt,ethAccount:po,fixedStr:ca,fromBufferToBase58:Wr,getSs58AddressInfo:gn,h64:Ve,i128:us,i16:is,i256:fs,i32:ss,i64:as,i8:os,metadata:tt,selfDecoder:ro,selfEncoder:no,str:Z,u128:cs,u16:Je,u256:ls,u32:be,u64:mt,u8:q,v14:xo,v14Lookup:Bn,v15:Eo});const rt=V,Ga=P(te(Z,rt)),R={bool:"boolean",str:"string",num:"number",big:"bigint",bits:"bitseq",void:"void"},Ka=$e(Object.fromEntries(Object.values(R).map(e=>[e,T]))),Ya=P(te(Z,Q(En(()=>Un)))),Za=P(rt),Ja=C({typeRef:rt,length:Q(rt)}),Qa=Q(V),Na=rt,ec=C({ok:rt,ko:rt}),Un=$e({struct:Ga,terminal:Ka,enum:Ya,tuple:Za,array:Ja,binary:Qa,option:Na,result:ec}),tc={i256:R.big,i128:R.big,i64:R.big,i32:R.num,i16:R.num,i8:R.num,u256:R.big,u128:R.big,u64:R.big,u32:R.num,u16:R.num,u8:R.num,bool:R.bool,char:R.str,str:R.str},_t=e=>({type:"terminal",value:{type:e}});function Ot(e,t=()=>{}){switch(e.type){case"AccountId20":case"AccountId32":return _t(R.str);case"array":return e.value.type==="primitive"&&e.value.value==="u8"?{type:"binary",value:e.len}:(t(e.value.id),{type:"array",value:{typeRef:e.value.id,length:e.len}});case"bitSequence":return _t(R.bits);case"compact":return _t(e.isBig?R.big:R.num);case"enum":return{type:"enum",value:Object.entries(e.value).map(([n,r])=>(r.type==="lookupEntry"&&t(r.value.id),[n,r.type==="lookupEntry"?Ot(r.value,t):Ot(r,t)]))};case"struct":{const n=Object.entries(e.value).map(([r,o])=>[r,o.id]);return n.forEach(([,r])=>t(r)),{type:"struct",value:n}}case"tuple":{const n=e.value.map(r=>r.id);return n.forEach(t),{type:"tuple",value:n}}case"option":return t(e.value.id),{type:"option",value:e.value.id};case"primitive":return _t(tc[e.value]);case"result":return t(e.value.ok.id),t(e.value.ko.id),{type:"result",value:{ok:e.value.ok.id,ko:e.value.ko.id}};case"sequence":return e.value.type==="primitive"&&e.value.value==="u8"?{type:"binary",value:void 0}:(t(e.value.id),{type:"array",value:{typeRef:e.value.id}});case"void":return _t(R.void)}}function Rn(e,t,n){if(t.type==="option"&&e==null)return!0;const r=(i,s)=>Rn(i,s,n),o=i=>{switch(i.value.type){case R.str:case R.big:case R.bool:case R.num:return typeof e===i.value.type;case R.bits:return typeof e=="object"&&e!=null&&typeof e.bitsLen=="number"&&e.bytes instanceof Uint8Array;case R.void:return!0}};switch(t.type){case"terminal":return o(t);case"binary":return e instanceof ze&&(t.value==null||e.asBytes().length>=t.value);case"array":if(!Array.isArray(e))return!1;const i=e;return t.value.length!=null&&i.length<t.value.length?!1:i.slice(0,t.value.length).every(u=>r(u,n(t.value.typeRef)));case"enum":if(!e)return!1;const s=e,a=Object.fromEntries(t.value);if(!(s.type in a))return!1;const c=a[s.type];return c==null?!0:r(s.value,c);case"option":return e==null?!0:r(e,n(t.value));case"struct":return e?t.value.every(([u,l])=>r(e[u],n(l))):!1;case"tuple":return e?t.value.every((u,l)=>r(e[l],n(u))):!1;case"result":return"success"in e&&"value"in e?r(e.value,n(e.success?t.value.ok:t.value.ko)):!1}}var nc=Object.defineProperty,rc=(e,t,n)=>t in e?nc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oc=(e,t,n)=>rc(e,t+"",n);class Ro{constructor(t=[]){oc(this,"value",new Map),t.forEach(([n,r])=>this.add(n,r))}has(t,n){return this.value.get(t)?.has(n)??!1}add(t,n){this.value.has(t)||this.value.set(t,new Set),this.value.get(t).add(n)}addAll(t){t.forEach(([n,r])=>this.add(n,r))}delete(t,n){if(!this.value.has(t))return;const r=this.value.get(t);r.delete(n),r.size||this.value.delete(t)}isEmpty(){return!this.value.size}get values(){return Array.from(this.value).flatMap(([t,n])=>Array.from(n).map(r=>[t,r]))}}var Se=(e=>(e[e.Incompatible=0]="Incompatible",e[e.Partial=1]="Partial",e[e.BackwardsCompatible=2]="BackwardsCompatible",e[e.Identical=3]="Identical",e))(Se||{});function Mn(e,t,n,r,o){if(!n&&!e)return ue(3);if(!n)return ue(2);if(!e)return ue(n.type==="option"?2:0);o.has(n)||o.set(n,new Map);const i=o.get(n);if(i.has(e)){const a=i.get(e);return a===null?{level:3,assumptions:new Ro([[e,n]])}:ue(a)}i.set(e,null);const s=ic(e,n,(a,c)=>Mn(typeof a=="number"?t(a):a,t,typeof c=="number"?r(c):c,r,o));return s.assumptions.delete(e,n),s.assumptions.isEmpty()||s.level===0?i.set(e,s.level):i.delete(e),s}function ic(e,t,n){if(e.type!==t.type)return t.type==="option"?Xt(n(e,t.value),2):e.type==="option"?Xt(n(e.value,t),1):ue(0);switch(t.type){case"terminal":return ue(t.value.type===e.value.type?3:0);case"binary":return ue(zo(e.value,t.value));case"array":const o=e,i=ue(zo(o.value.length,t.value.length));return zn([i,()=>n(o.value.typeRef,t.value.typeRef)]);case"enum":{const l=e,d=Object.fromEntries(t.value),f=l.value.length===t.value.length?3:2;return Xt(Mo(l.value.map(([h,p])=>()=>h in d?n(p,d[h]):ue(0))),f)}case"option":return n(e.value,t.value);case"struct":const s=e,a=Object.fromEntries(s.value),c=s.value.length===t.value.length?3:2;return Xt(zn(t.value.map(([l,d])=>()=>n(a[l],d))),c);case"tuple":{const l=e,d=ue(ac(l.value,t.value));return zn([d,...t.value.map((f,h)=>()=>n(l.value[h],f))])}case"result":const u=e;return Mo([n(u.value.ok,t.value.ok),n(u.value.ko,t.value.ko)])}}const Xt=(e,t)=>({...e,level:Math.min(e.level,t)}),sc=new Ro,ue=e=>({level:e,assumptions:sc}),zn=e=>{let t=ue(3);for(const n of e){const r=typeof n=="function"?n():n;if(r.level===0)return r;t.assumptions.addAll(r.assumptions.values),t.level=Math.min(t.level,r.level)}return t},Mo=e=>{if(!e.length)return ue(3);let t=!1,n=ue(3);for(const r of e){const o=typeof r=="function"?r():r;if(o.level===0){n.level=Math.min(n.level,1);continue}t=!0,n.assumptions.addAll(o.assumptions.values),n.level=Math.min(n.level,o.level)}return t?n:ue(0)},ac=(e,t)=>t.length===e.length?3:e.length>=t.length?2:0,zo=(e,t)=>t===e?3:t==null||e>=t?2:e==null?1:0,Do=$e({lookup:V,typedef:Un}),ct=e=>({type:"lookup",value:e}),Dn=e=>({type:"typedef",value:e}),Gt=Dn({type:"terminal",value:{type:R.void}}),cc=C({args:Do,values:Do});function uc(e){if(e.type.tag==="plain")return{args:Gt,values:ct(e.type.value)};const{key:t,value:n}=e.type.value;return{args:ct(t),values:ct(n)}}function lc(e){return{args:Dn({type:"tuple",value:e.inputs.map(t=>t.type)}),values:ct(e.output)}}function fc(e){return e.type==="lookupEntry"?ct(e.value.id):Dn(Ot(e))}function hc(e){return{args:Gt,values:ct(e)}}function dc(e,t,n,r,o){const i=(s,a)=>s.type==="lookup"?a(s.value):s.value;return{args:Mn(i(e.args,t),t,i(n.args,r),r,o).level,values:Mn(i(n.values,r),r,i(e.values,t),t,o).level}}function Ho(e,t,n){const r=e.type==="lookup"?t(e.value):e.value;return Rn(n,r,t)}const ut=()=>{},me={body:"",call:"",continue:"",follow:"",header:"",stopOperation:"",storage:"",unfollow:"",unpin:"",followEvent:""},Kt={chainName:"",genesisHash:"",properties:""},Hn={broadcast:"",stop:""};Object.entries({chainHead:me,chainSpec:Kt,transaction:Hn}).forEach(([e,t])=>{Object.keys(t).forEach(n=>{t[n]=`${e}_v1_${n}`})});const pc=e=>(t,n)=>{let r=e(Hn.broadcast,[t],{onSuccess:o=>{r=o===null?ut:()=>{e(Hn.stop,[o])},o===null&&n(new Error("Max # of broadcasted transactions has been reached"))},onError:n});return()=>{r()}};class Fo extends Error{constructor(){super("ChainHead stopped"),this.name="StopError"}}class Yt extends Error{constructor(){super("ChainHead disjointed"),this.name="DisjointError"}}class Zt extends Error{constructor(){super("ChainHead operations limit reached"),this.name="OperationLimitError"}}class Vo extends Error{constructor(t){super(t),this.name="OperationError"}}class Fn extends Error{constructor(){super("ChainHead operation inaccessible"),this.name="OperationInaccessibleError"}}function vc(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),res:e,rej:t}}const jo=()=>{const e=new Map;return{has:e.has.bind(e),subscribe(t,n){e.set(t,n)},unsubscribe(t){e.delete(t)},next(t,n){e.get(t)?.next(n)},error(t,n){const r=e.get(t);r&&(e.delete(t),r.error(n))},errorAll(t){const n=[...e.values()];e.clear(),n.forEach(r=>{r.error(t)})}}},Jt=e=>(...t)=>new Promise((n,r)=>{let o=wt;const[i,s]=t[t.length-1]instanceof AbortSignal?[t.slice(0,t.length-1),t[t.length-1]]:[t],a=()=>{o(),r(new Gr)};s?.addEventListener("abort",a,{once:!0});const c=u=>l=>{o=wt,s?.removeEventListener("abort",a),u(l)};o=e(c(n),c(r),...i)}),qo=(e,t)=>n=>Jt((r,o,...i)=>{let s=!0,a=()=>{s=!1};const[c,u]=t(...i);return n(e,c,{onSuccess:(l,d)=>{if(l.result==="limitReached")return o(new Zt);const{operationId:f}=l,h=()=>{n(me.stopOperation,[f])};if(!s)return h();let p=ut;const v=b=>{s=!1,p(),r(b)},y=b=>{s=!1,p(),o(b)};p=d(f,{next:b=>{const w=b;w.event==="operationError"?o(new Vo(w.error)):w.event==="operationInaccessible"?o(new Fn):u(b,v,y)},error:y}),a=()=>{s&&(p(),h())}},onError:o}),()=>{a()}}),yc=qo(me.body,e=>[[e],(t,n)=>{n(t.value)}]),bc=qo(me.call,(e,t,n)=>[[e,t,n],(r,o)=>{o(r.output)}]),mc=e=>t=>new Promise((n,r)=>{e(me.header,[t],{onSuccess:n,onError:r})}),Wo=e=>(t,n,r,o,i,s,a)=>{if(n.length===0)return s(),wt;let c=!0,u=()=>{c=!1};return e(me.storage,[t,n,r],{onSuccess:(l,d)=>{if(l.result==="limitReached"||l.discardedItems===n.length)return i(new Zt);const{operationId:f}=l,h=()=>{e(me.stopOperation,[f])};if(!c)return h();const p=d(l.operationId,{next:b=>{switch(b.event){case"operationStorageItems":{o(b.items);break}case"operationStorageDone":{y();break}case"operationError":{v(new Vo(b.error));break}case"operationInaccessible":{v(new Fn);break}default:e(me.continue,[b.operationId])}},error:i});u=()=>{p(),e(me.stopOperation,[l.operationId])};const v=b=>{u=wt,p(),i(b)},y=()=>{u=wt,p(),s()};a(l.discardedItems)},onError:i}),()=>{u()}},gc=e=>{const t=Wo(e);return Jt((n,r,o,i,s,a)=>{const c=i.startsWith("descendants");let u=c?[]:null;const d=t(o,[{key:s,type:i}],a??null,c?f=>{u.push(f)}:f=>{u=f[0]?.[i]},r,()=>{try{n(c?u.flat():u)}catch(f){r(f)}},f=>{f>0&&(d(),r(new Zt))});return d})},wc=e=>t=>t.length>0?new Promise((n,r)=>{e(me.unpin,[t],{onSuccess(){n()},onError:r})}):Promise.resolve();class Qt extends Error{constructor(){super("Client destroyed"),this.name="DestroyedError"}}function kc(e){return e.operationId!==void 0}function xc(e){return(t,n,r)=>{const o=jo(),i=new Set,s=vc();let a=s.promise;const c=p=>{if(kc(p))return o.has(p.operationId)||console.warn("Uknown operationId on",p),o.next(p.operationId,p);if(p.event!=="stop"){if(p.event==="initialized")return n({type:p.event,finalizedBlockHashes:p.finalizedBlockHashes,finalizedBlockRuntime:p.finalizedBlockRuntime});const{event:v,...y}=p;return n({type:v,...y})}r(new Fo),f(!1)},u=p=>{r(p),f(!(p instanceof Qt))},l=(p,v)=>{const y=v(p,{next:c,error:u});f=(b=!0)=>{a=null,f=ut,y(),b&&e(me.unfollow,[p]),o.errorAll(new Yt),i.forEach(w=>{w()}),i.clear()},a=p,s.res(p)},d=p=>{p instanceof Qt?f(!1):r(p),a=null,s.res(p)};let f=e(me.follow,[t],{onSuccess:l,onError:d});const h=(p,v,y)=>{const b=()=>{y?.onError(new Yt)};if(a===null)return b(),ut;const w=m=>{if(!y)return e(p,[m,...v]);i.add(b);const E=(A,O)=>a===null?(O.error(new Yt),ut):(o.subscribe(A,O),()=>{o.unsubscribe(A)}),S=e(p,[m,...v],{onSuccess:A=>{i.delete(b),y.onSuccess(A,E)},onError:A=>{i.delete(b),y.onError(A)}});return()=>{i.delete(b),S()}};if(typeof a=="string")return w(a);let x=ut;return a.then(m=>{if(m instanceof Error)return b();a&&(x=w(m))}),()=>{x()}};return{unfollow(){f(),a=null},body:yc(h),call:bc(h),header:mc(h),storage:gc(h),storageSubscription:Wo(h),unpin:wc(h),_request:h}}}var Ec=Object.defineProperty,Sc=(e,t,n)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xo=(e,t,n)=>Sc(e,typeof t!="symbol"?t+"":t,n);class Go extends Error{constructor(t){super(t.message),Xo(this,"code"),Xo(this,"data"),this.code=t.code,this.data=t.data,this.name="RpcError"}}let Ac=1;const Ic=e=>{let t=Ac++;const n=new Map,r=jo();let o=null;const i=(l,d,f)=>{o.send(JSON.stringify({jsonrpc:"2.0",id:l,method:d,params:f}))};function s(l){try{let d,f,h,p,v;if({id:d,result:f,error:h,params:p}=JSON.parse(l),d){const w=n.get(d);return w?(n.delete(d),h?w.onError(new Go(h)):w.onSuccess(f,(x,m)=>{const E=x;return r.subscribe(E,m),()=>{r.unsubscribe(E)}})):void 0}if({subscription:v,result:f,error:h}=p,!v||!h&&!Object.hasOwn(p,"result"))throw 0;const b=v;h?r.error(b,new Go(h)):r.next(b,f)}catch(d){console.warn("Error parsing incomming message: "+l),console.error(d)}}o=e(s);const a=()=>{o?.disconnect(),o=null,r.errorAll(new Qt),n.forEach(l=>l.onError(new Qt)),n.clear()};let c=1;return{request:(l,d,f)=>{if(!o)throw new Error("Not connected");const h=`${t}-${c++}`;return f&&n.set(h,f),i(h,l,d),()=>{n.delete(h)}},disconnect:a}},Bc=e=>{const t=Jt((r,o,i,s)=>e(i,s,{onSuccess:r,onError:o}));let n=null;return async()=>n||(n=Promise.all([t(Kt.chainName,[]),t(Kt.genesisHash,[]),t(Kt.properties,[])]).then(([r,o,i])=>({name:r,genesisHash:o,properties:i})))},_c=e=>{const{request:t,disconnect:n}=Ic(e);return{chainHead:xc(t),transaction:pc(t),getChainSpecData:Bc(t),destroy:n,request:Jt((r,o,i,s)=>t(i,s,{onSuccess:r,onError:o})),_request:t}};var Vn=function(e,t){return Vn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Vn(e,t)};function Le(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Vn(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Oc(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(l){try{u(r.next(l))}catch(d){s(d)}}function c(l){try{u(r.throw(l))}catch(d){s(d)}}function u(l){l.done?i(l.value):o(l.value).then(a,c)}u((r=r.apply(e,t||[])).next())})}function Ko(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(n=0)),n;)try{if(r=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,o=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){n.label=u[1];break}if(u[0]===6&&n.label<i[1]){n.label=i[1],i=u;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(u);break}i[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],o=0}finally{r=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function lt(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function je(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return i}function qe(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function ft(e){return this instanceof ft?(this.v=e,this):new ft(e)}function Cc(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(p){return Promise.resolve(p).then(h,d)}}function a(h,p){r[h]&&(o[h]=function(v){return new Promise(function(y,b){i.push([h,v,y,b])>1||c(h,v)})},p&&(o[h]=p(o[h])))}function c(h,p){try{u(r[h](p))}catch(v){f(i[0][3],v)}}function u(h){h.value instanceof ft?Promise.resolve(h.value.v).then(l,d):f(i[0][2],h)}function l(h){c("next",h)}function d(h){c("throw",h)}function f(h,p){h(p),i.shift(),i.length&&c(i[0][0],i[0][1])}}function $c(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof lt=="function"?lt(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=e[i]&&function(s){return new Promise(function(a,c){s=e[i](s),o(a,c,s.done,s.value)})}}function o(i,s,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function H(e){return typeof e=="function"}function jn(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var qn=jn(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
2
2
  `+n.map(function(r,o){return o+1+") "+r.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function Nt(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var rt=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=lt(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var l=this.initialTeardown;if(H(l))try{l()}catch(v){i=v instanceof qn?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=lt(d),h=f.next();!h.done;h=f.next()){var p=h.value;try{Jo(p)}catch(v){i=i??[],v instanceof qn?i=qe(qe([],je(i)),je(v.errors)):i.push(v)}}}catch(v){r={error:v}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}}if(i)throw new qn(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Jo(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Nt(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Nt(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),Yo=rt.EMPTY;function Zo(e){return e instanceof rt||e&&"closed"in e&&H(e.remove)&&H(e.add)&&H(e.unsubscribe)}function Jo(e){H(e)?e():e.unsubscribe()}var Qo={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Tc={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,qe([e,t],je(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function No(e){Tc.setTimeout(function(){throw e})}function We(){}function en(e){e()}var Wn=function(e){Le(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Zo(n)&&n.add(r)):r.destination=Rc,r}return t.create=function(n,r,o){return new ht(n,r,o)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(rt),Pc=Function.prototype.bind;function Xn(e,t){return Pc.call(e,t)}var Lc=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){tn(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){tn(r)}else tn(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){tn(n)}},e}(),ht=function(e){Le(t,e);function t(n,r,o){var i=e.call(this)||this,s;if(H(n)||!n)s={next:n??void 0,error:r??void 0,complete:o??void 0};else{var a;i&&Qo.useDeprecatedNextContext?(a=Object.create(n),a.unsubscribe=function(){return i.unsubscribe()},s={next:n.next&&Xn(n.next,a),error:n.error&&Xn(n.error,a),complete:n.complete&&Xn(n.complete,a)}):s=n}return i.destination=new Lc(s),i}return t}(Wn);function tn(e){No(e)}function Uc(e){throw e}var Rc={closed:!0,next:We,error:Uc,complete:We},Gn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function ot(e){return e}function Mc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ei(e)}function ei(e){return e.length===0?ot:e.length===1?e[0]:function(n){return e.reduce(function(r,o){return o(r)},n)}}var $=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,i=Dc(t)?t:new ht(t,n,r);return en(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=ti(n),new n(function(o,i){var s=new ht({next:function(a){try{t(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});r.subscribe(s)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[Gn]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return ei(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=ti(t),new t(function(r,o){var i;n.subscribe(function(s){return i=s},function(s){return o(s)},function(){return r(i)})})},e.create=function(t){return new e(t)},e}();function ti(e){var t;return(t=e??Qo.Promise)!==null&&t!==void 0?t:Promise}function zc(e){return e&&H(e.next)&&H(e.error)&&H(e.complete)}function Dc(e){return e&&e instanceof Wn||zc(e)&&Zo(e)}function Hc(e){return H(e?.lift)}function J(e){return function(t){if(Hc(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function j(e,t,n,r,o){return new Fc(e,t,n,r,o)}var Fc=function(e){Le(t,e);function t(n,r,o,i,s,a){var c=e.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=r?function(u){try{r(u)}catch(l){n.error(l)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(l){n.error(l)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){n.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(Wn),Vc=jn(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),nn=function(e){Le(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new ni(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new Vc},t.prototype.next=function(n){var r=this;en(function(){var o,i;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=lt(r.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(n)}}catch(u){o={error:u}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;en(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var o=r.observers;o.length;)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;en(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Yo:(this.currentObservers=null,a.push(n),new rt(function(){r.currentObservers=null,Nt(a,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,o=r.hasError,i=r.thrownError,s=r.isStopped;o?n.error(i):s&&n.complete()},t.prototype.asObservable=function(){var n=new $;return n.source=this,n},t.create=function(n,r){return new ni(n,r)},t}($),ni=function(e){Le(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:Yo},t}(nn),Kn={now:function(){return(Kn.delegate||Date).now()},delegate:void 0},rn=function(e){Le(t,e);function t(n,r,o){n===void 0&&(n=1/0),r===void 0&&(r=1/0),o===void 0&&(o=Kn);var i=e.call(this)||this;return i._bufferSize=n,i._windowTime=r,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,n),i._windowTime=Math.max(1,r),i}return t.prototype.next=function(n){var r=this,o=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,a=r._timestampProvider,c=r._windowTime;o||(i.push(n),!s&&i.push(a.now()+c)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),c=0;c<a.length&&!n.closed;c+=i?1:2)n.next(a[c]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,o=n._timestampProvider,i=n._buffer,s=n._infiniteTimeWindow,a=(s?1:2)*r;if(r<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var c=o.now(),u=0,l=1;l<i.length&&i[l]<=c;l+=2)u=l;u&&i.splice(0,u+1)}},t}(nn),jc=function(e){Le(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t}(rt),ri={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,qe([e,t],je(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},qc=function(e){Le(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o.pending=!1,o}return t.prototype.schedule=function(n,r){var o;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,r)),this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(s,this.id,r),this},t.prototype.requestAsyncId=function(n,r,o){return o===void 0&&(o=0),ri.setInterval(n.flush.bind(n,this),o)},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return r;r!=null&&ri.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(n,r);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var o=!1,i;try{this.work(n)}catch(s){o=!0,i=s||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,o=n.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Nt(i,this),r!=null&&(this.id=this.recycleAsyncId(o,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(jc),oi=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=Kn.now,e}(),Wc=function(e){Le(t,e);function t(n,r){r===void 0&&(r=oi.now);var o=e.call(this,n,r)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var o;this._active=!0;do if(o=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,o){for(;n=r.shift();)n.unsubscribe();throw o}},t}(oi),ii=new Wc(qc),Xc=ii,on=new $(function(e){return e.complete()});function Gc(e){return e&&H(e.schedule)}function Yn(e){return e[e.length-1]}function si(e){return H(Yn(e))?e.pop():void 0}function sn(e){return Gc(Yn(e))?e.pop():void 0}function Kc(e,t){return typeof Yn(e)=="number"?e.pop():t}var ai=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function ci(e){return H(e?.then)}function ui(e){return H(e[Gn])}function li(e){return Symbol.asyncIterator&&H(e?.[Symbol.asyncIterator])}function fi(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Yc(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var hi=Yc();function di(e){return H(e?.[hi])}function pi(e){return Cc(this,arguments,function(){var n,r,o,i;return Ko(this,function(s){switch(s.label){case 0:n=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,ft(n.read())];case 3:return r=s.sent(),o=r.value,i=r.done,i?[4,ft(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,ft(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function vi(e){return H(e?.getReader)}function le(e){if(e instanceof $)return e;if(e!=null){if(ui(e))return Zc(e);if(ai(e))return Jc(e);if(ci(e))return Qc(e);if(li(e))return yi(e);if(di(e))return Nc(e);if(vi(e))return eu(e)}throw fi(e)}function Zc(e){return new $(function(t){var n=e[Gn]();if(H(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Jc(e){return new $(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function Qc(e){return new $(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,No)})}function Nc(e){return new $(function(t){var n,r;try{for(var o=lt(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}t.complete()})}function yi(e){return new $(function(t){tu(e,t).catch(function(n){return t.error(n)})})}function eu(e){return yi(pi(e))}function tu(e,t){var n,r,o,i;return Oc(this,void 0,void 0,function(){var s,a;return Ko(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=$c(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Xe(e,t,n,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var i=t.schedule(function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(i),!o)return i}function bi(e,t){return t===void 0&&(t=0),J(function(n,r){n.subscribe(j(r,function(o){return Xe(r,e,function(){return r.next(o)},t)},function(){return Xe(r,e,function(){return r.complete()},t)},function(o){return Xe(r,e,function(){return r.error(o)},t)}))})}function mi(e,t){return t===void 0&&(t=0),J(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function nu(e,t){return le(e).pipe(mi(t),bi(t))}function ru(e,t){return le(e).pipe(mi(t),bi(t))}function ou(e,t){return new $(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function iu(e,t){return new $(function(n){var r;return Xe(n,t,function(){r=e[hi](),Xe(n,t,function(){var o,i,s;try{o=r.next(),i=o.value,s=o.done}catch(a){n.error(a);return}s?n.complete():n.next(i)},0,!0)}),function(){return H(r?.return)&&r.return()}})}function gi(e,t){if(!e)throw new Error("Iterable cannot be null");return new $(function(n){Xe(n,t,function(){var r=e[Symbol.asyncIterator]();Xe(n,t,function(){r.next().then(function(o){o.done?n.complete():n.next(o.value)})},0,!0)})})}function su(e,t){return gi(pi(e),t)}function au(e,t){if(e!=null){if(ui(e))return nu(e,t);if(ai(e))return ou(e,t);if(ci(e))return ru(e,t);if(li(e))return gi(e,t);if(di(e))return iu(e,t);if(vi(e))return su(e,t)}throw fi(e)}function Ct(e,t){return t?au(e,t):le(e)}function ee(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=sn(e);return Ct(e,n)}function Zn(e,t){var n=H(e)?e:function(){return e},r=function(o){return o.error(n())};return new $(r)}var wi=jn(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function cu(e,t){return new Promise(function(n,r){var o=!1,i;e.subscribe({next:function(s){i=s,o=!0},error:r,complete:function(){o?n(i):r(new wi)}})})}function we(e,t){return new Promise(function(n,r){var o=new ht({next:function(i){n(i),o.unsubscribe()},error:r,complete:function(){r(new wi)}});e.subscribe(o)})}function uu(e){return e instanceof Date&&!isNaN(e)}function I(e,t){return J(function(n,r){var o=0;n.subscribe(j(r,function(i){r.next(e.call(t,i,o++))}))})}var lu=Array.isArray;function fu(e,t){return lu(t)?e.apply(void 0,qe([],je(t))):e(t)}function hu(e){return I(function(t){return fu(e,t)})}var du=Array.isArray,pu=Object.getPrototypeOf,vu=Object.prototype,yu=Object.keys;function bu(e){if(e.length===1){var t=e[0];if(du(t))return{args:t,keys:null};if(mu(t)){var n=yu(t);return{args:n.map(function(r){return t[r]}),keys:n}}}return{args:e,keys:null}}function mu(e){return e&&typeof e=="object"&&pu(e)===vu}function gu(e,t){return e.reduce(function(n,r,o){return n[r]=t[o],n},{})}function an(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=sn(e),r=si(e),o=bu(e),i=o.args,s=o.keys;if(i.length===0)return Ct([],n);var a=new $(wu(i,n,s?function(c){return gu(s,c)}:ot));return r?a.pipe(hu(r)):a}function wu(e,t,n){return n===void 0&&(n=ot),function(r){ki(t,function(){for(var o=e.length,i=new Array(o),s=o,a=o,c=function(l){ki(t,function(){var d=Ct(e[l],t),f=!1;d.subscribe(j(r,function(h){i[l]=h,f||(f=!0,a--),a||r.next(n(i.slice()))},function(){--s||r.complete()}))},r)},u=0;u<o;u++)c(u)},r)}}function ki(e,t,n){e?Xe(n,e,t):t()}function ku(e,t,n,r,o,i,s,a){var c=[],u=0,l=0,d=!1,f=function(){d&&!c.length&&!u&&t.complete()},h=function(v){return u<r?p(v):c.push(v)},p=function(v){u++;var y=!1;le(n(v,l++)).subscribe(j(t,function(b){t.next(b)},function(){y=!0},void 0,function(){if(y)try{u--;for(var b=function(){var w=c.shift();s||p(w)};c.length&&u<r;)b();f()}catch(w){t.error(w)}}))};return e.subscribe(j(t,h,function(){d=!0,f()})),function(){}}function z(e,t,n){return n===void 0&&(n=1/0),H(t)?z(function(r,o){return I(function(i,s){return t(r,i,o,s)})(le(e(r,o)))},n):(typeof t=="number"&&(n=t),J(function(r,o){return ku(r,o,e,n)}))}function Jn(e){return e===void 0&&(e=1/0),z(ot,e)}function xu(){return Jn(1)}function Eu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xu()(Ct(e,sn(e)))}function Qn(e){return new $(function(t){le(e()).subscribe(t)})}function Su(e,t,n){return n===void 0&&(n=Xc),new $(function(r){var o=uu(e)?+e-n.now():e;o<0&&(o=0);var i=0;return n.schedule(function(){r.closed||(r.next(i++),r.complete())},o)})}function xi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=sn(e),r=Kc(e,1/0),o=e;return o.length?o.length===1?le(o[0]):Jn(r)(Ct(o,n)):on}function Ge(e,t){return J(function(n,r){var o=0;n.subscribe(j(r,function(i){return e.call(t,i,o++)&&r.next(i)}))})}function cn(e){return J(function(t,n){var r=null,o=!1,i;r=t.subscribe(j(n,void 0,void 0,function(s){i=le(e(s,cn(e)(t))),r?(r.unsubscribe(),r=null,i.subscribe(n)):o=!0})),o&&(r.unsubscribe(),r=null,i.subscribe(n))})}function Au(e,t,n,r,o){return function(i,s){var a=n,c=t,u=0;i.subscribe(j(s,function(l){var d=u++;c=a?e(c,l,d):(a=!0,l),s.next(c)},o))}}function Ei(e,t){return H(t)?z(e,t,1):z(e,1)}function Iu(e,t){return t===void 0&&(t=ii),J(function(n,r){var o=null,i=null,s=null,a=function(){if(o){o.unsubscribe(),o=null;var u=i;i=null,r.next(u)}};function c(){var u=s+e,l=t.now();if(l<u){o=this.schedule(void 0,u-l),r.add(o);return}a()}n.subscribe(j(r,function(u){i=u,s=t.now(),o||(o=t.schedule(c,e),r.add(o))},function(){a(),r.complete()},void 0,function(){i=o=null}))})}function Ae(e){return e<=0?function(){return on}:J(function(t,n){var r=0;t.subscribe(j(n,function(o){++r<=e&&(n.next(o),e<=r&&n.complete())}))})}function Bu(e,t){return J(function(n,r){var o=new Set;n.subscribe(j(r,function(i){var s=e?e(i):i;o.has(s)||(o.add(s),r.next(i))})),t&&le(t).subscribe(j(r,function(){return o.clear()},We))})}function ke(e,t){return t===void 0&&(t=ot),e=e??_u,J(function(n,r){var o,i=!0;n.subscribe(j(r,function(s){var a=t(s);(i||!e(o,a))&&(i=!1,o=a,r.next(s))}))})}function _u(e,t){return e===t}function Si(e,t){return J(Au(e,t,arguments.length>=2,!0))}function $t(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new nn}:t,r=e.resetOnError,o=r===void 0?!0:r,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,c=a===void 0?!0:a;return function(u){var l,d,f,h=0,p=!1,v=!1,y=function(){d?.unsubscribe(),d=void 0},b=function(){y(),l=f=void 0,p=v=!1},w=function(){var x=l;b(),x?.unsubscribe()};return J(function(x,m){h++,!v&&!p&&y();var E=f=f??n();m.add(function(){h--,h===0&&!v&&!p&&(d=Nn(w,c))}),E.subscribe(m),!l&&h>0&&(l=new ht({next:function(S){return E.next(S)},error:function(S){v=!0,y(),d=Nn(b,o,S),E.error(S)},complete:function(){p=!0,y(),d=Nn(b,s),E.complete()}}),le(x).subscribe(l))})(u)}}function Nn(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var o=new ht({next:function(){o.unsubscribe(),e()}});return le(t.apply(void 0,qe([],je(n)))).subscribe(o)}}function Ou(e,t,n){var r,o=!1;return r=e,$t({connector:function(){return new rn(r,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:o})}function er(e,t){return J(function(n,r){var o=null,i=0,s=!1,a=function(){return s&&!o&&r.complete()};n.subscribe(j(r,function(c){o?.unsubscribe();var u=0,l=i++;le(e(c,l)).subscribe(o=j(r,function(d){return r.next(t?t(c,d,l,u++):d)},function(){o=null,a()}))},function(){s=!0,a()}))})}function Cu(e){return J(function(t,n){le(e).subscribe(j(n,function(){return n.complete()},We)),!n.closed&&t.subscribe(n)})}function Ai(e,t){return t===void 0&&(t=!1),J(function(n,r){var o=0;n.subscribe(j(r,function(i){var s=e(i,o++);(s||t)&&r.next(i),!s&&r.complete()}))})}function $u(e,t,n){var r=H(e)||t||n?{next:e,error:t,complete:n}:e;return r?J(function(o,i){var s;(s=r.subscribe)===null||s===void 0||s.call(r);var a=!0;o.subscribe(j(i,function(c){var u;(u=r.next)===null||u===void 0||u.call(r,c),i.next(c)},function(){var c;a=!1,(c=r.complete)===null||c===void 0||c.call(r),i.complete()},function(c){var u;a=!1,(u=r.error)===null||u===void 0||u.call(r,c),i.error(c)},function(){var c,u;a&&((c=r.unsubscribe)===null||c===void 0||c.call(r)),(u=r.finalize)===null||u===void 0||u.call(r)}))}):ot}function Tu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=si(e);return J(function(r,o){for(var i=e.length,s=new Array(i),a=e.map(function(){return!1}),c=!1,u=function(d){le(e[d]).subscribe(j(o,function(f){s[d]=f,!c&&!a[d]&&(a[d]=!0,(c=a.every(ot))&&(a=null))},We))},l=0;l<i;l++)u(l);r.subscribe(j(o,function(d){if(c){var f=qe([d],je(s));o.next(n?n.apply(void 0,qe([],je(f))):f)}}))})}var Pu=Object.defineProperty,Lu=(e,t,n)=>t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ii=(e,t,n)=>Lu(e,typeof t!="symbol"?t+"":t,n);class Uu{constructor(){Ii(this,"first"),Ii(this,"last")}getRemoveFn(t){return()=>{t.prev?t.prev.next=t.next:this.first=t.next,t.next?t.next.prev=t.prev:this.last=t.prev,delete t.prev,delete t.next}}push(t){const n={value:t};return this.last===void 0?this.last=this.first=n:(this.last.next=n,n.prev=this.last,this.last=n),this.getRemoveFn(n)}unshift(t){return this.first={value:t,next:this.first},this.first.next&&(this.first.next.prev=this.first),this.last||(this.last=this.first),this.getRemoveFn(this.first)}pop(){const t=this.first?.value;return this.first&&(this.first=this.first.next,this.first?(delete this.first.prev?.next,delete this.first.prev):this.last=void 0),t}isEmpty(){return!this.first}}const Ru=()=>{const e=new Map,t=(f,h)=>{e.set(f,()=>{e.delete(f),h()})},n=f=>{e.get(f)?.()},r=new Uu,o=r.unshift.bind(r),i=r.push.bind(r),s=(f,h)=>{const p=h?o:i;t(f.source$,p(f))},a=()=>{const f=r.pop();f&&(e.delete(f.source$),c(f))},c=f=>{const{source$:h,observer:p}=f;let v=!1;const y=h.subscribe({next(b){p.next(b)},error(b){(v=b instanceof Zt)?s(f,!0):p.error(b)},complete(){p.complete()}});y.closed?v||a():t(h,()=>{y.unsubscribe(),a()})},u=(f=!1)=>h=>new $(p=>{const v={observer:p,source$:h};return r.isEmpty()?c(v):s(v,f),()=>{n(h)}}),l=u();return{withRecovery:u,withRecoveryFn:f=>(...h)=>l(f(...h))}},Mu=(e,t)=>n=>(r,...o)=>(r===null||r==="finalized"?e:r==="best"?t:ee(r)).pipe(Ae(1),z(s=>n(s,...o))),Bi=e=>(...t)=>new $(n=>{let r=new AbortController;return e(...t,r.signal).then(o=>{n.next(o),n.complete()},o=>{n.error(o)}),()=>{n.unsubscribe(),r.abort(),r=void 0}}),zu=e=>t=>(...n)=>e()[t](...n);class tr extends Error{constructor(){super("Block is not pinned"),this.name="BlockNotPinnedError"}}class Du extends Error{constructor(){super("Block pruned"),this.name="BlockPrunedError"}}class _i extends Error{constructor(){super("Block is not best block or finalized"),this.name="NotBestBlockError"}}const Hu=(e,t)=>e.pipe(Ai(n=>n.blocks.has(t)),ke((n,r)=>n.finalized===r.finalized&&n.best===r.best),Ge(n=>n.blocks.get(n.best).number>=n.blocks.get(t).number),I(n=>{const{number:r}=n.blocks.get(t);let o=n.blocks.get(n.best),i=n.finalized===o.hash;for(;o.number>r;)o=n.blocks.get(o.parent),i=i||n.finalized===o.hash;return i?"finalized":o.hash===t?"best":null}),ke(),Ai(n=>n!=="finalized",!0)),Fu=e=>{let t=null,n=We;const r=new $(o=>{t=e(!0,i=>{o.next(i)},i=>{t=null,o.error(i)}),n=()=>{o.complete(),t?.unfollow()}}).pipe($t());return{getFollower:()=>{if(!t)throw new Error("Missing chainHead subscription");return t},unfollow:()=>{n()},follow$:r}},Oi=()=>e=>new $(t=>{const n=new rt,r=()=>e.subscribe({next:o=>t.next(o),error:o=>{o instanceof Fo?(t.next({type:"stop-error"}),n.add(r())):t.error(o)},complete:()=>t.complete()});return n.add(r()),n});function Vu(e,t,n){return(r,o,...i)=>(o?Mc(qu(r,t.pipe(Oi(),Ge(a=>a.type==="finalized"),z(a=>a.prunedBlockHashes))),ju(r,e)):a=>a)(n(r,...i))}const ju=(e,t)=>n=>Hu(t,e).pipe(Ae(1),er(r=>r?n:Zn(()=>new _i))),qu=(e,t)=>n=>new $(r=>{const o=t.pipe(Ge(s=>s===e)).subscribe(()=>{r.error(new Du)}),i=n.subscribe(r);return()=>{o.unsubscribe(),i.unsubscribe()}});function un(e,t){return(n,...r)=>{const o=t(n,...r);return new $(i=>{let s=null,a=!1;const c=()=>{a||(a=!0,s=o.subscribe({next:d=>i.next(d),error:d=>i.error(d),complete:()=>i.complete()}),s.add(()=>{a=!1,s=null}))};let u=!1;const l=e.subscribe({next:d=>{const f=d.blocks.get(n);f?f.recovering?s?.unsubscribe():c():u&&i.error(new tr),u=d.recovering},error:d=>i.error(d)});return()=>{l.unsubscribe(),s?.unsubscribe()}})}}const Wu=e=>{const t=e.pipe(cn(n=>n instanceof Fn?Su(750).pipe(Ei(()=>t)):Zn(()=>n)));return t},nr=e=>(...t)=>Wu(e(...t)),Xu=(e,t)=>{const n=(r,o,i,s)=>new $(a=>e().storageSubscription(r,o,i??null,c=>{a.next(c)},c=>{a.error(c)},()=>{a.complete()},c=>{c!==0&&a.next(n(r,o.slice(-c),i,!0))})).pipe(Jn(),t(s));return n},Ci=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",it={type:"void"},Gu=(e,t=()=>null)=>{const n=new Map,r=new Set,o=l=>d=>{let f=n.get(d);if(f)return f;if(r.has(d)){const p={id:d};return n.set(d,p),p}r.add(d);const h=l(d);return f=n.get(d),f?Object.assign(f,h):(f={id:d,...h},n.set(d,f)),r.delete(d),f};let i=!0,s=!0;const a=o(l=>{const d=t(e[l]);if(d)return d;const{def:f,path:h,params:p}=e[l];if(f.tag==="composite"){if(f.value.length===0)return it;if(f.value.length===1){const v=a(f.value[0].type);return i&&h.at(-1)==="AccountId32"&&Ci(v,32)?(i=!1,{type:"AccountId32"}):s&&h.at(-1)==="AccountId20"&&Ci(v,20)?(s=!1,{type:"AccountId20"}):v}return c(f.value)}if(f.tag==="variant"){if(h.length===1&&h[0]==="Option"&&p.length===1&&p[0].name==="T"){const b=a(p[0].type);return b.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:b}}if(h.length===1&&h[0]==="Result"&&p.length===2&&p[0].name==="T"&&p[1].name==="E")return{type:"result",value:{ok:a(p[0].type),ko:a(p[1].type)}};if(f.value.length===0)return it;const v={},y={};return f.value.forEach(b=>{const w=b.name;if(y[w]=b.docs,b.fields.length===0){v[w]={...it,idx:b.index};return}if(b.fields.length===1&&!b.fields[0].name){v[w]={type:"lookupEntry",value:a(b.fields[0].type),idx:b.index};return}v[w]={...c(b.fields),idx:b.index}}),{type:"enum",value:v,innerDocs:y}}if(f.tag==="sequence")return{type:"sequence",value:a(f.value)};if(f.tag==="array"){const{len:v}=f.value,y=a(f.value.type);return!v||y.type==="void"?it:v>1?{type:"array",value:y,len:f.value.len}:y}if(f.tag==="tuple")return f.value.length===0?it:f.value.length>1?u(f.value.map(v=>a(v)),f.value.map(v=>e[v].docs)):a(f.value[0]);if(f.tag==="primitive")return{type:"primitive",value:f.value.tag};if(f.tag==="compact"){const v=a(f.value);return v.type==="void"?{type:"compact",isBig:null}:{type:"compact",isBig:Number(v.value.slice(1))>32}}return{type:f.tag}}),c=l=>{let d=!0;const f={},h={};return l.forEach((p,v)=>{d=d&&!!p.name;const y=p.name||v,b=a(p.type);b.type!=="void"&&(f[y]=b,h[y]=p.docs)}),d?{type:"struct",value:f,innerDocs:h}:u(Object.values(f),Object.values(h))},u=(l,d)=>{if(l.every(f=>f.id===l[0].id)&&d.every(f=>!f.length)){const[f]=l;return f.type==="void"?it:{type:"array",value:l[0],len:l.length}}return{type:"tuple",value:l,innerDocs:d}};return a},Ku=e=>{const t=Gu(e.lookup,({def:o})=>{if(o.tag==="composite"){const i=n(o);if(i)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(s=>[s.name,s.errors==null?{...it,idx:s.index}:{type:"lookupEntry",value:t(s.errors),idx:s.index}])),byteLength:i}}return null});function n(o){if(!(o.value.length===2&&o.value[0].name==="index"&&o.value[1].name==="error"))return null;const s=t(o.value[0].type),a=t(o.value[1].type);return s.type==="primitive"&&s.value==="u8"&&a.type==="array"&&a.value.type==="primitive"&&a.value.value==="u8"?1+a.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(s=>s.name==="Call")?.type??null})},Yu=(e,t,n)=>(r,o,i,...s)=>{const{id:a}=r;if(o.has(a))return o.get(a);if(i.has(a)){const u=t(()=>o.get(a),r,...s);return o.set(a,u),u}i.add(a);let c=e(r,o,i,...s);return i.delete(a),o.has(a)&&(c=n(c,o.get(a),r,...s)),o.set(a,c),c},Zu=St(),Ju=M(V[0],Rt(V[1],BigInt)),$i=Yu((e,t,n,r)=>{if(e.type==="primitive")return Uo[e.value];if(e.type==="void")return T;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return po;if(e.type==="compact")return e.isBig?Ju:V;if(e.type==="bitSequence")return Nr;const o=h=>$i(h,t,n,r),i=(h,p)=>{const v=o(h);return p?P(v,p):P(v)},s=h=>te(...h.map(o)),a=h=>{const p=Object.fromEntries(Object.entries(h).map(([v,y])=>[v,o(y)]));return C(p)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return Zu;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?St(e.len):i(e.value,e.len);if(e.type==="sequence")return i(e.value);if(e.type==="tuple")return s(e.value);if(e.type==="struct")return a(e.value);if(e.type==="option")return Q(o(e.value));if(e.type==="result")return Mt(o(e.value.ok),o(e.value.ko));const c=Object.values(e.value).map(h=>{switch(h.type){case"void":return T;case"lookupEntry":return o(h.value);case"tuple":return s(h.value);case"struct":return a(h.value);case"array":return i(h.value,h.len)}}),u=Object.fromEntries(Object.keys(e.value).map((h,p)=>[h,c[p]])),l=Object.values(e.value).map(h=>h.idx),f=l.every((h,p)=>h===p)?$e(u):$e(u,l);return e.byteLength?Qu(f,e.byteLength):f},En,e=>e),Ti=(e,t=at())=>{const n=new Map,r=o=>$i(e(o),n,new Set,t);return o=>r(o)},Qu=(e,t)=>{const n=W(t);return M(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},Pi=e=>{const{metadata:t}=e;let n=Ti(e);const r=t.pallets.find(d=>d.name==="System")?.constants.find(d=>d.name==="SS58Prefix");let o;if(r)try{const d=n(r.type).dec(r.value);typeof d=="number"&&(o=d,n=Ti(e,at(d)))}catch{}const i=new Map,s=(d,f)=>{let h=i.get(d);h||i.set(d,h=Ln(d));const p=t.pallets.find(S=>S.name===d).storage.items.find(S=>S.name===f),v=(S,...A)=>{const O=h(...A);return{...O,len:S,fallback:p.modifier===1?O.dec(p.fallback):void 0}};if(p.type.tag==="plain")return v(0,f,n(p.type.value).dec);const{key:y,value:b,hashers:w}=p.type.value,x=n(b),m=w.map(S=>Uo[S.tag]),E=(()=>{if(m.length===1)return[[n(y),m[0]]];const S=e(y);switch(S.type){case"array":return m.map(A=>[n(S.value.id),A]);case"tuple":return S.value.map((A,O)=>[n(A.id),m[O]]);default:throw new Error("Invalid key type")}})();return v(m.length,f,x.dec,...E)},a=d=>{switch(d.type){case"void":return T;case"lookupEntry":return n(d.value.id);case"tuple":return te(...Object.values(d.value).map(f=>n(f.id)));case"struct":return C(kn(d.value,f=>n(f.id)));case"array":return P(n(d.value.id),d.len)}},c=(d,f)=>{const h=t.pallets.find(p=>p.name===d).constants.find(p=>p.name===f);return n(h.type)},u=d=>(f,h)=>{const p=t.pallets.find(b=>b.name===f),v=e(p[d]);if(v.type!=="enum")throw null;const y=v.value[h];return{location:[p.index,y.idx],codec:a(v.value[h])}},l=(d,f)=>{const h=t.apis.find(p=>p.name===d)?.methods.find(p=>p.name===f);if(!h)throw null;return{args:te(...h.inputs.map(p=>n(p.type))),value:n(h.output)}};return{buildDefinition:n,buildStorage:s,buildEvent:u("events"),buildError:u("errors"),buildRuntimeCall:l,buildCall:u("calls"),buildConstant:c,ss58Prefix:o}},Nu=ie(be.enc(15)),el=te(V,W()),tl=Q(W()),nl=P(be).dec,rl=(e,t)=>{const n=r=>{const o=(c,u,l)=>e(c,u,l).pipe(cn(d=>{if(d instanceof tr)return t.pipe(Ae(1),er(f=>o(f,u,l)));throw d})),i=o(r,"Metadata_metadata_versions","").pipe(I(nl)),s=o(r,"Metadata_metadata","").pipe(I(c=>{const[,u]=el.dec(c);return{metadata:et.dec(u).metadata.value,metadataRaw:u}})),a=o(r,"Metadata_metadata_at_version",Nu).pipe(I(c=>{const u=tl.dec(c);return{metadata:et.dec(u).metadata.value,metadataRaw:u}}));return i.pipe(cn(()=>ee([14])),z(c=>c.includes(15)?a:s))};return r=>{const o=new Set([r]),i=n(r).pipe(I(({metadata:a,metadataRaw:c})=>{const u=Ku(a),l=Pi(u),d=l.buildStorage("System","Events"),f=a.extrinsic.signedExtensions.find(p=>p.identifier==="ChargeAssetTxPayment");let h=null;if(f){const p=u(f.type);if(p.type==="struct"){const v=p.value.asset_id;v.type==="option"&&(h=v.value.id)}}return{assetId:h,metadataRaw:c,lookup:u,dynamicBuilder:l,events:{key:d.enc(),dec:d.dec},accountId:at(l.ss58Prefix)}}),Ou(1)),s={at:r,runtime:i,addBlock:a=>(o.add(a),s),deleteBlocks:a=>(a.forEach(c=>{o.delete(c)}),o.size),usages:o};return i.subscribe({error(){}}),s}},Tt=$t({connector:()=>new rn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0}),Li=(e,t)=>{e.get(e.get(t).parent)?.children.delete(t),e.delete(t)},ol=(e,t)=>{const n=[...t];let r=e.blocks.get(e.blocks.get(e.finalized).parent);const o=[];for(;r;)o.push(r.hash),r.refCount===0&&!r.unpinned&&(n.push(r.hash),r.unpinned=!0),r=e.blocks.get(r.parent);const i=[...t];for(let s=o.length-1;s>=0&&(r=e.blocks.get(o[s]),!!r.unpinned);s--)i.push(r.hash);return i.forEach(s=>{Li(e.blocks,s)}),Object.entries(e.runtimes).map(([s,a])=>({key:s,usages:a.deleteBlocks(i)})).filter(s=>s.usages===0).map(s=>s.key).forEach(s=>{delete e.runtimes[s]}),n},il=(e,t,n,r,o)=>{const i=xi(r,e.pipe(sl(t),Oi())).pipe(Si((a,c)=>{switch(c.type){case"initialized":a.recovering&&(c.finalizedBlockHashes.some(h=>a.blocks.has(h))||(a=Ui()));const[u]=c.finalizedBlockHashes.slice(-1);a.finalized=a.best=u;const l=c.finalizedBlockHashes.length-1;c.finalizedBlockHashes.forEach((f,h)=>{a.blocks.has(f)?a.blocks.get(f).recovering=!1:a.blocks.set(f,{hash:f,parent:h===0?c.parentHash:c.finalizedBlockHashes[h-1],children:new Set(h===l?[]:[c.finalizedBlockHashes[h+1]]),runtime:f,refCount:0,number:c.number+h,recovering:!1})});const d=Object.values(a.runtimes).find(f=>f.usages.has(u));return a.finalizedRuntime=d??(a.runtimes[u]=s(u)),a;case"stop-error":for(const f of a.blocks.values())f.recovering=!0;return a.recovering=!0,a;case"newBlock":{const{parentBlockHash:f,blockHash:h}=c;if(a.blocks.has(h))a.blocks.get(h).recovering=!1;else{const p=a.blocks.get(f);p.children.add(h),c.newRuntime&&(a.runtimes[h]=s(h),a.runtimes[h].runtime.subscribe());const v={hash:h,number:p.number+1,parent:f,children:new Set,runtime:c.newRuntime?h:p.runtime,refCount:0,recovering:!1};a.blocks.set(h,v),a.runtimes[v.runtime].addBlock(h)}return a}case"bestBlockChanged":{if(a.recovering){for(const[f,h]of a.blocks)h.recovering&&Li(a.blocks,f);a.recovering=!1}return a.best=c.bestBlockHash,a}case"finalized":{a.finalized=c.finalizedBlockHashes.slice(-1)[0];const{blocks:f}=a;return f.get(a.best).number<f.get(a.finalized).number&&(a.best=a.finalized),a.finalizedRuntime=a.runtimes[f.get(a.finalized).runtime],o(ol(a,c.prunedBlockHashes)),a}case"blockUsage":{if(!a.blocks.has(c.value.hash))return a;const f=a.blocks.get(c.value.hash);return f.refCount+=c.value.type==="hold"?1:-1,f.refCount===0&&f.number<a.blocks.get(a.finalized).number&&!f.recovering&&(f.unpinned=!0,o([f.hash])),a}}},Ui()),Ge(a=>!!a.finalizedRuntime.runtime),I(a=>({...a})),Tt),s=rl(un(i,n),i.pipe(I(a=>a.finalized)));return i},Ui=()=>({best:"",finalized:"",runtimes:{},blocks:new Map,finalizedRuntime:{},recovering:!1}),sl=e=>t=>t.pipe(Ei(n=>n.type!=="initialized"?ee(n):e(n.finalizedBlockHashes[0]).then(r=>({...n,number:r.number,parentHash:r.parentHash})))),Ri=(e,t,n,r)=>{const o=a=>Cu(e.pipe(Ge(({blocks:c})=>!c.has(a)))),i=(a,c,u)=>{if(u)return ee({hash:a,found:{type:!1,validity:null}});const l=o(a);return t(a).pipe(z(d=>{const f=d.indexOf(c);return f>-1?l(r(a)).pipe(I(h=>({hash:a,found:{type:!0,index:f,events:h}}))):n(a,c).pipe(I(h=>({hash:a,found:{type:!1,validity:h}})))}),l)},s=(a,c,u)=>i(a,c,u.has(a)).pipe(z(l=>{const{found:d}=l;return d.type||d.validity?.success===!1?ee(l):e.pipe(o(a),z(f=>f.blocks.get(a).children),Bu(),z(f=>s(f,c,u)))}));return a=>e.pipe(Ae(1),z(c=>s(c.finalized,a,new Set(c.blocks.keys()))))},al=new Uint8Array([2]),cl=(e,t)=>ie(de(al,ge(e),ge(t))),Mi="TaggedTransactionQueue",zi="validate_transaction",ul=(e,t)=>(n,r)=>{const o=t(n).pipe(I(i=>i.dynamicBuilder.buildRuntimeCall(Mi,zi).value[1]));return e(n,`${Mi}_${zi}`,cl(r,n)).pipe(Tu(o),I(([i,s])=>s(i)))},ll=e=>t=>new $(n=>{let r=!1;const o=t.subscribe({next(i){r=!0,n.next(i)},error(i){n.error(i)},complete(){n.complete()}});return r||n.next(e),o}),fl=(e,t=1/0)=>n=>new $(r=>{let o;const i=new Map,s=new Map,a=new Map;let c=0,u=0,l=0;const d=()=>{const f=i.get(u);if(!f){s.size===0&&(typeof o>"u"||o.closed)&&r.complete();return}const h=u++;i.delete(h),l!==h&&a.set(h,[]),s.set(h,f.subscribe({next(p){l===h?r.next(p):a.get(h).push(p)},complete(){if(s.delete(h),h===l)for(l++;a.has(l)&&(a.get(l).forEach(p=>r.next(p)),a.delete(l),!s.has(l));)l++;d()},error(p){r.error(p)}}))};return o=n.subscribe({next(f){const h=c++;i.set(h,Qn(()=>e(f,h))),s.size<t&&d()},error(f){r.error(f)},complete(){s.size===0&&r.complete()}}),()=>{s.forEach(f=>f.unsubscribe()),o.unsubscribe(),i.clear(),a.clear()}}),rr=({hash:e,number:t,parent:n})=>({hash:e,number:t,parent:n}),hl=e=>{const{getFollower:t,unfollow:n,follow$:r}=Fu(e),o=zu(t),{withRecovery:i,withRecoveryFn:s}=Ru(),a=new nn,c=k=>(B,...R)=>new $(F=>{a.next({type:"blockUsage",value:{type:"hold",hash:B}});const ve=k(B,...R).subscribe(F);return()=>{setTimeout(()=>{a.next({type:"blockUsage",value:{type:"release",hash:B}})},0),ve.unsubscribe()}}),u=k=>(B,...R)=>new $(F=>{let ve=!1;return y.pipe(Ae(1)).subscribe(Ie=>{const ae=Ie.blocks.get(B);ve=!!ae&&!ae.unpinned}),ve?k(B,...R).subscribe(F):F.error(new tr)}),l=k=>t().header(k).then(bo.dec),d=k=>t().unpin(k).catch(B=>{if(!(B instanceof Yt))throw B}),f=k=>u(c((R=>Vu(y,r,R))(un(y,nr(s(Bi(k))))))),h=(k,B=!0)=>(R,...F)=>k(R,B,...F),p=nr(s(Bi(o("call")))),v=new Map,y=il(r,l,c(p),a,k=>{d(k),k.forEach(B=>{v.delete(B)})}),b=c(k=>y.pipe(Ae(1),z(B=>B.runtimes[B.blocks.get(k).runtime].runtime))),w=k=>B=>B.pipe(fl(R=>b(k(R)).pipe(I(F=>[R,F])))),x=(k,B,R)=>{const F=v.get(k)??new Map,ve=F.get(B);if(ve)return ve;v.set(k,F);const Ie=new rn,ae=R.pipe($t({connector:()=>Ie}),$u({complete(){F.set(B,Ie)}}));return F.set(B,ae),ae},m=y.pipe(ke((k,B)=>k.finalized===B.finalized),I(k=>rr(k.blocks.get(k.finalized))),Tt),E=y.pipe(ke((k,B)=>k.best===B.best),I(k=>rr(k.blocks.get(k.best))),Tt),S=y.pipe(ke((k,B)=>k.finalized===B.finalized&&k.best===B.best),Si((k,B)=>{const R=fe=>k.get(fe)||rr(B.blocks.get(fe)),F=R(B.best),ve=R(B.finalized),Ie=F.number-ve.number+1,ae=new Array(Ie);for(let fe=0,Lt=F.hash;fe<Ie;fe++)ae[fe]=R(Lt),Lt=ae[fe].parent;return new Map(ae.map(fe=>[fe.hash,fe]))},new Map),I(k=>[...k.values()]),Tt),A=y.pipe(ke((k,B)=>k.finalizedRuntime===B.finalizedRuntime),er(({finalizedRuntime:{runtime:k}})=>k.pipe(ll(null))),Tt),O=A.pipe(I(k=>k?.lookup.metadata??null)),D=Mu(m.pipe(I(k=>k.hash)),E.pipe(I(k=>k.hash))),G=f(o("body")),se=k=>x(k,"body",G(k,!0)),Ye=f(o("storage")),hn=D((k,B,R,F,ve=null,Ie)=>y.pipe(Ae(1),z(ae=>ae.runtimes[ae.blocks.get(k).runtime].runtime),z(ae=>{const fe=F(ae),Lt=x(k,`storage-${R}-${fe}-${ve??""}`,Ye(k,B,R,fe,ve));return Ie?x(k,`storage-${R}-${fe}-${ve??""}-dec`,Lt.pipe(I(of=>Ie(of,ae)))):Lt}))),fr=Xu(t,i),hr=nr(D(c(un(y,(k,B,R)=>fr(k,B,R??null,!1))))),ef=D(c(un(y,k=>Qn(()=>l(k)))));xi(A,S).subscribe({error(){}});const Ji=(k,B=!1)=>hn(k,B,"value",R=>R.events.key,null,(R,F)=>F.events.dec(R)),tf=f(o("call")),Qi=D((k,B,R,F)=>x(k,`call-${R}-${F}`,tf(k,B,R,F))),dr=ul(h(Qi,!1),b),Ni=k=>x(k,"body",G(k,!1)),nf=Ri(y,Ni,dr,Ji),rf=Ri(y,Ni,dr,()=>ee());return{follow$:r,finalized$:m,best$:E,bestBlocks$:S,runtime$:A,metadata$:O,header$:ef,body$:se,call$:h(Qi),storage$:h(hn),storageQueries$:hr,eventsAt$:h(Ji),trackTx$:nf,trackTxWithoutEvents$:rf,validateTx$:dr,pinnedBlocks$:y,withRuntime:w,getRuntimeContext$:D(b),unfollow:n}};var dl=e=>t=>new $(n=>e(t,r=>{n.error(r)}));const pl=({chainHead:e,transaction:t,destroy:n})=>({chainHead$:()=>hl(e),broadcastTx$:dl(t),destroy:n});class dt{constructor(){}_runtime(t){}}class Di{constructor(){}_compatibility(t){}}const ln=new WeakMap,Hi=new WeakMap,or=e=>e instanceof dt?Hi.get(e):ln.get(e);var pt=(e=>(e.Storage="storage",e.Tx="tx",e.Event="events",e.Const="constants",e))(pt||{});const vl=P(cc),yl=P(Un),bl=te(vl,yl),ml=(e,t)=>{const n=new Promise(async r=>{const o=t.runtime$.pipe(Ge(s=>s!=null));let i=await we(o);o.subscribe(s=>i=s),r(()=>i)});return Promise.all([e.metadataTypes.then(bl.dec),e.descriptors,n]).then(([[r,o],i,s])=>{const a=new Di;return ln.set(a,{runtime:s,getPalletEntryPoint(c,u,l){return r[i[c][u][l]]},getApiEntryPoint(c,u){return r[i.apis[c][u]]},typedefNodes:o}),a})},gl=e=>new Promise(async t=>{const n=e.runtime$.pipe(Ge(o=>o!=null));let r=await we(n);n.subscribe(o=>r=o),t(()=>r)}).then(t=>{const n=new dt;return Hi.set(n,{runtime:t}),n}),ir=new WeakMap,Fi=e=>(ir.has(e.metadataRaw)||ir.set(e.metadataRaw,{compat:new Map,lookup:e.lookup,typeNodes:[]}),ir.get(e.metadataRaw)),vt=(e,t,n)=>{const r=(c,u)=>{var l;const d=Fi(c);return(l=d.typeNodes)[u]||(l[u]=Ot(d.lookup(u)))};function o(c,u){if(c instanceof dt)return{args:Se.Identical,values:Se.Identical};const l=ln.get(c);u||(u=l.runtime());const d=t(l),f=n(u),h=l.typedefNodes,p=Fi(u);return dc(d,v=>h[v],f,v=>r(u,v),p.compat)}const i=ji(e,c=>Vi(o(c))),s=ji(e,(c,u)=>i(u)>=c),a=()=>e;return{isCompatible:s,getCompatibilityLevel:i,getCompatibilityLevels:o,waitDescriptors:a,withCompatibleRuntime:(c,u)=>l=>an([l.pipe(c.withRuntime(u)),a()]).pipe(I(([[d,f],h])=>[d,h,f])),compatibleRuntime$:(c,u)=>an([a(),c.getRuntimeContext$(u)]),argsAreCompatible:(c,u,l)=>{if(c instanceof dt)return!0;const d=o(c,u);if(d.args===Se.Incompatible)return!1;if(d.args>Se.Partial)return!0;if(d.values===Se.Incompatible)return!1;const f=n(u);return Ho(f.args,h=>r(u,h),l)},valuesAreCompatible:(c,u,l)=>{if(c instanceof dt)return!0;const d=o(c,u).values;if(d===Se.Incompatible)return!1;if(d>Se.Partial)return!0;const f=ln.get(c),h=t(f);return Ho(h.values,p=>f.typedefNodes[p],l)},getRuntimeTypedef:r}},Vi=e=>Math.min(e.args,e.values),ji=(e,t)=>(...n)=>{const r=n.at(-1);return r instanceof Di||r instanceof dt?t(...n):e.then(o=>t(...n,o))},wl=(e,t,{valuesAreCompatible:n,waitDescriptors:r,isCompatible:o,getCompatibilityLevel:i})=>{const s=new WeakMap,a=u=>{if(s.has(u))return s.get(u);const l=u.lookup.metadata.pallets.find(f=>f.name===e)?.constants.find(f=>f.name===t);if(l==null)throw new Error(`Runtime entry Constant(${e}.${t}) not found`);const d=u.dynamicBuilder.buildConstant(e,t).dec(l.value);return s.set(u,d),d},c=u=>{if(u){const l=or(u).runtime(),d=a(l);if(!n(u,l,d))throw new Error(`Incompatible runtime entry Constant(${e}.${t})`);return d}return r().then(c)};return Object.assign(c,{isCompatible:o,getCompatibilityLevel:i})},kl=$t({connector:()=>new rn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0});function sr(e,t){return new Promise((n,r)=>{let o=null,i=!1;const s=t?()=>{o?.unsubscribe(),r(new Gr)}:We;o=e.subscribe({next:a=>{n(a),o?.unsubscribe(),i=!0},error:a=>{t?.removeEventListener("abort",s),r(a)},complete:()=>{t?.removeEventListener("abort",s),r(new Error("Observable completed without emitting"))}}),i||t?.addEventListener("abort",s)})}const xl=(e,t=1/0)=>n=>new $(r=>{let o;const i=new Map,s=new Map,a=new Map;let c=0,u=0,l=0;const d=()=>{const f=i.get(u);if(!f){s.size===0&&(typeof o>"u"||o.closed)&&r.complete();return}const h=u++;i.delete(h),l!==h&&a.set(h,[]),s.set(h,f.subscribe({next(p){l===h?r.next(p):a.get(h).push(p)},complete(){if(s.delete(h),h===l)for(l++;a.has(l)&&(a.get(l).forEach(p=>r.next(p)),a.delete(l),!s.has(l));)l++;d()},error(p){r.error(p)}}))};return o=n.subscribe({next(f){const h=c++;i.set(h,Qn(()=>e(f,h))),s.size<t&&d()},error(f){r.error(f)},complete(){s.size===0&&r.complete()}}),()=>{s.forEach(f=>f.unsubscribe()),o.unsubscribe(),i.clear(),a.clear()}}),El=(e,t)=>n=>new $(r=>{let o=new Array,i=!1;const s=c=>{const u=new rt;o.push(u),o.length>t&&(o[0].unsubscribe(),o=o.slice(1));const l=e(c).subscribe({next(d){const f=o.indexOf(u);o.slice(0,f).forEach(h=>h.unsubscribe()),o=o.slice(f),r.next(d)},error(d){r.error(d)},complete(){const d=o.indexOf(u);o.splice(d,1),o.length===0&&i&&r.complete()}});u.add(l)},a=n.subscribe({next(c){s(c)},error(c){r.error(c)},complete(){o.length===0&&r.complete(),i=!0}});return()=>{a.unsubscribe(),o.forEach(c=>c.unsubscribe())}});let qi={};const Sl=e=>t=>new $(n=>{let r=qi,o=t.subscribe({next(i){n.next(r=i)},error(i){n.error(i)},complete(){r===qi?n.complete():o=e(r).subscribe(n)}});return()=>{o.unsubscribe()}}),ar=e=>typeof e=="object"&&e!==null&&Object.entries(e).every(([t,n])=>t==="at"&&(n===void 0||typeof n=="string")||t==="signal"&&(n===void 0||n instanceof AbortSignal)),Al=(e,t,n,{isCompatible:r,getCompatibilityLevel:o,withCompatibleRuntime:i,argsAreCompatible:s,valuesAreCompatible:a})=>{const c=()=>new Error(`Incompatible runtime entry Event(${e}.${t})`),u=n.finalized$.pipe(i(n,l=>l.hash),I(([l,d,f])=>{const h=f.lookup.metadata.pallets.find(p=>p.name===e)?.events;if(h==null||f.lookup.metadata.lookup[h].def.tag!=="variant"||f.lookup.metadata.lookup[h].def.value.find(p=>p.name===t)==null)throw new Error(`Runtime entry Event(${e}.${t}) not found`);if(!s(d,f,null))throw c();return[l,d,f]}),xl(([l,d,f])=>n.eventsAt$(l.hash).pipe(I(h=>h.filter(p=>p.event.type===e&&p.event.value.type===t).map(p=>{if(!a(d,f,p.event.value.value))throw c();return{meta:{phase:p.phase,block:l},payload:p.event.value.value}})))),kl);return{watch:l=>u.pipe(z(d=>l?d.filter(f=>l(f.payload)):d)),pull:()=>we(u),filter:l=>l.filter(d=>d.type===e&&d.value.type===t).map(d=>d.value.value),getCompatibilityLevel:o,isCompatible:r}},Il=(e,t,n,{isCompatible:r,getCompatibilityLevel:o,compatibleRuntime$:i,argsAreCompatible:s,valuesAreCompatible:a})=>{const c=`${e}_${t}`,u=()=>new Error(`Incompatible runtime entry RuntimeCall(${c})`);return Object.assign((...l)=>{const d=l[l.length-1],f=ar(d),{signal:h,at:p}=f?d:{},v=p??null,y=i(n,v).pipe(z(([b,w])=>{let x;try{x=w.dynamicBuilder.buildRuntimeCall(e,t)}catch{throw new Error(`Runtime entry RuntimeCall(${c}) not found`)}if(!s(b,w,l))throw u();return n.call$(v,c,ie(x.args.enc(l))).pipe(I(x.value.dec),I(m=>{if(!a(b,w,m))throw u();return m}))}));return sr(y,h)},{getCompatibilityLevel:o,isCompatible:r})},Bl=(e,t,n,{isCompatible:r,getCompatibilityLevel:o,getCompatibilityLevels:i,waitDescriptors:s,withCompatibleRuntime:a,argsAreCompatible:c,valuesAreCompatible:u})=>{const l=e==="System"&&t==="Number",d=()=>new Error(`Incompatible runtime entry Storage(${e}.${t})`),f=y=>new Error(`Invalid Arguments calling ${e}.${t}(${y})`),h=y=>{try{return y.dynamicBuilder.buildStorage(e,t)}catch{throw new Error(`Runtime entry Storage(${e}.${t}) not found`)}},p=(...y)=>{const b=y[y.length-1],w=b==="best"||b==="finalized"?y.slice(0,-1):y;return l?n.bestBlocks$.pipe(I(x=>x.at(b==="best"?0:-1).number),ke()):n[b==="best"?"best$":"finalized$"].pipe(Iu(0),a(n,x=>x.hash),El(([x,m,E])=>{const S=h(E);if(!c(m,E,w))throw d();return n.storage$(x.hash,"value",()=>S.enc(...w)).pipe(I(A=>{if(!u(m,E,A))throw d();return{val:A,codecs:S}}))},4),ke((x,m)=>x.val===m.val),I(({val:x,codecs:m})=>x===null?m.fallback:m.dec(x)))},v=async(...y)=>{const b=y[y.length-1],w=ar(b),{signal:x,at:m}=w?b:{},E=m??null;let S;if(l)S=n.bestBlocks$.pipe(I(A=>E==="finalized"||!E?A.at(-1):E==="best"?A.at(0):A.find(O=>O.hash===E)),I(A=>{if(!A)throw new _i;return A.number}),ke());else{const A=await s();S=n.storage$(E,"value",O=>{const D=h(O),G=y.length===D.len?y:y.slice(0,-1);if(y!==G&&!w)throw f(y);if(!c(A,O,G))throw d();return D.enc(...G)},null,(O,D)=>{const G=h(D),se=O===null?G.fallback:G.dec(O);if(!u(A,D,se))throw d();return se})}return sr(S,x)};return{isCompatible:r,getCompatibilityLevel:o,getValue:v,getValues:(y,b)=>Promise.all(y.map(w=>v(...b?[...w,b]:w))),getEntries:async(...y)=>{const b=y[y.length-1],w=ar(b),{signal:x,at:m}=w?b:{},E=m??null,S=await s(),A=n.storage$(E,"descendantsValues",O=>{const D=h(O);if(Vi(i(S,O))===Se.Incompatible)throw d();if(y.length>D.len)throw f(y);const G=y.length>0&&w?y.slice(0,-1):y;if(y.length===D.len&&G===y)throw f(y);return D.enc(...G)},null,(O,D)=>{const G=h(D);if(O.some(({value:se})=>!u(S,D,se)))throw d();return O.map(({key:se,value:Ye})=>({keyArgs:G.keyDecoder(se),value:G.dec(Ye)}))});return sr(A,x)},watchValue:p}},_l=bt(q.enc,e=>+!!e.signed<<7|e.version),Ol={Ed25519:0,Sr25519:1,Ecdsa:2},[fn,Pt]=["<Bytes>","</Bytes>"].map(e=>ze.fromText(e).asBytes());function Cl(e,t,n){return{publicKey:e,signTx:async(i,s,a,c,u=On)=>{let l;try{const b=Ao(a);if(b.metadata.tag!=="v14"&&b.metadata.tag!=="v15")throw null;l=b.metadata.value}catch{throw new Error("Unsupported metadata version")}const{version:d}=l.extrinsic,f=[],h=[];l.extrinsic.signedExtensions.map(({identifier:b})=>{const w=s[b];if(!w)throw new Error(`Missing ${b} signed extension`);f.push(w.value),h.push(w.additionalSigned)});const p=de(i,...f,...h),v=await n(p.length>256?u(p):p),y=de(_l({signed:!0,version:d}),new Uint8Array([0,...e]),new Uint8Array([Ol[t],...v]),...f,i);return de(V.enc(y.length),y)},signBytes:async i=>{let s=!0,a;for(a=0;s&&a<fn.length;a++)s=fn[a]===i[a];s=s&&a===fn.length;const c=i.length-Pt.length;for(a=0;s&&a<Pt.length;a++)s=Pt[a]===i[c+a];return s=s&&a===Pt.length,n(s?i:de(fn,i,Pt))}}}const Ke=new Uint8Array,$l=Ln("System")("BlockHash",We,[be,Pn]).enc(0),Wi=e=>e.chainHead.storage$(e.at,"value",()=>$l,null).pipe(I(t=>ge(t))),Xi=(e,t)=>{const n=Pi(t),r=t.metadata.pallets.find(a=>a.name==="System").constants.find(a=>a.name==="Version"),o=t(r.type),i=n.buildDefinition(r.type).dec;if(o.type!=="struct")throw new Error("not a struct");const s=n.buildDefinition(o.value[e].id).enc;return ee(s(i(r.value)[e]))},Tl=e=>ee({value:Qr.enc(e),additionalSigned:Ke});function Pl(e){let t=0;for(;!(e&1);)t++,e>>=1;return t}const Ll=bt(W(2).enc,e=>{const t=Math.max(e.period>>12,1),n=Math.min(Math.max(Pl(e.period)-1,1),15),r=e.phase/t<<4;return Ze.enc(n|r)}),Ul=new Uint8Array([0]),Rl=(e,t)=>{if(!e)return Wi(t).pipe(I(o=>({additionalSigned:o,value:Ul})));const{period:n,blockNumber:r}=e;return ee({additionalSigned:ge(t.at),value:Ll({period:n,phase:r%n})})},Ml=C({tip:V,asset:Q(W(1/0))}).enc,zl=(e,t)=>ee({value:Ml({tip:e,asset:t}),additionalSigned:Ke}),Dl=e=>Wi(e).pipe(I(t=>({value:Ke,additionalSigned:t}))),Hl=()=>ee({value:Uint8Array.from([0]),additionalSigned:Uint8Array.from([0])}),Gi="AccountNonceApi_account_nonce",Fl={1:q.dec,2:Ze.dec,4:be.dec,8:mt.dec},cr=e=>ee({value:V.enc(e),additionalSigned:Ke});var Vl=Object.freeze({__proto__:null,CheckGenesis:Dl,CheckMetadataHash:Hl,CheckNonce:e=>e.chainHead.call$(e.at,Gi,ie(e.from)).pipe(z(t=>{const n=ge(t),r=Fl[n.length];if(!r)throw new Error(`${Gi} retrieved wrong data`);return cr(r(n))})),CheckSpecVersion:({lookupFn:e})=>Xi("spec_version",e).pipe(I(t=>({additionalSigned:t,value:Ke}))),CheckTxVersion:({lookupFn:e})=>Xi("transaction_version",e).pipe(I(t=>({additionalSigned:t,value:Ke}))),getNonce:cr});const jl=(e,t,n,r,o={})=>e.getRuntimeContext$(r.hash).pipe(Ae(1),z(i=>{const s={lookupFn:i.lookup,chainHead:e,callData:n,at:r.hash,from:t.publicKey},a=o.mortality?o.mortality.mortal?{period:o.mortality.period,blockNumber:r.number}:void 0:{period:64,blockNumber:r.number};return an(i.lookup.metadata.extrinsic.signedExtensions.map(({identifier:c,type:u,additionalSigned:l})=>{if(c==="CheckMortality")return Rl(a,s);if(c==="ChargeTransactionPayment")return Tl(o.tip??0n);if(c==="ChargeAssetTxPayment")return zl(o.tip??0n,o.asset);if(c==="CheckNonce"&&"nonce"in o)return cr(o.nonce);const d=Vl[c];if(!d){if(i.dynamicBuilder.buildDefinition(u)===T&&i.dynamicBuilder.buildDefinition(l)===T)return ee({value:Ke,additionalSigned:Ke});throw new Error(`Unsupported signed-extension: ${c}`)}return d(s)})).pipe(z(c=>t.signTx(n,Object.fromEntries(i.lookup.metadata.extrinsic.signedExtensions.map(({identifier:u},l)=>[u,{identifier:u,...c[l]}])),i.metadataRaw,r.number)))}));var ql=Object.defineProperty,Wl=(e,t,n)=>t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xl=(e,t,n)=>Wl(e,t+"",n);const Gl=e=>ie(On(ge(e))),Kl=(e,t)=>new $(n=>{const r=new Map;let o,i;const s=()=>{let c=o.best,u=r.get(c),l=o.blocks.get(c).number;for(;!u;){const h=o.blocks.get(c);if(!h)break;u=r.get(c=h.parent),l--}if(!u)return;const d=l<=o.blocks.get(o.finalized).number,f=u.found.type;if(f&&i?.found&&i.hash===u.hash){d&&n.complete();return}n.next(i=u.found.type?{found:f,hash:u.hash,number:l,index:u.found.index,events:u.found.events}:{found:f,validity:u.found.validity}),d&&(f?n.complete():u.found.validity?.success===!1&&n.error(new ur(u.found.validity.value)))},a=t.pipe(ke((c,u)=>c.finalized===u.finalized&&c.best===u.best)).subscribe({next:c=>{o=c,r.size!==0&&s()},error(c){n.error(c)}});return a.add(e.subscribe({next:c=>{r.set(c.hash,c),s()},error(c){n.error(c)}})),a}).pipe(ke((n,r)=>n===r)),Yl=(e,t)=>{const n=e.filter(o=>o.phase.type==="ApplyExtrinsic"&&o.phase.value===t).map(o=>o.event),r=n[n.length-1];return r.type==="System"&&r.value.type==="ExtrinsicFailed"?{ok:!1,events:n,dispatchError:r.value.value.dispatch_error}:{ok:!0,events:n}};class ur extends Error{constructor(t){super(JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r instanceof ze?r.asHex():r,2)),Xl(this,"error"),this.name="InvalidTxError",this.error=t}}const lr=(e,t,n,r,o=!1)=>{const i=Gl(n),s=(l,d)=>({type:l,txHash:i,...d}),a=e.pinnedBlocks$.pipe(Ae(1),I(l=>{const d=l.blocks.get(r);return d&&!d.unpinned?d.hash:l.finalized})).pipe(z(l=>e.validateTx$(l,n).pipe(Ge(d=>!d.success),I(d=>{throw new ur(d.value)})))),c=new $(l=>{const d=e.trackTx$(n).subscribe(l);return d.add(t(n).subscribe({error(f){l.error(f)}})),d}),u=Kl(c,e.pinnedBlocks$).pipe(I(l=>l.found?s("txBestBlocksState",{found:!0,block:{index:l.index,number:l.number,hash:l.hash},...Yl(l.events,l.index)}):s("txBestBlocksState",{found:!1,isValid:l.validity?.success!==!1})));return Eu(o?ee(s("signed",{})):on,a,ee(s("broadcasted",{})),u.pipe(Sl(({found:l,type:d,...f})=>l?ee(s("finalized",f)):on)))},Ki=async(e,t,n,r)=>cu(lr(e,t,n,r)).then(o=>{if(o.type!=="finalized")throw null;const i={...o};return delete i.type,i}),Zl=at().enc,Jl=new Uint8Array(64),Ql=()=>Jl,Yi=(e,t,n,r,{isCompatible:o,getCompatibilityLevel:i,compatibleRuntime$:s,argsAreCompatible:a,getRuntimeTypedef:c},u)=>Object.assign(l=>{const d=(m,E,S={})=>{const A=or(m).runtime(),{dynamicBuilder:O,assetId:D,lookup:G}=A;let se;try{se=O.buildCall(e,t)}catch{throw new Error(`Runtime entry Tx(${e}.${t}) not found`)}if(u&&!a(m,A,E))throw new Error(`Incompatible runtime entry Tx(${e}.${t})`);let Ye=S;if(S.asset){if(D==null||!Rn(S.asset,Ot(G(D)),hr=>c(A,hr)))throw new Error("Incompatible runtime asset");Ye={...S,asset:O.buildDefinition(D).enc(S.asset)}}const{location:hn,codec:fr}=se;return{callData:ze.fromBytes(de(new Uint8Array(hn),fr.enc(E))),options:Ye}},f=(m,E={})=>s(n,null).pipe(I(([S])=>d(S,m,E))),h=m=>m?d(m,l).callData:we(f(l).pipe(I(E=>E.callData))),p=(m,{...E},S)=>f(l,E).pipe(z(({callData:A,options:O})=>jl(n,m,A.asBytes(),S,O))),v=(m,{at:E,...S}={})=>(!E||E==="finalized"?n.finalized$:E==="best"?n.best$:n.bestBlocks$.pipe(I(A=>A.find(O=>O.hash===E)))).pipe(Ae(1),z(A=>A?p(m,S,A).pipe(I(O=>({tx:ie(O),block:A}))):Zn(()=>new Error(`Uknown block ${E}`)))),y=(m,E)=>we(v(m,E)).then(S=>S.tx),b=(m,E)=>we(v(m,E)).then(({tx:S,block:A})=>Ki(n,r,S,A.hash)),w=(m,E)=>v(m,E).pipe(z(({tx:S,block:A})=>lr(n,r,S,A.hash,!0))),x=async(m,E)=>{const S=Cl(m instanceof Uint8Array?m:Zl(m),"Sr25519",Ql),A=ge(await y(S,E)),O=ie(de(A,be.enc(A.length))),D=n.getRuntimeContext$(null).pipe(I(({dynamicBuilder:{buildRuntimeCall:se}})=>se("TransactionPaymentApi","query_info").value[1])),G=n.call$(null,"TransactionPaymentApi_query_info",O);return we(an([G,D]).pipe(I(([se,Ye])=>Ye(se))))};return{getPaymentInfo:x,getEstimatedFees:async(m,E)=>(await x(m,E)).partial_fee,decodedCall:{type:e,value:At(t,l)},getEncodedData:h,sign:y,signSubmitAndWatch:w,signAndSubmit:b}},{getCompatibilityLevel:i,isCompatible:o}),Zi=(e,t,n)=>{const r={},o=p=>new Proxy(r,{get(v,y){return p(y)}}),i=p=>{const v={};return o(y=>(v[y]||(v[y]={}),o(b=>(v[y][b]||(v[y][b]=p(y,b)),v[y][b]))))},s=(p,v)=>p.lookup.metadata.pallets.find(y=>y.name===v),a=i((p,v)=>Bl(p,v,t,vt(e,y=>y.getPalletEntryPoint(pt.Storage,p,v),y=>uc(s(y,p).storage.items.find(b=>b.name===v))))),c=(p,v,y,b)=>{const w=p.lookup(y);if(w.type!=="enum")throw new Error("Expected enum");const x=fc(w.value[b]);return{args:v==="args"?x:Gt,values:v==="args"?Gt:x}},u=i((p,v)=>Yi(p,v,t,n,vt(e,y=>y.getPalletEntryPoint(pt.Tx,p,v),y=>c(y,"args",s(y,p).calls,v)),!0)),l=i((p,v)=>Al(p,v,t,vt(e,y=>y.getPalletEntryPoint(pt.Event,p,v),y=>c(y,"values",s(y,p).events,v)))),d=i((p,v)=>wl(p,v,vt(e,y=>y.getPalletEntryPoint(pt.Const,p,v),y=>hc(s(y,p).constants.find(b=>b.name===v).type)))),f=i((p,v)=>Il(p,v,t,vt(e,y=>y.getApiEntryPoint(p,v),y=>lc(y.lookup.metadata.apis.find(b=>b.name===p).methods.find(b=>b.name===v))))),h=(p,v)=>{const{lookup:y,dynamicBuilder:b}=or(v).runtime();try{const w=b.buildDefinition(y.call).dec(p.asBytes()),x=w.type,m=w.value.type,E=w.value.value;return Yi(x,m,t,n,vt(e,S=>S.getPalletEntryPoint(pt.Tx,x,m),S=>c(S,"args",s(S,x).calls,m)),!1)(E)}catch{throw new Error("createTx: invalid call data")}};return{query:a,txFromCallData:(p,v)=>v?h(p,v):e.then(y=>h(p,y)),tx:u,event:l,apis:f,constants:d}};function Nl(e){const t=_c(e),n=pl(t),r=n.chainHead$(),{getChainSpecData:o}=t,i=t.request;let s;const a=new WeakMap,c=d=>{const f=a.get(d)||ml(d,r);return a.set(d,f),f},u=()=>s??(s=gl(r)),{broadcastTx$:l}=n;return{getChainSpecData:o,finalizedBlock$:r.finalized$,getFinalizedBlock:()=>we(r.finalized$),bestBlocks$:r.bestBlocks$,getBestBlocks:()=>we(r.bestBlocks$),watchBlockBody:r.body$,getBlockBody:d=>we(r.body$(d)),getBlockHeader:d=>we(r.header$(d??null)),submit:(...d)=>Ki(r,l,...d),submitAndWatch:(...d)=>lr(r,l,...d),getTypedApi:d=>{const f=c(d);return Object.assign(Zi(f,r,l),{compatibilityToken:f})},getUnsafeApi:()=>{const d=u();return Object.assign(Zi(d,r,l),{runtimeToken:d})},destroy:()=>{r.unfollow(),n.destroy()},_request:i}}he.AccountId=at,he.Binary=ze,he.CompatibilityLevel=Se,he.Enum=At,he.FixedSizeBinary=xn,he.InvalidTxError=ur,he._Enum=oo,he.createClient=Nl,he.getSs58AddressInfo=gn});
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function Nt(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ot=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=lt(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var l=this.initialTeardown;if(H(l))try{l()}catch(v){i=v instanceof qn?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=lt(d),h=f.next();!h.done;h=f.next()){var p=h.value;try{Jo(p)}catch(v){i=i??[],v instanceof qn?i=qe(qe([],je(i)),je(v.errors)):i.push(v)}}}catch(v){r={error:v}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}}if(i)throw new qn(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Jo(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Nt(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Nt(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),Yo=ot.EMPTY;function Zo(e){return e instanceof ot||e&&"closed"in e&&H(e.remove)&&H(e.add)&&H(e.unsubscribe)}function Jo(e){H(e)?e():e.unsubscribe()}var Qo={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Tc={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,qe([e,t],je(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function No(e){Tc.setTimeout(function(){throw e})}function We(){}function en(e){e()}var Wn=function(e){Le(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Zo(n)&&n.add(r)):r.destination=Rc,r}return t.create=function(n,r,o){return new ht(n,r,o)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ot),Pc=Function.prototype.bind;function Xn(e,t){return Pc.call(e,t)}var Lc=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){tn(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){tn(r)}else tn(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){tn(n)}},e}(),ht=function(e){Le(t,e);function t(n,r,o){var i=e.call(this)||this,s;if(H(n)||!n)s={next:n??void 0,error:r??void 0,complete:o??void 0};else{var a;i&&Qo.useDeprecatedNextContext?(a=Object.create(n),a.unsubscribe=function(){return i.unsubscribe()},s={next:n.next&&Xn(n.next,a),error:n.error&&Xn(n.error,a),complete:n.complete&&Xn(n.complete,a)}):s=n}return i.destination=new Lc(s),i}return t}(Wn);function tn(e){No(e)}function Uc(e){throw e}var Rc={closed:!0,next:We,error:Uc,complete:We},Gn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function it(e){return e}function Mc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ei(e)}function ei(e){return e.length===0?it:e.length===1?e[0]:function(n){return e.reduce(function(r,o){return o(r)},n)}}var $=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,i=Dc(t)?t:new ht(t,n,r);return en(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=ti(n),new n(function(o,i){var s=new ht({next:function(a){try{t(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});r.subscribe(s)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[Gn]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return ei(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=ti(t),new t(function(r,o){var i;n.subscribe(function(s){return i=s},function(s){return o(s)},function(){return r(i)})})},e.create=function(t){return new e(t)},e}();function ti(e){var t;return(t=e??Qo.Promise)!==null&&t!==void 0?t:Promise}function zc(e){return e&&H(e.next)&&H(e.error)&&H(e.complete)}function Dc(e){return e&&e instanceof Wn||zc(e)&&Zo(e)}function Hc(e){return H(e?.lift)}function J(e){return function(t){if(Hc(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function j(e,t,n,r,o){return new Fc(e,t,n,r,o)}var Fc=function(e){Le(t,e);function t(n,r,o,i,s,a){var c=e.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=r?function(u){try{r(u)}catch(l){n.error(l)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(l){n.error(l)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){n.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(Wn),Vc=jn(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),nn=function(e){Le(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new ni(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new Vc},t.prototype.next=function(n){var r=this;en(function(){var o,i;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=lt(r.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(n)}}catch(u){o={error:u}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;en(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var o=r.observers;o.length;)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;en(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Yo:(this.currentObservers=null,a.push(n),new ot(function(){r.currentObservers=null,Nt(a,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,o=r.hasError,i=r.thrownError,s=r.isStopped;o?n.error(i):s&&n.complete()},t.prototype.asObservable=function(){var n=new $;return n.source=this,n},t.create=function(n,r){return new ni(n,r)},t}($),ni=function(e){Le(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:Yo},t}(nn),Kn={now:function(){return(Kn.delegate||Date).now()},delegate:void 0},rn=function(e){Le(t,e);function t(n,r,o){n===void 0&&(n=1/0),r===void 0&&(r=1/0),o===void 0&&(o=Kn);var i=e.call(this)||this;return i._bufferSize=n,i._windowTime=r,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,n),i._windowTime=Math.max(1,r),i}return t.prototype.next=function(n){var r=this,o=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,a=r._timestampProvider,c=r._windowTime;o||(i.push(n),!s&&i.push(a.now()+c)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),c=0;c<a.length&&!n.closed;c+=i?1:2)n.next(a[c]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,o=n._timestampProvider,i=n._buffer,s=n._infiniteTimeWindow,a=(s?1:2)*r;if(r<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var c=o.now(),u=0,l=1;l<i.length&&i[l]<=c;l+=2)u=l;u&&i.splice(0,u+1)}},t}(nn),jc=function(e){Le(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t}(ot),ri={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,qe([e,t],je(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},qc=function(e){Le(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o.pending=!1,o}return t.prototype.schedule=function(n,r){var o;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,r)),this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(s,this.id,r),this},t.prototype.requestAsyncId=function(n,r,o){return o===void 0&&(o=0),ri.setInterval(n.flush.bind(n,this),o)},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return r;r!=null&&ri.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(n,r);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var o=!1,i;try{this.work(n)}catch(s){o=!0,i=s||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,o=n.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Nt(i,this),r!=null&&(this.id=this.recycleAsyncId(o,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(jc),oi=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=Kn.now,e}(),Wc=function(e){Le(t,e);function t(n,r){r===void 0&&(r=oi.now);var o=e.call(this,n,r)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var o;this._active=!0;do if(o=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,o){for(;n=r.shift();)n.unsubscribe();throw o}},t}(oi),ii=new Wc(qc),Xc=ii,on=new $(function(e){return e.complete()});function Gc(e){return e&&H(e.schedule)}function Yn(e){return e[e.length-1]}function si(e){return H(Yn(e))?e.pop():void 0}function sn(e){return Gc(Yn(e))?e.pop():void 0}function Kc(e,t){return typeof Yn(e)=="number"?e.pop():t}var ai=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function ci(e){return H(e?.then)}function ui(e){return H(e[Gn])}function li(e){return Symbol.asyncIterator&&H(e?.[Symbol.asyncIterator])}function fi(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Yc(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var hi=Yc();function di(e){return H(e?.[hi])}function pi(e){return Cc(this,arguments,function(){var n,r,o,i;return Ko(this,function(s){switch(s.label){case 0:n=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,ft(n.read())];case 3:return r=s.sent(),o=r.value,i=r.done,i?[4,ft(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,ft(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function vi(e){return H(e?.getReader)}function le(e){if(e instanceof $)return e;if(e!=null){if(ui(e))return Zc(e);if(ai(e))return Jc(e);if(ci(e))return Qc(e);if(li(e))return yi(e);if(di(e))return Nc(e);if(vi(e))return eu(e)}throw fi(e)}function Zc(e){return new $(function(t){var n=e[Gn]();if(H(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Jc(e){return new $(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function Qc(e){return new $(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,No)})}function Nc(e){return new $(function(t){var n,r;try{for(var o=lt(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}t.complete()})}function yi(e){return new $(function(t){tu(e,t).catch(function(n){return t.error(n)})})}function eu(e){return yi(pi(e))}function tu(e,t){var n,r,o,i;return Oc(this,void 0,void 0,function(){var s,a;return Ko(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=$c(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Xe(e,t,n,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var i=t.schedule(function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(i),!o)return i}function bi(e,t){return t===void 0&&(t=0),J(function(n,r){n.subscribe(j(r,function(o){return Xe(r,e,function(){return r.next(o)},t)},function(){return Xe(r,e,function(){return r.complete()},t)},function(o){return Xe(r,e,function(){return r.error(o)},t)}))})}function mi(e,t){return t===void 0&&(t=0),J(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function nu(e,t){return le(e).pipe(mi(t),bi(t))}function ru(e,t){return le(e).pipe(mi(t),bi(t))}function ou(e,t){return new $(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function iu(e,t){return new $(function(n){var r;return Xe(n,t,function(){r=e[hi](),Xe(n,t,function(){var o,i,s;try{o=r.next(),i=o.value,s=o.done}catch(a){n.error(a);return}s?n.complete():n.next(i)},0,!0)}),function(){return H(r?.return)&&r.return()}})}function gi(e,t){if(!e)throw new Error("Iterable cannot be null");return new $(function(n){Xe(n,t,function(){var r=e[Symbol.asyncIterator]();Xe(n,t,function(){r.next().then(function(o){o.done?n.complete():n.next(o.value)})},0,!0)})})}function su(e,t){return gi(pi(e),t)}function au(e,t){if(e!=null){if(ui(e))return nu(e,t);if(ai(e))return ou(e,t);if(ci(e))return ru(e,t);if(li(e))return gi(e,t);if(di(e))return iu(e,t);if(vi(e))return su(e,t)}throw fi(e)}function Ct(e,t){return t?au(e,t):le(e)}function ee(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=sn(e);return Ct(e,n)}function Zn(e,t){var n=H(e)?e:function(){return e},r=function(o){return o.error(n())};return new $(r)}var wi=jn(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function cu(e,t){return new Promise(function(n,r){var o=!1,i;e.subscribe({next:function(s){i=s,o=!0},error:r,complete:function(){o?n(i):r(new wi)}})})}function we(e,t){return new Promise(function(n,r){var o=new ht({next:function(i){n(i),o.unsubscribe()},error:r,complete:function(){r(new wi)}});e.subscribe(o)})}function uu(e){return e instanceof Date&&!isNaN(e)}function I(e,t){return J(function(n,r){var o=0;n.subscribe(j(r,function(i){r.next(e.call(t,i,o++))}))})}var lu=Array.isArray;function fu(e,t){return lu(t)?e.apply(void 0,qe([],je(t))):e(t)}function hu(e){return I(function(t){return fu(e,t)})}var du=Array.isArray,pu=Object.getPrototypeOf,vu=Object.prototype,yu=Object.keys;function bu(e){if(e.length===1){var t=e[0];if(du(t))return{args:t,keys:null};if(mu(t)){var n=yu(t);return{args:n.map(function(r){return t[r]}),keys:n}}}return{args:e,keys:null}}function mu(e){return e&&typeof e=="object"&&pu(e)===vu}function gu(e,t){return e.reduce(function(n,r,o){return n[r]=t[o],n},{})}function an(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=sn(e),r=si(e),o=bu(e),i=o.args,s=o.keys;if(i.length===0)return Ct([],n);var a=new $(wu(i,n,s?function(c){return gu(s,c)}:it));return r?a.pipe(hu(r)):a}function wu(e,t,n){return n===void 0&&(n=it),function(r){ki(t,function(){for(var o=e.length,i=new Array(o),s=o,a=o,c=function(l){ki(t,function(){var d=Ct(e[l],t),f=!1;d.subscribe(j(r,function(h){i[l]=h,f||(f=!0,a--),a||r.next(n(i.slice()))},function(){--s||r.complete()}))},r)},u=0;u<o;u++)c(u)},r)}}function ki(e,t,n){e?Xe(n,e,t):t()}function ku(e,t,n,r,o,i,s,a){var c=[],u=0,l=0,d=!1,f=function(){d&&!c.length&&!u&&t.complete()},h=function(v){return u<r?p(v):c.push(v)},p=function(v){u++;var y=!1;le(n(v,l++)).subscribe(j(t,function(b){t.next(b)},function(){y=!0},void 0,function(){if(y)try{u--;for(var b=function(){var w=c.shift();s||p(w)};c.length&&u<r;)b();f()}catch(w){t.error(w)}}))};return e.subscribe(j(t,h,function(){d=!0,f()})),function(){}}function z(e,t,n){return n===void 0&&(n=1/0),H(t)?z(function(r,o){return I(function(i,s){return t(r,i,o,s)})(le(e(r,o)))},n):(typeof t=="number"&&(n=t),J(function(r,o){return ku(r,o,e,n)}))}function Jn(e){return e===void 0&&(e=1/0),z(it,e)}function xu(){return Jn(1)}function Eu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xu()(Ct(e,sn(e)))}function Qn(e){return new $(function(t){le(e()).subscribe(t)})}function Su(e,t,n){return n===void 0&&(n=Xc),new $(function(r){var o=uu(e)?+e-n.now():e;o<0&&(o=0);var i=0;return n.schedule(function(){r.closed||(r.next(i++),r.complete())},o)})}function xi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=sn(e),r=Kc(e,1/0),o=e;return o.length?o.length===1?le(o[0]):Jn(r)(Ct(o,n)):on}function Ge(e,t){return J(function(n,r){var o=0;n.subscribe(j(r,function(i){return e.call(t,i,o++)&&r.next(i)}))})}function cn(e){return J(function(t,n){var r=null,o=!1,i;r=t.subscribe(j(n,void 0,void 0,function(s){i=le(e(s,cn(e)(t))),r?(r.unsubscribe(),r=null,i.subscribe(n)):o=!0})),o&&(r.unsubscribe(),r=null,i.subscribe(n))})}function Au(e,t,n,r,o){return function(i,s){var a=n,c=t,u=0;i.subscribe(j(s,function(l){var d=u++;c=a?e(c,l,d):(a=!0,l),s.next(c)},o))}}function Ei(e,t){return H(t)?z(e,t,1):z(e,1)}function Iu(e,t){return t===void 0&&(t=ii),J(function(n,r){var o=null,i=null,s=null,a=function(){if(o){o.unsubscribe(),o=null;var u=i;i=null,r.next(u)}};function c(){var u=s+e,l=t.now();if(l<u){o=this.schedule(void 0,u-l),r.add(o);return}a()}n.subscribe(j(r,function(u){i=u,s=t.now(),o||(o=t.schedule(c,e),r.add(o))},function(){a(),r.complete()},void 0,function(){i=o=null}))})}function Ae(e){return e<=0?function(){return on}:J(function(t,n){var r=0;t.subscribe(j(n,function(o){++r<=e&&(n.next(o),e<=r&&n.complete())}))})}function Bu(e,t){return J(function(n,r){var o=new Set;n.subscribe(j(r,function(i){var s=e?e(i):i;o.has(s)||(o.add(s),r.next(i))})),t&&le(t).subscribe(j(r,function(){return o.clear()},We))})}function ke(e,t){return t===void 0&&(t=it),e=e??_u,J(function(n,r){var o,i=!0;n.subscribe(j(r,function(s){var a=t(s);(i||!e(o,a))&&(i=!1,o=a,r.next(s))}))})}function _u(e,t){return e===t}function Si(e,t){return J(Au(e,t,arguments.length>=2,!0))}function $t(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new nn}:t,r=e.resetOnError,o=r===void 0?!0:r,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,c=a===void 0?!0:a;return function(u){var l,d,f,h=0,p=!1,v=!1,y=function(){d?.unsubscribe(),d=void 0},b=function(){y(),l=f=void 0,p=v=!1},w=function(){var x=l;b(),x?.unsubscribe()};return J(function(x,m){h++,!v&&!p&&y();var E=f=f??n();m.add(function(){h--,h===0&&!v&&!p&&(d=Nn(w,c))}),E.subscribe(m),!l&&h>0&&(l=new ht({next:function(S){return E.next(S)},error:function(S){v=!0,y(),d=Nn(b,o,S),E.error(S)},complete:function(){p=!0,y(),d=Nn(b,s),E.complete()}}),le(x).subscribe(l))})(u)}}function Nn(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var o=new ht({next:function(){o.unsubscribe(),e()}});return le(t.apply(void 0,qe([],je(n)))).subscribe(o)}}function Ou(e,t,n){var r,o=!1;return r=e,$t({connector:function(){return new rn(r,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:o})}function er(e,t){return J(function(n,r){var o=null,i=0,s=!1,a=function(){return s&&!o&&r.complete()};n.subscribe(j(r,function(c){o?.unsubscribe();var u=0,l=i++;le(e(c,l)).subscribe(o=j(r,function(d){return r.next(t?t(c,d,l,u++):d)},function(){o=null,a()}))},function(){s=!0,a()}))})}function Cu(e){return J(function(t,n){le(e).subscribe(j(n,function(){return n.complete()},We)),!n.closed&&t.subscribe(n)})}function Ai(e,t){return t===void 0&&(t=!1),J(function(n,r){var o=0;n.subscribe(j(r,function(i){var s=e(i,o++);(s||t)&&r.next(i),!s&&r.complete()}))})}function $u(e,t,n){var r=H(e)||t||n?{next:e,error:t,complete:n}:e;return r?J(function(o,i){var s;(s=r.subscribe)===null||s===void 0||s.call(r);var a=!0;o.subscribe(j(i,function(c){var u;(u=r.next)===null||u===void 0||u.call(r,c),i.next(c)},function(){var c;a=!1,(c=r.complete)===null||c===void 0||c.call(r),i.complete()},function(c){var u;a=!1,(u=r.error)===null||u===void 0||u.call(r,c),i.error(c)},function(){var c,u;a&&((c=r.unsubscribe)===null||c===void 0||c.call(r)),(u=r.finalize)===null||u===void 0||u.call(r)}))}):it}function Tu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=si(e);return J(function(r,o){for(var i=e.length,s=new Array(i),a=e.map(function(){return!1}),c=!1,u=function(d){le(e[d]).subscribe(j(o,function(f){s[d]=f,!c&&!a[d]&&(a[d]=!0,(c=a.every(it))&&(a=null))},We))},l=0;l<i;l++)u(l);r.subscribe(j(o,function(d){if(c){var f=qe([d],je(s));o.next(n?n.apply(void 0,qe([],je(f))):f)}}))})}var Pu=Object.defineProperty,Lu=(e,t,n)=>t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ii=(e,t,n)=>Lu(e,typeof t!="symbol"?t+"":t,n);class Uu{constructor(){Ii(this,"first"),Ii(this,"last")}getRemoveFn(t){return()=>{t.prev?t.prev.next=t.next:this.first=t.next,t.next?t.next.prev=t.prev:this.last=t.prev,delete t.prev,delete t.next}}push(t){const n={value:t};return this.last===void 0?this.last=this.first=n:(this.last.next=n,n.prev=this.last,this.last=n),this.getRemoveFn(n)}unshift(t){return this.first={value:t,next:this.first},this.first.next&&(this.first.next.prev=this.first),this.last||(this.last=this.first),this.getRemoveFn(this.first)}pop(){const t=this.first?.value;return this.first&&(this.first=this.first.next,this.first?(delete this.first.prev?.next,delete this.first.prev):this.last=void 0),t}isEmpty(){return!this.first}}const Ru=()=>{const e=new Map,t=(f,h)=>{e.set(f,()=>{e.delete(f),h()})},n=f=>{e.get(f)?.()},r=new Uu,o=r.unshift.bind(r),i=r.push.bind(r),s=(f,h)=>{const p=h?o:i;t(f.source$,p(f))},a=()=>{const f=r.pop();f&&(e.delete(f.source$),c(f))},c=f=>{const{source$:h,observer:p}=f;let v=!1;const y=h.subscribe({next(b){p.next(b)},error(b){(v=b instanceof Zt)?s(f,!0):p.error(b)},complete(){p.complete()}});y.closed?v||a():t(h,()=>{y.unsubscribe(),a()})},u=(f=!1)=>h=>new $(p=>{const v={observer:p,source$:h};return r.isEmpty()?c(v):s(v,f),()=>{n(h)}}),l=u();return{withRecovery:u,withRecoveryFn:f=>(...h)=>l(f(...h))}},Mu=(e,t)=>n=>(r,...o)=>(r===null||r==="finalized"?e:r==="best"?t:ee(r)).pipe(Ae(1),z(s=>n(s,...o))),Bi=e=>(...t)=>new $(n=>{let r=new AbortController;return e(...t,r.signal).then(o=>{n.next(o),n.complete()},o=>{n.error(o)}),()=>{n.unsubscribe(),r.abort(),r=void 0}}),zu=e=>t=>(...n)=>e()[t](...n);class tr extends Error{constructor(){super("Block is not pinned"),this.name="BlockNotPinnedError"}}class Du extends Error{constructor(){super("Block pruned"),this.name="BlockPrunedError"}}class _i extends Error{constructor(){super("Block is not best block or finalized"),this.name="NotBestBlockError"}}const Hu=(e,t)=>e.pipe(Ai(n=>n.blocks.has(t)),ke((n,r)=>n.finalized===r.finalized&&n.best===r.best),Ge(n=>n.blocks.get(n.best).number>=n.blocks.get(t).number),I(n=>{const{number:r}=n.blocks.get(t);let o=n.blocks.get(n.best),i=n.finalized===o.hash;for(;o.number>r;)o=n.blocks.get(o.parent),i=i||n.finalized===o.hash;return i?"finalized":o.hash===t?"best":null}),ke(),Ai(n=>n!=="finalized",!0)),Fu=e=>{let t=null,n=We;const r=new $(o=>{t=e(!0,i=>{o.next(i)},i=>{t=null,o.error(i)}),n=()=>{o.complete(),t?.unfollow()}}).pipe($t());return{getFollower:()=>{if(!t)throw new Error("Missing chainHead subscription");return t},unfollow:()=>{n()},follow$:r}},Oi=()=>e=>new $(t=>{const n=new ot,r=()=>e.subscribe({next:o=>t.next(o),error:o=>{o instanceof Fo?(t.next({type:"stop-error"}),n.add(r())):t.error(o)},complete:()=>t.complete()});return n.add(r()),n});function Vu(e,t,n){return(r,o,...i)=>(o?Mc(qu(r,t.pipe(Oi(),Ge(a=>a.type==="finalized"),z(a=>a.prunedBlockHashes))),ju(r,e)):a=>a)(n(r,...i))}const ju=(e,t)=>n=>Hu(t,e).pipe(Ae(1),er(r=>r?n:Zn(()=>new _i))),qu=(e,t)=>n=>new $(r=>{const o=t.pipe(Ge(s=>s===e)).subscribe(()=>{r.error(new Du)}),i=n.subscribe(r);return()=>{o.unsubscribe(),i.unsubscribe()}});function un(e,t){return(n,...r)=>{const o=t(n,...r);return new $(i=>{let s=null,a=!1;const c=()=>{a||(a=!0,s=o.subscribe({next:d=>i.next(d),error:d=>i.error(d),complete:()=>i.complete()}),s.add(()=>{a=!1,s=null}))};let u=!1;const l=e.subscribe({next:d=>{const f=d.blocks.get(n);f?f.recovering?s?.unsubscribe():c():u&&i.error(new tr),u=d.recovering},error:d=>i.error(d)});return()=>{l.unsubscribe(),s?.unsubscribe()}})}}const Wu=e=>{const t=e.pipe(cn(n=>n instanceof Fn?Su(750).pipe(Ei(()=>t)):Zn(()=>n)));return t},nr=e=>(...t)=>Wu(e(...t)),Xu=(e,t)=>{const n=(r,o,i,s)=>new $(a=>e().storageSubscription(r,o,i??null,c=>{a.next(c)},c=>{a.error(c)},()=>{a.complete()},c=>{c!==0&&a.next(n(r,o.slice(-c),i,!0))})).pipe(Jn(),t(s));return n},Ci=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",Ke={type:"void"},Gu=(e,t=()=>null)=>{const n=new Map,r=new Set,o=l=>d=>{let f=n.get(d);if(f)return f;if(r.has(d)){const p={id:d};return n.set(d,p),p}r.add(d);const h=l(d);return f=n.get(d),f?Object.assign(f,h):(f={id:d,...h},n.set(d,f)),r.delete(d),f};let i=!0,s=!0;const a=o(l=>{const d=t(e[l]);if(d)return d;const{def:f,path:h,params:p}=e[l];if(f.tag==="composite"){if(f.value.length===0)return Ke;if(f.value.length===1){const v=a(f.value[0].type);return i&&h.at(-1)==="AccountId32"&&Ci(v,32)?(i=!1,{type:"AccountId32"}):s&&h.at(-1)==="AccountId20"&&Ci(v,20)?(s=!1,{type:"AccountId20"}):v}return c(f.value)}if(f.tag==="variant"){if(h.length===1&&h[0]==="Option"&&p.length===1&&p[0].name==="T"){const b=a(p[0].type);return b.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:b}}if(h.length===1&&h[0]==="Result"&&p.length===2&&p[0].name==="T"&&p[1].name==="E")return{type:"result",value:{ok:a(p[0].type),ko:a(p[1].type)}};if(f.value.length===0)return Ke;const v={},y={};return f.value.forEach(b=>{const w=b.name;if(y[w]=b.docs,b.fields.length===0){v[w]={...Ke,idx:b.index};return}if(b.fields.length===1&&!b.fields[0].name){v[w]={type:"lookupEntry",value:a(b.fields[0].type),idx:b.index};return}v[w]={...c(b.fields),idx:b.index}}),{type:"enum",value:v,innerDocs:y}}if(f.tag==="sequence")return{type:"sequence",value:a(f.value)};if(f.tag==="array"){const{len:v}=f.value,y=a(f.value.type);return!v||y.type==="void"?Ke:v>1?{type:"array",value:y,len:f.value.len}:y}if(f.tag==="tuple")return f.value.length===0?Ke:f.value.length>1?u(f.value.map(v=>a(v)),f.value.map(v=>e[v].docs)):a(f.value[0]);if(f.tag==="primitive")return{type:"primitive",value:f.value.tag};if(f.tag==="compact"){const v=a(f.value);return v.type==="void"?Ke:{type:"compact",isBig:Number(v.value.slice(1))>32}}return{type:f.tag}}),c=l=>{let d=!0;const f={},h={};return l.forEach((p,v)=>{d=d&&!!p.name;const y=p.name||v,b=a(p.type);b.type!=="void"&&(f[y]=b,h[y]=p.docs)}),d?{type:"struct",value:f,innerDocs:h}:u(Object.values(f),Object.values(h))},u=(l,d)=>{if(l.every(f=>f.id===l[0].id)&&d.every(f=>!f.length)){const[f]=l;return f.type==="void"?Ke:{type:"array",value:l[0],len:l.length}}return{type:"tuple",value:l,innerDocs:d}};return a},Ku=e=>{const t=Gu(e.lookup,({def:o})=>{if(o.tag==="composite"){const i=n(o);if(i)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(s=>[s.name,s.errors==null?{...Ke,idx:s.index}:{type:"lookupEntry",value:t(s.errors),idx:s.index}])),byteLength:i}}return null});function n(o){if(!(o.value.length===2&&o.value[0].name==="index"&&o.value[1].name==="error"))return null;const s=t(o.value[0].type),a=t(o.value[1].type);return s.type==="primitive"&&s.value==="u8"&&a.type==="array"&&a.value.type==="primitive"&&a.value.value==="u8"?1+a.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(s=>s.name==="Call")?.type??null})},Yu=(e,t,n)=>(r,o,i,...s)=>{const{id:a}=r;if(o.has(a))return o.get(a);if(i.has(a)){const u=t(()=>o.get(a),r,...s);return o.set(a,u),u}i.add(a);let c=e(r,o,i,...s);return i.delete(a),o.has(a)&&(c=n(c,o.get(a),r,...s)),o.set(a,c),c},Zu=St(),Ju=M(V[0],Rt(V[1],BigInt)),$i=Yu((e,t,n,r)=>{if(e.type==="primitive")return Uo[e.value];if(e.type==="void")return T;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return po;if(e.type==="compact")return e.isBig?Ju:V;if(e.type==="bitSequence")return Nr;const o=h=>$i(h,t,n,r),i=(h,p)=>{const v=o(h);return p?P(v,p):P(v)},s=h=>te(...h.map(o)),a=h=>{const p=Object.fromEntries(Object.entries(h).map(([v,y])=>[v,o(y)]));return C(p)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return Zu;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?St(e.len):i(e.value,e.len);if(e.type==="sequence")return i(e.value);if(e.type==="tuple")return s(e.value);if(e.type==="struct")return a(e.value);if(e.type==="option")return Q(o(e.value));if(e.type==="result")return Mt(o(e.value.ok),o(e.value.ko));const c=Object.values(e.value).map(h=>{switch(h.type){case"void":return T;case"lookupEntry":return o(h.value);case"tuple":return s(h.value);case"struct":return a(h.value);case"array":return i(h.value,h.len)}}),u=Object.fromEntries(Object.keys(e.value).map((h,p)=>[h,c[p]])),l=Object.values(e.value).map(h=>h.idx),f=l.every((h,p)=>h===p)?$e(u):$e(u,l);return e.byteLength?Qu(f,e.byteLength):f},En,e=>e),Ti=(e,t=at())=>{const n=new Map,r=o=>$i(e(o),n,new Set,t);return o=>r(o)},Qu=(e,t)=>{const n=W(t);return M(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},Pi=e=>{const{metadata:t}=e;let n=Ti(e);const r=t.pallets.find(d=>d.name==="System")?.constants.find(d=>d.name==="SS58Prefix");let o;if(r)try{const d=n(r.type).dec(r.value);typeof d=="number"&&(o=d,n=Ti(e,at(d)))}catch{}const i=new Map,s=(d,f)=>{let h=i.get(d);h||i.set(d,h=Ln(d));const p=t.pallets.find(S=>S.name===d).storage.items.find(S=>S.name===f),v=(S,...A)=>{const O=h(...A);return{...O,len:S,fallback:p.modifier===1?O.dec(p.fallback):void 0}};if(p.type.tag==="plain")return v(0,f,n(p.type.value).dec);const{key:y,value:b,hashers:w}=p.type.value,x=n(b),m=w.map(S=>Uo[S.tag]),E=(()=>{if(m.length===1)return[[n(y),m[0]]];const S=e(y);switch(S.type){case"array":return m.map(A=>[n(S.value.id),A]);case"tuple":return S.value.map((A,O)=>[n(A.id),m[O]]);default:throw new Error("Invalid key type")}})();return v(m.length,f,x.dec,...E)},a=d=>{switch(d.type){case"void":return T;case"lookupEntry":return n(d.value.id);case"tuple":return te(...Object.values(d.value).map(f=>n(f.id)));case"struct":return C(kn(d.value,f=>n(f.id)));case"array":return P(n(d.value.id),d.len)}},c=(d,f)=>{const h=t.pallets.find(p=>p.name===d).constants.find(p=>p.name===f);return n(h.type)},u=d=>(f,h)=>{const p=t.pallets.find(b=>b.name===f),v=e(p[d]);if(v.type!=="enum")throw null;const y=v.value[h];return{location:[p.index,y.idx],codec:a(v.value[h])}},l=(d,f)=>{const h=t.apis.find(p=>p.name===d)?.methods.find(p=>p.name===f);if(!h)throw null;return{args:te(...h.inputs.map(p=>n(p.type))),value:n(h.output)}};return{buildDefinition:n,buildStorage:s,buildEvent:u("events"),buildError:u("errors"),buildRuntimeCall:l,buildCall:u("calls"),buildConstant:c,ss58Prefix:o}},Nu=ie(be.enc(15)),el=te(V,W()),tl=Q(W()),nl=P(be).dec,rl=(e,t)=>{const n=r=>{const o=(c,u,l)=>e(c,u,l).pipe(cn(d=>{if(d instanceof tr)return t.pipe(Ae(1),er(f=>o(f,u,l)));throw d})),i=o(r,"Metadata_metadata_versions","").pipe(I(nl)),s=o(r,"Metadata_metadata","").pipe(I(c=>{const[,u]=el.dec(c);return{metadata:tt.dec(u).metadata.value,metadataRaw:u}})),a=o(r,"Metadata_metadata_at_version",Nu).pipe(I(c=>{const u=tl.dec(c);return{metadata:tt.dec(u).metadata.value,metadataRaw:u}}));return i.pipe(cn(()=>ee([14])),z(c=>c.includes(15)?a:s))};return r=>{const o=new Set([r]),i=n(r).pipe(I(({metadata:a,metadataRaw:c})=>{const u=Ku(a),l=Pi(u),d=l.buildStorage("System","Events"),f=a.extrinsic.signedExtensions.find(p=>p.identifier==="ChargeAssetTxPayment");let h=null;if(f){const p=u(f.type);if(p.type==="struct"){const v=p.value.asset_id;v.type==="option"&&(h=v.value.id)}}return{assetId:h,metadataRaw:c,lookup:u,dynamicBuilder:l,events:{key:d.enc(),dec:d.dec},accountId:at(l.ss58Prefix)}}),Ou(1)),s={at:r,runtime:i,addBlock:a=>(o.add(a),s),deleteBlocks:a=>(a.forEach(c=>{o.delete(c)}),o.size),usages:o};return i.subscribe({error(){}}),s}},Tt=$t({connector:()=>new rn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0}),Li=(e,t)=>{e.get(e.get(t).parent)?.children.delete(t),e.delete(t)},ol=(e,t)=>{const n=[...t];let r=e.blocks.get(e.blocks.get(e.finalized).parent);const o=[];for(;r;)o.push(r.hash),r.refCount===0&&!r.unpinned&&(n.push(r.hash),r.unpinned=!0),r=e.blocks.get(r.parent);const i=[...t];for(let s=o.length-1;s>=0&&(r=e.blocks.get(o[s]),!!r.unpinned);s--)i.push(r.hash);return i.forEach(s=>{Li(e.blocks,s)}),Object.entries(e.runtimes).map(([s,a])=>({key:s,usages:a.deleteBlocks(i)})).filter(s=>s.usages===0).map(s=>s.key).forEach(s=>{delete e.runtimes[s]}),n},il=(e,t,n,r,o)=>{const i=xi(r,e.pipe(sl(t),Oi())).pipe(Si((a,c)=>{switch(c.type){case"initialized":a.recovering&&(c.finalizedBlockHashes.some(h=>a.blocks.has(h))||(a=Ui()));const[u]=c.finalizedBlockHashes.slice(-1);a.finalized=a.best=u;const l=c.finalizedBlockHashes.length-1;c.finalizedBlockHashes.forEach((f,h)=>{a.blocks.has(f)?a.blocks.get(f).recovering=!1:a.blocks.set(f,{hash:f,parent:h===0?c.parentHash:c.finalizedBlockHashes[h-1],children:new Set(h===l?[]:[c.finalizedBlockHashes[h+1]]),runtime:f,refCount:0,number:c.number+h,recovering:!1})});const d=Object.values(a.runtimes).find(f=>f.usages.has(u));return a.finalizedRuntime=d??(a.runtimes[u]=s(u)),a;case"stop-error":for(const f of a.blocks.values())f.recovering=!0;return a.recovering=!0,a;case"newBlock":{const{parentBlockHash:f,blockHash:h}=c;if(a.blocks.has(h))a.blocks.get(h).recovering=!1;else{const p=a.blocks.get(f);p.children.add(h),c.newRuntime&&(a.runtimes[h]=s(h),a.runtimes[h].runtime.subscribe());const v={hash:h,number:p.number+1,parent:f,children:new Set,runtime:c.newRuntime?h:p.runtime,refCount:0,recovering:!1};a.blocks.set(h,v),a.runtimes[v.runtime].addBlock(h)}return a}case"bestBlockChanged":{if(a.recovering){for(const[f,h]of a.blocks)h.recovering&&Li(a.blocks,f);a.recovering=!1}return a.best=c.bestBlockHash,a}case"finalized":{a.finalized=c.finalizedBlockHashes.slice(-1)[0];const{blocks:f}=a;return f.get(a.best).number<f.get(a.finalized).number&&(a.best=a.finalized),a.finalizedRuntime=a.runtimes[f.get(a.finalized).runtime],o(ol(a,c.prunedBlockHashes)),a}case"blockUsage":{if(!a.blocks.has(c.value.hash))return a;const f=a.blocks.get(c.value.hash);return f.refCount+=c.value.type==="hold"?1:-1,f.refCount===0&&f.number<a.blocks.get(a.finalized).number&&!f.recovering&&(f.unpinned=!0,o([f.hash])),a}}},Ui()),Ge(a=>!!a.finalizedRuntime.runtime),I(a=>({...a})),Tt),s=rl(un(i,n),i.pipe(I(a=>a.finalized)));return i},Ui=()=>({best:"",finalized:"",runtimes:{},blocks:new Map,finalizedRuntime:{},recovering:!1}),sl=e=>t=>t.pipe(Ei(n=>n.type!=="initialized"?ee(n):e(n.finalizedBlockHashes[0]).then(r=>({...n,number:r.number,parentHash:r.parentHash})))),Ri=(e,t,n,r)=>{const o=a=>Cu(e.pipe(Ge(({blocks:c})=>!c.has(a)))),i=(a,c,u)=>{if(u)return ee({hash:a,found:{type:!1,validity:null}});const l=o(a);return t(a).pipe(z(d=>{const f=d.indexOf(c);return f>-1?l(r(a)).pipe(I(h=>({hash:a,found:{type:!0,index:f,events:h}}))):n(a,c).pipe(I(h=>({hash:a,found:{type:!1,validity:h}})))}),l)},s=(a,c,u)=>i(a,c,u.has(a)).pipe(z(l=>{const{found:d}=l;return d.type||d.validity?.success===!1?ee(l):e.pipe(o(a),z(f=>f.blocks.get(a).children),Bu(),z(f=>s(f,c,u)))}));return a=>e.pipe(Ae(1),z(c=>s(c.finalized,a,new Set(c.blocks.keys()))))},al=new Uint8Array([2]),cl=(e,t)=>ie(de(al,ge(e),ge(t))),Mi="TaggedTransactionQueue",zi="validate_transaction",ul=(e,t)=>(n,r)=>{const o=t(n).pipe(I(i=>i.dynamicBuilder.buildRuntimeCall(Mi,zi).value[1]));return e(n,`${Mi}_${zi}`,cl(r,n)).pipe(Tu(o),I(([i,s])=>s(i)))},ll=e=>t=>new $(n=>{let r=!1;const o=t.subscribe({next(i){r=!0,n.next(i)},error(i){n.error(i)},complete(){n.complete()}});return r||n.next(e),o}),fl=(e,t=1/0)=>n=>new $(r=>{let o;const i=new Map,s=new Map,a=new Map;let c=0,u=0,l=0;const d=()=>{const f=i.get(u);if(!f){s.size===0&&(typeof o>"u"||o.closed)&&r.complete();return}const h=u++;i.delete(h),l!==h&&a.set(h,[]),s.set(h,f.subscribe({next(p){l===h?r.next(p):a.get(h).push(p)},complete(){if(s.delete(h),h===l)for(l++;a.has(l)&&(a.get(l).forEach(p=>r.next(p)),a.delete(l),!s.has(l));)l++;d()},error(p){r.error(p)}}))};return o=n.subscribe({next(f){const h=c++;i.set(h,Qn(()=>e(f,h))),s.size<t&&d()},error(f){r.error(f)},complete(){s.size===0&&r.complete()}}),()=>{s.forEach(f=>f.unsubscribe()),o.unsubscribe(),i.clear(),a.clear()}}),rr=({hash:e,number:t,parent:n})=>({hash:e,number:t,parent:n}),hl=e=>{const{getFollower:t,unfollow:n,follow$:r}=Fu(e),o=zu(t),{withRecovery:i,withRecoveryFn:s}=Ru(),a=new nn,c=k=>(B,...U)=>new $(F=>{a.next({type:"blockUsage",value:{type:"hold",hash:B}});const ve=k(B,...U).subscribe(F);return()=>{setTimeout(()=>{a.next({type:"blockUsage",value:{type:"release",hash:B}})},0),ve.unsubscribe()}}),u=k=>(B,...U)=>new $(F=>{let ve=!1;return y.pipe(Ae(1)).subscribe(Ie=>{const ae=Ie.blocks.get(B);ve=!!ae&&!ae.unpinned}),ve?k(B,...U).subscribe(F):F.error(new tr)}),l=k=>t().header(k).then(bo.dec),d=k=>t().unpin(k).catch(B=>{if(!(B instanceof Yt))throw B}),f=k=>u(c((U=>Vu(y,r,U))(un(y,nr(s(Bi(k))))))),h=(k,B=!0)=>(U,...F)=>k(U,B,...F),p=nr(s(Bi(o("call")))),v=new Map,y=il(r,l,c(p),a,k=>{d(k),k.forEach(B=>{v.delete(B)})}),b=c(k=>y.pipe(Ae(1),z(B=>B.runtimes[B.blocks.get(k).runtime].runtime))),w=k=>B=>B.pipe(fl(U=>b(k(U)).pipe(I(F=>[U,F])))),x=(k,B,U)=>{const F=v.get(k)??new Map,ve=F.get(B);if(ve)return ve;v.set(k,F);const Ie=new rn,ae=U.pipe($t({connector:()=>Ie}),$u({complete(){F.set(B,Ie)}}));return F.set(B,ae),ae},m=y.pipe(ke((k,B)=>k.finalized===B.finalized),I(k=>rr(k.blocks.get(k.finalized))),Tt),E=y.pipe(ke((k,B)=>k.best===B.best),I(k=>rr(k.blocks.get(k.best))),Tt),S=y.pipe(ke((k,B)=>k.finalized===B.finalized&&k.best===B.best),Si((k,B)=>{const U=fe=>k.get(fe)||rr(B.blocks.get(fe)),F=U(B.best),ve=U(B.finalized),Ie=F.number-ve.number+1,ae=new Array(Ie);for(let fe=0,Lt=F.hash;fe<Ie;fe++)ae[fe]=U(Lt),Lt=ae[fe].parent;return new Map(ae.map(fe=>[fe.hash,fe]))},new Map),I(k=>[...k.values()]),Tt),A=y.pipe(ke((k,B)=>k.finalizedRuntime===B.finalizedRuntime),er(({finalizedRuntime:{runtime:k}})=>k.pipe(ll(null))),Tt),O=A.pipe(I(k=>k?.lookup.metadata??null)),D=Mu(m.pipe(I(k=>k.hash)),E.pipe(I(k=>k.hash))),G=f(o("body")),se=k=>x(k,"body",G(k,!0)),Ze=f(o("storage")),hn=D((k,B,U,F,ve=null,Ie)=>y.pipe(Ae(1),z(ae=>ae.runtimes[ae.blocks.get(k).runtime].runtime),z(ae=>{const fe=F(ae),Lt=x(k,`storage-${U}-${fe}-${ve??""}`,Ze(k,B,U,fe,ve));return Ie?x(k,`storage-${U}-${fe}-${ve??""}-dec`,Lt.pipe(I(of=>Ie(of,ae)))):Lt}))),fr=Xu(t,i),hr=nr(D(c(un(y,(k,B,U)=>fr(k,B,U??null,!1))))),ef=D(c(un(y,k=>Qn(()=>l(k)))));xi(A,S).subscribe({error(){}});const Ji=(k,B=!1)=>hn(k,B,"value",U=>U.events.key,null,(U,F)=>F.events.dec(U)),tf=f(o("call")),Qi=D((k,B,U,F)=>x(k,`call-${U}-${F}`,tf(k,B,U,F))),dr=ul(h(Qi,!1),b),Ni=k=>x(k,"body",G(k,!1)),nf=Ri(y,Ni,dr,Ji),rf=Ri(y,Ni,dr,()=>ee());return{follow$:r,finalized$:m,best$:E,bestBlocks$:S,runtime$:A,metadata$:O,header$:ef,body$:se,call$:h(Qi),storage$:h(hn),storageQueries$:hr,eventsAt$:h(Ji),trackTx$:nf,trackTxWithoutEvents$:rf,validateTx$:dr,pinnedBlocks$:y,withRuntime:w,getRuntimeContext$:D(b),unfollow:n}};var dl=e=>t=>new $(n=>e(t,r=>{n.error(r)}));const pl=({chainHead:e,transaction:t,destroy:n})=>({chainHead$:()=>hl(e),broadcastTx$:dl(t),destroy:n});class dt{constructor(){}_runtime(t){}}class Di{constructor(){}_compatibility(t){}}const ln=new WeakMap,Hi=new WeakMap,or=e=>e instanceof dt?Hi.get(e):ln.get(e);var pt=(e=>(e.Storage="storage",e.Tx="tx",e.Event="events",e.Const="constants",e))(pt||{});const vl=P(cc),yl=P(Un),bl=te(vl,yl),ml=(e,t)=>{const n=new Promise(async r=>{const o=t.runtime$.pipe(Ge(s=>s!=null));let i=await we(o);o.subscribe(s=>i=s),r(()=>i)});return Promise.all([e.metadataTypes.then(bl.dec),e.descriptors,n]).then(([[r,o],i,s])=>{const a=new Di;return ln.set(a,{runtime:s,getPalletEntryPoint(c,u,l){return r[i[c][u][l]]},getApiEntryPoint(c,u){return r[i.apis[c][u]]},typedefNodes:o}),a})},gl=e=>new Promise(async t=>{const n=e.runtime$.pipe(Ge(o=>o!=null));let r=await we(n);n.subscribe(o=>r=o),t(()=>r)}).then(t=>{const n=new dt;return Hi.set(n,{runtime:t}),n}),ir=new WeakMap,Fi=e=>(ir.has(e.metadataRaw)||ir.set(e.metadataRaw,{compat:new Map,lookup:e.lookup,typeNodes:[]}),ir.get(e.metadataRaw)),vt=(e,t,n)=>{const r=(c,u)=>{var l;const d=Fi(c);return(l=d.typeNodes)[u]||(l[u]=Ot(d.lookup(u)))};function o(c,u){if(c instanceof dt)return{args:Se.Identical,values:Se.Identical};const l=ln.get(c);u||(u=l.runtime());const d=t(l),f=n(u),h=l.typedefNodes,p=Fi(u);return dc(d,v=>h[v],f,v=>r(u,v),p.compat)}const i=ji(e,c=>Vi(o(c))),s=ji(e,(c,u)=>i(u)>=c),a=()=>e;return{isCompatible:s,getCompatibilityLevel:i,getCompatibilityLevels:o,waitDescriptors:a,withCompatibleRuntime:(c,u)=>l=>an([l.pipe(c.withRuntime(u)),a()]).pipe(I(([[d,f],h])=>[d,h,f])),compatibleRuntime$:(c,u)=>an([a(),c.getRuntimeContext$(u)]),argsAreCompatible:(c,u,l)=>{if(c instanceof dt)return!0;const d=o(c,u);if(d.args===Se.Incompatible)return!1;if(d.args>Se.Partial)return!0;if(d.values===Se.Incompatible)return!1;const f=n(u);return Ho(f.args,h=>r(u,h),l)},valuesAreCompatible:(c,u,l)=>{if(c instanceof dt)return!0;const d=o(c,u).values;if(d===Se.Incompatible)return!1;if(d>Se.Partial)return!0;const f=ln.get(c),h=t(f);return Ho(h.values,p=>f.typedefNodes[p],l)},getRuntimeTypedef:r}},Vi=e=>Math.min(e.args,e.values),ji=(e,t)=>(...n)=>{const r=n.at(-1);return r instanceof Di||r instanceof dt?t(...n):e.then(o=>t(...n,o))},wl=(e,t,{valuesAreCompatible:n,waitDescriptors:r,isCompatible:o,getCompatibilityLevel:i})=>{const s=new WeakMap,a=u=>{if(s.has(u))return s.get(u);const l=u.lookup.metadata.pallets.find(f=>f.name===e)?.constants.find(f=>f.name===t);if(l==null)throw new Error(`Runtime entry Constant(${e}.${t}) not found`);const d=u.dynamicBuilder.buildConstant(e,t).dec(l.value);return s.set(u,d),d},c=u=>{if(u){const l=or(u).runtime(),d=a(l);if(!n(u,l,d))throw new Error(`Incompatible runtime entry Constant(${e}.${t})`);return d}return r().then(c)};return Object.assign(c,{isCompatible:o,getCompatibilityLevel:i})},kl=$t({connector:()=>new rn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0});function sr(e,t){return new Promise((n,r)=>{let o=null,i=!1;const s=t?()=>{o?.unsubscribe(),r(new Gr)}:We;o=e.subscribe({next:a=>{n(a),o?.unsubscribe(),i=!0},error:a=>{t?.removeEventListener("abort",s),r(a)},complete:()=>{t?.removeEventListener("abort",s),r(new Error("Observable completed without emitting"))}}),i||t?.addEventListener("abort",s)})}const xl=(e,t=1/0)=>n=>new $(r=>{let o;const i=new Map,s=new Map,a=new Map;let c=0,u=0,l=0;const d=()=>{const f=i.get(u);if(!f){s.size===0&&(typeof o>"u"||o.closed)&&r.complete();return}const h=u++;i.delete(h),l!==h&&a.set(h,[]),s.set(h,f.subscribe({next(p){l===h?r.next(p):a.get(h).push(p)},complete(){if(s.delete(h),h===l)for(l++;a.has(l)&&(a.get(l).forEach(p=>r.next(p)),a.delete(l),!s.has(l));)l++;d()},error(p){r.error(p)}}))};return o=n.subscribe({next(f){const h=c++;i.set(h,Qn(()=>e(f,h))),s.size<t&&d()},error(f){r.error(f)},complete(){s.size===0&&r.complete()}}),()=>{s.forEach(f=>f.unsubscribe()),o.unsubscribe(),i.clear(),a.clear()}}),El=(e,t)=>n=>new $(r=>{let o=new Array,i=!1;const s=c=>{const u=new ot;o.push(u),o.length>t&&(o[0].unsubscribe(),o=o.slice(1));const l=e(c).subscribe({next(d){const f=o.indexOf(u);o.slice(0,f).forEach(h=>h.unsubscribe()),o=o.slice(f),r.next(d)},error(d){r.error(d)},complete(){const d=o.indexOf(u);o.splice(d,1),o.length===0&&i&&r.complete()}});u.add(l)},a=n.subscribe({next(c){s(c)},error(c){r.error(c)},complete(){o.length===0&&r.complete(),i=!0}});return()=>{a.unsubscribe(),o.forEach(c=>c.unsubscribe())}});let qi={};const Sl=e=>t=>new $(n=>{let r=qi,o=t.subscribe({next(i){n.next(r=i)},error(i){n.error(i)},complete(){r===qi?n.complete():o=e(r).subscribe(n)}});return()=>{o.unsubscribe()}}),ar=e=>typeof e=="object"&&e!==null&&Object.entries(e).every(([t,n])=>t==="at"&&(n===void 0||typeof n=="string")||t==="signal"&&(n===void 0||n instanceof AbortSignal)),Al=(e,t,n,{isCompatible:r,getCompatibilityLevel:o,withCompatibleRuntime:i,argsAreCompatible:s,valuesAreCompatible:a})=>{const c=()=>new Error(`Incompatible runtime entry Event(${e}.${t})`),u=n.finalized$.pipe(i(n,l=>l.hash),I(([l,d,f])=>{const h=f.lookup.metadata.pallets.find(p=>p.name===e)?.events;if(h==null||f.lookup.metadata.lookup[h].def.tag!=="variant"||f.lookup.metadata.lookup[h].def.value.find(p=>p.name===t)==null)throw new Error(`Runtime entry Event(${e}.${t}) not found`);if(!s(d,f,null))throw c();return[l,d,f]}),xl(([l,d,f])=>n.eventsAt$(l.hash).pipe(I(h=>h.filter(p=>p.event.type===e&&p.event.value.type===t).map(p=>{if(!a(d,f,p.event.value.value))throw c();return{meta:{phase:p.phase,block:l},payload:p.event.value.value}})))),kl);return{watch:l=>u.pipe(z(d=>l?d.filter(f=>l(f.payload)):d)),pull:()=>we(u),filter:l=>l.filter(d=>d.type===e&&d.value.type===t).map(d=>d.value.value),getCompatibilityLevel:o,isCompatible:r}},Il=(e,t,n,{isCompatible:r,getCompatibilityLevel:o,compatibleRuntime$:i,argsAreCompatible:s,valuesAreCompatible:a})=>{const c=`${e}_${t}`,u=()=>new Error(`Incompatible runtime entry RuntimeCall(${c})`);return Object.assign((...l)=>{const d=l[l.length-1],f=ar(d),{signal:h,at:p}=f?d:{},v=p??null,y=i(n,v).pipe(z(([b,w])=>{let x;try{x=w.dynamicBuilder.buildRuntimeCall(e,t)}catch{throw new Error(`Runtime entry RuntimeCall(${c}) not found`)}if(!s(b,w,l))throw u();return n.call$(v,c,ie(x.args.enc(l))).pipe(I(x.value.dec),I(m=>{if(!a(b,w,m))throw u();return m}))}));return sr(y,h)},{getCompatibilityLevel:o,isCompatible:r})},Bl=(e,t,n,{isCompatible:r,getCompatibilityLevel:o,getCompatibilityLevels:i,waitDescriptors:s,withCompatibleRuntime:a,argsAreCompatible:c,valuesAreCompatible:u})=>{const l=e==="System"&&t==="Number",d=()=>new Error(`Incompatible runtime entry Storage(${e}.${t})`),f=y=>new Error(`Invalid Arguments calling ${e}.${t}(${y})`),h=y=>{try{return y.dynamicBuilder.buildStorage(e,t)}catch{throw new Error(`Runtime entry Storage(${e}.${t}) not found`)}},p=(...y)=>{const b=y[y.length-1],w=b==="best"||b==="finalized"?y.slice(0,-1):y;return l?n.bestBlocks$.pipe(I(x=>x.at(b==="best"?0:-1).number),ke()):n[b==="best"?"best$":"finalized$"].pipe(Iu(0),a(n,x=>x.hash),El(([x,m,E])=>{const S=h(E);if(!c(m,E,w))throw d();return n.storage$(x.hash,"value",()=>S.enc(...w)).pipe(I(A=>{if(!u(m,E,A))throw d();return{val:A,codecs:S}}))},4),ke((x,m)=>x.val===m.val),I(({val:x,codecs:m})=>x===null?m.fallback:m.dec(x)))},v=async(...y)=>{const b=y[y.length-1],w=ar(b),{signal:x,at:m}=w?b:{},E=m??null;let S;if(l)S=n.bestBlocks$.pipe(I(A=>E==="finalized"||!E?A.at(-1):E==="best"?A.at(0):A.find(O=>O.hash===E)),I(A=>{if(!A)throw new _i;return A.number}),ke());else{const A=await s();S=n.storage$(E,"value",O=>{const D=h(O),G=y.length===D.len?y:y.slice(0,-1);if(y!==G&&!w)throw f(y);if(!c(A,O,G))throw d();return D.enc(...G)},null,(O,D)=>{const G=h(D),se=O===null?G.fallback:G.dec(O);if(!u(A,D,se))throw d();return se})}return sr(S,x)};return{isCompatible:r,getCompatibilityLevel:o,getValue:v,getValues:(y,b)=>Promise.all(y.map(w=>v(...b?[...w,b]:w))),getEntries:async(...y)=>{const b=y[y.length-1],w=ar(b),{signal:x,at:m}=w?b:{},E=m??null,S=await s(),A=n.storage$(E,"descendantsValues",O=>{const D=h(O);if(Vi(i(S,O))===Se.Incompatible)throw d();if(y.length>D.len)throw f(y);const G=y.length>0&&w?y.slice(0,-1):y;if(y.length===D.len&&G===y)throw f(y);return D.enc(...G)},null,(O,D)=>{const G=h(D);if(O.some(({value:se})=>!u(S,D,se)))throw d();return O.map(({key:se,value:Ze})=>({keyArgs:G.keyDecoder(se),value:G.dec(Ze)}))});return sr(A,x)},watchValue:p}},_l=bt(q.enc,e=>+!!e.signed<<7|e.version),Ol={Ed25519:0,Sr25519:1,Ecdsa:2},[fn,Pt]=["<Bytes>","</Bytes>"].map(e=>ze.fromText(e).asBytes());function Cl(e,t,n){return{publicKey:e,signTx:async(i,s,a,c,u=On)=>{let l;try{const b=Ao(a);if(b.metadata.tag!=="v14"&&b.metadata.tag!=="v15")throw null;l=b.metadata.value}catch{throw new Error("Unsupported metadata version")}const{version:d}=l.extrinsic,f=[],h=[];l.extrinsic.signedExtensions.map(({identifier:b})=>{const w=s[b];if(!w)throw new Error(`Missing ${b} signed extension`);f.push(w.value),h.push(w.additionalSigned)});const p=de(i,...f,...h),v=await n(p.length>256?u(p):p),y=de(_l({signed:!0,version:d}),new Uint8Array([0,...e]),new Uint8Array([Ol[t],...v]),...f,i);return de(V.enc(y.length),y)},signBytes:async i=>{let s=!0,a;for(a=0;s&&a<fn.length;a++)s=fn[a]===i[a];s=s&&a===fn.length;const c=i.length-Pt.length;for(a=0;s&&a<Pt.length;a++)s=Pt[a]===i[c+a];return s=s&&a===Pt.length,n(s?i:de(fn,i,Pt))}}}const Ye=new Uint8Array,$l=Ln("System")("BlockHash",We,[be,Pn]).enc(0),Wi=e=>e.chainHead.storage$(e.at,"value",()=>$l,null).pipe(I(t=>ge(t))),Xi=(e,t)=>{const n=Pi(t),r=t.metadata.pallets.find(a=>a.name==="System").constants.find(a=>a.name==="Version"),o=t(r.type),i=n.buildDefinition(r.type).dec;if(o.type!=="struct")throw new Error("not a struct");const s=n.buildDefinition(o.value[e].id).enc;return ee(s(i(r.value)[e]))},Tl=e=>ee({value:Qr.enc(e),additionalSigned:Ye});function Pl(e){let t=0;for(;!(e&1);)t++,e>>=1;return t}const Ll=bt(W(2).enc,e=>{const t=Math.max(e.period>>12,1),n=Math.min(Math.max(Pl(e.period)-1,1),15),r=e.phase/t<<4;return Je.enc(n|r)}),Ul=new Uint8Array([0]),Rl=(e,t)=>{if(!e)return Wi(t).pipe(I(o=>({additionalSigned:o,value:Ul})));const{period:n,blockNumber:r}=e;return ee({additionalSigned:ge(t.at),value:Ll({period:n,phase:r%n})})},Ml=C({tip:V,asset:Q(W(1/0))}).enc,zl=(e,t)=>ee({value:Ml({tip:e,asset:t}),additionalSigned:Ye}),Dl=e=>Wi(e).pipe(I(t=>({value:Ye,additionalSigned:t}))),Hl=()=>ee({value:Uint8Array.from([0]),additionalSigned:Uint8Array.from([0])}),Gi="AccountNonceApi_account_nonce",Fl={1:q.dec,2:Je.dec,4:be.dec,8:mt.dec},cr=e=>ee({value:V.enc(e),additionalSigned:Ye});var Vl=Object.freeze({__proto__:null,CheckGenesis:Dl,CheckMetadataHash:Hl,CheckNonce:e=>e.chainHead.call$(e.at,Gi,ie(e.from)).pipe(z(t=>{const n=ge(t),r=Fl[n.length];if(!r)throw new Error(`${Gi} retrieved wrong data`);return cr(r(n))})),CheckSpecVersion:({lookupFn:e})=>Xi("spec_version",e).pipe(I(t=>({additionalSigned:t,value:Ye}))),CheckTxVersion:({lookupFn:e})=>Xi("transaction_version",e).pipe(I(t=>({additionalSigned:t,value:Ye}))),getNonce:cr});const jl=(e,t,n,r,o={})=>e.getRuntimeContext$(r.hash).pipe(Ae(1),z(i=>{const s={lookupFn:i.lookup,chainHead:e,callData:n,at:r.hash,from:t.publicKey},a=o.mortality?o.mortality.mortal?{period:o.mortality.period,blockNumber:r.number}:void 0:{period:64,blockNumber:r.number};return an(i.lookup.metadata.extrinsic.signedExtensions.map(({identifier:c,type:u,additionalSigned:l})=>{if(c==="CheckMortality")return Rl(a,s);if(c==="ChargeTransactionPayment")return Tl(o.tip??0n);if(c==="ChargeAssetTxPayment")return zl(o.tip??0n,o.asset);if(c==="CheckNonce"&&"nonce"in o)return cr(o.nonce);const d=Vl[c];if(!d){if(i.dynamicBuilder.buildDefinition(u)===T&&i.dynamicBuilder.buildDefinition(l)===T)return ee({value:Ye,additionalSigned:Ye});throw new Error(`Unsupported signed-extension: ${c}`)}return d(s)})).pipe(z(c=>t.signTx(n,Object.fromEntries(i.lookup.metadata.extrinsic.signedExtensions.map(({identifier:u},l)=>[u,{identifier:u,...c[l]}])),i.metadataRaw,r.number)))}));var ql=Object.defineProperty,Wl=(e,t,n)=>t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xl=(e,t,n)=>Wl(e,t+"",n);const Gl=e=>ie(On(ge(e))),Kl=(e,t)=>new $(n=>{const r=new Map;let o,i;const s=()=>{let c=o.best,u=r.get(c),l=o.blocks.get(c).number;for(;!u;){const h=o.blocks.get(c);if(!h)break;u=r.get(c=h.parent),l--}if(!u)return;const d=l<=o.blocks.get(o.finalized).number,f=u.found.type;if(f&&i?.found&&i.hash===u.hash){d&&n.complete();return}n.next(i=u.found.type?{found:f,hash:u.hash,number:l,index:u.found.index,events:u.found.events}:{found:f,validity:u.found.validity}),d&&(f?n.complete():u.found.validity?.success===!1&&n.error(new ur(u.found.validity.value)))},a=t.pipe(ke((c,u)=>c.finalized===u.finalized&&c.best===u.best)).subscribe({next:c=>{o=c,r.size!==0&&s()},error(c){n.error(c)}});return a.add(e.subscribe({next:c=>{r.set(c.hash,c),s()},error(c){n.error(c)}})),a}).pipe(ke((n,r)=>n===r)),Yl=(e,t)=>{const n=e.filter(o=>o.phase.type==="ApplyExtrinsic"&&o.phase.value===t).map(o=>o.event),r=n[n.length-1];return r.type==="System"&&r.value.type==="ExtrinsicFailed"?{ok:!1,events:n,dispatchError:r.value.value.dispatch_error}:{ok:!0,events:n}};class ur extends Error{constructor(t){super(JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r instanceof ze?r.asHex():r,2)),Xl(this,"error"),this.name="InvalidTxError",this.error=t}}const lr=(e,t,n,r,o=!1)=>{const i=Gl(n),s=(l,d)=>({type:l,txHash:i,...d}),a=e.pinnedBlocks$.pipe(Ae(1),I(l=>{const d=l.blocks.get(r);return d&&!d.unpinned?d.hash:l.finalized})).pipe(z(l=>e.validateTx$(l,n).pipe(Ge(d=>!d.success),I(d=>{throw new ur(d.value)})))),c=new $(l=>{const d=e.trackTx$(n).subscribe(l);return d.add(t(n).subscribe({error(f){l.error(f)}})),d}),u=Kl(c,e.pinnedBlocks$).pipe(I(l=>l.found?s("txBestBlocksState",{found:!0,block:{index:l.index,number:l.number,hash:l.hash},...Yl(l.events,l.index)}):s("txBestBlocksState",{found:!1,isValid:l.validity?.success!==!1})));return Eu(o?ee(s("signed",{})):on,a,ee(s("broadcasted",{})),u.pipe(Sl(({found:l,type:d,...f})=>l?ee(s("finalized",f)):on)))},Ki=async(e,t,n,r)=>cu(lr(e,t,n,r)).then(o=>{if(o.type!=="finalized")throw null;const i={...o};return delete i.type,i}),Zl=at().enc,Jl=new Uint8Array(64),Ql=()=>Jl,Yi=(e,t,n,r,{isCompatible:o,getCompatibilityLevel:i,compatibleRuntime$:s,argsAreCompatible:a,getRuntimeTypedef:c},u)=>Object.assign(l=>{const d=(m,E,S={})=>{const A=or(m).runtime(),{dynamicBuilder:O,assetId:D,lookup:G}=A;let se;try{se=O.buildCall(e,t)}catch{throw new Error(`Runtime entry Tx(${e}.${t}) not found`)}if(u&&!a(m,A,E))throw new Error(`Incompatible runtime entry Tx(${e}.${t})`);let Ze=S;if(S.asset){if(D==null||!Rn(S.asset,Ot(G(D)),hr=>c(A,hr)))throw new Error("Incompatible runtime asset");Ze={...S,asset:O.buildDefinition(D).enc(S.asset)}}const{location:hn,codec:fr}=se;return{callData:ze.fromBytes(de(new Uint8Array(hn),fr.enc(E))),options:Ze}},f=(m,E={})=>s(n,null).pipe(I(([S])=>d(S,m,E))),h=m=>m?d(m,l).callData:we(f(l).pipe(I(E=>E.callData))),p=(m,{...E},S)=>f(l,E).pipe(z(({callData:A,options:O})=>jl(n,m,A.asBytes(),S,O))),v=(m,{at:E,...S}={})=>(!E||E==="finalized"?n.finalized$:E==="best"?n.best$:n.bestBlocks$.pipe(I(A=>A.find(O=>O.hash===E)))).pipe(Ae(1),z(A=>A?p(m,S,A).pipe(I(O=>({tx:ie(O),block:A}))):Zn(()=>new Error(`Uknown block ${E}`)))),y=(m,E)=>we(v(m,E)).then(S=>S.tx),b=(m,E)=>we(v(m,E)).then(({tx:S,block:A})=>Ki(n,r,S,A.hash)),w=(m,E)=>v(m,E).pipe(z(({tx:S,block:A})=>lr(n,r,S,A.hash,!0))),x=async(m,E)=>{const S=Cl(m instanceof Uint8Array?m:Zl(m),"Sr25519",Ql),A=ge(await y(S,E)),O=ie(de(A,be.enc(A.length))),D=n.getRuntimeContext$(null).pipe(I(({dynamicBuilder:{buildRuntimeCall:se}})=>se("TransactionPaymentApi","query_info").value[1])),G=n.call$(null,"TransactionPaymentApi_query_info",O);return we(an([G,D]).pipe(I(([se,Ze])=>Ze(se))))};return{getPaymentInfo:x,getEstimatedFees:async(m,E)=>(await x(m,E)).partial_fee,decodedCall:{type:e,value:At(t,l)},getEncodedData:h,sign:y,signSubmitAndWatch:w,signAndSubmit:b}},{getCompatibilityLevel:i,isCompatible:o}),Zi=(e,t,n)=>{const r={},o=p=>new Proxy(r,{get(v,y){return p(y)}}),i=p=>{const v={};return o(y=>(v[y]||(v[y]={}),o(b=>(v[y][b]||(v[y][b]=p(y,b)),v[y][b]))))},s=(p,v)=>p.lookup.metadata.pallets.find(y=>y.name===v),a=i((p,v)=>Bl(p,v,t,vt(e,y=>y.getPalletEntryPoint(pt.Storage,p,v),y=>uc(s(y,p).storage.items.find(b=>b.name===v))))),c=(p,v,y,b)=>{const w=p.lookup(y);if(w.type!=="enum")throw new Error("Expected enum");const x=fc(w.value[b]);return{args:v==="args"?x:Gt,values:v==="args"?Gt:x}},u=i((p,v)=>Yi(p,v,t,n,vt(e,y=>y.getPalletEntryPoint(pt.Tx,p,v),y=>c(y,"args",s(y,p).calls,v)),!0)),l=i((p,v)=>Al(p,v,t,vt(e,y=>y.getPalletEntryPoint(pt.Event,p,v),y=>c(y,"values",s(y,p).events,v)))),d=i((p,v)=>wl(p,v,vt(e,y=>y.getPalletEntryPoint(pt.Const,p,v),y=>hc(s(y,p).constants.find(b=>b.name===v).type)))),f=i((p,v)=>Il(p,v,t,vt(e,y=>y.getApiEntryPoint(p,v),y=>lc(y.lookup.metadata.apis.find(b=>b.name===p).methods.find(b=>b.name===v))))),h=(p,v)=>{const{lookup:y,dynamicBuilder:b}=or(v).runtime();try{const w=b.buildDefinition(y.call).dec(p.asBytes()),x=w.type,m=w.value.type,E=w.value.value;return Yi(x,m,t,n,vt(e,S=>S.getPalletEntryPoint(pt.Tx,x,m),S=>c(S,"args",s(S,x).calls,m)),!1)(E)}catch{throw new Error("createTx: invalid call data")}};return{query:a,txFromCallData:(p,v)=>v?h(p,v):e.then(y=>h(p,y)),tx:u,event:l,apis:f,constants:d}};function Nl(e){const t=_c(e),n=pl(t),r=n.chainHead$(),{getChainSpecData:o}=t,i=t.request;let s;const a=new WeakMap,c=d=>{const f=a.get(d)||ml(d,r);return a.set(d,f),f},u=()=>s??(s=gl(r)),{broadcastTx$:l}=n;return{getChainSpecData:o,finalizedBlock$:r.finalized$,getFinalizedBlock:()=>we(r.finalized$),bestBlocks$:r.bestBlocks$,getBestBlocks:()=>we(r.bestBlocks$),watchBlockBody:r.body$,getBlockBody:d=>we(r.body$(d)),getBlockHeader:d=>we(r.header$(d??null)),submit:(...d)=>Ki(r,l,...d),submitAndWatch:(...d)=>lr(r,l,...d),getTypedApi:d=>{const f=c(d);return Object.assign(Zi(f,r,l),{compatibilityToken:f})},getUnsafeApi:()=>{const d=u();return Object.assign(Zi(d,r,l),{runtimeToken:d})},destroy:()=>{r.unfollow(),n.destroy()},_request:i}}he.AccountId=at,he.Binary=ze,he.CompatibilityLevel=Se,he.Enum=At,he.FixedSizeBinary=xn,he.InvalidTxError=ur,he._Enum=oo,he.createClient=Nl,he.getSs58AddressInfo=gn});
@@ -1 +1 @@
1
- (function(be,ke){typeof exports=="object"&&typeof module<"u"?ke(exports):typeof define=="function"&&define.amd?define(["exports"],ke):(be=typeof globalThis<"u"?globalThis:be||self,ke(be.papiPjsSigner={}))})(this,function(be){"use strict";var ke=Object.defineProperty,Vn=(e,t,n)=>t in e?ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ut=(e,t,n)=>(Vn(e,typeof t!="symbol"?t+"":t,n),n),Ke={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function jn(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|Ke[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=Ke[e[i]],y=Ke[e[i+1]];s[t+o++]=c<<4|y}return s}var ht=class extends Uint8Array{constructor(e){super(e),ut(this,"i",0),ut(this,"v"),this.v=new DataView(e)}},F=e=>t=>e(t instanceof ht?t:new ht(t instanceof Uint8Array?t.buffer:typeof t=="string"?jn(t).buffer:t)),K=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].byteLength;const r=new Uint8Array(n);for(let s=0,o=0;s<t;s++){const i=e[s];r.set(i,o),o+=i.byteLength}return r};function Te(e,t){const n=Object.keys(e),r=n.length,s={};for(let o=0;o<r;o++){const i=n[o];s[i]=t(e[i],i)}return s}var We=F,k=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},De=(e,t)=>n=>e(t(n)),$e=(e,t)=>n=>t(e(n)),we=([e,t],n,r)=>k(De(e,n),$e(t,r));function Rn(e,t){return F(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function Nn(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function re(e,t,n){return k(Nn(e,n),Rn(e,t))}var _=re(1,"getUint8","setUint8"),Ee=re(2,"getUint16","setUint16"),z=re(4,"getUint32","setUint32"),Me=re(8,"getBigUint64","setBigUint64"),Fn=re(1,"getInt8","setInt8"),qn=re(2,"getInt16","setInt16"),Xn=re(4,"getInt32","setInt32"),Kn=re(8,"getBigInt64","setBigInt64"),dt=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},ft=e=>F(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),o=n[e](r+8,!0);return t.i+=16,o<<64n|s}),Wn=k(dt,ft("getBigUint64")),Gn=k(dt,ft("getBigInt64")),yt=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},pt=e=>F(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n}),zn=k(yt,pt("getBigUint64")),Yn=k(yt,pt("getBigInt64")),Ge=we(_,e=>e?1:0,Boolean),Jn=[_[1],Ee[1],z[1]],Qn=F(e=>{const t=e[e.i],n=t&3;if(n<3)return Jn[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const o=r/8|0;let i=0n;for(let y=0;y<o;y++)s=Me[1](e)<<i|s,i+=64n;let c=r%8;return c>3&&(s=BigInt(z[1](e))<<i|s,i+=32n,c-=4),c>1&&(s=BigInt(Ee[1](e))<<i|s,i+=16n,c-=2),c&&(s=BigInt(_[1](e))<<i|s),s}),Zn=1n<<56n,er=1<<24,tr=256,nr=4294967295n,rr=64,sr=16384,or=1<<30,ir=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<rr)return _[0](t);if(e<sr)return Ee[0](t|1);if(e<or)return z[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=Zn;)n.push(Me[0](r)),r>>=64n;r>=er&&(n.push(z[0](Number(r&nr))),r>>=32n);let s=Number(r);s>=tr&&(n.push(Ee[0](s)),s>>=16),s&&n.push(_[0](s));const o=K(n);return o[0]=o.length-5<<2|3,o},U=k(ir,Qn),cr=new TextEncoder,ar=e=>{const t=cr.encode(e);return K([U.enc(t.length),t])},lr=new TextDecoder,ur=F(e=>{let t=U.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,lr.decode(n)}),M=k(ar,ur),hr=()=>{},dr=new Uint8Array(0),E=k(()=>dr,hr),gt=e=>e===void 0?t=>K([U.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),bt=e=>F(t=>{const n=e===void 0?U.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),C=e=>k(gt(e),bt(e));C.enc=gt,C.dec=bt;var wt=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,i)=>[n[i],o])??n.map((o,i)=>[o,i])),s=o=>r.get(o);return({tag:o,value:i})=>K([_.enc(s(o)),e[o](i)])},vt=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,o)=>[s,n[o]])??n.map((s,o)=>[o,s]));return F(s=>{const o=_.dec(s),i=r.get(o),c=e[i];return{tag:i,value:c(s)}})},W=(e,...t)=>k(wt(Te(e,([n])=>n),...t),vt(Te(e,([,n])=>n),...t));W.enc=wt,W.dec=vt;var mt=e=>F(t=>{const n=_.dec(t);if(n!==0)return e===Ge[1]?n===1:e(t)}),xt=e=>t=>{const n=new Uint8Array(1);return t===void 0?(n[0]=0,n):(n[0]=1,e===Ge[0]?(n[0]=t?1:2,n):K([n,e(t)]))},q=e=>k(xt(e[0]),mt(e[1]));q.enc=xt,q.dec=mt;var kt=(e,t)=>F(n=>{const r=_[1](n)===0,o=(r?e:t)(n);return{success:r,value:o}}),Et=(e,t)=>({success:n,value:r})=>K([_[0](n?0:1),(n?e:t)(r)]),He=(e,t)=>k(Et(e[0],t[0]),kt(e[1],t[1]));He.dec=kt,He.enc=Et;var Bt=(...e)=>F(t=>e.map(n=>n(t))),It=(...e)=>t=>K(e.map((n,r)=>n(t[r]))),X=(...e)=>k(It(...e.map(([t])=>t)),Bt(...e.map(([,t])=>t)));X.enc=It,X.dec=Bt;var At=e=>{const t=Object.keys(e);return De(X.enc(...Object.values(e)),n=>t.map(r=>n[r]))},Ot=e=>{const t=Object.keys(e);return $e(X.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},m=e=>k(At(Te(e,t=>t[0])),Ot(Te(e,t=>t[1])));m.enc=At,m.dec=Ot;var _t=(e,t)=>t>=0?n=>K(n.map(e)):n=>K([U.enc(n.length),K(n.map(e))]),Ut=(e,t)=>F(n=>{const r=t>=0?t:U.dec(n),s=new Array(r);for(let o=0;o<r;o++)s[o]=e(n);return s}),I=(e,t)=>k(_t(e[0],t),Ut(e[1],t));I.enc=_t,I.dec=Ut;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function yr(...e){const t=o=>o,n=(o,i)=>c=>o(i(c)),r=e.map(o=>o.encode).reduceRight(n,t),s=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:s}}function pr(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(n=>{if(n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=e.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})}}}function gr(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function Lt(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const s=[],o=Array.from(e);for(o.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,c=!0;for(let y=r;y<o.length;y++){const h=o[y],d=t*i+h;if(!Number.isSafeInteger(d)||t*i/t!==i||d-h!==t*i)throw new Error("convertRadix: carry overflow");i=d%n;const l=Math.floor(d/n);if(o[y]=l,!Number.isSafeInteger(l)||l*n+i!==d)throw new Error("convertRadix: carry overflow");if(c)l?c=!1:r=y;else continue}if(s.push(i),c)break}for(let i=0;i<e.length-1&&e[i]===0;i++)s.push(0);return s.reverse()}function br(e){return{encode:t=>{if(!fr(t))throw new Error("radix.encode input should be Uint8Array");return Lt(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(Lt(t,e,2**8))}}}const St=(e=>yr(br(58),pr(e),gr("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function he(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function wr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Pe(e,...t){if(!wr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Be(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ze(e,t){Pe(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vr=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),de=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Ve=(e,t)=>e<<32-t|e>>>t,H=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Ct=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,Y=H?e=>e:e=>Ct(e);function P(e){for(let t=0;t<e.length;t++)e[t]=Ct(e[t])}function mr(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function J(e){return typeof e=="string"&&(e=mr(e)),Pe(e),e}class Tt{clone(){return this._cloneInto()}}function xr(e){const t=r=>e().update(J(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function kr(e){const t=(r,s)=>e(s).update(J(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function Er(e){const t=(r,s)=>e(s).update(J(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Br=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class Dt extends Tt{constructor(t,n,r={},s,o,i){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,he(t),he(n),he(s),n<0||n>s)throw new Error("outputLen bigger than keyLen");if(r.key!==void 0&&(r.key.length<1||r.key.length>s))throw new Error(`key must be up 1..${s} byte long or undefined`);if(r.salt!==void 0&&r.salt.length!==o)throw new Error(`salt must be ${o} byte long or undefined`);if(r.personalization!==void 0&&r.personalization.length!==i)throw new Error(`personalization must be ${i} byte long or undefined`);this.buffer32=de(this.buffer=new Uint8Array(t))}update(t){Be(this);const{blockLen:n,buffer:r,buffer32:s}=this;t=J(t);const o=t.length,i=t.byteOffset,c=t.buffer;for(let y=0;y<o;){this.pos===n&&(H||P(s),this.compress(s,0,!1),H||P(s),this.pos=0);const h=Math.min(n-this.pos,o-y),d=i+y;if(h===n&&!(d%4)&&y+h<o){const l=new Uint32Array(c,d,Math.floor((o-y)/4));H||P(l);for(let u=0;y+n<o;u+=s.length,y+=n)this.length+=n,this.compress(l,u,!1);H||P(l);continue}r.set(t.subarray(y,y+h),this.pos),this.pos+=h,this.length+=h,y+=h}return this}digestInto(t){Be(this),ze(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,this.buffer.subarray(n).fill(0),H||P(r),this.compress(r,0,!0),H||P(r);const s=de(t);this.get().forEach((o,i)=>s[i]=Y(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:o,outputLen:i,pos:c}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.length=r,t.finished=s,t.destroyed=o,t.outputLen=i,t.buffer.set(n),t.pos=c,t}}const je=BigInt(2**32-1),Ye=BigInt(32);function Re(e,t=!1){return t?{h:Number(e&je),l:Number(e>>Ye&je)}:{h:Number(e>>Ye&je)|0,l:Number(e&je)|0}}function $t(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:i}=Re(e[s],t);[n[s],r[s]]=[o,i]}return[n,r]}const Ir=(e,t)=>BigInt(e>>>0)<<Ye|BigInt(t>>>0),Ar=(e,t,n)=>e>>>n,Or=(e,t,n)=>e<<32-n|t>>>n,_r=(e,t,n)=>e>>>n|t<<32-n,Ur=(e,t,n)=>e<<32-n|t>>>n,Lr=(e,t,n)=>e<<64-n|t>>>n-32,Sr=(e,t,n)=>e>>>n-32|t<<64-n,Cr=(e,t)=>t,Tr=(e,t)=>e,Mt=(e,t,n)=>e<<n|t>>>32-n,Ht=(e,t,n)=>t<<n|e>>>32-n,Pt=(e,t,n)=>t<<n-32|e>>>64-n,Vt=(e,t,n)=>e<<n-32|t>>>64-n;function Dr(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const V={fromBig:Re,split:$t,toBig:Ir,shrSH:Ar,shrSL:Or,rotrSH:_r,rotrSL:Ur,rotrBH:Lr,rotrBL:Sr,rotr32H:Cr,rotr32L:Tr,rotlSH:Mt,rotlSL:Ht,rotlBH:Pt,rotlBL:Vt,add:Dr,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,add5H:(e,t,n,r,s,o)=>t+n+r+s+o+(e/2**32|0)|0,add5L:(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},O=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),g=new Uint32Array(32);function se(e,t,n,r,s,o){const i=s[o],c=s[o+1];let y=g[2*e],h=g[2*e+1],d=g[2*t],l=g[2*t+1],u=g[2*n],a=g[2*n+1],f=g[2*r],p=g[2*r+1],b=V.add3L(y,d,i);h=V.add3H(b,h,l,c),y=b|0,{Dh:p,Dl:f}={Dh:p^h,Dl:f^y},{Dh:p,Dl:f}={Dh:V.rotr32H(p,f),Dl:V.rotr32L(p,f)},{h:a,l:u}=V.add(a,u,p,f),{Bh:l,Bl:d}={Bh:l^a,Bl:d^u},{Bh:l,Bl:d}={Bh:V.rotrSH(l,d,24),Bl:V.rotrSL(l,d,24)},g[2*e]=y,g[2*e+1]=h,g[2*t]=d,g[2*t+1]=l,g[2*n]=u,g[2*n+1]=a,g[2*r]=f,g[2*r+1]=p}function oe(e,t,n,r,s,o){const i=s[o],c=s[o+1];let y=g[2*e],h=g[2*e+1],d=g[2*t],l=g[2*t+1],u=g[2*n],a=g[2*n+1],f=g[2*r],p=g[2*r+1],b=V.add3L(y,d,i);h=V.add3H(b,h,l,c),y=b|0,{Dh:p,Dl:f}={Dh:p^h,Dl:f^y},{Dh:p,Dl:f}={Dh:V.rotrSH(p,f,16),Dl:V.rotrSL(p,f,16)},{h:a,l:u}=V.add(a,u,p,f),{Bh:l,Bl:d}={Bh:l^a,Bl:d^u},{Bh:l,Bl:d}={Bh:V.rotrBH(l,d,63),Bl:V.rotrBL(l,d,63)},g[2*e]=y,g[2*e+1]=h,g[2*t]=d,g[2*t+1]=l,g[2*n]=u,g[2*n+1]=a,g[2*r]=f,g[2*r+1]=p}class $r extends Dt{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=O[0]|0,this.v0h=O[1]|0,this.v1l=O[2]|0,this.v1h=O[3]|0,this.v2l=O[4]|0,this.v2h=O[5]|0,this.v3l=O[6]|0,this.v3h=O[7]|0,this.v4l=O[8]|0,this.v4h=O[9]|0,this.v5l=O[10]|0,this.v5h=O[11]|0,this.v6l=O[12]|0,this.v6h=O[13]|0,this.v7l=O[14]|0,this.v7h=O[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|1<<24,t.salt){const r=de(J(t.salt));this.v4l^=Y(r[0]),this.v4h^=Y(r[1]),this.v5l^=Y(r[2]),this.v5h^=Y(r[3])}if(t.personalization){const r=de(J(t.personalization));this.v6l^=Y(r[0]),this.v6h^=Y(r[1]),this.v7l^=Y(r[2]),this.v7h^=Y(r[3])}if(t.key){const r=new Uint8Array(this.blockLen);r.set(J(t.key)),this.update(r)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:o,v2h:i,v3l:c,v3h:y,v4l:h,v4h:d,v5l:l,v5h:u,v6l:a,v6h:f,v7l:p,v7h:b}=this;return[t,n,r,s,o,i,c,y,h,d,l,u,a,f,p,b]}set(t,n,r,s,o,i,c,y,h,d,l,u,a,f,p,b){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=o|0,this.v2h=i|0,this.v3l=c|0,this.v3h=y|0,this.v4l=h|0,this.v4h=d|0,this.v5l=l|0,this.v5h=u|0,this.v6l=a|0,this.v6h=f|0,this.v7l=p|0,this.v7h=b|0}compress(t,n,r){this.get().forEach((y,h)=>g[h]=y),g.set(O,16);let{h:s,l:o}=V.fromBig(BigInt(this.length));g[24]=O[8]^o,g[25]=O[9]^s,r&&(g[28]=~g[28],g[29]=~g[29]);let i=0;const c=Br;for(let y=0;y<12;y++)se(0,4,8,12,t,n+2*c[i++]),oe(0,4,8,12,t,n+2*c[i++]),se(1,5,9,13,t,n+2*c[i++]),oe(1,5,9,13,t,n+2*c[i++]),se(2,6,10,14,t,n+2*c[i++]),oe(2,6,10,14,t,n+2*c[i++]),se(3,7,11,15,t,n+2*c[i++]),oe(3,7,11,15,t,n+2*c[i++]),se(0,5,10,15,t,n+2*c[i++]),oe(0,5,10,15,t,n+2*c[i++]),se(1,6,11,12,t,n+2*c[i++]),oe(1,6,11,12,t,n+2*c[i++]),se(2,7,8,13,t,n+2*c[i++]),oe(2,7,8,13,t,n+2*c[i++]),se(3,4,9,14,t,n+2*c[i++]),oe(3,4,9,14,t,n+2*c[i++]);this.v0l^=g[0]^g[16],this.v0h^=g[1]^g[17],this.v1l^=g[2]^g[18],this.v1h^=g[3]^g[19],this.v2l^=g[4]^g[20],this.v2h^=g[5]^g[21],this.v3l^=g[6]^g[22],this.v3h^=g[7]^g[23],this.v4l^=g[8]^g[24],this.v4h^=g[9]^g[25],this.v5l^=g[10]^g[26],this.v5h^=g[11]^g[27],this.v6l^=g[12]^g[28],this.v6h^=g[13]^g[29],this.v7l^=g[14]^g[30],this.v7h^=g[15]^g[31],g.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Ne=kr(e=>new $r(e)),jt=new TextEncoder().encode("SS58PRE"),Je=2,Rt=e=>{try{const t=St.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-Je),s=t.subarray(n.length+r.length),o=Ne(Uint8Array.of(...jt,...n,...r),{dkLen:64}).subarray(0,Je);return s[0]===o[0]&&s[1]===o[1]?{isValid:!0,ss58Format:Mr(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},Mr=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},Nt=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=Ne(Uint8Array.of(...jt,...t,...n),{dkLen:64}).subarray(0,Je);return St.encode(Uint8Array.of(...t,...n,...r))}};function Hr(e,t){return n=>{const r=Rt(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const Ie=(e=42,t=32)=>we(C(t),Hr(t),Nt(e)),Ft="0123456789abcdef";function j(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Ft[r>>4]+Ft[r&15]}return t.join("")}const Qe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function fe(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|Qe[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=Qe[e[i]],y=Qe[e[i+1]];s[t+o++]=c<<4|y}return s}function Ze(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}const ie=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const o=e[r];n.set(o,s),s+=o.byteLength}return n};var Pr=Object.defineProperty,qt=e=>{throw TypeError(e)},Vr=(e,t,n)=>t in e?Pr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ae=(e,t,n)=>Vr(e,typeof t!="symbol"?t+"":t,n),Xt=(e,t,n)=>t.has(e)||qt("Cannot "+n),Q=(e,t,n)=>(Xt(e,t,"read from private field"),n?n.call(e):t.get(e)),Oe=(e,t,n)=>t.has(e)?qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ye=(e,t,n,r)=>(Xt(e,t,"write to private field"),t.set(e,n),n),Z,_e,Fe,qe,Xe;const jr=new TextEncoder,Rr=new TextDecoder,Nr=X(U,C(1/0))[1];class et{constructor(t,n=!1){if(Oe(this,Z),Oe(this,_e,null),Oe(this,Fe,null),Oe(this,qe,null),Oe(this,Xe,null),Ae(this,"asText",()=>Q(this,Xe)??ye(this,Xe,Rr.decode(Q(this,Z)))),Ae(this,"asHex",()=>Q(this,Fe)||ye(this,Fe,j(Q(this,Z)))),Ae(this,"asOpaqueHex",()=>Q(this,qe)||ye(this,qe,j(this.asBytes()))),Ae(this,"asBytes",()=>Q(this,Z)),Ae(this,"asOpaqueBytes",()=>Q(this,_e)||ye(this,_e,ie(U[0](Q(this,Z).length),Q(this,Z)))),n){try{const[r,s]=Nr(t);if(r===s.length){ye(this,Z,s),ye(this,_e,t);return}}catch{}throw new Error("Invalid opaque bytes")}else ye(this,Z,t)}static fromText(t){return new this(jr.encode(t))}static fromHex(t){return new this(fe(t))}static fromOpaqueHex(t){return new this(fe(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}Z=new WeakMap,_e=new WeakMap,Fe=new WeakMap,qe=new WeakMap,Xe=new WeakMap;class Kt extends et{constructor(t){super(t)}static fromArray(t){return new this(new Uint8Array(t))}}const Wt=e=>{const t=C.enc(e);return n=>t(n.asBytes())},Gt=e=>{const t=C.dec(e),n=e==null?et:Kt;return r=>n.fromBytes(t(r))},Ue=e=>k(Wt(e),Gt(e));Ue.enc=Wt,Ue.dec=Gt;const v=U,zt=U,Fr=We(e=>{const t=v.dec(e),n=Math.ceil(t/8);return{bytes:C(n).dec(e),bitsLen:t}}),Yt=k(e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=v.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},Fr),qr=we(_,e=>e.charCodeAt(0),String.fromCharCode),Jt=e=>{const t=C.enc(e);return n=>t(fe(n))},Qt=e=>{const t=C.dec(e);return n=>j(t(n))},ce=e=>k(Jt(e),Qt(e));ce.enc=Jt,ce.dec=Qt;const Xr=new TextEncoder,Kr=new TextDecoder,Wr=e=>we(C(e),t=>Xr.encode(t),t=>Kr.decode(t)),Zt=e=>{let t=n=>{const r=e();return t=r,r(n)};return n=>t(n)},en=e=>{let t=n=>{const r=e(),s=r;return t=r,s(n)};return n=>t(n)},tn=e=>k(Zt(()=>e().enc),en(()=>e().dec)),tt=Object.assign((e,t)=>({type:e,value:t}),{is(e,t){return e.type===t},as(e,t){if(t!==e.type)throw new Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),Gr=new Proxy({},{get(e,t){return n=>tt(t,n)}}),nn=(...e)=>{const t=W.enc(...e);return n=>t({tag:n.type,value:n.value})},rn=(...e)=>{const t=W.dec(...e);return n=>{const{tag:r,value:s}=t(n);return tt(r,s)}},ve=(e,...t)=>k(nn(Ze(e,([n])=>n),...t),rn(Ze(e,([,n])=>n),...t));ve.enc=nn,ve.dec=rn;const sn=[],on=[],cn=[],zr=BigInt(0),Le=BigInt(1),Yr=BigInt(2),Jr=BigInt(7),Qr=BigInt(256),Zr=BigInt(113);for(let e=0,t=Le,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],sn.push(2*(5*r+n)),on.push((e+1)*(e+2)/2%64);let s=zr;for(let o=0;o<7;o++)t=(t<<Le^(t>>Jr)*Zr)%Qr,t&Yr&&(s^=Le<<(Le<<BigInt(o))-Le);cn.push(s)}const[es,ts]=$t(cn,!0),an=(e,t,n)=>n>32?Pt(e,t,n):Mt(e,t,n),ln=(e,t,n)=>n>32?Vt(e,t,n):Ht(e,t,n);function ns(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,y=(i+2)%10,h=n[y],d=n[y+1],l=an(h,d,1)^n[c],u=ln(h,d,1)^n[c+1];for(let a=0;a<50;a+=10)e[i+a]^=l,e[i+a+1]^=u}let s=e[2],o=e[3];for(let i=0;i<24;i++){const c=on[i],y=an(s,o,c),h=ln(s,o,c),d=sn[i];s=e[d],o=e[d+1],e[d]=y,e[d+1]=h}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=es[r],e[1]^=ts[r]}n.fill(0)}class nt extends Tt{constructor(t,n,r,s=!1,o=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,he(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=de(this.state)}keccak(){H||P(this.state32),ns(this.state32,this.rounds),H||P(this.state32),this.posOut=0,this.pos=0}update(t){Be(this);const{blockLen:n,state:r}=this;t=J(t);const s=t.length;for(let o=0;o<s;){const i=Math.min(n-this.pos,s-o);for(let c=0;c<i;c++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,n&128&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Be(this,!1),Pe(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,o-s);t.set(n.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return he(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ze(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:o,enableXOF:i}=this;return t||(t=new nt(n,r,s,i,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=s,t.enableXOF=i,t.destroyed=this.destroyed,t}}const rs=((e,t,n)=>xr(()=>new nt(t,e,n)))(1,136,256/8),un=e=>{const t=e.slice(2),n=j(rs(t)).slice(2),r=new Array(40);for(let s=0;s<40;s++){const o=parseInt(n[s],16),i=t[s];r[s]=o>7?i.toUpperCase():i}return`0x${r.join("")}`},ss=C(20)[1],hn=k(e=>{const t=fe(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);const n=j(t);if(e===n||e===n.toUpperCase())return t;if(un(n)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},We(e=>un(j(ss(e))))),dn=new TextEncoder,fn=new TextDecoder,os=we(C(4),dn.encode.bind(dn),fn.decode.bind(fn)),rt=m({engine:os,payload:ce()}),is=ve({consensus:rt,seal:rt,preRuntime:rt,runtimeUpdated:E},[4,5,6,8]),st=ce(32),cs=m({parentHash:st,number:v,stateRoot:st,extrinsicRoot:st,digests:I(is)}),ee=I(M),yn=q(M),as=W({bool:E,char:E,str:E,u8:E,u16:E,u32:E,u64:E,u128:E,u256:E,i8:E,i16:E,i32:E,i64:E,i128:E,i256:E}),pn=I(m({name:yn,type:v,typeName:yn,docs:ee})),ls=m({len:z,type:v}),us=m({bitStoreType:v,bitOrderType:v}),hs=I(m({name:M,fields:pn,index:_,docs:ee})),ds=W({composite:pn,variant:hs,sequence:v,array:ls,tuple:I(v),primitive:as,compact:v,bitSequence:us}),fs=m({name:M,type:q(v)}),ys=I(fs),ps=m({id:v,path:ee,params:ys,def:ds,docs:ee}),ot=I(ps),gs=W({Blake2128:E,Blake2256:E,Blake2128Concat:E,Twox128:E,Twox256:E,Twox64Concat:E,Identity:E}),bs=I(gs),ws=m({hashers:bs,key:v,value:v}),vs=m({name:M,modifier:_,type:W({plain:v,map:ws}),fallback:ce(),docs:ee}),ms=q(m({prefix:M,items:I(vs)})),gn={name:M,storage:ms,calls:q(v),events:q(v),constants:I(m({name:M,type:v,value:ce(),docs:ee})),errors:q(v),index:_},xs={...gn,docs:ee},ks=new Uint8Array,bn=e=>k(()=>ks,()=>e),Es=m({type:v,version:_,signedExtensions:I(m({identifier:M,type:v,additionalSigned:v}))}),wn=m({lookup:ot,pallets:I(m({...gn,docs:bn([])})),extrinsic:Es,type:v,apis:bn([])}),Bs=m({name:M,methods:I(m({name:M,inputs:I(m({name:M,type:v})),output:v,docs:ee})),docs:ee}),Is=m({version:_,address:v,call:v,signature:v,extra:v,signedExtensions:I(m({identifier:M,type:v,additionalSigned:v}))}),vn=m({lookup:ot,pallets:I(m(xs)),extrinsic:Is,type:v,apis:I(Bs),outerEnums:m({call:v,event:v,error:v}),custom:I(X(M,m({type:v,value:ce()})))}),mn=()=>{throw new Error("Unsupported metadata version!")},R=k(mn,mn),Se=m({magicNumber:z,metadata:W({v0:R,v1:R,v2:R,v3:R,v4:R,v5:R,v6:R,v7:R,v8:R,v9:R,v10:R,v11:R,v12:R,v13:R,v14:wn,v15:vn})}),it=C(),As=q(it),Os=X(U,it),xn=e=>{try{return Se.dec(e)}catch{}try{return Se.dec(As.dec(e))}catch{}try{return Se.dec(it.dec(e))}catch{}try{return Se.dec(Os.dec(e)[1])}catch{}throw null},_s={dkLen:32},kn=e=>Ne(e,_s),Us={dkLen:16},En=e=>Ne(e,Us),Bn=e=>ie(En(e),e),te=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function ae(e,t,n,r,s){return e=e+t+s|0,r=Ve(r^e,16),n=n+r|0,t=Ve(t^n,12),{a:e,b:t,c:n,d:r}}function le(e,t,n,r,s){return e=e+t+s|0,r=Ve(r^e,8),n=n+r|0,t=Ve(t^n,7),{a:e,b:t,c:n,d:r}}function In(e,t,n,r,s,o,i,c,y,h,d,l,u,a,f,p,b,w,A,D){let B=0;for(let ne=0;ne<r;ne++)({a:s,b:y,c:u,d:b}=ae(s,y,u,b,n[t+e[B++]])),{a:s,b:y,c:u,d:b}=le(s,y,u,b,n[t+e[B++]]),{a:o,b:h,c:a,d:w}=ae(o,h,a,w,n[t+e[B++]]),{a:o,b:h,c:a,d:w}=le(o,h,a,w,n[t+e[B++]]),{a:i,b:d,c:f,d:A}=ae(i,d,f,A,n[t+e[B++]]),{a:i,b:d,c:f,d:A}=le(i,d,f,A,n[t+e[B++]]),{a:c,b:l,c:p,d:D}=ae(c,l,p,D,n[t+e[B++]]),{a:c,b:l,c:p,d:D}=le(c,l,p,D,n[t+e[B++]]),{a:s,b:h,c:f,d:D}=ae(s,h,f,D,n[t+e[B++]]),{a:s,b:h,c:f,d:D}=le(s,h,f,D,n[t+e[B++]]),{a:o,b:d,c:p,d:b}=ae(o,d,p,b,n[t+e[B++]]),{a:o,b:d,c:p,d:b}=le(o,d,p,b,n[t+e[B++]]),{a:i,b:l,c:u,d:w}=ae(i,l,u,w,n[t+e[B++]]),{a:i,b:l,c:u,d:w}=le(i,l,u,w,n[t+e[B++]]),{a:c,b:y,c:a,d:A}=ae(c,y,a,A,n[t+e[B++]]),{a:c,b:y,c:a,d:A}=le(c,y,a,A,n[t+e[B++]]);return{v0:s,v1:o,v2:i,v3:c,v4:y,v5:h,v6:d,v7:l,v8:u,v9:a,v10:f,v11:p,v12:b,v13:w,v14:A,v15:D}}const An=(()=>{const e=Array.from({length:16},(r,s)=>s),t=r=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(s=>r[s]),n=[];for(let r=0,s=e;r<7;r++,s=t(s))n.push(...s);return Uint8Array.from(n)})();class ct extends Dt{constructor(t={},n=0){if(super(64,t.dkLen===void 0?32:t.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=t.dkLen===void 0?32:t.dkLen,he(this.outputLen),t.key!==void 0&&t.context!==void 0)throw new Error("Blake3: only key or context can be specified at same time");if(t.key!==void 0){const r=J(t.key).slice();if(r.length!==32)throw new Error("Blake3: key should be 32 byte");this.IV=de(r),H||P(this.IV),this.flags=n|16}else if(t.context!==void 0){const r=new ct({dkLen:32},32).update(t.context).digest();this.IV=de(r),H||P(this.IV),this.flags=n|64}else this.IV=te.slice(),this.flags=n;this.state=this.IV.slice(),this.bufferOut=vr(this.bufferOut32)}get(){return[]}set(){}b2Compress(t,n,r,s=0){const{state:o,pos:i}=this,{h:c,l:y}=Re(BigInt(t),!0),{v0:h,v1:d,v2:l,v3:u,v4:a,v5:f,v6:p,v7:b,v8:w,v9:A,v10:D,v11:B,v12:ne,v13:$,v14:G,v15:xe}=In(An,s,r,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],te[0],te[1],te[2],te[3],c,y,i,n);o[0]=h^w,o[1]=d^A,o[2]=l^D,o[3]=u^B,o[4]=a^ne,o[5]=f^$,o[6]=p^G,o[7]=b^xe}compress(t,n=0,r=!1){let s=this.flags;if(this.chunkPos||(s|=1),(this.chunkPos===15||r)&&(s|=2),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,s,t,n),this.chunkPos+=1,this.chunkPos===16||r){let o=this.state;this.state=this.IV.slice();for(let i,c=this.chunksDone+1;(r||!(c&1))&&(i=this.stack.pop());c>>=1)this.buffer32.set(i,0),this.buffer32.set(o,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|4,this.buffer32,0),o=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(o)}this.pos=0}_cloneInto(t){t=super._cloneInto(t);const{IV:n,flags:r,state:s,chunkPos:o,posOut:i,chunkOut:c,stack:y,chunksDone:h}=this;return t.state.set(s.slice()),t.stack=y.map(d=>Uint32Array.from(d)),t.IV.set(n),t.flags=r,t.chunkPos=o,t.chunksDone=h,t.posOut=i,t.chunkOut=c,t.enableXOF=this.enableXOF,t.bufferOut32.set(this.bufferOut32),t}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let t of this.stack)t.fill(0)}b2CompressOut(){const{state:t,pos:n,flags:r,buffer32:s,bufferOut32:o}=this,{h:i,l:c}=Re(BigInt(this.chunkOut++));H||P(s);const{v0:y,v1:h,v2:d,v3:l,v4:u,v5:a,v6:f,v7:p,v8:b,v9:w,v10:A,v11:D,v12:B,v13:ne,v14:$,v15:G}=In(An,0,s,7,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],te[0],te[1],te[2],te[3],c,i,n,r);o[0]=y^b,o[1]=h^w,o[2]=d^A,o[3]=l^D,o[4]=u^B,o[5]=a^ne,o[6]=f^$,o[7]=p^G,o[8]=t[0]^b,o[9]=t[1]^w,o[10]=t[2]^A,o[11]=t[3]^D,o[12]=t[4]^B,o[13]=t[5]^ne,o[14]=t[6]^$,o[15]=t[7]^G,H||(P(s),P(o)),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let t=this.flags|8;this.stack.length?(t|=4,H||P(this.buffer32),this.compress(this.buffer32,0,!0),H||P(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):t|=(this.chunkPos?0:1)|2,this.flags=t,this.b2CompressOut()}writeInto(t){Be(this,!1),Pe(t),this.finish();const{blockLen:n,bufferOut:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=n&&this.b2CompressOut();const i=Math.min(n-this.posOut,o-s);t.set(r.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(t)}xof(t){return he(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ze(t,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const Ls=Er(e=>new ct(e)),Ss={dkLen:32},On=e=>Ls(e,Ss),Cs=e=>ie(On(e),e),_n=e=>e,pe=(e,t,n,r)=>new DataView(new Uint16Array([e,t,n,r]).buffer).getBigUint64(0,!0),at=2n**64n-1n,T=(e,t)=>e<<t&at|e>>64n-t,x=(e,t)=>e*t&at,L=(e,t)=>e+t&at,S=11400714785074694791n,N=14029467366897019727n,Un=1609587929392839161n,Ce=9650029242287828579n,Ln=2870177450012600261n;function ue(e,t=0n){let n=L(L(t,S),N),r=L(t,N),s=t,o=t-S,i=e.length,c=0,y=null;(function(){let a=0,f=a+i;if(i){if(y=new Uint8Array(32),i<32){y.set(e.subarray(0,i),c),c+=i;return}if(a<=f-32){const p=f-32;do{let b;b=pe(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),n=x(T(L(n,x(b,N)),31n),S),a+=8,b=pe(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),r=x(T(L(r,x(b,N)),31n),S),a+=8,b=pe(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),s=x(T(L(s,x(b,N)),31n),S),a+=8,b=pe(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),o=x(T(L(o,x(b,N)),31n),S),a+=8}while(a<=p)}a<f&&(y.set(e.subarray(a,f),c),c=f-a)}})(),e=y||e;let h,d=0;for(i>=32?(h=T(n,1n),h=L(h,T(r,7n)),h=L(h,T(s,12n)),h=L(h,T(o,18n)),n=x(T(x(n,N),31n),S),h=h^n,h=L(x(h,S),Ce),r=x(T(x(r,N),31n),S),h=h^r,h=L(x(h,S),Ce),s=x(T(x(s,N),31n),S),h=h^s,h=L(x(h,S),Ce),o=x(T(x(o,N),31n),S),h=h^o,h=L(x(h,S),Ce)):h=L(t,Ln),h=L(h,BigInt(i));d<=c-8;){let u=pe(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],e[d+5]<<8|e[d+4],e[d+7]<<8|e[d+6]);u=x(T(x(u,N),31n),S),h=L(x(T(h^u,27n),S),Ce),d+=8}if(d+4<=c){let u=x(pe(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],0,0),S);h=L(x(T(h^u,23n),N),Un),d+=4}for(;d<c;){const u=x(pe(e[d++],0,0,0),Ln);h=x(T(h^u,11n),S)}let l=h>>33n;return h=x(h^l,N),l=h>>29n,h=x(h^l,Un),l=h>>32n,h^=l,h}const lt=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,ue(e),!0),n.setBigUint64(8,ue(e,1n),!0),t},Ts=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,ue(e),!0),n.setBigUint64(8,ue(e,1n),!0),n.setBigUint64(16,ue(e,2n),!0),n.setBigUint64(24,ue(e,3n),!0),t},Sn=e=>ie(Me.enc(ue(e)),e),Cn=new TextEncoder,Tn=e=>{const t=lt(Cn.encode(e));return(n,r,...s)=>{const o=ie(t,lt(Cn.encode(n))),i=j(o),c=s.map(l=>l[1]).map(l=>{switch(l){case _n:return 0;case Sn:return 8;case Bn:return 16;default:return null}}).filter(l=>l!==null),y=l=>{if(!l.startsWith(i))throw new Error(`key does not match this storage (${e}.${n})`);if(c.length!==s.length)throw new Error("Impossible to decode this key");if(s.length===0)return[];const u=l.slice(i.length),a=new Array(s.length);for(let f=0,p=0;f<c.length;f++){const b=s[f][0];p+=c[f],a[f]=b.dec(u.slice(p*2)),p+=b.enc(a[f]).length}return a},h=s.map(([{enc:l},u])=>a=>u(l(a)));return{enc:(...l)=>j(ie(o,...l.map((u,a)=>h[a](u)))),dec:r,keyDecoder:y}}};var Dn=Object.freeze({__proto__:null,AccountId:Ie,Bin:Ue,Binary:et,Blake2128:En,Blake2128Concat:Bn,Blake2256:kn,Blake3256:On,Blake3256Concat:Cs,Bytes:C,Enum:tt,FixedSizeBinary:Kt,Hex:ce,Identity:_n,Option:q,Result:He,ScaleEnum:W,Self:tn,Storage:Tn,Struct:m,Tuple:X,Twox128:lt,Twox256:Ts,Twox64Concat:Sn,Variant:ve,Vector:I,_Enum:Gr,_void:E,bitSequence:Yt,blockHeader:cs,bool:Ge,char:qr,compact:U,compactBn:zt,compactNumber:v,createCodec:k,createDecoder:We,decAnyMetadata:xn,enhanceCodec:we,enhanceDecoder:$e,enhanceEncoder:De,ethAccount:hn,fixedStr:Wr,fromBufferToBase58:Nt,getSs58AddressInfo:Rt,h64:ue,i128:Gn,i16:qn,i256:Yn,i32:Xn,i64:Kn,i8:Fn,metadata:Se,selfDecoder:en,selfEncoder:Zt,str:M,u128:Wn,u16:Ee,u256:zn,u32:z,u64:Me,u8:_,v14:wn,v14Lookup:ot,v15:vn});const $n=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",ge={type:"void"},Ds=(e,t=()=>null)=>{const n=new Map,r=new Set,s=d=>l=>{let u=n.get(l);if(u)return u;if(r.has(l)){const f={id:l};return n.set(l,f),f}r.add(l);const a=d(l);return u=n.get(l),u?Object.assign(u,a):(u={id:l,...a},n.set(l,u)),r.delete(l),u};let o=!0,i=!0;const c=s(d=>{const l=t(e[d]);if(l)return l;const{def:u,path:a,params:f}=e[d];if(u.tag==="composite"){if(u.value.length===0)return ge;if(u.value.length===1){const p=c(u.value[0].type);return o&&a.at(-1)==="AccountId32"&&$n(p,32)?(o=!1,{type:"AccountId32"}):i&&a.at(-1)==="AccountId20"&&$n(p,20)?(i=!1,{type:"AccountId20"}):p}return y(u.value)}if(u.tag==="variant"){if(a.length===1&&a[0]==="Option"&&f.length===1&&f[0].name==="T"){const w=c(f[0].type);return w.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:w}}if(a.length===1&&a[0]==="Result"&&f.length===2&&f[0].name==="T"&&f[1].name==="E")return{type:"result",value:{ok:c(f[0].type),ko:c(f[1].type)}};if(u.value.length===0)return ge;const p={},b={};return u.value.forEach(w=>{const A=w.name;if(b[A]=w.docs,w.fields.length===0){p[A]={...ge,idx:w.index};return}if(w.fields.length===1&&!w.fields[0].name){p[A]={type:"lookupEntry",value:c(w.fields[0].type),idx:w.index};return}p[A]={...y(w.fields),idx:w.index}}),{type:"enum",value:p,innerDocs:b}}if(u.tag==="sequence")return{type:"sequence",value:c(u.value)};if(u.tag==="array"){const{len:p}=u.value,b=c(u.value.type);return!p||b.type==="void"?ge:p>1?{type:"array",value:b,len:u.value.len}:b}if(u.tag==="tuple")return u.value.length===0?ge:u.value.length>1?h(u.value.map(p=>c(p)),u.value.map(p=>e[p].docs)):c(u.value[0]);if(u.tag==="primitive")return{type:"primitive",value:u.value.tag};if(u.tag==="compact"){const p=c(u.value);return p.type==="void"?{type:"compact",isBig:null}:{type:"compact",isBig:Number(p.value.slice(1))>32}}return{type:u.tag}}),y=d=>{let l=!0;const u={},a={};return d.forEach((f,p)=>{l=l&&!!f.name;const b=f.name||p,w=c(f.type);w.type!=="void"&&(u[b]=w,a[b]=f.docs)}),l?{type:"struct",value:u,innerDocs:a}:h(Object.values(u),Object.values(a))},h=(d,l)=>{if(d.every(u=>u.id===d[0].id)&&l.every(u=>!u.length)){const[u]=d;return u.type==="void"?ge:{type:"array",value:d[0],len:d.length}}return{type:"tuple",value:d,innerDocs:l}};return c},$s=e=>{const t=Ds(e.lookup,({def:s})=>{if(s.tag==="composite"){const o=n(s);if(o)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(i=>[i.name,i.errors==null?{...ge,idx:i.index}:{type:"lookupEntry",value:t(i.errors),idx:i.index}])),byteLength:o}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const i=t(s.value[0].type),c=t(s.value[1].type);return i.type==="primitive"&&i.value==="u8"&&c.type==="array"&&c.value.type==="primitive"&&c.value.value==="u8"?1+c.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(i=>i.name==="Call")?.type??null})},Ms=(e,t,n)=>(r,s,o,...i)=>{const{id:c}=r;if(s.has(c))return s.get(c);if(o.has(c)){const h=t(()=>s.get(c),r,...i);return s.set(c,h),h}o.add(c);let y=e(r,s,o,...i);return o.delete(c),s.has(c)&&(y=n(y,s.get(c),r,...i)),s.set(c,y),y},Hs=Ue(),Ps=k(U[0],$e(U[1],BigInt)),Mn=Ms((e,t,n,r)=>{if(e.type==="primitive")return Dn[e.value];if(e.type==="void")return E;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return hn;if(e.type==="compact")return e.isBig?Ps:U;if(e.type==="bitSequence")return Yt;const s=a=>Mn(a,t,n,r),o=(a,f)=>{const p=s(a);return f?I(p,f):I(p)},i=a=>X(...a.map(s)),c=a=>{const f=Object.fromEntries(Object.entries(a).map(([p,b])=>[p,s(b)]));return m(f)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return Hs;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?Ue(e.len):o(e.value,e.len);if(e.type==="sequence")return o(e.value);if(e.type==="tuple")return i(e.value);if(e.type==="struct")return c(e.value);if(e.type==="option")return q(s(e.value));if(e.type==="result")return He(s(e.value.ok),s(e.value.ko));const y=Object.values(e.value).map(a=>{switch(a.type){case"void":return E;case"lookupEntry":return s(a.value);case"tuple":return i(a.value);case"struct":return c(a.value);case"array":return o(a.value,a.len)}}),h=Object.fromEntries(Object.keys(e.value).map((a,f)=>[a,y[f]])),d=Object.values(e.value).map(a=>a.idx),u=d.every((a,f)=>a===f)?ve(h):ve(h,d);return e.byteLength?Vs(u,e.byteLength):u},tn,e=>e),Hn=(e,t=Ie())=>{const n=new Map,r=s=>Mn(e(s),n,new Set,t);return s=>r(s)},Vs=(e,t)=>{const n=C(t);return k(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},js=e=>{const{metadata:t}=e;let n=Hn(e);const r=t.pallets.find(l=>l.name==="System")?.constants.find(l=>l.name==="SS58Prefix");let s;if(r)try{const l=n(r.type).dec(r.value);typeof l=="number"&&(s=l,n=Hn(e,Ie(l)))}catch{}const o=new Map,i=(l,u)=>{let a=o.get(l);a||o.set(l,a=Tn(l));const f=t.pallets.find($=>$.name===l).storage.items.find($=>$.name===u),p=($,...G)=>{const xe=a(...G);return{...xe,len:$,fallback:f.modifier===1?xe.dec(f.fallback):void 0}};if(f.type.tag==="plain")return p(0,u,n(f.type.value).dec);const{key:b,value:w,hashers:A}=f.type.value,D=n(w),B=A.map($=>Dn[$.tag]),ne=(()=>{if(B.length===1)return[[n(b),B[0]]];const $=e(b);switch($.type){case"array":return B.map(G=>[n($.value.id),G]);case"tuple":return $.value.map((G,xe)=>[n(G.id),B[xe]]);default:throw new Error("Invalid key type")}})();return p(B.length,u,D.dec,...ne)},c=l=>{switch(l.type){case"void":return E;case"lookupEntry":return n(l.value.id);case"tuple":return X(...Object.values(l.value).map(u=>n(u.id)));case"struct":return m(Ze(l.value,u=>n(u.id)));case"array":return I(n(l.value.id),l.len)}},y=(l,u)=>{const a=t.pallets.find(f=>f.name===l).constants.find(f=>f.name===u);return n(a.type)},h=l=>(u,a)=>{const f=t.pallets.find(w=>w.name===u),p=e(f[l]);if(p.type!=="enum")throw null;const b=p.value[a];return{location:[f.index,b.idx],codec:c(p.value[a])}},d=(l,u)=>{const a=t.apis.find(f=>f.name===l)?.methods.find(f=>f.name===u);if(!a)throw null;return{args:X(...a.inputs.map(f=>n(f.type))),value:n(a.output)}};return{buildDefinition:n,buildStorage:i,buildEvent:h("events"),buildError:h("errors"),buildRuntimeCall:d,buildCall:h("calls"),buildConstant:y,ss58Prefix:s}},me=(e,t)=>{let n=e.toString(16);n=(n.length%2?"0":"")+n;const r=Math.max(0,(t||0)-n.length/2);return"0x"+"00".repeat(r)+n},Rs=({additionalSigned:e})=>({genesisHash:j(e)}),Ns=({value:e})=>({nonce:me(U.dec(e),4)}),Fs=({additionalSigned:e})=>({transactionVersion:me(z.dec(e),4)}),qs=m({tip:U,asset:q(C(1/0))}).dec;var Pn=Object.freeze({__proto__:null,ChargeAssetTxPayment:({value:e})=>{const{tip:t,asset:n}=qs(e);return{...n?{assetId:j(n)}:{},tip:me(t,16)}},ChargeTransactionPayment:({value:e})=>({tip:me(zt.dec(e),16)}),CheckGenesis:Rs,CheckMetadataHash:({value:e,additionalSigned:t})=>e.length&&e[0]?{mode:1,metadataHash:j(t.length?t.slice(1):t)}:{},CheckMortality:({value:e,additionalSigned:t},n)=>({era:j(e),blockHash:j(t),blockNumber:me(n,4)}),CheckNonce:Ns,CheckSpecVersion:({additionalSigned:e})=>({specVersion:me(z.dec(e),4)}),CheckTxVersion:Fs});const Xs=e=>{const t=js($s(e)),n=e.pallets.find(r=>r.name==="System").constants.find(r=>r.name==="SS58Prefix");return t.buildDefinition(n.type).dec(n.value)},Ks=De(_.enc,e=>+!!e.signed<<7|e.version),Ws=Ie().enc;function Gs(e,t,n){const r=i=>n({address:e,data:j(i),type:"bytes"}).then(({signature:c})=>fe(c)),s=Ws(e);return{publicKey:s,signTx:async(i,c,y,h,d=kn)=>{let l;try{const b=xn(y);if(b.metadata.tag!=="v14"&&b.metadata.tag!=="v15")throw null;l=b.metadata.value}catch{throw new Error("Unsupported metadata version")}const u={};u.signedExtensions=[];const{version:a}=l.extrinsic,f=[];l.extrinsic.signedExtensions.map(({identifier:b})=>{const w=c[b];if(!w)throw new Error(`Missing ${b} signed-extension`);if(f.push(w.value),u.signedExtensions.push(b),!Pn[b]){if(w.value.length===0&&w.additionalSigned.length===0)return;throw new Error(`PJS does not support this signed-extension: ${b}`)}Object.assign(u,Pn[b](w,h))}),u.address=Ie(Xs(l)).dec(s),u.method=j(i),u.version=a,u.withSignedTransaction=!0;const p=await t(u);if(!p.signedTransaction){const b=ie(Ks({signed:!0,version:a}),new Uint8Array([0,...s]),fe(p.signature),...f,i);return ie(U.enc(b.length),b)}return typeof p.signedTransaction=="string"?fe(p.signedTransaction):p.signedTransaction},signBytes:r}}const zs=new Set(["ed25519","sr25519","ecdsa"]),Ys=async e=>{let t=window.injectedWeb3?.[e];if(!t)throw new Error(`Unavailable extension: "${e}"`);const n=await t.enable(),r=n.signer.signPayload.bind(n.signer),s=n.signer.signRaw.bind(n.signer),o=h=>h.filter(({type:d})=>zs.has(d)).map(d=>{const l=Gs(d.address,r,s);return{...d,polkadotSigner:l}});let i=o(await n.accounts.get());const c=new Set,y=n.accounts.subscribe(h=>{i=o(h),c.forEach(d=>{d(i)})});return{name:e,getAccounts:()=>i,subscribe:h=>(c.add(h),()=>{c.delete(h)}),disconnect:()=>{y()}}},Js=()=>{const{injectedWeb3:e}=window;return e?Object.keys(e):[]};be.connectInjectedExtension=Ys,be.getInjectedExtensions=Js});
1
+ (function(be,ke){typeof exports=="object"&&typeof module<"u"?ke(exports):typeof define=="function"&&define.amd?define(["exports"],ke):(be=typeof globalThis<"u"?globalThis:be||self,ke(be.papiPjsSigner={}))})(this,function(be){"use strict";var ke=Object.defineProperty,Vn=(e,t,n)=>t in e?ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ut=(e,t,n)=>(Vn(e,typeof t!="symbol"?t+"":t,n),n),Ke={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function jn(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|Ke[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=Ke[e[i]],y=Ke[e[i+1]];s[t+o++]=c<<4|y}return s}var ht=class extends Uint8Array{constructor(e){super(e),ut(this,"i",0),ut(this,"v"),this.v=new DataView(e)}},F=e=>t=>e(t instanceof ht?t:new ht(t instanceof Uint8Array?t.buffer:typeof t=="string"?jn(t).buffer:t)),K=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].byteLength;const r=new Uint8Array(n);for(let s=0,o=0;s<t;s++){const i=e[s];r.set(i,o),o+=i.byteLength}return r};function Te(e,t){const n=Object.keys(e),r=n.length,s={};for(let o=0;o<r;o++){const i=n[o];s[i]=t(e[i],i)}return s}var We=F,k=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},De=(e,t)=>n=>e(t(n)),$e=(e,t)=>n=>t(e(n)),we=([e,t],n,r)=>k(De(e,n),$e(t,r));function Rn(e,t){return F(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function Nn(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function re(e,t,n){return k(Nn(e,n),Rn(e,t))}var _=re(1,"getUint8","setUint8"),Ee=re(2,"getUint16","setUint16"),z=re(4,"getUint32","setUint32"),Me=re(8,"getBigUint64","setBigUint64"),Fn=re(1,"getInt8","setInt8"),qn=re(2,"getInt16","setInt16"),Xn=re(4,"getInt32","setInt32"),Kn=re(8,"getBigInt64","setBigInt64"),dt=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},ft=e=>F(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),o=n[e](r+8,!0);return t.i+=16,o<<64n|s}),Wn=k(dt,ft("getBigUint64")),Gn=k(dt,ft("getBigInt64")),yt=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},pt=e=>F(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n}),zn=k(yt,pt("getBigUint64")),Yn=k(yt,pt("getBigInt64")),Ge=we(_,e=>e?1:0,Boolean),Jn=[_[1],Ee[1],z[1]],Qn=F(e=>{const t=e[e.i],n=t&3;if(n<3)return Jn[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const o=r/8|0;let i=0n;for(let y=0;y<o;y++)s=Me[1](e)<<i|s,i+=64n;let c=r%8;return c>3&&(s=BigInt(z[1](e))<<i|s,i+=32n,c-=4),c>1&&(s=BigInt(Ee[1](e))<<i|s,i+=16n,c-=2),c&&(s=BigInt(_[1](e))<<i|s),s}),Zn=1n<<56n,er=1<<24,tr=256,nr=4294967295n,rr=64,sr=16384,or=1<<30,ir=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<rr)return _[0](t);if(e<sr)return Ee[0](t|1);if(e<or)return z[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=Zn;)n.push(Me[0](r)),r>>=64n;r>=er&&(n.push(z[0](Number(r&nr))),r>>=32n);let s=Number(r);s>=tr&&(n.push(Ee[0](s)),s>>=16),s&&n.push(_[0](s));const o=K(n);return o[0]=o.length-5<<2|3,o},U=k(ir,Qn),cr=new TextEncoder,ar=e=>{const t=cr.encode(e);return K([U.enc(t.length),t])},lr=new TextDecoder,ur=F(e=>{let t=U.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,lr.decode(n)}),M=k(ar,ur),hr=()=>{},dr=new Uint8Array(0),E=k(()=>dr,hr),gt=e=>e===void 0?t=>K([U.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),bt=e=>F(t=>{const n=e===void 0?U.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),C=e=>k(gt(e),bt(e));C.enc=gt,C.dec=bt;var wt=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,i)=>[n[i],o])??n.map((o,i)=>[o,i])),s=o=>r.get(o);return({tag:o,value:i})=>K([_.enc(s(o)),e[o](i)])},vt=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,o)=>[s,n[o]])??n.map((s,o)=>[o,s]));return F(s=>{const o=_.dec(s),i=r.get(o),c=e[i];return{tag:i,value:c(s)}})},W=(e,...t)=>k(wt(Te(e,([n])=>n),...t),vt(Te(e,([,n])=>n),...t));W.enc=wt,W.dec=vt;var mt=e=>F(t=>{const n=_.dec(t);if(n!==0)return e===Ge[1]?n===1:e(t)}),xt=e=>t=>{const n=new Uint8Array(1);return t===void 0?(n[0]=0,n):(n[0]=1,e===Ge[0]?(n[0]=t?1:2,n):K([n,e(t)]))},q=e=>k(xt(e[0]),mt(e[1]));q.enc=xt,q.dec=mt;var kt=(e,t)=>F(n=>{const r=_[1](n)===0,o=(r?e:t)(n);return{success:r,value:o}}),Et=(e,t)=>({success:n,value:r})=>K([_[0](n?0:1),(n?e:t)(r)]),He=(e,t)=>k(Et(e[0],t[0]),kt(e[1],t[1]));He.dec=kt,He.enc=Et;var Bt=(...e)=>F(t=>e.map(n=>n(t))),It=(...e)=>t=>K(e.map((n,r)=>n(t[r]))),X=(...e)=>k(It(...e.map(([t])=>t)),Bt(...e.map(([,t])=>t)));X.enc=It,X.dec=Bt;var At=e=>{const t=Object.keys(e);return De(X.enc(...Object.values(e)),n=>t.map(r=>n[r]))},Ot=e=>{const t=Object.keys(e);return $e(X.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},m=e=>k(At(Te(e,t=>t[0])),Ot(Te(e,t=>t[1])));m.enc=At,m.dec=Ot;var _t=(e,t)=>t>=0?n=>K(n.map(e)):n=>K([U.enc(n.length),K(n.map(e))]),Ut=(e,t)=>F(n=>{const r=t>=0?t:U.dec(n),s=new Array(r);for(let o=0;o<r;o++)s[o]=e(n);return s}),I=(e,t)=>k(_t(e[0],t),Ut(e[1],t));I.enc=_t,I.dec=Ut;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function yr(...e){const t=o=>o,n=(o,i)=>c=>o(i(c)),r=e.map(o=>o.encode).reduceRight(n,t),s=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:s}}function pr(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(n=>{if(n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=e.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})}}}function gr(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function Lt(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const s=[],o=Array.from(e);for(o.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,c=!0;for(let y=r;y<o.length;y++){const h=o[y],d=t*i+h;if(!Number.isSafeInteger(d)||t*i/t!==i||d-h!==t*i)throw new Error("convertRadix: carry overflow");i=d%n;const l=Math.floor(d/n);if(o[y]=l,!Number.isSafeInteger(l)||l*n+i!==d)throw new Error("convertRadix: carry overflow");if(c)l?c=!1:r=y;else continue}if(s.push(i),c)break}for(let i=0;i<e.length-1&&e[i]===0;i++)s.push(0);return s.reverse()}function br(e){return{encode:t=>{if(!fr(t))throw new Error("radix.encode input should be Uint8Array");return Lt(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(Lt(t,e,2**8))}}}const St=(e=>yr(br(58),pr(e),gr("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function de(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function wr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Pe(e,...t){if(!wr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Be(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ze(e,t){Pe(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vr=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),fe=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Ve=(e,t)=>e<<32-t|e>>>t,H=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Ct=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,Y=H?e=>e:e=>Ct(e);function P(e){for(let t=0;t<e.length;t++)e[t]=Ct(e[t])}function mr(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function J(e){return typeof e=="string"&&(e=mr(e)),Pe(e),e}class Tt{clone(){return this._cloneInto()}}function xr(e){const t=r=>e().update(J(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function kr(e){const t=(r,s)=>e(s).update(J(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function Er(e){const t=(r,s)=>e(s).update(J(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Br=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class Dt extends Tt{constructor(t,n,r={},s,o,i){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,de(t),de(n),de(s),n<0||n>s)throw new Error("outputLen bigger than keyLen");if(r.key!==void 0&&(r.key.length<1||r.key.length>s))throw new Error(`key must be up 1..${s} byte long or undefined`);if(r.salt!==void 0&&r.salt.length!==o)throw new Error(`salt must be ${o} byte long or undefined`);if(r.personalization!==void 0&&r.personalization.length!==i)throw new Error(`personalization must be ${i} byte long or undefined`);this.buffer32=fe(this.buffer=new Uint8Array(t))}update(t){Be(this);const{blockLen:n,buffer:r,buffer32:s}=this;t=J(t);const o=t.length,i=t.byteOffset,c=t.buffer;for(let y=0;y<o;){this.pos===n&&(H||P(s),this.compress(s,0,!1),H||P(s),this.pos=0);const h=Math.min(n-this.pos,o-y),d=i+y;if(h===n&&!(d%4)&&y+h<o){const l=new Uint32Array(c,d,Math.floor((o-y)/4));H||P(l);for(let u=0;y+n<o;u+=s.length,y+=n)this.length+=n,this.compress(l,u,!1);H||P(l);continue}r.set(t.subarray(y,y+h),this.pos),this.pos+=h,this.length+=h,y+=h}return this}digestInto(t){Be(this),ze(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,this.buffer.subarray(n).fill(0),H||P(r),this.compress(r,0,!0),H||P(r);const s=fe(t);this.get().forEach((o,i)=>s[i]=Y(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:o,outputLen:i,pos:c}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.length=r,t.finished=s,t.destroyed=o,t.outputLen=i,t.buffer.set(n),t.pos=c,t}}const je=BigInt(2**32-1),Ye=BigInt(32);function Re(e,t=!1){return t?{h:Number(e&je),l:Number(e>>Ye&je)}:{h:Number(e>>Ye&je)|0,l:Number(e&je)|0}}function $t(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:i}=Re(e[s],t);[n[s],r[s]]=[o,i]}return[n,r]}const Ir=(e,t)=>BigInt(e>>>0)<<Ye|BigInt(t>>>0),Ar=(e,t,n)=>e>>>n,Or=(e,t,n)=>e<<32-n|t>>>n,_r=(e,t,n)=>e>>>n|t<<32-n,Ur=(e,t,n)=>e<<32-n|t>>>n,Lr=(e,t,n)=>e<<64-n|t>>>n-32,Sr=(e,t,n)=>e>>>n-32|t<<64-n,Cr=(e,t)=>t,Tr=(e,t)=>e,Mt=(e,t,n)=>e<<n|t>>>32-n,Ht=(e,t,n)=>t<<n|e>>>32-n,Pt=(e,t,n)=>t<<n-32|e>>>64-n,Vt=(e,t,n)=>e<<n-32|t>>>64-n;function Dr(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const V={fromBig:Re,split:$t,toBig:Ir,shrSH:Ar,shrSL:Or,rotrSH:_r,rotrSL:Ur,rotrBH:Lr,rotrBL:Sr,rotr32H:Cr,rotr32L:Tr,rotlSH:Mt,rotlSL:Ht,rotlBH:Pt,rotlBL:Vt,add:Dr,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,add5H:(e,t,n,r,s,o)=>t+n+r+s+o+(e/2**32|0)|0,add5L:(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},O=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),g=new Uint32Array(32);function se(e,t,n,r,s,o){const i=s[o],c=s[o+1];let y=g[2*e],h=g[2*e+1],d=g[2*t],l=g[2*t+1],u=g[2*n],a=g[2*n+1],f=g[2*r],p=g[2*r+1],b=V.add3L(y,d,i);h=V.add3H(b,h,l,c),y=b|0,{Dh:p,Dl:f}={Dh:p^h,Dl:f^y},{Dh:p,Dl:f}={Dh:V.rotr32H(p,f),Dl:V.rotr32L(p,f)},{h:a,l:u}=V.add(a,u,p,f),{Bh:l,Bl:d}={Bh:l^a,Bl:d^u},{Bh:l,Bl:d}={Bh:V.rotrSH(l,d,24),Bl:V.rotrSL(l,d,24)},g[2*e]=y,g[2*e+1]=h,g[2*t]=d,g[2*t+1]=l,g[2*n]=u,g[2*n+1]=a,g[2*r]=f,g[2*r+1]=p}function oe(e,t,n,r,s,o){const i=s[o],c=s[o+1];let y=g[2*e],h=g[2*e+1],d=g[2*t],l=g[2*t+1],u=g[2*n],a=g[2*n+1],f=g[2*r],p=g[2*r+1],b=V.add3L(y,d,i);h=V.add3H(b,h,l,c),y=b|0,{Dh:p,Dl:f}={Dh:p^h,Dl:f^y},{Dh:p,Dl:f}={Dh:V.rotrSH(p,f,16),Dl:V.rotrSL(p,f,16)},{h:a,l:u}=V.add(a,u,p,f),{Bh:l,Bl:d}={Bh:l^a,Bl:d^u},{Bh:l,Bl:d}={Bh:V.rotrBH(l,d,63),Bl:V.rotrBL(l,d,63)},g[2*e]=y,g[2*e+1]=h,g[2*t]=d,g[2*t+1]=l,g[2*n]=u,g[2*n+1]=a,g[2*r]=f,g[2*r+1]=p}class $r extends Dt{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=O[0]|0,this.v0h=O[1]|0,this.v1l=O[2]|0,this.v1h=O[3]|0,this.v2l=O[4]|0,this.v2h=O[5]|0,this.v3l=O[6]|0,this.v3h=O[7]|0,this.v4l=O[8]|0,this.v4h=O[9]|0,this.v5l=O[10]|0,this.v5h=O[11]|0,this.v6l=O[12]|0,this.v6h=O[13]|0,this.v7l=O[14]|0,this.v7h=O[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|1<<24,t.salt){const r=fe(J(t.salt));this.v4l^=Y(r[0]),this.v4h^=Y(r[1]),this.v5l^=Y(r[2]),this.v5h^=Y(r[3])}if(t.personalization){const r=fe(J(t.personalization));this.v6l^=Y(r[0]),this.v6h^=Y(r[1]),this.v7l^=Y(r[2]),this.v7h^=Y(r[3])}if(t.key){const r=new Uint8Array(this.blockLen);r.set(J(t.key)),this.update(r)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:o,v2h:i,v3l:c,v3h:y,v4l:h,v4h:d,v5l:l,v5h:u,v6l:a,v6h:f,v7l:p,v7h:b}=this;return[t,n,r,s,o,i,c,y,h,d,l,u,a,f,p,b]}set(t,n,r,s,o,i,c,y,h,d,l,u,a,f,p,b){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=o|0,this.v2h=i|0,this.v3l=c|0,this.v3h=y|0,this.v4l=h|0,this.v4h=d|0,this.v5l=l|0,this.v5h=u|0,this.v6l=a|0,this.v6h=f|0,this.v7l=p|0,this.v7h=b|0}compress(t,n,r){this.get().forEach((y,h)=>g[h]=y),g.set(O,16);let{h:s,l:o}=V.fromBig(BigInt(this.length));g[24]=O[8]^o,g[25]=O[9]^s,r&&(g[28]=~g[28],g[29]=~g[29]);let i=0;const c=Br;for(let y=0;y<12;y++)se(0,4,8,12,t,n+2*c[i++]),oe(0,4,8,12,t,n+2*c[i++]),se(1,5,9,13,t,n+2*c[i++]),oe(1,5,9,13,t,n+2*c[i++]),se(2,6,10,14,t,n+2*c[i++]),oe(2,6,10,14,t,n+2*c[i++]),se(3,7,11,15,t,n+2*c[i++]),oe(3,7,11,15,t,n+2*c[i++]),se(0,5,10,15,t,n+2*c[i++]),oe(0,5,10,15,t,n+2*c[i++]),se(1,6,11,12,t,n+2*c[i++]),oe(1,6,11,12,t,n+2*c[i++]),se(2,7,8,13,t,n+2*c[i++]),oe(2,7,8,13,t,n+2*c[i++]),se(3,4,9,14,t,n+2*c[i++]),oe(3,4,9,14,t,n+2*c[i++]);this.v0l^=g[0]^g[16],this.v0h^=g[1]^g[17],this.v1l^=g[2]^g[18],this.v1h^=g[3]^g[19],this.v2l^=g[4]^g[20],this.v2h^=g[5]^g[21],this.v3l^=g[6]^g[22],this.v3h^=g[7]^g[23],this.v4l^=g[8]^g[24],this.v4h^=g[9]^g[25],this.v5l^=g[10]^g[26],this.v5h^=g[11]^g[27],this.v6l^=g[12]^g[28],this.v6h^=g[13]^g[29],this.v7l^=g[14]^g[30],this.v7h^=g[15]^g[31],g.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Ne=kr(e=>new $r(e)),jt=new TextEncoder().encode("SS58PRE"),Je=2,Rt=e=>{try{const t=St.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-Je),s=t.subarray(n.length+r.length),o=Ne(Uint8Array.of(...jt,...n,...r),{dkLen:64}).subarray(0,Je);return s[0]===o[0]&&s[1]===o[1]?{isValid:!0,ss58Format:Mr(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},Mr=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},Nt=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=Ne(Uint8Array.of(...jt,...t,...n),{dkLen:64}).subarray(0,Je);return St.encode(Uint8Array.of(...t,...n,...r))}};function Hr(e,t){return n=>{const r=Rt(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const Ie=(e=42,t=32)=>we(C(t),Hr(t),Nt(e)),Ft="0123456789abcdef";function j(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Ft[r>>4]+Ft[r&15]}return t.join("")}const Qe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ye(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|Qe[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=Qe[e[i]],y=Qe[e[i+1]];s[t+o++]=c<<4|y}return s}function Ze(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}const ie=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const o=e[r];n.set(o,s),s+=o.byteLength}return n};var Pr=Object.defineProperty,qt=e=>{throw TypeError(e)},Vr=(e,t,n)=>t in e?Pr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ae=(e,t,n)=>Vr(e,typeof t!="symbol"?t+"":t,n),Xt=(e,t,n)=>t.has(e)||qt("Cannot "+n),Q=(e,t,n)=>(Xt(e,t,"read from private field"),n?n.call(e):t.get(e)),Oe=(e,t,n)=>t.has(e)?qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),pe=(e,t,n,r)=>(Xt(e,t,"write to private field"),t.set(e,n),n),Z,_e,Fe,qe,Xe;const jr=new TextEncoder,Rr=new TextDecoder,Nr=X(U,C(1/0))[1];class et{constructor(t,n=!1){if(Oe(this,Z),Oe(this,_e,null),Oe(this,Fe,null),Oe(this,qe,null),Oe(this,Xe,null),Ae(this,"asText",()=>Q(this,Xe)??pe(this,Xe,Rr.decode(Q(this,Z)))),Ae(this,"asHex",()=>Q(this,Fe)||pe(this,Fe,j(Q(this,Z)))),Ae(this,"asOpaqueHex",()=>Q(this,qe)||pe(this,qe,j(this.asBytes()))),Ae(this,"asBytes",()=>Q(this,Z)),Ae(this,"asOpaqueBytes",()=>Q(this,_e)||pe(this,_e,ie(U[0](Q(this,Z).length),Q(this,Z)))),n){try{const[r,s]=Nr(t);if(r===s.length){pe(this,Z,s),pe(this,_e,t);return}}catch{}throw new Error("Invalid opaque bytes")}else pe(this,Z,t)}static fromText(t){return new this(jr.encode(t))}static fromHex(t){return new this(ye(t))}static fromOpaqueHex(t){return new this(ye(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}Z=new WeakMap,_e=new WeakMap,Fe=new WeakMap,qe=new WeakMap,Xe=new WeakMap;class Kt extends et{constructor(t){super(t)}static fromArray(t){return new this(new Uint8Array(t))}}const Wt=e=>{const t=C.enc(e);return n=>t(n.asBytes())},Gt=e=>{const t=C.dec(e),n=e==null?et:Kt;return r=>n.fromBytes(t(r))},Ue=e=>k(Wt(e),Gt(e));Ue.enc=Wt,Ue.dec=Gt;const v=U,zt=U,Fr=We(e=>{const t=v.dec(e),n=Math.ceil(t/8);return{bytes:C(n).dec(e),bitsLen:t}}),Yt=k(e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=v.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},Fr),qr=we(_,e=>e.charCodeAt(0),String.fromCharCode),Jt=e=>{const t=C.enc(e);return n=>t(ye(n))},Qt=e=>{const t=C.dec(e);return n=>j(t(n))},ce=e=>k(Jt(e),Qt(e));ce.enc=Jt,ce.dec=Qt;const Xr=new TextEncoder,Kr=new TextDecoder,Wr=e=>we(C(e),t=>Xr.encode(t),t=>Kr.decode(t)),Zt=e=>{let t=n=>{const r=e();return t=r,r(n)};return n=>t(n)},en=e=>{let t=n=>{const r=e(),s=r;return t=r,s(n)};return n=>t(n)},tn=e=>k(Zt(()=>e().enc),en(()=>e().dec)),tt=Object.assign((e,t)=>({type:e,value:t}),{is(e,t){return e.type===t},as(e,t){if(t!==e.type)throw new Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),Gr=new Proxy({},{get(e,t){return n=>tt(t,n)}}),nn=(...e)=>{const t=W.enc(...e);return n=>t({tag:n.type,value:n.value})},rn=(...e)=>{const t=W.dec(...e);return n=>{const{tag:r,value:s}=t(n);return tt(r,s)}},ve=(e,...t)=>k(nn(Ze(e,([n])=>n),...t),rn(Ze(e,([,n])=>n),...t));ve.enc=nn,ve.dec=rn;const sn=[],on=[],cn=[],zr=BigInt(0),Le=BigInt(1),Yr=BigInt(2),Jr=BigInt(7),Qr=BigInt(256),Zr=BigInt(113);for(let e=0,t=Le,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],sn.push(2*(5*r+n)),on.push((e+1)*(e+2)/2%64);let s=zr;for(let o=0;o<7;o++)t=(t<<Le^(t>>Jr)*Zr)%Qr,t&Yr&&(s^=Le<<(Le<<BigInt(o))-Le);cn.push(s)}const[es,ts]=$t(cn,!0),an=(e,t,n)=>n>32?Pt(e,t,n):Mt(e,t,n),ln=(e,t,n)=>n>32?Vt(e,t,n):Ht(e,t,n);function ns(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,y=(i+2)%10,h=n[y],d=n[y+1],l=an(h,d,1)^n[c],u=ln(h,d,1)^n[c+1];for(let a=0;a<50;a+=10)e[i+a]^=l,e[i+a+1]^=u}let s=e[2],o=e[3];for(let i=0;i<24;i++){const c=on[i],y=an(s,o,c),h=ln(s,o,c),d=sn[i];s=e[d],o=e[d+1],e[d]=y,e[d+1]=h}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=es[r],e[1]^=ts[r]}n.fill(0)}class nt extends Tt{constructor(t,n,r,s=!1,o=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,de(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=fe(this.state)}keccak(){H||P(this.state32),ns(this.state32,this.rounds),H||P(this.state32),this.posOut=0,this.pos=0}update(t){Be(this);const{blockLen:n,state:r}=this;t=J(t);const s=t.length;for(let o=0;o<s;){const i=Math.min(n-this.pos,s-o);for(let c=0;c<i;c++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,n&128&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Be(this,!1),Pe(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,o-s);t.set(n.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return de(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ze(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:o,enableXOF:i}=this;return t||(t=new nt(n,r,s,i,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=s,t.enableXOF=i,t.destroyed=this.destroyed,t}}const rs=((e,t,n)=>xr(()=>new nt(t,e,n)))(1,136,256/8),un=e=>{const t=e.slice(2),n=j(rs(t)).slice(2),r=new Array(40);for(let s=0;s<40;s++){const o=parseInt(n[s],16),i=t[s];r[s]=o>7?i.toUpperCase():i}return`0x${r.join("")}`},ss=C(20)[1],hn=k(e=>{const t=ye(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);const n=j(t);if(e===n||e===n.toUpperCase())return t;if(un(n)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},We(e=>un(j(ss(e))))),dn=new TextEncoder,fn=new TextDecoder,os=we(C(4),dn.encode.bind(dn),fn.decode.bind(fn)),rt=m({engine:os,payload:ce()}),is=ve({consensus:rt,seal:rt,preRuntime:rt,runtimeUpdated:E},[4,5,6,8]),st=ce(32),cs=m({parentHash:st,number:v,stateRoot:st,extrinsicRoot:st,digests:I(is)}),ee=I(M),yn=q(M),as=W({bool:E,char:E,str:E,u8:E,u16:E,u32:E,u64:E,u128:E,u256:E,i8:E,i16:E,i32:E,i64:E,i128:E,i256:E}),pn=I(m({name:yn,type:v,typeName:yn,docs:ee})),ls=m({len:z,type:v}),us=m({bitStoreType:v,bitOrderType:v}),hs=I(m({name:M,fields:pn,index:_,docs:ee})),ds=W({composite:pn,variant:hs,sequence:v,array:ls,tuple:I(v),primitive:as,compact:v,bitSequence:us}),fs=m({name:M,type:q(v)}),ys=I(fs),ps=m({id:v,path:ee,params:ys,def:ds,docs:ee}),ot=I(ps),gs=W({Blake2128:E,Blake2256:E,Blake2128Concat:E,Twox128:E,Twox256:E,Twox64Concat:E,Identity:E}),bs=I(gs),ws=m({hashers:bs,key:v,value:v}),vs=m({name:M,modifier:_,type:W({plain:v,map:ws}),fallback:ce(),docs:ee}),ms=q(m({prefix:M,items:I(vs)})),gn={name:M,storage:ms,calls:q(v),events:q(v),constants:I(m({name:M,type:v,value:ce(),docs:ee})),errors:q(v),index:_},xs={...gn,docs:ee},ks=new Uint8Array,bn=e=>k(()=>ks,()=>e),Es=m({type:v,version:_,signedExtensions:I(m({identifier:M,type:v,additionalSigned:v}))}),wn=m({lookup:ot,pallets:I(m({...gn,docs:bn([])})),extrinsic:Es,type:v,apis:bn([])}),Bs=m({name:M,methods:I(m({name:M,inputs:I(m({name:M,type:v})),output:v,docs:ee})),docs:ee}),Is=m({version:_,address:v,call:v,signature:v,extra:v,signedExtensions:I(m({identifier:M,type:v,additionalSigned:v}))}),vn=m({lookup:ot,pallets:I(m(xs)),extrinsic:Is,type:v,apis:I(Bs),outerEnums:m({call:v,event:v,error:v}),custom:I(X(M,m({type:v,value:ce()})))}),mn=()=>{throw new Error("Unsupported metadata version!")},R=k(mn,mn),Se=m({magicNumber:z,metadata:W({v0:R,v1:R,v2:R,v3:R,v4:R,v5:R,v6:R,v7:R,v8:R,v9:R,v10:R,v11:R,v12:R,v13:R,v14:wn,v15:vn})}),it=C(),As=q(it),Os=X(U,it),xn=e=>{try{return Se.dec(e)}catch{}try{return Se.dec(As.dec(e))}catch{}try{return Se.dec(it.dec(e))}catch{}try{return Se.dec(Os.dec(e)[1])}catch{}throw null},_s={dkLen:32},kn=e=>Ne(e,_s),Us={dkLen:16},En=e=>Ne(e,Us),Bn=e=>ie(En(e),e),te=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function ae(e,t,n,r,s){return e=e+t+s|0,r=Ve(r^e,16),n=n+r|0,t=Ve(t^n,12),{a:e,b:t,c:n,d:r}}function le(e,t,n,r,s){return e=e+t+s|0,r=Ve(r^e,8),n=n+r|0,t=Ve(t^n,7),{a:e,b:t,c:n,d:r}}function In(e,t,n,r,s,o,i,c,y,h,d,l,u,a,f,p,b,w,A,D){let B=0;for(let ne=0;ne<r;ne++)({a:s,b:y,c:u,d:b}=ae(s,y,u,b,n[t+e[B++]])),{a:s,b:y,c:u,d:b}=le(s,y,u,b,n[t+e[B++]]),{a:o,b:h,c:a,d:w}=ae(o,h,a,w,n[t+e[B++]]),{a:o,b:h,c:a,d:w}=le(o,h,a,w,n[t+e[B++]]),{a:i,b:d,c:f,d:A}=ae(i,d,f,A,n[t+e[B++]]),{a:i,b:d,c:f,d:A}=le(i,d,f,A,n[t+e[B++]]),{a:c,b:l,c:p,d:D}=ae(c,l,p,D,n[t+e[B++]]),{a:c,b:l,c:p,d:D}=le(c,l,p,D,n[t+e[B++]]),{a:s,b:h,c:f,d:D}=ae(s,h,f,D,n[t+e[B++]]),{a:s,b:h,c:f,d:D}=le(s,h,f,D,n[t+e[B++]]),{a:o,b:d,c:p,d:b}=ae(o,d,p,b,n[t+e[B++]]),{a:o,b:d,c:p,d:b}=le(o,d,p,b,n[t+e[B++]]),{a:i,b:l,c:u,d:w}=ae(i,l,u,w,n[t+e[B++]]),{a:i,b:l,c:u,d:w}=le(i,l,u,w,n[t+e[B++]]),{a:c,b:y,c:a,d:A}=ae(c,y,a,A,n[t+e[B++]]),{a:c,b:y,c:a,d:A}=le(c,y,a,A,n[t+e[B++]]);return{v0:s,v1:o,v2:i,v3:c,v4:y,v5:h,v6:d,v7:l,v8:u,v9:a,v10:f,v11:p,v12:b,v13:w,v14:A,v15:D}}const An=(()=>{const e=Array.from({length:16},(r,s)=>s),t=r=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(s=>r[s]),n=[];for(let r=0,s=e;r<7;r++,s=t(s))n.push(...s);return Uint8Array.from(n)})();class ct extends Dt{constructor(t={},n=0){if(super(64,t.dkLen===void 0?32:t.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=t.dkLen===void 0?32:t.dkLen,de(this.outputLen),t.key!==void 0&&t.context!==void 0)throw new Error("Blake3: only key or context can be specified at same time");if(t.key!==void 0){const r=J(t.key).slice();if(r.length!==32)throw new Error("Blake3: key should be 32 byte");this.IV=fe(r),H||P(this.IV),this.flags=n|16}else if(t.context!==void 0){const r=new ct({dkLen:32},32).update(t.context).digest();this.IV=fe(r),H||P(this.IV),this.flags=n|64}else this.IV=te.slice(),this.flags=n;this.state=this.IV.slice(),this.bufferOut=vr(this.bufferOut32)}get(){return[]}set(){}b2Compress(t,n,r,s=0){const{state:o,pos:i}=this,{h:c,l:y}=Re(BigInt(t),!0),{v0:h,v1:d,v2:l,v3:u,v4:a,v5:f,v6:p,v7:b,v8:w,v9:A,v10:D,v11:B,v12:ne,v13:$,v14:G,v15:xe}=In(An,s,r,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],te[0],te[1],te[2],te[3],c,y,i,n);o[0]=h^w,o[1]=d^A,o[2]=l^D,o[3]=u^B,o[4]=a^ne,o[5]=f^$,o[6]=p^G,o[7]=b^xe}compress(t,n=0,r=!1){let s=this.flags;if(this.chunkPos||(s|=1),(this.chunkPos===15||r)&&(s|=2),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,s,t,n),this.chunkPos+=1,this.chunkPos===16||r){let o=this.state;this.state=this.IV.slice();for(let i,c=this.chunksDone+1;(r||!(c&1))&&(i=this.stack.pop());c>>=1)this.buffer32.set(i,0),this.buffer32.set(o,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|4,this.buffer32,0),o=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(o)}this.pos=0}_cloneInto(t){t=super._cloneInto(t);const{IV:n,flags:r,state:s,chunkPos:o,posOut:i,chunkOut:c,stack:y,chunksDone:h}=this;return t.state.set(s.slice()),t.stack=y.map(d=>Uint32Array.from(d)),t.IV.set(n),t.flags=r,t.chunkPos=o,t.chunksDone=h,t.posOut=i,t.chunkOut=c,t.enableXOF=this.enableXOF,t.bufferOut32.set(this.bufferOut32),t}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let t of this.stack)t.fill(0)}b2CompressOut(){const{state:t,pos:n,flags:r,buffer32:s,bufferOut32:o}=this,{h:i,l:c}=Re(BigInt(this.chunkOut++));H||P(s);const{v0:y,v1:h,v2:d,v3:l,v4:u,v5:a,v6:f,v7:p,v8:b,v9:w,v10:A,v11:D,v12:B,v13:ne,v14:$,v15:G}=In(An,0,s,7,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],te[0],te[1],te[2],te[3],c,i,n,r);o[0]=y^b,o[1]=h^w,o[2]=d^A,o[3]=l^D,o[4]=u^B,o[5]=a^ne,o[6]=f^$,o[7]=p^G,o[8]=t[0]^b,o[9]=t[1]^w,o[10]=t[2]^A,o[11]=t[3]^D,o[12]=t[4]^B,o[13]=t[5]^ne,o[14]=t[6]^$,o[15]=t[7]^G,H||(P(s),P(o)),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let t=this.flags|8;this.stack.length?(t|=4,H||P(this.buffer32),this.compress(this.buffer32,0,!0),H||P(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):t|=(this.chunkPos?0:1)|2,this.flags=t,this.b2CompressOut()}writeInto(t){Be(this,!1),Pe(t),this.finish();const{blockLen:n,bufferOut:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=n&&this.b2CompressOut();const i=Math.min(n-this.posOut,o-s);t.set(r.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(t)}xof(t){return de(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ze(t,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const Ls=Er(e=>new ct(e)),Ss={dkLen:32},On=e=>Ls(e,Ss),Cs=e=>ie(On(e),e),_n=e=>e,ge=(e,t,n,r)=>new DataView(new Uint16Array([e,t,n,r]).buffer).getBigUint64(0,!0),at=2n**64n-1n,T=(e,t)=>e<<t&at|e>>64n-t,x=(e,t)=>e*t&at,L=(e,t)=>e+t&at,S=11400714785074694791n,N=14029467366897019727n,Un=1609587929392839161n,Ce=9650029242287828579n,Ln=2870177450012600261n;function ue(e,t=0n){let n=L(L(t,S),N),r=L(t,N),s=t,o=t-S,i=e.length,c=0,y=null;(function(){let a=0,f=a+i;if(i){if(y=new Uint8Array(32),i<32){y.set(e.subarray(0,i),c),c+=i;return}if(a<=f-32){const p=f-32;do{let b;b=ge(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),n=x(T(L(n,x(b,N)),31n),S),a+=8,b=ge(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),r=x(T(L(r,x(b,N)),31n),S),a+=8,b=ge(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),s=x(T(L(s,x(b,N)),31n),S),a+=8,b=ge(e[a+1]<<8|e[a],e[a+3]<<8|e[a+2],e[a+5]<<8|e[a+4],e[a+7]<<8|e[a+6]),o=x(T(L(o,x(b,N)),31n),S),a+=8}while(a<=p)}a<f&&(y.set(e.subarray(a,f),c),c=f-a)}})(),e=y||e;let h,d=0;for(i>=32?(h=T(n,1n),h=L(h,T(r,7n)),h=L(h,T(s,12n)),h=L(h,T(o,18n)),n=x(T(x(n,N),31n),S),h=h^n,h=L(x(h,S),Ce),r=x(T(x(r,N),31n),S),h=h^r,h=L(x(h,S),Ce),s=x(T(x(s,N),31n),S),h=h^s,h=L(x(h,S),Ce),o=x(T(x(o,N),31n),S),h=h^o,h=L(x(h,S),Ce)):h=L(t,Ln),h=L(h,BigInt(i));d<=c-8;){let u=ge(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],e[d+5]<<8|e[d+4],e[d+7]<<8|e[d+6]);u=x(T(x(u,N),31n),S),h=L(x(T(h^u,27n),S),Ce),d+=8}if(d+4<=c){let u=x(ge(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],0,0),S);h=L(x(T(h^u,23n),N),Un),d+=4}for(;d<c;){const u=x(ge(e[d++],0,0,0),Ln);h=x(T(h^u,11n),S)}let l=h>>33n;return h=x(h^l,N),l=h>>29n,h=x(h^l,Un),l=h>>32n,h^=l,h}const lt=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,ue(e),!0),n.setBigUint64(8,ue(e,1n),!0),t},Ts=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,ue(e),!0),n.setBigUint64(8,ue(e,1n),!0),n.setBigUint64(16,ue(e,2n),!0),n.setBigUint64(24,ue(e,3n),!0),t},Sn=e=>ie(Me.enc(ue(e)),e),Cn=new TextEncoder,Tn=e=>{const t=lt(Cn.encode(e));return(n,r,...s)=>{const o=ie(t,lt(Cn.encode(n))),i=j(o),c=s.map(l=>l[1]).map(l=>{switch(l){case _n:return 0;case Sn:return 8;case Bn:return 16;default:return null}}).filter(l=>l!==null),y=l=>{if(!l.startsWith(i))throw new Error(`key does not match this storage (${e}.${n})`);if(c.length!==s.length)throw new Error("Impossible to decode this key");if(s.length===0)return[];const u=l.slice(i.length),a=new Array(s.length);for(let f=0,p=0;f<c.length;f++){const b=s[f][0];p+=c[f],a[f]=b.dec(u.slice(p*2)),p+=b.enc(a[f]).length}return a},h=s.map(([{enc:l},u])=>a=>u(l(a)));return{enc:(...l)=>j(ie(o,...l.map((u,a)=>h[a](u)))),dec:r,keyDecoder:y}}};var Dn=Object.freeze({__proto__:null,AccountId:Ie,Bin:Ue,Binary:et,Blake2128:En,Blake2128Concat:Bn,Blake2256:kn,Blake3256:On,Blake3256Concat:Cs,Bytes:C,Enum:tt,FixedSizeBinary:Kt,Hex:ce,Identity:_n,Option:q,Result:He,ScaleEnum:W,Self:tn,Storage:Tn,Struct:m,Tuple:X,Twox128:lt,Twox256:Ts,Twox64Concat:Sn,Variant:ve,Vector:I,_Enum:Gr,_void:E,bitSequence:Yt,blockHeader:cs,bool:Ge,char:qr,compact:U,compactBn:zt,compactNumber:v,createCodec:k,createDecoder:We,decAnyMetadata:xn,enhanceCodec:we,enhanceDecoder:$e,enhanceEncoder:De,ethAccount:hn,fixedStr:Wr,fromBufferToBase58:Nt,getSs58AddressInfo:Rt,h64:ue,i128:Gn,i16:qn,i256:Yn,i32:Xn,i64:Kn,i8:Fn,metadata:Se,selfDecoder:en,selfEncoder:Zt,str:M,u128:Wn,u16:Ee,u256:zn,u32:z,u64:Me,u8:_,v14:wn,v14Lookup:ot,v15:vn});const $n=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",he={type:"void"},Ds=(e,t=()=>null)=>{const n=new Map,r=new Set,s=d=>l=>{let u=n.get(l);if(u)return u;if(r.has(l)){const f={id:l};return n.set(l,f),f}r.add(l);const a=d(l);return u=n.get(l),u?Object.assign(u,a):(u={id:l,...a},n.set(l,u)),r.delete(l),u};let o=!0,i=!0;const c=s(d=>{const l=t(e[d]);if(l)return l;const{def:u,path:a,params:f}=e[d];if(u.tag==="composite"){if(u.value.length===0)return he;if(u.value.length===1){const p=c(u.value[0].type);return o&&a.at(-1)==="AccountId32"&&$n(p,32)?(o=!1,{type:"AccountId32"}):i&&a.at(-1)==="AccountId20"&&$n(p,20)?(i=!1,{type:"AccountId20"}):p}return y(u.value)}if(u.tag==="variant"){if(a.length===1&&a[0]==="Option"&&f.length===1&&f[0].name==="T"){const w=c(f[0].type);return w.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:w}}if(a.length===1&&a[0]==="Result"&&f.length===2&&f[0].name==="T"&&f[1].name==="E")return{type:"result",value:{ok:c(f[0].type),ko:c(f[1].type)}};if(u.value.length===0)return he;const p={},b={};return u.value.forEach(w=>{const A=w.name;if(b[A]=w.docs,w.fields.length===0){p[A]={...he,idx:w.index};return}if(w.fields.length===1&&!w.fields[0].name){p[A]={type:"lookupEntry",value:c(w.fields[0].type),idx:w.index};return}p[A]={...y(w.fields),idx:w.index}}),{type:"enum",value:p,innerDocs:b}}if(u.tag==="sequence")return{type:"sequence",value:c(u.value)};if(u.tag==="array"){const{len:p}=u.value,b=c(u.value.type);return!p||b.type==="void"?he:p>1?{type:"array",value:b,len:u.value.len}:b}if(u.tag==="tuple")return u.value.length===0?he:u.value.length>1?h(u.value.map(p=>c(p)),u.value.map(p=>e[p].docs)):c(u.value[0]);if(u.tag==="primitive")return{type:"primitive",value:u.value.tag};if(u.tag==="compact"){const p=c(u.value);return p.type==="void"?he:{type:"compact",isBig:Number(p.value.slice(1))>32}}return{type:u.tag}}),y=d=>{let l=!0;const u={},a={};return d.forEach((f,p)=>{l=l&&!!f.name;const b=f.name||p,w=c(f.type);w.type!=="void"&&(u[b]=w,a[b]=f.docs)}),l?{type:"struct",value:u,innerDocs:a}:h(Object.values(u),Object.values(a))},h=(d,l)=>{if(d.every(u=>u.id===d[0].id)&&l.every(u=>!u.length)){const[u]=d;return u.type==="void"?he:{type:"array",value:d[0],len:d.length}}return{type:"tuple",value:d,innerDocs:l}};return c},$s=e=>{const t=Ds(e.lookup,({def:s})=>{if(s.tag==="composite"){const o=n(s);if(o)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(i=>[i.name,i.errors==null?{...he,idx:i.index}:{type:"lookupEntry",value:t(i.errors),idx:i.index}])),byteLength:o}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const i=t(s.value[0].type),c=t(s.value[1].type);return i.type==="primitive"&&i.value==="u8"&&c.type==="array"&&c.value.type==="primitive"&&c.value.value==="u8"?1+c.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(i=>i.name==="Call")?.type??null})},Ms=(e,t,n)=>(r,s,o,...i)=>{const{id:c}=r;if(s.has(c))return s.get(c);if(o.has(c)){const h=t(()=>s.get(c),r,...i);return s.set(c,h),h}o.add(c);let y=e(r,s,o,...i);return o.delete(c),s.has(c)&&(y=n(y,s.get(c),r,...i)),s.set(c,y),y},Hs=Ue(),Ps=k(U[0],$e(U[1],BigInt)),Mn=Ms((e,t,n,r)=>{if(e.type==="primitive")return Dn[e.value];if(e.type==="void")return E;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return hn;if(e.type==="compact")return e.isBig?Ps:U;if(e.type==="bitSequence")return Yt;const s=a=>Mn(a,t,n,r),o=(a,f)=>{const p=s(a);return f?I(p,f):I(p)},i=a=>X(...a.map(s)),c=a=>{const f=Object.fromEntries(Object.entries(a).map(([p,b])=>[p,s(b)]));return m(f)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return Hs;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?Ue(e.len):o(e.value,e.len);if(e.type==="sequence")return o(e.value);if(e.type==="tuple")return i(e.value);if(e.type==="struct")return c(e.value);if(e.type==="option")return q(s(e.value));if(e.type==="result")return He(s(e.value.ok),s(e.value.ko));const y=Object.values(e.value).map(a=>{switch(a.type){case"void":return E;case"lookupEntry":return s(a.value);case"tuple":return i(a.value);case"struct":return c(a.value);case"array":return o(a.value,a.len)}}),h=Object.fromEntries(Object.keys(e.value).map((a,f)=>[a,y[f]])),d=Object.values(e.value).map(a=>a.idx),u=d.every((a,f)=>a===f)?ve(h):ve(h,d);return e.byteLength?Vs(u,e.byteLength):u},tn,e=>e),Hn=(e,t=Ie())=>{const n=new Map,r=s=>Mn(e(s),n,new Set,t);return s=>r(s)},Vs=(e,t)=>{const n=C(t);return k(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},js=e=>{const{metadata:t}=e;let n=Hn(e);const r=t.pallets.find(l=>l.name==="System")?.constants.find(l=>l.name==="SS58Prefix");let s;if(r)try{const l=n(r.type).dec(r.value);typeof l=="number"&&(s=l,n=Hn(e,Ie(l)))}catch{}const o=new Map,i=(l,u)=>{let a=o.get(l);a||o.set(l,a=Tn(l));const f=t.pallets.find($=>$.name===l).storage.items.find($=>$.name===u),p=($,...G)=>{const xe=a(...G);return{...xe,len:$,fallback:f.modifier===1?xe.dec(f.fallback):void 0}};if(f.type.tag==="plain")return p(0,u,n(f.type.value).dec);const{key:b,value:w,hashers:A}=f.type.value,D=n(w),B=A.map($=>Dn[$.tag]),ne=(()=>{if(B.length===1)return[[n(b),B[0]]];const $=e(b);switch($.type){case"array":return B.map(G=>[n($.value.id),G]);case"tuple":return $.value.map((G,xe)=>[n(G.id),B[xe]]);default:throw new Error("Invalid key type")}})();return p(B.length,u,D.dec,...ne)},c=l=>{switch(l.type){case"void":return E;case"lookupEntry":return n(l.value.id);case"tuple":return X(...Object.values(l.value).map(u=>n(u.id)));case"struct":return m(Ze(l.value,u=>n(u.id)));case"array":return I(n(l.value.id),l.len)}},y=(l,u)=>{const a=t.pallets.find(f=>f.name===l).constants.find(f=>f.name===u);return n(a.type)},h=l=>(u,a)=>{const f=t.pallets.find(w=>w.name===u),p=e(f[l]);if(p.type!=="enum")throw null;const b=p.value[a];return{location:[f.index,b.idx],codec:c(p.value[a])}},d=(l,u)=>{const a=t.apis.find(f=>f.name===l)?.methods.find(f=>f.name===u);if(!a)throw null;return{args:X(...a.inputs.map(f=>n(f.type))),value:n(a.output)}};return{buildDefinition:n,buildStorage:i,buildEvent:h("events"),buildError:h("errors"),buildRuntimeCall:d,buildCall:h("calls"),buildConstant:y,ss58Prefix:s}},me=(e,t)=>{let n=e.toString(16);n=(n.length%2?"0":"")+n;const r=Math.max(0,(t||0)-n.length/2);return"0x"+"00".repeat(r)+n},Rs=({additionalSigned:e})=>({genesisHash:j(e)}),Ns=({value:e})=>({nonce:me(U.dec(e),4)}),Fs=({additionalSigned:e})=>({transactionVersion:me(z.dec(e),4)}),qs=m({tip:U,asset:q(C(1/0))}).dec;var Pn=Object.freeze({__proto__:null,ChargeAssetTxPayment:({value:e})=>{const{tip:t,asset:n}=qs(e);return{...n?{assetId:j(n)}:{},tip:me(t,16)}},ChargeTransactionPayment:({value:e})=>({tip:me(zt.dec(e),16)}),CheckGenesis:Rs,CheckMetadataHash:({value:e,additionalSigned:t})=>e.length&&e[0]?{mode:1,metadataHash:j(t.length?t.slice(1):t)}:{},CheckMortality:({value:e,additionalSigned:t},n)=>({era:j(e),blockHash:j(t),blockNumber:me(n,4)}),CheckNonce:Ns,CheckSpecVersion:({additionalSigned:e})=>({specVersion:me(z.dec(e),4)}),CheckTxVersion:Fs});const Xs=e=>{const t=js($s(e)),n=e.pallets.find(r=>r.name==="System").constants.find(r=>r.name==="SS58Prefix");return t.buildDefinition(n.type).dec(n.value)},Ks=De(_.enc,e=>+!!e.signed<<7|e.version),Ws=Ie().enc;function Gs(e,t,n){const r=i=>n({address:e,data:j(i),type:"bytes"}).then(({signature:c})=>ye(c)),s=Ws(e);return{publicKey:s,signTx:async(i,c,y,h,d=kn)=>{let l;try{const b=xn(y);if(b.metadata.tag!=="v14"&&b.metadata.tag!=="v15")throw null;l=b.metadata.value}catch{throw new Error("Unsupported metadata version")}const u={};u.signedExtensions=[];const{version:a}=l.extrinsic,f=[];l.extrinsic.signedExtensions.map(({identifier:b})=>{const w=c[b];if(!w)throw new Error(`Missing ${b} signed-extension`);if(f.push(w.value),u.signedExtensions.push(b),!Pn[b]){if(w.value.length===0&&w.additionalSigned.length===0)return;throw new Error(`PJS does not support this signed-extension: ${b}`)}Object.assign(u,Pn[b](w,h))}),u.address=Ie(Xs(l)).dec(s),u.method=j(i),u.version=a,u.withSignedTransaction=!0;const p=await t(u);if(!p.signedTransaction){const b=ie(Ks({signed:!0,version:a}),new Uint8Array([0,...s]),ye(p.signature),...f,i);return ie(U.enc(b.length),b)}return typeof p.signedTransaction=="string"?ye(p.signedTransaction):p.signedTransaction},signBytes:r}}const zs=new Set(["ed25519","sr25519","ecdsa"]),Ys=async e=>{let t=window.injectedWeb3?.[e];if(!t)throw new Error(`Unavailable extension: "${e}"`);const n=await t.enable(),r=n.signer.signPayload.bind(n.signer),s=n.signer.signRaw.bind(n.signer),o=h=>h.filter(({type:d})=>zs.has(d)).map(d=>{const l=Gs(d.address,r,s);return{...d,polkadotSigner:l}});let i=o(await n.accounts.get());const c=new Set,y=n.accounts.subscribe(h=>{i=o(h),c.forEach(d=>{d(i)})});return{name:e,getAccounts:()=>i,subscribe:h=>(c.add(h),()=>{c.delete(h)}),disconnect:()=>{y()}}},Js=()=>{const{injectedWeb3:e}=window;return e?Object.keys(e):[]};be.connectInjectedExtension=Ys,be.getInjectedExtensions=Js});
@@ -1 +1 @@
1
- (function(v,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(v=typeof globalThis<"u"?globalThis:v||self,u(v.papiWsProviderWeb={}))})(this,function(v){"use strict";const u=p=>JSON.stringify({jsonrpc:"2.0",...p}),W=new Set(["v1","unstable"].map(p=>`chainHead_${p}_unfollow`)),H=p=>{let e={type:1,pending:[]};const s=o=>{if(e.type===0){const t=JSON.parse(o);if("id"in t)e.onGoingRequests.get(t.id)?.type===0&&e.activeChainHeads.add(t.result),e.onGoingRequests.delete(t.id);else{const{subscription:i,result:c}=t.params;c?.event==="stop"&&e.activeChainHeads.delete(i)}}e.type!==2&&p(o)},r=o=>{if(e.type===2)return;if(e.type===1){e.pending.push(o);return}const t=JSON.parse(o);if(W.has(t.method)&&e.activeChainHeads.delete(t.params[0]),"id"in t){const{method:i,id:c}=t,f=i.startsWith("chainHead")?i.endsWith("follow")?{type:0,msg:o}:{type:1,id:c}:{type:2,msg:o};e.onGoingRequests.set(c,f)}e.connection.send(o)};return{send:r,disconnect:()=>{e.type!==2&&(e.type===0&&e.connection.disconnect(),e={type:2})},connect:o=>{if(e.type!==1)throw new Error("Nonesense");const{pending:t}=e,i=new Map,c=new Set;e={type:0,connection:o(s,()=>{e={type:1,pending:[]},c.forEach(n=>{s(u({params:{subscription:n,result:{event:"stop",internal:!0}}}))}),c.clear(),i.values().forEach(n=>{n.type===1?s(u({id:n.id,error:{code:-32603,message:"Internal error"},internal:!0})):r(n.msg)}),i.clear()}),onGoingRequests:i,activeChainHeads:c},t.forEach(r)}}},P=p=>e=>{let s=H(e);const r=()=>{p().then(o=>{if(s)s.connect((t,i)=>o(t,()=>{i(),r()}));else try{o(()=>{},()=>{}).disconnect()}catch{}},()=>{s&&setTimeout(r,0)})};return r(),{send:o=>{s?.send(o)},disconnect:()=>{s?.disconnect(),s=null}}},S={type:2,event:{type:"timeout"}},w=()=>{},T=(p=>(...e)=>{let s=[],r=w;typeof e[1]=="function"&&(r=e[1]),Array.isArray(e[0])?s=e[0].map(n=>typeof n=="string"?[n]:[n.uri,n.protocol]):(s=[[e[0]]],e[1]&&e[1]!==r&&(s[0][1]=e[1]),e[2]&&(r=e[2]));let o=0,t,i=null,c=w;const f=P(async()=>{const[n,h]=i||s[o++%s.length];i=null;const a=new p(n,h);return r(t={type:0,uri:n,protocols:h}),await new Promise((L,g)=>{const m=()=>{l(),L()},y=d=>{l(),console.error(`Unable to connect to ${n}${h?", protocols: "+h:""}`),r(t={type:d?2:3,event:d}),setTimeout(g,d?300:0,d)},E=setTimeout(()=>{l(),r(t=S),g(S.event)},3500),l=()=>{clearTimeout(E),a.removeEventListener("error",y),a.removeEventListener("open",m)};a.addEventListener("open",m),a.addEventListener("error",y),c=()=>{y(null)}}),r(t={type:1,uri:n,protocols:h}),(L,g)=>{const m=d=>{typeof d.data=="string"&&L(d.data)},y=d=>C=>{console.warn(`WS halt (${d})`),r(t={type:d,event:C}),g()},E=y(2),l=y(3);return a.addEventListener("message",m),a.addEventListener("error",E),a.addEventListener("close",l),c=d=>{c=w,a.removeEventListener("message",m),a.removeEventListener("error",E),a.removeEventListener("close",l),a.close(),d&&l({})},{send:d=>{a.send(d)},disconnect:c}}});return f.getStatus=()=>t,f.switch=(...n)=>{t.type!==3&&(n.length&&(i=n),t.type!==2&&c(!0))},f})(WebSocket);v.getWsProvider=T});
1
+ (function(v,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(v=typeof globalThis<"u"?globalThis:v||self,u(v.papiWsProviderWeb={}))})(this,function(v){"use strict";const u=a=>JSON.stringify({jsonrpc:"2.0",...a}),W=new Set(["v1","unstable"].map(a=>`chainHead_${a}_unfollow`)),H=a=>{let e={type:1,pending:[]};const s=o=>{if(e.type===0){const t=JSON.parse(o);if("id"in t)e.onGoingRequests.get(t.id)?.type===0&&e.activeChainHeads.add(t.result),e.onGoingRequests.delete(t.id);else{const{subscription:i,result:c}=t.params;c?.event==="stop"&&e.activeChainHeads.delete(i)}}e.type!==2&&a(o)},r=o=>{if(e.type===2)return;if(e.type===1){e.pending.push(o);return}const t=JSON.parse(o);if(W.has(t.method)&&e.activeChainHeads.delete(t.params[0]),"id"in t){const{method:i,id:c}=t,f=i.startsWith("chainHead")?i.endsWith("follow")?{type:0,msg:o}:{type:1,id:c}:{type:2,msg:o};e.onGoingRequests.set(c,f)}e.connection.send(o)};return{send:r,disconnect:()=>{e.type!==2&&(e.type===0&&e.connection.disconnect(),e={type:2})},connect:o=>{if(e.type!==1)throw new Error("Nonesense");const{pending:t}=e,i=new Map,c=new Set;e={type:0,connection:o(s,()=>{e={type:1,pending:[]},c.forEach(n=>{s(u({params:{subscription:n,result:{event:"stop",internal:!0}}}))}),c.clear();for(const n of i.values())n.type===1?s(u({id:n.id,error:{code:-32603,message:"Internal error"},internal:!0})):r(n.msg);i.clear()}),onGoingRequests:i,activeChainHeads:c},t.forEach(r)}}},P=a=>e=>{let s=H(e);const r=()=>{a().then(o=>{if(s)s.connect((t,i)=>o(t,()=>{i(),r()}));else try{o(()=>{},()=>{}).disconnect()}catch{}},()=>{s&&setTimeout(r,0)})};return r(),{send:o=>{s?.send(o)},disconnect:()=>{s?.disconnect(),s=null}}},S={type:2,event:{type:"timeout"}},w=()=>{},T=(a=>(...e)=>{let s=[],r=w;typeof e[1]=="function"&&(r=e[1]),Array.isArray(e[0])?s=e[0].map(n=>typeof n=="string"?[n]:[n.uri,n.protocol]):(s=[[e[0]]],e[1]&&e[1]!==r&&(s[0][1]=e[1]),e[2]&&(r=e[2]));let o=0,t,i=null,c=w;const f=P(async()=>{const[n,h]=i||s[o++%s.length];i=null;const p=new a(n,h);return r(t={type:0,uri:n,protocols:h}),await new Promise((L,g)=>{const m=()=>{l(),L()},y=d=>{l(),console.error(`Unable to connect to ${n}${h?", protocols: "+h:""}`),r(t={type:d?2:3,event:d}),setTimeout(g,d?300:0,d)},E=setTimeout(()=>{l(),r(t=S),g(S.event)},3500),l=()=>{clearTimeout(E),p.removeEventListener("error",y),p.removeEventListener("open",m)};p.addEventListener("open",m),p.addEventListener("error",y),c=()=>{y(null)}}),r(t={type:1,uri:n,protocols:h}),(L,g)=>{const m=d=>{typeof d.data=="string"&&L(d.data)},y=d=>C=>{console.warn(`WS halt (${d})`),r(t={type:d,event:C}),g()},E=y(2),l=y(3);return p.addEventListener("message",m),p.addEventListener("error",E),p.addEventListener("close",l),c=d=>{c=w,p.removeEventListener("message",m),p.removeEventListener("error",E),p.removeEventListener("close",l),p.close(),d&&l({})},{send:d=>{p.send(d)},disconnect:c}}});return f.getStatus=()=>t,f.switch=(...n)=>{t.type!==3&&(n.length&&(i=n),t.type!==2&&c(!0))},f})(WebSocket);v.getWsProvider=T});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polkadot-api",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "author": "Josep M Sobrepere (https://github.com/josepot)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -178,27 +178,27 @@
178
178
  "rxjs": ">=7.8.0"
179
179
  },
180
180
  "dependencies": {
181
- "@polkadot-api/cli": "0.9.4",
182
- "@polkadot-api/logs-provider": "0.0.5",
183
- "@polkadot-api/json-rpc-provider": "0.0.3",
184
- "@polkadot-api/polkadot-sdk-compat": "2.2.1",
185
- "@polkadot-api/metadata-builders": "0.8.0",
186
- "@polkadot-api/metadata-compatibility": "0.1.7",
187
- "@polkadot-api/observable-client": "0.5.7",
188
- "@polkadot-api/pjs-signer": "0.4.3",
189
- "@polkadot-api/polkadot-signer": "0.1.5",
190
- "@polkadot-api/signer": "0.1.6",
191
- "@polkadot-api/sm-provider": "0.1.2",
192
- "@polkadot-api/substrate-client": "0.2.1",
193
- "@polkadot-api/substrate-bindings": "0.9.0",
194
- "@polkadot-api/ws-provider": "0.3.0",
195
- "@polkadot-api/utils": "0.1.1",
196
- "@polkadot-api/known-chains": "0.5.3",
197
- "@polkadot-api/smoldot": "0.3.2"
181
+ "@polkadot-api/cli": "0.9.5",
182
+ "@polkadot-api/json-rpc-provider": "0.0.4",
183
+ "@polkadot-api/logs-provider": "0.0.6",
184
+ "@polkadot-api/polkadot-sdk-compat": "2.2.2",
185
+ "@polkadot-api/metadata-compatibility": "0.1.8",
186
+ "@polkadot-api/metadata-builders": "0.8.1",
187
+ "@polkadot-api/observable-client": "0.5.8",
188
+ "@polkadot-api/pjs-signer": "0.4.4",
189
+ "@polkadot-api/signer": "0.1.7",
190
+ "@polkadot-api/polkadot-signer": "0.1.6",
191
+ "@polkadot-api/sm-provider": "0.1.3",
192
+ "@polkadot-api/substrate-bindings": "0.9.1",
193
+ "@polkadot-api/utils": "0.1.2",
194
+ "@polkadot-api/ws-provider": "0.3.1",
195
+ "@polkadot-api/substrate-client": "0.2.2",
196
+ "@polkadot-api/known-chains": "0.5.4",
197
+ "@polkadot-api/smoldot": "0.3.3"
198
198
  },
199
199
  "devDependencies": {
200
200
  "rxjs": "^7.8.1",
201
- "@polkadot-api/codegen": "0.12.2"
201
+ "@polkadot-api/codegen": "0.12.3"
202
202
  },
203
203
  "scripts": {
204
204
  "build-core": "tsc --noEmit && rollup -c",