1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5809],{5809:function(e,t,r){let n,i;r.d(t,{createClient:function(){return sR}});var o,s,u,l,a,c,f,p,h={};r.r(h),r.d(h,{AccountId:function(){return rJ.h},Bin:function(){return nb},Binary:function(){return nc},BitSeq:function(){return nA},Blake2128:function(){return t4.BT},Blake2128Concat:function(){return t4.Nd},Blake2256:function(){return t4.vT},Blake3256:function(){return nM},Blake3256Concat:function(){return nV},Bytes:function(){return d.Jj},Enum:function(){return v},FixedSizeBinary:function(){return np},Hex:function(){return rg.p},Identity:function(){return rY},Keccak256:function(){return rb},Option:function(){return O.Wx},Result:function(){return O.x4},ScaleEnum:function(){return k},Self:function(){return A},Storage:function(){return r5},Struct:function(){return O.AU},TrieNodeHeaders:function(){return nJ},TrieNodeWithHash:function(){return nZ},Tuple:function(){return O.ps},Twox128:function(){return r3},Twox256:function(){return r8},Twox64Concat:function(){return r7},Variant:function(){return x},Vector:function(){return O.OW},_Enum:function(){return y},_void:function(){return d.R9},bitSequence:function(){return ny},blockHeader:function(){return rB},bool:function(){return d.Xg},char:function(){return nm},compact:function(){return d.oA},compactBn:function(){return E.v},compactNumber:function(){return E.J},createCodec:function(){return d.VG},createDecoder:function(){return d.UF},decAnyMetadata:function(){return rM.q},enhanceCodec:function(){return d.hD},enhanceDecoder:function(){return d.sv},enhanceEncoder:function(){return d.J8},ethAccount:function(){return nO},extrinsicFormat:function(){return rq.A},fixedStr:function(){return nx},fromBufferToBase58:function(){return nD.Y},getMultisigAccountId:function(){return nW},getSs58AddressInfo:function(){return nD.h},h64:function(){return r2},i128:function(){return d.bH},i16:function(){return d.TQ},i256:function(){return d.jn},i32:function(){return d.kx},i64:function(){return d.fO},i8:function(){return d.i8},metadata:function(){return rM.P},selfDecoder:function(){return B},selfEncoder:function(){return S},sortMultisigSignatories:function(){return nL},str:function(){return d.Bd},trieNodeDec:function(){return nQ},u128:function(){return d.z7},u16:function(){return d.KB},u256:function(){return d.Ks},u32:function(){return d.Jq},u64:function(){return d.AW},u8:function(){return d.u8},unifyMetadata:function(){return rP.h},v14:function(){return n_.T},v14Lookup:function(){return nR.P},v15:function(){return n$.O},v16:function(){return nI.i},validateProofs:function(){return n0}});var d=r(797);function b(e,t){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,t(r,e)]))}let v=Object.assign((e,t)=>({type:e,value:t}),{is:(e,t)=>e.type===t,as(e,t){if(t!==e.type)throw Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),y=new Proxy({},{get:(e,t)=>e=>v(t,e)});var m=r(2292);let g=(...e)=>{let t=d.xs.enc(...e);return(0,m.b)(e=>t({tag:e.type,value:e.value}),e[0])},w=(...e)=>{let t=d.xs.dec(...e);return(0,m.b)(e=>{let{tag:r,value:n}=t(e);return v(r,n)},e[0])},x=(e,...t)=>(0,m.b)((0,d.VG)(g(b(e,([e])=>e),...t),w(b(e,([,e])=>e),...t)),e);x.enc=g,x.dec=w;let k=(e,...t)=>(0,m.b)((0,d.xs)(e,...t),e);k.enc=(e,...t)=>(0,m.b)(d.xs.enc(e,...t),e),k.dec=(e,...t)=>(0,m.b)(d.xs.dec(e,...t),e);var E=r(8153),O=r(83);let S=e=>{let t=r=>{let n=e();return t=n,n(r)};return e=>t(e)},B=e=>{let t=r=>{let n=e();return t=n,n(r)};return e=>t(e)},A=e=>(0,d.VG)(S(()=>e().enc),B(()=>e().dec)),_=E.J,$=(0,O.OW)((0,O.ps)(d.Bd,_)),I={bool:"boolean",str:"string",num:"number",big:"bigint",bits:"bitseq",void:"void"},R=x(Object.fromEntries(Object.values(I).map(e=>[e,d.R9]))),C=(0,O.OW)((0,O.ps)(d.Bd,x({inline:A(()=>H),lookup:_}))),z=(0,O.OW)(_),T=(0,O.AU)({typeRef:_,length:(0,O.Wx)(_)}),j=(0,O.Wx)(_),U=(0,O.AU)({ok:_,ko:_}),H=x({struct:$,terminal:R,enum:C,tuple:z,array:T,binary:j,option:_,result:U}),N={i256:I.big,i128:I.big,i64:I.big,i32:I.num,i16:I.num,i8:I.num,u256:I.big,u128:I.big,u64:I.big,u32:I.num,u16:I.num,u8:I.num,bool:I.bool,char:I.str,str:I.str},P=e=>({type:"terminal",value:{type:e}});function M(e,t=()=>{}){switch(e.type){case"AccountId20":case"AccountId32":return P(I.str);case"array":if("primitive"===e.value.type&&"u8"===e.value.value)return{type:"binary",value:e.len};return t(e.value.id),{type:"array",value:{typeRef:e.value.id,length:e.len}};case"bitSequence":return P(I.bits);case"compact":return P(e.isBig?I.big:I.num);case"enum":return{type:"enum",value:Object.entries(e.value).map(([e,r])=>"lookupEntry"!==r.type?[e,{type:"inline",value:M(r,t)}]:(t(r.value.id),[e,{type:"lookup",value:r.value.id}]))};case"struct":{let r=Object.entries(e.value).map(([e,t])=>[e,t.id]);return r.forEach(([,e])=>t(e)),{type:"struct",value:r}}case"tuple":{let r=e.value.map(e=>e.id);return r.forEach(t),{type:"tuple",value:r}}case"option":return t(e.value.id),{type:"option",value:e.value.id};case"primitive":return P(N[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":if("primitive"===e.value.type&&"u8"===e.value.value)return{type:"binary",value:void 0};return t(e.value.id),{type:"array",value:{typeRef:e.value.id}};case"void":return P(I.void)}}function V(e,t,r){if("option"===t.type&&null==e)return!0;let n=(e,t)=>V(e,t,r);switch(t.type){case"terminal":return(t=>{switch(t.value.type){case I.str:case I.big:case I.bool:case I.num:return typeof e===t.value.type;case I.bits:return"object"==typeof e&&null!=e&&"number"==typeof e.bitsLen&&e.bytes instanceof Uint8Array;case I.void:return!0}})(t);case"binary":return null!=e&&"function"==typeof e.asBytes&&(null==t.value||e.asBytes().length>=t.value);case"array":if(!Array.isArray(e)||null!=t.value.length&&e.length<t.value.length)return!1;return e.slice(0,t.value.length).every(e=>n(e,r(t.value.typeRef)));case"enum":if(!e)return!1;let i=Object.fromEntries(t.value);if(!(e.type in i))return!1;let o=i[e.type];if(null==o)return!0;return n(e.value,"inline"===o.type?o.value:r(o.value));case"option":if(null==e)return!0;return n(e,r(t.value));case"struct":if(!e)return!1;return t.value.every(([t,i])=>n(e[t],r(i)));case"tuple":if(!e)return!1;return t.value.every((t,i)=>n(e[i],r(t)));case"result":if(!("success"in e&&"value"in e))return!1;return n(e.value,r(e.success?t.value.ok:t.value.ko))}}var D=Object.defineProperty,F=(e,t,r)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,W=(e,t,r)=>F(e,t+"",r);class L{constructor(e=[]){W(this,"value",new Map),e.forEach(([e,t])=>this.add(e,t))}has(e,t){return this.value.get(e)?.has(t)??!1}add(e,t){this.value.has(e)||this.value.set(e,new Set),this.value.get(e).add(t)}addAll(e){e.forEach(([e,t])=>this.add(e,t))}delete(e,t){if(!this.value.has(e))return;let r=this.value.get(e);r.delete(t),r.size||this.value.delete(e)}isEmpty(){return!this.value.size}get values(){return Array.from(this.value).flatMap(([e,t])=>Array.from(t).map(t=>[e,t]))}}var J=((o=J||{})[o.Incompatible=0]="Incompatible",o[o.Partial=1]="Partial",o[o.BackwardsCompatible=2]="BackwardsCompatible",o[o.Identical=3]="Identical",o);function q(e,t,r,n,i,o=!1){if(!r&&!e)return G(3,[]);if(!r)return G(2,[]);if(!e)return G("option"===r.type?2:0,[]);i.has(r)||i.set(r,new Map);let s=i.get(r);if(s.has(e)){let t=s.get(e);return null==t?{level:3,changes:[],assumptions:new L([[e,r]])}:G(t.level,t.changes)}s.set(e,null);let u=function(e,t,r,n){let i=(e,t,n)=>{let i=r(e,t);return{...i,changes:i.level<3?[{id:["number"==typeof e?e:null,"number"==typeof t?t:null],level:i.level,path:n}]:[]}};if(e.type!==t.type)return"option"===t.type?K(i(e,t.value,"some"),2):"option"===e.type?K(i(e.value,t,"some"),1):G(0,[]);switch(t.type){case"terminal":return G(t.value.type===e.value.type?3:0,[]);case"binary":return ee(er(e.value,t.value));case"array":return Q([ee(er(e.value.length,t.value.length)),()=>i(e.value.typeRef,t.value.typeRef,"value")],n);case"enum":{let r=Object.fromEntries(t.value.map(([e,t])=>[e,t.value])),n=Z(e.value.map(([e,t])=>()=>e in r?i(t.value,r[e],e):G(0,[{id:["number"==typeof t.value?t.value:null,null],level:0,path:e}])));if(e.value.length===t.value.length)return n;n=K(n,2);let o=new Set(e.value.map(([e])=>e));return n.changes=[...n.changes,...t.value.filter(([e])=>!o.has(e)).map(([e,t])=>({id:[null,"number"==typeof t?t:null],level:0,path:e}))],n}case"option":return X(i(e.value,t.value,"some"),1);case"struct":let o=Object.fromEntries(e.value),s=e.value.length===t.value.length?3:2;return K(Q(t.value.map(([e,t])=>()=>i(o[e],t,e)),n),s);case"tuple":return Q([ee(et(e.value,t.value)),...t.value.map((t,r)=>()=>i(e.value[r],t,String(r)))],n);case"result":return Z([i(e.value.ok,t.value.ok,"ok"),i(e.value.ko,t.value.ko,"ko")])}}(e,r,(e,r)=>q("number"==typeof e?t(e):e,t,"number"==typeof r?n(r):r,n,i),o);return u.assumptions.delete(e,r),u.assumptions.isEmpty()||0===u.level?s.set(e,u):s.delete(e),u}let K=(e,t)=>({...e,level:Math.min(e.level,t)}),X=(e,t)=>({...e,level:Math.max(e.level,t)}),Y=new L,G=(e,t)=>({level:e,changes:t,assumptions:Y}),Q=(e,t)=>{let r=G(3,[]);for(let n of e){let e="function"==typeof n?n():n;
1if(!t&&0===e.level)return e;3!==e.level&&(r.changes=[...r.changes,...e.changes]),r.assumptions.addAll(e.assumptions.values),r.level=Math.min(r.level,e.level)}return r},Z=e=>{if(!e.length)return G(3,[]);let t=!1,r=G(3,[]);for(let n of e){let e="function"==typeof n?n():n;if(3!==e.level&&(r.changes=[...r.changes,...e.changes]),0===e.level){r.level=Math.min(r.level,1);continue}t=!0,r.assumptions.addAll(e.assumptions.values),r.level=Math.min(r.level,e.level)}return t?r:G(0,r.changes)},ee=e=>({assumptions:Y,changes:3===e?[]:[{id:[null,null],level:e,path:"length"}],level:e}),et=(e,t)=>t.length===e.length?3:e.length>=t.length?2:0,er=(e,t)=>t===e?3:null==t||e>=t?2:null==e?1:0,en=x({lookup:E.J,typedef:H}),ei=e=>({type:"lookup",value:e}),eo=e=>({type:"typedef",value:e}),es=eo({type:"terminal",value:{type:I.void}}),eu=(0,O.AU)({args:en,values:en});function el(e){return{args:eo({type:"tuple",value:e.inputs.map(e=>e.type)}),values:ei(e.output)}}function ea(e,t,r){return V(r,"lookup"===e.type?t(e.value):e.value,t)}function ec(e){return"function"==typeof e}function ef(e){return e&&ec(e.schedule)}function ep(e){return e[e.length-1]}function eh(e){return ec(ep(e))?e.pop():void 0}function ed(e){return ef(ep(e))?e.pop():void 0}var eb=function(e,t){return(eb=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function ev(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}eb(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function ey(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(l){return function(u){if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}function em(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function eg(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function ew(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function ex(e){return this instanceof ex?(this.v=e,this):new ex(e)}"function"==typeof SuppressedError&&SuppressedError;var ek=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function eE(e){return ec(null==e?void 0:e.then)}function eO(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var eS=eO(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function eB(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var eA=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e,t,r,n,i,o=this._parentage;if(o){if(this._parentage=null,Array.isArray(o))try{for(var s=em(o),u=s.next();!u.done;u=s.next())u.value.remove(this)}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this)}var l=this.initialTeardown;
1if(ec(l))try{l()}catch(e){i=e instanceof eS?e.errors:[e]}var a=this._finalizers;if(a){this._finalizers=null;try{for(var c=em(a),f=c.next();!f.done;f=c.next()){var p=f.value;try{eI(p)}catch(e){i=null!=i?i:[],e instanceof eS?i=ew(ew([],eg(i)),eg(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}if(i)throw new eS(i)}},t.prototype.add=function(e){var r;if(e&&e!==this){if(this.closed)eI(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&eB(t,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&eB(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),e_=eA.EMPTY;function e$(e){return e instanceof eA||e&&"closed"in e&&ec(e.remove)&&ec(e.add)&&ec(e.unsubscribe)}function eI(e){ec(e)?e():e.unsubscribe()}var eR={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},eC={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=eC.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,ew([e,t],eg(r))):setTimeout.apply(void 0,ew([e,t],eg(r)))},clearTimeout:function(e){var t=eC.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ez(e){eC.setTimeout(function(){var t=eR.onUnhandledError;if(t)t(e);else throw e})}function eT(){}var ej=eU("C",void 0,void 0);function eU(e,t,r){return{kind:e,value:t,error:r}}var eH=null;function eN(e){if(eR.useDeprecatedSynchronousErrorHandling){var t=!eH;if(t&&(eH={errorThrown:!1,error:null}),e(),t){var r=eH,n=r.errorThrown,i=r.error;if(eH=null,n)throw i}}else e()}var eP=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,e$(t)&&t.add(r)):r.destination=eJ,r}return ev(t,e),t.create=function(e,t,r){return new eF(e,t,r)},t.prototype.next=function(e){this.isStopped?eL(eU("N",e,void 0),this):this._next(e)},t.prototype.error=function(e){this.isStopped?eL(eU("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?eL(ej,this):(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(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(eA),eM=Function.prototype.bind;function eV(e,t){return eM.call(e,t)}var eD=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){eW(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){eW(e)}else eW(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){eW(e)}},e}(),eF=function(e){function t(t,r,n){var i,o,s=e.call(this)||this;return ec(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&eR.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&eV(t.next,o),error:t.error&&eV(t.error,o),complete:t.complete&&eV(t.complete,o)}):i=t,s.destination=new eD(i),s}return ev(t,e),t}(eP);function eW(e){eR.useDeprecatedSynchronousErrorHandling?eR.useDeprecatedSynchronousErrorHandling&&eH&&(eH.errorThrown=!0,eH.error=e):ez(e)}function eL(e,t){var r=eR.onStoppedNotification;r&&eC.setTimeout(function(){return r(e,t)})}var eJ={closed:!0,next:eT,error:function(e){throw e},complete:eT},eq="function"==typeof Symbol&&Symbol.observable||"@@observable";function eK(e){return e}function eX(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return eY(e)}function eY(e){return 0===e.length?eK:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var eG=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,i=this,o=(n=e)&&n instanceof eP||n&&ec(n.next)&&ec(n.error)&&ec(n.complete)&&e$(n)?e:new eF(e,t,r);return eN(function(){var e=i.operator,t=i.source;o.add(e?e.call(o,t):t?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=eQ(t))(function(t,n){var i=new eF({next:function(t){try{e(t)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t});r.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[eq]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return eY(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=eQ(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function eQ(e){var t;return null!==(t=null!=e?e:eR.Promise)&&void 0!==t?t:Promise}function eZ(e){return Symbol.asyncIterator&&ec(null==e?void 0:e[Symbol.asyncIterator])}function e0(e){return TypeError("You provided "+(null!==e&&"object"==typeof e?"an invali
1d object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var e1="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function e2(e){return ec(null==e?void 0:e[e1])}function e3(e){return function(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,a)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){o.push([e,t,r,n])>1||u(e,t)})},t&&(n[e]=t(n[e])))}function u(e,t){try{var r;(r=i[e](t)).value instanceof ex?Promise.resolve(r.value.v).then(l,a):c(o[0][2],r)}catch(e){c(o[0][3],e)}}function l(e){u("next",e)}function a(e){u("throw",e)}function c(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}(this,arguments,function(){var t,r,n;return ey(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,ex(t.read())];case 3:if(n=(r=i.sent()).value,!r.done)return[3,5];return[4,ex(void 0)];case 4:return[2,i.sent()];case 5:return[4,ex(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function e8(e){return ec(null==e?void 0:e.getReader)}function e7(e){if(e instanceof eG)return e;if(null!=e){if(ec(e[eq]))return new eG(function(t){var r=e[eq]();if(ec(r.subscribe))return r.subscribe(t);throw TypeError("Provided object does not correctly implement Symbol.observable")});if(ek(e))return new eG(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()});if(eE(e))return new eG(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,ez)});if(eZ(e))return e6(e);if(e2(e))return new eG(function(t){var r,n;try{for(var i=em(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()});if(e8(e))return e6(e3(e))}throw e0(e)}function e6(e){return new eG(function(t){(function(e,t){var r,n,i,o,s,u,l,a;return s=this,u=void 0,l=void 0,a=function(){var s;return ey(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=em(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,i,(t=e[r](t)).done,t.value)})}}}(e),u.label=1;case 1:return[4,r.next()];case 2:if((n=u.sent()).done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return i={error:u.sent()},[3,11];case 6:if(u.trys.push([6,,9,10]),!(n&&!n.done&&(o=r.return)))return[3,8];return[4,o.call(r)];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})},new(l||(l=Promise))(function(e,t){function r(e){try{i(a.next(e))}catch(e){t(e)}}function n(e){try{i(a.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):((i=t.value)instanceof l?i:new l(function(e){e(i)})).then(r,n)}i((a=a.apply(s,u||[])).next())})})(e,t).catch(function(e){return t.error(e)})})}function e4(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function e5(e){return function(t){if(ec(null==t?void 0:t.lift))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}function e9(e,t,r,n,i){return new te(e,t,r,n,i)}var te=function(e){function t(t,r,n,i,o,s){var u=e.call(this,t)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return ev(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),r||null===(t=this.onFinalize)||void 0===t||t.call(this)}},t}(eP);function tt(e,t){return void 0===t&&(t=0),e5(function(r,n){r.subscribe(e9(n,function(r){return e4(n,e,function(){return n.next(r)},t)},function(){return e4(n,e,function(){return n.complete()},t)},function(r){return e4(n,e,function(){return n.error(r)},t)}
1))})}function tr(e,t){return void 0===t&&(t=0),e5(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function tn(e,t){if(!e)throw Error("Iterable cannot be null");return new eG(function(r){e4(r,t,function(){var n=e[Symbol.asyncIterator]();e4(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function ti(e,t){return t?function(e,t){if(null!=e){if(ec(e[eq]))return e7(e).pipe(tr(t),tt(t));if(ek(e))return new eG(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})});if(eE(e))return e7(e).pipe(tr(t),tt(t));if(eZ(e))return tn(e,t);if(e2(e))return new eG(function(r){var n;return e4(r,t,function(){n=e[e1](),e4(r,t,function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(e){r.error(e);return}i?r.complete():r.next(t)},0,!0)}),function(){return ec(null==n?void 0:n.return)&&n.return()}});if(e8(e))return tn(e3(e),t)}throw e0(e)}(e,t):e7(e)}function to(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ed(e);return ti(e,r)}var ts=Object.defineProperty,tu=(e,t,r)=>t in e?ts(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tl=(e,t,r)=>tu(e,t+"",r);let ta=class e extends Error{constructor(){super("ChainHead stopped"),this.name=e.errorName}};tl(ta,"errorName","StopError");let tc=class e extends Error{constructor(){super("ChainHead disjointed"),this.name=e.errorName}};tl(tc,"errorName","DisjointError");let tf=class e extends Error{constructor(){super("ChainHead operations limit reached"),this.name=e.errorName}};tl(tf,"errorName","OperationLimitError");let tp=class e extends Error{constructor(t){super(t),this.name=e.errorName}};tl(tp,"errorName","OperationError");let th=class e extends Error{constructor(){super("ChainHead operation inaccessible"),this.name=e.errorName}};tl(th,"errorName","OperationInaccessibleError");var td=eO(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),tb=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return ev(t,e),t.prototype.lift=function(e){var t=new tv(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new td},t.prototype.next=function(e){var t=this;eN(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=em(t.currentObservers),o=i.next();!o.done;o=i.next())o.value.next(e)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;eN(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;eN(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this.hasError,n=this.isStopped,i=this.observers;return r||n?e_:(this.currentObservers=null,i.push(e),new eA(function(){t.currentObservers=null,eB(i,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,r=this.thrownError,n=this.isStopped;t?e.error(r):n&&e.complete()},t.prototype.asObservable=function(){var e=new eG;return e.source=this,e},t.create=function(e,t){return new tv(e,t)},t}(eG),tv=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return ev(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:e_},t}(tb);function ty(e,t){return e5(function(r,n){var i=0;r.subscribe(e9(n,function(r){n.next(e.call(t,r,i++))}))})}function tm(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new tb}:t,n=e.resetOnError,i=void 0===n||n,o=e.resetOnComplete,s=void 0===o||o,u=e.resetOnRefCountZero,l=void 0===u||u;return function(e){var t,n,o,u=0,a=!1,c=!1,f=function(){null==n||n.unsubscribe(),n=void 0},p=function(){f(),t=o=void 0,a=c=!1},h=function(){var e=t;p(),null==e||e.unsubscribe()};return e5(function(e,d){u++,c||a||f();var b=o=null!=o?o:r();d.add(function(){0!=--u||c||a||(n=tg(h,l))}),b.subscribe(d),!t&&u>0&&(t=new eF({next:function(e){return b.next(e)},error:function(e){c=!0,f(),n=tg(p,i,e),b.error(e)},complete:function(){a=!0,f(),n=tg(p,s),b.complete()}}),e7(e).subscribe(t))})(e)}}function tg(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0===t){e();return}if(!1!==t){var i=new eF({next:function(){i.unsubscribe(),e()}});return e7(t.apply(void 0,ew([],eg(r)))).subscribe(i)}}var tw={now:function(){return(tw.delegate||Date).now()},delegate:void 0},tx=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=tw);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return ev(t,e),t.prototype.next=function(t){var r=this.isStopped,n=this._buffer,i=this._infiniteTimeWindow,o=this._timestampProvider,s=this._windowTime;!r&&(n.push(t),i||n.push(o.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!e.closed;i+=r?1:2)e.next(n[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this._bufferSize,t=this._timestampProvider,r=this._buffer,n=this._infiniteTimeWindow,i=(n?1:2)*e;if(e<1/0&&i<r.length&&r.splice(0,r.length-i),!n){for(var o=t.now(),s=0,u=1;u<r.length&&r[u]<=o;u+=2)s=u;s&&r.splice(0,s+1)}},t}(tb);function tk(e,t,r){var n=ec(e)||t||r?{next:e,error:t,complete:r}:e;return n?e5(function(e,t){null===(r=n.subscribe)||void 0===r||r.call(n);var r,i=!0;e.subscribe(e9(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;i=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;i=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;i&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):eK}function tE(e,t){return e5(function(r,n){var i=0;r.subscribe(e9(n,function(r){return e.call(t,r,i++)&&n.next(r)}))})}function tO(e,t){return void 0===t&&(t=eK),e=null!=e?e:tS,e5(function(r,n){var i,o=!0;r.subscribe(e9(n,function(r){var s=t(r);(o||!e(i,s))&&(o=!1,i=s,n.next(r))}))})}function tS(e,t){return e===t}function tB(e,t){var r;return e5((r=arguments.length>=2,function(n,i){var o=r,s=t,u=0;n.subscribe(e9(i,function(t){var r=u++;s=o?e(s,t,r):(o=!0,t),i.next(s)},void 0))}))}function tA(e,t,r){return(void 0===r&&(r=1/0),ec(t))?tA(function(r,n){return ty(function(e,i){return t(r,e,n,i)})(e7(e(r,n)))},r):("number"==typeof t&&(r=t),e5(function(t,n){var i,o,s,u,l,a,c,f,p;return i=r,s=[],u=0,l=0,a=!1,c=function(){!a||s.length||u||n.complete()},f=function(e){return u<i?p(e):s.push(e)},p=function(t){u++;var r=!1;e7(e(t,l++)).subscribe(e9(n,function(e){o?f(e):n.next(e)},function(){r=!0},void 0,function(){if(r)try{for(u--;s.length&&u<i;)!function(){var e=s.shift();p(e)}();c()}catch(e){n.error(e)}}))},t.subscribe(e9(n,f,function(){a=!0,c()})),function(){}}))}function t_(e){return void 0===e&&(e=1/0),tA(eK,e)}function t$(e,t){return e5(function(r,n){var i=null,o=0,s=!1,u=function(){return s&&!i&&n.c
1omplete()};r.subscribe(e9(n,function(r){null==i||i.unsubscribe();var s=0,l=o++;e7(e(r,l)).subscribe(i=e9(n,function(e){return n.next(t?t(r,e,l,s++):e)},function(){i=null,u()}))},function(){s=!0,u()}))})}var tI=new eG(function(e){return e.complete()});function tR(e){return e<=0?function(){return tI}:e5(function(t,r){var n=0;t.subscribe(e9(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function tC(e,t,r){var n,i,o,s,u=!1;return e&&"object"==typeof e?(s=void 0===(n=e.bufferSize)?1/0:n,t=void 0===(i=e.windowTime)?1/0:i,u=void 0!==(o=e.refCount)&&o,r=e.scheduler):s=null!=e?e:1/0,tm({connector:function(){return new tx(s,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}function tz(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=ed(t),i=(e=1/0,"number"==typeof ep(t)?t.pop():e);return t.length?1===t.length?e7(t[0]):t_(i)(ti(t,n)):tI}function tT(e,t){return void 0===t&&(t=!1),e5(function(r,n){var i=0;r.subscribe(e9(n,function(r){var o=e(r,i++);(o||t)&&n.next(r),o||n.complete()}))})}function tj(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return t_(1)(ti(e,ed(e)))}var tU=Object.defineProperty,tH=(e,t,r)=>t in e?tU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tN=(e,t,r)=>tH(e,"symbol"!=typeof t?t+"":t,r);class tP{constructor(){tN(this,"first"),tN(this,"last")}getRemoveFn(e){return()=>{e.prev?e.prev.next=e.next:this.first=e.next,e.next?e.next.prev=e.prev:this.last=e.prev,delete e.prev,delete e.next}}push(e){let t={value:e};return void 0===this.last?this.last=this.first=t:(this.last.next=t,t.prev=this.last,this.last=t),this.getRemoveFn(t)}unshift(e){return this.first={value:e,next:this.first},this.first.next&&(this.first.next.prev=this.first),this.last||(this.last=this.first),this.getRemoveFn(this.first)}pop(){let e=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),e}isEmpty(){return!this.first}}let tM=()=>{let e=new Map,t=(t,r)=>{e.set(t,()=>{e.delete(t),r()})},r=t=>{e.get(t)?.()},n=new tP,i=n.unshift.bind(n),o=n.push.bind(n),s=(e,r)=>{t(e.source$,(r?i:o)(e))},u=()=>{let t=n.pop();t&&(e.delete(t.source$),l(t))},l=e=>{let{source$:r,observer:n}=e,i=!1,o=r.subscribe({next(e){n.next(e)},error(t){(i=t instanceof Error&&t.name===tf.errorName)?s(e,!0):n.error(t)},complete(){n.complete()}});o.closed?i||u():t(r,()=>{o.unsubscribe(),u()})},a=(e=!1)=>t=>new eG(i=>{let o={observer:i,source$:t};return n.isEmpty()?l(o):s(o,e),()=>{r(t)}}),c=a();return{withRecovery:a,withRecoveryFn:e=>(...t)=>c(e(...t))}};function tV(e){return e5(function(t,r){var n,i=null,o=!1;i=t.subscribe(e9(r,void 0,void 0,function(s){n=e7(e(s,tV(e)(t))),i?(i.unsubscribe(),i=null,n.subscribe(r)):o=!0})),o&&(i.unsubscribe(),i=null,n.subscribe(r))})}function tD(e,t){var r=ec(e)?e:function(){return e},n=function(e){return e.error(r())};return new eG(t?function(e){return t.schedule(n,0,e)}:n)}class tF extends Error{constructor(e,t){super(`Block ${e} is not pinned (${t})`),this.name="BlockNotPinnedError"}}var tW=function(e){function t(t,r){return e.call(this)||this}return ev(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(eA),tL={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=tL.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,ew([e,t],eg(r))):setInterval.apply(void 0,ew([e,t],eg(r)))},clearInterval:function(e){var t=tL.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},tJ=function(e){function t(t,r){var n=e.call(this,t,r)||this;
1return n.scheduler=t,n.work=r,n.pending=!1,n}return ev(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r,n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),tL.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&tL.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,eB(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(tW),tq=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=tw.now,e}(),tK=new(function(e){function t(t,r){void 0===r&&(r=tq.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return ev(t,e),t.prototype.flush=function(e){var t,r=this.actions;if(this._active){r.push(e);return}this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,t){for(;e=r.shift();)e.unsubscribe();throw t}},t}(tq))(tJ);function tX(e,t,r){void 0===e&&(e=0),void 0===r&&(r=tK);var n=-1;return null!=t&&(ef(t)?r=t:n=t),new eG(function(t){var i,o=(i=e)instanceof Date&&!isNaN(i)?+e-r.now():e;o<0&&(o=0);var s=0;return r.schedule(function(){t.closed||(t.next(s++),0<=n?this.schedule(void 0,n):t.complete())},o)})}let tY=e=>{let t=e.pipe(tV(e=>{var r,n;return e instanceof Error&&e.name===th.errorName?tX(750).pipe((r=()=>t,ec(void 0)?tA(r,n,1):tA(r,1))):tD(()=>e)}));return t},tG=new Set(["best","finalized",null]),tQ=(e,t,r)=>n=>(i,...o)=>{if(!tG.has(i))return tY(n(i,...o)).pipe(r(i));let s=("best"===i?t:e).pipe(tR(1),tA(e=>n(e,...o).pipe(r(e))),tV(e=>e instanceof tF?s:tD(()=>e)));return tY(s)},tZ=e=>(...t)=>new eG(r=>{let n=new AbortController;return e(...t,n.signal).then(e=>{r.next(e),r.complete()},e=>{r.error(e)}),()=>{r.unsubscribe(),n.abort(),n=void 0}}),t0=e=>t=>(...r)=>e()[t](...r);function t1(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return tj(t,to.apply(void 0,ew([],eg(e))))}}function t2(){return e5(function(e,t){e.subscribe(e9(t,eT))})}var t3=new eG(eT),t8=((s=t8||{})[s.Initializing=0]="Initializing",s[s.Ready=1]="Ready",s[s.RecoveringInit=2]="RecoveringInit",s[s.RecoveringFin=3]="RecoveringFin",s);function t7(e,t,r){return(n,...i)=>{let o;let s=()=>new tF(n,r),u=t(n,...i).pipe(ty(e=>({type:"val",value:e})),t1({type:"end"})),l=e.pipe(tT(e=>!e.blocks.has(n)),ty(e=>{if(e.blocks.get(e.finalized).number>=o.number)throw s()}),t2());return e.pipe(ty(e=>e.state.type===t8.Ready),tO(),t$(t=>t?(o||(o=e.state.blocks.get(n)),o?tj(l,u):tD(s)):t3),tT(e=>"val"===e.type),ty(e=>e.value))}}let t6=(e,t)=>{let r=(n,i,o,s)=>new eG(t=>e().storageSubscription(n,i,o??null,e=>{t.next(e)},e=>{t.error(e)},()=>{t.complete()},e=>{e>0&&t.next(r(n,i.slice(-e),o,!0))})).pipe(t_(),t(s));return r};var t4=r(1275),t5=r(5540),t9=r(7510);let re=BigInt(0),rt=BigInt(1),rr=BigInt(2),rn=BigInt(7),ri=BigInt(256),ro=BigInt(113),rs=[],ru=[],rl=[];for(let e=0,t=rt,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],rs.push(2*(5*n+r)),ru.push((e+1)*(e+2)/2%64);let i=re;for(let e=0;e<7;e++)(t=(t<<rt^(t>>rn)*ro)%ri)&rr&&(i^=rt<<(rt<<BigInt(e))-rt);rl.push(i)}
1let ra=(0,t5.Vl)(rl,!0),rc=ra[0],rf=ra[1],rp=(e,t,r)=>r>32?(0,t5.SD)(e,t,r):(0,t5.EP)(e,t,r),rh=(e,t,r)=>r>32?(0,t5.mk)(e,t,r):(0,t5.gm)(e,t,r);class rd{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(e,t,r,n=!1,i=24){if(this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,(0,t9.k8)(r,"outputLen"),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,t9.Jq)(this.state)}clone(){return this._cloneInto()}keccak(){(0,t9.Ux)(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],u=rp(o,s,1)^r[n],l=rh(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=u,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=ru[r],o=rp(t,i,n),s=rh(t,i,n),u=rs[r];t=e[u],i=e[u+1],e[u]=o,e[u+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=rc[n],e[1]^=rf[n]}(0,t9.ru)(r)}(this.state32,this.rounds),(0,t9.Ux)(this.state32),this.posOut=0,this.pos=0}update(e){(0,t9.$h)(this),(0,t9.gk)(e);let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let o=Math.min(t-this.pos,n-i);for(let t=0;t<o;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){(0,t9.$h)(this,!1),(0,t9.gk)(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,t9.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,t9.eB)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,t9.ru)(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return(e||=new rd(t,r,n,o,i)).state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}let rb=((e,t,r,n={})=>(0,t9.V1)(()=>new rd(t,e,r),n))(1,136,32);var rv=r(195);let ry=[t4.vT,rb],rm=(e,t)=>ry.find(r=>(0,rv.N)(r((0,rv.H)(e)))===t)||(()=>{throw Error("Unsupported hasher")});var rg=r(6571);let rw=new TextEncoder,rx=new TextDecoder,rk=(0,d.hD)((0,d.Jj)(4),rw.encode.bind(rw),rx.decode.bind(rx)),rE=(0,O.AU)({engine:rk,payload:(0,rg.p)()}),rO=x({other:(0,d.Jj)(),consensus:rE,seal:rE,preRuntime:rE,runtimeUpdated:d.R9},[0,4,5,6,8]),rS=(0,rg.p)(32),rB=(0,O.AU)({parentHash:rS,number:E.J,stateRoot:rS,extrinsicRoot:rS,digests:(0,O.OW)(rO)});var rA=Array.isArray,r_=Object.getPrototypeOf,r$=Object.prototype,rI=Object.keys,rR=Array.isArray;function rC(e){return ty(function(t){return rR(t)?e.apply(void 0,ew([],eg(t))):e(t)})}function rz(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ed(e),n=eh(e),i=function(e){if(1===e.length){var t=e[0];if(rA(t))return{args:t,keys:null};if(t&&"object"==typeof t&&r_(t)===r$){var r=rI(t);return{args:r.map(function(e){return t[e]}),keys:r}}}return{args:e,keys:null}}(e),o=i.args,s=i.keys;if(0===o.length)return ti([],r);var u=new eG(rT(o,r,s?function(e){return s.reduce(function(t,r,n){return t[r]=e[n],t},{})}:eK));return n?u.pipe(rC(n)):u}function rT(e,t,r){return void 0===r&&(r=eK),function(n){var i;i=function(){for(var i=e.length,o=Array(i),s=i,u=i,l=function(i){var l;l=function(){var l=ti(e[i],t),a=!1;l.subscribe(e9(n,function(e){o[i]=e,!a&&(a=!0,u--),u||n.next(r(o.slice()))},function(){--s||n.complete()}))},t?e4(n,t,l):l()},a=0;a<i;a++)l(a)},t?e4(n,t,i):i()}}function rj(e){return new eG(function(t){e7(e()).subscribe(t)})}let rU=e=>{let t=(r,n,i)=>{let o=r[n.idx],s=r[i.idx];if(2===r.length)return to([[o,n.id],[s,i.id]]);let u=n.idx+Math.floor((i.idx-n.idx)/2);return e(r[u]).pipe(tA(e=>{let o={id:e,idx:u};return o.id===n.id?t(r,o,i):o.id===i.id?t(r,n,o):rz([t(r,n,o),t(r,o,i)]).pipe(ty(([e,[t,...r]])=>[...e,...r]))}))};return r=>{let[n]=r;if(1===r.length)return e(n).pipe(ty(e=>[[n,e]]));let i=r.length-1;return rz([n,r[i]].map(e)).pipe(tA(([e,o])=>e===o?to([[n,e]]):t(r,{idx:0,id:e},{idx:i,id:o})))}},rH=(e,t,r)=>{let n=rU(t),i=t=>rj(()=>e().header(t)),o=new tx(1),s=e=>{if("initialized"===e.type){let[t]=e.finalizedBlockHashes;return rz([i(t),n(e.finalizedBlockHashes)]).pipe(ty(([r,n])=>{o.closed||(o.next(rm(r,t)),o.complete());let{number:i,parentHash:s,digests:u}=rB.dec(r);
1return{type:"initialized",finalizedBlockHashes:e.finalizedBlockHashes,runtimeChanges:new Map(n),number:i,parentHash:s,hasNewRuntime:u.some(e=>"runtimeUpdated"===e.type)}}))}if("newBlock"===e.type&&e.newRuntime)return t(e.blockHash).pipe(ty(t=>({...e,codeHash:t})))};return{getHeader:e=>i(e).pipe(ty(rB[1])),hasher$:o.asObservable(),enhancer:e=>new eG(t=>{let n,i=null,o=e=>i?.push(e)||u(e),u=e=>{let u=s(e);u?(i=[],n=u.subscribe({next:e=>{let r=[...i];i=null,t.next(e),r.forEach(o)},error:r})):t.next(e)},l=e.subscribe(e=>{"stop-error"===e.type?(n?.unsubscribe(),i=null,t.next(e)):o(e)});return()=>{n?.unsubscribe(),l.unsubscribe()}})}},rN=(e,t)=>{let r=null,n=!1,i=()=>{n=!0},o=()=>{if(!r)throw Error("Missing chainHead subscription");return r},s=t(tZ((e,t)=>o().storage(e,"hash","0x3a636f6465",null,t))),u=eT,{hasher$:l,enhancer:a,getHeader:c}=rH(o,s,()=>u());return{getHeader:c,hasher$:l,getFollower:o,follow$:new eG(t=>{let o;if(n)return t.complete();let s=()=>{r=e(!0,e=>t.next(e),e=>{r=null,n||(e instanceof Error&&e.name===ta.errorName?(s(),t.next({type:"stop-error"})):(console.warn("ChainHead follow request failed, retryingâ¦",e),o=setTimeout(s,250)))})};u=()=>{t.next({type:"stop-error"}),clearTimeout(o),r?.unfollow(),s()},s(),i=()=>{n=!0,clearTimeout(o),t.complete(),r?.unfollow()}}).pipe(a,tm()),unfollow:()=>{i()}}};var rP=r(5543),rM=r(8494);let rV=e=>(0,rv.N)(d.Jq.enc(e)),rD=(0,d.Jj)(),rF=(0,O.Wx)(rD),rW=(0,O.OW)(d.Jq).dec,rL=e=>e("Metadata_metadata_versions","").pipe(ty(rW),tV(()=>to([14]))).pipe(tA(t=>{let[r]=t.filter(e=>e>13&&e<17).sort((e,t)=>t-e);return 14===r?e("Metadata_metadata","").pipe(ty(rD.dec)):e("Metadata_metadata_at_version",rV(r)).pipe(ty(e=>rF.dec(e)))}));var rJ=r(7692),rq=r(5377),rK=r(3274),rX=r(6781);let rY=e=>e,rG=(e,t,r,n)=>new DataView(new Uint16Array([e,t,r,n]).buffer).getBigUint64(0,!0),rQ=2n**64n-1n,rZ=(e,t)=>e<<t&rQ|e>>64n-t,r0=(e,t)=>e*t&rQ,r1=(e,t)=>e+t&rQ;function r2(e,t=0n){let r,n=r1(r1(t,0x9e3779b185ebca87n),0xc2b2ae3d27d4eb4fn),i=r1(t,0xc2b2ae3d27d4eb4fn),o=t,s=t-0x9e3779b185ebca87n,u=e.length,l=0,a=null;!function(){let t=0,r=0+u;if(u){if(a=new Uint8Array(32),u<32){a.set(e.subarray(0,u),l),l+=u;return}if(t<=r-32){let u=r-32;do{let r;r=rG(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),n=r0(rZ(r1(n,r0(r,0xc2b2ae3d27d4eb4fn)),31n),0x9e3779b185ebca87n),t+=8,r=rG(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),i=r0(rZ(r1(i,r0(r,0xc2b2ae3d27d4eb4fn)),31n),0x9e3779b185ebca87n),t+=8,r=rG(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),o=r0(rZ(r1(o,r0(r,0xc2b2ae3d27d4eb4fn)),31n),0x9e3779b185ebca87n),t+=8,r=rG(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),s=r0(rZ(r1(s,r0(r,0xc2b2ae3d27d4eb4fn)),31n),0x9e3779b185ebca87n),t+=8}while(t<=u)}t<r&&(a.set(e.subarray(t,r),l),l=r-t)}}(),e=a||e;let c=0;for(u>=32?(r=r1(r=rZ(n,1n),rZ(i,7n)),r=r1(r,rZ(o,12n)),r=r1(r,rZ(s,18n))^(n=r0(rZ(r0(n,0xc2b2ae3d27d4eb4fn),31n),0x9e3779b185ebca87n)),r=r1(r0(r,0x9e3779b185ebca87n),0x85ebca77c2b2ae63n)^(i=r0(rZ(r0(i,0xc2b2ae3d27d4eb4fn),31n),0x9e3779b185ebca87n)),r=r1(r0(r,0x9e3779b185ebca87n),0x85ebca77c2b2ae63n)^(o=r0(rZ(r0(o,0xc2b2ae3d27d4eb4fn),31n),0x9e3779b185ebca87n)),r=r1(r0(r,0x9e3779b185ebca87n),0x85ebca77c2b2ae63n)^(s=r0(rZ(r0(s,0xc2b2ae3d27d4eb4fn),31n),0x9e3779b185ebca87n)),r=r1(r0(r,0x9e3779b185ebca87n),0x85ebca77c2b2ae63n)):r=r1(t,0x27d4eb2f165667c5n),r=r1(r,BigInt(u));c<=l-8;){let t=rG(e[c+1]<<8|e[c],e[c+3]<<8|e[c+2],e[c+5]<<8|e[c+4],e[c+7]<<8|e[c+6]);t=r0(rZ(r0(t,0xc2b2ae3d27d4eb4fn),31n),0x9e3779b185ebca87n),r=r1(r0(rZ(r^t,27n),0x9e3779b185ebca87n),0x85ebca77c2b2ae63n),c+=8}if(c+4<=l){let t=r0(rG(e[c+1]<<8|e[c],e[c+3]<<8|e[c+2],0,0),0x9e3779b185ebca87n);r=r1(r0(rZ(r^t,23n),0xc2b2ae3d27d4eb4fn),0x165667b19e3779f9n),c+=4}for(;c<l;){let t=r0(rG(e[c++],0,0,0),0x27d4eb2f165667c5n);r=r0(rZ(r^t,11n),0x9e3779b185ebca87n)}let f=r>>33n;return f=(r=r0(r^f,0xc2b2ae3d27d4eb4fn))>>29n,f=(r=r0(r^f,0x165667b19e3779f9n))>>32n,r^=f}let r3=e=>{let t=new Uint8Array(16),r=new DataView(t.buffer);return r.setBigUint64(0,r2(e),!0),r.setBigUint64(8,r2(e,1n),!0),t},r8=e=>{let t=new Uint8Array(32),r=new DataView(t.buffer);return r.setBigUint64(0,r2(e),!0),r.setBigUint64(8,r2(e,1n),!0),r.setBigUint64(16,r2(e,2n),!0),r.setBigUint64(24,r2(e,3n),!0),t},r7=e=>(0,rX.r)([d.AW.enc(r2(e)),e]),r6=new TextEncoder,r4=new Map([[rY,0],[r7,8],[t4.Nd,16],[t4.BT,-16],[t4.vT,-32],[r3,-16],[r8,-32]]),r5=e=>{let t=r3(r6.encode(e));return(r,...n)=>{let i=(0,rX.r)([t,r3(r6.encode(r))]),o=(0,rv.N)(i),s=n.map(([{enc:e},t])=>r=>t(e(r)));return{enc:(...e)=>(0,rv.N)((0,rX.r)([i,...e.map((e,t)=>s[t](e))])),dec:t=>{if(!t.startsWith(o))throw Error(`key does not match this storage (${e}.${r})`);if(0===n.length)return[];let i=(0,rv.H)(t.slice(o.length)),s=Array(n.length);for(let e=0,t=0;e<n.length;e++){let[r,o]=n[e],u=r4.get(o);if(null==u)throw Error("Unknown hasher");if(u<0){let r=-1*u;s[e]=(0,rv.N)(i.slice(t,t+r)),t+=r}else t+=u,s[e]=r.dec(i.slice(t)),t+=r.enc(s[e]).length}return s}}}};var r9=Object.defineProperty,ne=e=>{throw TypeError(e)},nt=(e,t,r)=>t in e?r9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nr=(e,t,r)=>nt(e,"symbol"!=typeof t?t+"":t,r),nn=(e,t,r)=>
1t.has(e)||ne("Cannot "+r),ni=(e,t,r)=>(nn(e,t,"read from private field"),r?r.call(e):t.get(e)),no=(e,t,r)=>t.has(e)?ne("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ns=(e,t,r,n)=>(nn(e,t,"write to private field"),t.set(e,r),r);let nu=new TextEncoder,nl=new TextDecoder,na=(0,d.ps)(d.oA,(0,d.Jj)(1/0))[1];class nc{constructor(e,t=!1){if(no(this,l),no(this,a,null),no(this,c,null),no(this,f,null),no(this,p,null),nr(this,"asText",()=>ni(this,p)??ns(this,p,nl.decode(ni(this,l)))),nr(this,"asHex",()=>ni(this,c)??ns(this,c,(0,rv.N)(ni(this,l)))),nr(this,"asOpaqueHex",()=>ni(this,f)??ns(this,f,(0,rv.N)(this.asOpaqueBytes()))),nr(this,"asBytes",()=>ni(this,l)),nr(this,"asOpaqueBytes",()=>ni(this,a)??ns(this,a,(0,rX.r)([d.oA[0](ni(this,l).length),ni(this,l)]))),t){try{let[t,r]=na(e);if(t===r.length){ns(this,l,r),ns(this,a,e);return}}catch(e){}throw Error("Invalid opaque bytes")}ns(this,l,e)}static fromText(e){return new this(nu.encode(e))}static fromHex(e){return new this((0,rv.H)(e))}static fromOpaqueHex(e){return new this((0,rv.H)(e),!0)}static fromBytes(e){return new this(e)}static fromOpaqueBytes(e){return new this(e,!0)}}l=new WeakMap,a=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap;let[nf]=(0,rJ.h)();class np extends nc{constructor(e){super(e)}static fromArray(e){return new this(new Uint8Array(e))}static fromAccountId32(e){return new this(nf(e))}}let nh=e=>{let t=d.Jj.enc(e);return e=>t(e.asBytes())},nd=e=>{let t=d.Jj.dec(e),r=null==e?nc:np;return e=>r.fromBytes(t(e))},nb=e=>(0,d.VG)(nh(e),nd(e));nb.enc=nh,nb.dec=nd;let nv=(0,d.UF)(e=>{let t=E.J.dec(e);return{bytes:(0,d.Jj)(Math.ceil(t/8)).dec(e),bitsLen:t}}),ny=(0,d.VG)(e=>{if(e.bitsLen>8*e.bytes.length)throw Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);let t=E.J.enc(e.bitsLen),r=new Uint8Array(e.bytes.length+t.length);return r.set(t,0),r.set(e.bytes,t.length),r},nv),nm=(0,d.hD)(d.u8,e=>e.charCodeAt(0),String.fromCharCode),ng=new TextEncoder,nw=new TextDecoder,nx=e=>(0,d.hD)((0,d.Jj)(e),e=>ng.encode(e),e=>nw.decode(e)),nk=e=>{let t=e.slice(2),r=(0,rv.N)(rb(ng.encode(t))).slice(2),n=Array(40);for(let e=0;e<40;e++){let i=parseInt(r[e],16),o=t[e];n[e]=i>7?o.toUpperCase():o}return`0x${n.join("")}`},nE=(0,d.Jj)(20)[1],nO=(0,d.VG)(e=>{let t=(0,rv.H)(e);if(20!==t.length)throw Error(`Invalid length found on EthAddress(${e})`);let r=(0,rv.N)(t);if(e===r||e===r.toUpperCase())return t;if(nk(r)!==e)throw Error(`Invalid checksum found on EthAddress(${e})`);return t},(0,d.UF)(e=>nk((0,rv.N)(nE(e))))),nS=(e=!0)=>(0,d.UF)(t=>{let r=E.J.dec(t),n=(0,d.Jj)(Math.ceil(r/8)).dec(t),i=Array(r),o=0;return n.forEach(t=>{for(let n=0;n<8&&o<r;n++){let r=e?n:7-n;i[o++]=t>>r&1}}),i}),nB=(e=!0)=>t=>{let r=E.J.enc(t.length),n=Math.ceil(t.length/8),i=new Uint8Array(n);for(let r=0;r<n;r++){let n=8*r,o=0;for(let r=0;r<8&&n<t.length;r++,n++)o|=t[n]<<(e?r:7-r);i[r]=o}return(0,rX.r)([r,i])},nA=e=>(0,d.VG)(nB(e),nS(e));nA.enc=nB,nA.dec=nS;var n_=r(9197),n$=r(327),nI=r(948),nR=r(7264),nC=r(8417),nz=r(5070);let nT={CHUNK_START:1,CHUNK_END:2,PARENT:4,ROOT:8,KEYED_HASH:16,DERIVE_KEY_CONTEXT:32,DERIVE_KEY_MATERIAL:64},nj=nC.r$.slice(),nU=(()=>{let e=Array.from({length:16},(e,t)=>t),t=e=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(t=>e[t]),r=[];for(let n=0,i=e;n<7;n++,i=t(i))r.push(...i);return Uint8Array.from(r)})();class nH extends nz.d9{chunkPos=0;chunksDone=0;flags=0;IV;state;stack=[];posOut=0;bufferOut32=new Uint32Array(16);bufferOut;chunkOut=0;enableXOF=!0;constructor(e={},t=0){super(64,void 0===e.dkLen?32:e.dkLen);let{key:r,context:n}=e,i=void 0!==n;if(void 0!==r){if(i)throw Error('Only "key" or "context" can be specified at same time');(0,t9.gk)(r,32,"key");let e=r.slice();this.IV=(0,t9.Jq)(e),(0,t9.Ux)(this.IV),this.flags=t|nT.KEYED_HASH}else if(i){(0,t9.gk)(n,void 0,"context");let e=new nH({dkLen:32},nT.DERIVE_KEY_CONTEXT).update(n).digest();this.IV=(0,t9.Jq)(e),(0,t9.Ux)(this.IV),this.flags=t|nT.DERIVE_KEY_MATERIAL}else this.IV=nj.slice(),this.flags=t;this.state=this.IV.slice(),this.bufferOut=(0,t9.u8)(this.bufferOut32)}get(){return[]}set(){}b2Compress(e,t,r,n=0){let{state:i,pos:o}=this,{h:s,l:u}=(0,t5.Ev)(BigInt(e),!0),{v0:l,v1:a,v2:c,v3:f,v4:p,v5:h,v6:d,v7:b,v8:v,v9:y,v10:m,v11:g,v12:w,v13:x,v14:k,v15:E}=(0,nz.nN)(nU,n,r,7,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],nj[0],nj[1],nj[2],nj[3],s,u,o,t);i[0]=l^v,i[1]=a^y,i[2]=c^m,i[3]=f^g,i[4]=p^w,i[5]=h^x,i[6]=d^k,i[7]=b^E}compress(e,t=0,r=!1){let n=this.flags;if(this.chunkPos||(n|=nT.CHUNK_START),(15===this.chunkPos||r)&&(n|=nT.CHUNK_END),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,n,e,t),this.chunkPos+=1,16===this.chunkPos||r){let e=this.state;this.state=this.IV.slice();for(let t,n=this.chunksDone+1;(r||!(1&n))&&(t=this.stack.pop());n>>=1)this.buffer32.set(t,0),this.buffer32.set(e,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|nT.PARENT,this.buffer32,0),e=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(e)}this.pos=0}_cloneInto(e){e=super._cloneInto(e);let{IV:t,flags:r,state:n,chunkPos:i,posOut:o,chunkOut:s,stack:u,chunksDone:l}=this;return e.state.set(n.slice()),e.stack=u.map(e=>Uint32Array.from(e)),e.IV.set(t),e.flags=r,e.chunkPos=i,e.chunksDone=l,e.posOut=o,e.chunkOut=s,e.enableXOF=this.enableXOF,e.bufferOut32.set(this.bufferOut32),e}destroy(){this.destroyed=!0,(0,t9.ru)(this.state,this.buffer32,this.IV,this.bufferOut32),(0,t9.ru)(...this.stack)}b2CompressOut(){let{state:e,pos:t,flags:r,buffer32:n,bufferOut32:i}=this,{h:o,l:s}=(0,t5.Ev)(BigInt(this.chunkOut++));(0,t9.Ux)(n);let{v0:u,v1:l,v2:a,v3:c,v4:f,v5:p,v6:h,v7:d,v8:b,v9:v,v10:y,v11:m,v12:g,v13:w,v14:x,v15:k}=(0,nz.nN)(nU,0,n,7,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],nj[0],nj[1],nj[2],nj[3],s,o,t,r);
1i[0]=u^b,i[1]=l^v,i[2]=a^y,i[3]=c^m,i[4]=f^g,i[5]=p^w,i[6]=h^x,i[7]=d^k,i[8]=e[0]^b,i[9]=e[1]^v,i[10]=e[2]^y,i[11]=e[3]^m,i[12]=e[4]^g,i[13]=e[5]^w,i[14]=e[6]^x,i[15]=e[7]^k,(0,t9.Ux)(n),(0,t9.Ux)(i),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,(0,t9.ru)(this.buffer.subarray(this.pos));let e=this.flags|nT.ROOT;this.stack.length?(e|=nT.PARENT,(0,t9.Ux)(this.buffer32),this.compress(this.buffer32,0,!0),(0,t9.Ux)(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):e|=(this.chunkPos?0:nT.CHUNK_START)|nT.CHUNK_END,this.flags=e,this.b2CompressOut()}writeInto(e){(0,t9.$h)(this,!1),(0,t9.gk)(e),this.finish();let{blockLen:t,bufferOut:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=t&&this.b2CompressOut();let o=Math.min(t-this.posOut,i-n);e.set(r.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible after digest call");return this.writeInto(e)}xof(e){return(0,t9.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,t9.eB)(e,this),this.finished)throw Error("digest() was already called");return this.enableXOF=!1,this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}let nN=(0,t9.V1)((e={})=>new nH(e)),nP={dkLen:32},nM=e=>nN(e,nP),nV=e=>(0,rX.r)([nM(e),e]);var nD=r(9635);let nF=nc.fromText("modlpy/utilisuba").asBytes(),nW=({threshold:e,signatories:t})=>{let r=nL(t),n=(0,rX.r)([nF,d.oA.enc(r.length),...r,d.KB.enc(e)]);return(0,t4.vT)(n)},nL=e=>e.slice().sort((e,t)=>{for(let r=0;;r++){let n=r>=e.length,i=r>=t.length;if(n&&i)return 0;if(n)return -1;if(i)return 1;if(e[r]!==t[r])return e[r]>t[r]?1:-1}}),nJ={Leaf:"Leaf",Branch:"Branch",BranchWithVal:"BranchWithVal",LeafWithHash:"LeafWithHash",BranchWithHash:"BranchWithHash",Empty:"Empty",Reserved:"Reserved"},nq=(0,rg.p)().dec,nK=(0,rg.p)(1/0).dec,nX=(0,rg.p)(32).dec,nY=d.u8.dec,nG=e=>{let t=nY(e),r=6,n=t>>6,i=n?1===n?nJ.Leaf:2===n?nJ.Branch:nJ.BranchWithVal:t>>--r?nJ.LeafWithHash:t>>--r?nJ.BranchWithHash:t?nJ.Reserved:nJ.Empty,o=t&255>>8-r;if(o===2**r-1){let t;do o+=t=nY(e);while(255===t)}return{type:i,partialKey:(0,rg.p)(Math.ceil(o/2)).dec(e).slice(o%2?3:2)}},nQ=(0,d.UF)(e=>{let t=nG(e),{type:r}=t;if("Empty"===r||"Reserved"===r)return t;if("Leaf"===r||"LeafWithHash"===r)return{...t,value:nK(e)};let n=d.KB.dec(e),i=[];for(let e=0;e<16;e++)n>>e&1&&i.push(e.toString(16));let o=null;"BranchWithVal"===r&&(o=nq(e)),"BranchWithHash"===r&&(o=nX(e));let s={...t,children:Object.fromEntries(i.map(t=>[t,nq(e)]))};return null!==o&&(s.value=o),s}),nZ=e=>(0,d.UF)(t=>{let r=(0,rv.N)(e(new Uint8Array(t.buffer)));try{return{hash:r,...nQ(t)}}catch{return{type:"Raw",hash:r,value:""}}}),n0=(e,t=t4.vT)=>{let r=e.map(nZ(t)),n=Object.fromEntries(r.map(e=>[e.hash,e])),i=r.map(e=>e.hash),o=new Set(i),s=t=>{if(t.value)return;let r=e[i.indexOf(t.hash)];t.value="string"==typeof r?r:(0,rv.N)(r)};return r.forEach(e=>{if("children"in e&&Object.values(e.children).forEach(t=>{let r=n[t];r&&(r.parent=e.hash,o.delete(t))}),"BranchWithHash"===e.type||"LeafWithHash"===e.type){let t=e.value,r=n[t];if(!r)return;o.delete(t),"Raw"!==r.type&&(Object.keys(r).forEach(e=>delete r[e]),r.type="Raw",r.hash=t),r.parent=e.hash,s(r)}"Raw"===e.type&&s(e)}),1===o.size?{rootHash:o.values().next().value,proofs:n}:null},n1=nb(),n2=(n=(e,t,r,n)=>{if("primitive"===e.type)return h[e.value];if("void"===e.type)return d.R9;if("AccountId32"===e.type)return n;if("AccountId20"===e.type)return nO;if("compact"===e.type)return e.isBig?E.v:E.J;if("bitSequence"===e.type)return nA(e.isLSB);let i=e=>n2(e,t,r,n),o=(e,t)=>{let r=i(e);return t?O.OW(r,t):O.OW(r)},s=e=>O.ps(...e.map(i)),u=e=>{let t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,i(t)]));return O.AU(t)};if("sequence"===e.type&&"primitive"===e.value.type&&"u8"===e.value.value)return n1;if("array"===e.type)return"primitive"===e.value.type&&"u8"===e.value.value?nb(e.len):o(e.value,e.len);if("sequence"===e.type)return o(e.value);if("tuple"===e.type)return s(e.value);if("struct"===e.type)return u(e.value);if("option"===e.type)return O.Wx(i(e.value));if("result"===e.type)return O.x4(i(e.value.ok),i(e.value.ko));let l=Object.values(e.value).map(e=>{switch(e.type){case"void":return d.R9;case"lookupEntry":return i(e.value);case"tuple":return s(e.value);case"struct":return u(e.value);case"array":return o(e.value,e.len)}}),a=Object.fromEntries(Object.keys(e.value).map((e,t)=>[e,l[t]])),c=Object.values(e.value).map(e=>e.idx),f=c.every((e,t)=>e===t)?x(a):x(a,c);return e.byteLength?n8(f,e.byteLength):f},i=e=>e,(e,t,r,...o)=>{let{id:s}=e;if(t.has(s))return t.get(s);if(r.has(s)){let r=A(()=>t.get(s),e,...o);return t.set(s,r),r}r.add(s);let u=n(e,t,r,...o);return r.delete(s),t.has(s)&&(u=i(u,t.get(s),e,...o)),t.set(s,u),u}),n3=(e,t=rJ.h())=>{let r=new Map,n=n=>n2(e(n),r,new Set,t);return e=>n(e)},n8=(e,t)=>{let r=d.Jj(t);return d.VG(t=>r.enc(e.enc(t)),t=>e.dec(r.dec(t)))},n7=d.hD(d.R9,()=>void 0,()=>null),n6=e=>{let t;let{metadata:r}=e,n=n3(e),i=r.pallets.find(e=>"System"===e.name)?.constants.find(e=>"SS58Prefix"===e.name);if(i)try{let r=n(i.type).dec(i.value);"number"==typeof r&&(t=r,n=n3(e,rJ.h(r)))}catch(e){}let o=new Map,s=e=>{switch(e.type){case"void":return d.R9;case"lookupEntry":return n(e.value.id);case"tuple":return O.ps(...Object.values(e.value).map(e=>n(e.id)));case"struct":return O.AU(b(e.value,e=>n(e.id)));case"array":return O.OW(n(e.value.id),e.len)}},u=t=>(n,i)=>{let o=r.pallets.find(e=>e.name===n),u=e(o[t].type);if("enum"!==u.type)throw null;let l=u.value[i];return{location:[o.index,l.idx],codec:s(u.value[i])}};return{buildDefinition:n,buildStorage:(t,i)=>{let s=o.get(t);s||o.set(t,s=r5(t));let u=r.pallets.find(e=>e.name===t).storage.items.find(e=>e.name===i),l=e=>e===d.R9?n7:e,a=(e,t,...r)=>{let n=s(...r),[,...i]=r;return{args:O.ps(...i.map(([e])=>e)),keys:n,value:t,len:e,fallback:1===u.modifier?t.dec(u.fallback):void 0}};if("plain"===u.type.tag)return a(0,l(n(u.type.value)),i);let{key:c,value:f,hashers:p}=u.type.value,b=l(n(f)),v=p.map(e=>h[e.tag]),y=(()=>
1{if(1===v.length)return[[n(c),v[0]]];let t=e(c);switch(t.type){case"array":return v.map(e=>[n(t.value.id),e]);case"tuple":return t.value.map((e,t)=>[n(e.id),v[t]]);default:throw Error("Invalid key type")}})();return a(v.length,b,i,...y)},buildEvent:u("events"),buildError:u("errors"),buildViewFn:(e,t)=>{let i=r.pallets.find(t=>t.name===e)?.viewFns.find(e=>e.name===t);if(!i)throw null;return{args:O.ps(...i.inputs.map(e=>n(e.type))),value:n(i.output)}},buildRuntimeCall:(e,t)=>{let i=r.apis.find(t=>t.name===e)?.methods.find(e=>e.name===t);if(!i)throw null;return{args:O.ps(...i.inputs.map(e=>n(e.type))),value:n(i.output)}},buildCall:u("calls"),buildConstant:(e,t)=>{let i=r.pallets.find(t=>t.name===e).constants.find(e=>e.name===t);return n(i.type)},ss58Prefix:t}},n4="CheckMortality",n5=(e,t,r)=>{let n=(0,rK.b)(e),i=n6(n),o=i.buildStorage("System","Events"),s=e.extrinsic.signedExtensions[0].find(e=>"ChargeAssetTxPayment"===e.identifier),u=null;if(s){let e=n(s.type);if("struct"===e.type){let t=e.value.asset_id;"option"===t.type&&(u=t.value.id)}}let l=ir(n.metadata,i);return{assetId:u,metadataRaw:t,codeHash:r,lookup:n,dynamicBuilder:i,events:{key:o.keys.enc(),dec:o.value.dec},accountId:(0,rJ.h)(i.ss58Prefix),getMortalityFromTx:e=>{let t=l(e);return"extra"in t&&t.extra[n4]||{mortal:!1}},extVersions:e.extrinsic.version}},n9=(0,d.Jj)(1/0).dec,ie=(0,d.sv)(d.KB[1],e=>{let t=2<<e%16;return{mortal:!0,period:t,phase:(e>>4)*Math.max(t>>12,1)}}),it=(0,d.UF)(e=>{let t=d.u8.dec(e);if(0===t)return{mortal:!1};let r=d.u8.dec(e);return ie(Uint8Array.from([t,r]))}),ir=(e,t)=>{let r,n;let i=O.AU.dec(Object.fromEntries(e.extrinsic.signedExtensions[0].map(e=>[e.identifier,e.identifier===n4?it:t.buildDefinition(e.type)[1]]))),{extrinsic:o}=e;if("address"in o)r=t.buildDefinition(o.address)[1],n=t.buildDefinition(o.signature)[1];else{let i=e.lookup[o.type]?.params,s=i?.find(e=>"Call"===e.name)?.type,u=i?.find(e=>"Address"===e.name)?.type,l=i?.find(e=>"Signature"===e.name)?.type;if(null==s||null==u||null==l)throw Error("Call, Address and/or signature not found");r=t.buildDefinition(u)[1],n=t.buildDefinition(l)[1]}let s=O.AU.dec({address:r,signature:n,extra:i,callData:n9});return(0,d.UF)(r=>{let n;let o=E.J.dec(r),{type:u,version:l}=rq.A[1](r);if("bare"===u)return{len:o,version:l,type:u,callData:n9(r)};if("signed"===u)return{len:o,version:l,type:u,...s(r)};let a=d.u8.dec(r);if(16===e.version){let r=e.extrinsic.signedExtensions[a];if(!r)throw Error("Unexpected extension version");n=O.AU.dec(Object.fromEntries(r.map(e=>[e.identifier,e.identifier===n4?it:t.buildDefinition(e.type)[1]])))}else n=i;return{len:o,type:u,version:l,extensionVersion:a,extra:n(r),callData:n9(r)}})},ii=e=>t=>{let r=(...n)=>{let i;try{i=e()}catch(e){return tD(e)}return i?t(i,...n).pipe(tV(e=>{if(e instanceof tF)return r(...n);if(e instanceof Error&&e.name===th.errorName)return tX(750).pipe(tA(()=>r(...n)));throw e})):tI};return r},io=(e,t,r)=>{let n=(e,n)=>t(e).pipe(tV(()=>to(null)),tA(t=>t?to(t):n.pipe(tk(t=>{r(e,t)}))),ty(t=>({codeHash:e,metadataRaw:t,metadata:(0,rP.h)(rM.P.dec(t))})));return(t,r)=>{let i=new Set([r]),o={},s=n(t,rL(ii(()=>{if(!i.size)throw o;return i.has(r)?r:[...i].at(-1)})(e)).pipe(tV(e=>e===o?tI:tD(()=>e)))).pipe(ty(({metadata:e,metadataRaw:t,codeHash:r})=>n5(e,t,r)),tC(1));return s.subscribe({error(){}}),{codeHash:t,runtime:s,addBlock:e=>{i.add(e)},deleteBlocks:e=>(e.forEach(e=>{i.delete(e)}),i.size),usages:i}}},is=tm({connector:()=>new tx(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0}),iu=({hash:e,number:t,parent:r,hasNewRuntime:n})=>({hash:e,number:t,parent:r,hasNewRuntime:n}),il=(e,t,r,n,i,o,s,u)=>{let l=({blocks:e,runtimes:t},r)=>{r.forEach(t=>{e.get(e.get(t).parent)?.children.delete(t),e.delete(t),u(t)}),Object.entries(t).map(([e,t])=>({key:e,usages:t.deleteBlocks(r)})).filter(e=>0===e.usages).map(e=>e.key).forEach(e=>{delete t[e]})},a=e=>{o.next(iu(e))},c=e=>{l(e,[...e.blocks.values()].filter(e=>e.recovering).map(e=>e.hash));let t="pendingBlocks"in e.state?e.state.pendingBlocks:[];e.state={type:t8.Ready},t.forEach(a)},f=new tb,p=f.pipe(function e(t,r){return r?function(n){return n.pipe(e(function(e,n){return e7(t(e,n)).pipe(ty(function(t,i){return r(e,t,n,i)}))}))}:e5(function(e,r){var n=0,i=null,o=!1;e.subscribe(e9(r,function(e){i||(i=e9(r,void 0,function(){i=null,o&&r.complete()}),e7(t(e,n++)).subscribe(i))},function(){o=!0,i||r.complete()}
1))})}(()=>tX(0)),ty(()=>({type:"cleanup"}))),h=ia(),d=()=>(l(h,[...h.blocks.values()].map(e=>e.hash)),Object.assign(h,ia())),b=Object.assign(tz(i,p,e).pipe(tB((e,t)=>{let r=t=>{l(e,t),s(t)},n=(...t)=>{let n=e.blocks.get(e.finalized)?.number??-1,i=t.filter(({refCount:e,recovering:t,number:r,pruned:i})=>!e&&!t&&(i||r<n)).map(({hash:e})=>e);i.length&&r(i)};switch(t.type){case"initialized":if(e.state.type!==t8.Initializing&&e.state.type!==t8.RecoveringInit)throw Error("Initialized event out of order");e.state.type!==t8.RecoveringInit||t.finalizedBlockHashes.some(t=>e.blocks.has(t))||(d(),o.next(null));let i=e.blocks.get(e.finalized)?.number??-1,u=t.finalizedBlockHashes.length-1,p=[];i>t.number+u?e.state={type:t8.RecoveringFin,target:i,pendingBlocks:p}:(e.state={type:t8.Initializing,pendingBlocks:p},e.finalized=t.finalizedBlockHashes[u]);let h=e.finalizedRuntime.codeHash;return t.finalizedBlockHashes.forEach((r,n)=>{let o=e.blocks.get(r);if(o)o.recovering=!1;else{let o=t.number+n,s=o>i,l=t.runtimeChanges.get(r),a=l&&!e.runtimes[l]&&s;a&&(h=l);let c=0===n?t.parentHash:t.finalizedBlockHashes[n-1],f={hash:r,hasNewRuntime:n?t.runtimeChanges.has(r):t.hasNewRuntime,parent:c,children:new Set(n===u?[]:[t.finalizedBlockHashes[n+1]]),pruned:!1,runtime:h,refCount:0,number:o,recovering:!1};e.blocks.set(r,f),a&&(e.finalizedRuntime=e.runtimes[l]=v(l,r)),e.runtimes[h].usages.add(r),s&&p.push(f)}}),e;case"stop-error":if(e.state.type===t8.Initializing)return d();for(let t of e.blocks.values())t.recovering=!0;return e.state={type:t8.RecoveringInit},e;case"newBlock":{let{parentBlockHash:r,blockHash:n}=t;if(e.blocks.has(n))e.blocks.get(n).recovering=!1;else{let i=e.blocks.get(r);i.children.add(n);let o={hash:n,number:i.number+1,parent:r,children:new Set,runtime:i.runtime,pruned:!1,refCount:0,recovering:!1,hasNewRuntime:!!t.newRuntime};if(e.blocks.set(n,o),t.newRuntime){let{codeHash:r}=t;o.runtime=r,e.runtimes[r]=v(r,n)}e.runtimes[o.runtime].addBlock(n),"pendingBlocks"in e.state?e.state.pendingBlocks.push(o):a(o)}return e}case"bestBlockChanged":if(e.state.type===t8.RecoveringFin)return e;return e.best=t.bestBlockHash,e.state.type===t8.Initializing&&c(e),e;case"finalized":{let r=t.finalizedBlockHashes.slice(-1)[0],n=!1;if(e.state.type===t8.RecoveringFin){if(e.blocks.get(r).number<e.state.target)return e;n=!0}e.finalized=r;let{blocks:i}=e;return i.get(e.best).number<i.get(e.finalized).number&&(e.best=e.finalized),e.finalizedRuntime=e.runtimes[i.get(e.finalized).runtime],t.prunedBlockHashes.forEach(t=>{let r=e.blocks.get(t);r&&(r.pruned=!0)}),n&&c(e),e.state.type===t8.Ready&&f.next(),e}case"cleanup":return n(...e.blocks.values()),e;case"blockUsage":{let r=e.blocks.get(t.value.hash);if(!r)return e;return r.refCount+="hold"===t.value.type?1:-1,n(r),e}}},h),ty(e=>({...e})),tk({error(e){o.error(e)}}),is),{state:h}),v=io(t7(b,t,"pinned-blocks"),r,n);return b},ia=()=>({best:"",finalized:"",runtimes:{},blocks:new Map,finalizedRuntime:{},state:{type:t8.Initializing,pendingBlocks:[]}});function ic(e){return e5(function(t,r){e7(e).subscribe(e9(r,function(){return r.complete()},eT)),r.closed||t.subscribe(r)})}let ip=(e,t,r,n,i,o)=>{let s=new Map,u=e=>{s.get(e)?.(),s.delete(e)},l=new eG(r=>{let n=t.subscribe({next:({hash:e})=>{s.set(e,o(e))},complete(){r.error(Error("Tracking stopped"))}});return n.add(e.pipe(ty(e=>e.finalized),tO()).subscribe(()=>{e.state.blocks.forEach(({pruned:e,hash:t})=>{e&&u(t)})})),n.add(()=>[...s.keys()].forEach(u)),n}),a=t=>ic(e.pipe(tE(({blocks:e})=>e.get(t)?.pruned??!0))),c=(e,t,o)=>{var s;if(o)return to({hash:e,found:{type:!1,validity:null}});let l=a(e);return r(e).pipe(tA(r=>{let o=r.indexOf(t);return o>-1?l(i(e)).pipe(ty(t=>({hash:e,found:{type:!0,index:o,events:t}}))):n(e,t).pipe(ty(t=>({hash:e,found:{type:!1,validity:t}})))}),l,(s=()=>u(e),e5(function(e,t){try{e.subscribe(t)}finally{t.add(s)}})))},f=t=>{[...e.state.blocks.get(t)?.children.keys()??[]].forEach(f),u(t)},p=(t,r,n)=>c(t,r,n.has(t)).pipe(tA(i=>{let{found:o}=i,s=o.type||o.validity?.success===!1;return s&&f(t),s?to(i):e.pipe(a(t),tA(e=>e.blocks.get(t).children),e5(function(e,t){var r=new Set;e.subscribe(e9(t,function(e){r.has(e)||(r.add(e),t.next(e))}))}),tA(e=>p(e,r,n)))}
1));return t=>tz(l,e.pipe(tR(1),tA(e=>p(e.finalized,t,new Set(e.blocks.keys())))))};function ih(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=eh(e);return e5(function(t,n){for(var i=e.length,o=Array(i),s=e.map(function(){return!1}),u=!1,l=function(t){e7(e[t]).subscribe(e9(n,function(e){o[t]=e,!u&&!s[t]&&(s[t]=!0,(u=s.every(eK))&&(s=null))},eT))},a=0;a<i;a++)l(a);t.subscribe(e9(n,function(e){if(u){var t=ew([e],eg(o));n.next(r?r.apply(void 0,ew([],eg(t))):t)}}))})}let id=new Uint8Array([2]),ib=(e,t)=>(0,rv.N)((0,rX.r)([id,(0,rv.H)(e),(0,rv.H)(t)])),iv="TaggedTransactionQueue",iy="validate_transaction",[,im]=x({InvalidTransaction:x({Call:d.R9,Payment:d.R9,Future:d.R9,Stale:d.R9,BadProof:d.R9,AncientBirthBlock:d.R9,ExhaustsResources:d.R9,Custom:d.u8,BadMandatory:d.R9,MandatoryValidation:d.R9,BadSigner:d.R9}),UnknownTransaction:x({CannotLookup:d.R9,NoUnsignedValidator:d.R9,Custom:d.u8})}),ig=(0,d.UF)(e=>{let t;let r=d.u8.dec(e);if(r>1)throw Error("Unable to decode validateTransaction result");if(!r)return{success:!0,value:void 0};try{t=im(e)}catch(e){t={type:"UnknownInvalidTx"}}return{success:!1,value:t}}),iw=(e,t)=>(r,n)=>{let i=t(r).pipe(ty(e=>{try{return e.dynamicBuilder.buildRuntimeCall(iv,iy).value[1]}catch(e){return ig}}));return e(r,`${iv}_${iy}`,ib(n,r)).pipe(ih(i),ty(([e,t])=>t(e)))},ix=e=>t=>new eG(r=>{let n=!1,i=t.subscribe({next(e){n=!0,r.next(e)},error(e){r.error(e)},complete(){r.complete()}});return n||r.next(e),i}),ik=e=>e=>new eG(t=>{let r=e.subscribe({next(e){t.next(e)},error(e){t.error(e)},complete(){t.complete()}}),n=()=>r.unsubscribe();return()=>{Promise.resolve().then(n)}}),iE=(e,t=1/0)=>r=>new eG(n=>{let i;let o=new Map,s=new Map,u=new Map,l=0,a=0,c=0,f=()=>{let e=o.get(a);if(!e){0===s.size&&(void 0===i||i.closed)&&n.complete();return}let t=a++;o.delete(t),c!==t&&u.set(t,[]);let r=!1,l=e.subscribe({next(e){c===t?n.next(e):u.get(t).push(e)},complete(){if(r=!0,s.delete(t),t===c)for(c++;
1u.has(c)&&(u.get(c).forEach(e=>n.next(e)),u.delete(c),!s.has(c));)c++;f()},error(e){n.error(e)}});r||s.set(t,l)};return(i=new eA).add(r.subscribe({next(r){let n=l++;o.set(n,rj(()=>e(r,n))),s.size<t&&f()},error(e){n.error(e)},complete(){0===s.size&&n.complete()}})),()=>{s.forEach(e=>e.unsubscribe()),i.unsubscribe(),o.clear(),u.clear()}}),iO=(e,t,r)=>{let{withRecovery:n,withRecoveryFn:i}=tM(),{getFollower:o,unfollow:s,follow$:u,getHeader:l,hasher$:a}=rN(e,i),c=t0(o),f=new tb,p=e=>t=>new eG(r=>{f.next({type:"blockUsage",value:{type:"hold",hash:e}});let n=t.subscribe(r);return n.add(()=>{setTimeout(()=>{f.next({type:"blockUsage",value:{type:"release",hash:e}})},0)}),n}),h=e=>(t,...r)=>e(t,...r).pipe(p(t)),d=(e,t)=>(r,...n)=>new eG(i=>g.state.blocks.has(r)?e(r,...n).subscribe(i):i.error(new tF(r,t))),b=e=>o().unpin(e).catch(e=>{if(!(e instanceof Error)||e.name!==tc.errorName)throw e}),v=(e,t)=>d(h(t7(g,i(tZ(e)),`stop-${t}`)),t),y=new Map,m=new tb,g=il(u,h(i(tZ(c("call")))),t,r,f,m,e=>{b(e).catch(e=>{console.error("unpin",e)}),e.forEach(e=>{y.delete(e)})},e=>{y.delete(e)}),w=d(h(e=>g.state.runtimes[g.state.blocks.get(e).runtime].runtime),"getRuntimeCtx"),x=(e,t,r)=>{let n;let i=y.get(e)??new Map,o=i.get(t);if(o)return o;y.set(e,i);let s=r.pipe(tm({connector:()=>n=new tx}),tk({complete(){i.set(t,n)}}),ik());return i.set(t,s),s},k=Object.assign(g.pipe(tE(e=>e.state.type===t8.Ready)),{state:g.state}),E=k.pipe(tO((e,t)=>e.finalized===t.finalized),tB((e,t)=>{let r=t.blocks.get(t.finalized),n=[r],i=e.at(-1);if(!i)return n;for(;r.number>i.number+1&&(r=t.blocks.get(r.parent));)n.unshift(r);return n},[]),t_(),ty(iu),is),O=k.pipe(tO((e,t)=>e.best===t.best),ty(e=>iu(e.blocks.get(e.best))),is),S=k.pipe(tO((e,t)=>e.finalized===t.finalized&&e.best===t.best),tB((e,t)=>{let r=r=>e.get(r)||iu(t.blocks.get(r)),n=r(t.best),i=r(t.finalized),o=n.number-i.number+1,s=Array(o);for(let e=0,t=n.hash;e<o;e++)s[e]=r(t),t=s[e].parent;return new Map(s.map(e=>[e.hash,e]))},new Map),ty(e=>[...e.values()]),is),B=k.pipe(tO((e,t)=>e.finalizedRuntime===t.finalizedRuntime),t$(({finalizedRuntime:{runtime:e}})=>e.pipe(ix(null))),is),A=B.pipe(ty(e=>e?.lookup.metadata??null)),_=tQ(E.pipe(ty(e=>e.hash)),O.pipe(ty(e=>e.hash)),p),$=v(c("body"),"body"),I=e=>tY(x(e,"body",$(e))),R=v(c("storage"),"storage"),C=_(d((e,t,r,n=null,i)=>g.state.runtimes[g.state.blocks.get(e).runtime].runtime.pipe(tA(o=>{let s=r(o);return x(e,`storage-${t}-${s}-${n??""}`,R(e,t,s,n)).pipe(i?ty(e=>i(e,o)):eK)})),"storage")),z=t6(o,n),T=_(d(t7(g,(e,t,r)=>z(e,t,r??null,!1),"storageQueries"),"storageQueries")),j=_(d(t7(g,l,"header"),"header")),U=e=>C(e,"value",e=>e.events.key,null,(e,t)=>t.events.dec(e)),H=v(c("call"),"call"),N=_((e,t,r)=>x(e,`call-${t}-${r}`,H(e,t,r))),P=iw(N,w),M=B.pipe(tE(Boolean),tR(1),tA(e=>{let t;let{enc:r}=e.dynamicBuilder.buildStorage("System","BlockHash").keys;try{t=r(0)}catch{t=r(0n)}return C(null,"value",()=>t,null)}),tC(1));tz(B,S).subscribe({error(){}});let V=(e,t=!1)=>{let r=e||"finalized";if(r=g.state[r]||r,!g.state.blocks.has(r)){if(t)throw new tF(r,"holdBlock");return eT}f.next({type:"blockUsage",value:{type:"hold",hash:r}});let n=()=>{f.next({type:"blockUsage",value:{type:"release",hash:r}}),n=eT};return()=>{n()}},D=m.pipe(tT(Boolean)),F=ip(k,D,I,P,U,V),W=ip(g,D,I,P,()=>to(),V);return{follow$:u,unfollow:s,finalized$:E,best$:O,bestBlocks$:S,newBlocks$:tj(k.pipe(tR(1),tA(({blocks:e,finalized:t})=>{let r=t=>{let n=e.get(t);return n?[n,...Array.from(n.children).flatMap(r)]:[]};return r(t)})),D),runtime$:B,metadata$:A,genesis$:M,hasher$:a,getRuntime$:e=>g.state.runtimes[e]?.runtime??to(null),header$:j,body$:I,call$:N,storage$:C,storageQueries$:T,eventsAt$:U,withHodl:e=>t=>new eG(r=>{let n=t.subscribe(r);return n.closed||n.add(V(e)),n}),holdBlock:V,trackTx$:F,trackTxWithoutEvents$:W,validateTx$:P,pinnedBlocks$:k,withRuntime:e=>t=>t.pipe(iE(t=>w(e(t)).pipe(ty(e=>[t,e])))),getRuntimeContext$:_(w)}};var iS=e=>t=>new eG(r=>e(t,e=>{r.error(e)}));let iB=({storageSubscription:e,...t})=>r=>{let n={},i=tZ(t.storage),o=tZ(t.call),s=tZ(t.header),u=tZ(t.body),l=e=>i(e,"hash","0x3a636f6465",null).pipe(ty(e=>e)),a=(e,t)=>
1r(e).pipe(tV(()=>to(null)),tA(r=>r?to(r):rL((...e)=>o(t,...e)).pipe(ty(t=>n5((0,rP.h)(rM.P.dec(t)),t,e)))),tk(t=>{n[e]=t})),c=e=>l(e).pipe(tA(t=>{let r=n[t];return r?to(r):a(t,e)})),f=(e,t,r,n=null,o)=>c(e).pipe(tA(s=>i(e,t,r(s),n).pipe(ty(e=>o?o(e,s):e))));return{body$:u,header$:e=>s(e).pipe(ty(rB[1])),storage$:f,storageQueries$:(t,r,n)=>new eG(i=>e(t,r,n||null,e=>i.next(e),e=>i.error(e),()=>{i.complete()})),call$:o,eventsAt$:e=>f(e,"value",e=>e.events.key,null,(e,t)=>t.events.dec(e)),getRuntimeContext$:c}},iA=()=>to(null),i_=(e,{getMetadata:t,setMetadata:r}={})=>({chainHead$:()=>iO(e.chainHead,t||iA,r||eT),archive:iB(e.archive),broadcastTx$:iS(e.transaction),destroy:e.destroy}),i$=(e,t)=>(r,...n)=>e(r,...n).pipe(tV(e=>{if(!(e instanceof tF))throw e;return t(r,...n).pipe(tV(t=>{throw console.warn(t),e}))}));var iI=Object.defineProperty,iR=(e,t,r)=>t in e?iI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,iC=(e,t,r)=>iR(e,"symbol"!=typeof t?t+"":t,r);class iz extends Error{constructor(e){super(e.message),iC(this,"code"),iC(this,"data"),this.code=e.code,this.data=e.data,this.name="RpcError"}}let iT=()=>{let e=new Map;return{has:e.has.bind(e),subscribe(t,r){e.set(t,r)},unsubscribe(t){e.delete(t)},next(t,r){e.get(t)?.next(r)},error(t,r){let n=e.get(t);n&&(e.delete(t),n.error(r))},errorAll(t){let r=[...e.values()];e.clear(),r.forEach(e=>{e.error(t)})}}};
1class ij extends Error{constructor(){super("Client destroyed"),this.name="DestroyedError"}}let iU=1,iH=e=>{let t=iU++,r=new Map,n=iT(),i=null,o=(e,t,r)=>{i.send(JSON.stringify({jsonrpc:"2.0",id:e,method:t,params:r}))};i=e(function(e){try{let t,i,o,s,u;let l=JSON.parse(e);if({id:t,result:i,error:o,params:s}=l,null===t)throw Error(s?.error?.message??"id null");if(null!=t){let e=r.get(t);if(!e)return;return r.delete(t),o?e.onError(new iz(o)):e.onSuccess(i,(e,t)=>(n.subscribe(e,t),()=>{n.unsubscribe(e)}))}if({subscription:u,result:i,error:o}=s,!u||!o&&!Object.hasOwn(s,"result"))throw 0;o?n.error(u,new iz(o)):n.next(u,i)}catch(t){console.warn("Error parsing incomming message: "+e),console.error(t)}});let s=1;return{request:(e,n,u)=>{if(!i)throw Error("Not connected");let l=`${t}-${s++}`;return u&&r.set(l,u),o(l,e,n),()=>{r.delete(l)}},disconnect:()=>{i?.disconnect(),i=null,n.errorAll(new ij),r.forEach(e=>e.onError(new ij)),r.clear()}}},iN=()=>{},iP={body:"",call:"",continue:"",follow:"",header:"",stopOperation:"",storage:"",unfollow:"",unpin:"",followEvent:""},iM={chainName:"",genesisHash:"",properties:""},iV={broadcast:"",stop:""};Object.entries({chainHead:iP,chainSpec:iM,transaction:iV}).forEach(([e,t])=>{Object.keys(t).forEach(r=>{t[r]=`${e}_v1_${r}`})});let iD=e=>(t,r)=>{let n=!1,i=()=>{n=!0};return e(iV.broadcast,[t],{onSuccess:t=>{null!==t?(i=()=>{e(iV.stop,[t]),i=iN},n&&i()):n||r(Error("Max # of broadcasted transactions has been reached"))},onError:r}),()=>{i()}},iF=Function.prototype;class iW extends Error{constructor(){super("Abort Error"),this.name="AbortError"}}let iL=e=>(...t)=>new Promise((r,n)=>{let i=iF,[o,s]=t[t.length-1]instanceof AbortSignal?[t.slice(0,t.length-1),t[t.length-1]]:[t],u=()=>{i(),n(new iW)};s?.addEventListener("abort",u,{once:!0});let l=e=>t=>{i=iF,s?.removeEventListener("abort",u),e(t)};i=e(l(r),l(n),...o)}),iJ=(e,t)=>r=>iL((n,i,...o)=>{let s=!0,u=()=>{s=!1},[l,a]=t(...o);return r(e,l,{onSuccess:(e,t)=>{if("limitReached"===e.result)return i(new tf);let{operationId:o}=e,l=()=>{r(iP.stopOperation,[o])};if(!s)return l();let c=iN,f=e=>{s=!1,c(),n(e)},p=e=>{s=!1,c(),i(e)};c=t(o,{next:e=>{"operationError"===e.event?i(new tp(e.error)):"operationInaccessible"===e.event?i(new th):a(e,f,p)},error:p}),u=()=>{s&&(c(),l())}},onError:i}),()=>{u()}}),iq=iJ(iP.body,e=>[[e],(e,t)=>{t(e.value)}]),iK=iJ(iP.call,(e,t,r)=>[[e,t,r],(e,t)=>{t(e.output)}]),iX=e=>t=>new Promise((r,n)=>{e(iP.header,[t],{onSuccess:r,onError:n})}),iY=e=>(t,r,n,i,o,s,u)=>{if(0===r.length)return s(),iF;let l=!0,a=()=>{l=!1};return e(iP.storage,[t,r,n],{onSuccess:(t,n)=>{if("limitReached"===t.result||t.discardedItems===r.length)return o(new tf);let{operationId:c}=t;if(!l)return void e(iP.stopOperation,[c]);let f=n(t.operationId,{next:t=>{switch(t.event){case"operationStorageItems":i(t.items);break;case"operationStorageDone":h();break;case"operationError":p(new tp(t.error));break;case"operationInaccessible":p(new th);break;default:e(iP.continue,[t.operationId])}},error:o});a=()=>{f(),e(iP.stopOperation,[t.operationId])};let p=e=>{a=iF,f(),o(e)},h=()=>{a=iF,f(),s()};u(t.discardedItems)},onError:o}),()=>{a()}},iG=e=>{let t=iY(e);return iL((e,r,n,i,o,s)=>{let u=i.startsWith("descendants"),l=u?[]:null,a=u?e=>{l.push(e)}:e=>{l=e[0]?.[i]},c=t(n,[{key:o,type:i}],s??null,a,r,()=>{try{e(u?l.flat():l)}catch(e){r(e)}},e=>{e>0&&(c(),r(new tf))});return c})},iQ=e=>t=>t.length>0?new Promise((r,n)=>{e(iP.unpin,[t],{onSuccess(){r()},onError:n})}):Promise.resolve(),iZ=e=>{let t=iL((t,r,n,i)=>e(n,i,{onSuccess:t,onError:r})),r=null;return async()=>r||(r=Promise.all([t(iM.chainName,[]),t(iM.genesisHash,[]),t(iM.properties,[])]).then(([e,t,r])=>({name:e,genesisHash:t,properties:r})))};var i0=Object.defineProperty,i1=(e,t,r)=>t in e?i0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i2=(e,t,r)=>i1(e,t+"",r);let i3=class e extends Error{constructor(t){super(`Invalid BlockHash: ${t}`),this.name=e.errorName}};i2(i3,"errorName","BlockHashNotFoundError");let i8=class e extends Error{constructor(t){super(`Storage Error: ${t}`),this.name=e.errorName}};i2(i8,"errorName","StorageError");
1let i7=class e extends Error{constructor(t){super(`Call Error: ${t}`),this.name=e.errorName}};i2(i7,"errorName","CallError");let i6=e=>(t,r,n,i,o,s)=>{if(0===r.length)return s(),iF;let u=!0,l=()=>{u=!1};return e("storage",[t,r,n],{onSuccess:(t,r)=>{let n=()=>{e("stopStorage",[t])};if(!u)return n();let a=r(t,{next:e=>{let{event:t}=e;if("storage"===t){let{event:t,...r}=e;i(r)}else"storageDone"===t?p():f(new i8(e.error))},error:o}),c=()=>{l=iF,a()};l=()=>{c(),n()};let f=e=>{c(),o(e)},p=()=>{c(),s()}},onError:o}),()=>{l()}},i4=e=>iL((t,r,n,i,o,s)=>{let u=i.startsWith("descendants"),l=u?[]:null,a=u?l.push.bind(l):({[i]:e})=>{l=e};return e(n,[{key:o,type:i}],s,a,e=>{r(e),l=null},()=>{t(l),l=null})}),i5=()=>e=>e,i9=()=>(e,t)=>{if(null===e)throw new i3(t);return e},oe=e=>{let t=(t,...r)=>e(`archive_v1_${t}`,...r),r=e=>r=>iL((n,i,...o)=>t(e,o,{onSuccess:e=>{try{n(r(e,...o))}catch(e){i(e)}},onError:i})),n=r("header")(i9()),i=r("body")(i9()),o=i6(t),s=i4(o);return{header:n,body:i,storageSubscription:o,storage:s,call:r("call")((e,t)=>{if(!e)throw new i3(t);if(!e.success)throw new i7(e.error);return e.value}),finalizedHeight:r("finalizedHeight")(i5()),hashByHeight:r("hashByHeight")(i5())}},ot=e=>{let{request:t,disconnect:r}=iH(e);return{archive:oe(t),chainHead:(e,r,n)=>{let i,o;let s=iT(),u=new Set,l=(i=()=>{},o=()=>{},{promise:new Promise((e,t)=>{i=e,o=t}),res:i,rej:o}),a=l.promise,c=iN,f=e=>{t(iP.unfollow,[e])},p=e=>{c(),null!==a&&(e&&(a instanceof Promise?a.then(e=>{"string"==typeof e&&f(e)}):f(a)),a=null,u.forEach(e=>{e()}),u.clear(),s.errorAll(new tc))},h=e=>{if(void 0!==e.operationId)return s.next(e.operationId,e);switch(e.event){case"stop":return n(new ta),p(!1);case"initialized":case"newBlock":case"bestBlockChanged":case"finalized":let{event:t,...i}=e;return r({type:t,...i})}},d=e=>{n(e),p(!(e instanceof ij))};t(iP.follow,[e],{onSuccess:(e,t)=>{a instanceof Promise&&(a=e,c=t(e,{next:h,error:d})),l.res(e)},onError:e=>{a=null,l.res(e),n(e)}});let b=(e,r,n)=>{let i=()=>{n?.onError(new tc)};if(null===a)return i(),iN;let o=o=>{if(!n)return t(e,[o,...r]);u.add(i);let l=(e,t)=>null===a?(t.error(new tc),iN):(s.subscribe(e,t),()=>{s.unsubscribe(e)}),c=t(e,[o,...r],{onSuccess:e=>{u.delete(i),n.onSuccess(e,l)},onError:e=>{u.delete(i),n.onError(e)}});return()=>{u.delete(i),c()}};if("string"==typeof a)return o(a);let l=iN;return a.then(e=>{if(e instanceof Error)return i();a&&(l=o(e))}),()=>{l()}};return{unfollow(){p(!0)},body:iq(b),call:iK(b),header:iX(b),storage:iG(b),storageSubscription:iY(b),unpin:iQ(b),_request:b}},transaction:iD(t),getChainSpecData:iZ(t),destroy:r,request:iL((e,r,n,i)=>t(n,i,{onSuccess:e,onError:r})),_request:t}};var or=eO(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function on(e,t){var r="object"==typeof t;return new Promise(function(n,i){var o=new eF({next:function(e){n(e),o.unsubscribe()},error:i,complete:function(){r?n(t.defaultValue):i(new or)}});e.subscribe(o)})}class oi{constructor(){}_runtime(e){}}class oo{constructor(){}_compatibility(e){}}let os=new WeakMap,ou=new WeakMap,ol=e=>e instanceof oi?ou.get(e):os.get(e);var oa=((u=oa||{}).Storage="storage",u.Tx="tx",u.Event="events",u.Const="constants",u.ViewFns="viewFns",u.Api="apis",u);let oc=(0,O.OW)(eu),of=(0,O.OW)(H),op=(0,O.ps)(oc,of),oh=(e,t)=>{let r=new Promise(async e=>{let r=t.runtime$.pipe(tE(e=>null!=e)),n=await on(r);r.subscribe(e=>n=e),e(()=>n)});return Promise.all([e.metadataTypes.then(op.dec),e.descriptors,r]).then(([[e,t],r,n])=>{let i=new oo;return os.set(i,{runtime:n,getEntryPoint(t,n,i){let o=r[t]?.[n]?.[i];if(null==o)throw Error(`Descriptor for ${t} ${n}.${i} does not exist`);return e[o]},typedefNodes:t}),i})},od=e=>new Promise(async t=>{let r=e.runtime$.pipe(tE(e=>null!=e)),n=await on(r);r.subscribe(e=>n=e),t(()=>n)}).then(e=>{let t=new oi;return ou.set(t,{runtime:e}),t}),ob=new WeakMap,ov=e=>(ob.has(e.metadataRaw)||ob.set(e.metadataRaw,{compat:new Map,lookup:e.lookup,typeNodes:[]}),ob.get(e.metadataRaw)),oy=(e,t,r)=>{let n=(e,t)=>{var r;let n=ov(e);return(r=n.typeNodes)[t]||(r[t]=M(n.lookup(t)))};function i(e,i){if(e instanceof oi)return{args:J.Identical,values:J.Identical};let o=os.get(e);i||(i=o.runtime());let s=r(i);if(null==s)return{args:J.Incompatible,values:J.Incompatible};let u=o.typedefNodes,l=ov(i),a=function(e,t,r,n,i,o){let s=(e,t)=>"lookup"===e.type?t(e.value):e.value;return{args:q(s(e.args,t),t,s(r.args,n),n,i,void 0),values:q(s(r.values,n),n,s(e.values,t),t,i,void 0)}}(t(o),e=>u[e],s,e=>n(i,e),l.compat);return{args:a.args.level,values:a.values.level}}let o=og(e,e=>om(i(e)));return{isCompatible:og(e,(e,t)=>o(t)>=e),getCompatibilityLevel:o,getCompatibilityLevels:i,descriptors:e,withCompatibleRuntime:(t,r)=>n=>rz([n.pipe(t.withRuntime(r)),e]).pipe(ty(([[e,t],r])=>[e,r,t])),compatibleRuntime$:(t,r)=>
1rz([e,t.getRuntimeContext$(r)]),argsAreCompatible:(e,t,o)=>{if(e instanceof oi)return!0;let s=i(e,t);if(s.args===J.Incompatible)return!1;if(s.args>J.Partial)return!0;if(s.values===J.Incompatible)return!1;let u=r(t);return null!=u&&ea(u.args,e=>n(t,e),o)},valuesAreCompatible:(e,r,n)=>{if(e instanceof oi)return!0;let o=i(e,r).values;if(o===J.Incompatible)return!1;if(o>J.Partial)return!0;let s=os.get(e);return ea(t(s).values,e=>s.typedefNodes[e],n)},getRuntimeTypedef:n,storageKeysAreCompatible:(e,t,i)=>{let o=r(e);if(null==o)return!1;let s=t=>n(e,t);return function(e,t,r,n){if(e.length>t)return!1;let i=[r];return t>1&&("tuple"===r.type?i=r.value.map(n):"array"===r.type&&r.value.length&&(i=Array(r.value.length).fill(n(r.value.typeRef)))),e.every((e,t)=>V(e,i[t],n))}(t,i,"lookup"===o.args.type?s(o.args.value):o.args.value,s)}}},om=e=>Math.min(e.args,e.values),og=(e,t)=>(...r)=>{let n=r.at(-1);return n instanceof oo||n instanceof oi?t(...r):e.then(e=>t(...r,e))},ow=(e,t,{valuesAreCompatible:r,descriptors:n,isCompatible:i,getCompatibilityLevel:o})=>{let s=new WeakMap,u=r=>{if(s.has(r))return s.get(r);let n=r.lookup.metadata.pallets.find(t=>t.name===e),i=n?.constants.find(e=>e.name===t);if(null==i)throw Error(`Runtime entry Constant(${e}.${t}) not found`);let o=r.dynamicBuilder.buildConstant(e,t).dec(i.value);return s.set(r,o),o},l=i=>{if(i){let n=ol(i).runtime(),o=u(n);if(!r(i,n,o))throw Error(`Incompatible runtime entry Constant(${e}.${t})`);return o}return n.then(l)};return Object.assign(l,{isCompatible:i,getCompatibilityLevel:o})},ox=tm({connector:()=>new tx(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0}),ok=(e,t,r,{isCompatible:n,getCompatibilityLevel:i,withCompatibleRuntime:o,argsAreCompatible:s,valuesAreCompatible:u})=>{let l=()=>Error(`Incompatible runtime entry Event(${e}.${t})`),a=r.finalized$.pipe(o(r,e=>e.hash),ty(([r,n,i])=>{let o=i.lookup.metadata.pallets.find(t=>t.name===e)?.events?.type;if(null==o||"variant"!==i.lookup.metadata.lookup[o].def.tag||null==i.lookup.metadata.lookup[o].def.value.find(e=>e.name===t))throw Error(`Runtime entry Event(${e}.${t}) not found`);if(!s(n,i,null))throw l();return[r,n,i]}),iE(([n,i,o])=>r.eventsAt$(n.hash).pipe(ty(r=>r.filter(r=>r.event.type===e&&r.event.value.type===t).map(e=>{if(!u(i,o,e.event.value.value))throw l();return{meta:{phase:e.phase,block:n},payload:e.event.value.value}})))),ox);
1return{watch:e=>a.pipe(tA(t=>e?t.filter(t=>e(t.payload)):t)),pull:()=>on(a),filter:r=>r.filter(r=>r.type===e&&r.value.type===t).map(e=>e.value.value),getCompatibilityLevel:i,isCompatible:n}};function oE(e,t){return new Promise((r,n)=>{let i=null,o=!1,s=t?()=>{i?.unsubscribe(),n(new iW)}:eT;i=e.subscribe({next:e=>{r(e),i?.unsubscribe(),o=!0},error:e=>{t?.removeEventListener("abort",s),n(e),o=!0},complete:()=>{t?.removeEventListener("abort",s),n(Error("Observable completed without emitting")),o=!0}}),o||t?.addEventListener("abort",s)})}let oO=e=>"object"==typeof e&&null!==e&&Object.entries(e).every(([e,t])=>"at"===e&&(void 0===t||"string"==typeof t)||"signal"===e&&(void 0===t||t instanceof AbortSignal)),oS=(e,t,r,{isCompatible:n,getCompatibilityLevel:i,compatibleRuntime$:o,argsAreCompatible:s,valuesAreCompatible:u})=>{let l=`${e}_${t}`,a=()=>Error(`Incompatible runtime entry RuntimeCall(${l})`);return Object.assign((...n)=>{let i=n[n.length-1],{signal:c,at:f}=oO(i)?i:{},p=f??null;return oE(o(r,p).pipe(tA(([i,o])=>{let c;try{c=o.dynamicBuilder.buildRuntimeCall(e,t)}catch{throw Error(`Runtime entry RuntimeCall(${l}) not found`)}if(!s(i,o,n))throw a();return r.call$(p,l,(0,rv.N)(c.args.enc(n))).pipe(ty(c.value.dec),ty(e=>{if(!u(i,o,e))throw a();return e}))}),r.withHodl(p)),c)},{getCompatibilityLevel:i,isCompatible:n})};var oB=Array.isArray;function oA(e){return 1===e.length&&oB(e[0])?e[0]:e}function o_(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=eh(e);return r?eX(o_.apply(void 0,ew([],eg(e))),rC(r)):e5(function(t,r){rT(ew([t],eg(oA(e))))(r)})}let o$=Symbol("EMPTY_VALUE"),oI=e=>t=>new eG(r=>{let n=0,i=null,o=o$,s=!1,u=()=>{let t=e(o,n++);o=o$,i=t.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){o!==o$?u():(i=null,s&&r.complete())}})},l=t.subscribe({next(e){o=e,i||u()},error(e){r.error(e)},complete(){i||r.complete(),s=!0}});return()=>{i?.unsubscribe(),l.unsubscribe()}}),oR=ty(e=>e.mapped),oC=(e,t,r,n,{isCompatible:i,getCompatibilityLevel:o,getCompatibilityLevels:s,descriptors:u,argsAreCompatible:l,storageKeysAreCompatible:a,valuesAreCompatible:c})=>{let f="System"===e&&"Number"===t,p="System"===e&&"BlockHash"===t,h=eX(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o_.apply(void 0,ew([],eg(e)))}(r.runtime$.pipe(tE(Boolean),tR(1),ty(({dynamicBuilder:e})=>"bigint"==typeof e.buildStorage("System","Number").value.dec(new Uint8Array(32))?BigInt:eK),tC())),ty(([e,t])=>t(e))),d=()=>Error(`Incompatible runtime entry Storage(${e}.${t})`),b=r=>Error(`Invalid Arguments calling ${e}.${t}(${r})`),v=r=>{try{return r.dynamicBuilder.buildStorage(e,t)}catch(r){throw Error(`Runtime entry Storage(${e}.${t}) not found`)}},y=(...e)=>{let t=e[e.length-1],n=oO(t),{at:i}=n?t:{},o=i??null,s=ti(u).pipe(tA(t=>r.storage$(o,"value",t=>{let r=v(t),i=e.length===r.len?e:e.slice(0,-1);if(e!==i&&!n)throw b(e);if(!a(t,i,r.len))throw d();return r.keys.enc(...i)},null,(e,r)=>{let n=v(r),i=null===e?n.fallback:n.value.dec(e);if(null!==e&&!c(t,r,i))throw d();return{raw:e,mapped:i}})),r.withHodl(o));return f?r.pinnedBlocks$.pipe(ty(e=>{let t="finalized"!==o&&o?"best"===o?e.best:o:e.finalized,r=e.blocks.get(t);if(!r)throw new tF(t,"System.Number");return r.number}),tO(),h,ty(e=>({raw:e.toString(),mapped:e})),tV(e=>{if(e instanceof tF)return s;throw e})):p&&0===Number(e[0])?r.genesis$.pipe(ty(e=>({raw:e,mapped:np.fromHex(e)}))):s},m=async(...e)=>{let t=e[e.length-1],{signal:r}=oO(t)?t:{};return oE(y(...e).pipe(oR),r)},g=(...e)=>{let t=e.at(-1);if(t instanceof oo||t instanceof oi){let r=e.slice(0,-1),n=ol(t).runtime();if(!l(t,n,r))throw d();return v(n).keys.enc(...r)}return u.then(t=>g(...e,t))};return{isCompatible:i,getCompatibilityLevel:o,getKey:g,getValue:m,getValues:(e,t)=>Promise.all(e.map(e=>m(...t?[...e,t]:e))),getEntries:async(...e)=>{let t=e[e.length-1],n=oO(t),{signal:i,at:o}=n?t:{},l=o??null;return oE(ti(u).pipe(tA(t=>r.storage$(l,"descendantsValues",r=>{let i=v(r);if(om(s(t,r))===J.Incompatible)throw d();if(e.length>i.len)throw b(e);let o=e.length>0&&n?e.slice(0,-1):e;if(e.length===i.len&&o===e)throw b(e);return i.keys.enc(...o)},null,(e,r)=>{let n=v(r),i=e.map(({key:e,value:t})=>({keyArgs:n.keys.dec(e),value:n.value.dec(t)}));if(i.some(({value:e})=>!c(t,r,e)))throw d();return i})),r.withHodl(l)),i)},watchValue:(...e)=>{let t=e[e.length-1],n="best"===t,i=n||"finalized"===t?e.slice(0,-1):e;return r[n?"best$":"finalized$"].pipe(oI(()=>y(...i,n?{at:"best"}:{})),tO((e,t)=>
1e.raw===t.raw),oR)},watchEntries:(...r)=>{let i=r.at(-1),o=oO(i);return n(e,t,o?r.slice(0,-1):r,o&&"best"===i.at)}}};var oz=r(6727);let[oT,oj]=["<Bytes>","</Bytes>"].map(e=>nc.fromText(e).asBytes()),oU=e=>async t=>{let r,n=!0;for(r=0;n&&r<oT.length;r++)n=oT[r]===t[r];n=n&&r===oT.length;let i=t.length-oj.length;for(r=0;n&&r<oj.length;r++)n=oj[r]===t[i+r];return e((n=n&&r===oj.length)?t:(0,rX.r)([oT,t,oj]))};function oH(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ed(e);return e5(function(t,n){(r?tj(e,t,r):tj(e,t)).subscribe(n)})}Uint8Array.from([1]);let oN=(e,t)=>{let r=e.metadata.pallets.find(e=>"System"===e.name).constants.find(e=>"Version"===e.name),n=e(r.type),i=t.buildDefinition(r.type).dec;if("struct"!==n.type)throw Error("not a struct");return i(r.value)},oP=e=>1<<Math.ceil(Math.log2(e)),oM=(0,d.J8)((0,d.Jj)(2)[0],e=>{let t=Math.min(Math.max(oP(e.period),4),65536),r=e.startAtBlock%t,n=Math.max(t>>12,1),i=Math.min(Math.max(function(e){let t=0;for(;!(1&e);)t++,e>>=1;return t}(t)-1,1),15
1);return d.KB[0](i|r/n<<4)}),[oV]=(0,O.AU)({tip:d.oA,asset:(0,O.Wx)((0,d.Jj)(1/0))}),oD=new Uint8Array,oF=Uint8Array.from([0]),oW=e=>({value:e,additionalSigned:oD}),oL=e=>({value:oD,additionalSigned:e}),oJ=(e,t)=>({value:e,additionalSigned:t}),oq=(e,t,r)=>{let n={};return t.metadata.extrinsic.signedExtensions[0].forEach(({identifier:e,type:t,additionalSigned:i})=>{n[e]=[t,i].map(e=>r.buildDefinition(e)[0])}),({mortality:i,tip:o=0n,nonce:s,customSignedExtensions:u={},...l})=>{let a=[],c=oN(t,r),f=e=>{let[t,r]=n[e],i=u[e];try{return b({value:t,additionalSigned:r},(e,t)=>{let r=i?.[t];return r instanceof Uint8Array?r:e(r)})}catch{if(i)throw Error(`Wrong input received for ${e}`);return a.push(e),null}},p=b(n,([t,r],n)=>{if(u[n])return f(n);switch(n){case"CheckNonce":return oW(t(s));case"CheckMortality":return i.mortal?oJ(oM({period:i.period,startAtBlock:i.startAtBlock.height}),(0,rv.H)(i.startAtBlock.hash)):oJ(oF,e);case"ChargeTransactionPayment":return oW(t(o));case"ChargeAssetTxPayment":return oW(oV({tip:o,asset:l.asset}));case"CheckGenesis":return oL(e);case"CheckMetadataHash":return oJ(oF,oF);case"CheckSpecVersion":return oL(r(c.spec_version));case"CheckTxVersion":return oL(r(c.transaction_version));default:return f(n)}});return a.forEach(e=>{delete p[e]}),b(p,(e,t)=>({...e,identifier:t}))}},oK="AccountNonceApi_account_nonce",oX={1:d.u8.dec,2:d.KB.dec,4:d.Jq.dec,8:d.AW.dec},oY=(e,t,r)=>e(r,oK,t).pipe(ty(e=>{let t=(0,rv.H)(e),r=oX[t.length];if(!r)throw Error(`${oK} retrieved wrong data`);return r(t)})),oG=(e,t,r,n,i,o={})=>rz([o.nonce?to(o.nonce):oQ(e,(0,rv.N)(t.publicKey)),e.getRuntimeContext$(n.hash),e.genesis$]).pipe(tR(1),tA(([e,s,u])=>{let l=oq((0,rv.H)(u),s.lookup,s.dynamicBuilder),a=o.mortality??{period:64,mortal:!0},c=l({nonce:e,tip:o.tip??0n,mortality:a.mortal?{mortal:!0,period:a.period,startAtBlock:{he
1ight:n.number,hash:n.hash}}:{mortal:!1},customSignedExtensions:i,asset:o.asset});return t.signTx(r,c,s.metadataRaw,n.number)})),oQ=(e,t)=>{let r=t=>e.newBlocks$.pipe(tB((e,t)=>t.parent===e?t.hash:e,t),oH(t),tO()),n=n=>r(n).pipe(tR(2),t$(r=>oY(e.call$,t,r)));return e.pinnedBlocks$.pipe(tR(1),ty(({blocks:e,best:t})=>{let r=e.get(t);return[...e.values()].filter(e=>!e.pruned&&0===e.children.size&&e.number>=r.number).map(e=>e.hash)}),t$(e=>rz(e.map(e=>n(e).pipe(ty(e=>({success:!0,value:e})),tV(e=>to({success:!1,value:e}))))).pipe(tR(1))),ty(e=>{let t=e.reduce((e,t)=>t.success&&t.value>=(e??0)?t.value:e,null);if(null==t)throw e[0].value;return t}))},oZ={},o0=e=>t=>new eG(r=>{let n=oZ,i=t.subscribe({next(e){r.next(n=e)},error(e){r.error(e)},complete(){n===oZ?r.complete():i=e(n).subscribe(r)}});return()=>{i.unsubscribe()}});var o1=Object.defineProperty,o2=(e,t,r)=>t in e?o1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,o3=(e,t,r)=>o2(e,t+"",r);let o8=(e,t)=>new eG(r=>{let n,i;let o=new Map,s=()=>{let e=n.best,t=o.get(e),s=n.blocks.get(e).number;for(;!t;){let r=n.blocks.get(e);if(!r)break;t=o.get(e=r.parent),s--}if(!t)return;let u=s<=n.blocks.get(n.finalized).number,l=t.found.type;if(l&&i?.found&&i.hash===t.hash){u&&r.complete();return}r.next(i=t.found.type?{found:l,hash:t.hash,number:s,index:t.found.index,events:t.found.events}:{found:l,validity:t.found.validity}),u&&(l?r.complete():t.found.validity?.success===!1&&r.error(new o6(t.found.validity.value)))},u=t.pipe(tO((e,t)=>e.finalized===t.finalized&&e.best===t.best)).subscribe({next:e=>{n=e,0!==o.size&&s()},error(e){r.error(e)}});return u.add(e.subscribe({next:e=>{o.set(e.hash,e),s()},error(e){r.error(e)}})),u}).pipe(tO((e,t)=>e===t)),o7=(e,t)=>{let r=e.filter(e=>"ApplyExtrinsic"===e.phase.type&&e.phase.value===t).map(e=>({...e.event,topics:e.topics})),n=r[r.length-1];return"System"===n.type&&"ExtrinsicFailed"===n.value.type?{ok:!1,events:r,dispatchError:n.value.value.dispatch_error}:{ok:!0,events:r}};class o6 extends Error{constructor(e){super(JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t instanceof nc?t.asHex():t,2)),o3(this,"error"),this.name="InvalidTxError",this.error=e}}let o4=(e,t,r,n=!1)=>e.hasher$.pipe(tA(i=>{let o=(0,rv.N)(i((0,rv.H)(r))),s=(e,t)=>({type:e,txHash:o,...t}),u=e.pinnedBlocks$.state,l=e=>{if(!e.mortal)return 0;let{phase:t,period:r}=e;return Math.floor((Math.max(u.blocks.get(u.best).number,t)-t)/r)*r+t},a=e=>{let t=[...u.blocks.values()].filter(e=>!e.pruned&&!e.children.size),r=Math.max(...t.map(({number:e})=>e));t=t.filter(({number:e})=>e>=r-1);let n=u.blocks.get(u.finalized);return(t=n.children?[n,...t]:t).filter(t=>t.number>=e)},c=({hash:t})=>e.validateTx$(t,r),f=rj(()=>u.finalizedRuntime.runtime.pipe(ty(e=>e.getMortalityFromTx(r)),ty(l),ty(a),tA(t=>{let r;return tz(...t.map(t=>(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 1===(t=oA(t)).length?e7(t[0]):new eG((e=t,function(t){for(var r=[],n=function(n){r.push(e7(e[n]).subscribe(e9(t,function(e){if(r){for(var i=0;i<r.length;i++)i!==n&&r[i].unsubscribe();r=null}t.next(e)})))},i=0;r&&!t.closed&&i<e.length;i++)n(i)}))})(c(t),e.finalized$.pipe(tT(e=>{if(e.number<t.number)return!0;let r=e;for(;r.number>t.number;){let e=u.blocks.get(r.parent);if(!e)return!1;r=e}return r.hash===e.hash}),t2(),t1({success:null}))))).pipe(tE((e,n)=>{if(!1===e.success&&(r??(r=new o6(e.value))),e.success)return!0;if(n===t.length-1&&r)throw r;return!1}),tR(1))}),t2())),p=o8(new eG(n=>{let i=e.trackTx$(r).subscribe(n);return i.add(t(r).subscribe({error(e){n.error(e)}})),i}),e.pinnedBlocks$).pipe(ty(e=>e.found?s("txBestBlocksState",{found:!0,block:{index:e.index,number:e.number,hash:e.hash},...o7(e.events,e.index)}):s("txBestBlocksState",{found:!1,isValid:e.validity?.success!==!1})));return tj(n?to(s("signed",{})):tI,f,to(s("broadcasted",{})),p.pipe(o0(({found:e,type:t,...r})=>e?to(s("finalized",r)):tI)))})),o5=async(e,t,r,n)=>{var i;return(i=o4(e,t,r),new Promise(function(e,t){var r,n=!1;i.subscribe({next:function(e){r=e,n=!0},error:t,complete:function(){n?e(r):t(new or)}})})).then(e=>{if("finalized"!==e.type)throw null;let t={...e};return delete t.type,t})}
1,o9=(0,rJ.h)().enc,se=new Uint8Array(64),st=new Uint8Array(65),sr=e=>()=>e?st:se,[,sn]=(0,O.AU)({weight:(0,O.AU)({ref_time:E.v,proof_size:E.v}),class:x({Normal:d.R9,Operational:d.R9,Mandatory:d.R9}),partial_fee:d.z7}),si=(e,t,r,n,{isCompatible:i,getCompatibilityLevel:o,compatibleRuntime$:s,argsAreCompatible:u,getRuntimeTypedef:l},a)=>Object.assign(i=>{let o=(r,n,i={})=>{let o;let s=ol(r).runtime(),{dynamicBuilder:c,assetId:f,lookup:p,extVersions:h}=s;try{o=c.buildCall(e,t)}catch{throw Error(`Runtime entry Tx(${e}.${t}) not found`)}if(a&&!u(r,s,n))throw Error(`Incompatible runtime entry Tx(${e}.${t})`);let b=i;if(i.asset){if(null==f||!V(i.asset,M(p(f)),e=>l(s,e)))throw Error("Incompatible runtime asset");b={...i,asset:c.buildDefinition(f).enc(i.asset)}}let{location:v,codec:y}=o,m=(0,rX.r)([new Uint8Array(v),y.enc(n)]);return{callData:nc.fromBytes(m),bare:(0,rv.N)((0,rX.r)(d.oA.enc(m.length+1),new Uint8Array(h.slice(-1)),m)),options:b}},c=(e,t={})=>s(r,null).pipe(ty(([r])=>o(r,e,t))),f=(e,{...t},n)=>c(i,t).pipe(tA(({callData:i,options:o})=>oG(r,e,i.asBytes(),n,t.customSignedExtensions||{},o))),p=(e,{at:t,...n}={})=>(t&&"finalized"!==t?"best"===t?r.best$:r.bestBlocks$.pipe(ty(e=>e.find(e=>e.hash===t))):r.finalized$).pipe(tR(1),tA(r=>r?f(e,n,r).pipe(ty(e=>({tx:(0,rv.N)(e),block:r}))):tD(()=>Error(`Uknown block ${t}`)))),h=(e,t)=>on(p(e,t)).then(e=>e.tx),b=async(e,t)=>{"string"==typeof e&&(e=e.startsWith("0x")?(0,rv.H)(e):o9(e));let n=20===e.length,i=function(e,t,r){let n=async(n,i,o,s,u=t4.vT)=>{let l=(0,rP.h)((0,rM.q)(o)),a=[],c=[];l.extrinsic.signedExtensions[0].map(({identifier:e})=>{let t=i[e];if(!t)throw Error(`Missing ${e} signed extension`);a.push(t.value),c.push(t.additionalSigned)});let f=(0,rX.r)([n,...a,...c]),p=await r(f.length>256?u(f):f);return(0,oz.m)(l,e,p,a,n,t)};return{publicKey:e,signTx:n,signBytes:oU(r)}}(e,n?"Ecdsa":"Sr25519",sr(n)),o=(0,rv.H)(await h(i,t)),s=(0,rv.N)((0,rX.r)([o,d.Jq.enc(o.length)])),u=r.getRuntimeContext$(null).pipe(ty(e=>{try{return e.dynamicBuilder.buildRuntimeCall("TransactionPaymentApi","query_info").value[1]}catch{return sn}}));return on(rz([r.call$(null,"TransactionPaymentApi_query_info",s),u]).pipe(ty(([e,t])=>t(e))))},y=async(e,t)=>(await b(e,t)).partial_fee;return{getPaymentInfo:b,getEstimatedFees:y,decodedCall:{type:e,value:v(t,i)},getEncodedData:e=>e?o(e,i).callData:on(c(i).pipe(ty(e=>e.callData))),getBareTx:e=>e?o(e,i).bare:on(c(i).pipe(ty(e=>e.bare))),sign:h,signSubmitAndWatch:(e,t)=>p(e,t).pipe(tA(({tx:e})=>o4(r,n,e,!0))),signAndSubmit:(e,t)=>on(p(e,t)).then(({tx:e,block:t})=>o5(r,n,e,t.hash))}},{getCompatibilityLevel:o,isCompatible:i}),so=(e,t)=>e.pipe(tT(e=>e.blocks.has(t)),tO((e,t)=>e.finalized===t.finalized&&e.best===t.best),ty(e=>{if(e.blocks.get(t).number>e.blocks.get(e.best).number)return null;let{number:r}=e.blocks.get(t),n=e.blocks.get(e.best),i=e.finalized===n.hash;for(;n.number>r;)n=e.blocks.get(n.parent),i=i||e.finalized===n.hash;return i?"finalized":n.hash===t?"best":null}),tO(),tT(e=>"finalized"!==e,!0));var ss=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return ev(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return r.closed||t.next(this._value),r},t.prototype.getValue=function(){var e=this.hasError,t=this.thrownError,r=this._value;if(e)throw t;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(tb);let su=()=>{let e=new ss(new tb);return[e.pipe(t$(eK)),()=>tk({next:t=>e.value.next(t),error:t=>{e.value.error(t),e.next(new tb)},complete:()=>{e.value.complete(),e.next(new tb)}})]};var sl=Object.defineProperty,sa=(e,t,r)=>t in e?sl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sc=(e,t,r)=>(sa(e,"symbol"!=typeof t?t+"":t,r),r),sf=Symbol("SUSPENSE"),sp=class extends Promise{constructor(e){super(e)}},sh=class extends Error{constructor(){super(),this.name="NoSubscribersError"}},sd=class extends Error{constructor(){super(),this.name="EmptyObservableError"}},sb={},sv=class extends eG{constructor(e,t,r=eT){super(n=>{let i;let o=new eP({next:n.next.bind(n),error:n.error.bind(n),complete:eT});this.refCount++,n.add(()=>{var e;this.refCount--,i.unsubscribe(),0===this.refCount&&(this.currentValue=sb,this.subscription&&this.subscription.unsubscribe(),r(),null==(e=this.subject)||e.complete(),this.subject=null,this.subscription=null,this.promise&&(this.promise.rej(new sh),this.promise=null))}),this.subject?(i=this.subject.subscribe(o),this.currentValue!==sb&&n.next(this.currentValue)):(this.subject=ne
1w tb,i=this.subject.subscribe(o),this.subscription=null,this.subscription=new eP({next:e=>{this.promise&&e!==sf&&(this.promise.res(e),this.promise=null),this.subject.next(this.currentValue=e)},error:e=>{var t;this.subscription=null;let r=this.subject;this.subject=null,this.currentValue=sb;let n=null==(t=this.promise)?void 0:t.rej;n&&e===sf&&(this.promise.rej=()=>{n(e)}),r.error(e),n&&this.promise&&(this.promise.rej=n)},complete:()=>{if(this.subscription=null,this.promise&&(this.promise.rej(new sd),this.promise=null),this.currentValue!==sb)return this.subject.complete();if(t===sb){let e=this.subject;return this.subject=null,e.error(new sd)}this.subject.next(this.currentValue=t),this.subject.complete()}}),e.subscribe(this.subscription),t!==sb&&this.currentValue===sb&&this.subject.next(this.currentValue=t))}),this.defaultValue=t,sc(this,"subject",null),sc(this,"subscription",null),sc(this,"refCount",0),sc(this,"currentValue",sb),sc(this,"promise",null),sc(this,"pipeState",(...e)=>{let t=super.pipe(...e);return t instanceof sv?t:new sv(t,sb)}),sc(this,"getRefCount",()=>this.refCount),sc(this,"getValue",()=>{if(this.promise)return this.promise.p;if(this.currentValue!==sb&&this.currentValue!==sf)return this.currentValue;if(this.defaultValue!==sb)return this.defaultValue;if(0===this.refCount)throw new sh;let e=new sp((e,t)=>{this.promise={res:e,rej:t,p:null}});return this.promise.p=e,e}),sc(this,"getDefaultValue",()=>this.defaultValue),t===sb&&delete this.getDefaultValue}};function sy(e,t){t.getValue=e.getValue,t.getRefCount=e.getRefCount,t.pipeState=e.pipeState,e.getDefaultValue&&(t.getDefaultValue=e.getDefaultValue)}var sm=class{constructor(){sc(this,"root"),this.root=new Map}get(e){let t=this.root;for(let r=0;r<e.length;r++)if(!(t=t.get(e[r])))return;return t}set(e,t){let r,n=this.root;for(r=0;r<e.length-1;r++){let t=n.get(e[r]);t||(t=new Map,n.set(e[r],t)),n=t}n.set(e[r],t)}delete(e){let t=[this.root],r=this.root;for(let n=0;n<e.length-1;n++)t.push(r=r.get(e[n]));let n=t.length-1;for(t[n].delete(e[n]);--n>-1&&0===t[n].get(e[n]).size;)t[n].delete(e[n])}},sg=(...e)=>("function"==typeof e[0]?function(e,t){let r=new sm,n="function"==typeof t?t:()=>t,i=t=>{for(let e=t.length-1;void 0===t[e]&&e>-1;e--)t.splice(-1);let i=[t.length,...t],o=r.get(i);if(void 0!==o)return o;let s=new sv(e(...t),n(...t),()=>{r.delete(i)}),u=new eG(e=>{let t=r.get(i),n=s;return t?t!==u&&sy(n=t,u):r.set(i,l),n.subscribe(e)});sy(s,u);let l=u;return r.set(i,l),l};return(...e)=>i(e)}:function(e,t){return new sv(e,t)})(e[0],e.length>1?e[1]:sb);let sw=(e,t,r)=>{let n=new Map(t.map(e=>[e.key,e])),i=new Map(e.map(e=>[e.key,e])),o=new Map,s=[];return t.forEach(e=>{let{key:t}=e,n=i.get(t);n&&n.value===e.value||o.set(t,r(e))}),e.forEach(e=>{n.has(e.key)||s.push(e)}),{deltas:{deleted:s,upserted:[...o.values()]},entries:t.map(({key:e})=>o.get(e)??i.get(e))}},sx=(e,t,r,n=!1)=>{try{let i=n?e:r.blocks.get(e).parent;for(;i&&!t[i];)i=r.blocks.get(i).parent;if(!i)return null;return t[i]}catch{return null}},sk=(e,t)=>r=>{let{keys:n,value:i}=r.dynamicBuilder.buildStorage(e,t);return e=>(e.dec={value:i.dec(e.value),args:n.dec(e.key)},e)},sE=(e,t,r)=>{let n=sg((n,i,o)=>{let s=sk(n,i),u=(n,i)=>{let u=so(e,i.hash).pipe(tE(e=>!e),tR(1));return t(i.hash,"closestDescendantMerkleValue",()=>o).pipe(tA(e=>e===n?.rootHash?to({...n,block:i,deltas:null,prev:n.block.hash}):t(i.hash,"descendantsValues",()=>o).pipe(r(()=>i.hash),ty(([e,t])=>[e,s(t)]),ty(([t,r])=>({prev:n&&n.block.hash,rootHash:e,block:i,patcher:r,...sw(n?.entries??[],t,r)})))),ic(u),tV(e=>e instanceof tF?tI:tD(()=>e)))},l=e.pipe(tO((e,t)=>e.finalized===t.finalized),oI(({blocks:e,finalized:t})=>u(null,e.get(t))),tR(1),ty(e=>({blocks:{[e.block.hash]:e},finalized:e.block.hash}))),[a,c]=su();return tz(l,e.pipe(tO((e,t)=>e.best===t.best),ih(a),oI(([e,t])=>{let{best:r}=e,{blocks:n}=t,i=n[r]?null:r;if(!i)return tI;let o=sx(i,n,e);return o?u(o,e.blocks.get(i)).pipe(ty(e=>(n[i]=e,t))):(i=e.finalized,u(n[t.finalized],e.blocks.get(i)).pipe(ty(e=>(e.prev=null,{blocks:{[i]:e},finalized:i}))))}))).pipe(c())}),i=t=>(r,i,o)=>{let s=n(r,i,o),u=t?"finalized":"best";return rz([s,e.pipe(tO((e,t)=>
1e[u]===t[u]))]).pipe(ty(([e,t])=>{let r=sx(t[u],e.blocks,t,!0);return r&&{update:r,state:e}}),tE(Boolean),tO((e,t)=>e.update===t.update),oH(null),e5(function(e,t){var r,n=!1;e.subscribe(e9(t,function(e){var i=r;r=e,n&&t.next([i,e]),n=!0}))}),tA(([e,r])=>{if(!e)return[r.update];let{update:n}=e,{state:i,update:o}=r,s=o,u=[];for(;s&&s.block.number>n.block.number;)u.unshift(s),s=s.prev?i.blocks[s.prev]:null;if(t&&(i.finalized=o.block.hash,u.length)){let{blocks:e}=i;Object.keys(e).forEach(t=>{e[t].block.number<u[0].block.number&&delete e[t]})}return n===s?u:[{...o,...n.rootHash===o.rootHash?{entries:n.entries,deltas:null}:sw(n.entries,o.entries,o.patcher)}]}))},o=sg(i(!0)),s=sg(i(!1));return(t,r,n,i)=>{let u=i?s:o;return e.pipe(tR(1),tA(e=>e.runtimes[e.blocks.get(e[i?"best":"finalized"]).runtime].runtime),ty(e=>e.dynamicBuilder.buildStorage(t,r).keys.enc(...n))).pipe(tR(1),tA(e=>u(t,r,e)),ty(({block:{hash:e,number:t,parent:r},deltas:n,entries:i},o)=>{let s=o>0?n:{deleted:[],upserted:i};return{block:{hash:e,number:t,parent:r},entries:i.map(sO),deltas:s&&{deleted:s.deleted.map(sO),upserted:s.upserted.map(sO)}}}))}},sO=e=>e.dec,sS="RuntimeViewFunction",sB="execute_view_function",sA=sS+"_"+sB,s_=(e,t,r,{isCompatible:n,getCompatibilityLevel:i,compatibleRuntime$:o,argsAreCompatible:s,valuesAreCompatible:u})=>{let l=()=>Error(`Incompatible runtime entry ViewFn(${e}.${t})`);return Object.assign((...n)=>{let i=n[n.length-1],{signal:a,at:c}=oO(i)?i:{},f=c??null;return oE(o(r,f).pipe(tA(([i,o])=>{let a,c;try{a=o.dynamicBuilder.buildRuntimeCall(sS,sB)}catch{throw Error(`Runtime entry RuntimeCall(${sA}) not found`)}try{c=o.dynamicBuilder.buildViewFn(e,t)}catch{throw Error(`Runtime entry ViewFn(${e}.${t}) not found`)}if(!s(i,o,n))throw l();let p=c.args.enc(n),h=(0,rX.r)([(0,rv.H)(o.lookup.metadata.pallets.find(({name:t})=>t===e).viewFns.find(({name:e})=>e===t).id),E.J.enc(p.length),p]);return r.call$(f,sA,(0,rv.N)(h)).pipe(ty(e=>{try{let t=a.value.dec(e);if(!("success"in t&&"value"in t)||!("type"in t.value)&&!("asBytes"in t.value))throw null;return t}catch{throw Error(`Unexpected RuntimeCall(${sA}) type`)}}),ty(({success:e,value:t})=>{if(!e)throw Error(`ViewFn API Error: ${t.type}`);let r=c.value.dec(t.asBytes());if(!u(i,o,r))throw l();return r}))}),r.withHodl(f)),a)},{getCompatibilityLevel:i,isCompatible:n})},s$=/^(?:0x)?((?:[0-9a-fA-F][0-9a-fA-F])+)$/,sI=(e,t,r)=>{let n={},i=e=>new Proxy(n,{get:(t,r)=>e(r)}),o=e=>{let t={};return i(r=>(t[r]||(t[r]={}),i(n=>(t[r][n]||(t[r][n]=e(r,n)),t[r][n]))))},s=(e,t)=>e.lookup.metadata.pallets.find(e=>e.name===t),u=sE(t.pinnedBlocks$,t.storage$,t.withRuntime),l=o((r,n)=>oC(r,n,t,u,oy(e,e=>e.getEntryPoint(oa.Storage,r,n),e=>{let t=s(e,r)?.storage?.items.find(e=>e.name===n);return null==t?null:function(e){if("plain"===e.type.tag)return{args:es,values:ei(e.type.value)};let{key:t,value:r}=e.type.value;return{args:ei(t),values:ei(r)}}(t)}))),a=(e,t,r,n)=>{var i;if(null==r)return null;let o=e.lookup(r);if("enum"!==o.type)throw Error("Expected enum");if(null==o.value[n])return null;let s="lookupEntry"===(i=o.value[n]).type?ei(i.value.id):eo(M(i));return{args:"args"===t?s:es,values:"args"===t?es:s}},c=o((n,i)=>si(n,i,t,r,oy(e,e=>e.getEntryPoint(oa.Tx,n,i),e=>a(e,"args",s(e,n)?.calls?.type,i)),!0)),f=o((r,n)=>ok(r,n,t,oy(e,e=>e.getEntryPoint(oa.Event,r,n),e=>a(e,"values",s(e,r)?.events?.type,n)))),p=o((t,r)=>ow(t,r,oy(e,e=>e.getEntryPoint(oa.Const,t,r),e=>{let n=s(e,t)?.constants.find(e=>e.name===r)?.type;return null==n?null:{args:es,values:ei(n)}}))),h=o((r,n)=>oS(r,n,t,oy(e,e=>e.getEntryPoint(oa.Api,r,n),e=>{let t=e.lookup.metadata.apis.find(e=>e.name===r)?.methods.find(e=>e.name===n);return null==t?null:el(t)}))),d=o((r,n)=>s_(r,n,t,oy(e,e=>e.getEntryPoint(oa.ViewFns,r,n),e=>{let t=e.lookup.metadata.pallets.find(e=>e.name===r)?.viewFns.find(e=>e.name===n);return null==t?null:el(t)}))),b=(n,i)=>{let{lookup:o,dynamicBuilder:u}=ol(i).runtime();try{let i=u.buildDefinition(o.call).dec(n.asBytes()),l=i.type,c=i.value.type,f=i.value.value;return si(l,c,t,r,oy(e,e=>e.getEntryPoint(oa.Tx,l,c),e=>a(e,"args",s(e,l)?.calls?.type,c)),!1)(f)}
1catch{throw Error("createTx: invalid call data")}};return{query:l,txFromCallData:(t,r)=>r?b(t,r):e.then(e=>b(t,e)),tx:c,event:f,apis:h,constants:p,view:d}};function sR(e,{getMetadata:t,setMetadata:r}={}){let n;let i=ot(e),o=i_(i,{getMetadata:t?e=>ti(t(e)):void 0,setMetadata:r}),{getChainSpecData:s}=i,{genesis$:u,...l}=o.chainHead$(),a=o.archive(l.getRuntime$),c={...l,genesis$:rj(s).pipe(ty(({genesisHash:e})=>e),tV(()=>u),tC(1)),storage$:i$(l.storage$,a.storage$),body$:i$(l.body$,a.body$),call$:i$(l.call$,a.call$),header$:i$(l.header$,a.header$),eventsAt$:i$(l.eventsAt$,a.eventsAt$),storageQueries$:i$(l.storageQueries$,a.storageQueries$),getRuntimeContext$:i$(l.getRuntimeContext$,a.getRuntimeContext$)},f=i.request,p=new WeakMap,{broadcastTx$:h}=o,d=e=>c.getRuntimeContext$(e).pipe(ty(e=>e.metadataRaw)),b={getChainSpecData:s,getMetadata$:d,getMetadata:(e,t)=>oE(d(e),t),blocks$:c.newBlocks$,hodlBlock:e=>c.holdBlock(e,!0),finalizedBlock$:c.finalized$,getFinalizedBlock:()=>on(c.finalized$),bestBlocks$:c.bestBlocks$,getBestBlocks:()=>on(c.bestBlocks$),watchBlockBody:c.body$,getBlockBody:e=>on(c.body$(e)),getBlockHeader:e=>on(c.header$(e??null)),submit:(...e)=>o5(c,h,...e),submitAndWatch:e=>o4(c,h,e),getTypedApi:e=>{if(p.has(e))return p.get(e);let t=oh(e,c),r=Object.assign(sI(t,c,h),{compatibilityToken:t});return p.set(e,r),r},getUnsafeApi:()=>{if(n)return n;let e=od(c);return n=Object.assign(sI(e,c,h),{runtimeToken:e})},rawQuery:(e,{at:t,signal:r}={})=>oE(c.storage$(t??null,"value",()=>{let t=e.match(s$)?.[1];return t?`0x${t}`:nc.fromText(e).asHex()}),r),destroy:()=>{c.unfollow(),o.destroy()},_request:f};return b.___INTERNAL_DO_NOT_USE=c,b}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.