@cmts-dev/carmentis-sdk-core 1.2.8 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=function(e){return e[e.CARMENTIS_ERROR=0]=`CARMENTIS_ERROR`,e[e.NODE_ERROR=1]=`NODE_ERROR`,e[e.NODE_NOT_AVAILABLE_DURING_SYNCHRONISATION_ERROR=2]=`NODE_NOT_AVAILABLE_DURING_SYNCHRONISATION_ERROR`,e[e.INTERNAL_ERROR=500]=`INTERNAL_ERROR`,e[e.TYPE_CHECKING_FAILURE_ERROR=501]=`TYPE_CHECKING_FAILURE_ERROR`,e[e.SERIALIZATION_ERROR=502]=`SERIALIZATION_ERROR`,e[e.PROOF_VERIFICATION_FAILURE=300]=`PROOF_VERIFICATION_FAILURE`,e[e.BLOCKCHAIN_ERROR=100]=`BLOCKCHAIN_ERROR`,e[e.ACCOUNT_NOT_FOUND=101]=`ACCOUNT_NOT_FOUND`,e[e.ACCOUNT_ALREADY_EXISTS=102]=`ACCOUNT_ALREADY_EXISTS`,e[e.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY=103]=`ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY`,e[e.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY_HASH=104]=`ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY_HASH`,e[e.ACCOUNT_ALREADY_EXISTS_FOR_PUBLIC_KEY=105]=`ACCOUNT_ALREADY_EXISTS_FOR_PUBLIC_KEY`,e[e.ACCOUNT_NOT_FOUND_FOR_ADDRESS=106]=`ACCOUNT_NOT_FOUND_FOR_ADDRESS`,e[e.ORGANIZATION_NOT_FOUND=107]=`ORGANIZATION_NOT_FOUND`,e[e.APPLICATION_NOT_FOUND=108]=`APPLICATION_NOT_FOUND`,e[e.APPLICATION_LEDGER_NOT_FOUND=109]=`APPLICATION_LEDGER_NOT_FOUND`,e[e.VALIDATOR_NODE_NOT_FOUND=110]=`VALIDATOR_NODE_NOT_FOUND`,e[e.VIRTUAL_BLOCKCHAIN_NOT_FOUND=111]=`VIRTUAL_BLOCKCHAIN_NOT_FOUND`,e[e.VIRTUAL_BLOCKCHAIN_ALREADY_EXISTS=112]=`VIRTUAL_BLOCKCHAIN_ALREADY_EXISTS`,e[e.MICROBLOCK_STRUCTURE_CHECKING_ERROR=113]=`MICROBLOCK_STRUCTURE_CHECKING_ERROR`,e[e.ECONOMICS_ERROR=200]=`ECONOMICS_ERROR`,e[e.INVALID_TOKEN_UNIT=201]=`INVALID_TOKEN_UNIT`,e[e.PROTOCOL_ERROR=400]=`PROTOCOL_ERROR`,e}({}),r=class extends Error{},i=class extends r{},a=class extends r{},o=class e extends Error{constructor(e,t=n.CARMENTIS_ERROR){super(`[error ${t}] ${e}`),this.code=t}getErrorCode(){return this.code}static isCarmentisError(t){return t instanceof e}},s=class extends o{constructor(e){super(`Microblock structure checking error: ${e??`Not specified`}`,n.MICROBLOCK_STRUCTURE_CHECKING_ERROR)}},c=class extends o{constructor(){super(`You are not authenticated`)}},l=class extends o{constructor(e=`Parsing failure`){super(e)}},u=class extends o{constructor(e){super(e,n.BLOCKCHAIN_ERROR)}},d=class extends o{},f=class extends d{constructor(e){super(e??`Decryption failure`)}},p=class extends f{constructor(e){super(e)}},m=class extends o{},h=class extends m{},g=class extends h{constructor(e){super(`Connection with node at ${e} refused`,n.NODE_ERROR)}},_=class extends h{constructor(){super(`Query rejected while catching up`,n.NODE_ERROR)}},v=class extends o{constructor(e,t=n.ECONOMICS_ERROR){super(e,t)}},y=class extends v{constructor(){super(`Invalid unit type`,n.INVALID_TOKEN_UNIT)}},b=class extends o{constructor(e,t=n.BLOCKCHAIN_ERROR){super(e,t)}},ee=class extends Error{constructor(){super(`No implemented`)}},x=class extends b{constructor(e,t){super(`MicroBlock in virtual blockchain ${e.encode()} not found at height ${t}`)}},te=class extends b{constructor(){super(`MicroBlock not found`)}},ne=class extends b{constructor(){super(`MicroBlock not found in block`)}},re=class extends r{constructor(e){super(`Actor '${e}' already defined`)}},ie=class extends r{constructor(e,t){super(`invalid actor ID ${e} (expected ID: ${t})`)}},ae=class extends r{constructor(e){super(`Channel '${e}' already defined`)}},oe=class extends r{constructor(e){super(`Unknown actor '${e}'`)}},se=class extends r{constructor(e){super(`Unknown channel '${e}'`)}},ce=class extends o{constructor(e,t,r){super(`Proof verification failed on channel ${e} (computed hash is ${t}, on-chain hash is ${r})`,n.PROOF_VERIFICATION_FAILURE)}},le=class extends r{constructor(e){super(`Cannot subscribe as undefined actor ${e}`)}},S=class extends r{constructor(e){super(`Actor ${e} is already subscribed`)}},ue=class extends r{constructor(e){super(`signature scheme of type ${e} is not allowed on this application ledger`)}},de=class extends r{constructor(e){super(`PKE scheme of type ${e} is not allowed on this application ledger`)}},fe=class extends r{constructor(e){super(`Invalid channel ID ${e}`)}},pe=class extends r{constructor(){super(`Current actor not found`)}},me=class extends b{},he=class extends b{constructor(e,t){super(`Actor ${e} has not been invited to channel ${t}`)}},ge=class extends b{constructor(e){super(`Account not found for public key`)}},_e=class extends b{constructor(e){super(`Account not found for account hash: ${e.encode()}`,n.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY)}},ve=class extends b{constructor(e){super(`Organization not found for hash: ${e.encode()}`,n.ORGANIZATION_NOT_FOUND)}},ye=class extends b{constructor(e){super(`Application not found for id: ${e.encode()}`,n.APPLICATION_NOT_FOUND)}},be=class extends b{constructor(e){super(`Validator node not found for id: ${e.encode()}`,n.VALIDATOR_NODE_NOT_FOUND)}},xe=class extends b{constructor(e){super(`Account not found for public key hash: ${e.encode()}`,n.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY_HASH)}},Se=class extends b{constructor(e){super(`Virtual blockchain not found: ${e.encode()}`,n.VIRTUAL_BLOCKCHAIN_NOT_FOUND)}},Ce=class extends Se{constructor(e){super(e)}},we=class extends o{constructor(e,t=n.PROTOCOL_ERROR){super(`/!\\ `+e,t)}},Te=class extends we{constructor(e,t){super(`Actor ${t} (id ${e}) has not subscribed to a public encryption key.`),this.actorId=e,this.actorName=t}getNotSubscribedActorName(){return this.actorName}},Ee=class extends we{constructor(){super(`Section not found`)}},De=class extends we{constructor(e,t){super(`No shared secret between host ${t} and guest ${e}`)}},Oe=class extends o{constructor(e){super(e,n.SERIALIZATION_ERROR)}},ke=9e15,Ae=1e9,je=`0123456789abcdef`,Me=`2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058`,Ne=`3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789`,Pe={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ke,maxE:ke,crypto:!1},Fe,Ie,C=!0,Le=`[DecimalError] `,Re=Le+`Invalid argument: `,ze=Le+`Precision limit exceeded`,Be=Le+`crypto unavailable`,Ve=`[object Decimal]`,He=Math.floor,Ue=Math.pow,We=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Ge=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ke=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,qe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Je=1e7,w=7,Ye=9007199254740991,Xe=Me.length-1,Ze=Ne.length-1,T={toStringTag:Ve};T.absoluteValue=T.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),E(e)},T.ceil=function(){return E(new this.constructor(this),this.e+1,2)},T.clampedTo=T.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Re+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)},T.comparedTo=T.cmp=function(e){var t,n,r,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,c=a.s,l=e.s;if(!o||!s)return!c||!l?NaN:c===l?o===s?0:!o^c<0?1:-1:c;if(!o[0]||!s[0])return o[0]?c:s[0]?-l:0;if(c!==l)return c;if(a.e!==e.e)return a.e>e.e^c<0?1:-1;for(r=o.length,i=s.length,t=0,n=r<i?r:i;t<n;++t)if(o[t]!==s[t])return o[t]>s[t]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},T.cosine=T.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+w,r.rounding=1,n=nt(r,xt(r,n)),r.precision=e,r.rounding=t,E(Ie==2||Ie==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)},T.cubeRoot=T.cbrt=function(){var e,t,n,r,i,a,o,s,c,l,u=this,d=u.constructor;if(!u.isFinite()||u.isZero())return new d(u);for(C=!1,a=u.s*Ue(u.s*u,1/3),!a||Math.abs(a)==1/0?(n=Qe(u.d),e=u.e,(a=(e-n.length+1)%3)&&(n+=a==1||a==-2?`0`:`00`),a=Ue(n,1/3),e=He((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?n=`5e`+e:(n=a.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+e),r=new d(n),r.s=u.s):r=new d(a.toString()),o=(e=d.precision)+3;;)if(s=r,c=s.times(s).times(s),l=c.plus(u),r=rt(l.plus(u).times(s),l.plus(c),o+2,1),Qe(s.d).slice(0,o)===(n=Qe(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n==`9999`||!i&&n==`4999`){if(!i&&(E(s,e+1,0),s.times(s).times(s).eq(u))){r=s;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(E(r,e+1,1),t=!r.times(r).times(r).eq(u));break}return C=!0,E(r,e,d.rounding,t)},T.decimalPlaces=T.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-He(this.e/w))*w,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},T.dividedBy=T.div=function(e){return rt(this,new this.constructor(e))},T.dividedToIntegerBy=T.divToInt=function(e){var t=this,n=t.constructor;return E(rt(t,new n(e),0,1,1),n.precision,n.rounding)},T.equals=T.eq=function(e){return this.cmp(e)===0},T.floor=function(){return E(new this.constructor(this),this.e+1,3)},T.greaterThan=T.gt=function(e){return this.cmp(e)>0},T.greaterThanOrEqualTo=T.gte=function(e){var t=this.cmp(e);return t==1||t===0},T.hyperbolicCosine=T.cosh=function(){var e,t,n,r,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;n=o.precision,r=o.rounding,o.precision=n+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/bt(4,e)).toString()):(e=16,t=`2.3283064365386962890625e-10`),a=yt(o,1,a.times(t),new o(1),!0);for(var c,l=e,u=new o(8);l--;)c=a.times(a),a=s.minus(c.times(u.minus(c.times(u))));return E(a,o.precision=n,o.rounding=r,!0)},T.hyperbolicSine=T.sinh=function(){var e,t,n,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=yt(a,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/bt(5,e)),i=yt(a,2,i,i,!0);for(var o,s=new a(5),c=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(c.times(o).plus(l))))}return a.precision=t,a.rounding=n,E(i,t,n,!0)},T.hyperbolicTangent=T.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,rt(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},T.inverseCosine=T.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n===-1?e.isZero()?st(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2)):n===0?e.isNeg()?st(t,r,i):new t(0):new t(NaN)},T.inverseHyperbolicCosine=T.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,C=!1,n=n.times(n).minus(1).sqrt().plus(n),C=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},T.inverseHyperbolicSine=T.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,C=!1,n=n.times(n).plus(1).sqrt().plus(n),C=!0,r.precision=e,r.rounding=t,n.ln())},T.inverseHyperbolicTangent=T.atanh=function(){var e,t,n,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?E(new a(i),e,t,!0):(a.precision=n=r-i.e,i=rt(i.plus(1),new a(1).minus(i),n+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},T.inverseSine=T.asin=function(){var e,t,n,r,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),n=a.precision,r=a.rounding,t===-1?(a.precision=n+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=n,a.rounding=r,i.times(2)):t===0?(e=st(a,n+4,r).times(.5),e.s=i.s,e):new a(NaN))},T.inverseTangent=T.atan=function(){var e,t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding;if(!l.isFinite()){if(!l.s)return new u(NaN);if(d+4<=Ze)return o=st(u,d+4,f).times(.5),o.s=l.s,o}else if(l.isZero())return new u(l);else if(l.abs().eq(1)&&d+4<=Ze)return o=st(u,d+4,f).times(.25),o.s=l.s,o;for(u.precision=s=d+10,u.rounding=1,n=Math.min(28,s/w+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(C=!1,t=Math.ceil(s/w),r=1,c=l.times(l),o=new u(l),i=l;e!==-1;)if(i=i.times(c),a=o.minus(i.div(r+=2)),i=i.times(c),o=a.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),C=!0,E(o,u.precision=d,u.rounding=f,!0)},T.isFinite=function(){return!!this.d},T.isInteger=T.isInt=function(){return!!this.d&&He(this.e/w)>this.d.length-2},T.isNaN=function(){return!this.s},T.isNegative=T.isNeg=function(){return this.s<0},T.isPositive=T.isPos=function(){return this.s>0},T.isZero=function(){return!!this.d&&this.d[0]===0},T.lessThan=T.lt=function(e){return this.cmp(e)<0},T.lessThanOrEqualTo=T.lte=function(e){return this.cmp(e)<1},T.logarithm=T.log=function(e){var t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding,p=5;if(e==null)e=new u(10),t=!0;else{if(e=new u(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new u(n&&!n[0]?-1/0:l.s==1?n?0:1/0:NaN);if(t)if(n.length>1)a=!0;else{for(i=n[0];i%10==0;)i/=10;a=i!==1}if(C=!1,s=d+p,o=mt(l,s),r=t?ot(u,s+10):mt(e,s),c=rt(o,r,s,1),et(c.d,i=d,f))do if(s+=10,o=mt(l,s),r=t?ot(u,s+10):mt(e,s),c=rt(o,r,s,1),!a){+Qe(c.d).slice(i+1,i+15)+1==0x5af3107a4000&&(c=E(c,d+1,0));break}while(et(c.d,i+=10,f));return C=!0,E(c,d,f)},T.minus=T.sub=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d?e.s=-e.s:e=new m(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,s=m.precision,c=m.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new m(p);else return new m(c===3?-0:0);return C?E(e,s,c):e}if(n=He(e.e/w),u=He(p.e/w),l=l.slice(),a=u-n,a){for(d=a<0,d?(t=l,a=-a,o=f.length):(t=f,n=u,o=l.length),r=Math.max(Math.ceil(s/w),o)+2,a>r&&(a=r,t.length=1),t.reverse(),r=a;r--;)t.push(0);t.reverse()}else{for(r=l.length,o=f.length,d=r<o,d&&(o=r),r=0;r<o;r++)if(l[r]!=f[r]){d=l[r]<f[r];break}a=0}for(d&&(t=l,l=f,f=t,e.s=-e.s),o=l.length,r=f.length-o;r>0;--r)l[o++]=0;for(r=f.length;r>a;){if(l[--r]<f[r]){for(i=r;i&&l[--i]===0;)l[i]=Je-1;--l[i],l[r]+=Je}l[r]-=f[r]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--n;return l[0]?(e.d=l,e.e=at(l,n),C?E(e,s,c):e):new m(c===3?-0:0)},T.modulo=T.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?E(new r(n),r.precision,r.rounding):(C=!1,r.modulo==9?(t=rt(n,e.abs(),0,3,1),t.s*=e.s):t=rt(n,e,0,r.modulo,1),t=t.times(e),C=!0,n.minus(t))},T.naturalExponential=T.exp=function(){return pt(this)},T.naturalLogarithm=T.ln=function(){return mt(this)},T.negated=T.neg=function(){var e=new this.constructor(this);return e.s=-e.s,E(e)},T.plus=T.add=function(e){var t,n,r,i,a,o,s,c,l,u,d=this,f=d.constructor;if(e=new f(e),!d.d||!e.d)return!d.s||!e.s?e=new f(NaN):d.d||(e=new f(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(l=d.d,u=e.d,s=f.precision,c=f.rounding,!l[0]||!u[0])return u[0]||(e=new f(d)),C?E(e,s,c):e;if(a=He(d.e/w),r=He(e.e/w),l=l.slice(),i=a-r,i){for(i<0?(n=l,i=-i,o=u.length):(n=u,r=a,o=l.length),a=Math.ceil(s/w),o=a>o?a+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=l.length,i=u.length,o-i<0&&(i=o,n=u,u=l,l=n),t=0;i;)t=(l[--i]=l[i]+u[i]+t)/Je|0,l[i]%=Je;for(t&&(l.unshift(t),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=at(l,r),C?E(e,s,c):e},T.precision=T.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Re+e);return n.d?(t=ct(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},T.round=function(){var e=this,t=e.constructor;return E(new t(e),e.e+1,t.rounding)},T.sine=T.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+w,r.rounding=1,n=vt(r,xt(r,n)),r.precision=e,r.rounding=t,E(Ie>2?n.neg():n,e,t,!0)):new r(NaN)},T.squareRoot=T.sqrt=function(){var e,t,n,r,i,a,o=this,s=o.d,c=o.e,l=o.s,u=o.constructor;if(l!==1||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);for(C=!1,l=Math.sqrt(+o),l==0||l==1/0?(t=Qe(s),(t.length+c)%2==0&&(t+=`0`),l=Math.sqrt(t),c=He((c+1)/2)-(c<0||c%2),l==1/0?t=`5e`+c:(t=l.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+c),r=new u(t)):r=new u(l.toString()),n=(c=u.precision)+3;;)if(a=r,r=a.plus(rt(o,a,n+2,1)).times(.5),Qe(a.d).slice(0,n)===(t=Qe(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t==`9999`||!i&&t==`4999`){if(!i&&(E(a,c+1,0),a.times(a).eq(o))){r=a;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)==`5`)&&(E(r,c+1,1),e=!r.times(r).eq(o));break}return C=!0,E(r,c,u.rounding,e)},T.tangent=T.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=rt(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,E(Ie==2||Ie==4?n.neg():n,e,t,!0)):new r(NaN)},T.times=T.mul=function(e){var t,n,r,i,a,o,s,c,l,u=this,d=u.constructor,f=u.d,p=(e=new d(e)).d;if(e.s*=u.s,!f||!f[0]||!p||!p[0])return new d(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=He(u.e/w)+He(e.e/w),c=f.length,l=p.length,c<l&&(a=f,f=p,p=a,o=c,c=l,l=o),a=[],o=c+l,r=o;r--;)a.push(0);for(r=l;--r>=0;){for(t=0,i=c+r;i>r;)s=a[i]+p[r]*f[i-r-1]+t,a[i--]=s%Je|0,t=s/Je|0;a[i]=(a[i]+t)%Je|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=at(a,n),C?E(e,d.precision,d.rounding):e},T.toBinary=function(e,t){return St(this,2,e,t)},T.toDecimalPlaces=T.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:($e(e,0,Ae),t===void 0?t=r.rounding:$e(t,0,8),E(n,e+n.e+1,t))},T.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=it(r,!0):($e(e,0,Ae),t===void 0?t=i.rounding:$e(t,0,8),r=E(new i(r),e+1,t),n=it(r,!0,e+1)),r.isNeg()&&!r.isZero()?`-`+n:n},T.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?n=it(i):($e(e,0,Ae),t===void 0?t=a.rounding:$e(t,0,8),r=E(new a(i),e+i.e+1,t),n=it(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?`-`+n:n},T.toFraction=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.d,h=p.constructor;if(!m)return new h(p);if(l=n=new h(1),r=c=new h(0),t=new h(r),a=t.e=ct(m)-p.e-1,o=a%w,t.d[0]=Ue(10,o<0?w+o:o),e==null)e=a>0?t:l;else{if(s=new h(e),!s.isInt()||s.lt(l))throw Error(Re+s);e=s.gt(t)?a>0?t:l:s}for(C=!1,s=new h(Qe(m)),u=h.precision,h.precision=a=m.length*w*2;d=rt(s,t,0,1,1),i=n.plus(d.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=c.plus(d.times(i)),c=i,i=t,t=s.minus(d.times(i)),s=i;return i=rt(e.minus(n),r,0,1,1),c=c.plus(i.times(l)),n=n.plus(i.times(r)),c.s=l.s=p.s,f=rt(l,r,a,1).minus(p).abs().cmp(rt(c,n,a,1).minus(p).abs())<1?[l,r]:[c,n],h.precision=u,C=!0,f},T.toHexadecimal=T.toHex=function(e,t){return St(this,16,e,t)},T.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:$e(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&=n.s,e}return e.d[0]?(C=!1,n=rt(n,e,0,t,1).times(e),C=!0,E(n)):(e.s=n.s,n=e),n},T.toNumber=function(){return+this},T.toOctal=function(e,t){return St(this,8,e,t)},T.toPower=T.pow=function(e){var t,n,r,i,a,o,s=this,c=s.constructor,l=+(e=new c(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new c(Ue(+s,l));if(s=new c(s),s.eq(1))return s;if(r=c.precision,a=c.rounding,e.eq(1))return E(s,r,a);if(t=He(e.e/w),t>=e.d.length-1&&(n=l<0?-l:l)<=Ye)return i=ut(c,s,n,r),e.s<0?new c(1).div(i):E(i,r,a);if(o=s.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=o,s}return n=Ue(+s,l),t=n==0||!isFinite(n)?He(l*(Math.log(`0.`+Qe(s.d))/Math.LN10+s.e+1)):new c(n+``).e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(C=!1,c.rounding=s.s=1,n=Math.min(12,(t+``).length),i=pt(e.times(mt(s,r+n)),r),i.d&&(i=E(i,r+5,1),et(i.d,r,a)&&(t=r+10,i=E(pt(e.times(mt(s,t+n)),t),t+5,1),+Qe(i.d).slice(r+1,r+15)+1==0x5af3107a4000&&(i=E(i,r+1,0)))),i.s=o,C=!0,c.rounding=a,E(i,r,a))},T.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=it(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):($e(e,1,Ae),t===void 0?t=i.rounding:$e(t,0,8),r=E(new i(r),e,t),n=it(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?`-`+n:n},T.toSignificantDigits=T.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):($e(e,1,Ae),t===void 0?t=r.rounding:$e(t,0,8)),E(new r(n),e,t)},T.toString=function(){var e=this,t=e.constructor,n=it(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?`-`+n:n},T.truncated=T.trunc=function(){return E(new this.constructor(this),this.e+1,1)},T.valueOf=T.toJSON=function(){var e=this,t=e.constructor,n=it(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?`-`+n:n};function Qe(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+``,n=w-r.length,n&&(a+=lt(n)),a+=r;o=e[t],r=o+``,n=w-r.length,n&&(a+=lt(n))}else if(o===0)return`0`;for(;o%10==0;)o/=10;return a+o}function $e(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Re+e)}function et(e,t,n,r){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=w,i=0):(i=Math.ceil((t+1)/w),t%=w),a=Ue(10,w-t),s=e[i]%a|0,r==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=n<4&&s==99999||n>3&&s==49999||s==5e4||s==0):o=(n<4&&s+1==a||n>3&&s+1==a/2)&&(e[i+1]/a/100|0)==Ue(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(r||n<4)&&s==9999||!r&&n>3&&s==4999):o=((r||n<4)&&s+1==a||!r&&n>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==Ue(10,t-3)-1,o}function tt(e,t,n){for(var r,i=[0],a,o=0,s=e.length;o<s;){for(a=i.length;a--;)i[a]*=t;for(i[0]+=je.indexOf(e.charAt(o++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function nt(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/bt(4,n)).toString()):(n=16,i=`2.3283064365386962890625e-10`),e.precision+=n,t=yt(e,1,t.times(i),new e(1));for(var a=n;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var rt=(function(){function e(e,t,n){var r,i=0,a=e.length;for(e=e.slice();a--;)r=e[a]*t+i,e[a]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,a,o,s,c){var l,u,d,f,p,m,h,g,_,v,y,b,ee,x,te,ne,re,ie,ae,oe,se=r.constructor,ce=r.s==i.s?1:-1,le=r.d,S=i.d;if(!le||!le[0]||!S||!S[0])return new se(!r.s||!i.s||(le?S&&le[0]==S[0]:!S)?NaN:le&&le[0]==0||!S?ce*0:ce/0);for(c?(p=1,u=r.e-i.e):(c=Je,p=w,u=He(r.e/p)-He(i.e/p)),ae=S.length,re=le.length,_=new se(ce),v=_.d=[],d=0;S[d]==(le[d]||0);d++);if(S[d]>(le[d]||0)&&u--,a==null?(x=a=se.precision,o=se.rounding):x=s?a+(r.e-i.e)+1:a,x<0)v.push(1),m=!0;else{if(x=x/p+2|0,d=0,ae==1){for(f=0,S=S[0],x++;(d<re||f)&&x--;d++)te=f*c+(le[d]||0),v[d]=te/S|0,f=te%S|0;m=f||d<re}else{for(f=c/(S[0]+1)|0,f>1&&(S=e(S,f,c),le=e(le,f,c),ae=S.length,re=le.length),ne=ae,y=le.slice(0,ae),b=y.length;b<ae;)y[b++]=0;oe=S.slice(),oe.unshift(0),ie=S[0],S[1]>=c/2&&++ie;do f=0,l=t(S,y,ae,b),l<0?(ee=y[0],ae!=b&&(ee=ee*c+(y[1]||0)),f=ee/ie|0,f>1?(f>=c&&(f=c-1),h=e(S,f,c),g=h.length,b=y.length,l=t(h,y,g,b),l==1&&(f--,n(h,ae<g?oe:S,g,c))):(f==0&&(l=f=1),h=S.slice()),g=h.length,g<b&&h.unshift(0),n(y,h,b,c),l==-1&&(b=y.length,l=t(S,y,ae,b),l<1&&(f++,n(y,ae<b?oe:S,b,c))),b=y.length):l===0&&(f++,y=[0]),v[d++]=f,l&&y[0]?y[b++]=le[ne]||0:(y=[le[ne]],b=1);while((ne++<re||y[0]!==void 0)&&x--);m=y[0]!==void 0}v[0]||v.shift()}if(p==1)_.e=u,Fe=m;else{for(d=1,f=v[0];f>=10;f/=10)d++;_.e=d+u*p-1,E(_,s?a+_.e+1:a,o,m)}return _}})();function E(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor;out:if(t!=null){if(d=e.d,!d)return e;for(i=1,s=d[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=w,o=t,u=d[f=0],c=u/Ue(10,i-o-1)%10|0;else if(f=Math.ceil((a+1)/w),s=d.length,f>=s)if(r){for(;s++<=f;)d.push(0);u=c=0,i=1,a%=w,o=a-w+1}else break out;else{for(u=s=d[f],i=1;s>=10;s/=10)i++;a%=w,o=a-w+i,c=o<0?0:u/Ue(10,i-o-1)%10|0}if(r=r||t<0||d[f+1]!==void 0||(o<0?u:u%Ue(10,i-o-1)),l=n<4?(c||r)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(a>0?o>0?u/Ue(10,i-o):0:d[f-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,l?(t-=e.e+1,d[0]=Ue(10,(w-t%w)%w),e.e=-t||0):d[0]=e.e=0,e;if(a==0?(d.length=f,s=1,f--):(d.length=f+1,s=Ue(10,w-a),d[f]=o>0?(u/Ue(10,i-o)%Ue(10,o)|0)*s:0),l)for(;;)if(f==0){for(a=1,o=d[0];o>=10;o/=10)a++;for(o=d[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,d[0]==Je&&(d[0]=1));break}else{if(d[f]+=s,d[f]!=Je)break;d[f--]=0,s=1}for(a=d.length;d[--a]===0;)d.pop()}return C&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function it(e,t,n){if(!e.isFinite())return ht(e);var r,i=e.e,a=Qe(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+`.`+a.slice(1)+lt(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(e.e<0?`e`:`e+`)+e.e):i<0?(a=`0.`+lt(-i-1)+a,n&&(r=n-o)>0&&(a+=lt(r))):i>=o?(a+=lt(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+lt(r))):((r=i+1)<o&&(a=a.slice(0,r)+`.`+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+=`.`),a+=lt(r))),a}function at(e,t){var n=e[0];for(t*=w;n>=10;n/=10)t++;return t}function ot(e,t,n){if(t>Xe)throw C=!0,n&&(e.precision=n),Error(ze);return E(new e(Me),t,1,!0)}function st(e,t,n){if(t>Ze)throw Error(ze);return E(new e(Ne),t,n,!0)}function ct(e){var t=e.length-1,n=t*w+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function lt(e){for(var t=``;e--;)t+=`0`;return t}function ut(e,t,n,r){var i,a=new e(1),o=Math.ceil(r/w+4);for(C=!1;;){if(n%2&&(a=a.times(t),Ct(a.d,o)&&(i=!0)),n=He(n/2),n===0){n=a.d.length-1,i&&a.d[n]===0&&++a.d[n];break}t=t.times(t),Ct(t.d,o)}return C=!0,a}function dt(e){return e.d[e.d.length-1]&1}function ft(e,t,n){for(var r,i,a=new e(t[0]),o=0;++o<t.length;){if(i=new e(t[o]),!i.s){a=i;break}r=a.cmp(i),(r===n||r===0&&a.s===n)&&(a=i)}return a}function pt(e,t){var n,r,i,a,o,s,c,l=0,u=0,d=0,f=e.constructor,p=f.rounding,m=f.precision;if(!e.d||!e.d[0]||e.e>17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(C=!1,c=m):c=t,s=new f(.03125);e.e>-2;)e=e.times(s),d+=5;for(r=Math.log(Ue(2,d))/Math.LN10*2+5|0,c+=r,n=a=o=new f(1),f.precision=c;;){if(a=E(a.times(e),c,1),n=n.times(++u),s=o.plus(rt(a,n,c,1)),Qe(s.d).slice(0,c)===Qe(o.d).slice(0,c)){for(i=d;i--;)o=E(o.times(o),c,1);if(t==null)if(l<3&&et(o.d,c-r,p,l))f.precision=c+=10,n=a=s=new f(1),u=0,l++;else return E(o,f.precision=m,p,C=!0);else return f.precision=m,o}o=s}}function mt(e,t){var n,r,i,a,o,s,c,l,u,d,f,p=1,m=10,h=e,g=h.d,_=h.constructor,v=_.rounding,y=_.precision;if(h.s<0||!g||!g[0]||!h.e&&g[0]==1&&g.length==1)return new _(g&&!g[0]?-1/0:h.s==1?g?0:h:NaN);if(t==null?(C=!1,u=y):u=t,_.precision=u+=m,n=Qe(g),r=n.charAt(0),Math.abs(a=h.e)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Qe(h.d),r=n.charAt(0),p++;a=h.e,r>1?(h=new _(`0.`+n),a++):h=new _(r+`.`+n.slice(1))}else return l=ot(_,u+2,y).times(a+``),h=mt(new _(r+`.`+n.slice(1)),u-m).plus(l),_.precision=y,t==null?E(h,y,v,C=!0):h;for(d=h,c=o=h=rt(h.minus(1),h.plus(1),u,1),f=E(h.times(h),u,1),i=3;;){if(o=E(o.times(f),u,1),l=c.plus(rt(o,new _(i),u,1)),Qe(l.d).slice(0,u)===Qe(c.d).slice(0,u))if(c=c.times(2),a!==0&&(c=c.plus(ot(_,u+2,y).times(a+``))),c=rt(c,new _(p),u,1),t==null)if(et(c.d,u-m,v,s))_.precision=u+=m,l=o=h=rt(d.minus(1),d.plus(1),u,1),f=E(h.times(h),u,1),i=s=1;else return E(c,_.precision=y,v,C=!0);else return _.precision=y,c;c=l,i+=2}}function ht(e){return String(e.s*e.s/0)}function gt(e,t){var n,r,i;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%w,n<0&&(r+=w),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=w;r<i;)e.d.push(+t.slice(r,r+=w));t=t.slice(r),r=w-t.length}else r-=i;for(;r--;)t+=`0`;e.d.push(+t),C&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function _t(e,t){var n,r,i,a,o,s,c,l,u;if(t.indexOf(`_`)>-1){if(t=t.replace(/(\d)_(?=\d)/g,`$1`),qe.test(t))return gt(e,t)}else if(t===`Infinity`||t===`NaN`)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Ge.test(t))n=16,t=t.toLowerCase();else if(We.test(t))n=2;else if(Ke.test(t))n=8;else throw Error(Re+t);for(a=t.search(/p/i),a>0?(c=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf(`.`),o=a>=0,r=e.constructor,o&&(t=t.replace(`.`,``),s=t.length,a=s-a,i=ut(r,new r(n),a,a*2)),l=tt(t,n,Je),u=l.length-1,a=u;l[a]===0;--a)l.pop();return a<0?new r(e.s*0):(e.e=at(l,u),e.d=l,C=!1,o&&(e=rt(e,i,s*4)),c&&(e=e.times(Math.abs(c)<54?Ue(2,c):fn.pow(2,c))),C=!0,e)}function vt(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:yt(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/bt(5,n)),t=yt(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function yt(e,t,n,r,i){var a,o,s,c,l=1,u=e.precision,d=Math.ceil(u/w);for(C=!1,c=n.times(n),s=new e(r);;){if(o=rt(s.times(c),new e(t++*t++),u,1),s=i?r.plus(o):r.minus(o),r=rt(o.times(c),new e(t++*t++),u,1),o=s.plus(r),o.d[d]!==void 0){for(a=d;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=r,r=o,o=a,l++}return C=!0,o.d.length=d+1,o}function bt(e,t){for(var n=e;--t;)n*=e;return n}function xt(e,t){var n,r=t.s<0,i=st(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return Ie=r?4:1,t;if(n=t.divToInt(i),n.isZero())Ie=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(a))return Ie=dt(n)?r?2:3:r?4:1,t;Ie=dt(n)?r?1:4:r?3:2}return t.minus(i).abs()}function St(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor,m=n!==void 0;if(m?($e(n,1,Ae),r===void 0?r=p.rounding:$e(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())u=ht(e);else{for(u=it(e),o=u.indexOf(`.`),m?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(u=u.replace(`.`,``),f=new p(1),f.e=u.length-o,f.d=tt(it(f),10,i),f.e=f.d.length),d=tt(u,10,i),a=c=d.length;d[--c]==0;)d.pop();if(!d[0])u=m?`0p+0`:`0`;else{if(o<0?a--:(e=new p(e),e.d=d,e.e=a,e=rt(e,f,n,r,0,i),d=e.d,a=e.e,l=Fe),o=d[n],s=i/2,l||=d[n+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(e.s<0?3:2)):o>s||o===s&&(r===4||l||r===6&&d[n-1]&1||r===(e.s<0?8:7)),d.length=n,l)for(;++d[--n]>i-1;)d[n]=0,n||(++a,d.unshift(1));for(c=d.length;!d[c-1];--c);for(o=0,u=``;o<c;o++)u+=je.charAt(d[o]);if(m){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)u+=`0`;for(d=tt(u,i,t),c=d.length;!d[c-1];--c);for(o=1,u=`1.`;o<c;o++)u+=je.charAt(d[o])}else u=u.charAt(0)+`.`+u.slice(1);u=u+(a<0?`p`:`p+`)+a}else if(a<0){for(;++a;)u=`0`+u;u=`0.`+u}else if(++a>c)for(a-=c;a--;)u+=`0`;else a<c&&(u=u.slice(0,a)+`.`+u.slice(a))}u=(t==16?`0x`:t==2?`0b`:t==8?`0o`:``)+u}return e.s<0?`-`+u:u}function Ct(e,t){if(e.length>t)return e.length=t,!0}function wt(e){return new this(e).abs()}function Tt(e){return new this(e).acos()}function Et(e){return new this(e).acosh()}function Dt(e,t){return new this(e).plus(t)}function Ot(e){return new this(e).asin()}function kt(e){return new this(e).asinh()}function At(e){return new this(e).atan()}function jt(e){return new this(e).atanh()}function Mt(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,a=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=st(this,a,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?st(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=st(this,a,1).times(.5),n.s=e.s):t.s<0?(this.precision=a,this.rounding=1,n=this.atan(rt(e,t,a,1)),t=st(this,a,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(rt(e,t,a,1)),n}function Nt(e){return new this(e).cbrt()}function Pt(e){return E(e=new this(e),e.e+1,2)}function Ft(e,t,n){return new this(e).clamp(t,n)}function It(e){if(!e||typeof e!=`object`)throw Error(Le+`Object expected`);var t,n,r,i=e.defaults===!0,a=[`precision`,1,Ae,`rounding`,0,8,`toExpNeg`,-ke,0,`toExpPos`,0,ke,`maxE`,0,ke,`minE`,-ke,0,`modulo`,0,9];for(t=0;t<a.length;t+=3)if(n=a[t],i&&(this[n]=Pe[n]),(r=e[n])!==void 0)if(He(r)===r&&r>=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(Re+n+`: `+r);if(n=`crypto`,i&&(this[n]=Pe[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Be);else this[n]=!1;else throw Error(Re+n+`: `+r);return this}function Lt(e){return new this(e).cos()}function Rt(e){return new this(e).cosh()}function zt(e){var t,n,r;function i(e){var t,n,r,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,Wt(e)){a.s=e.s,C?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d);return}if(r=typeof e,r===`number`){if(e===0){a.s=1/e<0?-1:1,a.e=0,a.d=[0];return}if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;C?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]);return}if(e*0!=0){e||(a.s=NaN),a.e=NaN,a.d=null;return}return gt(a,e.toString())}if(r===`string`)return(n=e.charCodeAt(0))===45?(e=e.slice(1),a.s=-1):(n===43&&(e=e.slice(1)),a.s=1),qe.test(e)?gt(a,e):_t(a,e);if(r===`bigint`)return e<0?(e=-e,a.s=-1):a.s=1,gt(a,e.toString());throw Error(Re+e)}if(i.prototype=T,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=It,i.clone=zt,i.isDecimal=Wt,i.abs=wt,i.acos=Tt,i.acosh=Et,i.add=Dt,i.asin=Ot,i.asinh=kt,i.atan=At,i.atanh=jt,i.atan2=Mt,i.cbrt=Nt,i.ceil=Pt,i.clamp=Ft,i.cos=Lt,i.cosh=Rt,i.div=Bt,i.exp=Vt,i.floor=Ht,i.hypot=Ut,i.ln=Gt,i.log=Kt,i.log10=Jt,i.log2=qt,i.max=Yt,i.min=Xt,i.mod=Zt,i.mul=Qt,i.pow=$t,i.random=en,i.round=tn,i.sign=nn,i.sin=rn,i.sinh=an,i.sqrt=on,i.sub=sn,i.sum=cn,i.tan=ln,i.tanh=un,i.trunc=dn,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`maxE`,`minE`,`modulo`,`crypto`],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function Bt(e,t){return new this(e).div(t)}function Vt(e){return new this(e).exp()}function Ht(e){return E(e=new this(e),e.e+1,3)}function Ut(){var e,t,n=new this(0);for(C=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return C=!0,new this(1/0);n=t}return C=!0,n.sqrt()}function Wt(e){return e instanceof fn||e&&e.toStringTag===Ve||!1}function Gt(e){return new this(e).ln()}function Kt(e,t){return new this(e).log(t)}function qt(e){return new this(e).log(2)}function Jt(e){return new this(e).log(10)}function Yt(){return ft(this,arguments,-1)}function Xt(){return ft(this,arguments,1)}function Zt(e,t){return new this(e).mod(t)}function Qt(e,t){return new this(e).mul(t)}function $t(e,t){return new this(e).pow(t)}function en(e){var t,n,r,i,a=0,o=new this(1),s=[];if(e===void 0?e=this.precision:$e(e,1,Ae),r=Math.ceil(e/w),!this.crypto)for(;a<r;)s[a++]=Math.random()*1e7|0;else if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));a<r;)i=t[a],i>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);a<r;)i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((t[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=r/4}else throw Error(Be);for(r=s[--a],e%=w,r&&e&&(i=Ue(10,w-e),s[a]=(r/i|0)*i);s[a]===0;a--)s.pop();if(a<0)n=0,s=[0];else{for(n=-1;s[0]===0;n-=w)s.shift();for(r=1,i=s[0];i>=10;i/=10)r++;r<w&&(n-=w-r)}return o.e=n,o.d=s,o}function tn(e){return E(e=new this(e),e.e+1,this.rounding)}function nn(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function rn(e){return new this(e).sin()}function an(e){return new this(e).sinh()}function on(e){return new this(e).sqrt()}function sn(e,t){return new this(e).sub(t)}function cn(){var e=0,t=arguments,n=new this(t[e]);for(C=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return C=!0,E(n,this.precision,this.rounding)}function ln(e){return new this(e).tan()}function un(e){return new this(e).tanh()}function dn(e){return E(e=new this(e),e.e+1,1)}T[Symbol.for(`nodejs.util.inspect.custom`)]=T.toString,T[Symbol.toStringTag]=`Decimal`;var fn=T.constructor=zt(Pe);Me=new fn(Me),Ne=new fn(Ne);var pn=function(e){return e[e.TOKEN=1e5]=`TOKEN`,e[e.DECI_TOKEN=1e4]=`DECI_TOKEN`,e[e.CENTI_TOKEN=1e3]=`CENTI_TOKEN`,e[e.MILLI_TOKEN=100]=`MILLI_TOKEN`,e[e.MICRO_TOKEN=10]=`MICRO_TOKEN`,e[e.ATOMIC=1]=`ATOMIC`,e}({}),mn=function(e){return e.TOKEN=`CMTS`,e.DECI_TOKEN=`dCMTS`,e.CENTI_TOKEN=`cCMTS`,e.MILLI_TOKEN=`mCMTS`,e.MICRO_TOKEN=`μCMTS`,e.ATOMIC=`aCMTS`,e}({}),hn=class e{constructor(e){this.amount=e}static create(e,t=pn.TOKEN){if(t!=pn.TOKEN)throw new y;return this.createCMTS(e)}static createCMTS(e){return this.createSafeCmtsToken(fn(e),fn(pn.TOKEN))}static createDeciToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.DECI_TOKEN))}static createMicroToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.MICRO_TOKEN))}static createMilliToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.MILLI_TOKEN))}static createCentiToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.CENTI_TOKEN))}static createMillionToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.MICRO_TOKEN))}static createAtomic(e){return this.createSafeCmtsToken(fn(e),fn(pn.ATOMIC))}static createSafeCmtsToken(t,n){let r=t.mul(n);if(r.isInteger())return new e(r);throw new v(`Invalid amount: An atomic token should be insecable: got ${r}`)}static zero(){return this.createAtomic(0)}static oneCMTS(){return this.createCMTS(1)}static parse(t){let n=t.trim().match(/^(\d+(?:\.\d+)?)\s*(\S+)$/);if(!n)throw new v(`Invalid token amount format: "${t}"`);let[,r,i]=n,a=parseFloat(r);switch(i){case mn.TOKEN:return e.createCMTS(a);case mn.DECI_TOKEN:return e.createDeciToken(a);case mn.CENTI_TOKEN:return e.createCentiToken(a);case mn.MILLI_TOKEN:return e.createMilliToken(a);case mn.MICRO_TOKEN:return e.createMicroToken(a);case mn.ATOMIC:return e.createAtomic(a);default:throw new y}}getAmount(e=pn.TOKEN){switch(e){case pn.TOKEN:return this.amount.div(fn(pn.TOKEN)).toNumber();case pn.CENTI_TOKEN:return this.amount.div(fn(pn.CENTI_TOKEN)).toNumber();case pn.MILLI_TOKEN:return this.amount.div(fn(pn.MILLI_TOKEN)).toNumber();case pn.DECI_TOKEN:return this.amount.div(fn(pn.DECI_TOKEN)).toNumber();case pn.MICRO_TOKEN:return this.amount.div(fn(pn.MICRO_TOKEN)).toNumber();case pn.ATOMIC:return this.amount.toNumber()}}getAmountAsAtomic(){return this.getAmount(pn.ATOMIC)}getAmountAsCMTS(){return this.getAmount(pn.TOKEN)}isPositive(){return this.amount.isPositive()||this.amount.isZero()}isPositiveStrict(){return this.isPositive()&&!this.isZero()}isNegative(){return this.amount.isNegative()}isZero(){return this.amount.isZero()}equals(e){return this.amount.equals(e.amount)}isGreaterThan(e){return this.amount.gt(e.amount)}isLessThan(e){return this.amount.lt(e.amount)}add(t){return e.createAtomic(this.getAmountAsAtomic()+t.getAmountAsAtomic())}sub(t){return e.createAtomic(this.getAmountAsAtomic()-t.getAmountAsAtomic())}mul(t){return e.createAtomic(this.getAmountAsAtomic()*t)}toString(t=pn.TOKEN){switch(t){case pn.TOKEN:return`${this.getAmountAsCMTS()} ${e.getUnitLabel(t)}`;case pn.ATOMIC:return`${this.getAmountAsAtomic()} ${e.getUnitLabel(t)}`;default:throw new y}}static getUnitLabel(e){switch(e){case pn.TOKEN:return mn.TOKEN;case pn.ATOMIC:return mn.ATOMIC;default:throw new y}}},gn=t({FORMAT:()=>28,HASHABLE:()=>1,HASHED:()=>8,MASKABLE:()=>2,MASKED:()=>16,PROPERTIES:()=>3,REDACTED:()=>4,TYPE_ARRAY:()=>1,TYPE_ARRAY_OF:()=>32,TYPE_BIN256:()=>13,TYPE_BINARY:()=>12,TYPE_BOOLEAN:()=>5,TYPE_HASH_STR:()=>14,TYPE_MAIN:()=>31,TYPE_NAMES:()=>Pn,TYPE_NULL:()=>6,TYPE_NUMBER:()=>4,TYPE_OBJECT:()=>2,TYPE_STRING:()=>3,TYPE_UINT16:()=>8,TYPE_UINT24:()=>9,TYPE_UINT32:()=>10,TYPE_UINT48:()=>11,TYPE_UINT8:()=>7,TYPE_UNKNOWN:()=>0}),_n=0,vn=1,yn=2,bn=3,xn=4,Sn=5,Cn=6,wn=7,Tn=8,En=9,Dn=10,On=11,kn=12,An=13,jn=14,Mn=31,Nn=32,Pn=[`unknown`,`array`,`object`,`string`,`number`,`boolean`,`null`,`uint8`,`uint16`,`uint24`,`uint32`,`uint48`,`binary`,`bin256`,`hashString`],Fn=1,In=2,Ln=3,Rn=4,zn=8,Bn=16,Vn=28,Hn=t({MAGIC_STRING:()=>Un,MAX_MICROBLOCK_FUTURE_DELAY:()=>120,MAX_MICROBLOCK_PAST_DELAY:()=>300,MB_STATUS_PREVIOUS_HASH_ERROR:()=>3,MB_STATUS_TIMESTAMP_ERROR:()=>2,MB_STATUS_UNRECOVERABLE_ERROR:()=>1,N_VIRTUAL_BLOCKCHAINS:()=>6,PROTOCOL_VERSION:()=>1,VB_ACCOUNT:()=>1,VB_APPLICATION:()=>4,VB_APP_LEDGER:()=>5,VB_NAME:()=>Qn,VB_ORGANIZATION:()=>3,VB_PROTOCOL:()=>0,VB_VALIDATOR_NODE:()=>2}),Un=`CMTS`,Wn=1,Gn=0,Kn=1,qn=2,Jn=3,Yn=4,Xn=5,Zn=6,Qn=[`protocol`,`account`,`validator node`,`organization`,`application`,`application ledger`],$n=300,er=120,tr=1,nr=2,rr=3,ir=t({ACCOUNT_ALLOWED_TRANSFERS:()=>Gr,ACCOUNT_BLOCK_FEES:()=>2,ACCOUNT_BURNT_TOKENS:()=>0,ACCOUNT_NAMES:()=>Wr,ACCOUNT_STANDARD:()=>1,BK_EARNED_BLOCK_FEES:()=>3,BK_EARNED_TX_FEES:()=>1,BK_NAMES:()=>Br,BK_PAID_BLOCK_FEES:()=>2,BK_PAID_TX_FEES:()=>0,BK_PLUS:()=>1,BK_PURCHASE:()=>7,BK_RECEIVED_ESCROW:()=>13,BK_RECEIVED_ESCROW_REFUND:()=>15,BK_RECEIVED_EXPIRED_ESCROW:()=>17,BK_RECEIVED_ISSUANCE:()=>5,BK_RECEIVED_PAYMENT:()=>9,BK_RECEIVED_SLASHED_TOKENS:()=>19,BK_RECEIVED_VESTING:()=>11,BK_REFERENCES:()=>zr,BK_REF_BLOCK:()=>0,BK_REF_MICROBLOCK:()=>1,BK_REF_SECTION:()=>2,BK_SALE:()=>6,BK_SENT_ESCROW:()=>12,BK_SENT_ESCROW_REFUND:()=>14,BK_SENT_EXPIRED_ESCROW:()=>16,BK_SENT_ISSUANCE:()=>4,BK_SENT_PAYMENT:()=>8,BK_SENT_SLASHED_TOKENS:()=>18,BK_SENT_VESTING:()=>10,CENTITOKEN:()=>sr,FIXED_GAS_FEE:()=>fr,GAS_ATOMS_PER_GAS:()=>mr,GAS_PER_BYTE:()=>1,INITIAL_OFFER:()=>lr,MAXIMUM_GAS_PRICE:()=>dr,MILLITOKEN:()=>100,MINIMUM_GAS_PRICE:()=>1,TOKEN:()=>or,TOKEN_NAME:()=>ar}),ar=`CMTS`,or=1e5,sr=1e3,cr=100,lr=1e9*or,ur=1,dr=2**29-1,fr=1e3,pr=1,mr=1e5,hr=1,gr=0,_r=2,vr=4,yr=6,br=8,xr=10,Sr=12,Cr=14,wr=16,Tr=18,Er=1,Dr=3,Or=5,kr=7,Ar=9,jr=11,Mr=13,Nr=15,Pr=17,Fr=19,Ir=0,Lr=1,Rr=2,zr=[1,1,0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0],Br=[`Paid TX fees`,`Earned TX fees`,`Paid block fees`,`Earned block fees`,`Sent initial token issuance`,`Received initial token issuance`,`Sale`,`Purchase`,`Sent payment`,`Received payment`,`Sent vesting`,`Received vesting`,`Sent escrow`,`Received escrow`,`Sent escrow refund`,`Received escrow refund`,`Sent expired escrow`,`Received expired escrow`,`Sent slashed tokens`,`Received slashed tokens`],Vr=0,Hr=1,Ur=2,Wr=[`Burnt tokens account`,`Standard account`,`Block fees account`],Gr=[524800,524265,6],Kr=t({ACCOUNT_HISTORY:()=>ai,ACCOUNT_STATE:()=>ii,ALL_SCHEMAS:()=>oa,BLOCK_CONTENT:()=>di,BLOCK_INFORMATION:()=>ui,CONTRACT_PARAMETER_SCHEMA:()=>Jr,CONTRACT_SCHEMA:()=>Yr,ERROR:()=>qr,MICROBLOCK_BODY:()=>_i,MICROBLOCK_HEADER:()=>hi,MICROBLOCK_HEADER_BODY_HASH_OFFSET:()=>58,MICROBLOCK_HEADER_PREVIOUS_HASH_OFFSET:()=>13,MICROBLOCK_HEADER_SIZE:()=>122,MICROBLOCK_SECTION:()=>gi,MICROBLOCK_VB_INFORMATION:()=>vi,MSG_ACCOUNT_BY_PUBLIC_KEY_HASH:()=>22,MSG_ACCOUNT_HISTORY:()=>20,MSG_ACCOUNT_STATE:()=>18,MSG_AWAIT_MICROBLOCK_ANCHORING:()=>13,MSG_BLOCK_CONTENT:()=>6,MSG_BLOCK_INFORMATION:()=>4,MSG_CHAIN_INFORMATION:()=>2,MSG_ERROR:()=>0,MSG_GENESIS_SNAPSHOT:()=>28,MSG_GET_ACCOUNT_BY_PUBLIC_KEY_HASH:()=>21,MSG_GET_ACCOUNT_HISTORY:()=>19,MSG_GET_ACCOUNT_STATE:()=>17,MSG_GET_BLOCK_CONTENT:()=>5,MSG_GET_BLOCK_INFORMATION:()=>3,MSG_GET_CHAIN_INFORMATION:()=>1,MSG_GET_GENESIS_SNAPSHOT:()=>27,MSG_GET_MICROBLOCK_BODYS:()=>15,MSG_GET_MICROBLOCK_INFORMATION:()=>11,MSG_GET_OBJECT_LIST:()=>25,MSG_GET_VALIDATOR_NODE_BY_ADDRESS:()=>23,MSG_GET_VIRTUAL_BLOCKCHAIN_STATE:()=>7,MSG_GET_VIRTUAL_BLOCKCHAIN_UPDATE:()=>9,MSG_MICROBLOCK_ANCHORING:()=>14,MSG_MICROBLOCK_BODYS:()=>16,MSG_MICROBLOCK_INFORMATION:()=>12,MSG_OBJECT_LIST:()=>26,MSG_VALIDATOR_NODE_BY_ADDRESS:()=>24,MSG_VIRTUAL_BLOCKCHAIN_STATE:()=>8,MSG_VIRTUAL_BLOCKCHAIN_UPDATE:()=>10,NODE_MESSAGES:()=>Ji,PROTOCOL_VARIABLES:()=>si,PROTOCOL_VB_STATE:()=>ci,RECORD_DESCRIPTION:()=>ri,VB_STATES:()=>li,VIRTUAL_BLOCKCHAIN_STATE:()=>oi,WIMSG_ANSWER:()=>5,WIMSG_CONNECTION_ACCEPTED:()=>7,WIMSG_CONNECTION_INFO:()=>6,WIMSG_CONNECTION_TOKEN:()=>2,WIMSG_FORWARDED_ANSWER:()=>3,WIMSG_FORWARDED_REQUEST:()=>8,WIMSG_GET_CONNECTION_INFO:()=>4,WIMSG_REQUEST:()=>0,WIMSG_UPDATE_QR:()=>1,WI_MESSAGES:()=>aa,WI_QR_CODE:()=>Yi}),qr={label:`Error`,definition:[{name:`type`,type:7},{name:`id`,type:7},{name:`arg`,type:35}]},Jr={label:`contractParameter`,definition:[{name:`name`,type:3},{name:`type`,type:3},{name:`defaultValue`,type:3},{name:`modifiable`,type:5}]},Yr={label:`contract`,definition:[{name:`name`,type:3},{name:`parametersDefinition`,type:34,schema:Jr}]},Xr={label:`RecordActor`,definition:[{name:`name`,type:3}]},Zr={label:`RecordChannel`,definition:[{name:`name`,type:3},{name:`public`,type:5}]},Qr={label:`RecordChannelAssignation`,definition:[{name:`fieldPath`,type:3},{name:`channelName`,type:3}]},$r={label:`RecordActorAssignation`,definition:[{name:`actorName`,type:3},{name:`channelName`,type:3}]},ei={label:`RecordMaskedPart`,definition:[{name:`position`,type:10},{name:`length`,type:10},{name:`replacementString`,type:3}]},ti={label:`RecordMaskableField`,definition:[{name:`fieldPath`,type:3},{name:`maskedParts`,type:34,schema:ei}]},ni={label:`RecordHashableField`,definition:[{name:`fieldPath`,type:3}]},ri={label:`RecordDescription`,definition:[{name:`applicationId`,type:14},{name:`virtualBlockchainId`,type:14,optional:!0},{name:`data`,type:2,unspecifiedSchema:!0},{name:`actors`,type:34,optional:!0,schema:Xr},{name:`channels`,type:34,optional:!0,schema:Zr},{name:`channelAssignations`,type:34,optional:!0,schema:Qr},{name:`actorAssignations`,type:34,optional:!0,schema:$r},{name:`hashableFields`,type:34,optional:!0,schema:ni},{name:`maskableFields`,type:34,optional:!0,schema:ti},{name:`author`,type:3},{name:`endorser`,type:3,optional:!0},{name:`approvalMessage`,type:3,optional:!0}]},ii={label:`AccountState`,definition:[{name:`height`,type:11},{name:`balance`,type:11},{name:`lastHistoryHash`,type:13},{name:`locks`,type:34,definition:[{name:`type`,type:7},{name:`amount`,type:11},{name:`parameters`,type:12}]}]},ai={label:`AccountHistory`,definition:[{name:`height`,type:11},{name:`previousHistoryHash`,type:13},{name:`type`,type:7},{name:`timestamp`,type:11},{name:`linkedAccount`,type:13},{name:`amount`,type:11},{name:`chainReference`,type:12}]},oi={label:`VirtualBlockchainState`,definition:[{name:`type`,type:7},{name:`expirationDay`,type:10},{name:`height`,type:11},{name:`lastMicroblockHash`,type:13},{name:`serializedInternalState`,type:12}]},si={label:`PROTOCOL_VARIABLES`,definition:[{name:`protocolVersionName`,type:3},{name:`protocolVersion`,type:8},{name:`feesCalculationVersion`,type:8},{name:`globalStateUpdaterVersion`,type:8},{name:`applicationLedgerInternalStateUpdaterVersion`,type:8},{name:`applicationInternalStateUpdaterVersion`,type:8},{name:`organizationInternalStateUpdaterVersion`,type:8},{name:`validatorNodeInternalStateUpdaterVersion`,type:8},{name:`accountInternalStateUpdaterVersion`,type:8},{name:`protocolInternalStateUpdaterVersion`,type:8}]},ci={label:`ProtocolVbState`,definition:[{name:`organizationId`,type:13},{name:`currentProtocolVariables`,type:2,schema:si},{name:`protocolUpdates`,type:34,schema:{label:`PROTOCOL_UPDATE`,definition:[{name:`protocolVersion`,type:8},{name:`changeLog`,type:3},{name:`protocolVariables`,type:2,schema:si},{name:`protocolVersionName`,type:3}]}}]},li=[ci,{label:`AccountVbState`,definition:[{name:`signatureSchemeId`,type:7},{name:`publicKeyHeight`,type:11}]},{label:`ValidatorNodeVbState`,definition:[{name:`organizationId`,type:13},{name:`descriptionHeight`,type:11},{name:`rpcEndpointHeight`,type:11},{name:`networkIntegrationHeight`,type:11}]},{label:`OrganizationVbState`,definition:[{name:`accountId`,type:13},{name:`descriptionHeight`,type:11}]},{label:`ApplicationVbState`,definition:[{name:`organizationId`,type:13},{name:`descriptionHeight`,type:11}]},{label:`AppLedgerVbState`,definition:[{name:`allowedSignatureSchemeIds`,type:39},{name:`allowedPkeSchemeIds`,type:39},{name:`applicationId`,type:13},{name:`channels`,type:34,definition:[{name:`name`,type:3},{name:`isPrivate`,type:5},{name:`creatorId`,type:7}]},{name:`actors`,type:34,definition:[{name:`name`,type:3},{name:`subscribed`,type:5},{name:`signatureKeyHeight`,type:11},{name:`pkeKeyHeight`,type:11},{name:`sharedSecrets`,type:34,definition:[{name:`peerActorId`,type:7},{name:`height`,type:11}]},{name:`invitations`,type:34,definition:[{name:`channelId`,type:7},{name:`height`,type:11}]}]}]}],ui={label:`BlockInformation`,definition:[{name:`hash`,type:13},{name:`timestamp`,type:11},{name:`proposerAddress`,type:12},{name:`size`,type:11},{name:`microblockCount`,type:11}]},di={label:`BlockContent`,definition:[{name:`microblocks`,type:34,definition:[{name:`hash`,type:13},{name:`vbIdentifier`,type:13},{name:`vbType`,type:7},{name:`height`,type:11},{name:`size`,type:11},{name:`sectionCount`,type:11}]}]},fi=13,pi=58,mi=122,hi={label:`MicroblockHeader`,definition:[{name:`magicString`,type:3,size:4},{name:`protocolVersion`,type:8},{name:`microblockType`,type:7},{name:`height`,type:11},{name:`previousHash`,type:13},{name:`timestamp`,type:11},{name:`gas`,type:9},{name:`gasPrice`,type:10},{name:`bodyHash`,type:13},{name:`feesPayerAccount`,type:13}]},gi={label:`MicroblockSection`,definition:[{name:`type`,type:7},{name:`data`,type:12}]},_i={label:`MicroblockBody`,definition:[{name:`body`,type:34,schema:gi}]},vi={label:`MicroblockVbInformation`,definition:[{name:`virtualBlockchainType`,type:7},{name:`virtualBlockchainId`,type:13}]},yi=0,bi=1,xi=2,Si=3,Ci=4,wi=5,Ti=6,Ei=7,Di=8,Oi=9,ki=10,Ai=11,ji=12,Mi=13,Ni=14,Pi=15,Fi=16,Ii=17,Li=18,Ri=19,zi=20,Bi=21,Vi=22,Hi=23,Ui=24,Wi=25,Gi=26,Ki=27,qi=28,Ji=[];Ji[0]={label:`MessageError`,definition:[{name:`error`,type:3}]},Ji[1]={label:`MessageGetChainInformation`,definition:[]},Ji[2]={label:`MessageChainInformation`,definition:[{name:`height`,type:11},{name:`lastBlockTimestamp`,type:11},{name:`microblockCount`,type:11},{name:`objectCounts`,type:43,size:6}]},Ji[3]={label:`MessageGetBlockInformation`,definition:[{name:`height`,type:11}]},Ji[4]={label:`MessageBlockInformation`,definition:ui.definition},Ji[5]={label:`MessageGetBlockContent`,definition:[{name:`height`,type:11}]},Ji[6]={label:`MessageBlockContent`,definition:di.definition},Ji[7]={label:`MessageGetVirtualBlockchainState`,definition:[{name:`virtualBlockchainId`,type:13}]},Ji[8]={label:`MessageVirtualBlockchainState`,definition:[{name:`stateData`,type:12}]},Ji[9]={label:`MessageGetVirtualBlockchainUpdate`,definition:[{name:`virtualBlockchainId`,type:13},{name:`knownHeight`,type:11}]},Ji[10]={label:`MessageVirtualBlockchainUpdate`,definition:[{name:`exists`,type:5},{name:`changed`,type:5},{name:`stateData`,type:12},{name:`headers`,type:44}]},Ji[11]={label:`MessageGetMicroblockInformation`,definition:[{name:`hash`,type:13}]},Ji[12]={label:`MessageMicroblockInformation`,definition:[{name:`virtualBlockchainType`,type:7},{name:`virtualBlockchainId`,type:13},{name:`header`,type:12}]},Ji[13]={label:`MessageAwaitMicroblockAnchoring`,definition:[{name:`hash`,type:13}]},Ji[14]={label:`MessageMicroblockAnchoring`,definition:vi.definition},Ji[15]={label:`MessageGetMicroblockBodys`,definition:[{name:`hashes`,type:45}]},Ji[16]={label:`MessageMicroblockBodys`,definition:[{name:`list`,type:34,definition:[{name:`hash`,type:13},{name:`body`,type:12}]}]},Ji[17]={label:`MessageGetAccountState`,definition:[{name:`accountHash`,type:13}]},Ji[18]={label:`MessageAccountState`,definition:ii.definition},Ji[19]={label:`MessageGetAccountHistory`,definition:[{name:`accountHash`,type:13},{name:`lastHistoryHash`,type:13},{name:`maxRecords`,type:8}]},Ji[20]={label:`MessageAccountHistory`,definition:[{name:`list`,type:34,schema:ai}]},Ji[21]={label:`MessageGetAccountByPublicKeyHash`,definition:[{name:`publicKeyHash`,type:13}]},Ji[22]={label:`MessageAccountByPublicKeyHash`,definition:[{name:`accountHash`,type:13}]},Ji[23]={label:`MessageGetValidatorNodeByAddress`,definition:[{name:`address`,type:12}]},Ji[24]={label:`MessageValidatorNodeByAddress`,definition:[{name:`validatorNodeHash`,type:13}]},Ji[25]={label:`MessageGetObjectList`,definition:[{name:`type`,type:7}]},Ji[26]={label:`MessageObjectList`,definition:[{name:`list`,type:45}]},Ji[27]={label:`MessageGetGenesisSnapshot`,definition:[]},Ji[28]={label:`MessageGenesisSnapshot`,definition:[{name:`base64EncodedChunks`,type:35}]};var Yi={label:`WiQrCode`,definition:[{name:`qrId`,type:13},{name:`timestamp`,type:11},{name:`serverUrl`,type:3,size:100}]},Xi=0,Zi=1,Qi=2,$i=3,ea=4,ta=5,na=6,ra=7,ia=8,aa=[];aa[0]={label:`WiMsgRequest`,definition:[{name:`requestType`,type:7},{name:`request`,type:12},{name:`deviceId`,type:13},{name:`withToken`,type:7}]},aa[1]={label:`WiMsgUpdateQr`,definition:[{name:`qrId`,type:13},{name:`timestamp`,type:11}]},aa[2]={label:`WiMsgConnectionToken`,definition:[{name:`token`,type:13}]},aa[3]={label:`WiMsgForwardedAnswer`,definition:[{name:`answerType`,type:7},{name:`answer`,type:12}]},aa[4]={label:`WiMsgGetConnectionInfo`,definition:[{name:`qrId`,type:13}]},aa[5]={label:`WiMsgAnswer`,definition:[{name:`answerType`,type:7},{name:`answer`,type:12}]},aa[6]={label:`WiMsgConnectionInfo`,definition:[]},aa[7]={label:`WiMsgConnectionAccepted`,definition:[{name:`qrId`,type:13}]},aa[8]={label:`WiMsgForwardedRequest`,definition:[{name:`requestType`,type:7},{name:`request`,type:12}]};var oa={singles:[Xr,Zr,Qr,$r,ei,ti,ni,ri,hi,gi,_i,vi,Yi],collections:[{label:`VbState`,list:li},{label:`NodeMessage`,list:Ji},{label:`WiMessage`,list:aa}]},D=function(e){return e[e.AUXILIARY_SIGNATURE=126]=`AUXILIARY_SIGNATURE`,e[e.SIGNATURE=127]=`SIGNATURE`,e[e.ALLOWED_ADDITIONAL_WRITER=128]=`ALLOWED_ADDITIONAL_WRITER`,e[e.CUSTOM=129]=`CUSTOM`,e[e.PROTOCOL_CREATION=1]=`PROTOCOL_CREATION`,e[e.PROTOCOL_UPDATE=2]=`PROTOCOL_UPDATE`,e[e.PROTOCOL_VARIABLES=5]=`PROTOCOL_VARIABLES`,e[e.ACCOUNT_PUBLIC_KEY=17]=`ACCOUNT_PUBLIC_KEY`,e[e.ACCOUNT_TOKEN_ISSUANCE=18]=`ACCOUNT_TOKEN_ISSUANCE`,e[e.ACCOUNT_CREATION=19]=`ACCOUNT_CREATION`,e[e.ACCOUNT_TRANSFER=20]=`ACCOUNT_TRANSFER`,e[e.ACCOUNT_VESTING_TRANSFER=21]=`ACCOUNT_VESTING_TRANSFER`,e[e.ACCOUNT_ESCROW_TRANSFER=22]=`ACCOUNT_ESCROW_TRANSFER`,e[e.ACCOUNT_ESCROW_SETTLEMENT=23]=`ACCOUNT_ESCROW_SETTLEMENT`,e[e.ACCOUNT_STAKE=24]=`ACCOUNT_STAKE`,e[e.ACCOUNT_UNSTAKE=25]=`ACCOUNT_UNSTAKE`,e[e.VN_CREATION=33]=`VN_CREATION`,e[e.VN_COMETBFT_PUBLIC_KEY_DECLARATION=34]=`VN_COMETBFT_PUBLIC_KEY_DECLARATION`,e[e.VN_RPC_ENDPOINT=35]=`VN_RPC_ENDPOINT`,e[e.VN_APPROVAL=36]=`VN_APPROVAL`,e[e.VN_SLASHING_CANCELLATION=37]=`VN_SLASHING_CANCELLATION`,e[e.ORG_CREATION=52]=`ORG_CREATION`,e[e.ORG_DESCRIPTION=50]=`ORG_DESCRIPTION`,e[e.APP_CREATION=65]=`APP_CREATION`,e[e.APP_DESCRIPTION=66]=`APP_DESCRIPTION`,e[e.APP_LEDGER_ALLOWED_SIG_SCHEMES=80]=`APP_LEDGER_ALLOWED_SIG_SCHEMES`,e[e.APP_LEDGER_ALLOWED_PKE_SCHEMES=81]=`APP_LEDGER_ALLOWED_PKE_SCHEMES`,e[e.APP_LEDGER_CREATION=82]=`APP_LEDGER_CREATION`,e[e.APP_LEDGER_ACTOR_CREATION=83]=`APP_LEDGER_ACTOR_CREATION`,e[e.APP_LEDGER_CHANNEL_CREATION=84]=`APP_LEDGER_CHANNEL_CREATION`,e[e.APP_LEDGER_SHARED_SECRET=85]=`APP_LEDGER_SHARED_SECRET`,e[e.APP_LEDGER_CHANNEL_INVITATION=86]=`APP_LEDGER_CHANNEL_INVITATION`,e[e.APP_LEDGER_ACTOR_SUBSCRIPTION=87]=`APP_LEDGER_ACTOR_SUBSCRIPTION`,e[e.APP_LEDGER_PUBLIC_CHANNEL_DATA=88]=`APP_LEDGER_PUBLIC_CHANNEL_DATA`,e[e.APP_LEDGER_PRIVATE_CHANNEL_DATA=89]=`APP_LEDGER_PRIVATE_CHANNEL_DATA`,e[e.APP_LEDGER_AUTHOR=90]=`APP_LEDGER_AUTHOR`,e[e.APP_LEDGER_ENDORSEMENT_REQUEST=91]=`APP_LEDGER_ENDORSEMENT_REQUEST`,e}({}),sa=t({ACCOUNT_CREATION:()=>ha,ACCOUNT_ESCROW_SETTLEMENT:()=>ya,ACCOUNT_ESCROW_TRANSFER:()=>va,ACCOUNT_PUBLIC_KEY:()=>pa,ACCOUNT_STAKE:()=>ba,ACCOUNT_TOKEN_ISSUANCE:()=>ma,ACCOUNT_TRANSFER:()=>ga,ACCOUNT_VESTING_TRANSFER:()=>_a,ALL_SECTIONS_SCHEMAS:()=>Ka,APP_CREATION:()=>Aa,APP_DESCRIPTION:()=>ja,APP_LEDGER_ACTOR_CREATION:()=>Ia,APP_LEDGER_ACTOR_SUBSCRIPTION:()=>Ba,APP_LEDGER_ALLOWED_PKE_SCHEMES:()=>Pa,APP_LEDGER_ALLOWED_SIG_SCHEMES:()=>Na,APP_LEDGER_AUTHOR:()=>Ua,APP_LEDGER_CHANNEL_CREATION:()=>La,APP_LEDGER_CHANNEL_INVITATION:()=>za,APP_LEDGER_CREATION:()=>Fa,APP_LEDGER_ENDORSEMENT_REQUEST:()=>Wa,APP_LEDGER_PRIVATE_CHANNEL_DATA:()=>Ha,APP_LEDGER_PUBLIC_CHANNEL_DATA:()=>Va,APP_LEDGER_SHARED_SECRET:()=>Ra,DEF:()=>qa,ORG_CREATION:()=>Da,ORG_DESCRIPTION:()=>Oa,PROTOCOL_CREATION:()=>ua,PROTOCOL_UPDATE:()=>da,SIGNATURE:()=>ca,SIGNATURE_SCHEMA:()=>la,VN_APPROVAL:()=>Ta,VN_COMETBFT_PUBLIC_KEY_DECLARATION:()=>Ca,VN_CREATION:()=>Sa,VN_RPC_ENDPOINT:()=>wa}),ca=D.SIGNATURE,la={label:`SIGNATURE`,definition:[{name:`schemeId`,type:7},{name:`signature`,type:12}]},ua=D.PROTOCOL_CREATION,da=D.PROTOCOL_UPDATE,fa=[];fa[ua]={label:`PROTOCOL_CREATION`,definition:[{name:`organizationId`,type:13}]},fa[da]={label:`PROTOCOL_VARIABLES_UPDATE`,definition:[{name:`protocolVersion`,type:8},{name:`protocolVersionName`,type:3},{name:`changeLog`,type:3},{name:`protocolVariables`,type:2,schema:si}]};var pa=D.ACCOUNT_PUBLIC_KEY,ma=D.ACCOUNT_TOKEN_ISSUANCE,ha=D.ACCOUNT_CREATION,ga=D.ACCOUNT_TRANSFER,_a=D.ACCOUNT_VESTING_TRANSFER,va=D.ACCOUNT_ESCROW_TRANSFER,ya=D.ACCOUNT_ESCROW_SETTLEMENT,ba=D.ACCOUNT_STAKE,xa=[];xa[pa]={label:`ACCOUNT_PUBLIC_KEY`,definition:[{name:`publicKey`,type:12},{name:`schemeId`,type:7}]},xa[ma]={label:`ACCOUNT_TOKEN_ISSUANCE`,definition:[{name:`amount`,type:11}]},xa[ha]={label:`ACCOUNT_CREATION`,definition:[{name:`sellerAccount`,type:13},{name:`amount`,type:11}]},xa[ga]={label:`ACCOUNT_TRANSFER`,definition:[{name:`account`,type:13},{name:`amount`,type:11},{name:`publicReference`,type:3},{name:`privateReference`,type:3}]},xa[_a]={label:`ACCOUNT_VESTING_TRANSFER`,definition:[{name:`account`,type:13},{name:`amount`,type:11},{name:`publicReference`,type:3},{name:`privateReference`,type:3},{name:`cliffDurationDays`,type:8},{name:`vestingDurationDays`,type:8}]},xa[va]={label:`ACCOUNT_ESCROW_TRANSFER`,definition:[{name:`account`,type:13},{name:`amount`,type:11},{name:`publicReference`,type:3},{name:`privateReference`,type:3},{name:`escrowIdentifier`,type:13},{name:`agentAccount`,type:13},{name:`durationDays`,type:8}]},xa[ya]={label:`ACCOUNT_ESCROW_SETTLEMENT`,definition:[{name:`confirmed`,type:5},{name:`escrowIdentifier`,type:13}]},xa[ba]={label:`ACCOUNT_STAKE`,definition:[{name:`amount`,type:11},{name:`objectType`,type:7},{name:`objectIdentifier`,type:13}]};var Sa=D.VN_CREATION,Ca=D.VN_COMETBFT_PUBLIC_KEY_DECLARATION,wa=D.VN_RPC_ENDPOINT,Ta=D.VN_APPROVAL,Ea=[];Ea[Sa]={label:`VN_CREATION`,definition:[{name:`organizationId`,type:13}]},Ea[Ca]={label:`VN_COMETBFT_PUBLIC_KEY_DECLARATION`,definition:[{name:`cometPublicKeyType`,type:3},{name:`cometPublicKey`,type:3}]},Ea[wa]={label:`VN_RPC_ENDPOINT`,definition:[{name:`rpcEndpoint`,type:3}]},Ea[Ta]={label:`VN_APPROVAL`,definition:[{name:`status`,type:5}]};var Da=D.ORG_CREATION,Oa=D.ORG_DESCRIPTION,ka=[];ka[Da]={label:`ORG_CREATION`,definition:[{name:`accountId`,type:13}]},ka[Oa]={label:`ORG_DESCRIPTION`,definition:[{name:`name`,type:3},{name:`city`,type:3},{name:`countryCode`,type:3,size:2},{name:`website`,type:3}]};var Aa=D.APP_CREATION,ja=D.APP_DESCRIPTION,Ma=[];Ma[Aa]={label:`APP_CREATION`,definition:[{name:`organizationId`,type:13}]},Ma[ja]={label:`APP_DESCRIPTION`,definition:[{name:`name`,type:3},{name:`logoUrl`,type:3},{name:`homepageUrl`,type:3},{name:`description`,type:3}]};var Na=D.APP_LEDGER_ALLOWED_SIG_SCHEMES,Pa=D.APP_LEDGER_ALLOWED_PKE_SCHEMES,Fa=D.APP_LEDGER_CREATION,Ia=D.APP_LEDGER_ACTOR_CREATION,La=D.APP_LEDGER_CHANNEL_CREATION,Ra=D.APP_LEDGER_SHARED_SECRET,za=D.APP_LEDGER_CHANNEL_INVITATION,Ba=D.APP_LEDGER_ACTOR_SUBSCRIPTION,Va=D.APP_LEDGER_PUBLIC_CHANNEL_DATA,Ha=D.APP_LEDGER_PRIVATE_CHANNEL_DATA,Ua=D.APP_LEDGER_AUTHOR,Wa=D.APP_LEDGER_ENDORSEMENT_REQUEST,Ga=[];Ga[Na]={label:`APP_LEDGER_ALLOWED_SIG_SCHEMES`,definition:[{name:`schemeIds`,type:39}]},Ga[Pa]={label:`APP_LEDGER_ALLOWED_PKE_SCHEMES`,definition:[{name:`schemeIds`,type:39}]},Ga[Fa]={label:`APP_LEDGER_CREATION`,definition:[{name:`applicationId`,type:13}]},Ga[Ia]={label:`APP_LEDGER_ACTOR_CREATION`,definition:[{name:`id`,type:7},{name:`type`,type:7},{name:`name`,type:3}]},Ga[La]={label:`APP_LEDGER_CHANNEL_CREATION`,definition:[{name:`id`,type:7},{name:`isPrivate`,type:5},{name:`creatorId`,type:7},{name:`name`,type:3}]},Ga[Ra]={label:`APP_LEDGER_SHARED_SECRET`,definition:[{name:`hostId`,type:7},{name:`guestId`,type:7},{name:`encryptedSharedKey`,type:12}]},Ga[za]={label:`APP_LEDGER_CHANNEL_INVITATION`,definition:[{name:`channelId`,type:7},{name:`hostId`,type:7},{name:`guestId`,type:7},{name:`encryptedChannelKey`,type:12}]},Ga[Ba]={label:`APP_LEDGER_ACTOR_SUBSCRIPTION`,definition:[{name:`actorId`,type:7},{name:`actorType`,type:7},{name:`organizationId`,type:13},{name:`signatureSchemeId`,type:7},{name:`signaturePublicKey`,type:12},{name:`pkeSchemeId`,type:7},{name:`pkePublicKey`,type:12}]},Ga[Va]={label:`APP_LEDGER_PUBLIC_CHANNEL_DATA`,definition:[{name:`channelId`,type:7},{name:`data`,type:12}]},Ga[Ha]={label:`APP_LEDGER_PRIVATE_CHANNEL_DATA`,definition:[{name:`channelId`,type:7},{name:`merkleRootHash`,type:13},{name:`encryptedData`,type:12}]},Ga[Ua]={label:`APP_LEDGER_AUTHOR`,definition:[{name:`authorId`,type:7}]},Ga[Wa]={label:`APP_LEDGER_ENDORSEMENT_REQUEST`,definition:[{name:`endorserId`,type:7},{name:`message`,type:3}]};var Ka={...fa,...xa,...Ea,...ka,...Ma,...Ga},qa=[fa,xa,Ea,ka,Ma,Ga],Ja=t({WI_INVALID_SIGNATURE:()=>0}),Ya=0,Xa=function(e){return e[e.SECP256K1=0]=`SECP256K1`,e[e.ML_DSA_65=1]=`ML_DSA_65`,e[e.PKMS_SECP256K1=2]=`PKMS_SECP256K1`,e[e.ED25519=3]=`ED25519`,e}({}),Za=new TextEncoder,Qa=new TextDecoder,$a={encode:eo,decode:to};function eo(e){return Za.encode(e)}function to(e){return Qa.decode(e)}var no=class extends m{constructor(e){super(e,n.TYPE_CHECKING_FAILURE_ERROR)}},ro=126,io=class{static getType(e){switch(typeof e){case`string`:return 3;case`number`:return 4;case`boolean`:return 5;case`object`:if(e===null)return 6;if(Array.isArray(e))return 1;if(e instanceof Uint8Array)return 12;if(Object.getPrototypeOf(e).isPrototypeOf(Object))return 2}return 0}static isJsonType(e){return ro>>e&1}},ao=class{basicType;definition;value;constructor(e,t){this.definition=e,this.value=t,this.basicType=io.getType(t)}check(){let e=this.definition.type&31;switch(e){case 3:this.isString();break;case 4:this.isNumber();break;case 5:this.isBoolean();break;case 7:this.isUnsignedInteger(8);break;case 8:this.isUnsignedInteger(16);break;case 9:this.isUnsignedInteger(24);break;case 10:this.isUnsignedInteger(32);break;case 11:this.isUnsignedInteger(48);break;case 12:this.isBinary();break;case 13:this.isBinary(32);break;case 14:this.isHashString();break;default:throw`unexpected definition type ${e}`}}isString(){if(this.basicType!=3)throw`string expected`;if(this.definition.size){let e=$a.encode(this.value);this.checkSize(e.length,this.definition.size)}}isNumber(){if(this.basicType!=4)throw`number expected`}isBoolean(){if(this.basicType!=5)throw`Boolean value expected`}isInteger(){if(this.isNumber(),this.value%1)throw`integer expected`;if(this.value<-(2**53-1)||this.value>2**53-1)throw`value is outside the safe integer range`}isUnsignedInteger(e){if(this.isInteger(),this.value<0)throw new no(`non-negative value expected`);if(this.value>=2**e)throw Error(`value is too big (${e}-bit value expected)`)}isBinary(e){if(this.basicType!=12)throw`Uint8Array expected`;this.checkSize(this.value.length,e||this.definition.size)}isHashString(){if(this.isString(),this.checkSize(this.value.length,64),/[^\da-f]/i.test(this.value))throw`hexadecimal string expected`}checkSize(e,t){if(t!==void 0&&e!=t)throw`invalid size (expecting ${t}, got ${e})`}};function oo(e){return typeof e==`function`?e:so(e)}function so(e){if(e==null)return()=>!1;if(e===`fatal`)return e=>e.level===`fatal`;if(e===`error`)return e=>e.level===`fatal`||e.level===`error`;if(e===`warning`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`;if(e===`info`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`;if(e===`debug`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`||e.level===`debug`;if(e===`trace`)return()=>!0;throw TypeError(`Invalid log level: ${e}.`)}var co=[`trace`,`debug`,`info`,`warning`,`error`,`fatal`];function lo(e,t){let n=co.indexOf(e);if(n<0)throw TypeError(`Invalid log level: ${JSON.stringify(e)}.`);let r=co.indexOf(t);if(r<0)throw TypeError(`Invalid log level: ${JSON.stringify(t)}.`);return n-r}function uo(e=[]){return po.getLogger(e)}var fo=Symbol.for(`logtape.rootLogger`),po=class e{parent;children;category;sinks;parentSinks=`inherit`;filters;lowestLevel=`trace`;contextLocalStorage;static getLogger(t=[]){let n=fo in globalThis?globalThis[fo]??null:null;return n??(n=new e(null,[]),globalThis[fo]=n),typeof t==`string`?n.getChild(t):t.length===0?n:n.getChild(t)}constructor(e,t){this.parent=e,this.children={},this.category=t,this.sinks=[],this.filters=[]}getChild(t){let n=typeof t==`string`?t:t[0],r=this.children[n],i=r instanceof e?r:r?.deref();return i??(i=new e(this,[...this.category,n]),this.children[n]=`WeakRef`in globalThis?new WeakRef(i):i),typeof t==`string`||t.length===1?i:i.getChild(t.slice(1))}reset(){for(;this.sinks.length>0;)this.sinks.shift();for(this.parentSinks=`inherit`;this.filters.length>0;)this.filters.shift();this.lowestLevel=`trace`}resetDescendants(){for(let t of Object.values(this.children))(t instanceof e?t:t.deref())?.resetDescendants();this.reset()}with(e){return new mo(this,{...e})}filter(e){for(let t of this.filters)if(!t(e))return!1;return this.filters.length<1?this.parent?.filter(e)??!0:!0}*getSinks(e){if(!(this.lowestLevel===null||lo(e,this.lowestLevel)<0)){if(this.parent!=null&&this.parentSinks===`inherit`)for(let t of this.parent.getSinks(e))yield t;for(let e of this.sinks)yield e}}emit(e,t){let n=wo(),r=`category`in e?e.category:this.category,i=n.length>0?[...n,...r]:r,a=Object.getOwnPropertyDescriptors(e);a.category={value:i,enumerable:!0,configurable:!0};let o=Object.defineProperties({},a);if(!(this.lowestLevel===null||lo(o.level,this.lowestLevel)<0||!this.filter(o))){for(let e of this.getSinks(o.level))if(!t?.has(e))try{e(o)}catch(n){let r=new Set(t);r.add(e),ho.log(`fatal`,`Failed to emit a log record to sink {sink}: {error}`,{sink:e,error:n,record:o},r)}}}log(e,t,n,r){let i=To(),a,o=typeof n==`function`?{category:this.category,level:e,timestamp:Date.now(),get message(){return xo(t,this.properties)},rawMessage:t,get properties(){return a??={...i,...n()},a}}:{category:this.category,level:e,timestamp:Date.now(),message:xo(t,{...i,...n}),rawMessage:t,properties:{...i,...n}};this.emit(o,r)}logLazily(e,t,n={}){let r=To(),i,a;function o(){if((a==null||i==null)&&(a=t((e,...t)=>(i=e,So(e,t))),i==null))throw TypeError(`No log record was made.`);return[a,i]}this.emit({category:this.category,level:e,get message(){return o()[0]},get rawMessage(){return o()[1]},timestamp:Date.now(),properties:{...r,...n}})}logTemplate(e,t,n,r={}){let i=To();this.emit({category:this.category,level:e,message:So(t,n),rawMessage:t,timestamp:Date.now(),properties:{...i,...r}})}trace(e,...t){typeof e==`string`?this.log(`trace`,e,t[0]??{}):typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){typeof e==`string`?this.log(`debug`,e,t[0]??{}):typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){typeof e==`string`?this.log(`info`,e,t[0]??{}):typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){typeof e==`string`?this.log(`warning`,e,t[0]??{}):typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){this.warn(e,...t)}error(e,...t){typeof e==`string`?this.log(`error`,e,t[0]??{}):typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){typeof e==`string`?this.log(`fatal`,e,t[0]??{}):typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}},mo=class e{logger;properties;constructor(e,t){this.logger=e,this.properties=t}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(e){return this.logger.getChild(e).with(this.properties)}with(t){return new e(this.logger,{...this.properties,...t})}log(e,t,n,r){this.logger.log(e,t,typeof n==`function`?()=>({...this.properties,...n()}):{...this.properties,...n},r)}logLazily(e,t){this.logger.logLazily(e,t,this.properties)}logTemplate(e,t,n){this.logger.logTemplate(e,t,n,this.properties)}emit(e){let t={...e,properties:{...this.properties,...e.properties}};this.logger.emit(t)}trace(e,...t){typeof e==`string`?this.log(`trace`,e,t[0]??{}):typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){typeof e==`string`?this.log(`debug`,e,t[0]??{}):typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){typeof e==`string`?this.log(`info`,e,t[0]??{}):typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){typeof e==`string`?this.log(`warning`,e,t[0]??{}):typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){this.warn(e,...t)}error(e,...t){typeof e==`string`?this.log(`error`,e,t[0]??{}):typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){typeof e==`string`?this.log(`fatal`,e,t[0]??{}):typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}},ho=po.getLogger([`logtape`,`meta`]);function go(e){return e.includes(`.`)||e.includes(`[`)||e.includes(`?.`)}function _o(e,t){if(!(t===`__proto__`||t===`prototype`||t===`constructor`)&&(typeof e==`object`||typeof e==`function`)&&e!==null)return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function vo(e,t){let n=e.length,r=t;if(r>=n)return null;let i;if(e[r]===`[`){if(r++,r>=n)return null;if(e[r]===`"`||e[r]===`'`){let t=e[r];r++;let a=``;for(;r<n&&e[r]!==t;)if(e[r]===`\\`){if(r++,r<n){let t=e[r];switch(t){case`n`:a+=`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=function(e){return e[e.CARMENTIS_ERROR=0]=`CARMENTIS_ERROR`,e[e.NODE_ERROR=1]=`NODE_ERROR`,e[e.NODE_NOT_AVAILABLE_DURING_SYNCHRONISATION_ERROR=2]=`NODE_NOT_AVAILABLE_DURING_SYNCHRONISATION_ERROR`,e[e.INTERNAL_ERROR=500]=`INTERNAL_ERROR`,e[e.TYPE_CHECKING_FAILURE_ERROR=501]=`TYPE_CHECKING_FAILURE_ERROR`,e[e.SERIALIZATION_ERROR=502]=`SERIALIZATION_ERROR`,e[e.PROOF_VERIFICATION_FAILURE=300]=`PROOF_VERIFICATION_FAILURE`,e[e.BLOCKCHAIN_ERROR=100]=`BLOCKCHAIN_ERROR`,e[e.ACCOUNT_NOT_FOUND=101]=`ACCOUNT_NOT_FOUND`,e[e.ACCOUNT_ALREADY_EXISTS=102]=`ACCOUNT_ALREADY_EXISTS`,e[e.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY=103]=`ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY`,e[e.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY_HASH=104]=`ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY_HASH`,e[e.ACCOUNT_ALREADY_EXISTS_FOR_PUBLIC_KEY=105]=`ACCOUNT_ALREADY_EXISTS_FOR_PUBLIC_KEY`,e[e.ACCOUNT_NOT_FOUND_FOR_ADDRESS=106]=`ACCOUNT_NOT_FOUND_FOR_ADDRESS`,e[e.ORGANIZATION_NOT_FOUND=107]=`ORGANIZATION_NOT_FOUND`,e[e.APPLICATION_NOT_FOUND=108]=`APPLICATION_NOT_FOUND`,e[e.APPLICATION_LEDGER_NOT_FOUND=109]=`APPLICATION_LEDGER_NOT_FOUND`,e[e.VALIDATOR_NODE_NOT_FOUND=110]=`VALIDATOR_NODE_NOT_FOUND`,e[e.VIRTUAL_BLOCKCHAIN_NOT_FOUND=111]=`VIRTUAL_BLOCKCHAIN_NOT_FOUND`,e[e.VIRTUAL_BLOCKCHAIN_ALREADY_EXISTS=112]=`VIRTUAL_BLOCKCHAIN_ALREADY_EXISTS`,e[e.MICROBLOCK_STRUCTURE_CHECKING_ERROR=113]=`MICROBLOCK_STRUCTURE_CHECKING_ERROR`,e[e.ECONOMICS_ERROR=200]=`ECONOMICS_ERROR`,e[e.INVALID_TOKEN_UNIT=201]=`INVALID_TOKEN_UNIT`,e[e.PROTOCOL_ERROR=400]=`PROTOCOL_ERROR`,e}({}),r=class extends Error{},i=class extends r{},a=class extends r{},o=class e extends Error{constructor(e,t=n.CARMENTIS_ERROR){super(`[error ${t}] ${e}`),this.code=t}getErrorCode(){return this.code}static isCarmentisError(t){return t instanceof e}},s=class extends o{constructor(e){super(`Microblock structure checking error: ${e??`Not specified`}`,n.MICROBLOCK_STRUCTURE_CHECKING_ERROR)}},c=class extends o{constructor(){super(`You are not authenticated`)}},l=class extends o{constructor(e=`Parsing failure`){super(e)}},u=class extends o{constructor(e){super(e,n.BLOCKCHAIN_ERROR)}},d=class extends o{},f=class extends d{constructor(e){super(e??`Decryption failure`)}},p=class extends f{constructor(e){super(e)}},m=class extends o{},h=class extends m{},g=class extends h{constructor(e){super(`Connection with node at ${e} refused`,n.NODE_ERROR)}},_=class extends h{constructor(){super(`Query rejected while catching up`,n.NODE_ERROR)}},v=class extends o{constructor(e,t=n.ECONOMICS_ERROR){super(e,t)}},y=class extends v{constructor(){super(`Invalid unit type`,n.INVALID_TOKEN_UNIT)}},b=class extends o{constructor(e,t=n.BLOCKCHAIN_ERROR){super(e,t)}},ee=class extends Error{constructor(){super(`No implemented`)}},x=class extends b{constructor(e,t){super(`MicroBlock in virtual blockchain ${e.encode()} not found at height ${t}`)}},te=class extends b{constructor(){super(`MicroBlock not found`)}},ne=class extends b{constructor(){super(`MicroBlock not found in block`)}},re=class extends r{constructor(e){super(`Actor '${e}' already defined`)}},ie=class extends r{constructor(e,t){super(`invalid actor ID ${e} (expected ID: ${t})`)}},ae=class extends r{constructor(e){super(`Channel '${e}' already defined`)}},oe=class extends r{constructor(e){super(`Unknown actor '${e}'`)}},se=class extends r{constructor(e){super(`Unknown channel '${e}'`)}},ce=class extends o{constructor(e,t,r){super(`Proof verification failed on channel ${e} (computed hash is ${t}, on-chain hash is ${r})`,n.PROOF_VERIFICATION_FAILURE)}},le=class extends r{constructor(e){super(`Cannot subscribe as undefined actor ${e}`)}},S=class extends r{constructor(e){super(`Actor ${e} is already subscribed`)}},ue=class extends r{constructor(e){super(`signature scheme of type ${e} is not allowed on this application ledger`)}},de=class extends r{constructor(e){super(`PKE scheme of type ${e} is not allowed on this application ledger`)}},fe=class extends r{constructor(e){super(`Invalid channel ID ${e}`)}},pe=class extends r{constructor(){super(`Current actor not found`)}},me=class extends b{},he=class extends b{constructor(e,t){super(`Actor ${e} has not been invited to channel ${t}`)}},ge=class extends b{constructor(e){super(`Account not found for public key`)}},_e=class extends b{constructor(e){super(`Account not found for account hash: ${e.encode()}`,n.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY)}},ve=class extends b{constructor(e){super(`Organization not found for hash: ${e.encode()}`,n.ORGANIZATION_NOT_FOUND)}},ye=class extends b{constructor(e){super(`Application not found for id: ${e.encode()}`,n.APPLICATION_NOT_FOUND)}},be=class extends b{constructor(e){super(`Validator node not found for id: ${e.encode()}`,n.VALIDATOR_NODE_NOT_FOUND)}},xe=class extends b{constructor(e){super(`Account not found for public key hash: ${e.encode()}`,n.ACCOUNT_NOT_FOUND_FOR_PUBLIC_KEY_HASH)}},Se=class extends b{constructor(e){super(`Virtual blockchain not found: ${e.encode()}`,n.VIRTUAL_BLOCKCHAIN_NOT_FOUND)}},Ce=class extends Se{constructor(e){super(e)}},we=class extends o{constructor(e,t=n.PROTOCOL_ERROR){super(`/!\\ `+e,t)}},Te=class extends we{constructor(e,t){super(`Actor ${t} (id ${e}) has not subscribed to a public encryption key.`),this.actorId=e,this.actorName=t}getNotSubscribedActorName(){return this.actorName}},Ee=class extends we{constructor(){super(`Section not found`)}},De=class extends we{constructor(e,t){super(`No shared secret between host ${t} and guest ${e}`)}},Oe=class extends o{constructor(e){super(e,n.SERIALIZATION_ERROR)}},ke=9e15,Ae=1e9,je=`0123456789abcdef`,Me=`2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058`,Ne=`3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789`,Pe={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ke,maxE:ke,crypto:!1},Fe,Ie,C=!0,Le=`[DecimalError] `,Re=Le+`Invalid argument: `,ze=Le+`Precision limit exceeded`,Be=Le+`crypto unavailable`,Ve=`[object Decimal]`,He=Math.floor,Ue=Math.pow,We=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Ge=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ke=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,qe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Je=1e7,w=7,Ye=9007199254740991,Xe=Me.length-1,Ze=Ne.length-1,T={toStringTag:Ve};T.absoluteValue=T.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),E(e)},T.ceil=function(){return E(new this.constructor(this),this.e+1,2)},T.clampedTo=T.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Re+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)},T.comparedTo=T.cmp=function(e){var t,n,r,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,c=a.s,l=e.s;if(!o||!s)return!c||!l?NaN:c===l?o===s?0:!o^c<0?1:-1:c;if(!o[0]||!s[0])return o[0]?c:s[0]?-l:0;if(c!==l)return c;if(a.e!==e.e)return a.e>e.e^c<0?1:-1;for(r=o.length,i=s.length,t=0,n=r<i?r:i;t<n;++t)if(o[t]!==s[t])return o[t]>s[t]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},T.cosine=T.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+w,r.rounding=1,n=nt(r,xt(r,n)),r.precision=e,r.rounding=t,E(Ie==2||Ie==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)},T.cubeRoot=T.cbrt=function(){var e,t,n,r,i,a,o,s,c,l,u=this,d=u.constructor;if(!u.isFinite()||u.isZero())return new d(u);for(C=!1,a=u.s*Ue(u.s*u,1/3),!a||Math.abs(a)==1/0?(n=Qe(u.d),e=u.e,(a=(e-n.length+1)%3)&&(n+=a==1||a==-2?`0`:`00`),a=Ue(n,1/3),e=He((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?n=`5e`+e:(n=a.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+e),r=new d(n),r.s=u.s):r=new d(a.toString()),o=(e=d.precision)+3;;)if(s=r,c=s.times(s).times(s),l=c.plus(u),r=rt(l.plus(u).times(s),l.plus(c),o+2,1),Qe(s.d).slice(0,o)===(n=Qe(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n==`9999`||!i&&n==`4999`){if(!i&&(E(s,e+1,0),s.times(s).times(s).eq(u))){r=s;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(E(r,e+1,1),t=!r.times(r).times(r).eq(u));break}return C=!0,E(r,e,d.rounding,t)},T.decimalPlaces=T.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-He(this.e/w))*w,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},T.dividedBy=T.div=function(e){return rt(this,new this.constructor(e))},T.dividedToIntegerBy=T.divToInt=function(e){var t=this,n=t.constructor;return E(rt(t,new n(e),0,1,1),n.precision,n.rounding)},T.equals=T.eq=function(e){return this.cmp(e)===0},T.floor=function(){return E(new this.constructor(this),this.e+1,3)},T.greaterThan=T.gt=function(e){return this.cmp(e)>0},T.greaterThanOrEqualTo=T.gte=function(e){var t=this.cmp(e);return t==1||t===0},T.hyperbolicCosine=T.cosh=function(){var e,t,n,r,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;n=o.precision,r=o.rounding,o.precision=n+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/bt(4,e)).toString()):(e=16,t=`2.3283064365386962890625e-10`),a=yt(o,1,a.times(t),new o(1),!0);for(var c,l=e,u=new o(8);l--;)c=a.times(a),a=s.minus(c.times(u.minus(c.times(u))));return E(a,o.precision=n,o.rounding=r,!0)},T.hyperbolicSine=T.sinh=function(){var e,t,n,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=yt(a,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/bt(5,e)),i=yt(a,2,i,i,!0);for(var o,s=new a(5),c=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(c.times(o).plus(l))))}return a.precision=t,a.rounding=n,E(i,t,n,!0)},T.hyperbolicTangent=T.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,rt(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},T.inverseCosine=T.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n===-1?e.isZero()?st(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2)):n===0?e.isNeg()?st(t,r,i):new t(0):new t(NaN)},T.inverseHyperbolicCosine=T.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,C=!1,n=n.times(n).minus(1).sqrt().plus(n),C=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},T.inverseHyperbolicSine=T.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,C=!1,n=n.times(n).plus(1).sqrt().plus(n),C=!0,r.precision=e,r.rounding=t,n.ln())},T.inverseHyperbolicTangent=T.atanh=function(){var e,t,n,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?E(new a(i),e,t,!0):(a.precision=n=r-i.e,i=rt(i.plus(1),new a(1).minus(i),n+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},T.inverseSine=T.asin=function(){var e,t,n,r,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),n=a.precision,r=a.rounding,t===-1?(a.precision=n+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=n,a.rounding=r,i.times(2)):t===0?(e=st(a,n+4,r).times(.5),e.s=i.s,e):new a(NaN))},T.inverseTangent=T.atan=function(){var e,t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding;if(!l.isFinite()){if(!l.s)return new u(NaN);if(d+4<=Ze)return o=st(u,d+4,f).times(.5),o.s=l.s,o}else if(l.isZero())return new u(l);else if(l.abs().eq(1)&&d+4<=Ze)return o=st(u,d+4,f).times(.25),o.s=l.s,o;for(u.precision=s=d+10,u.rounding=1,n=Math.min(28,s/w+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(C=!1,t=Math.ceil(s/w),r=1,c=l.times(l),o=new u(l),i=l;e!==-1;)if(i=i.times(c),a=o.minus(i.div(r+=2)),i=i.times(c),o=a.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),C=!0,E(o,u.precision=d,u.rounding=f,!0)},T.isFinite=function(){return!!this.d},T.isInteger=T.isInt=function(){return!!this.d&&He(this.e/w)>this.d.length-2},T.isNaN=function(){return!this.s},T.isNegative=T.isNeg=function(){return this.s<0},T.isPositive=T.isPos=function(){return this.s>0},T.isZero=function(){return!!this.d&&this.d[0]===0},T.lessThan=T.lt=function(e){return this.cmp(e)<0},T.lessThanOrEqualTo=T.lte=function(e){return this.cmp(e)<1},T.logarithm=T.log=function(e){var t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding,p=5;if(e==null)e=new u(10),t=!0;else{if(e=new u(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new u(n&&!n[0]?-1/0:l.s==1?n?0:1/0:NaN);if(t)if(n.length>1)a=!0;else{for(i=n[0];i%10==0;)i/=10;a=i!==1}if(C=!1,s=d+p,o=mt(l,s),r=t?ot(u,s+10):mt(e,s),c=rt(o,r,s,1),et(c.d,i=d,f))do if(s+=10,o=mt(l,s),r=t?ot(u,s+10):mt(e,s),c=rt(o,r,s,1),!a){+Qe(c.d).slice(i+1,i+15)+1==0x5af3107a4000&&(c=E(c,d+1,0));break}while(et(c.d,i+=10,f));return C=!0,E(c,d,f)},T.minus=T.sub=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d?e.s=-e.s:e=new m(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,s=m.precision,c=m.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new m(p);else return new m(c===3?-0:0);return C?E(e,s,c):e}if(n=He(e.e/w),u=He(p.e/w),l=l.slice(),a=u-n,a){for(d=a<0,d?(t=l,a=-a,o=f.length):(t=f,n=u,o=l.length),r=Math.max(Math.ceil(s/w),o)+2,a>r&&(a=r,t.length=1),t.reverse(),r=a;r--;)t.push(0);t.reverse()}else{for(r=l.length,o=f.length,d=r<o,d&&(o=r),r=0;r<o;r++)if(l[r]!=f[r]){d=l[r]<f[r];break}a=0}for(d&&(t=l,l=f,f=t,e.s=-e.s),o=l.length,r=f.length-o;r>0;--r)l[o++]=0;for(r=f.length;r>a;){if(l[--r]<f[r]){for(i=r;i&&l[--i]===0;)l[i]=Je-1;--l[i],l[r]+=Je}l[r]-=f[r]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--n;return l[0]?(e.d=l,e.e=at(l,n),C?E(e,s,c):e):new m(c===3?-0:0)},T.modulo=T.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?E(new r(n),r.precision,r.rounding):(C=!1,r.modulo==9?(t=rt(n,e.abs(),0,3,1),t.s*=e.s):t=rt(n,e,0,r.modulo,1),t=t.times(e),C=!0,n.minus(t))},T.naturalExponential=T.exp=function(){return pt(this)},T.naturalLogarithm=T.ln=function(){return mt(this)},T.negated=T.neg=function(){var e=new this.constructor(this);return e.s=-e.s,E(e)},T.plus=T.add=function(e){var t,n,r,i,a,o,s,c,l,u,d=this,f=d.constructor;if(e=new f(e),!d.d||!e.d)return!d.s||!e.s?e=new f(NaN):d.d||(e=new f(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(l=d.d,u=e.d,s=f.precision,c=f.rounding,!l[0]||!u[0])return u[0]||(e=new f(d)),C?E(e,s,c):e;if(a=He(d.e/w),r=He(e.e/w),l=l.slice(),i=a-r,i){for(i<0?(n=l,i=-i,o=u.length):(n=u,r=a,o=l.length),a=Math.ceil(s/w),o=a>o?a+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=l.length,i=u.length,o-i<0&&(i=o,n=u,u=l,l=n),t=0;i;)t=(l[--i]=l[i]+u[i]+t)/Je|0,l[i]%=Je;for(t&&(l.unshift(t),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=at(l,r),C?E(e,s,c):e},T.precision=T.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Re+e);return n.d?(t=ct(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},T.round=function(){var e=this,t=e.constructor;return E(new t(e),e.e+1,t.rounding)},T.sine=T.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+w,r.rounding=1,n=vt(r,xt(r,n)),r.precision=e,r.rounding=t,E(Ie>2?n.neg():n,e,t,!0)):new r(NaN)},T.squareRoot=T.sqrt=function(){var e,t,n,r,i,a,o=this,s=o.d,c=o.e,l=o.s,u=o.constructor;if(l!==1||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);for(C=!1,l=Math.sqrt(+o),l==0||l==1/0?(t=Qe(s),(t.length+c)%2==0&&(t+=`0`),l=Math.sqrt(t),c=He((c+1)/2)-(c<0||c%2),l==1/0?t=`5e`+c:(t=l.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+c),r=new u(t)):r=new u(l.toString()),n=(c=u.precision)+3;;)if(a=r,r=a.plus(rt(o,a,n+2,1)).times(.5),Qe(a.d).slice(0,n)===(t=Qe(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t==`9999`||!i&&t==`4999`){if(!i&&(E(a,c+1,0),a.times(a).eq(o))){r=a;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)==`5`)&&(E(r,c+1,1),e=!r.times(r).eq(o));break}return C=!0,E(r,c,u.rounding,e)},T.tangent=T.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=rt(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,E(Ie==2||Ie==4?n.neg():n,e,t,!0)):new r(NaN)},T.times=T.mul=function(e){var t,n,r,i,a,o,s,c,l,u=this,d=u.constructor,f=u.d,p=(e=new d(e)).d;if(e.s*=u.s,!f||!f[0]||!p||!p[0])return new d(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=He(u.e/w)+He(e.e/w),c=f.length,l=p.length,c<l&&(a=f,f=p,p=a,o=c,c=l,l=o),a=[],o=c+l,r=o;r--;)a.push(0);for(r=l;--r>=0;){for(t=0,i=c+r;i>r;)s=a[i]+p[r]*f[i-r-1]+t,a[i--]=s%Je|0,t=s/Je|0;a[i]=(a[i]+t)%Je|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=at(a,n),C?E(e,d.precision,d.rounding):e},T.toBinary=function(e,t){return St(this,2,e,t)},T.toDecimalPlaces=T.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:($e(e,0,Ae),t===void 0?t=r.rounding:$e(t,0,8),E(n,e+n.e+1,t))},T.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=it(r,!0):($e(e,0,Ae),t===void 0?t=i.rounding:$e(t,0,8),r=E(new i(r),e+1,t),n=it(r,!0,e+1)),r.isNeg()&&!r.isZero()?`-`+n:n},T.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?n=it(i):($e(e,0,Ae),t===void 0?t=a.rounding:$e(t,0,8),r=E(new a(i),e+i.e+1,t),n=it(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?`-`+n:n},T.toFraction=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.d,h=p.constructor;if(!m)return new h(p);if(l=n=new h(1),r=c=new h(0),t=new h(r),a=t.e=ct(m)-p.e-1,o=a%w,t.d[0]=Ue(10,o<0?w+o:o),e==null)e=a>0?t:l;else{if(s=new h(e),!s.isInt()||s.lt(l))throw Error(Re+s);e=s.gt(t)?a>0?t:l:s}for(C=!1,s=new h(Qe(m)),u=h.precision,h.precision=a=m.length*w*2;d=rt(s,t,0,1,1),i=n.plus(d.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=c.plus(d.times(i)),c=i,i=t,t=s.minus(d.times(i)),s=i;return i=rt(e.minus(n),r,0,1,1),c=c.plus(i.times(l)),n=n.plus(i.times(r)),c.s=l.s=p.s,f=rt(l,r,a,1).minus(p).abs().cmp(rt(c,n,a,1).minus(p).abs())<1?[l,r]:[c,n],h.precision=u,C=!0,f},T.toHexadecimal=T.toHex=function(e,t){return St(this,16,e,t)},T.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:$e(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&=n.s,e}return e.d[0]?(C=!1,n=rt(n,e,0,t,1).times(e),C=!0,E(n)):(e.s=n.s,n=e),n},T.toNumber=function(){return+this},T.toOctal=function(e,t){return St(this,8,e,t)},T.toPower=T.pow=function(e){var t,n,r,i,a,o,s=this,c=s.constructor,l=+(e=new c(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new c(Ue(+s,l));if(s=new c(s),s.eq(1))return s;if(r=c.precision,a=c.rounding,e.eq(1))return E(s,r,a);if(t=He(e.e/w),t>=e.d.length-1&&(n=l<0?-l:l)<=Ye)return i=ut(c,s,n,r),e.s<0?new c(1).div(i):E(i,r,a);if(o=s.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=o,s}return n=Ue(+s,l),t=n==0||!isFinite(n)?He(l*(Math.log(`0.`+Qe(s.d))/Math.LN10+s.e+1)):new c(n+``).e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(C=!1,c.rounding=s.s=1,n=Math.min(12,(t+``).length),i=pt(e.times(mt(s,r+n)),r),i.d&&(i=E(i,r+5,1),et(i.d,r,a)&&(t=r+10,i=E(pt(e.times(mt(s,t+n)),t),t+5,1),+Qe(i.d).slice(r+1,r+15)+1==0x5af3107a4000&&(i=E(i,r+1,0)))),i.s=o,C=!0,c.rounding=a,E(i,r,a))},T.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=it(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):($e(e,1,Ae),t===void 0?t=i.rounding:$e(t,0,8),r=E(new i(r),e,t),n=it(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?`-`+n:n},T.toSignificantDigits=T.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):($e(e,1,Ae),t===void 0?t=r.rounding:$e(t,0,8)),E(new r(n),e,t)},T.toString=function(){var e=this,t=e.constructor,n=it(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?`-`+n:n},T.truncated=T.trunc=function(){return E(new this.constructor(this),this.e+1,1)},T.valueOf=T.toJSON=function(){var e=this,t=e.constructor,n=it(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?`-`+n:n};function Qe(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+``,n=w-r.length,n&&(a+=lt(n)),a+=r;o=e[t],r=o+``,n=w-r.length,n&&(a+=lt(n))}else if(o===0)return`0`;for(;o%10==0;)o/=10;return a+o}function $e(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Re+e)}function et(e,t,n,r){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=w,i=0):(i=Math.ceil((t+1)/w),t%=w),a=Ue(10,w-t),s=e[i]%a|0,r==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=n<4&&s==99999||n>3&&s==49999||s==5e4||s==0):o=(n<4&&s+1==a||n>3&&s+1==a/2)&&(e[i+1]/a/100|0)==Ue(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(r||n<4)&&s==9999||!r&&n>3&&s==4999):o=((r||n<4)&&s+1==a||!r&&n>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==Ue(10,t-3)-1,o}function tt(e,t,n){for(var r,i=[0],a,o=0,s=e.length;o<s;){for(a=i.length;a--;)i[a]*=t;for(i[0]+=je.indexOf(e.charAt(o++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function nt(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/bt(4,n)).toString()):(n=16,i=`2.3283064365386962890625e-10`),e.precision+=n,t=yt(e,1,t.times(i),new e(1));for(var a=n;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var rt=(function(){function e(e,t,n){var r,i=0,a=e.length;for(e=e.slice();a--;)r=e[a]*t+i,e[a]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,a,o,s,c){var l,u,d,f,p,m,h,g,_,v,y,b,ee,x,te,ne,re,ie,ae,oe,se=r.constructor,ce=r.s==i.s?1:-1,le=r.d,S=i.d;if(!le||!le[0]||!S||!S[0])return new se(!r.s||!i.s||(le?S&&le[0]==S[0]:!S)?NaN:le&&le[0]==0||!S?ce*0:ce/0);for(c?(p=1,u=r.e-i.e):(c=Je,p=w,u=He(r.e/p)-He(i.e/p)),ae=S.length,re=le.length,_=new se(ce),v=_.d=[],d=0;S[d]==(le[d]||0);d++);if(S[d]>(le[d]||0)&&u--,a==null?(x=a=se.precision,o=se.rounding):x=s?a+(r.e-i.e)+1:a,x<0)v.push(1),m=!0;else{if(x=x/p+2|0,d=0,ae==1){for(f=0,S=S[0],x++;(d<re||f)&&x--;d++)te=f*c+(le[d]||0),v[d]=te/S|0,f=te%S|0;m=f||d<re}else{for(f=c/(S[0]+1)|0,f>1&&(S=e(S,f,c),le=e(le,f,c),ae=S.length,re=le.length),ne=ae,y=le.slice(0,ae),b=y.length;b<ae;)y[b++]=0;oe=S.slice(),oe.unshift(0),ie=S[0],S[1]>=c/2&&++ie;do f=0,l=t(S,y,ae,b),l<0?(ee=y[0],ae!=b&&(ee=ee*c+(y[1]||0)),f=ee/ie|0,f>1?(f>=c&&(f=c-1),h=e(S,f,c),g=h.length,b=y.length,l=t(h,y,g,b),l==1&&(f--,n(h,ae<g?oe:S,g,c))):(f==0&&(l=f=1),h=S.slice()),g=h.length,g<b&&h.unshift(0),n(y,h,b,c),l==-1&&(b=y.length,l=t(S,y,ae,b),l<1&&(f++,n(y,ae<b?oe:S,b,c))),b=y.length):l===0&&(f++,y=[0]),v[d++]=f,l&&y[0]?y[b++]=le[ne]||0:(y=[le[ne]],b=1);while((ne++<re||y[0]!==void 0)&&x--);m=y[0]!==void 0}v[0]||v.shift()}if(p==1)_.e=u,Fe=m;else{for(d=1,f=v[0];f>=10;f/=10)d++;_.e=d+u*p-1,E(_,s?a+_.e+1:a,o,m)}return _}})();function E(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor;out:if(t!=null){if(d=e.d,!d)return e;for(i=1,s=d[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=w,o=t,u=d[f=0],c=u/Ue(10,i-o-1)%10|0;else if(f=Math.ceil((a+1)/w),s=d.length,f>=s)if(r){for(;s++<=f;)d.push(0);u=c=0,i=1,a%=w,o=a-w+1}else break out;else{for(u=s=d[f],i=1;s>=10;s/=10)i++;a%=w,o=a-w+i,c=o<0?0:u/Ue(10,i-o-1)%10|0}if(r=r||t<0||d[f+1]!==void 0||(o<0?u:u%Ue(10,i-o-1)),l=n<4?(c||r)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(a>0?o>0?u/Ue(10,i-o):0:d[f-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,l?(t-=e.e+1,d[0]=Ue(10,(w-t%w)%w),e.e=-t||0):d[0]=e.e=0,e;if(a==0?(d.length=f,s=1,f--):(d.length=f+1,s=Ue(10,w-a),d[f]=o>0?(u/Ue(10,i-o)%Ue(10,o)|0)*s:0),l)for(;;)if(f==0){for(a=1,o=d[0];o>=10;o/=10)a++;for(o=d[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,d[0]==Je&&(d[0]=1));break}else{if(d[f]+=s,d[f]!=Je)break;d[f--]=0,s=1}for(a=d.length;d[--a]===0;)d.pop()}return C&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function it(e,t,n){if(!e.isFinite())return ht(e);var r,i=e.e,a=Qe(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+`.`+a.slice(1)+lt(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(e.e<0?`e`:`e+`)+e.e):i<0?(a=`0.`+lt(-i-1)+a,n&&(r=n-o)>0&&(a+=lt(r))):i>=o?(a+=lt(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+lt(r))):((r=i+1)<o&&(a=a.slice(0,r)+`.`+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+=`.`),a+=lt(r))),a}function at(e,t){var n=e[0];for(t*=w;n>=10;n/=10)t++;return t}function ot(e,t,n){if(t>Xe)throw C=!0,n&&(e.precision=n),Error(ze);return E(new e(Me),t,1,!0)}function st(e,t,n){if(t>Ze)throw Error(ze);return E(new e(Ne),t,n,!0)}function ct(e){var t=e.length-1,n=t*w+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function lt(e){for(var t=``;e--;)t+=`0`;return t}function ut(e,t,n,r){var i,a=new e(1),o=Math.ceil(r/w+4);for(C=!1;;){if(n%2&&(a=a.times(t),Ct(a.d,o)&&(i=!0)),n=He(n/2),n===0){n=a.d.length-1,i&&a.d[n]===0&&++a.d[n];break}t=t.times(t),Ct(t.d,o)}return C=!0,a}function dt(e){return e.d[e.d.length-1]&1}function ft(e,t,n){for(var r,i,a=new e(t[0]),o=0;++o<t.length;){if(i=new e(t[o]),!i.s){a=i;break}r=a.cmp(i),(r===n||r===0&&a.s===n)&&(a=i)}return a}function pt(e,t){var n,r,i,a,o,s,c,l=0,u=0,d=0,f=e.constructor,p=f.rounding,m=f.precision;if(!e.d||!e.d[0]||e.e>17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(C=!1,c=m):c=t,s=new f(.03125);e.e>-2;)e=e.times(s),d+=5;for(r=Math.log(Ue(2,d))/Math.LN10*2+5|0,c+=r,n=a=o=new f(1),f.precision=c;;){if(a=E(a.times(e),c,1),n=n.times(++u),s=o.plus(rt(a,n,c,1)),Qe(s.d).slice(0,c)===Qe(o.d).slice(0,c)){for(i=d;i--;)o=E(o.times(o),c,1);if(t==null)if(l<3&&et(o.d,c-r,p,l))f.precision=c+=10,n=a=s=new f(1),u=0,l++;else return E(o,f.precision=m,p,C=!0);else return f.precision=m,o}o=s}}function mt(e,t){var n,r,i,a,o,s,c,l,u,d,f,p=1,m=10,h=e,g=h.d,_=h.constructor,v=_.rounding,y=_.precision;if(h.s<0||!g||!g[0]||!h.e&&g[0]==1&&g.length==1)return new _(g&&!g[0]?-1/0:h.s==1?g?0:h:NaN);if(t==null?(C=!1,u=y):u=t,_.precision=u+=m,n=Qe(g),r=n.charAt(0),Math.abs(a=h.e)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Qe(h.d),r=n.charAt(0),p++;a=h.e,r>1?(h=new _(`0.`+n),a++):h=new _(r+`.`+n.slice(1))}else return l=ot(_,u+2,y).times(a+``),h=mt(new _(r+`.`+n.slice(1)),u-m).plus(l),_.precision=y,t==null?E(h,y,v,C=!0):h;for(d=h,c=o=h=rt(h.minus(1),h.plus(1),u,1),f=E(h.times(h),u,1),i=3;;){if(o=E(o.times(f),u,1),l=c.plus(rt(o,new _(i),u,1)),Qe(l.d).slice(0,u)===Qe(c.d).slice(0,u))if(c=c.times(2),a!==0&&(c=c.plus(ot(_,u+2,y).times(a+``))),c=rt(c,new _(p),u,1),t==null)if(et(c.d,u-m,v,s))_.precision=u+=m,l=o=h=rt(d.minus(1),d.plus(1),u,1),f=E(h.times(h),u,1),i=s=1;else return E(c,_.precision=y,v,C=!0);else return _.precision=y,c;c=l,i+=2}}function ht(e){return String(e.s*e.s/0)}function gt(e,t){var n,r,i;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%w,n<0&&(r+=w),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=w;r<i;)e.d.push(+t.slice(r,r+=w));t=t.slice(r),r=w-t.length}else r-=i;for(;r--;)t+=`0`;e.d.push(+t),C&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function _t(e,t){var n,r,i,a,o,s,c,l,u;if(t.indexOf(`_`)>-1){if(t=t.replace(/(\d)_(?=\d)/g,`$1`),qe.test(t))return gt(e,t)}else if(t===`Infinity`||t===`NaN`)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Ge.test(t))n=16,t=t.toLowerCase();else if(We.test(t))n=2;else if(Ke.test(t))n=8;else throw Error(Re+t);for(a=t.search(/p/i),a>0?(c=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf(`.`),o=a>=0,r=e.constructor,o&&(t=t.replace(`.`,``),s=t.length,a=s-a,i=ut(r,new r(n),a,a*2)),l=tt(t,n,Je),u=l.length-1,a=u;l[a]===0;--a)l.pop();return a<0?new r(e.s*0):(e.e=at(l,u),e.d=l,C=!1,o&&(e=rt(e,i,s*4)),c&&(e=e.times(Math.abs(c)<54?Ue(2,c):fn.pow(2,c))),C=!0,e)}function vt(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:yt(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/bt(5,n)),t=yt(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function yt(e,t,n,r,i){var a,o,s,c,l=1,u=e.precision,d=Math.ceil(u/w);for(C=!1,c=n.times(n),s=new e(r);;){if(o=rt(s.times(c),new e(t++*t++),u,1),s=i?r.plus(o):r.minus(o),r=rt(o.times(c),new e(t++*t++),u,1),o=s.plus(r),o.d[d]!==void 0){for(a=d;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=r,r=o,o=a,l++}return C=!0,o.d.length=d+1,o}function bt(e,t){for(var n=e;--t;)n*=e;return n}function xt(e,t){var n,r=t.s<0,i=st(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return Ie=r?4:1,t;if(n=t.divToInt(i),n.isZero())Ie=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(a))return Ie=dt(n)?r?2:3:r?4:1,t;Ie=dt(n)?r?1:4:r?3:2}return t.minus(i).abs()}function St(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor,m=n!==void 0;if(m?($e(n,1,Ae),r===void 0?r=p.rounding:$e(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())u=ht(e);else{for(u=it(e),o=u.indexOf(`.`),m?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(u=u.replace(`.`,``),f=new p(1),f.e=u.length-o,f.d=tt(it(f),10,i),f.e=f.d.length),d=tt(u,10,i),a=c=d.length;d[--c]==0;)d.pop();if(!d[0])u=m?`0p+0`:`0`;else{if(o<0?a--:(e=new p(e),e.d=d,e.e=a,e=rt(e,f,n,r,0,i),d=e.d,a=e.e,l=Fe),o=d[n],s=i/2,l||=d[n+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(e.s<0?3:2)):o>s||o===s&&(r===4||l||r===6&&d[n-1]&1||r===(e.s<0?8:7)),d.length=n,l)for(;++d[--n]>i-1;)d[n]=0,n||(++a,d.unshift(1));for(c=d.length;!d[c-1];--c);for(o=0,u=``;o<c;o++)u+=je.charAt(d[o]);if(m){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)u+=`0`;for(d=tt(u,i,t),c=d.length;!d[c-1];--c);for(o=1,u=`1.`;o<c;o++)u+=je.charAt(d[o])}else u=u.charAt(0)+`.`+u.slice(1);u=u+(a<0?`p`:`p+`)+a}else if(a<0){for(;++a;)u=`0`+u;u=`0.`+u}else if(++a>c)for(a-=c;a--;)u+=`0`;else a<c&&(u=u.slice(0,a)+`.`+u.slice(a))}u=(t==16?`0x`:t==2?`0b`:t==8?`0o`:``)+u}return e.s<0?`-`+u:u}function Ct(e,t){if(e.length>t)return e.length=t,!0}function wt(e){return new this(e).abs()}function Tt(e){return new this(e).acos()}function Et(e){return new this(e).acosh()}function Dt(e,t){return new this(e).plus(t)}function Ot(e){return new this(e).asin()}function kt(e){return new this(e).asinh()}function At(e){return new this(e).atan()}function jt(e){return new this(e).atanh()}function Mt(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,a=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=st(this,a,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?st(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=st(this,a,1).times(.5),n.s=e.s):t.s<0?(this.precision=a,this.rounding=1,n=this.atan(rt(e,t,a,1)),t=st(this,a,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(rt(e,t,a,1)),n}function Nt(e){return new this(e).cbrt()}function Pt(e){return E(e=new this(e),e.e+1,2)}function Ft(e,t,n){return new this(e).clamp(t,n)}function It(e){if(!e||typeof e!=`object`)throw Error(Le+`Object expected`);var t,n,r,i=e.defaults===!0,a=[`precision`,1,Ae,`rounding`,0,8,`toExpNeg`,-ke,0,`toExpPos`,0,ke,`maxE`,0,ke,`minE`,-ke,0,`modulo`,0,9];for(t=0;t<a.length;t+=3)if(n=a[t],i&&(this[n]=Pe[n]),(r=e[n])!==void 0)if(He(r)===r&&r>=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(Re+n+`: `+r);if(n=`crypto`,i&&(this[n]=Pe[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Be);else this[n]=!1;else throw Error(Re+n+`: `+r);return this}function Lt(e){return new this(e).cos()}function Rt(e){return new this(e).cosh()}function zt(e){var t,n,r;function i(e){var t,n,r,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,Wt(e)){a.s=e.s,C?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d);return}if(r=typeof e,r===`number`){if(e===0){a.s=1/e<0?-1:1,a.e=0,a.d=[0];return}if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;C?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]);return}if(e*0!=0){e||(a.s=NaN),a.e=NaN,a.d=null;return}return gt(a,e.toString())}if(r===`string`)return(n=e.charCodeAt(0))===45?(e=e.slice(1),a.s=-1):(n===43&&(e=e.slice(1)),a.s=1),qe.test(e)?gt(a,e):_t(a,e);if(r===`bigint`)return e<0?(e=-e,a.s=-1):a.s=1,gt(a,e.toString());throw Error(Re+e)}if(i.prototype=T,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=It,i.clone=zt,i.isDecimal=Wt,i.abs=wt,i.acos=Tt,i.acosh=Et,i.add=Dt,i.asin=Ot,i.asinh=kt,i.atan=At,i.atanh=jt,i.atan2=Mt,i.cbrt=Nt,i.ceil=Pt,i.clamp=Ft,i.cos=Lt,i.cosh=Rt,i.div=Bt,i.exp=Vt,i.floor=Ht,i.hypot=Ut,i.ln=Gt,i.log=Kt,i.log10=Jt,i.log2=qt,i.max=Yt,i.min=Xt,i.mod=Zt,i.mul=Qt,i.pow=$t,i.random=en,i.round=tn,i.sign=nn,i.sin=rn,i.sinh=an,i.sqrt=on,i.sub=sn,i.sum=cn,i.tan=ln,i.tanh=un,i.trunc=dn,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`maxE`,`minE`,`modulo`,`crypto`],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function Bt(e,t){return new this(e).div(t)}function Vt(e){return new this(e).exp()}function Ht(e){return E(e=new this(e),e.e+1,3)}function Ut(){var e,t,n=new this(0);for(C=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return C=!0,new this(1/0);n=t}return C=!0,n.sqrt()}function Wt(e){return e instanceof fn||e&&e.toStringTag===Ve||!1}function Gt(e){return new this(e).ln()}function Kt(e,t){return new this(e).log(t)}function qt(e){return new this(e).log(2)}function Jt(e){return new this(e).log(10)}function Yt(){return ft(this,arguments,-1)}function Xt(){return ft(this,arguments,1)}function Zt(e,t){return new this(e).mod(t)}function Qt(e,t){return new this(e).mul(t)}function $t(e,t){return new this(e).pow(t)}function en(e){var t,n,r,i,a=0,o=new this(1),s=[];if(e===void 0?e=this.precision:$e(e,1,Ae),r=Math.ceil(e/w),!this.crypto)for(;a<r;)s[a++]=Math.random()*1e7|0;else if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));a<r;)i=t[a],i>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);a<r;)i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((t[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=r/4}else throw Error(Be);for(r=s[--a],e%=w,r&&e&&(i=Ue(10,w-e),s[a]=(r/i|0)*i);s[a]===0;a--)s.pop();if(a<0)n=0,s=[0];else{for(n=-1;s[0]===0;n-=w)s.shift();for(r=1,i=s[0];i>=10;i/=10)r++;r<w&&(n-=w-r)}return o.e=n,o.d=s,o}function tn(e){return E(e=new this(e),e.e+1,this.rounding)}function nn(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function rn(e){return new this(e).sin()}function an(e){return new this(e).sinh()}function on(e){return new this(e).sqrt()}function sn(e,t){return new this(e).sub(t)}function cn(){var e=0,t=arguments,n=new this(t[e]);for(C=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return C=!0,E(n,this.precision,this.rounding)}function ln(e){return new this(e).tan()}function un(e){return new this(e).tanh()}function dn(e){return E(e=new this(e),e.e+1,1)}T[Symbol.for(`nodejs.util.inspect.custom`)]=T.toString,T[Symbol.toStringTag]=`Decimal`;var fn=T.constructor=zt(Pe);Me=new fn(Me),Ne=new fn(Ne);var pn=function(e){return e[e.TOKEN=1e5]=`TOKEN`,e[e.DECI_TOKEN=1e4]=`DECI_TOKEN`,e[e.CENTI_TOKEN=1e3]=`CENTI_TOKEN`,e[e.MILLI_TOKEN=100]=`MILLI_TOKEN`,e[e.MICRO_TOKEN=10]=`MICRO_TOKEN`,e[e.ATOMIC=1]=`ATOMIC`,e}({}),mn=function(e){return e.TOKEN=`CMTS`,e.DECI_TOKEN=`dCMTS`,e.CENTI_TOKEN=`cCMTS`,e.MILLI_TOKEN=`mCMTS`,e.MICRO_TOKEN=`μCMTS`,e.ATOMIC=`aCMTS`,e}({}),hn=class e{constructor(e){this.amount=e}static create(e,t=pn.TOKEN){if(t!=pn.TOKEN)throw new y;return this.createCMTS(e)}static createCMTS(e){return this.createSafeCmtsToken(fn(e),fn(pn.TOKEN))}static createDeciToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.DECI_TOKEN))}static createMicroToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.MICRO_TOKEN))}static createMilliToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.MILLI_TOKEN))}static createCentiToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.CENTI_TOKEN))}static createMillionToken(e){return this.createSafeCmtsToken(fn(e),fn(pn.MICRO_TOKEN))}static createAtomic(e){return this.createSafeCmtsToken(fn(e),fn(pn.ATOMIC))}static createSafeCmtsToken(t,n){let r=t.mul(n);if(r.isInteger())return new e(r);throw new v(`Invalid amount: An atomic token should be insecable: got ${r}`)}static zero(){return this.createAtomic(0)}static oneCMTS(){return this.createCMTS(1)}static parse(t){let n=t.trim().match(/^(\d+(?:\.\d+)?)\s*(\S+)$/);if(!n)throw new v(`Invalid token amount format: "${t}"`);let[,r,i]=n,a=parseFloat(r);switch(i){case mn.TOKEN:return e.createCMTS(a);case mn.DECI_TOKEN:return e.createDeciToken(a);case mn.CENTI_TOKEN:return e.createCentiToken(a);case mn.MILLI_TOKEN:return e.createMilliToken(a);case mn.MICRO_TOKEN:return e.createMicroToken(a);case mn.ATOMIC:return e.createAtomic(a);default:throw new y}}getAmount(e=pn.TOKEN){switch(e){case pn.TOKEN:return this.amount.div(fn(pn.TOKEN)).toNumber();case pn.CENTI_TOKEN:return this.amount.div(fn(pn.CENTI_TOKEN)).toNumber();case pn.MILLI_TOKEN:return this.amount.div(fn(pn.MILLI_TOKEN)).toNumber();case pn.DECI_TOKEN:return this.amount.div(fn(pn.DECI_TOKEN)).toNumber();case pn.MICRO_TOKEN:return this.amount.div(fn(pn.MICRO_TOKEN)).toNumber();case pn.ATOMIC:return this.amount.toNumber()}}getAmountAsAtomic(){return this.getAmount(pn.ATOMIC)}getAmountAsCMTS(){return this.getAmount(pn.TOKEN)}isPositive(){return this.amount.isPositive()||this.amount.isZero()}isPositiveStrict(){return this.isPositive()&&!this.isZero()}isNegative(){return this.amount.isNegative()}isZero(){return this.amount.isZero()}equals(e){return this.amount.equals(e.amount)}isGreaterThan(e){return this.amount.gt(e.amount)}isLessThan(e){return this.amount.lt(e.amount)}add(t){return e.createAtomic(this.getAmountAsAtomic()+t.getAmountAsAtomic())}sub(t){return e.createAtomic(this.getAmountAsAtomic()-t.getAmountAsAtomic())}mul(t){return e.createAtomic(this.getAmountAsAtomic()*t)}toString(t=pn.TOKEN,n={}){let r=this.getAmountAsCMTS();switch(n.locale=n.locale===`system`?void 0:n.locale||`en-EN`,t){case pn.TOKEN:return`${Intl.NumberFormat(n.locale,{minimumFractionDigits:n.decimalPlaces===void 0?0:n.decimalPlaces,maximumFractionDigits:n.decimalPlaces===void 0?8:n.decimalPlaces,useGrouping:n.grouping||!1}).format(r)} ${e.getUnitLabel(t)}`;case pn.ATOMIC:return`${r} ${e.getUnitLabel(t)}`;default:throw new y}}static getUnitLabel(e){switch(e){case pn.TOKEN:return mn.TOKEN;case pn.ATOMIC:return mn.ATOMIC;default:throw new y}}},gn=t({FORMAT:()=>28,HASHABLE:()=>1,HASHED:()=>8,MASKABLE:()=>2,MASKED:()=>16,PROPERTIES:()=>3,REDACTED:()=>4,TYPE_ARRAY:()=>1,TYPE_ARRAY_OF:()=>32,TYPE_BIN256:()=>13,TYPE_BINARY:()=>12,TYPE_BOOLEAN:()=>5,TYPE_HASH_STR:()=>14,TYPE_MAIN:()=>31,TYPE_NAMES:()=>Pn,TYPE_NULL:()=>6,TYPE_NUMBER:()=>4,TYPE_OBJECT:()=>2,TYPE_STRING:()=>3,TYPE_UINT16:()=>8,TYPE_UINT24:()=>9,TYPE_UINT32:()=>10,TYPE_UINT48:()=>11,TYPE_UINT8:()=>7,TYPE_UNKNOWN:()=>0}),_n=0,vn=1,yn=2,bn=3,xn=4,Sn=5,Cn=6,wn=7,Tn=8,En=9,Dn=10,On=11,kn=12,An=13,jn=14,Mn=31,Nn=32,Pn=[`unknown`,`array`,`object`,`string`,`number`,`boolean`,`null`,`uint8`,`uint16`,`uint24`,`uint32`,`uint48`,`binary`,`bin256`,`hashString`],Fn=1,In=2,Ln=3,Rn=4,zn=8,Bn=16,Vn=28,Hn=t({MAGIC_STRING:()=>Un,MAX_MICROBLOCK_FUTURE_DELAY:()=>120,MAX_MICROBLOCK_PAST_DELAY:()=>300,MB_STATUS_PREVIOUS_HASH_ERROR:()=>3,MB_STATUS_TIMESTAMP_ERROR:()=>2,MB_STATUS_UNRECOVERABLE_ERROR:()=>1,N_VIRTUAL_BLOCKCHAINS:()=>6,PROTOCOL_VERSION:()=>1,VB_ACCOUNT:()=>1,VB_APPLICATION:()=>4,VB_APP_LEDGER:()=>5,VB_NAME:()=>Qn,VB_ORGANIZATION:()=>3,VB_PROTOCOL:()=>0,VB_VALIDATOR_NODE:()=>2}),Un=`CMTS`,Wn=1,Gn=0,Kn=1,qn=2,Jn=3,Yn=4,Xn=5,Zn=6,Qn=[`protocol`,`account`,`validator node`,`organization`,`application`,`application ledger`],$n=300,er=120,tr=1,nr=2,rr=3,ir=t({ACCOUNT_ALLOWED_TRANSFERS:()=>Gr,ACCOUNT_BLOCK_FEES:()=>2,ACCOUNT_BURNT_TOKENS:()=>0,ACCOUNT_NAMES:()=>Wr,ACCOUNT_STANDARD:()=>1,BK_EARNED_BLOCK_FEES:()=>3,BK_EARNED_TX_FEES:()=>1,BK_NAMES:()=>Br,BK_PAID_BLOCK_FEES:()=>2,BK_PAID_TX_FEES:()=>0,BK_PLUS:()=>1,BK_PURCHASE:()=>7,BK_RECEIVED_ESCROW:()=>13,BK_RECEIVED_ESCROW_REFUND:()=>15,BK_RECEIVED_EXPIRED_ESCROW:()=>17,BK_RECEIVED_ISSUANCE:()=>5,BK_RECEIVED_PAYMENT:()=>9,BK_RECEIVED_SLASHED_TOKENS:()=>19,BK_RECEIVED_VESTING:()=>11,BK_REFERENCES:()=>zr,BK_REF_BLOCK:()=>0,BK_REF_MICROBLOCK:()=>1,BK_REF_SECTION:()=>2,BK_SALE:()=>6,BK_SENT_ESCROW:()=>12,BK_SENT_ESCROW_REFUND:()=>14,BK_SENT_EXPIRED_ESCROW:()=>16,BK_SENT_ISSUANCE:()=>4,BK_SENT_PAYMENT:()=>8,BK_SENT_SLASHED_TOKENS:()=>18,BK_SENT_VESTING:()=>10,CENTITOKEN:()=>sr,FIXED_GAS_FEE:()=>fr,GAS_ATOMS_PER_GAS:()=>mr,GAS_PER_BYTE:()=>1,INITIAL_OFFER:()=>lr,MAXIMUM_GAS_PRICE:()=>dr,MILLITOKEN:()=>100,MINIMUM_GAS_PRICE:()=>1,TOKEN:()=>or,TOKEN_NAME:()=>ar}),ar=`CMTS`,or=1e5,sr=1e3,cr=100,lr=1e9*or,ur=1,dr=2**29-1,fr=1e3,pr=1,mr=1e5,hr=1,gr=0,_r=2,vr=4,yr=6,br=8,xr=10,Sr=12,Cr=14,wr=16,Tr=18,Er=1,Dr=3,Or=5,kr=7,Ar=9,jr=11,Mr=13,Nr=15,Pr=17,Fr=19,Ir=0,Lr=1,Rr=2,zr=[1,1,0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0],Br=[`Paid TX fees`,`Earned TX fees`,`Paid block fees`,`Earned block fees`,`Sent initial token issuance`,`Received initial token issuance`,`Sale`,`Purchase`,`Sent payment`,`Received payment`,`Sent vesting`,`Received vesting`,`Sent escrow`,`Received escrow`,`Sent escrow refund`,`Received escrow refund`,`Sent expired escrow`,`Received expired escrow`,`Sent slashed tokens`,`Received slashed tokens`],Vr=0,Hr=1,Ur=2,Wr=[`Burnt tokens account`,`Standard account`,`Block fees account`],Gr=[524800,524265,6],Kr=t({ACCOUNT_HISTORY:()=>ai,ACCOUNT_STATE:()=>ii,ALL_SCHEMAS:()=>oa,BLOCK_CONTENT:()=>di,BLOCK_INFORMATION:()=>ui,CONTRACT_PARAMETER_SCHEMA:()=>Jr,CONTRACT_SCHEMA:()=>Yr,ERROR:()=>qr,MICROBLOCK_BODY:()=>_i,MICROBLOCK_HEADER:()=>hi,MICROBLOCK_HEADER_BODY_HASH_OFFSET:()=>58,MICROBLOCK_HEADER_PREVIOUS_HASH_OFFSET:()=>13,MICROBLOCK_HEADER_SIZE:()=>122,MICROBLOCK_SECTION:()=>gi,MICROBLOCK_VB_INFORMATION:()=>vi,MSG_ACCOUNT_BY_PUBLIC_KEY_HASH:()=>22,MSG_ACCOUNT_HISTORY:()=>20,MSG_ACCOUNT_STATE:()=>18,MSG_AWAIT_MICROBLOCK_ANCHORING:()=>13,MSG_BLOCK_CONTENT:()=>6,MSG_BLOCK_INFORMATION:()=>4,MSG_CHAIN_INFORMATION:()=>2,MSG_ERROR:()=>0,MSG_GENESIS_SNAPSHOT:()=>28,MSG_GET_ACCOUNT_BY_PUBLIC_KEY_HASH:()=>21,MSG_GET_ACCOUNT_HISTORY:()=>19,MSG_GET_ACCOUNT_STATE:()=>17,MSG_GET_BLOCK_CONTENT:()=>5,MSG_GET_BLOCK_INFORMATION:()=>3,MSG_GET_CHAIN_INFORMATION:()=>1,MSG_GET_GENESIS_SNAPSHOT:()=>27,MSG_GET_MICROBLOCK_BODYS:()=>15,MSG_GET_MICROBLOCK_INFORMATION:()=>11,MSG_GET_OBJECT_LIST:()=>25,MSG_GET_VALIDATOR_NODE_BY_ADDRESS:()=>23,MSG_GET_VIRTUAL_BLOCKCHAIN_STATE:()=>7,MSG_GET_VIRTUAL_BLOCKCHAIN_UPDATE:()=>9,MSG_MICROBLOCK_ANCHORING:()=>14,MSG_MICROBLOCK_BODYS:()=>16,MSG_MICROBLOCK_INFORMATION:()=>12,MSG_OBJECT_LIST:()=>26,MSG_VALIDATOR_NODE_BY_ADDRESS:()=>24,MSG_VIRTUAL_BLOCKCHAIN_STATE:()=>8,MSG_VIRTUAL_BLOCKCHAIN_UPDATE:()=>10,NODE_MESSAGES:()=>Ji,PROTOCOL_VARIABLES:()=>si,PROTOCOL_VB_STATE:()=>ci,RECORD_DESCRIPTION:()=>ri,VB_STATES:()=>li,VIRTUAL_BLOCKCHAIN_STATE:()=>oi,WIMSG_ANSWER:()=>5,WIMSG_CONNECTION_ACCEPTED:()=>7,WIMSG_CONNECTION_INFO:()=>6,WIMSG_CONNECTION_TOKEN:()=>2,WIMSG_FORWARDED_ANSWER:()=>3,WIMSG_FORWARDED_REQUEST:()=>8,WIMSG_GET_CONNECTION_INFO:()=>4,WIMSG_REQUEST:()=>0,WIMSG_UPDATE_QR:()=>1,WI_MESSAGES:()=>aa,WI_QR_CODE:()=>Yi}),qr={label:`Error`,definition:[{name:`type`,type:7},{name:`id`,type:7},{name:`arg`,type:35}]},Jr={label:`contractParameter`,definition:[{name:`name`,type:3},{name:`type`,type:3},{name:`defaultValue`,type:3},{name:`modifiable`,type:5}]},Yr={label:`contract`,definition:[{name:`name`,type:3},{name:`parametersDefinition`,type:34,schema:Jr}]},Xr={label:`RecordActor`,definition:[{name:`name`,type:3}]},Zr={label:`RecordChannel`,definition:[{name:`name`,type:3},{name:`public`,type:5}]},Qr={label:`RecordChannelAssignation`,definition:[{name:`fieldPath`,type:3},{name:`channelName`,type:3}]},$r={label:`RecordActorAssignation`,definition:[{name:`actorName`,type:3},{name:`channelName`,type:3}]},ei={label:`RecordMaskedPart`,definition:[{name:`position`,type:10},{name:`length`,type:10},{name:`replacementString`,type:3}]},ti={label:`RecordMaskableField`,definition:[{name:`fieldPath`,type:3},{name:`maskedParts`,type:34,schema:ei}]},ni={label:`RecordHashableField`,definition:[{name:`fieldPath`,type:3}]},ri={label:`RecordDescription`,definition:[{name:`applicationId`,type:14},{name:`virtualBlockchainId`,type:14,optional:!0},{name:`data`,type:2,unspecifiedSchema:!0},{name:`actors`,type:34,optional:!0,schema:Xr},{name:`channels`,type:34,optional:!0,schema:Zr},{name:`channelAssignations`,type:34,optional:!0,schema:Qr},{name:`actorAssignations`,type:34,optional:!0,schema:$r},{name:`hashableFields`,type:34,optional:!0,schema:ni},{name:`maskableFields`,type:34,optional:!0,schema:ti},{name:`author`,type:3},{name:`endorser`,type:3,optional:!0},{name:`approvalMessage`,type:3,optional:!0}]},ii={label:`AccountState`,definition:[{name:`height`,type:11},{name:`balance`,type:11},{name:`lastHistoryHash`,type:13},{name:`locks`,type:34,definition:[{name:`type`,type:7},{name:`amount`,type:11},{name:`parameters`,type:12}]}]},ai={label:`AccountHistory`,definition:[{name:`height`,type:11},{name:`previousHistoryHash`,type:13},{name:`type`,type:7},{name:`timestamp`,type:11},{name:`linkedAccount`,type:13},{name:`amount`,type:11},{name:`chainReference`,type:12}]},oi={label:`VirtualBlockchainState`,definition:[{name:`type`,type:7},{name:`expirationDay`,type:10},{name:`height`,type:11},{name:`lastMicroblockHash`,type:13},{name:`serializedInternalState`,type:12}]},si={label:`PROTOCOL_VARIABLES`,definition:[{name:`protocolVersionName`,type:3},{name:`protocolVersion`,type:8},{name:`feesCalculationVersion`,type:8},{name:`globalStateUpdaterVersion`,type:8},{name:`applicationLedgerInternalStateUpdaterVersion`,type:8},{name:`applicationInternalStateUpdaterVersion`,type:8},{name:`organizationInternalStateUpdaterVersion`,type:8},{name:`validatorNodeInternalStateUpdaterVersion`,type:8},{name:`accountInternalStateUpdaterVersion`,type:8},{name:`protocolInternalStateUpdaterVersion`,type:8}]},ci={label:`ProtocolVbState`,definition:[{name:`organizationId`,type:13},{name:`currentProtocolVariables`,type:2,schema:si},{name:`protocolUpdates`,type:34,schema:{label:`PROTOCOL_UPDATE`,definition:[{name:`protocolVersion`,type:8},{name:`changeLog`,type:3},{name:`protocolVariables`,type:2,schema:si},{name:`protocolVersionName`,type:3}]}}]},li=[ci,{label:`AccountVbState`,definition:[{name:`signatureSchemeId`,type:7},{name:`publicKeyHeight`,type:11}]},{label:`ValidatorNodeVbState`,definition:[{name:`organizationId`,type:13},{name:`descriptionHeight`,type:11},{name:`rpcEndpointHeight`,type:11},{name:`networkIntegrationHeight`,type:11}]},{label:`OrganizationVbState`,definition:[{name:`accountId`,type:13},{name:`descriptionHeight`,type:11}]},{label:`ApplicationVbState`,definition:[{name:`organizationId`,type:13},{name:`descriptionHeight`,type:11}]},{label:`AppLedgerVbState`,definition:[{name:`allowedSignatureSchemeIds`,type:39},{name:`allowedPkeSchemeIds`,type:39},{name:`applicationId`,type:13},{name:`channels`,type:34,definition:[{name:`name`,type:3},{name:`isPrivate`,type:5},{name:`creatorId`,type:7}]},{name:`actors`,type:34,definition:[{name:`name`,type:3},{name:`subscribed`,type:5},{name:`signatureKeyHeight`,type:11},{name:`pkeKeyHeight`,type:11},{name:`sharedSecrets`,type:34,definition:[{name:`peerActorId`,type:7},{name:`height`,type:11}]},{name:`invitations`,type:34,definition:[{name:`channelId`,type:7},{name:`height`,type:11}]}]}]}],ui={label:`BlockInformation`,definition:[{name:`hash`,type:13},{name:`timestamp`,type:11},{name:`proposerAddress`,type:12},{name:`size`,type:11},{name:`microblockCount`,type:11}]},di={label:`BlockContent`,definition:[{name:`microblocks`,type:34,definition:[{name:`hash`,type:13},{name:`vbIdentifier`,type:13},{name:`vbType`,type:7},{name:`height`,type:11},{name:`size`,type:11},{name:`sectionCount`,type:11}]}]},fi=13,pi=58,mi=122,hi={label:`MicroblockHeader`,definition:[{name:`magicString`,type:3,size:4},{name:`protocolVersion`,type:8},{name:`microblockType`,type:7},{name:`height`,type:11},{name:`previousHash`,type:13},{name:`timestamp`,type:11},{name:`gas`,type:9},{name:`gasPrice`,type:10},{name:`bodyHash`,type:13},{name:`feesPayerAccount`,type:13}]},gi={label:`MicroblockSection`,definition:[{name:`type`,type:7},{name:`data`,type:12}]},_i={label:`MicroblockBody`,definition:[{name:`body`,type:34,schema:gi}]},vi={label:`MicroblockVbInformation`,definition:[{name:`virtualBlockchainType`,type:7},{name:`virtualBlockchainId`,type:13}]},yi=0,bi=1,xi=2,Si=3,Ci=4,wi=5,Ti=6,Ei=7,Di=8,Oi=9,ki=10,Ai=11,ji=12,Mi=13,Ni=14,Pi=15,Fi=16,Ii=17,Li=18,Ri=19,zi=20,Bi=21,Vi=22,Hi=23,Ui=24,Wi=25,Gi=26,Ki=27,qi=28,Ji=[];Ji[0]={label:`MessageError`,definition:[{name:`error`,type:3}]},Ji[1]={label:`MessageGetChainInformation`,definition:[]},Ji[2]={label:`MessageChainInformation`,definition:[{name:`height`,type:11},{name:`lastBlockTimestamp`,type:11},{name:`microblockCount`,type:11},{name:`objectCounts`,type:43,size:6}]},Ji[3]={label:`MessageGetBlockInformation`,definition:[{name:`height`,type:11}]},Ji[4]={label:`MessageBlockInformation`,definition:ui.definition},Ji[5]={label:`MessageGetBlockContent`,definition:[{name:`height`,type:11}]},Ji[6]={label:`MessageBlockContent`,definition:di.definition},Ji[7]={label:`MessageGetVirtualBlockchainState`,definition:[{name:`virtualBlockchainId`,type:13}]},Ji[8]={label:`MessageVirtualBlockchainState`,definition:[{name:`stateData`,type:12}]},Ji[9]={label:`MessageGetVirtualBlockchainUpdate`,definition:[{name:`virtualBlockchainId`,type:13},{name:`knownHeight`,type:11}]},Ji[10]={label:`MessageVirtualBlockchainUpdate`,definition:[{name:`exists`,type:5},{name:`changed`,type:5},{name:`stateData`,type:12},{name:`headers`,type:44}]},Ji[11]={label:`MessageGetMicroblockInformation`,definition:[{name:`hash`,type:13}]},Ji[12]={label:`MessageMicroblockInformation`,definition:[{name:`virtualBlockchainType`,type:7},{name:`virtualBlockchainId`,type:13},{name:`header`,type:12}]},Ji[13]={label:`MessageAwaitMicroblockAnchoring`,definition:[{name:`hash`,type:13}]},Ji[14]={label:`MessageMicroblockAnchoring`,definition:vi.definition},Ji[15]={label:`MessageGetMicroblockBodys`,definition:[{name:`hashes`,type:45}]},Ji[16]={label:`MessageMicroblockBodys`,definition:[{name:`list`,type:34,definition:[{name:`hash`,type:13},{name:`body`,type:12}]}]},Ji[17]={label:`MessageGetAccountState`,definition:[{name:`accountHash`,type:13}]},Ji[18]={label:`MessageAccountState`,definition:ii.definition},Ji[19]={label:`MessageGetAccountHistory`,definition:[{name:`accountHash`,type:13},{name:`lastHistoryHash`,type:13},{name:`maxRecords`,type:8}]},Ji[20]={label:`MessageAccountHistory`,definition:[{name:`list`,type:34,schema:ai}]},Ji[21]={label:`MessageGetAccountByPublicKeyHash`,definition:[{name:`publicKeyHash`,type:13}]},Ji[22]={label:`MessageAccountByPublicKeyHash`,definition:[{name:`accountHash`,type:13}]},Ji[23]={label:`MessageGetValidatorNodeByAddress`,definition:[{name:`address`,type:12}]},Ji[24]={label:`MessageValidatorNodeByAddress`,definition:[{name:`validatorNodeHash`,type:13}]},Ji[25]={label:`MessageGetObjectList`,definition:[{name:`type`,type:7}]},Ji[26]={label:`MessageObjectList`,definition:[{name:`list`,type:45}]},Ji[27]={label:`MessageGetGenesisSnapshot`,definition:[]},Ji[28]={label:`MessageGenesisSnapshot`,definition:[{name:`base64EncodedChunks`,type:35}]};var Yi={label:`WiQrCode`,definition:[{name:`qrId`,type:13},{name:`timestamp`,type:11},{name:`serverUrl`,type:3,size:100}]},Xi=0,Zi=1,Qi=2,$i=3,ea=4,ta=5,na=6,ra=7,ia=8,aa=[];aa[0]={label:`WiMsgRequest`,definition:[{name:`requestType`,type:7},{name:`request`,type:12},{name:`deviceId`,type:13},{name:`withToken`,type:7}]},aa[1]={label:`WiMsgUpdateQr`,definition:[{name:`qrId`,type:13},{name:`timestamp`,type:11}]},aa[2]={label:`WiMsgConnectionToken`,definition:[{name:`token`,type:13}]},aa[3]={label:`WiMsgForwardedAnswer`,definition:[{name:`answerType`,type:7},{name:`answer`,type:12}]},aa[4]={label:`WiMsgGetConnectionInfo`,definition:[{name:`qrId`,type:13}]},aa[5]={label:`WiMsgAnswer`,definition:[{name:`answerType`,type:7},{name:`answer`,type:12}]},aa[6]={label:`WiMsgConnectionInfo`,definition:[]},aa[7]={label:`WiMsgConnectionAccepted`,definition:[{name:`qrId`,type:13}]},aa[8]={label:`WiMsgForwardedRequest`,definition:[{name:`requestType`,type:7},{name:`request`,type:12}]};var oa={singles:[Xr,Zr,Qr,$r,ei,ti,ni,ri,hi,gi,_i,vi,Yi],collections:[{label:`VbState`,list:li},{label:`NodeMessage`,list:Ji},{label:`WiMessage`,list:aa}]},D=function(e){return e[e.AUXILIARY_SIGNATURE=126]=`AUXILIARY_SIGNATURE`,e[e.SIGNATURE=127]=`SIGNATURE`,e[e.ALLOWED_ADDITIONAL_WRITER=128]=`ALLOWED_ADDITIONAL_WRITER`,e[e.CUSTOM=129]=`CUSTOM`,e[e.PROTOCOL_CREATION=1]=`PROTOCOL_CREATION`,e[e.PROTOCOL_UPDATE=2]=`PROTOCOL_UPDATE`,e[e.PROTOCOL_VARIABLES=5]=`PROTOCOL_VARIABLES`,e[e.ACCOUNT_PUBLIC_KEY=17]=`ACCOUNT_PUBLIC_KEY`,e[e.ACCOUNT_TOKEN_ISSUANCE=18]=`ACCOUNT_TOKEN_ISSUANCE`,e[e.ACCOUNT_CREATION=19]=`ACCOUNT_CREATION`,e[e.ACCOUNT_TRANSFER=20]=`ACCOUNT_TRANSFER`,e[e.ACCOUNT_VESTING_TRANSFER=21]=`ACCOUNT_VESTING_TRANSFER`,e[e.ACCOUNT_ESCROW_TRANSFER=22]=`ACCOUNT_ESCROW_TRANSFER`,e[e.ACCOUNT_ESCROW_SETTLEMENT=23]=`ACCOUNT_ESCROW_SETTLEMENT`,e[e.ACCOUNT_STAKE=24]=`ACCOUNT_STAKE`,e[e.ACCOUNT_UNSTAKE=25]=`ACCOUNT_UNSTAKE`,e[e.VN_CREATION=33]=`VN_CREATION`,e[e.VN_COMETBFT_PUBLIC_KEY_DECLARATION=34]=`VN_COMETBFT_PUBLIC_KEY_DECLARATION`,e[e.VN_RPC_ENDPOINT=35]=`VN_RPC_ENDPOINT`,e[e.VN_APPROVAL=36]=`VN_APPROVAL`,e[e.VN_SLASHING_CANCELLATION=37]=`VN_SLASHING_CANCELLATION`,e[e.ORG_CREATION=52]=`ORG_CREATION`,e[e.ORG_DESCRIPTION=50]=`ORG_DESCRIPTION`,e[e.APP_CREATION=65]=`APP_CREATION`,e[e.APP_DESCRIPTION=66]=`APP_DESCRIPTION`,e[e.APP_LEDGER_ALLOWED_SIG_SCHEMES=80]=`APP_LEDGER_ALLOWED_SIG_SCHEMES`,e[e.APP_LEDGER_ALLOWED_PKE_SCHEMES=81]=`APP_LEDGER_ALLOWED_PKE_SCHEMES`,e[e.APP_LEDGER_CREATION=82]=`APP_LEDGER_CREATION`,e[e.APP_LEDGER_ACTOR_CREATION=83]=`APP_LEDGER_ACTOR_CREATION`,e[e.APP_LEDGER_CHANNEL_CREATION=84]=`APP_LEDGER_CHANNEL_CREATION`,e[e.APP_LEDGER_SHARED_SECRET=85]=`APP_LEDGER_SHARED_SECRET`,e[e.APP_LEDGER_CHANNEL_INVITATION=86]=`APP_LEDGER_CHANNEL_INVITATION`,e[e.APP_LEDGER_ACTOR_SUBSCRIPTION=87]=`APP_LEDGER_ACTOR_SUBSCRIPTION`,e[e.APP_LEDGER_PUBLIC_CHANNEL_DATA=88]=`APP_LEDGER_PUBLIC_CHANNEL_DATA`,e[e.APP_LEDGER_PRIVATE_CHANNEL_DATA=89]=`APP_LEDGER_PRIVATE_CHANNEL_DATA`,e[e.APP_LEDGER_AUTHOR=90]=`APP_LEDGER_AUTHOR`,e[e.APP_LEDGER_ENDORSEMENT_REQUEST=91]=`APP_LEDGER_ENDORSEMENT_REQUEST`,e}({}),sa=t({ACCOUNT_CREATION:()=>ha,ACCOUNT_ESCROW_SETTLEMENT:()=>ya,ACCOUNT_ESCROW_TRANSFER:()=>va,ACCOUNT_PUBLIC_KEY:()=>pa,ACCOUNT_STAKE:()=>ba,ACCOUNT_TOKEN_ISSUANCE:()=>ma,ACCOUNT_TRANSFER:()=>ga,ACCOUNT_VESTING_TRANSFER:()=>_a,ALL_SECTIONS_SCHEMAS:()=>Ka,APP_CREATION:()=>Aa,APP_DESCRIPTION:()=>ja,APP_LEDGER_ACTOR_CREATION:()=>Ia,APP_LEDGER_ACTOR_SUBSCRIPTION:()=>Ba,APP_LEDGER_ALLOWED_PKE_SCHEMES:()=>Pa,APP_LEDGER_ALLOWED_SIG_SCHEMES:()=>Na,APP_LEDGER_AUTHOR:()=>Ua,APP_LEDGER_CHANNEL_CREATION:()=>La,APP_LEDGER_CHANNEL_INVITATION:()=>za,APP_LEDGER_CREATION:()=>Fa,APP_LEDGER_ENDORSEMENT_REQUEST:()=>Wa,APP_LEDGER_PRIVATE_CHANNEL_DATA:()=>Ha,APP_LEDGER_PUBLIC_CHANNEL_DATA:()=>Va,APP_LEDGER_SHARED_SECRET:()=>Ra,DEF:()=>qa,ORG_CREATION:()=>Da,ORG_DESCRIPTION:()=>Oa,PROTOCOL_CREATION:()=>ua,PROTOCOL_UPDATE:()=>da,SIGNATURE:()=>ca,SIGNATURE_SCHEMA:()=>la,VN_APPROVAL:()=>Ta,VN_COMETBFT_PUBLIC_KEY_DECLARATION:()=>Ca,VN_CREATION:()=>Sa,VN_RPC_ENDPOINT:()=>wa}),ca=D.SIGNATURE,la={label:`SIGNATURE`,definition:[{name:`schemeId`,type:7},{name:`signature`,type:12}]},ua=D.PROTOCOL_CREATION,da=D.PROTOCOL_UPDATE,fa=[];fa[ua]={label:`PROTOCOL_CREATION`,definition:[{name:`organizationId`,type:13}]},fa[da]={label:`PROTOCOL_VARIABLES_UPDATE`,definition:[{name:`protocolVersion`,type:8},{name:`protocolVersionName`,type:3},{name:`changeLog`,type:3},{name:`protocolVariables`,type:2,schema:si}]};var pa=D.ACCOUNT_PUBLIC_KEY,ma=D.ACCOUNT_TOKEN_ISSUANCE,ha=D.ACCOUNT_CREATION,ga=D.ACCOUNT_TRANSFER,_a=D.ACCOUNT_VESTING_TRANSFER,va=D.ACCOUNT_ESCROW_TRANSFER,ya=D.ACCOUNT_ESCROW_SETTLEMENT,ba=D.ACCOUNT_STAKE,xa=[];xa[pa]={label:`ACCOUNT_PUBLIC_KEY`,definition:[{name:`publicKey`,type:12},{name:`schemeId`,type:7}]},xa[ma]={label:`ACCOUNT_TOKEN_ISSUANCE`,definition:[{name:`amount`,type:11}]},xa[ha]={label:`ACCOUNT_CREATION`,definition:[{name:`sellerAccount`,type:13},{name:`amount`,type:11}]},xa[ga]={label:`ACCOUNT_TRANSFER`,definition:[{name:`account`,type:13},{name:`amount`,type:11},{name:`publicReference`,type:3},{name:`privateReference`,type:3}]},xa[_a]={label:`ACCOUNT_VESTING_TRANSFER`,definition:[{name:`account`,type:13},{name:`amount`,type:11},{name:`publicReference`,type:3},{name:`privateReference`,type:3},{name:`cliffDurationDays`,type:8},{name:`vestingDurationDays`,type:8}]},xa[va]={label:`ACCOUNT_ESCROW_TRANSFER`,definition:[{name:`account`,type:13},{name:`amount`,type:11},{name:`publicReference`,type:3},{name:`privateReference`,type:3},{name:`escrowIdentifier`,type:13},{name:`agentAccount`,type:13},{name:`durationDays`,type:8}]},xa[ya]={label:`ACCOUNT_ESCROW_SETTLEMENT`,definition:[{name:`confirmed`,type:5},{name:`escrowIdentifier`,type:13}]},xa[ba]={label:`ACCOUNT_STAKE`,definition:[{name:`amount`,type:11},{name:`objectType`,type:7},{name:`objectIdentifier`,type:13}]};var Sa=D.VN_CREATION,Ca=D.VN_COMETBFT_PUBLIC_KEY_DECLARATION,wa=D.VN_RPC_ENDPOINT,Ta=D.VN_APPROVAL,Ea=[];Ea[Sa]={label:`VN_CREATION`,definition:[{name:`organizationId`,type:13}]},Ea[Ca]={label:`VN_COMETBFT_PUBLIC_KEY_DECLARATION`,definition:[{name:`cometPublicKeyType`,type:3},{name:`cometPublicKey`,type:3}]},Ea[wa]={label:`VN_RPC_ENDPOINT`,definition:[{name:`rpcEndpoint`,type:3}]},Ea[Ta]={label:`VN_APPROVAL`,definition:[{name:`status`,type:5}]};var Da=D.ORG_CREATION,Oa=D.ORG_DESCRIPTION,ka=[];ka[Da]={label:`ORG_CREATION`,definition:[{name:`accountId`,type:13}]},ka[Oa]={label:`ORG_DESCRIPTION`,definition:[{name:`name`,type:3},{name:`city`,type:3},{name:`countryCode`,type:3,size:2},{name:`website`,type:3}]};var Aa=D.APP_CREATION,ja=D.APP_DESCRIPTION,Ma=[];Ma[Aa]={label:`APP_CREATION`,definition:[{name:`organizationId`,type:13}]},Ma[ja]={label:`APP_DESCRIPTION`,definition:[{name:`name`,type:3},{name:`logoUrl`,type:3},{name:`homepageUrl`,type:3},{name:`description`,type:3}]};var Na=D.APP_LEDGER_ALLOWED_SIG_SCHEMES,Pa=D.APP_LEDGER_ALLOWED_PKE_SCHEMES,Fa=D.APP_LEDGER_CREATION,Ia=D.APP_LEDGER_ACTOR_CREATION,La=D.APP_LEDGER_CHANNEL_CREATION,Ra=D.APP_LEDGER_SHARED_SECRET,za=D.APP_LEDGER_CHANNEL_INVITATION,Ba=D.APP_LEDGER_ACTOR_SUBSCRIPTION,Va=D.APP_LEDGER_PUBLIC_CHANNEL_DATA,Ha=D.APP_LEDGER_PRIVATE_CHANNEL_DATA,Ua=D.APP_LEDGER_AUTHOR,Wa=D.APP_LEDGER_ENDORSEMENT_REQUEST,Ga=[];Ga[Na]={label:`APP_LEDGER_ALLOWED_SIG_SCHEMES`,definition:[{name:`schemeIds`,type:39}]},Ga[Pa]={label:`APP_LEDGER_ALLOWED_PKE_SCHEMES`,definition:[{name:`schemeIds`,type:39}]},Ga[Fa]={label:`APP_LEDGER_CREATION`,definition:[{name:`applicationId`,type:13}]},Ga[Ia]={label:`APP_LEDGER_ACTOR_CREATION`,definition:[{name:`id`,type:7},{name:`type`,type:7},{name:`name`,type:3}]},Ga[La]={label:`APP_LEDGER_CHANNEL_CREATION`,definition:[{name:`id`,type:7},{name:`isPrivate`,type:5},{name:`creatorId`,type:7},{name:`name`,type:3}]},Ga[Ra]={label:`APP_LEDGER_SHARED_SECRET`,definition:[{name:`hostId`,type:7},{name:`guestId`,type:7},{name:`encryptedSharedKey`,type:12}]},Ga[za]={label:`APP_LEDGER_CHANNEL_INVITATION`,definition:[{name:`channelId`,type:7},{name:`hostId`,type:7},{name:`guestId`,type:7},{name:`encryptedChannelKey`,type:12}]},Ga[Ba]={label:`APP_LEDGER_ACTOR_SUBSCRIPTION`,definition:[{name:`actorId`,type:7},{name:`actorType`,type:7},{name:`organizationId`,type:13},{name:`signatureSchemeId`,type:7},{name:`signaturePublicKey`,type:12},{name:`pkeSchemeId`,type:7},{name:`pkePublicKey`,type:12}]},Ga[Va]={label:`APP_LEDGER_PUBLIC_CHANNEL_DATA`,definition:[{name:`channelId`,type:7},{name:`data`,type:12}]},Ga[Ha]={label:`APP_LEDGER_PRIVATE_CHANNEL_DATA`,definition:[{name:`channelId`,type:7},{name:`merkleRootHash`,type:13},{name:`encryptedData`,type:12}]},Ga[Ua]={label:`APP_LEDGER_AUTHOR`,definition:[{name:`authorId`,type:7}]},Ga[Wa]={label:`APP_LEDGER_ENDORSEMENT_REQUEST`,definition:[{name:`endorserId`,type:7},{name:`message`,type:3}]};var Ka={...fa,...xa,...Ea,...ka,...Ma,...Ga},qa=[fa,xa,Ea,ka,Ma,Ga],Ja=t({WI_INVALID_SIGNATURE:()=>0}),Ya=0,Xa=function(e){return e[e.SECP256K1=0]=`SECP256K1`,e[e.ML_DSA_65=1]=`ML_DSA_65`,e[e.PKMS_SECP256K1=2]=`PKMS_SECP256K1`,e[e.ED25519=3]=`ED25519`,e}({}),Za=new TextEncoder,Qa=new TextDecoder,$a={encode:eo,decode:to};function eo(e){return Za.encode(e)}function to(e){return Qa.decode(e)}var no=class extends m{constructor(e){super(e,n.TYPE_CHECKING_FAILURE_ERROR)}},ro=126,io=class{static getType(e){switch(typeof e){case`string`:return 3;case`number`:return 4;case`boolean`:return 5;case`object`:if(e===null)return 6;if(Array.isArray(e))return 1;if(e instanceof Uint8Array)return 12;if(Object.getPrototypeOf(e).isPrototypeOf(Object))return 2}return 0}static isJsonType(e){return ro>>e&1}},ao=class{basicType;definition;value;constructor(e,t){this.definition=e,this.value=t,this.basicType=io.getType(t)}check(){let e=this.definition.type&31;switch(e){case 3:this.isString();break;case 4:this.isNumber();break;case 5:this.isBoolean();break;case 7:this.isUnsignedInteger(8);break;case 8:this.isUnsignedInteger(16);break;case 9:this.isUnsignedInteger(24);break;case 10:this.isUnsignedInteger(32);break;case 11:this.isUnsignedInteger(48);break;case 12:this.isBinary();break;case 13:this.isBinary(32);break;case 14:this.isHashString();break;default:throw`unexpected definition type ${e}`}}isString(){if(this.basicType!=3)throw`string expected`;if(this.definition.size){let e=$a.encode(this.value);this.checkSize(e.length,this.definition.size)}}isNumber(){if(this.basicType!=4)throw`number expected`}isBoolean(){if(this.basicType!=5)throw`Boolean value expected`}isInteger(){if(this.isNumber(),this.value%1)throw`integer expected`;if(this.value<-(2**53-1)||this.value>2**53-1)throw`value is outside the safe integer range`}isUnsignedInteger(e){if(this.isInteger(),this.value<0)throw new no(`non-negative value expected`);if(this.value>=2**e)throw Error(`value is too big (${e}-bit value expected)`)}isBinary(e){if(this.basicType!=12)throw`Uint8Array expected`;this.checkSize(this.value.length,e||this.definition.size)}isHashString(){if(this.isString(),this.checkSize(this.value.length,64),/[^\da-f]/i.test(this.value))throw`hexadecimal string expected`}checkSize(e,t){if(t!==void 0&&e!=t)throw`invalid size (expecting ${t}, got ${e})`}};function oo(e){return typeof e==`function`?e:so(e)}function so(e){if(e==null)return()=>!1;if(e===`fatal`)return e=>e.level===`fatal`;if(e===`error`)return e=>e.level===`fatal`||e.level===`error`;if(e===`warning`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`;if(e===`info`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`;if(e===`debug`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`||e.level===`debug`;if(e===`trace`)return()=>!0;throw TypeError(`Invalid log level: ${e}.`)}var co=[`trace`,`debug`,`info`,`warning`,`error`,`fatal`];function lo(e,t){let n=co.indexOf(e);if(n<0)throw TypeError(`Invalid log level: ${JSON.stringify(e)}.`);let r=co.indexOf(t);if(r<0)throw TypeError(`Invalid log level: ${JSON.stringify(t)}.`);return n-r}function uo(e=[]){return po.getLogger(e)}var fo=Symbol.for(`logtape.rootLogger`),po=class e{parent;children;category;sinks;parentSinks=`inherit`;filters;lowestLevel=`trace`;contextLocalStorage;static getLogger(t=[]){let n=fo in globalThis?globalThis[fo]??null:null;return n??(n=new e(null,[]),globalThis[fo]=n),typeof t==`string`?n.getChild(t):t.length===0?n:n.getChild(t)}constructor(e,t){this.parent=e,this.children={},this.category=t,this.sinks=[],this.filters=[]}getChild(t){let n=typeof t==`string`?t:t[0],r=this.children[n],i=r instanceof e?r:r?.deref();return i??(i=new e(this,[...this.category,n]),this.children[n]=`WeakRef`in globalThis?new WeakRef(i):i),typeof t==`string`||t.length===1?i:i.getChild(t.slice(1))}reset(){for(;this.sinks.length>0;)this.sinks.shift();for(this.parentSinks=`inherit`;this.filters.length>0;)this.filters.shift();this.lowestLevel=`trace`}resetDescendants(){for(let t of Object.values(this.children))(t instanceof e?t:t.deref())?.resetDescendants();this.reset()}with(e){return new mo(this,{...e})}filter(e){for(let t of this.filters)if(!t(e))return!1;return this.filters.length<1?this.parent?.filter(e)??!0:!0}*getSinks(e){if(!(this.lowestLevel===null||lo(e,this.lowestLevel)<0)){if(this.parent!=null&&this.parentSinks===`inherit`)for(let t of this.parent.getSinks(e))yield t;for(let e of this.sinks)yield e}}emit(e,t){let n=wo(),r=`category`in e?e.category:this.category,i=n.length>0?[...n,...r]:r,a=Object.getOwnPropertyDescriptors(e);a.category={value:i,enumerable:!0,configurable:!0};let o=Object.defineProperties({},a);if(!(this.lowestLevel===null||lo(o.level,this.lowestLevel)<0||!this.filter(o))){for(let e of this.getSinks(o.level))if(!t?.has(e))try{e(o)}catch(n){let r=new Set(t);r.add(e),ho.log(`fatal`,`Failed to emit a log record to sink {sink}: {error}`,{sink:e,error:n,record:o},r)}}}log(e,t,n,r){let i=To(),a,o=typeof n==`function`?{category:this.category,level:e,timestamp:Date.now(),get message(){return xo(t,this.properties)},rawMessage:t,get properties(){return a??={...i,...n()},a}}:{category:this.category,level:e,timestamp:Date.now(),message:xo(t,{...i,...n}),rawMessage:t,properties:{...i,...n}};this.emit(o,r)}logLazily(e,t,n={}){let r=To(),i,a;function o(){if((a==null||i==null)&&(a=t((e,...t)=>(i=e,So(e,t))),i==null))throw TypeError(`No log record was made.`);return[a,i]}this.emit({category:this.category,level:e,get message(){return o()[0]},get rawMessage(){return o()[1]},timestamp:Date.now(),properties:{...r,...n}})}logTemplate(e,t,n,r={}){let i=To();this.emit({category:this.category,level:e,message:So(t,n),rawMessage:t,timestamp:Date.now(),properties:{...i,...r}})}trace(e,...t){typeof e==`string`?this.log(`trace`,e,t[0]??{}):typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){typeof e==`string`?this.log(`debug`,e,t[0]??{}):typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){typeof e==`string`?this.log(`info`,e,t[0]??{}):typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){typeof e==`string`?this.log(`warning`,e,t[0]??{}):typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){this.warn(e,...t)}error(e,...t){typeof e==`string`?this.log(`error`,e,t[0]??{}):typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){typeof e==`string`?this.log(`fatal`,e,t[0]??{}):typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}},mo=class e{logger;properties;constructor(e,t){this.logger=e,this.properties=t}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(e){return this.logger.getChild(e).with(this.properties)}with(t){return new e(this.logger,{...this.properties,...t})}log(e,t,n,r){this.logger.log(e,t,typeof n==`function`?()=>({...this.properties,...n()}):{...this.properties,...n},r)}logLazily(e,t){this.logger.logLazily(e,t,this.properties)}logTemplate(e,t,n){this.logger.logTemplate(e,t,n,this.properties)}emit(e){let t={...e,properties:{...this.properties,...e.properties}};this.logger.emit(t)}trace(e,...t){typeof e==`string`?this.log(`trace`,e,t[0]??{}):typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){typeof e==`string`?this.log(`debug`,e,t[0]??{}):typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){typeof e==`string`?this.log(`info`,e,t[0]??{}):typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){typeof e==`string`?this.log(`warning`,e,t[0]??{}):typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){this.warn(e,...t)}error(e,...t){typeof e==`string`?this.log(`error`,e,t[0]??{}):typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){typeof e==`string`?this.log(`fatal`,e,t[0]??{}):typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}},ho=po.getLogger([`logtape`,`meta`]);function go(e){return e.includes(`.`)||e.includes(`[`)||e.includes(`?.`)}function _o(e,t){if(!(t===`__proto__`||t===`prototype`||t===`constructor`)&&(typeof e==`object`||typeof e==`function`)&&e!==null)return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function vo(e,t){let n=e.length,r=t;if(r>=n)return null;let i;if(e[r]===`[`){if(r++,r>=n)return null;if(e[r]===`"`||e[r]===`'`){let t=e[r];r++;let a=``;for(;r<n&&e[r]!==t;)if(e[r]===`\\`){if(r++,r<n){let t=e[r];switch(t){case`n`:a+=`
|
|
2
2
|
`;break;case`t`:a+=` `;break;case`r`:a+=`\r`;break;case`b`:a+=`\b`;break;case`f`:a+=`\f`;break;case`v`:a+=`\v`;break;case`0`:a+=`\0`;break;case`\\`:a+=`\\`;break;case`"`:a+=`"`;break;case`'`:a+=`'`;break;case`u`:if(r+4<n){let n=e.slice(r+1,r+5),i=Number.parseInt(n,16);Number.isNaN(i)?a+=t:(a+=String.fromCharCode(i),r+=4)}else a+=t;break;default:a+=t}r++}}else a+=e[r],r++;if(r>=n)return null;i=a,r++}else{let t=r;for(;r<n&&e[r]!==`]`&&e[r]!==`'`&&e[r]!==`"`;)r++;if(r>=n)return null;let a=e.slice(t,r);if(a.length===0)return null;let o=Number(a);i=Number.isNaN(o)?a:o}for(;r<n&&e[r]!==`]`;)r++;r<n&&r++}else{let t=r;for(;r<n&&e[r]!==`.`&&e[r]!==`[`&&e[r]!==`?`&&e[r]!==`]`;)r++;if(i=e.slice(t,r),i.length===0)return null}return r<n&&e[r]===`.`&&r++,{segment:i,nextIndex:r}}function yo(e,t){if(typeof t==`string`)return _o(e,t);if(Array.isArray(e)&&t>=0&&t<e.length)return e[t]}function bo(e,t){if(e==null||t.length===0||t.endsWith(`.`))return;let n=e,r=0,i=t.length;for(;r<i;){if(t.slice(r,r+2)===`?.`){if(r+=2,n==null)return}else if(n==null)return;let e=vo(t,r);if(e===null)return;let{segment:i,nextIndex:a}=e;if(r=a,n=yo(n,i),n===void 0)return}return n}function xo(e,t){let n=e.length;if(n===0)return[``];if(!e.includes(`{`))return[e];let r=[],i=0;for(let a=0;a<n;a++){let o=e[a];if(o===`{`){if((a+1<n?e[a+1]:``)===`{`){a++;continue}let o=e.indexOf(`}`,a+1);if(o===-1)continue;let s=e.slice(i,a);r.push(s.replace(/{{/g,`{`).replace(/}}/g,`}`));let c=e.slice(a+1,o),l,u=c.trim();u===`*`?l=c in t?t[c]:`*`in t?t[`*`]:t:(l=c===u||c in t?t[c]:t[u],l===void 0&&go(u)&&(l=bo(t,u))),r.push(l),a=o,i=a+1}else o===`}`&&a+1<n&&e[a+1]===`}`&&a++}let a=e.slice(i);return r.push(a.replace(/{{/g,`{`).replace(/}}/g,`}`)),r}function So(e,t){let n=[];for(let r=0;r<e.length;r++)n.push(e[r]),r<t.length&&n.push(t[r]);return n}var Co=Symbol.for(`logtape.categoryPrefix`);function wo(){let e=po.getLogger().contextLocalStorage?.getStore();if(e==null)return[];let t=e[Co];return Array.isArray(t)?t:[]}function To(){let e=po.getLogger().contextLocalStorage?.getStore();if(e==null)return{};let t={};for(let n of Object.keys(e))t[n]=e[n];return t}var Eo=t({inspect:()=>Do});function Do(e,t){let n=t?.compact===!0?void 0:2;return JSON.stringify(e,null,n)}var Oo={trace:`TRC`,debug:`DBG`,info:`INF`,warning:`WRN`,error:`ERR`,fatal:`FTL`},ko=typeof document<`u`||typeof navigator<`u`&&navigator.product===`ReactNative`?e=>JSON.stringify(e):`Deno`in globalThis&&`inspect`in globalThis.Deno&&typeof globalThis.Deno.inspect==`function`?(e,t)=>globalThis.Deno.inspect(e,{strAbbreviateSize:1/0,iterableLimit:1/0,...t}):Eo!=null&&`inspect`in Eo&&typeof Do==`function`?(e,t)=>Do(e,{maxArrayLength:1/0,maxStringLength:1/0,...t}):e=>JSON.stringify(e);function Ao(e){return e<10?`0${e}`:`${e}`}function jo(e){return e<10?`00${e}`:e<100?`0${e}`:`${e}`}var Mo={"date-time-timezone":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${Ao(t.getUTCMonth()+1)}-${Ao(t.getUTCDate())} ${Ao(t.getUTCHours())}:${Ao(t.getUTCMinutes())}:${Ao(t.getUTCSeconds())}.${jo(t.getUTCMilliseconds())} +00:00`},"date-time-tz":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${Ao(t.getUTCMonth()+1)}-${Ao(t.getUTCDate())} ${Ao(t.getUTCHours())}:${Ao(t.getUTCMinutes())}:${Ao(t.getUTCSeconds())}.${jo(t.getUTCMilliseconds())} +00`},"date-time":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${Ao(t.getUTCMonth()+1)}-${Ao(t.getUTCDate())} ${Ao(t.getUTCHours())}:${Ao(t.getUTCMinutes())}:${Ao(t.getUTCSeconds())}.${jo(t.getUTCMilliseconds())}`},"time-timezone":e=>{let t=new Date(e);return`${Ao(t.getUTCHours())}:${Ao(t.getUTCMinutes())}:${Ao(t.getUTCSeconds())}.${jo(t.getUTCMilliseconds())} +00:00`},"time-tz":e=>{let t=new Date(e);return`${Ao(t.getUTCHours())}:${Ao(t.getUTCMinutes())}:${Ao(t.getUTCSeconds())}.${jo(t.getUTCMilliseconds())} +00`},time:e=>{let t=new Date(e);return`${Ao(t.getUTCHours())}:${Ao(t.getUTCMinutes())}:${Ao(t.getUTCSeconds())}.${jo(t.getUTCMilliseconds())}`},date:e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${Ao(t.getUTCMonth()+1)}-${Ao(t.getUTCDate())}`},rfc3339:e=>new Date(e).toISOString(),none:()=>null},No={ABBR:Oo,abbr:{trace:`trc`,debug:`dbg`,info:`inf`,warning:`wrn`,error:`err`,fatal:`ftl`},FULL:{trace:`TRACE`,debug:`DEBUG`,info:`INFO`,warning:`WARNING`,error:`ERROR`,fatal:`FATAL`},full:{trace:`trace`,debug:`debug`,info:`info`,warning:`warning`,error:`error`,fatal:`fatal`},L:{trace:`T`,debug:`D`,info:`I`,warning:`W`,error:`E`,fatal:`F`},l:{trace:`t`,debug:`d`,info:`i`,warning:`w`,error:`e`,fatal:`f`}};function Po(e={}){let t=(()=>{let t=e.timestamp;return t==null?Mo[`date-time-timezone`]:t===`disabled`?Mo.none:typeof t==`string`&&t in Mo?Mo[t]:t})(),n=e.category??`·`,r=e.value?t=>e.value(t,ko):ko,i=(()=>{let t=e.level;return t==null||t===`ABBR`?e=>No.ABBR[e]:t===`abbr`?e=>No.abbr[e]:t===`FULL`?e=>No.FULL[e]:t===`full`?e=>No.full[e]:t===`L`?e=>No.L[e]:t===`l`?e=>No.l[e]:t})(),a=e.format??(({timestamp:e,level:t,category:n,message:r})=>`${e?`${e} `:``}[${t}] ${n}: ${r}`);return e=>{let o=e.message,s=o.length,c;if(s===1)c=o[0];else if(s<=6){c=``;for(let e=0;e<s;e++)c+=e%2==0?o[e]:r(o[e])}else{let e=Array(s);for(let t=0;t<s;t++)e[t]=t%2==0?o[t]:r(o[t]);c=e.join(``)}return`${a({timestamp:t(e.timestamp),level:i(e.level),category:typeof n==`function`?n(e.category):e.category.join(n),message:c,record:e})}\n`}}Po();var Fo=`\x1B[0m`,Io={black:`\x1B[30m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`},Lo={bold:`\x1B[1m`,dim:`\x1B[2m`,italic:`\x1B[3m`,underline:`\x1B[4m`,strikethrough:`\x1B[9m`},Ro={trace:null,debug:`blue`,info:`green`,warning:`yellow`,error:`red`,fatal:`magenta`};function zo(e={}){let t=e.format,n=e.timestampStyle===void 0?`dim`:e.timestampStyle,r=e.timestampColor??null,i=`${n==null?``:Lo[n]}${r==null?``:Io[r]}`,a=n==null&&r==null?``:Fo,o=e.levelStyle===void 0?`bold`:e.levelStyle,s=e.levelColors??Ro,c=e.categoryStyle===void 0?`dim`:e.categoryStyle,l=e.categoryColor??null,u=`${c==null?``:Lo[c]}${l==null?``:Io[l]}`,d=c==null&&l==null?``:Fo;return Po({timestamp:`date-time-tz`,value(e,t){return t(e,{colors:!0})},...e,format({timestamp:e,level:n,category:r,message:c,record:l}){let f=s[l.level];return e=`${i}${e}${a}`,n=`${o==null?``:Lo[o]}${f==null?``:Io[f]}${n}${o==null&&f==null?``:Fo}`,t==null?`${e} ${n} ${u}${r}:${d} ${c}`:t({timestamp:e,level:n,category:`${u}${r}${d}`,message:c,record:l})}})}zo();function Bo(e={}){if(!e.categorySeparator&&!e.message&&!e.properties)return e=>{if(e.message.length===3)return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:e.message[0]+JSON.stringify(e.message[1])+e.message[2],logger:e.category.join(`.`),properties:e.properties})+`
|
|
3
3
|
`;if(e.message.length===1)return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:e.message[0],logger:e.category.join(`.`),properties:e.properties})+`
|
|
4
4
|
`;let t=e.message[0];for(let n=1;n<e.message.length;n++)t+=n&1?JSON.stringify(e.message[n]):e.message[n];return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:t,logger:e.category.join(`.`),properties:e.properties})+`
|
|
@@ -1089,10 +1089,15 @@ var pn = /* @__PURE__ */ function(e) {
|
|
|
1089
1089
|
mul(t) {
|
|
1090
1090
|
return e.createAtomic(this.getAmountAsAtomic() * t);
|
|
1091
1091
|
}
|
|
1092
|
-
toString(t = pn.TOKEN) {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
case pn.
|
|
1092
|
+
toString(t = pn.TOKEN, n = {}) {
|
|
1093
|
+
let r = this.getAmountAsCMTS();
|
|
1094
|
+
switch (n.locale = n.locale === "system" ? void 0 : n.locale || "en-EN", t) {
|
|
1095
|
+
case pn.TOKEN: return `${Intl.NumberFormat(n.locale, {
|
|
1096
|
+
minimumFractionDigits: n.decimalPlaces === void 0 ? 0 : n.decimalPlaces,
|
|
1097
|
+
maximumFractionDigits: n.decimalPlaces === void 0 ? 8 : n.decimalPlaces,
|
|
1098
|
+
useGrouping: n.grouping || !1
|
|
1099
|
+
}).format(r)} ${e.getUnitLabel(t)}`;
|
|
1100
|
+
case pn.ATOMIC: return `${r} ${e.getUnitLabel(t)}`;
|
|
1096
1101
|
default: throw new y();
|
|
1097
1102
|
}
|
|
1098
1103
|
}
|
|
@@ -153,9 +153,20 @@ export declare class CMTSToken implements Currency {
|
|
|
153
153
|
* Converts the object to a string representation combining the amount and its unit label.
|
|
154
154
|
* The returned string typically includes the numerical value and its corresponding unit.
|
|
155
155
|
*
|
|
156
|
-
* @
|
|
156
|
+
* @param unit - The unit in which the value should be represented: either TokenUnit.TOKEN (default) or TokenUnit.ATOMIC
|
|
157
|
+
* @param options - Optional formatting configuration applied only when `unit === TokenUnit.TOKEN`.
|
|
158
|
+
* @param options.decimalPlaces - Fixed number of decimal places to display. No formatting if undefined (default).
|
|
159
|
+
* @param options.grouping - Whether to enable digit grouping (defaults to false)
|
|
160
|
+
* @param options.locale - BCP 47 locale string used for number formatting
|
|
161
|
+
* - If set to `"system"`, the runtime default locale is used.
|
|
162
|
+
* - If omitted, defaults to `"en-EN"`.
|
|
163
|
+
* @return {string} A string representation of the object in the format `"{amount} {unitLabel}"`.
|
|
157
164
|
*/
|
|
158
|
-
toString(unit?: TokenUnit
|
|
165
|
+
toString(unit?: TokenUnit, options?: {
|
|
166
|
+
decimalPlaces?: number;
|
|
167
|
+
grouping?: boolean;
|
|
168
|
+
locale?: string;
|
|
169
|
+
}): string;
|
|
159
170
|
/**
|
|
160
171
|
* Retrieves the label corresponding to the current unit of the token.
|
|
161
172
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/economics/currencies/token.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAIpC;;;;;;;;;;;;;GAaG;AACH,oBAAY,SAAS;IACjB,KAAK,SAAU,CAAQ,SAAS;IAChC,UAAU,QAAS,CAAI,wBAAwB;IAC/C,WAAW,OAAQ,CAAI,0BAA0B;IACjD,WAAW,MAAM,CAAM,2BAA2B;IAClD,WAAW,KAAK,CAAO,qDAAqD;IAC5E,MAAM,IAAI;CACb;AAED;;;;;;;;;;;;GAYG;AACH,oBAAY,cAAc;IACtB,KAAK,SAAS,CAAW,mBAAmB;IAC5C,UAAU,UAAU,CAAK,oBAAoB;IAC7C,WAAW,UAAU,CAAI,oBAAoB;IAC7C,WAAW,UAAU,CAAI,mBAAmB;IAC5C,WAAW,eAAU,CAAI,4CAA4C;IACrE,MAAM,UAAU;CACnB;AAGD;;GAEG;AACH,qBAAa,SAAU,YAAW,QAAQ;IAElB,OAAO,CAAC,MAAM;IAAlC,OAAO;IAEP;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,SAA2B;IAK/D,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;IAIhC,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM;IAIrC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAItC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAItC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAItC,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAIxC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM;IAIlC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IASlC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI;IAIX,MAAM,CAAC,OAAO;IAId;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM;IA0B1B,SAAS,CAAC,IAAI,GAAG,SAA2B,GAAG,MAAM;IAWrD;;;;;OAKG;IACH,iBAAiB;IAIjB;;;OAGG;IACH,eAAe;IAIf;;;;OAIG;IACH,UAAU,IAAI,OAAO;IAIrB,gBAAgB,IAAI,OAAO;IAI3B,UAAU,IAAI,OAAO;IAIrB,MAAM,IAAI,OAAO;IAKjB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIjC;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIxC;;;;;;OAMG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIrC;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IAIhC;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IAIhC;;;;;OAKG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAIhC
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/economics/currencies/token.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAIpC;;;;;;;;;;;;;GAaG;AACH,oBAAY,SAAS;IACjB,KAAK,SAAU,CAAQ,SAAS;IAChC,UAAU,QAAS,CAAI,wBAAwB;IAC/C,WAAW,OAAQ,CAAI,0BAA0B;IACjD,WAAW,MAAM,CAAM,2BAA2B;IAClD,WAAW,KAAK,CAAO,qDAAqD;IAC5E,MAAM,IAAI;CACb;AAED;;;;;;;;;;;;GAYG;AACH,oBAAY,cAAc;IACtB,KAAK,SAAS,CAAW,mBAAmB;IAC5C,UAAU,UAAU,CAAK,oBAAoB;IAC7C,WAAW,UAAU,CAAI,oBAAoB;IAC7C,WAAW,UAAU,CAAI,mBAAmB;IAC5C,WAAW,eAAU,CAAI,4CAA4C;IACrE,MAAM,UAAU;CACnB;AAGD;;GAEG;AACH,qBAAa,SAAU,YAAW,QAAQ;IAElB,OAAO,CAAC,MAAM;IAAlC,OAAO;IAEP;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,SAA2B;IAK/D,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;IAIhC,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM;IAIrC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAItC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAItC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAItC,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAIxC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM;IAIlC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IASlC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI;IAIX,MAAM,CAAC,OAAO;IAId;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM;IA0B1B,SAAS,CAAC,IAAI,GAAG,SAA2B,GAAG,MAAM;IAWrD;;;;;OAKG;IACH,iBAAiB;IAIjB;;;OAGG;IACH,eAAe;IAIf;;;;OAIG;IACH,UAAU,IAAI,OAAO;IAIrB,gBAAgB,IAAI,OAAO;IAI3B,UAAU,IAAI,OAAO;IAIrB,MAAM,IAAI,OAAO;IAKjB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIjC;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIxC;;;;;;OAMG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIrC;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IAIhC;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IAIhC;;;;;OAKG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAIhC;;;;;;;;;;;;OAYG;IACH,QAAQ,CACJ,IAAI,GAAE,SAA2B,EACjC,OAAO,GAAE;QACL,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACd,GACP,MAAM;IAsBT;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;CAO9B"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmts-dev/carmentis-sdk-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/carmentis-sdk-core.cjs",
|
|
7
7
|
"module": "./dist/carmentis-sdk-core.js",
|
|
8
|
-
"types": "./dist/
|
|
8
|
+
"types": "./dist/common.d.ts",
|
|
9
|
+
"typesVersions": {
|
|
10
|
+
"*": {
|
|
11
|
+
"*": [
|
|
12
|
+
"./dist/common.d.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
9
16
|
"exports": {
|
|
10
17
|
".": {
|
|
11
|
-
"import": "./dist/carmentis-sdk-core.
|
|
18
|
+
"import": "./dist/carmentis-sdk-core.js",
|
|
12
19
|
"require": "./dist/carmentis-sdk-core.cjs",
|
|
13
20
|
"types": "./dist/common.d.ts"
|
|
14
21
|
}
|