@hiero-ledger/sdk 2.78.0-beta.3 → 2.79.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd.js +45 -10
- package/dist/umd.min.js +3 -3
- package/lib/Executable.cjs +27 -0
- package/lib/Executable.js +1 -1
- package/lib/Executable.js.map +1 -1
- package/lib/channel/WebChannel.cjs +1 -1
- package/lib/channel/WebChannel.js +1 -1
- package/lib/channel/WebChannel.js.map +1 -1
- package/lib/client/Network.cjs +1 -4
- package/lib/client/Network.js +1 -1
- package/lib/client/Network.js.map +1 -1
- package/lib/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/client/addressbooks/previewnet.cjs +1 -1
- package/lib/client/addressbooks/previewnet.d.ts +1 -1
- package/lib/client/addressbooks/previewnet.js +1 -1
- package/lib/client/addressbooks/previewnet.js.map +1 -1
- package/lib/client/addressbooks/testnet.cjs +1 -1
- package/lib/client/addressbooks/testnet.d.ts +1 -1
- package/lib/client/addressbooks/testnet.js +1 -1
- package/lib/client/addressbooks/testnet.js.map +1 -1
- package/lib/transaction/Transaction.cjs +1 -0
- package/lib/transaction/Transaction.js +1 -1
- package/lib/transaction/Transaction.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/Executable.js +37 -0
- package/src/channel/WebChannel.js +3 -1
- package/src/client/Network.js +1 -6
- package/src/client/addressbooks/mainnet.js +1 -1
- package/src/client/addressbooks/previewnet.js +1 -1
- package/src/client/addressbooks/testnet.js +1 -1
- package/src/transaction/Transaction.js +1 -0
package/dist/umd.min.js
CHANGED
|
@@ -45,7 +45,7 @@ const _0n$3=BigInt(0),_1n$4=BigInt(1),_2n$2=BigInt(2);function isBytes$1(e){retu
|
|
|
45
45
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1);function constTimeNegate(e,t){const n=t.negate();return e?n:t}function validateW(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function calcWOpts(e,t){validateW(e,t);return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}function validateMSMPoints(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function validateMSMScalars(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(e){return pointWindowSizes.get(e)||1}function wNAF(e,t){return{constTimeNegate:constTimeNegate,hasPrecomputes:e=>1!==getW(e),unsafeLadder(t,n,r=e.ZERO){let o=t;for(;n>_0n$1;)n&_1n$2&&(r=r.add(o)),o=o.double(),n>>=_1n$2;return r},precomputeWindow(e,n){const{windows:r,windowSize:o}=calcWOpts(n,t),i=[];let a=e,s=a;for(let e=0;e<r;e++){s=a,i.push(s);for(let e=1;e<o;e++)s=s.add(a),i.push(s);a=s.double()}return i},wNAF(n,r,o){const{windows:i,windowSize:a}=calcWOpts(n,t);let s=e.ZERO,c=e.BASE;const u=BigInt(2**n-1),l=2**n,d=BigInt(n);for(let e=0;e<i;e++){const t=e*a;let n=Number(o&u);o>>=d,n>a&&(n-=l,o+=_1n$2);const i=t,p=t+Math.abs(n)-1,h=e%2!=0,f=n<0;0===n?c=c.add(constTimeNegate(h,r[i])):s=s.add(constTimeNegate(f,r[p]))}return{p:s,f:c}},wNAFUnsafe(n,r,o,i=e.ZERO){const{windows:a,windowSize:s}=calcWOpts(n,t),c=BigInt(2**n-1),u=2**n,l=BigInt(n);for(let e=0;e<a;e++){const t=e*s;if(o===_0n$1)break;let n=Number(o&c);if(o>>=l,n>s&&(n-=u,o+=_1n$2),0===n)continue;let a=r[t+Math.abs(n)-1];n<0&&(a=a.negate()),i=i.add(a)}return i},getPrecomputes(e,t,n){let r=pointPrecomputes.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&pointPrecomputes.set(t,n(r))),r},wNAFCached(e,t,n){const r=getW(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){const o=getW(e);return 1===o?this.unsafeLadder(e,t,r):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),t,r)},setWindowSize(e,n){validateW(n,t),pointWindowSizes.set(e,n),pointPrecomputes.delete(e)}}}function pippenger(e,t,n,r){if(validateMSMPoints(n,e),validateMSMScalars(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,i=bitLen(BigInt(n.length)),a=i>12?i-3:i>4?i-2:i?2:1,s=(1<<a)-1,c=new Array(s+1).fill(o);let u=o;for(let e=Math.floor((t.BITS-1)/a)*a;e>=0;e-=a){c.fill(o);for(let t=0;t<r.length;t++){const o=r[t],i=Number(o>>BigInt(e)&BigInt(s));c[i]=c[i].add(n[t])}let t=o;for(let e=c.length-1,n=o;e>0;e--)n=n.add(c[e]),t=t.add(n);if(u=u.add(t),0!==e)for(let e=0;e<a;e++)u=u.double()}return u}function validateBasic(e){return validateField(e.Fp),validateObject(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}
|
|
46
46
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validateSigVerOpts(e){void 0!==e.lowS&&abool("lowS",e.lowS),void 0!==e.prehash&&abool("prehash",e.prehash)}function validatePointOpts(e){const t=validateBasic(e);validateObject(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut;class DERErr extends Error{constructor(e=""){super(e)}}const DER={Err:DERErr,_tlv:{encode:(e,t)=>{const{Err:n}=DER;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=numberToHexUnpadded(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?numberToHexUnpadded(o.length/2|128):"";return numberToHexUnpadded(e)+i+o+t},decode(e,t){const{Err:n}=DER;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++];let i=0;if(!!(128&o)){const e=127&o;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const a=t.subarray(r,r+e);if(a.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===a[0])throw new n("tlv.decode(long): zero leftmost byte");for(const e of a)i=i<<8|e;if(r+=e,i<128)throw new n("tlv.decode(long): not minimal encoding")}else i=o;const a=t.subarray(r,r+i);if(a.length!==i)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=DER;if(e<_0n)throw new t("integer: negative integers are not allowed");let n=numberToHexUnpadded(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=DER;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return b2n(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=DER,o="string"==typeof e?h2b(e):e;abytes(o);const{v:i,l:a}=r.decode(48,o);if(a.length)throw new t("invalid signature: left bytes after parsing");const{v:s,l:c}=r.decode(2,i),{v:u,l:l}=r.decode(2,c);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(s),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=DER,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},_0n=BigInt(0),_1n$1=BigInt(1);BigInt(2);const _3n=BigInt(3);function weierstrassPoints(e){const t=validatePointOpts(e),{Fp:n}=t,r=Field(t.n,t.nBitLength),o=t.toBytes||((e,t,r)=>{const o=t.toAffine();return concatBytes(Uint8Array.from([4]),n.toBytes(o.x),n.toBytes(o.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function a(e){const{a:r,b:o}=t,i=n.sqr(e),a=n.mul(i,e);return n.add(n.add(a,n.mul(e,r)),o)}if(!n.eql(n.sqr(t.Gy),a(t.Gx)))throw new Error("bad generator point: equation left != right");function s(e){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:o,n:i}=t;if(n&&"bigint"!=typeof e){if(isBytes$1(e)&&(e=bytesToHex(e)),"string"!=typeof e||!n.includes(e.length))throw new Error("invalid private key");e=e.padStart(2*r,"0")}let a;try{a="bigint"==typeof e?e:bytesToNumberBE(ensureBytes("private key",e,r))}catch(t){throw new Error("invalid private key, expected hex or "+r+" bytes, got "+typeof e)}return o&&(a=mod(a,i)),aInRange("private key",a,_1n$1,i),a}function c(e){if(!(e instanceof d))throw new Error("ProjectivePoint expected")}const u=memoized((e,t)=>{const{px:r,py:o,pz:i}=e;if(n.eql(i,n.ONE))return{x:r,y:o};const a=e.is0();null==t&&(t=a?n.ONE:n.inv(i));const s=n.mul(r,t),c=n.mul(o,t),u=n.mul(i,t);if(a)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:c}}),l=memoized(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:r,y:o}=e.toAffine();if(!n.isValid(r)||!n.isValid(o))throw new Error("bad point: x or y not FE");const i=n.sqr(o),s=a(r);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class d{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!n.isValid(e))throw new Error("x required");if(null==t||!n.isValid(t))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required");Object.freeze(this)}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof d)throw new Error("projective point not allowed");const o=e=>n.eql(e,n.ZERO);return o(t)&&o(r)?d.ZERO:new d(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(d.fromAffine)}static fromHex(e){const t=d.fromAffine(i(ensureBytes("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(s(e))}static msm(e,t){return pippenger(d,r,e,t)}_setWindowSize(e){h.setWindowSize(this,e)}assertValidity(){l(this)}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){c(e);const{px:t,py:r,pz:o}=this,{px:i,py:a,pz:s}=e,u=n.eql(n.mul(t,s),n.mul(i,o)),l=n.eql(n.mul(r,s),n.mul(a,o));return u&&l}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,o=n.mul(r,_3n),{px:i,py:a,pz:s}=this;let c=n.ZERO,u=n.ZERO,l=n.ZERO,p=n.mul(i,i),h=n.mul(a,a),f=n.mul(s,s),y=n.mul(i,a);return y=n.add(y,y),l=n.mul(i,s),l=n.add(l,l),c=n.mul(e,l),u=n.mul(o,f),u=n.add(c,u),c=n.sub(h,u),u=n.add(h,u),u=n.mul(c,u),c=n.mul(y,c),l=n.mul(o,l),f=n.mul(e,f),y=n.sub(p,f),y=n.mul(e,y),y=n.add(y,l),l=n.add(p,p),p=n.add(l,p),p=n.add(p,f),p=n.mul(p,y),u=n.add(u,p),f=n.mul(a,s),f=n.add(f,f),p=n.mul(f,y),c=n.sub(c,p),l=n.mul(f,h),l=n.add(l,l),l=n.add(l,l),new d(c,u,l)}add(e){c(e);const{px:r,py:o,pz:i}=this,{px:a,py:s,pz:u}=e;let l=n.ZERO,p=n.ZERO,h=n.ZERO;const f=t.a,y=n.mul(t.b,_3n);let m=n.mul(r,a),g=n.mul(o,s),_=n.mul(i,u),b=n.add(r,o),I=n.add(a,s);b=n.mul(b,I),I=n.add(m,g),b=n.sub(b,I),I=n.add(r,i);let T=n.add(a,u);return I=n.mul(I,T),T=n.add(m,_),I=n.sub(I,T),T=n.add(o,i),l=n.add(s,u),T=n.mul(T,l),l=n.add(g,_),T=n.sub(T,l),h=n.mul(f,I),l=n.mul(y,_),h=n.add(l,h),l=n.sub(g,h),h=n.add(g,h),p=n.mul(l,h),g=n.add(m,m),g=n.add(g,m),_=n.mul(f,_),I=n.mul(y,I),g=n.add(g,_),_=n.sub(m,_),_=n.mul(f,_),I=n.add(I,_),m=n.mul(g,I),p=n.add(p,m),m=n.mul(T,I),l=n.mul(b,l),l=n.sub(l,m),m=n.mul(b,g),h=n.mul(T,h),h=n.add(h,m),new d(l,p,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return h.wNAFCached(this,e,d.normalizeZ)}multiplyUnsafe(e){const{endo:r,n:o}=t;aInRange("scalar",e,_0n,o);const i=d.ZERO;if(e===_0n)return i;if(this.is0()||e===_1n$1)return this;if(!r||h.hasPrecomputes(this))return h.wNAFCachedUnsafe(this,e,d.normalizeZ);let{k1neg:a,k1:s,k2neg:c,k2:u}=r.splitScalar(e),l=i,p=i,f=this;for(;s>_0n||u>_0n;)s&_1n$1&&(l=l.add(f)),u&_1n$1&&(p=p.add(f)),f=f.double(),s>>=_1n$1,u>>=_1n$1;return a&&(l=l.negate()),c&&(p=p.negate()),p=new d(n.mul(p.px,r.beta),p.py,p.pz),l.add(p)}multiply(e){const{endo:r,n:o}=t;let i,a;if(aInRange("scalar",e,_1n$1,o),r){const{k1neg:t,k1:o,k2neg:s,k2:c}=r.splitScalar(e);let{p:u,f:l}=this.wNAF(o),{p:p,f:f}=this.wNAF(c);u=h.constTimeNegate(t,u),p=h.constTimeNegate(s,p),p=new d(n.mul(p.px,r.beta),p.py,p.pz),i=u.add(p),a=l.add(f)}else{const{p:t,f:n}=this.wNAF(e);i=t,a=n}return d.normalizeZ([i,a])[0]}multiplyAndAddUnsafe(e,t,n){const r=d.BASE,o=(e,t)=>t!==_0n&&t!==_1n$1&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),i=o(this,t).add(o(e,n));return i.is0()?void 0:i}toAffine(e){return u(this,e)}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===_1n$1)return!0;if(n)return n(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===_1n$1?this:n?n(d,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return abool("isCompressed",e),this.assertValidity(),o(d,this,e)}toHex(e=!0){return abool("isCompressed",e),bytesToHex(this.toRawBytes(e))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const p=t.nBitLength,h=wNAF(d,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:s,weierstrassEquation:a,isWithinCurveOrder:function(e){return inRange(e,_1n$1,t.n)}}}function validateOpts(e){const t=validateBasic(e);return validateObject(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function weierstrass(e){const t=validateOpts(e),{Fp:n,n:r}=t,o=n.BYTES+1,i=2*n.BYTES+1;function a(e){return mod(e,r)}function s(e){return invert(e,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:d}=weierstrassPoints({...t,toBytes(e,t,r){const o=t.toAffine(),i=n.toBytes(o.x),a=concatBytes;return abool("isCompressed",r),r?a(Uint8Array.from([t.hasEvenY()?2:3]),i):a(Uint8Array.from([4]),i,n.toBytes(o.y))},fromBytes(e){const t=e.length,r=e[0],a=e.subarray(1);if(t!==o||2!==r&&3!==r){if(t===i&&4===r){return{x:n.fromBytes(a.subarray(0,n.BYTES)),y:n.fromBytes(a.subarray(n.BYTES,2*n.BYTES))}}throw new Error("invalid Point, expected length of "+o+", or uncompressed "+i+", got "+t)}{const e=bytesToNumberBE(a);if(!inRange(e,_1n$1,n.ORDER))throw new Error("Point is not on curve");const t=l(e);let o;try{o=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return!(1&~r)!==((o&_1n$1)===_1n$1)&&(o=n.neg(o)),{x:e,y:o}}}}),p=e=>bytesToHex(numberToBytesBE(e,t.nByteLength));function h(e){return e>r>>_1n$1}const f=(e,t,n)=>bytesToNumberBE(e.slice(t,n));class y{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=ensureBytes("compactSignature",e,2*n),new y(f(e,0,n),f(e,n,2*n))}static fromDER(e){const{r:t,s:n}=DER.toSig(ensureBytes("DER",e));return new y(t,n)}assertValidity(){aInRange("r",this.r,_1n$1,r),aInRange("s",this.s,_1n$1,r)}addRecoveryBit(e){return new y(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:o,recovery:i}=this,u=b(ensureBytes("msgHash",e));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const l=2===i||3===i?r+t.n:r;if(l>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=1&i?"03":"02",h=c.fromHex(d+p(l)),f=s(l),y=a(-u*f),m=a(o*f),g=c.BASE.multiplyAndAddUnsafe(h,y,m);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}const m={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=getMinHashLength(t.n);return mapHashToField(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function g(e){const t=isBytes$1(e),n="string"==typeof e,r=(t||n)&&e.length;return t?r===o||r===i:n?r===2*o||r===2*i:e instanceof c}const _=t.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const n=bytesToNumberBE(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},b=t.bits2int_modN||function(e){return a(_(e))},I=bitMask(t.nBitLength);function T(e){return aInRange("num < 2^"+t.nBitLength,e,_0n,I),numberToBytesBE(e,t.nByteLength)}function k(e,r,o=S){if(["recovered","canonical"].some(e=>e in o))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:l}=t;let{lowS:p,prehash:f,extraEntropy:m}=o;null==p&&(p=!0),e=ensureBytes("msgHash",e),validateSigVerOpts(o),f&&(e=ensureBytes("prehashed msgHash",i(e)));const g=b(e),I=u(r),k=[T(I),T(g)];if(null!=m&&!1!==m){const e=!0===m?l(n.BYTES):m;k.push(ensureBytes("extraEntropy",e))}const w=concatBytes(...k),A=g;return{seed:w,k2sig:function(e){const t=_(e);if(!d(t))return;const n=s(t),r=c.BASE.multiply(t).toAffine(),o=a(r.x);if(o===_0n)return;const i=a(n*a(A+o*I));if(i===_0n)return;let u=(r.x===o?0:2)|Number(r.y&_1n$1),l=i;return p&&h(i)&&(l=function(e){return h(e)?a(-e):e}(i),u^=1),new y(o,l,u)}}}const S={lowS:t.lowS,prehash:!1},w={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(g(e))throw new Error("first arg must be private key");if(!g(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(n)},sign:function(e,n,r=S){const{seed:o,k2sig:i}=k(e,n,r),a=t;return createHmacDrbg(a.hash.outputLen,a.nByteLength,a.hmac)(o,i)},verify:function(e,n,r,o=w){const i=e;n=ensureBytes("msgHash",n),r=ensureBytes("publicKey",r);const{lowS:u,prehash:l,format:d}=o;if(validateSigVerOpts(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==d&&"compact"!==d&&"der"!==d)throw new Error("format must be compact or der");const p="string"==typeof i||isBytes$1(i),h=!p&&!d&&"object"==typeof i&&null!==i&&"bigint"==typeof i.r&&"bigint"==typeof i.s;if(!p&&!h)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let f,m;try{if(h&&(f=new y(i.r,i.s)),p){try{"compact"!==d&&(f=y.fromDER(i))}catch(e){if(!(e instanceof DER.Err))throw e}f||"der"===d||(f=y.fromCompact(i))}m=c.fromHex(r)}catch(e){return!1}if(!f)return!1;if(u&&f.hasHighS())return!1;l&&(n=t.hash(n));const{r:g,s:_}=f,I=b(n),T=s(_),k=a(I*T),S=a(g*T),A=c.BASE.multiplyAndAddUnsafe(m,k,S)?.toAffine();return!!A&&a(A.x)===g},ProjectivePoint:c,Signature:y,utils:m}}
|
|
47
47
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(e){return{hash:e,hmac:(t,...n)=>hmac(e,t,concatBytes$1(...n)),randomBytes:randomBytes}}function createCurve(e,t){const n=t=>weierstrass({...e,...getHash(t)});return{...n(t),create:n}}
|
|
48
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(4);const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n=BigInt(1),_2n=BigInt(2),divNearest=(e,t)=>(e+t/_2n)/t;function sqrtMod(e){const t=secp256k1P,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=pow2(l,n,t)*l%t,p=pow2(d,n,t)*l%t,h=pow2(p,_2n,t)*u%t,f=pow2(h,o,t)*h%t,y=pow2(f,i,t)*f%t,m=pow2(y,s,t)*y%t,g=pow2(m,c,t)*m%t,_=pow2(g,s,t)*y%t,b=pow2(_,n,t)*l%t,I=pow2(b,a,t)*f%t,T=pow2(I,r,t)*u%t,k=pow2(T,_2n,t);if(!Fpk1.eql(Fpk1.sqr(k),e))throw new Error("Cannot find square root");return k}const Fpk1=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fpk1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=secp256k1N,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,a=BigInt("0x100000000000000000000000000000000"),s=divNearest(i*e,t),c=divNearest(-r*e,t);let u=mod(e-s*n-c*o,t),l=mod(-s*r-c*i,t);const d=u>a,p=l>a;if(d&&(u=t-u),p&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:p,k2:l}}}},sha256);BigInt(0),secp256k1.ProjectivePoint;const N=secp256k1.CURVE.n,HARDENED_BIT$1=2147483648;async function derive$1(e,t,n){const r=isHardenedIndex(n),o=new Uint8Array(37),i=secp256k1.getPublicKey(e,!0);r?(o[0]=0,o.set(e,1)):o.set(i,0),new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(33,n,!1);const a=await hash(HashAlgorithm.Sha512,t,o),s=a.subarray(0,32),c=a.subarray(32);try{const r=bytesToNumberBE(e),o=(r+bytesToNumberBE(s))%N;if(0n===o)return derive$1(e,t,n+1);return{keyData:numberToBytesBE(o,32),chainCode:c}}catch{return derive$1(e,t,n+1)}}async function fromSeed$1(e){if(e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");const t=await hash(HashAlgorithm.Sha512,"Bitcoin seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}function toHardenedIndex(e){return e|HARDENED_BIT$1}function isHardenedIndex(e){return 0!==(e&HARDENED_BIT$1)}async function derive(e,t,n){if(isHardenedIndex(n))throw new Error("the index should not be pre-hardened");const r=new Uint8Array(37);r[0]=0,r.set(e,1),new DataView(r.buffer,r.byteOffset,r.byteLength).setUint32(33,n,!1),r[33]|=128;const o=await hash(HashAlgorithm.Sha512,t,r);return{keyData:o.subarray(0,32),chainCode:o.subarray(32)}}async function fromSeed(e){const t=await hash(HashAlgorithm.Sha512,"ed25519 seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}const derPrefix$2="302e020100300506032b657004220420",derPrefixBytes$2=decode$6(derPrefix$2);class Ed25519PrivateKey{constructor(e,t){this._keyPair=e instanceof Uint8Array?nacl.sign.keyPair.fromSeed(e):e,this._chainCode=null!=t?t:null}get _type(){return"ED25519"}static generate(){const e=bytes(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static async generateAsync(){const e=await bytesAsync(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static fromBytes(e){switch(e.length){case 48:return Ed25519PrivateKey.fromBytesDer(e);case 32:case 64:return Ed25519PrivateKey.fromBytesRaw(e);default:throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}}static fromBytesDer(e){let t;try{const n=new Uint8Array(e),r=n.subarray(0,e.length-32).every((e,t)=>derPrefixBytes$2[t]===e);if(!r)throw new BadKeyError("invalid DER prefix for ED25519 private key");t=n.slice(e.length-32)}catch(e){const t=null!=e&&null!=e.message?e.message:"";throw new BadKeyError(`cannot decode ED25519 private key data from DER format: ${t}`)}const n=nacl.sign.keyPair.fromSeed(t);return new Ed25519PrivateKey(n)}static fromBytesRaw(e){switch(e.length){case 32:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e));case 64:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSecretKey(e))}throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}static fromString(e){return Ed25519PrivateKey.fromBytes(decode$6(e))}static fromStringDer(e){return Ed25519PrivateKey.fromBytesDer(decode$6(e))}static fromStringRaw(e){return Ed25519PrivateKey.fromBytesRaw(decode$6(e))}static async fromSeed(e){const{keyData:t,chainCode:n}=await fromSeed(e);return new Ed25519PrivateKey(t,n)}get publicKey(){return new Ed25519PublicKey(this._keyPair.publicKey)}sign(e){return nacl.sign.detached(e,this._keyPair.secretKey)}toBytesDer(){const e=new Uint8Array(derPrefixBytes$2.length+32),t=this._keyPair.secretKey.subarray(0,32),n=32-t.length,r=derPrefixBytes$2.length+n;return e.set(derPrefixBytes$2,0),e.set(t,r),e}toBytesRaw(){return this._keyPair.secretKey.slice(0,32)}}const HEX_CHARS$1="0123456789abcdef".split(""),KECCAK_PADDING$1=[1,256,65536,16777216],SHIFT$1=[0,8,16,24],RC$1=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak$1=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update$1=(e,t)=>{for(var n,r,o=t.length,i=e.blocks,a=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<o;){if(e.reset)for(e.reset=!1,i[0]=e.block,n=1;n<s+1;++n)i[n]=0;if("string"!=typeof t)for(n=e.start;l<o&&n<a;++l)i[n>>2]|=t[l]<<SHIFT$1[3&n++];else for(n=e.start;l<o&&n<a;++l)(r=t.charCodeAt(l))<128?i[n>>2]|=r<<SHIFT$1[3&n++]:r<2048?(i[n>>2]|=(192|r>>6)<<SHIFT$1[3&n++],i[n>>2]|=(128|63&r)<<SHIFT$1[3&n++]):r<55296||r>=57344?(i[n>>2]|=(224|r>>12)<<SHIFT$1[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT$1[3&n++],i[n>>2]|=(128|63&r)<<SHIFT$1[3&n++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++l)),i[n>>2]|=(240|r>>18)<<SHIFT$1[3&n++],i[n>>2]|=(128|r>>12&63)<<SHIFT$1[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT$1[3&n++],i[n>>2]|=(128|63&r)<<SHIFT$1[3&n++]);if(e.lastByteIndex=n,n>=a){for(e.start=n-a,e.block=i[s],n=0;n<s;++n)u[n]^=i[n];f$1(u),e.reset=!0}else e.start=n}if(i[(n=e.lastByteIndex)>>2]|=KECCAK_PADDING$1[3&n],e.lastByteIndex===a)for(i[0]=i[s],n=1;n<s+1;++n)i[n]=0;for(i[s-1]|=2147483648,n=0;n<s;++n)u[n]^=i[n];f$1(u);var d,p="",h=0;for(n=0;h<c;){for(n=0;n<s&&h<c;++n,++h)d=u[n],p+=HEX_CHARS$1[d>>4&15]+HEX_CHARS$1[15&d]+HEX_CHARS$1[d>>12&15]+HEX_CHARS$1[d>>8&15]+HEX_CHARS$1[d>>20&15]+HEX_CHARS$1[d>>16&15]+HEX_CHARS$1[d>>28&15]+HEX_CHARS$1[d>>24&15];h%s===0&&(f$1(u),n=0)}return"0x"+p},f$1=e=>{var t,n,r,o,i,a,s,c,u,l,d,p,h,f,y,m,g,_,b,I,T,k,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,K,M,H,j,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ie,ae,se,ce,ue;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=i^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(p<<1|h>>>31),n=u^(h<<1|p>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(o<<1|i>>>31),n=d^(i<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,f=e[0],y=e[1],$=e[11]<<4|e[10]>>>28,z=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,w=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,re=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,K=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,T=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,E=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,M=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=f^~m&_,e[1]=y^~g&b,e[10]=w^~v&O,e[11]=A^~E&N,e[20]=B^~x&U,e[21]=L^~F&K,e[30]=q^~$&W,e[31]=V^~z&Y,e[40]=ee^~ne&oe,e[41]=te^~re&ie,e[2]=m^~_&I,e[3]=g^~b&T,e[12]=v^~O&P,e[13]=E^~N&R,e[22]=x^~U&M,e[23]=F^~K&H,e[32]=$^~W&Q,e[33]=z^~Y&X,e[42]=ne^~oe&ae,e[43]=re^~ie&se,e[4]=_^~I&k,e[5]=b^~T&S,e[14]=O^~P&C,e[15]=N^~R&D,e[24]=U^~M&j,e[25]=K^~H&G,e[34]=W^~Q&Z,e[35]=Y^~X&J,e[44]=oe^~ae&ce,e[45]=ie^~se&ue,e[6]=I^~k&f,e[7]=T^~S&y,e[16]=P^~C&w,e[17]=R^~D&A,e[26]=M^~j&B,e[27]=H^~G&L,e[36]=Q^~Z&q,e[37]=X^~J&V,e[46]=ae^~ce&ee,e[47]=se^~ue&te,e[8]=k^~f&m,e[9]=S^~y&g,e[18]=C^~w&v,e[19]=D^~A&E,e[28]=j^~B&x,e[29]=G^~L&F,e[38]=Z^~q&$,e[39]=J^~V&z,e[48]=ce^~ee&ne,e[49]=ue^~te&re,e[0]^=RC$1[r],e[1]^=RC$1[r+1]},keccak$1=e=>t=>{var n;if("0x"===t.slice(0,2)){n=[];for(var r=2,o=t.length;r<o;r+=2)n.push(parseInt(t.slice(r,r+2),16))}else n=t;return update$1(Keccak$1(e),n)},keccak256$2=keccak$1(256);function equalBytes(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function generate(){const e=secp256k1.utils.randomPrivateKey();return{privateKey:e,publicKey:secp256k1.getPublicKey(e,!0)}}async function generateAsync(){return Promise.resolve(generate())}function fromBytes(e){const t=new Uint8Array(e);return{privateKey:t,publicKey:secp256k1.getPublicKey(t,!0)}}function sign(e,t){const n=encode$3(t),r=decode$6(keccak256$2(`0x${n}`));return secp256k1.sign(r,e).toCompactRawBytes()}function verify(e,t,n){const r=encode$3(t),o=decode$6(keccak256$2(`0x${r}`)),i=BigInt("0x"+encode$3(n.subarray(0,32))),a=BigInt("0x"+encode$3(n.subarray(32,64)));return secp256k1.verify({r:i,s:a},o,e)}function getRecoveryId(e,t,n){const r=secp256k1.getPublicKey(e,!1),o=decode$6(keccak256$2(`0x${encode$3(n)}`));for(let e=0;e<4;e++)try{const n=secp256k1.Signature.fromCompact(t).addRecoveryBit(e);if(equalBytes(n.recoverPublicKey(o).toRawBytes(!1),r))return e}catch{}throw new Error("Unexpected error: could not construct a recoverable key.")}const legacyDerPrefix="302d300706052b8104000a032200",legacyDerPrefixBytes=decode$6(legacyDerPrefix),derPrefix$1="3036301006072a8648ce3d020106052b8104000a032200",derPrefixBytes$1=decode$6(derPrefix$1);class EcdsaPublicKey extends Key$1{constructor(e){super(),this._keyData=e}get _type(){return"secp256k1"}static fromBytes(e){return 33===e.length?EcdsaPublicKey.fromBytesRaw(e):EcdsaPublicKey.fromBytesDer(e)}static fromBytesDer(e){let t;switch(e.length){case 47:t=e.subarray(legacyDerPrefixBytes.length);break;case 56:t=e.subarray(derPrefixBytes$1.length,derPrefixBytes$1.length+33);break;default:try{t=secp256k1.ProjectivePoint.fromHex(e.subarray(derPrefixBytes$1.length)).toRawBytes(!0)}catch(e){throw new BadKeyError("cannot decode ECDSA public key from this DER format")}}if(!t||0===t.length)throw new BadKeyError("cannot decode ECDSA public key from this DER format");return new EcdsaPublicKey(t)}static fromBytesRaw(e){if(33!==e.length)throw new BadKeyError(`invalid public key length: ${e.length} bytes`);return new EcdsaPublicKey(e)}static fromString(e){return EcdsaPublicKey.fromBytes(decode$6(e))}verify(e,t){return verify(this._keyData,e,t)}toBytesDer(){const e=new Uint8Array(legacyDerPrefixBytes.length+this._keyData.length);return e.set(legacyDerPrefixBytes,0),e.set(this._keyData,legacyDerPrefixBytes.length),e}toBytesRaw(){return new Uint8Array(this._keyData.subarray())}toEthereumAddress(){const e=secp256k1.ProjectivePoint.fromHex(this._keyData).toRawBytes(!1),t=decode$6(keccak256$2(`0x${encode$3(e.subarray(1))}`));return encode$3(t.subarray(12))}equals(e){return arrayEqual$1(this._keyData,e._keyData)}}const derPrefix="3030020100300706052b8104000a04220420",derPrefixBytes=decode$6(derPrefix),derPrefix2="30540201010420",derPrefixBytes2=decode$6(derPrefix2);class EcdsaPrivateKey{constructor(e,t){this._keyPair=e,this._chainCode=null!=t?t:null}get _type(){return"secp256k1"}static generate(){return new EcdsaPrivateKey(generate())}static async generateAsync(){return new EcdsaPrivateKey(await generateAsync())}static fromBytes(e){return 32===e.length?EcdsaPrivateKey.fromBytesRaw(e):EcdsaPrivateKey.fromBytesDer(e)}static fromBytesDer(e){let t=new Uint8Array;return t=arrayStartsWith(e,derPrefixBytes)?e.subarray(derPrefixBytes.length):e.subarray(derPrefixBytes2.length,derPrefixBytes2.length+32),new EcdsaPrivateKey(fromBytes(t))}static fromBytesRaw(e){return new EcdsaPrivateKey(fromBytes(e))}static fromString(e){return EcdsaPrivateKey.fromBytes(decode$6(e))}static fromStringDer(e){return EcdsaPrivateKey.fromBytesDer(decode$6(e))}static fromStringRaw(e){return EcdsaPrivateKey.fromBytesRaw(decode$6(e))}static async fromSeed(e){const{keyData:t,chainCode:n}=await fromSeed$1(e);return new EcdsaPrivateKey(fromBytes(t),n)}get publicKey(){return new EcdsaPublicKey(this._keyPair.publicKey)}sign(e){return sign(this._keyPair.privateKey,e)}toBytesDer(){const e=new Uint8Array(derPrefixBytes.length+32),t=this._keyPair.privateKey.subarray(0,32),n=32-t.length,r=derPrefixBytes.length+n;return e.set(derPrefixBytes,0),e.set(t,r),e}toBytesRaw(){const e=this._keyPair.privateKey.subarray(-32),t=32-e.length,n=new Uint8Array(32);return n.set(e,t),n}getRecoveryId(e,t){return getRecoveryId(this._keyPair.privateKey,e,t)}}let PublicKey$1=class e extends Key$1{constructor(e){super(),this._key=e}get _type(){return this._key._type}static fromBytes(t){let n;try{return new e(Ed25519PublicKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}try{return new e(EcdsaPublicKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}throw new BadKeyError(`public key cannot be decoded from bytes: ${n}`)}static fromBytesED25519(t){return new e(Ed25519PublicKey.fromBytes(t))}static fromBytesECDSA(t){return new e(EcdsaPublicKey.fromBytes(t))}static fromString(t){return e.fromBytes(decode$6(t))}static fromStringED25519(t){return e.fromBytesED25519(decode$6(t))}static fromStringECDSA(t){return e.fromBytesECDSA(decode$6(t))}verify(e,t){return this._key.verify(e,t)}verifyTransaction(e){console.log("Deprecated: use `@hiero-ledger/sdk`.PublicKey instead"),e._requireFrozen(),e.isFrozen()||e.freeze();for(const t of e._signedTransactions)if(null!=t.sigMap&&null!=t.sigMap.sigPair){let e=!1;for(const n of t.sigMap.sigPair){if(arrayEqual$1(n.pubKeyPrefix,this.toBytesRaw())){e=!0;const r=t.bodyBytes,o=null!=n.ed25519?n.ed25519:n.ECDSASecp256k1;if(!this.verify(r,o))return!1}}if(!e)return!1}return!0}toBytes(){return this._key instanceof Ed25519PublicKey?this.toBytesRaw():this.toBytesDer()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this.toStringDer()}toStringDer(){return encode$3(this.toBytesDer())}toStringRaw(){return encode$3(this.toBytesRaw())}toEthereumAddress(){if(this._key instanceof EcdsaPublicKey)return this._key.toEthereumAddress();throw new Error("unsupported operation on Ed25519PublicKey")}equals(e){return(this._key instanceof Ed25519PublicKey&&e._key instanceof Ed25519PublicKey||this._key instanceof EcdsaPublicKey&&e._key instanceof EcdsaPublicKey)&&this._key.equals(e._key)}};var sparkMd5={exports:{}},hasRequiredSparkMd5;function requireSparkMd5(){return hasRequiredSparkMd5||(hasRequiredSparkMd5=1,function(e){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],o=e[2],i=e[3];r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(l,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<o;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,n(l,i),l}function a(e){var t,r,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(l,o(e.subarray(t-64,t)));for(r=(e=t-64<u?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,n(l,i),l}function s(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function c(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function u(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n<r;n+=1)i[n]=e.charCodeAt(n);return t?i:o}function d(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function p(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),r}function h(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function f(){this.reset()}return c(i("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var o,i,a,s,c=this.byteLength,u=t(n,c),l=c;return r!==e&&(l=t(r,c)),u>l?new ArrayBuffer(0):(o=l-u,i=new ArrayBuffer(o),a=new Uint8Array(i),s=new Uint8Array(this,u,o),a.set(s),i)}}(),f.prototype.append=function(e){return this.appendBinary(u(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)i[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=c(this._hash),e&&(n=h(n)),this.reset(),n},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},f.hash=function(e,t){return f.hashBinary(u(e),t)},f.hashBinary=function(e,t){var n=c(i(e));return t?h(n):n},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,r=p(this._buff.buffer,e),i=r.length;for(this._length+=e.byteLength,t=64;t<=i;t+=64)n(this._hash,o(r.subarray(t-64,t)));return this._buff=t-64<i?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)i[t>>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=c(this._hash),e&&(n=h(n)),this.reset(),n},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e=f.prototype.getState.call(this);return e.buff=d(e.buff),e},f.ArrayBuffer.prototype.setState=function(e){return e.buff=l(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var n=c(a(new Uint8Array(e)));return t?h(n):n},f}()}(sparkMd5)),sparkMd5.exports}var sparkMd5Exports=requireSparkMd5(),SparkMD5=getDefaultExportFromCjs(sparkMd5Exports),buffer={},base64Js={},hasRequiredBase64Js;function requireBase64Js(){if(hasRequiredBase64Js)return base64Js;hasRequiredBase64Js=1,base64Js.byteLength=function(e){var t=i(e),n=t[0],r=t[1];return 3*(n+r)/4-r},base64Js.toByteArray=function(e){var r,o,a=i(e),s=a[0],c=a[1],u=new n(function(e,t,n){return 3*(t+n)/4-n}(0,s,c)),l=0,d=c>0?s-4:s;for(o=0;o<d;o+=4)r=t[e.charCodeAt(o)]<<18|t[e.charCodeAt(o+1)]<<12|t[e.charCodeAt(o+2)]<<6|t[e.charCodeAt(o+3)],u[l++]=r>>16&255,u[l++]=r>>8&255,u[l++]=255&r;2===c&&(r=t[e.charCodeAt(o)]<<2|t[e.charCodeAt(o+1)]>>4,u[l++]=255&r);1===c&&(r=t[e.charCodeAt(o)]<<10|t[e.charCodeAt(o+1)]<<4|t[e.charCodeAt(o+2)]>>2,u[l++]=r>>8&255,u[l++]=255&r);return u},base64Js.fromByteArray=function(t){for(var n,r=t.length,o=r%3,i=[],a=16383,c=0,u=r-o;c<u;c+=a)i.push(s(t,c,c+a>u?u:c+a));1===o?(n=t[r-1],i.push(e[n>>2]+e[n<<4&63]+"==")):2===o&&(n=(t[r-2]<<8)+t[r-1],i.push(e[n>>10]+e[n>>4&63]+e[n<<2&63]+"="));return i.join("")};for(var e=[],t=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)e[o]=r[o],t[r.charCodeAt(o)]=o;function i(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function a(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(a(r));return o.join("")}return t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63,base64Js}var ieee754={},hasRequiredIeee754,hasRequiredBuffer;
|
|
48
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(4);const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n=BigInt(1),_2n=BigInt(2),divNearest=(e,t)=>(e+t/_2n)/t;function sqrtMod(e){const t=secp256k1P,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=pow2(l,n,t)*l%t,p=pow2(d,n,t)*l%t,h=pow2(p,_2n,t)*u%t,f=pow2(h,o,t)*h%t,y=pow2(f,i,t)*f%t,m=pow2(y,s,t)*y%t,g=pow2(m,c,t)*m%t,_=pow2(g,s,t)*y%t,b=pow2(_,n,t)*l%t,I=pow2(b,a,t)*f%t,T=pow2(I,r,t)*u%t,k=pow2(T,_2n,t);if(!Fpk1.eql(Fpk1.sqr(k),e))throw new Error("Cannot find square root");return k}const Fpk1=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fpk1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=secp256k1N,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,a=BigInt("0x100000000000000000000000000000000"),s=divNearest(i*e,t),c=divNearest(-r*e,t);let u=mod(e-s*n-c*o,t),l=mod(-s*r-c*i,t);const d=u>a,p=l>a;if(d&&(u=t-u),p&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:p,k2:l}}}},sha256);BigInt(0),secp256k1.ProjectivePoint;const N=secp256k1.CURVE.n,HARDENED_BIT$1=2147483648;async function derive$1(e,t,n){const r=isHardenedIndex(n),o=new Uint8Array(37),i=secp256k1.getPublicKey(e,!0);r?(o[0]=0,o.set(e,1)):o.set(i,0),new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(33,n,!1);const a=await hash(HashAlgorithm.Sha512,t,o),s=a.subarray(0,32),c=a.subarray(32);try{const r=bytesToNumberBE(e),o=(r+bytesToNumberBE(s))%N;if(0n===o)return derive$1(e,t,n+1);return{keyData:numberToBytesBE(o,32),chainCode:c}}catch{return derive$1(e,t,n+1)}}async function fromSeed$1(e){if(e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");const t=await hash(HashAlgorithm.Sha512,"Bitcoin seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}function toHardenedIndex(e){return e|HARDENED_BIT$1}function isHardenedIndex(e){return 0!==(e&HARDENED_BIT$1)}async function derive(e,t,n){if(isHardenedIndex(n))throw new Error("the index should not be pre-hardened");const r=new Uint8Array(37);r[0]=0,r.set(e,1),new DataView(r.buffer,r.byteOffset,r.byteLength).setUint32(33,n,!1),r[33]|=128;const o=await hash(HashAlgorithm.Sha512,t,r);return{keyData:o.subarray(0,32),chainCode:o.subarray(32)}}async function fromSeed(e){const t=await hash(HashAlgorithm.Sha512,"ed25519 seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}const derPrefix$2="302e020100300506032b657004220420",derPrefixBytes$2=decode$6(derPrefix$2);class Ed25519PrivateKey{constructor(e,t){this._keyPair=e instanceof Uint8Array?nacl.sign.keyPair.fromSeed(e):e,this._chainCode=null!=t?t:null}get _type(){return"ED25519"}static generate(){const e=bytes(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static async generateAsync(){const e=await bytesAsync(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static fromBytes(e){switch(e.length){case 48:return Ed25519PrivateKey.fromBytesDer(e);case 32:case 64:return Ed25519PrivateKey.fromBytesRaw(e);default:throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}}static fromBytesDer(e){let t;try{const n=new Uint8Array(e),r=n.subarray(0,e.length-32).every((e,t)=>derPrefixBytes$2[t]===e);if(!r)throw new BadKeyError("invalid DER prefix for ED25519 private key");t=n.slice(e.length-32)}catch(e){const t=null!=e&&null!=e.message?e.message:"";throw new BadKeyError(`cannot decode ED25519 private key data from DER format: ${t}`)}const n=nacl.sign.keyPair.fromSeed(t);return new Ed25519PrivateKey(n)}static fromBytesRaw(e){switch(e.length){case 32:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e));case 64:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSecretKey(e))}throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}static fromString(e){return Ed25519PrivateKey.fromBytes(decode$6(e))}static fromStringDer(e){return Ed25519PrivateKey.fromBytesDer(decode$6(e))}static fromStringRaw(e){return Ed25519PrivateKey.fromBytesRaw(decode$6(e))}static async fromSeed(e){const{keyData:t,chainCode:n}=await fromSeed(e);return new Ed25519PrivateKey(t,n)}get publicKey(){return new Ed25519PublicKey(this._keyPair.publicKey)}sign(e){return nacl.sign.detached(e,this._keyPair.secretKey)}toBytesDer(){const e=new Uint8Array(derPrefixBytes$2.length+32),t=this._keyPair.secretKey.subarray(0,32),n=32-t.length,r=derPrefixBytes$2.length+n;return e.set(derPrefixBytes$2,0),e.set(t,r),e}toBytesRaw(){return this._keyPair.secretKey.slice(0,32)}}const HEX_CHARS$1="0123456789abcdef".split(""),KECCAK_PADDING$1=[1,256,65536,16777216],SHIFT$1=[0,8,16,24],RC$1=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak$1=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update$1=(e,t)=>{for(var n,r,o=t.length,i=e.blocks,a=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<o;){if(e.reset)for(e.reset=!1,i[0]=e.block,n=1;n<s+1;++n)i[n]=0;if("string"!=typeof t)for(n=e.start;l<o&&n<a;++l)i[n>>2]|=t[l]<<SHIFT$1[3&n++];else for(n=e.start;l<o&&n<a;++l)(r=t.charCodeAt(l))<128?i[n>>2]|=r<<SHIFT$1[3&n++]:r<2048?(i[n>>2]|=(192|r>>6)<<SHIFT$1[3&n++],i[n>>2]|=(128|63&r)<<SHIFT$1[3&n++]):r<55296||r>=57344?(i[n>>2]|=(224|r>>12)<<SHIFT$1[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT$1[3&n++],i[n>>2]|=(128|63&r)<<SHIFT$1[3&n++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++l)),i[n>>2]|=(240|r>>18)<<SHIFT$1[3&n++],i[n>>2]|=(128|r>>12&63)<<SHIFT$1[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT$1[3&n++],i[n>>2]|=(128|63&r)<<SHIFT$1[3&n++]);if(e.lastByteIndex=n,n>=a){for(e.start=n-a,e.block=i[s],n=0;n<s;++n)u[n]^=i[n];f$1(u),e.reset=!0}else e.start=n}if(i[(n=e.lastByteIndex)>>2]|=KECCAK_PADDING$1[3&n],e.lastByteIndex===a)for(i[0]=i[s],n=1;n<s+1;++n)i[n]=0;for(i[s-1]|=2147483648,n=0;n<s;++n)u[n]^=i[n];f$1(u);var d,p="",h=0;for(n=0;h<c;){for(n=0;n<s&&h<c;++n,++h)d=u[n],p+=HEX_CHARS$1[d>>4&15]+HEX_CHARS$1[15&d]+HEX_CHARS$1[d>>12&15]+HEX_CHARS$1[d>>8&15]+HEX_CHARS$1[d>>20&15]+HEX_CHARS$1[d>>16&15]+HEX_CHARS$1[d>>28&15]+HEX_CHARS$1[d>>24&15];h%s===0&&(f$1(u),n=0)}return"0x"+p},f$1=e=>{var t,n,r,o,i,a,s,c,u,l,d,p,h,f,y,m,g,_,b,I,T,k,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,K,M,H,j,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ie,ae,se,ce,ue;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=i^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(p<<1|h>>>31),n=u^(h<<1|p>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(o<<1|i>>>31),n=d^(i<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,f=e[0],y=e[1],$=e[11]<<4|e[10]>>>28,z=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,w=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,re=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,K=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,T=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,E=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,M=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=f^~m&_,e[1]=y^~g&b,e[10]=w^~v&O,e[11]=A^~E&N,e[20]=B^~x&U,e[21]=L^~F&K,e[30]=q^~$&W,e[31]=V^~z&Y,e[40]=ee^~ne&oe,e[41]=te^~re&ie,e[2]=m^~_&I,e[3]=g^~b&T,e[12]=v^~O&P,e[13]=E^~N&R,e[22]=x^~U&M,e[23]=F^~K&H,e[32]=$^~W&Q,e[33]=z^~Y&X,e[42]=ne^~oe&ae,e[43]=re^~ie&se,e[4]=_^~I&k,e[5]=b^~T&S,e[14]=O^~P&C,e[15]=N^~R&D,e[24]=U^~M&j,e[25]=K^~H&G,e[34]=W^~Q&Z,e[35]=Y^~X&J,e[44]=oe^~ae&ce,e[45]=ie^~se&ue,e[6]=I^~k&f,e[7]=T^~S&y,e[16]=P^~C&w,e[17]=R^~D&A,e[26]=M^~j&B,e[27]=H^~G&L,e[36]=Q^~Z&q,e[37]=X^~J&V,e[46]=ae^~ce&ee,e[47]=se^~ue&te,e[8]=k^~f&m,e[9]=S^~y&g,e[18]=C^~w&v,e[19]=D^~A&E,e[28]=j^~B&x,e[29]=G^~L&F,e[38]=Z^~q&$,e[39]=J^~V&z,e[48]=ce^~ee&ne,e[49]=ue^~te&re,e[0]^=RC$1[r],e[1]^=RC$1[r+1]},keccak$1=e=>t=>{var n;if("0x"===t.slice(0,2)){n=[];for(var r=2,o=t.length;r<o;r+=2)n.push(parseInt(t.slice(r,r+2),16))}else n=t;return update$1(Keccak$1(e),n)},keccak256$2=keccak$1(256);function equalBytes(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function generate(){const e=secp256k1.utils.randomPrivateKey();return{privateKey:e,publicKey:secp256k1.getPublicKey(e,!0)}}async function generateAsync(){return Promise.resolve(generate())}function fromBytes(e){const t=new Uint8Array(e);return{privateKey:t,publicKey:secp256k1.getPublicKey(t,!0)}}function sign(e,t){const n=encode$3(t),r=decode$6(keccak256$2(`0x${n}`));return secp256k1.sign(r,e).toCompactRawBytes()}function verify(e,t,n){const r=encode$3(t),o=decode$6(keccak256$2(`0x${r}`)),i=BigInt("0x"+encode$3(n.subarray(0,32))),a=BigInt("0x"+encode$3(n.subarray(32,64)));return secp256k1.verify({r:i,s:a},o,e)}function getRecoveryId(e,t,n){const r=secp256k1.getPublicKey(e,!1),o=decode$6(keccak256$2(`0x${encode$3(n)}`));for(let e=0;e<4;e++)try{const n=secp256k1.Signature.fromCompact(t).addRecoveryBit(e);if(equalBytes(n.recoverPublicKey(o).toRawBytes(!1),r))return e}catch{}throw new Error("Unexpected error: could not construct a recoverable key.")}const legacyDerPrefix="302d300706052b8104000a032200",legacyDerPrefixBytes=decode$6(legacyDerPrefix),derPrefix$1="3036301006072a8648ce3d020106052b8104000a032200",derPrefixBytes$1=decode$6(derPrefix$1);class EcdsaPublicKey extends Key$1{constructor(e){super(),this._keyData=e}get _type(){return"secp256k1"}static fromBytes(e){return 33===e.length?EcdsaPublicKey.fromBytesRaw(e):EcdsaPublicKey.fromBytesDer(e)}static fromBytesDer(e){let t;switch(e.length){case 47:t=e.subarray(legacyDerPrefixBytes.length);break;case 56:t=e.subarray(derPrefixBytes$1.length,derPrefixBytes$1.length+33);break;default:try{t=secp256k1.ProjectivePoint.fromHex(e.subarray(derPrefixBytes$1.length)).toRawBytes(!0)}catch(e){throw new BadKeyError("cannot decode ECDSA public key from this DER format")}}if(!t||0===t.length)throw new BadKeyError("cannot decode ECDSA public key from this DER format");return new EcdsaPublicKey(t)}static fromBytesRaw(e){if(33!==e.length)throw new BadKeyError(`invalid public key length: ${e.length} bytes`);return new EcdsaPublicKey(e)}static fromString(e){return EcdsaPublicKey.fromBytes(decode$6(e))}verify(e,t){return verify(this._keyData,e,t)}toBytesDer(){const e=new Uint8Array(legacyDerPrefixBytes.length+this._keyData.length);return e.set(legacyDerPrefixBytes,0),e.set(this._keyData,legacyDerPrefixBytes.length),e}toBytesRaw(){return new Uint8Array(this._keyData.subarray())}toEthereumAddress(){const e=secp256k1.ProjectivePoint.fromHex(this._keyData).toRawBytes(!1),t=decode$6(keccak256$2(`0x${encode$3(e.subarray(1))}`));return encode$3(t.subarray(12))}equals(e){return arrayEqual$1(this._keyData,e._keyData)}}const derPrefix="3030020100300706052b8104000a04220420",derPrefixBytes=decode$6(derPrefix),derPrefix2="30540201010420",derPrefixBytes2=decode$6(derPrefix2);class EcdsaPrivateKey{constructor(e,t){this._keyPair=e,this._chainCode=null!=t?t:null}get _type(){return"secp256k1"}static generate(){return new EcdsaPrivateKey(generate())}static async generateAsync(){return new EcdsaPrivateKey(await generateAsync())}static fromBytes(e){return 32===e.length?EcdsaPrivateKey.fromBytesRaw(e):EcdsaPrivateKey.fromBytesDer(e)}static fromBytesDer(e){let t=new Uint8Array;return t=arrayStartsWith(e,derPrefixBytes)?e.subarray(derPrefixBytes.length):e.subarray(derPrefixBytes2.length,derPrefixBytes2.length+32),new EcdsaPrivateKey(fromBytes(t))}static fromBytesRaw(e){return new EcdsaPrivateKey(fromBytes(e))}static fromString(e){return EcdsaPrivateKey.fromBytes(decode$6(e))}static fromStringDer(e){return EcdsaPrivateKey.fromBytesDer(decode$6(e))}static fromStringRaw(e){return EcdsaPrivateKey.fromBytesRaw(decode$6(e))}static async fromSeed(e){const{keyData:t,chainCode:n}=await fromSeed$1(e);return new EcdsaPrivateKey(fromBytes(t),n)}get publicKey(){return new EcdsaPublicKey(this._keyPair.publicKey)}sign(e){return sign(this._keyPair.privateKey,e)}toBytesDer(){const e=new Uint8Array(derPrefixBytes.length+32),t=this._keyPair.privateKey.subarray(0,32),n=32-t.length,r=derPrefixBytes.length+n;return e.set(derPrefixBytes,0),e.set(t,r),e}toBytesRaw(){const e=this._keyPair.privateKey.subarray(-32),t=32-e.length,n=new Uint8Array(32);return n.set(e,t),n}getRecoveryId(e,t){return getRecoveryId(this._keyPair.privateKey,e,t)}}let PublicKey$1=class e extends Key$1{constructor(e){super(),this._key=e}get _type(){return this._key._type}static fromBytes(t){let n;try{return new e(Ed25519PublicKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}try{return new e(EcdsaPublicKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}throw new BadKeyError(`public key cannot be decoded from bytes: ${n}`)}static fromBytesED25519(t){return new e(Ed25519PublicKey.fromBytes(t))}static fromBytesECDSA(t){return new e(EcdsaPublicKey.fromBytes(t))}static fromString(t){return e.fromBytes(decode$6(t))}static fromStringED25519(t){return e.fromBytesED25519(decode$6(t))}static fromStringECDSA(t){return e.fromBytesECDSA(decode$6(t))}verify(e,t){return this._key.verify(e,t)}verifyTransaction(e){console.log("Deprecated: use `@hashgraph/sdk`.PublicKey instead"),e._requireFrozen(),e.isFrozen()||e.freeze();for(const t of e._signedTransactions)if(null!=t.sigMap&&null!=t.sigMap.sigPair){let e=!1;for(const n of t.sigMap.sigPair){if(arrayEqual$1(n.pubKeyPrefix,this.toBytesRaw())){e=!0;const r=t.bodyBytes,o=null!=n.ed25519?n.ed25519:n.ECDSASecp256k1;if(!this.verify(r,o))return!1}}if(!e)return!1}return!0}toBytes(){return this._key instanceof Ed25519PublicKey?this.toBytesRaw():this.toBytesDer()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this.toStringDer()}toStringDer(){return encode$3(this.toBytesDer())}toStringRaw(){return encode$3(this.toBytesRaw())}toEthereumAddress(){if(this._key instanceof EcdsaPublicKey)return this._key.toEthereumAddress();throw new Error("unsupported operation on Ed25519PublicKey")}equals(e){return(this._key instanceof Ed25519PublicKey&&e._key instanceof Ed25519PublicKey||this._key instanceof EcdsaPublicKey&&e._key instanceof EcdsaPublicKey)&&this._key.equals(e._key)}};var sparkMd5={exports:{}},hasRequiredSparkMd5;function requireSparkMd5(){return hasRequiredSparkMd5||(hasRequiredSparkMd5=1,function(e){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],o=e[2],i=e[3];r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(l,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<o;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,n(l,i),l}function a(e){var t,r,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(l,o(e.subarray(t-64,t)));for(r=(e=t-64<u?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,n(l,i),l}function s(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function c(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function u(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n<r;n+=1)i[n]=e.charCodeAt(n);return t?i:o}function d(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function p(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),r}function h(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function f(){this.reset()}return c(i("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var o,i,a,s,c=this.byteLength,u=t(n,c),l=c;return r!==e&&(l=t(r,c)),u>l?new ArrayBuffer(0):(o=l-u,i=new ArrayBuffer(o),a=new Uint8Array(i),s=new Uint8Array(this,u,o),a.set(s),i)}}(),f.prototype.append=function(e){return this.appendBinary(u(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)i[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=c(this._hash),e&&(n=h(n)),this.reset(),n},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},f.hash=function(e,t){return f.hashBinary(u(e),t)},f.hashBinary=function(e,t){var n=c(i(e));return t?h(n):n},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,r=p(this._buff.buffer,e),i=r.length;for(this._length+=e.byteLength,t=64;t<=i;t+=64)n(this._hash,o(r.subarray(t-64,t)));return this._buff=t-64<i?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)i[t>>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=c(this._hash),e&&(n=h(n)),this.reset(),n},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e=f.prototype.getState.call(this);return e.buff=d(e.buff),e},f.ArrayBuffer.prototype.setState=function(e){return e.buff=l(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var n=c(a(new Uint8Array(e)));return t?h(n):n},f}()}(sparkMd5)),sparkMd5.exports}var sparkMd5Exports=requireSparkMd5(),SparkMD5=getDefaultExportFromCjs(sparkMd5Exports),buffer={},base64Js={},hasRequiredBase64Js;function requireBase64Js(){if(hasRequiredBase64Js)return base64Js;hasRequiredBase64Js=1,base64Js.byteLength=function(e){var t=i(e),n=t[0],r=t[1];return 3*(n+r)/4-r},base64Js.toByteArray=function(e){var r,o,a=i(e),s=a[0],c=a[1],u=new n(function(e,t,n){return 3*(t+n)/4-n}(0,s,c)),l=0,d=c>0?s-4:s;for(o=0;o<d;o+=4)r=t[e.charCodeAt(o)]<<18|t[e.charCodeAt(o+1)]<<12|t[e.charCodeAt(o+2)]<<6|t[e.charCodeAt(o+3)],u[l++]=r>>16&255,u[l++]=r>>8&255,u[l++]=255&r;2===c&&(r=t[e.charCodeAt(o)]<<2|t[e.charCodeAt(o+1)]>>4,u[l++]=255&r);1===c&&(r=t[e.charCodeAt(o)]<<10|t[e.charCodeAt(o+1)]<<4|t[e.charCodeAt(o+2)]>>2,u[l++]=r>>8&255,u[l++]=255&r);return u},base64Js.fromByteArray=function(t){for(var n,r=t.length,o=r%3,i=[],a=16383,c=0,u=r-o;c<u;c+=a)i.push(s(t,c,c+a>u?u:c+a));1===o?(n=t[r-1],i.push(e[n>>2]+e[n<<4&63]+"==")):2===o&&(n=(t[r-2]<<8)+t[r-1],i.push(e[n>>10]+e[n>>4&63]+e[n<<2&63]+"="));return i.join("")};for(var e=[],t=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)e[o]=r[o],t[r.charCodeAt(o)]=o;function i(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function a(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(a(r));return o.join("")}return t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63,base64Js}var ieee754={},hasRequiredIeee754,hasRequiredBuffer;
|
|
49
49
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function requireIeee754(){return hasRequiredIeee754||(hasRequiredIeee754=1,ieee754.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?o-1:0,p=n?-1:1,h=e[t+d];for(d+=p,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=p,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=p,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},ieee754.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,d=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,f=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=f,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[n+h]=255&a,h+=f,a/=256,u-=8);e[n+h-f]|=128*y}),ieee754}
|
|
50
50
|
/*!
|
|
51
51
|
* The buffer module from node.js, for the browser.
|
|
@@ -112,7 +112,7 @@ const _0n$3=BigInt(0),_1n$4=BigInt(1),_2n$2=BigInt(2);function isBytes$1(e){retu
|
|
|
112
112
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
113
113
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
114
114
|
*
|
|
115
|
-
*/function assertBigInt(){if("undefined"==typeof BigInt)throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function concat$1(e){let t=0,n=0;for(let n=0;n<e.length;n++){t+=e[n].byteLength}const r=new Uint8Array(t);for(let t=0;t<e.length;t++){const o=e[t];r.set(new Uint8Array(o),n),n+=o.byteLength}return r.buffer}function checkBufferParams(e,t,n,r){return t instanceof Uint8Array?t.byteLength?n<0?(e.error="Wrong parameter: inputOffset less than zero",!1):r<0?(e.error="Wrong parameter: inputLength less than zero",!1):!(t.byteLength-n-r<0)||(e.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(e.error="Wrong parameter: inputBuffer has zero length",!1):(e.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class ViewWriter{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return concat$1(this.items)}}const powers2=[new Uint8Array([1])],digitsString="0123456789",EMPTY_STRING="",EMPTY_BUFFER=new ArrayBuffer(0),EMPTY_VIEW=new Uint8Array(0),END_OF_CONTENT_NAME="EndOfContent",OCTET_STRING_NAME="OCTET STRING",BIT_STRING_NAME="BIT STRING";function HexBlock(e){var t;return(t=class extends e{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(e){this.valueHexView=new Uint8Array(e)}constructor(...e){var t;super(...e);const n=e[0]||{};this.isHexOnly=null!==(t=n.isHexOnly)&&void 0!==t&&t,this.valueHexView=n.valueHex?buildExports.BufferSourceConverter.toUint8Array(n.valueHex):EMPTY_VIEW}fromBER(e,t,n){const r=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!checkBufferParams(this,r,t,n))return-1;const o=t+n;return this.valueHexView=r.subarray(t,o),this.valueHexView.length?(this.blockLength=n,o):(this.warnings.push("Zero buffer length"),t)}toBER(e=!1){return this.isHexOnly?e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",EMPTY_BUFFER)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:buildExports.Convert.ToHex(this.valueHexView)}}}).NAME="hexBlock",t}class LocalBaseBlock{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:t=EMPTY_STRING,warnings:n=[],valueBeforeDecode:r=EMPTY_VIEW}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=buildExports.BufferSourceConverter.toUint8Array(r)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:buildExports.Convert.ToHex(this.valueBeforeDecodeView)}}}LocalBaseBlock.NAME="baseBlock";class ValueBlock extends LocalBaseBlock{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}ValueBlock.NAME="valueBlock";class LocalIdentificationBlock extends(HexBlock(LocalBaseBlock)){constructor({idBlock:e={}}={}){var t,n,r,o;super(),e?(this.isHexOnly=null!==(t=e.isHexOnly)&&void 0!==t&&t,this.valueHexView=e.valueHex?buildExports.BufferSourceConverter.toUint8Array(e.valueHex):EMPTY_VIEW,this.tagClass=null!==(n=e.tagClass)&&void 0!==n?n:-1,this.tagNumber=null!==(r=e.tagNumber)&&void 0!==r?r:-1,this.isConstructed=null!==(o=e.isConstructed)&&void 0!==o&&o):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",EMPTY_BUFFER}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const n=new Uint8Array(1);if(!e){let e=this.tagNumber;e&=31,t|=e,n[0]=t}return n.buffer}if(!this.isHexOnly){const n=utilToBase(this.tagNumber,7),r=new Uint8Array(n),o=n.byteLength,i=new Uint8Array(o+1);if(i[0]=31|t,!e){for(let e=0;e<o-1;e++)i[e+1]=128|r[e];i[o]=r[o-1]}return i.buffer}const n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=31|t,!e){const e=this.valueHexView;for(let t=0;t<e.length-1;t++)n[t+1]=128|e[t];n[this.valueHexView.byteLength]=e[e.length-1]}return n.buffer}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);if(0===o.length)return this.error="Zero buffer length",-1;switch(192&o[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=!(32&~o[0]),this.isHexOnly=!1;const i=31&o[0];if(31!==i)this.tagNumber=i,this.blockLength=1;else{let e=1,t=this.valueHexView=new Uint8Array(255),n=255;for(;128&o[e];){if(t[e-1]=127&o[e],e++,e>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(e===n){n+=255;const e=new Uint8Array(n);for(let n=0;n<t.length;n++)e[n]=t[n];t=this.valueHexView=new Uint8Array(n)}}this.blockLength=e+1,t[e-1]=127&o[e];const r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=t[n];t=this.valueHexView=new Uint8Array(e),t.set(r),this.blockLength<=9?this.tagNumber=utilFromBase(t,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}LocalIdentificationBlock.NAME="identificationBlock";class LocalLengthBlock extends LocalBaseBlock{constructor({lenBlock:e={}}={}){var t,n,r;super(),this.isIndefiniteForm=null!==(t=e.isIndefiniteForm)&&void 0!==t&&t,this.longFormUsed=null!==(n=e.longFormUsed)&&void 0!==n&&n,this.length=null!==(r=e.length)&&void 0!==r?r:0}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);if(0===o.length)return this.error="Zero buffer length",-1;if(255===o[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===o[0],this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(128&o[0]),!1===this.longFormUsed)return this.length=o[0],this.blockLength=1,t+this.blockLength;const i=127&o[0];if(i>8)return this.error="Too big integer",-1;if(i+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const a=t+1,s=r.subarray(a,a+i);return 0===s[i-1]&&this.warnings.push("Needlessly long encoded length"),this.length=utilFromBase(s,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=i+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){const r=utilToBase(this.length,8);if(r.byteLength>127)return this.error="Too big length",EMPTY_BUFFER;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const o=new Uint8Array(r);n=new Uint8Array(t),n[0]=128|r.byteLength;for(let e=0;e<r.byteLength;e++)n[e+1]=o[e];return t}return t=new ArrayBuffer(1),!1===e&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}LocalLengthBlock.NAME="lengthBlock";const typeStore={};class BaseBlock extends LocalBaseBlock{constructor({name:e=EMPTY_STRING,optional:t=!1,primitiveSchema:n,...r}={},o){super(r),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new LocalIdentificationBlock(r),this.lenBlock=new LocalLengthBlock(r),this.valueBlock=o?new o(r):new ValueBlock(r)}fromBER(e,t,n){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(e,t){const n=t||new ViewWriter;t||prepareIndefiniteForm(this);const r=this.idBlock.toBER(e);if(n.write(r),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{const t=this.valueBlock.toBER(e);this.lenBlock.length=t.byteLength;const r=this.lenBlock.toBER(e);n.write(r),n.write(t)}return t?EMPTY_BUFFER:n.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return"ascii"===e?this.onAsciiEncoding():buildExports.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${buildExports.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;return isEqualBuffer(this.toBER(),e.toBER())}}function prepareIndefiniteForm(e){var t;if(e instanceof typeStore.Constructed)for(const t of e.valueBlock.value)prepareIndefiniteForm(t)&&(e.lenBlock.isIndefiniteForm=!0);return!!(null===(t=e.lenBlock)||void 0===t?void 0:t.isIndefiniteForm)}BaseBlock.NAME="BaseBlock";class BaseStringBlock extends BaseBlock{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=EMPTY_STRING,...t}={},n){super(t,n),e&&this.fromString(e)}fromBER(e,t,n){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}BaseStringBlock.NAME="BaseStringBlock";class LocalPrimitiveValueBlock extends(HexBlock(ValueBlock)){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}var _a$w,_a$v,_a$u,_a$t,_a$s;LocalPrimitiveValueBlock.NAME="PrimitiveValueBlock";class Primitive extends BaseBlock{constructor(e={}){super(e,LocalPrimitiveValueBlock),this.idBlock.isConstructed=!1}}function localChangeType(e,t){if(e instanceof t)return e;const n=new t;return n.idBlock=e.idBlock,n.lenBlock=e.lenBlock,n.warnings=e.warnings,n.valueBeforeDecodeView=e.valueBeforeDecodeView,n}function localFromBER(e,t=0,n=e.length){const r=t;let o=new BaseBlock({},ValueBlock);const i=new LocalBaseBlock;if(!checkBufferParams(i,e,t,n))return o.error=i.error,{offset:-1,result:o};if(!e.subarray(t,t+n).length)return o.error="Zero buffer length",{offset:-1,result:o};let a=o.idBlock.fromBER(e,t,n);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),-1===a)return o.error=o.idBlock.error,{offset:-1,result:o};if(t=a,n-=o.idBlock.blockLength,a=o.lenBlock.fromBER(e,t,n),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),-1===a)return o.error=o.lenBlock.error,{offset:-1,result:o};if(t=a,n-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let s=BaseBlock;if(1===o.idBlock.tagClass){if(o.idBlock.tagNumber>=37&&!1===o.idBlock.isHexOnly)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};s=typeStore.EndOfContent;break;case 1:s=typeStore.Boolean;break;case 2:s=typeStore.Integer;break;case 3:s=typeStore.BitString;break;case 4:s=typeStore.OctetString;break;case 5:s=typeStore.Null;break;case 6:s=typeStore.ObjectIdentifier;break;case 10:s=typeStore.Enumerated;break;case 12:s=typeStore.Utf8String;break;case 13:s=typeStore.RelativeObjectIdentifier;break;case 14:s=typeStore.TIME;break;case 15:return o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};case 16:s=typeStore.Sequence;break;case 17:s=typeStore.Set;break;case 18:s=typeStore.NumericString;break;case 19:s=typeStore.PrintableString;break;case 20:s=typeStore.TeletexString;break;case 21:s=typeStore.VideotexString;break;case 22:s=typeStore.IA5String;break;case 23:s=typeStore.UTCTime;break;case 24:s=typeStore.GeneralizedTime;break;case 25:s=typeStore.GraphicString;break;case 26:s=typeStore.VisibleString;break;case 27:s=typeStore.GeneralString;break;case 28:s=typeStore.UniversalString;break;case 29:s=typeStore.CharacterString;break;case 30:s=typeStore.BmpString;break;case 31:s=typeStore.DATE;break;case 32:s=typeStore.TimeOfDay;break;case 33:s=typeStore.DateTime;break;case 34:s=typeStore.Duration;break;default:{const e=o.idBlock.isConstructed?new typeStore.Constructed:new typeStore.Primitive;e.idBlock=o.idBlock,e.lenBlock=o.lenBlock,e.warnings=o.warnings,o=e}}}else s=o.idBlock.isConstructed?typeStore.Constructed:typeStore.Primitive;return o=localChangeType(o,s),a=o.fromBER(e,t,o.lenBlock.isIndefiniteForm?n:o.lenBlock.length),o.valueBeforeDecodeView=e.subarray(r,r+o.blockLength),{offset:a,result:o}}function fromBER(e){if(!e.byteLength){const e=new BaseBlock({},ValueBlock);return e.error="Input buffer has zero length",{offset:-1,result:e}}return localFromBER(buildExports.BufferSourceConverter.toUint8Array(e).slice(),0,e.byteLength)}function checkLen(e,t){return e?1:t}_a$w=Primitive,typeStore.Primitive=_a$w,Primitive.NAME="PRIMITIVE";class LocalConstructedValueBlock extends ValueBlock{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+n),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),t;let o=t;for(;checkLen(this.isIndefiniteForm,n)>0;){const e=localFromBER(r,o,n);if(-1===e.offset)return this.error=e.result.error,this.warnings.concat(e.result.warnings),-1;if(o=e.offset,this.blockLength+=e.result.blockLength,n-=e.result.blockLength,this.value.push(e.result),this.isIndefiniteForm&&e.result.constructor.NAME===END_OF_CONTENT_NAME)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===END_OF_CONTENT_NAME?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,t){const n=t||new ViewWriter;for(let t=0;t<this.value.length;t++)this.value[t].toBER(e,n);return t?EMPTY_BUFFER:n.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}LocalConstructedValueBlock.NAME="ConstructedValueBlock";class Constructed extends BaseBlock{constructor(e={}){super(e,LocalConstructedValueBlock),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const e=[];for(const t of this.valueBlock.value)e.push(t.toString("ascii").split("\n").map(e=>` ${e}`).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :\n${e.join("\n")}`:`${t} :`}}_a$v=Constructed,typeStore.Constructed=_a$v,Constructed.NAME="CONSTRUCTED";class LocalEndOfContentValueBlock extends ValueBlock{fromBER(e,t,n){return t}toBER(e){return EMPTY_BUFFER}}LocalEndOfContentValueBlock.override="EndOfContentValueBlock";class EndOfContent extends BaseBlock{constructor(e={}){super(e,LocalEndOfContentValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}_a$u=EndOfContent,typeStore.EndOfContent=_a$u,EndOfContent.NAME=END_OF_CONTENT_NAME;class Null extends BaseBlock{constructor(e={}){super(e,ValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){const n=new ArrayBuffer(2);if(!e){const e=new Uint8Array(n);e[0]=5,e[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}}_a$t=Null,typeStore.Null=_a$t,Null.NAME="NULL";class LocalBooleanValueBlock extends(HexBlock(ValueBlock)){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=buildExports.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);return checkBufferParams(this,r,t,n)?(this.valueHexView=r.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,utilDecodeTC.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}LocalBooleanValueBlock.NAME="BooleanValueBlock";let Boolean$1=class extends BaseBlock{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,LocalBooleanValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};_a$s=Boolean$1,typeStore.Boolean=_a$s,Boolean$1.NAME="BOOLEAN";class LocalOctetStringValueBlock extends(HexBlock(LocalConstructedValueBlock)){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=LocalConstructedValueBlock.prototype.fromBER.call(this,e,t,n),-1===r)return r;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.NAME;if(t===END_OF_CONTENT_NAME){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(t!==OCTET_STRING_NAME)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,n),this.blockLength=n;return r}toBER(e,t){return this.isConstructed?LocalConstructedValueBlock.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}var _a$r,_a$q,_a$p,_a$o,_a$n,_a$m,_a$l,_a$k,_a$j;LocalOctetStringValueBlock.NAME="OctetStringValueBlock";class OctetString extends BaseBlock{constructor({idBlock:e={},lenBlock:t={},...n}={}){var r,o;null!==(r=n.isConstructed)&&void 0!==r||(n.isConstructed=!!(null===(o=n.value)||void 0===o?void 0:o.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},LocalOctetStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===n)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const r=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(r.byteLength){const e=localFromBER(r,0,r.byteLength);-1!==e.offset&&e.offset===n&&(this.valueBlock.value=[e.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);return`${this.constructor.NAME} : ${buildExports.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof _a$r&&e.push(t.valueBlock.valueHexView);return buildExports.BufferSourceConverter.concat(e)}}_a$r=OctetString,typeStore.OctetString=_a$r,OctetString.NAME=OCTET_STRING_NAME;class LocalBitStringValueBlock extends(HexBlock(LocalConstructedValueBlock)){constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let r=-1;if(this.isConstructed){if(r=LocalConstructedValueBlock.prototype.fromBER.call(this,e,t,n),-1===r)return r;for(const e of this.value){const t=e.constructor.NAME;if(t===END_OF_CONTENT_NAME){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(t!==BIT_STRING_NAME)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const n=e.valueBlock;if(this.unusedBits>0&&n.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=n.unusedBits}return r}const o=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,o,t,n))return-1;const i=o.subarray(t,t+n);if(this.unusedBits=i[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const e=i.subarray(1);try{if(e.byteLength){const t=localFromBER(e,0,e.byteLength);-1!==t.offset&&t.offset===n-1&&(this.value=[t.result])}}catch{}}return this.valueHexView=i.subarray(1),this.blockLength=i.length,t+n}toBER(e,t){if(this.isConstructed)return LocalConstructedValueBlock.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return EMPTY_BUFFER;const n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}LocalBitStringValueBlock.NAME="BitStringValueBlock";class BitString extends BaseBlock{constructor({idBlock:e={},lenBlock:t={},...n}={}){var r,o;null!==(r=n.isConstructed)&&void 0!==r||(n.isConstructed=!!(null===(o=n.value)||void 0===o?void 0:o.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},LocalBitStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const n of t)e.push(n.toString(2).padStart(8,"0"));const n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}}function viewAdd(e,t){const n=new Uint8Array([0]),r=new Uint8Array(e),o=new Uint8Array(t);let i=r.slice(0);const a=i.length-1,s=o.slice(0),c=s.length-1;let u=0;let l=0;for(let e=c<a?a:c;e>=0;e--,l++){if(!0==l<s.length)u=i[a-l]+s[c-l]+n[0];else u=i[a-l]+n[0];if(n[0]=u/10,!0==l>=i.length)i=utilConcatView(new Uint8Array([u%10]),i);else i[a-l]=u%10}return n[0]>0&&(i=utilConcatView(n,i)),i}function power2(e){if(e>=powers2.length)for(let t=powers2.length;t<=e;t++){const e=new Uint8Array([0]);let n=powers2[t-1].slice(0);for(let t=n.length-1;t>=0;t--){const r=new Uint8Array([(n[t]<<1)+e[0]]);e[0]=r[0]/10,n[t]=r[0]%10}e[0]>0&&(n=utilConcatView(e,n)),powers2.push(n)}return powers2[e]}function viewSub(e,t){let n=0;const r=new Uint8Array(e),o=new Uint8Array(t),i=r.slice(0),a=i.length-1,s=o.slice(0),c=s.length-1;let u,l=0;for(let e=c;e>=0;e--,l++)if(u=i[a-l]-s[c-l]-n,!0==u<0)n=1,i[a-l]=u+10;else n=0,i[a-l]=u;if(n>0)for(let e=a-c+1;e>=0;e--,l++){if(u=i[a-l]-n,!(u<0)){n=0,i[a-l]=u;break}n=1,i[a-l]=u+10}return i.slice()}_a$q=BitString,typeStore.BitString=_a$q,BitString.NAME=BIT_STRING_NAME;class LocalIntegerValueBlock extends(HexBlock(ValueBlock)){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=utilDecodeTC.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),void 0!==e&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(utilEncodeTC(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,r=0){const o=this.fromBER(e,t,n);if(-1===o)return o;const i=this.valueHexView;return 0===i[0]&&128&i[1]?this.valueHexView=i.subarray(1):0!==r&&i.length<r&&(r-i.length>1&&(r=i.length+1),this.valueHexView=i.subarray(r-i.length)),o}toDER(e=!1){const t=this.valueHexView;switch(!0){case!!(128&t[0]):{const e=new Uint8Array(this.valueHexView.length+1);e[0]=0,e.set(t,1),this.valueHexView=e}break;case 0===t[0]&&!(128&t[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(e)}fromBER(e,t,n){const r=super.fromBER(e,t,n);return-1===r||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=8*this.valueHexView.length-1;let t,n=new Uint8Array(8*this.valueHexView.length/3),r=0;const o=this.valueHexView;let i="",a=!1;for(let a=o.byteLength-1;a>=0;a--){t=o[a];for(let o=0;o<8;o++){if(!(1&~t))if(r===e)n=viewSub(power2(r),n),i="-";else n=viewAdd(n,power2(r));r++,t>>=1}}for(let e=0;e<n.length;e++)n[e]&&(a=!0),a&&(i+=digitsString.charAt(n[e]));return!1===a&&(i+=digitsString.charAt(0)),i}}_a$p=LocalIntegerValueBlock,LocalIntegerValueBlock.NAME="IntegerValueBlock",Object.defineProperty(_a$p.prototype,"valueHex",{set:function(e){this.valueHexView=new Uint8Array(e),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});class Integer extends BaseBlock{constructor(e={}){super(e,LocalIntegerValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return assertBigInt(),BigInt(this.valueBlock.toString())}static fromBigInt(e){assertBigInt();const t=BigInt(e),n=new ViewWriter,r=t.toString(16).replace(/^-/,""),o=new Uint8Array(buildExports.Convert.FromHex(r));if(t<0){const e=new Uint8Array(o.length+(128&o[0]?1:0));e[0]|=128;const r=BigInt(`0x${buildExports.Convert.ToHex(e)}`)+t,i=buildExports.BufferSourceConverter.toUint8Array(buildExports.Convert.FromHex(r.toString(16)));i[0]|=128,n.write(i)}else 128&o[0]&&n.write(new Uint8Array([0])),n.write(o);return new _a$o({valueHex:n.final()})}convertToDER(){const e=new _a$o({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new _a$o({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}_a$o=Integer,typeStore.Integer=_a$o,Integer.NAME="INTEGER";class Enumerated extends Integer{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}_a$n=Enumerated,typeStore.Enumerated=_a$n,Enumerated.NAME="ENUMERATED";class LocalSidValueBlock extends(HexBlock(ValueBlock)){constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let e=0;e<n&&(this.valueHexView[e]=127&o[e],this.blockLength++,128&o[e]);e++);const i=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)i[e]=this.valueHexView[e];return this.valueHexView=i,128&o[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){assertBigInt();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const n=new Uint8Array(t.length/7);for(let e=0;e<n.length;e++)n[e]=parseInt(t.slice(7*e,7*e+7),2)+(e+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,n=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)n[e]=128|t[e];return n[this.blockLength-1]=t[this.blockLength-1],n.buffer}const t=utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",EMPTY_BUFFER;const n=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)n[t]=128|e[t];n[r]=e[r]}return n}toString(){let e="";if(this.isHexOnly)e=buildExports.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}LocalSidValueBlock.NAME="sidBlock";class LocalObjectIdentifierValueBlock extends ValueBlock{constructor({value:e=EMPTY_STRING,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let r=t;for(;n>0;){const t=new LocalSidValueBlock;if(r=t.fromBER(e,r,n),-1===r)return this.blockLength=0,this.error=t.error,r;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,n-=t.blockLength,this.value.push(t)}return r}toBER(e){const t=[];for(let n=0;n<this.value.length;n++){const r=this.value[n].toBER(e);if(0===r.byteLength)return this.error=this.value[n].error,EMPTY_BUFFER;t.push(r)}return concat$1(t)}fromString(e){this.value=[];let t=0,n=0,r="",o=!1;do{if(n=e.indexOf(".",t),r=-1===n?e.substring(t):e.substring(t,n),t=n+1,o){const e=this.value[0];let t=0;switch(e.valueDec){case 0:break;case 1:t=40;break;case 2:t=80;break;default:return void(this.value=[])}const n=parseInt(r,10);if(isNaN(n))return;e.valueDec=n+t,o=!1}else{const e=new LocalSidValueBlock;if(r>Number.MAX_SAFE_INTEGER){assertBigInt();const t=BigInt(r);e.valueBigInt=t}else if(e.valueDec=parseInt(r,10),isNaN(e.valueDec))return;this.value.length||(e.isFirstSid=!0,o=!0),this.value.push(e)}}while(-1!==n)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let r=this.value[n].toString();0!==n&&(e=`${e}.`),t?(r=`{${r}}`,this.value[n].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}LocalObjectIdentifierValueBlock.NAME="ObjectIdentifierValueBlock";class ObjectIdentifier extends BaseBlock{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,LocalObjectIdentifierValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_a$m=ObjectIdentifier,typeStore.ObjectIdentifier=_a$m,ObjectIdentifier.NAME="OBJECT IDENTIFIER";class LocalRelativeSidValueBlock extends(HexBlock(LocalBaseBlock)){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(0===n)return t;const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let e=0;e<n&&(this.valueHexView[e]=127&o[e],this.blockLength++,128&o[e]);e++);const i=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)i[e]=this.valueHexView[e];return this.valueHexView=i,128&o[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,n=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)n[e]=128|t[e];return n[this.blockLength-1]=t[this.blockLength-1],n.buffer}const t=utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",EMPTY_BUFFER;const n=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)n[t]=128|e[t];n[r]=e[r]}return n.buffer}toString(){let e="";return e=this.isHexOnly?buildExports.Convert.ToHex(this.valueHexView):this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}LocalRelativeSidValueBlock.NAME="relativeSidBlock";class LocalRelativeObjectIdentifierValueBlock extends ValueBlock{constructor({value:e=EMPTY_STRING,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let r=t;for(;n>0;){const t=new LocalRelativeSidValueBlock;if(r=t.fromBER(e,r,n),-1===r)return this.blockLength=0,this.error=t.error,r;this.blockLength+=t.blockLength,n-=t.blockLength,this.value.push(t)}return r}toBER(e,t){const n=[];for(let t=0;t<this.value.length;t++){const r=this.value[t].toBER(e);if(0===r.byteLength)return this.error=this.value[t].error,EMPTY_BUFFER;n.push(r)}return concat$1(n)}fromString(e){this.value=[];let t=0,n=0,r="";do{n=e.indexOf(".",t),r=-1===n?e.substring(t):e.substring(t,n),t=n+1;const o=new LocalRelativeSidValueBlock;if(o.valueDec=parseInt(r,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(-1!==n);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let r=this.value[n].toString();0!==n&&(e=`${e}.`),t?(r=`{${r}}`,e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}LocalRelativeObjectIdentifierValueBlock.NAME="RelativeObjectIdentifierValueBlock";class RelativeObjectIdentifier extends BaseBlock{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,LocalRelativeObjectIdentifierValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_a$l=RelativeObjectIdentifier,typeStore.RelativeObjectIdentifier=_a$l,RelativeObjectIdentifier.NAME="RelativeObjectIdentifier";class Sequence extends Constructed{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}_a$k=Sequence,typeStore.Sequence=_a$k,Sequence.NAME="SEQUENCE";let Set$1=class extends Constructed{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};_a$j=Set$1,typeStore.Set=_a$j,Set$1.NAME="SET";class LocalStringValueBlock extends(HexBlock(ValueBlock)){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=EMPTY_STRING}toJSON(){return{...super.toJSON(),value:this.value}}}LocalStringValueBlock.NAME="StringValueBlock";class LocalSimpleStringValueBlock extends LocalStringValueBlock{}LocalSimpleStringValueBlock.NAME="SimpleStringValueBlock";class LocalSimpleStringBlock extends BaseStringBlock{constructor({...e}={}){super(e,LocalSimpleStringValueBlock)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,buildExports.BufferSourceConverter.toUint8Array(e))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);this.valueBlock.value=e}}LocalSimpleStringBlock.NAME="SIMPLE STRING";class LocalUtf8StringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){this.valueBlock.valueHexView=buildExports.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=buildExports.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=buildExports.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(buildExports.Convert.FromUtf8String(e)),this.valueBlock.value=e}}var _a$i,_a$h,_a$g,_a$f,_a$e,_a$d,_a$c,_a$b,_a$a,_a$9,_a$8,_a$7,_a$6,_a$5,_a$4,_a$3,_a$2,_a$1;LocalUtf8StringValueBlock.NAME="Utf8StringValueBlock";class Utf8String extends LocalUtf8StringValueBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}_a$i=Utf8String,typeStore.Utf8String=_a$i,Utf8String.NAME="UTF8String";class LocalBmpStringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){this.valueBlock.value=buildExports.Convert.ToUtf16String(e),this.valueBlock.valueHexView=buildExports.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(buildExports.Convert.FromUtf16String(e))}}LocalBmpStringValueBlock.NAME="BmpStringValueBlock";class BmpString extends LocalBmpStringValueBlock{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}_a$h=BmpString,typeStore.BmpString=_a$h,BmpString.NAME="BMPString";class LocalUniversalStringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let e=0;e<n.length;e+=4)n[e]=n[e+3],n[e+1]=n[e+2],n[e+2]=0,n[e+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(4*t);for(let r=0;r<t;r++){const t=utilToBase(e.charCodeAt(r),8),o=new Uint8Array(t);if(o.length>4)continue;const i=4-o.length;for(let e=o.length-1;e>=0;e--)n[4*r+e+i]=o[e]}this.valueBlock.value=e}}LocalUniversalStringValueBlock.NAME="UniversalStringValueBlock";class UniversalString extends LocalUniversalStringValueBlock{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}_a$g=UniversalString,typeStore.UniversalString=_a$g,UniversalString.NAME="UniversalString";class NumericString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}_a$f=NumericString,typeStore.NumericString=_a$f,NumericString.NAME="NumericString";class PrintableString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_a$e=PrintableString,typeStore.PrintableString=_a$e,PrintableString.NAME="PrintableString";class TeletexString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_a$d=TeletexString,typeStore.TeletexString=_a$d,TeletexString.NAME="TeletexString";class VideotexString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}_a$c=VideotexString,typeStore.VideotexString=_a$c,VideotexString.NAME="VideotexString";class IA5String extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_a$b=IA5String,typeStore.IA5String=_a$b,IA5String.NAME="IA5String";class GraphicString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_a$a=GraphicString,typeStore.GraphicString=_a$a,GraphicString.NAME="GraphicString";class VisibleString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}_a$9=VisibleString,typeStore.VisibleString=_a$9,VisibleString.NAME="VisibleString";class GeneralString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}_a$8=GeneralString,typeStore.GeneralString=_a$8,GeneralString.NAME="GeneralString";class CharacterString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}_a$7=CharacterString,typeStore.CharacterString=_a$7,CharacterString.NAME="CharacterString";class UTCTime extends VisibleString{constructor({value:e,valueDate:t,...n}={}){if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let t=0;t<e.length;t++)this.valueBlock.valueHexView[t]=e.charCodeAt(t)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,buildExports.BufferSourceConverter.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(e);if(null===t)return void(this.error="Wrong input string for conversion");const n=parseInt(t[1],10);this.year=n>=50?1900+n:2e3+n,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(e="iso"){if("iso"===e){const e=new Array(7);return e[0]=padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=padNumber(this.month,2),e[2]=padNumber(this.day,2),e[3]=padNumber(this.hour,2),e[4]=padNumber(this.minute,2),e[5]=padNumber(this.second,2),e[6]="Z",e.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}_a$6=UTCTime,typeStore.UTCTime=_a$6,UTCTime.NAME="UTCTime";class GeneralizedTime extends UTCTime{constructor(e={}){var t;super(e),null!==(t=this.millisecond)&&void 0!==t||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t,n=!1,r="",o="",i=0,a=0,s=0;if("Z"===e[e.length-1])r=e.substring(0,e.length-1),n=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(n){if(-1!==r.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==r.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let e=1,t=r.indexOf("+"),n="";if(-1===t&&(t=r.indexOf("-"),e=-1),-1!==t){if(n=r.substring(t+1),r=r.substring(0,t),2!==n.length&&4!==n.length)throw new Error("Wrong input string for conversion");let o=parseInt(n.substring(0,2),10);if(isNaN(o.valueOf()))throw new Error("Wrong input string for conversion");if(a=e*o,4===n.length){if(o=parseInt(n.substring(2,4),10),isNaN(o.valueOf()))throw new Error("Wrong input string for conversion");s=e*o}}}let c=r.indexOf(".");if(-1===c&&(c=r.indexOf(",")),-1!==c){const e=new Number(`0${r.substring(c)}`);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");i=e.valueOf(),o=r.substring(0,c)}else o=r;switch(!0){case 8===o.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*i;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*i;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){const e=1e3*i;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for conversion")}const u=t.exec(o);if(null===u)throw new Error("Wrong input string for conversion");for(let e=1;e<u.length;e++)switch(e){case 1:this.year=parseInt(u[e],10);break;case 2:this.month=parseInt(u[e],10);break;case 3:this.day=parseInt(u[e],10);break;case 4:this.hour=parseInt(u[e],10)+a;break;case 5:this.minute=parseInt(u[e],10)+s;break;case 6:this.second=parseInt(u[e],10);break;default:throw new Error("Wrong input string for conversion")}if(!1===n){const e=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=e.getUTCFullYear(),this.month=e.getUTCMonth(),this.day=e.getUTCDay(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}}toString(e="iso"){if("iso"===e){const e=[];return e.push(padNumber(this.year,4)),e.push(padNumber(this.month,2)),e.push(padNumber(this.day,2)),e.push(padNumber(this.hour,2)),e.push(padNumber(this.minute,2)),e.push(padNumber(this.second,2)),0!==this.millisecond&&(e.push("."),e.push(padNumber(this.millisecond,3))),e.push("Z"),e.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}_a$5=GeneralizedTime,typeStore.GeneralizedTime=_a$5,GeneralizedTime.NAME="GeneralizedTime";class DATE extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}_a$4=DATE,typeStore.DATE=_a$4,DATE.NAME="DATE";class TimeOfDay extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}_a$3=TimeOfDay,typeStore.TimeOfDay=_a$3,TimeOfDay.NAME="TimeOfDay";class DateTime extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}_a$2=DateTime,typeStore.DateTime=_a$2,DateTime.NAME="DateTime";let Duration$1=class extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};var _a;_a$1=Duration$1,typeStore.Duration=_a$1,Duration$1.NAME="Duration";class TIME extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}_a=TIME,typeStore.TIME=_a,TIME.NAME="TIME";var pem={exports:{}},forge,hasRequiredForge;function requireForge(){return hasRequiredForge?forge:(hasRequiredForge=1,forge={options:{usePureJavaScript:!1}})}var util={exports:{}},baseN,hasRequiredBaseN,hasRequiredUtil,hasRequiredPem;function requireBaseN(){if(hasRequiredBaseN)return baseN;hasRequiredBaseN=1;var e={};baseN=e;var t={};return e.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var r="";if(e instanceof Uint8Array){var o=0,i=t.length,a=t.charAt(0),s=[0];for(o=0;o<e.length;++o){for(var c=0,u=e[o];c<s.length;++c)u+=s[c]<<8,s[c]=u%i,u=u/i|0;for(;u>0;)s.push(u%i),u=u/i|0}for(o=0;0===e[o]&&o<e.length-1;++o)r+=a;for(o=s.length-1;o>=0;--o)r+=t[s[o]]}else r=function(e,t){var n=0,r=t.length,o=t.charAt(0),i=[0];for(n=0;n<e.length();++n){for(var a=0,s=e.at(n);a<i.length;++a)s+=i[a]<<8,i[a]=s%r,s=s/r|0;for(;s>0;)i.push(s%r),s=s/r|0}var c="";for(n=0;0===e.at(n)&&n<e.length()-1;++n)c+=o;for(n=i.length-1;n>=0;--n)c+=t[i[n]];return c}(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");r=r.match(l).join("\r\n")}return r},e.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var r=t[n];if(!r){r=t[n]=[];for(var o=0;o<n.length;++o)r[n.charCodeAt(o)]=o}e=e.replace(/\s/g,"");var i=n.length,a=n.charAt(0),s=[0];for(o=0;o<e.length;o++){var c=r[e.charCodeAt(o)];if(void 0===c)return;for(var u=0,l=c;u<s.length;++u)l+=s[u]*i,s[u]=255&l,l>>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===a&&d<e.length-1;++d)s.push(0);return"undefined"!=typeof Buffer?Buffer.from(s.reverse()):new Uint8Array(s.reverse())},baseN}function requireUtil(){if(hasRequiredUtil)return util.exports;hasRequiredUtil=1;var e=requireForge(),t=requireBaseN(),n=util.exports=e.util=e.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(n.isArrayBuffer(e)||n.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof o||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return n.nextTick=process.nextTick,void("function"==typeof setImmediate?n.setImmediate=setImmediate:n.setImmediate=n.nextTick);if("function"==typeof setImmediate)return n.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(n.nextTick=function(e){return setImmediate(e)});if(n.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];function s(n){if(n.source===window&&n.data===e){n.stopPropagation();var r=t.slice();t.length=0,r.forEach(function(e){e()})}}n.setImmediate=function(n){t.push(n),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",s,!0)}if("undefined"!=typeof MutationObserver){var r=Date.now(),o=!0,i=document.createElement("div");t=[];new MutationObserver(function(){var e=t.slice();t.length=0,e.forEach(function(e){e()})}).observe(i,{attributes:!0});var a=n.setImmediate;n.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),a(e)):(t.push(e),1===t.length&&i.setAttribute("a",o=!o))}}n.nextTick=n.setImmediate}(),n.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,n.globalScope=n.isNodejs?commonjsGlobal:"undefined"==typeof self?window:self,n.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},n.isArrayBufferView=function(e){return e&&n.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},n.ByteBuffer=o,n.ByteStringBuffer=o;n.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},n.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},n.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},n.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},n.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},n.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},n.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(n.encodeUtf8(e))},n.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},n.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},n.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},n.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},n.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},n.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},n.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},n.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},n.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},n.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},n.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<<e-2;return t>=n&&(t-=n<<1),t},n.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},n.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},n.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},n.ByteStringBuffer.prototype.copy=function(){var e=n.createBuffer(this.data);return e.read=this.read,e},n.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},n.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},n.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},n.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var n=this.data.charCodeAt(t);n<16&&(e+="0"),e+=n.toString(16)}return e},n.ByteStringBuffer.prototype.toString=function(){return n.decodeUtf8(this.bytes())},n.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=n.isArrayBuffer(e),o=n.isArrayBufferView(e);if(r||o)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},n.DataBuffer.prototype.length=function(){return this.write-this.read},n.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},n.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},n.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},n.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n<t;++n)this.data.setUint8(e);return this},n.DataBuffer.prototype.putBytes=function(e,t){if(n.isArrayBufferView(e)){var r=(o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-o.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(o),this.write+=r,this}if(n.isArrayBuffer(e)){var o=new Uint8Array(e);return this.accommodate(o.byteLength),new Uint8Array(this.data.buffer).set(o,this.write),this.write+=o.byteLength,this}if(e instanceof n.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&n.isArrayBufferView(e.data)){o=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(o.byteLength),new Uint8Array(e.data.byteLength,this.write).set(o),this.write+=o.byteLength,this}if(e instanceof n.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=n.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=n.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},n.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},n.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},n.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},n.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},n.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},n.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},n.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},n.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},n.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},n.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},n.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},n.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},n.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},n.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},n.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},n.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},n.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},n.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},n.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<<e-2;return t>=n&&(t-=n<<1),t},n.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},n.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},n.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},n.DataBuffer.prototype.copy=function(){return new n.DataBuffer(this)},n.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},n.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},n.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},n.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var n=this.data.getUint8(t);n<16&&(e+="0"),e+=n.toString(16)}return e},n.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return n.binary.raw.encode(t);if("hex"===e)return n.binary.hex.encode(t);if("base64"===e)return n.binary.base64.encode(t);if("utf8"===e)return n.text.utf8.decode(t);if("utf16"===e)return n.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},n.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=n.encodeUtf8(e)),new n.ByteBuffer(e)},n.fillString=function(e,t){for(var n="";t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return n},n.xorBytes=function(e,t,n){for(var r="",o="",i="",a=0,s=0;n>0;--n,++a)o=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(r+=i,i="",s=0),i+=String.fromCharCode(o),++s;return r+=i},n.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n<e.length;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t},n.bytesToHex=function(e){return n.createBuffer(e).toHex()},n.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";n.encode64=function(e,t){for(var n,r,o,a="",s="",c=0;c<e.length;)n=e.charCodeAt(c++),r=e.charCodeAt(c++),o=e.charCodeAt(c++),a+=i.charAt(n>>2),a+=i.charAt((3&n)<<4|r>>4),isNaN(r)?a+="==":(a+=i.charAt((15&r)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},n.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,n,r,o,i="",s=0;s<e.length;)t=a[e.charCodeAt(s++)-43],n=a[e.charCodeAt(s++)-43],r=a[e.charCodeAt(s++)-43],o=a[e.charCodeAt(s++)-43],i+=String.fromCharCode(t<<2|n>>4),64!==r&&(i+=String.fromCharCode((15&n)<<4|r>>2),64!==o&&(i+=String.fromCharCode((3&r)<<6|o)));return i},n.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},n.decodeUtf8=function(e){return decodeURIComponent(escape(e))},n.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:t.encode,decode:t.decode}},n.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},n.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length));for(var o=n=n||0,i=0;i<e.length;++i)r[o++]=e.charCodeAt(i);return t?o-n:r},n.binary.hex.encode=n.bytesToHex,n.binary.hex.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2)));var o=0,i=n=n||0;for(1&e.length&&(o=1,r[i++]=parseInt(e[0],16));o<e.length;o+=2)r[i++]=parseInt(e.substr(o,2),16);return t?i-n:r},n.binary.base64.encode=function(e,t){for(var n,r,o,a="",s="",c=0;c<e.byteLength;)n=e[c++],r=e[c++],o=e[c++],a+=i.charAt(n>>2),a+=i.charAt((3&n)<<4|r>>4),isNaN(r)?a+="==":(a+=i.charAt((15&r)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},n.binary.base64.decode=function(e,t,n){var r,o,i,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,l=n=n||0;u<e.length;)r=a[e.charCodeAt(u++)-43],o=a[e.charCodeAt(u++)-43],i=a[e.charCodeAt(u++)-43],s=a[e.charCodeAt(u++)-43],c[l++]=r<<2|o>>4,64!==i&&(c[l++]=(15&o)<<4|i>>2,64!==s&&(c[l++]=(3&i)<<6|s));return t?l-n:c.subarray(0,l)},n.binary.base58.encode=function(e,t){return n.binary.baseN.encode(e,s,t)},n.binary.base58.decode=function(e,t){return n.binary.baseN.decode(e,s,t)},n.text={utf8:{},utf16:{}},n.text.utf8.encode=function(e,t,r){e=n.encodeUtf8(e);var o=t;o||(o=new Uint8Array(e.length));for(var i=r=r||0,a=0;a<e.length;++a)o[i++]=e.charCodeAt(a);return t?i-r:o},n.text.utf8.decode=function(e){return n.decodeUtf8(String.fromCharCode.apply(null,e))},n.text.utf16.encode=function(e,t,n){var r=t;r||(r=new Uint8Array(2*e.length));for(var o=new Uint16Array(r.buffer),i=n=n||0,a=n,s=0;s<e.length;++s)o[a++]=e.charCodeAt(s),i+=2;return t?i-n:r},n.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},n.deflate=function(e,t,r){if(t=n.decode64(e.deflate(n.encode64(t)).rval),r){var o=2;32&t.charCodeAt(1)&&(o=6),t=t.substring(o,t.length-4)}return t},n.inflate=function(e,t,r){var o=e.inflate(n.encode64(t)).rval;return null===o?null:n.decode64(o)};var c=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var o;if(null===r?o=e.removeItem(t):(r=n.encode64(JSON.stringify(r)),o=e.setItem(t,r)),void 0!==o&&!0!==o.rval){var i=new Error(o.error.message);throw i.id=o.error.id,i.name=o.error.name,i}},u=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var o=new Error(r.error.message);throw o.id=r.error.id,o.name=r.error.name,o}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(n.decode64(r))),r},l=function(e,t,n,r){var o=u(e,t);null===o&&(o={}),o[n]=r,c(e,t,o)},d=function(e,t,n){var r=u(e,t);return null!==r&&(r=n in r?r[n]:null),r},p=function(e,t,n){var r=u(e,t);if(null!==r&&n in r){delete r[n];var o=!0;for(var i in r){o=!1;break}o&&(r=null),c(e,t,r)}},h=function(e,t){c(e,t,null)},f=function(e,t,n){var r,o=null;void 0===n&&(n=["web","flash"]);var i=!1,a=null;for(var s in n){r=n[s];try{if("flash"===r||"both"===r){if(null===t[0])throw new Error("Flash local storage not available.");o=e.apply(this,t),i="flash"===r}"web"!==r&&"both"!==r||(t[0]=localStorage,o=e.apply(this,t),i=!0)}catch(e){a=e}if(i)break}if(!i)throw a;return o};return n.setItem=function(e,t,n,r,o){f(l,arguments,o)},n.getItem=function(e,t,n,r){return f(d,arguments,r)},n.removeItem=function(e,t,n,r){f(p,arguments,r)},n.clearItems=function(e,t,n){f(h,arguments,n)},n.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},n.format=function(e){for(var t,n,r=/%./g,o=0,i=[],a=0;t=r.exec(e);){(n=e.substring(a,r.lastIndex-2)).length>0&&i.push(n),a=r.lastIndex;var s=t[0][1];switch(s){case"s":case"o":o<arguments.length?i.push(arguments[1+o++]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+s+"?>")}}return i.push(e.substring(a)),i.join("")},n.formatNumber=function(e,t,n,r){var o=e,i=isNaN(t=Math.abs(t))?2:t,a=void 0===n?",":n,s=void 0===r?".":r,c=o<0?"-":"",u=parseInt(o=Math.abs(+o||0).toFixed(i),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+s:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(i?a+Math.abs(o-u).toFixed(i).slice(2):"")},n.formatSize=function(e){return e=e>=1073741824?n.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?n.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?n.formatNumber(e/1024,0)+" KiB":n.formatNumber(e,0)+" bytes"},n.bytesFromIP=function(e){return-1!==e.indexOf(".")?n.bytesFromIPv4(e):-1!==e.indexOf(":")?n.bytesFromIPv6(e):null},n.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=n.createBuffer(),r=0;r<e.length;++r){var o=parseInt(e[r],10);if(isNaN(o))return null;t.putByte(o)}return t.getBytes()},n.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).length+t),o=n.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var a=n.hexToBytes(e[i]);a.length<2&&o.putByte(0),o.putBytes(a)}else o.fillWithByte(0,r),r=0;return o.getBytes()},n.bytesToIP=function(e){return 4===e.length?n.bytesToIPv4(e):16===e.length?n.bytesToIPv6(e):null},n.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t.join(".")},n.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],o=0,i=0;i<e.length;i+=2){for(var a=n.bytesToHex(e[i]+e[i+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=r[r.length-1],c=t.length;s&&c===s.end+1?(s.end=c,s.end-s.start>r[o].end-r[o].start&&(o=r.length-1)):r.push({start:c,end:c})}t.push(a)}if(r.length>0){var u=r[o];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},n.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in n&&!e.update)return t(null,n.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return n.cores=navigator.hardwareConcurrency,t(null,n.cores);if("undefined"==typeof Worker)return n.cores=1,t(null,n.cores);if("undefined"==typeof Blob)return n.cores=2,t(null,n.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){var t=Date.now(),n=t+4;self.postMessage({st:t,et:n})})}.toString(),")()"],{type:"application/javascript"}));!function e(o,i,a){if(0===i){var s=Math.floor(o.reduce(function(e,t){return e+t},0)/o.length);return n.cores=Math.max(1,s),URL.revokeObjectURL(r),t(null,n.cores)}!function(e,t){for(var n=[],o=[],i=0;i<e;++i){var a=new Worker(r);a.addEventListener("message",function(r){if(o.push(r.data),o.length===e){for(var i=0;i<e;++i)n[i].terminate();t(null,o)}}),n.push(a)}for(i=0;i<e;++i)n[i].postMessage(i)}(a,function(t,n){o.push(function(e,t){for(var n=[],r=0;r<e;++r)for(var o=t[r],i=n[r]=[],a=0;a<e;++a)if(r!==a){var s=t[a];(o.st>s.st&&o.st<s.et||s.st>o.st&&s.st<o.et)&&i.push(a)}return n.reduce(function(e,t){return Math.max(e,t.length)},0)}(a,n)),e(o,i-1,a)})}([],5,16)},util.exports}function requirePem(){if(hasRequiredPem)return pem.exports;hasRequiredPem=1;var e=requireForge();requireUtil();var t=pem.exports=e.pem=e.pem||{};function n(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},o=0;o<e.values.length;++o)n.push(e.values[o].replace(/^(\S+\r\n)/,r));t+=n.join(",")+"\r\n";var i=0,a=-1;for(o=0;o<t.length;++o,++i)if(i>65&&-1!==a){var s=t[a];","===s?(++a,t=t.substr(0,a)+"\r\n "+t.substr(a)):t=t.substr(0,a)+"\r\n"+s+t.substr(a+1),i=o-a-1,a=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(a=o);return t}function r(e){return e.replace(/^\s+/,"")}return t.encode=function(t,r){r=r||{};var o,i="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(i+=n(o={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(i+=n(o={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(o={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&o.values.push(t.dekInfo.parameters),i+=n(o)),t.headers)for(var a=0;a<t.headers.length;++a)i+=n(t.headers[a]);return t.procType&&(i+="\r\n"),i+=e.util.encode64(t.body,r.maxline||64)+"\r\n",i+="-----END "+t.type+"-----\r\n"},t.decode=function(t){for(var n,o=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/;n=i.exec(t);){var c=n[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var u={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(n[3])};if(o.push(u),n[2]){for(var l=n[2].split(s),d=0;n&&d<l.length;){for(var p=l[d].replace(/\s+$/,""),h=d+1;h<l.length;++h){var f=l[h];if(!/\s/.test(f[0]))break;p+=f,d=h}if(n=p.match(a)){for(var y={name:n[1],values:[]},m=n[2].split(","),g=0;g<m.length;++g)y.values.push(r(m[g]));if(u.procType)if(u.contentDomain||"Content-Domain"!==y.name)if(u.dekInfo||"DEK-Info"!==y.name)u.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:m[0],parameters:m[1]||null}}else u.contentDomain=m[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:m[0],type:m[1]}}}++d}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===o.length)throw new Error("Invalid PEM formatted message.");return o},pem.exports}var pemExports=requirePem(),pemForge=getDefaultExportFromCjs(pemExports);const ID_ED25519="1.3.101.112";async function readPemED25519(e,t){const n=decode$3(e.replace(/-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g,""));if(t){let e;try{e=EncryptedPrivateKeyInfo.parse(n)}catch(e){const t=null!=e&&null!=e.message?e.message:"";throw new BadKeyError(`failed to parse encrypted private key: ${t}`)}const r=await e.decrypt(t);let o=null;if(r.algId.algIdent!==ID_ED25519)throw new BadKeyError(`unknown private key algorithm ${r.algId.toString()}`);o=Ed25519PrivateKey;const i=decode$4(r.privateKey);if(!("bytes"in i))throw new BadKeyError(`expected ASN bytes, got ${JSON.stringify(i)}`);return o.fromBytes(i.bytes)}return n.subarray(16)}async function readPemECDSA(e,t){const n=decode$3(e.replace(/-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g,""));if(t){const n=pemForge.decode(e)[0].dekInfo.parameters,r=decode$6(n),o=e.split("\n"),i=await messageDigest(t,n),a=bufferExports.Buffer.from(o.slice(4,o.length-1).join(""),"base64"),s=await createDecipheriv(CipherAlgorithm.Aes128Cbc,i,r,a);return EcdsaPrivateKey.fromBytesDer(s)}return fromBER(n).result.valueBlock.value[1].valueBlock.valueHexView}async function read(e,t){return!!e.includes("BEGIN EC PRIVATE KEY")?readPemECDSA(e,t):readPemED25519(e,t)}function legacy(e,t){const n=new Uint8Array(e.length+8);n.set(e,0);const r=new DataView(n.buffer,n.byteOffset,n.byteLength);0xffffffffff===t?(r.setInt32(e.length+0,255),r.setInt32(e.length+4,-1)):(r.setInt32(e.length+0,t<0?-1:0),r.setInt32(e.length+4,t));const o=Uint8Array.from([255]);return deriveKey(HashAlgorithm.Sha512,n,o,2048,32)}const CACHE$1={privateKeyConstructor:null,privateKeyFromBytes:null,mnemonicFromString:null};let PrivateKey$1=class e extends Key$1{constructor(e){super(),this._key=e}get _type(){return this._key._type}get _chainCode(){return this._key._chainCode}static generateED25519(){return new e(Ed25519PrivateKey.generate())}static generateECDSA(){return new e(EcdsaPrivateKey.generate())}static generate(){return e.generateED25519()}static async generateAsync(){return e.generateED25519Async()}static async generateED25519Async(){return new e(await Ed25519PrivateKey.generateAsync())}static async generateECDSAAsync(){return new e(await EcdsaPrivateKey.generateAsync())}static fromBytes(t){let n;32==t.length&&console.warn("WARNING: Consider using fromStringECDSA() or fromStringED25519() on a HEX-encoded string and fromStringDer() on a HEX-encoded string with DER prefix instead.");try{return new e(Ed25519PrivateKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}try{return new e(EcdsaPrivateKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}throw new BadKeyError(`private key cannot be decoded from bytes: ${n}`)}static fromBytesECDSA(t){return new e(EcdsaPrivateKey.fromBytes(t))}static fromBytesED25519(t){return new e(Ed25519PrivateKey.fromBytes(t))}static fromString(t){return e.fromBytes(decode$6(t))}static fromStringECDSA(t){return e.fromBytesECDSA(decode$6(t))}static fromStringED25519(t){return e.fromBytesED25519(decode$6(t))}static async fromSeedED25519(t){const n=await Ed25519PrivateKey.fromSeed(t);return new e(n)}static async fromSeedECDSAsecp256k1(t){const n=await EcdsaPrivateKey.fromSeed(t);return new e(n)}static async fromMnemonic(e,t=""){if(null==CACHE$1.mnemonicFromString)throw new Error("Mnemonic not found in cache");return("string"==typeof e?CACHE$1.mnemonicFromString(e):e).toEd25519PrivateKey(t)}static async fromKeystore(t,n=""){return e.fromBytes(await loadKeystore(t,n))}static async fromPem(t,n=""){const r=await read(t,n);if(r instanceof Ed25519PrivateKey||r instanceof EcdsaPrivateKey)return new e(r);const o=!!t.includes("BEGIN EC PRIVATE KEY");return new e(o?EcdsaPrivateKey.fromBytes(r):Ed25519PrivateKey.fromBytes(r))}async derive(t){if(null==this._key._chainCode)throw new Error("this private key does not support key derivation");if(this._key instanceof Ed25519PrivateKey){const{keyData:n,chainCode:r}=await derive(this.toBytesRaw(),this._key._chainCode,t);return new e(new Ed25519PrivateKey(n,r))}{const{keyData:n,chainCode:r}=await derive$1(this.toBytesRaw(),this._key._chainCode,t);return new e(new EcdsaPrivateKey(fromBytes(n),r))}}async legacyDerive(t){const n=await legacy(this.toBytesRaw().subarray(0,32),t),r=this._key.constructor;return new e(new r(n))}get publicKey(){return new PublicKey$1(this._key.publicKey)}sign(e){return this._key.sign(e)}signTransaction(e){if(e.isFrozen()||e.freeze(),1!=e._signedTransactions.length)throw new Error("`PrivateKey.signTransaction()` requires `Transaction` to have a single node `AccountId` set");const t=e._signedTransactions[0],n=encode$3(this.publicKey.toBytesRaw());null==t.sigMap&&(t.sigMap={}),null==t.sigMap.sigPair&&(t.sigMap.sigPair=[]);for(const e of t.sigMap.sigPair)if(null!=e.pubKeyPrefix&&encode$3(e.pubKeyPrefix)===n)switch(this._type){case"ED25519":return e.ed25519;case"secp256k1":return e.ECDSASecp256k1}const r=this.sign(null!=t.bodyBytes?t.bodyBytes:new Uint8Array),o={pubKeyPrefix:this.publicKey.toBytesRaw()};switch(this._type){case"ED25519":o.ed25519=r;break;case"secp256k1":o.ECDSASecp256k1=r}return t.sigMap.sigPair.push(o),e._signerPublicKeys.add(n),r}isDerivable(){return null!=this._key._chainCode}toBytes(){return this._key instanceof Ed25519PrivateKey?this.toBytesRaw():this.toBytesDer()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this.toStringDer()}toStringDer(){return encode$3(this.toBytesDer())}toStringRaw(){return encode$3(this.toBytesRaw())}toKeystore(e=""){return createKeystore(this.toBytesRaw(),e)}getRecoveryId(e,t,n){if(!(this._key instanceof EcdsaPrivateKey))throw new Error("Invalid key type, must be ECDSA secp256k1.");if(32!==e.length||32!==t.length)throw new Error("Invalid signature components.");const r=new Uint8Array(64);return r.set(e,0),r.set(t,32),this._key.getRecoveryId(r,n)}};CACHE$1.privateKeyConstructor=e=>new PrivateKey$1(e),CACHE$1.privateKeyFromBytes=e=>PrivateKey$1.fromBytes(e);const BadMnemonicReason=Object.freeze({BadLength:"BadLength",UnknownWords:"UnknownWords",ChecksumMismatch:"ChecksumMismatch"});class BadMnemonicError extends Error{constructor(e,t,n){let r;switch(t){case BadMnemonicReason.BadLength:r="mnemonic is of an unexpected number of words";break;case BadMnemonicReason.ChecksumMismatch:r="checksum byte in mnemonic did not match the rest of the mnemonic";break;case BadMnemonicReason.UnknownWords:r="mnemonic contained words that are not in the standard word list";break;default:throw new Error(`unexpected value ${t.toString()} for 'reason'`)}super(`invalid mnemonic: ${r}`),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,BadMnemonicError),this.name="BadMnemonicError",this.reason=t,this.mnemonic=e,this.unknownWordIndices=n}}var legacyWords=["aback","abbey","abbot","abide","ablaze","able","aboard","abode","abort","abound","about","above","abroad","abrupt","absent","absorb","absurd","abuse","accent","accept","access","accord","accuse","ace","ache","aching","acid","acidic","acorn","acre","across","act","action","active","actor","actual","acute","adam","adapt","add","added","addict","adept","adhere","adjust","admire","admit","adobe","adopt","adrift","adult","adverb","advice","aerial","afar","affair","affect","afford","afghan","afield","afloat","afraid","afresh","after","again","age","agency","agenda","agent","aghast","agile","ago","agony","agree","agreed","ahead","aid","aide","aim","air","airman","airy","akin","alarm","alaska","albeit","album","ale","alert","alibi","alice","alien","alight","align","alike","alive","alkali","all","alley","allied","allow","alloy","ally","almond","almost","aloft","alone","along","aloof","aloud","alpha","alpine","also","altar","alter","always","amaze","amazon","amber","ambush","amen","amend","amid","amidst","amiss","among","amount","ample","amuse","anchor","and","andrew","anew","angel","anger","angle","angry","animal","ankle","annoy","annual","answer","anthem","any","anyhow","anyway","apart","apathy","apex","apiece","appeal","appear","apple","apply","april","apron","arab","arcade","arcane","arch","arctic","ardent","are","area","argue","arid","arise","ark","arm","armful","army","aroma","around","arouse","array","arrest","arrive","arrow","arson","art","artery","artful","artist","ascent","ash","ashen","ashore","aside","ask","asleep","aspect","assay","assent","assert","assess","asset","assign","assist","assume","assure","asthma","astute","asylum","ate","athens","atlas","atom","atomic","attach","attack","attain","attend","attic","auburn","audio","audit","august","aunt","auntie","aura","austin","author","auto","autumn","avail","avenge","avenue","avert","avid","avoid","await","awake","awaken","award","aware","awash","away","awful","awhile","axe","axes","axiom","axis","axle","aye","babe","baby","bach","back","backup","bacon","bad","badge","badly","bag","baggy","bail","bait","bake","baker","bakery","bald","ball","ballad","ballet","ballot","baltic","bamboo","ban","banal","banana","band","bang","bank","bar","barber","bare","barely","barge","bark","barley","barn","baron","barrel","barren","basalt","base","basic","basil","basin","basis","basket","bass","bat","batch","bath","baton","battle","bay","beach","beacon","beak","beam","bean","bear","beard","beast","beat","beauty","become","bed","beech","beef","beefy","beep","beer","beet","beetle","before","beg","beggar","begin","behalf","behave","behind","beige","being","belief","bell","belly","belong","below","belt","bench","bend","benign","bent","berlin","berry","berth","beset","beside","best","bestow","bet","beta","betray","better","beware","beyond","bias","biceps","bicker","bid","big","bigger","bike","bile","bill","bin","binary","bind","biopsy","birch","bird","birdie","birth","bishop","bit","bitch","bite","bitter","black","blade","blame","bland","blast","blaze","bleak","blend","bless","blew","blind","blink","blip","bliss","blitz","block","blond","blood","bloody","bloom","blot","blouse","blow","blue","bluff","blunt","blur","blush","boar","board","boast","boat","bob","bodily","body","bogus","boil","bold","bolt","bomb","bombay","bond","bone","bonn","bonnet","bonus","bony","book","boom","boost","boot","booth","booze","border","bore","borrow","bosom","boss","boston","both","bother","bottle","bottom","bought","bounce","bound","bounty","bout","bovine","bow","bowel","bowl","box","boy","boyish","brace","brain","brainy","brake","bran","branch","brand","brandy","brass","brave","bravo","brazil","breach","bread","break","breast","breath","bred","breed","breeze","brew","bribe","brick","bride","bridge","brief","bright","brim","brine","bring","brink","brisk","broad","broke","broken","bronze","brook","broom","brown","bruise","brush","brutal","brute","bubble","buck","bucket","buckle","budget","buffet","buggy","build","bulb","bulge","bulk","bulky","bull","bullet","bully","bump","bumpy","bunch","bundle","bunk","bunny","burden","bureau","burial","buried","burly","burn","burnt","burrow","burst","bury","bus","bush","bust","bustle","busy","but","butler","butt","butter","button","buy","buyer","buzz","bye","byte","cab","cabin","cable","cache","cactus","caesar","cage","cairo","cajun","cajole","cake","calf","call","caller","calm","calmly","came","camel","camera","camp","campus","can","canada","canal","canary","cancel","cancer","candid","candle","candy","cane","canine","canoe","canopy","canvas","canyon","cap","cape","car","carbon","card","care","career","caress","cargo","carl","carnal","carol","carp","carpet","carrot","carry","cart","cartel","case","cash","cask","cast","castle","casual","cat","catch","cater","cattle","caught","causal","cause","cave","cease","celery","cell","cellar","celtic","cement","censor","census","cent","cereal","chain","chair","chalk","chalky","champ","chance","change","chant","chaos","chap","chapel","charge","charm","chart","chase","chat","cheap","cheat","check","cheek","cheeky","cheer","cheery","cheese","chef","cheque","cherry","chess","chest","chew","chic","chick","chief","child","chile","chill","chilly","chin","china","chip","choice","choir","choose","chop","choppy","chord","chorus","chose","chosen","chris","chrome","chunk","chunky","church","cider","cigar","cinema","circa","circle","circus","cite","city","civic","civil","clad","claim","clammy","clan","clap","clash","clasp","class","clause","claw","clay","clean","clear","clergy","clerk","clever","click","client","cliff","climax","climb","clinch","cling","clinic","clip","cloak","clock","clone","close","closer","closet","cloth","cloud","cloudy","clout","clown","club","clue","clumsy","clung","clutch","coach","coal","coarse","coast","coat","coax","cobalt","cobra","coca","cock","cocoa","code","coffee","coffin","cohort","coil","coin","coke","cold","collar","colon","colony","colt","column","comb","combat","come","comedy","comic","commit","common","compel","comply","concur","cone","confer","congo","consul","convex","convey","convoy","cook","cool","cope","copper","copy","coral","cord","core","cork","corn","corner","corps","corpse","corpus","cortex","cosmic","cosmos","cost","costly","cotton","couch","cough","could","count","county","coup","couple","coupon","course","court","cousin","cove","cover","covert","cow","coward","cowboy","cozy","crab","crack","cradle","craft","crafty","crag","crane","crash","crate","crater","crawl","crazy","creak","cream","creamy","create","credit","creed","creek","creep","creepy","crept","crest","crew","cried","crime","crisis","crisp","critic","crook","crop","cross","crow","crowd","crown","crude","cruel","cruise","crunch","crush","crust","crux","cry","crypt","cuba","cube","cubic","cuckoo","cuff","cult","cup","curb","cure","curfew","curl","curry","curse","cursor","curve","cuss","custom","cut","cute","cycle","cyclic","cynic","czech","dad","daddy","dagger","daily","dairy","daisy","dale","dam","damage","damp","dampen","dance","danger","danish","dare","dark","darken","darn","dart","dash","data","date","david","dawn","day","dead","deadly","deaf","deal","dealer","dean","dear","death","debate","debit","debris","debt","debtor","decade","decay","decent","decide","deck","decor","decree","deduce","deed","deep","deeply","deer","defeat","defect","defend","defer","define","defy","degree","deity","delay","delete","delhi","delta","demand","demise","demo","demure","denial","denote","dense","dental","deny","depart","depend","depict","deploy","depot","depth","deputy","derive","desert","design","desire","desist","desk","detail","detect","deter","detest","detour","device","devise","devoid","devote","devour","dial","diana","diary","dice","dictum","did","die","diesel","diet","differ","dig","digest","digit","dine","dinghy","dinner","diode","dip","dire","direct","dirt","dirty","disc","disco","dish","disk","dismal","dispel","ditch","dive","divert","divide","divine","dizzy","docile","dock","doctor","dog","dogma","dole","doll","dollar","dolly","domain","dome","domino","donate","done","donkey","donor","doom","door","dorsal","dose","dot","double","doubt","dough","dour","dove","down","dozen","draft","drag","dragon","drain","drama","drank","draw","drawer","dread","dream","dreary","dress","drew","dried","drift","drill","drink","drip","drive","driver","drop","drove","drown","drug","drum","drunk","dry","dual","duck","duct","due","duel","duet","duke","dull","duly","dumb","dummy","dump","dune","dung","duress","during","dusk","dust","dusty","dutch","duty","dwarf","dwell","dyer","dying","dynamo","each","eager","eagle","ear","earl","early","earn","earth","ease","easel","easily","east","easter","easy","eat","eaten","eater","echo","eddy","eden","edge","edible","edict","edit","editor","eel","eerie","eerily","effect","effort","egg","ego","eight","eighth","eighty","either","elbow","elder","eldest","elect","eleven","elicit","elite","else","elude","elves","embark","emblem","embryo","emerge","emit","empire","employ","empty","enable","enamel","end","endure","enemy","energy","engage","engine","enjoy","enlist","enough","ensure","entail","enter","entire","entry","envoy","envy","enzyme","epic","epoch","equal","equate","equip","equity","era","erect","eric","erode","erotic","errant","error","escape","escort","essay","essex","estate","esteem","ethic","ethnic","europe","evade","eve","even","event","ever","every","evict","evil","evoke","evolve","exact","exam","exceed","excel","except","excess","excise","excite","excuse","exempt","exert","exile","exist","exit","exodus","exotic","expand","expect","expert","expire","export","expose","extend","extra","eye","eyed","fabric","face","facial","fact","factor","fade","fail","faint","fair","fairly","fairy","faith","fake","falcon","fall","false","falter","fame","family","famine","famous","fan","fancy","far","farce","fare","farm","farmer","fast","fasten","faster","fat","fatal","fate","father","fatty","fault","faulty","fauna","fear","feast","feat","fed","fee","feeble","feed","feel","feet","fell","fellow","felt","female","fence","fend","ferry","fetal","fetch","feudal","fever","few","fewer","fiasco","fiddle","field","fiend","fierce","fiery","fifth","fifty","fig","fight","figure","file","fill","filled","filler","film","filter","filth","filthy","final","finale","find","fine","finery","finger","finish","finite","fire","firm","firmly","first","fiscal","fish","fisher","fist","fit","fitful","five","fix","flag","flair","flak","flame","flank","flap","flare","flash","flask","flat","flavor","flaw","fled","flee","fleece","fleet","flesh","fleshy","flew","flick","flight","flimsy","flint","flirt","float","flock","flood","floor","floppy","flora","floral","flour","flow","flower","fluent","fluffy","fluid","flung","flurry","flush","flute","flux","fly","flyer","foal","foam","focal","focus","fog","foil","fold","folk","follow","folly","fond","fondly","font","food","fool","foot","for","forbid","force","ford","forest","forge","forget","fork","form","formal","format","former","fort","forth","forty","forum","fossil","foster","foul","found","four","fourth","fox","foyer","frail","frame","franc","france","frank","fraud","fred","free","freed","freely","freeze","french","frenzy","fresh","friar","friday","fridge","fried","friend","fright","fringe","frock","frog","from","front","frost","frosty","frown","frozen","frugal","fruit","fry","fudge","fuel","full","fully","fumes","fun","fund","funny","fur","furry","fury","fuse","fusion","fuss","fussy","futile","future","fuzzy","gadget","gain","gala","galaxy","gale","gall","galley","gallon","gallop","gamble","game","gamma","gandhi","gang","gap","garage","garden","garlic","gas","gasp","gate","gather","gauge","gaunt","gave","gaze","gear","geese","gem","gemini","gender","gene","geneva","genial","genius","genre","gentle","gently","gentry","genus","george","germ","get","ghetto","ghost","giant","gift","giggle","gill","gilt","ginger","girl","give","given","glad","glade","glance","gland","glare","glass","glassy","gleam","glee","glide","global","globe","gloom","gloomy","gloria","glory","gloss","glossy","glove","glow","glue","gnat","gnu","goal","goat","gold","golden","golf","gone","gong","goo","good","goose","gore","gorge","gory","gosh","gospel","gossip","got","gothic","govern","gown","grab","grace","grade","grail","grain","grand","grant","grape","graph","grasp","grass","grassy","grate","grave","gravel","gravy","grease","greasy","great","greece","greed","greedy","greek","green","greet","grew","grey","grid","grief","grill","grim","grin","grind","grip","grit","gritty","groan","groin","groom","groove","gross","ground","group","grove","grow","grown","growth","grudge","grunt","guard","guess","guest","guide","guild","guilt","guilty","guise","guitar","gulf","gully","gun","gunman","guru","gut","guy","gypsy","habit","hack","had","hail","hair","hairy","haiti","hale","half","hall","halt","hamlet","hammer","hand","handle","handy","hang","hangar","hanoi","happen","happy","harass","harbor","hard","harder","hardly","hare","harem","harm","harp","harry","harsh","has","hash","hassle","haste","hasten","hasty","hat","hatch","hate","haul","haunt","havana","have","haven","havoc","hawaii","hawk","hay","hazard","haze","hazel","hazy","head","heal","health","heap","hear","heard","heart","hearth","hearty","heat","heater","heaven","heavy","hebrew","heck","hectic","hedge","heel","hefty","height","heir","held","helium","helix","hell","hello","helm","helmet","help","hemp","hence","henry","her","herald","herb","herd","here","hereby","hermes","hernia","hero","heroic","heroin","hey","heyday","hick","hidden","hide","high","higher","highly","hill","him","hind","hinder","hint","hippie","hire","his","hiss","hit","hive","hoard","hoarse","hobby","hockey","hold","holder","hole","hollow","holly","holy","home","honest","honey","hood","hook","hope","horn","horrid","horror","horse","hose","host","hot","hotel","hound","hour","house","hover","how","huge","hull","human","humane","humble","humid","hung","hunger","hungry","hunt","hurdle","hurl","hurry","hurt","hush","hut","hybrid","hymn","hyphen","ice","icing","icon","idaho","idea","ideal","idiom","idiot","idle","idly","idol","ignite","ignore","ill","image","immune","impact","imply","import","impose","inca","incest","inch","income","incur","indeed","index","india","indian","indoor","induce","inept","inert","infant","infect","infer","influx","inform","inject","injure","injury","ink","inlaid","inland","inlet","inmate","inn","innate","inner","input","insane","insect","insert","inset","inside","insist","insult","insure","intact","intake","intend","inter","into","invade","invent","invest","invite","invoke","inward","iowa","iran","iraq","irish","iron","ironic","irony","isaac","isabel","island","isle","israel","issue","italy","itch","item","itself","ivan","ivory","jack","jacket","jacob","jade","jaguar","jail","james","jane","japan","jargon","java","jaw","jazz","jeep","jelly","jerky","jest","jet","jewel","jewish","jim","job","jock","jockey","joe","john","join","joint","joke","jolly","jolt","jordan","joseph","joy","joyful","joyous","judge","judy","juice","juicy","july","jumble","jumbo","jump","june","jungle","junior","junk","junta","jury","just","kansas","karate","karl","keel","keen","keep","keeper","kenya","kept","kernel","kettle","key","khaki","kick","kid","kidnap","kidney","kill","killer","kin","kind","kindly","king","kiss","kite","kitten","knack","knee","kneel","knew","knife","knight","knit","knob","knock","knot","know","known","koran","korea","kuwait","label","lace","lack","lad","ladder","laden","lady","lagoon","laity","lake","lamb","lame","lamp","lance","land","lane","lap","lapse","large","larval","laser","last","latch","late","lately","latent","later","latest","latin","latter","laugh","launch","lava","lavish","law","lawful","lawn","lawyer","lay","layer","layman","lazy","lead","leader","leaf","leafy","league","leak","leaky","lean","leap","learn","lease","leash","least","leave","led","ledge","left","leg","legacy","legal","legend","legion","lemon","lend","length","lens","lent","leo","leper","lesion","less","lessen","lesser","lesson","lest","let","lethal","letter","level","lever","levy","lewis","liable","liar","libel","libya","lice","lick","lid","lie","lied","lier","life","lift","light","like","likely","limb","lime","limit","limp","line","linear","linen","linger","link","lint","lion","lip","liquid","liquor","list","listen","lit","live","lively","liver","liz","lizard","load","loaf","loan","lobby","lobe","local","locate","lock","locus","lodge","loft","lofty","log","logic","logo","london","lone","lonely","long","longer","look","loop","loose","loosen","loot","lord","lorry","lose","loss","lost","lot","lotion","lotus","loud","loudly","lounge","lousy","love","lovely","lover","low","lower","lowest","loyal","lucid","luck","lucky","lucy","lull","lump","lumpy","lunacy","lunar","lunch","lung","lure","lurid","lush","lust","lute","luther","luxury","lying","lymph","lynch","lyric","macho","macro","mad","madam","made","mafia","magic","magma","magnet","magnum","magpie","maid","maiden","mail","main","mainly","major","make","maker","male","malice","mall","malt","mammal","manage","mane","mania","manic","manner","manor","mantle","manual","manure","many","map","maple","marble","march","mare","margin","maria","marina","mark","market","marry","mars","marsh","martin","martyr","mary","mask","mason","mass","mast","master","mat","match","mate","matrix","matter","mature","maxim","may","maybe","mayor","maze","mead","meadow","meal","mean","meant","meat","medal","media","median","medic","medium","meet","mellow","melody","melon","melt","member","memo","memory","menace","mend","mental","mentor","menu","mercy","mere","merely","merge","merger","merit","merry","mesh","mess","messy","met","metal","meter","method","methyl","metric","metro","mexico","miami","mickey","mid","midday","middle","midst","midway","might","mighty","mild","mildew","mile","milk","milky","mill","mimic","mince","mind","mine","mini","mink","minor","mint","minus","minute","mire","mirror","mirth","misery","miss","mist","misty","mite","mix","moan","moat","mob","mobile","mock","mode","model","modem","modern","modest","modify","module","moist","molar","mold","mole","molten","moment","monday","money","monk","monkey","month","mood","moody","moon","moor","moral","morale","morbid","more","morgue","mortal","mortar","mosaic","moscow","moses","mosque","moss","most","mostly","moth","mother","motion","motive","motor","mount","mourn","mouse","mouth","move","movie","mrs","much","muck","mucus","mud","muddle","muddy","mule","mummy","munich","murder","murky","murmur","muscle","museum","music","mussel","must","mutant","mute","mutiny","mutter","mutton","mutual","muzzle","myopic","myriad","myself","mystic","myth","nadir","nail","naked","name","namely","nape","napkin","naples","narrow","nasal","nasty","nathan","nation","native","nature","nausea","naval","nave","navy","near","nearer","nearly","neat","neatly","neck","need","needle","needy","negate","neon","nepal","nephew","nerve","nest","net","neural","never","newly","next","nice","nicely","niche","nickel","niece","night","nile","nimble","nine","ninety","ninth","nobel","noble","nobody","node","noise","noisy","none","noon","nor","norm","normal","north","norway","nose","nosy","not","note","notice","notify","notion","noun","novel","novice","now","nozzle","null","numb","number","nurse","nut","nylon","nymph","oak","oar","oasis","oath","obese","obey","object","oblige","oboe","obtain","obtuse","occult","occupy","occur","ocean","octave","odd","off","offend","offer","office","offset","often","ohio","oil","oily","okay","old","older","oldest","olive","omega","omen","omit","once","one","onion","only","onset","onto","onus","onward","opaque","open","openly","opera","opium","oppose","optic","option","oracle","oral","orange","orbit","orchid","ordeal","order","organ","orgasm","orient","origin","ornate","orphan","oscar","other","otter","ought","ounce","our","out","outer","output","outset","oval","oven","over","overt","owe","owing","owl","own","owner","oxford","oxide","oxygen","oyster","ozone","pace","pack","packet","pact","pad","paddle","paddy","pagan","page","paid","pain","paint","pair","palace","pale","palm","pan","panama","panel","panic","papa","papal","paper","parade","parcel","pardon","parent","paris","parish","park","parody","parrot","part","partly","party","pascal","pass","past","paste","pastel","pastor","pastry","pat","patch","patent","path","patio","patrol","patron","paul","pause","pave","paw","pawn","pay","peace","peach","peak","pear","pearl","pedal","peel","peer","peking","pelvic","pelvis","pen","penal","pence","pencil","penny","people","pepper","per","perch","peril","period","perish","permit","person","peru","pest","pet","peter","petite","petrol","petty","phase","philip","phone","photo","phrase","piano","pick","picket","picnic","pie","piece","pier","pierce","piety","pig","pigeon","piggy","pike","pile","pill","pillar","pillow","pilot","pin","pinch","pine","pink","pint","pious","pipe","pirate","piss","pistol","piston","pit","pitch","pity","pivot","pixel","pizza","place","placid","plague","plain","plan","plane","planet","plank","plant","plasma","plate","play","player","plea","plead","please","pledge","plenty","plight","plot","plough","ploy","plug","plum","plump","plunge","plural","plus","plush","pocket","poem","poet","poetic","poetry","point","poison","poland","polar","pole","police","policy","polish","polite","poll","pollen","polo","pond","ponder","pony","pool","poor","poorly","pop","poppy","pore","pork","port","portal","pose","posh","post","postal","pot","potato","potent","pouch","pound","pour","powder","power","praise","pray","prayer","preach","prefer","prefix","press","pretty","price","pride","priest","primal","prime","prince","print","prior","prism","prison","privy","prize","probe","profit","prompt","prone","proof","propel","proper","prose","proton","proud","prove","proven","proxy","prune","pry","psalm","pseudo","psyche","pub","public","puff","pull","pulp","pulpit","pulsar","pulse","pump","punch","punish","punk","pupil","puppet","puppy","pure","purely","purge","purify","purple","purse","pursue","push","pushy","put","putt","puzzle","quaint","quake","quarry","quart","quartz","quebec","queen","queer","query","quest","queue","quick","quid","quiet","quilt","quirk","quit","quite","quiver","quiz","quota","quote","rabbit","race","racial","racism","rack","racket","radar","radio","radish","radius","raffle","raft","rage","raid","rail","rain","rainy","raise","rake","rally","ramp","random","range","rank","ransom","rape","rapid","rare","rarely","rarity","rash","rat","rate","rather","ratify","ratio","rattle","rave","raven","raw","ray","razor","reach","react","read","reader","ready","real","really","realm","reap","rear","reason","rebel","recall","recent","recess","recipe","reckon","record","recoup","rector","red","redeem","redo","reduce","reed","reef","reek","refer","reform","refuge","refuse","regal","regard","regent","regime","region","regret","reign","reject","relate","relax","relay","relic","relief","relish","rely","remain","remark","remedy","remind","remit","remote","remove","renal","render","rent","rental","repair","repeal","repeat","repent","reply","report","rescue","resent","reside","resign","resin","resist","resort","rest","result","resume","retail","retain","retina","retire","return","reveal","review","revise","revive","revolt","reward","rex","rhine","rhino","rhyme","rhythm","ribbon","rice","rich","rick","rid","ride","rider","ridge","rife","rifle","rift","right","rigid","rile","rim","ring","rinse","riot","ripe","ripen","ripple","rise","risk","risky","rite","ritual","ritz","rival","river","road","roar","roast","rob","robe","robert","robin","robot","robust","rock","rocket","rocky","rod","rode","rodent","rogue","role","roll","roman","rome","roof","room","root","rope","rose","rosy","rot","rotate","rotor","rotten","rouge","rough","round","route","rover","row","royal","rub","rubber","rubble","ruby","rudder","rude","rug","rugby","ruin","rule","ruler","rumble","rump","run","rune","rung","runway","rural","rush","russia","rust","rustic","rusty","sack","sacred","sad","saddle","sadism","sadly","safari","safe","safely","safer","safety","saga","sage","sahara","said","sail","sailor","saint","sake","salad","salary","sale","saline","saliva","salmon","saloon","salt","salty","salute","sam","same","sample","sand","sandy","sane","sash","satin","satire","saturn","sauce","saucer","saudi","sauna","savage","save","saw","say","scale","scalp","scan","scant","scar","scarce","scare","scarf","scary","scene","scenic","scent","school","scold","scope","score","scorn","scotch","scott","scout","scrap","scrape","scream","screen","screw","script","scroll","scrub","scum","sea","seal","seam","seaman","search","season","seat","second","secret","sect","sector","secure","see","seed","seeing","seek","seem","seize","seldom","select","self","sell","seller","semi","senate","send","senile","senior","sense","sensor","sent","sentry","seoul","sequel","serene","serial","series","sermon","serum","serve","server","set","settle","seven","severe","sew","sewage","shabby","shade","shadow","shady","shaft","shaggy","shah","shake","shaky","shall","sham","shame","shape","share","shark","sharp","shawl","she","shear","sheen","sheep","sheer","sheet","shelf","shell","sherry","shield","shift","shine","shiny","ship","shire","shirk","shirt","shiver","shock","shoe","shook","shoot","shop","shore","short","shot","should","shout","show","shower","shrank","shrewd","shrill","shrimp","shrine","shrink","shrub","shrug","shut","shy","shyly","sick","side","siege","sigh","sight","sigma","sign","signal","silent","silk","silken","silky","sill","silly","silo","silver","simple","simply","since","sinful","sing","singer","single","sink","sir","sire","siren","sister","sit","site","sitter","six","sixth","sixty","size","sketch","skill","skin","skinny","skip","skirt","skull","sky","slab","slack","slain","slam","slang","slap","slat","slate","slave","sleek","sleep","sleepy","sleeve","slice","slick","slid","slide","slight","slim","slimy","sling","slip","slit","slogan","slope","sloppy","slot","slow","slowly","slug","slum","slump","smack","small","smart","smash","smear","smell","smelly","smelt","smile","smite","smoke","smoky","smooth","smug","snack","snail","snake","snap","snatch","sneak","snow","snowy","snug","soak","soap","sober","soccer","social","sock","socket","socks","soda","sodden","sodium","sofa","soft","soften","softly","soggy","soil","solar","sold","sole","solely","solemn","solid","solo","solve","some","son","sonar","sonata","song","sonic","sony","soon","sooner","soot","soothe","sordid","sore","sorrow","sorry","sort","soul","sound","soup","sour","source","soviet","sow","space","spade","spain","span","spare","spark","sparse","spasm","spat","spate","speak","spear","speech","speed","speedy","spell","spend","sphere","spice","spicy","spider","spiky","spill","spin","spinal","spine","spiral","spirit","spit","spite","splash","split","spoil","spoke","sponge","spoon","sport","spot","spouse","spray","spread","spree","spring","sprint","spur","squad","square","squash","squat","squid","stab","stable","stack","staff","stage","stain","stair","stairs","stake","stale","stall","stamp","stance","stand","staple","star","starch","stare","stark","start","starve","state","static","statue","status","stay","stead","steady","steak","steal","steam","steel","steep","steer","stem","stench","step","stereo","stern","stew","stick","sticky","stiff","stifle","stigma","still","sting","stint","stir","stitch","stock","stocky","stone","stony","stool","stop","store","storm","stormy","story","stout","stove","stow","strain","strait","strand","strap","strata","straw","stray","streak","stream","street","stress","strict","stride","strife","strike","string","strip","stripe","strive","stroke","stroll","strong","stud","studio","study","stuff","stuffy","stunt","stupid","sturdy","style","submit","subtle","subtly","suburb","such","sudden","sue","suez","suffer","sugar","suit","suite","suitor","sullen","sultan","sum","summer","summit","summon","sun","sunday","sunny","sunset","super","superb","supper","supple","supply","sure","surely","surf","surge","survey","suture","swamp","swan","swap","swarm","sway","swear","sweat","sweaty","sweden","sweep","sweet","swell","swift","swim","swine","swing","swirl","swiss","switch","sword","swore","sydney","symbol","synod","syntax","syria","syrup","system","table","tablet","taboo","tacit","tackle","tact","tactic","tail","tailor","taiwan","take","tale","talent","talk","tall","tally","tame","tampa","tan","tandem","tangle","tank","tap","tape","target","tariff","tarp","tart","tarzan","task","taste","tasty","tattoo","taurus","taut","tavern","tax","taxi","tea","teach","teak","team","tear","tease","tech","teeth","tell","temper","temple","tempo","tempt","ten","tenant","tend","tender","tendon","tennis","tenor","tense","tent","tenth","tenure","teresa","term","terror","terse","test","texas","text","thank","thaw","them","theme","thence","theory","there","these","thesis","they","thick","thief","thigh","thin","thing","think","third","thirst","thirty","this","thomas","thorn","those","though","thread","threat","three","thrill","thrive","throat","throne","throng","throw","thrust","thud","thug","thumb","thus","thyme","tibet","tick","ticket","tidal","tide","tidy","tie","tier","tiger","tight","tile","till","tilt","timber","time","timid","tin","tiny","tip","tire","tissue","title","toad","toast","today","toe","toilet","token","tokyo","told","toll","tom","tomato","tomb","tonal","tone","tongue","tonic","too","took","tool","tooth","top","topaz","topic","torch","torque","torso","tort","toss","total","touch","tough","tour","toward","towel","tower","town","toxic","toxin","toy","trace","track","tract","trade","tragic","trail","train","trait","tram","trance","trap","trauma","travel","tray","tread","treat","treaty","treble","tree","trek","tremor","trench","trend","trendy","trial","tribal","tribe","trick","tricky","tried","trifle","trim","trio","trip","triple","troop","trophy","trot","trough","trout","truce","truck","true","truly","trunk","trust","truth","try","tube","tumble","tuna","tundra","tune","tunic","tunnel","turban","turf","turk","turkey","turn","turtle","tutor","tweed","twelve","twenty","twice","twin","twist","two","tycoon","tying","type","tyrant","ugly","ulcer","ultra","umpire","unable","uncle","under","uneasy","unfair","unify","union","unique","unit","unite","unity","unlike","unrest","unruly","until","update","upheld","uphill","uphold","upon","upper","uproar","upset","upshot","uptake","upturn","upward","urban","urge","urgent","urging","urine","usable","usage","use","useful","user","usual","utmost","utter","vacant","vacuum","vague","vain","valet","valid","valley","value","valve","van","vanish","vanity","vary","vase","vast","vat","vault","vector","veil","vein","velvet","vendor","veneer","venice","venom","vent","venue","venus","verb","verbal","verge","verify","verity","verse","versus","very","vessel","vest","vet","veto","via","viable","vicar","vice","victim","victor","video","vienna","view","vigil","viking","vile","villa","vine","vinyl","viola","violet","violin","viral","virgo","virtue","virus","visa","vision","visit","visual","vital","vivid","vocal","vodka","vogue","voice","void","volley","volume","vote","vowel","voyage","vulgar","wade","wage","waist","wait","waiter","wake","walk","walker","wall","wallet","walnut","wander","want","war","warden","warm","warmth","warn","warp","warsaw","wary","was","wash","wasp","waste","watch","water","watery","wave","wax","way","weak","weaken","wealth","weapon","wear","weary","weave","wedge","wee","weed","week","weekly","weep","weigh","weight","weird","well","were","west","wet","whale","wharf","what","wheat","wheel","when","whence","where","which","whiff","while","whim","whip","whisky","white","who","whole","wholly","whom","whose","why","wicked","wide","widely","widen","wider","widow","width","wife","wig","wild","wildly","will","willow","wily","win","wind","window","windy","wine","wing","wink","winner","winter","wipe","wire","wisdom","wise","wish","wit","witch","with","within","witty","wizard","woke","wolf","wolves","woman","womb","won","wonder","wood","wooden","woods","woody","wool","word","work","worker","world","worm","worry","worse","worst","worth","worthy","would","wound","wrap","wrath","wreath","wreck","wring","wrist","writ","write","writer","wrong","xerox","yacht","yale","yard","yarn","yeah","year","yeard","yeast","yellow","yet","yield","yogurt","yolk","you","young","your","youth","zaire","zeal","zebra","zenith","zero","zeus","zigzag","zinc","zombie","zone"],bip39Words=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];async function digest$1(e){return new Uint8Array(await crypto.subtle.digest("SHA-256",e))}async function toSeed(e,t){const n=e.join(" "),r=`mnemonic${t}`.normalize("NFKD");return deriveKey(HashAlgorithm.Sha512,n,r,2048,64)}function legacy1(e,t){const n=convertRadix(e.map(e=>t.indexOf(e.toLowerCase())),t.length,256,33),r=n[n.length-1],o=new Uint8Array(n.length-1);for(let e=0;e<n.length-1;e+=1)o[e]=n[e]^r;return[o,r]}async function legacy2(e,t){const n=11*e.length,r=[];r.fill(!1,0,n);for(const[n,o]of e.entries()){const e=t.indexOf(o.toLowerCase());if(e<0)throw new Error(`Word not found in wordlist: ${o}`);for(let t=0;t<11;t+=1)r[11*n+t]=!!(e&1<<10-t)}const o=n/33,i=n-o,a=new Uint8Array(i/8);for(let e=0;e<a.length;e+=1)for(let t=0;t<8;t+=1)r[8*e+t]&&(a[e]|=1<<7-t);const s=bytesToBits(await digest$1(a));for(let e=0;e<o;e+=1)if(r[i+e]!==s[e])throw new Error("Checksum mismatch");return a}function crc8(e){let t=255;for(let n=0;n<e.length-1;n+=1){t^=e[n];for(let e=0;e<8;e+=1)t=t>>>1^(1&t?178:0)}return 255^t}function convertRadix(e,t,n,r){let o=new BigNumber$1(0);for(const n of e)o=o.times(t),o=o.plus(n);const i=new Uint8Array(r);for(let e=r-1;e>=0;e-=1){const t=o.dividedToIntegerBy(n),r=o.modulo(n);o=t,i[e]=r.toNumber()}return i}function bytesToBits(e){const t=[];t.fill(!1,0,8*e.length);for(let n=0;n<e.length;n+=1)for(let r=0;r<8;r+=1)t[8*n+r]=!!(e[n]&1<<7-r);return t}const ED25519_SEED_TEXT="ed25519 seed",ECDSA_SEED_TEXT="Bitcoin seed",HARDENED=2147483648,HEDERA_PATH=[44,3030,0,0],SLIP44_ECDSA_HEDERA_PATH=[44|HARDENED,3030|HARDENED,0|HARDENED,0],SLIP44_ECDSA_ETH_PATH=[44|HARDENED,60|HARDENED,0|HARDENED,0,0];let Mnemonic$1=class e{constructor({words:e}){this.words=e}static generate(){return e._generate(24)}static generate12(){return e._generate(12)}static async _generate(t){let n;if(12===t)n=16;else{if(24!==t)throw new Error(`unsupported phrase length ${t}, only 12 or 24 are supported`);n=32}const r=await bytesAsync(n),o=(bytesToBinary(Array.from(r))+await deriveChecksumBits(r)).match(/(.{1,11})/g),i=(null!=o?o:[]).map(e=>bip39Words[binaryToByte(e)]);return new e({words:i})}static fromWords(t){return new e({words:t})._validate()}toPrivateKey(e=""){return this.toEd25519PrivateKey(e)}async toEd25519PrivateKey(e="",t=HEDERA_PATH){let{keyData:n,chainCode:r}=await this._toKeyData(e,ED25519_SEED_TEXT);for(const e of t)({keyData:n,chainCode:r}=await derive(n,r,e));const o=nacl.sign.keyPair.fromSeed(n);if(null==CACHE$1.privateKeyConstructor)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyConstructor(new Ed25519PrivateKey(o,r))}async toStandardEd25519PrivateKey(t="",n){const r=await e.toSeed(this.words,t);let o=await PrivateKey$1.fromSeedED25519(r);n=null==n?0:n;for(const e of[44,3030,0,0,n])o=await o.derive(e);return o}async toEcdsaPrivateKey(e="",t=HEDERA_PATH){let{keyData:n,chainCode:r}=await this._toKeyData(e,ECDSA_SEED_TEXT);for(const e of t)({keyData:n,chainCode:r}=await derive$1(n,r,e));if(null==CACHE$1.privateKeyConstructor)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyConstructor(new EcdsaPrivateKey(fromBytes(n),r))}async toStandardECDSAsecp256k1PrivateKey(t="",n){const r=await e.toSeed(this.words,t);let o=await PrivateKey$1.fromSeedECDSAsecp256k1(r);n=null==n?0:n;for(const e of[toHardenedIndex(44),toHardenedIndex(3030),toHardenedIndex(0),0,n])o=await o.derive(e);return o}static async toSeed(e,t){return await toSeed(e,t)}async _toKeyData(e,t){const n=await toSeed(this.words,e),r=await hash(HashAlgorithm.Sha512,t,n);return{keyData:r.subarray(0,32),chainCode:r.subarray(32)}}static async fromString(t){return e.fromWords(t.split(/\s|,/))}async _validate(){if(22===this.words.length){const e=this.words.reduce((e,t,n)=>legacyWords.includes(t.toLowerCase())?e:[...e,n],[]);if(e.length>0)throw new BadMnemonicError(this,BadMnemonicReason.UnknownWords,e);const[t,n]=legacy1(this.words,legacyWords);if(n!==crc8(t))throw new BadMnemonicError(this,BadMnemonicReason.ChecksumMismatch,[])}else{if(12!==this.words.length&&24!==this.words.length)throw new BadMnemonicError(this,BadMnemonicReason.BadLength,[]);const e=this.words.reduce((e,t,n)=>bip39Words.includes(t)?e:[...e,n],[]);if(e.length>0)throw new BadMnemonicError(this,BadMnemonicReason.UnknownWords,e);const t=this.words.map(e=>bip39Words.indexOf(e).toString(2).padStart(11,"0")).join(""),n=32*Math.floor(t.length/33),r=t.slice(0,n),o=t.slice(n),i=r.match(/(.{1,8})/g).map(binaryToByte);if(await deriveChecksumBits(Uint8Array.from(i))!==o)throw new BadMnemonicError(this,BadMnemonicReason.ChecksumMismatch,[])}return this}async toLegacyPrivateKey(){let e;if(22===this.words.length?[e]=legacy1(this.words,legacyWords):e=await legacy2(this.words,bip39Words),null==CACHE$1.privateKeyFromBytes)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyFromBytes(e)}toString(){return this.words.join(" ")}};function binaryToByte(e){return parseInt(e,2)}function bytesToBinary(e){return e.map(e=>e.toString(2).padStart(8,"0")).join("")}async function deriveChecksumBits(e){const t=8*e.length/32,n=await digest$1(e);return bytesToBinary(Array.from(n)).slice(0,t)}function arrayEqual(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=new DataView(t.buffer,t.byteOffset,t.byteLength);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}class Cache{constructor(){this._timeDrift=0,this._contractId=null,this._keyList=null,this._thresholdKey=null,this._publicKeyED25519=null,this._publicKeyECDSA=null,this._privateKeyConstructor=null,this._mnemonicFromString=null,this._accountIdConstructor=null,this._delegateContractId=null,this._evmAddress=null,this._ethereumTransactionDataLegacyFromBytes=null,this._ethereumTransactionDataEip1559FromBytes=null,this._ethereumTransactionDataEip2930FromBytes=null,this._transactionReceiptQueryConstructor=null,this._transactionRecordQueryConstructor=null}setTimeDrift(e){this._timeDrift=e}get timeDrift(){if(null==this._timeDrift)throw new Error("Cache.timeDrift was used before it was set");return this._timeDrift}setContractId(e){this._contractId=e}get contractId(){if(null==this._contractId)throw new Error("Cache.contractId was used before it was set");return this._contractId}setKeyList(e){this._keyList=e}get keyList(){if(null==this._keyList)throw new Error("Cache.keyList was used before it was set");return this._keyList}setThresholdKey(e){this._thresholdKey=e}get thresholdKey(){if(null==this._thresholdKey)throw new Error("Cache.thresholdKey was used before it was set");return this._thresholdKey}setPublicKeyED25519(e){this._publicKeyED25519=e}get publicKeyED25519(){if(null==this._publicKeyED25519)throw new Error("Cache.publicKeyED25519 was used before it was set");return this._publicKeyED25519}setPublicKeyECDSA(e){this._publicKeyECDSA=e}get publicKeyECDSA(){if(null==this._publicKeyECDSA)throw new Error("Cache.publicKeyECDSA was used before it was set");return this._publicKeyECDSA}setPrivateKeyConstructor(e){this._privateKeyConstructor=e}get privateKeyConstructor(){if(null==this._privateKeyConstructor)throw new Error("Cache.privateKeyConstructor was used before it was set");return this._privateKeyConstructor}setMnemonicFromString(e){this._mnemonicFromString=e}get mnemonicFromString(){if(null==this._mnemonicFromString)throw new Error("Cache.mnemonicFromString was used before it was set");return this.mnemonicFromString}setAccountIdConstructor(e){this._accountIdConstructor=e}get accountIdConstructor(){if(null==this._accountIdConstructor)throw new Error("Cache.accountIdConstructor was used before it was set");return this._accountIdConstructor}setDelegateContractId(e){this._delegateContractId=e}get delegateContractId(){if(null==this._delegateContractId)throw new Error("Cache.delegateContractId was used before it was set");return this._delegateContractId}setEvmAddress(e){this._evmAddress=e}get evmAddress(){if(null==this._evmAddress)throw new Error("Cache.evmAddress was used before it was set");return this._evmAddress}setEthereumTransactionDataLegacyFromBytes(e){this._ethereumTransactionDataLegacyFromBytes=e}get ethereumTransactionDataLegacyFromBytes(){if(null==this._ethereumTransactionDataLegacyFromBytes)throw new Error("Cache.ethereumTransactionDataLegacyFromBytes was used before it was set");return this._ethereumTransactionDataLegacyFromBytes}setEthereumTransactionDataEip1559FromBytes(e){this._ethereumTransactionDataEip1559FromBytes=e}get ethereumTransactionDataEip1559FromBytes(){if(null==this._ethereumTransactionDataEip1559FromBytes)throw new Error("Cache.ethereumTransactionDataEip1559FromBytes was used before it was set");return this._ethereumTransactionDataEip1559FromBytes}setEthereumTransactionDataEip2930FromBytes(e){this._ethereumTransactionDataEip2930FromBytes=e}get ethereumTransactionDataEip2930FromBytes(){if(null==this._ethereumTransactionDataEip2930FromBytes)throw new Error("Cache.ethereumTransactionDataEip2930FromBytes was used before it was set");return this._ethereumTransactionDataEip2930FromBytes}setTransactionReceiptQueryConstructor(e){this._transactionReceiptQueryConstructor=e}get transactionReceiptQueryConstructor(){if(null==this._transactionReceiptQueryConstructor)throw new Error("Cache.transactionReceiptQueryConstructor was used before it was set");return this._transactionReceiptQueryConstructor}setTransactionRecordQueryConstructor(e){this._transactionRecordQueryConstructor=e}get transactionRecordQueryConstructor(){if(null==this._transactionRecordQueryConstructor)throw new Error("Cache.transactionRecordQueryConstructor was used before it was set");return this._transactionRecordQueryConstructor}}const CACHE=new Cache;class Key{_toProtobufKey(){throw new Error("not implemented")}static _fromProtobufKey(e){return null!=e.contractID?CACHE.contractId(e.contractID):null!=e.delegatableContractId?CACHE.delegateContractId(e.delegatableContractId):null!=e.ed25519&&e.ed25519.byteLength>0?CACHE.publicKeyED25519(e.ed25519):null!=e.ECDSASecp256k1&&e.ECDSASecp256k1.byteLength>0?CACHE.publicKeyECDSA(e.ECDSASecp256k1):null!=e.thresholdKey&&null!=e.thresholdKey.threshold?CACHE.thresholdKey(e.thresholdKey):null!=e.keyList?CACHE.keyList(e.keyList):null}}class PublicKey extends Key{constructor(e){super(),this._key=e}static fromBytes(e){return new PublicKey(PublicKey$1.fromBytes(e))}static fromBytesED25519(e){return new PublicKey(PublicKey$1.fromBytesED25519(e))}static fromBytesECDSA(e){return new PublicKey(PublicKey$1.fromBytesECDSA(e))}static fromString(e){return new PublicKey(PublicKey$1.fromString(e))}static fromStringECDSA(e){return new PublicKey(PublicKey$1.fromStringECDSA(e))}static fromStringED25519(e){return new PublicKey(PublicKey$1.fromStringED25519(e))}verify(e,t){return this._key.verify(e,t)}verifyTransaction(e){e._requireFrozen(),e.isFrozen()||e.freeze();for(const t of e._signedTransactions.list)if(null!=t.sigMap&&null!=t.sigMap.sigPair){let e=!1;for(const n of t.sigMap.sigPair){if(arrayEqual(n.pubKeyPrefix,this.toBytesRaw())){e=!0;const r=t.bodyBytes;let o=null;if(null!=n.ed25519?o=n.ed25519:null!=n.ECDSASecp256k1&&(o=n.ECDSASecp256k1),null==o)continue;if(!this.verify(r,o))return!1}}if(!e)return!1}return!0}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toEthereumAddress(){return this._key.toEthereumAddress()}toEvmAddress(){return this._key.toEthereumAddress()}toString(){return this._key.toString()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}equals(e){return this._key.equals(e._key)}_toProtobufKey(){switch(this._key._type){case"ED25519":return{ed25519:this._key.toBytesRaw()};case"secp256k1":return{ECDSASecp256k1:this._key.toBytesRaw()};default:throw new Error(`unrecognized key type ${this._key._type}`)}}_toProtobufSignature(e){switch(this._key._type){case"ED25519":return{pubKeyPrefix:this._key.toBytesRaw(),ed25519:e};case"secp256k1":return{pubKeyPrefix:this._key.toBytesRaw(),ECDSASecp256k1:e};default:throw new Error(`unrecognized key type ${this._key._type}`)}}get type(){return this._key._type}toAccountId(e,t){return CACHE.accountIdConstructor(e,t,this)}static unusableKey(){return PublicKey.fromStringED25519("0000000000000000000000000000000000000000000000000000000000000000")}}CACHE.setPublicKeyED25519(e=>PublicKey.fromBytesED25519(e)),CACHE.setPublicKeyECDSA(e=>PublicKey.fromBytesECDSA(e));const version$6="logger/5.8.0";let _permanentCensorErrors=!1,_censorErrors=!1;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels.default,_globalLogger=null;function _checkNormalize(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}const _normalizeError=_checkNormalize();var LogLevel$1,ErrorCode;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(LogLevel$1||(LogLevel$1={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";let Logger$1=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==LogLevels[n]&&this.throwArgumentError("invalid log level name","logLevel",e),_logLevel>LogLevels[n]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,n,r){if(_censorErrors)return this.makeError("censored error",n,{});n||(n=e.errors.UNKNOWN_ERROR),r||(r={});const o=[];Object.keys(r).forEach(e=>{const t=r[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=HEX[t[e]>>4],n+=HEX[15&t[e]];o.push(e+"=Uint8Array(0x"+n+")")}else o.push(e+"="+JSON.stringify(t))}catch(t){o.push(e+"="+JSON.stringify(r[e].toString()))}}),o.push(`code=${n}`),o.push(`version=${this.version}`);const i=t;let a="";switch(n){case ErrorCode.NUMERIC_FAULT:{a="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":a+="-"+e;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break}case ErrorCode.CALL_EXCEPTION:case ErrorCode.INSUFFICIENT_FUNDS:case ErrorCode.MISSING_NEW:case ErrorCode.NONCE_EXPIRED:case ErrorCode.REPLACEMENT_UNDERPRICED:case ErrorCode.TRANSACTION_REPLACED:case ErrorCode.UNPREDICTABLE_GAS_LIMIT:a=n}a&&(t+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),o.length&&(t+=" ("+o.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=n,Object.keys(r).forEach(function(e){s[e]=r[e]}),s}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(t,n,r){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:n,value:r})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(t){_normalizeError&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}checkSafeUint53(t,n){"number"==typeof t&&(null==n&&(n="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,n,r){r=r?": "+r:"",t<n&&this.throwError("missing argument"+r,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:n}),t>n&&this.throwError("too many arguments"+r,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:n})}checkNew(t,n){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}checkAbstract(t,n){t===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}static globalLogger(){return _globalLogger||(_globalLogger=new e(version$6)),_globalLogger}static setCensorship(t,n){if(!t&&n&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_permanentCensorErrors){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!t,_permanentCensorErrors=!!n}static setLogLevel(t){const n=LogLevels[t.toLowerCase()];null!=n?_logLevel=n:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Logger$1.errors=ErrorCode,Logger$1.levels=LogLevel$1;const version$5="bytes/5.8.0",logger$8=new Logger$1(version$5);function isHexable(e){return!!e.toHexString}function addSlice(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function isBytesLike(e){return isHexString(e)&&!(e.length%2)||isBytes(e)}function isInteger(e){return"number"==typeof e&&e==e&&e%1==0}function isBytes(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!isInteger(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!isInteger(n)||n<0||n>=256)return!1}return!0}function arrayify(e,t){if(t||(t={}),"number"==typeof e){logger$8.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),addSlice(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),isHexable(e)&&(e=e.toHexString()),isHexString(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":logger$8.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return addSlice(new Uint8Array(r))}return isBytes(e)?addSlice(new Uint8Array(e)):logger$8.throwArgumentError("invalid arrayify value","value",e)}function concat(e){const t=e.map(e=>arrayify(e)),n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n);return t.reduce((e,t)=>(r.set(t,e),e+t.length),0),addSlice(r)}function isHexString(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const HexCharacters="0123456789abcdef";function hexlify(e,t){if(t||(t={}),"number"==typeof e){logger$8.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=HexCharacters[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),isHexable(e))return e.toHexString();if(isHexString(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":logger$8.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(isBytes(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=HexCharacters[(240&r)>>4]+HexCharacters[15&r]}return t}return logger$8.throwArgumentError("invalid hexlify value","value",e)}function hexConcat(e){let t="0x";return e.forEach(e=>{t+=hexlify(e).substring(2)}),t}function hexZeroPad(e,t){for("string"!=typeof e?e=hexlify(e):isHexString(e)||logger$8.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&logger$8.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}class EvmAddress extends Key{constructor(e){super(),this._bytes=e}static fromString(e){if(40!==(e=e.startsWith("0x")?e.slice(2):e).length)throw new Error("Input EVM address string is not the correct size");return new EvmAddress(decode$8(e))}static fromBytes(e){return new EvmAddress(e)}toBytes(){return this._bytes}toString(){return encode$5(this._bytes)}equals(e){return arrayEqual$2(this._bytes,e._bytes)}}const regex=/"^(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))(?:-([a-z]{5}))?$/,ENTITY_ID_REGEX=/^(\d+)(?:\.(\d+)\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/,EVM_ADDRESS_LENGTH=20,LONG_ZERO_PREFIX_LENGTH=12,ENTITY_NUM_OFFSET=16;function constructor(e,t,n){if(null==t&&null!=n||null!=t&&null==n)throw new Error("invalid entity ID");const[r,o,i]="number"==typeof e||Long.isLong(e)?[null!=n?Long.fromValue(e):Long.ZERO,null!=t?Long.fromValue(t):Long.ZERO,null!=n?Long.fromValue(n):Long.fromValue(e)]:[null!=e.shard?Long.fromValue(e.shard):Long.ZERO,null!=e.realm?Long.fromValue(e.realm):Long.ZERO,Long.fromValue(e.num)];if(r.isNegative()||o.isNegative()||i.isNegative())throw new Error("negative numbers are not allowed in IDs");return{shard:r,realm:o,num:i}}function compare(e,t){let n=e[0].compare(t[0]);return 0!=n?n:(n=e[1].compare(t[1]),0!=n?n:e[2].compare(t[2]))}function fromStringSplitter(e){const t=ENTITY_ID_REGEX.exec(e);if(null==t)throw new Error(`failed to parse entity id: ${e}`);return null==t[2]&&null==t[3]?{shard:"0",realm:"0",numOrHex:t[1],checksum:t[4]}:{shard:t[1],realm:t[2],numOrHex:t[3],checksum:t[4]}}function fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm)||Number.isNaN(t.numOrHex))throw new Error("invalid format for entity ID");return{shard:null!=t.shard?Long.fromString(t.shard):Long.ZERO,realm:null!=t.realm?Long.fromString(t.realm):Long.ZERO,num:Long.fromString(t.numOrHex),checksum:t.checksum}}function fromSolidityAddress(e){const t=e.startsWith("0x")?decode$8(e.slice(2)):decode$8(e);if(t.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${e.length}`);return[Long.fromBytesBE([0,0,0,0,...t.slice(0,4)]),Long.fromBytesBE(Array.from(t.slice(4,12))),Long.fromBytesBE(Array.from(t.slice(12,20)))]}function fromEvmAddress(e,t,n){if(!isHexString$1(n))throw new Error(`Invalid EVM address hex string: ${n}`);const r=n.startsWith("0x")?decode$8(n.slice(2)):decode$8(n);if(r.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded evm address length:\n expected length ${EVM_ADDRESS_LENGTH}, got length ${n.length}`);let o=Long.ZERO;return isLongZeroAddress(r)&&(o=Long.fromBytesBE(Array.from(r.slice(LONG_ZERO_PREFIX_LENGTH,EVM_ADDRESS_LENGTH)))),[e instanceof Long?e:Long.fromNumber(e),t instanceof Long?t:Long.fromNumber(t),o,o.isZero()?EvmAddress.fromBytes(r):null]}function toSolidityAddress(e){const t=new Uint8Array(20),n=safeView(t),[r,o,i]=e;return n.setUint32(0,convertToNumber(r)),n.setUint32(8,convertToNumber(o)),n.setUint32(16,convertToNumber(i)),encode$5(t)}function toEvmAddress(e){if(e instanceof Uint8Array)return encode$5(e);const t=e,n=new Uint8Array(EVM_ADDRESS_LENGTH);return safeView(n).setUint32(ENTITY_NUM_OFFSET,convertToNumber(t)),encode$5(n)}function _parseAddress(e,t){let n=regex.exec(t);if(null===n){return{status:0}}let r=[Long.fromString(n[1]),Long.fromString(n[2]),Long.fromString(n[3])],o=`${r[0].toString()}.${r[1].toString()}.${r[2].toString()}`,i=_checksum(e,o);return{status:void 0===n[4]?2:i==n[4]?3:1,num1:r[0],num2:r[1],num3:r[2],givenChecksum:n[4],correctChecksum:i,noChecksumFormat:o,withChecksumFormat:`${o}-${i}`}}function _checksum(e,t){let n="",r=[],o=0,i=0,a=0,s=0,c=0;const u=11881376,l="a".charCodeAt(0);let d=new Uint8Array(e.length+6);d.set(e,0),d.set([0,0,0,0,0,0],e.length);for(let e=0;e<t.length;e++)r.push("."===t[e]?10:parseInt(t[e],10));for(let e=0;e<r.length;e++)a=(31*a+r[e])%17576,e%2==0?o=(o+r[e])%11:i=(i+r[e])%11;for(let e=0;e<d.length;e++)s=(31*s+d[e])%u;c=(17576*(11*(t.length%5*11+o)+i)+a+s)%u,c=1000003*c%u;for(let e=0;e<5;e++)n=String.fromCharCode(l+c%26)+n,c/=26;return n}function validateChecksum(e,t,n,r,o){if(null==o._network._ledgerId||null==r)return;const i=_checksum(o._network._ledgerId._ledgerId,`${e.toString()}.${t.toString()}.${n.toString()}`);if(r!=i)throw new BadEntityIdError(e,t,n,r,i)}function toStringWithChecksum(e,t){if(null==t)throw new Error("client cannot be null");if(null==t._network._ledgerId)throw new Error("cannot calculate checksum with a client that does not contain a recognzied ledger ID");return`${e}-${_checksum(t._network._ledgerId._ledgerId,e)}`}function appendBuffer(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n}function toHexString(e){var t="0x";return e.forEach(function(e){t+=("0"+(255&e).toString(16)).slice(-2)}),t}function aliasToPublicKey(e){const t=base32.decode(e);if(!t)return null;let n;try{n=libExports.proto.Key.decode(t)}catch(e){throw new Error("The alias is created with hollow account. Please use aliasToEvmAddress!")}return null!=n.ed25519&&n.ed25519.byteLength>0?PublicKey.fromBytes(n.ed25519):null!=n.ECDSASecp256k1&&n.ECDSASecp256k1.byteLength>0?PublicKey.fromBytes(n.ECDSASecp256k1):null}function aliasToEvmAddress(e){const t=base32.decode(e);if(!t)return null;try{throw libExports.proto.Key.decode(t),new Error("The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!")}catch(e){return toHexString(t)}}function publicKeyToAlias(e){if("string"==typeof e&&(e.startsWith("0x")&&42==e.length||40==e.length)){e.startsWith("0x")||(e=`0x${e}`);const t=arrayify(e);return t?base32.encode(t):null}const t="string"==typeof e?PublicKey.fromString(e):e;let n=t.toStringRaw(),r="";"secp256k1"===t._key._type&&(r="0x3A21"),"ED25519"===t._key._type&&(r="0x1220"),n.startsWith("0x")||(n=`0x${n}`);const o=appendBuffer(arrayify(r),arrayify(n));return base32.encode(o)}var EntityIdHelper=Object.freeze({__proto__:null,_checksum:_checksum,_parseAddress:_parseAddress,aliasToEvmAddress:aliasToEvmAddress,aliasToPublicKey:aliasToPublicKey,compare:compare,constructor:constructor,fromEvmAddress:fromEvmAddress,fromSolidityAddress:fromSolidityAddress,fromString:fromString,fromStringSplitter:fromStringSplitter,publicKeyToAlias:publicKeyToAlias,toEvmAddress:toEvmAddress,toSolidityAddress:toSolidityAddress,toStringWithChecksum:toStringWithChecksum,validateChecksum:validateChecksum});const HARDENED_BIT=2147483648;class Mnemonic{constructor(e){this._mnemonic=e}static async generate(){return new Mnemonic(await Mnemonic$1._generate(24))}static async generate12(){return new Mnemonic(await Mnemonic$1._generate(12))}static async fromWords(e){return new Mnemonic(await Mnemonic$1.fromWords(e))}async toPrivateKey(e=""){return CACHE.privateKeyConstructor(await this._mnemonic.toPrivateKey(e))}async toEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEd25519PrivateKey(e,t))}async toStandardEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardEd25519PrivateKey(e,t))}async toEcdsaPrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEcdsaPrivateKey(e,t))}calculateDerivationPathValues(e){const t=/m\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)/.exec(e),n=new Array(5);if(t)for(let e=1;e<=5;e++){let r=t[e];r.endsWith("'")?(r=r.substring(0,r.length-1),n[e-1]=parseInt(r,10)|HARDENED_BIT):n[e-1]=parseInt(r,10)}return n}async toStandardECDSAsecp256k1PrivateKeyImpl(e,t){return await this.toEcdsaPrivateKey(e,t)}async toStandardECDSAsecp256k1PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardECDSAsecp256k1PrivateKey(e,t))}async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath(e="",t){const n=this.calculateDerivationPathValues(t);return await this.toStandardECDSAsecp256k1PrivateKeyImpl(e,n)}static async fromString(e){return new Mnemonic(await Mnemonic$1.fromString(e))}async toLegacyPrivateKey(){return CACHE.privateKeyConstructor(await this._mnemonic.toLegacyPrivateKey())}async toSeed(e){return await Mnemonic$1.toSeed(this._mnemonic.words,e)}toString(){return this._mnemonic.toString()}}class ObjectMap{constructor(e){this._map=new Map,this.__map=new Map,this._fromString=e}get(e){const t="string"==typeof e?e:e.toString(),n=this._map.get(t);return null!=n?n:null}_set(e,t){const n="string"==typeof e?e:e.toString();this._map.set(n,t),this.__map.set(e,t)}values(){return this._map.values()}get size(){return this._map.size}keys(){return this.__map.keys()}[Symbol.iterator](){return this.__map[Symbol.iterator]()}toString(){const e={};for(const[t,n]of this._map)e[t]=n;return JSON.stringify(e)}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t}),e}}function decode$2(e){const t=e.startsWith("0x")?e.substring(2):e;if(t.length%2!=0)throw new Error("Invalid hex string: Must have an even number of characters.");if(/[^0-9a-fA-F]/.test(t))throw new Error("Invalid hex string: Contains non-hexadecimal characters.");const n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const r=parseInt(t.substring(e,e+2),16);n[e/2]=r}return Buffer.from(t,"hex")}class AccountId{constructor(e,t,n,r,o){const i=constructor(e,t,n);this.shard=i.shard,this.realm=i.realm,this.num=i.num,this.aliasKey=null!=r?r:null,this.evmAddress=null!=o?o:null,this._checksum=null}static fromString(e){let t,n,r=Long.ZERO,o=Long.ZERO,i=Long.ZERO;if(e.startsWith("0x")&&42==e.length||40==e.length)n=EvmAddress.fromString(e);else{const a=fromStringSplitter(e);if(Number.isNaN(a.shard)||Number.isNaN(a.realm))throw new Error("invalid format for entity ID");null!=a.shard&&(r=Long.fromString(a.shard)),null!=a.realm&&(o=Long.fromString(a.realm)),a.numOrHex.length<20?i=Long.fromString(a.numOrHex):40==a.numOrHex.length?n=EvmAddress.fromString(a.numOrHex):t=PublicKey.fromString(a.numOrHex)}return new AccountId(r,o,i,t,n)}static fromEvmAddress(e,t,n){const r="string"==typeof n?EvmAddress.fromString(n):n,[o,i,a,s]=fromEvmAddress(e,t,r.toString());return new AccountId(o,i,a,void 0,s||void 0)}static fromEvmPublicAddress(e){return new AccountId(0,0,0,void 0,e)}static _fromProtobuf(e){let t,n;return null!=e.alias&&(20===e.alias.length?n=EvmAddress.fromBytes(e.alias):t=Key._fromProtobufKey(libExports.proto.Key.decode(e.alias))),t instanceof PublicKey||(t=void 0),new AccountId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.accountNum?e.accountNum:0,t,n)}get checksum(){return this._checksum}getEvmAddress(){return this.evmAddress}async populateAccountNum(e){if(null===this.evmAddress)throw new Error("field `evmAddress` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.evmAddress.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).account;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}async populateAccountEvmAddress(e){if(null===this.num)throw new Error("field `num` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.num.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).evm_address;return this.evmAddress=EvmAddress.fromString(r),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return AccountId._fromProtobuf(libExports.proto.AccountID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$2(e))?new AccountId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?this.evmAddress.toString():null!=this.aliasKey&&"secp256k1"==this.aliasKey._key._type?this.aliasKey.toEvmAddress():toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress.toBytes()):toEvmAddress(this.num)}_toProtobuf(){let e=null;null!=this.aliasKey?e=libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null!=this.evmAddress&&(e=this.evmAddress._bytes);const t=this.num.eq(Long.fromBigInt(0n))&&e;return e?{alias:t?e:null,accountNum:t?null:this.num,shardNum:this.shard,realmNum:this.realm}:{alias:null,accountNum:this.num,shardNum:this.shard,realmNum:this.realm}}toBytes(){return libExports.proto.AccountID.encode(this._toProtobuf()).finish()}toString(){let e=this.num.toString();return null!=this.aliasKey?e=this.aliasKey.toString():null!=this.evmAddress&&(e=this.evmAddress.toString()),`${this.shard.toString()}.${this.realm.toString()}.${e}`}toStringWithChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");return toStringWithChecksum(this.toString(),e)}equals(e){let t=!1;return null!=this.aliasKey&&null!=e.aliasKey?t=this.aliasKey.equals(e.aliasKey):null!=this.evmAddress&&null!=e.evmAddress?t=this.evmAddress.equals(e.evmAddress):null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress&&(t=this.num.eq(e.num)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&t}clone(){const e=new AccountId(this);return e._checksum=this._checksum,e.aliasKey=this.aliasKey,e.evmAddress=this.evmAddress,e}compare(e){let t=this.shard.compare(e.shard);if(0!=t)return t;if(t=this.realm.compare(e.realm),0!=t)return t;if(null!=this.aliasKey&&null!=e.aliasKey){const t=this.aliasKey.toString(),n=e.aliasKey.toString();return t>n?1:t<n?-1:0}if(null!=this.evmAddress&&null!=e.evmAddress){const t=this.evmAddress.toString(),n=e.evmAddress.toString();return t>n?1:t<n?-1:0}return null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress?this.num.compare(e.num):1}}CACHE.setAccountIdConstructor((e,t,n)=>new AccountId(e,t,Long.ZERO,n));const MAX_NS=Long.fromNumber(1e9),generatedIds=new Set;class Timestamp{constructor(e,t){this.seconds=e instanceof Long?e:Long.fromNumber(e),this.nanos=t instanceof Long?t:Long.fromNumber(t),Object.freeze(this)}static generate(e=!0){let t;t=e?Math.floor(5e3*Math.random())+3e3:0;const n=Date.now()-t,r=Math.floor(n/1e3)+CACHE.timeDrift,o=1e6*Math.floor(n%1e3)+Math.floor(1e6*Math.random()),i=new Timestamp(r,o);return generatedIds.has(i.toString())?this.generate():(generatedIds.add(i.toString()),i)}static fromDate(e){let t;if("number"==typeof e)t=Long.fromNumber(e);else if("string"==typeof e)t=Long.fromNumber(Date.parse(e)).mul(1e6);else{if(!(e instanceof Date))throw new TypeError(`invalid type '${typeof e}' for 'data', expected 'Date'`);t=Long.fromNumber(e.getTime()).mul(1e6)}return new Timestamp(0,0).plusNanos(t)}toDate(){return new Date(1e3*this.seconds.toInt()+Math.floor(this.nanos.toInt()/1e6))}plusNanos(e){const t=this.nanos.add(e);return new Timestamp(this.seconds.add(t.div(MAX_NS)),t.mod(MAX_NS))}_toProtobuf(){return{seconds:this.seconds,nanos:this.nanos.toInt()}}static _fromProtobuf(e){return new Timestamp(e.seconds instanceof Long?e.seconds.toInt():null!=e.seconds?e.seconds:0,null!=e.nanos?e.nanos:0)}toString(){const e=String(this.nanos).padStart(9,"0");return`${this.seconds.toString()}.${e}`}compare(e){const t=this.seconds.compare(e.seconds);return 0!=t?t:this.nanos.compare(e.nanos)}}class TransactionId{constructor(e,t,n=!1,r=null){this.accountId=e,this.validStart=t,this.scheduled=n,this.nonce=null,null!=r&&0!=r&&this.setNonce(r),Object.seal(this)}setNonce(e){return this.nonce="number"==typeof e?Long.fromNumber(e):e,this}static withValidStart(e,t){return new TransactionId(e,t)}static generate(e){return new TransactionId("string"==typeof e?AccountId.fromString(e):new AccountId(e),Timestamp.generate())}static fromString(e){let t,n,r,o,i,a;return[t,a]=e.split("@"),[n,a]=a.split("."),a.includes("?")?([r,a]=a.split("?scheduled"),o=!0,i=a.includes("/")?a.replace("/",""):null):a.includes("/")?([r,i]=a.split("/"),o=!1):r=a,new TransactionId(AccountId.fromString(t),new Timestamp(Long.fromValue(n),Long.fromValue(r)),o,null!=i?Long.fromString(i):null)}setScheduled(e){return this.scheduled=e,this}toString(){if(null!=this.accountId&&null!=this.validStart){const e=String(this.validStart.nanos).padStart(9,"0"),t=null!=this.nonce?"/".concat(this.nonce.toString()):"",n=this.scheduled?"?scheduled":"";return`${this.accountId.toString()}@${this.validStart.seconds.toString()}.${e}${n}${t}`}throw new Error("neither `accountId` nor `validStart` are set")}static _fromProtobuf(e){if(null!=e.accountID&&null!=e.transactionValidStart)return new TransactionId(AccountId._fromProtobuf(e.accountID),Timestamp._fromProtobuf(e.transactionValidStart),null!=e.scheduled?e.scheduled:void 0,null!=e.nonce?e.nonce:void 0);throw new Error("Neither `nonce` or `accountID` and `transactionValidStart` are set")}_toProtobuf(){return{accountID:null!=this.accountId?this.accountId._toProtobuf():null,transactionValidStart:null!=this.validStart?this.validStart._toProtobuf():null,scheduled:this.scheduled,nonce:null!=this.nonce?this.nonce.toInt():null}}static fromBytes(e){return TransactionId._fromProtobuf(libExports.proto.TransactionID.decode(e))}toBytes(){return libExports.proto.TransactionID.encode(this._toProtobuf()).finish()}clone(){return new TransactionId(this.accountId,this.validStart,this.scheduled,this.nonce)}compare(e){const t=this.accountId.compare(e.accountId);return 0!=t?t:this.validStart.compare(e.validStart)}getReceipt(e){return CACHE.transactionReceiptQueryConstructor().setTransactionId(this).execute(e)}async getRecord(e){return await this.getReceipt(e),CACHE.transactionRecordQueryConstructor().setTransactionId(this).execute(e)}}class SignaturePairMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new SignaturePairMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}addSignature(e,t){return this._set(e,t),this}}let NodeAccountIdSignatureMap$1=class e extends ObjectMap{constructor(){super(e=>TransactionId.fromString(e))}static _fromSignedTransactions(t){const n=new e;for(const{bodyBytes:e,sigMap:r}of t.list)if(null!=e&&null!=r){const t=libExports.proto.TransactionBody.decode(e);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);n._set(e,SignaturePairMap._fromTransactionSigMap(r))}}return n}addSignature(e,t,n){const r=this.get(e);r?r.addSignature(t,n):this._set(e,(new SignaturePairMap).addSignature(t,n))}};class List{constructor(){this.list=[],this.locked=!1,this.index=0}setList(e){if(this.locked)throw new Error("list is locked");return this.list=e,this.index=0,this}push(...e){if(this.locked)throw new Error("list is locked");return this.list.push(...e),this}setLocked(){return this.locked=!0,this}clear(){this.list=[],this.index=0,this.locked=!1}get(e){return this.list[e]}set(e,t){return e===this.length?this.list.push(t):this.list[e]=t,this}setIfAbsent(e,t){return e!=this.length&&null!=this.list[e]||this.set(e,t()),this}get next(){return this.get(this.advance())}get current(){return this.get(this.index)}advance(){const e=this.index;return this.index=(this.index+1)%this.list.length,e}get isEmpty(){return 0===this.length}get length(){return this.list.length}clone(){const e=new List;return e.list=this.list,e.locked=this.locked,e}}let SignatureMap$1=class e extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(t){const n=new e,r=t._nodeAccountIds.length,o=t._signedTransactions.length/r;for(let e=0;e<r;e++){const i=new List;for(let n=0;n<o;n++)i.push(t._signedTransactions.get(n*r+e));n._set(t._nodeAccountIds.list[e],NodeAccountIdSignatureMap$1._fromSignedTransactions(i))}return n}addSignature(e,t,n,r){let o=this.get(e);return o||(o=new NodeAccountIdSignatureMap$1,this._set(e,o)),o.addSignature(t,n,r),this._set(e,o),this}getFlatSignatureList(){const e=[];for(const t of this.values())for(const n of t.values())e.push(n);return e}};class ASN1Decoder{constructor(e){this.data=new Uint8Array(e),this.pos=0,this.oids=[],this.oidMap={"1.3.132.0.10":"ecdsa","1.3.101.112":"ed25519","1.2.840.10045.2.1":"pubkey"},this.isPublicKey=!1}readLength(){let e=this.data[this.pos++];if(128&e){let t=127&e;e=0;for(let n=0;n<t;n++)e=e<<8|this.data[this.pos++]}return e}readType(){return this.data[this.pos++]}readInteger(){const e=this.readLength();let t=0;for(let n=0;n<e;n++)t=t<<8|this.data[this.pos++];return{integer:t}}readOctetString(){const e=this.readLength(),t=this.data.slice(this.pos,this.pos+e);return this.pos+=e,{pkey:t}}readBitString(){const e=this.readLength(),t=this.data[this.pos++],n=this.data.slice(this.pos,this.pos+e-1);return this.pos+=e-1,{unusedBits:t,pubkey:n}}readObjectIdentifier(){const e=this.readLength(),t=this.pos+e,n=[];let r=0;const o=this.data[this.pos++];for(n.push(Math.floor(o/40)),n.push(o%40);this.pos<t;){const e=this.data[this.pos++];r=r<<7|127&e,128&e||(n.push(r),r=0)}const i=n.join(".");return this.oids.push(i),{oid:i}}getOids(){return this.oids}getOidKeyTypes(){return this.oids.map(e=>this.oidMap[e]||"unknown")}readSequence(){const e=this.readLength(),t=this.pos+e,n=[];for(;this.pos<t;)n.push(this.read());return n}read(){const e=this.readType();switch(e){case 2:return this.readInteger();case 3:return this.readBitString();case 4:return this.readOctetString();case 6:return this.readObjectIdentifier();case 48:case 160:case 161:return this.readSequence();default:throw new Error(`Unsupported type: ${e}`)}}isPublicKeyType(){return this.isPublicKey}}class PrivateKey extends Key{constructor(e){super(),this._key=e}static generateED25519(){return new PrivateKey(PrivateKey$1.generateED25519())}static generateECDSA(){return new PrivateKey(PrivateKey$1.generateECDSA())}static generate(){return PrivateKey.generateED25519()}static async generateAsync(){return new PrivateKey(await PrivateKey$1.generateAsync())}static async generateED25519Async(){return new PrivateKey(await PrivateKey$1.generateED25519Async())}static async generateECDSAAsync(){return new PrivateKey(await PrivateKey$1.generateECDSAAsync())}static fromBytes(e){const t=hexlify(e);return PrivateKey.isDerKey(t)?"ecdsa"===PrivateKey.getAlgorithm(t)?new PrivateKey(PrivateKey$1.fromBytesECDSA(e)):new PrivateKey(PrivateKey$1.fromBytesED25519(e)):new PrivateKey(PrivateKey$1.fromBytes(e))}static fromBytesECDSA(e){return new PrivateKey(PrivateKey$1.fromBytesECDSA(e))}static fromBytesED25519(e){return new PrivateKey(PrivateKey$1.fromBytesED25519(e))}static fromString(e){return PrivateKey.isDerKey(e)?this.fromStringDer(e):new PrivateKey(PrivateKey$1.fromString(e))}static fromStringDer(e){return PrivateKey.isDerKey(e)?"ecdsa"===PrivateKey.getAlgorithm(e)?this.fromStringECDSA(e):this.fromStringED25519(e):PrivateKey.fromString(e)}static fromStringECDSA(e){return new PrivateKey(PrivateKey$1.fromStringECDSA(e))}static fromStringED25519(e){return new PrivateKey(PrivateKey$1.fromStringED25519(e))}static async fromSeedED25519(e){return new PrivateKey(await PrivateKey$1.fromSeedED25519(e))}static async fromSeedECDSAsecp256k1(e){return new PrivateKey(await PrivateKey$1.fromSeedECDSAsecp256k1(e))}static async fromMnemonic(e,t=""){return new PrivateKey(e instanceof Mnemonic?await PrivateKey$1.fromMnemonic(e._mnemonic,t):await PrivateKey$1.fromMnemonic(e,t))}static async fromKeystore(e,t=""){return new PrivateKey(await PrivateKey$1.fromKeystore(e,t))}static async fromPem(e,t=""){return new PrivateKey(await PrivateKey$1.fromPem(e,t))}async derive(e){return new PrivateKey(await this._key.derive(e))}async legacyDerive(e){return new PrivateKey(await this._key.legacyDerive(e))}get publicKey(){return new PublicKey(this._key.publicKey)}get chainCode(){return this._key._chainCode}sign(e){return this._key.sign(e)}signTransaction(e,t=!1){if(t)return this._signTransactionLegacy(e);const n=new SignatureMap$1;for(const t of e._signedTransactions.list){const e=t.bodyBytes;if(!e)throw new Error("Body bytes are missing");const r=libExports.proto.TransactionBody.decode(e);if(!r.transactionID||!r.nodeAccountID)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const o=AccountId._fromProtobuf(r.nodeAccountID),i=TransactionId._fromProtobuf(r.transactionID),a=this._key.sign(e);n.addSignature(o,i,this.publicKey,a)}return e.addSignature(this.publicKey,n),n}_signTransactionLegacy(e){const t=e._signedTransactions.list.map(e=>{const t=e.bodyBytes;return t?this._key.sign(t):new Uint8Array});return e.addSignature(this.publicKey,t),1===t.length?t[0]:t}isDerivable(){return this._key.isDerivable()}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this._key.toStringDer()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}toKeystore(e=""){return this._key.toKeystore(e)}_toProtobufKey(){return this.publicKey._toProtobufKey()}toAccountId(e,t){return this.publicKey.toAccountId(e,t)}get type(){return this._key._type}getRecoveryId(e,t,n){return this._key.getRecoveryId(e,t,n)}static getAlgorithm(e){if(!PrivateKey.isDerKey(e))throw new Error("Only der keys are supported");const t=new ASN1Decoder(Uint8Array.from(decode$8(e)));t.read();return t.getOidKeyTypes()[0]}static isDerKey(e){try{const t=Uint8Array.from(decode$8(e));return new ASN1Decoder(t).read(),!0}catch(e){return!1}}}CACHE.setPrivateKeyConstructor(e=>new PrivateKey(e));class KeyList extends Key{constructor(e,t){super(),this._keys=null==e?[]:e instanceof Key?[e]:e,this._threshold=null==t?null:t}static of(...e){return new KeyList(e,null)}static from(e,t,n){return new KeyList(null==t?Array.from(e):Array.from(e,t,n))}get threshold(){return this._threshold}setThreshold(e){return this._threshold=e,this}push(...e){return this._keys.push(...e)}splice(e,t,...n){return new KeyList(this._keys.splice(e,t,...n),this.threshold)}slice(e,t){return new KeyList(this._keys.slice(e,t),this.threshold)}[Symbol.iterator](){return this._keys[Symbol.iterator]()}toArray(){return this._keys.slice()}toString(){return JSON.stringify({threshold:this._threshold,keys:this._keys.toString()})}_toProtobufKey(){const e=this._keys.map(e=>e._toProtobufKey());return null==this.threshold?{keyList:{keys:e}}:{thresholdKey:{threshold:this.threshold,keys:{keys:e}}}}static __fromProtobufKeyList(e){const t=(null!=e.keys?e.keys:[]).map(e=>Key._fromProtobufKey(e));return new KeyList(t)}static __fromProtobufThresoldKey(e){const t=KeyList.__fromProtobufKeyList(null!=e.keys?e.keys:{});return t.setThreshold(null!=e.threshold?e.threshold:0),t}}function valueToLong(e){return BigNumber$1.isBigNumber(e)?e:new BigNumber$1(e.toString())}CACHE.setKeyList(e=>KeyList.__fromProtobufKeyList(e)),CACHE.setThresholdKey(e=>KeyList.__fromProtobufThresoldKey(e));class HbarUnit{constructor(e,t,n){this._name=e,this._symbol=t,this._tinybar=n,Object.freeze(this)}static fromString(e){switch(e){case HbarUnit.Hbar._symbol:return HbarUnit.Hbar;case HbarUnit.Tinybar._symbol:return HbarUnit.Tinybar;case HbarUnit.Microbar._symbol:return HbarUnit.Microbar;case HbarUnit.Millibar._symbol:return HbarUnit.Millibar;case HbarUnit.Kilobar._symbol:return HbarUnit.Kilobar;case HbarUnit.Megabar._symbol:return HbarUnit.Megabar;case HbarUnit.Gigabar._symbol:return HbarUnit.Gigabar;default:throw new Error("Unknown unit.")}}}HbarUnit.Tinybar=new HbarUnit("tinybar","tℏ",new BigNumber$1(1)),HbarUnit.Microbar=new HbarUnit("microbar","μℏ",new BigNumber$1(100)),HbarUnit.Millibar=new HbarUnit("millibar","mℏ",new BigNumber$1(1e5)),HbarUnit.Hbar=new HbarUnit("hbar","ℏ",new BigNumber$1("100000000")),HbarUnit.Kilobar=new HbarUnit("kilobar","kℏ",new BigNumber$1(1e3).multipliedBy(new BigNumber$1("100000000"))),HbarUnit.Megabar=new HbarUnit("megabar","Mℏ",new BigNumber$1(1e6).multipliedBy(new BigNumber$1("100000000"))),HbarUnit.Gigabar=new HbarUnit("gigabar","Gℏ",new BigNumber$1("1000000000").multipliedBy(new BigNumber$1("100000000")));class Hbar{constructor(e,t=HbarUnit.Hbar){if(t===HbarUnit.Tinybar)this._valueInTinybar=valueToLong(e);else{let n;n=Long.isLong(e)?new BigNumber$1(e.toString(10)):BigNumber$1.isBigNumber(e)||"string"==typeof e||"number"==typeof e?new BigNumber$1(e):new BigNumber$1(0),this._valueInTinybar=n.multipliedBy(t._tinybar)}if(!this._valueInTinybar.isInteger())throw new Error("Hbar in tinybars contains decimals")}static from(e,t){return new Hbar(e,t)}static fromTinybars(e){return"string"==typeof e?this.fromString(e,HbarUnit.Tinybar):new Hbar(e,HbarUnit.Tinybar)}static fromString(e,t=HbarUnit.Hbar){if(/^((?:\+|-)?\d+(?:\.\d+)?)(?: (tℏ|μℏ|mℏ|ℏ|kℏ|Mℏ|Gℏ))?$/.test(e)){let[n,r]=e.split(" ");return null!=r&&(t=HbarUnit.fromString(r)),new Hbar(new BigNumber$1(n),t)}throw new Error("invalid argument provided")}to(e){return this._valueInTinybar.dividedBy(e._tinybar)}toBigNumber(){return this.to(HbarUnit.Hbar)}toTinybars(){return Long.fromValue(this._valueInTinybar.toFixed())}negated(){return Hbar.fromTinybars(this._valueInTinybar.negated())}isNegative(){return this._valueInTinybar.isNegative()}toString(e){return null!=e?`${this._valueInTinybar.dividedBy(e._tinybar).toString()} ${e._symbol}`:this._valueInTinybar.isLessThan(1e4)&&this._valueInTinybar.isGreaterThan(-1e4)?`${this._valueInTinybar.toFixed()} ${HbarUnit.Tinybar._symbol}`:`${this.to(HbarUnit.Hbar).toString()} ${HbarUnit.Hbar._symbol}`}}class StatusError extends Error{constructor(e,t){super(t),this.name="StatusError",this.status=e.status,this.transactionId=e.transactionId,this.message=t,void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,StatusError)}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),message:this.message}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}class ReceiptStatusError extends StatusError{constructor(e){super(e,`receipt for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionReceipt=e.transactionReceipt}}class Status{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case Status.Ok:return"OK";case Status.InvalidTransaction:return"INVALID_TRANSACTION";case Status.PayerAccountNotFound:return"PAYER_ACCOUNT_NOT_FOUND";case Status.InvalidNodeAccount:return"INVALID_NODE_ACCOUNT";case Status.TransactionExpired:return"TRANSACTION_EXPIRED";case Status.InvalidTransactionStart:return"INVALID_TRANSACTION_START";case Status.InvalidTransactionDuration:return"INVALID_TRANSACTION_DURATION";case Status.InvalidSignature:return"INVALID_SIGNATURE";case Status.MemoTooLong:return"MEMO_TOO_LONG";case Status.InsufficientTxFee:return"INSUFFICIENT_TX_FEE";case Status.InsufficientPayerBalance:return"INSUFFICIENT_PAYER_BALANCE";case Status.DuplicateTransaction:return"DUPLICATE_TRANSACTION";case Status.Busy:return"BUSY";case Status.NotSupported:return"NOT_SUPPORTED";case Status.InvalidFileId:return"INVALID_FILE_ID";case Status.InvalidAccountId:return"INVALID_ACCOUNT_ID";case Status.InvalidContractId:return"INVALID_CONTRACT_ID";case Status.InvalidTransactionId:return"INVALID_TRANSACTION_ID";case Status.ReceiptNotFound:return"RECEIPT_NOT_FOUND";case Status.RecordNotFound:return"RECORD_NOT_FOUND";case Status.InvalidSolidityId:return"INVALID_SOLIDITY_ID";case Status.Unknown:return"UNKNOWN";case Status.Success:return"SUCCESS";case Status.FailInvalid:return"FAIL_INVALID";case Status.FailFee:return"FAIL_FEE";case Status.FailBalance:return"FAIL_BALANCE";case Status.KeyRequired:return"KEY_REQUIRED";case Status.BadEncoding:return"BAD_ENCODING";case Status.InsufficientAccountBalance:return"INSUFFICIENT_ACCOUNT_BALANCE";case Status.InvalidSolidityAddress:return"INVALID_SOLIDITY_ADDRESS";case Status.InsufficientGas:return"INSUFFICIENT_GAS";case Status.ContractSizeLimitExceeded:return"CONTRACT_SIZE_LIMIT_EXCEEDED";case Status.LocalCallModificationException:return"LOCAL_CALL_MODIFICATION_EXCEPTION";case Status.ContractRevertExecuted:return"CONTRACT_REVERT_EXECUTED";case Status.ContractExecutionException:return"CONTRACT_EXECUTION_EXCEPTION";case Status.InvalidReceivingNodeAccount:return"INVALID_RECEIVING_NODE_ACCOUNT";case Status.MissingQueryHeader:return"MISSING_QUERY_HEADER";case Status.AccountUpdateFailed:return"ACCOUNT_UPDATE_FAILED";case Status.InvalidKeyEncoding:return"INVALID_KEY_ENCODING";case Status.NullSolidityAddress:return"NULL_SOLIDITY_ADDRESS";case Status.ContractUpdateFailed:return"CONTRACT_UPDATE_FAILED";case Status.InvalidQueryHeader:return"INVALID_QUERY_HEADER";case Status.InvalidFeeSubmitted:return"INVALID_FEE_SUBMITTED";case Status.InvalidPayerSignature:return"INVALID_PAYER_SIGNATURE";case Status.KeyNotProvided:return"KEY_NOT_PROVIDED";case Status.InvalidExpirationTime:return"INVALID_EXPIRATION_TIME";case Status.NoWaclKey:return"NO_WACL_KEY";case Status.FileContentEmpty:return"FILE_CONTENT_EMPTY";case Status.InvalidAccountAmounts:return"INVALID_ACCOUNT_AMOUNTS";case Status.EmptyTransactionBody:return"EMPTY_TRANSACTION_BODY";case Status.InvalidTransactionBody:return"INVALID_TRANSACTION_BODY";case Status.InvalidSignatureTypeMismatchingKey:return"INVALID_SIGNATURE_TYPE_MISMATCHING_KEY";case Status.InvalidSignatureCountMismatchingKey:return"INVALID_SIGNATURE_COUNT_MISMATCHING_KEY";case Status.EmptyLiveHashBody:return"EMPTY_LIVE_HASH_BODY";case Status.EmptyLiveHash:return"EMPTY_LIVE_HASH";case Status.EmptyLiveHashKeys:return"EMPTY_LIVE_HASH_KEYS";case Status.InvalidLiveHashSize:return"INVALID_LIVE_HASH_SIZE";case Status.EmptyQueryBody:return"EMPTY_QUERY_BODY";case Status.EmptyLiveHashQuery:return"EMPTY_LIVE_HASH_QUERY";case Status.LiveHashNotFound:return"LIVE_HASH_NOT_FOUND";case Status.AccountIdDoesNotExist:return"ACCOUNT_ID_DOES_NOT_EXIST";case Status.LiveHashAlreadyExists:return"LIVE_HASH_ALREADY_EXISTS";case Status.InvalidFileWacl:return"INVALID_FILE_WACL";case Status.SerializationFailed:return"SERIALIZATION_FAILED";case Status.TransactionOversize:return"TRANSACTION_OVERSIZE";case Status.TransactionTooManyLayers:return"TRANSACTION_TOO_MANY_LAYERS";case Status.ContractDeleted:return"CONTRACT_DELETED";case Status.PlatformNotActive:return"PLATFORM_NOT_ACTIVE";case Status.KeyPrefixMismatch:return"KEY_PREFIX_MISMATCH";case Status.PlatformTransactionNotCreated:return"PLATFORM_TRANSACTION_NOT_CREATED";case Status.InvalidRenewalPeriod:return"INVALID_RENEWAL_PERIOD";case Status.InvalidPayerAccountId:return"INVALID_PAYER_ACCOUNT_ID";case Status.AccountDeleted:return"ACCOUNT_DELETED";case Status.FileDeleted:return"FILE_DELETED";case Status.AccountRepeatedInAccountAmounts:return"ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS";case Status.SettingNegativeAccountBalance:return"SETTING_NEGATIVE_ACCOUNT_BALANCE";case Status.ObtainerRequired:return"OBTAINER_REQUIRED";case Status.ObtainerSameContractId:return"OBTAINER_SAME_CONTRACT_ID";case Status.ObtainerDoesNotExist:return"OBTAINER_DOES_NOT_EXIST";case Status.ModifyingImmutableContract:return"MODIFYING_IMMUTABLE_CONTRACT";case Status.FileSystemException:return"FILE_SYSTEM_EXCEPTION";case Status.AutorenewDurationNotInRange:return"AUTORENEW_DURATION_NOT_IN_RANGE";case Status.ErrorDecodingBytestring:return"ERROR_DECODING_BYTESTRING";case Status.ContractFileEmpty:return"CONTRACT_FILE_EMPTY";case Status.ContractBytecodeEmpty:return"CONTRACT_BYTECODE_EMPTY";case Status.InvalidInitialBalance:return"INVALID_INITIAL_BALANCE";case Status.InvalidReceiveRecordThreshold:return"INVALID_RECEIVE_RECORD_THRESHOLD";case Status.InvalidSendRecordThreshold:return"INVALID_SEND_RECORD_THRESHOLD";case Status.AccountIsNotGenesisAccount:return"ACCOUNT_IS_NOT_GENESIS_ACCOUNT";case Status.PayerAccountUnauthorized:return"PAYER_ACCOUNT_UNAUTHORIZED";case Status.InvalidFreezeTransactionBody:return"INVALID_FREEZE_TRANSACTION_BODY";case Status.FreezeTransactionBodyNotFound:return"FREEZE_TRANSACTION_BODY_NOT_FOUND";case Status.TransferListSizeLimitExceeded:return"TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.ResultSizeLimitExceeded:return"RESULT_SIZE_LIMIT_EXCEEDED";case Status.NotSpecialAccount:return"NOT_SPECIAL_ACCOUNT";case Status.ContractNegativeGas:return"CONTRACT_NEGATIVE_GAS";case Status.ContractNegativeValue:return"CONTRACT_NEGATIVE_VALUE";case Status.InvalidFeeFile:return"INVALID_FEE_FILE";case Status.InvalidExchangeRateFile:return"INVALID_EXCHANGE_RATE_FILE";case Status.InsufficientLocalCallGas:return"INSUFFICIENT_LOCAL_CALL_GAS";case Status.EntityNotAllowedToDelete:return"ENTITY_NOT_ALLOWED_TO_DELETE";case Status.AuthorizationFailed:return"AUTHORIZATION_FAILED";case Status.FileUploadedProtoInvalid:return"FILE_UPLOADED_PROTO_INVALID";case Status.FileUploadedProtoNotSavedToDisk:return"FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK";case Status.FeeScheduleFilePartUploaded:return"FEE_SCHEDULE_FILE_PART_UPLOADED";case Status.ExchangeRateChangeLimitExceeded:return"EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED";case Status.MaxContractStorageExceeded:return"MAX_CONTRACT_STORAGE_EXCEEDED";case Status.TransferAccountSameAsDeleteAccount:return"TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT";case Status.TotalLedgerBalanceInvalid:return"TOTAL_LEDGER_BALANCE_INVALID";case Status.ExpirationReductionNotAllowed:return"EXPIRATION_REDUCTION_NOT_ALLOWED";case Status.MaxGasLimitExceeded:return"MAX_GAS_LIMIT_EXCEEDED";case Status.MaxFileSizeExceeded:return"MAX_FILE_SIZE_EXCEEDED";case Status.ReceiverSigRequired:return"RECEIVER_SIG_REQUIRED";case Status.InvalidTopicId:return"INVALID_TOPIC_ID";case Status.InvalidAdminKey:return"INVALID_ADMIN_KEY";case Status.InvalidSubmitKey:return"INVALID_SUBMIT_KEY";case Status.Unauthorized:return"UNAUTHORIZED";case Status.InvalidTopicMessage:return"INVALID_TOPIC_MESSAGE";case Status.InvalidAutorenewAccount:return"INVALID_AUTORENEW_ACCOUNT";case Status.AutorenewAccountNotAllowed:return"AUTORENEW_ACCOUNT_NOT_ALLOWED";case Status.TopicExpired:return"TOPIC_EXPIRED";case Status.InvalidChunkNumber:return"INVALID_CHUNK_NUMBER";case Status.InvalidChunkTransactionId:return"INVALID_CHUNK_TRANSACTION_ID";case Status.AccountFrozenForToken:return"ACCOUNT_FROZEN_FOR_TOKEN";case Status.TokensPerAccountLimitExceeded:return"TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED";case Status.InvalidTokenId:return"INVALID_TOKEN_ID";case Status.InvalidTokenDecimals:return"INVALID_TOKEN_DECIMALS";case Status.InvalidTokenInitialSupply:return"INVALID_TOKEN_INITIAL_SUPPLY";case Status.InvalidTreasuryAccountForToken:return"INVALID_TREASURY_ACCOUNT_FOR_TOKEN";case Status.InvalidTokenSymbol:return"INVALID_TOKEN_SYMBOL";case Status.TokenHasNoFreezeKey:return"TOKEN_HAS_NO_FREEZE_KEY";case Status.TransfersNotZeroSumForToken:return"TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN";case Status.MissingTokenSymbol:return"MISSING_TOKEN_SYMBOL";case Status.TokenSymbolTooLong:return"TOKEN_SYMBOL_TOO_LONG";case Status.AccountKycNotGrantedForToken:return"ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN";case Status.TokenHasNoKycKey:return"TOKEN_HAS_NO_KYC_KEY";case Status.InsufficientTokenBalance:return"INSUFFICIENT_TOKEN_BALANCE";case Status.TokenWasDeleted:return"TOKEN_WAS_DELETED";case Status.TokenHasNoSupplyKey:return"TOKEN_HAS_NO_SUPPLY_KEY";case Status.TokenHasNoWipeKey:return"TOKEN_HAS_NO_WIPE_KEY";case Status.InvalidTokenMintAmount:return"INVALID_TOKEN_MINT_AMOUNT";case Status.InvalidTokenBurnAmount:return"INVALID_TOKEN_BURN_AMOUNT";case Status.TokenNotAssociatedToAccount:return"TOKEN_NOT_ASSOCIATED_TO_ACCOUNT";case Status.CannotWipeTokenTreasuryAccount:return"CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT";case Status.InvalidKycKey:return"INVALID_KYC_KEY";case Status.InvalidWipeKey:return"INVALID_WIPE_KEY";case Status.InvalidFreezeKey:return"INVALID_FREEZE_KEY";case Status.InvalidSupplyKey:return"INVALID_SUPPLY_KEY";case Status.MissingTokenName:return"MISSING_TOKEN_NAME";case Status.TokenNameTooLong:return"TOKEN_NAME_TOO_LONG";case Status.InvalidWipingAmount:return"INVALID_WIPING_AMOUNT";case Status.TokenIsImmutable:return"TOKEN_IS_IMMUTABLE";case Status.TokenAlreadyAssociatedToAccount:return"TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT";case Status.TransactionRequiresZeroTokenBalances:return"TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES";case Status.AccountIsTreasury:return"ACCOUNT_IS_TREASURY";case Status.TokenIdRepeatedInTokenList:return"TOKEN_ID_REPEATED_IN_TOKEN_LIST";case Status.TokenTransferListSizeLimitExceeded:return"TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.EmptyTokenTransferBody:return"EMPTY_TOKEN_TRANSFER_BODY";case Status.EmptyTokenTransferAccountAmounts:return"EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS";case Status.InvalidScheduleId:return"INVALID_SCHEDULE_ID";case Status.ScheduleIsImmutable:return"SCHEDULE_IS_IMMUTABLE";case Status.InvalidSchedulePayerId:return"INVALID_SCHEDULE_PAYER_ID";case Status.InvalidScheduleAccountId:return"INVALID_SCHEDULE_ACCOUNT_ID";case Status.NoNewValidSignatures:return"NO_NEW_VALID_SIGNATURES";case Status.UnresolvableRequiredSigners:return"UNRESOLVABLE_REQUIRED_SIGNERS";case Status.ScheduledTransactionNotInWhitelist:return"SCHEDULED_TRANSACTION_NOT_IN_WHITELIST";case Status.SomeSignaturesWereInvalid:return"SOME_SIGNATURES_WERE_INVALID";case Status.TransactionIdFieldNotAllowed:return"TRANSACTION_ID_FIELD_NOT_ALLOWED";case Status.IdenticalScheduleAlreadyCreated:return"IDENTICAL_SCHEDULE_ALREADY_CREATED";case Status.InvalidZeroByteInString:return"INVALID_ZERO_BYTE_IN_STRING";case Status.ScheduleAlreadyDeleted:return"SCHEDULE_ALREADY_DELETED";case Status.ScheduleAlreadyExecuted:return"SCHEDULE_ALREADY_EXECUTED";case Status.MessageSizeTooLarge:return"MESSAGE_SIZE_TOO_LARGE";case Status.OperationRepeatedInBucketGroups:return"OPERATION_REPEATED_IN_BUCKET_GROUPS";case Status.BucketCapacityOverflow:return"BUCKET_CAPACITY_OVERFLOW";case Status.NodeCapacityNotSufficientForOperation:return"NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION";case Status.BucketHasNoThrottleGroups:return"BUCKET_HAS_NO_THROTTLE_GROUPS";case Status.ThrottleGroupHasZeroOpsPerSec:return"THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC";case Status.SuccessButMissingExpectedOperation:return"SUCCESS_BUT_MISSING_EXPECTED_OPERATION";case Status.UnparseableThrottleDefinitions:return"UNPARSEABLE_THROTTLE_DEFINITIONS";case Status.InvalidThrottleDefinitions:return"INVALID_THROTTLE_DEFINITIONS";case Status.AccountExpiredAndPendingRemoval:return"ACCOUNT_EXPIRED_AND_PENDING_REMOVAL";case Status.InvalidTokenMaxSupply:return"INVALID_TOKEN_MAX_SUPPLY";case Status.InvalidTokenNftSerialNumber:return"INVALID_TOKEN_NFT_SERIAL_NUMBER";case Status.InvalidNftId:return"INVALID_NFT_ID";case Status.MetadataTooLong:return"METADATA_TOO_LONG";case Status.BatchSizeLimitExceeded:return"BATCH_SIZE_LIMIT_EXCEEDED";case Status.InvalidQueryRange:return"INVALID_QUERY_RANGE";case Status.FractionDividesByZero:return"FRACTION_DIVIDES_BY_ZERO";case Status.InsufficientPayerBalanceForCustomFee:return"INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE";case Status.CustomFeesListTooLong:return"CUSTOM_FEES_LIST_TOO_LONG";case Status.InvalidCustomFeeCollector:return"INVALID_CUSTOM_FEE_COLLECTOR";case Status.InvalidTokenIdInCustomFees:return"INVALID_TOKEN_ID_IN_CUSTOM_FEES";case Status.TokenNotAssociatedToFeeCollector:return"TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR";case Status.TokenMaxSupplyReached:return"TOKEN_MAX_SUPPLY_REACHED";case Status.SenderDoesNotOwnNftSerialNo:return"SENDER_DOES_NOT_OWN_NFT_SERIAL_NO";case Status.CustomFeeNotFullySpecified:return"CUSTOM_FEE_NOT_FULLY_SPECIFIED";case Status.CustomFeeMustBePositive:return"CUSTOM_FEE_MUST_BE_POSITIVE";case Status.TokenHasNoFeeScheduleKey:return"TOKEN_HAS_NO_FEE_SCHEDULE_KEY";case Status.CustomFeeOutsideNumericRange:return"CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE";case Status.RoyaltyFractionCannotExceedOne:return"ROYALTY_FRACTION_CANNOT_EXCEED_ONE";case Status.FractionalFeeMaxAmountLessThanMinAmount:return"FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT";case Status.CustomScheduleAlreadyHasNoFees:return"CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES";case Status.CustomFeeDenominationMustBeFungibleCommon:return"CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON";case Status.CustomFractionalFeeOnlyAllowedForFungibleCommon:return"CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.InvalidCustomFeeScheduleKey:return"INVALID_CUSTOM_FEE_SCHEDULE_KEY";case Status.InvalidTokenMintMetadata:return"INVALID_TOKEN_MINT_METADATA";case Status.InvalidTokenBurnMetadata:return"INVALID_TOKEN_BURN_METADATA";case Status.CurrentTreasuryStillOwnsNfts:return"CURRENT_TREASURY_STILL_OWNS_NFTS";case Status.AccountStillOwnsNfts:return"ACCOUNT_STILL_OWNS_NFTS";case Status.TreasuryMustOwnBurnedNft:return"TREASURY_MUST_OWN_BURNED_NFT";case Status.AccountDoesNotOwnWipedNft:return"ACCOUNT_DOES_NOT_OWN_WIPED_NFT";case Status.AccountAmountTransfersOnlyAllowedForFungibleCommon:return"ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.MaxNftsInPriceRegimeHaveBeenMinted:return"MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED";case Status.PayerAccountDeleted:return"PAYER_ACCOUNT_DELETED";case Status.CustomFeeChargingExceededMaxRecursionDepth:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH";case Status.CustomFeeChargingExceededMaxAccountAmounts:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS";case Status.InsufficientSenderAccountBalanceForCustomFee:return"INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE";case Status.SerialNumberLimitReached:return"SERIAL_NUMBER_LIMIT_REACHED";case Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique:return"CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.NoRemainingAutomaticAssociations:return"NO_REMAINING_AUTOMATIC_ASSOCIATIONS";case Status.ExistingAutomaticAssociationsExceedGivenLimit:return"EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT";case Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit:return"REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT";case Status.TokenIsPaused:return"TOKEN_IS_PAUSED";case Status.TokenHasNoPauseKey:return"TOKEN_HAS_NO_PAUSE_KEY";case Status.InvalidPauseKey:return"INVALID_PAUSE_KEY";case Status.FreezeUpdateFileDoesNotExist:return"FREEZE_UPDATE_FILE_DOES_NOT_EXIST";case Status.FreezeUpdateFileHashDoesNotMatch:return"FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH";case Status.NoUpgradeHasBeenPrepared:return"NO_UPGRADE_HAS_BEEN_PREPARED";case Status.NoFreezeIsScheduled:return"NO_FREEZE_IS_SCHEDULED";case Status.UpdateFileHashChangedSincePrepareUpgrade:return"UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE";case Status.FreezeStartTimeMustBeFuture:return"FREEZE_START_TIME_MUST_BE_FUTURE";case Status.PreparedUpdateFileIsImmutable:return"PREPARED_UPDATE_FILE_IS_IMMUTABLE";case Status.FreezeAlreadyScheduled:return"FREEZE_ALREADY_SCHEDULED";case Status.FreezeUpgradeInProgress:return"FREEZE_UPGRADE_IN_PROGRESS";case Status.UpdateFileIdDoesNotMatchPrepared:return"UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED";case Status.UpdateFileHashDoesNotMatchPrepared:return"UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED";case Status.ConsensusGasExhausted:return"CONSENSUS_GAS_EXHAUSTED";case Status.RevertedSuccess:return"REVERTED_SUCCESS";case Status.MaxStorageInPriceRegimeHasBeenUsed:return"MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED";case Status.InvalidAliasKey:return"INVALID_ALIAS_KEY";case Status.UnexpectedTokenDecimals:return"UNEXPECTED_TOKEN_DECIMALS";case Status.InvalidProxyAccountId:return"INVALID_PROXY_ACCOUNT_ID";case Status.InvalidTransferAccountId:return"INVALID_TRANSFER_ACCOUNT_ID";case Status.InvalidFeeCollectorAccountId:return"INVALID_FEE_COLLECTOR_ACCOUNT_ID";case Status.AliasIsImmutable:return"ALIAS_IS_IMMUTABLE";case Status.SpenderAccountSameAsOwner:return"SPENDER_ACCOUNT_SAME_AS_OWNER";case Status.AmountExceedsTokenMaxSupply:return"AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY";case Status.NegativeAllowanceAmount:return"NEGATIVE_ALLOWANCE_AMOUNT";case Status.CannotApproveForAllFungibleCommon:return"CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON";case Status.SpenderDoesNotHaveAllowance:return"SPENDER_DOES_NOT_HAVE_ALLOWANCE";case Status.AmountExceedsAllowance:return"AMOUNT_EXCEEDS_ALLOWANCE";case Status.MaxAllowancesExceeded:return"MAX_ALLOWANCES_EXCEEDED";case Status.EmptyAllowances:return"EMPTY_ALLOWANCES";case Status.SpenderAccountRepeatedInAllowances:return"SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES";case Status.RepeatedSerialNumsInNftAllowances:return"REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES";case Status.FungibleTokenInNftAllowances:return"FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES";case Status.NftInFungibleTokenAllowances:return"NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES";case Status.InvalidAllowanceOwnerId:return"INVALID_ALLOWANCE_OWNER_ID";case Status.InvalidAllowanceSpenderId:return"INVALID_ALLOWANCE_SPENDER_ID";case Status.RepeatedAllowancesToDelete:return"REPEATED_ALLOWANCES_TO_DELETE";case Status.InvalidDelegatingSpender:return"INVALID_DELEGATING_SPENDER";case Status.DelegatingSpenderCannotGrantApproveForAll:return"DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL";case Status.DelegatingSpenderDoesNotHaveApproveForAll:return"DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL";case Status.ScheduleExpirationTimeTooFarInFuture:return"SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE";case Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime:return"SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME";case Status.ScheduleFutureThrottleExceeded:return"SCHEDULE_FUTURE_THROTTLE_EXCEEDED";case Status.ScheduleFutureGasLimitExceeded:return"SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED";case Status.InvalidEthereumTransaction:return"INVALID_ETHEREUM_TRANSACTION";case Status.WrongChainId:return"WRONG_CHAIN_ID";case Status.WrongNonce:return"WRONG_NONCE";case Status.AccessListUnsupported:return"ACCESS_LIST_UNSUPPORTED";case Status.SchedulePendingExpiration:return"SCHEDULE_PENDING_EXPIRATION";case Status.ContractIsTokenTreasury:return"CONTRACT_IS_TOKEN_TREASURY";case Status.ContractHasNonZeroTokenBalances:return"CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES";case Status.ContractExpiredAndPendingRemoval:return"CONTRACT_EXPIRED_AND_PENDING_REMOVAL";case Status.ContractHasNoAutoRenewAccount:return"CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT";case Status.PermanentRemovalRequiresSystemInitiation:return"PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION";case Status.ProxyAccountIdFieldIsDeprecated:return"PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED";case Status.SelfStakingIsNotAllowed:return"SELF_STAKING_IS_NOT_ALLOWED";case Status.InvalidStakingId:return"INVALID_STAKING_ID";case Status.StakingNotEnabled:return"STAKING_NOT_ENABLED";case Status.InvalidPrngRange:return"INVALID_PRNG_RANGE";case Status.MaxEntitiesInPriceRegimeHaveBeenCreated:return"MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED";case Status.InvalidFullPrefixSignatureForPrecompile:return"INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE";case Status.InsufficientBalancesForStorageRent:return"INSUFFICIENT_BALANCES_FOR_STORAGE_RENT";case Status.MaxChildRecordsExceeded:return"MAX_CHILD_RECORDS_EXCEEDED";case Status.InsufficientBalancesForRenewalFees:return"INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES";case Status.TransactionHasUnknownFields:return"TRANSACTION_HAS_UNKNOWN_FIELDS";case Status.AccountIsImmutable:return"ACCOUNT_IS_IMMUTABLE";case Status.AliasAlreadyAssigned:return"ALIAS_ALREADY_ASSIGNED";case Status.InvalidMetadataKey:return"INVALID_METADATA_KEY";case Status.TokenHasNoMetadataKey:return"TOKEN_HAS_NO_METADATA_KEY";case Status.MissingTokenMetadata:return"MISSING_TOKEN_METADATA";case Status.MissingSerialNumbers:return"MISSING_SERIAL_NUMBERS";case Status.TokenHasNoAdminKey:return"TOKEN_HAS_NO_ADMIN_KEY";case Status.NodeDeleted:return"NODE_DELETED";case Status.InvalidNodeId:return"INVALID_NODE_ID";case Status.InvalidGossipEndpoint:return"INVALID_GOSSIP_ENDPOINT";case Status.InvalidNodeAccountId:return"INVALID_NODE_ACCOUNT_ID";case Status.InvalidNodeDescription:return"INVALID_NODE_DESCRIPTION";case Status.InvalidServiceEndpoint:return"INVALID_SERVICE_ENDPOINT";case Status.InvalidGossipCaCertificate:return"INVALID_GOSSIP_CA_CERTIFICATE";case Status.InvalidGrpcCertificate:return"INVALID_GRPC_CERTIFICATE";case Status.InvalidMaxAutoAssociations:return"INVALID_MAX_AUTO_ASSOCIATIONS";case Status.MaxNodesCreated:return"MAX_NODES_CREATED";case Status.IpFqdnCannotBeSetForSameEndpoint:return"IP_FQDN_CANNOT_BE_SET_FOR_SAME_ENDPOINT";case Status.GossipEndpointCannotHaveFqdn:return"GOSSIP_ENDPOINT_CANNOT_HAVE_FQDN";case Status.FqdnSizeTooLarge:return"FQDN_SIZE_TOO_LARGE";case Status.InvalidEndpoint:return"INVALID_ENDPOINT";case Status.GossipEndpointsExceededLimit:return"GOSSIP_ENDPOINTS_EXCEEDED_LIMIT";case Status.ServiceEndpointsExceededLimit:return"SERVICE_ENDPOINTS_EXCEEDED_LIMIT";case Status.InvalidIpv4Address:return"INVALID_IPV4_ADDRESS";case Status.TokenReferenceRepeated:return"TOKEN_REFERENCE_REPEATED";case Status.InvalidOwnerId:return"INVALID_OWNER_ID";case Status.TokenReferenceListSizeLimitExceeded:return"TOKEN_REFERENCE_LIST_SIZE_LIMIT_EXCEEDED";case Status.EmptyTokenReferenceList:return"EMPTY_TOKEN_REFERENCE_LIST";case Status.UpdateNodeAccountNotAllowed:return"UPDATE_NODE_ACCOUNT_NOT_ALLOWED";case Status.TokenHasNoMetadataOrSupplyKey:return"TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY";case Status.EmptyPendingAirdropIdList:return"EMPTY_PENDING_AIRDROP_ID_LIST";case Status.PendingAirdropIdRepeated:return"PENDING_AIRDROP_ID_REPEATED";case Status.MaxPendingAirdropIdExceeded:return"PENDING_AIRDROP_ID_LIST_TOO_LONG";case Status.PendingNftAirdropAlreadyExists:return"PENDING_NFT_AIRDROP_ALREADY_EXISTS";case Status.AccountHasPendingAirdrops:return"ACCOUNT_HAS_PENDING_AIRDROPS";case Status.ThrottledAtConsensus:return"THROTTLED_AT_CONSENSUS";case Status.InvalidPendingAirdropId:return"INVALID_PENDING_AIRDROP_ID";case Status.TokenAirdropWithFallbackRoyalty:return"TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY";case Status.InvalidTokenInPendingAirdrop:return"INVALID_TOKEN_IN_PENDING_AIRDROP";case Status.ScheduleExpiryIsBusy:return"SCHEDULE_EXPIRY_IS_BUSY";case Status.InvalidGrpcCertificateHash:return"INVALID_GRPC_CERTIFICATE_HASH";case Status.MissingExpiryTime:return"MISSING_EXPIRY_TIME";case Status.NoSchedulingAllowedAfterScheduledRecursion:return"NO_SCHEDULING_ALLOWED_AFTER_SCHEDULED_RECURSION";case Status.RecursiveSchedulingLimitReached:return"RECURSIVE_SCHEDULING_LIMIT_REACHED";case Status.WaitingForLedgerId:return"WAITING_FOR_LEDGER_ID";case Status.MaxEntriesForFeeExemptKeyListExceeded:return"MAX_ENTRIES_FOR_FEE_EXEMPT_KEY_LIST_EXCEEDED";case Status.FeeExemptKeyListContainsDuplicatedKeys:return"FEE_EXEMPT_KEY_LIST_CONTAINS_DUPLICATED_KEYS";case Status.InvalidKeyInFeeExemptKeyList:return"INVALID_KEY_IN_FEE_EXEMPT_KEY_LIST";case Status.InvalidFeeScheduleKey:return"INVALID_FEE_SCHEDULE_KEY";case Status.FeeScheduleKeyCannotBeUpdated:return"FEE_SCHEDULE_KEY_CANNOT_BE_UPDATED";case Status.FeeScheduleKeyNotSet:return"FEE_SCHEDULE_KEY_NOT_SET";case Status.MaxCustomFeeLimitExceeded:return"MAX_CUSTOM_FEE_LIMIT_EXCEEDED";case Status.NoValidMaxCustomFee:return"NO_VALID_MAX_CUSTOM_FEE";case Status.InvalidMaxCustomFees:return"INVALID_MAX_CUSTOM_FEES";case Status.DuplicateDenominationInMaxCustomFeeList:return"DUPLICATE_DENOMINATION_IN_MAX_CUSTOM_FEE_LIST";case Status.DuplicateAccountIdInMaxCustomFeeList:return"DUPLICATE_ACCOUNT_ID_IN_MAX_CUSTOM_FEE_LIST";case Status.MaxCustomFeesIsNotSupported:return"MAX_CUSTOM_FEES_IS_NOT_SUPPORTED";case Status.BatchListEmpty:return"BATCH_LIST_EMPTY";case Status.BatchListContainsDuplicates:return"BATCH_LIST_CONTAINS_DUPLICATES";case Status.BatchTransactionInBlacklist:return"BATCH_TRANSACTION_IN_BLACKLIST";case Status.InnerTransactionFailed:return"INNER_TRANSACTION_FAILED";case Status.MissingBatchKey:return"MISSING_BATCH_KEY";case Status.BatchKeySetOnNonInnerTransaction:return"BATCH_KEY_SET_ON_NON_INNER_TRANSACTION";case Status.InvalidBatchKey:return"INVALID_BATCH_KEY";case Status.ScheduleExpiryNotConfigurable:return"SCHEDULE_EXPIRY_NOT_CONFIGURABLE";case Status.CreatingSystemEntities:return"CREATING_SYSTEM_ENTITIES";case Status.ThrottleGroupLcmOverflow:return"THROTTLE_GROUP_LCM_OVERFLOW";case Status.AirdropContainsMultipleSendersForAToken:return"AIRDROP_CONTAINS_MULTIPLE_SENDERS_FOR_A_TOKEN";case Status.GrpcWebProxyNotSupported:return"GRPC_WEB_PROXY_NOT_SUPPORTED";case Status.NftTransfersOnlyAllowedForNonFungibleUnique:return"NFT_TRANSFERS_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.InvalidSerializedTxMessageHashAlgorithm:return"INVALID_SERIALIZED_TX_MESSAGE_HASH_ALGORITHM";case Status.WrongHookEntityType:return"WRONG_HOOK_ENTITY_TYPE";case Status.EvmHookGasThrottled:return"EVM_HOOK_GAS_THROTTLED";case Status.HookIdInUse:return"HOOK_ID_IN_USE";case Status.BadHookRequest:return"BAD_HOOK_REQUEST";case Status.RejectedByAccountAllowanceHook:return"REJECTED_BY_ACCOUNT_ALLOWANCE_HOOK";case Status.HookNotFound:return"HOOK_NOT_FOUND";case Status.LambdaStorageUpdateBytesTooLong:return"LAMBDA_STORAGE_UPDATE_BYTES_TOO_LONG";case Status.LambdaStorageUpdateBytesMustUseMinimalRepresentation:return"LAMBDA_STORAGE_UPDATE_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.InvalidHookId:return"INVALID_HOOK_ID";case Status.EmptyLambdaStorageUpdate:return"EMPTY_LAMBDA_STORAGE_UPDATE";case Status.HookIdRepeatedInCreationDetails:return"HOOK_ID_REPEATED_IN_CREATION_DETAILS";case Status.HooksNotEnabled:return"HOOKS_NOT_ENABLED";case Status.HookIsNotALambda:return"HOOK_IS_NOT_A_LAMBDA";case Status.HookDeleted:return"HOOK_DELETED";case Status.TooManyLambdaStorageUpdates:return"TOO_MANY_LAMBDA_STORAGE_UPDATES";case Status.HookCreationBytesMustUseMinimalRepresentation:return"HOOK_CREATION_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.HookCreationBytesTooLong:return"HOOK_CREATION_BYTES_TOO_LONG";case Status.InvalidHookCreationSpec:return"INVALID_HOOK_CREATION_SPEC";case Status.HookExtensionEmpty:return"HOOK_EXTENSION_EMPTY";case Status.InvalidHookAdminKey:return"INVALID_HOOK_ADMIN_KEY";case Status.HookDeletionRequiresZeroStorageSlots:return"HOOK_DELETION_REQUIRES_ZERO_STORAGE_SLOTS";case Status.CannotSetHooksAndApproval:return"CANNOT_SET_HOOKS_AND_APPROVAL";case Status.TransactionRequiresZeroHooks:return"TRANSACTION_REQUIRES_ZERO_HOOKS";case Status.InvalidHookCall:return"INVALID_HOOK_CALL";case Status.HooksAreNotSupportedInAirdrops:return"HOOKS_ARE_NOT_SUPPORTED_IN_AIRDROPS";case Status.AccountIsLinkedToANode:return"ACCOUNT_IS_LINKED_TO_A_NODE";case Status.HooksExecutionsRequireTopLevelCryptoTransfer:return"HOOKS_EXECUTIONS_REQUIRE_TOP_LEVEL_CRYPTO_TRANSFER";case Status.NodeAccountHasZeroBalance:return"NODE_ACCOUNT_HAS_ZERO_BALANCE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return Status.Ok;case 1:return Status.InvalidTransaction;case 2:return Status.PayerAccountNotFound;case 3:return Status.InvalidNodeAccount;case 4:return Status.TransactionExpired;case 5:return Status.InvalidTransactionStart;case 6:return Status.InvalidTransactionDuration;case 7:return Status.InvalidSignature;case 8:return Status.MemoTooLong;case 9:return Status.InsufficientTxFee;case 10:return Status.InsufficientPayerBalance;case 11:return Status.DuplicateTransaction;case 12:return Status.Busy;case 13:return Status.NotSupported;case 14:return Status.InvalidFileId;case 15:return Status.InvalidAccountId;case 16:return Status.InvalidContractId;case 17:return Status.InvalidTransactionId;case 18:return Status.ReceiptNotFound;case 19:return Status.RecordNotFound;case 20:return Status.InvalidSolidityId;case 21:return Status.Unknown;case 22:return Status.Success;case 23:return Status.FailInvalid;case 24:return Status.FailFee;case 25:return Status.FailBalance;case 26:return Status.KeyRequired;case 27:return Status.BadEncoding;case 28:return Status.InsufficientAccountBalance;case 29:return Status.InvalidSolidityAddress;case 30:return Status.InsufficientGas;case 31:return Status.ContractSizeLimitExceeded;case 32:return Status.LocalCallModificationException;case 33:return Status.ContractRevertExecuted;case 34:return Status.ContractExecutionException;case 35:return Status.InvalidReceivingNodeAccount;case 36:return Status.MissingQueryHeader;case 37:return Status.AccountUpdateFailed;case 38:return Status.InvalidKeyEncoding;case 39:return Status.NullSolidityAddress;case 40:return Status.ContractUpdateFailed;case 41:return Status.InvalidQueryHeader;case 42:return Status.InvalidFeeSubmitted;case 43:return Status.InvalidPayerSignature;case 44:return Status.KeyNotProvided;case 45:return Status.InvalidExpirationTime;case 46:return Status.NoWaclKey;case 47:return Status.FileContentEmpty;case 48:return Status.InvalidAccountAmounts;case 49:return Status.EmptyTransactionBody;case 50:return Status.InvalidTransactionBody;case 51:return Status.InvalidSignatureTypeMismatchingKey;case 52:return Status.InvalidSignatureCountMismatchingKey;case 53:return Status.EmptyLiveHashBody;case 54:return Status.EmptyLiveHash;case 55:return Status.EmptyLiveHashKeys;case 56:return Status.InvalidLiveHashSize;case 57:return Status.EmptyQueryBody;case 58:return Status.EmptyLiveHashQuery;case 59:return Status.LiveHashNotFound;case 60:return Status.AccountIdDoesNotExist;case 61:return Status.LiveHashAlreadyExists;case 62:return Status.InvalidFileWacl;case 63:return Status.SerializationFailed;case 64:return Status.TransactionOversize;case 65:return Status.TransactionTooManyLayers;case 66:return Status.ContractDeleted;case 67:return Status.PlatformNotActive;case 68:return Status.KeyPrefixMismatch;case 69:return Status.PlatformTransactionNotCreated;case 70:return Status.InvalidRenewalPeriod;case 71:return Status.InvalidPayerAccountId;case 72:return Status.AccountDeleted;case 73:return Status.FileDeleted;case 74:return Status.AccountRepeatedInAccountAmounts;case 75:return Status.SettingNegativeAccountBalance;case 76:return Status.ObtainerRequired;case 77:return Status.ObtainerSameContractId;case 78:return Status.ObtainerDoesNotExist;case 79:return Status.ModifyingImmutableContract;case 80:return Status.FileSystemException;case 81:return Status.AutorenewDurationNotInRange;case 82:return Status.ErrorDecodingBytestring;case 83:return Status.ContractFileEmpty;case 84:return Status.ContractBytecodeEmpty;case 85:return Status.InvalidInitialBalance;case 86:return Status.InvalidReceiveRecordThreshold;case 87:return Status.InvalidSendRecordThreshold;case 88:return Status.AccountIsNotGenesisAccount;case 89:return Status.PayerAccountUnauthorized;case 90:return Status.InvalidFreezeTransactionBody;case 91:return Status.FreezeTransactionBodyNotFound;case 92:return Status.TransferListSizeLimitExceeded;case 93:return Status.ResultSizeLimitExceeded;case 94:return Status.NotSpecialAccount;case 95:return Status.ContractNegativeGas;case 96:return Status.ContractNegativeValue;case 97:return Status.InvalidFeeFile;case 98:return Status.InvalidExchangeRateFile;case 99:return Status.InsufficientLocalCallGas;case 100:return Status.EntityNotAllowedToDelete;case 101:return Status.AuthorizationFailed;case 102:return Status.FileUploadedProtoInvalid;case 103:return Status.FileUploadedProtoNotSavedToDisk;case 104:return Status.FeeScheduleFilePartUploaded;case 105:return Status.ExchangeRateChangeLimitExceeded;case 106:return Status.MaxContractStorageExceeded;case 107:return Status.TransferAccountSameAsDeleteAccount;case 108:return Status.TotalLedgerBalanceInvalid;case 110:return Status.ExpirationReductionNotAllowed;case 111:return Status.MaxGasLimitExceeded;case 112:return Status.MaxFileSizeExceeded;case 113:return Status.ReceiverSigRequired;case 150:return Status.InvalidTopicId;case 155:return Status.InvalidAdminKey;case 156:return Status.InvalidSubmitKey;case 157:return Status.Unauthorized;case 158:return Status.InvalidTopicMessage;case 159:return Status.InvalidAutorenewAccount;case 160:return Status.AutorenewAccountNotAllowed;case 162:return Status.TopicExpired;case 163:return Status.InvalidChunkNumber;case 164:return Status.InvalidChunkTransactionId;case 165:return Status.AccountFrozenForToken;case 166:return Status.TokensPerAccountLimitExceeded;case 167:return Status.InvalidTokenId;case 168:return Status.InvalidTokenDecimals;case 169:return Status.InvalidTokenInitialSupply;case 170:return Status.InvalidTreasuryAccountForToken;case 171:return Status.InvalidTokenSymbol;case 172:return Status.TokenHasNoFreezeKey;case 173:return Status.TransfersNotZeroSumForToken;case 174:return Status.MissingTokenSymbol;case 175:return Status.TokenSymbolTooLong;case 176:return Status.AccountKycNotGrantedForToken;case 177:return Status.TokenHasNoKycKey;case 178:return Status.InsufficientTokenBalance;case 179:return Status.TokenWasDeleted;case 180:return Status.TokenHasNoSupplyKey;case 181:return Status.TokenHasNoWipeKey;case 182:return Status.InvalidTokenMintAmount;case 183:return Status.InvalidTokenBurnAmount;case 184:return Status.TokenNotAssociatedToAccount;case 185:return Status.CannotWipeTokenTreasuryAccount;case 186:return Status.InvalidKycKey;case 187:return Status.InvalidWipeKey;case 188:return Status.InvalidFreezeKey;case 189:return Status.InvalidSupplyKey;case 190:return Status.MissingTokenName;case 191:return Status.TokenNameTooLong;case 192:return Status.InvalidWipingAmount;case 193:return Status.TokenIsImmutable;case 194:return Status.TokenAlreadyAssociatedToAccount;case 195:return Status.TransactionRequiresZeroTokenBalances;case 196:return Status.AccountIsTreasury;case 197:return Status.TokenIdRepeatedInTokenList;case 198:return Status.TokenTransferListSizeLimitExceeded;case 199:return Status.EmptyTokenTransferBody;case 200:return Status.EmptyTokenTransferAccountAmounts;case 201:return Status.InvalidScheduleId;case 202:return Status.ScheduleIsImmutable;case 203:return Status.InvalidSchedulePayerId;case 204:return Status.InvalidScheduleAccountId;case 205:return Status.NoNewValidSignatures;case 206:return Status.UnresolvableRequiredSigners;case 207:return Status.ScheduledTransactionNotInWhitelist;case 208:return Status.SomeSignaturesWereInvalid;case 209:return Status.TransactionIdFieldNotAllowed;case 210:return Status.IdenticalScheduleAlreadyCreated;case 211:return Status.InvalidZeroByteInString;case 212:return Status.ScheduleAlreadyDeleted;case 213:return Status.ScheduleAlreadyExecuted;case 214:return Status.MessageSizeTooLarge;case 215:return Status.OperationRepeatedInBucketGroups;case 216:return Status.BucketCapacityOverflow;case 217:return Status.NodeCapacityNotSufficientForOperation;case 218:return Status.BucketHasNoThrottleGroups;case 219:return Status.ThrottleGroupHasZeroOpsPerSec;case 220:return Status.SuccessButMissingExpectedOperation;case 221:return Status.UnparseableThrottleDefinitions;case 222:return Status.InvalidThrottleDefinitions;case 223:return Status.AccountExpiredAndPendingRemoval;case 224:return Status.InvalidTokenMaxSupply;case 225:return Status.InvalidTokenNftSerialNumber;case 226:return Status.InvalidNftId;case 227:return Status.MetadataTooLong;case 228:return Status.BatchSizeLimitExceeded;case 229:return Status.InvalidQueryRange;case 230:return Status.FractionDividesByZero;case 231:return Status.InsufficientPayerBalanceForCustomFee;case 232:return Status.CustomFeesListTooLong;case 233:return Status.InvalidCustomFeeCollector;case 234:return Status.InvalidTokenIdInCustomFees;case 235:return Status.TokenNotAssociatedToFeeCollector;case 236:return Status.TokenMaxSupplyReached;case 237:return Status.SenderDoesNotOwnNftSerialNo;case 238:return Status.CustomFeeNotFullySpecified;case 239:return Status.CustomFeeMustBePositive;case 240:return Status.TokenHasNoFeeScheduleKey;case 241:return Status.CustomFeeOutsideNumericRange;case 242:return Status.RoyaltyFractionCannotExceedOne;case 243:return Status.FractionalFeeMaxAmountLessThanMinAmount;case 244:return Status.CustomScheduleAlreadyHasNoFees;case 245:return Status.CustomFeeDenominationMustBeFungibleCommon;case 246:return Status.CustomFractionalFeeOnlyAllowedForFungibleCommon;case 247:return Status.InvalidCustomFeeScheduleKey;case 248:return Status.InvalidTokenMintMetadata;case 249:return Status.InvalidTokenBurnMetadata;case 250:return Status.CurrentTreasuryStillOwnsNfts;case 251:return Status.AccountStillOwnsNfts;case 252:return Status.TreasuryMustOwnBurnedNft;case 253:return Status.AccountDoesNotOwnWipedNft;case 254:return Status.AccountAmountTransfersOnlyAllowedForFungibleCommon;case 255:return Status.MaxNftsInPriceRegimeHaveBeenMinted;case 256:return Status.PayerAccountDeleted;case 257:return Status.CustomFeeChargingExceededMaxRecursionDepth;case 258:return Status.CustomFeeChargingExceededMaxAccountAmounts;case 259:return Status.InsufficientSenderAccountBalanceForCustomFee;case 260:return Status.SerialNumberLimitReached;case 261:return Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique;case 262:return Status.NoRemainingAutomaticAssociations;case 263:return Status.ExistingAutomaticAssociationsExceedGivenLimit;case 264:return Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit;case 265:return Status.TokenIsPaused;case 266:return Status.TokenHasNoPauseKey;case 267:return Status.InvalidPauseKey;case 268:return Status.FreezeUpdateFileDoesNotExist;case 269:return Status.FreezeUpdateFileHashDoesNotMatch;case 270:return Status.NoUpgradeHasBeenPrepared;case 271:return Status.NoFreezeIsScheduled;case 272:return Status.UpdateFileHashChangedSincePrepareUpgrade;case 273:return Status.FreezeStartTimeMustBeFuture;case 274:return Status.PreparedUpdateFileIsImmutable;case 275:return Status.FreezeAlreadyScheduled;case 276:return Status.FreezeUpgradeInProgress;case 277:return Status.UpdateFileIdDoesNotMatchPrepared;case 278:return Status.UpdateFileHashDoesNotMatchPrepared;case 279:return Status.ConsensusGasExhausted;case 280:return Status.RevertedSuccess;case 281:return Status.MaxStorageInPriceRegimeHasBeenUsed;case 282:return Status.InvalidAliasKey;case 283:return Status.UnexpectedTokenDecimals;case 284:return Status.InvalidProxyAccountId;case 285:return Status.InvalidTransferAccountId;case 286:return Status.InvalidFeeCollectorAccountId;case 287:return Status.AliasIsImmutable;case 288:return Status.SpenderAccountSameAsOwner;case 289:return Status.AmountExceedsTokenMaxSupply;case 290:return Status.NegativeAllowanceAmount;case 291:return Status.CannotApproveForAllFungibleCommon;case 292:return Status.SpenderDoesNotHaveAllowance;case 293:return Status.AmountExceedsAllowance;case 294:return Status.MaxAllowancesExceeded;case 295:return Status.EmptyAllowances;case 296:return Status.SpenderAccountRepeatedInAllowances;case 297:return Status.RepeatedSerialNumsInNftAllowances;case 298:return Status.FungibleTokenInNftAllowances;case 299:return Status.NftInFungibleTokenAllowances;case 300:return Status.InvalidAllowanceOwnerId;case 301:return Status.InvalidAllowanceSpenderId;case 302:return Status.RepeatedAllowancesToDelete;case 303:return Status.InvalidDelegatingSpender;case 304:return Status.DelegatingSpenderCannotGrantApproveForAll;case 305:return Status.DelegatingSpenderDoesNotHaveApproveForAll;case 306:return Status.ScheduleExpirationTimeTooFarInFuture;case 307:return Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime;case 308:return Status.ScheduleFutureThrottleExceeded;case 309:return Status.ScheduleFutureGasLimitExceeded;case 310:return Status.InvalidEthereumTransaction;case 311:return Status.WrongChainId;case 312:return Status.WrongNonce;case 313:return Status.AccessListUnsupported;case 314:return Status.SchedulePendingExpiration;case 315:return Status.ContractIsTokenTreasury;case 316:return Status.ContractHasNonZeroTokenBalances;case 317:return Status.ContractExpiredAndPendingRemoval;case 318:return Status.ContractHasNoAutoRenewAccount;case 319:return Status.PermanentRemovalRequiresSystemInitiation;case 320:return Status.ProxyAccountIdFieldIsDeprecated;case 321:return Status.SelfStakingIsNotAllowed;case 322:return Status.InvalidStakingId;case 323:return Status.StakingNotEnabled;case 324:return Status.InvalidPrngRange;case 325:return Status.MaxEntitiesInPriceRegimeHaveBeenCreated;case 326:return Status.InvalidFullPrefixSignatureForPrecompile;case 327:return Status.InsufficientBalancesForStorageRent;case 328:return Status.MaxChildRecordsExceeded;case 329:return Status.InsufficientBalancesForRenewalFees;case 330:return Status.TransactionHasUnknownFields;case 331:return Status.AccountIsImmutable;case 332:return Status.AliasAlreadyAssigned;case 333:return Status.InvalidMetadataKey;case 334:return Status.TokenHasNoMetadataKey;case 335:return Status.MissingTokenMetadata;case 336:return Status.MissingSerialNumbers;case 337:return Status.TokenHasNoAdminKey;case 338:return Status.NodeDeleted;case 339:return Status.InvalidNodeId;case 340:return Status.InvalidGossipEndpoint;case 341:return Status.InvalidNodeAccountId;case 342:return Status.InvalidNodeDescription;case 343:return Status.InvalidServiceEndpoint;case 344:return Status.InvalidGossipCaCertificate;case 345:return Status.InvalidGrpcCertificate;case 346:return Status.InvalidMaxAutoAssociations;case 347:return Status.MaxNodesCreated;case 348:return Status.IpFqdnCannotBeSetForSameEndpoint;case 349:return Status.GossipEndpointCannotHaveFqdn;case 350:return Status.FqdnSizeTooLarge;case 351:return Status.InvalidEndpoint;case 352:return Status.GossipEndpointsExceededLimit;case 353:return Status.TokenReferenceRepeated;case 354:return Status.InvalidOwnerId;case 355:return Status.TokenReferenceListSizeLimitExceeded;case 356:return Status.ServiceEndpointsExceededLimit;case 357:return Status.InvalidIpv4Address;case 358:return Status.EmptyTokenReferenceList;case 359:return Status.UpdateNodeAccountNotAllowed;case 360:return Status.TokenHasNoMetadataOrSupplyKey;case 361:return Status.EmptyPendingAirdropIdList;case 362:return Status.PendingAirdropIdRepeated;case 363:return Status.MaxPendingAirdropIdExceeded;case 364:return Status.PendingNftAirdropAlreadyExists;case 365:return Status.AccountHasPendingAirdrops;case 366:return Status.ThrottledAtConsensus;case 367:return Status.InvalidPendingAirdropId;case 368:return Status.TokenAirdropWithFallbackRoyalty;case 369:return Status.InvalidTokenInPendingAirdrop;case 370:return Status.ScheduleExpiryIsBusy;case 371:return Status.InvalidGrpcCertificateHash;case 372:return Status.MissingExpiryTime;case 373:return Status.NoSchedulingAllowedAfterScheduledRecursion;case 374:return Status.RecursiveSchedulingLimitReached;case 375:return Status.WaitingForLedgerId;case 376:return Status.MaxEntriesForFeeExemptKeyListExceeded;case 377:return Status.FeeExemptKeyListContainsDuplicatedKeys;case 378:return Status.InvalidKeyInFeeExemptKeyList;case 379:return Status.InvalidFeeScheduleKey;case 380:return Status.FeeScheduleKeyCannotBeUpdated;case 381:return Status.FeeScheduleKeyNotSet;case 382:return Status.MaxCustomFeeLimitExceeded;case 383:return Status.NoValidMaxCustomFee;case 384:return Status.InvalidMaxCustomFees;case 385:return Status.DuplicateDenominationInMaxCustomFeeList;case 386:return Status.DuplicateAccountIdInMaxCustomFeeList;case 387:return Status.MaxCustomFeesIsNotSupported;case 388:return Status.BatchListEmpty;case 389:return Status.BatchListContainsDuplicates;case 390:return Status.BatchTransactionInBlacklist;case 391:return Status.InnerTransactionFailed;case 392:return Status.MissingBatchKey;case 393:return Status.BatchKeySetOnNonInnerTransaction;case 394:return Status.InvalidBatchKey;case 395:return Status.ScheduleExpiryNotConfigurable;case 396:return Status.CreatingSystemEntities;case 397:return Status.ThrottleGroupLcmOverflow;case 398:return Status.AirdropContainsMultipleSendersForAToken;case 399:return Status.GrpcWebProxyNotSupported;case 400:return Status.NftTransfersOnlyAllowedForNonFungibleUnique;case 401:return Status.InvalidSerializedTxMessageHashAlgorithm;case 499:return Status.WrongHookEntityType;case 500:return Status.EvmHookGasThrottled;case 501:return Status.HookIdInUse;case 502:return Status.BadHookRequest;case 503:return Status.RejectedByAccountAllowanceHook;case 504:return Status.HookNotFound;case 505:return Status.LambdaStorageUpdateBytesTooLong;case 506:return Status.LambdaStorageUpdateBytesMustUseMinimalRepresentation;case 507:return Status.InvalidHookId;case 508:return Status.EmptyLambdaStorageUpdate;case 509:return Status.HookIdRepeatedInCreationDetails;case 510:return Status.HooksNotEnabled;case 511:return Status.HookIsNotALambda;case 512:return Status.HookDeleted;case 513:return Status.TooManyLambdaStorageUpdates;case 514:return Status.HookCreationBytesMustUseMinimalRepresentation;case 515:return Status.HookCreationBytesTooLong;case 516:return Status.InvalidHookCreationSpec;case 517:return Status.HookExtensionEmpty;case 518:return Status.InvalidHookAdminKey;case 519:return Status.HookDeletionRequiresZeroStorageSlots;case 520:return Status.CannotSetHooksAndApproval;case 521:return Status.TransactionRequiresZeroHooks;case 522:return Status.InvalidHookCall;case 523:return Status.HooksAreNotSupportedInAirdrops;case 524:return Status.AccountIsLinkedToANode;case 525:return Status.HooksExecutionsRequireTopLevelCryptoTransfer;case 526:return Status.NodeAccountHasZeroBalance;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}Status.Ok=new Status(0),Status.InvalidTransaction=new Status(1),Status.PayerAccountNotFound=new Status(2),Status.InvalidNodeAccount=new Status(3),Status.TransactionExpired=new Status(4),Status.InvalidTransactionStart=new Status(5),Status.InvalidTransactionDuration=new Status(6),Status.InvalidSignature=new Status(7),Status.MemoTooLong=new Status(8),Status.InsufficientTxFee=new Status(9),Status.InsufficientPayerBalance=new Status(10),Status.DuplicateTransaction=new Status(11),Status.Busy=new Status(12),Status.NotSupported=new Status(13),Status.InvalidFileId=new Status(14),Status.InvalidAccountId=new Status(15),Status.InvalidContractId=new Status(16),Status.InvalidTransactionId=new Status(17),Status.ReceiptNotFound=new Status(18),Status.RecordNotFound=new Status(19),Status.InvalidSolidityId=new Status(20),Status.Unknown=new Status(21),Status.Success=new Status(22),Status.FailInvalid=new Status(23),Status.FailFee=new Status(24),Status.FailBalance=new Status(25),Status.KeyRequired=new Status(26),Status.BadEncoding=new Status(27),Status.InsufficientAccountBalance=new Status(28),Status.InvalidSolidityAddress=new Status(29),Status.InsufficientGas=new Status(30),Status.ContractSizeLimitExceeded=new Status(31),Status.LocalCallModificationException=new Status(32),Status.ContractRevertExecuted=new Status(33),Status.ContractExecutionException=new Status(34),Status.InvalidReceivingNodeAccount=new Status(35),Status.MissingQueryHeader=new Status(36),Status.AccountUpdateFailed=new Status(37),Status.InvalidKeyEncoding=new Status(38),Status.NullSolidityAddress=new Status(39),Status.ContractUpdateFailed=new Status(40),Status.InvalidQueryHeader=new Status(41),Status.InvalidFeeSubmitted=new Status(42),Status.InvalidPayerSignature=new Status(43),Status.KeyNotProvided=new Status(44),Status.InvalidExpirationTime=new Status(45),Status.NoWaclKey=new Status(46),Status.FileContentEmpty=new Status(47),Status.InvalidAccountAmounts=new Status(48),Status.EmptyTransactionBody=new Status(49),Status.InvalidTransactionBody=new Status(50),Status.InvalidSignatureTypeMismatchingKey=new Status(51),Status.InvalidSignatureCountMismatchingKey=new Status(52),Status.EmptyLiveHashBody=new Status(53),Status.EmptyLiveHash=new Status(54),Status.EmptyLiveHashKeys=new Status(55),Status.InvalidLiveHashSize=new Status(56),Status.EmptyQueryBody=new Status(57),Status.EmptyLiveHashQuery=new Status(58),Status.LiveHashNotFound=new Status(59),Status.AccountIdDoesNotExist=new Status(60),Status.LiveHashAlreadyExists=new Status(61),Status.InvalidFileWacl=new Status(62),Status.SerializationFailed=new Status(63),Status.TransactionOversize=new Status(64),Status.TransactionTooManyLayers=new Status(65),Status.ContractDeleted=new Status(66),Status.PlatformNotActive=new Status(67),Status.KeyPrefixMismatch=new Status(68),Status.PlatformTransactionNotCreated=new Status(69),Status.InvalidRenewalPeriod=new Status(70),Status.InvalidPayerAccountId=new Status(71),Status.AccountDeleted=new Status(72),Status.FileDeleted=new Status(73),Status.AccountRepeatedInAccountAmounts=new Status(74),Status.SettingNegativeAccountBalance=new Status(75),Status.ObtainerRequired=new Status(76),Status.ObtainerSameContractId=new Status(77),Status.ObtainerDoesNotExist=new Status(78),Status.ModifyingImmutableContract=new Status(79),Status.FileSystemException=new Status(80),Status.AutorenewDurationNotInRange=new Status(81),Status.ErrorDecodingBytestring=new Status(82),Status.ContractFileEmpty=new Status(83),Status.ContractBytecodeEmpty=new Status(84),Status.InvalidInitialBalance=new Status(85),Status.InvalidReceiveRecordThreshold=new Status(86),Status.InvalidSendRecordThreshold=new Status(87),Status.AccountIsNotGenesisAccount=new Status(88),Status.PayerAccountUnauthorized=new Status(89),Status.InvalidFreezeTransactionBody=new Status(90),Status.FreezeTransactionBodyNotFound=new Status(91),Status.TransferListSizeLimitExceeded=new Status(92),Status.ResultSizeLimitExceeded=new Status(93),Status.NotSpecialAccount=new Status(94),Status.ContractNegativeGas=new Status(95),Status.ContractNegativeValue=new Status(96),Status.InvalidFeeFile=new Status(97),Status.InvalidExchangeRateFile=new Status(98),Status.InsufficientLocalCallGas=new Status(99),Status.EntityNotAllowedToDelete=new Status(100),Status.AuthorizationFailed=new Status(101),Status.FileUploadedProtoInvalid=new Status(102),Status.FileUploadedProtoNotSavedToDisk=new Status(103),Status.FeeScheduleFilePartUploaded=new Status(104),Status.ExchangeRateChangeLimitExceeded=new Status(105),Status.MaxContractStorageExceeded=new Status(106),Status.TransferAccountSameAsDeleteAccount=new Status(107),Status.TotalLedgerBalanceInvalid=new Status(108),Status.ExpirationReductionNotAllowed=new Status(110),Status.MaxGasLimitExceeded=new Status(111),Status.MaxFileSizeExceeded=new Status(112),Status.ReceiverSigRequired=new Status(113),Status.InvalidTopicId=new Status(150),Status.InvalidAdminKey=new Status(155),Status.InvalidSubmitKey=new Status(156),Status.Unauthorized=new Status(157),Status.InvalidTopicMessage=new Status(158),Status.InvalidAutorenewAccount=new Status(159),Status.AutorenewAccountNotAllowed=new Status(160),Status.TopicExpired=new Status(162),Status.InvalidChunkNumber=new Status(163),Status.InvalidChunkTransactionId=new Status(164),Status.AccountFrozenForToken=new Status(165),Status.TokensPerAccountLimitExceeded=new Status(166),Status.InvalidTokenId=new Status(167),Status.InvalidTokenDecimals=new Status(168),Status.InvalidTokenInitialSupply=new Status(169),Status.InvalidTreasuryAccountForToken=new Status(170),Status.InvalidTokenSymbol=new Status(171),Status.TokenHasNoFreezeKey=new Status(172),Status.TransfersNotZeroSumForToken=new Status(173),Status.MissingTokenSymbol=new Status(174),Status.TokenSymbolTooLong=new Status(175),Status.AccountKycNotGrantedForToken=new Status(176),Status.TokenHasNoKycKey=new Status(177),Status.InsufficientTokenBalance=new Status(178),Status.TokenWasDeleted=new Status(179),Status.TokenHasNoSupplyKey=new Status(180),Status.TokenHasNoWipeKey=new Status(181),Status.InvalidTokenMintAmount=new Status(182),Status.InvalidTokenBurnAmount=new Status(183),Status.TokenNotAssociatedToAccount=new Status(184),Status.CannotWipeTokenTreasuryAccount=new Status(185),Status.InvalidKycKey=new Status(186),Status.InvalidWipeKey=new Status(187),Status.InvalidFreezeKey=new Status(188),Status.InvalidSupplyKey=new Status(189),Status.MissingTokenName=new Status(190),Status.TokenNameTooLong=new Status(191),Status.InvalidWipingAmount=new Status(192),Status.TokenIsImmutable=new Status(193),Status.TokenAlreadyAssociatedToAccount=new Status(194),Status.TransactionRequiresZeroTokenBalances=new Status(195),Status.AccountIsTreasury=new Status(196),Status.TokenIdRepeatedInTokenList=new Status(197),Status.TokenTransferListSizeLimitExceeded=new Status(198),Status.EmptyTokenTransferBody=new Status(199),Status.EmptyTokenTransferAccountAmounts=new Status(200),Status.InvalidScheduleId=new Status(201),Status.ScheduleIsImmutable=new Status(202),Status.InvalidSchedulePayerId=new Status(203),Status.InvalidScheduleAccountId=new Status(204),Status.NoNewValidSignatures=new Status(205),Status.UnresolvableRequiredSigners=new Status(206),Status.ScheduledTransactionNotInWhitelist=new Status(207),Status.SomeSignaturesWereInvalid=new Status(208),Status.TransactionIdFieldNotAllowed=new Status(209),Status.IdenticalScheduleAlreadyCreated=new Status(210),Status.InvalidZeroByteInString=new Status(211),Status.ScheduleAlreadyDeleted=new Status(212),Status.ScheduleAlreadyExecuted=new Status(213),Status.MessageSizeTooLarge=new Status(214),Status.OperationRepeatedInBucketGroups=new Status(215),Status.BucketCapacityOverflow=new Status(216),Status.NodeCapacityNotSufficientForOperation=new Status(217),Status.BucketHasNoThrottleGroups=new Status(218),Status.ThrottleGroupHasZeroOpsPerSec=new Status(219),Status.SuccessButMissingExpectedOperation=new Status(220),Status.UnparseableThrottleDefinitions=new Status(221),Status.InvalidThrottleDefinitions=new Status(222),Status.AccountExpiredAndPendingRemoval=new Status(223),Status.InvalidTokenMaxSupply=new Status(224),Status.InvalidTokenNftSerialNumber=new Status(225),Status.InvalidNftId=new Status(226),Status.MetadataTooLong=new Status(227),Status.BatchSizeLimitExceeded=new Status(228),Status.InvalidQueryRange=new Status(229),Status.FractionDividesByZero=new Status(230),Status.InsufficientPayerBalanceForCustomFee=new Status(231),Status.CustomFeesListTooLong=new Status(232),Status.InvalidCustomFeeCollector=new Status(233),Status.InvalidTokenIdInCustomFees=new Status(234),Status.TokenNotAssociatedToFeeCollector=new Status(235),Status.TokenMaxSupplyReached=new Status(236),Status.SenderDoesNotOwnNftSerialNo=new Status(237),Status.CustomFeeNotFullySpecified=new Status(238),Status.CustomFeeMustBePositive=new Status(239),Status.TokenHasNoFeeScheduleKey=new Status(240),Status.CustomFeeOutsideNumericRange=new Status(241),Status.RoyaltyFractionCannotExceedOne=new Status(242),Status.FractionalFeeMaxAmountLessThanMinAmount=new Status(243),Status.CustomScheduleAlreadyHasNoFees=new Status(244),Status.CustomFeeDenominationMustBeFungibleCommon=new Status(245),Status.CustomFractionalFeeOnlyAllowedForFungibleCommon=new Status(246),Status.InvalidCustomFeeScheduleKey=new Status(247),Status.InvalidTokenMintMetadata=new Status(248),Status.InvalidTokenBurnMetadata=new Status(249),Status.CurrentTreasuryStillOwnsNfts=new Status(250),Status.AccountStillOwnsNfts=new Status(251),Status.TreasuryMustOwnBurnedNft=new Status(252),Status.AccountDoesNotOwnWipedNft=new Status(253),Status.AccountAmountTransfersOnlyAllowedForFungibleCommon=new Status(254),Status.MaxNftsInPriceRegimeHaveBeenMinted=new Status(255),Status.PayerAccountDeleted=new Status(256),Status.CustomFeeChargingExceededMaxRecursionDepth=new Status(257),Status.CustomFeeChargingExceededMaxAccountAmounts=new Status(258),Status.InsufficientSenderAccountBalanceForCustomFee=new Status(259),Status.SerialNumberLimitReached=new Status(260),Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique=new Status(261),Status.NoRemainingAutomaticAssociations=new Status(262),Status.ExistingAutomaticAssociationsExceedGivenLimit=new Status(263),Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit=new Status(264),Status.TokenIsPaused=new Status(265),Status.TokenHasNoPauseKey=new Status(266),Status.InvalidPauseKey=new Status(267),Status.FreezeUpdateFileDoesNotExist=new Status(268),Status.FreezeUpdateFileHashDoesNotMatch=new Status(269),Status.NoUpgradeHasBeenPrepared=new Status(270),Status.NoFreezeIsScheduled=new Status(271),Status.UpdateFileHashChangedSincePrepareUpgrade=new Status(272),Status.FreezeStartTimeMustBeFuture=new Status(273),Status.PreparedUpdateFileIsImmutable=new Status(274),Status.FreezeAlreadyScheduled=new Status(275),Status.FreezeUpgradeInProgress=new Status(276),Status.UpdateFileIdDoesNotMatchPrepared=new Status(277),Status.UpdateFileHashDoesNotMatchPrepared=new Status(278),Status.ConsensusGasExhausted=new Status(279),Status.RevertedSuccess=new Status(280),Status.MaxStorageInPriceRegimeHasBeenUsed=new Status(281),Status.InvalidAliasKey=new Status(282),Status.UnexpectedTokenDecimals=new Status(283),Status.InvalidProxyAccountId=new Status(284),Status.InvalidTransferAccountId=new Status(285),Status.InvalidFeeCollectorAccountId=new Status(286),Status.AliasIsImmutable=new Status(287),Status.SpenderAccountSameAsOwner=new Status(288),Status.AmountExceedsTokenMaxSupply=new Status(289),Status.NegativeAllowanceAmount=new Status(290),Status.CannotApproveForAllFungibleCommon=new Status(291),Status.SpenderDoesNotHaveAllowance=new Status(292),Status.AmountExceedsAllowance=new Status(293),Status.MaxAllowancesExceeded=new Status(294),Status.EmptyAllowances=new Status(295),Status.SpenderAccountRepeatedInAllowances=new Status(296),Status.RepeatedSerialNumsInNftAllowances=new Status(297),Status.FungibleTokenInNftAllowances=new Status(298),Status.NftInFungibleTokenAllowances=new Status(299),Status.InvalidAllowanceOwnerId=new Status(300),Status.InvalidAllowanceSpenderId=new Status(301),Status.RepeatedAllowancesToDelete=new Status(302),Status.InvalidDelegatingSpender=new Status(303),Status.DelegatingSpenderCannotGrantApproveForAll=new Status(304),Status.DelegatingSpenderDoesNotHaveApproveForAll=new Status(305),Status.ScheduleExpirationTimeTooFarInFuture=new Status(306),Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime=new Status(307),Status.ScheduleFutureThrottleExceeded=new Status(308),Status.ScheduleFutureGasLimitExceeded=new Status(309),Status.InvalidEthereumTransaction=new Status(310),Status.WrongChainId=new Status(311),Status.WrongNonce=new Status(312),Status.AccessListUnsupported=new Status(313),Status.SchedulePendingExpiration=new Status(314),Status.ContractIsTokenTreasury=new Status(315),Status.ContractHasNonZeroTokenBalances=new Status(316),Status.ContractExpiredAndPendingRemoval=new Status(317),Status.ContractHasNoAutoRenewAccount=new Status(318),Status.PermanentRemovalRequiresSystemInitiation=new Status(319),Status.ProxyAccountIdFieldIsDeprecated=new Status(320),Status.SelfStakingIsNotAllowed=new Status(321),Status.InvalidStakingId=new Status(322),Status.StakingNotEnabled=new Status(323),Status.InvalidPrngRange=new Status(324),Status.MaxEntitiesInPriceRegimeHaveBeenCreated=new Status(325),Status.InvalidFullPrefixSignatureForPrecompile=new Status(326),Status.InsufficientBalancesForStorageRent=new Status(327),Status.MaxChildRecordsExceeded=new Status(328),Status.InsufficientBalancesForRenewalFees=new Status(329),Status.TransactionHasUnknownFields=new Status(330),Status.AccountIsImmutable=new Status(331),Status.AliasAlreadyAssigned=new Status(332),Status.InvalidMetadataKey=new Status(333),Status.TokenHasNoMetadataKey=new Status(334),Status.MissingTokenMetadata=new Status(335),Status.MissingSerialNumbers=new Status(336),Status.TokenHasNoAdminKey=new Status(337),Status.NodeDeleted=new Status(338),Status.InvalidNodeId=new Status(339),Status.InvalidGossipEndpoint=new Status(340),Status.InvalidNodeAccountId=new Status(341),Status.InvalidNodeDescription=new Status(342),Status.InvalidServiceEndpoint=new Status(343),Status.InvalidGossipCaCertificate=new Status(344),Status.InvalidGrpcCertificate=new Status(345),Status.InvalidMaxAutoAssociations=new Status(346),Status.MaxNodesCreated=new Status(347),Status.IpFqdnCannotBeSetForSameEndpoint=new Status(348),Status.GossipEndpointCannotHaveFqdn=new Status(349),Status.FqdnSizeTooLarge=new Status(350),Status.InvalidEndpoint=new Status(351),Status.GossipEndpointsExceededLimit=new Status(352),Status.TokenReferenceRepeated=new Status(353),Status.InvalidOwnerId=new Status(354),Status.TokenReferenceListSizeLimitExceeded=new Status(355),Status.ServiceEndpointsExceededLimit=new Status(356),Status.InvalidIpv4Address=new Status(357),Status.EmptyTokenReferenceList=new Status(358),Status.UpdateNodeAccountNotAllowed=new Status(359),Status.TokenHasNoMetadataOrSupplyKey=new Status(360),Status.EmptyPendingAirdropIdList=new Status(361),Status.PendingAirdropIdRepeated=new Status(362),Status.MaxPendingAirdropIdExceeded=new Status(363),Status.PendingNftAirdropAlreadyExists=new Status(364),Status.AccountHasPendingAirdrops=new Status(365),Status.ThrottledAtConsensus=new Status(366),Status.InvalidPendingAirdropId=new Status(367),Status.TokenAirdropWithFallbackRoyalty=new Status(368),Status.InvalidTokenInPendingAirdrop=new Status(369),Status.ScheduleExpiryIsBusy=new Status(370),Status.InvalidGrpcCertificateHash=new Status(371),Status.MissingExpiryTime=new Status(372),Status.NoSchedulingAllowedAfterScheduledRecursion=new Status(373),Status.RecursiveSchedulingLimitReached=new Status(374),Status.WaitingForLedgerId=new Status(375),Status.MaxEntriesForFeeExemptKeyListExceeded=new Status(376),Status.FeeExemptKeyListContainsDuplicatedKeys=new Status(377),Status.InvalidKeyInFeeExemptKeyList=new Status(378),Status.InvalidFeeScheduleKey=new Status(379),Status.FeeScheduleKeyCannotBeUpdated=new Status(380),Status.FeeScheduleKeyNotSet=new Status(381),Status.MaxCustomFeeLimitExceeded=new Status(382),Status.NoValidMaxCustomFee=new Status(383),Status.InvalidMaxCustomFees=new Status(384),Status.DuplicateDenominationInMaxCustomFeeList=new Status(385),Status.DuplicateAccountIdInMaxCustomFeeList=new Status(386),Status.MaxCustomFeesIsNotSupported=new Status(387),Status.BatchListEmpty=new Status(388),Status.BatchListContainsDuplicates=new Status(389),Status.BatchTransactionInBlacklist=new Status(390),Status.InnerTransactionFailed=new Status(391),Status.MissingBatchKey=new Status(392),Status.BatchKeySetOnNonInnerTransaction=new Status(393),Status.InvalidBatchKey=new Status(394),Status.ScheduleExpiryNotConfigurable=new Status(395),Status.CreatingSystemEntities=new Status(396),Status.ThrottleGroupLcmOverflow=new Status(397),Status.AirdropContainsMultipleSendersForAToken=new Status(398),Status.GrpcWebProxyNotSupported=new Status(399),Status.NftTransfersOnlyAllowedForNonFungibleUnique=new Status(400),Status.InvalidSerializedTxMessageHashAlgorithm=new Status(401),Status.WrongHookEntityType=new Status(499),Status.EvmHookGasThrottled=new Status(500),Status.HookIdInUse=new Status(501),Status.BadHookRequest=new Status(502),Status.RejectedByAccountAllowanceHook=new Status(503),Status.HookNotFound=new Status(504),Status.LambdaStorageUpdateBytesTooLong=new Status(505),Status.LambdaStorageUpdateBytesMustUseMinimalRepresentation=new Status(506),Status.InvalidHookId=new Status(507),Status.EmptyLambdaStorageUpdate=new Status(508),Status.HookIdRepeatedInCreationDetails=new Status(509),Status.HooksNotEnabled=new Status(510),Status.HookIsNotALambda=new Status(511),Status.HookDeleted=new Status(512),Status.TooManyLambdaStorageUpdates=new Status(513),Status.HookCreationBytesMustUseMinimalRepresentation=new Status(514),Status.HookCreationBytesTooLong=new Status(515),Status.InvalidHookCreationSpec=new Status(516),Status.HookExtensionEmpty=new Status(517),Status.InvalidHookAdminKey=new Status(518),Status.HookDeletionRequiresZeroStorageSlots=new Status(519),Status.CannotSetHooksAndApproval=new Status(520),Status.TransactionRequiresZeroHooks=new Status(521),Status.InvalidHookCall=new Status(522),Status.HooksAreNotSupportedInAirdrops=new Status(523),Status.AccountIsLinkedToANode=new Status(524),Status.HooksExecutionsRequireTopLevelCryptoTransfer=new Status(525),Status.NodeAccountHasZeroBalance=new Status(526);class GrpcStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){switch(e){case 0:return GrpcStatus.Ok;case 1:return GrpcStatus.Cancelled;case 2:return GrpcStatus.Unknown;case 3:return GrpcStatus.InvalidArgument;case 4:return GrpcStatus.DeadlineExceeded;case 5:return GrpcStatus.NotFound;case 6:return GrpcStatus.AlreadyExists;case 7:return GrpcStatus.PermissionDenied;case 8:return GrpcStatus.ResourceExhausted;case 9:return GrpcStatus.FailedPrecondition;case 10:return GrpcStatus.Aborted;case 11:return GrpcStatus.OutOfRange;case 12:return GrpcStatus.Unimplemented;case 13:return GrpcStatus.Internal;case 14:return GrpcStatus.Unavailable;case 15:return GrpcStatus.DataLoss;case 16:return GrpcStatus.Unauthenticated;case 17:return GrpcStatus.Timeout;case 18:return GrpcStatus.GrpcWeb;default:throw new Error("(BUG) non-exhaustive GrpcStatus switch statement")}}toString(){switch(this){case GrpcStatus.Ok:return"OK";case GrpcStatus.Cancelled:return"CANCELLED";case GrpcStatus.Unknown:return"UNKNOWN";case GrpcStatus.InvalidArgument:return"INVALID_ARGUMENT";case GrpcStatus.DeadlineExceeded:return"DEADLINE_EXCEEDED";case GrpcStatus.NotFound:return"NOT_FOUND";case GrpcStatus.AlreadyExists:return"ALREADY_EXISTS";case GrpcStatus.PermissionDenied:return"PERMISSION_DENIED";case GrpcStatus.Unauthenticated:return"UNAUTHENTICATED";case GrpcStatus.ResourceExhausted:return"RESOURCE_EXHAUSTED";case GrpcStatus.FailedPrecondition:return"FAILED_PRECONDITION";case GrpcStatus.Aborted:return"ABORTED";case GrpcStatus.OutOfRange:return"OUT_OF_RANGE";case GrpcStatus.Unimplemented:return"UNIMPLEMENTED";case GrpcStatus.Internal:return"INTERNAL";case GrpcStatus.Unavailable:return"UNAVAILABLE";case GrpcStatus.DataLoss:return"DATA_LOSS";case GrpcStatus.Timeout:return"TIMEOUT";case GrpcStatus.GrpcWeb:return"GRPC_WEB";default:return`UNKNOWN (${this._code})`}}valueOf(){return this._code}}GrpcStatus.Ok=new GrpcStatus(0),GrpcStatus.Cancelled=new GrpcStatus(1),GrpcStatus.Unknown=new GrpcStatus(2),GrpcStatus.InvalidArgument=new GrpcStatus(3),GrpcStatus.DeadlineExceeded=new GrpcStatus(4),GrpcStatus.NotFound=new GrpcStatus(5),GrpcStatus.AlreadyExists=new GrpcStatus(6),GrpcStatus.PermissionDenied=new GrpcStatus(7),GrpcStatus.ResourceExhausted=new GrpcStatus(8),GrpcStatus.FailedPrecondition=new GrpcStatus(9),GrpcStatus.Aborted=new GrpcStatus(10),GrpcStatus.OutOfRange=new GrpcStatus(11),GrpcStatus.Unimplemented=new GrpcStatus(12),GrpcStatus.Internal=new GrpcStatus(13),GrpcStatus.Unavailable=new GrpcStatus(14),GrpcStatus.DataLoss=new GrpcStatus(15),GrpcStatus.Unauthenticated=new GrpcStatus(16),GrpcStatus.Timeout=new GrpcStatus(17),GrpcStatus.GrpcWeb=new GrpcStatus(18);class GrpcServiceError extends Error{constructor(e,t){super(`gRPC service failed with: Status: ${e.toString()}, Code: ${e.valueOf()}`),this.status=e,this.nodeAccountId=t,this.name="GrpcServiceError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,GrpcServiceError)}static _fromResponse(e){if(null!=e.code&&null!=e.details){const t=GrpcStatus._fromValue(e.code),n=new GrpcServiceError(t);return n.stack+=`\nCaused by: ${e.stack?e.stack.toString():""}`,n.message+=`: ${e.details}`,n}return e}toString(){return`${this.name}: ${this.message}`}}class HttpStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){return new HttpStatus(e)}toString(){return this._code.toString()}valueOf(){return this._code}}class HttpError extends Error{constructor(e){super(`failed with error code: ${e.toString()}`),this.status=e,this.name="HttpError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,HttpError)}}class MaxAttemptsOrTimeoutError extends Error{constructor(e,t){super(e),this.nodeAccountId=t}toJSON(){return{message:this.message,nodeAccountId:this.nodeAccountId}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}const ExecutionState={Finished:"Finished",Retry:"Retry",Error:"Error"},RST_STREAM=/\brst[^0-9a-zA-Z]stream\b/i,DEFAULT_MAX_ATTEMPTS=10;class Executable{constructor(){this._maxAttempts=DEFAULT_MAX_ATTEMPTS,this._nodeAccountIds=new List,this.transactionNodeIds=[],this._signOnDemand=!1,this._minBackoff=null,this._maxBackoff=8e3,this._operator=null,this._requestTimeout=null,this._grpcDeadline=null,this._logger=null}get nodeAccountIds(){return this._nodeAccountIds.isEmpty?null:(this._nodeAccountIds.setLocked(),this._nodeAccountIds.list)}setNodeAccountIds(e){return this._nodeAccountIds.setList(e).setLocked(),this}get maxRetries(){return console.warn("Deprecated: use maxAttempts instead"),this.maxAttempts}setMaxRetries(e){return console.warn("Deprecated: use setMaxAttempts() instead"),this.setMaxAttempts(e)}get maxAttempts(){return this._maxAttempts}setMaxAttempts(e){return this._maxAttempts=e,this}get grpcDeadline(){return this._grpcDeadline}setGrpcDeadline(e){return this._grpcDeadline=e,this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(null!=this._maxBackoff&&e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(null!=this._minBackoff&&e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}_beforeExecute(e){throw new Error("not implemented")}_makeRequestAsync(){throw new Error("not implemented")}_mapStatusError(e,t,n){throw new Error("not implemented")}_mapResponse(e,t,n){throw new Error("not implemented")}_execute(e,t){throw new Error("not implemented")}_getTransactionId(){throw new Error("not implemented")}_getLogId(){throw new Error("not implemented")}_requestToBytes(e){throw new Error("not implemented")}_responseToBytes(e){throw new Error("not implemented")}_shouldRetry(e,t){throw new Error("not implemented")}_shouldRetryExceptionally(e){return!(e instanceof GrpcServiceError)||(e.status._code===GrpcStatus.Timeout._code||e.status._code===GrpcStatus.DeadlineExceeded._code||e.status._code===GrpcStatus.Unavailable._code||e.status._code===GrpcStatus.ResourceExhausted._code||e.status._code===GrpcStatus.GrpcWeb._code||e.status._code===GrpcStatus.Internal._code&&RST_STREAM.test(e.message))}_setOperatorWith(e,t,n){return this._operator={transactionSigner:n,accountId:e,publicKey:t},this}async executeWithSigner(e){return e.call(this)}isBatchedAndNotBatchTransaction(){return!1}async execute(e,t){const n=null!=e.network["127.0.0.1:50211"];if(this.isBatchedAndNotBatchTransaction())throw new Error("Cannot execute batchified transaction outside of BatchTransaction");this._logger=null==this._logger?null!=e._logger?e._logger:null:this._logger,null==this._requestTimeout&&(this._requestTimeout=null!=t?t:e.requestTimeout),null==this._grpcDeadline&&(this._grpcDeadline=e.grpcDeadline),await this._beforeExecute(e),null==this._maxBackoff&&(this._maxBackoff=e.maxBackoff),null==this._minBackoff&&(this._minBackoff=e.minBackoff);const r=Date.now();let o=null;const i=n?1e3:e._maxAttempts??this._maxAttempts;if(this.transactionNodeIds.length){const e=this._nodeAccountIds.list.map(e=>e.toString());if(!this.transactionNodeIds.some(t=>e.includes(t))){const t=e.length>2?`${e.slice(0,2).join(", ")} ...`:e.join(", "),n=1===e.length;throw new Error(`Attempting to execute a transaction against node${n?"":"s"} ${t}, which ${n?"is":"are"} not included in the Client's node list. Please review your Client configuration.`)}}for(let t=1;t<=i;t+=1){if(null!=this._requestTimeout&&r+this._requestTimeout<=Date.now())throw new MaxAttemptsOrTimeoutError("timeout exceeded",this._nodeAccountIds.isEmpty?"No node account ID set":this._nodeAccountIds.current.toString());let a,s;if(this._nodeAccountIds.isEmpty?(s=e._network.getNode(),a=s.accountId,this._nodeAccountIds.setList([a])):(a=this._nodeAccountIds.current,s=e._network.getNode(a)),null==s)throw new Error(`NodeAccountId not recognized: ${a.toString()}`);if(this.transactionNodeIds.length){if(!this.transactionNodeIds.includes(a.toString())){console.error(`Attempting to execute a transaction against node ${a.toString()}, which is not included in the Client's node list. Please review your Client configuration.`),this._nodeAccountIds.advance();continue}}const c=this._getLogId();this._logger&&this._logger.debug(`[${c}] Node AccountID: ${s.accountId.toString()}, IP: ${s.address.toString()}`);const u=s.getChannel();null!=this._grpcDeadline&&u.setGrpcDeadline(this._grpcDeadline);const l=await this._makeRequestAsync();let d;if(!s.isHealthy()){const e=this._nodeAccountIds.index===this._nodeAccountIds.list.length-1;if(isTransactionReceiptOrRecordRequest(l)||n){await delayForAttempt(n,t,this._minBackoff,this._maxBackoff);continue}if(e||this._nodeAccountIds.length<=1)throw new Error(`Network connectivity issue: All nodes are unhealthy. Original node list: ${this._nodeAccountIds.list.join(", ")}`);this._logger&&this._logger.debug(`[${c}] Node is not healthy, trying the next node.`),this._nodeAccountIds.advance();continue}this._nodeAccountIds.advance();try{const e=[];null!=this._grpcDeadline&&e.push(new Promise((e,t)=>setTimeout(()=>t(new GrpcServiceError(GrpcStatus.DeadlineExceeded)),this._grpcDeadline))),this._logger&&this._logger.trace(`[${this._getLogId()}] sending protobuf ${encode$5(this._requestToBytes(l))}`),e.push(this._execute(u,l)),d=await Promise.race(e)}catch(n){const r=GrpcServiceError._fromResponse(n);if(o=r,this._logger&&this._logger.debug(`[${c}] received error ${JSON.stringify(r)}`),(r instanceof GrpcServiceError||r instanceof HttpError)&&this._shouldRetryExceptionally(r)&&t<=i){this._logger&&this._logger.debug(`[${this._getLogId()}] node with accountId: ${s.accountId.toString()} and proxy IP: ${s.address.toString()} is unhealthy`),e._network.increaseBackoff(s);continue}throw n}this._logger&&this._logger.trace(`[${this._getLogId()}] sending protobuf ${encode$5(this._responseToBytes(d))}`),e._network.decreaseBackoff(s);const[p,h]=this._shouldRetry(l,d);switch(p.toString()!==Status.Ok.toString()&&p.toString()!==Status.Success.toString()&&(o=p),h){case ExecutionState.Retry:await delayForAttempt(n,t,this._minBackoff,this._maxBackoff);continue;case ExecutionState.Finished:return this._mapResponse(d,a,l);case ExecutionState.Error:throw this._mapStatusError(l,d,a);default:throw new Error("(BUG) non-exhaustive switch statement for `ExecutionState`")}}throw new MaxAttemptsOrTimeoutError(`max attempts of ${i.toString()} was reached for request with last error being: ${null!=o?o.toString():""}`,this._nodeAccountIds.current.toString())}toBytes(){throw new Error("not implemented")}setLogger(e){return this._logger=e,this}get logger(){return this._logger}}function isTransactionReceiptOrRecordRequest(e){return"object"==typeof e&&null!==e&&("transactionGetReceipt"in e||"transactionGetRecord"in e)}function delayForAttempt(e,t,n,r){if(e)return new Promise(e=>setTimeout(e,n));const o=Math.min(Math.floor(n*Math.pow(2,t)),r);return new Promise(e=>setTimeout(e,o))}class PrecheckStatusError extends StatusError{constructor(e){super(e,`transaction ${e.transactionId.toString()} failed precheck with status ${e.status.toString()} against node account id ${e.nodeId.toString()}`),this.contractFunctionResult=e.contractFunctionResult,this.nodeId=e.nodeId}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),nodeId:this.nodeId.toString(),message:this.message,contractFunctionResult:this.contractFunctionResult}}}class MaxQueryPaymentExceeded extends Error{constructor(e,t){super(),this.message=`query cost of ${e.toString()} HBAR exceeds max set on client: ${t.toString()} HBAR`,this.name="MaxQueryPaymentExceededError",this.queryCost=e,this.maxQueryPayment=t}}class QueryBase extends Executable{constructor(){super()}async _makePaymentTransaction(e,t,n,r){const o=[];null!=n?(o.push({accountID:n.accountId._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()})):(o.push({accountID:new AccountId(0)._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()}));const i={transactionID:e._toProtobuf(),nodeAccountID:t._toProtobuf(),transactionFee:new Hbar(1).toTinybars(),transactionValidDuration:{seconds:Long.fromNumber(120)},cryptoTransfer:{transfers:{accountAmounts:o}}},a={bodyBytes:libExports.proto.TransactionBody.encode(i).finish()};if(null!=n){const e=await n.transactionSigner(a.bodyBytes);a.sigMap={sigPair:[n.publicKey._toProtobufSignature(e)]}}return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(a).finish()}}}class CostQuery extends QueryBase{constructor(e){super(),this._query=e,this._grpcDeadline=e._grpcDeadline,this._requestTimeout=e._requestTimeout,this._nodeAccountIds=e._nodeAccountIds.clone(),this._operator=e._operator,this._header=null}_getTransactionId(){return this._query._getTransactionId()}_getLogId(){return`CostQuery:${this._query._getLogId()}`}async _beforeExecute(e){if(null==e)throw new Error("Cannot do CostQuery without Client");const t=null!=this._operator?this._operator:e._operator;if(null==t)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._query._nodeAccountIds.isEmpty&&this._query._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute());const n=TransactionId.generate(t.accountId);null==this._query.paymentTransactionId&&this._query.setPaymentTransactionId(n);const r=this._getLogId(),o=new AccountId(0),i=TransactionId.generate(new AccountId(0)),a=new Hbar(0);this._logger&&this._logger.debug(`[${r}] making a payment transaction for node ${o.toString()} and transaction ID ${i.toString()} with amount ${a.toString()}`),this._header={payment:await this._makePaymentTransaction(i,new AccountId(0),t,a),responseType:libExports.proto.ResponseType.COST_ANSWER}}_makeRequestAsync(){return Promise.resolve(this._query._onMakeRequest(this._header))}_shouldRetry(e,t){return this._query._shouldRetry(e,t)}_mapStatusError(e,t,n){return this._query._mapStatusError(e,t,n)}_mapResponse(e,t,n){const r=this._query._mapResponseHeader(e).cost;return Promise.resolve(Hbar.fromTinybars(r))}_execute(e,t){return this._query._execute(e,t)}_requestToBytes(e){return this._query._requestToBytes(e)}_responseToBytes(e){return this._query._responseToBytes(e)}}const QUERY_REGISTRY=new Map;class Query extends QueryBase{constructor(){super(),this._paymentTransactionId=null,this._paymentTransactions=[],this._queryPayment=null,this._maxQueryPayment=null,this._timestamp=Date.now()}static fromBytes(e){const t=libExports.proto.Query.decode(e);if(null==t.query)throw new Error("(BUG) query.query was not set in the protobuf");const n=QUERY_REGISTRY.get(t.query);if(null==n)throw new Error(`(BUG) Query.fromBytes() not implemented for type ${t.query}`);return n(t)}toBytes(){return libExports.proto.Query.encode(this._makeRequest()).finish()}setQueryPayment(e){return this._queryPayment=e,this}setMaxQueryPayment(e){return this._maxQueryPayment=e,this}async getCost(e){this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._timestamp=Date.now();const t=await new CostQuery(this).execute(e);return Hbar.fromTinybars(t._valueInTinybar.multipliedBy(1.1).toFixed(0))}setPaymentTransactionId(e){return this._paymentTransactionId=e,this}get paymentTransactionId(){return this._paymentTransactionId}_getTransactionId(){if(null==this._paymentTransactionId)throw new Error("Query.PaymentTransactionId was not set duration execution");return this._paymentTransactionId}_isPaymentRequired(){return!0}_validateChecksums(e){}async _beforeExecute(e){if(this._paymentTransactions.length>0)return;if(e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._operator=null!=this._operator?this._operator:e._operator,this._isPaymentRequired()){if(this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),null==this._operator)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._paymentTransactionId=TransactionId.generate(this._operator.accountId)}else this._paymentTransactionId=TransactionId.generate(new AccountId(0));let t=new Hbar(0);const n=null!=this._maxQueryPayment?this._maxQueryPayment:e.defaultMaxQueryPayment;if(null!=this._queryPayment)t=this._queryPayment;else if(0===this._paymentTransactions.length&&this._isPaymentRequired()){const r=await this.getCost(e);if(n.toTinybars().toInt()<r.toTinybars().toInt())throw new MaxQueryPaymentExceeded(r,n);t=r,this._logger&&this._logger.debug(`[${this._getLogId()}] received cost for query ${t.toString()}`)}this._queryPayment=t,this._timestamp=Date.now(),this._nodeAccountIds.setLocked();for(const e of this._nodeAccountIds.list){const t=this._getLogId(),n=this._paymentTransactionId,r=this._queryPayment;this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${e.toString()} and transaction ID ${n.toString()} with amount ${r.toString()}`),this._paymentTransactions.push(await this._makePaymentTransaction(n,e,this._isPaymentRequired()?this._operator:null,r))}}_mapResponseHeader(e){throw new Error("not implemented")}_makeRequestHeader(){let e={};return this._isPaymentRequired()&&this._paymentTransactions.length>0&&(e={responseType:libExports.proto.ResponseType.ANSWER_ONLY,payment:this._paymentTransactions[this._nodeAccountIds.index]}),e}_onMakeRequest(e){throw new Error("not implemented")}_makeRequest(){let e={};return this._isPaymentRequired()&&null!=this._paymentTransactions&&(e={payment:this._paymentTransactions[this._nodeAccountIds.index],responseType:libExports.proto.ResponseType.ANSWER_ONLY}),this._onMakeRequest(e)}async _makeRequestAsync(){let e={responseType:libExports.proto.ResponseType.ANSWER_ONLY};const t=this._getLogId(),n=this._nodeAccountIds.current,r=TransactionId.generate(this._operator?this._operator.accountId:new AccountId(0)),o=this._queryPayment;return this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${n.toString()} and transaction ID ${r.toString()} with amount ${o.toString()}`),e.payment=await this._makePaymentTransaction(r,n,this._isPaymentRequired()?this._operator:null,o),this._onMakeRequest(e)}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t),r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}_requestToBytes(e){return libExports.proto.Query.encode(e).finish()}_responseToBytes(e){return libExports.proto.Response.encode(e).finish()}}class ContractId extends Key{constructor(e,t,n,r){super();const o=constructor(e,t,n);this.shard=o.shard,this.realm=o.realm,this.num=o.num,this.evmAddress=null!=r?r:null,this._checksum=null}static fromEvmAddress(e,t,n){const r=EvmAddress.fromString(n),[o,i,a,s]=fromEvmAddress(e,t,r.toString());return new ContractId(o,i,a,s?.toBytes())}static fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm))throw new Error("invalid format for entity ID");const n=null!=t.shard?Long.fromString(t.shard):Long.ZERO,r=null!=t.realm?Long.fromString(t.realm):Long.ZERO,[o,i]=t.numOrHex.length<40?[Long.fromString(t.numOrHex),void 0]:[Long.ZERO,decode$8(t.numOrHex)];return new ContractId(n,r,o,i)}static _fromProtobuf(e){return new ContractId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.contractNum?e.contractNum:0)}get checksum(){return this._checksum}async populateAccountNum(e){const t=`${e.mirrorRestApiBaseUrl}/contracts/${this.toEvmAddress()}`,n=await fetch(t),r=(await n.json()).contract_id;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ContractId._fromProtobuf(libExports.proto.ContractID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$8(e))?new ContractId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?encode$5(this.evmAddress):toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress):toEvmAddress(this.num)}_toProtobuf(){return{contractNum:this.num,shardNum:this.shard,realmNum:this.realm,evmAddress:this.evmAddress}}toString(){return null!=this.evmAddress?`${this.shard.toString()}.${this.realm.toString()}.${encode$5(this.evmAddress)}`:`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ContractID.encode(this._toProtobuf()).finish()}clone(){const e=new ContractId(this);return e._checksum=this._checksum,e.evmAddress=this.evmAddress,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}equals(e){let t=!1;return null!=this.evmAddress&&null!=e.evmAddress&&(t=arrayEqual(this.evmAddress,e.evmAddress)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&this.num.eq(e.num)&&t}_toProtobufKey(){return{contractID:this._toProtobuf()}}static __fromProtobufKey(e){return ContractId._fromProtobuf(e)}}CACHE.setContractId(e=>ContractId.__fromProtobufKey(e));class FileId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static getAddressBookFileIdFor(e=0,t=0){return new FileId({num:102,shard:e,realm:t})}static getFeeScheduleFileIdFor(e=0,t=0){return new FileId({num:111,shard:e,realm:t})}static getExchangeRatesFileIdFor(e=0,t=0){return new FileId({num:112,shard:e,realm:t})}static fromString(e){const t=fromString(e),n=new FileId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new FileId(null!=e.shardNum?Long.fromString(e.shardNum.toString()):0,null!=e.realmNum?Long.fromString(e.realmNum.toString()):0,null!=e.fileNum?Long.fromString(e.fileNum.toString()):0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return FileId._fromProtobuf(libExports.proto.FileID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new FileId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("FileId.fromEvmAddress does not support non-long-zero addresses");const[r,o,i]=fromEvmAddress(e,t,n);return new FileId(r,o,i)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{fileNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.FileID.encode(this._toProtobuf()).finish()}clone(){const e=new FileId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}FileId.ADDRESS_BOOK=new FileId(102),FileId.FEE_SCHEDULE=new FileId(111),FileId.EXCHANGE_RATES=new FileId(112);class TopicId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TopicId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TopicId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.topicNum?e.topicNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TopicId._fromProtobuf(libExports.proto.TopicID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new TopicId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TopicId.fromEvmAddress does not support non-long-zero addresses");const[r,o,i]=fromEvmAddress(e,t,n);return new TopicId(r,o,i)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{topicNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TopicID.encode(this._toProtobuf()).finish()}clone(){const e=new TopicId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class TokenId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TokenId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TokenId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.tokenNum?e.tokenNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TokenId._fromProtobuf(libExports.proto.TokenID.decode(e))}static fromSolidityAddress(e){return new TokenId(...fromSolidityAddress(e))}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TokenId.fromEvmAddress does not support non-long-zero addresses");const[r,o,i]=fromEvmAddress(e,t,n);return new TokenId(r,o,i)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{tokenNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TokenID.encode(this._toProtobuf()).finish()}clone(){const e=new TokenId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ScheduleId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new ScheduleId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new ScheduleId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.scheduleNum?e.scheduleNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ScheduleId._fromProtobuf(libExports.proto.ScheduleID.decode(e))}static fromSolidityAddress(e){return new ScheduleId(...fromSolidityAddress(e))}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}_toProtobuf(){return{scheduleNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ScheduleID.encode(this._toProtobuf()).finish()}clone(){const e=new ScheduleId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ExchangeRate{constructor(e){this.hbars=e.hbars,this.cents=e.cents,this.expirationTime=e.expirationTime,this.exchangeRateInCents=e.cents/e.hbars,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRate({hbars:e.hbarEquiv,cents:e.centEquiv,expirationTime:new Date(null!=e.expirationTime&&null!=e.expirationTime.seconds?Long.isLong(e.expirationTime.seconds)?1e3*e.expirationTime.seconds.toInt():e.expirationTime.seconds:0)})}_toProtobuf(){return{hbarEquiv:this.hbars,centEquiv:this.cents,expirationTime:{seconds:Long.fromNumber(Math.trunc(this.expirationTime.getTime()/1e3))}}}toJSON(){return{hbars:this.hbars,cents:this.cents,expirationTime:this.expirationTime,exchangeRateInCents:this.exchangeRateInCents}}toString(){return JSON.stringify(this.toJSON())}}class TransactionReceipt{constructor(e){this.status=e.status,this.accountId=e.accountId,this.fileId=e.fileId,this.contractId=e.contractId,this.topicId=e.topicId,this.tokenId=e.tokenId,this.scheduleId=e.scheduleId,this.exchangeRate=e.exchangeRate,this.nextExchangeRate=e.nextExchangeRate,this.topicSequenceNumber=e.topicSequenceNumber,this.topicRunningHash=e.topicRunningHash,this.totalSupply=e.totalSupply,this.scheduledTransactionId=e.scheduledTransactionId,this.serials=e.serials??[],this.duplicates=e.duplicates??[],this.children=e.children??[],this.nodeId=e.nodeId,Object.freeze(this)}_toProtobuf(){return{duplicateTransactionReceipts:this.duplicates.map(e=>e._toProtobuf().receipt),childTransactionReceipts:this.children.map(e=>e._toProtobuf().receipt),receipt:{status:this.status.valueOf(),accountID:null!=this.accountId?this.accountId._toProtobuf():null,fileID:null!=this.fileId?this.fileId._toProtobuf():null,contractID:null!=this.contractId?this.contractId._toProtobuf():null,topicID:null!=this.topicId?this.topicId._toProtobuf():null,tokenID:null!=this.tokenId?this.tokenId._toProtobuf():null,scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,topicRunningHash:null==this.topicRunningHash?null:this.topicRunningHash,topicSequenceNumber:this.topicSequenceNumber,exchangeRate:{nextRate:null!=this.nextExchangeRate?this.nextExchangeRate._toProtobuf():null,currentRate:null!=this.exchangeRate?this.exchangeRate._toProtobuf():null},scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,serialNumbers:this.serials,newTotalSupply:this.totalSupply,nodeId:this.nodeId}}}static _fromProtobuf(e){const t=e.receipt,n=null!=e.childTransactionReceipts?e.childTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[],r=null!=e.duplicateTransactionReceipts?e.duplicateTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[];return new TransactionReceipt({status:Status._fromCode(null!=t.status?t.status:0),accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):null,fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):null,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):null,topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):null,tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):null,scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):null,exchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.currentRate):null,nextExchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.nextRate):null,topicSequenceNumber:null==t.topicSequenceNumber?null:Long.fromString(t.topicSequenceNumber.toString()),topicRunningHash:null!=t.topicRunningHash?new Uint8Array(t.topicRunningHash):null,totalSupply:null!=t.newTotalSupply?Long.fromString(t.newTotalSupply.toString()):null,scheduledTransactionId:null!=t.scheduledTransactionID?TransactionId._fromProtobuf(t.scheduledTransactionID):null,serials:null!=t.serialNumbers?t.serialNumbers.map(e=>Long.fromValue(e)):[],children:n,duplicates:r,nodeId:null!=t.nodeId?t.nodeId:null})}static fromBytes(e){return TransactionReceipt._fromProtobuf(libExports.proto.TransactionGetReceiptResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetReceiptResponse.encode(this._toProtobuf()).finish()}toJSON(){return{status:this.status.toString(),accountId:this.accountId?.toString()||null,filedId:this.fileId?.toString()||null,contractId:this.contractId?.toString()||null,topicId:this.topicId?.toString()||null,tokenId:this.tokenId?.toString()||null,scheduleId:this.scheduleId?.toString()||null,exchangeRate:this.exchangeRate?.toJSON()||null,nextExchangeRate:this.nextExchangeRate?.toJSON()||null,topicSequenceNumber:this.topicSequenceNumber?.toString()||null,topicRunningHash:null!=this.topicRunningHash?encode$5(this.topicRunningHash):null,totalSupply:this.totalSupply?.toString()||null,scheduledTransactionId:this.scheduledTransactionId?.toString()||null,serials:this.serials.map(e=>e.toString()),duplicates:this.duplicates.map(e=>e.toJSON()),children:this.children.map(e=>e.toJSON()),nodeId:this.nodeId?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}const{proto:proto$7}=HieroProto;class TransactionReceiptQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateStatus&&this.setValidateStatus(e.validateStatus)}static _fromProtobuf(e){const t=e.transactionGetReceipt;return new TransactionReceiptQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0,includeChildren:null!=t.includeChildReceipts?t.includeChildReceipts:void 0})}get transactionId(){return this._transactionId}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeDuplicates(e){return this._includeDuplicates=e,this}get includeDuplicates(){return null!=this._includeDuplicates&&this._includeDuplicates}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setValidateStatus(e){return this._validateStatus=e,this}get validateStatus(){return this._validateStatus}_isPaymentRequired(){return!1}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$7.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetReceipt.receipt.status;switch(r=Status._fromCode(o),this._logger&&this._logger.debug(`[${this._getLogId()}] received receipt status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:return[r,ExecutionState.Retry];case Status.Success:case Status.FeeScheduleFilePartUploaded:return[r,ExecutionState.Finished];default:return[r,this._validateStatus?ExecutionState.Error:ExecutionState.Finished]}}_getTransactionId(){return null!=this._transactionId?this._transactionId:super._getTransactionId()}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$7.ResponseCodeEnum.OK);if(o!==Status.Ok)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const i=t.transactionGetReceipt,a=i.receipt.status;if(o=Status._fromCode(a),null==this._transactionId)throw new Error("Failed to construct `ReceiptStatusError` because `transactionId` is `null`");return new ReceiptStatusError({status:o,transactionId:this._transactionId,transactionReceipt:TransactionReceipt._fromProtobuf(i)})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTransactionReceipts(t)}_mapResponseHeader(e){return e.transactionGetReceipt.header}_mapResponse(e,t,n){const r=e.transactionGetReceipt;return Promise.resolve(TransactionReceipt._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetReceipt:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeDuplicates:this._includeDuplicates,includeChildReceipts:this._includeChildren}}}_getLogId(){return`TransactionReceiptQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("transactionGetReceipt",TransactionReceiptQuery._fromProtobuf);class Transfer{constructor(e){this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e)t.push(new Transfer({accountId:AccountId._fromProtobuf(n.accountID),amount:Hbar.fromTinybars(null!=n.amount?n.amount:0),isApproved:n.isApproval}));return t}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars(),isApproval:this.isApproved}}toJSON(){return{accountId:this.accountId.toString(),amount:this.amount.toTinybars().toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class ContractLogInfo{constructor(e){this.contractId=e.contractId,this.bloom=e.bloom,this.topics=e.topics,this.data=e.data,Object.freeze(this)}static _fromProtobuf(e){return new ContractLogInfo({contractId:ContractId._fromProtobuf(e.contractID),bloom:null!=e.bloom?e.bloom:new Uint8Array,topics:null!=e.topic?e.topic:[],data:null!=e.data?e.data:new Uint8Array})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),bloom:this.bloom,topic:this.topics,data:this.data}}}function decode$1(e){return(new TextDecoder).decode(e)}function encode$1(e){return(new TextEncoder).encode(e)}var bn$1={exports:{}},bn=bn$1.exports,hasRequiredBn;function requireBn(){return hasRequiredBn||(hasRequiredBn=1,function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function c(e,t,r,o){for(var i=0,a=0,s=Math.min(e.length,r),c=t;c<s;c++){var u=e.charCodeAt(c)-48;i*=o,a=u>=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a<o,"Invalid character"),i+=a}return i}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,r):(this._parseBase(e,t,o),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,a,s=0;if("be"===r)for(o=e.length-1,i=0;o>=0;o-=3)a=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(o=0,i=0;o<e.length;o+=3)a=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var o,i=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,o=1;o<=67108863;o*=t)r++;r--,o=o/t|0;for(var i=e.length-n,a=i%r,s=Math.min(i,i-a)+n,u=0,l=n;l<s;l+=r)u=c(e,l,l+r,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){u(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var o=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<o|i)).toString(16);i=s>>>24-o&16777215,(o+=2)>=26&&(o-=26,a--),r=0!==i||a!==this.length-1?d[6-c.length]+c+r:c+r}for(0!==i&&(r=i.toString(16)+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=p[e],l=h[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var y=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?y+r:d[u-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},i&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(i,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var o=0|e.words[0],i=0|t.words[0],a=o*i,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var u=1;u<r;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(o=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var o=this.byteLength(),i=r||Math.max(1,o);n(o<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,o),a},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,o=0,i=0;o<this.length;o++){var a=this.words[o]<<i|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===i?(n<e.length&&(e[n++]=a>>24&255),r=0,i=0):(r=a>>>24,i+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,o=0,i=0;o<this.length;o++){var a=this.words[o]<<i|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===i?(n>=0&&(e[n--]=a>>24&255),r=0,i=0):(r=a>>>24,i+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 8191&t||(n+=13,t>>>=13),127&t||(n+=7,t>>>=7),15&t||(n+=4,t>>>=4),3&t||(n+=2,t>>>=2),1&t||n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return n(0===(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return n(0===(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return n(0===(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return r>0&&(this.words[o]=~this.words[o]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,o=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<o:this.words[r]&~(1<<o),this._strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var o=0,i=0;i<r.length;i++)t=(0|n.words[i])+(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<n.length;i++)t=(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;i<n.length;i++)this.words[i]=n.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)i=(t=(0|n.words[a])-(0|r.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<n.length;a++)i=(t=(0|n.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,o,i,a=e.words,s=t.words,c=n.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,y=h>>>13,m=0|a[2],g=8191&m,_=m>>>13,b=0|a[3],I=8191&b,T=b>>>13,k=0|a[4],S=8191&k,w=k>>>13,A=0|a[5],v=8191&A,E=A>>>13,O=0|a[6],N=8191&O,P=O>>>13,R=0|a[7],C=8191&R,D=R>>>13,B=0|a[8],L=8191&B,x=B>>>13,F=0|a[9],U=8191&F,K=F>>>13,M=0|s[0],H=8191&M,j=M>>>13,G=0|s[1],q=8191&G,V=G>>>13,$=0|s[2],z=8191&$,W=$>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,Z=0|s[4],J=8191&Z,ee=Z>>>13,te=0|s[5],ne=8191&te,re=te>>>13,oe=0|s[6],ie=8191&oe,ae=oe>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,ye=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,H))|0)+((8191&(o=(o=Math.imul(d,j))+Math.imul(p,H)|0))<<13)|0;u=((i=Math.imul(p,j))+(o>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(f,H),o=(o=Math.imul(f,j))+Math.imul(y,H)|0,i=Math.imul(y,j);var ge=(u+(r=r+Math.imul(d,q)|0)|0)+((8191&(o=(o=o+Math.imul(d,V)|0)+Math.imul(p,q)|0))<<13)|0;u=((i=i+Math.imul(p,V)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,H),o=(o=Math.imul(g,j))+Math.imul(_,H)|0,i=Math.imul(_,j),r=r+Math.imul(f,q)|0,o=(o=o+Math.imul(f,V)|0)+Math.imul(y,q)|0,i=i+Math.imul(y,V)|0;var _e=(u+(r=r+Math.imul(d,z)|0)|0)+((8191&(o=(o=o+Math.imul(d,W)|0)+Math.imul(p,z)|0))<<13)|0;u=((i=i+Math.imul(p,W)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(I,H),o=(o=Math.imul(I,j))+Math.imul(T,H)|0,i=Math.imul(T,j),r=r+Math.imul(g,q)|0,o=(o=o+Math.imul(g,V)|0)+Math.imul(_,q)|0,i=i+Math.imul(_,V)|0,r=r+Math.imul(f,z)|0,o=(o=o+Math.imul(f,W)|0)+Math.imul(y,z)|0,i=i+Math.imul(y,W)|0;var be=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(o=(o=o+Math.imul(d,X)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,X)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(S,H),o=(o=Math.imul(S,j))+Math.imul(w,H)|0,i=Math.imul(w,j),r=r+Math.imul(I,q)|0,o=(o=o+Math.imul(I,V)|0)+Math.imul(T,q)|0,i=i+Math.imul(T,V)|0,r=r+Math.imul(g,z)|0,o=(o=o+Math.imul(g,W)|0)+Math.imul(_,z)|0,i=i+Math.imul(_,W)|0,r=r+Math.imul(f,Q)|0,o=(o=o+Math.imul(f,X)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,X)|0;var Ie=(u+(r=r+Math.imul(d,J)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(v,H),o=(o=Math.imul(v,j))+Math.imul(E,H)|0,i=Math.imul(E,j),r=r+Math.imul(S,q)|0,o=(o=o+Math.imul(S,V)|0)+Math.imul(w,q)|0,i=i+Math.imul(w,V)|0,r=r+Math.imul(I,z)|0,o=(o=o+Math.imul(I,W)|0)+Math.imul(T,z)|0,i=i+Math.imul(T,W)|0,r=r+Math.imul(g,Q)|0,o=(o=o+Math.imul(g,X)|0)+Math.imul(_,Q)|0,i=i+Math.imul(_,X)|0,r=r+Math.imul(f,J)|0,o=(o=o+Math.imul(f,ee)|0)+Math.imul(y,J)|0,i=i+Math.imul(y,ee)|0;var Te=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(o=(o=o+Math.imul(d,re)|0)+Math.imul(p,ne)|0))<<13)|0;u=((i=i+Math.imul(p,re)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(N,H),o=(o=Math.imul(N,j))+Math.imul(P,H)|0,i=Math.imul(P,j),r=r+Math.imul(v,q)|0,o=(o=o+Math.imul(v,V)|0)+Math.imul(E,q)|0,i=i+Math.imul(E,V)|0,r=r+Math.imul(S,z)|0,o=(o=o+Math.imul(S,W)|0)+Math.imul(w,z)|0,i=i+Math.imul(w,W)|0,r=r+Math.imul(I,Q)|0,o=(o=o+Math.imul(I,X)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,X)|0,r=r+Math.imul(g,J)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(_,J)|0,i=i+Math.imul(_,ee)|0,r=r+Math.imul(f,ne)|0,o=(o=o+Math.imul(f,re)|0)+Math.imul(y,ne)|0,i=i+Math.imul(y,re)|0;var ke=(u+(r=r+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(C,H),o=(o=Math.imul(C,j))+Math.imul(D,H)|0,i=Math.imul(D,j),r=r+Math.imul(N,q)|0,o=(o=o+Math.imul(N,V)|0)+Math.imul(P,q)|0,i=i+Math.imul(P,V)|0,r=r+Math.imul(v,z)|0,o=(o=o+Math.imul(v,W)|0)+Math.imul(E,z)|0,i=i+Math.imul(E,W)|0,r=r+Math.imul(S,Q)|0,o=(o=o+Math.imul(S,X)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,X)|0,r=r+Math.imul(I,J)|0,o=(o=o+Math.imul(I,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,r=r+Math.imul(g,ne)|0,o=(o=o+Math.imul(g,re)|0)+Math.imul(_,ne)|0,i=i+Math.imul(_,re)|0,r=r+Math.imul(f,ie)|0,o=(o=o+Math.imul(f,ae)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,ae)|0;var Se=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(L,H),o=(o=Math.imul(L,j))+Math.imul(x,H)|0,i=Math.imul(x,j),r=r+Math.imul(C,q)|0,o=(o=o+Math.imul(C,V)|0)+Math.imul(D,q)|0,i=i+Math.imul(D,V)|0,r=r+Math.imul(N,z)|0,o=(o=o+Math.imul(N,W)|0)+Math.imul(P,z)|0,i=i+Math.imul(P,W)|0,r=r+Math.imul(v,Q)|0,o=(o=o+Math.imul(v,X)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,X)|0,r=r+Math.imul(S,J)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(w,J)|0,i=i+Math.imul(w,ee)|0,r=r+Math.imul(I,ne)|0,o=(o=o+Math.imul(I,re)|0)+Math.imul(T,ne)|0,i=i+Math.imul(T,re)|0,r=r+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,ae)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,ae)|0,r=r+Math.imul(f,ce)|0,o=(o=o+Math.imul(f,ue)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,ue)|0;var we=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(U,H),o=(o=Math.imul(U,j))+Math.imul(K,H)|0,i=Math.imul(K,j),r=r+Math.imul(L,q)|0,o=(o=o+Math.imul(L,V)|0)+Math.imul(x,q)|0,i=i+Math.imul(x,V)|0,r=r+Math.imul(C,z)|0,o=(o=o+Math.imul(C,W)|0)+Math.imul(D,z)|0,i=i+Math.imul(D,W)|0,r=r+Math.imul(N,Q)|0,o=(o=o+Math.imul(N,X)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,X)|0,r=r+Math.imul(v,J)|0,o=(o=o+Math.imul(v,ee)|0)+Math.imul(E,J)|0,i=i+Math.imul(E,ee)|0,r=r+Math.imul(S,ne)|0,o=(o=o+Math.imul(S,re)|0)+Math.imul(w,ne)|0,i=i+Math.imul(w,re)|0,r=r+Math.imul(I,ie)|0,o=(o=o+Math.imul(I,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,r=r+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,r=r+Math.imul(f,de)|0,o=(o=o+Math.imul(f,pe)|0)+Math.imul(y,de)|0,i=i+Math.imul(y,pe)|0;var Ae=(u+(r=r+Math.imul(d,fe)|0)|0)+((8191&(o=(o=o+Math.imul(d,ye)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,ye)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(U,q),o=(o=Math.imul(U,V))+Math.imul(K,q)|0,i=Math.imul(K,V),r=r+Math.imul(L,z)|0,o=(o=o+Math.imul(L,W)|0)+Math.imul(x,z)|0,i=i+Math.imul(x,W)|0,r=r+Math.imul(C,Q)|0,o=(o=o+Math.imul(C,X)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,X)|0,r=r+Math.imul(N,J)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,r=r+Math.imul(v,ne)|0,o=(o=o+Math.imul(v,re)|0)+Math.imul(E,ne)|0,i=i+Math.imul(E,re)|0,r=r+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,ae)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,ae)|0,r=r+Math.imul(I,ce)|0,o=(o=o+Math.imul(I,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,r=r+Math.imul(g,de)|0,o=(o=o+Math.imul(g,pe)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,pe)|0;var ve=(u+(r=r+Math.imul(f,fe)|0)|0)+((8191&(o=(o=o+Math.imul(f,ye)|0)+Math.imul(y,fe)|0))<<13)|0;u=((i=i+Math.imul(y,ye)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(U,z),o=(o=Math.imul(U,W))+Math.imul(K,z)|0,i=Math.imul(K,W),r=r+Math.imul(L,Q)|0,o=(o=o+Math.imul(L,X)|0)+Math.imul(x,Q)|0,i=i+Math.imul(x,X)|0,r=r+Math.imul(C,J)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,r=r+Math.imul(N,ne)|0,o=(o=o+Math.imul(N,re)|0)+Math.imul(P,ne)|0,i=i+Math.imul(P,re)|0,r=r+Math.imul(v,ie)|0,o=(o=o+Math.imul(v,ae)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,ae)|0,r=r+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(w,ce)|0,i=i+Math.imul(w,ue)|0,r=r+Math.imul(I,de)|0,o=(o=o+Math.imul(I,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(r=r+Math.imul(g,fe)|0)|0)+((8191&(o=(o=o+Math.imul(g,ye)|0)+Math.imul(_,fe)|0))<<13)|0;u=((i=i+Math.imul(_,ye)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,Q),o=(o=Math.imul(U,X))+Math.imul(K,Q)|0,i=Math.imul(K,X),r=r+Math.imul(L,J)|0,o=(o=o+Math.imul(L,ee)|0)+Math.imul(x,J)|0,i=i+Math.imul(x,ee)|0,r=r+Math.imul(C,ne)|0,o=(o=o+Math.imul(C,re)|0)+Math.imul(D,ne)|0,i=i+Math.imul(D,re)|0,r=r+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,r=r+Math.imul(v,ce)|0,o=(o=o+Math.imul(v,ue)|0)+Math.imul(E,ce)|0,i=i+Math.imul(E,ue)|0,r=r+Math.imul(S,de)|0,o=(o=o+Math.imul(S,pe)|0)+Math.imul(w,de)|0,i=i+Math.imul(w,pe)|0;var Oe=(u+(r=r+Math.imul(I,fe)|0)|0)+((8191&(o=(o=o+Math.imul(I,ye)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,ye)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,J),o=(o=Math.imul(U,ee))+Math.imul(K,J)|0,i=Math.imul(K,ee),r=r+Math.imul(L,ne)|0,o=(o=o+Math.imul(L,re)|0)+Math.imul(x,ne)|0,i=i+Math.imul(x,re)|0,r=r+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,r=r+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,r=r+Math.imul(v,de)|0,o=(o=o+Math.imul(v,pe)|0)+Math.imul(E,de)|0,i=i+Math.imul(E,pe)|0;var Ne=(u+(r=r+Math.imul(S,fe)|0)|0)+((8191&(o=(o=o+Math.imul(S,ye)|0)+Math.imul(w,fe)|0))<<13)|0;u=((i=i+Math.imul(w,ye)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(U,ne),o=(o=Math.imul(U,re))+Math.imul(K,ne)|0,i=Math.imul(K,re),r=r+Math.imul(L,ie)|0,o=(o=o+Math.imul(L,ae)|0)+Math.imul(x,ie)|0,i=i+Math.imul(x,ae)|0,r=r+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,r=r+Math.imul(N,de)|0,o=(o=o+Math.imul(N,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var Pe=(u+(r=r+Math.imul(v,fe)|0)|0)+((8191&(o=(o=o+Math.imul(v,ye)|0)+Math.imul(E,fe)|0))<<13)|0;u=((i=i+Math.imul(E,ye)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ie),o=(o=Math.imul(U,ae))+Math.imul(K,ie)|0,i=Math.imul(K,ae),r=r+Math.imul(L,ce)|0,o=(o=o+Math.imul(L,ue)|0)+Math.imul(x,ce)|0,i=i+Math.imul(x,ue)|0,r=r+Math.imul(C,de)|0,o=(o=o+Math.imul(C,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Re=(u+(r=r+Math.imul(N,fe)|0)|0)+((8191&(o=(o=o+Math.imul(N,ye)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,ye)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(U,ce),o=(o=Math.imul(U,ue))+Math.imul(K,ce)|0,i=Math.imul(K,ue),r=r+Math.imul(L,de)|0,o=(o=o+Math.imul(L,pe)|0)+Math.imul(x,de)|0,i=i+Math.imul(x,pe)|0;var Ce=(u+(r=r+Math.imul(C,fe)|0)|0)+((8191&(o=(o=o+Math.imul(C,ye)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,ye)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,de),o=(o=Math.imul(U,pe))+Math.imul(K,de)|0,i=Math.imul(K,pe);var De=(u+(r=r+Math.imul(L,fe)|0)|0)+((8191&(o=(o=o+Math.imul(L,ye)|0)+Math.imul(x,fe)|0))<<13)|0;u=((i=i+Math.imul(x,ye)|0)+(o>>>13)|0)+(De>>>26)|0,De&=67108863;var Be=(u+(r=Math.imul(U,fe))|0)+((8191&(o=(o=Math.imul(U,ye))+Math.imul(K,fe)|0))<<13)|0;return u=((i=Math.imul(K,ye))+(o>>>13)|0)+(Be>>>26)|0,Be&=67108863,c[0]=me,c[1]=ge,c[2]=_e,c[3]=be,c[4]=Ie,c[5]=Te,c[6]=ke,c[7]=Se,c[8]=we,c[9]=Ae,c[10]=ve,c[11]=Ee,c[12]=Oe,c[13]=Ne,c[14]=Pe,c[15]=Re,c[16]=Ce,c[17]=De,c[18]=Be,0!==u&&(c[19]=u,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,o=0,i=0;i<n.length-1;i++){var a=o;o=0;for(var s=67108863&r,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),o+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}n.words[i]=s,r=a,a=o}return 0!==r?n.words[i]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=f),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?f(this,e,t):n<1024?m(this,e,t):g(this,e,t)},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),g(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,o=0;o<this.length;o++){var i=(0|this.words[o])*e,a=(67108863&i)+(67108863&r);r>>=26,r+=i/67108864|0,r+=a>>>26,this.words[o]=67108863&a}return 0!==r&&(this.words[o]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,o=n%26;t[n]=e.words[r]>>>o&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,o=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<r;this.words[t]=c|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this._strip()},o.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var o;n("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=r;if(o-=a,o=Math.max(0,o),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,o=1<<t;return!(this.length<=r)&&!!(this.words[r]&o)},o.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var o,i,a=e.length+r;this._expand(a);var s=0;for(o=0;o<e.length;o++){i=(0|this.words[o+r])+s;var c=(0|e.words[o])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[o+r]=67108863&i}for(;o<this.length-r;o++)s=(i=(0|this.words[o+r])+s)>>26,this.words[o+r]=67108863&i;if(0===s)return this._strip();for(n(-1===s),s=0,o=0;o<this.length;o++)s=(i=-(0|this.words[o])+s)>>26,this.words[o]=67108863&i;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,c=r.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=r.clone()._ishlnsubmul(i,1,c);0===l.negative&&(r=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),r._ishlnsubmul(i,p,d);0!==r.negative;)p--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=p)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),o=e.andln(1),i=n.cmp(r);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,o=0,i=this.length-1;i>=0;i--)o=(r*o+(0|this.words[i]))%e;return t?-o:o},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,o=this.length-1;o>=0;o--){var i=(0|this.words[o])+67108864*r;this.words[o]=i/e|0,r=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;0===(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,y=1;0===(r.words[0]&y)&&f<26;++f,y<<=1);if(f>0)for(r.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),a.isub(c)):(r.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:r.iushln(u)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;0===(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var o=t.cmp(n);if(o<0){var i=t;t=n,n=i}else if(0===o||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,o=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=o,this;for(var i=o,a=r;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],o=0|e.words[n];if(r!==o){r<o?t=-1:r>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new w(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function I(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function T(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){w.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(I,b),I.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),o=0;o<r;o++)t.words[o]=e.words[o];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&n,o=10;o<e.length;o++){var a=0|e.words[o];e.words[o-10]=(a&n)<<4|i>>>22,i=a}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},I.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(T,b),r(k,b),r(S,b),S.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,o=67108863&r;r>>>=26,e.words[n]=o,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new I;else if("p224"===e)t=new T;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return _[e]=t,t},w.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},w.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},w.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},w.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},w.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},w.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},w.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},w.prototype.isqr=function(e){return this.imul(e,e.clone())},w.prototype.sqr=function(e){return this.mul(e,e)},w.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var y=h,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<f);var g=this.pow(d,new o(1).iushln(f-m-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=m}return p},w.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},w.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),r=t.length-1;r>=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}c=26}return i},w.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},w.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},r(A,w),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,bn)}(bn$1)),bn$1.exports}var bnExports=requireBn(),_BN=getDefaultExportFromCjs(bnExports);const version$4="bignumber/5.8.0";var BN=_BN.BN;const logger$7=new Logger$1(version$4),_constructorGuard$1={},MAX_SAFE=9007199254740991;let _warnedToStringRadix=!1;class BigNumber{constructor(e,t){e!==_constructorGuard$1&&logger$7.throwError("cannot call constructor directly; use BigNumber.from",Logger$1.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return toBigNumber(toBN(this).fromTwos(e))}toTwos(e){return toBigNumber(toBN(this).toTwos(e))}abs(){return"-"===this._hex[0]?BigNumber.from(this._hex.substring(1)):this}add(e){return toBigNumber(toBN(this).add(toBN(e)))}sub(e){return toBigNumber(toBN(this).sub(toBN(e)))}div(e){return BigNumber.from(e).isZero()&&throwFault("division-by-zero","div"),toBigNumber(toBN(this).div(toBN(e)))}mul(e){return toBigNumber(toBN(this).mul(toBN(e)))}mod(e){const t=toBN(e);return t.isNeg()&&throwFault("division-by-zero","mod"),toBigNumber(toBN(this).umod(t))}pow(e){const t=toBN(e);return t.isNeg()&&throwFault("negative-power","pow"),toBigNumber(toBN(this).pow(t))}and(e){const t=toBN(e);return(this.isNegative()||t.isNeg())&&throwFault("unbound-bitwise-result","and"),toBigNumber(toBN(this).and(t))}or(e){const t=toBN(e);return(this.isNegative()||t.isNeg())&&throwFault("unbound-bitwise-result","or"),toBigNumber(toBN(this).or(t))}xor(e){const t=toBN(e);return(this.isNegative()||t.isNeg())&&throwFault("unbound-bitwise-result","xor"),toBigNumber(toBN(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&throwFault("negative-width","mask"),toBigNumber(toBN(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&throwFault("negative-width","shl"),toBigNumber(toBN(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&throwFault("negative-width","shr"),toBigNumber(toBN(this).shrn(e))}eq(e){return toBN(this).eq(toBN(e))}lt(e){return toBN(this).lt(toBN(e))}lte(e){return toBN(this).lte(toBN(e))}gt(e){return toBN(this).gt(toBN(e))}gte(e){return toBN(this).gte(toBN(e))}isNegative(){return"-"===this._hex[0]}isZero(){return toBN(this).isZero()}toNumber(){try{return toBN(this).toNumber()}catch(e){throwFault("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return logger$7.throwError("this platform does not support BigInt",Logger$1.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?_warnedToStringRadix||(_warnedToStringRadix=!0,logger$7.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?logger$7.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Logger$1.errors.UNEXPECTED_ARGUMENT,{}):logger$7.throwError("BigNumber.toString does not accept parameters",Logger$1.errors.UNEXPECTED_ARGUMENT,{})),toBN(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof BigNumber)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new BigNumber(_constructorGuard$1,toHex(e)):e.match(/^-?[0-9]+$/)?new BigNumber(_constructorGuard$1,toHex(new BN(e))):logger$7.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&throwFault("underflow","BigNumber.from",e),(e>=MAX_SAFE||e<=-9007199254740991)&&throwFault("overflow","BigNumber.from",e),BigNumber.from(String(e));const t=e;if("bigint"==typeof t)return BigNumber.from(t.toString());if(isBytes(t))return BigNumber.from(hexlify(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return BigNumber.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(isHexString(e)||"-"===e[0]&&isHexString(e.substring(1))))return BigNumber.from(e)}return logger$7.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function toHex(e){if("string"!=typeof e)return toHex(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&logger$7.throwArgumentError("invalid hex","value",e),"0x00"===(e=toHex(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function toBigNumber(e){return BigNumber.from(toHex(e))}function toBN(e){const t=BigNumber.from(e).toHexString();return"-"===t[0]?new BN("-"+t.substring(3),16):new BN(t.substring(2),16)}function throwFault(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),logger$7.throwError(e,Logger$1.errors.NUMERIC_FAULT,r)}function _base36To16(e){return new BN(e,36).toString(16)}function defineReadOnly(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}window&&window.__awaiter;const version$3="abi/5.8.0",logger$6=new Logger$1(version$3),_constructorGuard={};let ModifiersBytes={calldata:!0,memory:!0,storage:!0},ModifiersNest={calldata:!0,memory:!0};function checkModifier(e,t){if("bytes"===e||"string"===e){if(ModifiersBytes[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&ModifiersNest[t])return!0;return(ModifiersBytes[t]||"payable"===t)&&logger$6.throwArgumentError("invalid modifier","name",t),!1}function parseParamType(e,t){let n=e;function r(t){logger$6.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function o(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let i={type:"",name:"",state:{allowType:!0}},a=i;for(let n=0;n<e.length;n++){let i=e[n];switch(i){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||r(n),a.state.allowType=!1,a.type=verifyType(a.type),a.components=[o(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),checkModifier(a.type,a.name)&&(a.name=""),a.type=verifyType(a.type);let e=a;a=a.parent,a||r(n),delete e.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),checkModifier(a.type,a.name)&&(a.name=""),a.type=verifyType(a.type);let s=o(a.parent);a.parent.components.push(s),delete a.parent,a=s;break;case" ":a.state.allowType&&""!==a.type&&(a.type=verifyType(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(t||r(n),a.indexed&&r(n),a.indexed=!0,a.name=""):checkModifier(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||r(n),a.type+=i,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||r(n),a.type+=i,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=i,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=i,delete a.state.allowArray):a.state.readArray?a.type+=i:r(n)}}return a.parent&&logger$6.throwArgumentError("unexpected eof","param",e),delete i.state,"indexed"===a.name?(t||r(n.length-7),a.indexed&&r(n.length-7),a.indexed=!0,a.name=""):checkModifier(a.type,a.name)&&(a.name=""),i.type=verifyType(i.type),i}function populate(e,t){for(let n in t)defineReadOnly(e,n,t[n])}const FormatTypes=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),paramTypeArray=new RegExp(/^(.*)\[([0-9]*)\]$/);class ParamType{constructor(e,t){e!==_constructorGuard&&logger$6.throwError("use fromString",Logger$1.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),populate(this,t);let n=this.type.match(paramTypeArray);populate(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:ParamType.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=FormatTypes.sighash),FormatTypes[e]||logger$6.throwArgumentError("invalid format type","format",e),e===FormatTypes.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==FormatTypes.sighash&&(t+=this.type),t+="("+this.components.map(t=>t.format(e)).join(e===FormatTypes.full?", ":",")+")"):t+=this.type,e!==FormatTypes.sighash&&(!0===this.indexed&&(t+=" indexed"),e===FormatTypes.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?ParamType.fromString(e,t):ParamType.fromObject(e)}static fromObject(e){return ParamType.isParamType(e)?e:new ParamType(_constructorGuard,{name:e.name||null,type:verifyType(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(ParamType.fromObject):null})}static fromString(e,t){return n=parseParamType(e,!!t),ParamType.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}}function verifyType(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const logger$5=new Logger$1(version$3);class Coder{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){logger$5.throwArgumentError(e,this.localName,t)}}class Writer{constructor(e){defineReadOnly(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return hexConcat(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(concat(e._data))}writeBytes(e){let t=arrayify(e);const n=t.length%this.wordSize;return n&&(t=concat([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=arrayify(BigNumber.from(e));return t.length>this.wordSize&&logger$5.throwError("value out-of-bounds",Logger$1.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=concat([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class Reader{constructor(e,t,n,r){defineReadOnly(this,"_data",arrayify(e)),defineReadOnly(this,"wordSize",t||32),defineReadOnly(this,"_coerceFunc",n),defineReadOnly(this,"allowLoose",r),this._offset=0}get data(){return hexlify(this._data)}get consumed(){return this._offset}static coerce(e,t){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):Reader.coerce(e,t)}_peekBytes(e,t,n){let r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+t<=this._data.length?r=t:logger$5.throwError("data out-of-bounds",Logger$1.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(e){return new Reader(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let n=this._peekBytes(0,e,!!t);return this._offset+=n.length,n.slice(0,e)}readValue(){return BigNumber.from(this.readBytes(this.wordSize))}}var sha3$1={exports:{}},hasRequiredSha3;
|
|
115
|
+
*/function assertBigInt(){if("undefined"==typeof BigInt)throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function concat$1(e){let t=0,n=0;for(let n=0;n<e.length;n++){t+=e[n].byteLength}const r=new Uint8Array(t);for(let t=0;t<e.length;t++){const o=e[t];r.set(new Uint8Array(o),n),n+=o.byteLength}return r.buffer}function checkBufferParams(e,t,n,r){return t instanceof Uint8Array?t.byteLength?n<0?(e.error="Wrong parameter: inputOffset less than zero",!1):r<0?(e.error="Wrong parameter: inputLength less than zero",!1):!(t.byteLength-n-r<0)||(e.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(e.error="Wrong parameter: inputBuffer has zero length",!1):(e.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class ViewWriter{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return concat$1(this.items)}}const powers2=[new Uint8Array([1])],digitsString="0123456789",EMPTY_STRING="",EMPTY_BUFFER=new ArrayBuffer(0),EMPTY_VIEW=new Uint8Array(0),END_OF_CONTENT_NAME="EndOfContent",OCTET_STRING_NAME="OCTET STRING",BIT_STRING_NAME="BIT STRING";function HexBlock(e){var t;return(t=class extends e{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(e){this.valueHexView=new Uint8Array(e)}constructor(...e){var t;super(...e);const n=e[0]||{};this.isHexOnly=null!==(t=n.isHexOnly)&&void 0!==t&&t,this.valueHexView=n.valueHex?buildExports.BufferSourceConverter.toUint8Array(n.valueHex):EMPTY_VIEW}fromBER(e,t,n){const r=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!checkBufferParams(this,r,t,n))return-1;const o=t+n;return this.valueHexView=r.subarray(t,o),this.valueHexView.length?(this.blockLength=n,o):(this.warnings.push("Zero buffer length"),t)}toBER(e=!1){return this.isHexOnly?e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",EMPTY_BUFFER)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:buildExports.Convert.ToHex(this.valueHexView)}}}).NAME="hexBlock",t}class LocalBaseBlock{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:t=EMPTY_STRING,warnings:n=[],valueBeforeDecode:r=EMPTY_VIEW}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=buildExports.BufferSourceConverter.toUint8Array(r)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:buildExports.Convert.ToHex(this.valueBeforeDecodeView)}}}LocalBaseBlock.NAME="baseBlock";class ValueBlock extends LocalBaseBlock{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}ValueBlock.NAME="valueBlock";class LocalIdentificationBlock extends(HexBlock(LocalBaseBlock)){constructor({idBlock:e={}}={}){var t,n,r,o;super(),e?(this.isHexOnly=null!==(t=e.isHexOnly)&&void 0!==t&&t,this.valueHexView=e.valueHex?buildExports.BufferSourceConverter.toUint8Array(e.valueHex):EMPTY_VIEW,this.tagClass=null!==(n=e.tagClass)&&void 0!==n?n:-1,this.tagNumber=null!==(r=e.tagNumber)&&void 0!==r?r:-1,this.isConstructed=null!==(o=e.isConstructed)&&void 0!==o&&o):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",EMPTY_BUFFER}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const n=new Uint8Array(1);if(!e){let e=this.tagNumber;e&=31,t|=e,n[0]=t}return n.buffer}if(!this.isHexOnly){const n=utilToBase(this.tagNumber,7),r=new Uint8Array(n),o=n.byteLength,i=new Uint8Array(o+1);if(i[0]=31|t,!e){for(let e=0;e<o-1;e++)i[e+1]=128|r[e];i[o]=r[o-1]}return i.buffer}const n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=31|t,!e){const e=this.valueHexView;for(let t=0;t<e.length-1;t++)n[t+1]=128|e[t];n[this.valueHexView.byteLength]=e[e.length-1]}return n.buffer}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);if(0===o.length)return this.error="Zero buffer length",-1;switch(192&o[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=!(32&~o[0]),this.isHexOnly=!1;const i=31&o[0];if(31!==i)this.tagNumber=i,this.blockLength=1;else{let e=1,t=this.valueHexView=new Uint8Array(255),n=255;for(;128&o[e];){if(t[e-1]=127&o[e],e++,e>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(e===n){n+=255;const e=new Uint8Array(n);for(let n=0;n<t.length;n++)e[n]=t[n];t=this.valueHexView=new Uint8Array(n)}}this.blockLength=e+1,t[e-1]=127&o[e];const r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=t[n];t=this.valueHexView=new Uint8Array(e),t.set(r),this.blockLength<=9?this.tagNumber=utilFromBase(t,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}LocalIdentificationBlock.NAME="identificationBlock";class LocalLengthBlock extends LocalBaseBlock{constructor({lenBlock:e={}}={}){var t,n,r;super(),this.isIndefiniteForm=null!==(t=e.isIndefiniteForm)&&void 0!==t&&t,this.longFormUsed=null!==(n=e.longFormUsed)&&void 0!==n&&n,this.length=null!==(r=e.length)&&void 0!==r?r:0}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);if(0===o.length)return this.error="Zero buffer length",-1;if(255===o[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===o[0],this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(128&o[0]),!1===this.longFormUsed)return this.length=o[0],this.blockLength=1,t+this.blockLength;const i=127&o[0];if(i>8)return this.error="Too big integer",-1;if(i+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const a=t+1,s=r.subarray(a,a+i);return 0===s[i-1]&&this.warnings.push("Needlessly long encoded length"),this.length=utilFromBase(s,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=i+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){const r=utilToBase(this.length,8);if(r.byteLength>127)return this.error="Too big length",EMPTY_BUFFER;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const o=new Uint8Array(r);n=new Uint8Array(t),n[0]=128|r.byteLength;for(let e=0;e<r.byteLength;e++)n[e+1]=o[e];return t}return t=new ArrayBuffer(1),!1===e&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}LocalLengthBlock.NAME="lengthBlock";const typeStore={};class BaseBlock extends LocalBaseBlock{constructor({name:e=EMPTY_STRING,optional:t=!1,primitiveSchema:n,...r}={},o){super(r),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new LocalIdentificationBlock(r),this.lenBlock=new LocalLengthBlock(r),this.valueBlock=o?new o(r):new ValueBlock(r)}fromBER(e,t,n){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(e,t){const n=t||new ViewWriter;t||prepareIndefiniteForm(this);const r=this.idBlock.toBER(e);if(n.write(r),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{const t=this.valueBlock.toBER(e);this.lenBlock.length=t.byteLength;const r=this.lenBlock.toBER(e);n.write(r),n.write(t)}return t?EMPTY_BUFFER:n.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return"ascii"===e?this.onAsciiEncoding():buildExports.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${buildExports.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;return isEqualBuffer(this.toBER(),e.toBER())}}function prepareIndefiniteForm(e){var t;if(e instanceof typeStore.Constructed)for(const t of e.valueBlock.value)prepareIndefiniteForm(t)&&(e.lenBlock.isIndefiniteForm=!0);return!!(null===(t=e.lenBlock)||void 0===t?void 0:t.isIndefiniteForm)}BaseBlock.NAME="BaseBlock";class BaseStringBlock extends BaseBlock{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=EMPTY_STRING,...t}={},n){super(t,n),e&&this.fromString(e)}fromBER(e,t,n){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}BaseStringBlock.NAME="BaseStringBlock";class LocalPrimitiveValueBlock extends(HexBlock(ValueBlock)){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}var _a$w,_a$v,_a$u,_a$t,_a$s;LocalPrimitiveValueBlock.NAME="PrimitiveValueBlock";class Primitive extends BaseBlock{constructor(e={}){super(e,LocalPrimitiveValueBlock),this.idBlock.isConstructed=!1}}function localChangeType(e,t){if(e instanceof t)return e;const n=new t;return n.idBlock=e.idBlock,n.lenBlock=e.lenBlock,n.warnings=e.warnings,n.valueBeforeDecodeView=e.valueBeforeDecodeView,n}function localFromBER(e,t=0,n=e.length){const r=t;let o=new BaseBlock({},ValueBlock);const i=new LocalBaseBlock;if(!checkBufferParams(i,e,t,n))return o.error=i.error,{offset:-1,result:o};if(!e.subarray(t,t+n).length)return o.error="Zero buffer length",{offset:-1,result:o};let a=o.idBlock.fromBER(e,t,n);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),-1===a)return o.error=o.idBlock.error,{offset:-1,result:o};if(t=a,n-=o.idBlock.blockLength,a=o.lenBlock.fromBER(e,t,n),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),-1===a)return o.error=o.lenBlock.error,{offset:-1,result:o};if(t=a,n-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let s=BaseBlock;if(1===o.idBlock.tagClass){if(o.idBlock.tagNumber>=37&&!1===o.idBlock.isHexOnly)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};s=typeStore.EndOfContent;break;case 1:s=typeStore.Boolean;break;case 2:s=typeStore.Integer;break;case 3:s=typeStore.BitString;break;case 4:s=typeStore.OctetString;break;case 5:s=typeStore.Null;break;case 6:s=typeStore.ObjectIdentifier;break;case 10:s=typeStore.Enumerated;break;case 12:s=typeStore.Utf8String;break;case 13:s=typeStore.RelativeObjectIdentifier;break;case 14:s=typeStore.TIME;break;case 15:return o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};case 16:s=typeStore.Sequence;break;case 17:s=typeStore.Set;break;case 18:s=typeStore.NumericString;break;case 19:s=typeStore.PrintableString;break;case 20:s=typeStore.TeletexString;break;case 21:s=typeStore.VideotexString;break;case 22:s=typeStore.IA5String;break;case 23:s=typeStore.UTCTime;break;case 24:s=typeStore.GeneralizedTime;break;case 25:s=typeStore.GraphicString;break;case 26:s=typeStore.VisibleString;break;case 27:s=typeStore.GeneralString;break;case 28:s=typeStore.UniversalString;break;case 29:s=typeStore.CharacterString;break;case 30:s=typeStore.BmpString;break;case 31:s=typeStore.DATE;break;case 32:s=typeStore.TimeOfDay;break;case 33:s=typeStore.DateTime;break;case 34:s=typeStore.Duration;break;default:{const e=o.idBlock.isConstructed?new typeStore.Constructed:new typeStore.Primitive;e.idBlock=o.idBlock,e.lenBlock=o.lenBlock,e.warnings=o.warnings,o=e}}}else s=o.idBlock.isConstructed?typeStore.Constructed:typeStore.Primitive;return o=localChangeType(o,s),a=o.fromBER(e,t,o.lenBlock.isIndefiniteForm?n:o.lenBlock.length),o.valueBeforeDecodeView=e.subarray(r,r+o.blockLength),{offset:a,result:o}}function fromBER(e){if(!e.byteLength){const e=new BaseBlock({},ValueBlock);return e.error="Input buffer has zero length",{offset:-1,result:e}}return localFromBER(buildExports.BufferSourceConverter.toUint8Array(e).slice(),0,e.byteLength)}function checkLen(e,t){return e?1:t}_a$w=Primitive,typeStore.Primitive=_a$w,Primitive.NAME="PRIMITIVE";class LocalConstructedValueBlock extends ValueBlock{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+n),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),t;let o=t;for(;checkLen(this.isIndefiniteForm,n)>0;){const e=localFromBER(r,o,n);if(-1===e.offset)return this.error=e.result.error,this.warnings.concat(e.result.warnings),-1;if(o=e.offset,this.blockLength+=e.result.blockLength,n-=e.result.blockLength,this.value.push(e.result),this.isIndefiniteForm&&e.result.constructor.NAME===END_OF_CONTENT_NAME)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===END_OF_CONTENT_NAME?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,t){const n=t||new ViewWriter;for(let t=0;t<this.value.length;t++)this.value[t].toBER(e,n);return t?EMPTY_BUFFER:n.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}LocalConstructedValueBlock.NAME="ConstructedValueBlock";class Constructed extends BaseBlock{constructor(e={}){super(e,LocalConstructedValueBlock),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const e=[];for(const t of this.valueBlock.value)e.push(t.toString("ascii").split("\n").map(e=>` ${e}`).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :\n${e.join("\n")}`:`${t} :`}}_a$v=Constructed,typeStore.Constructed=_a$v,Constructed.NAME="CONSTRUCTED";class LocalEndOfContentValueBlock extends ValueBlock{fromBER(e,t,n){return t}toBER(e){return EMPTY_BUFFER}}LocalEndOfContentValueBlock.override="EndOfContentValueBlock";class EndOfContent extends BaseBlock{constructor(e={}){super(e,LocalEndOfContentValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}_a$u=EndOfContent,typeStore.EndOfContent=_a$u,EndOfContent.NAME=END_OF_CONTENT_NAME;class Null extends BaseBlock{constructor(e={}){super(e,ValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){const n=new ArrayBuffer(2);if(!e){const e=new Uint8Array(n);e[0]=5,e[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}}_a$t=Null,typeStore.Null=_a$t,Null.NAME="NULL";class LocalBooleanValueBlock extends(HexBlock(ValueBlock)){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=buildExports.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);return checkBufferParams(this,r,t,n)?(this.valueHexView=r.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,utilDecodeTC.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}LocalBooleanValueBlock.NAME="BooleanValueBlock";let Boolean$1=class extends BaseBlock{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,LocalBooleanValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};_a$s=Boolean$1,typeStore.Boolean=_a$s,Boolean$1.NAME="BOOLEAN";class LocalOctetStringValueBlock extends(HexBlock(LocalConstructedValueBlock)){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=LocalConstructedValueBlock.prototype.fromBER.call(this,e,t,n),-1===r)return r;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.NAME;if(t===END_OF_CONTENT_NAME){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(t!==OCTET_STRING_NAME)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,n),this.blockLength=n;return r}toBER(e,t){return this.isConstructed?LocalConstructedValueBlock.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}var _a$r,_a$q,_a$p,_a$o,_a$n,_a$m,_a$l,_a$k,_a$j;LocalOctetStringValueBlock.NAME="OctetStringValueBlock";class OctetString extends BaseBlock{constructor({idBlock:e={},lenBlock:t={},...n}={}){var r,o;null!==(r=n.isConstructed)&&void 0!==r||(n.isConstructed=!!(null===(o=n.value)||void 0===o?void 0:o.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},LocalOctetStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===n)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const r=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(r.byteLength){const e=localFromBER(r,0,r.byteLength);-1!==e.offset&&e.offset===n&&(this.valueBlock.value=[e.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);return`${this.constructor.NAME} : ${buildExports.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof _a$r&&e.push(t.valueBlock.valueHexView);return buildExports.BufferSourceConverter.concat(e)}}_a$r=OctetString,typeStore.OctetString=_a$r,OctetString.NAME=OCTET_STRING_NAME;class LocalBitStringValueBlock extends(HexBlock(LocalConstructedValueBlock)){constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let r=-1;if(this.isConstructed){if(r=LocalConstructedValueBlock.prototype.fromBER.call(this,e,t,n),-1===r)return r;for(const e of this.value){const t=e.constructor.NAME;if(t===END_OF_CONTENT_NAME){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(t!==BIT_STRING_NAME)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const n=e.valueBlock;if(this.unusedBits>0&&n.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=n.unusedBits}return r}const o=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,o,t,n))return-1;const i=o.subarray(t,t+n);if(this.unusedBits=i[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const e=i.subarray(1);try{if(e.byteLength){const t=localFromBER(e,0,e.byteLength);-1!==t.offset&&t.offset===n-1&&(this.value=[t.result])}}catch{}}return this.valueHexView=i.subarray(1),this.blockLength=i.length,t+n}toBER(e,t){if(this.isConstructed)return LocalConstructedValueBlock.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return EMPTY_BUFFER;const n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}LocalBitStringValueBlock.NAME="BitStringValueBlock";class BitString extends BaseBlock{constructor({idBlock:e={},lenBlock:t={},...n}={}){var r,o;null!==(r=n.isConstructed)&&void 0!==r||(n.isConstructed=!!(null===(o=n.value)||void 0===o?void 0:o.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},LocalBitStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const n of t)e.push(n.toString(2).padStart(8,"0"));const n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}}function viewAdd(e,t){const n=new Uint8Array([0]),r=new Uint8Array(e),o=new Uint8Array(t);let i=r.slice(0);const a=i.length-1,s=o.slice(0),c=s.length-1;let u=0;let l=0;for(let e=c<a?a:c;e>=0;e--,l++){if(!0==l<s.length)u=i[a-l]+s[c-l]+n[0];else u=i[a-l]+n[0];if(n[0]=u/10,!0==l>=i.length)i=utilConcatView(new Uint8Array([u%10]),i);else i[a-l]=u%10}return n[0]>0&&(i=utilConcatView(n,i)),i}function power2(e){if(e>=powers2.length)for(let t=powers2.length;t<=e;t++){const e=new Uint8Array([0]);let n=powers2[t-1].slice(0);for(let t=n.length-1;t>=0;t--){const r=new Uint8Array([(n[t]<<1)+e[0]]);e[0]=r[0]/10,n[t]=r[0]%10}e[0]>0&&(n=utilConcatView(e,n)),powers2.push(n)}return powers2[e]}function viewSub(e,t){let n=0;const r=new Uint8Array(e),o=new Uint8Array(t),i=r.slice(0),a=i.length-1,s=o.slice(0),c=s.length-1;let u,l=0;for(let e=c;e>=0;e--,l++)if(u=i[a-l]-s[c-l]-n,!0==u<0)n=1,i[a-l]=u+10;else n=0,i[a-l]=u;if(n>0)for(let e=a-c+1;e>=0;e--,l++){if(u=i[a-l]-n,!(u<0)){n=0,i[a-l]=u;break}n=1,i[a-l]=u+10}return i.slice()}_a$q=BitString,typeStore.BitString=_a$q,BitString.NAME=BIT_STRING_NAME;class LocalIntegerValueBlock extends(HexBlock(ValueBlock)){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=utilDecodeTC.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),void 0!==e&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(utilEncodeTC(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,r=0){const o=this.fromBER(e,t,n);if(-1===o)return o;const i=this.valueHexView;return 0===i[0]&&128&i[1]?this.valueHexView=i.subarray(1):0!==r&&i.length<r&&(r-i.length>1&&(r=i.length+1),this.valueHexView=i.subarray(r-i.length)),o}toDER(e=!1){const t=this.valueHexView;switch(!0){case!!(128&t[0]):{const e=new Uint8Array(this.valueHexView.length+1);e[0]=0,e.set(t,1),this.valueHexView=e}break;case 0===t[0]&&!(128&t[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(e)}fromBER(e,t,n){const r=super.fromBER(e,t,n);return-1===r||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=8*this.valueHexView.length-1;let t,n=new Uint8Array(8*this.valueHexView.length/3),r=0;const o=this.valueHexView;let i="",a=!1;for(let a=o.byteLength-1;a>=0;a--){t=o[a];for(let o=0;o<8;o++){if(!(1&~t))if(r===e)n=viewSub(power2(r),n),i="-";else n=viewAdd(n,power2(r));r++,t>>=1}}for(let e=0;e<n.length;e++)n[e]&&(a=!0),a&&(i+=digitsString.charAt(n[e]));return!1===a&&(i+=digitsString.charAt(0)),i}}_a$p=LocalIntegerValueBlock,LocalIntegerValueBlock.NAME="IntegerValueBlock",Object.defineProperty(_a$p.prototype,"valueHex",{set:function(e){this.valueHexView=new Uint8Array(e),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});class Integer extends BaseBlock{constructor(e={}){super(e,LocalIntegerValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return assertBigInt(),BigInt(this.valueBlock.toString())}static fromBigInt(e){assertBigInt();const t=BigInt(e),n=new ViewWriter,r=t.toString(16).replace(/^-/,""),o=new Uint8Array(buildExports.Convert.FromHex(r));if(t<0){const e=new Uint8Array(o.length+(128&o[0]?1:0));e[0]|=128;const r=BigInt(`0x${buildExports.Convert.ToHex(e)}`)+t,i=buildExports.BufferSourceConverter.toUint8Array(buildExports.Convert.FromHex(r.toString(16)));i[0]|=128,n.write(i)}else 128&o[0]&&n.write(new Uint8Array([0])),n.write(o);return new _a$o({valueHex:n.final()})}convertToDER(){const e=new _a$o({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new _a$o({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}_a$o=Integer,typeStore.Integer=_a$o,Integer.NAME="INTEGER";class Enumerated extends Integer{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}_a$n=Enumerated,typeStore.Enumerated=_a$n,Enumerated.NAME="ENUMERATED";class LocalSidValueBlock extends(HexBlock(ValueBlock)){constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let e=0;e<n&&(this.valueHexView[e]=127&o[e],this.blockLength++,128&o[e]);e++);const i=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)i[e]=this.valueHexView[e];return this.valueHexView=i,128&o[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){assertBigInt();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const n=new Uint8Array(t.length/7);for(let e=0;e<n.length;e++)n[e]=parseInt(t.slice(7*e,7*e+7),2)+(e+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,n=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)n[e]=128|t[e];return n[this.blockLength-1]=t[this.blockLength-1],n.buffer}const t=utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",EMPTY_BUFFER;const n=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)n[t]=128|e[t];n[r]=e[r]}return n}toString(){let e="";if(this.isHexOnly)e=buildExports.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}LocalSidValueBlock.NAME="sidBlock";class LocalObjectIdentifierValueBlock extends ValueBlock{constructor({value:e=EMPTY_STRING,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let r=t;for(;n>0;){const t=new LocalSidValueBlock;if(r=t.fromBER(e,r,n),-1===r)return this.blockLength=0,this.error=t.error,r;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,n-=t.blockLength,this.value.push(t)}return r}toBER(e){const t=[];for(let n=0;n<this.value.length;n++){const r=this.value[n].toBER(e);if(0===r.byteLength)return this.error=this.value[n].error,EMPTY_BUFFER;t.push(r)}return concat$1(t)}fromString(e){this.value=[];let t=0,n=0,r="",o=!1;do{if(n=e.indexOf(".",t),r=-1===n?e.substring(t):e.substring(t,n),t=n+1,o){const e=this.value[0];let t=0;switch(e.valueDec){case 0:break;case 1:t=40;break;case 2:t=80;break;default:return void(this.value=[])}const n=parseInt(r,10);if(isNaN(n))return;e.valueDec=n+t,o=!1}else{const e=new LocalSidValueBlock;if(r>Number.MAX_SAFE_INTEGER){assertBigInt();const t=BigInt(r);e.valueBigInt=t}else if(e.valueDec=parseInt(r,10),isNaN(e.valueDec))return;this.value.length||(e.isFirstSid=!0,o=!0),this.value.push(e)}}while(-1!==n)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let r=this.value[n].toString();0!==n&&(e=`${e}.`),t?(r=`{${r}}`,this.value[n].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}LocalObjectIdentifierValueBlock.NAME="ObjectIdentifierValueBlock";class ObjectIdentifier extends BaseBlock{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,LocalObjectIdentifierValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_a$m=ObjectIdentifier,typeStore.ObjectIdentifier=_a$m,ObjectIdentifier.NAME="OBJECT IDENTIFIER";class LocalRelativeSidValueBlock extends(HexBlock(LocalBaseBlock)){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(0===n)return t;const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let e=0;e<n&&(this.valueHexView[e]=127&o[e],this.blockLength++,128&o[e]);e++);const i=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)i[e]=this.valueHexView[e];return this.valueHexView=i,128&o[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,n=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)n[e]=128|t[e];return n[this.blockLength-1]=t[this.blockLength-1],n.buffer}const t=utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",EMPTY_BUFFER;const n=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)n[t]=128|e[t];n[r]=e[r]}return n.buffer}toString(){let e="";return e=this.isHexOnly?buildExports.Convert.ToHex(this.valueHexView):this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}LocalRelativeSidValueBlock.NAME="relativeSidBlock";class LocalRelativeObjectIdentifierValueBlock extends ValueBlock{constructor({value:e=EMPTY_STRING,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let r=t;for(;n>0;){const t=new LocalRelativeSidValueBlock;if(r=t.fromBER(e,r,n),-1===r)return this.blockLength=0,this.error=t.error,r;this.blockLength+=t.blockLength,n-=t.blockLength,this.value.push(t)}return r}toBER(e,t){const n=[];for(let t=0;t<this.value.length;t++){const r=this.value[t].toBER(e);if(0===r.byteLength)return this.error=this.value[t].error,EMPTY_BUFFER;n.push(r)}return concat$1(n)}fromString(e){this.value=[];let t=0,n=0,r="";do{n=e.indexOf(".",t),r=-1===n?e.substring(t):e.substring(t,n),t=n+1;const o=new LocalRelativeSidValueBlock;if(o.valueDec=parseInt(r,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(-1!==n);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let r=this.value[n].toString();0!==n&&(e=`${e}.`),t?(r=`{${r}}`,e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}LocalRelativeObjectIdentifierValueBlock.NAME="RelativeObjectIdentifierValueBlock";class RelativeObjectIdentifier extends BaseBlock{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,LocalRelativeObjectIdentifierValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_a$l=RelativeObjectIdentifier,typeStore.RelativeObjectIdentifier=_a$l,RelativeObjectIdentifier.NAME="RelativeObjectIdentifier";class Sequence extends Constructed{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}_a$k=Sequence,typeStore.Sequence=_a$k,Sequence.NAME="SEQUENCE";let Set$1=class extends Constructed{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};_a$j=Set$1,typeStore.Set=_a$j,Set$1.NAME="SET";class LocalStringValueBlock extends(HexBlock(ValueBlock)){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=EMPTY_STRING}toJSON(){return{...super.toJSON(),value:this.value}}}LocalStringValueBlock.NAME="StringValueBlock";class LocalSimpleStringValueBlock extends LocalStringValueBlock{}LocalSimpleStringValueBlock.NAME="SimpleStringValueBlock";class LocalSimpleStringBlock extends BaseStringBlock{constructor({...e}={}){super(e,LocalSimpleStringValueBlock)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,buildExports.BufferSourceConverter.toUint8Array(e))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);this.valueBlock.value=e}}LocalSimpleStringBlock.NAME="SIMPLE STRING";class LocalUtf8StringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){this.valueBlock.valueHexView=buildExports.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=buildExports.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=buildExports.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(buildExports.Convert.FromUtf8String(e)),this.valueBlock.value=e}}var _a$i,_a$h,_a$g,_a$f,_a$e,_a$d,_a$c,_a$b,_a$a,_a$9,_a$8,_a$7,_a$6,_a$5,_a$4,_a$3,_a$2,_a$1;LocalUtf8StringValueBlock.NAME="Utf8StringValueBlock";class Utf8String extends LocalUtf8StringValueBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}_a$i=Utf8String,typeStore.Utf8String=_a$i,Utf8String.NAME="UTF8String";class LocalBmpStringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){this.valueBlock.value=buildExports.Convert.ToUtf16String(e),this.valueBlock.valueHexView=buildExports.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(buildExports.Convert.FromUtf16String(e))}}LocalBmpStringValueBlock.NAME="BmpStringValueBlock";class BmpString extends LocalBmpStringValueBlock{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}_a$h=BmpString,typeStore.BmpString=_a$h,BmpString.NAME="BMPString";class LocalUniversalStringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let e=0;e<n.length;e+=4)n[e]=n[e+3],n[e+1]=n[e+2],n[e+2]=0,n[e+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(4*t);for(let r=0;r<t;r++){const t=utilToBase(e.charCodeAt(r),8),o=new Uint8Array(t);if(o.length>4)continue;const i=4-o.length;for(let e=o.length-1;e>=0;e--)n[4*r+e+i]=o[e]}this.valueBlock.value=e}}LocalUniversalStringValueBlock.NAME="UniversalStringValueBlock";class UniversalString extends LocalUniversalStringValueBlock{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}_a$g=UniversalString,typeStore.UniversalString=_a$g,UniversalString.NAME="UniversalString";class NumericString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}_a$f=NumericString,typeStore.NumericString=_a$f,NumericString.NAME="NumericString";class PrintableString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_a$e=PrintableString,typeStore.PrintableString=_a$e,PrintableString.NAME="PrintableString";class TeletexString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_a$d=TeletexString,typeStore.TeletexString=_a$d,TeletexString.NAME="TeletexString";class VideotexString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}_a$c=VideotexString,typeStore.VideotexString=_a$c,VideotexString.NAME="VideotexString";class IA5String extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_a$b=IA5String,typeStore.IA5String=_a$b,IA5String.NAME="IA5String";class GraphicString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_a$a=GraphicString,typeStore.GraphicString=_a$a,GraphicString.NAME="GraphicString";class VisibleString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}_a$9=VisibleString,typeStore.VisibleString=_a$9,VisibleString.NAME="VisibleString";class GeneralString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}_a$8=GeneralString,typeStore.GeneralString=_a$8,GeneralString.NAME="GeneralString";class CharacterString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}_a$7=CharacterString,typeStore.CharacterString=_a$7,CharacterString.NAME="CharacterString";class UTCTime extends VisibleString{constructor({value:e,valueDate:t,...n}={}){if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let t=0;t<e.length;t++)this.valueBlock.valueHexView[t]=e.charCodeAt(t)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,buildExports.BufferSourceConverter.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(e);if(null===t)return void(this.error="Wrong input string for conversion");const n=parseInt(t[1],10);this.year=n>=50?1900+n:2e3+n,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(e="iso"){if("iso"===e){const e=new Array(7);return e[0]=padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=padNumber(this.month,2),e[2]=padNumber(this.day,2),e[3]=padNumber(this.hour,2),e[4]=padNumber(this.minute,2),e[5]=padNumber(this.second,2),e[6]="Z",e.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}_a$6=UTCTime,typeStore.UTCTime=_a$6,UTCTime.NAME="UTCTime";class GeneralizedTime extends UTCTime{constructor(e={}){var t;super(e),null!==(t=this.millisecond)&&void 0!==t||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t,n=!1,r="",o="",i=0,a=0,s=0;if("Z"===e[e.length-1])r=e.substring(0,e.length-1),n=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(n){if(-1!==r.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==r.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let e=1,t=r.indexOf("+"),n="";if(-1===t&&(t=r.indexOf("-"),e=-1),-1!==t){if(n=r.substring(t+1),r=r.substring(0,t),2!==n.length&&4!==n.length)throw new Error("Wrong input string for conversion");let o=parseInt(n.substring(0,2),10);if(isNaN(o.valueOf()))throw new Error("Wrong input string for conversion");if(a=e*o,4===n.length){if(o=parseInt(n.substring(2,4),10),isNaN(o.valueOf()))throw new Error("Wrong input string for conversion");s=e*o}}}let c=r.indexOf(".");if(-1===c&&(c=r.indexOf(",")),-1!==c){const e=new Number(`0${r.substring(c)}`);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");i=e.valueOf(),o=r.substring(0,c)}else o=r;switch(!0){case 8===o.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*i;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*i;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){const e=1e3*i;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for conversion")}const u=t.exec(o);if(null===u)throw new Error("Wrong input string for conversion");for(let e=1;e<u.length;e++)switch(e){case 1:this.year=parseInt(u[e],10);break;case 2:this.month=parseInt(u[e],10);break;case 3:this.day=parseInt(u[e],10);break;case 4:this.hour=parseInt(u[e],10)+a;break;case 5:this.minute=parseInt(u[e],10)+s;break;case 6:this.second=parseInt(u[e],10);break;default:throw new Error("Wrong input string for conversion")}if(!1===n){const e=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=e.getUTCFullYear(),this.month=e.getUTCMonth(),this.day=e.getUTCDay(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}}toString(e="iso"){if("iso"===e){const e=[];return e.push(padNumber(this.year,4)),e.push(padNumber(this.month,2)),e.push(padNumber(this.day,2)),e.push(padNumber(this.hour,2)),e.push(padNumber(this.minute,2)),e.push(padNumber(this.second,2)),0!==this.millisecond&&(e.push("."),e.push(padNumber(this.millisecond,3))),e.push("Z"),e.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}_a$5=GeneralizedTime,typeStore.GeneralizedTime=_a$5,GeneralizedTime.NAME="GeneralizedTime";class DATE extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}_a$4=DATE,typeStore.DATE=_a$4,DATE.NAME="DATE";class TimeOfDay extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}_a$3=TimeOfDay,typeStore.TimeOfDay=_a$3,TimeOfDay.NAME="TimeOfDay";class DateTime extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}_a$2=DateTime,typeStore.DateTime=_a$2,DateTime.NAME="DateTime";let Duration$1=class extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};var _a;_a$1=Duration$1,typeStore.Duration=_a$1,Duration$1.NAME="Duration";class TIME extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}_a=TIME,typeStore.TIME=_a,TIME.NAME="TIME";var pem={exports:{}},forge,hasRequiredForge;function requireForge(){return hasRequiredForge?forge:(hasRequiredForge=1,forge={options:{usePureJavaScript:!1}})}var util={exports:{}},baseN,hasRequiredBaseN,hasRequiredUtil,hasRequiredPem;function requireBaseN(){if(hasRequiredBaseN)return baseN;hasRequiredBaseN=1;var e={};baseN=e;var t={};return e.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var r="";if(e instanceof Uint8Array){var o=0,i=t.length,a=t.charAt(0),s=[0];for(o=0;o<e.length;++o){for(var c=0,u=e[o];c<s.length;++c)u+=s[c]<<8,s[c]=u%i,u=u/i|0;for(;u>0;)s.push(u%i),u=u/i|0}for(o=0;0===e[o]&&o<e.length-1;++o)r+=a;for(o=s.length-1;o>=0;--o)r+=t[s[o]]}else r=function(e,t){var n=0,r=t.length,o=t.charAt(0),i=[0];for(n=0;n<e.length();++n){for(var a=0,s=e.at(n);a<i.length;++a)s+=i[a]<<8,i[a]=s%r,s=s/r|0;for(;s>0;)i.push(s%r),s=s/r|0}var c="";for(n=0;0===e.at(n)&&n<e.length()-1;++n)c+=o;for(n=i.length-1;n>=0;--n)c+=t[i[n]];return c}(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");r=r.match(l).join("\r\n")}return r},e.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var r=t[n];if(!r){r=t[n]=[];for(var o=0;o<n.length;++o)r[n.charCodeAt(o)]=o}e=e.replace(/\s/g,"");var i=n.length,a=n.charAt(0),s=[0];for(o=0;o<e.length;o++){var c=r[e.charCodeAt(o)];if(void 0===c)return;for(var u=0,l=c;u<s.length;++u)l+=s[u]*i,s[u]=255&l,l>>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===a&&d<e.length-1;++d)s.push(0);return"undefined"!=typeof Buffer?Buffer.from(s.reverse()):new Uint8Array(s.reverse())},baseN}function requireUtil(){if(hasRequiredUtil)return util.exports;hasRequiredUtil=1;var e=requireForge(),t=requireBaseN(),n=util.exports=e.util=e.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(n.isArrayBuffer(e)||n.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof o||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return n.nextTick=process.nextTick,void("function"==typeof setImmediate?n.setImmediate=setImmediate:n.setImmediate=n.nextTick);if("function"==typeof setImmediate)return n.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(n.nextTick=function(e){return setImmediate(e)});if(n.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];function s(n){if(n.source===window&&n.data===e){n.stopPropagation();var r=t.slice();t.length=0,r.forEach(function(e){e()})}}n.setImmediate=function(n){t.push(n),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",s,!0)}if("undefined"!=typeof MutationObserver){var r=Date.now(),o=!0,i=document.createElement("div");t=[];new MutationObserver(function(){var e=t.slice();t.length=0,e.forEach(function(e){e()})}).observe(i,{attributes:!0});var a=n.setImmediate;n.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),a(e)):(t.push(e),1===t.length&&i.setAttribute("a",o=!o))}}n.nextTick=n.setImmediate}(),n.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,n.globalScope=n.isNodejs?commonjsGlobal:"undefined"==typeof self?window:self,n.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},n.isArrayBufferView=function(e){return e&&n.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},n.ByteBuffer=o,n.ByteStringBuffer=o;n.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},n.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},n.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},n.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},n.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},n.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},n.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(n.encodeUtf8(e))},n.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},n.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},n.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},n.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},n.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},n.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},n.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},n.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},n.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},n.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},n.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<<e-2;return t>=n&&(t-=n<<1),t},n.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},n.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},n.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},n.ByteStringBuffer.prototype.copy=function(){var e=n.createBuffer(this.data);return e.read=this.read,e},n.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},n.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},n.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},n.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var n=this.data.charCodeAt(t);n<16&&(e+="0"),e+=n.toString(16)}return e},n.ByteStringBuffer.prototype.toString=function(){return n.decodeUtf8(this.bytes())},n.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=n.isArrayBuffer(e),o=n.isArrayBufferView(e);if(r||o)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},n.DataBuffer.prototype.length=function(){return this.write-this.read},n.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},n.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},n.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},n.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n<t;++n)this.data.setUint8(e);return this},n.DataBuffer.prototype.putBytes=function(e,t){if(n.isArrayBufferView(e)){var r=(o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-o.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(o),this.write+=r,this}if(n.isArrayBuffer(e)){var o=new Uint8Array(e);return this.accommodate(o.byteLength),new Uint8Array(this.data.buffer).set(o,this.write),this.write+=o.byteLength,this}if(e instanceof n.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&n.isArrayBufferView(e.data)){o=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(o.byteLength),new Uint8Array(e.data.byteLength,this.write).set(o),this.write+=o.byteLength,this}if(e instanceof n.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=n.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=n.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},n.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},n.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},n.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},n.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},n.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},n.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},n.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},n.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},n.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},n.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},n.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},n.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},n.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},n.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},n.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},n.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},n.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},n.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},n.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<<e-2;return t>=n&&(t-=n<<1),t},n.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},n.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},n.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},n.DataBuffer.prototype.copy=function(){return new n.DataBuffer(this)},n.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},n.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},n.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},n.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var n=this.data.getUint8(t);n<16&&(e+="0"),e+=n.toString(16)}return e},n.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return n.binary.raw.encode(t);if("hex"===e)return n.binary.hex.encode(t);if("base64"===e)return n.binary.base64.encode(t);if("utf8"===e)return n.text.utf8.decode(t);if("utf16"===e)return n.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},n.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=n.encodeUtf8(e)),new n.ByteBuffer(e)},n.fillString=function(e,t){for(var n="";t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return n},n.xorBytes=function(e,t,n){for(var r="",o="",i="",a=0,s=0;n>0;--n,++a)o=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(r+=i,i="",s=0),i+=String.fromCharCode(o),++s;return r+=i},n.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n<e.length;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t},n.bytesToHex=function(e){return n.createBuffer(e).toHex()},n.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";n.encode64=function(e,t){for(var n,r,o,a="",s="",c=0;c<e.length;)n=e.charCodeAt(c++),r=e.charCodeAt(c++),o=e.charCodeAt(c++),a+=i.charAt(n>>2),a+=i.charAt((3&n)<<4|r>>4),isNaN(r)?a+="==":(a+=i.charAt((15&r)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},n.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,n,r,o,i="",s=0;s<e.length;)t=a[e.charCodeAt(s++)-43],n=a[e.charCodeAt(s++)-43],r=a[e.charCodeAt(s++)-43],o=a[e.charCodeAt(s++)-43],i+=String.fromCharCode(t<<2|n>>4),64!==r&&(i+=String.fromCharCode((15&n)<<4|r>>2),64!==o&&(i+=String.fromCharCode((3&r)<<6|o)));return i},n.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},n.decodeUtf8=function(e){return decodeURIComponent(escape(e))},n.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:t.encode,decode:t.decode}},n.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},n.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length));for(var o=n=n||0,i=0;i<e.length;++i)r[o++]=e.charCodeAt(i);return t?o-n:r},n.binary.hex.encode=n.bytesToHex,n.binary.hex.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2)));var o=0,i=n=n||0;for(1&e.length&&(o=1,r[i++]=parseInt(e[0],16));o<e.length;o+=2)r[i++]=parseInt(e.substr(o,2),16);return t?i-n:r},n.binary.base64.encode=function(e,t){for(var n,r,o,a="",s="",c=0;c<e.byteLength;)n=e[c++],r=e[c++],o=e[c++],a+=i.charAt(n>>2),a+=i.charAt((3&n)<<4|r>>4),isNaN(r)?a+="==":(a+=i.charAt((15&r)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},n.binary.base64.decode=function(e,t,n){var r,o,i,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,l=n=n||0;u<e.length;)r=a[e.charCodeAt(u++)-43],o=a[e.charCodeAt(u++)-43],i=a[e.charCodeAt(u++)-43],s=a[e.charCodeAt(u++)-43],c[l++]=r<<2|o>>4,64!==i&&(c[l++]=(15&o)<<4|i>>2,64!==s&&(c[l++]=(3&i)<<6|s));return t?l-n:c.subarray(0,l)},n.binary.base58.encode=function(e,t){return n.binary.baseN.encode(e,s,t)},n.binary.base58.decode=function(e,t){return n.binary.baseN.decode(e,s,t)},n.text={utf8:{},utf16:{}},n.text.utf8.encode=function(e,t,r){e=n.encodeUtf8(e);var o=t;o||(o=new Uint8Array(e.length));for(var i=r=r||0,a=0;a<e.length;++a)o[i++]=e.charCodeAt(a);return t?i-r:o},n.text.utf8.decode=function(e){return n.decodeUtf8(String.fromCharCode.apply(null,e))},n.text.utf16.encode=function(e,t,n){var r=t;r||(r=new Uint8Array(2*e.length));for(var o=new Uint16Array(r.buffer),i=n=n||0,a=n,s=0;s<e.length;++s)o[a++]=e.charCodeAt(s),i+=2;return t?i-n:r},n.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},n.deflate=function(e,t,r){if(t=n.decode64(e.deflate(n.encode64(t)).rval),r){var o=2;32&t.charCodeAt(1)&&(o=6),t=t.substring(o,t.length-4)}return t},n.inflate=function(e,t,r){var o=e.inflate(n.encode64(t)).rval;return null===o?null:n.decode64(o)};var c=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var o;if(null===r?o=e.removeItem(t):(r=n.encode64(JSON.stringify(r)),o=e.setItem(t,r)),void 0!==o&&!0!==o.rval){var i=new Error(o.error.message);throw i.id=o.error.id,i.name=o.error.name,i}},u=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var o=new Error(r.error.message);throw o.id=r.error.id,o.name=r.error.name,o}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(n.decode64(r))),r},l=function(e,t,n,r){var o=u(e,t);null===o&&(o={}),o[n]=r,c(e,t,o)},d=function(e,t,n){var r=u(e,t);return null!==r&&(r=n in r?r[n]:null),r},p=function(e,t,n){var r=u(e,t);if(null!==r&&n in r){delete r[n];var o=!0;for(var i in r){o=!1;break}o&&(r=null),c(e,t,r)}},h=function(e,t){c(e,t,null)},f=function(e,t,n){var r,o=null;void 0===n&&(n=["web","flash"]);var i=!1,a=null;for(var s in n){r=n[s];try{if("flash"===r||"both"===r){if(null===t[0])throw new Error("Flash local storage not available.");o=e.apply(this,t),i="flash"===r}"web"!==r&&"both"!==r||(t[0]=localStorage,o=e.apply(this,t),i=!0)}catch(e){a=e}if(i)break}if(!i)throw a;return o};return n.setItem=function(e,t,n,r,o){f(l,arguments,o)},n.getItem=function(e,t,n,r){return f(d,arguments,r)},n.removeItem=function(e,t,n,r){f(p,arguments,r)},n.clearItems=function(e,t,n){f(h,arguments,n)},n.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},n.format=function(e){for(var t,n,r=/%./g,o=0,i=[],a=0;t=r.exec(e);){(n=e.substring(a,r.lastIndex-2)).length>0&&i.push(n),a=r.lastIndex;var s=t[0][1];switch(s){case"s":case"o":o<arguments.length?i.push(arguments[1+o++]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+s+"?>")}}return i.push(e.substring(a)),i.join("")},n.formatNumber=function(e,t,n,r){var o=e,i=isNaN(t=Math.abs(t))?2:t,a=void 0===n?",":n,s=void 0===r?".":r,c=o<0?"-":"",u=parseInt(o=Math.abs(+o||0).toFixed(i),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+s:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(i?a+Math.abs(o-u).toFixed(i).slice(2):"")},n.formatSize=function(e){return e=e>=1073741824?n.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?n.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?n.formatNumber(e/1024,0)+" KiB":n.formatNumber(e,0)+" bytes"},n.bytesFromIP=function(e){return-1!==e.indexOf(".")?n.bytesFromIPv4(e):-1!==e.indexOf(":")?n.bytesFromIPv6(e):null},n.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=n.createBuffer(),r=0;r<e.length;++r){var o=parseInt(e[r],10);if(isNaN(o))return null;t.putByte(o)}return t.getBytes()},n.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).length+t),o=n.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var a=n.hexToBytes(e[i]);a.length<2&&o.putByte(0),o.putBytes(a)}else o.fillWithByte(0,r),r=0;return o.getBytes()},n.bytesToIP=function(e){return 4===e.length?n.bytesToIPv4(e):16===e.length?n.bytesToIPv6(e):null},n.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t.join(".")},n.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],o=0,i=0;i<e.length;i+=2){for(var a=n.bytesToHex(e[i]+e[i+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=r[r.length-1],c=t.length;s&&c===s.end+1?(s.end=c,s.end-s.start>r[o].end-r[o].start&&(o=r.length-1)):r.push({start:c,end:c})}t.push(a)}if(r.length>0){var u=r[o];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},n.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in n&&!e.update)return t(null,n.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return n.cores=navigator.hardwareConcurrency,t(null,n.cores);if("undefined"==typeof Worker)return n.cores=1,t(null,n.cores);if("undefined"==typeof Blob)return n.cores=2,t(null,n.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){var t=Date.now(),n=t+4;self.postMessage({st:t,et:n})})}.toString(),")()"],{type:"application/javascript"}));!function e(o,i,a){if(0===i){var s=Math.floor(o.reduce(function(e,t){return e+t},0)/o.length);return n.cores=Math.max(1,s),URL.revokeObjectURL(r),t(null,n.cores)}!function(e,t){for(var n=[],o=[],i=0;i<e;++i){var a=new Worker(r);a.addEventListener("message",function(r){if(o.push(r.data),o.length===e){for(var i=0;i<e;++i)n[i].terminate();t(null,o)}}),n.push(a)}for(i=0;i<e;++i)n[i].postMessage(i)}(a,function(t,n){o.push(function(e,t){for(var n=[],r=0;r<e;++r)for(var o=t[r],i=n[r]=[],a=0;a<e;++a)if(r!==a){var s=t[a];(o.st>s.st&&o.st<s.et||s.st>o.st&&s.st<o.et)&&i.push(a)}return n.reduce(function(e,t){return Math.max(e,t.length)},0)}(a,n)),e(o,i-1,a)})}([],5,16)},util.exports}function requirePem(){if(hasRequiredPem)return pem.exports;hasRequiredPem=1;var e=requireForge();requireUtil();var t=pem.exports=e.pem=e.pem||{};function n(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},o=0;o<e.values.length;++o)n.push(e.values[o].replace(/^(\S+\r\n)/,r));t+=n.join(",")+"\r\n";var i=0,a=-1;for(o=0;o<t.length;++o,++i)if(i>65&&-1!==a){var s=t[a];","===s?(++a,t=t.substr(0,a)+"\r\n "+t.substr(a)):t=t.substr(0,a)+"\r\n"+s+t.substr(a+1),i=o-a-1,a=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(a=o);return t}function r(e){return e.replace(/^\s+/,"")}return t.encode=function(t,r){r=r||{};var o,i="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(i+=n(o={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(i+=n(o={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(o={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&o.values.push(t.dekInfo.parameters),i+=n(o)),t.headers)for(var a=0;a<t.headers.length;++a)i+=n(t.headers[a]);return t.procType&&(i+="\r\n"),i+=e.util.encode64(t.body,r.maxline||64)+"\r\n",i+="-----END "+t.type+"-----\r\n"},t.decode=function(t){for(var n,o=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/;n=i.exec(t);){var c=n[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var u={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(n[3])};if(o.push(u),n[2]){for(var l=n[2].split(s),d=0;n&&d<l.length;){for(var p=l[d].replace(/\s+$/,""),h=d+1;h<l.length;++h){var f=l[h];if(!/\s/.test(f[0]))break;p+=f,d=h}if(n=p.match(a)){for(var y={name:n[1],values:[]},m=n[2].split(","),g=0;g<m.length;++g)y.values.push(r(m[g]));if(u.procType)if(u.contentDomain||"Content-Domain"!==y.name)if(u.dekInfo||"DEK-Info"!==y.name)u.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:m[0],parameters:m[1]||null}}else u.contentDomain=m[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:m[0],type:m[1]}}}++d}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===o.length)throw new Error("Invalid PEM formatted message.");return o},pem.exports}var pemExports=requirePem(),pemForge=getDefaultExportFromCjs(pemExports);const ID_ED25519="1.3.101.112";async function readPemED25519(e,t){const n=decode$3(e.replace(/-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g,""));if(t){let e;try{e=EncryptedPrivateKeyInfo.parse(n)}catch(e){const t=null!=e&&null!=e.message?e.message:"";throw new BadKeyError(`failed to parse encrypted private key: ${t}`)}const r=await e.decrypt(t);let o=null;if(r.algId.algIdent!==ID_ED25519)throw new BadKeyError(`unknown private key algorithm ${r.algId.toString()}`);o=Ed25519PrivateKey;const i=decode$4(r.privateKey);if(!("bytes"in i))throw new BadKeyError(`expected ASN bytes, got ${JSON.stringify(i)}`);return o.fromBytes(i.bytes)}return n.subarray(16)}async function readPemECDSA(e,t){const n=decode$3(e.replace(/-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g,""));if(t){const n=pemForge.decode(e)[0].dekInfo.parameters,r=decode$6(n),o=e.split("\n"),i=await messageDigest(t,n),a=bufferExports.Buffer.from(o.slice(4,o.length-1).join(""),"base64"),s=await createDecipheriv(CipherAlgorithm.Aes128Cbc,i,r,a);return EcdsaPrivateKey.fromBytesDer(s)}return fromBER(n).result.valueBlock.value[1].valueBlock.valueHexView}async function read(e,t){return!!e.includes("BEGIN EC PRIVATE KEY")?readPemECDSA(e,t):readPemED25519(e,t)}function legacy(e,t){const n=new Uint8Array(e.length+8);n.set(e,0);const r=new DataView(n.buffer,n.byteOffset,n.byteLength);0xffffffffff===t?(r.setInt32(e.length+0,255),r.setInt32(e.length+4,-1)):(r.setInt32(e.length+0,t<0?-1:0),r.setInt32(e.length+4,t));const o=Uint8Array.from([255]);return deriveKey(HashAlgorithm.Sha512,n,o,2048,32)}const CACHE$1={privateKeyConstructor:null,privateKeyFromBytes:null,mnemonicFromString:null};let PrivateKey$1=class e extends Key$1{constructor(e){super(),this._key=e}get _type(){return this._key._type}get _chainCode(){return this._key._chainCode}static generateED25519(){return new e(Ed25519PrivateKey.generate())}static generateECDSA(){return new e(EcdsaPrivateKey.generate())}static generate(){return e.generateED25519()}static async generateAsync(){return e.generateED25519Async()}static async generateED25519Async(){return new e(await Ed25519PrivateKey.generateAsync())}static async generateECDSAAsync(){return new e(await EcdsaPrivateKey.generateAsync())}static fromBytes(t){let n;32==t.length&&console.warn("WARNING: Consider using fromStringECDSA() or fromStringED25519() on a HEX-encoded string and fromStringDer() on a HEX-encoded string with DER prefix instead.");try{return new e(Ed25519PrivateKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}try{return new e(EcdsaPrivateKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}throw new BadKeyError(`private key cannot be decoded from bytes: ${n}`)}static fromBytesECDSA(t){return new e(EcdsaPrivateKey.fromBytes(t))}static fromBytesED25519(t){return new e(Ed25519PrivateKey.fromBytes(t))}static fromString(t){return e.fromBytes(decode$6(t))}static fromStringECDSA(t){return e.fromBytesECDSA(decode$6(t))}static fromStringED25519(t){return e.fromBytesED25519(decode$6(t))}static async fromSeedED25519(t){const n=await Ed25519PrivateKey.fromSeed(t);return new e(n)}static async fromSeedECDSAsecp256k1(t){const n=await EcdsaPrivateKey.fromSeed(t);return new e(n)}static async fromMnemonic(e,t=""){if(null==CACHE$1.mnemonicFromString)throw new Error("Mnemonic not found in cache");return("string"==typeof e?CACHE$1.mnemonicFromString(e):e).toEd25519PrivateKey(t)}static async fromKeystore(t,n=""){return e.fromBytes(await loadKeystore(t,n))}static async fromPem(t,n=""){const r=await read(t,n);if(r instanceof Ed25519PrivateKey||r instanceof EcdsaPrivateKey)return new e(r);const o=!!t.includes("BEGIN EC PRIVATE KEY");return new e(o?EcdsaPrivateKey.fromBytes(r):Ed25519PrivateKey.fromBytes(r))}async derive(t){if(null==this._key._chainCode)throw new Error("this private key does not support key derivation");if(this._key instanceof Ed25519PrivateKey){const{keyData:n,chainCode:r}=await derive(this.toBytesRaw(),this._key._chainCode,t);return new e(new Ed25519PrivateKey(n,r))}{const{keyData:n,chainCode:r}=await derive$1(this.toBytesRaw(),this._key._chainCode,t);return new e(new EcdsaPrivateKey(fromBytes(n),r))}}async legacyDerive(t){const n=await legacy(this.toBytesRaw().subarray(0,32),t),r=this._key.constructor;return new e(new r(n))}get publicKey(){return new PublicKey$1(this._key.publicKey)}sign(e){return this._key.sign(e)}signTransaction(e){if(e.isFrozen()||e.freeze(),1!=e._signedTransactions.length)throw new Error("`PrivateKey.signTransaction()` requires `Transaction` to have a single node `AccountId` set");const t=e._signedTransactions[0],n=encode$3(this.publicKey.toBytesRaw());null==t.sigMap&&(t.sigMap={}),null==t.sigMap.sigPair&&(t.sigMap.sigPair=[]);for(const e of t.sigMap.sigPair)if(null!=e.pubKeyPrefix&&encode$3(e.pubKeyPrefix)===n)switch(this._type){case"ED25519":return e.ed25519;case"secp256k1":return e.ECDSASecp256k1}const r=this.sign(null!=t.bodyBytes?t.bodyBytes:new Uint8Array),o={pubKeyPrefix:this.publicKey.toBytesRaw()};switch(this._type){case"ED25519":o.ed25519=r;break;case"secp256k1":o.ECDSASecp256k1=r}return t.sigMap.sigPair.push(o),e._signerPublicKeys.add(n),r}isDerivable(){return null!=this._key._chainCode}toBytes(){return this._key instanceof Ed25519PrivateKey?this.toBytesRaw():this.toBytesDer()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this.toStringDer()}toStringDer(){return encode$3(this.toBytesDer())}toStringRaw(){return encode$3(this.toBytesRaw())}toKeystore(e=""){return createKeystore(this.toBytesRaw(),e)}getRecoveryId(e,t,n){if(!(this._key instanceof EcdsaPrivateKey))throw new Error("Invalid key type, must be ECDSA secp256k1.");if(32!==e.length||32!==t.length)throw new Error("Invalid signature components.");const r=new Uint8Array(64);return r.set(e,0),r.set(t,32),this._key.getRecoveryId(r,n)}};CACHE$1.privateKeyConstructor=e=>new PrivateKey$1(e),CACHE$1.privateKeyFromBytes=e=>PrivateKey$1.fromBytes(e);const BadMnemonicReason=Object.freeze({BadLength:"BadLength",UnknownWords:"UnknownWords",ChecksumMismatch:"ChecksumMismatch"});class BadMnemonicError extends Error{constructor(e,t,n){let r;switch(t){case BadMnemonicReason.BadLength:r="mnemonic is of an unexpected number of words";break;case BadMnemonicReason.ChecksumMismatch:r="checksum byte in mnemonic did not match the rest of the mnemonic";break;case BadMnemonicReason.UnknownWords:r="mnemonic contained words that are not in the standard word list";break;default:throw new Error(`unexpected value ${t.toString()} for 'reason'`)}super(`invalid mnemonic: ${r}`),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,BadMnemonicError),this.name="BadMnemonicError",this.reason=t,this.mnemonic=e,this.unknownWordIndices=n}}var legacyWords=["aback","abbey","abbot","abide","ablaze","able","aboard","abode","abort","abound","about","above","abroad","abrupt","absent","absorb","absurd","abuse","accent","accept","access","accord","accuse","ace","ache","aching","acid","acidic","acorn","acre","across","act","action","active","actor","actual","acute","adam","adapt","add","added","addict","adept","adhere","adjust","admire","admit","adobe","adopt","adrift","adult","adverb","advice","aerial","afar","affair","affect","afford","afghan","afield","afloat","afraid","afresh","after","again","age","agency","agenda","agent","aghast","agile","ago","agony","agree","agreed","ahead","aid","aide","aim","air","airman","airy","akin","alarm","alaska","albeit","album","ale","alert","alibi","alice","alien","alight","align","alike","alive","alkali","all","alley","allied","allow","alloy","ally","almond","almost","aloft","alone","along","aloof","aloud","alpha","alpine","also","altar","alter","always","amaze","amazon","amber","ambush","amen","amend","amid","amidst","amiss","among","amount","ample","amuse","anchor","and","andrew","anew","angel","anger","angle","angry","animal","ankle","annoy","annual","answer","anthem","any","anyhow","anyway","apart","apathy","apex","apiece","appeal","appear","apple","apply","april","apron","arab","arcade","arcane","arch","arctic","ardent","are","area","argue","arid","arise","ark","arm","armful","army","aroma","around","arouse","array","arrest","arrive","arrow","arson","art","artery","artful","artist","ascent","ash","ashen","ashore","aside","ask","asleep","aspect","assay","assent","assert","assess","asset","assign","assist","assume","assure","asthma","astute","asylum","ate","athens","atlas","atom","atomic","attach","attack","attain","attend","attic","auburn","audio","audit","august","aunt","auntie","aura","austin","author","auto","autumn","avail","avenge","avenue","avert","avid","avoid","await","awake","awaken","award","aware","awash","away","awful","awhile","axe","axes","axiom","axis","axle","aye","babe","baby","bach","back","backup","bacon","bad","badge","badly","bag","baggy","bail","bait","bake","baker","bakery","bald","ball","ballad","ballet","ballot","baltic","bamboo","ban","banal","banana","band","bang","bank","bar","barber","bare","barely","barge","bark","barley","barn","baron","barrel","barren","basalt","base","basic","basil","basin","basis","basket","bass","bat","batch","bath","baton","battle","bay","beach","beacon","beak","beam","bean","bear","beard","beast","beat","beauty","become","bed","beech","beef","beefy","beep","beer","beet","beetle","before","beg","beggar","begin","behalf","behave","behind","beige","being","belief","bell","belly","belong","below","belt","bench","bend","benign","bent","berlin","berry","berth","beset","beside","best","bestow","bet","beta","betray","better","beware","beyond","bias","biceps","bicker","bid","big","bigger","bike","bile","bill","bin","binary","bind","biopsy","birch","bird","birdie","birth","bishop","bit","bitch","bite","bitter","black","blade","blame","bland","blast","blaze","bleak","blend","bless","blew","blind","blink","blip","bliss","blitz","block","blond","blood","bloody","bloom","blot","blouse","blow","blue","bluff","blunt","blur","blush","boar","board","boast","boat","bob","bodily","body","bogus","boil","bold","bolt","bomb","bombay","bond","bone","bonn","bonnet","bonus","bony","book","boom","boost","boot","booth","booze","border","bore","borrow","bosom","boss","boston","both","bother","bottle","bottom","bought","bounce","bound","bounty","bout","bovine","bow","bowel","bowl","box","boy","boyish","brace","brain","brainy","brake","bran","branch","brand","brandy","brass","brave","bravo","brazil","breach","bread","break","breast","breath","bred","breed","breeze","brew","bribe","brick","bride","bridge","brief","bright","brim","brine","bring","brink","brisk","broad","broke","broken","bronze","brook","broom","brown","bruise","brush","brutal","brute","bubble","buck","bucket","buckle","budget","buffet","buggy","build","bulb","bulge","bulk","bulky","bull","bullet","bully","bump","bumpy","bunch","bundle","bunk","bunny","burden","bureau","burial","buried","burly","burn","burnt","burrow","burst","bury","bus","bush","bust","bustle","busy","but","butler","butt","butter","button","buy","buyer","buzz","bye","byte","cab","cabin","cable","cache","cactus","caesar","cage","cairo","cajun","cajole","cake","calf","call","caller","calm","calmly","came","camel","camera","camp","campus","can","canada","canal","canary","cancel","cancer","candid","candle","candy","cane","canine","canoe","canopy","canvas","canyon","cap","cape","car","carbon","card","care","career","caress","cargo","carl","carnal","carol","carp","carpet","carrot","carry","cart","cartel","case","cash","cask","cast","castle","casual","cat","catch","cater","cattle","caught","causal","cause","cave","cease","celery","cell","cellar","celtic","cement","censor","census","cent","cereal","chain","chair","chalk","chalky","champ","chance","change","chant","chaos","chap","chapel","charge","charm","chart","chase","chat","cheap","cheat","check","cheek","cheeky","cheer","cheery","cheese","chef","cheque","cherry","chess","chest","chew","chic","chick","chief","child","chile","chill","chilly","chin","china","chip","choice","choir","choose","chop","choppy","chord","chorus","chose","chosen","chris","chrome","chunk","chunky","church","cider","cigar","cinema","circa","circle","circus","cite","city","civic","civil","clad","claim","clammy","clan","clap","clash","clasp","class","clause","claw","clay","clean","clear","clergy","clerk","clever","click","client","cliff","climax","climb","clinch","cling","clinic","clip","cloak","clock","clone","close","closer","closet","cloth","cloud","cloudy","clout","clown","club","clue","clumsy","clung","clutch","coach","coal","coarse","coast","coat","coax","cobalt","cobra","coca","cock","cocoa","code","coffee","coffin","cohort","coil","coin","coke","cold","collar","colon","colony","colt","column","comb","combat","come","comedy","comic","commit","common","compel","comply","concur","cone","confer","congo","consul","convex","convey","convoy","cook","cool","cope","copper","copy","coral","cord","core","cork","corn","corner","corps","corpse","corpus","cortex","cosmic","cosmos","cost","costly","cotton","couch","cough","could","count","county","coup","couple","coupon","course","court","cousin","cove","cover","covert","cow","coward","cowboy","cozy","crab","crack","cradle","craft","crafty","crag","crane","crash","crate","crater","crawl","crazy","creak","cream","creamy","create","credit","creed","creek","creep","creepy","crept","crest","crew","cried","crime","crisis","crisp","critic","crook","crop","cross","crow","crowd","crown","crude","cruel","cruise","crunch","crush","crust","crux","cry","crypt","cuba","cube","cubic","cuckoo","cuff","cult","cup","curb","cure","curfew","curl","curry","curse","cursor","curve","cuss","custom","cut","cute","cycle","cyclic","cynic","czech","dad","daddy","dagger","daily","dairy","daisy","dale","dam","damage","damp","dampen","dance","danger","danish","dare","dark","darken","darn","dart","dash","data","date","david","dawn","day","dead","deadly","deaf","deal","dealer","dean","dear","death","debate","debit","debris","debt","debtor","decade","decay","decent","decide","deck","decor","decree","deduce","deed","deep","deeply","deer","defeat","defect","defend","defer","define","defy","degree","deity","delay","delete","delhi","delta","demand","demise","demo","demure","denial","denote","dense","dental","deny","depart","depend","depict","deploy","depot","depth","deputy","derive","desert","design","desire","desist","desk","detail","detect","deter","detest","detour","device","devise","devoid","devote","devour","dial","diana","diary","dice","dictum","did","die","diesel","diet","differ","dig","digest","digit","dine","dinghy","dinner","diode","dip","dire","direct","dirt","dirty","disc","disco","dish","disk","dismal","dispel","ditch","dive","divert","divide","divine","dizzy","docile","dock","doctor","dog","dogma","dole","doll","dollar","dolly","domain","dome","domino","donate","done","donkey","donor","doom","door","dorsal","dose","dot","double","doubt","dough","dour","dove","down","dozen","draft","drag","dragon","drain","drama","drank","draw","drawer","dread","dream","dreary","dress","drew","dried","drift","drill","drink","drip","drive","driver","drop","drove","drown","drug","drum","drunk","dry","dual","duck","duct","due","duel","duet","duke","dull","duly","dumb","dummy","dump","dune","dung","duress","during","dusk","dust","dusty","dutch","duty","dwarf","dwell","dyer","dying","dynamo","each","eager","eagle","ear","earl","early","earn","earth","ease","easel","easily","east","easter","easy","eat","eaten","eater","echo","eddy","eden","edge","edible","edict","edit","editor","eel","eerie","eerily","effect","effort","egg","ego","eight","eighth","eighty","either","elbow","elder","eldest","elect","eleven","elicit","elite","else","elude","elves","embark","emblem","embryo","emerge","emit","empire","employ","empty","enable","enamel","end","endure","enemy","energy","engage","engine","enjoy","enlist","enough","ensure","entail","enter","entire","entry","envoy","envy","enzyme","epic","epoch","equal","equate","equip","equity","era","erect","eric","erode","erotic","errant","error","escape","escort","essay","essex","estate","esteem","ethic","ethnic","europe","evade","eve","even","event","ever","every","evict","evil","evoke","evolve","exact","exam","exceed","excel","except","excess","excise","excite","excuse","exempt","exert","exile","exist","exit","exodus","exotic","expand","expect","expert","expire","export","expose","extend","extra","eye","eyed","fabric","face","facial","fact","factor","fade","fail","faint","fair","fairly","fairy","faith","fake","falcon","fall","false","falter","fame","family","famine","famous","fan","fancy","far","farce","fare","farm","farmer","fast","fasten","faster","fat","fatal","fate","father","fatty","fault","faulty","fauna","fear","feast","feat","fed","fee","feeble","feed","feel","feet","fell","fellow","felt","female","fence","fend","ferry","fetal","fetch","feudal","fever","few","fewer","fiasco","fiddle","field","fiend","fierce","fiery","fifth","fifty","fig","fight","figure","file","fill","filled","filler","film","filter","filth","filthy","final","finale","find","fine","finery","finger","finish","finite","fire","firm","firmly","first","fiscal","fish","fisher","fist","fit","fitful","five","fix","flag","flair","flak","flame","flank","flap","flare","flash","flask","flat","flavor","flaw","fled","flee","fleece","fleet","flesh","fleshy","flew","flick","flight","flimsy","flint","flirt","float","flock","flood","floor","floppy","flora","floral","flour","flow","flower","fluent","fluffy","fluid","flung","flurry","flush","flute","flux","fly","flyer","foal","foam","focal","focus","fog","foil","fold","folk","follow","folly","fond","fondly","font","food","fool","foot","for","forbid","force","ford","forest","forge","forget","fork","form","formal","format","former","fort","forth","forty","forum","fossil","foster","foul","found","four","fourth","fox","foyer","frail","frame","franc","france","frank","fraud","fred","free","freed","freely","freeze","french","frenzy","fresh","friar","friday","fridge","fried","friend","fright","fringe","frock","frog","from","front","frost","frosty","frown","frozen","frugal","fruit","fry","fudge","fuel","full","fully","fumes","fun","fund","funny","fur","furry","fury","fuse","fusion","fuss","fussy","futile","future","fuzzy","gadget","gain","gala","galaxy","gale","gall","galley","gallon","gallop","gamble","game","gamma","gandhi","gang","gap","garage","garden","garlic","gas","gasp","gate","gather","gauge","gaunt","gave","gaze","gear","geese","gem","gemini","gender","gene","geneva","genial","genius","genre","gentle","gently","gentry","genus","george","germ","get","ghetto","ghost","giant","gift","giggle","gill","gilt","ginger","girl","give","given","glad","glade","glance","gland","glare","glass","glassy","gleam","glee","glide","global","globe","gloom","gloomy","gloria","glory","gloss","glossy","glove","glow","glue","gnat","gnu","goal","goat","gold","golden","golf","gone","gong","goo","good","goose","gore","gorge","gory","gosh","gospel","gossip","got","gothic","govern","gown","grab","grace","grade","grail","grain","grand","grant","grape","graph","grasp","grass","grassy","grate","grave","gravel","gravy","grease","greasy","great","greece","greed","greedy","greek","green","greet","grew","grey","grid","grief","grill","grim","grin","grind","grip","grit","gritty","groan","groin","groom","groove","gross","ground","group","grove","grow","grown","growth","grudge","grunt","guard","guess","guest","guide","guild","guilt","guilty","guise","guitar","gulf","gully","gun","gunman","guru","gut","guy","gypsy","habit","hack","had","hail","hair","hairy","haiti","hale","half","hall","halt","hamlet","hammer","hand","handle","handy","hang","hangar","hanoi","happen","happy","harass","harbor","hard","harder","hardly","hare","harem","harm","harp","harry","harsh","has","hash","hassle","haste","hasten","hasty","hat","hatch","hate","haul","haunt","havana","have","haven","havoc","hawaii","hawk","hay","hazard","haze","hazel","hazy","head","heal","health","heap","hear","heard","heart","hearth","hearty","heat","heater","heaven","heavy","hebrew","heck","hectic","hedge","heel","hefty","height","heir","held","helium","helix","hell","hello","helm","helmet","help","hemp","hence","henry","her","herald","herb","herd","here","hereby","hermes","hernia","hero","heroic","heroin","hey","heyday","hick","hidden","hide","high","higher","highly","hill","him","hind","hinder","hint","hippie","hire","his","hiss","hit","hive","hoard","hoarse","hobby","hockey","hold","holder","hole","hollow","holly","holy","home","honest","honey","hood","hook","hope","horn","horrid","horror","horse","hose","host","hot","hotel","hound","hour","house","hover","how","huge","hull","human","humane","humble","humid","hung","hunger","hungry","hunt","hurdle","hurl","hurry","hurt","hush","hut","hybrid","hymn","hyphen","ice","icing","icon","idaho","idea","ideal","idiom","idiot","idle","idly","idol","ignite","ignore","ill","image","immune","impact","imply","import","impose","inca","incest","inch","income","incur","indeed","index","india","indian","indoor","induce","inept","inert","infant","infect","infer","influx","inform","inject","injure","injury","ink","inlaid","inland","inlet","inmate","inn","innate","inner","input","insane","insect","insert","inset","inside","insist","insult","insure","intact","intake","intend","inter","into","invade","invent","invest","invite","invoke","inward","iowa","iran","iraq","irish","iron","ironic","irony","isaac","isabel","island","isle","israel","issue","italy","itch","item","itself","ivan","ivory","jack","jacket","jacob","jade","jaguar","jail","james","jane","japan","jargon","java","jaw","jazz","jeep","jelly","jerky","jest","jet","jewel","jewish","jim","job","jock","jockey","joe","john","join","joint","joke","jolly","jolt","jordan","joseph","joy","joyful","joyous","judge","judy","juice","juicy","july","jumble","jumbo","jump","june","jungle","junior","junk","junta","jury","just","kansas","karate","karl","keel","keen","keep","keeper","kenya","kept","kernel","kettle","key","khaki","kick","kid","kidnap","kidney","kill","killer","kin","kind","kindly","king","kiss","kite","kitten","knack","knee","kneel","knew","knife","knight","knit","knob","knock","knot","know","known","koran","korea","kuwait","label","lace","lack","lad","ladder","laden","lady","lagoon","laity","lake","lamb","lame","lamp","lance","land","lane","lap","lapse","large","larval","laser","last","latch","late","lately","latent","later","latest","latin","latter","laugh","launch","lava","lavish","law","lawful","lawn","lawyer","lay","layer","layman","lazy","lead","leader","leaf","leafy","league","leak","leaky","lean","leap","learn","lease","leash","least","leave","led","ledge","left","leg","legacy","legal","legend","legion","lemon","lend","length","lens","lent","leo","leper","lesion","less","lessen","lesser","lesson","lest","let","lethal","letter","level","lever","levy","lewis","liable","liar","libel","libya","lice","lick","lid","lie","lied","lier","life","lift","light","like","likely","limb","lime","limit","limp","line","linear","linen","linger","link","lint","lion","lip","liquid","liquor","list","listen","lit","live","lively","liver","liz","lizard","load","loaf","loan","lobby","lobe","local","locate","lock","locus","lodge","loft","lofty","log","logic","logo","london","lone","lonely","long","longer","look","loop","loose","loosen","loot","lord","lorry","lose","loss","lost","lot","lotion","lotus","loud","loudly","lounge","lousy","love","lovely","lover","low","lower","lowest","loyal","lucid","luck","lucky","lucy","lull","lump","lumpy","lunacy","lunar","lunch","lung","lure","lurid","lush","lust","lute","luther","luxury","lying","lymph","lynch","lyric","macho","macro","mad","madam","made","mafia","magic","magma","magnet","magnum","magpie","maid","maiden","mail","main","mainly","major","make","maker","male","malice","mall","malt","mammal","manage","mane","mania","manic","manner","manor","mantle","manual","manure","many","map","maple","marble","march","mare","margin","maria","marina","mark","market","marry","mars","marsh","martin","martyr","mary","mask","mason","mass","mast","master","mat","match","mate","matrix","matter","mature","maxim","may","maybe","mayor","maze","mead","meadow","meal","mean","meant","meat","medal","media","median","medic","medium","meet","mellow","melody","melon","melt","member","memo","memory","menace","mend","mental","mentor","menu","mercy","mere","merely","merge","merger","merit","merry","mesh","mess","messy","met","metal","meter","method","methyl","metric","metro","mexico","miami","mickey","mid","midday","middle","midst","midway","might","mighty","mild","mildew","mile","milk","milky","mill","mimic","mince","mind","mine","mini","mink","minor","mint","minus","minute","mire","mirror","mirth","misery","miss","mist","misty","mite","mix","moan","moat","mob","mobile","mock","mode","model","modem","modern","modest","modify","module","moist","molar","mold","mole","molten","moment","monday","money","monk","monkey","month","mood","moody","moon","moor","moral","morale","morbid","more","morgue","mortal","mortar","mosaic","moscow","moses","mosque","moss","most","mostly","moth","mother","motion","motive","motor","mount","mourn","mouse","mouth","move","movie","mrs","much","muck","mucus","mud","muddle","muddy","mule","mummy","munich","murder","murky","murmur","muscle","museum","music","mussel","must","mutant","mute","mutiny","mutter","mutton","mutual","muzzle","myopic","myriad","myself","mystic","myth","nadir","nail","naked","name","namely","nape","napkin","naples","narrow","nasal","nasty","nathan","nation","native","nature","nausea","naval","nave","navy","near","nearer","nearly","neat","neatly","neck","need","needle","needy","negate","neon","nepal","nephew","nerve","nest","net","neural","never","newly","next","nice","nicely","niche","nickel","niece","night","nile","nimble","nine","ninety","ninth","nobel","noble","nobody","node","noise","noisy","none","noon","nor","norm","normal","north","norway","nose","nosy","not","note","notice","notify","notion","noun","novel","novice","now","nozzle","null","numb","number","nurse","nut","nylon","nymph","oak","oar","oasis","oath","obese","obey","object","oblige","oboe","obtain","obtuse","occult","occupy","occur","ocean","octave","odd","off","offend","offer","office","offset","often","ohio","oil","oily","okay","old","older","oldest","olive","omega","omen","omit","once","one","onion","only","onset","onto","onus","onward","opaque","open","openly","opera","opium","oppose","optic","option","oracle","oral","orange","orbit","orchid","ordeal","order","organ","orgasm","orient","origin","ornate","orphan","oscar","other","otter","ought","ounce","our","out","outer","output","outset","oval","oven","over","overt","owe","owing","owl","own","owner","oxford","oxide","oxygen","oyster","ozone","pace","pack","packet","pact","pad","paddle","paddy","pagan","page","paid","pain","paint","pair","palace","pale","palm","pan","panama","panel","panic","papa","papal","paper","parade","parcel","pardon","parent","paris","parish","park","parody","parrot","part","partly","party","pascal","pass","past","paste","pastel","pastor","pastry","pat","patch","patent","path","patio","patrol","patron","paul","pause","pave","paw","pawn","pay","peace","peach","peak","pear","pearl","pedal","peel","peer","peking","pelvic","pelvis","pen","penal","pence","pencil","penny","people","pepper","per","perch","peril","period","perish","permit","person","peru","pest","pet","peter","petite","petrol","petty","phase","philip","phone","photo","phrase","piano","pick","picket","picnic","pie","piece","pier","pierce","piety","pig","pigeon","piggy","pike","pile","pill","pillar","pillow","pilot","pin","pinch","pine","pink","pint","pious","pipe","pirate","piss","pistol","piston","pit","pitch","pity","pivot","pixel","pizza","place","placid","plague","plain","plan","plane","planet","plank","plant","plasma","plate","play","player","plea","plead","please","pledge","plenty","plight","plot","plough","ploy","plug","plum","plump","plunge","plural","plus","plush","pocket","poem","poet","poetic","poetry","point","poison","poland","polar","pole","police","policy","polish","polite","poll","pollen","polo","pond","ponder","pony","pool","poor","poorly","pop","poppy","pore","pork","port","portal","pose","posh","post","postal","pot","potato","potent","pouch","pound","pour","powder","power","praise","pray","prayer","preach","prefer","prefix","press","pretty","price","pride","priest","primal","prime","prince","print","prior","prism","prison","privy","prize","probe","profit","prompt","prone","proof","propel","proper","prose","proton","proud","prove","proven","proxy","prune","pry","psalm","pseudo","psyche","pub","public","puff","pull","pulp","pulpit","pulsar","pulse","pump","punch","punish","punk","pupil","puppet","puppy","pure","purely","purge","purify","purple","purse","pursue","push","pushy","put","putt","puzzle","quaint","quake","quarry","quart","quartz","quebec","queen","queer","query","quest","queue","quick","quid","quiet","quilt","quirk","quit","quite","quiver","quiz","quota","quote","rabbit","race","racial","racism","rack","racket","radar","radio","radish","radius","raffle","raft","rage","raid","rail","rain","rainy","raise","rake","rally","ramp","random","range","rank","ransom","rape","rapid","rare","rarely","rarity","rash","rat","rate","rather","ratify","ratio","rattle","rave","raven","raw","ray","razor","reach","react","read","reader","ready","real","really","realm","reap","rear","reason","rebel","recall","recent","recess","recipe","reckon","record","recoup","rector","red","redeem","redo","reduce","reed","reef","reek","refer","reform","refuge","refuse","regal","regard","regent","regime","region","regret","reign","reject","relate","relax","relay","relic","relief","relish","rely","remain","remark","remedy","remind","remit","remote","remove","renal","render","rent","rental","repair","repeal","repeat","repent","reply","report","rescue","resent","reside","resign","resin","resist","resort","rest","result","resume","retail","retain","retina","retire","return","reveal","review","revise","revive","revolt","reward","rex","rhine","rhino","rhyme","rhythm","ribbon","rice","rich","rick","rid","ride","rider","ridge","rife","rifle","rift","right","rigid","rile","rim","ring","rinse","riot","ripe","ripen","ripple","rise","risk","risky","rite","ritual","ritz","rival","river","road","roar","roast","rob","robe","robert","robin","robot","robust","rock","rocket","rocky","rod","rode","rodent","rogue","role","roll","roman","rome","roof","room","root","rope","rose","rosy","rot","rotate","rotor","rotten","rouge","rough","round","route","rover","row","royal","rub","rubber","rubble","ruby","rudder","rude","rug","rugby","ruin","rule","ruler","rumble","rump","run","rune","rung","runway","rural","rush","russia","rust","rustic","rusty","sack","sacred","sad","saddle","sadism","sadly","safari","safe","safely","safer","safety","saga","sage","sahara","said","sail","sailor","saint","sake","salad","salary","sale","saline","saliva","salmon","saloon","salt","salty","salute","sam","same","sample","sand","sandy","sane","sash","satin","satire","saturn","sauce","saucer","saudi","sauna","savage","save","saw","say","scale","scalp","scan","scant","scar","scarce","scare","scarf","scary","scene","scenic","scent","school","scold","scope","score","scorn","scotch","scott","scout","scrap","scrape","scream","screen","screw","script","scroll","scrub","scum","sea","seal","seam","seaman","search","season","seat","second","secret","sect","sector","secure","see","seed","seeing","seek","seem","seize","seldom","select","self","sell","seller","semi","senate","send","senile","senior","sense","sensor","sent","sentry","seoul","sequel","serene","serial","series","sermon","serum","serve","server","set","settle","seven","severe","sew","sewage","shabby","shade","shadow","shady","shaft","shaggy","shah","shake","shaky","shall","sham","shame","shape","share","shark","sharp","shawl","she","shear","sheen","sheep","sheer","sheet","shelf","shell","sherry","shield","shift","shine","shiny","ship","shire","shirk","shirt","shiver","shock","shoe","shook","shoot","shop","shore","short","shot","should","shout","show","shower","shrank","shrewd","shrill","shrimp","shrine","shrink","shrub","shrug","shut","shy","shyly","sick","side","siege","sigh","sight","sigma","sign","signal","silent","silk","silken","silky","sill","silly","silo","silver","simple","simply","since","sinful","sing","singer","single","sink","sir","sire","siren","sister","sit","site","sitter","six","sixth","sixty","size","sketch","skill","skin","skinny","skip","skirt","skull","sky","slab","slack","slain","slam","slang","slap","slat","slate","slave","sleek","sleep","sleepy","sleeve","slice","slick","slid","slide","slight","slim","slimy","sling","slip","slit","slogan","slope","sloppy","slot","slow","slowly","slug","slum","slump","smack","small","smart","smash","smear","smell","smelly","smelt","smile","smite","smoke","smoky","smooth","smug","snack","snail","snake","snap","snatch","sneak","snow","snowy","snug","soak","soap","sober","soccer","social","sock","socket","socks","soda","sodden","sodium","sofa","soft","soften","softly","soggy","soil","solar","sold","sole","solely","solemn","solid","solo","solve","some","son","sonar","sonata","song","sonic","sony","soon","sooner","soot","soothe","sordid","sore","sorrow","sorry","sort","soul","sound","soup","sour","source","soviet","sow","space","spade","spain","span","spare","spark","sparse","spasm","spat","spate","speak","spear","speech","speed","speedy","spell","spend","sphere","spice","spicy","spider","spiky","spill","spin","spinal","spine","spiral","spirit","spit","spite","splash","split","spoil","spoke","sponge","spoon","sport","spot","spouse","spray","spread","spree","spring","sprint","spur","squad","square","squash","squat","squid","stab","stable","stack","staff","stage","stain","stair","stairs","stake","stale","stall","stamp","stance","stand","staple","star","starch","stare","stark","start","starve","state","static","statue","status","stay","stead","steady","steak","steal","steam","steel","steep","steer","stem","stench","step","stereo","stern","stew","stick","sticky","stiff","stifle","stigma","still","sting","stint","stir","stitch","stock","stocky","stone","stony","stool","stop","store","storm","stormy","story","stout","stove","stow","strain","strait","strand","strap","strata","straw","stray","streak","stream","street","stress","strict","stride","strife","strike","string","strip","stripe","strive","stroke","stroll","strong","stud","studio","study","stuff","stuffy","stunt","stupid","sturdy","style","submit","subtle","subtly","suburb","such","sudden","sue","suez","suffer","sugar","suit","suite","suitor","sullen","sultan","sum","summer","summit","summon","sun","sunday","sunny","sunset","super","superb","supper","supple","supply","sure","surely","surf","surge","survey","suture","swamp","swan","swap","swarm","sway","swear","sweat","sweaty","sweden","sweep","sweet","swell","swift","swim","swine","swing","swirl","swiss","switch","sword","swore","sydney","symbol","synod","syntax","syria","syrup","system","table","tablet","taboo","tacit","tackle","tact","tactic","tail","tailor","taiwan","take","tale","talent","talk","tall","tally","tame","tampa","tan","tandem","tangle","tank","tap","tape","target","tariff","tarp","tart","tarzan","task","taste","tasty","tattoo","taurus","taut","tavern","tax","taxi","tea","teach","teak","team","tear","tease","tech","teeth","tell","temper","temple","tempo","tempt","ten","tenant","tend","tender","tendon","tennis","tenor","tense","tent","tenth","tenure","teresa","term","terror","terse","test","texas","text","thank","thaw","them","theme","thence","theory","there","these","thesis","they","thick","thief","thigh","thin","thing","think","third","thirst","thirty","this","thomas","thorn","those","though","thread","threat","three","thrill","thrive","throat","throne","throng","throw","thrust","thud","thug","thumb","thus","thyme","tibet","tick","ticket","tidal","tide","tidy","tie","tier","tiger","tight","tile","till","tilt","timber","time","timid","tin","tiny","tip","tire","tissue","title","toad","toast","today","toe","toilet","token","tokyo","told","toll","tom","tomato","tomb","tonal","tone","tongue","tonic","too","took","tool","tooth","top","topaz","topic","torch","torque","torso","tort","toss","total","touch","tough","tour","toward","towel","tower","town","toxic","toxin","toy","trace","track","tract","trade","tragic","trail","train","trait","tram","trance","trap","trauma","travel","tray","tread","treat","treaty","treble","tree","trek","tremor","trench","trend","trendy","trial","tribal","tribe","trick","tricky","tried","trifle","trim","trio","trip","triple","troop","trophy","trot","trough","trout","truce","truck","true","truly","trunk","trust","truth","try","tube","tumble","tuna","tundra","tune","tunic","tunnel","turban","turf","turk","turkey","turn","turtle","tutor","tweed","twelve","twenty","twice","twin","twist","two","tycoon","tying","type","tyrant","ugly","ulcer","ultra","umpire","unable","uncle","under","uneasy","unfair","unify","union","unique","unit","unite","unity","unlike","unrest","unruly","until","update","upheld","uphill","uphold","upon","upper","uproar","upset","upshot","uptake","upturn","upward","urban","urge","urgent","urging","urine","usable","usage","use","useful","user","usual","utmost","utter","vacant","vacuum","vague","vain","valet","valid","valley","value","valve","van","vanish","vanity","vary","vase","vast","vat","vault","vector","veil","vein","velvet","vendor","veneer","venice","venom","vent","venue","venus","verb","verbal","verge","verify","verity","verse","versus","very","vessel","vest","vet","veto","via","viable","vicar","vice","victim","victor","video","vienna","view","vigil","viking","vile","villa","vine","vinyl","viola","violet","violin","viral","virgo","virtue","virus","visa","vision","visit","visual","vital","vivid","vocal","vodka","vogue","voice","void","volley","volume","vote","vowel","voyage","vulgar","wade","wage","waist","wait","waiter","wake","walk","walker","wall","wallet","walnut","wander","want","war","warden","warm","warmth","warn","warp","warsaw","wary","was","wash","wasp","waste","watch","water","watery","wave","wax","way","weak","weaken","wealth","weapon","wear","weary","weave","wedge","wee","weed","week","weekly","weep","weigh","weight","weird","well","were","west","wet","whale","wharf","what","wheat","wheel","when","whence","where","which","whiff","while","whim","whip","whisky","white","who","whole","wholly","whom","whose","why","wicked","wide","widely","widen","wider","widow","width","wife","wig","wild","wildly","will","willow","wily","win","wind","window","windy","wine","wing","wink","winner","winter","wipe","wire","wisdom","wise","wish","wit","witch","with","within","witty","wizard","woke","wolf","wolves","woman","womb","won","wonder","wood","wooden","woods","woody","wool","word","work","worker","world","worm","worry","worse","worst","worth","worthy","would","wound","wrap","wrath","wreath","wreck","wring","wrist","writ","write","writer","wrong","xerox","yacht","yale","yard","yarn","yeah","year","yeard","yeast","yellow","yet","yield","yogurt","yolk","you","young","your","youth","zaire","zeal","zebra","zenith","zero","zeus","zigzag","zinc","zombie","zone"],bip39Words=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];async function digest$1(e){return new Uint8Array(await crypto.subtle.digest("SHA-256",e))}async function toSeed(e,t){const n=e.join(" "),r=`mnemonic${t}`.normalize("NFKD");return deriveKey(HashAlgorithm.Sha512,n,r,2048,64)}function legacy1(e,t){const n=convertRadix(e.map(e=>t.indexOf(e.toLowerCase())),t.length,256,33),r=n[n.length-1],o=new Uint8Array(n.length-1);for(let e=0;e<n.length-1;e+=1)o[e]=n[e]^r;return[o,r]}async function legacy2(e,t){const n=11*e.length,r=[];r.fill(!1,0,n);for(const[n,o]of e.entries()){const e=t.indexOf(o.toLowerCase());if(e<0)throw new Error(`Word not found in wordlist: ${o}`);for(let t=0;t<11;t+=1)r[11*n+t]=!!(e&1<<10-t)}const o=n/33,i=n-o,a=new Uint8Array(i/8);for(let e=0;e<a.length;e+=1)for(let t=0;t<8;t+=1)r[8*e+t]&&(a[e]|=1<<7-t);const s=bytesToBits(await digest$1(a));for(let e=0;e<o;e+=1)if(r[i+e]!==s[e])throw new Error("Checksum mismatch");return a}function crc8(e){let t=255;for(let n=0;n<e.length-1;n+=1){t^=e[n];for(let e=0;e<8;e+=1)t=t>>>1^(1&t?178:0)}return 255^t}function convertRadix(e,t,n,r){let o=new BigNumber$1(0);for(const n of e)o=o.times(t),o=o.plus(n);const i=new Uint8Array(r);for(let e=r-1;e>=0;e-=1){const t=o.dividedToIntegerBy(n),r=o.modulo(n);o=t,i[e]=r.toNumber()}return i}function bytesToBits(e){const t=[];t.fill(!1,0,8*e.length);for(let n=0;n<e.length;n+=1)for(let r=0;r<8;r+=1)t[8*n+r]=!!(e[n]&1<<7-r);return t}const ED25519_SEED_TEXT="ed25519 seed",ECDSA_SEED_TEXT="Bitcoin seed",HARDENED=2147483648,HEDERA_PATH=[44,3030,0,0],SLIP44_ECDSA_HEDERA_PATH=[44|HARDENED,3030|HARDENED,0|HARDENED,0],SLIP44_ECDSA_ETH_PATH=[44|HARDENED,60|HARDENED,0|HARDENED,0,0];let Mnemonic$1=class e{constructor({words:e}){this.words=e}static generate(){return e._generate(24)}static generate12(){return e._generate(12)}static async _generate(t){let n;if(12===t)n=16;else{if(24!==t)throw new Error(`unsupported phrase length ${t}, only 12 or 24 are supported`);n=32}const r=await bytesAsync(n),o=(bytesToBinary(Array.from(r))+await deriveChecksumBits(r)).match(/(.{1,11})/g),i=(null!=o?o:[]).map(e=>bip39Words[binaryToByte(e)]);return new e({words:i})}static fromWords(t){return new e({words:t})._validate()}toPrivateKey(e=""){return this.toEd25519PrivateKey(e)}async toEd25519PrivateKey(e="",t=HEDERA_PATH){let{keyData:n,chainCode:r}=await this._toKeyData(e,ED25519_SEED_TEXT);for(const e of t)({keyData:n,chainCode:r}=await derive(n,r,e));const o=nacl.sign.keyPair.fromSeed(n);if(null==CACHE$1.privateKeyConstructor)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyConstructor(new Ed25519PrivateKey(o,r))}async toStandardEd25519PrivateKey(t="",n){const r=await e.toSeed(this.words,t);let o=await PrivateKey$1.fromSeedED25519(r);n=null==n?0:n;for(const e of[44,3030,0,0,n])o=await o.derive(e);return o}async toEcdsaPrivateKey(e="",t=HEDERA_PATH){let{keyData:n,chainCode:r}=await this._toKeyData(e,ECDSA_SEED_TEXT);for(const e of t)({keyData:n,chainCode:r}=await derive$1(n,r,e));if(null==CACHE$1.privateKeyConstructor)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyConstructor(new EcdsaPrivateKey(fromBytes(n),r))}async toStandardECDSAsecp256k1PrivateKey(t="",n){const r=await e.toSeed(this.words,t);let o=await PrivateKey$1.fromSeedECDSAsecp256k1(r);n=null==n?0:n;for(const e of[toHardenedIndex(44),toHardenedIndex(3030),toHardenedIndex(0),0,n])o=await o.derive(e);return o}static async toSeed(e,t){return await toSeed(e,t)}async _toKeyData(e,t){const n=await toSeed(this.words,e),r=await hash(HashAlgorithm.Sha512,t,n);return{keyData:r.subarray(0,32),chainCode:r.subarray(32)}}static async fromString(t){return e.fromWords(t.split(/\s|,/))}async _validate(){if(22===this.words.length){const e=this.words.reduce((e,t,n)=>legacyWords.includes(t.toLowerCase())?e:[...e,n],[]);if(e.length>0)throw new BadMnemonicError(this,BadMnemonicReason.UnknownWords,e);const[t,n]=legacy1(this.words,legacyWords);if(n!==crc8(t))throw new BadMnemonicError(this,BadMnemonicReason.ChecksumMismatch,[])}else{if(12!==this.words.length&&24!==this.words.length)throw new BadMnemonicError(this,BadMnemonicReason.BadLength,[]);const e=this.words.reduce((e,t,n)=>bip39Words.includes(t)?e:[...e,n],[]);if(e.length>0)throw new BadMnemonicError(this,BadMnemonicReason.UnknownWords,e);const t=this.words.map(e=>bip39Words.indexOf(e).toString(2).padStart(11,"0")).join(""),n=32*Math.floor(t.length/33),r=t.slice(0,n),o=t.slice(n),i=r.match(/(.{1,8})/g).map(binaryToByte);if(await deriveChecksumBits(Uint8Array.from(i))!==o)throw new BadMnemonicError(this,BadMnemonicReason.ChecksumMismatch,[])}return this}async toLegacyPrivateKey(){let e;if(22===this.words.length?[e]=legacy1(this.words,legacyWords):e=await legacy2(this.words,bip39Words),null==CACHE$1.privateKeyFromBytes)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyFromBytes(e)}toString(){return this.words.join(" ")}};function binaryToByte(e){return parseInt(e,2)}function bytesToBinary(e){return e.map(e=>e.toString(2).padStart(8,"0")).join("")}async function deriveChecksumBits(e){const t=8*e.length/32,n=await digest$1(e);return bytesToBinary(Array.from(n)).slice(0,t)}function arrayEqual(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=new DataView(t.buffer,t.byteOffset,t.byteLength);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}class Cache{constructor(){this._timeDrift=0,this._contractId=null,this._keyList=null,this._thresholdKey=null,this._publicKeyED25519=null,this._publicKeyECDSA=null,this._privateKeyConstructor=null,this._mnemonicFromString=null,this._accountIdConstructor=null,this._delegateContractId=null,this._evmAddress=null,this._ethereumTransactionDataLegacyFromBytes=null,this._ethereumTransactionDataEip1559FromBytes=null,this._ethereumTransactionDataEip2930FromBytes=null,this._transactionReceiptQueryConstructor=null,this._transactionRecordQueryConstructor=null}setTimeDrift(e){this._timeDrift=e}get timeDrift(){if(null==this._timeDrift)throw new Error("Cache.timeDrift was used before it was set");return this._timeDrift}setContractId(e){this._contractId=e}get contractId(){if(null==this._contractId)throw new Error("Cache.contractId was used before it was set");return this._contractId}setKeyList(e){this._keyList=e}get keyList(){if(null==this._keyList)throw new Error("Cache.keyList was used before it was set");return this._keyList}setThresholdKey(e){this._thresholdKey=e}get thresholdKey(){if(null==this._thresholdKey)throw new Error("Cache.thresholdKey was used before it was set");return this._thresholdKey}setPublicKeyED25519(e){this._publicKeyED25519=e}get publicKeyED25519(){if(null==this._publicKeyED25519)throw new Error("Cache.publicKeyED25519 was used before it was set");return this._publicKeyED25519}setPublicKeyECDSA(e){this._publicKeyECDSA=e}get publicKeyECDSA(){if(null==this._publicKeyECDSA)throw new Error("Cache.publicKeyECDSA was used before it was set");return this._publicKeyECDSA}setPrivateKeyConstructor(e){this._privateKeyConstructor=e}get privateKeyConstructor(){if(null==this._privateKeyConstructor)throw new Error("Cache.privateKeyConstructor was used before it was set");return this._privateKeyConstructor}setMnemonicFromString(e){this._mnemonicFromString=e}get mnemonicFromString(){if(null==this._mnemonicFromString)throw new Error("Cache.mnemonicFromString was used before it was set");return this.mnemonicFromString}setAccountIdConstructor(e){this._accountIdConstructor=e}get accountIdConstructor(){if(null==this._accountIdConstructor)throw new Error("Cache.accountIdConstructor was used before it was set");return this._accountIdConstructor}setDelegateContractId(e){this._delegateContractId=e}get delegateContractId(){if(null==this._delegateContractId)throw new Error("Cache.delegateContractId was used before it was set");return this._delegateContractId}setEvmAddress(e){this._evmAddress=e}get evmAddress(){if(null==this._evmAddress)throw new Error("Cache.evmAddress was used before it was set");return this._evmAddress}setEthereumTransactionDataLegacyFromBytes(e){this._ethereumTransactionDataLegacyFromBytes=e}get ethereumTransactionDataLegacyFromBytes(){if(null==this._ethereumTransactionDataLegacyFromBytes)throw new Error("Cache.ethereumTransactionDataLegacyFromBytes was used before it was set");return this._ethereumTransactionDataLegacyFromBytes}setEthereumTransactionDataEip1559FromBytes(e){this._ethereumTransactionDataEip1559FromBytes=e}get ethereumTransactionDataEip1559FromBytes(){if(null==this._ethereumTransactionDataEip1559FromBytes)throw new Error("Cache.ethereumTransactionDataEip1559FromBytes was used before it was set");return this._ethereumTransactionDataEip1559FromBytes}setEthereumTransactionDataEip2930FromBytes(e){this._ethereumTransactionDataEip2930FromBytes=e}get ethereumTransactionDataEip2930FromBytes(){if(null==this._ethereumTransactionDataEip2930FromBytes)throw new Error("Cache.ethereumTransactionDataEip2930FromBytes was used before it was set");return this._ethereumTransactionDataEip2930FromBytes}setTransactionReceiptQueryConstructor(e){this._transactionReceiptQueryConstructor=e}get transactionReceiptQueryConstructor(){if(null==this._transactionReceiptQueryConstructor)throw new Error("Cache.transactionReceiptQueryConstructor was used before it was set");return this._transactionReceiptQueryConstructor}setTransactionRecordQueryConstructor(e){this._transactionRecordQueryConstructor=e}get transactionRecordQueryConstructor(){if(null==this._transactionRecordQueryConstructor)throw new Error("Cache.transactionRecordQueryConstructor was used before it was set");return this._transactionRecordQueryConstructor}}const CACHE=new Cache;class Key{_toProtobufKey(){throw new Error("not implemented")}static _fromProtobufKey(e){return null!=e.contractID?CACHE.contractId(e.contractID):null!=e.delegatableContractId?CACHE.delegateContractId(e.delegatableContractId):null!=e.ed25519&&e.ed25519.byteLength>0?CACHE.publicKeyED25519(e.ed25519):null!=e.ECDSASecp256k1&&e.ECDSASecp256k1.byteLength>0?CACHE.publicKeyECDSA(e.ECDSASecp256k1):null!=e.thresholdKey&&null!=e.thresholdKey.threshold?CACHE.thresholdKey(e.thresholdKey):null!=e.keyList?CACHE.keyList(e.keyList):null}}class PublicKey extends Key{constructor(e){super(),this._key=e}static fromBytes(e){return new PublicKey(PublicKey$1.fromBytes(e))}static fromBytesED25519(e){return new PublicKey(PublicKey$1.fromBytesED25519(e))}static fromBytesECDSA(e){return new PublicKey(PublicKey$1.fromBytesECDSA(e))}static fromString(e){return new PublicKey(PublicKey$1.fromString(e))}static fromStringECDSA(e){return new PublicKey(PublicKey$1.fromStringECDSA(e))}static fromStringED25519(e){return new PublicKey(PublicKey$1.fromStringED25519(e))}verify(e,t){return this._key.verify(e,t)}verifyTransaction(e){e._requireFrozen(),e.isFrozen()||e.freeze();for(const t of e._signedTransactions.list)if(null!=t.sigMap&&null!=t.sigMap.sigPair){let e=!1;for(const n of t.sigMap.sigPair){if(arrayEqual(n.pubKeyPrefix,this.toBytesRaw())){e=!0;const r=t.bodyBytes;let o=null;if(null!=n.ed25519?o=n.ed25519:null!=n.ECDSASecp256k1&&(o=n.ECDSASecp256k1),null==o)continue;if(!this.verify(r,o))return!1}}if(!e)return!1}return!0}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toEthereumAddress(){return this._key.toEthereumAddress()}toEvmAddress(){return this._key.toEthereumAddress()}toString(){return this._key.toString()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}equals(e){return this._key.equals(e._key)}_toProtobufKey(){switch(this._key._type){case"ED25519":return{ed25519:this._key.toBytesRaw()};case"secp256k1":return{ECDSASecp256k1:this._key.toBytesRaw()};default:throw new Error(`unrecognized key type ${this._key._type}`)}}_toProtobufSignature(e){switch(this._key._type){case"ED25519":return{pubKeyPrefix:this._key.toBytesRaw(),ed25519:e};case"secp256k1":return{pubKeyPrefix:this._key.toBytesRaw(),ECDSASecp256k1:e};default:throw new Error(`unrecognized key type ${this._key._type}`)}}get type(){return this._key._type}toAccountId(e,t){return CACHE.accountIdConstructor(e,t,this)}static unusableKey(){return PublicKey.fromStringED25519("0000000000000000000000000000000000000000000000000000000000000000")}}CACHE.setPublicKeyED25519(e=>PublicKey.fromBytesED25519(e)),CACHE.setPublicKeyECDSA(e=>PublicKey.fromBytesECDSA(e));const version$6="logger/5.8.0";let _permanentCensorErrors=!1,_censorErrors=!1;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels.default,_globalLogger=null;function _checkNormalize(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}const _normalizeError=_checkNormalize();var LogLevel$1,ErrorCode;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(LogLevel$1||(LogLevel$1={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";let Logger$1=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==LogLevels[n]&&this.throwArgumentError("invalid log level name","logLevel",e),_logLevel>LogLevels[n]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,n,r){if(_censorErrors)return this.makeError("censored error",n,{});n||(n=e.errors.UNKNOWN_ERROR),r||(r={});const o=[];Object.keys(r).forEach(e=>{const t=r[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=HEX[t[e]>>4],n+=HEX[15&t[e]];o.push(e+"=Uint8Array(0x"+n+")")}else o.push(e+"="+JSON.stringify(t))}catch(t){o.push(e+"="+JSON.stringify(r[e].toString()))}}),o.push(`code=${n}`),o.push(`version=${this.version}`);const i=t;let a="";switch(n){case ErrorCode.NUMERIC_FAULT:{a="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":a+="-"+e;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break}case ErrorCode.CALL_EXCEPTION:case ErrorCode.INSUFFICIENT_FUNDS:case ErrorCode.MISSING_NEW:case ErrorCode.NONCE_EXPIRED:case ErrorCode.REPLACEMENT_UNDERPRICED:case ErrorCode.TRANSACTION_REPLACED:case ErrorCode.UNPREDICTABLE_GAS_LIMIT:a=n}a&&(t+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),o.length&&(t+=" ("+o.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=n,Object.keys(r).forEach(function(e){s[e]=r[e]}),s}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(t,n,r){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:n,value:r})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(t){_normalizeError&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}checkSafeUint53(t,n){"number"==typeof t&&(null==n&&(n="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,n,r){r=r?": "+r:"",t<n&&this.throwError("missing argument"+r,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:n}),t>n&&this.throwError("too many arguments"+r,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:n})}checkNew(t,n){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}checkAbstract(t,n){t===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}static globalLogger(){return _globalLogger||(_globalLogger=new e(version$6)),_globalLogger}static setCensorship(t,n){if(!t&&n&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_permanentCensorErrors){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!t,_permanentCensorErrors=!!n}static setLogLevel(t){const n=LogLevels[t.toLowerCase()];null!=n?_logLevel=n:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Logger$1.errors=ErrorCode,Logger$1.levels=LogLevel$1;const version$5="bytes/5.8.0",logger$8=new Logger$1(version$5);function isHexable(e){return!!e.toHexString}function addSlice(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function isBytesLike(e){return isHexString(e)&&!(e.length%2)||isBytes(e)}function isInteger(e){return"number"==typeof e&&e==e&&e%1==0}function isBytes(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!isInteger(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!isInteger(n)||n<0||n>=256)return!1}return!0}function arrayify(e,t){if(t||(t={}),"number"==typeof e){logger$8.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),addSlice(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),isHexable(e)&&(e=e.toHexString()),isHexString(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":logger$8.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return addSlice(new Uint8Array(r))}return isBytes(e)?addSlice(new Uint8Array(e)):logger$8.throwArgumentError("invalid arrayify value","value",e)}function concat(e){const t=e.map(e=>arrayify(e)),n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n);return t.reduce((e,t)=>(r.set(t,e),e+t.length),0),addSlice(r)}function isHexString(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const HexCharacters="0123456789abcdef";function hexlify(e,t){if(t||(t={}),"number"==typeof e){logger$8.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=HexCharacters[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),isHexable(e))return e.toHexString();if(isHexString(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":logger$8.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(isBytes(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=HexCharacters[(240&r)>>4]+HexCharacters[15&r]}return t}return logger$8.throwArgumentError("invalid hexlify value","value",e)}function hexConcat(e){let t="0x";return e.forEach(e=>{t+=hexlify(e).substring(2)}),t}function hexZeroPad(e,t){for("string"!=typeof e?e=hexlify(e):isHexString(e)||logger$8.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&logger$8.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}class EvmAddress extends Key{constructor(e){super(),this._bytes=e}static fromString(e){if(40!==(e=e.startsWith("0x")?e.slice(2):e).length)throw new Error("Input EVM address string is not the correct size");return new EvmAddress(decode$8(e))}static fromBytes(e){return new EvmAddress(e)}toBytes(){return this._bytes}toString(){return encode$5(this._bytes)}equals(e){return arrayEqual$2(this._bytes,e._bytes)}}const regex=/"^(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))(?:-([a-z]{5}))?$/,ENTITY_ID_REGEX=/^(\d+)(?:\.(\d+)\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/,EVM_ADDRESS_LENGTH=20,LONG_ZERO_PREFIX_LENGTH=12,ENTITY_NUM_OFFSET=16;function constructor(e,t,n){if(null==t&&null!=n||null!=t&&null==n)throw new Error("invalid entity ID");const[r,o,i]="number"==typeof e||Long.isLong(e)?[null!=n?Long.fromValue(e):Long.ZERO,null!=t?Long.fromValue(t):Long.ZERO,null!=n?Long.fromValue(n):Long.fromValue(e)]:[null!=e.shard?Long.fromValue(e.shard):Long.ZERO,null!=e.realm?Long.fromValue(e.realm):Long.ZERO,Long.fromValue(e.num)];if(r.isNegative()||o.isNegative()||i.isNegative())throw new Error("negative numbers are not allowed in IDs");return{shard:r,realm:o,num:i}}function compare(e,t){let n=e[0].compare(t[0]);return 0!=n?n:(n=e[1].compare(t[1]),0!=n?n:e[2].compare(t[2]))}function fromStringSplitter(e){const t=ENTITY_ID_REGEX.exec(e);if(null==t)throw new Error(`failed to parse entity id: ${e}`);return null==t[2]&&null==t[3]?{shard:"0",realm:"0",numOrHex:t[1],checksum:t[4]}:{shard:t[1],realm:t[2],numOrHex:t[3],checksum:t[4]}}function fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm)||Number.isNaN(t.numOrHex))throw new Error("invalid format for entity ID");return{shard:null!=t.shard?Long.fromString(t.shard):Long.ZERO,realm:null!=t.realm?Long.fromString(t.realm):Long.ZERO,num:Long.fromString(t.numOrHex),checksum:t.checksum}}function fromSolidityAddress(e){const t=e.startsWith("0x")?decode$8(e.slice(2)):decode$8(e);if(t.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${e.length}`);return[Long.fromBytesBE([0,0,0,0,...t.slice(0,4)]),Long.fromBytesBE(Array.from(t.slice(4,12))),Long.fromBytesBE(Array.from(t.slice(12,20)))]}function fromEvmAddress(e,t,n){if(!isHexString$1(n))throw new Error(`Invalid EVM address hex string: ${n}`);const r=n.startsWith("0x")?decode$8(n.slice(2)):decode$8(n);if(r.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded evm address length:\n expected length ${EVM_ADDRESS_LENGTH}, got length ${n.length}`);let o=Long.ZERO;return isLongZeroAddress(r)&&(o=Long.fromBytesBE(Array.from(r.slice(LONG_ZERO_PREFIX_LENGTH,EVM_ADDRESS_LENGTH)))),[e instanceof Long?e:Long.fromNumber(e),t instanceof Long?t:Long.fromNumber(t),o,o.isZero()?EvmAddress.fromBytes(r):null]}function toSolidityAddress(e){const t=new Uint8Array(20),n=safeView(t),[r,o,i]=e;return n.setUint32(0,convertToNumber(r)),n.setUint32(8,convertToNumber(o)),n.setUint32(16,convertToNumber(i)),encode$5(t)}function toEvmAddress(e){if(e instanceof Uint8Array)return encode$5(e);const t=e,n=new Uint8Array(EVM_ADDRESS_LENGTH);return safeView(n).setUint32(ENTITY_NUM_OFFSET,convertToNumber(t)),encode$5(n)}function _parseAddress(e,t){let n=regex.exec(t);if(null===n){return{status:0}}let r=[Long.fromString(n[1]),Long.fromString(n[2]),Long.fromString(n[3])],o=`${r[0].toString()}.${r[1].toString()}.${r[2].toString()}`,i=_checksum(e,o);return{status:void 0===n[4]?2:i==n[4]?3:1,num1:r[0],num2:r[1],num3:r[2],givenChecksum:n[4],correctChecksum:i,noChecksumFormat:o,withChecksumFormat:`${o}-${i}`}}function _checksum(e,t){let n="",r=[],o=0,i=0,a=0,s=0,c=0;const u=11881376,l="a".charCodeAt(0);let d=new Uint8Array(e.length+6);d.set(e,0),d.set([0,0,0,0,0,0],e.length);for(let e=0;e<t.length;e++)r.push("."===t[e]?10:parseInt(t[e],10));for(let e=0;e<r.length;e++)a=(31*a+r[e])%17576,e%2==0?o=(o+r[e])%11:i=(i+r[e])%11;for(let e=0;e<d.length;e++)s=(31*s+d[e])%u;c=(17576*(11*(t.length%5*11+o)+i)+a+s)%u,c=1000003*c%u;for(let e=0;e<5;e++)n=String.fromCharCode(l+c%26)+n,c/=26;return n}function validateChecksum(e,t,n,r,o){if(null==o._network._ledgerId||null==r)return;const i=_checksum(o._network._ledgerId._ledgerId,`${e.toString()}.${t.toString()}.${n.toString()}`);if(r!=i)throw new BadEntityIdError(e,t,n,r,i)}function toStringWithChecksum(e,t){if(null==t)throw new Error("client cannot be null");if(null==t._network._ledgerId)throw new Error("cannot calculate checksum with a client that does not contain a recognzied ledger ID");return`${e}-${_checksum(t._network._ledgerId._ledgerId,e)}`}function appendBuffer(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n}function toHexString(e){var t="0x";return e.forEach(function(e){t+=("0"+(255&e).toString(16)).slice(-2)}),t}function aliasToPublicKey(e){const t=base32.decode(e);if(!t)return null;let n;try{n=libExports.proto.Key.decode(t)}catch(e){throw new Error("The alias is created with hollow account. Please use aliasToEvmAddress!")}return null!=n.ed25519&&n.ed25519.byteLength>0?PublicKey.fromBytes(n.ed25519):null!=n.ECDSASecp256k1&&n.ECDSASecp256k1.byteLength>0?PublicKey.fromBytes(n.ECDSASecp256k1):null}function aliasToEvmAddress(e){const t=base32.decode(e);if(!t)return null;try{throw libExports.proto.Key.decode(t),new Error("The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!")}catch(e){return toHexString(t)}}function publicKeyToAlias(e){if("string"==typeof e&&(e.startsWith("0x")&&42==e.length||40==e.length)){e.startsWith("0x")||(e=`0x${e}`);const t=arrayify(e);return t?base32.encode(t):null}const t="string"==typeof e?PublicKey.fromString(e):e;let n=t.toStringRaw(),r="";"secp256k1"===t._key._type&&(r="0x3A21"),"ED25519"===t._key._type&&(r="0x1220"),n.startsWith("0x")||(n=`0x${n}`);const o=appendBuffer(arrayify(r),arrayify(n));return base32.encode(o)}var EntityIdHelper=Object.freeze({__proto__:null,_checksum:_checksum,_parseAddress:_parseAddress,aliasToEvmAddress:aliasToEvmAddress,aliasToPublicKey:aliasToPublicKey,compare:compare,constructor:constructor,fromEvmAddress:fromEvmAddress,fromSolidityAddress:fromSolidityAddress,fromString:fromString,fromStringSplitter:fromStringSplitter,publicKeyToAlias:publicKeyToAlias,toEvmAddress:toEvmAddress,toSolidityAddress:toSolidityAddress,toStringWithChecksum:toStringWithChecksum,validateChecksum:validateChecksum});const HARDENED_BIT=2147483648;class Mnemonic{constructor(e){this._mnemonic=e}static async generate(){return new Mnemonic(await Mnemonic$1._generate(24))}static async generate12(){return new Mnemonic(await Mnemonic$1._generate(12))}static async fromWords(e){return new Mnemonic(await Mnemonic$1.fromWords(e))}async toPrivateKey(e=""){return CACHE.privateKeyConstructor(await this._mnemonic.toPrivateKey(e))}async toEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEd25519PrivateKey(e,t))}async toStandardEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardEd25519PrivateKey(e,t))}async toEcdsaPrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEcdsaPrivateKey(e,t))}calculateDerivationPathValues(e){const t=/m\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)/.exec(e),n=new Array(5);if(t)for(let e=1;e<=5;e++){let r=t[e];r.endsWith("'")?(r=r.substring(0,r.length-1),n[e-1]=parseInt(r,10)|HARDENED_BIT):n[e-1]=parseInt(r,10)}return n}async toStandardECDSAsecp256k1PrivateKeyImpl(e,t){return await this.toEcdsaPrivateKey(e,t)}async toStandardECDSAsecp256k1PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardECDSAsecp256k1PrivateKey(e,t))}async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath(e="",t){const n=this.calculateDerivationPathValues(t);return await this.toStandardECDSAsecp256k1PrivateKeyImpl(e,n)}static async fromString(e){return new Mnemonic(await Mnemonic$1.fromString(e))}async toLegacyPrivateKey(){return CACHE.privateKeyConstructor(await this._mnemonic.toLegacyPrivateKey())}async toSeed(e){return await Mnemonic$1.toSeed(this._mnemonic.words,e)}toString(){return this._mnemonic.toString()}}class ObjectMap{constructor(e){this._map=new Map,this.__map=new Map,this._fromString=e}get(e){const t="string"==typeof e?e:e.toString(),n=this._map.get(t);return null!=n?n:null}_set(e,t){const n="string"==typeof e?e:e.toString();this._map.set(n,t),this.__map.set(e,t)}values(){return this._map.values()}get size(){return this._map.size}keys(){return this.__map.keys()}[Symbol.iterator](){return this.__map[Symbol.iterator]()}toString(){const e={};for(const[t,n]of this._map)e[t]=n;return JSON.stringify(e)}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t}),e}}function decode$2(e){const t=e.startsWith("0x")?e.substring(2):e;if(t.length%2!=0)throw new Error("Invalid hex string: Must have an even number of characters.");if(/[^0-9a-fA-F]/.test(t))throw new Error("Invalid hex string: Contains non-hexadecimal characters.");const n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const r=parseInt(t.substring(e,e+2),16);n[e/2]=r}return Buffer.from(t,"hex")}class AccountId{constructor(e,t,n,r,o){const i=constructor(e,t,n);this.shard=i.shard,this.realm=i.realm,this.num=i.num,this.aliasKey=null!=r?r:null,this.evmAddress=null!=o?o:null,this._checksum=null}static fromString(e){let t,n,r=Long.ZERO,o=Long.ZERO,i=Long.ZERO;if(e.startsWith("0x")&&42==e.length||40==e.length)n=EvmAddress.fromString(e);else{const a=fromStringSplitter(e);if(Number.isNaN(a.shard)||Number.isNaN(a.realm))throw new Error("invalid format for entity ID");null!=a.shard&&(r=Long.fromString(a.shard)),null!=a.realm&&(o=Long.fromString(a.realm)),a.numOrHex.length<20?i=Long.fromString(a.numOrHex):40==a.numOrHex.length?n=EvmAddress.fromString(a.numOrHex):t=PublicKey.fromString(a.numOrHex)}return new AccountId(r,o,i,t,n)}static fromEvmAddress(e,t,n){const r="string"==typeof n?EvmAddress.fromString(n):n,[o,i,a,s]=fromEvmAddress(e,t,r.toString());return new AccountId(o,i,a,void 0,s||void 0)}static fromEvmPublicAddress(e){return new AccountId(0,0,0,void 0,e)}static _fromProtobuf(e){let t,n;return null!=e.alias&&(20===e.alias.length?n=EvmAddress.fromBytes(e.alias):t=Key._fromProtobufKey(libExports.proto.Key.decode(e.alias))),t instanceof PublicKey||(t=void 0),new AccountId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.accountNum?e.accountNum:0,t,n)}get checksum(){return this._checksum}getEvmAddress(){return this.evmAddress}async populateAccountNum(e){if(null===this.evmAddress)throw new Error("field `evmAddress` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.evmAddress.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).account;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}async populateAccountEvmAddress(e){if(null===this.num)throw new Error("field `num` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.num.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).evm_address;return this.evmAddress=EvmAddress.fromString(r),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return AccountId._fromProtobuf(libExports.proto.AccountID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$2(e))?new AccountId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?this.evmAddress.toString():null!=this.aliasKey&&"secp256k1"==this.aliasKey._key._type?this.aliasKey.toEvmAddress():toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress.toBytes()):toEvmAddress(this.num)}_toProtobuf(){let e=null;null!=this.aliasKey?e=libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null!=this.evmAddress&&(e=this.evmAddress._bytes);const t=this.num.eq(Long.fromBigInt(0n))&&e;return e?{alias:t?e:null,accountNum:t?null:this.num,shardNum:this.shard,realmNum:this.realm}:{alias:null,accountNum:this.num,shardNum:this.shard,realmNum:this.realm}}toBytes(){return libExports.proto.AccountID.encode(this._toProtobuf()).finish()}toString(){let e=this.num.toString();return null!=this.aliasKey?e=this.aliasKey.toString():null!=this.evmAddress&&(e=this.evmAddress.toString()),`${this.shard.toString()}.${this.realm.toString()}.${e}`}toStringWithChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");return toStringWithChecksum(this.toString(),e)}equals(e){let t=!1;return null!=this.aliasKey&&null!=e.aliasKey?t=this.aliasKey.equals(e.aliasKey):null!=this.evmAddress&&null!=e.evmAddress?t=this.evmAddress.equals(e.evmAddress):null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress&&(t=this.num.eq(e.num)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&t}clone(){const e=new AccountId(this);return e._checksum=this._checksum,e.aliasKey=this.aliasKey,e.evmAddress=this.evmAddress,e}compare(e){let t=this.shard.compare(e.shard);if(0!=t)return t;if(t=this.realm.compare(e.realm),0!=t)return t;if(null!=this.aliasKey&&null!=e.aliasKey){const t=this.aliasKey.toString(),n=e.aliasKey.toString();return t>n?1:t<n?-1:0}if(null!=this.evmAddress&&null!=e.evmAddress){const t=this.evmAddress.toString(),n=e.evmAddress.toString();return t>n?1:t<n?-1:0}return null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress?this.num.compare(e.num):1}}CACHE.setAccountIdConstructor((e,t,n)=>new AccountId(e,t,Long.ZERO,n));const MAX_NS=Long.fromNumber(1e9),generatedIds=new Set;class Timestamp{constructor(e,t){this.seconds=e instanceof Long?e:Long.fromNumber(e),this.nanos=t instanceof Long?t:Long.fromNumber(t),Object.freeze(this)}static generate(e=!0){let t;t=e?Math.floor(5e3*Math.random())+3e3:0;const n=Date.now()-t,r=Math.floor(n/1e3)+CACHE.timeDrift,o=1e6*Math.floor(n%1e3)+Math.floor(1e6*Math.random()),i=new Timestamp(r,o);return generatedIds.has(i.toString())?this.generate():(generatedIds.add(i.toString()),i)}static fromDate(e){let t;if("number"==typeof e)t=Long.fromNumber(e);else if("string"==typeof e)t=Long.fromNumber(Date.parse(e)).mul(1e6);else{if(!(e instanceof Date))throw new TypeError(`invalid type '${typeof e}' for 'data', expected 'Date'`);t=Long.fromNumber(e.getTime()).mul(1e6)}return new Timestamp(0,0).plusNanos(t)}toDate(){return new Date(1e3*this.seconds.toInt()+Math.floor(this.nanos.toInt()/1e6))}plusNanos(e){const t=this.nanos.add(e);return new Timestamp(this.seconds.add(t.div(MAX_NS)),t.mod(MAX_NS))}_toProtobuf(){return{seconds:this.seconds,nanos:this.nanos.toInt()}}static _fromProtobuf(e){return new Timestamp(e.seconds instanceof Long?e.seconds.toInt():null!=e.seconds?e.seconds:0,null!=e.nanos?e.nanos:0)}toString(){const e=String(this.nanos).padStart(9,"0");return`${this.seconds.toString()}.${e}`}compare(e){const t=this.seconds.compare(e.seconds);return 0!=t?t:this.nanos.compare(e.nanos)}}class TransactionId{constructor(e,t,n=!1,r=null){this.accountId=e,this.validStart=t,this.scheduled=n,this.nonce=null,null!=r&&0!=r&&this.setNonce(r),Object.seal(this)}setNonce(e){return this.nonce="number"==typeof e?Long.fromNumber(e):e,this}static withValidStart(e,t){return new TransactionId(e,t)}static generate(e){return new TransactionId("string"==typeof e?AccountId.fromString(e):new AccountId(e),Timestamp.generate())}static fromString(e){let t,n,r,o,i,a;return[t,a]=e.split("@"),[n,a]=a.split("."),a.includes("?")?([r,a]=a.split("?scheduled"),o=!0,i=a.includes("/")?a.replace("/",""):null):a.includes("/")?([r,i]=a.split("/"),o=!1):r=a,new TransactionId(AccountId.fromString(t),new Timestamp(Long.fromValue(n),Long.fromValue(r)),o,null!=i?Long.fromString(i):null)}setScheduled(e){return this.scheduled=e,this}toString(){if(null!=this.accountId&&null!=this.validStart){const e=String(this.validStart.nanos).padStart(9,"0"),t=null!=this.nonce?"/".concat(this.nonce.toString()):"",n=this.scheduled?"?scheduled":"";return`${this.accountId.toString()}@${this.validStart.seconds.toString()}.${e}${n}${t}`}throw new Error("neither `accountId` nor `validStart` are set")}static _fromProtobuf(e){if(null!=e.accountID&&null!=e.transactionValidStart)return new TransactionId(AccountId._fromProtobuf(e.accountID),Timestamp._fromProtobuf(e.transactionValidStart),null!=e.scheduled?e.scheduled:void 0,null!=e.nonce?e.nonce:void 0);throw new Error("Neither `nonce` or `accountID` and `transactionValidStart` are set")}_toProtobuf(){return{accountID:null!=this.accountId?this.accountId._toProtobuf():null,transactionValidStart:null!=this.validStart?this.validStart._toProtobuf():null,scheduled:this.scheduled,nonce:null!=this.nonce?this.nonce.toInt():null}}static fromBytes(e){return TransactionId._fromProtobuf(libExports.proto.TransactionID.decode(e))}toBytes(){return libExports.proto.TransactionID.encode(this._toProtobuf()).finish()}clone(){return new TransactionId(this.accountId,this.validStart,this.scheduled,this.nonce)}compare(e){const t=this.accountId.compare(e.accountId);return 0!=t?t:this.validStart.compare(e.validStart)}getReceipt(e){return CACHE.transactionReceiptQueryConstructor().setTransactionId(this).execute(e)}async getRecord(e){return await this.getReceipt(e),CACHE.transactionRecordQueryConstructor().setTransactionId(this).execute(e)}}class SignaturePairMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new SignaturePairMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}addSignature(e,t){return this._set(e,t),this}}let NodeAccountIdSignatureMap$1=class e extends ObjectMap{constructor(){super(e=>TransactionId.fromString(e))}static _fromSignedTransactions(t){const n=new e;for(const{bodyBytes:e,sigMap:r}of t.list)if(null!=e&&null!=r){const t=libExports.proto.TransactionBody.decode(e);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);n._set(e,SignaturePairMap._fromTransactionSigMap(r))}}return n}addSignature(e,t,n){const r=this.get(e);r?r.addSignature(t,n):this._set(e,(new SignaturePairMap).addSignature(t,n))}};class List{constructor(){this.list=[],this.locked=!1,this.index=0}setList(e){if(this.locked)throw new Error("list is locked");return this.list=e,this.index=0,this}push(...e){if(this.locked)throw new Error("list is locked");return this.list.push(...e),this}setLocked(){return this.locked=!0,this}clear(){this.list=[],this.index=0,this.locked=!1}get(e){return this.list[e]}set(e,t){return e===this.length?this.list.push(t):this.list[e]=t,this}setIfAbsent(e,t){return e!=this.length&&null!=this.list[e]||this.set(e,t()),this}get next(){return this.get(this.advance())}get current(){return this.get(this.index)}advance(){const e=this.index;return this.index=(this.index+1)%this.list.length,e}get isEmpty(){return 0===this.length}get length(){return this.list.length}clone(){const e=new List;return e.list=this.list,e.locked=this.locked,e}}let SignatureMap$1=class e extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(t){const n=new e,r=t._nodeAccountIds.length,o=t._signedTransactions.length/r;for(let e=0;e<r;e++){const i=new List;for(let n=0;n<o;n++)i.push(t._signedTransactions.get(n*r+e));n._set(t._nodeAccountIds.list[e],NodeAccountIdSignatureMap$1._fromSignedTransactions(i))}return n}addSignature(e,t,n,r){let o=this.get(e);return o||(o=new NodeAccountIdSignatureMap$1,this._set(e,o)),o.addSignature(t,n,r),this._set(e,o),this}getFlatSignatureList(){const e=[];for(const t of this.values())for(const n of t.values())e.push(n);return e}};class ASN1Decoder{constructor(e){this.data=new Uint8Array(e),this.pos=0,this.oids=[],this.oidMap={"1.3.132.0.10":"ecdsa","1.3.101.112":"ed25519","1.2.840.10045.2.1":"pubkey"},this.isPublicKey=!1}readLength(){let e=this.data[this.pos++];if(128&e){let t=127&e;e=0;for(let n=0;n<t;n++)e=e<<8|this.data[this.pos++]}return e}readType(){return this.data[this.pos++]}readInteger(){const e=this.readLength();let t=0;for(let n=0;n<e;n++)t=t<<8|this.data[this.pos++];return{integer:t}}readOctetString(){const e=this.readLength(),t=this.data.slice(this.pos,this.pos+e);return this.pos+=e,{pkey:t}}readBitString(){const e=this.readLength(),t=this.data[this.pos++],n=this.data.slice(this.pos,this.pos+e-1);return this.pos+=e-1,{unusedBits:t,pubkey:n}}readObjectIdentifier(){const e=this.readLength(),t=this.pos+e,n=[];let r=0;const o=this.data[this.pos++];for(n.push(Math.floor(o/40)),n.push(o%40);this.pos<t;){const e=this.data[this.pos++];r=r<<7|127&e,128&e||(n.push(r),r=0)}const i=n.join(".");return this.oids.push(i),{oid:i}}getOids(){return this.oids}getOidKeyTypes(){return this.oids.map(e=>this.oidMap[e]||"unknown")}readSequence(){const e=this.readLength(),t=this.pos+e,n=[];for(;this.pos<t;)n.push(this.read());return n}read(){const e=this.readType();switch(e){case 2:return this.readInteger();case 3:return this.readBitString();case 4:return this.readOctetString();case 6:return this.readObjectIdentifier();case 48:case 160:case 161:return this.readSequence();default:throw new Error(`Unsupported type: ${e}`)}}isPublicKeyType(){return this.isPublicKey}}class PrivateKey extends Key{constructor(e){super(),this._key=e}static generateED25519(){return new PrivateKey(PrivateKey$1.generateED25519())}static generateECDSA(){return new PrivateKey(PrivateKey$1.generateECDSA())}static generate(){return PrivateKey.generateED25519()}static async generateAsync(){return new PrivateKey(await PrivateKey$1.generateAsync())}static async generateED25519Async(){return new PrivateKey(await PrivateKey$1.generateED25519Async())}static async generateECDSAAsync(){return new PrivateKey(await PrivateKey$1.generateECDSAAsync())}static fromBytes(e){const t=hexlify(e);return PrivateKey.isDerKey(t)?"ecdsa"===PrivateKey.getAlgorithm(t)?new PrivateKey(PrivateKey$1.fromBytesECDSA(e)):new PrivateKey(PrivateKey$1.fromBytesED25519(e)):new PrivateKey(PrivateKey$1.fromBytes(e))}static fromBytesECDSA(e){return new PrivateKey(PrivateKey$1.fromBytesECDSA(e))}static fromBytesED25519(e){return new PrivateKey(PrivateKey$1.fromBytesED25519(e))}static fromString(e){return PrivateKey.isDerKey(e)?this.fromStringDer(e):new PrivateKey(PrivateKey$1.fromString(e))}static fromStringDer(e){return PrivateKey.isDerKey(e)?"ecdsa"===PrivateKey.getAlgorithm(e)?this.fromStringECDSA(e):this.fromStringED25519(e):PrivateKey.fromString(e)}static fromStringECDSA(e){return new PrivateKey(PrivateKey$1.fromStringECDSA(e))}static fromStringED25519(e){return new PrivateKey(PrivateKey$1.fromStringED25519(e))}static async fromSeedED25519(e){return new PrivateKey(await PrivateKey$1.fromSeedED25519(e))}static async fromSeedECDSAsecp256k1(e){return new PrivateKey(await PrivateKey$1.fromSeedECDSAsecp256k1(e))}static async fromMnemonic(e,t=""){return new PrivateKey(e instanceof Mnemonic?await PrivateKey$1.fromMnemonic(e._mnemonic,t):await PrivateKey$1.fromMnemonic(e,t))}static async fromKeystore(e,t=""){return new PrivateKey(await PrivateKey$1.fromKeystore(e,t))}static async fromPem(e,t=""){return new PrivateKey(await PrivateKey$1.fromPem(e,t))}async derive(e){return new PrivateKey(await this._key.derive(e))}async legacyDerive(e){return new PrivateKey(await this._key.legacyDerive(e))}get publicKey(){return new PublicKey(this._key.publicKey)}get chainCode(){return this._key._chainCode}sign(e){return this._key.sign(e)}signTransaction(e,t=!1){if(t)return this._signTransactionLegacy(e);const n=new SignatureMap$1;for(const t of e._signedTransactions.list){const e=t.bodyBytes;if(!e)throw new Error("Body bytes are missing");const r=libExports.proto.TransactionBody.decode(e);if(!r.transactionID||!r.nodeAccountID)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const o=AccountId._fromProtobuf(r.nodeAccountID),i=TransactionId._fromProtobuf(r.transactionID),a=this._key.sign(e);n.addSignature(o,i,this.publicKey,a)}return e.addSignature(this.publicKey,n),n}_signTransactionLegacy(e){const t=e._signedTransactions.list.map(e=>{const t=e.bodyBytes;return t?this._key.sign(t):new Uint8Array});return e.addSignature(this.publicKey,t),1===t.length?t[0]:t}isDerivable(){return this._key.isDerivable()}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this._key.toStringDer()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}toKeystore(e=""){return this._key.toKeystore(e)}_toProtobufKey(){return this.publicKey._toProtobufKey()}toAccountId(e,t){return this.publicKey.toAccountId(e,t)}get type(){return this._key._type}getRecoveryId(e,t,n){return this._key.getRecoveryId(e,t,n)}static getAlgorithm(e){if(!PrivateKey.isDerKey(e))throw new Error("Only der keys are supported");const t=new ASN1Decoder(Uint8Array.from(decode$8(e)));t.read();return t.getOidKeyTypes()[0]}static isDerKey(e){try{const t=Uint8Array.from(decode$8(e));return new ASN1Decoder(t).read(),!0}catch(e){return!1}}}CACHE.setPrivateKeyConstructor(e=>new PrivateKey(e));class KeyList extends Key{constructor(e,t){super(),this._keys=null==e?[]:e instanceof Key?[e]:e,this._threshold=null==t?null:t}static of(...e){return new KeyList(e,null)}static from(e,t,n){return new KeyList(null==t?Array.from(e):Array.from(e,t,n))}get threshold(){return this._threshold}setThreshold(e){return this._threshold=e,this}push(...e){return this._keys.push(...e)}splice(e,t,...n){return new KeyList(this._keys.splice(e,t,...n),this.threshold)}slice(e,t){return new KeyList(this._keys.slice(e,t),this.threshold)}[Symbol.iterator](){return this._keys[Symbol.iterator]()}toArray(){return this._keys.slice()}toString(){return JSON.stringify({threshold:this._threshold,keys:this._keys.toString()})}_toProtobufKey(){const e=this._keys.map(e=>e._toProtobufKey());return null==this.threshold?{keyList:{keys:e}}:{thresholdKey:{threshold:this.threshold,keys:{keys:e}}}}static __fromProtobufKeyList(e){const t=(null!=e.keys?e.keys:[]).map(e=>Key._fromProtobufKey(e));return new KeyList(t)}static __fromProtobufThresoldKey(e){const t=KeyList.__fromProtobufKeyList(null!=e.keys?e.keys:{});return t.setThreshold(null!=e.threshold?e.threshold:0),t}}function valueToLong(e){return BigNumber$1.isBigNumber(e)?e:new BigNumber$1(e.toString())}CACHE.setKeyList(e=>KeyList.__fromProtobufKeyList(e)),CACHE.setThresholdKey(e=>KeyList.__fromProtobufThresoldKey(e));class HbarUnit{constructor(e,t,n){this._name=e,this._symbol=t,this._tinybar=n,Object.freeze(this)}static fromString(e){switch(e){case HbarUnit.Hbar._symbol:return HbarUnit.Hbar;case HbarUnit.Tinybar._symbol:return HbarUnit.Tinybar;case HbarUnit.Microbar._symbol:return HbarUnit.Microbar;case HbarUnit.Millibar._symbol:return HbarUnit.Millibar;case HbarUnit.Kilobar._symbol:return HbarUnit.Kilobar;case HbarUnit.Megabar._symbol:return HbarUnit.Megabar;case HbarUnit.Gigabar._symbol:return HbarUnit.Gigabar;default:throw new Error("Unknown unit.")}}}HbarUnit.Tinybar=new HbarUnit("tinybar","tℏ",new BigNumber$1(1)),HbarUnit.Microbar=new HbarUnit("microbar","μℏ",new BigNumber$1(100)),HbarUnit.Millibar=new HbarUnit("millibar","mℏ",new BigNumber$1(1e5)),HbarUnit.Hbar=new HbarUnit("hbar","ℏ",new BigNumber$1("100000000")),HbarUnit.Kilobar=new HbarUnit("kilobar","kℏ",new BigNumber$1(1e3).multipliedBy(new BigNumber$1("100000000"))),HbarUnit.Megabar=new HbarUnit("megabar","Mℏ",new BigNumber$1(1e6).multipliedBy(new BigNumber$1("100000000"))),HbarUnit.Gigabar=new HbarUnit("gigabar","Gℏ",new BigNumber$1("1000000000").multipliedBy(new BigNumber$1("100000000")));class Hbar{constructor(e,t=HbarUnit.Hbar){if(t===HbarUnit.Tinybar)this._valueInTinybar=valueToLong(e);else{let n;n=Long.isLong(e)?new BigNumber$1(e.toString(10)):BigNumber$1.isBigNumber(e)||"string"==typeof e||"number"==typeof e?new BigNumber$1(e):new BigNumber$1(0),this._valueInTinybar=n.multipliedBy(t._tinybar)}if(!this._valueInTinybar.isInteger())throw new Error("Hbar in tinybars contains decimals")}static from(e,t){return new Hbar(e,t)}static fromTinybars(e){return"string"==typeof e?this.fromString(e,HbarUnit.Tinybar):new Hbar(e,HbarUnit.Tinybar)}static fromString(e,t=HbarUnit.Hbar){if(/^((?:\+|-)?\d+(?:\.\d+)?)(?: (tℏ|μℏ|mℏ|ℏ|kℏ|Mℏ|Gℏ))?$/.test(e)){let[n,r]=e.split(" ");return null!=r&&(t=HbarUnit.fromString(r)),new Hbar(new BigNumber$1(n),t)}throw new Error("invalid argument provided")}to(e){return this._valueInTinybar.dividedBy(e._tinybar)}toBigNumber(){return this.to(HbarUnit.Hbar)}toTinybars(){return Long.fromValue(this._valueInTinybar.toFixed())}negated(){return Hbar.fromTinybars(this._valueInTinybar.negated())}isNegative(){return this._valueInTinybar.isNegative()}toString(e){return null!=e?`${this._valueInTinybar.dividedBy(e._tinybar).toString()} ${e._symbol}`:this._valueInTinybar.isLessThan(1e4)&&this._valueInTinybar.isGreaterThan(-1e4)?`${this._valueInTinybar.toFixed()} ${HbarUnit.Tinybar._symbol}`:`${this.to(HbarUnit.Hbar).toString()} ${HbarUnit.Hbar._symbol}`}}class StatusError extends Error{constructor(e,t){super(t),this.name="StatusError",this.status=e.status,this.transactionId=e.transactionId,this.message=t,void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,StatusError)}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),message:this.message}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}class ReceiptStatusError extends StatusError{constructor(e){super(e,`receipt for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionReceipt=e.transactionReceipt}}class Status{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case Status.Ok:return"OK";case Status.InvalidTransaction:return"INVALID_TRANSACTION";case Status.PayerAccountNotFound:return"PAYER_ACCOUNT_NOT_FOUND";case Status.InvalidNodeAccount:return"INVALID_NODE_ACCOUNT";case Status.TransactionExpired:return"TRANSACTION_EXPIRED";case Status.InvalidTransactionStart:return"INVALID_TRANSACTION_START";case Status.InvalidTransactionDuration:return"INVALID_TRANSACTION_DURATION";case Status.InvalidSignature:return"INVALID_SIGNATURE";case Status.MemoTooLong:return"MEMO_TOO_LONG";case Status.InsufficientTxFee:return"INSUFFICIENT_TX_FEE";case Status.InsufficientPayerBalance:return"INSUFFICIENT_PAYER_BALANCE";case Status.DuplicateTransaction:return"DUPLICATE_TRANSACTION";case Status.Busy:return"BUSY";case Status.NotSupported:return"NOT_SUPPORTED";case Status.InvalidFileId:return"INVALID_FILE_ID";case Status.InvalidAccountId:return"INVALID_ACCOUNT_ID";case Status.InvalidContractId:return"INVALID_CONTRACT_ID";case Status.InvalidTransactionId:return"INVALID_TRANSACTION_ID";case Status.ReceiptNotFound:return"RECEIPT_NOT_FOUND";case Status.RecordNotFound:return"RECORD_NOT_FOUND";case Status.InvalidSolidityId:return"INVALID_SOLIDITY_ID";case Status.Unknown:return"UNKNOWN";case Status.Success:return"SUCCESS";case Status.FailInvalid:return"FAIL_INVALID";case Status.FailFee:return"FAIL_FEE";case Status.FailBalance:return"FAIL_BALANCE";case Status.KeyRequired:return"KEY_REQUIRED";case Status.BadEncoding:return"BAD_ENCODING";case Status.InsufficientAccountBalance:return"INSUFFICIENT_ACCOUNT_BALANCE";case Status.InvalidSolidityAddress:return"INVALID_SOLIDITY_ADDRESS";case Status.InsufficientGas:return"INSUFFICIENT_GAS";case Status.ContractSizeLimitExceeded:return"CONTRACT_SIZE_LIMIT_EXCEEDED";case Status.LocalCallModificationException:return"LOCAL_CALL_MODIFICATION_EXCEPTION";case Status.ContractRevertExecuted:return"CONTRACT_REVERT_EXECUTED";case Status.ContractExecutionException:return"CONTRACT_EXECUTION_EXCEPTION";case Status.InvalidReceivingNodeAccount:return"INVALID_RECEIVING_NODE_ACCOUNT";case Status.MissingQueryHeader:return"MISSING_QUERY_HEADER";case Status.AccountUpdateFailed:return"ACCOUNT_UPDATE_FAILED";case Status.InvalidKeyEncoding:return"INVALID_KEY_ENCODING";case Status.NullSolidityAddress:return"NULL_SOLIDITY_ADDRESS";case Status.ContractUpdateFailed:return"CONTRACT_UPDATE_FAILED";case Status.InvalidQueryHeader:return"INVALID_QUERY_HEADER";case Status.InvalidFeeSubmitted:return"INVALID_FEE_SUBMITTED";case Status.InvalidPayerSignature:return"INVALID_PAYER_SIGNATURE";case Status.KeyNotProvided:return"KEY_NOT_PROVIDED";case Status.InvalidExpirationTime:return"INVALID_EXPIRATION_TIME";case Status.NoWaclKey:return"NO_WACL_KEY";case Status.FileContentEmpty:return"FILE_CONTENT_EMPTY";case Status.InvalidAccountAmounts:return"INVALID_ACCOUNT_AMOUNTS";case Status.EmptyTransactionBody:return"EMPTY_TRANSACTION_BODY";case Status.InvalidTransactionBody:return"INVALID_TRANSACTION_BODY";case Status.InvalidSignatureTypeMismatchingKey:return"INVALID_SIGNATURE_TYPE_MISMATCHING_KEY";case Status.InvalidSignatureCountMismatchingKey:return"INVALID_SIGNATURE_COUNT_MISMATCHING_KEY";case Status.EmptyLiveHashBody:return"EMPTY_LIVE_HASH_BODY";case Status.EmptyLiveHash:return"EMPTY_LIVE_HASH";case Status.EmptyLiveHashKeys:return"EMPTY_LIVE_HASH_KEYS";case Status.InvalidLiveHashSize:return"INVALID_LIVE_HASH_SIZE";case Status.EmptyQueryBody:return"EMPTY_QUERY_BODY";case Status.EmptyLiveHashQuery:return"EMPTY_LIVE_HASH_QUERY";case Status.LiveHashNotFound:return"LIVE_HASH_NOT_FOUND";case Status.AccountIdDoesNotExist:return"ACCOUNT_ID_DOES_NOT_EXIST";case Status.LiveHashAlreadyExists:return"LIVE_HASH_ALREADY_EXISTS";case Status.InvalidFileWacl:return"INVALID_FILE_WACL";case Status.SerializationFailed:return"SERIALIZATION_FAILED";case Status.TransactionOversize:return"TRANSACTION_OVERSIZE";case Status.TransactionTooManyLayers:return"TRANSACTION_TOO_MANY_LAYERS";case Status.ContractDeleted:return"CONTRACT_DELETED";case Status.PlatformNotActive:return"PLATFORM_NOT_ACTIVE";case Status.KeyPrefixMismatch:return"KEY_PREFIX_MISMATCH";case Status.PlatformTransactionNotCreated:return"PLATFORM_TRANSACTION_NOT_CREATED";case Status.InvalidRenewalPeriod:return"INVALID_RENEWAL_PERIOD";case Status.InvalidPayerAccountId:return"INVALID_PAYER_ACCOUNT_ID";case Status.AccountDeleted:return"ACCOUNT_DELETED";case Status.FileDeleted:return"FILE_DELETED";case Status.AccountRepeatedInAccountAmounts:return"ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS";case Status.SettingNegativeAccountBalance:return"SETTING_NEGATIVE_ACCOUNT_BALANCE";case Status.ObtainerRequired:return"OBTAINER_REQUIRED";case Status.ObtainerSameContractId:return"OBTAINER_SAME_CONTRACT_ID";case Status.ObtainerDoesNotExist:return"OBTAINER_DOES_NOT_EXIST";case Status.ModifyingImmutableContract:return"MODIFYING_IMMUTABLE_CONTRACT";case Status.FileSystemException:return"FILE_SYSTEM_EXCEPTION";case Status.AutorenewDurationNotInRange:return"AUTORENEW_DURATION_NOT_IN_RANGE";case Status.ErrorDecodingBytestring:return"ERROR_DECODING_BYTESTRING";case Status.ContractFileEmpty:return"CONTRACT_FILE_EMPTY";case Status.ContractBytecodeEmpty:return"CONTRACT_BYTECODE_EMPTY";case Status.InvalidInitialBalance:return"INVALID_INITIAL_BALANCE";case Status.InvalidReceiveRecordThreshold:return"INVALID_RECEIVE_RECORD_THRESHOLD";case Status.InvalidSendRecordThreshold:return"INVALID_SEND_RECORD_THRESHOLD";case Status.AccountIsNotGenesisAccount:return"ACCOUNT_IS_NOT_GENESIS_ACCOUNT";case Status.PayerAccountUnauthorized:return"PAYER_ACCOUNT_UNAUTHORIZED";case Status.InvalidFreezeTransactionBody:return"INVALID_FREEZE_TRANSACTION_BODY";case Status.FreezeTransactionBodyNotFound:return"FREEZE_TRANSACTION_BODY_NOT_FOUND";case Status.TransferListSizeLimitExceeded:return"TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.ResultSizeLimitExceeded:return"RESULT_SIZE_LIMIT_EXCEEDED";case Status.NotSpecialAccount:return"NOT_SPECIAL_ACCOUNT";case Status.ContractNegativeGas:return"CONTRACT_NEGATIVE_GAS";case Status.ContractNegativeValue:return"CONTRACT_NEGATIVE_VALUE";case Status.InvalidFeeFile:return"INVALID_FEE_FILE";case Status.InvalidExchangeRateFile:return"INVALID_EXCHANGE_RATE_FILE";case Status.InsufficientLocalCallGas:return"INSUFFICIENT_LOCAL_CALL_GAS";case Status.EntityNotAllowedToDelete:return"ENTITY_NOT_ALLOWED_TO_DELETE";case Status.AuthorizationFailed:return"AUTHORIZATION_FAILED";case Status.FileUploadedProtoInvalid:return"FILE_UPLOADED_PROTO_INVALID";case Status.FileUploadedProtoNotSavedToDisk:return"FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK";case Status.FeeScheduleFilePartUploaded:return"FEE_SCHEDULE_FILE_PART_UPLOADED";case Status.ExchangeRateChangeLimitExceeded:return"EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED";case Status.MaxContractStorageExceeded:return"MAX_CONTRACT_STORAGE_EXCEEDED";case Status.TransferAccountSameAsDeleteAccount:return"TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT";case Status.TotalLedgerBalanceInvalid:return"TOTAL_LEDGER_BALANCE_INVALID";case Status.ExpirationReductionNotAllowed:return"EXPIRATION_REDUCTION_NOT_ALLOWED";case Status.MaxGasLimitExceeded:return"MAX_GAS_LIMIT_EXCEEDED";case Status.MaxFileSizeExceeded:return"MAX_FILE_SIZE_EXCEEDED";case Status.ReceiverSigRequired:return"RECEIVER_SIG_REQUIRED";case Status.InvalidTopicId:return"INVALID_TOPIC_ID";case Status.InvalidAdminKey:return"INVALID_ADMIN_KEY";case Status.InvalidSubmitKey:return"INVALID_SUBMIT_KEY";case Status.Unauthorized:return"UNAUTHORIZED";case Status.InvalidTopicMessage:return"INVALID_TOPIC_MESSAGE";case Status.InvalidAutorenewAccount:return"INVALID_AUTORENEW_ACCOUNT";case Status.AutorenewAccountNotAllowed:return"AUTORENEW_ACCOUNT_NOT_ALLOWED";case Status.TopicExpired:return"TOPIC_EXPIRED";case Status.InvalidChunkNumber:return"INVALID_CHUNK_NUMBER";case Status.InvalidChunkTransactionId:return"INVALID_CHUNK_TRANSACTION_ID";case Status.AccountFrozenForToken:return"ACCOUNT_FROZEN_FOR_TOKEN";case Status.TokensPerAccountLimitExceeded:return"TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED";case Status.InvalidTokenId:return"INVALID_TOKEN_ID";case Status.InvalidTokenDecimals:return"INVALID_TOKEN_DECIMALS";case Status.InvalidTokenInitialSupply:return"INVALID_TOKEN_INITIAL_SUPPLY";case Status.InvalidTreasuryAccountForToken:return"INVALID_TREASURY_ACCOUNT_FOR_TOKEN";case Status.InvalidTokenSymbol:return"INVALID_TOKEN_SYMBOL";case Status.TokenHasNoFreezeKey:return"TOKEN_HAS_NO_FREEZE_KEY";case Status.TransfersNotZeroSumForToken:return"TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN";case Status.MissingTokenSymbol:return"MISSING_TOKEN_SYMBOL";case Status.TokenSymbolTooLong:return"TOKEN_SYMBOL_TOO_LONG";case Status.AccountKycNotGrantedForToken:return"ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN";case Status.TokenHasNoKycKey:return"TOKEN_HAS_NO_KYC_KEY";case Status.InsufficientTokenBalance:return"INSUFFICIENT_TOKEN_BALANCE";case Status.TokenWasDeleted:return"TOKEN_WAS_DELETED";case Status.TokenHasNoSupplyKey:return"TOKEN_HAS_NO_SUPPLY_KEY";case Status.TokenHasNoWipeKey:return"TOKEN_HAS_NO_WIPE_KEY";case Status.InvalidTokenMintAmount:return"INVALID_TOKEN_MINT_AMOUNT";case Status.InvalidTokenBurnAmount:return"INVALID_TOKEN_BURN_AMOUNT";case Status.TokenNotAssociatedToAccount:return"TOKEN_NOT_ASSOCIATED_TO_ACCOUNT";case Status.CannotWipeTokenTreasuryAccount:return"CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT";case Status.InvalidKycKey:return"INVALID_KYC_KEY";case Status.InvalidWipeKey:return"INVALID_WIPE_KEY";case Status.InvalidFreezeKey:return"INVALID_FREEZE_KEY";case Status.InvalidSupplyKey:return"INVALID_SUPPLY_KEY";case Status.MissingTokenName:return"MISSING_TOKEN_NAME";case Status.TokenNameTooLong:return"TOKEN_NAME_TOO_LONG";case Status.InvalidWipingAmount:return"INVALID_WIPING_AMOUNT";case Status.TokenIsImmutable:return"TOKEN_IS_IMMUTABLE";case Status.TokenAlreadyAssociatedToAccount:return"TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT";case Status.TransactionRequiresZeroTokenBalances:return"TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES";case Status.AccountIsTreasury:return"ACCOUNT_IS_TREASURY";case Status.TokenIdRepeatedInTokenList:return"TOKEN_ID_REPEATED_IN_TOKEN_LIST";case Status.TokenTransferListSizeLimitExceeded:return"TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.EmptyTokenTransferBody:return"EMPTY_TOKEN_TRANSFER_BODY";case Status.EmptyTokenTransferAccountAmounts:return"EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS";case Status.InvalidScheduleId:return"INVALID_SCHEDULE_ID";case Status.ScheduleIsImmutable:return"SCHEDULE_IS_IMMUTABLE";case Status.InvalidSchedulePayerId:return"INVALID_SCHEDULE_PAYER_ID";case Status.InvalidScheduleAccountId:return"INVALID_SCHEDULE_ACCOUNT_ID";case Status.NoNewValidSignatures:return"NO_NEW_VALID_SIGNATURES";case Status.UnresolvableRequiredSigners:return"UNRESOLVABLE_REQUIRED_SIGNERS";case Status.ScheduledTransactionNotInWhitelist:return"SCHEDULED_TRANSACTION_NOT_IN_WHITELIST";case Status.SomeSignaturesWereInvalid:return"SOME_SIGNATURES_WERE_INVALID";case Status.TransactionIdFieldNotAllowed:return"TRANSACTION_ID_FIELD_NOT_ALLOWED";case Status.IdenticalScheduleAlreadyCreated:return"IDENTICAL_SCHEDULE_ALREADY_CREATED";case Status.InvalidZeroByteInString:return"INVALID_ZERO_BYTE_IN_STRING";case Status.ScheduleAlreadyDeleted:return"SCHEDULE_ALREADY_DELETED";case Status.ScheduleAlreadyExecuted:return"SCHEDULE_ALREADY_EXECUTED";case Status.MessageSizeTooLarge:return"MESSAGE_SIZE_TOO_LARGE";case Status.OperationRepeatedInBucketGroups:return"OPERATION_REPEATED_IN_BUCKET_GROUPS";case Status.BucketCapacityOverflow:return"BUCKET_CAPACITY_OVERFLOW";case Status.NodeCapacityNotSufficientForOperation:return"NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION";case Status.BucketHasNoThrottleGroups:return"BUCKET_HAS_NO_THROTTLE_GROUPS";case Status.ThrottleGroupHasZeroOpsPerSec:return"THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC";case Status.SuccessButMissingExpectedOperation:return"SUCCESS_BUT_MISSING_EXPECTED_OPERATION";case Status.UnparseableThrottleDefinitions:return"UNPARSEABLE_THROTTLE_DEFINITIONS";case Status.InvalidThrottleDefinitions:return"INVALID_THROTTLE_DEFINITIONS";case Status.AccountExpiredAndPendingRemoval:return"ACCOUNT_EXPIRED_AND_PENDING_REMOVAL";case Status.InvalidTokenMaxSupply:return"INVALID_TOKEN_MAX_SUPPLY";case Status.InvalidTokenNftSerialNumber:return"INVALID_TOKEN_NFT_SERIAL_NUMBER";case Status.InvalidNftId:return"INVALID_NFT_ID";case Status.MetadataTooLong:return"METADATA_TOO_LONG";case Status.BatchSizeLimitExceeded:return"BATCH_SIZE_LIMIT_EXCEEDED";case Status.InvalidQueryRange:return"INVALID_QUERY_RANGE";case Status.FractionDividesByZero:return"FRACTION_DIVIDES_BY_ZERO";case Status.InsufficientPayerBalanceForCustomFee:return"INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE";case Status.CustomFeesListTooLong:return"CUSTOM_FEES_LIST_TOO_LONG";case Status.InvalidCustomFeeCollector:return"INVALID_CUSTOM_FEE_COLLECTOR";case Status.InvalidTokenIdInCustomFees:return"INVALID_TOKEN_ID_IN_CUSTOM_FEES";case Status.TokenNotAssociatedToFeeCollector:return"TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR";case Status.TokenMaxSupplyReached:return"TOKEN_MAX_SUPPLY_REACHED";case Status.SenderDoesNotOwnNftSerialNo:return"SENDER_DOES_NOT_OWN_NFT_SERIAL_NO";case Status.CustomFeeNotFullySpecified:return"CUSTOM_FEE_NOT_FULLY_SPECIFIED";case Status.CustomFeeMustBePositive:return"CUSTOM_FEE_MUST_BE_POSITIVE";case Status.TokenHasNoFeeScheduleKey:return"TOKEN_HAS_NO_FEE_SCHEDULE_KEY";case Status.CustomFeeOutsideNumericRange:return"CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE";case Status.RoyaltyFractionCannotExceedOne:return"ROYALTY_FRACTION_CANNOT_EXCEED_ONE";case Status.FractionalFeeMaxAmountLessThanMinAmount:return"FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT";case Status.CustomScheduleAlreadyHasNoFees:return"CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES";case Status.CustomFeeDenominationMustBeFungibleCommon:return"CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON";case Status.CustomFractionalFeeOnlyAllowedForFungibleCommon:return"CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.InvalidCustomFeeScheduleKey:return"INVALID_CUSTOM_FEE_SCHEDULE_KEY";case Status.InvalidTokenMintMetadata:return"INVALID_TOKEN_MINT_METADATA";case Status.InvalidTokenBurnMetadata:return"INVALID_TOKEN_BURN_METADATA";case Status.CurrentTreasuryStillOwnsNfts:return"CURRENT_TREASURY_STILL_OWNS_NFTS";case Status.AccountStillOwnsNfts:return"ACCOUNT_STILL_OWNS_NFTS";case Status.TreasuryMustOwnBurnedNft:return"TREASURY_MUST_OWN_BURNED_NFT";case Status.AccountDoesNotOwnWipedNft:return"ACCOUNT_DOES_NOT_OWN_WIPED_NFT";case Status.AccountAmountTransfersOnlyAllowedForFungibleCommon:return"ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.MaxNftsInPriceRegimeHaveBeenMinted:return"MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED";case Status.PayerAccountDeleted:return"PAYER_ACCOUNT_DELETED";case Status.CustomFeeChargingExceededMaxRecursionDepth:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH";case Status.CustomFeeChargingExceededMaxAccountAmounts:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS";case Status.InsufficientSenderAccountBalanceForCustomFee:return"INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE";case Status.SerialNumberLimitReached:return"SERIAL_NUMBER_LIMIT_REACHED";case Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique:return"CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.NoRemainingAutomaticAssociations:return"NO_REMAINING_AUTOMATIC_ASSOCIATIONS";case Status.ExistingAutomaticAssociationsExceedGivenLimit:return"EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT";case Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit:return"REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT";case Status.TokenIsPaused:return"TOKEN_IS_PAUSED";case Status.TokenHasNoPauseKey:return"TOKEN_HAS_NO_PAUSE_KEY";case Status.InvalidPauseKey:return"INVALID_PAUSE_KEY";case Status.FreezeUpdateFileDoesNotExist:return"FREEZE_UPDATE_FILE_DOES_NOT_EXIST";case Status.FreezeUpdateFileHashDoesNotMatch:return"FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH";case Status.NoUpgradeHasBeenPrepared:return"NO_UPGRADE_HAS_BEEN_PREPARED";case Status.NoFreezeIsScheduled:return"NO_FREEZE_IS_SCHEDULED";case Status.UpdateFileHashChangedSincePrepareUpgrade:return"UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE";case Status.FreezeStartTimeMustBeFuture:return"FREEZE_START_TIME_MUST_BE_FUTURE";case Status.PreparedUpdateFileIsImmutable:return"PREPARED_UPDATE_FILE_IS_IMMUTABLE";case Status.FreezeAlreadyScheduled:return"FREEZE_ALREADY_SCHEDULED";case Status.FreezeUpgradeInProgress:return"FREEZE_UPGRADE_IN_PROGRESS";case Status.UpdateFileIdDoesNotMatchPrepared:return"UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED";case Status.UpdateFileHashDoesNotMatchPrepared:return"UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED";case Status.ConsensusGasExhausted:return"CONSENSUS_GAS_EXHAUSTED";case Status.RevertedSuccess:return"REVERTED_SUCCESS";case Status.MaxStorageInPriceRegimeHasBeenUsed:return"MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED";case Status.InvalidAliasKey:return"INVALID_ALIAS_KEY";case Status.UnexpectedTokenDecimals:return"UNEXPECTED_TOKEN_DECIMALS";case Status.InvalidProxyAccountId:return"INVALID_PROXY_ACCOUNT_ID";case Status.InvalidTransferAccountId:return"INVALID_TRANSFER_ACCOUNT_ID";case Status.InvalidFeeCollectorAccountId:return"INVALID_FEE_COLLECTOR_ACCOUNT_ID";case Status.AliasIsImmutable:return"ALIAS_IS_IMMUTABLE";case Status.SpenderAccountSameAsOwner:return"SPENDER_ACCOUNT_SAME_AS_OWNER";case Status.AmountExceedsTokenMaxSupply:return"AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY";case Status.NegativeAllowanceAmount:return"NEGATIVE_ALLOWANCE_AMOUNT";case Status.CannotApproveForAllFungibleCommon:return"CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON";case Status.SpenderDoesNotHaveAllowance:return"SPENDER_DOES_NOT_HAVE_ALLOWANCE";case Status.AmountExceedsAllowance:return"AMOUNT_EXCEEDS_ALLOWANCE";case Status.MaxAllowancesExceeded:return"MAX_ALLOWANCES_EXCEEDED";case Status.EmptyAllowances:return"EMPTY_ALLOWANCES";case Status.SpenderAccountRepeatedInAllowances:return"SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES";case Status.RepeatedSerialNumsInNftAllowances:return"REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES";case Status.FungibleTokenInNftAllowances:return"FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES";case Status.NftInFungibleTokenAllowances:return"NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES";case Status.InvalidAllowanceOwnerId:return"INVALID_ALLOWANCE_OWNER_ID";case Status.InvalidAllowanceSpenderId:return"INVALID_ALLOWANCE_SPENDER_ID";case Status.RepeatedAllowancesToDelete:return"REPEATED_ALLOWANCES_TO_DELETE";case Status.InvalidDelegatingSpender:return"INVALID_DELEGATING_SPENDER";case Status.DelegatingSpenderCannotGrantApproveForAll:return"DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL";case Status.DelegatingSpenderDoesNotHaveApproveForAll:return"DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL";case Status.ScheduleExpirationTimeTooFarInFuture:return"SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE";case Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime:return"SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME";case Status.ScheduleFutureThrottleExceeded:return"SCHEDULE_FUTURE_THROTTLE_EXCEEDED";case Status.ScheduleFutureGasLimitExceeded:return"SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED";case Status.InvalidEthereumTransaction:return"INVALID_ETHEREUM_TRANSACTION";case Status.WrongChainId:return"WRONG_CHAIN_ID";case Status.WrongNonce:return"WRONG_NONCE";case Status.AccessListUnsupported:return"ACCESS_LIST_UNSUPPORTED";case Status.SchedulePendingExpiration:return"SCHEDULE_PENDING_EXPIRATION";case Status.ContractIsTokenTreasury:return"CONTRACT_IS_TOKEN_TREASURY";case Status.ContractHasNonZeroTokenBalances:return"CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES";case Status.ContractExpiredAndPendingRemoval:return"CONTRACT_EXPIRED_AND_PENDING_REMOVAL";case Status.ContractHasNoAutoRenewAccount:return"CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT";case Status.PermanentRemovalRequiresSystemInitiation:return"PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION";case Status.ProxyAccountIdFieldIsDeprecated:return"PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED";case Status.SelfStakingIsNotAllowed:return"SELF_STAKING_IS_NOT_ALLOWED";case Status.InvalidStakingId:return"INVALID_STAKING_ID";case Status.StakingNotEnabled:return"STAKING_NOT_ENABLED";case Status.InvalidPrngRange:return"INVALID_PRNG_RANGE";case Status.MaxEntitiesInPriceRegimeHaveBeenCreated:return"MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED";case Status.InvalidFullPrefixSignatureForPrecompile:return"INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE";case Status.InsufficientBalancesForStorageRent:return"INSUFFICIENT_BALANCES_FOR_STORAGE_RENT";case Status.MaxChildRecordsExceeded:return"MAX_CHILD_RECORDS_EXCEEDED";case Status.InsufficientBalancesForRenewalFees:return"INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES";case Status.TransactionHasUnknownFields:return"TRANSACTION_HAS_UNKNOWN_FIELDS";case Status.AccountIsImmutable:return"ACCOUNT_IS_IMMUTABLE";case Status.AliasAlreadyAssigned:return"ALIAS_ALREADY_ASSIGNED";case Status.InvalidMetadataKey:return"INVALID_METADATA_KEY";case Status.TokenHasNoMetadataKey:return"TOKEN_HAS_NO_METADATA_KEY";case Status.MissingTokenMetadata:return"MISSING_TOKEN_METADATA";case Status.MissingSerialNumbers:return"MISSING_SERIAL_NUMBERS";case Status.TokenHasNoAdminKey:return"TOKEN_HAS_NO_ADMIN_KEY";case Status.NodeDeleted:return"NODE_DELETED";case Status.InvalidNodeId:return"INVALID_NODE_ID";case Status.InvalidGossipEndpoint:return"INVALID_GOSSIP_ENDPOINT";case Status.InvalidNodeAccountId:return"INVALID_NODE_ACCOUNT_ID";case Status.InvalidNodeDescription:return"INVALID_NODE_DESCRIPTION";case Status.InvalidServiceEndpoint:return"INVALID_SERVICE_ENDPOINT";case Status.InvalidGossipCaCertificate:return"INVALID_GOSSIP_CA_CERTIFICATE";case Status.InvalidGrpcCertificate:return"INVALID_GRPC_CERTIFICATE";case Status.InvalidMaxAutoAssociations:return"INVALID_MAX_AUTO_ASSOCIATIONS";case Status.MaxNodesCreated:return"MAX_NODES_CREATED";case Status.IpFqdnCannotBeSetForSameEndpoint:return"IP_FQDN_CANNOT_BE_SET_FOR_SAME_ENDPOINT";case Status.GossipEndpointCannotHaveFqdn:return"GOSSIP_ENDPOINT_CANNOT_HAVE_FQDN";case Status.FqdnSizeTooLarge:return"FQDN_SIZE_TOO_LARGE";case Status.InvalidEndpoint:return"INVALID_ENDPOINT";case Status.GossipEndpointsExceededLimit:return"GOSSIP_ENDPOINTS_EXCEEDED_LIMIT";case Status.ServiceEndpointsExceededLimit:return"SERVICE_ENDPOINTS_EXCEEDED_LIMIT";case Status.InvalidIpv4Address:return"INVALID_IPV4_ADDRESS";case Status.TokenReferenceRepeated:return"TOKEN_REFERENCE_REPEATED";case Status.InvalidOwnerId:return"INVALID_OWNER_ID";case Status.TokenReferenceListSizeLimitExceeded:return"TOKEN_REFERENCE_LIST_SIZE_LIMIT_EXCEEDED";case Status.EmptyTokenReferenceList:return"EMPTY_TOKEN_REFERENCE_LIST";case Status.UpdateNodeAccountNotAllowed:return"UPDATE_NODE_ACCOUNT_NOT_ALLOWED";case Status.TokenHasNoMetadataOrSupplyKey:return"TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY";case Status.EmptyPendingAirdropIdList:return"EMPTY_PENDING_AIRDROP_ID_LIST";case Status.PendingAirdropIdRepeated:return"PENDING_AIRDROP_ID_REPEATED";case Status.MaxPendingAirdropIdExceeded:return"PENDING_AIRDROP_ID_LIST_TOO_LONG";case Status.PendingNftAirdropAlreadyExists:return"PENDING_NFT_AIRDROP_ALREADY_EXISTS";case Status.AccountHasPendingAirdrops:return"ACCOUNT_HAS_PENDING_AIRDROPS";case Status.ThrottledAtConsensus:return"THROTTLED_AT_CONSENSUS";case Status.InvalidPendingAirdropId:return"INVALID_PENDING_AIRDROP_ID";case Status.TokenAirdropWithFallbackRoyalty:return"TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY";case Status.InvalidTokenInPendingAirdrop:return"INVALID_TOKEN_IN_PENDING_AIRDROP";case Status.ScheduleExpiryIsBusy:return"SCHEDULE_EXPIRY_IS_BUSY";case Status.InvalidGrpcCertificateHash:return"INVALID_GRPC_CERTIFICATE_HASH";case Status.MissingExpiryTime:return"MISSING_EXPIRY_TIME";case Status.NoSchedulingAllowedAfterScheduledRecursion:return"NO_SCHEDULING_ALLOWED_AFTER_SCHEDULED_RECURSION";case Status.RecursiveSchedulingLimitReached:return"RECURSIVE_SCHEDULING_LIMIT_REACHED";case Status.WaitingForLedgerId:return"WAITING_FOR_LEDGER_ID";case Status.MaxEntriesForFeeExemptKeyListExceeded:return"MAX_ENTRIES_FOR_FEE_EXEMPT_KEY_LIST_EXCEEDED";case Status.FeeExemptKeyListContainsDuplicatedKeys:return"FEE_EXEMPT_KEY_LIST_CONTAINS_DUPLICATED_KEYS";case Status.InvalidKeyInFeeExemptKeyList:return"INVALID_KEY_IN_FEE_EXEMPT_KEY_LIST";case Status.InvalidFeeScheduleKey:return"INVALID_FEE_SCHEDULE_KEY";case Status.FeeScheduleKeyCannotBeUpdated:return"FEE_SCHEDULE_KEY_CANNOT_BE_UPDATED";case Status.FeeScheduleKeyNotSet:return"FEE_SCHEDULE_KEY_NOT_SET";case Status.MaxCustomFeeLimitExceeded:return"MAX_CUSTOM_FEE_LIMIT_EXCEEDED";case Status.NoValidMaxCustomFee:return"NO_VALID_MAX_CUSTOM_FEE";case Status.InvalidMaxCustomFees:return"INVALID_MAX_CUSTOM_FEES";case Status.DuplicateDenominationInMaxCustomFeeList:return"DUPLICATE_DENOMINATION_IN_MAX_CUSTOM_FEE_LIST";case Status.DuplicateAccountIdInMaxCustomFeeList:return"DUPLICATE_ACCOUNT_ID_IN_MAX_CUSTOM_FEE_LIST";case Status.MaxCustomFeesIsNotSupported:return"MAX_CUSTOM_FEES_IS_NOT_SUPPORTED";case Status.BatchListEmpty:return"BATCH_LIST_EMPTY";case Status.BatchListContainsDuplicates:return"BATCH_LIST_CONTAINS_DUPLICATES";case Status.BatchTransactionInBlacklist:return"BATCH_TRANSACTION_IN_BLACKLIST";case Status.InnerTransactionFailed:return"INNER_TRANSACTION_FAILED";case Status.MissingBatchKey:return"MISSING_BATCH_KEY";case Status.BatchKeySetOnNonInnerTransaction:return"BATCH_KEY_SET_ON_NON_INNER_TRANSACTION";case Status.InvalidBatchKey:return"INVALID_BATCH_KEY";case Status.ScheduleExpiryNotConfigurable:return"SCHEDULE_EXPIRY_NOT_CONFIGURABLE";case Status.CreatingSystemEntities:return"CREATING_SYSTEM_ENTITIES";case Status.ThrottleGroupLcmOverflow:return"THROTTLE_GROUP_LCM_OVERFLOW";case Status.AirdropContainsMultipleSendersForAToken:return"AIRDROP_CONTAINS_MULTIPLE_SENDERS_FOR_A_TOKEN";case Status.GrpcWebProxyNotSupported:return"GRPC_WEB_PROXY_NOT_SUPPORTED";case Status.NftTransfersOnlyAllowedForNonFungibleUnique:return"NFT_TRANSFERS_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.InvalidSerializedTxMessageHashAlgorithm:return"INVALID_SERIALIZED_TX_MESSAGE_HASH_ALGORITHM";case Status.WrongHookEntityType:return"WRONG_HOOK_ENTITY_TYPE";case Status.EvmHookGasThrottled:return"EVM_HOOK_GAS_THROTTLED";case Status.HookIdInUse:return"HOOK_ID_IN_USE";case Status.BadHookRequest:return"BAD_HOOK_REQUEST";case Status.RejectedByAccountAllowanceHook:return"REJECTED_BY_ACCOUNT_ALLOWANCE_HOOK";case Status.HookNotFound:return"HOOK_NOT_FOUND";case Status.LambdaStorageUpdateBytesTooLong:return"LAMBDA_STORAGE_UPDATE_BYTES_TOO_LONG";case Status.LambdaStorageUpdateBytesMustUseMinimalRepresentation:return"LAMBDA_STORAGE_UPDATE_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.InvalidHookId:return"INVALID_HOOK_ID";case Status.EmptyLambdaStorageUpdate:return"EMPTY_LAMBDA_STORAGE_UPDATE";case Status.HookIdRepeatedInCreationDetails:return"HOOK_ID_REPEATED_IN_CREATION_DETAILS";case Status.HooksNotEnabled:return"HOOKS_NOT_ENABLED";case Status.HookIsNotALambda:return"HOOK_IS_NOT_A_LAMBDA";case Status.HookDeleted:return"HOOK_DELETED";case Status.TooManyLambdaStorageUpdates:return"TOO_MANY_LAMBDA_STORAGE_UPDATES";case Status.HookCreationBytesMustUseMinimalRepresentation:return"HOOK_CREATION_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.HookCreationBytesTooLong:return"HOOK_CREATION_BYTES_TOO_LONG";case Status.InvalidHookCreationSpec:return"INVALID_HOOK_CREATION_SPEC";case Status.HookExtensionEmpty:return"HOOK_EXTENSION_EMPTY";case Status.InvalidHookAdminKey:return"INVALID_HOOK_ADMIN_KEY";case Status.HookDeletionRequiresZeroStorageSlots:return"HOOK_DELETION_REQUIRES_ZERO_STORAGE_SLOTS";case Status.CannotSetHooksAndApproval:return"CANNOT_SET_HOOKS_AND_APPROVAL";case Status.TransactionRequiresZeroHooks:return"TRANSACTION_REQUIRES_ZERO_HOOKS";case Status.InvalidHookCall:return"INVALID_HOOK_CALL";case Status.HooksAreNotSupportedInAirdrops:return"HOOKS_ARE_NOT_SUPPORTED_IN_AIRDROPS";case Status.AccountIsLinkedToANode:return"ACCOUNT_IS_LINKED_TO_A_NODE";case Status.HooksExecutionsRequireTopLevelCryptoTransfer:return"HOOKS_EXECUTIONS_REQUIRE_TOP_LEVEL_CRYPTO_TRANSFER";case Status.NodeAccountHasZeroBalance:return"NODE_ACCOUNT_HAS_ZERO_BALANCE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return Status.Ok;case 1:return Status.InvalidTransaction;case 2:return Status.PayerAccountNotFound;case 3:return Status.InvalidNodeAccount;case 4:return Status.TransactionExpired;case 5:return Status.InvalidTransactionStart;case 6:return Status.InvalidTransactionDuration;case 7:return Status.InvalidSignature;case 8:return Status.MemoTooLong;case 9:return Status.InsufficientTxFee;case 10:return Status.InsufficientPayerBalance;case 11:return Status.DuplicateTransaction;case 12:return Status.Busy;case 13:return Status.NotSupported;case 14:return Status.InvalidFileId;case 15:return Status.InvalidAccountId;case 16:return Status.InvalidContractId;case 17:return Status.InvalidTransactionId;case 18:return Status.ReceiptNotFound;case 19:return Status.RecordNotFound;case 20:return Status.InvalidSolidityId;case 21:return Status.Unknown;case 22:return Status.Success;case 23:return Status.FailInvalid;case 24:return Status.FailFee;case 25:return Status.FailBalance;case 26:return Status.KeyRequired;case 27:return Status.BadEncoding;case 28:return Status.InsufficientAccountBalance;case 29:return Status.InvalidSolidityAddress;case 30:return Status.InsufficientGas;case 31:return Status.ContractSizeLimitExceeded;case 32:return Status.LocalCallModificationException;case 33:return Status.ContractRevertExecuted;case 34:return Status.ContractExecutionException;case 35:return Status.InvalidReceivingNodeAccount;case 36:return Status.MissingQueryHeader;case 37:return Status.AccountUpdateFailed;case 38:return Status.InvalidKeyEncoding;case 39:return Status.NullSolidityAddress;case 40:return Status.ContractUpdateFailed;case 41:return Status.InvalidQueryHeader;case 42:return Status.InvalidFeeSubmitted;case 43:return Status.InvalidPayerSignature;case 44:return Status.KeyNotProvided;case 45:return Status.InvalidExpirationTime;case 46:return Status.NoWaclKey;case 47:return Status.FileContentEmpty;case 48:return Status.InvalidAccountAmounts;case 49:return Status.EmptyTransactionBody;case 50:return Status.InvalidTransactionBody;case 51:return Status.InvalidSignatureTypeMismatchingKey;case 52:return Status.InvalidSignatureCountMismatchingKey;case 53:return Status.EmptyLiveHashBody;case 54:return Status.EmptyLiveHash;case 55:return Status.EmptyLiveHashKeys;case 56:return Status.InvalidLiveHashSize;case 57:return Status.EmptyQueryBody;case 58:return Status.EmptyLiveHashQuery;case 59:return Status.LiveHashNotFound;case 60:return Status.AccountIdDoesNotExist;case 61:return Status.LiveHashAlreadyExists;case 62:return Status.InvalidFileWacl;case 63:return Status.SerializationFailed;case 64:return Status.TransactionOversize;case 65:return Status.TransactionTooManyLayers;case 66:return Status.ContractDeleted;case 67:return Status.PlatformNotActive;case 68:return Status.KeyPrefixMismatch;case 69:return Status.PlatformTransactionNotCreated;case 70:return Status.InvalidRenewalPeriod;case 71:return Status.InvalidPayerAccountId;case 72:return Status.AccountDeleted;case 73:return Status.FileDeleted;case 74:return Status.AccountRepeatedInAccountAmounts;case 75:return Status.SettingNegativeAccountBalance;case 76:return Status.ObtainerRequired;case 77:return Status.ObtainerSameContractId;case 78:return Status.ObtainerDoesNotExist;case 79:return Status.ModifyingImmutableContract;case 80:return Status.FileSystemException;case 81:return Status.AutorenewDurationNotInRange;case 82:return Status.ErrorDecodingBytestring;case 83:return Status.ContractFileEmpty;case 84:return Status.ContractBytecodeEmpty;case 85:return Status.InvalidInitialBalance;case 86:return Status.InvalidReceiveRecordThreshold;case 87:return Status.InvalidSendRecordThreshold;case 88:return Status.AccountIsNotGenesisAccount;case 89:return Status.PayerAccountUnauthorized;case 90:return Status.InvalidFreezeTransactionBody;case 91:return Status.FreezeTransactionBodyNotFound;case 92:return Status.TransferListSizeLimitExceeded;case 93:return Status.ResultSizeLimitExceeded;case 94:return Status.NotSpecialAccount;case 95:return Status.ContractNegativeGas;case 96:return Status.ContractNegativeValue;case 97:return Status.InvalidFeeFile;case 98:return Status.InvalidExchangeRateFile;case 99:return Status.InsufficientLocalCallGas;case 100:return Status.EntityNotAllowedToDelete;case 101:return Status.AuthorizationFailed;case 102:return Status.FileUploadedProtoInvalid;case 103:return Status.FileUploadedProtoNotSavedToDisk;case 104:return Status.FeeScheduleFilePartUploaded;case 105:return Status.ExchangeRateChangeLimitExceeded;case 106:return Status.MaxContractStorageExceeded;case 107:return Status.TransferAccountSameAsDeleteAccount;case 108:return Status.TotalLedgerBalanceInvalid;case 110:return Status.ExpirationReductionNotAllowed;case 111:return Status.MaxGasLimitExceeded;case 112:return Status.MaxFileSizeExceeded;case 113:return Status.ReceiverSigRequired;case 150:return Status.InvalidTopicId;case 155:return Status.InvalidAdminKey;case 156:return Status.InvalidSubmitKey;case 157:return Status.Unauthorized;case 158:return Status.InvalidTopicMessage;case 159:return Status.InvalidAutorenewAccount;case 160:return Status.AutorenewAccountNotAllowed;case 162:return Status.TopicExpired;case 163:return Status.InvalidChunkNumber;case 164:return Status.InvalidChunkTransactionId;case 165:return Status.AccountFrozenForToken;case 166:return Status.TokensPerAccountLimitExceeded;case 167:return Status.InvalidTokenId;case 168:return Status.InvalidTokenDecimals;case 169:return Status.InvalidTokenInitialSupply;case 170:return Status.InvalidTreasuryAccountForToken;case 171:return Status.InvalidTokenSymbol;case 172:return Status.TokenHasNoFreezeKey;case 173:return Status.TransfersNotZeroSumForToken;case 174:return Status.MissingTokenSymbol;case 175:return Status.TokenSymbolTooLong;case 176:return Status.AccountKycNotGrantedForToken;case 177:return Status.TokenHasNoKycKey;case 178:return Status.InsufficientTokenBalance;case 179:return Status.TokenWasDeleted;case 180:return Status.TokenHasNoSupplyKey;case 181:return Status.TokenHasNoWipeKey;case 182:return Status.InvalidTokenMintAmount;case 183:return Status.InvalidTokenBurnAmount;case 184:return Status.TokenNotAssociatedToAccount;case 185:return Status.CannotWipeTokenTreasuryAccount;case 186:return Status.InvalidKycKey;case 187:return Status.InvalidWipeKey;case 188:return Status.InvalidFreezeKey;case 189:return Status.InvalidSupplyKey;case 190:return Status.MissingTokenName;case 191:return Status.TokenNameTooLong;case 192:return Status.InvalidWipingAmount;case 193:return Status.TokenIsImmutable;case 194:return Status.TokenAlreadyAssociatedToAccount;case 195:return Status.TransactionRequiresZeroTokenBalances;case 196:return Status.AccountIsTreasury;case 197:return Status.TokenIdRepeatedInTokenList;case 198:return Status.TokenTransferListSizeLimitExceeded;case 199:return Status.EmptyTokenTransferBody;case 200:return Status.EmptyTokenTransferAccountAmounts;case 201:return Status.InvalidScheduleId;case 202:return Status.ScheduleIsImmutable;case 203:return Status.InvalidSchedulePayerId;case 204:return Status.InvalidScheduleAccountId;case 205:return Status.NoNewValidSignatures;case 206:return Status.UnresolvableRequiredSigners;case 207:return Status.ScheduledTransactionNotInWhitelist;case 208:return Status.SomeSignaturesWereInvalid;case 209:return Status.TransactionIdFieldNotAllowed;case 210:return Status.IdenticalScheduleAlreadyCreated;case 211:return Status.InvalidZeroByteInString;case 212:return Status.ScheduleAlreadyDeleted;case 213:return Status.ScheduleAlreadyExecuted;case 214:return Status.MessageSizeTooLarge;case 215:return Status.OperationRepeatedInBucketGroups;case 216:return Status.BucketCapacityOverflow;case 217:return Status.NodeCapacityNotSufficientForOperation;case 218:return Status.BucketHasNoThrottleGroups;case 219:return Status.ThrottleGroupHasZeroOpsPerSec;case 220:return Status.SuccessButMissingExpectedOperation;case 221:return Status.UnparseableThrottleDefinitions;case 222:return Status.InvalidThrottleDefinitions;case 223:return Status.AccountExpiredAndPendingRemoval;case 224:return Status.InvalidTokenMaxSupply;case 225:return Status.InvalidTokenNftSerialNumber;case 226:return Status.InvalidNftId;case 227:return Status.MetadataTooLong;case 228:return Status.BatchSizeLimitExceeded;case 229:return Status.InvalidQueryRange;case 230:return Status.FractionDividesByZero;case 231:return Status.InsufficientPayerBalanceForCustomFee;case 232:return Status.CustomFeesListTooLong;case 233:return Status.InvalidCustomFeeCollector;case 234:return Status.InvalidTokenIdInCustomFees;case 235:return Status.TokenNotAssociatedToFeeCollector;case 236:return Status.TokenMaxSupplyReached;case 237:return Status.SenderDoesNotOwnNftSerialNo;case 238:return Status.CustomFeeNotFullySpecified;case 239:return Status.CustomFeeMustBePositive;case 240:return Status.TokenHasNoFeeScheduleKey;case 241:return Status.CustomFeeOutsideNumericRange;case 242:return Status.RoyaltyFractionCannotExceedOne;case 243:return Status.FractionalFeeMaxAmountLessThanMinAmount;case 244:return Status.CustomScheduleAlreadyHasNoFees;case 245:return Status.CustomFeeDenominationMustBeFungibleCommon;case 246:return Status.CustomFractionalFeeOnlyAllowedForFungibleCommon;case 247:return Status.InvalidCustomFeeScheduleKey;case 248:return Status.InvalidTokenMintMetadata;case 249:return Status.InvalidTokenBurnMetadata;case 250:return Status.CurrentTreasuryStillOwnsNfts;case 251:return Status.AccountStillOwnsNfts;case 252:return Status.TreasuryMustOwnBurnedNft;case 253:return Status.AccountDoesNotOwnWipedNft;case 254:return Status.AccountAmountTransfersOnlyAllowedForFungibleCommon;case 255:return Status.MaxNftsInPriceRegimeHaveBeenMinted;case 256:return Status.PayerAccountDeleted;case 257:return Status.CustomFeeChargingExceededMaxRecursionDepth;case 258:return Status.CustomFeeChargingExceededMaxAccountAmounts;case 259:return Status.InsufficientSenderAccountBalanceForCustomFee;case 260:return Status.SerialNumberLimitReached;case 261:return Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique;case 262:return Status.NoRemainingAutomaticAssociations;case 263:return Status.ExistingAutomaticAssociationsExceedGivenLimit;case 264:return Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit;case 265:return Status.TokenIsPaused;case 266:return Status.TokenHasNoPauseKey;case 267:return Status.InvalidPauseKey;case 268:return Status.FreezeUpdateFileDoesNotExist;case 269:return Status.FreezeUpdateFileHashDoesNotMatch;case 270:return Status.NoUpgradeHasBeenPrepared;case 271:return Status.NoFreezeIsScheduled;case 272:return Status.UpdateFileHashChangedSincePrepareUpgrade;case 273:return Status.FreezeStartTimeMustBeFuture;case 274:return Status.PreparedUpdateFileIsImmutable;case 275:return Status.FreezeAlreadyScheduled;case 276:return Status.FreezeUpgradeInProgress;case 277:return Status.UpdateFileIdDoesNotMatchPrepared;case 278:return Status.UpdateFileHashDoesNotMatchPrepared;case 279:return Status.ConsensusGasExhausted;case 280:return Status.RevertedSuccess;case 281:return Status.MaxStorageInPriceRegimeHasBeenUsed;case 282:return Status.InvalidAliasKey;case 283:return Status.UnexpectedTokenDecimals;case 284:return Status.InvalidProxyAccountId;case 285:return Status.InvalidTransferAccountId;case 286:return Status.InvalidFeeCollectorAccountId;case 287:return Status.AliasIsImmutable;case 288:return Status.SpenderAccountSameAsOwner;case 289:return Status.AmountExceedsTokenMaxSupply;case 290:return Status.NegativeAllowanceAmount;case 291:return Status.CannotApproveForAllFungibleCommon;case 292:return Status.SpenderDoesNotHaveAllowance;case 293:return Status.AmountExceedsAllowance;case 294:return Status.MaxAllowancesExceeded;case 295:return Status.EmptyAllowances;case 296:return Status.SpenderAccountRepeatedInAllowances;case 297:return Status.RepeatedSerialNumsInNftAllowances;case 298:return Status.FungibleTokenInNftAllowances;case 299:return Status.NftInFungibleTokenAllowances;case 300:return Status.InvalidAllowanceOwnerId;case 301:return Status.InvalidAllowanceSpenderId;case 302:return Status.RepeatedAllowancesToDelete;case 303:return Status.InvalidDelegatingSpender;case 304:return Status.DelegatingSpenderCannotGrantApproveForAll;case 305:return Status.DelegatingSpenderDoesNotHaveApproveForAll;case 306:return Status.ScheduleExpirationTimeTooFarInFuture;case 307:return Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime;case 308:return Status.ScheduleFutureThrottleExceeded;case 309:return Status.ScheduleFutureGasLimitExceeded;case 310:return Status.InvalidEthereumTransaction;case 311:return Status.WrongChainId;case 312:return Status.WrongNonce;case 313:return Status.AccessListUnsupported;case 314:return Status.SchedulePendingExpiration;case 315:return Status.ContractIsTokenTreasury;case 316:return Status.ContractHasNonZeroTokenBalances;case 317:return Status.ContractExpiredAndPendingRemoval;case 318:return Status.ContractHasNoAutoRenewAccount;case 319:return Status.PermanentRemovalRequiresSystemInitiation;case 320:return Status.ProxyAccountIdFieldIsDeprecated;case 321:return Status.SelfStakingIsNotAllowed;case 322:return Status.InvalidStakingId;case 323:return Status.StakingNotEnabled;case 324:return Status.InvalidPrngRange;case 325:return Status.MaxEntitiesInPriceRegimeHaveBeenCreated;case 326:return Status.InvalidFullPrefixSignatureForPrecompile;case 327:return Status.InsufficientBalancesForStorageRent;case 328:return Status.MaxChildRecordsExceeded;case 329:return Status.InsufficientBalancesForRenewalFees;case 330:return Status.TransactionHasUnknownFields;case 331:return Status.AccountIsImmutable;case 332:return Status.AliasAlreadyAssigned;case 333:return Status.InvalidMetadataKey;case 334:return Status.TokenHasNoMetadataKey;case 335:return Status.MissingTokenMetadata;case 336:return Status.MissingSerialNumbers;case 337:return Status.TokenHasNoAdminKey;case 338:return Status.NodeDeleted;case 339:return Status.InvalidNodeId;case 340:return Status.InvalidGossipEndpoint;case 341:return Status.InvalidNodeAccountId;case 342:return Status.InvalidNodeDescription;case 343:return Status.InvalidServiceEndpoint;case 344:return Status.InvalidGossipCaCertificate;case 345:return Status.InvalidGrpcCertificate;case 346:return Status.InvalidMaxAutoAssociations;case 347:return Status.MaxNodesCreated;case 348:return Status.IpFqdnCannotBeSetForSameEndpoint;case 349:return Status.GossipEndpointCannotHaveFqdn;case 350:return Status.FqdnSizeTooLarge;case 351:return Status.InvalidEndpoint;case 352:return Status.GossipEndpointsExceededLimit;case 353:return Status.TokenReferenceRepeated;case 354:return Status.InvalidOwnerId;case 355:return Status.TokenReferenceListSizeLimitExceeded;case 356:return Status.ServiceEndpointsExceededLimit;case 357:return Status.InvalidIpv4Address;case 358:return Status.EmptyTokenReferenceList;case 359:return Status.UpdateNodeAccountNotAllowed;case 360:return Status.TokenHasNoMetadataOrSupplyKey;case 361:return Status.EmptyPendingAirdropIdList;case 362:return Status.PendingAirdropIdRepeated;case 363:return Status.MaxPendingAirdropIdExceeded;case 364:return Status.PendingNftAirdropAlreadyExists;case 365:return Status.AccountHasPendingAirdrops;case 366:return Status.ThrottledAtConsensus;case 367:return Status.InvalidPendingAirdropId;case 368:return Status.TokenAirdropWithFallbackRoyalty;case 369:return Status.InvalidTokenInPendingAirdrop;case 370:return Status.ScheduleExpiryIsBusy;case 371:return Status.InvalidGrpcCertificateHash;case 372:return Status.MissingExpiryTime;case 373:return Status.NoSchedulingAllowedAfterScheduledRecursion;case 374:return Status.RecursiveSchedulingLimitReached;case 375:return Status.WaitingForLedgerId;case 376:return Status.MaxEntriesForFeeExemptKeyListExceeded;case 377:return Status.FeeExemptKeyListContainsDuplicatedKeys;case 378:return Status.InvalidKeyInFeeExemptKeyList;case 379:return Status.InvalidFeeScheduleKey;case 380:return Status.FeeScheduleKeyCannotBeUpdated;case 381:return Status.FeeScheduleKeyNotSet;case 382:return Status.MaxCustomFeeLimitExceeded;case 383:return Status.NoValidMaxCustomFee;case 384:return Status.InvalidMaxCustomFees;case 385:return Status.DuplicateDenominationInMaxCustomFeeList;case 386:return Status.DuplicateAccountIdInMaxCustomFeeList;case 387:return Status.MaxCustomFeesIsNotSupported;case 388:return Status.BatchListEmpty;case 389:return Status.BatchListContainsDuplicates;case 390:return Status.BatchTransactionInBlacklist;case 391:return Status.InnerTransactionFailed;case 392:return Status.MissingBatchKey;case 393:return Status.BatchKeySetOnNonInnerTransaction;case 394:return Status.InvalidBatchKey;case 395:return Status.ScheduleExpiryNotConfigurable;case 396:return Status.CreatingSystemEntities;case 397:return Status.ThrottleGroupLcmOverflow;case 398:return Status.AirdropContainsMultipleSendersForAToken;case 399:return Status.GrpcWebProxyNotSupported;case 400:return Status.NftTransfersOnlyAllowedForNonFungibleUnique;case 401:return Status.InvalidSerializedTxMessageHashAlgorithm;case 499:return Status.WrongHookEntityType;case 500:return Status.EvmHookGasThrottled;case 501:return Status.HookIdInUse;case 502:return Status.BadHookRequest;case 503:return Status.RejectedByAccountAllowanceHook;case 504:return Status.HookNotFound;case 505:return Status.LambdaStorageUpdateBytesTooLong;case 506:return Status.LambdaStorageUpdateBytesMustUseMinimalRepresentation;case 507:return Status.InvalidHookId;case 508:return Status.EmptyLambdaStorageUpdate;case 509:return Status.HookIdRepeatedInCreationDetails;case 510:return Status.HooksNotEnabled;case 511:return Status.HookIsNotALambda;case 512:return Status.HookDeleted;case 513:return Status.TooManyLambdaStorageUpdates;case 514:return Status.HookCreationBytesMustUseMinimalRepresentation;case 515:return Status.HookCreationBytesTooLong;case 516:return Status.InvalidHookCreationSpec;case 517:return Status.HookExtensionEmpty;case 518:return Status.InvalidHookAdminKey;case 519:return Status.HookDeletionRequiresZeroStorageSlots;case 520:return Status.CannotSetHooksAndApproval;case 521:return Status.TransactionRequiresZeroHooks;case 522:return Status.InvalidHookCall;case 523:return Status.HooksAreNotSupportedInAirdrops;case 524:return Status.AccountIsLinkedToANode;case 525:return Status.HooksExecutionsRequireTopLevelCryptoTransfer;case 526:return Status.NodeAccountHasZeroBalance;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}Status.Ok=new Status(0),Status.InvalidTransaction=new Status(1),Status.PayerAccountNotFound=new Status(2),Status.InvalidNodeAccount=new Status(3),Status.TransactionExpired=new Status(4),Status.InvalidTransactionStart=new Status(5),Status.InvalidTransactionDuration=new Status(6),Status.InvalidSignature=new Status(7),Status.MemoTooLong=new Status(8),Status.InsufficientTxFee=new Status(9),Status.InsufficientPayerBalance=new Status(10),Status.DuplicateTransaction=new Status(11),Status.Busy=new Status(12),Status.NotSupported=new Status(13),Status.InvalidFileId=new Status(14),Status.InvalidAccountId=new Status(15),Status.InvalidContractId=new Status(16),Status.InvalidTransactionId=new Status(17),Status.ReceiptNotFound=new Status(18),Status.RecordNotFound=new Status(19),Status.InvalidSolidityId=new Status(20),Status.Unknown=new Status(21),Status.Success=new Status(22),Status.FailInvalid=new Status(23),Status.FailFee=new Status(24),Status.FailBalance=new Status(25),Status.KeyRequired=new Status(26),Status.BadEncoding=new Status(27),Status.InsufficientAccountBalance=new Status(28),Status.InvalidSolidityAddress=new Status(29),Status.InsufficientGas=new Status(30),Status.ContractSizeLimitExceeded=new Status(31),Status.LocalCallModificationException=new Status(32),Status.ContractRevertExecuted=new Status(33),Status.ContractExecutionException=new Status(34),Status.InvalidReceivingNodeAccount=new Status(35),Status.MissingQueryHeader=new Status(36),Status.AccountUpdateFailed=new Status(37),Status.InvalidKeyEncoding=new Status(38),Status.NullSolidityAddress=new Status(39),Status.ContractUpdateFailed=new Status(40),Status.InvalidQueryHeader=new Status(41),Status.InvalidFeeSubmitted=new Status(42),Status.InvalidPayerSignature=new Status(43),Status.KeyNotProvided=new Status(44),Status.InvalidExpirationTime=new Status(45),Status.NoWaclKey=new Status(46),Status.FileContentEmpty=new Status(47),Status.InvalidAccountAmounts=new Status(48),Status.EmptyTransactionBody=new Status(49),Status.InvalidTransactionBody=new Status(50),Status.InvalidSignatureTypeMismatchingKey=new Status(51),Status.InvalidSignatureCountMismatchingKey=new Status(52),Status.EmptyLiveHashBody=new Status(53),Status.EmptyLiveHash=new Status(54),Status.EmptyLiveHashKeys=new Status(55),Status.InvalidLiveHashSize=new Status(56),Status.EmptyQueryBody=new Status(57),Status.EmptyLiveHashQuery=new Status(58),Status.LiveHashNotFound=new Status(59),Status.AccountIdDoesNotExist=new Status(60),Status.LiveHashAlreadyExists=new Status(61),Status.InvalidFileWacl=new Status(62),Status.SerializationFailed=new Status(63),Status.TransactionOversize=new Status(64),Status.TransactionTooManyLayers=new Status(65),Status.ContractDeleted=new Status(66),Status.PlatformNotActive=new Status(67),Status.KeyPrefixMismatch=new Status(68),Status.PlatformTransactionNotCreated=new Status(69),Status.InvalidRenewalPeriod=new Status(70),Status.InvalidPayerAccountId=new Status(71),Status.AccountDeleted=new Status(72),Status.FileDeleted=new Status(73),Status.AccountRepeatedInAccountAmounts=new Status(74),Status.SettingNegativeAccountBalance=new Status(75),Status.ObtainerRequired=new Status(76),Status.ObtainerSameContractId=new Status(77),Status.ObtainerDoesNotExist=new Status(78),Status.ModifyingImmutableContract=new Status(79),Status.FileSystemException=new Status(80),Status.AutorenewDurationNotInRange=new Status(81),Status.ErrorDecodingBytestring=new Status(82),Status.ContractFileEmpty=new Status(83),Status.ContractBytecodeEmpty=new Status(84),Status.InvalidInitialBalance=new Status(85),Status.InvalidReceiveRecordThreshold=new Status(86),Status.InvalidSendRecordThreshold=new Status(87),Status.AccountIsNotGenesisAccount=new Status(88),Status.PayerAccountUnauthorized=new Status(89),Status.InvalidFreezeTransactionBody=new Status(90),Status.FreezeTransactionBodyNotFound=new Status(91),Status.TransferListSizeLimitExceeded=new Status(92),Status.ResultSizeLimitExceeded=new Status(93),Status.NotSpecialAccount=new Status(94),Status.ContractNegativeGas=new Status(95),Status.ContractNegativeValue=new Status(96),Status.InvalidFeeFile=new Status(97),Status.InvalidExchangeRateFile=new Status(98),Status.InsufficientLocalCallGas=new Status(99),Status.EntityNotAllowedToDelete=new Status(100),Status.AuthorizationFailed=new Status(101),Status.FileUploadedProtoInvalid=new Status(102),Status.FileUploadedProtoNotSavedToDisk=new Status(103),Status.FeeScheduleFilePartUploaded=new Status(104),Status.ExchangeRateChangeLimitExceeded=new Status(105),Status.MaxContractStorageExceeded=new Status(106),Status.TransferAccountSameAsDeleteAccount=new Status(107),Status.TotalLedgerBalanceInvalid=new Status(108),Status.ExpirationReductionNotAllowed=new Status(110),Status.MaxGasLimitExceeded=new Status(111),Status.MaxFileSizeExceeded=new Status(112),Status.ReceiverSigRequired=new Status(113),Status.InvalidTopicId=new Status(150),Status.InvalidAdminKey=new Status(155),Status.InvalidSubmitKey=new Status(156),Status.Unauthorized=new Status(157),Status.InvalidTopicMessage=new Status(158),Status.InvalidAutorenewAccount=new Status(159),Status.AutorenewAccountNotAllowed=new Status(160),Status.TopicExpired=new Status(162),Status.InvalidChunkNumber=new Status(163),Status.InvalidChunkTransactionId=new Status(164),Status.AccountFrozenForToken=new Status(165),Status.TokensPerAccountLimitExceeded=new Status(166),Status.InvalidTokenId=new Status(167),Status.InvalidTokenDecimals=new Status(168),Status.InvalidTokenInitialSupply=new Status(169),Status.InvalidTreasuryAccountForToken=new Status(170),Status.InvalidTokenSymbol=new Status(171),Status.TokenHasNoFreezeKey=new Status(172),Status.TransfersNotZeroSumForToken=new Status(173),Status.MissingTokenSymbol=new Status(174),Status.TokenSymbolTooLong=new Status(175),Status.AccountKycNotGrantedForToken=new Status(176),Status.TokenHasNoKycKey=new Status(177),Status.InsufficientTokenBalance=new Status(178),Status.TokenWasDeleted=new Status(179),Status.TokenHasNoSupplyKey=new Status(180),Status.TokenHasNoWipeKey=new Status(181),Status.InvalidTokenMintAmount=new Status(182),Status.InvalidTokenBurnAmount=new Status(183),Status.TokenNotAssociatedToAccount=new Status(184),Status.CannotWipeTokenTreasuryAccount=new Status(185),Status.InvalidKycKey=new Status(186),Status.InvalidWipeKey=new Status(187),Status.InvalidFreezeKey=new Status(188),Status.InvalidSupplyKey=new Status(189),Status.MissingTokenName=new Status(190),Status.TokenNameTooLong=new Status(191),Status.InvalidWipingAmount=new Status(192),Status.TokenIsImmutable=new Status(193),Status.TokenAlreadyAssociatedToAccount=new Status(194),Status.TransactionRequiresZeroTokenBalances=new Status(195),Status.AccountIsTreasury=new Status(196),Status.TokenIdRepeatedInTokenList=new Status(197),Status.TokenTransferListSizeLimitExceeded=new Status(198),Status.EmptyTokenTransferBody=new Status(199),Status.EmptyTokenTransferAccountAmounts=new Status(200),Status.InvalidScheduleId=new Status(201),Status.ScheduleIsImmutable=new Status(202),Status.InvalidSchedulePayerId=new Status(203),Status.InvalidScheduleAccountId=new Status(204),Status.NoNewValidSignatures=new Status(205),Status.UnresolvableRequiredSigners=new Status(206),Status.ScheduledTransactionNotInWhitelist=new Status(207),Status.SomeSignaturesWereInvalid=new Status(208),Status.TransactionIdFieldNotAllowed=new Status(209),Status.IdenticalScheduleAlreadyCreated=new Status(210),Status.InvalidZeroByteInString=new Status(211),Status.ScheduleAlreadyDeleted=new Status(212),Status.ScheduleAlreadyExecuted=new Status(213),Status.MessageSizeTooLarge=new Status(214),Status.OperationRepeatedInBucketGroups=new Status(215),Status.BucketCapacityOverflow=new Status(216),Status.NodeCapacityNotSufficientForOperation=new Status(217),Status.BucketHasNoThrottleGroups=new Status(218),Status.ThrottleGroupHasZeroOpsPerSec=new Status(219),Status.SuccessButMissingExpectedOperation=new Status(220),Status.UnparseableThrottleDefinitions=new Status(221),Status.InvalidThrottleDefinitions=new Status(222),Status.AccountExpiredAndPendingRemoval=new Status(223),Status.InvalidTokenMaxSupply=new Status(224),Status.InvalidTokenNftSerialNumber=new Status(225),Status.InvalidNftId=new Status(226),Status.MetadataTooLong=new Status(227),Status.BatchSizeLimitExceeded=new Status(228),Status.InvalidQueryRange=new Status(229),Status.FractionDividesByZero=new Status(230),Status.InsufficientPayerBalanceForCustomFee=new Status(231),Status.CustomFeesListTooLong=new Status(232),Status.InvalidCustomFeeCollector=new Status(233),Status.InvalidTokenIdInCustomFees=new Status(234),Status.TokenNotAssociatedToFeeCollector=new Status(235),Status.TokenMaxSupplyReached=new Status(236),Status.SenderDoesNotOwnNftSerialNo=new Status(237),Status.CustomFeeNotFullySpecified=new Status(238),Status.CustomFeeMustBePositive=new Status(239),Status.TokenHasNoFeeScheduleKey=new Status(240),Status.CustomFeeOutsideNumericRange=new Status(241),Status.RoyaltyFractionCannotExceedOne=new Status(242),Status.FractionalFeeMaxAmountLessThanMinAmount=new Status(243),Status.CustomScheduleAlreadyHasNoFees=new Status(244),Status.CustomFeeDenominationMustBeFungibleCommon=new Status(245),Status.CustomFractionalFeeOnlyAllowedForFungibleCommon=new Status(246),Status.InvalidCustomFeeScheduleKey=new Status(247),Status.InvalidTokenMintMetadata=new Status(248),Status.InvalidTokenBurnMetadata=new Status(249),Status.CurrentTreasuryStillOwnsNfts=new Status(250),Status.AccountStillOwnsNfts=new Status(251),Status.TreasuryMustOwnBurnedNft=new Status(252),Status.AccountDoesNotOwnWipedNft=new Status(253),Status.AccountAmountTransfersOnlyAllowedForFungibleCommon=new Status(254),Status.MaxNftsInPriceRegimeHaveBeenMinted=new Status(255),Status.PayerAccountDeleted=new Status(256),Status.CustomFeeChargingExceededMaxRecursionDepth=new Status(257),Status.CustomFeeChargingExceededMaxAccountAmounts=new Status(258),Status.InsufficientSenderAccountBalanceForCustomFee=new Status(259),Status.SerialNumberLimitReached=new Status(260),Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique=new Status(261),Status.NoRemainingAutomaticAssociations=new Status(262),Status.ExistingAutomaticAssociationsExceedGivenLimit=new Status(263),Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit=new Status(264),Status.TokenIsPaused=new Status(265),Status.TokenHasNoPauseKey=new Status(266),Status.InvalidPauseKey=new Status(267),Status.FreezeUpdateFileDoesNotExist=new Status(268),Status.FreezeUpdateFileHashDoesNotMatch=new Status(269),Status.NoUpgradeHasBeenPrepared=new Status(270),Status.NoFreezeIsScheduled=new Status(271),Status.UpdateFileHashChangedSincePrepareUpgrade=new Status(272),Status.FreezeStartTimeMustBeFuture=new Status(273),Status.PreparedUpdateFileIsImmutable=new Status(274),Status.FreezeAlreadyScheduled=new Status(275),Status.FreezeUpgradeInProgress=new Status(276),Status.UpdateFileIdDoesNotMatchPrepared=new Status(277),Status.UpdateFileHashDoesNotMatchPrepared=new Status(278),Status.ConsensusGasExhausted=new Status(279),Status.RevertedSuccess=new Status(280),Status.MaxStorageInPriceRegimeHasBeenUsed=new Status(281),Status.InvalidAliasKey=new Status(282),Status.UnexpectedTokenDecimals=new Status(283),Status.InvalidProxyAccountId=new Status(284),Status.InvalidTransferAccountId=new Status(285),Status.InvalidFeeCollectorAccountId=new Status(286),Status.AliasIsImmutable=new Status(287),Status.SpenderAccountSameAsOwner=new Status(288),Status.AmountExceedsTokenMaxSupply=new Status(289),Status.NegativeAllowanceAmount=new Status(290),Status.CannotApproveForAllFungibleCommon=new Status(291),Status.SpenderDoesNotHaveAllowance=new Status(292),Status.AmountExceedsAllowance=new Status(293),Status.MaxAllowancesExceeded=new Status(294),Status.EmptyAllowances=new Status(295),Status.SpenderAccountRepeatedInAllowances=new Status(296),Status.RepeatedSerialNumsInNftAllowances=new Status(297),Status.FungibleTokenInNftAllowances=new Status(298),Status.NftInFungibleTokenAllowances=new Status(299),Status.InvalidAllowanceOwnerId=new Status(300),Status.InvalidAllowanceSpenderId=new Status(301),Status.RepeatedAllowancesToDelete=new Status(302),Status.InvalidDelegatingSpender=new Status(303),Status.DelegatingSpenderCannotGrantApproveForAll=new Status(304),Status.DelegatingSpenderDoesNotHaveApproveForAll=new Status(305),Status.ScheduleExpirationTimeTooFarInFuture=new Status(306),Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime=new Status(307),Status.ScheduleFutureThrottleExceeded=new Status(308),Status.ScheduleFutureGasLimitExceeded=new Status(309),Status.InvalidEthereumTransaction=new Status(310),Status.WrongChainId=new Status(311),Status.WrongNonce=new Status(312),Status.AccessListUnsupported=new Status(313),Status.SchedulePendingExpiration=new Status(314),Status.ContractIsTokenTreasury=new Status(315),Status.ContractHasNonZeroTokenBalances=new Status(316),Status.ContractExpiredAndPendingRemoval=new Status(317),Status.ContractHasNoAutoRenewAccount=new Status(318),Status.PermanentRemovalRequiresSystemInitiation=new Status(319),Status.ProxyAccountIdFieldIsDeprecated=new Status(320),Status.SelfStakingIsNotAllowed=new Status(321),Status.InvalidStakingId=new Status(322),Status.StakingNotEnabled=new Status(323),Status.InvalidPrngRange=new Status(324),Status.MaxEntitiesInPriceRegimeHaveBeenCreated=new Status(325),Status.InvalidFullPrefixSignatureForPrecompile=new Status(326),Status.InsufficientBalancesForStorageRent=new Status(327),Status.MaxChildRecordsExceeded=new Status(328),Status.InsufficientBalancesForRenewalFees=new Status(329),Status.TransactionHasUnknownFields=new Status(330),Status.AccountIsImmutable=new Status(331),Status.AliasAlreadyAssigned=new Status(332),Status.InvalidMetadataKey=new Status(333),Status.TokenHasNoMetadataKey=new Status(334),Status.MissingTokenMetadata=new Status(335),Status.MissingSerialNumbers=new Status(336),Status.TokenHasNoAdminKey=new Status(337),Status.NodeDeleted=new Status(338),Status.InvalidNodeId=new Status(339),Status.InvalidGossipEndpoint=new Status(340),Status.InvalidNodeAccountId=new Status(341),Status.InvalidNodeDescription=new Status(342),Status.InvalidServiceEndpoint=new Status(343),Status.InvalidGossipCaCertificate=new Status(344),Status.InvalidGrpcCertificate=new Status(345),Status.InvalidMaxAutoAssociations=new Status(346),Status.MaxNodesCreated=new Status(347),Status.IpFqdnCannotBeSetForSameEndpoint=new Status(348),Status.GossipEndpointCannotHaveFqdn=new Status(349),Status.FqdnSizeTooLarge=new Status(350),Status.InvalidEndpoint=new Status(351),Status.GossipEndpointsExceededLimit=new Status(352),Status.TokenReferenceRepeated=new Status(353),Status.InvalidOwnerId=new Status(354),Status.TokenReferenceListSizeLimitExceeded=new Status(355),Status.ServiceEndpointsExceededLimit=new Status(356),Status.InvalidIpv4Address=new Status(357),Status.EmptyTokenReferenceList=new Status(358),Status.UpdateNodeAccountNotAllowed=new Status(359),Status.TokenHasNoMetadataOrSupplyKey=new Status(360),Status.EmptyPendingAirdropIdList=new Status(361),Status.PendingAirdropIdRepeated=new Status(362),Status.MaxPendingAirdropIdExceeded=new Status(363),Status.PendingNftAirdropAlreadyExists=new Status(364),Status.AccountHasPendingAirdrops=new Status(365),Status.ThrottledAtConsensus=new Status(366),Status.InvalidPendingAirdropId=new Status(367),Status.TokenAirdropWithFallbackRoyalty=new Status(368),Status.InvalidTokenInPendingAirdrop=new Status(369),Status.ScheduleExpiryIsBusy=new Status(370),Status.InvalidGrpcCertificateHash=new Status(371),Status.MissingExpiryTime=new Status(372),Status.NoSchedulingAllowedAfterScheduledRecursion=new Status(373),Status.RecursiveSchedulingLimitReached=new Status(374),Status.WaitingForLedgerId=new Status(375),Status.MaxEntriesForFeeExemptKeyListExceeded=new Status(376),Status.FeeExemptKeyListContainsDuplicatedKeys=new Status(377),Status.InvalidKeyInFeeExemptKeyList=new Status(378),Status.InvalidFeeScheduleKey=new Status(379),Status.FeeScheduleKeyCannotBeUpdated=new Status(380),Status.FeeScheduleKeyNotSet=new Status(381),Status.MaxCustomFeeLimitExceeded=new Status(382),Status.NoValidMaxCustomFee=new Status(383),Status.InvalidMaxCustomFees=new Status(384),Status.DuplicateDenominationInMaxCustomFeeList=new Status(385),Status.DuplicateAccountIdInMaxCustomFeeList=new Status(386),Status.MaxCustomFeesIsNotSupported=new Status(387),Status.BatchListEmpty=new Status(388),Status.BatchListContainsDuplicates=new Status(389),Status.BatchTransactionInBlacklist=new Status(390),Status.InnerTransactionFailed=new Status(391),Status.MissingBatchKey=new Status(392),Status.BatchKeySetOnNonInnerTransaction=new Status(393),Status.InvalidBatchKey=new Status(394),Status.ScheduleExpiryNotConfigurable=new Status(395),Status.CreatingSystemEntities=new Status(396),Status.ThrottleGroupLcmOverflow=new Status(397),Status.AirdropContainsMultipleSendersForAToken=new Status(398),Status.GrpcWebProxyNotSupported=new Status(399),Status.NftTransfersOnlyAllowedForNonFungibleUnique=new Status(400),Status.InvalidSerializedTxMessageHashAlgorithm=new Status(401),Status.WrongHookEntityType=new Status(499),Status.EvmHookGasThrottled=new Status(500),Status.HookIdInUse=new Status(501),Status.BadHookRequest=new Status(502),Status.RejectedByAccountAllowanceHook=new Status(503),Status.HookNotFound=new Status(504),Status.LambdaStorageUpdateBytesTooLong=new Status(505),Status.LambdaStorageUpdateBytesMustUseMinimalRepresentation=new Status(506),Status.InvalidHookId=new Status(507),Status.EmptyLambdaStorageUpdate=new Status(508),Status.HookIdRepeatedInCreationDetails=new Status(509),Status.HooksNotEnabled=new Status(510),Status.HookIsNotALambda=new Status(511),Status.HookDeleted=new Status(512),Status.TooManyLambdaStorageUpdates=new Status(513),Status.HookCreationBytesMustUseMinimalRepresentation=new Status(514),Status.HookCreationBytesTooLong=new Status(515),Status.InvalidHookCreationSpec=new Status(516),Status.HookExtensionEmpty=new Status(517),Status.InvalidHookAdminKey=new Status(518),Status.HookDeletionRequiresZeroStorageSlots=new Status(519),Status.CannotSetHooksAndApproval=new Status(520),Status.TransactionRequiresZeroHooks=new Status(521),Status.InvalidHookCall=new Status(522),Status.HooksAreNotSupportedInAirdrops=new Status(523),Status.AccountIsLinkedToANode=new Status(524),Status.HooksExecutionsRequireTopLevelCryptoTransfer=new Status(525),Status.NodeAccountHasZeroBalance=new Status(526);class GrpcStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){switch(e){case 0:return GrpcStatus.Ok;case 1:return GrpcStatus.Cancelled;case 2:return GrpcStatus.Unknown;case 3:return GrpcStatus.InvalidArgument;case 4:return GrpcStatus.DeadlineExceeded;case 5:return GrpcStatus.NotFound;case 6:return GrpcStatus.AlreadyExists;case 7:return GrpcStatus.PermissionDenied;case 8:return GrpcStatus.ResourceExhausted;case 9:return GrpcStatus.FailedPrecondition;case 10:return GrpcStatus.Aborted;case 11:return GrpcStatus.OutOfRange;case 12:return GrpcStatus.Unimplemented;case 13:return GrpcStatus.Internal;case 14:return GrpcStatus.Unavailable;case 15:return GrpcStatus.DataLoss;case 16:return GrpcStatus.Unauthenticated;case 17:return GrpcStatus.Timeout;case 18:return GrpcStatus.GrpcWeb;default:throw new Error("(BUG) non-exhaustive GrpcStatus switch statement")}}toString(){switch(this){case GrpcStatus.Ok:return"OK";case GrpcStatus.Cancelled:return"CANCELLED";case GrpcStatus.Unknown:return"UNKNOWN";case GrpcStatus.InvalidArgument:return"INVALID_ARGUMENT";case GrpcStatus.DeadlineExceeded:return"DEADLINE_EXCEEDED";case GrpcStatus.NotFound:return"NOT_FOUND";case GrpcStatus.AlreadyExists:return"ALREADY_EXISTS";case GrpcStatus.PermissionDenied:return"PERMISSION_DENIED";case GrpcStatus.Unauthenticated:return"UNAUTHENTICATED";case GrpcStatus.ResourceExhausted:return"RESOURCE_EXHAUSTED";case GrpcStatus.FailedPrecondition:return"FAILED_PRECONDITION";case GrpcStatus.Aborted:return"ABORTED";case GrpcStatus.OutOfRange:return"OUT_OF_RANGE";case GrpcStatus.Unimplemented:return"UNIMPLEMENTED";case GrpcStatus.Internal:return"INTERNAL";case GrpcStatus.Unavailable:return"UNAVAILABLE";case GrpcStatus.DataLoss:return"DATA_LOSS";case GrpcStatus.Timeout:return"TIMEOUT";case GrpcStatus.GrpcWeb:return"GRPC_WEB";default:return`UNKNOWN (${this._code})`}}valueOf(){return this._code}}GrpcStatus.Ok=new GrpcStatus(0),GrpcStatus.Cancelled=new GrpcStatus(1),GrpcStatus.Unknown=new GrpcStatus(2),GrpcStatus.InvalidArgument=new GrpcStatus(3),GrpcStatus.DeadlineExceeded=new GrpcStatus(4),GrpcStatus.NotFound=new GrpcStatus(5),GrpcStatus.AlreadyExists=new GrpcStatus(6),GrpcStatus.PermissionDenied=new GrpcStatus(7),GrpcStatus.ResourceExhausted=new GrpcStatus(8),GrpcStatus.FailedPrecondition=new GrpcStatus(9),GrpcStatus.Aborted=new GrpcStatus(10),GrpcStatus.OutOfRange=new GrpcStatus(11),GrpcStatus.Unimplemented=new GrpcStatus(12),GrpcStatus.Internal=new GrpcStatus(13),GrpcStatus.Unavailable=new GrpcStatus(14),GrpcStatus.DataLoss=new GrpcStatus(15),GrpcStatus.Unauthenticated=new GrpcStatus(16),GrpcStatus.Timeout=new GrpcStatus(17),GrpcStatus.GrpcWeb=new GrpcStatus(18);class GrpcServiceError extends Error{constructor(e,t){super(`gRPC service failed with: Status: ${e.toString()}, Code: ${e.valueOf()}`),this.status=e,this.nodeAccountId=t,this.name="GrpcServiceError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,GrpcServiceError)}static _fromResponse(e){if(null!=e.code&&null!=e.details){const t=GrpcStatus._fromValue(e.code),n=new GrpcServiceError(t);return n.stack+=`\nCaused by: ${e.stack?e.stack.toString():""}`,n.message+=`: ${e.details}`,n}return e}toString(){return`${this.name}: ${this.message}`}}class HttpStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){return new HttpStatus(e)}toString(){return this._code.toString()}valueOf(){return this._code}}class HttpError extends Error{constructor(e){super(`failed with error code: ${e.toString()}`),this.status=e,this.name="HttpError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,HttpError)}}class MaxAttemptsOrTimeoutError extends Error{constructor(e,t){super(e),this.nodeAccountId=t}toJSON(){return{message:this.message,nodeAccountId:this.nodeAccountId}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}const ExecutionState={Finished:"Finished",Retry:"Retry",Error:"Error"},RST_STREAM=/\brst[^0-9a-zA-Z]stream\b/i,DEFAULT_MAX_ATTEMPTS=10;class Executable{constructor(){this._maxAttempts=DEFAULT_MAX_ATTEMPTS,this._nodeAccountIds=new List,this.transactionNodeIds=[],this._signOnDemand=!1,this._minBackoff=null,this._maxBackoff=8e3,this._operator=null,this._requestTimeout=null,this._grpcDeadline=null,this._logger=null}get nodeAccountIds(){return this._nodeAccountIds.isEmpty?null:(this._nodeAccountIds.setLocked(),this._nodeAccountIds.list)}setNodeAccountIds(e){return this._nodeAccountIds.setList(e).setLocked(),this}get maxRetries(){return console.warn("Deprecated: use maxAttempts instead"),this.maxAttempts}setMaxRetries(e){return console.warn("Deprecated: use setMaxAttempts() instead"),this.setMaxAttempts(e)}get maxAttempts(){return this._maxAttempts}setMaxAttempts(e){return this._maxAttempts=e,this}get grpcDeadline(){return this._grpcDeadline}setGrpcDeadline(e){return this._grpcDeadline=e,this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(null!=this._maxBackoff&&e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(null!=this._minBackoff&&e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}_beforeExecute(e){throw new Error("not implemented")}_makeRequestAsync(){throw new Error("not implemented")}_mapStatusError(e,t,n){throw new Error("not implemented")}_mapResponse(e,t,n){throw new Error("not implemented")}_execute(e,t){throw new Error("not implemented")}_getTransactionId(){throw new Error("not implemented")}_getLogId(){throw new Error("not implemented")}_requestToBytes(e){throw new Error("not implemented")}_responseToBytes(e){throw new Error("not implemented")}_shouldRetry(e,t){throw new Error("not implemented")}_shouldRetryExceptionally(e){return!(e instanceof GrpcServiceError)||(e.status._code===GrpcStatus.Timeout._code||e.status._code===GrpcStatus.DeadlineExceeded._code||e.status._code===GrpcStatus.Unavailable._code||e.status._code===GrpcStatus.ResourceExhausted._code||e.status._code===GrpcStatus.GrpcWeb._code||e.status._code===GrpcStatus.Internal._code&&RST_STREAM.test(e.message))}_setOperatorWith(e,t,n){return this._operator={transactionSigner:n,accountId:e,publicKey:t},this}async executeWithSigner(e){return e.call(this)}isBatchedAndNotBatchTransaction(){return!1}async execute(e,t){const n=null!=e.network["127.0.0.1:50211"];if(this.isBatchedAndNotBatchTransaction())throw new Error("Cannot execute batchified transaction outside of BatchTransaction");this._logger=null==this._logger?null!=e._logger?e._logger:null:this._logger,null==this._requestTimeout&&(this._requestTimeout=null!=t?t:e.requestTimeout),null==this._grpcDeadline&&(this._grpcDeadline=e.grpcDeadline),await this._beforeExecute(e),null==this._maxBackoff&&(this._maxBackoff=e.maxBackoff),null==this._minBackoff&&(this._minBackoff=e.minBackoff);const r=Date.now();let o=null;const i=n?1e3:e._maxAttempts??this._maxAttempts;if(this.transactionNodeIds.length){const e=this._nodeAccountIds.list.map(e=>e.toString());if(!this.transactionNodeIds.some(t=>e.includes(t))){const t=e.length>2?`${e.slice(0,2).join(", ")} ...`:e.join(", "),n=1===e.length;throw new Error(`Attempting to execute a transaction against node${n?"":"s"} ${t}, which ${n?"is":"are"} not included in the Client's node list. Please review your Client configuration.`)}}for(let t=1;t<=i;t+=1){if(null!=this._requestTimeout&&r+this._requestTimeout<=Date.now())throw new MaxAttemptsOrTimeoutError("timeout exceeded",this._nodeAccountIds.isEmpty?"No node account ID set":this._nodeAccountIds.current.toString());let a,s;if(this._nodeAccountIds.isEmpty?(s=e._network.getNode(),a=s.accountId,this._nodeAccountIds.setList([a])):(a=this._nodeAccountIds.current,s=e._network.getNode(a)),null==s)throw new Error(`NodeAccountId not recognized: ${a.toString()}`);if(this.transactionNodeIds.length){if(!this.transactionNodeIds.includes(a.toString())){console.error(`Attempting to execute a transaction against node ${a.toString()}, which is not included in the Client's node list. Please review your Client configuration.`),this._nodeAccountIds.advance();continue}}const c=this._getLogId();this._logger&&this._logger.debug(`[${c}] Node AccountID: ${s.accountId.toString()}, IP: ${s.address.toString()}`);const u=s.getChannel();null!=this._grpcDeadline&&u.setGrpcDeadline(this._grpcDeadline);const l=await this._makeRequestAsync();let d;if(!s.isHealthy()){const e=this._nodeAccountIds.index===this._nodeAccountIds.list.length-1;if(isTransactionReceiptOrRecordRequest(l)||n){await delayForAttempt(n,t,this._minBackoff,this._maxBackoff);continue}if(e||this._nodeAccountIds.length<=1)throw new Error(`Network connectivity issue: All nodes are unhealthy. Original node list: ${this._nodeAccountIds.list.join(", ")}`);this._logger&&this._logger.debug(`[${c}] Node is not healthy, trying the next node.`),this._nodeAccountIds.advance();continue}this._nodeAccountIds.advance();try{const e=[];null!=this._grpcDeadline&&e.push(new Promise((e,t)=>setTimeout(()=>t(new GrpcServiceError(GrpcStatus.DeadlineExceeded)),this._grpcDeadline))),this._logger&&this._logger.trace(`[${this._getLogId()}] sending protobuf ${encode$5(this._requestToBytes(l))}`),e.push(this._execute(u,l)),d=await Promise.race(e)}catch(n){const r=GrpcServiceError._fromResponse(n);if(o=r,this._logger&&this._logger.debug(`[${c}] received error ${JSON.stringify(r)}`),(r instanceof GrpcServiceError||r instanceof HttpError)&&this._shouldRetryExceptionally(r)&&t<=i){this._logger&&this._logger.debug(`[${this._getLogId()}] node with accountId: ${s.accountId.toString()} and proxy IP: ${s.address.toString()} is unhealthy`),e._network.increaseBackoff(s);continue}throw n}this._logger&&this._logger.trace(`[${this._getLogId()}] sending protobuf ${encode$5(this._responseToBytes(d))}`),e._network.decreaseBackoff(s);const[p,h]=this._shouldRetry(l,d);switch(p.toString()!==Status.Ok.toString()&&p.toString()!==Status.Success.toString()&&(o=p),h){case ExecutionState.Retry:if(p===Status.InvalidNodeAccount){this._logger&&this._logger.debug(`[${this._getLogId()}] node with accountId: ${s.accountId.toString()} and proxy IP: ${s.address.toString()} has invalid node account ID, marking as unhealthy and updating network`),e._network.increaseBackoff(s);try{e.mirrorNetwork.length>0?await e.updateNetwork():this._logger&&this._logger.warn("Cannot update address book: no mirror network configured. Retrying with existing network configuration.")}catch(e){if(this._logger){const t=e instanceof Error?e.message:String(e);this._logger.trace(`failed to update client address book after INVALID_NODE_ACCOUNT_ID: ${t}`)}}}await delayForAttempt(n,t,this._minBackoff,this._maxBackoff);continue;case ExecutionState.Finished:return this._mapResponse(d,a,l);case ExecutionState.Error:throw this._mapStatusError(l,d,a);default:throw new Error("(BUG) non-exhaustive switch statement for `ExecutionState`")}}throw new MaxAttemptsOrTimeoutError(`max attempts of ${i.toString()} was reached for request with last error being: ${null!=o?o.toString():""}`,this._nodeAccountIds.current.toString())}toBytes(){throw new Error("not implemented")}setLogger(e){return this._logger=e,this}get logger(){return this._logger}}function isTransactionReceiptOrRecordRequest(e){return"object"==typeof e&&null!==e&&("transactionGetReceipt"in e||"transactionGetRecord"in e)}function delayForAttempt(e,t,n,r){if(e)return new Promise(e=>setTimeout(e,n));const o=Math.min(Math.floor(n*Math.pow(2,t)),r);return new Promise(e=>setTimeout(e,o))}class PrecheckStatusError extends StatusError{constructor(e){super(e,`transaction ${e.transactionId.toString()} failed precheck with status ${e.status.toString()} against node account id ${e.nodeId.toString()}`),this.contractFunctionResult=e.contractFunctionResult,this.nodeId=e.nodeId}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),nodeId:this.nodeId.toString(),message:this.message,contractFunctionResult:this.contractFunctionResult}}}class MaxQueryPaymentExceeded extends Error{constructor(e,t){super(),this.message=`query cost of ${e.toString()} HBAR exceeds max set on client: ${t.toString()} HBAR`,this.name="MaxQueryPaymentExceededError",this.queryCost=e,this.maxQueryPayment=t}}class QueryBase extends Executable{constructor(){super()}async _makePaymentTransaction(e,t,n,r){const o=[];null!=n?(o.push({accountID:n.accountId._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()})):(o.push({accountID:new AccountId(0)._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()}));const i={transactionID:e._toProtobuf(),nodeAccountID:t._toProtobuf(),transactionFee:new Hbar(1).toTinybars(),transactionValidDuration:{seconds:Long.fromNumber(120)},cryptoTransfer:{transfers:{accountAmounts:o}}},a={bodyBytes:libExports.proto.TransactionBody.encode(i).finish()};if(null!=n){const e=await n.transactionSigner(a.bodyBytes);a.sigMap={sigPair:[n.publicKey._toProtobufSignature(e)]}}return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(a).finish()}}}class CostQuery extends QueryBase{constructor(e){super(),this._query=e,this._grpcDeadline=e._grpcDeadline,this._requestTimeout=e._requestTimeout,this._nodeAccountIds=e._nodeAccountIds.clone(),this._operator=e._operator,this._header=null}_getTransactionId(){return this._query._getTransactionId()}_getLogId(){return`CostQuery:${this._query._getLogId()}`}async _beforeExecute(e){if(null==e)throw new Error("Cannot do CostQuery without Client");const t=null!=this._operator?this._operator:e._operator;if(null==t)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._query._nodeAccountIds.isEmpty&&this._query._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute());const n=TransactionId.generate(t.accountId);null==this._query.paymentTransactionId&&this._query.setPaymentTransactionId(n);const r=this._getLogId(),o=new AccountId(0),i=TransactionId.generate(new AccountId(0)),a=new Hbar(0);this._logger&&this._logger.debug(`[${r}] making a payment transaction for node ${o.toString()} and transaction ID ${i.toString()} with amount ${a.toString()}`),this._header={payment:await this._makePaymentTransaction(i,new AccountId(0),t,a),responseType:libExports.proto.ResponseType.COST_ANSWER}}_makeRequestAsync(){return Promise.resolve(this._query._onMakeRequest(this._header))}_shouldRetry(e,t){return this._query._shouldRetry(e,t)}_mapStatusError(e,t,n){return this._query._mapStatusError(e,t,n)}_mapResponse(e,t,n){const r=this._query._mapResponseHeader(e).cost;return Promise.resolve(Hbar.fromTinybars(r))}_execute(e,t){return this._query._execute(e,t)}_requestToBytes(e){return this._query._requestToBytes(e)}_responseToBytes(e){return this._query._responseToBytes(e)}}const QUERY_REGISTRY=new Map;class Query extends QueryBase{constructor(){super(),this._paymentTransactionId=null,this._paymentTransactions=[],this._queryPayment=null,this._maxQueryPayment=null,this._timestamp=Date.now()}static fromBytes(e){const t=libExports.proto.Query.decode(e);if(null==t.query)throw new Error("(BUG) query.query was not set in the protobuf");const n=QUERY_REGISTRY.get(t.query);if(null==n)throw new Error(`(BUG) Query.fromBytes() not implemented for type ${t.query}`);return n(t)}toBytes(){return libExports.proto.Query.encode(this._makeRequest()).finish()}setQueryPayment(e){return this._queryPayment=e,this}setMaxQueryPayment(e){return this._maxQueryPayment=e,this}async getCost(e){this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._timestamp=Date.now();const t=await new CostQuery(this).execute(e);return Hbar.fromTinybars(t._valueInTinybar.multipliedBy(1.1).toFixed(0))}setPaymentTransactionId(e){return this._paymentTransactionId=e,this}get paymentTransactionId(){return this._paymentTransactionId}_getTransactionId(){if(null==this._paymentTransactionId)throw new Error("Query.PaymentTransactionId was not set duration execution");return this._paymentTransactionId}_isPaymentRequired(){return!0}_validateChecksums(e){}async _beforeExecute(e){if(this._paymentTransactions.length>0)return;if(e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._operator=null!=this._operator?this._operator:e._operator,this._isPaymentRequired()){if(this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),null==this._operator)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._paymentTransactionId=TransactionId.generate(this._operator.accountId)}else this._paymentTransactionId=TransactionId.generate(new AccountId(0));let t=new Hbar(0);const n=null!=this._maxQueryPayment?this._maxQueryPayment:e.defaultMaxQueryPayment;if(null!=this._queryPayment)t=this._queryPayment;else if(0===this._paymentTransactions.length&&this._isPaymentRequired()){const r=await this.getCost(e);if(n.toTinybars().toInt()<r.toTinybars().toInt())throw new MaxQueryPaymentExceeded(r,n);t=r,this._logger&&this._logger.debug(`[${this._getLogId()}] received cost for query ${t.toString()}`)}this._queryPayment=t,this._timestamp=Date.now(),this._nodeAccountIds.setLocked();for(const e of this._nodeAccountIds.list){const t=this._getLogId(),n=this._paymentTransactionId,r=this._queryPayment;this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${e.toString()} and transaction ID ${n.toString()} with amount ${r.toString()}`),this._paymentTransactions.push(await this._makePaymentTransaction(n,e,this._isPaymentRequired()?this._operator:null,r))}}_mapResponseHeader(e){throw new Error("not implemented")}_makeRequestHeader(){let e={};return this._isPaymentRequired()&&this._paymentTransactions.length>0&&(e={responseType:libExports.proto.ResponseType.ANSWER_ONLY,payment:this._paymentTransactions[this._nodeAccountIds.index]}),e}_onMakeRequest(e){throw new Error("not implemented")}_makeRequest(){let e={};return this._isPaymentRequired()&&null!=this._paymentTransactions&&(e={payment:this._paymentTransactions[this._nodeAccountIds.index],responseType:libExports.proto.ResponseType.ANSWER_ONLY}),this._onMakeRequest(e)}async _makeRequestAsync(){let e={responseType:libExports.proto.ResponseType.ANSWER_ONLY};const t=this._getLogId(),n=this._nodeAccountIds.current,r=TransactionId.generate(this._operator?this._operator.accountId:new AccountId(0)),o=this._queryPayment;return this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${n.toString()} and transaction ID ${r.toString()} with amount ${o.toString()}`),e.payment=await this._makePaymentTransaction(r,n,this._isPaymentRequired()?this._operator:null,o),this._onMakeRequest(e)}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t),r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}_requestToBytes(e){return libExports.proto.Query.encode(e).finish()}_responseToBytes(e){return libExports.proto.Response.encode(e).finish()}}class ContractId extends Key{constructor(e,t,n,r){super();const o=constructor(e,t,n);this.shard=o.shard,this.realm=o.realm,this.num=o.num,this.evmAddress=null!=r?r:null,this._checksum=null}static fromEvmAddress(e,t,n){const r=EvmAddress.fromString(n),[o,i,a,s]=fromEvmAddress(e,t,r.toString());return new ContractId(o,i,a,s?.toBytes())}static fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm))throw new Error("invalid format for entity ID");const n=null!=t.shard?Long.fromString(t.shard):Long.ZERO,r=null!=t.realm?Long.fromString(t.realm):Long.ZERO,[o,i]=t.numOrHex.length<40?[Long.fromString(t.numOrHex),void 0]:[Long.ZERO,decode$8(t.numOrHex)];return new ContractId(n,r,o,i)}static _fromProtobuf(e){return new ContractId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.contractNum?e.contractNum:0)}get checksum(){return this._checksum}async populateAccountNum(e){const t=`${e.mirrorRestApiBaseUrl}/contracts/${this.toEvmAddress()}`,n=await fetch(t),r=(await n.json()).contract_id;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ContractId._fromProtobuf(libExports.proto.ContractID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$8(e))?new ContractId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?encode$5(this.evmAddress):toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress):toEvmAddress(this.num)}_toProtobuf(){return{contractNum:this.num,shardNum:this.shard,realmNum:this.realm,evmAddress:this.evmAddress}}toString(){return null!=this.evmAddress?`${this.shard.toString()}.${this.realm.toString()}.${encode$5(this.evmAddress)}`:`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ContractID.encode(this._toProtobuf()).finish()}clone(){const e=new ContractId(this);return e._checksum=this._checksum,e.evmAddress=this.evmAddress,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}equals(e){let t=!1;return null!=this.evmAddress&&null!=e.evmAddress&&(t=arrayEqual(this.evmAddress,e.evmAddress)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&this.num.eq(e.num)&&t}_toProtobufKey(){return{contractID:this._toProtobuf()}}static __fromProtobufKey(e){return ContractId._fromProtobuf(e)}}CACHE.setContractId(e=>ContractId.__fromProtobufKey(e));class FileId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static getAddressBookFileIdFor(e=0,t=0){return new FileId({num:102,shard:e,realm:t})}static getFeeScheduleFileIdFor(e=0,t=0){return new FileId({num:111,shard:e,realm:t})}static getExchangeRatesFileIdFor(e=0,t=0){return new FileId({num:112,shard:e,realm:t})}static fromString(e){const t=fromString(e),n=new FileId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new FileId(null!=e.shardNum?Long.fromString(e.shardNum.toString()):0,null!=e.realmNum?Long.fromString(e.realmNum.toString()):0,null!=e.fileNum?Long.fromString(e.fileNum.toString()):0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return FileId._fromProtobuf(libExports.proto.FileID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new FileId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("FileId.fromEvmAddress does not support non-long-zero addresses");const[r,o,i]=fromEvmAddress(e,t,n);return new FileId(r,o,i)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{fileNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.FileID.encode(this._toProtobuf()).finish()}clone(){const e=new FileId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}FileId.ADDRESS_BOOK=new FileId(102),FileId.FEE_SCHEDULE=new FileId(111),FileId.EXCHANGE_RATES=new FileId(112);class TopicId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TopicId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TopicId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.topicNum?e.topicNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TopicId._fromProtobuf(libExports.proto.TopicID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new TopicId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TopicId.fromEvmAddress does not support non-long-zero addresses");const[r,o,i]=fromEvmAddress(e,t,n);return new TopicId(r,o,i)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{topicNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TopicID.encode(this._toProtobuf()).finish()}clone(){const e=new TopicId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class TokenId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TokenId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TokenId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.tokenNum?e.tokenNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TokenId._fromProtobuf(libExports.proto.TokenID.decode(e))}static fromSolidityAddress(e){return new TokenId(...fromSolidityAddress(e))}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TokenId.fromEvmAddress does not support non-long-zero addresses");const[r,o,i]=fromEvmAddress(e,t,n);return new TokenId(r,o,i)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{tokenNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TokenID.encode(this._toProtobuf()).finish()}clone(){const e=new TokenId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ScheduleId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new ScheduleId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new ScheduleId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.scheduleNum?e.scheduleNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ScheduleId._fromProtobuf(libExports.proto.ScheduleID.decode(e))}static fromSolidityAddress(e){return new ScheduleId(...fromSolidityAddress(e))}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}_toProtobuf(){return{scheduleNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ScheduleID.encode(this._toProtobuf()).finish()}clone(){const e=new ScheduleId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ExchangeRate{constructor(e){this.hbars=e.hbars,this.cents=e.cents,this.expirationTime=e.expirationTime,this.exchangeRateInCents=e.cents/e.hbars,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRate({hbars:e.hbarEquiv,cents:e.centEquiv,expirationTime:new Date(null!=e.expirationTime&&null!=e.expirationTime.seconds?Long.isLong(e.expirationTime.seconds)?1e3*e.expirationTime.seconds.toInt():e.expirationTime.seconds:0)})}_toProtobuf(){return{hbarEquiv:this.hbars,centEquiv:this.cents,expirationTime:{seconds:Long.fromNumber(Math.trunc(this.expirationTime.getTime()/1e3))}}}toJSON(){return{hbars:this.hbars,cents:this.cents,expirationTime:this.expirationTime,exchangeRateInCents:this.exchangeRateInCents}}toString(){return JSON.stringify(this.toJSON())}}class TransactionReceipt{constructor(e){this.status=e.status,this.accountId=e.accountId,this.fileId=e.fileId,this.contractId=e.contractId,this.topicId=e.topicId,this.tokenId=e.tokenId,this.scheduleId=e.scheduleId,this.exchangeRate=e.exchangeRate,this.nextExchangeRate=e.nextExchangeRate,this.topicSequenceNumber=e.topicSequenceNumber,this.topicRunningHash=e.topicRunningHash,this.totalSupply=e.totalSupply,this.scheduledTransactionId=e.scheduledTransactionId,this.serials=e.serials??[],this.duplicates=e.duplicates??[],this.children=e.children??[],this.nodeId=e.nodeId,Object.freeze(this)}_toProtobuf(){return{duplicateTransactionReceipts:this.duplicates.map(e=>e._toProtobuf().receipt),childTransactionReceipts:this.children.map(e=>e._toProtobuf().receipt),receipt:{status:this.status.valueOf(),accountID:null!=this.accountId?this.accountId._toProtobuf():null,fileID:null!=this.fileId?this.fileId._toProtobuf():null,contractID:null!=this.contractId?this.contractId._toProtobuf():null,topicID:null!=this.topicId?this.topicId._toProtobuf():null,tokenID:null!=this.tokenId?this.tokenId._toProtobuf():null,scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,topicRunningHash:null==this.topicRunningHash?null:this.topicRunningHash,topicSequenceNumber:this.topicSequenceNumber,exchangeRate:{nextRate:null!=this.nextExchangeRate?this.nextExchangeRate._toProtobuf():null,currentRate:null!=this.exchangeRate?this.exchangeRate._toProtobuf():null},scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,serialNumbers:this.serials,newTotalSupply:this.totalSupply,nodeId:this.nodeId}}}static _fromProtobuf(e){const t=e.receipt,n=null!=e.childTransactionReceipts?e.childTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[],r=null!=e.duplicateTransactionReceipts?e.duplicateTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[];return new TransactionReceipt({status:Status._fromCode(null!=t.status?t.status:0),accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):null,fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):null,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):null,topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):null,tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):null,scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):null,exchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.currentRate):null,nextExchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.nextRate):null,topicSequenceNumber:null==t.topicSequenceNumber?null:Long.fromString(t.topicSequenceNumber.toString()),topicRunningHash:null!=t.topicRunningHash?new Uint8Array(t.topicRunningHash):null,totalSupply:null!=t.newTotalSupply?Long.fromString(t.newTotalSupply.toString()):null,scheduledTransactionId:null!=t.scheduledTransactionID?TransactionId._fromProtobuf(t.scheduledTransactionID):null,serials:null!=t.serialNumbers?t.serialNumbers.map(e=>Long.fromValue(e)):[],children:n,duplicates:r,nodeId:null!=t.nodeId?t.nodeId:null})}static fromBytes(e){return TransactionReceipt._fromProtobuf(libExports.proto.TransactionGetReceiptResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetReceiptResponse.encode(this._toProtobuf()).finish()}toJSON(){return{status:this.status.toString(),accountId:this.accountId?.toString()||null,filedId:this.fileId?.toString()||null,contractId:this.contractId?.toString()||null,topicId:this.topicId?.toString()||null,tokenId:this.tokenId?.toString()||null,scheduleId:this.scheduleId?.toString()||null,exchangeRate:this.exchangeRate?.toJSON()||null,nextExchangeRate:this.nextExchangeRate?.toJSON()||null,topicSequenceNumber:this.topicSequenceNumber?.toString()||null,topicRunningHash:null!=this.topicRunningHash?encode$5(this.topicRunningHash):null,totalSupply:this.totalSupply?.toString()||null,scheduledTransactionId:this.scheduledTransactionId?.toString()||null,serials:this.serials.map(e=>e.toString()),duplicates:this.duplicates.map(e=>e.toJSON()),children:this.children.map(e=>e.toJSON()),nodeId:this.nodeId?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}const{proto:proto$7}=HieroProto;class TransactionReceiptQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateStatus&&this.setValidateStatus(e.validateStatus)}static _fromProtobuf(e){const t=e.transactionGetReceipt;return new TransactionReceiptQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0,includeChildren:null!=t.includeChildReceipts?t.includeChildReceipts:void 0})}get transactionId(){return this._transactionId}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeDuplicates(e){return this._includeDuplicates=e,this}get includeDuplicates(){return null!=this._includeDuplicates&&this._includeDuplicates}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setValidateStatus(e){return this._validateStatus=e,this}get validateStatus(){return this._validateStatus}_isPaymentRequired(){return!1}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$7.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetReceipt.receipt.status;switch(r=Status._fromCode(o),this._logger&&this._logger.debug(`[${this._getLogId()}] received receipt status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:return[r,ExecutionState.Retry];case Status.Success:case Status.FeeScheduleFilePartUploaded:return[r,ExecutionState.Finished];default:return[r,this._validateStatus?ExecutionState.Error:ExecutionState.Finished]}}_getTransactionId(){return null!=this._transactionId?this._transactionId:super._getTransactionId()}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$7.ResponseCodeEnum.OK);if(o!==Status.Ok)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const i=t.transactionGetReceipt,a=i.receipt.status;if(o=Status._fromCode(a),null==this._transactionId)throw new Error("Failed to construct `ReceiptStatusError` because `transactionId` is `null`");return new ReceiptStatusError({status:o,transactionId:this._transactionId,transactionReceipt:TransactionReceipt._fromProtobuf(i)})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTransactionReceipts(t)}_mapResponseHeader(e){return e.transactionGetReceipt.header}_mapResponse(e,t,n){const r=e.transactionGetReceipt;return Promise.resolve(TransactionReceipt._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetReceipt:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeDuplicates:this._includeDuplicates,includeChildReceipts:this._includeChildren}}}_getLogId(){return`TransactionReceiptQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("transactionGetReceipt",TransactionReceiptQuery._fromProtobuf);class Transfer{constructor(e){this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e)t.push(new Transfer({accountId:AccountId._fromProtobuf(n.accountID),amount:Hbar.fromTinybars(null!=n.amount?n.amount:0),isApproved:n.isApproval}));return t}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars(),isApproval:this.isApproved}}toJSON(){return{accountId:this.accountId.toString(),amount:this.amount.toTinybars().toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class ContractLogInfo{constructor(e){this.contractId=e.contractId,this.bloom=e.bloom,this.topics=e.topics,this.data=e.data,Object.freeze(this)}static _fromProtobuf(e){return new ContractLogInfo({contractId:ContractId._fromProtobuf(e.contractID),bloom:null!=e.bloom?e.bloom:new Uint8Array,topics:null!=e.topic?e.topic:[],data:null!=e.data?e.data:new Uint8Array})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),bloom:this.bloom,topic:this.topics,data:this.data}}}function decode$1(e){return(new TextDecoder).decode(e)}function encode$1(e){return(new TextEncoder).encode(e)}var bn$1={exports:{}},bn=bn$1.exports,hasRequiredBn;function requireBn(){return hasRequiredBn||(hasRequiredBn=1,function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function c(e,t,r,o){for(var i=0,a=0,s=Math.min(e.length,r),c=t;c<s;c++){var u=e.charCodeAt(c)-48;i*=o,a=u>=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a<o,"Invalid character"),i+=a}return i}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,r):(this._parseBase(e,t,o),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,a,s=0;if("be"===r)for(o=e.length-1,i=0;o>=0;o-=3)a=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(o=0,i=0;o<e.length;o+=3)a=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var o,i=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,o=1;o<=67108863;o*=t)r++;r--,o=o/t|0;for(var i=e.length-n,a=i%r,s=Math.min(i,i-a)+n,u=0,l=n;l<s;l+=r)u=c(e,l,l+r,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){u(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var o=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<o|i)).toString(16);i=s>>>24-o&16777215,(o+=2)>=26&&(o-=26,a--),r=0!==i||a!==this.length-1?d[6-c.length]+c+r:c+r}for(0!==i&&(r=i.toString(16)+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=p[e],l=h[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var y=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?y+r:d[u-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},i&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(i,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var o=0|e.words[0],i=0|t.words[0],a=o*i,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var u=1;u<r;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(o=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var o=this.byteLength(),i=r||Math.max(1,o);n(o<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,o),a},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,o=0,i=0;o<this.length;o++){var a=this.words[o]<<i|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===i?(n<e.length&&(e[n++]=a>>24&255),r=0,i=0):(r=a>>>24,i+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,o=0,i=0;o<this.length;o++){var a=this.words[o]<<i|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===i?(n>=0&&(e[n--]=a>>24&255),r=0,i=0):(r=a>>>24,i+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 8191&t||(n+=13,t>>>=13),127&t||(n+=7,t>>>=7),15&t||(n+=4,t>>>=4),3&t||(n+=2,t>>>=2),1&t||n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return n(0===(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return n(0===(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return n(0===(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return r>0&&(this.words[o]=~this.words[o]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,o=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<o:this.words[r]&~(1<<o),this._strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var o=0,i=0;i<r.length;i++)t=(0|n.words[i])+(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<n.length;i++)t=(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;i<n.length;i++)this.words[i]=n.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)i=(t=(0|n.words[a])-(0|r.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<n.length;a++)i=(t=(0|n.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,o,i,a=e.words,s=t.words,c=n.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,y=h>>>13,m=0|a[2],g=8191&m,_=m>>>13,b=0|a[3],I=8191&b,T=b>>>13,k=0|a[4],S=8191&k,w=k>>>13,A=0|a[5],v=8191&A,E=A>>>13,O=0|a[6],N=8191&O,P=O>>>13,R=0|a[7],C=8191&R,D=R>>>13,B=0|a[8],L=8191&B,x=B>>>13,F=0|a[9],U=8191&F,K=F>>>13,M=0|s[0],H=8191&M,j=M>>>13,G=0|s[1],q=8191&G,V=G>>>13,$=0|s[2],z=8191&$,W=$>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,Z=0|s[4],J=8191&Z,ee=Z>>>13,te=0|s[5],ne=8191&te,re=te>>>13,oe=0|s[6],ie=8191&oe,ae=oe>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,ye=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,H))|0)+((8191&(o=(o=Math.imul(d,j))+Math.imul(p,H)|0))<<13)|0;u=((i=Math.imul(p,j))+(o>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(f,H),o=(o=Math.imul(f,j))+Math.imul(y,H)|0,i=Math.imul(y,j);var ge=(u+(r=r+Math.imul(d,q)|0)|0)+((8191&(o=(o=o+Math.imul(d,V)|0)+Math.imul(p,q)|0))<<13)|0;u=((i=i+Math.imul(p,V)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,H),o=(o=Math.imul(g,j))+Math.imul(_,H)|0,i=Math.imul(_,j),r=r+Math.imul(f,q)|0,o=(o=o+Math.imul(f,V)|0)+Math.imul(y,q)|0,i=i+Math.imul(y,V)|0;var _e=(u+(r=r+Math.imul(d,z)|0)|0)+((8191&(o=(o=o+Math.imul(d,W)|0)+Math.imul(p,z)|0))<<13)|0;u=((i=i+Math.imul(p,W)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(I,H),o=(o=Math.imul(I,j))+Math.imul(T,H)|0,i=Math.imul(T,j),r=r+Math.imul(g,q)|0,o=(o=o+Math.imul(g,V)|0)+Math.imul(_,q)|0,i=i+Math.imul(_,V)|0,r=r+Math.imul(f,z)|0,o=(o=o+Math.imul(f,W)|0)+Math.imul(y,z)|0,i=i+Math.imul(y,W)|0;var be=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(o=(o=o+Math.imul(d,X)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,X)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(S,H),o=(o=Math.imul(S,j))+Math.imul(w,H)|0,i=Math.imul(w,j),r=r+Math.imul(I,q)|0,o=(o=o+Math.imul(I,V)|0)+Math.imul(T,q)|0,i=i+Math.imul(T,V)|0,r=r+Math.imul(g,z)|0,o=(o=o+Math.imul(g,W)|0)+Math.imul(_,z)|0,i=i+Math.imul(_,W)|0,r=r+Math.imul(f,Q)|0,o=(o=o+Math.imul(f,X)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,X)|0;var Ie=(u+(r=r+Math.imul(d,J)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(v,H),o=(o=Math.imul(v,j))+Math.imul(E,H)|0,i=Math.imul(E,j),r=r+Math.imul(S,q)|0,o=(o=o+Math.imul(S,V)|0)+Math.imul(w,q)|0,i=i+Math.imul(w,V)|0,r=r+Math.imul(I,z)|0,o=(o=o+Math.imul(I,W)|0)+Math.imul(T,z)|0,i=i+Math.imul(T,W)|0,r=r+Math.imul(g,Q)|0,o=(o=o+Math.imul(g,X)|0)+Math.imul(_,Q)|0,i=i+Math.imul(_,X)|0,r=r+Math.imul(f,J)|0,o=(o=o+Math.imul(f,ee)|0)+Math.imul(y,J)|0,i=i+Math.imul(y,ee)|0;var Te=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(o=(o=o+Math.imul(d,re)|0)+Math.imul(p,ne)|0))<<13)|0;u=((i=i+Math.imul(p,re)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(N,H),o=(o=Math.imul(N,j))+Math.imul(P,H)|0,i=Math.imul(P,j),r=r+Math.imul(v,q)|0,o=(o=o+Math.imul(v,V)|0)+Math.imul(E,q)|0,i=i+Math.imul(E,V)|0,r=r+Math.imul(S,z)|0,o=(o=o+Math.imul(S,W)|0)+Math.imul(w,z)|0,i=i+Math.imul(w,W)|0,r=r+Math.imul(I,Q)|0,o=(o=o+Math.imul(I,X)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,X)|0,r=r+Math.imul(g,J)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(_,J)|0,i=i+Math.imul(_,ee)|0,r=r+Math.imul(f,ne)|0,o=(o=o+Math.imul(f,re)|0)+Math.imul(y,ne)|0,i=i+Math.imul(y,re)|0;var ke=(u+(r=r+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(C,H),o=(o=Math.imul(C,j))+Math.imul(D,H)|0,i=Math.imul(D,j),r=r+Math.imul(N,q)|0,o=(o=o+Math.imul(N,V)|0)+Math.imul(P,q)|0,i=i+Math.imul(P,V)|0,r=r+Math.imul(v,z)|0,o=(o=o+Math.imul(v,W)|0)+Math.imul(E,z)|0,i=i+Math.imul(E,W)|0,r=r+Math.imul(S,Q)|0,o=(o=o+Math.imul(S,X)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,X)|0,r=r+Math.imul(I,J)|0,o=(o=o+Math.imul(I,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,r=r+Math.imul(g,ne)|0,o=(o=o+Math.imul(g,re)|0)+Math.imul(_,ne)|0,i=i+Math.imul(_,re)|0,r=r+Math.imul(f,ie)|0,o=(o=o+Math.imul(f,ae)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,ae)|0;var Se=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(L,H),o=(o=Math.imul(L,j))+Math.imul(x,H)|0,i=Math.imul(x,j),r=r+Math.imul(C,q)|0,o=(o=o+Math.imul(C,V)|0)+Math.imul(D,q)|0,i=i+Math.imul(D,V)|0,r=r+Math.imul(N,z)|0,o=(o=o+Math.imul(N,W)|0)+Math.imul(P,z)|0,i=i+Math.imul(P,W)|0,r=r+Math.imul(v,Q)|0,o=(o=o+Math.imul(v,X)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,X)|0,r=r+Math.imul(S,J)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(w,J)|0,i=i+Math.imul(w,ee)|0,r=r+Math.imul(I,ne)|0,o=(o=o+Math.imul(I,re)|0)+Math.imul(T,ne)|0,i=i+Math.imul(T,re)|0,r=r+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,ae)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,ae)|0,r=r+Math.imul(f,ce)|0,o=(o=o+Math.imul(f,ue)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,ue)|0;var we=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(U,H),o=(o=Math.imul(U,j))+Math.imul(K,H)|0,i=Math.imul(K,j),r=r+Math.imul(L,q)|0,o=(o=o+Math.imul(L,V)|0)+Math.imul(x,q)|0,i=i+Math.imul(x,V)|0,r=r+Math.imul(C,z)|0,o=(o=o+Math.imul(C,W)|0)+Math.imul(D,z)|0,i=i+Math.imul(D,W)|0,r=r+Math.imul(N,Q)|0,o=(o=o+Math.imul(N,X)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,X)|0,r=r+Math.imul(v,J)|0,o=(o=o+Math.imul(v,ee)|0)+Math.imul(E,J)|0,i=i+Math.imul(E,ee)|0,r=r+Math.imul(S,ne)|0,o=(o=o+Math.imul(S,re)|0)+Math.imul(w,ne)|0,i=i+Math.imul(w,re)|0,r=r+Math.imul(I,ie)|0,o=(o=o+Math.imul(I,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,r=r+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,r=r+Math.imul(f,de)|0,o=(o=o+Math.imul(f,pe)|0)+Math.imul(y,de)|0,i=i+Math.imul(y,pe)|0;var Ae=(u+(r=r+Math.imul(d,fe)|0)|0)+((8191&(o=(o=o+Math.imul(d,ye)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,ye)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(U,q),o=(o=Math.imul(U,V))+Math.imul(K,q)|0,i=Math.imul(K,V),r=r+Math.imul(L,z)|0,o=(o=o+Math.imul(L,W)|0)+Math.imul(x,z)|0,i=i+Math.imul(x,W)|0,r=r+Math.imul(C,Q)|0,o=(o=o+Math.imul(C,X)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,X)|0,r=r+Math.imul(N,J)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,r=r+Math.imul(v,ne)|0,o=(o=o+Math.imul(v,re)|0)+Math.imul(E,ne)|0,i=i+Math.imul(E,re)|0,r=r+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,ae)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,ae)|0,r=r+Math.imul(I,ce)|0,o=(o=o+Math.imul(I,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,r=r+Math.imul(g,de)|0,o=(o=o+Math.imul(g,pe)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,pe)|0;var ve=(u+(r=r+Math.imul(f,fe)|0)|0)+((8191&(o=(o=o+Math.imul(f,ye)|0)+Math.imul(y,fe)|0))<<13)|0;u=((i=i+Math.imul(y,ye)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(U,z),o=(o=Math.imul(U,W))+Math.imul(K,z)|0,i=Math.imul(K,W),r=r+Math.imul(L,Q)|0,o=(o=o+Math.imul(L,X)|0)+Math.imul(x,Q)|0,i=i+Math.imul(x,X)|0,r=r+Math.imul(C,J)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,r=r+Math.imul(N,ne)|0,o=(o=o+Math.imul(N,re)|0)+Math.imul(P,ne)|0,i=i+Math.imul(P,re)|0,r=r+Math.imul(v,ie)|0,o=(o=o+Math.imul(v,ae)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,ae)|0,r=r+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(w,ce)|0,i=i+Math.imul(w,ue)|0,r=r+Math.imul(I,de)|0,o=(o=o+Math.imul(I,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(r=r+Math.imul(g,fe)|0)|0)+((8191&(o=(o=o+Math.imul(g,ye)|0)+Math.imul(_,fe)|0))<<13)|0;u=((i=i+Math.imul(_,ye)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(U,Q),o=(o=Math.imul(U,X))+Math.imul(K,Q)|0,i=Math.imul(K,X),r=r+Math.imul(L,J)|0,o=(o=o+Math.imul(L,ee)|0)+Math.imul(x,J)|0,i=i+Math.imul(x,ee)|0,r=r+Math.imul(C,ne)|0,o=(o=o+Math.imul(C,re)|0)+Math.imul(D,ne)|0,i=i+Math.imul(D,re)|0,r=r+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,r=r+Math.imul(v,ce)|0,o=(o=o+Math.imul(v,ue)|0)+Math.imul(E,ce)|0,i=i+Math.imul(E,ue)|0,r=r+Math.imul(S,de)|0,o=(o=o+Math.imul(S,pe)|0)+Math.imul(w,de)|0,i=i+Math.imul(w,pe)|0;var Oe=(u+(r=r+Math.imul(I,fe)|0)|0)+((8191&(o=(o=o+Math.imul(I,ye)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,ye)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,J),o=(o=Math.imul(U,ee))+Math.imul(K,J)|0,i=Math.imul(K,ee),r=r+Math.imul(L,ne)|0,o=(o=o+Math.imul(L,re)|0)+Math.imul(x,ne)|0,i=i+Math.imul(x,re)|0,r=r+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,r=r+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,r=r+Math.imul(v,de)|0,o=(o=o+Math.imul(v,pe)|0)+Math.imul(E,de)|0,i=i+Math.imul(E,pe)|0;var Ne=(u+(r=r+Math.imul(S,fe)|0)|0)+((8191&(o=(o=o+Math.imul(S,ye)|0)+Math.imul(w,fe)|0))<<13)|0;u=((i=i+Math.imul(w,ye)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(U,ne),o=(o=Math.imul(U,re))+Math.imul(K,ne)|0,i=Math.imul(K,re),r=r+Math.imul(L,ie)|0,o=(o=o+Math.imul(L,ae)|0)+Math.imul(x,ie)|0,i=i+Math.imul(x,ae)|0,r=r+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,r=r+Math.imul(N,de)|0,o=(o=o+Math.imul(N,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var Pe=(u+(r=r+Math.imul(v,fe)|0)|0)+((8191&(o=(o=o+Math.imul(v,ye)|0)+Math.imul(E,fe)|0))<<13)|0;u=((i=i+Math.imul(E,ye)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,ie),o=(o=Math.imul(U,ae))+Math.imul(K,ie)|0,i=Math.imul(K,ae),r=r+Math.imul(L,ce)|0,o=(o=o+Math.imul(L,ue)|0)+Math.imul(x,ce)|0,i=i+Math.imul(x,ue)|0,r=r+Math.imul(C,de)|0,o=(o=o+Math.imul(C,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Re=(u+(r=r+Math.imul(N,fe)|0)|0)+((8191&(o=(o=o+Math.imul(N,ye)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,ye)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(U,ce),o=(o=Math.imul(U,ue))+Math.imul(K,ce)|0,i=Math.imul(K,ue),r=r+Math.imul(L,de)|0,o=(o=o+Math.imul(L,pe)|0)+Math.imul(x,de)|0,i=i+Math.imul(x,pe)|0;var Ce=(u+(r=r+Math.imul(C,fe)|0)|0)+((8191&(o=(o=o+Math.imul(C,ye)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,ye)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,de),o=(o=Math.imul(U,pe))+Math.imul(K,de)|0,i=Math.imul(K,pe);var De=(u+(r=r+Math.imul(L,fe)|0)|0)+((8191&(o=(o=o+Math.imul(L,ye)|0)+Math.imul(x,fe)|0))<<13)|0;u=((i=i+Math.imul(x,ye)|0)+(o>>>13)|0)+(De>>>26)|0,De&=67108863;var Be=(u+(r=Math.imul(U,fe))|0)+((8191&(o=(o=Math.imul(U,ye))+Math.imul(K,fe)|0))<<13)|0;return u=((i=Math.imul(K,ye))+(o>>>13)|0)+(Be>>>26)|0,Be&=67108863,c[0]=me,c[1]=ge,c[2]=_e,c[3]=be,c[4]=Ie,c[5]=Te,c[6]=ke,c[7]=Se,c[8]=we,c[9]=Ae,c[10]=ve,c[11]=Ee,c[12]=Oe,c[13]=Ne,c[14]=Pe,c[15]=Re,c[16]=Ce,c[17]=De,c[18]=Be,0!==u&&(c[19]=u,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,o=0,i=0;i<n.length-1;i++){var a=o;o=0;for(var s=67108863&r,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),o+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}n.words[i]=s,r=a,a=o}return 0!==r?n.words[i]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=f),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?f(this,e,t):n<1024?m(this,e,t):g(this,e,t)},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),g(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,o=0;o<this.length;o++){var i=(0|this.words[o])*e,a=(67108863&i)+(67108863&r);r>>=26,r+=i/67108864|0,r+=a>>>26,this.words[o]=67108863&a}return 0!==r&&(this.words[o]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,o=n%26;t[n]=e.words[r]>>>o&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,o=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<r;this.words[t]=c|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this._strip()},o.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var o;n("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=r;if(o-=a,o=Math.max(0,o),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,o=1<<t;return!(this.length<=r)&&!!(this.words[r]&o)},o.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var o,i,a=e.length+r;this._expand(a);var s=0;for(o=0;o<e.length;o++){i=(0|this.words[o+r])+s;var c=(0|e.words[o])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[o+r]=67108863&i}for(;o<this.length-r;o++)s=(i=(0|this.words[o+r])+s)>>26,this.words[o+r]=67108863&i;if(0===s)return this._strip();for(n(-1===s),s=0,o=0;o<this.length;o++)s=(i=-(0|this.words[o])+s)>>26,this.words[o]=67108863&i;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,c=r.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=r.clone()._ishlnsubmul(i,1,c);0===l.negative&&(r=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),r._ishlnsubmul(i,p,d);0!==r.negative;)p--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=p)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),o=e.andln(1),i=n.cmp(r);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,o=0,i=this.length-1;i>=0;i--)o=(r*o+(0|this.words[i]))%e;return t?-o:o},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,o=this.length-1;o>=0;o--){var i=(0|this.words[o])+67108864*r;this.words[o]=i/e|0,r=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;0===(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,y=1;0===(r.words[0]&y)&&f<26;++f,y<<=1);if(f>0)for(r.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),a.isub(c)):(r.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:r.iushln(u)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;0===(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var o=t.cmp(n);if(o<0){var i=t;t=n,n=i}else if(0===o||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,o=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=o,this;for(var i=o,a=r;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],o=0|e.words[n];if(r!==o){r<o?t=-1:r>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new w(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function I(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function T(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){w.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(I,b),I.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),o=0;o<r;o++)t.words[o]=e.words[o];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&n,o=10;o<e.length;o++){var a=0|e.words[o];e.words[o-10]=(a&n)<<4|i>>>22,i=a}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},I.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(T,b),r(k,b),r(S,b),S.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,o=67108863&r;r>>>=26,e.words[n]=o,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new I;else if("p224"===e)t=new T;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return _[e]=t,t},w.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},w.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},w.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},w.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},w.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},w.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},w.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},w.prototype.isqr=function(e){return this.imul(e,e.clone())},w.prototype.sqr=function(e){return this.mul(e,e)},w.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var y=h,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<f);var g=this.pow(d,new o(1).iushln(f-m-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=m}return p},w.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},w.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),r=t.length-1;r>=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}c=26}return i},w.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},w.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},r(A,w),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,bn)}(bn$1)),bn$1.exports}var bnExports=requireBn(),_BN=getDefaultExportFromCjs(bnExports);const version$4="bignumber/5.8.0";var BN=_BN.BN;const logger$7=new Logger$1(version$4),_constructorGuard$1={},MAX_SAFE=9007199254740991;let _warnedToStringRadix=!1;class BigNumber{constructor(e,t){e!==_constructorGuard$1&&logger$7.throwError("cannot call constructor directly; use BigNumber.from",Logger$1.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return toBigNumber(toBN(this).fromTwos(e))}toTwos(e){return toBigNumber(toBN(this).toTwos(e))}abs(){return"-"===this._hex[0]?BigNumber.from(this._hex.substring(1)):this}add(e){return toBigNumber(toBN(this).add(toBN(e)))}sub(e){return toBigNumber(toBN(this).sub(toBN(e)))}div(e){return BigNumber.from(e).isZero()&&throwFault("division-by-zero","div"),toBigNumber(toBN(this).div(toBN(e)))}mul(e){return toBigNumber(toBN(this).mul(toBN(e)))}mod(e){const t=toBN(e);return t.isNeg()&&throwFault("division-by-zero","mod"),toBigNumber(toBN(this).umod(t))}pow(e){const t=toBN(e);return t.isNeg()&&throwFault("negative-power","pow"),toBigNumber(toBN(this).pow(t))}and(e){const t=toBN(e);return(this.isNegative()||t.isNeg())&&throwFault("unbound-bitwise-result","and"),toBigNumber(toBN(this).and(t))}or(e){const t=toBN(e);return(this.isNegative()||t.isNeg())&&throwFault("unbound-bitwise-result","or"),toBigNumber(toBN(this).or(t))}xor(e){const t=toBN(e);return(this.isNegative()||t.isNeg())&&throwFault("unbound-bitwise-result","xor"),toBigNumber(toBN(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&throwFault("negative-width","mask"),toBigNumber(toBN(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&throwFault("negative-width","shl"),toBigNumber(toBN(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&throwFault("negative-width","shr"),toBigNumber(toBN(this).shrn(e))}eq(e){return toBN(this).eq(toBN(e))}lt(e){return toBN(this).lt(toBN(e))}lte(e){return toBN(this).lte(toBN(e))}gt(e){return toBN(this).gt(toBN(e))}gte(e){return toBN(this).gte(toBN(e))}isNegative(){return"-"===this._hex[0]}isZero(){return toBN(this).isZero()}toNumber(){try{return toBN(this).toNumber()}catch(e){throwFault("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return logger$7.throwError("this platform does not support BigInt",Logger$1.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?_warnedToStringRadix||(_warnedToStringRadix=!0,logger$7.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?logger$7.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Logger$1.errors.UNEXPECTED_ARGUMENT,{}):logger$7.throwError("BigNumber.toString does not accept parameters",Logger$1.errors.UNEXPECTED_ARGUMENT,{})),toBN(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof BigNumber)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new BigNumber(_constructorGuard$1,toHex(e)):e.match(/^-?[0-9]+$/)?new BigNumber(_constructorGuard$1,toHex(new BN(e))):logger$7.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&throwFault("underflow","BigNumber.from",e),(e>=MAX_SAFE||e<=-9007199254740991)&&throwFault("overflow","BigNumber.from",e),BigNumber.from(String(e));const t=e;if("bigint"==typeof t)return BigNumber.from(t.toString());if(isBytes(t))return BigNumber.from(hexlify(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return BigNumber.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(isHexString(e)||"-"===e[0]&&isHexString(e.substring(1))))return BigNumber.from(e)}return logger$7.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function toHex(e){if("string"!=typeof e)return toHex(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&logger$7.throwArgumentError("invalid hex","value",e),"0x00"===(e=toHex(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function toBigNumber(e){return BigNumber.from(toHex(e))}function toBN(e){const t=BigNumber.from(e).toHexString();return"-"===t[0]?new BN("-"+t.substring(3),16):new BN(t.substring(2),16)}function throwFault(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),logger$7.throwError(e,Logger$1.errors.NUMERIC_FAULT,r)}function _base36To16(e){return new BN(e,36).toString(16)}function defineReadOnly(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}window&&window.__awaiter;const version$3="abi/5.8.0",logger$6=new Logger$1(version$3),_constructorGuard={};let ModifiersBytes={calldata:!0,memory:!0,storage:!0},ModifiersNest={calldata:!0,memory:!0};function checkModifier(e,t){if("bytes"===e||"string"===e){if(ModifiersBytes[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&ModifiersNest[t])return!0;return(ModifiersBytes[t]||"payable"===t)&&logger$6.throwArgumentError("invalid modifier","name",t),!1}function parseParamType(e,t){let n=e;function r(t){logger$6.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function o(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let i={type:"",name:"",state:{allowType:!0}},a=i;for(let n=0;n<e.length;n++){let i=e[n];switch(i){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||r(n),a.state.allowType=!1,a.type=verifyType(a.type),a.components=[o(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),checkModifier(a.type,a.name)&&(a.name=""),a.type=verifyType(a.type);let e=a;a=a.parent,a||r(n),delete e.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),checkModifier(a.type,a.name)&&(a.name=""),a.type=verifyType(a.type);let s=o(a.parent);a.parent.components.push(s),delete a.parent,a=s;break;case" ":a.state.allowType&&""!==a.type&&(a.type=verifyType(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(t||r(n),a.indexed&&r(n),a.indexed=!0,a.name=""):checkModifier(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||r(n),a.type+=i,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||r(n),a.type+=i,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=i,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=i,delete a.state.allowArray):a.state.readArray?a.type+=i:r(n)}}return a.parent&&logger$6.throwArgumentError("unexpected eof","param",e),delete i.state,"indexed"===a.name?(t||r(n.length-7),a.indexed&&r(n.length-7),a.indexed=!0,a.name=""):checkModifier(a.type,a.name)&&(a.name=""),i.type=verifyType(i.type),i}function populate(e,t){for(let n in t)defineReadOnly(e,n,t[n])}const FormatTypes=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),paramTypeArray=new RegExp(/^(.*)\[([0-9]*)\]$/);class ParamType{constructor(e,t){e!==_constructorGuard&&logger$6.throwError("use fromString",Logger$1.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),populate(this,t);let n=this.type.match(paramTypeArray);populate(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:ParamType.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=FormatTypes.sighash),FormatTypes[e]||logger$6.throwArgumentError("invalid format type","format",e),e===FormatTypes.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==FormatTypes.sighash&&(t+=this.type),t+="("+this.components.map(t=>t.format(e)).join(e===FormatTypes.full?", ":",")+")"):t+=this.type,e!==FormatTypes.sighash&&(!0===this.indexed&&(t+=" indexed"),e===FormatTypes.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?ParamType.fromString(e,t):ParamType.fromObject(e)}static fromObject(e){return ParamType.isParamType(e)?e:new ParamType(_constructorGuard,{name:e.name||null,type:verifyType(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(ParamType.fromObject):null})}static fromString(e,t){return n=parseParamType(e,!!t),ParamType.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}}function verifyType(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const logger$5=new Logger$1(version$3);class Coder{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){logger$5.throwArgumentError(e,this.localName,t)}}class Writer{constructor(e){defineReadOnly(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return hexConcat(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(concat(e._data))}writeBytes(e){let t=arrayify(e);const n=t.length%this.wordSize;return n&&(t=concat([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=arrayify(BigNumber.from(e));return t.length>this.wordSize&&logger$5.throwError("value out-of-bounds",Logger$1.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=concat([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class Reader{constructor(e,t,n,r){defineReadOnly(this,"_data",arrayify(e)),defineReadOnly(this,"wordSize",t||32),defineReadOnly(this,"_coerceFunc",n),defineReadOnly(this,"allowLoose",r),this._offset=0}get data(){return hexlify(this._data)}get consumed(){return this._offset}static coerce(e,t){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):Reader.coerce(e,t)}_peekBytes(e,t,n){let r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+t<=this._data.length?r=t:logger$5.throwError("data out-of-bounds",Logger$1.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(e){return new Reader(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let n=this._peekBytes(0,e,!!t);return this._offset+=n.length,n.slice(0,e)}readValue(){return BigNumber.from(this.readBytes(this.wordSize))}}var sha3$1={exports:{}},hasRequiredSha3;
|
|
116
116
|
/**
|
|
117
117
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
118
118
|
*
|
|
@@ -120,4 +120,4 @@ const _0n$3=BigInt(0),_1n$4=BigInt(1),_2n$2=BigInt(2);function isBytes$1(e){retu
|
|
|
120
120
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
121
121
|
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
122
122
|
* @license MIT
|
|
123
|
-
*/function requireSha3(){return hasRequiredSha3||(hasRequiredSha3=1,function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=commonjsGlobal:o&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),c=[4,1024,262144,67108864],u=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],p=[128,256],h=["hex","buffer","arrayBuffer","array","digest"],f={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var y=function(e,t,n){return function(r){return new P(e,t,e).update(r)[n]()}},m=function(e,t,n){return function(r,o){return new P(e,t,o).update(r)[n]()}},g=function(e,t,n){return function(t,r,o,i){return k["cshake"+e].update(t,r,o,i)[n]()}},_=function(e,t,n){return function(t,r,o,i){return k["kmac"+e].update(t,r,o,i)[n]()}},b=function(e,t,n,r){for(var o=0;o<h.length;++o){var i=h[o];e[i]=t(n,r,i)}return e},I=function(e,t){var n=y(e,t,"hex");return n.create=function(){return new P(e,t,e)},n.update=function(e){return n.create().update(e)},b(n,y,e,t)},T=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:I},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:I},{name:"shake",padding:[31,7936,2031616,520093696],bits:p,createMethod:function(e,t){var n=m(e,t,"hex");return n.create=function(n){return new P(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},b(n,m,e,t)}},{name:"cshake",padding:c,bits:p,createMethod:function(e,t){var n=f[e],r=g(e,0,"hex");return r.create=function(r,o,i){return o||i?new P(e,t,r).bytepad([o,i],n):k["shake"+e].create(r)},r.update=function(e,t,n,o){return r.create(t,n,o).update(e)},b(r,g,e,t)}},{name:"kmac",padding:c,bits:p,createMethod:function(e,t){var n=f[e],r=_(e,0,"hex");return r.create=function(r,o,i){return new R(e,t,o).bytepad(["KMAC",i],n).bytepad([r],n)},r.update=function(e,t,n,o){return r.create(e,n,o).update(t)},b(r,_,e,t)}}],k={},S=[],w=0;w<T.length;++w)for(var A=T[w],v=A.bits,E=0;E<v.length;++E){var O=A.name+"_"+v[E];if(S.push(O),k[O]=A.createMethod(v[E],A.padding),"sha3"!==A.name){var N=A.name+v[E];S.push(N),k[N]=k[O]}}function P(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function R(e,t,n){P.call(this,e,t,n)}P.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var o,i,s=this.blocks,c=this.byteCount,l=e.length,d=this.blockCount,p=0,h=this.s;p<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,o=1;o<d+1;++o)s[o]=0;if(n)for(o=this.start;p<l&&o<c;++p)s[o>>2]|=e[p]<<u[3&o++];else for(o=this.start;p<l&&o<c;++p)(i=e.charCodeAt(p))<128?s[o>>2]|=i<<u[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<u[3&o++],s[o>>2]|=(128|63&i)<<u[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<u[3&o++],s[o>>2]|=(128|i>>6&63)<<u[3&o++],s[o>>2]|=(128|63&i)<<u[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++p)),s[o>>2]|=(240|i>>18)<<u[3&o++],s[o>>2]|=(128|i>>12&63)<<u[3&o++],s[o>>2]|=(128|i>>6&63)<<u[3&o++],s[o>>2]|=(128|63&i)<<u[3&o++]);if(this.lastByteIndex=o,o>=c){for(this.start=o-c,this.block=s[d],o=0;o<d;++o)h[o]^=s[o];C(h),this.reset=!0}else this.start=o}return this},P.prototype.encode=function(e,t){var n=255&e,r=1,o=[n];for(n=255&(e>>=8);n>0;)o.unshift(n),n=255&(e>>=8),++r;return t?o.push(r):o.unshift(r),this.update(o),o.length},P.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var o=0,i=e.length;if(n)o=i;else for(var s=0;s<e.length;++s){var c=e.charCodeAt(s);c<128?o+=1:c<2048?o+=2:c<55296||c>=57344?o+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++s)),o+=4)}return o+=this.encode(8*o),this.update(e),o},P.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var o=t-n%t,i=[];return i.length=o,this.update(i),this},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];C(r)}},P.prototype.toString=P.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,o=this.extraBytes,i=0,a=0,c="";a<r;){for(i=0;i<t&&a<r;++i,++a)e=n[i],c+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t===0&&(C(n),i=0)}return o&&(e=n[i],c+=s[e>>4&15]+s[15&e],o>1&&(c+=s[e>>12&15]+s[e>>8&15]),o>2&&(c+=s[e>>20&15]+s[e>>16&15])),c},P.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,o=this.extraBytes,i=0,a=0,s=this.outputBits>>3;e=o?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);a<r;){for(i=0;i<t&&a<r;++i,++a)c[a]=n[i];a%t===0&&C(n)}return o&&(c[i]=n[i],e=e.slice(0,s)),e},P.prototype.buffer=P.prototype.arrayBuffer,P.prototype.digest=P.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,o=this.outputBlocks,i=this.extraBytes,a=0,s=0,c=[];s<o;){for(a=0;a<n&&s<o;++a,++s)e=s<<2,t=r[a],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%n===0&&C(r)}return i&&(e=s<<2,t=r[a],c[e]=255&t,i>1&&(c[e+1]=t>>8&255),i>2&&(c[e+2]=t>>16&255)),c},R.prototype=new P,R.prototype.finalize=function(){return this.encode(this.outputBits,!0),P.prototype.finalize.call(this)};var C=function(e){var t,n,r,o,i,a,s,c,u,d,p,h,f,y,m,g,_,b,I,T,k,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,K,M,H,j,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ie,ae,se,ce,ue,le;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],p=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=i^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(d<<1|p>>>31),n=s^(p<<1|d>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(h<<1|f>>>31),n=u^(f<<1|h>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=d^(o<<1|i>>>31),n=p^(i<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,y=e[0],m=e[1],z=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,N=e[20]<<3|e[21]>>>29,P=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,G=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,L=e[2]<<1|e[3]>>>31,x=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,_=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,Q=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,C=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,F=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,I=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,D=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,v=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,K=e[26]<<25|e[27]>>>7,M=e[27]<<25|e[26]>>>7,T=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,J=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,$=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,O=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,j=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,w=e[49]<<14|e[48]>>>18,e[0]=y^~g&b,e[1]=m^~_&I,e[10]=A^~E&N,e[11]=v^~O&P,e[20]=L^~F&K,e[21]=x^~U&M,e[30]=V^~z&Y,e[31]=$^~W&Q,e[40]=te^~re&ie,e[41]=ne^~oe&ae,e[2]=g^~b&T,e[3]=_^~I&k,e[12]=E^~N&R,e[13]=O^~P&C,e[22]=F^~K&H,e[23]=U^~M&j,e[32]=z^~Y&X,e[33]=W^~Q&Z,e[42]=re^~ie&se,e[43]=oe^~ae&ce,e[4]=b^~T&S,e[5]=I^~k&w,e[14]=N^~R&D,e[15]=P^~C&B,e[24]=K^~H&G,e[25]=M^~j&q,e[34]=Y^~X&J,e[35]=Q^~Z&ee,e[44]=ie^~se&ue,e[45]=ae^~ce&le,e[6]=T^~S&y,e[7]=k^~w&m,e[16]=R^~D&A,e[17]=C^~B&v,e[26]=H^~G&L,e[27]=j^~q&x,e[36]=X^~J&V,e[37]=Z^~ee&$,e[46]=se^~ue&te,e[47]=ce^~le&ne,e[8]=S^~y&g,e[9]=w^~m&_,e[18]=D^~A&E,e[19]=B^~v&O,e[28]=G^~L&F,e[29]=q^~x&U,e[38]=J^~V&z,e[39]=ee^~$&W,e[48]=ue^~te&re,e[49]=le^~ne&oe,e[0]^=l[r],e[1]^=l[r+1]};if(i)e.exports=k;else for(w=0;w<S.length;++w)r[S[w]]=k[S[w]]}()}(sha3$1)),sha3$1.exports}var sha3Exports=requireSha3(),sha3=getDefaultExportFromCjs(sha3Exports);function keccak256$1(e){return"0x"+sha3.keccak_256(arrayify(e))}const version$2="rlp/5.8.0",logger$4=new Logger$1(version$2);function arrayifyInteger(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function unarrayifyInteger(e,t,n){let r=0;for(let o=0;o<n;o++)r=256*r+e[t+o];return r}function _encode(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(_encode(e))}),t.length<=55)return t.unshift(192+t.length),t;const n=arrayifyInteger(t.length);return n.unshift(247+n.length),n.concat(t)}isBytesLike(e)||logger$4.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(arrayify(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=arrayifyInteger(t.length);return n.unshift(183+n.length),n.concat(t)}function encode(e){return hexlify(_encode(e))}function _decodeChildren(e,t,n,r){const o=[];for(;n<t+1+r;){const i=_decode(e,n);o.push(i.result),(n+=i.consumed)>t+1+r&&logger$4.throwError("child data too short",Logger$1.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:o}}function _decode(e,t){if(0===e.length&&logger$4.throwError("data too short",Logger$1.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&logger$4.throwError("data short segment too short",Logger$1.errors.BUFFER_OVERRUN,{});const r=unarrayifyInteger(e,t+1,n);return t+1+n+r>e.length&&logger$4.throwError("data long segment too short",Logger$1.errors.BUFFER_OVERRUN,{}),_decodeChildren(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&logger$4.throwError("data array too short",Logger$1.errors.BUFFER_OVERRUN,{}),_decodeChildren(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&logger$4.throwError("data array too short",Logger$1.errors.BUFFER_OVERRUN,{});const r=unarrayifyInteger(e,t+1,n);t+1+n+r>e.length&&logger$4.throwError("data array too short",Logger$1.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:hexlify(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&logger$4.throwError("data too short",Logger$1.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:hexlify(e.slice(t+1,t+1+n))}}return{consumed:1,result:hexlify(e[t])}}function decode(e){const t=arrayify(e),n=_decode(t,0);return n.consumed!==t.length&&logger$4.throwArgumentError("invalid rlp data","data",e),n.result}const version$1="address/5.8.0",logger$3=new Logger$1(version$1);function getChecksumAddress(e){isHexString(e,20)||logger$3.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=arrayify(keccak256$1(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const MAX_SAFE_INTEGER=9007199254740991;function log10(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const ibanLookup={};for(let e=0;e<10;e++)ibanLookup[String(e)]=String(e);for(let e=0;e<26;e++)ibanLookup[String.fromCharCode(65+e)]=String(10+e);const safeDigits=Math.floor(log10(MAX_SAFE_INTEGER));function ibanChecksum(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>ibanLookup[e]).join("");for(;t.length>=safeDigits;){let e=t.substring(0,safeDigits);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}function getAddress(e){let t=null;if("string"!=typeof e&&logger$3.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=getChecksumAddress(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&logger$3.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==ibanChecksum(e)&&logger$3.throwArgumentError("bad icap checksum","address",e),t=_base36To16(e.substring(4));t.length<40;)t="0"+t;t=getChecksumAddress("0x"+t)}else logger$3.throwArgumentError("invalid address","address",e);return t}class AddressCoder extends Coder{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=getAddress(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return getAddress(hexZeroPad(e.readValue().toHexString(),20))}}class AnonymousCoder extends Coder{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const logger$2=new Logger$1(version$3);function pack(e,t,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map(t=>{const r=t.localName;return r||logger$2.throwError("cannot encode object for signature with missing names",Logger$1.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]&&logger$2.throwError("cannot encode object for signature with duplicate names",Logger$1.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]=!0,n[r]})}else logger$2.throwArgumentError("invalid tuple value","tuple",n);t.length!==r.length&&logger$2.throwArgumentError("types/value length mismatch","tuple",n);let o=new Writer(e.wordSize),i=new Writer(e.wordSize),a=[];t.forEach((e,t)=>{let n=r[t];if(e.dynamic){let t=i.length;e.encode(i,n);let r=o.writeUpdatableValue();a.push(e=>{r(e+t)})}else e.encode(o,n)}),a.forEach(e=>{e(o.length)});let s=e.appendWriter(o);return s+=e.appendWriter(i),s}function unpack(e,t){let n=[],r=e.subReader(0);t.forEach(t=>{let o=null;if(t.dynamic){let n=e.readValue(),i=r.subReader(n.toNumber());try{o=t.decode(i)}catch(e){if(e.code===Logger$1.errors.BUFFER_OVERRUN)throw e;o=e,o.baseType=t.name,o.name=t.localName,o.type=t.type}}else try{o=t.decode(e)}catch(e){if(e.code===Logger$1.errors.BUFFER_OVERRUN)throw e;o=e,o.baseType=t.name,o.name=t.localName,o.type=t.type}null!=o&&n.push(o)});const o=t.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});t.forEach((e,t)=>{let r=e.localName;if(!r||1!==o[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const i=n[t];i instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw i}}):n[r]=i});for(let e=0;e<n.length;e++){const t=n[e];t instanceof Error&&Object.defineProperty(n,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(n)}class ArrayCoder extends Coder{constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let n=this.length;-1===n&&(n=t.length,e.writeValue(t.length)),logger$2.checkArgumentCount(t.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let e=0;e<t.length;e++)r.push(this.coder);return pack(e,r,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&logger$2.throwError("insufficient data length",Logger$1.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let n=[];for(let e=0;e<t;e++)n.push(new AnonymousCoder(this.coder));return e.coerce(this.name,unpack(e,n))}}class BooleanCoder extends Coder{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class DynamicBytesCoder extends Coder{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=arrayify(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class BytesCoder extends DynamicBytesCoder{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,hexlify(super.decode(e)))}}class FixedBytesCoder extends Coder{constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=arrayify(t);return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return e.coerce(this.name,hexlify(e.readBytes(this.size)))}}class NullCoder extends Coder{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const NegativeOne=BigNumber.from(-1),Zero=BigNumber.from(0),One=BigNumber.from(1),MaxUint256=BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class NumberCoder extends Coder{constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let n=BigNumber.from(t),r=MaxUint256.mask(8*e.wordSize);if(this.signed){let e=r.mask(8*this.size-1);(n.gt(e)||n.lt(e.add(One).mul(NegativeOne)))&&this._throwError("value out-of-bounds",t)}else(n.lt(Zero)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(n)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}const version="strings/5.8.0",logger$1=new Logger$1(version);var UnicodeNormalizationForm,Utf8ErrorReason;function errorFunc(e,t,n,r,o){return logger$1.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)}function ignoreFunc(e,t,n,r,o){if(e===Utf8ErrorReason.BAD_PREFIX||e===Utf8ErrorReason.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===Utf8ErrorReason.OVERRUN?n.length-t-1:0}function replaceFunc(e,t,n,r,o){return e===Utf8ErrorReason.OVERLONG?(r.push(o),0):(r.push(65533),ignoreFunc(e,t,n))}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(UnicodeNormalizationForm||(UnicodeNormalizationForm={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(Utf8ErrorReason||(Utf8ErrorReason={}));const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(e,t){null==t&&(t=Utf8ErrorFuncs.error),e=arrayify(e);const n=[];let r=0;for(;r<e.length;){const o=e[r++];if(!(o>>7)){n.push(o);continue}let i=null,a=null;if(192==(224&o))i=1,a=127;else if(224==(240&o))i=2,a=2047;else{if(240!=(248&o)){r+=t(128==(192&o)?Utf8ErrorReason.UNEXPECTED_CONTINUE:Utf8ErrorReason.BAD_PREFIX,r-1,e,n);continue}i=3,a=65535}if(r-1+i>=e.length){r+=t(Utf8ErrorReason.OVERRUN,r-1,e,n);continue}let s=o&(1<<8-i-1)-1;for(let o=0;o<i;o++){let o=e[r];if(128!=(192&o)){r+=t(Utf8ErrorReason.MISSING_CONTINUE,r,e,n),s=null;break}s=s<<6|63&o,r++}null!==s&&(s>1114111?r+=t(Utf8ErrorReason.OUT_OF_RANGE,r-1-i,e,n,s):s>=55296&&s<=57343?r+=t(Utf8ErrorReason.UTF16_SURROGATE,r-1-i,e,n,s):s<=a?r+=t(Utf8ErrorReason.OVERLONG,r-1-i,e,n,s):n.push(s))}return n}function toUtf8Bytes(e,t=UnicodeNormalizationForm.current){t!=UnicodeNormalizationForm.current&&(logger$1.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const o=e.charCodeAt(t);if(t>=e.length||56320!=(64512&o))throw new Error("invalid utf-8 string");const i=65536+((1023&r)<<10)+(1023&o);n.push(i>>18|240),n.push(i>>12&63|128),n.push(i>>6&63|128),n.push(63&i|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return arrayify(n)}function _toUtf8String(e){return e.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))).join("")}function toUtf8String(e,t){return _toUtf8String(getUtf8CodePoints(e,t))}class StringCoder extends DynamicBytesCoder{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,toUtf8Bytes(t))}decode(e){return toUtf8String(super.decode(e))}}class TupleCoder extends Coder{constructor(e,t){let n=!1;const r=[];e.forEach(e=>{e.dynamic&&(n=!0),r.push(e.type)});super("tuple","tuple("+r.join(",")+")",t,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});const t=this.coders.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});return this.coders.forEach((n,r)=>{let o=n.localName;o&&1===t[o]&&("length"===o&&(o="_length"),null==e[o]&&(e[o]=e[r]))}),Object.freeze(e)}encode(e,t){return pack(e,this.coders,t)}decode(e){return e.coerce(this.name,unpack(e,this.coders))}}const logger=new Logger$1(version$3),paramTypeBytes=new RegExp(/^bytes([0-9]*)$/),paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);class AbiCoder{constructor(e){defineReadOnly(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new AddressCoder(e.name);case"bool":return new BooleanCoder(e.name);case"string":return new StringCoder(e.name);case"bytes":return new BytesCoder(e.name);case"array":return new ArrayCoder(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new TupleCoder((e.components||[]).map(e=>this._getCoder(e)),e.name);case"":return new NullCoder(e.name)}let t=e.type.match(paramTypeNumber);if(t){let n=parseInt(t[2]||"256");return(0===n||n>256||n%8!=0)&&logger.throwArgumentError("invalid "+t[1]+" bit length","param",e),new NumberCoder(n/8,"int"===t[1],e.name)}if(t=e.type.match(paramTypeBytes),t){let n=parseInt(t[1]);return(0===n||n>32)&&logger.throwArgumentError("invalid bytes length","param",e),new FixedBytesCoder(n,e.name)}return logger.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new Reader(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new Writer(this._getWordSize())}getDefaultValue(e){const t=e.map(e=>this._getCoder(ParamType.from(e)));return new TupleCoder(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&logger.throwError("types/values length mismatch",Logger$1.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const n=e.map(e=>this._getCoder(ParamType.from(e))),r=new TupleCoder(n,"_"),o=this._getWriter();return r.encode(o,t),o.data}decode(e,t,n){const r=e.map(e=>this._getCoder(ParamType.from(e)));return new TupleCoder(r,"_").decode(this._getReader(arrayify(t),n))}}const defaultAbiCoder=new AbiCoder,{proto:proto$6}=HieroProto;class ContractNonceInfo{constructor(e){this.contractId=e.contractId,this.nonce=e.nonce,Object.freeze(this)}static _fromProtobuf(e){return new ContractNonceInfo({contractId:ContractId._fromProtobuf(e.contractId),nonce:null!=e.nonce?e.nonce:Long.ZERO})}_toProtobuf(){return{contractId:this.contractId._toProtobuf(),nonce:this.nonce}}static fromBytes(e){return ContractNonceInfo._fromProtobuf(proto$6.ContractNonceInfo.decode(e))}toBytes(){return proto$6.ContractNonceInfo.encode(this._toProtobuf()).finish()}toJSON(){return{contractId:this.contractId.toString(),nonce:this.nonce.toNumber()}}toString(){return JSON.stringify(this.toJSON())}equals(e){return this.contractId.equals(e.contractId)&&this.nonce.eq(e.nonce)}}class ContractFunctionResult{constructor(e){this._createResult=e._createResult,this.contractId=e.contractId,this.bytes=e.bytes,this.errorMessage=e.errorMessage,this.bloom=e.bloom,this.gasUsed=e.gasUsed,this.logs=e.logs,this.createdContractIds=e.createdContractIds,this.evmAddress=e.evmAddress,this.stateChanges=e.stateChanges,this.gas=e.gas,this.amount=e.amount,this.functionParameters=e.functionParameters,this.senderAccountId=e.senderAccountId,this.contractNonces=e.contractNonces,this.signerNonce=e.signerNonce}static _fromProtobuf(e,t){const n=e.contractID,r=e.gasUsed,o=e.gas?e.gas:-1,i=e.amount?e.amount:-1;return new ContractFunctionResult({_createResult:t,bytes:e.contractCallResult,contractId:null!=n?ContractId._fromProtobuf(n):null,errorMessage:null!=e.errorMessage?e.errorMessage:null,bloom:e.bloom,gasUsed:r instanceof Long?r:Long.fromValue(r),logs:(null!=e.logInfo?e.logInfo:[]).map(e=>ContractLogInfo._fromProtobuf(e)),createdContractIds:(null!=e.createdContractIDs?e.createdContractIDs:[]).map(e=>ContractId._fromProtobuf(e)),evmAddress:null!=e.evmAddress&&Object.hasOwn(e.evmAddress,"value")&&null!=e.evmAddress.value?e.evmAddress.value:null,stateChanges:[],gas:o instanceof Long?o:Long.fromValue(o),amount:i instanceof Long?i:Long.fromValue(i),functionParameters:e.functionParameters,senderAccountId:null!=e.senderId?AccountId._fromProtobuf(e.senderId):null,contractNonces:(null!=e.contractNonces?e.contractNonces:[]).map(e=>ContractNonceInfo._fromProtobuf(e)),signerNonce:null!=e.signerNonce&&Object.hasOwn(e.signerNonce,"value")&&e.signerNonce.value||null})}asBytes(){return this.bytes}getString(e){return decode$1(this.getBytes(e))}getBytes(e){const t=this.getInt32(e),n=safeView(this.bytes).getInt32(t+28);return this.bytes.subarray(t+32,t+32+n)}getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}getBool(e){return 0!==this.bytes[32*(null!=e?e:0)+31]}getInt8(e){const t=32*(null!=e?e:0)+31;return safeView(this.bytes).getInt8(t)}getUint8(e){return this.bytes[32*(null!=e?e:0)+31]}getInt16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt40(e){const t=defaultAbiCoder.decode(["int40"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint40(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(27,32)),16)}getInt48(e){const t=defaultAbiCoder.decode(["int48"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint48(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(26,32)),16)}getInt56(e){const t=defaultAbiCoder.decode(["int56"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint56(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(25,32)),16)}getInt64(e){const t=defaultAbiCoder.decode(["int64"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint64(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(24,32)),16)}getInt72(e){const t=defaultAbiCoder.decode(["int72"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint72(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(23,32)),16)}getInt80(e){const t=defaultAbiCoder.decode(["int80"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint80(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(22,32)),16)}getInt88(e){const t=defaultAbiCoder.decode(["int88"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint88(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(21,32)),16)}getInt96(e){const t=defaultAbiCoder.decode(["int96"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint96(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(20,32)),16)}getInt104(e){const t=defaultAbiCoder.decode(["int104"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint104(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(19,32)),16)}getInt112(e){const t=defaultAbiCoder.decode(["int112"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint112(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(18,32)),16)}getInt120(e){const t=defaultAbiCoder.decode(["int120"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint120(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(17,32)),16)}getInt128(e){const t=defaultAbiCoder.decode(["int128"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint128(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(16,32)),16)}getInt136(e){const t=defaultAbiCoder.decode(["int136"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint136(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(15,32)),16)}getInt144(e){const t=defaultAbiCoder.decode(["int144"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint144(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(14,32)),16)}getInt152(e){const t=defaultAbiCoder.decode(["int152"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint152(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(13,32)),16)}getInt160(e){const t=defaultAbiCoder.decode(["int160"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint160(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(12,32)),16)}getInt168(e){const t=defaultAbiCoder.decode(["int168"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint168(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(11,32)),16)}getInt176(e){const t=defaultAbiCoder.decode(["int176"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint176(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(10,32)),16)}getInt184(e){const t=defaultAbiCoder.decode(["int184"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint184(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(9,32)),16)}getInt192(e){const t=defaultAbiCoder.decode(["int192"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint192(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(8,32)),16)}getInt200(e){const t=defaultAbiCoder.decode(["int200"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint200(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(7,32)),16)}getInt208(e){const t=defaultAbiCoder.decode(["int208"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint208(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(6,32)),16)}getInt216(e){const t=defaultAbiCoder.decode(["int216"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint216(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(5,32)),16)}getInt224(e){const t=defaultAbiCoder.decode(["int224"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint224(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(4,32)),16)}getInt232(e){const t=defaultAbiCoder.decode(["int232"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint232(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(3,32)),16)}getInt240(e){const t=defaultAbiCoder.decode(["int240"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint240(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(2,32)),16)}getInt248(e){const t=defaultAbiCoder.decode(["int248"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint248(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(1,32)),16)}getInt256(e){const t=defaultAbiCoder.decode(["int256"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint256(e){return new BigNumber$1(encode$5(this._getBytes32(e)),16)}getAddress(e){return encode$5(this.bytes.subarray(32*(null!=e?e:0)+12,32*(null!=e?e:0)+32))}getResult(e){return defaultAbiCoder.decode(e,this.bytes)}_getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}_toProtobuf(){return{contractID:null!=this.contractId?this.contractId._toProtobuf():null,contractCallResult:this.bytes,errorMessage:this.errorMessage,bloom:this.bloom,gasUsed:this.gasUsed,logInfo:this.logs.map(e=>e._toProtobuf()),createdContractIDs:this.createdContractIds.map(e=>e._toProtobuf()),evmAddress:null!=this.evmAddress?{value:this.evmAddress}:null,gas:this.gas,amount:this.amount,functionParameters:this.functionParameters,senderId:null!=this.senderAccountId?this.senderAccountId._toProtobuf():null,contractNonces:this.contractNonces.map(e=>e._toProtobuf()),signerNonce:null!=this.signerNonce?{value:this.signerNonce}:null}}}class TokenTransferAccountMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.toString()}),e}}class TokenTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t,n){const r=e.toString();let o=this._map.get(r);null==o&&(o=new TokenTransferAccountMap,this._map.set(r,o),this.__map.set(e,o)),o._set(t,convertAmountToLong(n))}static _fromProtobuf(e){const t=new TokenTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.transfers?n.transfers:[]){const n=AccountId._fromProtobuf(r.accountID);t.__set(e,n,r.amount)}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const[e,t]of n)r.push({accountID:e._toProtobuf(),amount:t});e.push({token:t._toProtobuf(),transfers:r})}return e}}class TokenNftTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t){const n=e.toString();let r=this._map.get(n);null==r&&(r=[],this._map.set(n,r),this.__map.set(e,r)),r.push(t)}static _fromProtobuf(e){const t=new TokenNftTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[]){const n=AccountId._fromProtobuf(r.senderAccountID),o=AccountId._fromProtobuf(r.receiverAccountID);t.__set(e,{sender:n,recipient:o,serial:Long.fromValue(r.serialNumber),isApproved:!1})}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const e of n)r.push({senderAccountID:e.sender._toProtobuf(),receiverAccountID:e.recipient._toProtobuf(),serialNumber:e.serial});e.push({token:t._toProtobuf(),nftTransfers:r})}return e}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.map(e=>({sender:e.sender.toString(),recipient:e.recipient.toString(),serial:e.serial,isApproved:e.isApproved}))}),e}}class AssessedCustomFee{constructor(e={}){this._feeCollectorAccountId=null,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount),this._payerAccountIds=null,null!=e.payerAccountIds&&this.setPayerAccountIds(e.payerAccountIds)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}get payerAccountIds(){return this._payerAccountIds}setPayerAccountIds(e){return this._payerAccountIds=e,this}static _fromProtobuf(e){return new AssessedCustomFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0,amount:null!=e.amount?e.amount:void 0,payerAccountIds:null!=e.effectivePayerAccountId?e.effectivePayerAccountId.map(e=>AccountId._fromProtobuf(e)):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,amount:this._amount,effectivePayerAccountId:null!=this._payerAccountIds?this._payerAccountIds.map(e=>e._toProtobuf()):null}}toJSON(){return{feeCollectorAccountId:this.feeCollectorAccountId?.toString()||null,tokenId:this._tokenId?.toString()||null,amount:this._amount?.toString()||null,payerAccountIds:this._payerAccountIds?.map(e=>e.toString())||[]}}}class TokenAssociation{constructor(e={}){this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._defaultMaxTransactionFee=new Hbar(5)}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}static _fromProtobuf(e){return new TokenAssociation({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0})}_toProtobuf(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():void 0,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():void 0}}toJSON(){return{accountId:this._accountId?.toString()||null,tokenId:this._tokenId?.toString()||null}}}class TokenTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.expectedDecimals=e.expectedDecimals,this.amount=convertAmountToLong(e.amount),this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token),r=null!=n.expectedDecimals&&Object.hasOwn(n.expectedDecimals,"value")?n.expectedDecimals.value:null;for(const o of null!=n.transfers?n.transfers:[])t.push(new TokenTransfer({tokenId:e,accountId:AccountId._fromProtobuf(o.accountID),expectedDecimals:r||null,amount:null!=o.amount?o.amount:Long.ZERO,isApproved:1==o.isApproval}))}return t}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount,isApproval:this.isApproved}}toJSON(){return{tokenId:this.tokenId.toString(),accountId:this.accountId.toString(),expectedDecimals:this.expectedDecimals,amount:this.amount.toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class NftId{constructor(e,t){this.tokenId=e,this.serial="number"==typeof t?Long.fromNumber(t):t,Object.freeze(this)}static fromString(e){const t=e.split("/").length>1?e.split("/"):e.split("@");for(const e of t)if(""===e)throw new Error("invalid format for NftId: use [token]/[serial] or [token]@[serial]");const n=TokenId.fromString(t[0]),r=Long.fromString(t[1]);return new NftId(n,r)}static _fromProtobuf(e){return new NftId(TokenId._fromProtobuf(e.token_ID),null!=e.serialNumber?e.serialNumber:Long.ZERO)}static fromBytes(e){return NftId._fromProtobuf(libExports.proto.NftID.decode(e))}_toProtobuf(){return{token_ID:this.tokenId._toProtobuf(),serialNumber:Long.fromValue(void 0!==this.serial?this.serial:0)}}toString(){return`${this.tokenId.toString()}/${this.serial.toString()}`}toBytes(){return libExports.proto.NftID.encode(this._toProtobuf()).finish()}}class PendingAirdropId{constructor(e={}){this._senderId=null,this._receiverId=null,this._tokenId=null,this._nftId=null,e.receiverId&&(this._receiverId=e.receiverId),e.senderId&&(this._senderId=e.senderId),e.tokenId?this._tokenId=new TokenId(e.tokenId):e.nftId&&(this._nftId=new NftId(e.nftId?.tokenId,e.nftId?.serial))}static fromBytes(e){if(null==e.senderId)throw new Error("senderId is required");if(null==e.receiverId)throw new Error("receiverId is required");if(null==e.fungibleTokenType&&null==e.nonFungibleToken)throw new Error("Either fungibleTokenType or nonFungibleToken is required");return new PendingAirdropId({senderId:AccountId._fromProtobuf(e.senderId),receiverId:AccountId._fromProtobuf(e.receiverId),nftId:null!=e.nonFungibleToken?NftId._fromProtobuf(e.nonFungibleToken):null,tokenId:null!=e.fungibleTokenType?TokenId._fromProtobuf(e.fungibleTokenType):null})}setSenderid(e){return this._senderId=e,this}setReceiverId(e){return this._receiverId=e,this}setTokenId(e){return this._nftId=null,this._tokenId=e,this}setNftId(e){return this._tokenId=null,this._nftId=e,this}get senderId(){return this._senderId}get receiverId(){return this._receiverId}get tokenId(){return this._tokenId}get nftId(){return this._nftId}toBytes(){return{senderId:this.senderId?._toProtobuf(),receiverId:this._receiverId?._toProtobuf(),fungibleTokenType:this._tokenId?._toProtobuf(),nonFungibleToken:this._nftId?._toProtobuf()}}}class PendingAirdropRecord{constructor(e){this.airdropId=e.airdropId,this.amount=convertAmountToLong(e.amount)}toBytes(){return{pendingAirdropId:this.airdropId.toBytes(),pendingAirdropValue:{amount:this.amount}}}static fromBytes(e){if(null==e.pendingAirdropId)throw new Error("pendingAirdropId is required");const t=PendingAirdropId.fromBytes(e.pendingAirdropId),n=e.pendingAirdropValue?.amount;return new PendingAirdropRecord({airdropId:t,amount:n||Long.ZERO})}}class TransactionRecord{constructor(e){this.receipt=e.receipt,this.transactionHash=e.transactionHash,this.consensusTimestamp=e.consensusTimestamp,this.transactionId=e.transactionId,this.transactionMemo=e.transactionMemo,this.transactionFee=e.transactionFee,this.transfers=e.transfers,this.contractFunctionResult=null!=e.contractFunctionResult?e.contractFunctionResult:null,this.tokenTransfers=e.tokenTransfers,this.tokenTransfersList=e.tokenTransfersList,this.scheduleRef=e.scheduleRef,this.assessedCustomFees=e.assessedCustomFees,this.nftTransfers=e.nftTransfers,this.automaticTokenAssociations=e.automaticTokenAssociations,this.parentConsensusTimestamp=e.parentConsensusTimestamp,this.aliasKey=e.aliasKey,this.duplicates=e.duplicates,this.children=e.children,this.hbarAllowanceAdjustments=e.hbarAllowanceAdjustments,this.tokenAllowanceAdjustments=e.tokenAllowanceAdjustments,this.nftAllowanceAdjustments=e.nftAllowanceAdjustments,this.ethereumHash=e.ethereumHash,this.paidStakingRewards=e.paidStakingRewards,this.prngBytes=e.prngBytes,this.prngNumber=e.prngNumber,this.evmAddress=e.evmAddress,this.newPendingAirdrops=e.newPendingAirdrops,Object.freeze(this)}_toProtobuf(){const e=this.tokenTransfers._toProtobuf(),t=this.nftTransfers._toProtobuf(),n=[];for(const r of e)for(const e of t)null!=r.token&&null!=e.token&&r.token.shardNum===e.token.shardNum&&r.token.realmNum===e.token.realmNum&&r.token.tokenNum===e.token.tokenNum?n.push({token:r.token,transfers:r.transfers,nftTransfers:r.nftTransfers}):(n.push(r),n.push(e));return{duplicateTransactionRecords:this.duplicates.map(e=>e._toProtobuf().transactionRecord),childTransactionRecords:this.children.map(e=>e._toProtobuf().transactionRecord),transactionRecord:{receipt:this.receipt._toProtobuf().receipt,transactionHash:null!=this.transactionHash?this.transactionHash:null,consensusTimestamp:null!=this.consensusTimestamp?this.consensusTimestamp._toProtobuf():null,transactionID:null!=this.transactionId?this.transactionId._toProtobuf():null,memo:null!=this.transactionMemo?this.transactionMemo:null,transactionFee:null!=this.transactionFee?this.transactionFee.toTinybars():null,contractCallResult:null==this.contractFunctionResult||this.contractFunctionResult._createResult?null:this.contractFunctionResult._toProtobuf(),contractCreateResult:null!=this.contractFunctionResult&&this.contractFunctionResult._createResult?this.contractFunctionResult._toProtobuf():null,transferList:null!=this.transfers?{accountAmounts:this.transfers.map(e=>e._toProtobuf())}:null,tokenTransferLists:n,scheduleRef:null!=this.scheduleRef?this.scheduleRef._toProtobuf():null,assessedCustomFees:this.assessedCustomFees.map(e=>e._toProtobuf()),automaticTokenAssociations:this.automaticTokenAssociations.map(e=>e._toProtobuf()),parentConsensusTimestamp:null!=this.parentConsensusTimestamp?this.parentConsensusTimestamp._toProtobuf():null,alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ethereumHash:this.ethereumHash,paidStakingRewards:this.paidStakingRewards.map(e=>e._toProtobuf()),prngBytes:this.prngBytes,prngNumber:null!=this.prngNumber?this.prngNumber:null,evmAddress:null!=this.evmAddress?this.evmAddress.toBytes():null,newPendingAirdrops:this.newPendingAirdrops.map(e=>e.toBytes())}}}static _fromProtobuf(e){const t=e.transactionRecord;let n=null!=t.alias&&t.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(t.alias)):null;n instanceof PublicKey||(n=null);const r=null!=e.childTransactionRecords?e.childTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],o=null!=e.duplicateTransactionRecords?e.duplicateTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],i=null!=t.contractCallResult?ContractFunctionResult._fromProtobuf(t.contractCallResult,!1):null!=t.contractCreateResult?ContractFunctionResult._fromProtobuf(t.contractCreateResult,!0):void 0,a=null!=t.newPendingAirdrops?t.newPendingAirdrops.map(e=>PendingAirdropRecord.fromBytes(e)):[];return new TransactionRecord({receipt:TransactionReceipt._fromProtobuf({receipt:t.receipt}),transactionHash:null!=t.transactionHash?t.transactionHash:new Uint8Array,consensusTimestamp:Timestamp._fromProtobuf(t.consensusTimestamp),transactionId:TransactionId._fromProtobuf(t.transactionID),transactionMemo:null!=t.memo?t.memo:"",transactionFee:Hbar.fromTinybars(null!=t.transactionFee?t.transactionFee:0),transfers:Transfer._fromProtobuf(null!=t.transferList&&null!=t.transferList.accountAmounts?t.transferList.accountAmounts:[]),contractFunctionResult:i,tokenTransfers:TokenTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),tokenTransfersList:TokenTransfer._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),scheduleRef:null!=t.scheduleRef?ScheduleId._fromProtobuf(t.scheduleRef):null,assessedCustomFees:null!=t.assessedCustomFees?t.assessedCustomFees.map(e=>AssessedCustomFee._fromProtobuf(e)):[],nftTransfers:TokenNftTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),automaticTokenAssociations:null!=t.automaticTokenAssociations?t.automaticTokenAssociations.map(e=>TokenAssociation._fromProtobuf(e)):[],parentConsensusTimestamp:null!=t.parentConsensusTimestamp?Timestamp._fromProtobuf(t.parentConsensusTimestamp):null,aliasKey:n,duplicates:o,children:r,hbarAllowanceAdjustments:[],tokenAllowanceAdjustments:[],nftAllowanceAdjustments:[],ethereumHash:null!=t.ethereumHash?t.ethereumHash:null,paidStakingRewards:null!=t.paidStakingRewards?Transfer._fromProtobuf(t.paidStakingRewards):[],prngBytes:null!=t.prngBytes?t.prngBytes:null,prngNumber:null!=t.prngNumber?t.prngNumber:null,evmAddress:null!=t.evmAddress?EvmAddress.fromBytes(t.evmAddress):null,newPendingAirdrops:a})}static fromBytes(e){return TransactionRecord._fromProtobuf(libExports.proto.TransactionGetRecordResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetRecordResponse.encode(this._toProtobuf()).finish()}toJSON(){return{receipt:this.receipt.toJSON(),transactionHash:encode$5(this.transactionHash),consensusTimestamp:this.consensusTimestamp.toDate(),transactionId:this.transactionId.toString(),transactionMemo:this.transactionMemo,transactionFee:this.transactionFee.toTinybars().toString(),transfers:this.transfers.map(e=>e.toJSON()),tokenTransfers:this.tokenTransfers,tokenTransfersList:this.tokenTransfersList.map(e=>e.toJSON()),scheduleRef:this.scheduleRef?.toString()||null,assessedCustomFees:this.assessedCustomFees,nftTransfers:this.nftTransfers,automaticTokenAssociations:this.automaticTokenAssociations,parentConsensusTimestamp:this.parentConsensusTimestamp?.toDate()||null,aliasKey:this.aliasKey?.toString()||null,duplicates:this.duplicates,children:this.children,ethereumHash:null!=this.ethereumHash?encode$5(this.ethereumHash):null,paidStakingRewards:this.paidStakingRewards,prngBytes:null!=this.prngBytes?encode$5(this.prngBytes):null,prngNumber:this.prngNumber,evmAddress:this.evmAddress?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}class RecordStatusError extends StatusError{constructor(e){super(e,`Record for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionRecord=e.transactionRecord}}const{proto:proto$5}=HieroProto;class TransactionRecordQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateReceiptStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateReceiptStatus&&this.setValidateReceiptStatus(e.validateReceiptStatus)}get transactionId(){return this._transactionId}static _fromProtobuf(e){const t=e.transactionGetRecord;return new TransactionRecordQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeChildren:null!=t.includeChildRecords?t.includeChildRecords:void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0})}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setIncludeDuplicates(e){return this._duplicates=e,this}get includeDuplicates(){return null!=this._duplicates&&this._duplicates}setValidateReceiptStatus(e){return this._validateReceiptStatus=e,this}get validateReceiptStatus(){return this._validateReceiptStatus}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$5.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetRecord;if(o.header.responseType===libExports.proto.ResponseType.COST_ANSWER)return[r,ExecutionState.Finished];const i=o.transactionRecord.receipt.status;switch(r=Status._fromCode(i),this._logger&&this._logger.debug(`[${this._getLogId()}] received record's receipt ${r.toString()}`),r){case Status.Ok:case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:return[r,ExecutionState.Retry];case Status.Success:return[r,ExecutionState.Finished];default:return[r,this._validateReceiptStatus?ExecutionState.Error:ExecutionState.Finished]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$5.ResponseCodeEnum.OK);switch(o){case Status.Ok:break;case Status.ContractRevertExecuted:return new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})});default:return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}const i=t.transactionGetRecord.transactionRecord.receipt,a=i.status;return o=Status._fromCode(a),o===Status.ContractRevertExecuted?new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})}):new ReceiptStatusError({status:o,transactionId:this._getTransactionId(),transactionReceipt:TransactionReceipt._fromProtobuf({receipt:i})})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTxRecordByTxID(t)}_mapResponseHeader(e){return e.transactionGetRecord.header}_mapResponse(e,t,n){const r=e.transactionGetRecord;return Promise.resolve(TransactionRecord._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetRecord:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeChildRecords:this._includeChildren,includeDuplicates:this._includeDuplicates}}}_getLogId(){return`TransactionRecordQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("transactionGetRecord",TransactionRecordQuery._fromProtobuf);class TransactionResponse{constructor(e){this.nodeId=e.nodeId,this.transactionHash=e.transactionHash,this.transactionId=e.transactionId,this.transaction=e.transaction,this.logger=e.logger}static fromJSON(e){return new TransactionResponse({nodeId:AccountId.fromString(e.nodeId),transactionHash:decode$8(e.transactionHash),transactionId:TransactionId.fromString(e.transactionId)})}async getReceipt(e){let t;try{t=await this.getReceiptQuery().execute(e)}catch(t){if(t instanceof ReceiptStatusError&&t.status===Status.ThrottledAtConsensus)return this.logger?.info("Transaction throttled at consensus"),this._retryTransaction(e);throw t}if(t.status!==Status.Success&&t.status!==Status.FeeScheduleFilePartUploaded)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecord(e){return await this.getReceipt(e),this.getRecordQuery().execute(e)}async getVerboseRecord(e){try{return await this.getReceiptQuery().execute(e),this.getRecordQuery().execute(e)}catch(t){return this.getRecordQuery().execute(e)}}async getReceiptWithSigner(e){const t=await this.getReceiptQuery().executeWithSigner(e);if(t.status!==Status.Success)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecordWithSigner(e){return await this.getReceiptWithSigner(e),this.getRecordQuery().executeWithSigner(e)}getReceiptQuery(){return(new TransactionReceiptQuery).setTransactionId(this.transactionId).setNodeAccountIds([this.nodeId])}getRecordQuery(){return(new TransactionRecordQuery).setTransactionId(this.transactionId).setNodeAccountIds([this.nodeId])}toJSON(){return{nodeId:this.nodeId.toString(),transactionHash:encode$5(this.transactionHash),transactionId:this.transactionId.toString()}}async _retryTransaction(e){if(!this.transaction)throw new Error("If you retry transaction you should have the transaction set");if(e.operatorAccountId?.toString()!==this.transaction.transactionId?.accountId?.toString())throw new Error("Retry mechanism is not supported when tx id is not generated by the operator account");if(null===e.operatorAccountId)throw new Error("Operator account is not set");let t=250;for(let n=0;n<5;n++){if(this.logger?.trace(`Transaction throttled, retry attempt ${n}`),this.transaction?._resetTransaction(e),null==this.transaction||null==this.transaction.transactionId)throw new Error("Transaction or Transaction ID is null after reset");this.transactionId=this.transaction.transactionId,n>0&&(await wait(Math.min(t,16e3)),t*=2);try{this.transaction._resetTransaction(e);const t=await this.transaction.execute(e),r=await(new TransactionReceiptQuery).setTransactionId(t.transactionId).setNodeAccountIds([t.nodeId]).execute(e);if(r.status!==Status.ThrottledAtConsensus)return this.logger?.info(`Transaction throttle retry succeeded after attempt ${n}`),r}catch(e){if(e instanceof ReceiptStatusError&&e.status===Status.ThrottledAtConsensus){this.logger?.info("Transaction throttled at consensus");continue}throw this.logger?.error(`An error occurred after throttle retry: ${e instanceof Error?e.message:String(e)}`),e}}throw this.logger?.error("Transaction throttle retry failed after maximum attempts"),new Error("Transaction retry failed after maximum attempts")}toString(){return JSON.stringify(this.toJSON())}}async function digest(e){return new Uint8Array(await window.crypto.subtle.digest("SHA-384",e))}class TransactionHashMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static async _fromTransaction(e){const t=new TransactionHashMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._nodeAccountIds.list[n],o=e._transactions.get(n),i=await digest(o.signedTransactionBytes);t._set(r,i)}return t}}class NodeAccountIdSignatureMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new NodeAccountIdSignatureMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}}class SignatureMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(e){const t=new SignatureMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._signedTransactions.get(n).sigMap;null!=r&&t._set(e._nodeAccountIds.list[n],NodeAccountIdSignatureMap._fromTransactionSigMap(r))}return t}}class CustomFee{constructor(e={}){this._feeCollectorAccountId=null,this._allCollectorsAreExempt=!1,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),null!=e.allCollectorsAreExempt&&this.setAllCollectorsAreExempt(e.allCollectorsAreExempt)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get allCollectorsAreExempt(){return this._allCollectorsAreExempt}setAllCollectorsAreExempt(e){return this._allCollectorsAreExempt=e,this}static _fromProtobuf(e){throw new Error("not implemented")}_toProtobuf(){throw new Error("not implemented")}}class CustomFixedFee extends CustomFee{constructor(e={}){super(e),this._denominatingTokenId=null,null!=e.denominatingTokenId&&this.setDenominatingTokenId(e.denominatingTokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount)}setHbarAmount(e){return this._amount=e.toTinybars(),this._denominatingTokenId=null,this}get hbarAmount(){return null!=this._denominatingTokenId?null:Hbar.fromTinybars(null!=this._amount?this._amount:0)}setDenominatingTokenToSameToken(){return this._denominatingTokenId=new TokenId(0,0,0),this}get denominatingTokenId(){return this._denominatingTokenId}setDenominatingTokenId(e){return this._denominatingTokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}static _fromProtobuf(e){const t=e.fixedFee;return new CustomFixedFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,denominatingTokenId:null!=t.denominatingTokenId?TokenId._fromProtobuf(t.denominatingTokenId):void 0,amount:null!=t.amount?t.amount:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}_toTopicFeeProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}}class CustomFeeLimit{constructor(e={}){this._accountId=null,e.accountId&&this.setAccountId(e.accountId),this._fees=null,e.fees&&this.setFees(e.fees)}static _fromProtobuf(e){return new CustomFeeLimit({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):null,fees:null!=e.fees?e.fees.map(e=>CustomFixedFee._fromProtobuf({fixedFee:e})):null})}getAccountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}getFees(){return this._fees}setFees(e){return this._fees=e,this}_toProtobuf(){const e=[];return null!=this._fees&&this._fees.forEach(t=>{const n=t._toProtobuf();null!=n.fixedFee&&e.push(n.fixedFee)}),{accountId:null!=this._accountId?this._accountId._toProtobuf():null,fees:e}}}class SignableNodeTransactionBodyBytes{constructor(e,t,n){this.nodeAccountId=e,this.transactionId=t,this.signableTransactionBodyBytes=n}}const DEFAULT_AUTO_RENEW_PERIOD=Long.fromValue(7776e3),DEFAULT_RECORD_THRESHOLD=Hbar.fromTinybars(Long.fromString("9223372036854775807")),NODE_ACCOUNT_BATCH_ID=new AccountId(0,0,0),DEFAULT_TRANSACTION_VALID_DURATION=120,CHUNK_SIZE=1024,TRANSACTION_REGISTRY=new Map;class Transaction extends Executable{constructor(){super(),this._transactions=new List,this._signedTransactions=new List,this._signerPublicKeys=new Set,this._transactionValidDuration=DEFAULT_TRANSACTION_VALID_DURATION,this._defaultMaxTransactionFee=new Hbar(2),this._customFeeLimits=[],this._maxTransactionFee=null,this._transactionMemo="",this._transactionIds=new List,this._publicKeys=[],this._transactionSigners=[],this._regenerateTransactionId=null,this._batchKey=null,this._isThrottled=!1}static fromBytes(e){const t=[],n=[],r=[],o=[],i=[],a=[],s=libExports.proto.TransactionList.decode(e).transactionList;if(0===s.length){const t=libExports.proto.Transaction.decode(e);0!==t.signedTransactionBytes.length?s.push(t):s.push({signedTransactionBytes:libExports.proto.SignedTransaction.encode({sigMap:t.sigMap,bodyBytes:t.bodyBytes}).finish()})}for(const e of s){if(null==e.bodyBytes&&null==e.signedTransactionBytes)throw new Error("bodyBytes and signedTransactionBytes are null");if(e.bodyBytes&&0!=e.bodyBytes.length){const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=t.nodeAccountID){const e=AccountId._fromProtobuf(t.nodeAccountID);i.includes(e.toString())||(r.push(e),i.push(e.toString()))}if(null==t.data)throw new Error("(BUG) body.data was not set in the protobuf");a.push(t)}if(e.signedTransactionBytes&&0!=e.signedTransactionBytes.length){const s=libExports.proto.SignedTransaction.decode(e.signedTransactionBytes);t.push(s);const c=libExports.proto.TransactionBody.decode(s.bodyBytes);if(null!=c.transactionID){const e=TransactionId._fromProtobuf(c.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=c.nodeAccountID){const e=AccountId._fromProtobuf(c.nodeAccountID);i.includes(e.toString())||(r.push(e),i.push(e.toString()))}if(null==c.data)throw new Error("(BUG) body.data was not set in the protobuf");a.push(c)}}const c=a[0];if(null==c||null==c.data)throw new Error("No transaction found in bytes or failed to decode TransactionBody");const u=TRANSACTION_REGISTRY.get(c.data);if(null==u)throw new Error(`(BUG) Transaction.fromBytes() not implemented for type ${c.data}`);return u(s,t,n,r,a)}schedule(){if(this._requireNotFrozen(),1!=SCHEDULE_CREATE_TRANSACTION.length)throw new Error("ScheduleCreateTransaction has not been loaded yet");return SCHEDULE_CREATE_TRANSACTION[0]()._setScheduledTransaction(this)}async batchify(e,t){return this._requireNotFrozen(),this.setBatchKey(t),await this.signWithOperator(e)}static _fromProtobufTransactions(e,t,n,r,o,i){const a=i[0];for(let e=0;e<r.length;e++)for(let t=0;t<o.length-1;t++)if(!compare$1(i[e*o.length+t],i[e*o.length+t+1],new Set(["nodeAccountID"])))throw new Error("failed to validate transaction bodies");const s=new AccountId(0);for(let e=0;e<o.length;e++)o[e].equals(s)&&o.splice(e--,1);e._transactions.setList(t),e._signedTransactions.setList(n),e._transactionIds.setList(r),e._nodeAccountIds.setList(o),e._transactionValidDuration=null!=a.transactionValidDuration&&null!=a.transactionValidDuration.seconds?Long.fromValue(a.transactionValidDuration.seconds).toInt():DEFAULT_TRANSACTION_VALID_DURATION,e._maxTransactionFee=null!=a.transactionFee&&a.transactionFee>new Long(0,0,!0)?Hbar.fromTinybars(a.transactionFee):null,e._customFeeLimits=null!=a.maxCustomFees?a.maxCustomFees?.map(e=>CustomFeeLimit._fromProtobuf(e)):[],e._batchKey=null!=a.batchKey?Key._fromProtobufKey(a?.batchKey):null,e._transactionMemo=null!=a.memo?a.memo:"";for(let r=0;r<o.length;r++){const o=n[r]||t[r];if(null!=o.sigMap&&null!=o.sigMap.sigPair)for(const t of o.sigMap.sigPair)e._signerPublicKeys.add(encode$5(t.pubKeyPrefix)),e._publicKeys.push(PublicKey.fromBytes(t.pubKeyPrefix)),e._transactionSigners.push(null)}return e}setNodeAccountIds(e){return this._requireNotFrozen(),super.setNodeAccountIds(e),this}get transactionValidDuration(){return this._transactionValidDuration}get size(){return this._requireFrozen(),this._makeRequestAsync().then(e=>libExports.proto.Transaction.encode(e).finish().length)}get bodySize(){const e=this._makeTransactionBody(AccountId.fromString("0.0.0"));return libExports.proto.TransactionBody.encode(e).finish().length}setTransactionValidDuration(e){return this._requireNotFrozen(),this._transactionValidDuration=e,this}get maxTransactionFee(){return this._maxTransactionFee}setMaxTransactionFee(e){return this._requireNotFrozen(),this._maxTransactionFee=e instanceof Hbar?e:new Hbar(e),this}get regenerateTransactionId(){return this._regenerateTransactionId}setRegenerateTransactionId(e){return this._requireNotFrozen(),this._regenerateTransactionId=e,this}get transactionMemo(){return this._transactionMemo}setTransactionMemo(e){return this._requireNotFrozen(),this._transactionMemo=e,this}get transactionId(){return this._transactionIds.isEmpty?null:(this._transactionIds.setLocked(),this._transactionIds.current)}setTransactionId(e){return this._requireNotFrozen(),this._transactionIds.setList([e]).setLocked(),this}getRequiredChunks(){return 1}get bodySizeAllChunks(){const e=[];for(let t=0;t<this.getRequiredChunks();t++)this._transactionIds.index=t,e.push(this.bodySize);return this._transactionIds.index=0,e}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}async signWith(e,t){this._signOnDemand||this._requireFrozen();const n=encode$5(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;if(this._transactions.clear(),this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(t),this._signOnDemand)return this;this._transactionIds.setLocked(),this._nodeAccountIds.setLocked();for(const n of this._signedTransactions.list){const r=n.bodyBytes,o=await t(r);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(o))}return this}signWithOperator(e){const t=e._operator;if(null==t)throw new Error("`client` must have an operator to sign with the operator");return this._isFrozen()||this.freezeWith(e),this.signWith(t.publicKey,t.transactionSigner)}_resetTransaction(e){if(!e.operatorAccountId)throw new Error("Client must have an operator account ID");this.logger?.info("Resetting transaction id and resigning");const t=TransactionId.generate(e.operatorAccountId);this._transactionIds.clear(),this._signedTransactions.clear(),this._transactionIds.setList([t]),this._isThrottled=!0}addSignature(e,t){if(!(t instanceof SignatureMap$1))return this._addSignatureLegacy(e,t);this.isFrozen()||this.freeze();const n=encode$5(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();for(let n=0;n<this._signedTransactions.length;n++){const r=this._signedTransactions.get(n);if(null==r.sigMap&&(r.sigMap={}),null==r.sigMap.sigPair&&(r.sigMap.sigPair=[]),r.bodyBytes){const{transactionID:n,nodeAccountID:o}=libExports.proto.TransactionBody.decode(r.bodyBytes);if(!n||!o)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const i=TransactionId._fromProtobuf(n),a=AccountId._fromProtobuf(o),s=t.get(a),c=s?.get(i),u=c?.get(e);if(!u)throw new Error("Signature not found for the transaction and public key");const l=e._toProtobufSignature(u);r.sigMap?.sigPair?.push(l)}}return this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(null),this}_addSignatureLegacy(e,t){const n=t instanceof Uint8Array,r=Array.isArray(t);if(this.getRequiredChunks()>1)throw new Error("Add signature is not supported for chunked transactions");if(n&&1!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");if(r&&t.length!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");this.isFrozen()||this.freeze();const o=encode$5(e.toBytesRaw());if(this._signerPublicKeys.has(o))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();const i=n?[t]:t;for(let t=0;t<this._signedTransactions.length;t++){const n=this._signedTransactions.get(t);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(i[t]))}return this._signerPublicKeys.add(o),this._publicKeys.push(e),this._transactionSigners.push(null),this}getSignaturesLegacy(){return this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap._fromTransaction(this)}removeSignature(e){this.isFrozen()||this.freeze();const t=encode$5(e.toBytesRaw());if(!this._signerPublicKeys.has(t))throw new Error("The public key has not signed this transaction");const n=[];for(const e of this._signedTransactions.list){const r=this._removeSignaturesFromTransaction(e,t);n.push(...r)}return this._signerPublicKeys.delete(t),this._publicKeys=this._publicKeys.filter(t=>!t.equals(e)),this._transactionSigners.pop(),n}removeAllSignatures(){this.isFrozen()||this.freeze();const e=this._collectSignaturesByPublicKey();for(const e of this._signedTransactions.list)e.sigMap&&e.sigMap.sigPair&&(e.sigMap.sigPair=[]);return this._signerPublicKeys.clear(),this._publicKeys=[],this._transactionSigners=[],e}getSignatures(e){return e?this.getSignaturesLegacy():(this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap$1._fromTransaction(this))}async getSignaturesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),SignatureMap$1._fromTransaction(this)}_setTransactionId(){if(null==this._operatorAccountId&&this._transactionIds.isEmpty)throw new Error("`transactionId` must be set or `client` must be provided with `freezeWith`")}_setNodeAccountIds(e){if(this._nodeAccountIds.isEmpty){if(null==e)throw new Error("`nodeAccountId` must be set or `client` must be provided with `freezeWith`");this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute())}}_applyMaxNodesPerTransactionLimit(e){const t=e.maxNodesPerTransaction;if(t<=0||this._nodeAccountIds.length<=t)return;this._logger&&this._logger.debug(`Trimming frozen transaction from ${this._nodeAccountIds.length} nodes to ${t} nodes based on maxNodesPerTransaction setting`);const n=this._nodeAccountIds.list.slice(0,t),r=this._nodeAccountIds.length,o=this._transactionIds.length,i=[];for(let e=0;e<o;e++){const n=e*r;for(let e=0;e<t;e++){const t=n+e;t<this._signedTransactions.length&&i.push(this._signedTransactions.get(t))}}this._transactions.clear(),this._nodeAccountIds.locked=!1,this._nodeAccountIds.setList(n),this._nodeAccountIds.locked=!0,this._signedTransactions.setList(i)}setBatchKey(e){return this._requireNotFrozen(),this._batchKey=e,this}get batchKey(){return this._batchKey}get signableNodeBodyBytesList(){return this._requireFrozen(),this._signedTransactions.list.map(e=>{if(!e.bodyBytes)throw new Error("Missing bodyBytes in signed transaction.");const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(!t.nodeAccountID)throw new Error("Missing nodeAccountID in transaction body.");const n=AccountId._fromProtobuf(t.nodeAccountID);if(!t.transactionID)throw new Error("Missing transactionID in transaction body.");const r=TransactionId._fromProtobuf(t.transactionID);return new SignableNodeTransactionBodyBytes(n,r,e.bodyBytes)})}_buildSignedTransactions(){this._signedTransactions.locked||this._signedTransactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}_buildIncompleteTransactions(){0==this._nodeAccountIds.length?this._transactions.setList([this._makeSignedTransaction(null)]):this._transactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}freeze(){return this.freezeWith(null)}_freezeWithAccountId(e){null==this._operatorAccountId&&(this._operatorAccountId=e)}freezeWith(e){if(this._signOnDemand=null!=e&&e.signOnDemand,this._operator=null!=e?e._operator:null,this._freezeWithAccountId(null!=e?e.operatorAccountId:null),this._maxTransactionFee=null==this._maxTransactionFee?null!=e&&null!=e.defaultMaxTransactionFee?e.defaultMaxTransactionFee:this._defaultMaxTransactionFee:this._maxTransactionFee,this._regenerateTransactionId=null!=e&&null==this._regenerateTransactionId?e.defaultRegenerateTransactionId:this._regenerateTransactionId,this.batchKey?this._nodeAccountIds.setList([NODE_ACCOUNT_BATCH_ID]):this._setNodeAccountIds(e),this._setTransactionId(),null!=e)for(const t of this._transactionIds.list)null!=t.accountId&&t.accountId.validateChecksum(e);return this._buildNewTransactionIdList(),this._signOnDemand||this._buildSignedTransactions(),this}async signWithSigner(e){return await e.signTransaction(this),this}async freezeWithSigner(e){return await e.populateTransaction(this),this.freeze(),this}toBytes(){return this._requireNotSignOnDemand(),this._isFrozen()?(this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._buildAllTransactions()):this._buildIncompleteTransactions(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async toBytesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async getTransactionHash(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),digest(this._transactions.get(0).signedTransactionBytes)}async getTransactionHashPerNode(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),await TransactionHashMap._fromTransaction(this)}isFrozen(){return this._signedTransactions.length>0}_getTransactionId(){const e=this.transactionId;if(null==e)throw new Error("transaction must have been frozen before getting the transaction ID, try calling `freeze`");return e}_validateChecksums(e){}async _beforeExecute(e){this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),this._logger&&this._logger.info(`Network used: ${e._network.networkName}`),this._isFrozen()||this.freezeWith(e),this._applyMaxNodesPerTransactionLimit(e),e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),null!=this._operator&&null!=this._operator||(this._operator=null!=e?e._operator:null),null!=this._operatorAccountId&&null!=this._operatorAccountId||(this._operatorAccountId=null!=e&&null!=e._operator?e._operator.accountId:null),null!=this._operator&&await this.signWith(this._operator.publicKey,this._operator.transactionSigner)}async _makeRequestAsync(){const e=this._transactionIds.index*this._nodeAccountIds.length+this._nodeAccountIds.index;return this._signOnDemand||this._isThrottled?await this._buildTransactionAsync():(this._buildTransaction(e),this._transactions.get(e))}async _signTransaction(){const e=this._makeSignedTransaction(this._nodeAccountIds.next),t=e.bodyBytes;for(let n=0;n<this._publicKeys.length;n++){const r=this._publicKeys[n],o=this._transactionSigners[n];if(null==o)continue;const i=await o(t);null==e.sigMap&&(e.sigMap={}),null==e.sigMap.sigPair&&(e.sigMap.sigPair=[]),e.sigMap.sigPair.push(r._toProtobufSignature(i))}return e}_buildNewTransactionIdList(){if(this._transactionIds.locked||null==this._operatorAccountId)return;const e=TransactionId.withValidStart(this._operatorAccountId,Timestamp.generate());this._transactionIds.set(this._transactionIds.index,e)}_buildAllTransactions(){for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}async _buildAllTransactionsAsync(){if(this._signOnDemand){if(this._buildSignedTransactions(),!this._transactions.locked)for(let e=0;e<this._signedTransactions.length;e++)this._transactions.push(await this._buildTransactionAsync())}else this._buildAllTransactions()}_buildTransaction(e){if(this._transactions.length<e)for(let t=this._transactions.length;t<e;t++)this._transactions.push(null);null!=this._transactions.list[e]&&this._transactions.set(e,{signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}),this._transactions.setIfAbsent(e,()=>({signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}))}async _buildTransactionAsync(){return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(await this._signTransaction()).finish()}}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=t,r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger&&(this._logger.debug(`[${this._getLogId()}] received status ${r.toString()}`),this._logger.info(`SDK Transaction Status Response: ${r.toString()}`)),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];case Status.TransactionExpired:return this._transactionIds.locked||null!=this._regenerateTransactionId&&!this._regenerateTransactionId?[r,ExecutionState.Error]:(this._buildNewTransactionIdList(),[r,ExecutionState.Retry]);default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=t,o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return this._logger&&this._logger.info(`Transaction Error Info: ${o.toString()}, ${this.transactionId.toString()}`),new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}async _mapResponse(e,t,n){const r=await digest(n.signedTransactionBytes),o=this._getTransactionId();return this._transactionIds.advance(),this._logger&&this._logger.info(`Transaction Info: ${JSON.stringify(new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,logger:this._logger}).toJSON())}`),new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,transaction:this,logger:this._logger})}_makeSignedTransaction(e){const t=this._makeTransactionBody(e);this._logger&&this._logger.info(`Transaction Body: ${JSON.stringify(t)}`);return{sigMap:{sigPair:[]},bodyBytes:libExports.proto.TransactionBody.encode(t).finish()}}isBatchedAndNotBatchTransaction(){return null!=this.batchKey&&"atomicBatch"!=this._getTransactionDataCase()}_makeTransactionBody(e){return{[this._getTransactionDataCase()]:this._makeTransactionData(),transactionFee:null!=this._maxTransactionFee?this._maxTransactionFee.toTinybars():null,memo:this._transactionMemo,transactionID:null!=this._transactionIds.current?this._transactionIds.current._toProtobuf():null,nodeAccountID:null!=e?e._toProtobuf():null,transactionValidDuration:{seconds:Long.fromNumber(this._transactionValidDuration)},maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,batchKey:this.batchKey?._toProtobufKey()}}_getTransactionDataCase(){throw new Error("not implemented")}_getScheduledTransactionBody(){return{memo:this.transactionMemo,transactionFee:null==this._maxTransactionFee?this._defaultMaxTransactionFee.toTinybars():this._maxTransactionFee.toTinybars(),maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,[this._getTransactionDataCase()]:this._makeTransactionData()}}_makeTransactionData(){throw new Error("not implemented")}_isFrozen(){return this._signOnDemand||this._signedTransactions.length>0}_requireNotFrozen(){if(this._isFrozen())throw new Error("transaction is immutable; it has at least one signature or has been explicitly frozen")}_requireNotSignOnDemand(){if(this._signOnDemand)throw new Error("Please use `toBytesAsync()` if `signOnDemand` is enabled")}_requireFrozen(){if(!this._isFrozen())throw new Error("transaction must have been frozen before calculating the hash will be stable, try calling `freeze`")}_requireOneNodeAccountId(){if(1!=this._nodeAccountIds.length)throw"transaction did not have exactly one node ID set"}_requestToBytes(e){return libExports.proto.Transaction.encode(e).finish()}_responseToBytes(e){return libExports.proto.TransactionResponse.encode(e).finish()}_removeSignaturesFromTransaction(e,t){const n=[];return e.sigMap&&e.sigMap.sigPair?(e.sigMap.sigPair=e.sigMap.sigPair.filter(e=>{const r=this._shouldRemoveSignature(e,t),o=e.ed25519??e.ECDSASecp256k1;return r&&o&&n.push(o),!r}),n):[]}_shouldRemoveSignature=(e,t)=>encode$5(e?.pubKeyPrefix||new Uint8Array)===t;_collectSignaturesByPublicKey(){const e=new Map,t={};for(const n of this._signedTransactions.list){if(!n.sigMap||!n.sigMap.sigPair)return new Map;for(const r of n.sigMap.sigPair){const n=r.ed25519??r.ECDSASecp256k1;if(!n||!r.pubKeyPrefix)return new Map;const o=encode$5(r.pubKeyPrefix);let i=t[o];i||(i=PublicKey.fromString(o),t[o]=i),e.has(i)||e.set(i,[]);const a=e.get(i);a&&a.push(n)}}return e}}const SCHEDULE_CREATE_TRANSACTION=[];class TokenNftTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.senderAccountId=e.senderAccountId instanceof AccountId?e.senderAccountId:AccountId.fromString(e.senderAccountId),this.receiverAccountId=e.receiverAccountId instanceof AccountId?e.receiverAccountId:AccountId.fromString(e.receiverAccountId),this.serialNumber=Long.fromValue(e.serialNumber),this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[])t.push(new TokenNftTransfer({tokenId:e,senderAccountId:AccountId._fromProtobuf(r.senderAccountID),receiverAccountId:AccountId._fromProtobuf(r.receiverAccountID),serialNumber:null!=r.serialNumber?r.serialNumber:Long.ZERO,isApproved:1==r.isApproval}))}return t}_toProtobuf(){return{senderAccountID:this.senderAccountId._toProtobuf(),receiverAccountID:this.receiverAccountId._toProtobuf(),serialNumber:this.serialNumber,isApproval:this.isApproved}}}class NullableTokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AbstractTokenTransferTransaction extends Transaction{constructor(e={}){super(),this._tokenTransfers=[],this._nftTransfers=[];for(const t of null!=e.tokenTransfers?e.tokenTransfers:[])this.addTokenTransfer(t.tokenId,t.accountId,t.amount);for(const t of null!=e.nftTransfers?e.nftTransfers:[])this.addNftTransfer(t.tokenId,t.serial,t.sender,t.recipient)}addNftTransfer(e,t,n,r){return this._addNftTransfer(!1,e,t,n,r)}_addTokenTransfer(e,t,n,r,o){this._requireNotFrozen();const i=e instanceof TokenId?e:TokenId.fromString(e),a=t instanceof AccountId?t:AccountId.fromString(t),s=convertAmountToLong(n);for(const e of this._tokenTransfers)if(0===e.tokenId.compare(i)&&0===e.accountId.compare(a))return e.amount=e.amount.add(s),e.expectedDecimals=o,this;return this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:o,amount:n,isApproved:r})),this}addTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!1,null)}_addNftTransfer(e,t,n,r,o){let i,a,s;if(this._requireNotFrozen(),t instanceof NftId)i=t,a="string"==typeof n?AccountId.fromString(n):n,s="string"==typeof r?AccountId.fromString(r):r;else if(t instanceof TokenId)i=new NftId(t,n),a="string"==typeof r?AccountId.fromString(r):r,s="string"==typeof o?AccountId.fromString(o):o;else try{i=NftId.fromString(t),a="string"==typeof n?AccountId.fromString(n):n,s="string"==typeof r?AccountId.fromString(r):r}catch(e){const c=TokenId.fromString(t);i=new NftId(c,n),a="string"==typeof r?AccountId.fromString(r):r,s="string"==typeof o?AccountId.fromString(o):o}for(const e of this._nftTransfers)if(0===e.tokenId.compare(i.tokenId)&&0===e.serialNumber.compare(i.serial))return e.senderAccountId=a,e.receiverAccountId=s,this;return this._nftTransfers.push(new TokenNftTransfer({tokenId:i.tokenId,serialNumber:i.serial,senderAccountId:a,receiverAccountId:s,isApproved:e})),this}addApprovedNftTransfer(e,t,n,r){return this._addNftTransfer(!0,e,t,n,r)}addApprovedTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!0,null)}addTokenTransferWithDecimals(e,t,n,r){this._requireNotFrozen();const o=e instanceof TokenId?e:TokenId.fromString(e),i=t instanceof AccountId?t:AccountId.fromString(t),a=convertAmountToLong(n);let s=!1;for(const e of this._tokenTransfers)if(0===e.tokenId.compare(o)){if(null!=e.expectedDecimals&&e.expectedDecimals!==r)throw new Error("expected decimals mis-match");e.expectedDecimals=r,0===e.accountId.compare(i)&&(e.amount=e.amount.add(a),e.expectedDecimals=r,s=!0)}return s||this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:r,amount:n,isApproved:!1})),this}get tokenIdDecimals(){const e=new NullableTokenDecimalMap;for(const t of this._tokenTransfers)e._set(t.tokenId,t.expectedDecimals);return e}get nftTransfers(){const e=new TokenNftTransferMap;for(const t of this._nftTransfers){const n=e.get(t.tokenId),r={sender:t.senderAccountId,recipient:t.receiverAccountId,serial:t.serialNumber,isApproved:t.isApproved};null!=n?n.push(r):e._set(t.tokenId,[r])}return e}get tokenTransfers(){const e=new TokenTransferMap;for(const t of this._tokenTransfers){let n=e.get(t.tokenId);null!=n?n._set(t.accountId,t.amount):(n=new TokenTransferAccountMap,n._set(t.accountId,t.amount),e._set(t.tokenId,n))}return e}_makeTransactionData(){const e=[];this._tokenTransfers.sort((e,t)=>{const n=e.tokenId.compare(t.tokenId);return 0!==n?n:e.accountId.compare(t.accountId)}),this._nftTransfers.sort((e,t)=>{const n=e.senderAccountId.compare(t.senderAccountId);if(0!=n)return n;const r=e.receiverAccountId.compare(t.receiverAccountId);return 0!=r?r:e.serialNumber.compare(t.serialNumber)});let t=0,n=0;for(;t<this._tokenTransfers.length||n<this._nftTransfers.length;)if(t<this._tokenTransfers.length&&n<this._nftTransfers.length){const r=this._tokenTransfers[t].tokenId,o=this._nftTransfers[n].tokenId,i=e.length>0?e[e.length-1]:null,a=null!=i?i.tokenId:null;if(null!=i&&null!=a&&0===a.compare(r)){i.transfers.push(this._tokenTransfers[t++]);continue}if(null!=i&&null!=a&&0===a.compare(o)){i.nftTransfers.push(this._nftTransfers[n++]);continue}const s=r.compare(o);0===s?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[this._nftTransfers[n++]]}):s<0?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]}):e.push({tokenId:o,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}else if(t<this._tokenTransfers.length){const n=this._tokenTransfers[t].tokenId;let r;for(const t of e)0===t.tokenId.compare(n)&&(r=t);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(n)){r.transfers.push(this._tokenTransfers[t++]);continue}e.push({tokenId:n,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]})}else if(n<this._nftTransfers.length){const t=this._nftTransfers[n].tokenId;let r;for(const n of e)0===n.tokenId.compare(t)&&(r=n);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(t)){r.nftTransfers.push(this._nftTransfers[n++]);continue}e.push({tokenId:t,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}return{tokenTransfers:e.map(e=>({token:e.tokenId._toProtobuf(),expectedDecimals:null!=e.expectedDecimals?{value:e.expectedDecimals}:null,transfers:e.transfers.map(e=>e._toProtobuf()),nftTransfers:e.nftTransfers.map(e=>e._toProtobuf())}))}}}class TokenAirdropTransaction extends AbstractTokenTransferTransaction{constructor(e={}){if(super(),null!=e.tokenTransfers)for(const t of e.tokenTransfers)this._addTokenTransfer(t.tokenId,t.accountId,t.amount,t.isApproved,t.expectedDecimals);if(this._nftTransfers=[],null!=e.nftTransfers)for(const t of e.nftTransfers)this._addNftTransfer(t.isApproved,t.tokenId,t.serialNumber,t.senderAccountId,t.receiverAccountId)}addApprovedTokenTransferWithDecimals(e,t,n,r){return this._requireNotFrozen(),this._addTokenTransfer(e,t,n,!0,r),this}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenAirdrop,a=TokenTransfer._fromProtobuf(i.tokenTransfers??[]),s=TokenNftTransfer._fromProtobuf(i.tokenTransfers??[]);return Transaction._fromProtobufTransactions(new TokenAirdropTransaction({nftTransfers:s,tokenTransfers:a}),e,t,n,r,o)}_execute(e,t){return e.token.airdropTokens(t)}_getTransactionDataCase(){return"tokenAirdrop"}_getLogId(){return`TokenAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAirdrop",TokenAirdropTransaction._fromProtobuf);class AirdropPendingTransaction extends Transaction{constructor(e){super(),this._pendingAirdropIds=[],null!=e?.pendingAirdropIds&&(this._pendingAirdropIds=e.pendingAirdropIds)}get pendingAirdropIds(){return this._pendingAirdropIds}addPendingAirdropId(e){return this._requireNotFrozen(),this._pendingAirdropIds.push(e),this}setPendingAirdropIds(e){return this._requireNotFrozen(),this._pendingAirdropIds=e,this}}class TokenClaimAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_execute(e,t){return e.token.claimAirdrop(t)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}static _fromProtobuf(e,t,n,r,o){const i=o[0],{pendingAirdrops:a}=i.tokenClaimAirdrop;return Transaction._fromProtobufTransactions(new TokenClaimAirdropTransaction({pendingAirdropIds:a?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getTransactionDataCase(){return"tokenClaimAirdrop"}_getLogId(){return`TokenClaimAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenClaimAirdrop",TokenClaimAirdropTransaction._fromProtobuf);class TokenCancelAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}_execute(e,t){return e.token.cancelAirdrop(t)}_getTransactionDataCase(){return"tokenCancelAirdrop"}static _fromProtobuf(e,t,n,r,o){const i=o[0],{pendingAirdrops:a}=i.tokenCancelAirdrop;return Transaction._fromProtobufTransactions(new TokenCancelAirdropTransaction({pendingAirdropIds:a?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getLogId(){return`TokenCancelAirdrop:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCancelAirdrop",TokenCancelAirdropTransaction._fromProtobuf);class HbarAllowance{constructor(e){this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=e.amount,Object.freeze(this)}static _fromProtobuf(e){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}static _fromGrantedProtobuf(e,t){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,amount:null!=this.amount?this.amount.toTinybars():null}}_validateChecksums(e){null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}toJSON(){return{ownerAccountId:null!=this.ownerAccountId?this.ownerAccountId.toString():null,spenderAccountId:null!=this.spenderAccountId?this.spenderAccountId.toString():null,amount:null!=this.amount?this.amount.toString():null}}}class TokenAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=null!=e.amount?convertAmountToLong(e.amount):null,Object.freeze(this)}static _fromProtobuf(e){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:null!=e.amount?Long.fromValue(e.amount):null})}static _fromGrantedProtobuf(e,t){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:null!=e.amount?Long.fromValue(e.amount):null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,amount:this.amount}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class TokenNftAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.serialNumbers=e.serialNumbers,this.allSerials=e.allSerials,this.delegatingSpender=e.delegatingSpender,Object.freeze(this)}static _fromProtobuf(e){const t=null!=e.approvedForAll&&1==e.approvedForAll.value;return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null!=e.spender?AccountId._fromProtobuf(e.spender):null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:t?null:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:t,delegatingSpender:null!=e.delegatingSpender?AccountId._fromProtobuf(e.delegatingSpender):null})}static _fromGrantedProtobuf(e,t){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,serialNumbers:[],allSerials:null,delegatingSpender:null})}static _fromRemoveProtobuf(e){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:null,delegatingSpender:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,approvedForAll:null==this.serialNumbers?{value:this.allSerials}:null,serialNumbers:this.serialNumbers,delegatingSpender:null!=this.delegatingSpender?this.delegatingSpender._toProtobuf():null}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class AccountAllowanceAdjustTransaction extends Transaction{constructor(e={}){super(),this._hbarAllowances=null!=e.hbarAllowances?e.hbarAllowances:[],this._tokenAllowances=null!=e.tokenAllowances?e.tokenAllowances:[],this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}get hbarAllowances(){return this._hbarAllowances}addHbarAllowance(e,t){const n=t instanceof Hbar?t:new Hbar(t);return this._adjustHbarAllowance(null,e,requireNotNegative(n))}_adjustHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarAllowances.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n})),this}grantHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r))}revokeHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r).negated())}get tokenAllowances(){return this._tokenAllowances}addTokenAllowance(e,t,n){return this._adjustTokenAllowance(e,null,t,requireNotNegative(Long.fromValue(n)))}_adjustTokenAllowance(e,t,n,r){return this._requireNotFrozen(),this._tokenAllowances.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:"number"==typeof r?Long.fromNumber(r):r})),this}grantTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}revokeTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}addTokenNftAllowance(e,t){const n="string"==typeof e?NftId.fromString(e):e;return this._adjustTokenNftAllowance(n,null,t)}_adjustTokenNftAllowance(e,t,n){this._requireNotFrozen();const r="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,o="string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t;let i=!1;for(const t of this._nftAllowances)if(0===t.tokenId.compare(e.tokenId)&&null!=t.spenderAccountId&&0===t.spenderAccountId.compare(r)){null!=t.serialNumbers&&t.serialNumbers.push(e.serial),i=!0;break}return i||this._nftAllowances.push(new TokenNftAllowance({tokenId:e.tokenId,spenderAccountId:r,serialNumbers:[e.serial],ownerAccountId:o,allSerials:!1,delegatingSpender:null})),this}grantTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(r,t,n)}revokeTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(new NftId(r.tokenId,r.serial.negate()),t,n)}addAllTokenNftAllowance(e,t){return this._adjustTokenNftAllowanceAllSerials(e,null,t,!0)}grantTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!0)}revokeTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!1)}_adjustTokenNftAllowanceAllSerials(e,t,n,r){return this._requireNotFrozen(),this._nftAllowances.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,ownerAccountId:null!=t?"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t:null,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}_validateChecksums(e){this._hbarAllowances.map(t=>t._validateChecksums(e)),this._tokenAllowances.map(t=>t._validateChecksums(e)),this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return Promise.reject(new Error("This feature has been deprecated for this class."))}_getTransactionDataCase(){throw new Error("This feature has been deprecated for this class.")}_makeTransactionData(){throw new Error("This feature has been deprecated.")}_getLogId(){return`AccountAllowanceAdjustTransaction:${this._transactionIds.current.validStart.toString()}`}}class AccountAllowanceApproveTransaction extends Transaction{constructor(e={}){super(),this._hbarApprovals=null!=e.hbarApprovals?e.hbarApprovals:[],this._tokenApprovals=null!=e.tokenApprovals?e.tokenApprovals:[],this._nftApprovals=null!=e.nftApprovals?e.nftApprovals:[]}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoApproveAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceApproveTransaction({hbarApprovals:(null!=i.cryptoAllowances?i.cryptoAllowances:[]).map(e=>HbarAllowance._fromProtobuf(e)),tokenApprovals:(null!=i.tokenAllowances?i.tokenAllowances:[]).map(e=>TokenAllowance._fromProtobuf(e)),nftApprovals:(null!=i.nftAllowances?i.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get hbarApprovals(){return this._hbarApprovals}approveHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n instanceof Hbar?n:new Hbar(n)})),this}addHbarAllowance(e,t){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof e?AccountId.fromString(e):e,amount:t instanceof Hbar?t:new Hbar(t),ownerAccountId:null})),this}get tokenApprovals(){return this._tokenApprovals}approveTokenAllowance(e,t,n,r){this._requireNotFrozen();const o=convertAmountToLong(r);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:o})),this}addTokenAllowance(e,t,n){this._requireNotFrozen();const r=convertAmountToLong(n);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof t?AccountId.fromString(t):t,amount:r,ownerAccountId:null})),this}addTokenNftAllowance(e,t){return this._approveTokenNftAllowance(e,null,t,null)}get tokenNftApprovals(){return this._nftApprovals}_approveTokenNftAllowance(e,t,n,r){this._requireNotFrozen();const o="string"==typeof e?NftId.fromString(e):e,i="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n;let a=!1;for(const e of this._nftApprovals)if(0===e.tokenId.compare(o.tokenId)&&null!=e.spenderAccountId&&0===e.spenderAccountId.compare(i)){null!=e.serialNumbers&&e.serialNumbers.push(o.serial),a=!0;break}return a||this._nftApprovals.push(new TokenNftAllowance({tokenId:o.tokenId,spenderAccountId:i,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:[o.serial],allSerials:!1,delegatingSpender:"string"==typeof r?AccountId.fromString(r):r})),this}approveTokenNftAllowance(e,t,n){return this._approveTokenNftAllowance(e,t,n,null)}approveTokenNftAllowanceWithDelegatingSpender(e,t,n,r){return this._approveTokenNftAllowance(e,t,n,r)}_approveAllTokenNftAllowance(e,t,n,r){return this._requireNotFrozen(),this._nftApprovals.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}addAllTokenNftAllowance(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}approveTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}deleteTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!1)}_validateChecksums(e){this._hbarApprovals.map(t=>t._validateChecksums(e)),this._tokenApprovals.map(t=>t._validateChecksums(e)),this._nftApprovals.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.approveAllowances(t)}_getTransactionDataCase(){return"cryptoApproveAllowance"}_makeTransactionData(){return{cryptoAllowances:this._hbarApprovals.map(e=>e._toProtobuf()),tokenAllowances:this._tokenApprovals.map(e=>e._toProtobuf()),nftAllowances:this._nftApprovals.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceApproveTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoApproveAllowance",AccountAllowanceApproveTransaction._fromProtobuf);class AccountAllowanceDeleteTransaction extends Transaction{constructor(e={}){super(),this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoDeleteAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceDeleteTransaction({nftAllowances:(null!=i.nftAllowances?i.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get tokenNftAllowanceDeletions(){return this._nftAllowances}deleteAllTokenNftAllowances(e,t){this._requireNotFrozen();const n="string"==typeof e?NftId.fromString(e):e,r="string"==typeof t?AccountId.fromString(t):t;let o=!1;for(const e of this._nftAllowances)if(0===e.tokenId.compare(n.tokenId)){null!=e.serialNumbers&&e.serialNumbers.push(n.serial),o=!0;break}return o||this._nftAllowances.push(new TokenNftAllowance({tokenId:n.tokenId,spenderAccountId:null,serialNumbers:[n.serial],ownerAccountId:r,allSerials:!1,delegatingSpender:null})),this}_validateChecksums(e){this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.deleteAllowances(t)}_getTransactionDataCase(){return"cryptoDeleteAllowance"}_makeTransactionData(){return{nftAllowances:this._nftAllowances.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteAllowance",AccountAllowanceDeleteTransaction._fromProtobuf);class TokenBalanceMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class TokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AccountBalance{constructor(e){this.hbars=e.hbars,this.tokens=e.tokens,this.tokenDecimals=e.tokenDecimals,Object.freeze(this)}static fromBytes(e){return AccountBalance._fromProtobuf(libExports.proto.CryptoGetAccountBalanceResponse.decode(e))}static _fromProtobuf(e){const t=new TokenBalanceMap,n=new TokenDecimalMap;if(null!=e.tokenBalances)for(const r of e.tokenBalances){const e=TokenId._fromProtobuf(r.tokenId);n._set(e,null!=r.decimals?r.decimals:0),t._set(e,Long.fromValue(r.balance))}return new AccountBalance({hbars:Hbar.fromTinybars(e.balance),tokens:t,tokenDecimals:n})}_toProtobuf(){const e=[];for(const[t,n]of null!=this.tokens?this.tokens:[])e.push({tokenId:t._toProtobuf(),balance:n,decimals:null!=this.tokenDecimals?this.tokenDecimals.get(t):null});return{balance:this.hbars.toTinybars(),tokenBalances:e}}toBytes(){return libExports.proto.CryptoGetAccountBalanceResponse.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){const e=[];for(const[t,n]of null!=this.tokens?this.tokens:[]){const r=null!=this.tokenDecimals?this.tokenDecimals.get(t):null;e.push({tokenId:t.toString(),balance:n.toString(),decimals:null!=r?r:0})}return{hbars:this.hbars.toString(),tokens:e}}}class AccountBalanceQuery extends Query{constructor(e={}){super(),this._accountId=null,this._contractId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.cryptogetAccountBalance;return new AccountBalanceQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_isPaymentRequired(){return!1}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoGetBalance(t)}_mapResponseHeader(e){return e.cryptogetAccountBalance.header}_mapResponse(e,t,n){const r=e.cryptogetAccountBalance;return Promise.resolve(AccountBalance._fromProtobuf(r))}_onMakeRequest(e){return{cryptogetAccountBalance:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`AccountBalanceQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("cryptogetAccountBalance",AccountBalanceQuery._fromProtobuf);class Duration{constructor(e){this.seconds=e instanceof Long?e:Long.fromNumber(e),Object.freeze(this)}_toProtobuf(){return{seconds:this.seconds}}static _fromProtobuf(e){return new Duration(e.seconds)}}class AccountCreateTransaction extends Transaction{constructor(e={}){super(),this._key=null,this._initialBalance=null,this._sendRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiveRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiverSignatureRequired=!1,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._alias=null,null!=e.key&&this.setKeyWithoutAlias(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.alias&&this.setAlias(e.alias)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoCreateAccount;let a;return null!=i.alias&&i.alias.length>0&&20===i.alias.length&&(a=EvmAddress.fromBytes(i.alias)),Transaction._fromProtobufTransactions(new AccountCreateTransaction({key:null!=i.key?Key._fromProtobufKey(i.key):void 0,initialBalance:null!=i.initialBalance?Hbar.fromTinybars(i.initialBalance):void 0,receiverSignatureRequired:null!=i.receiverSigRequired?i.receiverSigRequired:void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,accountMemo:null!=i.memo?i.memo:void 0,maxAutomaticTokenAssociations:null!=i.maxAutomaticTokenAssociations?i.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:1==i.declineReward,alias:a}),e,t,n,r,o)}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}setECDSAKeyWithAlias(e){this.setKeyWithoutAlias(e);const t=this._deriveECDSAKeyAlias(e);return this.setAlias(t),this}setKeyWithAlias(e,t){this.setKeyWithoutAlias(e);const n=this._deriveECDSAKeyAlias(t);return this.setAlias(n),this}setKeyWithoutAlias(e){return this._requireNotFrozen(),this._key=e,this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get alias(){return this._alias}setAlias(e){if("string"==typeof e){if(!(e.startsWith("0x")&&42==e.length||40==e.length))throw new Error('evmAddress must be a valid EVM address with or without "0x" prefix');this._alias=EvmAddress.fromString(e)}else this._alias=e;return this}_validateChecksums(e){null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_deriveECDSAKeyAlias(e){const t=e instanceof PrivateKey&&"secp256k1"===e.type,n=e instanceof PublicKey&&"secp256k1"===e.type;if(t)return e.publicKey.toEvmAddress();if(n)return e.toEvmAddress();throw new Error("Invalid key for alias derivation provided: expected an ECDSA (secp256k1) PrivateKey or PublicKey.")}_execute(e,t){return e.crypto.createAccount(t)}_getTransactionDataCase(){return"cryptoCreateAccount"}_makeTransactionData(){let e=null;return null!=this._alias&&(e=this._alias.toBytes()),{key:null!=this._key?this._key._toProtobufKey():null,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,receiveRecordThreshold:this._receiveRecordThreshold.toTinybars(),sendRecordThreshold:this._sendRecordThreshold.toTinybars(),receiverSigRequired:this._receiverSignatureRequired,memo:this._accountMemo,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?this._maxAutomaticTokenAssociations.toInt():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,alias:e}}_getLogId(){return`AccountCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoCreateAccount",AccountCreateTransaction._fromProtobuf);class AccountDeleteTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._transferAccountId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoDelete;return Transaction._fromProtobufTransactions(new AccountDeleteTransaction({accountId:null!=i.deleteAccountID?AccountId._fromProtobuf(i.deleteAccountID):void 0,transferAccountId:null!=i.transferAccountID?AccountId._fromProtobuf(i.transferAccountID):void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoDelete(t)}_getTransactionDataCase(){return"cryptoDelete"}_makeTransactionData(){return{deleteAccountID:null!=this._accountId?this._accountId._toProtobuf():null,transferAccountID:null!=this._transferAccountId?this._transferAccountId._toProtobuf():null}}_getLogId(){return`AccountDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDelete",AccountDeleteTransaction._fromProtobuf);class StakingInfo{constructor(e){this.declineStakingReward=e.declineStakingReward,this.stakePeriodStart=e.stakePeriodStart,this.pendingReward=e.pendingReward,this.stakedToMe=e.stakedToMe,this.stakedAccountId=e.stakedAccountId,this.stakedNodeId=e.stakedNodeId,Object.freeze(this)}static _fromProtobuf(e){return new StakingInfo({declineStakingReward:1==e.declineReward,stakePeriodStart:null!=e.stakePeriodStart?Timestamp._fromProtobuf(e.stakePeriodStart):null,pendingReward:null!=e.pendingReward?Hbar.fromTinybars(e.pendingReward):null,stakedToMe:null!=e.stakedToMe?Hbar.fromTinybars(e.stakedToMe):null,stakedAccountId:null!=e.stakedAccountId?AccountId._fromProtobuf(e.stakedAccountId):null,stakedNodeId:null!=e.stakedNodeId?e.stakedNodeId:null})}_toProtobuf(){return{declineReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart._toProtobuf():null,pendingReward:null!=this.pendingReward?this.pendingReward.toTinybars():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toTinybars():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId}}static fromBytes(e){return StakingInfo._fromProtobuf(libExports.proto.StakingInfo.decode(e))}toBytes(){return libExports.proto.StakingInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{declineStakingReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart.toString():null,pendingReward:null!=this.pendingReward?this.pendingReward.toString():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toString():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId.toString():null,stakedNodeId:null!=this.stakedNodeId?this.stakedNodeId.toString():null}}}class LiveHash{constructor(e){this.accountId=e.accountId,this.hash=e.hash,this.keys=e.keys,this.duration=e.duration,Object.freeze(this)}static _fromProtobuf(e){const t=e;return new LiveHash({accountId:AccountId._fromProtobuf(t.accountId),hash:null!=t.hash?t.hash:new Uint8Array,keys:null!=t.keys?KeyList.__fromProtobufKeyList(t.keys):new KeyList,duration:Duration._fromProtobuf(t.duration)})}_toProtobuf(){return{accountId:this.accountId._toProtobuf(),hash:this.hash,keys:this.keys._toProtobufKey().keyList,duration:this.duration._toProtobuf()}}}class TokenRelationship{constructor(e){this.tokenId=e.tokenId,this.symbol=e.symbol,this.balance=e.balance,this.isKycGranted=e.isKycGranted,this.isFrozen=e.isFrozen,this.automaticAssociation=e.automaticAssociation,Object.freeze(this)}static _fromProtobuf(e){const t=TokenId._fromProtobuf(e.tokenId),n=null==e.kycStatus||0===e.kycStatus?null:1===e.kycStatus,r=null==e.freezeStatus||0===e.freezeStatus?null:1===e.freezeStatus;return new TokenRelationship({tokenId:t,symbol:e.symbol,balance:null!=e.balance?e.balance instanceof Long?e.balance:Long.fromValue(e.balance):Long.ZERO,isKycGranted:n,isFrozen:r,automaticAssociation:null!=e.automaticAssociation?e.automaticAssociation:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),symbol:this.symbol,balance:this.balance,kycStatus:null==this.isKycGranted?0:this.isKycGranted?1:2,freezeStatus:null==this.isFrozen?0:this.isFrozen?1:2,automaticAssociation:this.automaticAssociation}}}class TokenRelationshipMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}static _fromProtobuf(e){const t=new TokenRelationshipMap;for(const n of e){const e=TokenId._fromProtobuf(n.tokenId);t._set(e,TokenRelationship._fromProtobuf(n))}return t}_toProtobuf(){const e=[];for(const[t,n]of this)e.push(n._toProtobuf());return e}}class LedgerId{constructor(e){this._ledgerId=e,Object.freeze(this)}static fromString(e){switch(e){case NETNAMES[0]:case"0":return LedgerId.MAINNET;case NETNAMES[1]:case"1":return LedgerId.TESTNET;case NETNAMES[2]:case"2":return LedgerId.PREVIEWNET;case NETNAMES[3]:case"3":return LedgerId.LOCAL_NODE;default:try{let t=decode$8(e);return new LedgerId(t)}catch(e){throw new Error("Default reached for fromString")}}}toString(){if(1!=this._ledgerId.length)return encode$5(this._ledgerId);switch(this._ledgerId[0]){case 0:return NETNAMES[0];case 1:return NETNAMES[1];case 2:return NETNAMES[2];case 3:return NETNAMES[3];default:return encode$5(this._ledgerId)}}static fromBytes(e){return new LedgerId(e)}toBytes(){return this._ledgerId}isMainnet(){return this.toString()==NETNAMES[0]}isTestnet(){return this.toString()==NETNAMES[1]}isPreviewnet(){return this.toString()==NETNAMES[2]}isLocalNode(){return this.toString()==NETNAMES[3]}}const NETNAMES=["mainnet","testnet","previewnet","local-node"];LedgerId.MAINNET=new LedgerId(new Uint8Array([0])),LedgerId.TESTNET=new LedgerId(new Uint8Array([1])),LedgerId.PREVIEWNET=new LedgerId(new Uint8Array([2])),LedgerId.LOCAL_NODE=new LedgerId(new Uint8Array([3]));class AccountInfo{constructor(e){this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.isDeleted=e.isDeleted,this.proxyAccountId=e.proxyAccountId,this.proxyReceived=e.proxyReceived,this.key=e.key,this.balance=e.balance,this.sendRecordThreshold=e.sendRecordThreshold,this.receiveRecordThreshold=e.receiveRecordThreshold,this.isReceiverSignatureRequired=e.isReceiverSignatureRequired,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.liveHashes=e.liveHashes,this.tokenRelationships=e.tokenRelationships,this.accountMemo=e.accountMemo,this.ownedNfts=e.ownedNfts,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.aliasKey=e.aliasKey,this.ledgerId=e.ledgerId,this.hbarAllowances=e.hbarAllowances,this.tokenAllowances=e.tokenAllowances,this.nftAllowances=e.nftAllowances,this.ethereumNonce=e.ethereumNonce,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){let t=null!=e.alias&&e.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(e.alias)):null;t instanceof PublicKey||(t=null);const n=AccountId._fromProtobuf(e.accountID);return new AccountInfo({accountId:n,contractAccountId:null!=e.contractAccountID?e.contractAccountID:null,isDeleted:null!=e.deleted&&e.deleted,key:Key._fromProtobufKey(e.key),balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),sendRecordThreshold:Hbar.fromTinybars(null!=e.generateSendRecordThreshold?e.generateSendRecordThreshold:0),receiveRecordThreshold:Hbar.fromTinybars(null!=e.generateReceiveRecordThreshold?e.generateReceiveRecordThreshold:0),isReceiverSignatureRequired:null!=e.receiverSigRequired&&e.receiverSigRequired,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:null!=e.autoRenewPeriod?new Duration(e.autoRenewPeriod.seconds):new Duration(0),proxyAccountId:null!=e.proxyAccountID&&0!==Long.fromValue(e.proxyAccountID.shardNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.realmNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.accountNum).toInt()?AccountId._fromProtobuf(e.proxyAccountID):null,proxyReceived:Hbar.fromTinybars(null!=e.proxyReceived?e.proxyReceived:0),liveHashes:(null!=e.liveHashes?e.liveHashes:[]).map(e=>LiveHash._fromProtobuf(e)),tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),accountMemo:null!=e.memo?e.memo:"",ownedNfts:e.ownedNfts?e.ownedNfts:Long.ZERO,maxAutomaticTokenAssociations:e.maxAutomaticTokenAssociations?Long.fromNumber(e.maxAutomaticTokenAssociations):Long.ZERO,aliasKey:t,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,hbarAllowances:[],tokenAllowances:[],nftAllowances:[],ethereumNonce:null!=e.ethereumNonce?e.ethereumNonce:null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,deleted:this.isDeleted,proxyAccountID:null!=this.proxyAccountId?this.proxyAccountId._toProtobuf():null,proxyReceived:this.proxyReceived.toTinybars(),key:this.key._toProtobufKey(),balance:this.balance.toTinybars(),generateSendRecordThreshold:this.sendRecordThreshold.toTinybars(),generateReceiveRecordThreshold:this.receiveRecordThreshold.toTinybars(),receiverSigRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:this.autoRenewPeriod._toProtobuf(),liveHashes:this.liveHashes.map(e=>e._toProtobuf()),tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,memo:this.accountMemo,ownedNfts:this.ownedNfts,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toInt(),alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,ethereumNonce:this.ethereumNonce,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null}}static fromBytes(e){return AccountInfo._fromProtobuf(libExports.proto.CryptoGetInfoResponse.AccountInfo.decode(e))}toBytes(){return libExports.proto.CryptoGetInfoResponse.AccountInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{balance:this.balance.toString(),accountId:this.accountId.toString(),contractAccountId:this.contractAccountId,isDeleted:this.isDeleted,proxyAccountId:null!=this.proxyAccountId?this.proxyAccountId.toString():null,proxyReceived:this.proxyReceived.toString(),key:null!=this.key?this.key.toString():null,sendRecordThreshold:this.sendRecordThreshold.toString(),receiveRecordThreshold:this.receiveRecordThreshold.toString(),isReceiverSignatureRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime.toString(),autoRenewPeriod:this.autoRenewPeriod.toString(),accountMemo:this.accountMemo,ownedNfts:this.ownedNfts.toString(),maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toString(),aliasKey:null!=this.aliasKey?this.aliasKey.toString():null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,ethereumNonce:null!=this.ethereumNonce?this.ethereumNonce.toString():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo.toJSON():null}}}class AccountInfoQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetInfo;return new AccountInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.cryptoGetInfo.header}_mapResponse(e,t,n){const r=e.cryptoGetInfo;return Promise.resolve(AccountInfo._fromProtobuf(r.accountInfo))}_onMakeRequest(e){return{cryptoGetInfo:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetInfo",AccountInfoQuery._fromProtobuf);class AccountInfoFlow{static async verifySignature(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransaction(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}static async verifySignatureWithSigner(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransactionWithSigner(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}}class AccountRecordsQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetAccountRecords;return new AccountRecordsQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountRecords(t)}_mapResponseHeader(e){return e.cryptoGetAccountRecords.header}_mapResponse(e,t,n){const r=e.cryptoGetAccountRecords.records;return Promise.resolve(r.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})))}_onMakeRequest(e){return{cryptoGetAccountRecords:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountRecordsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetAccountRecords",AccountRecordsQuery._fromProtobuf);class AccountUpdateTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._key=null,this._receiverSignatureRequired=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._expirationTime=null,this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._aliasKey=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.key&&this.setKey(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoUpdateAccount;return Transaction._fromProtobufTransactions(new AccountUpdateTransaction({accountId:null!=i.accountIDToUpdate?AccountId._fromProtobuf(i.accountIDToUpdate):void 0,key:null!=i.key?Key._fromProtobufKey(i.key):void 0,receiverSignatureRequired:null!=i.receiverSigRequiredWrapper&&Object.hasOwn(i.receiverSigRequiredWrapper,"value")?i.receiverSigRequiredWrapper.value:void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,accountMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0,maxAutomaticTokenAssociations:null!=i.maxAutomaticTokenAssociations&&null!=i.maxAutomaticTokenAssociations.value&&Object.hasOwn(i.maxAutomaticTokenAssociations,"value")?Long.fromNumber(i.maxAutomaticTokenAssociations.value):void 0,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:null!=i.declineReward&&Object.hasOwn(i.declineReward,"value")?i.declineReward.value:void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}clearAccountMemo(){return this._requireNotFrozen(),this._accountMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get aliasKey(){return null}setAliasKey(e){return this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearStakedAccountId(){return this._requireNotFrozen(),this._stakedAccountId=new AccountId(0,0,0),this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}clearStakedNodeId(){return this._requireNotFrozen(),this._stakedNodeId=Long.fromNumber(-1),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.updateAccount(t)}_getTransactionDataCase(){return"cryptoUpdateAccount"}_makeTransactionData(){return{accountIDToUpdate:null!=this._accountId?this._accountId._toProtobuf():null,key:null!=this._key?this._key._toProtobufKey():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,receiverSigRequiredWrapper:null==this._receiverSignatureRequired?null:{value:this._receiverSignatureRequired},memo:null!=this._accountMemo?{value:this._accountMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations.toInt()}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null}}_getLogId(){return`AccountUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoUpdateAccount",AccountUpdateTransaction._fromProtobuf);class FreezeType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FreezeType.UnknownFreezeType:return"UNKNOWN_FREEZE_TYPE";case FreezeType.FreezeOnly:return"FREEZE_ONLY";case FreezeType.PrepareUpgrade:return"PREPARE_UPGRADE";case FreezeType.FreezeUpgrade:return"FREEZE_UPGRADE";case FreezeType.FreezeAbort:return"FREEZE_ABORT";case FreezeType.TelemetryUpgrade:return"TELEMETRY_UPGRADE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FreezeType.UnknownFreezeType;case 1:return FreezeType.FreezeOnly;case 2:return FreezeType.PrepareUpgrade;case 3:return FreezeType.FreezeUpgrade;case 4:return FreezeType.FreezeAbort;case 5:return FreezeType.TelemetryUpgrade;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}FreezeType.UnknownFreezeType=new FreezeType(0),FreezeType.FreezeOnly=new FreezeType(1),FreezeType.PrepareUpgrade=new FreezeType(2),FreezeType.FreezeUpgrade=new FreezeType(3),FreezeType.FreezeAbort=new FreezeType(4),FreezeType.TelemetryUpgrade=new FreezeType(5);class FreezeTransaction extends Transaction{constructor(e={}){super(),this._startTime=null,this._startTimestamp=null,this._endTime=null,this._fileId=null,this._fileHash=null,this._freezeType=null,null!=e.startTime&&this.setStartTime(e.startTime.hour,e.startTime.minute),null!=e.endTime&&this.setEndTime(e.endTime.hour,e.endTime.minute),null!=e.startTimestamp&&this.setStartTimestamp(e.startTimestamp),null!=e.updateFileId&&this.setUpdateFileId(e.updateFileId),null!=e.fileId&&this.setFileId(e.fileId),null!=e.fileHash&&this.setFileHash(e.fileHash),null!=e.freezeType&&this.setFreezeType(e.freezeType)}static _fromProtobuf(e,t,n,r,o){const i=o[0].freeze;return Transaction._fromProtobufTransactions(new FreezeTransaction({startTime:null!=i.startHour&&null!=i.startMin?{hour:i.startHour,minute:i.startMin}:void 0,endTime:null!=i.endHour&&null!=i.endMin?{hour:i.endHour,minute:i.endMin}:void 0,startTimestamp:null!=i.startTime?Timestamp._fromProtobuf(i.startTime):void 0,updateFileId:null!=i.updateFile?FileId._fromProtobuf(i.updateFile):void 0,fileHash:null!=i.fileHash?i.fileHash:void 0,freezeType:null!=i.freezeType?FreezeType._fromCode(i.freezeType):void 0}),e,t,n,r,o)}get startTime(){return null}setStartTime(e,t){if(this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._startTime={hour:Number(t[0]),minute:Number(t[1])}}else this._startTime={hour:e,minute:t};return this}get startTimestamp(){return this._startTimestamp}setStartTimestamp(e){return this._requireNotFrozen(),this._startTimestamp=e,this}get endTime(){return console.warn("`FreezeTransaction.endTime` is deprecated"),this._endTime}setEndTime(e,t){if(console.warn("`FreezeTransaction.endTime` is deprecated"),this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._endTime={hour:Number(t[0]),minute:Number(t[1])}}else this._endTime={hour:e,minute:t};return this}get updateFileId(){return this.fileId}setUpdateFileId(e){return this.setFileId(e)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e,this}get fileHash(){return this._fileHash}setFileHash(e){return this._requireNotFrozen(),this._fileHash="string"==typeof e?decode$8(e):e,this}get freezeType(){return this._freezeType}setFreezeType(e){return this._requireNotFrozen(),this._freezeType=e,this}_getTransactionDataCase(){return"freeze"}_makeTransactionData(){return{startTime:null!=this._startTimestamp?this._startTimestamp._toProtobuf():null,updateFile:null!=this._fileId?this._fileId._toProtobuf():null,fileHash:this._fileHash,freezeType:null!=this._freezeType?this._freezeType.valueOf():null}}_getLogId(){return`FreezeTransaction:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.freeze.freeze(t)}}TRANSACTION_REGISTRY.set("freeze",FreezeTransaction._fromProtobuf);class BatchTransaction extends Transaction{constructor(e){super(),this._batchTransactions=e?.transactions||[]}setInnerTransactions(e){return e.forEach(e=>this._validateTransaction(e)),this._batchTransactions=e,this}addInnerTransaction(e){return this._validateTransaction(e),this._requireNotFrozen(),this._batchTransactions.push(e),this}get innerTransactions(){return this._batchTransactions}get innerTransactionIds(){return Array.isArray(this._batchTransactions)?this._batchTransactions.map(e=>e.transactionId):[]}_makeTransactionData(){if(!Array.isArray(this._batchTransactions))return{transactions:[]};return{transactions:this._batchTransactions.map(e=>libExports.proto.SignedTransaction.encode(e._signedTransactions.get(0)).finish())}}static _fromProtobuf(e,t,n,r,o){const i=o[0],a=i.atomicBatch?.transactions,s=a?.map(e=>libExports.proto.SignedTransaction.decode(e)),c=s?.map(e=>{const t=libExports.proto.TransactionBody.decode(e.bodyBytes),n=t.data;if(!n)throw new Error("Transaction type not found");const r=TRANSACTION_REGISTRY.get(n);if(!r)throw new Error("fromProtobuf not found");return r([],[e],[],[],[t])});return Transaction._fromProtobufTransactions(new BatchTransaction({transactions:c}),e,t,n,r,o)}_getTransactionDataCase(){return"atomicBatch"}_getLogId(){return`AtomicBatch:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.util.atomicBatch(t)}_validateTransaction(e){if(e instanceof BatchTransaction||e instanceof FreezeTransaction)throw new Error("Transaction is not allowed to be added to a batch");if(!e.isFrozen())throw new Error("Transaction must be frozen before being added to a batch");if(!e.batchKey)throw new Error("Transaction must have a batch key")}}TRANSACTION_REGISTRY.set("atomicBatch",BatchTransaction._fromProtobuf);class ContractByteCodeQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetBytecode;return new ContractByteCodeQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractGetBytecode(t)}_mapResponseHeader(e){return e.contractGetBytecodeResponse.header}_mapResponse(e){const t=e.contractGetBytecodeResponse;return Promise.resolve(null!=t.bytecode?t.bytecode:new Uint8Array)}_onMakeRequest(e){return{contractGetBytecode:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractByteCodeQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetBytecode",ContractByteCodeQuery._fromProtobuf);const HEX_CHARS="0123456789abcdef".split(""),KECCAK_PADDING=[1,256,65536,16777216],SHIFT=[0,8,16,24],RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update=(e,t)=>{for(var n,r,o=t.length,i=e.blocks,a=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<o;){if(e.reset)for(e.reset=!1,i[0]=e.block,n=1;n<s+1;++n)i[n]=0;if("string"!=typeof t)for(n=e.start;l<o&&n<a;++l)i[n>>2]|=t[l]<<SHIFT[3&n++];else for(n=e.start;l<o&&n<a;++l)(r=t.charCodeAt(l))<128?i[n>>2]|=r<<SHIFT[3&n++]:r<2048?(i[n>>2]|=(192|r>>6)<<SHIFT[3&n++],i[n>>2]|=(128|63&r)<<SHIFT[3&n++]):r<55296||r>=57344?(i[n>>2]|=(224|r>>12)<<SHIFT[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],i[n>>2]|=(128|63&r)<<SHIFT[3&n++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++l)),i[n>>2]|=(240|r>>18)<<SHIFT[3&n++],i[n>>2]|=(128|r>>12&63)<<SHIFT[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],i[n>>2]|=(128|63&r)<<SHIFT[3&n++]);if(e.lastByteIndex=n,n>=a){for(e.start=n-a,e.block=i[s],n=0;n<s;++n)u[n]^=i[n];f(u),e.reset=!0}else e.start=n}if(i[(n=e.lastByteIndex)>>2]|=KECCAK_PADDING[3&n],e.lastByteIndex===a)for(i[0]=i[s],n=1;n<s+1;++n)i[n]=0;for(i[s-1]|=2147483648,n=0;n<s;++n)u[n]^=i[n];f(u);var d,p="",h=0;for(n=0;h<c;){for(n=0;n<s&&h<c;++n,++h)d=u[n],p+=HEX_CHARS[d>>4&15]+HEX_CHARS[15&d]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15];h%s===0&&(f(u),n=0)}return"0x"+p},f=e=>{var t,n,r,o,i,a,s,c,u,l,d,p,h,f,y,m,g,_,b,I,T,k,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,K,M,H,j,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ie,ae,se,ce,ue;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=i^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(p<<1|h>>>31),n=u^(h<<1|p>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(o<<1|i>>>31),n=d^(i<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,f=e[0],y=e[1],$=e[11]<<4|e[10]>>>28,z=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,w=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,re=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,K=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,T=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,E=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,M=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=f^~m&_,e[1]=y^~g&b,e[10]=w^~v&O,e[11]=A^~E&N,e[20]=B^~x&U,e[21]=L^~F&K,e[30]=q^~$&W,e[31]=V^~z&Y,e[40]=ee^~ne&oe,e[41]=te^~re&ie,e[2]=m^~_&I,e[3]=g^~b&T,e[12]=v^~O&P,e[13]=E^~N&R,e[22]=x^~U&M,e[23]=F^~K&H,e[32]=$^~W&Q,e[33]=z^~Y&X,e[42]=ne^~oe&ae,e[43]=re^~ie&se,e[4]=_^~I&k,e[5]=b^~T&S,e[14]=O^~P&C,e[15]=N^~R&D,e[24]=U^~M&j,e[25]=K^~H&G,e[34]=W^~Q&Z,e[35]=Y^~X&J,e[44]=oe^~ae&ce,e[45]=ie^~se&ue,e[6]=I^~k&f,e[7]=T^~S&y,e[16]=P^~C&w,e[17]=R^~D&A,e[26]=M^~j&B,e[27]=H^~G&L,e[36]=Q^~Z&q,e[37]=X^~J&V,e[46]=ae^~ce&ee,e[47]=se^~ue&te,e[8]=k^~f&m,e[9]=S^~y&g,e[18]=C^~w&v,e[19]=D^~A&E,e[28]=j^~B&x,e[29]=G^~L&F,e[38]=Z^~q&$,e[39]=J^~V&z,e[48]=ce^~ee&ne,e[49]=ue^~te&re,e[0]^=RC[r],e[1]^=RC[r+1]},keccak=e=>t=>{var n;if("0x"===t.slice(0,2)){n=[];for(var r=2,o=t.length;r<o;r+=2)n.push(parseInt(t.slice(r,r+2),16))}else n=t;return update(Keccak(e),n)},keccak256=keccak(256),ArgumentType={uint8:0,int8:1,uint16:2,int16:3,uint24:4,int24:5,uint32:6,int32:7,uint40:8,int40:9,uint48:10,int48:11,uint56:12,int56:13,uint64:14,int64:15,uint72:16,int72:17,uint80:18,int80:19,uint88:20,int88:21,uint96:22,int96:23,uint104:24,int104:25,uint112:26,int112:27,uint120:28,int120:29,uint128:30,int128:31,uint136:32,int136:33,uint144:34,int144:35,uint152:36,int152:37,uint160:38,int160:39,uint168:40,int168:41,uint176:42,int176:43,uint184:44,int184:45,uint192:46,int192:47,uint200:48,int200:49,uint208:50,int208:51,uint216:52,int216:53,uint224:54,int224:55,uint232:56,int232:57,uint240:58,int240:59,uint248:60,int248:61,uint256:62,int256:63,string:64,bool:65,bytes:66,bytes32:67,address:68,func:69};class ContractFunctionSelector{constructor(e){this.name=null,this._params="",this._paramTypes=[],null!=e&&(this._name=e)}addString(){return this._addParam({ty:ArgumentType.string,array:!1})}addStringArray(){return this._addParam({ty:ArgumentType.string,array:!0})}addBytes(){return this._addParam({ty:ArgumentType.bytes,array:!1})}addBytes32(){return this._addParam({ty:ArgumentType.bytes32,array:!1})}addBytesArray(){return this._addParam({ty:ArgumentType.bytes,array:!0})}addBytes32Array(){return this._addParam({ty:ArgumentType.bytes32,array:!0})}addInt8(){return this._addParam({ty:ArgumentType.int8,array:!1})}addUint8(){return this._addParam({ty:ArgumentType.uint8,array:!1})}addInt16(){return this._addParam({ty:ArgumentType.int16,array:!1})}addUint16(){return this._addParam({ty:ArgumentType.uint16,array:!1})}addInt24(){return this._addParam({ty:ArgumentType.int24,array:!1})}addUint24(){return this._addParam({ty:ArgumentType.uint24,array:!1})}addInt32(){return this._addParam({ty:ArgumentType.int32,array:!1})}addUint32(){return this._addParam({ty:ArgumentType.uint32,array:!1})}addInt40(){return this._addParam({ty:ArgumentType.int40,array:!1})}addUint40(){return this._addParam({ty:ArgumentType.uint40,array:!1})}addInt48(){return this._addParam({ty:ArgumentType.int48,array:!1})}addUint48(){return this._addParam({ty:ArgumentType.uint48,array:!1})}addInt56(){return this._addParam({ty:ArgumentType.int56,array:!1})}addUint56(){return this._addParam({ty:ArgumentType.uint56,array:!1})}addInt64(){return this._addParam({ty:ArgumentType.int64,array:!1})}addUint64(){return this._addParam({ty:ArgumentType.uint64,array:!1})}addInt72(){return this._addParam({ty:ArgumentType.int72,array:!1})}addUint72(){return this._addParam({ty:ArgumentType.uint72,array:!1})}addInt80(){return this._addParam({ty:ArgumentType.int80,array:!1})}addUint80(){return this._addParam({ty:ArgumentType.uint80,array:!1})}addInt88(){return this._addParam({ty:ArgumentType.int88,array:!1})}addUint88(){return this._addParam({ty:ArgumentType.uint88,array:!1})}addInt96(){return this._addParam({ty:ArgumentType.int96,array:!1})}addUint96(){return this._addParam({ty:ArgumentType.uint96,array:!1})}addInt104(){return this._addParam({ty:ArgumentType.int104,array:!1})}addUint104(){return this._addParam({ty:ArgumentType.uint104,array:!1})}addInt112(){return this._addParam({ty:ArgumentType.int112,array:!1})}addUint112(){return this._addParam({ty:ArgumentType.uint112,array:!1})}addInt120(){return this._addParam({ty:ArgumentType.int120,array:!1})}addUint120(){return this._addParam({ty:ArgumentType.uint120,array:!1})}addInt128(){return this._addParam({ty:ArgumentType.int128,array:!1})}addUint128(){return this._addParam({ty:ArgumentType.uint128,array:!1})}addInt136(){return this._addParam({ty:ArgumentType.int136,array:!1})}addUint136(){return this._addParam({ty:ArgumentType.uint136,array:!1})}addInt144(){return this._addParam({ty:ArgumentType.int144,array:!1})}addUint144(){return this._addParam({ty:ArgumentType.uint144,array:!1})}addInt152(){return this._addParam({ty:ArgumentType.int152,array:!1})}addUint152(){return this._addParam({ty:ArgumentType.uint152,array:!1})}addInt160(){return this._addParam({ty:ArgumentType.int160,array:!1})}addUint160(){return this._addParam({ty:ArgumentType.uint160,array:!1})}addInt168(){return this._addParam({ty:ArgumentType.int168,array:!1})}addUint168(){return this._addParam({ty:ArgumentType.uint168,array:!1})}addInt176(){return this._addParam({ty:ArgumentType.int176,array:!1})}addUint176(){return this._addParam({ty:ArgumentType.uint176,array:!1})}addInt184(){return this._addParam({ty:ArgumentType.int184,array:!1})}addUint184(){return this._addParam({ty:ArgumentType.uint184,array:!1})}addInt192(){return this._addParam({ty:ArgumentType.int192,array:!1})}addUint192(){return this._addParam({ty:ArgumentType.uint192,array:!1})}addInt200(){return this._addParam({ty:ArgumentType.int200,array:!1})}addUint200(){return this._addParam({ty:ArgumentType.uint200,array:!1})}addInt208(){return this._addParam({ty:ArgumentType.int208,array:!1})}addUint208(){return this._addParam({ty:ArgumentType.uint208,array:!1})}addInt216(){return this._addParam({ty:ArgumentType.int216,array:!1})}addUint216(){return this._addParam({ty:ArgumentType.uint216,array:!1})}addInt224(){return this._addParam({ty:ArgumentType.int224,array:!1})}addUint224(){return this._addParam({ty:ArgumentType.uint224,array:!1})}addInt232(){return this._addParam({ty:ArgumentType.int232,array:!1})}addUint232(){return this._addParam({ty:ArgumentType.uint232,array:!1})}addInt240(){return this._addParam({ty:ArgumentType.int240,array:!1})}addUint240(){return this._addParam({ty:ArgumentType.uint240,array:!1})}addInt248(){return this._addParam({ty:ArgumentType.int248,array:!1})}addUint248(){return this._addParam({ty:ArgumentType.uint248,array:!1})}addInt256(){return this._addParam({ty:ArgumentType.int256,array:!1})}addUint256(){return this._addParam({ty:ArgumentType.uint256,array:!1})}addInt8Array(){return this._addParam({ty:ArgumentType.int8,array:!0})}addUint8Array(){return this._addParam({ty:ArgumentType.uint8,array:!0})}addInt16Array(){return this._addParam({ty:ArgumentType.int16,array:!0})}addUint16Array(){return this._addParam({ty:ArgumentType.uint16,array:!0})}addInt24Array(){return this._addParam({ty:ArgumentType.int24,array:!0})}addUint24Array(){return this._addParam({ty:ArgumentType.uint24,array:!0})}addInt32Array(){return this._addParam({ty:ArgumentType.int32,array:!0})}addUint32Array(){return this._addParam({ty:ArgumentType.uint32,array:!0})}addInt40Array(){return this._addParam({ty:ArgumentType.int40,array:!0})}addUint40Array(){return this._addParam({ty:ArgumentType.uint40,array:!0})}addInt48Array(){return this._addParam({ty:ArgumentType.int48,array:!0})}addUint48Array(){return this._addParam({ty:ArgumentType.uint48,array:!0})}addInt56Array(){return this._addParam({ty:ArgumentType.int56,array:!0})}addUint56Array(){return this._addParam({ty:ArgumentType.uint56,array:!0})}addInt64Array(){return this._addParam({ty:ArgumentType.int64,array:!0})}addUint64Array(){return this._addParam({ty:ArgumentType.uint64,array:!0})}addInt72Array(){return this._addParam({ty:ArgumentType.int72,array:!0})}addUint72Array(){return this._addParam({ty:ArgumentType.uint72,array:!0})}addInt80Array(){return this._addParam({ty:ArgumentType.int80,array:!0})}addUint80Array(){return this._addParam({ty:ArgumentType.uint80,array:!0})}addInt88Array(){return this._addParam({ty:ArgumentType.int88,array:!0})}addUint88Array(){return this._addParam({ty:ArgumentType.uint88,array:!0})}addInt96Array(){return this._addParam({ty:ArgumentType.int96,array:!0})}addUint96Array(){return this._addParam({ty:ArgumentType.uint96,array:!0})}addInt104Array(){return this._addParam({ty:ArgumentType.int104,array:!0})}addUint104Array(){return this._addParam({ty:ArgumentType.uint104,array:!0})}addInt112Array(){return this._addParam({ty:ArgumentType.int112,array:!0})}addUint112Array(){return this._addParam({ty:ArgumentType.uint112,array:!0})}addInt120Array(){return this._addParam({ty:ArgumentType.int120,array:!0})}addUint120Array(){return this._addParam({ty:ArgumentType.uint120,array:!0})}addInt128Array(){return this._addParam({ty:ArgumentType.int128,array:!0})}addUint128Array(){return this._addParam({ty:ArgumentType.uint128,array:!0})}addInt136Array(){return this._addParam({ty:ArgumentType.int136,array:!0})}addUint136Array(){return this._addParam({ty:ArgumentType.uint136,array:!0})}addInt144Array(){return this._addParam({ty:ArgumentType.int144,array:!0})}addUint144Array(){return this._addParam({ty:ArgumentType.uint144,array:!0})}addInt152Array(){return this._addParam({ty:ArgumentType.int152,array:!0})}addUint152Array(){return this._addParam({ty:ArgumentType.uint152,array:!0})}addInt160Array(){return this._addParam({ty:ArgumentType.int160,array:!0})}addUint160Array(){return this._addParam({ty:ArgumentType.uint160,array:!0})}addInt168Array(){return this._addParam({ty:ArgumentType.int168,array:!0})}addUint168Array(){return this._addParam({ty:ArgumentType.uint168,array:!0})}addInt176Array(){return this._addParam({ty:ArgumentType.int176,array:!0})}addUint176Array(){return this._addParam({ty:ArgumentType.uint176,array:!0})}addInt184Array(){return this._addParam({ty:ArgumentType.int184,array:!0})}addUint184Array(){return this._addParam({ty:ArgumentType.uint184,array:!0})}addInt192Array(){return this._addParam({ty:ArgumentType.int192,array:!0})}addUint192Array(){return this._addParam({ty:ArgumentType.uint192,array:!0})}addInt200Array(){return this._addParam({ty:ArgumentType.int200,array:!0})}addUint200Array(){return this._addParam({ty:ArgumentType.uint200,array:!0})}addInt208Array(){return this._addParam({ty:ArgumentType.int208,array:!0})}addUint208Array(){return this._addParam({ty:ArgumentType.uint208,array:!0})}addInt216Array(){return this._addParam({ty:ArgumentType.int216,array:!0})}addUint216Array(){return this._addParam({ty:ArgumentType.uint216,array:!0})}addInt224Array(){return this._addParam({ty:ArgumentType.int224,array:!0})}addUint224Array(){return this._addParam({ty:ArgumentType.uint224,array:!0})}addInt232Array(){return this._addParam({ty:ArgumentType.int232,array:!0})}addUint232Array(){return this._addParam({ty:ArgumentType.uint232,array:!0})}addInt240Array(){return this._addParam({ty:ArgumentType.int240,array:!0})}addUint240Array(){return this._addParam({ty:ArgumentType.uint240,array:!0})}addInt248Array(){return this._addParam({ty:ArgumentType.int248,array:!0})}addUint248Array(){return this._addParam({ty:ArgumentType.uint248,array:!0})}addInt256Array(){return this._addParam({ty:ArgumentType.int256,array:!0})}addUint256Array(){return this._addParam({ty:ArgumentType.uint256,array:!0})}addBool(){return this._addParam({ty:ArgumentType.bool,array:!1})}addAddress(){return this._addParam({ty:ArgumentType.address,array:!1})}addAddressArray(){return this._addParam({ty:ArgumentType.address,array:!0})}addFunction(){return this._addParam({ty:ArgumentType.func,array:!1})}_addParam(e){return this._paramTypes.length>0&&(this._params+=","),this._params+=solidityTypeToString(e),this._paramTypes.push(e),this}_build(e){if(null!=e)this._name=e;else if(null==this._name)throw new Error("`name` required for ContractFunctionSelector");const t=encode$5(encode$1(this.toString()));return decode$8(keccak256(`0x${t}`)).slice(0,4)}toString(){return`${null!=this._name?this._name.toString():""}(${this._params})`}}function solidityTypeToString(e){let t="";switch(e.ty){case ArgumentType.uint8:t="uint8";break;case ArgumentType.int8:t="int8";break;case ArgumentType.uint16:t="uint16";break;case ArgumentType.int16:t="int16";break;case ArgumentType.uint24:t="uint24";break;case ArgumentType.int24:t="int24";break;case ArgumentType.uint32:t="uint32";break;case ArgumentType.int32:t="int32";break;case ArgumentType.uint40:t="uint40";break;case ArgumentType.int40:t="int40";break;case ArgumentType.uint48:t="uint48";break;case ArgumentType.int48:t="int48";break;case ArgumentType.uint56:t="uint56";break;case ArgumentType.int56:t="int56";break;case ArgumentType.uint64:t="uint64";break;case ArgumentType.int64:t="int64";break;case ArgumentType.uint72:t="uint72";break;case ArgumentType.int72:t="int72";break;case ArgumentType.uint80:t="uint80";break;case ArgumentType.int80:t="int80";break;case ArgumentType.uint88:t="uint88";break;case ArgumentType.int88:t="int88";break;case ArgumentType.uint96:t="uint96";break;case ArgumentType.int96:t="int96";break;case ArgumentType.uint104:t="uint104";break;case ArgumentType.int104:t="int104";break;case ArgumentType.uint112:t="uint112";break;case ArgumentType.int112:t="int112";break;case ArgumentType.uint120:t="uint120";break;case ArgumentType.int120:t="int120";break;case ArgumentType.uint128:t="uint128";break;case ArgumentType.int128:t="int128";break;case ArgumentType.uint136:t="uint136";break;case ArgumentType.int136:t="int136";break;case ArgumentType.uint144:t="uint144";break;case ArgumentType.int144:t="int144";break;case ArgumentType.uint152:t="uint152";break;case ArgumentType.int152:t="int152";break;case ArgumentType.uint160:t="uint160";break;case ArgumentType.int160:t="int160";break;case ArgumentType.uint168:t="uint168";break;case ArgumentType.int168:t="int168";break;case ArgumentType.uint176:t="uint176";break;case ArgumentType.int176:t="int176";break;case ArgumentType.uint184:t="uint184";break;case ArgumentType.int184:t="int184";break;case ArgumentType.uint192:t="uint192";break;case ArgumentType.int192:t="int192";break;case ArgumentType.uint200:t="uint200";break;case ArgumentType.int200:t="int200";break;case ArgumentType.uint208:t="uint208";break;case ArgumentType.int208:t="int208";break;case ArgumentType.uint216:t="uint216";break;case ArgumentType.int216:t="int216";break;case ArgumentType.uint224:t="uint224";break;case ArgumentType.int224:t="int224";break;case ArgumentType.uint232:t="uint232";break;case ArgumentType.int232:t="int232";break;case ArgumentType.uint240:t="uint240";break;case ArgumentType.int240:t="int240";break;case ArgumentType.uint248:t="uint248";break;case ArgumentType.int248:t="int248";break;case ArgumentType.uint256:t="uint256";break;case ArgumentType.int256:t="int256";break;case ArgumentType.string:t="string";break;case ArgumentType.bool:t="bool";break;case ArgumentType.bytes:t="bytes";break;case ArgumentType.bytes32:t="bytes32";break;case ArgumentType.address:t="address";break;case ArgumentType.func:t="function";break;default:t=""}return e.array&&(t+="[]"),t}class ContractFunctionParameters{constructor(){this._selector=new ContractFunctionSelector,this._arguments=[]}addString(e){return this._selector.addString(),this._addParam(e,!0)}addStringArray(e){return this._selector.addStringArray(),this._addParam(e,!0)}addBytes(e){return this._selector.addBytes(),this._addParam(e,!0)}addBytes32(e){if(32!==e.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${e.length}`);return this._selector.addBytes32(),this._addParam(e,!1)}addBytesArray(e){return this._selector.addBytesArray(),this._addParam(e,!0)}addBytes32Array(e){for(const[t,n]of e.entries())if(32!==n.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${n.length}`);return this._selector.addBytes32Array(),this._addParam(e,!0)}addBool(e){return this._selector.addBool(),this._addParam(e,!1)}addInt8(e){return this._selector.addInt8(),this._addParam(convertToBigNumber(e),!1)}addUint8(e){return this._selector.addUint8(),this._addParam(convertToBigNumber(e),!1)}addInt16(e){return this._selector.addInt16(),this._addParam(convertToBigNumber(e),!1)}addUint16(e){return this._selector.addUint16(),this._addParam(convertToBigNumber(e),!1)}addInt24(e){return this._selector.addInt24(),this._addParam(convertToBigNumber(e),!1)}addUint24(e){return this._selector.addUint24(),this._addParam(convertToBigNumber(e),!1)}addInt32(e){return this._selector.addInt32(),this._addParam(convertToBigNumber(e),!1)}addUint32(e){return this._selector.addUint32(),this._addParam(convertToBigNumber(e),!1)}addInt40(e){return this._selector.addInt40(),this._addParam(convertToBigNumber(e),!1)}addUint40(e){return this._selector.addUint40(),this._addParam(convertToBigNumber(e),!1)}addInt48(e){return this._selector.addInt48(),this._addParam(convertToBigNumber(e),!1)}addUint48(e){return this._selector.addUint48(),this._addParam(convertToBigNumber(e),!1)}addInt56(e){return this._selector.addInt56(),this._addParam(convertToBigNumber(e),!1)}addUint56(e){return this._selector.addUint56(),this._addParam(convertToBigNumber(e),!1)}addInt64(e){return this._selector.addInt64(),this._addParam(convertToBigNumber(e),!1)}addUint64(e){return this._selector.addUint64(),this._addParam(convertToBigNumber(e),!1)}addInt72(e){return this._selector.addInt72(),this._addParam(convertToBigNumber(e),!1)}addUint72(e){return this._selector.addUint72(),this._addParam(convertToBigNumber(e),!1)}addInt80(e){return this._selector.addInt80(),this._addParam(convertToBigNumber(e),!1)}addUint80(e){return this._selector.addUint80(),this._addParam(convertToBigNumber(e),!1)}addInt88(e){return this._selector.addInt88(),this._addParam(convertToBigNumber(e),!1)}addUint88(e){return this._selector.addUint88(),this._addParam(convertToBigNumber(e),!1)}addInt96(e){return this._selector.addInt96(),this._addParam(convertToBigNumber(e),!1)}addUint96(e){return this._selector.addUint96(),this._addParam(convertToBigNumber(e),!1)}addInt104(e){return this._selector.addInt104(),this._addParam(convertToBigNumber(e),!1)}addUint104(e){return this._selector.addUint104(),this._addParam(convertToBigNumber(e),!1)}addInt112(e){return this._selector.addInt112(),this._addParam(convertToBigNumber(e),!1)}addUint112(e){return this._selector.addUint112(),this._addParam(convertToBigNumber(e),!1)}addInt120(e){return this._selector.addInt120(),this._addParam(convertToBigNumber(e),!1)}addUint120(e){return this._selector.addUint120(),this._addParam(convertToBigNumber(e),!1)}addInt128(e){return this._selector.addInt128(),this._addParam(convertToBigNumber(e),!1)}addUint128(e){return this._selector.addUint128(),this._addParam(convertToBigNumber(e),!1)}addInt136(e){return this._selector.addInt136(),this._addParam(convertToBigNumber(e),!1)}addUint136(e){return this._selector.addUint136(),this._addParam(convertToBigNumber(e),!1)}addInt144(e){return this._selector.addInt144(),this._addParam(convertToBigNumber(e),!1)}addUint144(e){return this._selector.addUint144(),this._addParam(convertToBigNumber(e),!1)}addInt152(e){return this._selector.addInt152(),this._addParam(convertToBigNumber(e),!1)}addUint152(e){return this._selector.addUint152(),this._addParam(convertToBigNumber(e),!1)}addInt160(e){return this._selector.addInt160(),this._addParam(convertToBigNumber(e),!1)}addUint160(e){return this._selector.addUint160(),this._addParam(convertToBigNumber(e),!1)}addInt168(e){return this._selector.addInt168(),this._addParam(convertToBigNumber(e),!1)}addUint168(e){return this._selector.addUint168(),this._addParam(convertToBigNumber(e),!1)}addInt176(e){return this._selector.addInt176(),this._addParam(convertToBigNumber(e),!1)}addUint176(e){return this._selector.addUint176(),this._addParam(convertToBigNumber(e),!1)}addInt184(e){return this._selector.addInt184(),this._addParam(convertToBigNumber(e),!1)}addUint184(e){return this._selector.addUint184(),this._addParam(convertToBigNumber(e),!1)}addInt192(e){return this._selector.addInt192(),this._addParam(convertToBigNumber(e),!1)}addUint192(e){return this._selector.addUint192(),this._addParam(convertToBigNumber(e),!1)}addInt200(e){return this._selector.addInt200(),this._addParam(convertToBigNumber(e),!1)}addUint200(e){return this._selector.addUint200(),this._addParam(convertToBigNumber(e),!1)}addInt208(e){return this._selector.addInt208(),this._addParam(convertToBigNumber(e),!1)}addUint208(e){return this._selector.addUint208(),this._addParam(convertToBigNumber(e),!1)}addInt216(e){return this._selector.addInt216(),this._addParam(convertToBigNumber(e),!1)}addUint216(e){return this._selector.addUint216(),this._addParam(convertToBigNumber(e),!1)}addInt224(e){return this._selector.addInt224(),this._addParam(convertToBigNumber(e),!1)}addUint224(e){return this._selector.addUint224(),this._addParam(convertToBigNumber(e),!1)}addInt232(e){return this._selector.addInt232(),this._addParam(convertToBigNumber(e),!1)}addUint232(e){return this._selector.addUint232(),this._addParam(convertToBigNumber(e),!1)}addInt240(e){return this._selector.addInt240(),this._addParam(convertToBigNumber(e),!1)}addUint240(e){return this._selector.addUint240(),this._addParam(convertToBigNumber(e),!1)}addInt248(e){return this._selector.addInt248(),this._addParam(convertToBigNumber(e),!1)}addUint248(e){return this._selector.addUint248(),this._addParam(convertToBigNumber(e),!1)}addInt256(e){return this._selector.addInt256(),this._addParam(convertToBigNumber(e),!1)}addUint256(e){return this._selector.addUint256(),this._addParam(convertToBigNumber(e),!1)}addInt8Array(e){return this._selector.addInt8Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint8Array(e){return this._selector.addUint8Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt16Array(e){return this._selector.addInt16Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint16Array(e){return this._selector.addUint16Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt24Array(e){return this._selector.addInt24Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint24Array(e){return this._selector.addUint24Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt32Array(e){return this._selector.addInt32Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint32Array(e){return this._selector.addUint32Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt40Array(e){return this._selector.addInt40Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint40Array(e){return this._selector.addUint40Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt48Array(e){return this._selector.addInt48Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint48Array(e){return this._selector.addUint48Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt56Array(e){return this._selector.addInt56Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint56Array(e){return this._selector.addUint56Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt64Array(e){return this._selector.addInt64Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint64Array(e){return this._selector.addUint64Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt72Array(e){return this._selector.addInt72Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint72Array(e){return this._selector.addUint72Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt80Array(e){return this._selector.addInt80Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint80Array(e){return this._selector.addUint80Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt88Array(e){return this._selector.addInt88Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint88Array(e){return this._selector.addUint88Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt96Array(e){return this._selector.addInt96Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint96Array(e){return this._selector.addUint96Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt104Array(e){return this._selector.addInt104Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint104Array(e){return this._selector.addUint104Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt112Array(e){return this._selector.addInt112Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint112Array(e){return this._selector.addUint112Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt120Array(e){return this._selector.addInt120Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint120Array(e){return this._selector.addUint120Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt128Array(e){return this._selector.addInt128Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint128Array(e){return this._selector.addUint128Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt136Array(e){return this._selector.addInt136Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint136Array(e){return this._selector.addUint136Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt144Array(e){return this._selector.addInt144Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint144Array(e){return this._selector.addUint144Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt152Array(e){return this._selector.addInt152Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint152Array(e){return this._selector.addUint152Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt160Array(e){return this._selector.addInt160Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint160Array(e){return this._selector.addUint160Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt168Array(e){return this._selector.addInt168Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint168Array(e){return this._selector.addUint168Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt176Array(e){return this._selector.addInt176Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint176Array(e){return this._selector.addUint176Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt184Array(e){return this._selector.addInt184Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint184Array(e){return this._selector.addUint184Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt192Array(e){return this._selector.addInt192Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint192Array(e){return this._selector.addUint192Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt200Array(e){return this._selector.addInt200Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint200Array(e){return this._selector.addUint200Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt208Array(e){return this._selector.addInt208Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint208Array(e){return this._selector.addUint208Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt216Array(e){return this._selector.addInt216Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint216Array(e){return this._selector.addUint216Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt224Array(e){return this._selector.addInt224Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint224Array(e){return this._selector.addUint224Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt232Array(e){return this._selector.addInt232Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint232Array(e){return this._selector.addUint232Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt240Array(e){return this._selector.addInt240Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint240Array(e){return this._selector.addUint240Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt248Array(e){return this._selector.addInt248Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint248Array(e){return this._selector.addUint248Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt256Array(e){return this._selector.addInt256Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint256Array(e){return this._selector.addUint256Array(),this._addParam(convertToBigNumberArray(e),!0)}addAddress(e){let t;if("string"==typeof e){if(40!==e.length&&42!==e.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");t=e}else t=e.toString();const n=40===t.length?decode$8(t):decode$8(t.substring(2));return this._selector.addAddress(),this._addParam(n,!1)}addAddressArray(e){const t=[];for(const[n,r]of e.entries()){let e;if("string"==typeof r){if(40!==r.length&&42!==r.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");e=r}else e=r.toString();const n=40===e.length?decode$8(e):decode$8(e.substring(2));t.push(n)}return this._selector.addAddressArray(),this._addParam(t,!0)}addFunction(e,t){const n=decode$8(e),r=t._build();if(20!==n.length)throw new Error("`function` type requires parameter `address` to be exactly 20 bytes");this._selector.addFunction();const o=new Uint8Array(24);return o.set(n,0),o.set(r,20),this._addParam(o,!1)}_addParam(e,t){const n=this._selector._paramTypes.length-1,r=argumentToBytes(e,this._selector._paramTypes[n]);return this._arguments.push({dynamic:t,value:r}),this}_build(e){const t=null!=e,n=t?4:0,r=0===this._arguments.length?n:32*this._arguments.length+this._arguments.map(e=>e.dynamic?e.value.length:0).reduce((e,t)=>e+t)+n,o=new Uint8Array(r);t&&o.set(this._selector._build(e),0);let i=32*this._arguments.length;for(const[e,{dynamic:t,value:r}]of this._arguments.entries())if(t){const t=safeView(o,n+32*e+28);t.setUint32(0,i),o.set(r,t.getUint32(0)+n),i+=r.length}else o.set(r,n+32*e);return o}}function argumentToBytes(e,t){let n,r=new Uint8Array(32),o=safeView(r);if(t.array){if(!Array.isArray(e))throw new TypeError("SolidityType indicates type is array, but parameter is not an array");const n=[];for(const[r,o]of e.entries()){const e=argumentToBytes(o,{ty:t.ty,array:!1});n.push(e)}const i=n.map(e=>e.length).reduce((e,t)=>e+t,0);switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r=new Uint8Array(i+32);break;case ArgumentType.bytes:case ArgumentType.string:r=new Uint8Array(32*n.length+i+32);break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}o=safeView(r,28),o.setUint32(0,n.length);let a=32*n.length;for(const[e,o]of n.entries())switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r.set(o,32*e+32);break;case ArgumentType.bytes:case ArgumentType.string:const n=safeView(r,32*(e+1)+28);n.setUint32(0,a),r.set(o,n.getUint32(0)+32),a+=o.length;break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}return r}switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.int256:case ArgumentType.uint256:{let n=e.toString(16);n=e>0||0==e?"0x"+n:n.slice(0,1)+"0x"+n.slice(1);return arrayify(defaultAbiCoder.encode([solidityTypeToString(t)],[n]))}case ArgumentType.address:return r.set(e,12),r;case ArgumentType.bool:return r[31]=e?1:0,r;case ArgumentType.func:return r.set(e,8),r;case ArgumentType.bytes32:return r.set(e,0),r;case ArgumentType.bytes:case ArgumentType.string:return n=e instanceof Uint8Array?e:encode$1(e),r=Math.floor(n.length/32)>=0?0!==Math.floor(n.length%32)?new Uint8Array(32*(Math.floor(n.length/32)+1)+32):new Uint8Array(32*Math.floor(n.length/32)+32):new Uint8Array(64),r.set(n,32),o=safeView(r,28),o.setUint32(0,n.length),r;default:throw new Error(`Unsupported argument type: ${t.toString()}`)}}class ContractCallQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId),this._gas=null,null!=e.gas&&this.setGas(e.gas),this._functionParameters=null,null!=e.functionParameters&&(e.functionParameters instanceof Uint8Array?this.setFunctionParameters(e.functionParameters):this.setFunction(e.functionParameters.name,e.functionParameters.parameters)),this._maxResultSize=null,null!=e.maxResultSize&&this.setMaxResultSize(e.maxResultSize),this._senderAccountId=null,null!=e.senderAccountId&&this.setSenderAccountId(e.senderAccountId)}static _fromProtobuf(e){const t=e.contractCallLocal;return new ContractCallQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0,gas:null!=t.gas?t.gas:void 0,functionParameters:null!=t.functionParameters?t.functionParameters:void 0,maxResultSize:null!=t.maxResultSize?t.maxResultSize:void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){return this._gas=e instanceof Long?e:Long.fromValue(e),this}get senderAccountId(){return this._senderAccountId}setSenderAccountId(e){return this._senderAccountId="string"==typeof e?AccountId.fromString(e):e,this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._functionParameters=e,this}setFunction(e,t){return this._functionParameters=(null!=t?t:new ContractFunctionParameters)._build(e),this}setMaxResultSize(e){return this._maxResultSize=e instanceof Long?e:Long.fromValue(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);if(!t.contractCallLocal.functionResult)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const i=this._mapResponseSync(t);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:i})}_execute(e,t){return e.smartContract.contractCallLocalMethod(t)}_mapResponseHeader(e){return e.contractCallLocal.header}_mapResponse(e){const t=e.contractCallLocal;return Promise.resolve(ContractFunctionResult._fromProtobuf(t.functionResult,!1))}_mapResponseSync(e){const t=e.contractCallLocal;return ContractFunctionResult._fromProtobuf(t.functionResult,!1)}_onMakeRequest(e){return{contractCallLocal:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,maxResultSize:this._maxResultSize,functionParameters:this._functionParameters,senderId:null!=this._senderAccountId?this._senderAccountId._toProtobuf():null}}}_getLogId(){return`ContractCallQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractCallLocal",ContractCallQuery._fromProtobuf);class FileCreateTransaction extends Transaction{constructor(e={}){super(),this._keys=null,this._expirationTime=new Timestamp(0,0).plusNanos(Long.fromNumber(Date.now()).mul(1e6).add(DEFAULT_AUTO_RENEW_PERIOD.mul(1e9))),this._contents=null,this._fileMemo=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileCreate;return Transaction._fromProtobufTransactions(new FileCreateTransaction({keys:null!=i.keys&&null!=i.keys.keys?i.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,contents:null!=i.contents?i.contents:void 0,fileMemo:null!=i.memo?i.memo:void 0}),e,t,n,r,o)}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode$1(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}_execute(e,t){return e.file.createFile(t)}_getTransactionDataCase(){return"fileCreate"}_makeTransactionData(){return{keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:this._expirationTime._toProtobuf(),contents:this._contents,memo:this._fileMemo}}_getLogId(){return`FileCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileCreate",FileCreateTransaction._fromProtobuf);class FileAppendTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contents=null,this._maxChunks=20,this._chunkSize=4096,this._chunkInterval=10,this._defaultMaxTransactionFee=new Hbar(5),null!=e.fileId&&this.setFileId(e.fileId),null!=e.contents&&this.setContents(e.contents),null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),null!=e.chunkInterval&&this.setChunkInterval(e.chunkInterval),this._transactionIds=new List}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileAppend;let a;const s=r.length>0?r.length:1;for(let e=0;e<o.length;e+=s){const t=o[e].fileAppend;if(null==t.contents)break;if(null==a){a=new Uint8Array(t.contents);continue}const n=new Uint8Array(a.length+t.contents.length);n.set(a,0),n.set(t.contents,a.length),a=n}const c=i.contents?.length||void 0,u=o.length?o.length/s:void 0;let l;if(n.length>1){const e=n[0].validStart,t=n[1].validStart;e&&t&&(l=t.nanos.sub(e.nanos).toNumber())}return Transaction._fromProtobufTransactions(new FileAppendTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,contents:a,chunkSize:c,maxChunks:u,chunkInterval:l}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}getRequiredChunks(){if(null==this._contents)return 1;return Math.ceil(this._contents.length/this._chunkSize)}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode$1(e),this}get maxChunks(){return this._maxChunks}setMaxChunks(e){if(e<=0)throw new Error("Max chunks must be greater than 0");return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}setChunkSize(e){if(e<=0)throw new Error("Chunk size must be greater than 0");return this._chunkSize=e,this}get chunkInterval(){return this._chunkInterval}setChunkInterval(e){return this._chunkInterval=e,this}freezeWith(e){if(super.freezeWith(e),null==this._contents)return this;let t=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){this._transactionIds.push(t),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));t=new TransactionId(t.accountId,new Timestamp(t.validStart.seconds,t.validStart.nanos.add(this._chunkInterval)))}return this._transactionIds.advance(),this._transactionIds.setLocked(),this}schedule(){if(this._requireNotFrozen(),null!=this._contents&&this._contents.length>this._chunkSize)throw new Error(`cannot schedule \`FileAppendTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot execute \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let i=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now(),n=await super.execute(e,i);null!=i&&(i=Date.now()-t),await n.getReceipt(e),o.push(n)}return o}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.appendContent(t)}_getTransactionDataCase(){return"fileAppend"}_buildIncompleteTransactions(){const e=AccountId.fromString("0.0.0"),t=this.transactionId?.accountId||e,n=this.transactionId?.validStart||Timestamp.fromDate(new Date);if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){let r=TransactionId.withValidStart(t,n.plusNanos(this._chunkInterval*e));if(this._transactionIds.push(r),this._transactionIds.advance(),0===this._nodeAccountIds.list.length)this._transactions.push(this._makeSignedTransaction(null));else for(const e of this._nodeAccountIds.list)this._transactions.push(this._makeSignedTransaction(e))}this._transactionIds.advance(),this._transactionIds.setLocked()}_buildAllTransactions(){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}_getLogId(){return`FileAppendTransaction:${this._transactionIds.current.validStart.toString()}`}_makeTransactionData(){const e=null!=this._contents?this._contents.length:0,t=this._transactionIds.index*this._chunkSize,n=Math.min(t+this._chunkSize,e);return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contents:null!=this._contents?this._contents.slice(t,n):null}}}TRANSACTION_REGISTRY.set("fileAppend",FileAppendTransaction._fromProtobuf);class FileDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileDelete;return Transaction._fromProtobufTransactions(new FileDeleteTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.deleteFile(t)}_getTransactionDataCase(){return"fileDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null}}_getLogId(){return`FileDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileDelete",FileDeleteTransaction._fromProtobuf);class ContractCreateTransaction extends Transaction{constructor(e={}){super(),this._bytecodeFileId=null,this._bytecode=null,this._adminKey=null,this._gas=null,this._initialBalance=null,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._constructorParameters=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._defaultMaxTransactionFee=new Hbar(20),this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._autoRenewAccountId=null,null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.bytecode&&this.setBytecode(e.bytecode),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.gas&&this.setGas(e.gas),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.constructorParameters&&this.setConstructorParameters(e.constructorParameters),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractCreateInstance;return Transaction._fromProtobufTransactions(new ContractCreateTransaction({bytecodeFileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,gas:null!=i.gas?i.gas:void 0,initialBalance:null!=i.initialBalance?Hbar.fromTinybars(i.initialBalance):void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,constructorParameters:null!=i.constructorParameters?i.constructorParameters:void 0,contractMemo:null!=i.memo?i.memo:void 0,maxAutomaticTokenAssociations:null!=i.maxAutomaticTokenAssociations?i.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:1==i.declineReward,autoRenewAccountId:null!=i.autoRenewAccountId?AccountId._fromProtobuf(i.autoRenewAccountId):void 0}),e,t,n,r,o)}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this._bytecode=null,this}get bytecode(){return this._bytecode}setBytecode(e){return this._requireNotFrozen(),this._bytecode=e,this._bytecodeFileId=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get gas(){return this._gas}setGas(e){if(this._requireNotFrozen(),this._gas=e instanceof Long?e:Long.fromValue(e),this._gas.lessThan(0))throw new Error("Gas cannot be negative number");return this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get constructorParameters(){return this._constructorParameters}setConstructorParameters(e){return this._requireNotFrozen(),this._constructorParameters=e instanceof ContractFunctionParameters?e._build():e,this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this._stakedNodeId=null,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this._stakedAccountId=null,this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}_validateChecksums(e){null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.smartContract.createContract(t)}_getTransactionDataCase(){return"contractCreateInstance"}_makeTransactionData(){return{fileID:null!=this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,initcode:this._bytecode,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,gas:this._gas,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),constructorParameters:this._constructorParameters,memo:this._contractMemo,maxAutomaticTokenAssociations:this._maxAutomaticTokenAssociations,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,autoRenewAccountId:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null}}_getLogId(){return`ContractCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCreateInstance",ContractCreateTransaction._fromProtobuf);class ContractCreateFlow{constructor(){this._bytecode=null,this._contractCreate=new ContractCreateTransaction,this._signerPublicKeys=new Set,this._publicKeys=[],this._transactionSigners=[],this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get bytecode(){return this._bytecode}setBytecode(e){return this._bytecode=e instanceof Uint8Array?e:encode$1(e),this}get adminKey(){return this._contractCreate.adminKey}setAdminKey(e){return this._contractCreate.setAdminKey(e),this}get gas(){return this._contractCreate.gas}setGas(e){return this._contractCreate.setGas(e),this}get initialBalance(){return this._contractCreate.initialBalance}setInitialBalance(e){return this._contractCreate.setInitialBalance(e),this}get proxyAccountId(){return this._contractCreate.proxyAccountId}setProxyAccountId(e){return this._contractCreate.setProxyAccountId(e),this}get autoRenewPeriod(){return this._contractCreate.autoRenewPeriod}setAutoRenewPeriod(e){return this._contractCreate.setAutoRenewPeriod(e),this}get constructorParameters(){return this._contractCreate.constructorParameters}setConstructorParameters(e){return this._contractCreate.setConstructorParameters(e),this}get contractMemo(){return this._contractCreate.contractMemo}setContractMemo(e){return this._contractCreate.setContractMemo(e),this}get maxAutomaticTokenAssociation(){return this._contractCreate.maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._contractCreate.setMaxAutomaticTokenAssociations(e),this}get stakedAccountId(){return this._contractCreate.stakedAccountId}setStakedAccountId(e){return this._contractCreate.setStakedAccountId(e),this}get stakedNodeId(){return this._contractCreate.stakedNodeId}setStakedNodeId(e){return this._contractCreate.setStakedNodeId(e),this}get declineStakingRewards(){return this._contractCreate.declineStakingRewards}setDeclineStakingReward(e){return this._contractCreate.setDeclineStakingReward(e),this}get autoRenewAccountId(){return this._contractCreate.autoRenewAccountId}setAutoRenewAccountId(e){return this._contractCreate.setAutoRenewAccountId(e),this}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}signWith(e,t){const n=encode$5(e.toBytesRaw());return this._signerPublicKeys.has(n)||(this._publicKeys.push(e),this._transactionSigners.push(t)),this}async execute(e,t){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");const n=e.operatorPublicKey,r=(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWith(e);await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.execute(e,t);const i=(await o.getReceipt(e)).fileId;if(this._bytecode.length>2048){const n=(new FileAppendTransaction).setFileId(i).setContents(this._bytecode.subarray(2048)).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await n.execute(e,t)}if(this._contractCreate.setBytecodeFileId(i).freezeWith(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.execute(e,t),await o.getReceipt(e),null!=n){const n=(new FileDeleteTransaction).setFileId(i).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await(await n.execute(e,t)).getReceipt(e)}return o}async executeWithSigner(e){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");if(null==e.getAccountKey)throw new Error("`Signer.getAccountKey()` is not implemented, but is required for `ContractCreateFlow`");const t=await e.getAccountKey();let n;if(t instanceof PublicKey)n=t;else{const e=Object.values(t._key._key._keyData),r=new Uint8Array(e);n=PublicKey.fromBytes(r)}const r=await(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWithSigner(e);await r.signWithSigner(e),await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.executeWithSigner(e);const i=(await o.getReceiptWithSigner(e)).fileId;if(this._bytecode.length>2048){let t=(new FileAppendTransaction).setFileId(i).setContents(this._bytecode.subarray(2048));null!=this._maxChunks&&t.setMaxChunks(this._maxChunks),t=await t.freezeWithSigner(e),await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await t.executeWithSigner(e)}if(this._contractCreate=await this._contractCreate.setBytecodeFileId(i).freezeWithSigner(e),this._contractCreate=await this._contractCreate.signWithSigner(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.executeWithSigner(e),await o.getReceiptWithSigner(e),null!=t){const t=await(new FileDeleteTransaction).setFileId(i).freezeWithSigner(e);await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await(await t.executeWithSigner(e)).getReceiptWithSigner(e)}return o}}async function addSignersToTransaction(e,t,n){for(let r=0;r<t.length;r++)await e.signWith(t[r],n[r])}class ContractDeleteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._transferAccountId=null,this._transferContractId=null,this._permanentRemoval=!1,null!=e.contractId&&this.setContractId(e.contractId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId),null!=e.transferContractId&&this.setTransferContractId(e.transferContractId),null!=e.permanentRemoval&&this.setPermanentRemoval(e.permanentRemoval)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractDeleteInstance;return Transaction._fromProtobufTransactions(new ContractDeleteTransaction({contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,transferAccountId:null!=i.transferAccountID?AccountId._fromProtobuf(i.transferAccountID):void 0,transferContractId:null!=i.transferContractID?ContractId._fromProtobuf(i.transferContractID):void 0,permanentRemoval:i.permanentRemoval??!1}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get transferContractId(){return this._transferContractId}setTransferContractId(e){return this._requireNotFrozen(),this._transferContractId=e instanceof ContractId?e:ContractId.fromString(e),this._transferAccountId=null,this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId=e instanceof AccountId?e:AccountId.fromString(e),this._transferContractId=null,this}get permanentRemoval(){return this._permanentRemoval}setPermanentRemoval(e){return this._requireNotFrozen(),this._permanentRemoval=e,this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e),null!=this._transferContractId&&this._transferContractId.validateChecksum(e)}_execute(e,t){return e.smartContract.deleteContract(t)}_getTransactionDataCase(){return"contractDeleteInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,transferAccountID:this._transferAccountId?this._transferAccountId._toProtobuf():null,transferContractID:null!=this._transferContractId?this._transferContractId._toProtobuf():null,permanentRemoval:this._permanentRemoval}}_getLogId(){return`ContractDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractDeleteInstance",ContractDeleteTransaction._fromProtobuf);class ContractExecuteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._gas=null,this._amount=null,this._functionParameters=null,null!=e.contractId&&this.setContractId(e.contractId),null!=e.gas&&this.setGas(e.gas),null!=e.amount&&this.setPayableAmount(e.amount),null!=e.functionParameters?this.setFunctionParameters(e.functionParameters):null!=e.function&&this.setFunction(e.function.name,e.function.parameters)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractCall;return Transaction._fromProtobufTransactions(new ContractExecuteTransaction({contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,gas:null!=i.gas?i.gas:void 0,amount:null!=i.amount?Hbar.fromTinybars(i.amount):void 0,functionParameters:null!=i.functionParameters?i.functionParameters:void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){this._requireNotFrozen();const t=e instanceof Long?e:Long.fromValue(e);if(t.lt(0))throw new Error("Gas must be greater than 0");return this._gas=t,this}get payableAmount(){return this._amount}setPayableAmount(e,t=HbarUnit.Hbar){return this._requireNotFrozen(),this._amount=e instanceof Hbar?e:Hbar.from(e,t),this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._requireNotFrozen(),this._functionParameters=e,this}setFunction(e,t){return this._requireNotFrozen(),this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractCallMethod(t)}_getTransactionDataCase(){return"contractCall"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,amount:null!=this._amount?this._amount.toTinybars():null,functionParameters:this._functionParameters}}_getLogId(){return`ContractExecuteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCall",ContractExecuteTransaction._fromProtobuf);const{proto:proto$4}=HieroProto;class ContractInfo{constructor(e){this.contractId=e.contractId,this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.storage=e.storage,this.contractMemo=e.contractMemo,this.balance=e.balance,this.isDeleted=e.isDeleted,this.tokenRelationships=e.tokenRelationships,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.ledgerId=e.ledgerId,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){const t=e.autoRenewPeriod.seconds;return new ContractInfo({contractId:ContractId._fromProtobuf(e.contractID),accountId:AccountId._fromProtobuf(e.accountID),contractAccountId:null!=e.contractAccountID?e.contractAccountID:"",adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:new Duration(t),autoRenewAccountId:null!=e.autoRenewAccountId?AccountId._fromProtobuf(e.autoRenewAccountId):null,storage:null!=e.storage?e.storage instanceof Long?e.storage:Long.fromValue(e.storage):Long.ZERO,contractMemo:null!=e.memo?e.memo:"",balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),isDeleted:e.deleted,tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null,maxAutomaticTokenAssociations:null!=e.maxAutomaticTokenAssociations?Long.isLong(e.maxAutomaticTokenAssociations)?e.maxAutomaticTokenAssociations:Long.fromValue(e.maxAutomaticTokenAssociations):Long.ZERO})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccountId:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,storage:this.storage,memo:this.contractMemo,balance:this.balance.toTinybars(),deleted:this.isDeleted,tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toNumber()}}static fromBytes(e){return ContractInfo._fromProtobuf(proto$4.ContractGetInfoResponse.ContractInfo.decode(e))}toBytes(){return proto$4.ContractGetInfoResponse.ContractInfo.encode(this._toProtobuf()).finish()}}class ContractInfoQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetInfo;return new ContractInfoQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.getContractInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.contractGetInfo.header}_mapResponse(e,t,n){const r=e.contractGetInfo;return Promise.resolve(ContractInfo._fromProtobuf(r.contractInfo))}_onMakeRequest(e){return{contractGetInfo:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetInfo",ContractInfoQuery._fromProtobuf);class ContractUpdateTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._expirationTime=null,this._adminKey=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._bytecodeFileId=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,this._autoRenewAccountId=null,null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractUpdateInstance;let a,s,c;return null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds&&(a=i.autoRenewPeriod.seconds),null!=i.memoWrapper&&Object.hasOwn(i.memoWrapper,"value")&&null!=i.memoWrapper.value&&(s=i.memoWrapper.value),null!=i.maxAutomaticTokenAssociations&&null!=i.maxAutomaticTokenAssociations.value&&(c=i.maxAutomaticTokenAssociations.value),Transaction._fromProtobufTransactions(new ContractUpdateTransaction({contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,bytecodeFileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:a,contractMemo:s,maxAutomaticTokenAssociations:c,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:null!=i.declineReward&&1==Boolean(i.declineReward),autoRenewAccountId:null!=i.autoRenewAccountId?AccountId._fromProtobuf(i.autoRenewAccountId):void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return console.warn("Deprecated: there is no replacement"),this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}clearContractMemo(){return this._requireNotFrozen(),this._contractMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearAutoRenewAccountId(){return this._autoRenewAccountId=new AccountId(0),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.smartContract.updateContract(t)}_getTransactionDataCase(){return"contractUpdateInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,fileID:this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,memoWrapper:null!=this._contractMemo?{value:this._contractMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null,autoRenewAccountId:null!=this._autoRenewAccountId?"0.0.0"==this._autoRenewAccountId.toString()?libExports.proto.AccountID.create():this._autoRenewAccountId._toProtobuf():null}}_getLogId(){return`ContractUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractUpdateInstance",ContractUpdateTransaction._fromProtobuf);class FeeAssessmentMethod{constructor(e){this._value=e,Object.freeze(this)}toString(){switch(this){case FeeAssessmentMethod.Inclusive:return"INCLUSIVE";case FeeAssessmentMethod.Exclusive:return"EXCLUSIVE";default:return`UNKNOWN (${this._value.toString()})`}}static _fromValue(e){switch(e){case!1:return FeeAssessmentMethod.Inclusive;case!0:return FeeAssessmentMethod.Exclusive}}valueOf(){return this._value}}FeeAssessmentMethod.Inclusive=new FeeAssessmentMethod(!1),FeeAssessmentMethod.Exclusive=new FeeAssessmentMethod(!0);class CustomFractionalFee extends CustomFee{constructor(e={}){super(e),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator),this._min=null,null!=e.min&&this.setMin(e.min),this._max,null!=e.max&&this.setMax(e.max),this._assessmentMethod,null!=e.assessmentMethod&&this.setAssessmentMethod(e.assessmentMethod)}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}get min(){return this._min}setMin(e){return this._min="number"==typeof e?Long.fromNumber(e):e,this}get max(){return this._max}setMax(e){return this._max="number"==typeof e?Long.fromNumber(e):e,this}get assessmentMethod(){return this._assessmentMethod}setAssessmentMethod(e){return this._assessmentMethod=e,this}static _fromProtobuf(e){const t=e.fractionalFee,n=t.fractionalAmount;return new CustomFractionalFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0,min:null!=t.minimumAmount?t.minimumAmount:void 0,max:null!=t.maximumAmount?t.maximumAmount:void 0,assessmentMethod:null!=t.netOfTransfers?new FeeAssessmentMethod(t.netOfTransfers):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fractionalFee:{fractionalAmount:{numerator:this._numerator,denominator:this._denominator},minimumAmount:this._min,maximumAmount:this._max,netOfTransfers:null!=this._assessmentMethod&&this._assessmentMethod.valueOf()}}}}class CustomRoyalyFee extends CustomFee{constructor(e={}){super(e),this._fallbackFee=null,null!=e.fallbackFee&&this.setFallbackFee(e.fallbackFee),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator)}get fallbackFee(){return this._fallbackFee}setFallbackFee(e){return this._fallbackFee=e,this}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}static _fromProtobuf(e){const t=e.royaltyFee,n=t.exchangeValueFraction;return new CustomRoyalyFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,fallbackFee:null!=t.fallbackFee?CustomFixedFee._fromProtobuf({fixedFee:t.fallbackFee}):void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,royaltyFee:{exchangeValueFraction:{numerator:this._numerator,denominator:this._denominator},fallbackFee:null!=this._fallbackFee?this._fallbackFee._toProtobuf().fixedFee:null}}}}class DelegateContractId extends ContractId{constructor(e,t,n,r){super(e,t,n,r)}static fromString(e){return new DelegateContractId(ContractId.fromString(e))}static _fromProtobuf(e){return new DelegateContractId(ContractId._fromProtobuf(e))}static fromBytes(e){return new DelegateContractId(ContractId.fromBytes(e))}static fromSolidityAddress(e){return new DelegateContractId(ContractId.fromSolidityAddress(e))}clone(){const e=new DelegateContractId(this);return e._checksum=this._checksum,e}_toProtobufKey(){return{delegatableContractId:this._toProtobuf()}}static __fromProtobufKey(e){return DelegateContractId._fromProtobuf(e)}}CACHE.setDelegateContractId(e=>DelegateContractId.__fromProtobufKey(e));class EthereumTransaction extends Transaction{constructor(e={}){super(),this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.callData&&this.setCallDataFileId(e.callData),null!=e.callDataFileId&&this.setCallDataFileId(e.callDataFileId),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance)}static _fromProtobuf(e,t,n,r,o){const i=o[0].ethereumTransaction;return Transaction._fromProtobufTransactions(new EthereumTransaction({ethereumData:null!=i.ethereumData?i.ethereumData:void 0,callData:null!=i.callData?FileId._fromProtobuf(i.callData):void 0,maxGasAllowance:null!=i.maxGasAllowance?Hbar.fromTinybars(i.maxGasAllowance):void 0}),e,t,n,r,o)}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._requireNotFrozen(),this._ethereumData=e,this}get callData(){return this.callDataFileId}setCallData(e){return this.setCallDataFileId(e)}get callDataFileId(){return this._callDataFileId}setCallDataFileId(e){return this._requireNotFrozen(),this._callDataFileId=e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._requireNotFrozen(),this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}_validateChecksums(e){null!=this._ethereumData&&this._ethereumData instanceof FileId&&this._ethereumData.validateChecksum(e)}_execute(e,t){return e.smartContract.callEthereum(t)}_getTransactionDataCase(){return"ethereumTransaction"}_makeTransactionData(){return{ethereumData:this._ethereumData,callData:null!=this._callDataFileId?this._callDataFileId._toProtobuf():null,maxGasAllowance:null!=this._maxGasAllowance?this._maxGasAllowance.toTinybars():null}}_getLogId(){return`EthereumTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("ethereumTransaction",EthereumTransaction._fromProtobuf);class EthereumTransactionData{constructor(e){this.callData=e.callData}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");switch(e[0]){case 1:return CACHE.ethereumTransactionDataEip2930FromBytes(e);case 2:return CACHE.ethereumTransactionDataEip1559FromBytes(e);default:return CACHE.ethereumTransactionDataLegacyFromBytes(e)}}toBytes(){throw new Error("not implemented")}toString(){throw new Error("not implemented")}toJSON(){throw new Error("not implemented")}}class EthereumTransactionDataLegacy extends EthereumTransactionData{constructor(e){super(e),this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.v=e.v,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decode(e);if(9!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataLegacy({nonce:decode$8(t[0]),gasPrice:decode$8(t[1]),gasLimit:decode$8(t[2]),to:decode$8(t[3]),value:decode$8(t[4]),callData:decode$8(t[5]),v:decode$8(t[6]),r:decode$8(t[7]),s:decode$8(t[8])})}toBytes(){return decode$8(encode([this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.v,this.r,this.s]))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{nonce:encode$5(this.nonce),gasPrice:encode$5(this.gasPrice),gasLimit:encode$5(this.gasLimit),to:encode$5(this.to),value:encode$5(this.value),callData:encode$5(this.callData),v:encode$5(this.v),r:encode$5(this.r),s:encode$5(this.s)}}}CACHE.setEthereumTransactionDataLegacyFromBytes(e=>EthereumTransactionDataLegacy.fromBytes(e));class EthereumTransactionDataEip1559 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.maxPriorityGas=e.maxPriorityGas,this.maxGas=e.maxGas,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decode(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(12!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip1559({chainId:decode$8(t[0]),nonce:decode$8(t[1]),maxPriorityGas:decode$8(t[2]),maxGas:decode$8(t[3]),gasLimit:decode$8(t[4]),to:decode$8(t[5]),value:decode$8(t[6]),callData:decode$8(t[7]),accessList:t[8].map(e=>decode$8(e)),recId:decode$8(t[9]),r:decode$8(t[10]),s:decode$8(t[11])})}toBytes(){return decode$8("02"+encode([this.chainId,this.nonce,this.maxPriorityGas,this.maxGas,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$5(this.chainId),nonce:encode$5(this.nonce),maxPriorityGas:encode$5(this.maxPriorityGas),maxGas:encode$5(this.maxGas),gasLimit:encode$5(this.gasLimit),to:encode$5(this.to),value:encode$5(this.value),callData:encode$5(this.callData),accessList:this.accessList.map(e=>encode$5(e)),recId:encode$5(this.recId),r:encode$5(this.r),s:encode$5(this.s)}}}CACHE.setEthereumTransactionDataEip1559FromBytes(e=>EthereumTransactionDataEip1559.fromBytes(e));class EthereumTransactionDataEip2930 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decode(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(11!==t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip2930({chainId:decode$8(t[0]),nonce:decode$8(t[1]),gasPrice:decode$8(t[2]),gasLimit:decode$8(t[3]),to:decode$8(t[4]),value:decode$8(t[5]),callData:decode$8(t[6]),accessList:t[7].map(e=>decode$8(e)),recId:decode$8(t[8]),r:decode$8(t[9]),s:decode$8(t[10])})}toBytes(){return decode$8("01"+encode([this.chainId,this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$5(this.chainId),nonce:encode$5(this.nonce),gasPrice:encode$5(this.gasPrice),gasLimit:encode$5(this.gasLimit),to:encode$5(this.to),value:encode$5(this.value),callData:encode$5(this.callData),accessList:this.accessList.map(e=>encode$5(e)),recId:encode$5(this.recId),r:encode$5(this.r),s:encode$5(this.s)}}}CACHE.setEthereumTransactionDataEip2930FromBytes(e=>EthereumTransactionDataEip2930.fromBytes(e));class EthereumFlow{constructor(e={}){this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance),this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._ethereumData=e instanceof Uint8Array?EthereumTransactionData.fromBytes(e):e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}async execute(e){if(null==this._ethereumData)throw new Error("cannot submit ethereum transaction with no ethereum data");const t=new EthereumTransaction,n=this._ethereumData.toBytes();if(null!=this._maxGasAllowance&&t.setMaxGasAllowanceHbar(this._maxGasAllowance),null!=this._callDataFileId){if(0===this._ethereumData.callData.length)throw new Error("call data file ID provided, but ethereum data already contains call data");t.setEthereumData(n).setCallDataFileId(this._callDataFileId)}else if(n.length<=128e3)t.setEthereumData(n);else{const n=await createFile(this._ethereumData.callData,e,this._maxChunks);this._ethereumData.callData=new Uint8Array,t.setEthereumData(this._ethereumData.toBytes()).setCallDataFileId(n)}return t.execute(e)}}async function createFile(e,t,n){const r=encode$5(e),o=(await(await(new FileCreateTransaction).setContents(r.substring(0,4096)).setKeys(t.operatorPublicKey?[t.operatorPublicKey]:[]).execute(t)).getReceipt(t)).fileId;if(e.length>4096){let e=(new FileAppendTransaction).setFileId(o).setContents(r.substring(4096,r.length));null!=n&&e.setMaxChunks(n),await(await e.execute(t)).getReceipt(t)}return o}const{proto:proto$3}=HieroProto;class ExchangeRates{constructor(e){this.currentRate=e.currentRate,this.nextRate=e.nextRate,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRates({currentRate:ExchangeRate._fromProtobuf(e.currentRate),nextRate:ExchangeRate._fromProtobuf(e.nextRate)})}_toProtobuf(){return{currentRate:this.currentRate._toProtobuf(),nextRate:this.nextRate._toProtobuf()}}static fromBytes(e){return ExchangeRates._fromProtobuf(proto$3.ExchangeRateSet.decode(e))}}class FeeComponents{constructor(e={}){this.min=e.min,this.max=e.max,this.constant=e.constant,this.transactionBandwidthByte=e.transactionBandwidthByte,this.transactionVerification=e.transactionVerification,this.transactionRamByteHour=e.transactionRamByteHour,this.transactionStorageByteHour=e.transactionStorageByteHour,this.contractTransactionGas=e.contractTransactionGas,this.transferVolumeHbar=e.transferVolumeHbar,this.responseMemoryByte=e.responseMemoryByte,this.responseDiskByte=e.responseDiskByte}static fromBytes(e){return FeeComponents._fromProtobuf(libExports.proto.FeeComponents.decode(e))}static _fromProtobuf(e){return new FeeComponents({min:null!=e.min?e.min:void 0,max:null!=e.max?e.max:void 0,constant:null!=e.constant?e.constant:void 0,transactionBandwidthByte:null!=e.bpt?e.bpt:void 0,transactionVerification:null!=e.vpt?e.vpt:void 0,transactionRamByteHour:null!=e.rbh?e.rbh:void 0,transactionStorageByteHour:null!=e.sbh?e.sbh:void 0,contractTransactionGas:null!=e.gas?e.gas:void 0,transferVolumeHbar:null!=e.tv?e.tv:void 0,responseMemoryByte:null!=e.bpr?e.bpr:void 0,responseDiskByte:null!=e.sbpr?e.sbpr:void 0})}_toProtobuf(){return{min:null!=this.min?this.min:void 0,max:null!=this.max?this.max:void 0,constant:null!=this.constant?this.constant:void 0,bpt:null!=this.transactionBandwidthByte?this.transactionBandwidthByte:void 0,vpt:null!=this.transactionVerification?this.transactionVerification:void 0,rbh:null!=this.transactionRamByteHour?this.transactionRamByteHour:void 0,sbh:null!=this.transactionStorageByteHour?this.transactionStorageByteHour:void 0,gas:null!=this.contractTransactionGas?this.contractTransactionGas:void 0,tv:null!=this.transferVolumeHbar?this.transferVolumeHbar:void 0,bpr:null!=this.responseMemoryByte?this.responseMemoryByte:void 0,sbpr:null!=this.responseDiskByte?this.responseDiskByte:void 0}}toBytes(){return libExports.proto.FeeComponents.encode(this._toProtobuf()).finish()}}class FeeDataType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FeeDataType.Default:return"DEFAULT";case FeeDataType.TokenFungibleCommon:return"TOKEN_FUNGIBLE_COMMON";case FeeDataType.TokenNonFungibleUnique:return"TOKEN_NON_FUNGIBLE_UNIQUE";case FeeDataType.TokenFungibleCommonWithCustomFees:return"TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES";case FeeDataType.TokenNonFungibleUniqueWithCustomFees:return"TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES";case FeeDataType.ScheduleCreateContractCall:return"SCHEDULE_CREATE_CONTRACT_CALL";case FeeDataType.TopicCreateWithCustomFees:return"TOPIC_CREATE_WITH_CUSTOM_FEES";case FeeDataType.SubmitMessageWithCustomFees:return"SUBMIT_MESSAGE_WITH_CUSTOM_FEES";case FeeDataType.CryptoTransferWithHooks:return"CRYPTO_TRANSFER_WITH_HOOKS";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FeeDataType.Default;case 1:return FeeDataType.TokenFungibleCommon;case 2:return FeeDataType.TokenNonFungibleUnique;case 3:return FeeDataType.TokenFungibleCommonWithCustomFees;case 4:return FeeDataType.TokenNonFungibleUniqueWithCustomFees;case 5:return FeeDataType.ScheduleCreateContractCall;case 6:return FeeDataType.TopicCreateWithCustomFees;case 7:return FeeDataType.SubmitMessageWithCustomFees;case 8:return FeeDataType.CryptoTransferWithHooks}throw new Error(`(BUG) SubType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}FeeDataType.Default=new FeeDataType(0),FeeDataType.TokenFungibleCommon=new FeeDataType(1),FeeDataType.TokenNonFungibleUnique=new FeeDataType(2),FeeDataType.TokenFungibleCommonWithCustomFees=new FeeDataType(3),FeeDataType.TokenNonFungibleUniqueWithCustomFees=new FeeDataType(4),FeeDataType.ScheduleCreateContractCall=new FeeDataType(5),FeeDataType.TopicCreateWithCustomFees=new FeeDataType(6),FeeDataType.SubmitMessageWithCustomFees=new FeeDataType(7),FeeDataType.CryptoTransferWithHooks=new FeeDataType(8);class FeeData{constructor(e={}){this.nodedata=e.nodedata,this.networkdata=e.networkdata,this.servicedata=e.servicedata,this.feeDataType=e.feeDataType}static fromBytes(e){return FeeData._fromProtobuf(libExports.proto.FeeData.decode(e))}static _fromProtobuf(e){return new FeeData({nodedata:null!=e.nodedata?FeeComponents._fromProtobuf(e.nodedata):void 0,networkdata:null!=e.networkdata?FeeComponents._fromProtobuf(e.networkdata):void 0,servicedata:null!=e.servicedata?FeeComponents._fromProtobuf(e.servicedata):void 0,feeDataType:null!=e.subType?FeeDataType._fromCode(e.subType):void 0})}_toProtobuf(){return{nodedata:null!=this.nodedata?this.nodedata._toProtobuf():void 0,networkdata:null!=this.networkdata?this.networkdata._toProtobuf():void 0,servicedata:null!=this.servicedata?this.servicedata._toProtobuf():void 0,subType:null!=this.feeDataType?this.feeDataType.valueOf():void 0}}toBytes(){return libExports.proto.FeeData.encode(this._toProtobuf()).finish()}}class RequestType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case RequestType.None:return"NONE";case RequestType.CryptoTransfer:return"CryptoTransfer";case RequestType.CryptoUpdate:return"CryptoUpdate";case RequestType.CryptoDelete:return"CryptoDelete";case RequestType.CryptoAddLiveHash:return"CryptoAddLiveHash";case RequestType.CryptoDeleteLiveHash:return"CryptoDeleteLiveHash";case RequestType.ContractCall:return"ContractCall";case RequestType.ContractCreate:return"ContractCreate";case RequestType.ContractUpdate:return"ContractUpdate";case RequestType.FileCreate:return"FileCreate";case RequestType.FileAppend:return"FileAppend";case RequestType.FileUpdate:return"FileUpdate";case RequestType.FileDelete:return"FileDelete";case RequestType.CryptoGetAccountBalance:return"CryptoGetAccountBalance";case RequestType.CryptoGetAccountRecords:return"CryptoGetAccountRecords";case RequestType.CryptoGetInfo:return"CryptoGetInfo";case RequestType.ContractCallLocal:return"ContractCallLocal";case RequestType.ContractGetInfo:return"ContractGetInfo";case RequestType.ContractGetBytecode:return"ContractGetBytecode";case RequestType.GetBySolidityID:return"GetBySolidityID";case RequestType.GetByKey:return"GetByKey";case RequestType.CryptoGetLiveHash:return"CryptoGetLiveHash";case RequestType.CryptoGetStakers:return"CryptoGetStakers";case RequestType.FileGetContents:return"FileGetContents";case RequestType.FileGetInfo:return"FileGetInfo";case RequestType.TransactionGetRecord:return"TransactionGetRecord";case RequestType.ContractGetRecords:return"ContractGetRecords";case RequestType.CryptoCreate:return"CryptoCreate";case RequestType.SystemDelete:return"SystemDelete";case RequestType.SystemUndelete:return"SystemUndelete";case RequestType.ContractDelete:return"ContractDelete";case RequestType.Freeze:return"Freeze";case RequestType.CreateTransactionRecord:return"CreateTransactionRecord";case RequestType.CryptoAccountAutoRenew:return"CryptoAccountAutoRenew";case RequestType.ContractAutoRenew:return"ContractAutoRenew";case RequestType.GetVersionInfo:return"GetVersionInfo";case RequestType.TransactionGetReceipt:return"TransactionGetReceipt";case RequestType.ConsensusCreateTopic:return"ConsensusCreateTopic";case RequestType.ConsensusUpdateTopic:return"ConsensusUpdateTopic";case RequestType.ConsensusDeleteTopic:return"ConsensusDeleteTopic";case RequestType.ConsensusGetTopicInfo:return"ConsensusGetTopicInfo";case RequestType.ConsensusSubmitMessage:return"ConsensusSubmitMessage";case RequestType.UncheckedSubmit:return"UncheckedSubmit";case RequestType.TokenCreate:return"TokenCreate";case RequestType.TokenGetInfo:return"TokenGetInfo";case RequestType.TokenFreezeAccount:return"TokenFreezeAccount";case RequestType.TokenUnfreezeAccount:return"TokenUnfreezeAccount";case RequestType.TokenGrantKycToAccount:return"TokenGrantKycToAccount";case RequestType.TokenRevokeKycFromAccount:return"TokenRevokeKycFromAccount";case RequestType.TokenDelete:return"TokenDelete";case RequestType.TokenUpdate:return"TokenUpdate";case RequestType.TokenMint:return"TokenMint";case RequestType.TokenBurn:return"TokenBurn";case RequestType.TokenAccountWipe:return"TokenAccountWipe";case RequestType.TokenAssociateToAccount:return"TokenAssociateToAccount";case RequestType.TokenDissociateFromAccount:return"TokenDissociateFromAccount";case RequestType.ScheduleCreate:return"ScheduleCreate";case RequestType.ScheduleDelete:return"ScheduleDelete";case RequestType.ScheduleSign:return"ScheduleSign";case RequestType.ScheduleGetInfo:return"ScheduleGetInfo";case RequestType.TokenGetAccountNftInfos:return"TokenGetAccountNftInfos";case RequestType.TokenGetNftInfo:return"TokenGetNftInfo";case RequestType.TokenGetNftInfos:return"TokenGetNftInfos";case RequestType.TokenFeeScheduleUpdate:return"TokenFeeScheduleUpdate";case RequestType.NetworkGetExecutionTime:return"NetworkGetExecutionTime";case RequestType.TokenPause:return"TokenPause";case RequestType.TokenUnpause:return"TokenUnpause";case RequestType.CryptoApproveAllowance:return"CryptoApproveAllowance";case RequestType.CryptoDeleteAllowance:return"CryptoDeleteAllowance";case RequestType.GetAccountDetails:return"GetAccountDetails";case RequestType.EthereumTransaction:return"EthereumTransaction";case RequestType.NodeStakeUpdate:return"NodeStakeUpdate";case RequestType.Prng:return"UtilPrng";case RequestType.TransactionGetFastRecord:return"TransactionGetFastRecord";case RequestType.TokenUpdateNfts:return"TokenUpdateNfts";case RequestType.NodeCreate:return"NodeCreate";case RequestType.NodeUpdate:return"NodeUpdate";case RequestType.NodeDelete:return"NodeDelete";case RequestType.TokenReject:return"TokenReject";case RequestType.TokenAirdrop:return"TokenAirdrop";case RequestType.TokenCancelAirdrop:return"TokenCancelAirdrop";case RequestType.TokenClaimAirdrop:return"TokenClaimAirdrop";case RequestType.TssMessage:return"TssMessage";case RequestType.TssVote:return"TssVote";case RequestType.TssShareSignature:return"TssShareSignature";case RequestType.TssEncryptionKey:return"TssEncryptionKey";case RequestType.StateSignatureTransaction:return"StateSignatureTransaction";case RequestType.HistoryAssemblySignature:return"HistoryAssemblySignature";case RequestType.HistoryProofKeyPublication:return"HistoryProofKeyPublication";case RequestType.HistoryProofVote:return"HistoryProofVote";case RequestType.HintsKeyPublication:return"HintsKeyPublication";case RequestType.HintsPreprocessingVote:return"HintsPreprocessingVote";case RequestType.HintsPartialSignature:return"HintsPartialSignature";case RequestType.CrsPublication:return"CrsPublication";case RequestType.AtomicBatch:return"AtomicBatch";case RequestType.LambdaSStore:return"LambdaSStore";case RequestType.HookDispatch:return"HookDispatch";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return RequestType.None;case 1:return RequestType.CryptoTransfer;case 2:return RequestType.CryptoUpdate;case 3:return RequestType.CryptoDelete;case 4:return RequestType.CryptoAddLiveHash;case 5:return RequestType.CryptoDeleteLiveHash;case 6:return RequestType.ContractCall;case 7:return RequestType.ContractCreate;case 8:return RequestType.ContractUpdate;case 9:return RequestType.FileCreate;case 10:return RequestType.FileAppend;case 11:return RequestType.FileUpdate;case 12:return RequestType.FileDelete;case 13:return RequestType.CryptoGetAccountBalance;case 14:return RequestType.CryptoGetAccountRecords;case 15:return RequestType.CryptoGetInfo;case 16:return RequestType.ContractCallLocal;case 17:return RequestType.ContractGetInfo;case 18:return RequestType.ContractGetBytecode;case 19:return RequestType.GetBySolidityID;case 20:return RequestType.GetByKey;case 21:return RequestType.CryptoGetLiveHash;case 22:return RequestType.CryptoGetStakers;case 23:return RequestType.FileGetContents;case 24:return RequestType.FileGetInfo;case 25:return RequestType.TransactionGetRecord;case 26:return RequestType.ContractGetRecords;case 27:return RequestType.CryptoCreate;case 28:return RequestType.SystemDelete;case 29:return RequestType.SystemUndelete;case 30:return RequestType.ContractDelete;case 31:return RequestType.Freeze;case 32:return RequestType.CreateTransactionRecord;case 33:return RequestType.CryptoAccountAutoRenew;case 34:return RequestType.ContractAutoRenew;case 35:return RequestType.GetVersionInfo;case 36:return RequestType.TransactionGetReceipt;case 50:return RequestType.ConsensusCreateTopic;case 51:return RequestType.ConsensusUpdateTopic;case 52:return RequestType.ConsensusDeleteTopic;case 53:return RequestType.ConsensusGetTopicInfo;case 54:return RequestType.ConsensusSubmitMessage;case 55:return RequestType.UncheckedSubmit;case 56:return RequestType.TokenCreate;case 58:return RequestType.TokenGetInfo;case 59:return RequestType.TokenFreezeAccount;case 60:return RequestType.TokenUnfreezeAccount;case 61:return RequestType.TokenGrantKycToAccount;case 62:return RequestType.TokenRevokeKycFromAccount;case 63:return RequestType.TokenDelete;case 64:return RequestType.TokenUpdate;case 65:return RequestType.TokenMint;case 66:return RequestType.TokenBurn;case 67:return RequestType.TokenAccountWipe;case 68:return RequestType.TokenAssociateToAccount;case 69:return RequestType.TokenDissociateFromAccount;case 70:return RequestType.ScheduleCreate;case 71:return RequestType.ScheduleDelete;case 72:return RequestType.ScheduleSign;case 73:return RequestType.ScheduleGetInfo;case 74:return RequestType.TokenGetAccountNftInfos;case 75:return RequestType.TokenGetNftInfo;case 76:return RequestType.TokenGetNftInfos;case 77:return RequestType.TokenFeeScheduleUpdate;case 78:return RequestType.NetworkGetExecutionTime;case 79:return RequestType.TokenPause;case 80:return RequestType.TokenUnpause;case 81:return RequestType.CryptoApproveAllowance;case 82:return RequestType.CryptoDeleteAllowance;case 83:return RequestType.GetAccountDetails;case 84:return RequestType.EthereumTransaction;case 85:return RequestType.NodeStakeUpdate;case 86:return RequestType.Prng;case 87:return RequestType.TransactionGetFastRecord;case 88:return RequestType.TokenUpdateNfts;case 89:return RequestType.NodeCreate;case 90:return RequestType.NodeUpdate;case 91:return RequestType.NodeDelete;case 92:return RequestType.TokenReject;case 93:return RequestType.TokenAirdrop;case 94:return RequestType.TokenCancelAirdrop;case 95:return RequestType.TokenClaimAirdrop;case 96:return RequestType.TssMessage;case 97:return RequestType.TssVote;case 98:return RequestType.TssShareSignature;case 99:return RequestType.TssEncryptionKey;case 100:return RequestType.StateSignatureTransaction;case 101:return RequestType.HintsKeyPublication;case 102:return RequestType.HintsPreprocessingVote;case 103:return RequestType.HintsPartialSignature;case 104:return RequestType.HistoryAssemblySignature;case 105:return RequestType.HistoryProofKeyPublication;case 106:return RequestType.HistoryProofVote;case 107:return RequestType.CrsPublication;case 108:return RequestType.AtomicBatch;case 109:return RequestType.LambdaSStore;case 110:return RequestType.HookDispatch}throw new Error(`(BUG) RequestType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}RequestType.None=new RequestType(0),RequestType.CryptoTransfer=new RequestType(1),RequestType.CryptoUpdate=new RequestType(2),RequestType.CryptoDelete=new RequestType(3),RequestType.CryptoAddLiveHash=new RequestType(4),RequestType.CryptoDeleteLiveHash=new RequestType(5),RequestType.ContractCall=new RequestType(6),RequestType.ContractCreate=new RequestType(7),RequestType.ContractUpdate=new RequestType(8),RequestType.FileCreate=new RequestType(9),RequestType.FileAppend=new RequestType(10),RequestType.FileUpdate=new RequestType(11),RequestType.FileDelete=new RequestType(12),RequestType.CryptoGetAccountBalance=new RequestType(13),RequestType.CryptoGetAccountRecords=new RequestType(14),RequestType.CryptoGetInfo=new RequestType(15),RequestType.ContractCallLocal=new RequestType(16),RequestType.ContractGetInfo=new RequestType(17),RequestType.ContractGetBytecode=new RequestType(18),RequestType.GetBySolidityID=new RequestType(19),RequestType.GetByKey=new RequestType(20),RequestType.CryptoGetLiveHash=new RequestType(21),RequestType.CryptoGetStakers=new RequestType(22),RequestType.FileGetContents=new RequestType(23),RequestType.FileGetInfo=new RequestType(24),RequestType.TransactionGetRecord=new RequestType(25),RequestType.ContractGetRecords=new RequestType(26),RequestType.CryptoCreate=new RequestType(27),RequestType.SystemDelete=new RequestType(28),RequestType.SystemUndelete=new RequestType(29),RequestType.ContractDelete=new RequestType(30),RequestType.Freeze=new RequestType(31),RequestType.CreateTransactionRecord=new RequestType(32),RequestType.CryptoAccountAutoRenew=new RequestType(33),RequestType.ContractAutoRenew=new RequestType(34),RequestType.GetVersionInfo=new RequestType(35),RequestType.TransactionGetReceipt=new RequestType(36),RequestType.ConsensusCreateTopic=new RequestType(50),RequestType.ConsensusUpdateTopic=new RequestType(51),RequestType.ConsensusDeleteTopic=new RequestType(52),RequestType.ConsensusGetTopicInfo=new RequestType(53),RequestType.ConsensusSubmitMessage=new RequestType(54),RequestType.UncheckedSubmit=new RequestType(55),RequestType.TokenCreate=new RequestType(56),RequestType.TokenGetInfo=new RequestType(58),RequestType.TokenFreezeAccount=new RequestType(59),RequestType.TokenUnfreezeAccount=new RequestType(60),RequestType.TokenGrantKycToAccount=new RequestType(61),RequestType.TokenRevokeKycFromAccount=new RequestType(62),RequestType.TokenDelete=new RequestType(63),RequestType.TokenUpdate=new RequestType(64),RequestType.TokenMint=new RequestType(65),RequestType.TokenBurn=new RequestType(66),RequestType.TokenAccountWipe=new RequestType(67),RequestType.TokenAssociateToAccount=new RequestType(68),RequestType.TokenDissociateFromAccount=new RequestType(69),RequestType.ScheduleCreate=new RequestType(70),RequestType.ScheduleDelete=new RequestType(71),RequestType.ScheduleSign=new RequestType(72),RequestType.ScheduleGetInfo=new RequestType(73),RequestType.TokenGetAccountNftInfos=new RequestType(74),RequestType.TokenGetNftInfo=new RequestType(75),RequestType.TokenGetNftInfos=new RequestType(76),RequestType.TokenFeeScheduleUpdate=new RequestType(77),RequestType.NetworkGetExecutionTime=new RequestType(78),RequestType.TokenPause=new RequestType(79),RequestType.TokenUnpause=new RequestType(80),RequestType.CryptoApproveAllowance=new RequestType(81),RequestType.CryptoDeleteAllowance=new RequestType(82),RequestType.GetAccountDetails=new RequestType(83),RequestType.EthereumTransaction=new RequestType(84),RequestType.NodeStakeUpdate=new RequestType(85),RequestType.Prng=new RequestType(86),RequestType.TransactionGetFastRecord=new RequestType(87),RequestType.TokenUpdateNfts=new RequestType(88),RequestType.NodeCreate=new RequestType(89),RequestType.NodeUpdate=new RequestType(90),RequestType.NodeDelete=new RequestType(91),RequestType.TokenReject=new RequestType(92),RequestType.TokenAirdrop=new RequestType(93),RequestType.TokenCancelAirdrop=new RequestType(94),RequestType.TokenClaimAirdrop=new RequestType(95),RequestType.TssMessage=new RequestType(96),RequestType.TssVote=new RequestType(97),RequestType.TssShareSignature=new RequestType(98),RequestType.TssEncryptionKey=new RequestType(99),RequestType.StateSignatureTransaction=new RequestType(100),RequestType.HintsKeyPublication=new RequestType(101),RequestType.HintsPreprocessingVote=new RequestType(102),RequestType.HintsPartialSignature=new RequestType(103),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.CrsPublication=new RequestType(107),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.AtomicBatch=new RequestType(108),RequestType.LambdaSStore=new RequestType(109),RequestType.HookDispatch=new RequestType(110);class TransactionFeeSchedule{constructor(e={}){this.hederaFunctionality=e.hederaFunctionality,this.feeData=e.feeData,this.fees=e.fees}static fromBytes(e){return TransactionFeeSchedule._fromProtobuf(libExports.proto.TransactionFeeSchedule.decode(e))}static _fromProtobuf(e){return new TransactionFeeSchedule({hederaFunctionality:null!=e.hederaFunctionality?RequestType._fromCode(e.hederaFunctionality):void 0,feeData:null!=e.feeData?FeeData._fromProtobuf(e.feeData):void 0,fees:null!=e.fees?e.fees.map(e=>FeeData._fromProtobuf(e)):void 0})}_toProtobuf(){return{hederaFunctionality:null!=this.hederaFunctionality?this.hederaFunctionality.valueOf():void 0,feeData:null!=this.feeData?this.feeData._toProtobuf():void 0,fees:null!=this.fees?this.fees.map(e=>e._toProtobuf()):void 0}}toBytes(){return libExports.proto.TransactionFeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedule{constructor(e={}){this.transactionFeeSchedule=e.transactionFeeSchedule,this.expirationTime=e.expirationTime}static fromBytes(e){return FeeSchedule._fromProtobuf(libExports.proto.FeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedule({transactionFeeSchedule:null!=e.transactionFeeSchedule?e.transactionFeeSchedule.map(e=>TransactionFeeSchedule._fromProtobuf(e)):void 0,expirationTime:null!=e.expiryTime?Timestamp._fromProtobuf(e.expiryTime):void 0})}_toProtobuf(){return{transactionFeeSchedule:null!=this.transactionFeeSchedule?this.transactionFeeSchedule.map(e=>e._toProtobuf()):void 0,expiryTime:null!=this.expirationTime?this.expirationTime._toProtobuf():void 0}}toBytes(){return libExports.proto.FeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedules{constructor(e={}){this.current=e.currentFeeSchedule,this.next=e.nextFeeSchedule}static fromBytes(e){return FeeSchedules._fromProtobuf(libExports.proto.CurrentAndNextFeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedules({currentFeeSchedule:null!=e.currentFeeSchedule?FeeSchedule._fromProtobuf(e.currentFeeSchedule):void 0,nextFeeSchedule:null!=e.nextFeeSchedule?FeeSchedule._fromProtobuf(e.nextFeeSchedule):void 0})}_toProtobuf(){return{currentFeeSchedule:null!=this.current?this.current._toProtobuf():void 0,nextFeeSchedule:null!=this.next?this.next._toProtobuf():void 0}}toBytes(){return libExports.proto.CurrentAndNextFeeSchedule.encode(this._toProtobuf()).finish()}}class FileContentsQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetContents;return new FileContentsQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileContent(t)}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_mapResponseHeader(e){return e.fileGetContents.header}_mapResponse(e){const t=e.fileGetContents.fileContents.contents;return Promise.resolve(t)}_onMakeRequest(e){return{fileGetContents:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileContentsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetContents",FileContentsQuery._fromProtobuf);const{proto:proto$2}=HieroProto;class FileInfo{constructor(e){this.fileId=e.fileId,this.size=e.size,this.expirationTime=e.expirationTime,this.isDeleted=e.isDeleted,this.keys=e.keys,this.fileMemo=e.fileMemo,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.size;return new FileInfo({fileId:FileId._fromProtobuf(e.fileID),size:t instanceof Long?t:Long.fromValue(t),expirationTime:Timestamp._fromProtobuf(e.expirationTime),isDeleted:e.deleted,keys:null!=e.keys?KeyList.__fromProtobufKeyList(e.keys):new KeyList,fileMemo:null!=e.memo?e.memo:"",ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null})}_toProtobuf(){return{fileID:this.fileId._toProtobuf(),size:this.size,expirationTime:this.expirationTime._toProtobuf(),deleted:this.isDeleted,keys:this.keys._toProtobufKey().keyList,memo:this.fileMemo,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null}}static fromBytes(e){return FileInfo._fromProtobuf(libExports.proto.FileGetInfoResponse.FileInfo.decode(e))}toBytes(){return proto$2.FileGetInfoResponse.FileInfo.encode(this._toProtobuf()).finish()}}class FileInfoQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetInfo;return new FileInfoQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileInfo(t)}_mapResponseHeader(e){return e.fileGetInfo.header}_mapResponse(e,t,n){const r=e.fileGetInfo;return Promise.resolve(FileInfo._fromProtobuf(r.fileInfo))}_onMakeRequest(e){return{fileGetInfo:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetInfo",FileInfoQuery._fromProtobuf);class FileUpdateTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._keys=null,this._expirationTime=null,this._contents=null,this._fileMemo=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileUpdate;return Transaction._fromProtobufTransactions(new FileUpdateTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,keys:null!=i.keys&&null!=i.keys.keys?i.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,contents:null!=i.contents?i.contents:void 0,fileMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode$1(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}clearFileMemo(){return this._requireNotFrozen(),this._fileMemo=null,this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.updateFile(t)}_getTransactionDataCase(){return"fileUpdate"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,contents:this._contents,memo:null!=this._fileMemo?{value:this._fileMemo}:null}}_getLogId(){return`FileUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileUpdate",FileUpdateTransaction._fromProtobuf);class LiveHashAddTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._keys=null,this._duration=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.keys&&this.setKeys(e.keys),null!=e.duration&&this.setDuration(e.duration),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoAddLiveHash.liveHash;return Transaction._fromProtobufTransactions(new LiveHashAddTransaction({hash:null!=i.hash?i.hash:void 0,keys:null!=i.keys&&null!=i.keys.keys?i.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,duration:null!=i.duration&&null!=i.duration.seconds?i.duration.seconds:void 0,accountId:null!=i.accountId?AccountId._fromProtobuf(i.accountId):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get keys(){return this._keys}setKeys(e){return this._requireNotFrozen(),this._keys=e instanceof KeyList?e.toArray():e,this}get duration(){return this._duration}setDuration(e){return this._requireNotFrozen(),this._duration=e instanceof Duration?e:new Duration(e),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.addLiveHash(t)}_getTransactionDataCase(){return"cryptoAddLiveHash"}_makeTransactionData(){return{liveHash:{hash:this._hash,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:void 0,duration:null!=this._duration?this._duration._toProtobuf():null,accountId:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`LiveHashAddTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoAddLiveHash",LiveHashAddTransaction._fromProtobuf);class LiveHashDeleteTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoDeleteLiveHash;return Transaction._fromProtobufTransactions(new LiveHashDeleteTransaction({hash:null!=i.liveHashToDelete?i.liveHashToDelete:void 0,accountId:null!=i.accountOfLiveHash?AccountId._fromProtobuf(i.accountOfLiveHash):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.deleteLiveHash(t)}_getTransactionDataCase(){return"cryptoDeleteLiveHash"}_makeTransactionData(){return{liveHashToDelete:this._hash,accountOfLiveHash:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`LiveHashDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteLiveHash",LiveHashDeleteTransaction._fromProtobuf);class LiveHashQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._hash=null,null!=e.hash&&this.setHash(e.hash)}static _fromProtobuf(e){const t=e.cryptoGetLiveHash;return new LiveHashQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,hash:null!=t.hash?t.hash:void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get liveHash(){return this._hash}setHash(e){return this._hash=e,this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getLiveHash(t)}_mapResponseHeader(e){return e.cryptoGetLiveHash.header}_mapResponse(e){const t=e.cryptoGetLiveHash;return Promise.resolve(LiveHash._fromProtobuf(t.liveHash))}_onMakeRequest(e){return{cryptoGetLiveHash:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,hash:this._hash}}}_getLogId(){return`LiveHashQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetLiveHash",LiveHashQuery._fromProtobuf);class MirrorNodeContractQuery{constructor(){this._contractId=null,this._contractEvmAddress=null,this._sender=null,this._senderEvmAddress=null,this._functionName=null,this._functionParameters=null,this._value=null,this._gasLimit=null,this._gasPrice=null,this._blockNumber=null}setContractId(e){return this._contractId=e,this}setSender(e){return this._sender=e,this}setSenderEvmAddress(e){return this._senderEvmAddress=e,this}setFunction(e,t){return this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}setValue(e){return this._value=e,this}setGasLimit(e){return this._gasLimit=e,this}setGasPrice(e){return this._gasPrice=e,this}setBlockNumber(e){return this._blockNumber=e,this}get contractId(){return this._contractId}get contractEvmAddress(){const e=this._contractId?.toEvmAddress();if(null==e)throw new Error("Contract ID is not set");return e}get sender(){return this._sender}get senderEvmAddress(){return this._senderEvmAddress}get callData(){return this._functionParameters}get value(){return this._value}get gasLimit(){return this._gasLimit}get gasPrice(){return this._gasPrice}get blockNumber(){return this._blockNumber}async performMirrorNodeRequest(e,t){if(null==this.contractId)throw new Error("Contract ID is not set");this._fillEvmAddress();let n=e.mirrorRestApiBaseUrl;const r=e._mirrorNetwork.getNextMirrorNode().address.address;if("localhost"===r||"127.0.0.1"===r){const e=new URL(n);e.protocol="http:",e.port="8545",n=e.toString()}const o=`${n}/contracts/call`,i=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return await i.json()}_fillEvmAddress(){null==this.senderEvmAddress&&null!=this.sender&&(this._senderEvmAddress=this.sender.toEvmAddress())}get JSONPayload(){throw new Error("JSONPayload getter is not implemented. Please implement this method in the subclass.")}}class MirrorNodeContractCallQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$5(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!1,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){return(await this.performMirrorNodeRequest(e,this.JSONPayload)).result}}class MirrorNodeContractEstimateQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$5(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!0,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){const t=await this.performMirrorNodeRequest(e,this.JSONPayload);return Number(t.result)}}class IPv4AddressPart{constructor(e={}){this._left=null,null!=e.left&&this.setLeft(e.left),this._right=null,null!=e.right&&this.setRight(e.right)}get left(){return this._left}setLeft(e){return this._left=e,this}get right(){return this._right}setRight(e){return this._right=e,this}toString(){return null!=this._left&&null!=this._right?`${this._left.toString()}.${this._right.toString()}`:""}}class IPv4Address{constructor(e={}){this._network=null,null!=e.network&&this.setNetwork(e.network),this._host=null,null!=e.host&&this.setHost(e.host)}get newtork(){return this._network}setNetwork(e){return this._network=e,this}get host(){return this._host}setHost(e){return this._host=e,this}static _fromProtobuf(e){return new IPv4Address({network:(new IPv4AddressPart).setLeft(e[0]).setRight(e[1]),host:(new IPv4AddressPart).setLeft(e[2]).setRight(e[3])})}_toProtobuf(){return Uint8Array.of(null!=this._network&&null!=this._network._left?this._network._left:0,null!=this._network&&null!=this._network.right?this._network.right:0,null!=this._host&&null!=this._host.left?this._host.left:0,null!=this._host&&null!=this._host.right?this._host.right:0)}static _fromString(e){const t=e.split(".");if(4!==t.length)throw new Error("Invalid IPv4 address format");const n=(new IPv4AddressPart).setLeft(Number(t[0])).setRight(Number(t[1])),r=(new IPv4AddressPart).setLeft(Number(t[2])).setRight(Number(t[3]));return new IPv4Address({network:n,host:r})}toString(){return null!=this._network&&null!=this._host?`${this._network.toString()}.${this._host.toString()}`:""}}class EndPoint{constructor(e={}){this._address=null,null!=e.address&&this.setAddress(e.address),this._port=null,null!=e.port&&this.setPort(e.port)}get address(){return this._address}setAddress(e){return this._address=e,this}get port(){return this._port}setPort(e){return this._port=e,this}static _fromProtobuf(e){let t;return e.domainName?t=e.domainName:e.ipAddressV4&&(t=IPv4Address._fromProtobuf(e.ipAddressV4)),new EndPoint({address:t,port:null!=e.port?e.port:void 0})}_toProtobuf(){return"string"!=typeof this._address?{ipAddressV4:null!=this._address?this._address._toProtobuf():null,port:this._port}:{domainName:this._address,port:this._port}}static fromJSON(e){return new EndPoint({address:e.address||void 0,port:null!=e.port?parseInt(e.port,10):void 0})}toString(){return`${null!=this._address?this._address.toString():""}:${null!=this._port?this._port.toString():""}`}toJSON(){return{address:null!=this._address?this._address.toString():null,port:null!=this._port?this._port.toString():null}}}class NodeAddress{constructor(e={}){this._publicKey=null,null!=e.publicKey&&this.setPublicKey(e.publicKey),this._nodeId=null,null!=e.nodeId&&this.setNodeId(e.nodeId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._certHash=null,null!=e.certHash&&this.setCertHash(e.certHash),this._addresses=[],null!=e.addresses&&this.setAddresses(e.addresses),this._description=null,null!=e.description&&this.setDescription(e.description),this._stake=null,null!=e.stake&&this.setStake(e.stake)}get publicKey(){return this._publicKey}setPublicKey(e){return this._publicKey=e,this}get nodeId(){return this._nodeId}setNodeId(e){return this._nodeId=e,this}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get certHash(){return this._certHash}setCertHash(e){return this._certHash=e,this}get addresses(){return this._addresses}setAddresses(e){return this._addresses=e,this}get description(){return this._description}setDescription(e){return this._description=e,this}get stake(){return this._stake}setStake(e){return this._stake=e,this}static _fromProtobuf(e){return new NodeAddress({publicKey:null!=e.RSA_PubKey?e.RSA_PubKey:void 0,nodeId:null!=e.nodeId?e.nodeId:void 0,accountId:null!=e.nodeAccountId?AccountId._fromProtobuf(e.nodeAccountId):void 0,certHash:null!=e.nodeCertHash?e.nodeCertHash:void 0,addresses:null!=e.serviceEndpoint?e.serviceEndpoint.map(e=>EndPoint._fromProtobuf(e)):void 0,description:null!=e.description?e.description:void 0,stake:null!=e.stake?e.stake:void 0})}_toProtobuf(){return{RSA_PubKey:this._publicKey,nodeId:this._nodeId,nodeAccountId:null!=this._accountId?this._accountId._toProtobuf():null,nodeCertHash:this._certHash,serviceEndpoint:this._addresses.map(e=>e._toProtobuf()),description:this._description,stake:this._stake}}static fromJSON(e){return new NodeAddress({publicKey:e.publicKey??void 0,nodeId:null!=e.nodeId?Long.fromString(e.nodeId):void 0,accountId:e.accountId?AccountId.fromString(e.accountId):void 0,certHash:null!=e.certHash?encode$1(e.certHash):void 0,addresses:null!=e.addresses?e.addresses.map(e=>EndPoint.fromJSON(e)):void 0,description:e.description??void 0,stake:null!=e.stake?Long.fromString(e.stake):void 0})}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{publicKey:this._publicKey,nodeId:null!=this._nodeId?this._nodeId.toString():null,accountId:null!=this._accountId?this._accountId.toString():null,certHash:null!=this._certHash?decode$1(this._certHash):null,addresses:this._addresses.map(e=>e.toJSON()),description:this._description,stake:null!=this._stake?this._stake.toString():null}}}class NodeAddressBook{constructor(e={}){this._nodeAddresses=[],null!=e.nodeAddresses&&this.setNodeAddresses(e.nodeAddresses)}get nodeAddresses(){return this._nodeAddresses}setNodeAddresses(e){return this._nodeAddresses=e,this}static fromBytes(e){return NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(e))}static _fromProtobuf(e){return new NodeAddressBook({nodeAddresses:null!=e.nodeAddress?e.nodeAddress.map(e=>NodeAddress._fromProtobuf(e)):void 0})}_toProtobuf(){return{nodeAddress:this._nodeAddresses.map(e=>e._toProtobuf())}}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{nodeAddresses:this._nodeAddresses.map(e=>e.toJSON())}}toBytes(){return libExports.proto.NodeAddressBook.encode(this._toProtobuf()).finish()}}class SemanticVersion{constructor(e){this.major=e.major,this.minor=e.minor,this.patch=e.patch,Object.freeze(this)}static _fromProtobuf(e){return new SemanticVersion({major:e.major,minor:e.minor,patch:e.patch})}_toProtobuf(){return{major:this.major,minor:this.minor,patch:this.patch}}static fromBytes(e){return SemanticVersion._fromProtobuf(libExports.proto.SemanticVersion.decode(e))}toBytes(){return libExports.proto.SemanticVersion.encode(this._toProtobuf()).finish()}}class NetworkVersionInfo{constructor(e){this.protobufVersion=e.protobufVersion,this.servicesVersion=e.servicesVersion,Object.freeze(this)}static _fromProtobuf(e){return new NetworkVersionInfo({protobufVersion:SemanticVersion._fromProtobuf(e.hapiProtoVersion),servicesVersion:SemanticVersion._fromProtobuf(e.hederaServicesVersion)})}_toProtobuf(){return{hapiProtoVersion:this.protobufVersion._toProtobuf(),hederaServicesVersion:this.servicesVersion._toProtobuf()}}static fromBytes(e){return NetworkVersionInfo._fromProtobuf(libExports.proto.NetworkGetVersionInfoResponse.decode(e))}toBytes(){return libExports.proto.NetworkGetVersionInfoResponse.encode(this._toProtobuf()).finish()}}class NetworkVersionInfoQuery extends Query{constructor(){super()}static _fromProtobuf(e){return new NetworkVersionInfoQuery}_execute(e,t){return e.network.getVersionInfo(t)}_mapResponseHeader(e){return e.networkGetVersionInfo.header}_mapResponse(e){const t=e.networkGetVersionInfo;return Promise.resolve(NetworkVersionInfo._fromProtobuf(t))}_onMakeRequest(e){return{networkGetVersionInfo:{header:e}}}_getLogId(){return`NetworkVersionInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("networkGetVersionInfo",NetworkVersionInfoQuery._fromProtobuf);var Provider={};class PrngTransaction extends Transaction{constructor(e={}){super(),this._range=null,null!=e.range&&this.setRange(e.range)}setRange(e){return this._range=e,this}get range(){return this._range}_validateChecksums(e){null!=this._range&&isNumber(this._range)&&this._validateChecksums(e)}_execute(e,t){return e.util.prng(t)}static _fromProtobuf(e,t,n,r,o){const i=o[0].utilPrng;return Transaction._fromProtobufTransactions(new PrngTransaction({range:i.range}),e,t,n,r,o)}_getTransactionDataCase(){return"utilPrng"}_makeTransactionData(){return{range:this.range}}_getLogId(){return`RandomGenerate:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("utilPrng",PrngTransaction._fromProtobuf);class ProxyStaker{constructor(e){this.accountId=e.accountId,this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),Object.freeze(this)}static _fromProtobuf(e){return new ProxyStaker({accountId:AccountId._fromProtobuf(e.accountID),amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars()}}}class ScheduleCreateTransaction extends Transaction{constructor(e={}){super(),this._adminKey=null,this._scheduledTransaction=null,this._payerAccountId=null,this._scheduleMemo=null,this._scheduledSignerPublicKeys=new Set,this._expirationTime=null,this._waitForExpiry=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.payerAccountID&&this.setPayerAccountId(e.payerAccountID),null!=e.scheduleMemo&&this.setScheduleMemo(e.scheduleMemo),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const i=o[0],a=i.scheduleCreate,s=new ScheduleCreateTransaction({adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,payerAccountID:null!=a.payerAccountID?AccountId._fromProtobuf(a.payerAccountID):void 0,scheduleMemo:null!=a.memo?a.memo:void 0,waitForExpiry:null!=a.waitForExpiry?a.waitForExpiry:void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0});if(null!=i.scheduleCreate){const e=i.scheduleCreate.scheduledTransactionBody,t=libExports.proto.TransactionBody.encode(e).finish(),n={signedTransactionBytes:libExports.proto.SignedTransaction.encode({bodyBytes:t}).finish()},r=libExports.proto.TransactionList.encode({transactionList:[n]}).finish(),o=Transaction.fromBytes(r);s._setScheduledTransaction(o)}return Transaction._fromProtobufTransactions(s,e,t,n,r,o)}_setScheduledTransaction(e){return this._scheduledTransaction=e,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get payerAccountId(){return this._payerAccountId}setPayerAccountId(e){return this._requireNotFrozen(),this._payerAccountId=e,this}setScheduleMemo(e){return this._requireNotFrozen(),this._scheduleMemo=e,this}get getScheduleMemo(){return this._requireNotFrozen(),this._scheduleMemo}setScheduledTransaction(e){return this._requireNotFrozen(),e._requireNotFrozen(),this._scheduledTransaction=e.schedule()._scheduledTransaction,this}_validateChecksums(e){null!=this._payerAccountId&&this._payerAccountId.validateChecksum(e)}_execute(e,t){return e.schedule.createSchedule(t)}_getTransactionDataCase(){return"scheduleCreate"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,payerAccountID:null!=this._payerAccountId?this._payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this._scheduledTransaction?this._scheduledTransaction._getScheduledTransactionBody():null,memo:this._scheduleMemo,waitForExpiry:this._waitForExpiry,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`ScheduleCreateTransaction:${this._transactionIds.current.validStart.toString()}`}setExpirationTime(e){return this._expirationTime=e,this}get expirationTime(){return this._requireNotFrozen(),this._expirationTime}setWaitForExpiry(e){return this._waitForExpiry=e,this}get waitForExpiry(){return this._requireNotFrozen(),this._waitForExpiry}}TRANSACTION_REGISTRY.set("scheduleCreate",ScheduleCreateTransaction._fromProtobuf),SCHEDULE_CREATE_TRANSACTION.push(()=>new ScheduleCreateTransaction);class ScheduleDeleteTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const i=o[0].scheduleDelete;return Transaction._fromProtobufTransactions(new ScheduleDeleteTransaction({scheduleId:null!=i.scheduleID?ScheduleId._fromProtobuf(i.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.deleteSchedule(t)}_getTransactionDataCase(){return"scheduleDelete"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleDelete",ScheduleDeleteTransaction._fromProtobuf);const{proto:proto$1}=HieroProto;class ScheduleInfo{constructor(e){this.scheduleId=e.scheduleId,this.creatorAccountId=e.creatorAccountID,this.payerAccountId=e.payerAccountID,this.schedulableTransactionBody=e.schedulableTransactionBody,this.signers=e.signers,this.scheduleMemo=e.scheduleMemo,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.executed=e.executed,this.deleted=e.deleted,this.scheduledTransactionId=e.scheduledTransactionId,this.waitForExpiry=e.waitForExpiry,Object.freeze(this)}static _fromProtobuf(e){return new ScheduleInfo({scheduleId:ScheduleId._fromProtobuf(e.scheduleID),creatorAccountID:null!=e.creatorAccountID?AccountId._fromProtobuf(e.creatorAccountID):null,payerAccountID:null!=e.payerAccountID?AccountId._fromProtobuf(e.payerAccountID):null,schedulableTransactionBody:null!=e.scheduledTransactionBody?e.scheduledTransactionBody:null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,signers:null!=e.signers?KeyList.__fromProtobufKeyList(e.signers):null,scheduleMemo:null!=e.memo?e.memo:null,expirationTime:null!=e.expirationTime?Timestamp._fromProtobuf(e.expirationTime):null,executed:null!=e.executionTime?Timestamp._fromProtobuf(e.executionTime):null,deleted:null!=e.deletionTime?Timestamp._fromProtobuf(e.deletionTime):null,scheduledTransactionId:null!=e.scheduledTransactionID?TransactionId._fromProtobuf(e.scheduledTransactionID):null,waitForExpiry:null!=e.waitForExpiry&&e.waitForExpiry})}_toProtobuf(){return{scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,creatorAccountID:null!=this.creatorAccountId?this.creatorAccountId._toProtobuf():null,payerAccountID:null!=this.payerAccountId?this.payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this.schedulableTransactionBody?this.schedulableTransactionBody:null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,signers:null!=this.signers?this.signers._toProtobufKey().keyList:null,memo:null!=this.scheduleMemo?this.scheduleMemo:"",expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,waitForExpiry:this.waitForExpiry}}get scheduledTransaction(){if(null==this.schedulableTransactionBody)throw new Error("Scheduled transaction body is empty");const e=new proto$1.SchedulableTransactionBody(this.schedulableTransactionBody),t=e.data;return Transaction.fromBytes(proto$1.TransactionList.encode({transactionList:[{signedTransactionBytes:proto$1.SignedTransaction.encode({bodyBytes:proto$1.TransactionBody.encode({transactionFee:this.schedulableTransactionBody.transactionFee,memo:this.schedulableTransactionBody.memo,[t]:e[t]}).finish()}).finish()}]}).finish())}}class ScheduleInfoQuery extends Query{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId)}static _fromProtobuf(e){const t=e.scheduleGetInfo;return new ScheduleInfoQuery({scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):void 0})}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.getScheduleInfo(t)}_mapResponseHeader(e){return e.scheduleGetInfo.header}_mapResponse(e,t,n){const r=e.scheduleGetInfo;return Promise.resolve(ScheduleInfo._fromProtobuf(r.scheduleInfo))}_onMakeRequest(e){return{scheduleGetInfo:{header:e,scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}}_getLogId(){return`ScheduleInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("scheduleGetInfo",ScheduleInfoQuery._fromProtobuf);class ScheduleSignTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const i=o[0].scheduleSign;return Transaction._fromProtobufTransactions(new ScheduleSignTransaction({scheduleId:null!=i.scheduleID?ScheduleId._fromProtobuf(i.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.signSchedule(t)}_getTransactionDataCase(){return"scheduleSign"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleSignTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleSign",ScheduleSignTransaction._fromProtobuf);var Signer={};class SignerSignature{constructor(e){this.publicKey=e.publicKey,this.signature=e.signature,this.accountId=e.accountId}}class SubscriptionHandle{constructor(){this._call=null,this._unsubscribed=!1}_setCall(e){this._call=e}unsubscribe(){null!=this._call&&(this._unsubscribed=!0,this._call())}}class SystemDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,this._expirationTime=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const i=o[0].systemDelete;return Transaction._fromProtobufTransactions(new SystemDeleteTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e,this}_execute(e,t){return null!=this._fileId?e.file.systemDelete(t):e.smartContract.systemDelete(t)}_getTransactionDataCase(){return"systemDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`SystemDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemDelete",SystemDeleteTransaction._fromProtobuf);class SystemUndeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].systemUndelete;return Transaction._fromProtobufTransactions(new SystemUndeleteTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}_execute(e,t){return null!=this._fileId?e.file.systemUndelete(t):e.smartContract.systemUndelete(t)}_getTransactionDataCase(){return"systemUndelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}_getLogId(){return`SystemUndeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemUndelete",SystemUndeleteTransaction._fromProtobuf);class TokenAssociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenAssociate;return Transaction._fromProtobufTransactions(new TokenAssociateTransaction({tokenIds:null!=i.tokens?i.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.associateTokens(t)}_getTransactionDataCase(){return"tokenAssociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenAssociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAssociate",TokenAssociateTransaction._fromProtobuf);class TokenBurnTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._serials=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenBurn;return Transaction._fromProtobufTransactions(new TokenBurnTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,amount:null!=i.amount?i.amount:void 0,serials:null!=i.serialNumbers?i.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>e instanceof Long?e:Long.fromValue(e)),this}_execute(e,t){return e.token.burnToken(t)}_getTransactionDataCase(){return"tokenBurn"}_makeTransactionData(){return{amount:this._amount,serialNumbers:this._serials,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenBurnTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenBurn",TokenBurnTransaction._fromProtobuf);class TokenReference{constructor(){this.fungibleToken=null,this.nft=null}static _fromProtobuf(e){return{fungibleToken:null!=e.fungibleToken?TokenId._fromProtobuf(e.fungibleToken):null,nft:null!=e.nft?NftId._fromProtobuf(e.nft):null}}}class TokenRejectTransaction extends Transaction{constructor(e={}){super(),this._owner=null,null!=e.owner&&this.setOwnerId(e.owner),this._tokenIds=[],this._nftIds=[],null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.nftIds&&this.setNftIds(e.nftIds)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenReject,a=i.rejections?.map(e=>TokenReference._fromProtobuf(e)),s=a?.filter(e=>e.fungibleToken).map(({fungibleToken:e})=>{if(null==e)throw new Error("Fungible Token cannot be null");return e}),c=a?.filter(e=>e.nft).map(({nft:e})=>{if(null==e)throw new Error("Nft cannot be null");return e});return Transaction._fromProtobufTransactions(new TokenRejectTransaction({owner:null!=i.owner?AccountId._fromProtobuf(i.owner):void 0,tokenIds:s,nftIds:c}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this._requireNotFrozen(),this._tokenIds?.push(e),this}get nftIds(){return this._nftIds}setNftIds(e){return this._requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this._requireNotFrozen(),this._nftIds?.push(e),this}get ownerId(){return this._owner}setOwnerId(e){return this._requireNotFrozen(),this._owner=e,this}_execute(e,t){return e.token.rejectToken(t)}_getTransactionDataCase(){return"tokenReject"}_makeTransactionData(){const e=[];for(const t of this._tokenIds)e.push({fungibleToken:t._toProtobuf()});for(const t of this._nftIds)e.push({nft:t._toProtobuf()});return{owner:this.ownerId?._toProtobuf()??null,rejections:e}}_getLogId(){return`TokenRejectTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenReject",TokenRejectTransaction._fromProtobuf);class TokenDissociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenDissociate;return Transaction._fromProtobufTransactions(new TokenDissociateTransaction({tokenIds:null!=i.tokens?i.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.dissociateTokens(t)}_getTransactionDataCase(){return"tokenDissociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenDissociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDissociate",TokenDissociateTransaction._fromProtobuf);class TokenRejectFlow{constructor(){this._ownerId=null,this._tokenIds=[],this._nftIds=[],this._freezeWithClient=null,this._signPrivateKey=null,this._signPublicKey=null,this._transactionSigner=null}setOwnerId(e){return this.requireNotFrozen(),this._ownerId=e,this}get ownerId(){return this._ownerId}setTokenIds(e){return this.requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this.requireNotFrozen(),this._tokenIds.push(e),this}get tokenIds(){return this._tokenIds}setNftIds(e){return this.requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this.requireNotFrozen(),this._nftIds.push(e),this}get nftIds(){return this._nftIds}sign(e){return this._signPrivateKey=e,this._signPublicKey=null,this._transactionSigner=null,this}signWith(e,t){return this._signPublicKey=e,this._transactionSigner=t,this._signPrivateKey=null,this}signWithOperator(e){const t=e.getOperator();if(null==t)throw new Error("Client operator must be set");return this._signPublicKey=t.publicKey,this._transactionSigner=t.transactionSigner,this._signPrivateKey=null,this}fillOutTransaction(e){this._freezeWithClient&&e.freezeWith(this._freezeWithClient),this._signPrivateKey?e.sign(this._signPrivateKey):this._signPublicKey&&this._transactionSigner&&e.signWith(this._signPublicKey,this._transactionSigner)}freezeWith(e){return this._freezeWithClient=e,this}async execute(e){const t=(new TokenRejectTransaction).setTokenIds(this.tokenIds).setNftIds(this.nftIds);this.ownerId&&t.setOwnerId(this.ownerId),this.fillOutTransaction(t);const n=this.nftIds.map(e=>e.tokenId).filter(function(e,t,n){return n.indexOf(e)===t}),r=(new TokenDissociateTransaction).setTokenIds([...this.tokenIds,...n]);null!=this.ownerId&&r.setAccountId(this.ownerId),this.fillOutTransaction(r);const o=await t.execute(e);await o.getReceipt(e);const i=await r.execute(e);return await i.getReceipt(e),o}requireNotFrozen(){if(null!=this._freezeWithClient)throw new Error("Transaction is already frozen and cannot be modified")}}class TokenType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenType.FungibleCommon:return"FUNGIBLE_COMMON";case TokenType.NonFungibleUnique:return"NON_FUNGIBLE_UNIQUE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenType.FungibleCommon;case 1:return TokenType.NonFungibleUnique}throw new Error(`(BUG) TokenType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenType.FungibleCommon=new TokenType(0),TokenType.NonFungibleUnique=new TokenType(1);class TokenSupplyType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenSupplyType.Infinite:return"INFINITE";case TokenSupplyType.Finite:return"FINITE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenSupplyType.Infinite;case 1:return TokenSupplyType.Finite}throw new Error(`(BUG) TokenSupplyType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenSupplyType.Infinite=new TokenSupplyType(0),TokenSupplyType.Finite=new TokenSupplyType(1);class TokenCreateTransaction extends Transaction{constructor(e={}){super(),this._tokenName=null,this._tokenSymbol=null,this._decimals=null,this._initialSupply=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._pauseKey=null,this._wipeKey=null,this._supplyKey=null,this._feeScheduleKey=null,this._freezeDefault=null,this._autoRenewAccountId=null,this._expirationTime=new Timestamp(Math.floor(Date.now()/1e3+DEFAULT_AUTO_RENEW_PERIOD.toNumber()),0),this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._tokenMemo=null,this._customFees=[],this._tokenType=null,this._supplyType=null,this._maxSupply=null,this._defaultMaxTransactionFee=new Hbar(30),this._metadataKey=null,this._metadata=null,null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.decimals&&this.setDecimals(e.decimals),null!=e.initialSupply&&this.setInitialSupply(e.initialSupply),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.freezeDefault&&this.setFreezeDefault(e.freezeDefault),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.tokenType&&this.setTokenType(e.tokenType),null!=e.supplyType&&this.setSupplyType(e.supplyType),null!=e.maxSupply&&this.setMaxSupply(e.maxSupply),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenCreation;return Transaction._fromProtobufTransactions(new TokenCreateTransaction({tokenName:null!=i.name?i.name:void 0,tokenSymbol:null!=i.symbol?i.symbol:void 0,decimals:null!=i.decimals?i.decimals:void 0,initialSupply:null!=i.initialSupply?i.initialSupply:void 0,treasuryAccountId:null!=i.treasury?AccountId._fromProtobuf(i.treasury):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,kycKey:null!=i.kycKey?Key._fromProtobufKey(i.kycKey):void 0,freezeKey:null!=i.freezeKey?Key._fromProtobufKey(i.freezeKey):void 0,pauseKey:null!=i.pauseKey?Key._fromProtobufKey(i.pauseKey):void 0,wipeKey:null!=i.wipeKey?Key._fromProtobufKey(i.wipeKey):void 0,supplyKey:null!=i.supplyKey?Key._fromProtobufKey(i.supplyKey):void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,freezeDefault:null!=i.freezeDefault?i.freezeDefault:void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,expirationTime:null!=i.expiry?Timestamp._fromProtobuf(i.expiry):void 0,autoRenewPeriod:null!=i.autoRenewPeriod?Duration._fromProtobuf(i.autoRenewPeriod):void 0,tokenMemo:null!=i.memo?i.memo:void 0,customFees:null!=i.customFees?i.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0,tokenType:null!=i.tokenType?TokenType._fromCode(i.tokenType):void 0,supplyType:null!=i.supplyType?TokenSupplyType._fromCode(i.supplyType):void 0,maxSupply:null!=i.maxSupply?i.maxSupply:void 0,metadataKey:null!=i.metadataKey?Key._fromProtobufKey(i.metadataKey):void 0,metadata:null!=i.metadata?i.metadata:void 0}),e,t,n,r,o)}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get decimals(){return this._decimals}setDecimals(e){return this._requireNotFrozen(),this._decimals=e instanceof Long?e:Long.fromValue(e),this}get initialSupply(){return this._initialSupply}setInitialSupply(e){return this._requireNotFrozen(),this._initialSupply=convertAmountToLong(e),this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId&&null!=this.autoRenewPeriod?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&null!=this.autoRenewPeriod&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get freezeDefault(){return this._freezeDefault}setFreezeDefault(e){return this._requireNotFrozen(),this._freezeDefault=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this._autoRenewPeriod=null,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get customFees(){return this._customFees}setCustomFees(e){return this._customFees=e,this}get tokenType(){return this._tokenType}setTokenType(e){return this._tokenType=e,this}get supplyType(){return this._supplyType}setSupplyType(e){return this._supplyType=e,this}get maxSupply(){return this._maxSupply}setMaxSupply(e){return this._maxSupply=convertAmountToLong(e),this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.createToken(t)}_getTransactionDataCase(){return"tokenCreation"}_makeTransactionData(){return{name:this._tokenName,symbol:this._tokenSymbol,decimals:null!=this._decimals?this._decimals.toInt():null,initialSupply:this._initialSupply,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,freezeDefault:this._freezeDefault,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:this._tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this._tokenType?this._tokenType._code:null,supplyType:null!=this._supplyType?this._supplyType._code:null,maxSupply:this.maxSupply,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?this._metadata:void 0}}_getLogId(){return`TokenCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCreation",TokenCreateTransaction._fromProtobuf);class TokenDeleteTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenDeletion;return Transaction._fromProtobufTransactions(new TokenDeleteTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.deleteToken(t)}_getTransactionDataCase(){return"tokenDeletion"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDeletion",TokenDeleteTransaction._fromProtobuf);class TokenFeeScheduleUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._customFees=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.customFees&&this.setCustomFees(e.customFees)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenFeeScheduleUpdate;return Transaction._fromProtobufTransactions(new TokenFeeScheduleUpdateTransaction({tokenId:null!=i.tokenId?TokenId._fromProtobuf(i.tokenId):void 0,customFees:null!=i.customFees?i.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get customFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}_execute(e,t){return e.token.updateTokenFeeSchedule(t)}_getTransactionDataCase(){return"tokenFeeScheduleUpdate"}_makeTransactionData(){return{tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,customFees:this._customFees.map(e=>e._toProtobuf())}}_getLogId(){return`TokenFeeScheduleUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFeeScheduleUpdate",TokenFeeScheduleUpdateTransaction._fromProtobuf);class TokenFreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenFreeze;return Transaction._fromProtobufTransactions(new TokenFreezeTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.freezeTokenAccount(t)}_getTransactionDataCase(){return"tokenFreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenFreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFreeze",TokenFreezeTransaction._fromProtobuf);class TokenGrantKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenGrantKyc;return Transaction._fromProtobufTransactions(new TokenGrantKycTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.grantKycToTokenAccount(t)}_getTransactionDataCase(){return"tokenGrantKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenGrantKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenGrantKyc",TokenGrantKycTransaction._fromProtobuf);class TokenInfo{constructor(e){this.tokenId=e.tokenId,this.name=e.name,this.symbol=e.symbol,this.decimals=e.decimals,this.totalSupply=e.totalSupply,this.treasuryAccountId=e.treasuryAccountId,this.adminKey=e.adminKey,this.kycKey=e.kycKey,this.freezeKey=e.freezeKey,this.pauseKey=e.pauseKey,this.wipeKey=e.wipeKey,this.supplyKey=e.supplyKey,this.feeScheduleKey=e.feeScheduleKey,this.defaultFreezeStatus=e.defaultFreezeStatus,this.defaultKycStatus=e.defaultKycStatus,this.pauseStatus=e.pauseStatus,this.isDeleted=e.isDeleted,this.autoRenewAccountId=e.autoRenewAccountId,this.autoRenewPeriod=e.autoRenewPeriod,this.expirationTime=e.expirationTime,this.tokenMemo=e.tokenMemo,this.customFees=e.customFees,this.tokenType=e.tokenType,this.supplyType=e.supplyType,this.maxSupply=e.maxSupply,this.ledgerId=e.ledgerId,this.metadataKey=e.metadataKey,this.metadata=e.metadata}static _fromProtobuf(e){const t=e.defaultFreezeStatus,n=e.defaultKycStatus,r=e.pauseStatus,o=null!=e.autoRenewAccount?AccountId._fromProtobuf(e.autoRenewAccount):new AccountId(0);return new TokenInfo({tokenId:TokenId._fromProtobuf(e.tokenId),name:e.name,symbol:e.symbol,decimals:e.decimals,totalSupply:Long.fromValue(e.totalSupply),treasuryAccountId:null!=e.treasury?AccountId._fromProtobuf(e.treasury):null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,kycKey:null!=e.kycKey?Key._fromProtobufKey(e.kycKey):null,freezeKey:null!=e.freezeKey?Key._fromProtobufKey(e.freezeKey):null,pauseKey:null!=e.pauseKey?Key._fromProtobufKey(e.pauseKey):null,wipeKey:null!=e.wipeKey?Key._fromProtobufKey(e.wipeKey):null,supplyKey:null!=e.supplyKey?Key._fromProtobufKey(e.supplyKey):null,feeScheduleKey:null!=e.feeScheduleKey?Key._fromProtobufKey(e.feeScheduleKey):null,defaultFreezeStatus:0===t?null:1==t,defaultKycStatus:0===n?null:1==n,pauseStatus:0===r?null:1==r,isDeleted:e.deleted,autoRenewAccountId:0!=o.shard.toInt()||0!=o.realm.toInt()||0!=o.num.toInt()?o:null,autoRenewPeriod:null!=e.autoRenewPeriod?Duration._fromProtobuf(e.autoRenewPeriod):null,expirationTime:null!=e.expiry?Timestamp._fromProtobuf(e.expiry):null,tokenMemo:null!=e.memo?e.memo:"",customFees:null!=e.customFees?e.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):[],tokenType:null!=e.tokenType?TokenType._fromCode(e.tokenType):null,supplyType:null!=e.supplyType?TokenSupplyType._fromCode(e.supplyType):null,maxSupply:null!=e.maxSupply?e.maxSupply:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,metadataKey:null!=e.metadataKey?Key._fromProtobufKey(e.metadataKey):null,metadata:null!=e.metadata?e.metadata:new Uint8Array})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),name:this.name,symbol:this.symbol,decimals:this.decimals,totalSupply:this.totalSupply,treasury:null!=this.treasuryAccountId?this.treasuryAccountId._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,kycKey:null!=this.kycKey?this.kycKey._toProtobufKey():null,freezeKey:null!=this.freezeKey?this.freezeKey._toProtobufKey():null,pauseKey:null!=this.pauseKey?this.pauseKey._toProtobufKey():null,wipeKey:null!=this.wipeKey?this.wipeKey._toProtobufKey():null,supplyKey:null!=this.supplyKey?this.supplyKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,defaultFreezeStatus:null==this.defaultFreezeStatus?0:this.defaultFreezeStatus?1:2,defaultKycStatus:null==this.defaultKycStatus?0:this.defaultKycStatus?1:2,pauseStatus:null==this.pauseStatus?0:this.pauseStatus?1:2,deleted:this.isDeleted,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():void 0,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,expiry:null!=this.expirationTime?this.expirationTime._toProtobuf():null,memo:this.tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this.tokenType?this.tokenType._code:null,supplyType:null!=this.supplyType?this.supplyType._code:null,maxSupply:this.maxSupply,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,metadataKey:null!=this.metadataKey?this.metadataKey._toProtobufKey():null,metadata:null!=this.metadata?this.metadata:null}}static fromBytes(e){return TokenInfo._fromProtobuf(libExports.proto.TokenInfo.decode(e))}toBytes(){return libExports.proto.TokenInfo.encode(this._toProtobuf()).finish()}}class TokenInfoQuery extends Query{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e){const t=e.tokenGetInfo;return new TokenInfoQuery({tokenId:null!=t.token?TokenId._fromProtobuf(t.token):void 0})}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.getTokenInfo(t)}_mapResponseHeader(e){return e.tokenGetInfo.header}_mapResponse(e,t,n){const r=e.tokenGetInfo;return Promise.resolve(TokenInfo._fromProtobuf(r.tokenInfo))}_onMakeRequest(e){return{tokenGetInfo:{header:e,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}}_getLogId(){return`TokenInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetInfo",TokenInfoQuery._fromProtobuf);class TokenMintTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._metadata=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenMint;return Transaction._fromProtobufTransactions(new TokenMintTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,amount:null!=i.amount?i.amount:void 0,metadata:null!=i.metadata?i.metadata:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get metadata(){return this._metadata}addMetadata(e){return this._requireNotFrozen(),"string"==typeof e&&console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead."),this._metadata.push("string"==typeof e?decode$8(e):e),this}setMetadata(e){this._requireNotFrozen();for(const t of e)if("string"==typeof t){console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.");break}return this._metadata=e.map(e=>"string"==typeof e?decode$8(e):e),this}_execute(e,t){return e.token.mintToken(t)}_getTransactionDataCase(){return"tokenMint"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,metadata:this._metadata}}_getLogId(){return`TokenMintTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenMint",TokenMintTransaction._fromProtobuf);class TokenNftInfo{constructor(e){this.nftId=e.nftId,this.accountId=e.accountId,this.creationTime=e.creationTime,this.metadata=e.metadata,this.ledgerId=e.ledgerId,this.spenderId=e.spenderId,Object.freeze(this)}static _fromProtobuf(e){return new TokenNftInfo({nftId:NftId._fromProtobuf(e.nftID),accountId:AccountId._fromProtobuf(e.accountID),creationTime:Timestamp._fromProtobuf(e.creationTime),metadata:void 0!==e.metadata?e.metadata:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,spenderId:null!=e.spenderId?AccountId._fromProtobuf(e.spenderId):null})}_toProtobuf(){return{nftID:this.nftId._toProtobuf(),accountID:this.accountId._toProtobuf(),creationTime:this.creationTime._toProtobuf(),metadata:this.metadata,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,spenderId:null!=this.spenderId?this.spenderId._toProtobuf():null}}toJson(){return{nftId:this.nftId.toString(),accountId:this.accountId.toString(),creationTime:this.creationTime.toString(),metadata:null!=this.metadata?encode$5(this.metadata):null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,spenderId:null!=this.spenderId?this.spenderId.toString():null}}toString(){return JSON.stringify(this.toJson())}}class TokenNftInfoQuery extends Query{constructor(e={}){super(),this._nftId=null,null!=e.nftId&&this.setNftId(e.nftId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._start=null,null!=e.start&&this.setStart(e.start),this._end=null,null!=e.end&&this.setEnd(e.end)}static _fromProtobuf(e){if(null!=e.tokenGetNftInfo){const t=e.tokenGetNftInfo;return new TokenNftInfoQuery({nftId:null!=t.nftID?NftId._fromProtobuf(t.nftID):void 0})}if(null!=e.tokenGetAccountNftInfos){const t=e.tokenGetAccountNftInfos;return new TokenNftInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}{const t=e.tokenGetNftInfos;return new TokenNftInfoQuery({tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}}get nftId(){return this._nftId}setNftId(e){return this._nftId="string"==typeof e?NftId.fromString(e):NftId._fromProtobuf(e._toProtobuf()),this}get accountId(){return console.warn("`TokenNftInfoQuery.accountId` is deprecated with no replacement"),this._accountId}setAccountId(e){return console.warn("`TokenNftInfoQuery.setAccountId()` is deprecated with no replacement"),this._accountId="string"==typeof e?AccountId.fromString(e):AccountId._fromProtobuf(e._toProtobuf()),this}get tokenId(){return console.warn("`TokenNftInfoQuery.tokenId` is deprecated with no replacement"),this._tokenId}setTokenId(e){return console.warn("`TokenNftInfoQuery.setTokenId()` is deprecated with no replacement"),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get start(){return console.warn("`TokenNftInfoQuery.start` is deprecated with no replacement"),this._start}setStart(e){return console.warn("`TokenNftInfoQuery.setStart()` is deprecated with no replacement"),this._start="number"==typeof e?Long.fromNumber(e):e,this}get end(){return console.warn("`TokenNftInfoQuery.end` is deprecated with no replacement"),this._end}setEnd(e){return console.warn("`TokenNftInfoQuery.setEnd()` is deprecated with no replacement"),this._end="number"==typeof e?Long.fromNumber(e):e,this}async getCost(e){return super.getCost(e)}_execute(e,t){return e.token.getTokenNftInfo(t)}_mapResponseHeader(e){return e.tokenGetNftInfo.header}_mapResponse(e,t,n){const r=[e.tokenGetNftInfo.nft];return Promise.resolve(r.map(e=>TokenNftInfo._fromProtobuf(e)))}_onMakeRequest(e){return{tokenGetNftInfo:{header:e,nftID:null!=this._nftId?this._nftId._toProtobuf():null}}}_getLogId(){return`TokenNftInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetNftInfo",TokenNftInfoQuery._fromProtobuf);class TokenPauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenPause;return Transaction._fromProtobufTransactions(new TokenPauseTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenPause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenPauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenPause",TokenPauseTransaction._fromProtobuf);class TokenRevokeKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenRevokeKyc;return Transaction._fromProtobufTransactions(new TokenRevokeKycTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.revokeKycFromTokenAccount(t)}_getTransactionDataCase(){return"tokenRevokeKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenRevokeKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenRevokeKyc",TokenRevokeKycTransaction._fromProtobuf);class TokenUnfreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUnfreeze;return Transaction._fromProtobufTransactions(new TokenUnfreezeTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.unfreezeTokenAccount(t)}_getTransactionDataCase(){return"tokenUnfreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenUnfreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnfreeze",TokenUnfreezeTransaction._fromProtobuf);class TokenUnpauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUnpause;return Transaction._fromProtobufTransactions(new TokenUnpauseTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.unpauseToken(t)}_getTransactionDataCase(){return"tokenUnpause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenUnpauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnpause",TokenUnpauseTransaction._fromProtobuf);class TokenKeyValidation{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenKeyValidation.FullValidation:return"FULL_VALIDATION";case TokenKeyValidation.NoValidation:return"NO_VALIDATION";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenKeyValidation.FullValidation;case 1:return TokenKeyValidation.NoValidation}throw new Error(`(BUG) TokenKeyValidation.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenKeyValidation.FullValidation=new TokenKeyValidation(0),TokenKeyValidation.NoValidation=new TokenKeyValidation(1);class TokenUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._tokenName=null,this._tokenSymbol=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._wipeKey=null,this._supplyKey=null,this._autoRenewAccountId=null,this._expirationTime=null,this._autoRenewPeriod=null,this._tokenMemo=null,this._feeScheduleKey=null,this._pauseKey=null,this._metadataKey=null,this._metadata=null,this._keyVerificationMode=TokenKeyValidation.FullValidation,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata),null!=e.keyVerificationMode&&this.setKeyVerificationMode(e.keyVerificationMode)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUpdate;return Transaction._fromProtobufTransactions(new TokenUpdateTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,tokenName:Object.hasOwn(i,"name")?i.name:void 0,tokenSymbol:Object.hasOwn(i,"symbol")?i.symbol:void 0,treasuryAccountId:null!=i.treasury?AccountId._fromProtobuf(i.treasury):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,kycKey:null!=i.kycKey?Key._fromProtobufKey(i.kycKey):void 0,freezeKey:null!=i.freezeKey?Key._fromProtobufKey(i.freezeKey):void 0,wipeKey:null!=i.wipeKey?Key._fromProtobufKey(i.wipeKey):void 0,supplyKey:null!=i.supplyKey?Key._fromProtobufKey(i.supplyKey):void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,expirationTime:null!=i.expiry?Timestamp._fromProtobuf(i.expiry):void 0,autoRenewPeriod:null!=i.autoRenewPeriod?Duration._fromProtobuf(i.autoRenewPeriod):void 0,tokenMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,pauseKey:null!=i.pauseKey?Key._fromProtobufKey(i.pauseKey):void 0,metadataKey:null!=i.metadataKey?Key._fromProtobufKey(i.metadataKey):void 0,metadata:null!=i.metadata&&Object.hasOwn(i.metadata,"value")?i.metadata.value:void 0,keyVerificationMode:null!=i.keyVerificationMode?TokenKeyValidation._fromCode(i.keyVerificationMode):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}setsupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}get keyVerificationMode(){return this._keyVerificationMode}setKeyVerificationMode(e){return this._requireNotFrozen(),this._keyVerificationMode=e,this}clearTokenMemo(){return this._requireNotFrozen(),this._tokenMemo=null,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.updateToken(t)}_getTransactionDataCase(){return"tokenUpdate"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,name:null!=this.tokenName?this.tokenName:null,symbol:this.tokenSymbol,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:null!=this._tokenMemo?{value:this._tokenMemo}:null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?{value:this._metadata}:null,keyVerificationMode:null!=this._keyVerificationMode?this._keyVerificationMode._code:void 0}}_getLogId(){return`TokenUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdate",TokenUpdateTransaction._fromProtobuf);class TokenWipeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,this._serials=[],this._amount=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenWipe;return Transaction._fromProtobufTransactions(new TokenWipeTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0,amount:null!=i.amount?i.amount:void 0,serials:null!=i.serialNumbers?i.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>"number"==typeof e?Long.fromNumber(e):e),this}_execute(e,t){return e.token.wipeTokenAccount(t)}_getTransactionDataCase(){return"tokenWipe"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null,serialNumbers:this.serials}}_getLogId(){return`TokenWipeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenWipe",TokenWipeTransaction._fromProtobuf);class TopicCreateTransaction extends Transaction{constructor(e={}){super(),this._defaultMaxTransactionFee=new Hbar(25),this._adminKey=null,this._submitKey=null,this._feeScheduleKey=null,this._feeExemptKeys=[],this._autoRenewAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._customFees=[],this._topicMemo=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.submitKey&&this.setSubmitKey(e.submitKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.topicMemo&&this.setTopicMemo(e.topicMemo)}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusCreateTopic;return Transaction._fromProtobufTransactions(new TopicCreateTransaction({adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,submitKey:null!=i.submitKey?Key._fromProtobufKey(i.submitKey):void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,feeExemptKeys:null!=i.feeExemptKeyList?i.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,customFees:null!=i.customFees?i.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=i.memo?i.memo:void 0}),e,t,n,r,o)}get topicMemo(){return this._topicMemo}getTopicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}get adminKey(){return this._adminKey}getAdminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get submitKey(){return this._submitKey}getSubmitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}getAutoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}getAutoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}_execute(e,t){return e.consensus.createTopic(t)}_getTransactionDataCase(){return"consensusCreateTopic"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:this._feeExemptKeys.map(e=>e._toProtobufKey()),autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),customFees:this._customFees.map(e=>e._toTopicFeeProtobuf()),memo:this._topicMemo}}_getLogId(){return`TopicCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusCreateTopic",TopicCreateTransaction._fromProtobuf);class TopicDeleteTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusDeleteTopic;return Transaction._fromProtobufTransactions(new TopicDeleteTransaction({topicId:null!=i.topicID?TopicId._fromProtobuf(i.topicID):void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.deleteTopic(t)}_getTransactionDataCase(){return"consensusDeleteTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null}}_getLogId(){return`TopicDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusDeleteTopic",TopicDeleteTransaction._fromProtobuf);class TopicInfo{constructor(e){this.topicId=e.topicId,this.topicMemo=e.topicMemo,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.expirationTime=e.expirationTime,this.adminKey=e.adminKey,this.submitKey=e.submitKey,this.feeScheduleKey=e.feeScheduleKey,this.feeExemptKeys=e.feeExemptKeys,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.customFees=e.customFees,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.topicInfo;return new TopicInfo({topicId:TopicId._fromProtobuf(e.topicID),topicMemo:null!=t.memo?t.memo:"",runningHash:null!=t.runningHash?t.runningHash:new Uint8Array,sequenceNumber:null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO,expirationTime:null!=t.expirationTime?Timestamp._fromProtobuf(t.expirationTime):null,adminKey:null!=t.adminKey?Key._fromProtobufKey(t.adminKey):null,submitKey:null!=t.submitKey?Key._fromProtobufKey(t.submitKey):null,feeScheduleKey:null!=t.feeScheduleKey?Key._fromProtobufKey(t.feeScheduleKey):null,feeExemptKeys:null!=t.feeExemptKeyList?t.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):null,autoRenewPeriod:null!=t.autoRenewPeriod?new Duration(t.autoRenewPeriod.seconds):null,autoRenewAccountId:null!=t.autoRenewAccount?AccountId._fromProtobuf(t.autoRenewAccount):null,customFees:null!=t.customFees?t.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):null,ledgerId:null!=t.ledgerId?LedgerId.fromBytes(t.ledgerId):null})}_toProtobuf(){return{topicID:this.topicId._toProtobuf(),topicInfo:{memo:this.topicMemo,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber,expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,submitKey:null!=this.submitKey?this.submitKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this.feeExemptKeys?this.feeExemptKeys.map(e=>e._toProtobufKey()):null,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,customFees:null!=this.customFees?this.customFees.map(e=>e._toProtobuf()):null}}}static fromBytes(e){return TopicInfo._fromProtobuf(libExports.proto.ConsensusGetTopicInfoResponse.decode(e))}toBytes(){return libExports.proto.ConsensusGetTopicInfoResponse.encode(this._toProtobuf()).finish()}}class TopicInfoQuery extends Query{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e){const t=e.consensusGetTopicInfo;return new TopicInfoQuery({topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):void 0})}get topicId(){return this._topicId}setTopicId(e){return this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.getTopicInfo(t)}_mapResponseHeader(e){return e.consensusGetTopicInfo.header}_mapResponse(e,t,n){return Promise.resolve(TopicInfo._fromProtobuf(e.consensusGetTopicInfo))}_onMakeRequest(e){return{consensusGetTopicInfo:{header:e,topicID:null!=this._topicId?this._topicId._toProtobuf():null}}}_getLogId(){return`TopicInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("consensusGetTopicInfo",TopicInfoQuery._fromProtobuf);class TopicMessageChunk{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,Object.freeze(this)}static _fromProtobuf(e){return new TopicMessageChunk({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromValue(e.sequenceNumber):Long.ZERO})}_toProtobuf(){return{consensusTimestamp:this.consensusTimestamp._toProtobuf(),message:this.contents,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber}}}class TopicMessage{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.chunks=e.chunks,this.initialTransactionId=e.initialTransactionId,Object.freeze(this)}static _ofSingle(e){return new TopicMessage({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromNumber(e.sequenceNumber):Long.ZERO,initialTransactionId:null!=e.chunkInfo&&null!=e.chunkInfo.initialTransactionID?TransactionId._fromProtobuf(e.chunkInfo.initialTransactionID):null,chunks:[TopicMessageChunk._fromProtobuf(e)]})}static _ofMany(e){const t=e[e.length-1],n=Timestamp._fromProtobuf(t.consensusTimestamp),r=t.runningHash,o=null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO;e.sort((e,t)=>(null!=e&&null!=e.chunkInfo&&null!=e.chunkInfo.number?e.chunkInfo.number:0)<(null!=t&&null!=t.chunkInfo&&null!=t.chunkInfo.number?t.chunkInfo.number:0)?-1:1);const i=e.map(e=>TopicMessageChunk._fromProtobuf(e)),a=i.map(e=>e.contents.length).reduce((e,t)=>e+t,0),s=new Uint8Array(a);let c=0;e.forEach(e=>{s.set(e.message,c),c+=e.message.length});let u=null;return e.length>0&&null!=e[0].chunkInfo&&null!=e[0].chunkInfo.initialTransactionID&&(u=TransactionId._fromProtobuf(e[0].chunkInfo.initialTransactionID)),new TopicMessage({consensusTimestamp:n,contents:s,runningHash:r,sequenceNumber:o,chunks:i,initialTransactionId:u})}}class TopicMessageQuery{constructor(e={}){this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._startTime=null,null!=e.startTime&&this.setStartTime(e.startTime),this._endTime=null,null!=e.endTime&&this.setEndTime(e.endTime),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._errorHandler=(e,t)=>{console.error(`Error attempting to subscribe to topic: ${null!=this._topicId?this._topicId.toString():""}`)},null!=e.errorHandler&&(this._errorHandler=e.errorHandler),this._listener=null,this._completionHandler=()=>{console.log(`Subscription to topic ${null!=this._topicId?this._topicId.toString():""} complete`)},null!=e.completionHandler&&(this._completionHandler=e.completionHandler),this._maxAttempts=20,this._maxBackoff=8e3,this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},null!=e.retryHandler&&(this._retryHandler=e.retryHandler),this._attempt=0,this._handle=null,this.setMaxBackoff(8e3)}get topicId(){return this._topicId}setTopicId(e){return this.requireNotSubscribed(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get startTime(){return this._startTime}setStartTime(e){return this.requireNotSubscribed(),this._startTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get endTime(){return this._endTime}setEndTime(e){return this.requireNotSubscribed(),this._endTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get limit(){return this._limit}setLimit(e){return this.requireNotSubscribed(),this._limit=e instanceof Long?e:Long.fromValue(e),this}setErrorHandler(e){return this._errorHandler=e,this}setCompletionHandler(e){return this.requireNotSubscribed(),this._completionHandler=e,this}setMaxAttempts(e){return this.requireNotSubscribed(),this._maxAttempts=e,this}setMaxBackoff(e){return this.requireNotSubscribed(),this._maxBackoff=e,this}subscribe(e,t,n){return this._handle=new SubscriptionHandle,this._listener=n,null!=t&&(this._errorHandler=t),this._makeServerStreamRequest(e),this._handle}_makeServerStreamRequest(e){const t=this._buildConsensusRequest(),n=new Map,r=e._mirrorNetwork.getNextMirrorNode().getChannel().makeServerStreamRequest("ConsensusService","subscribeTopic",t,e=>this._handleMessage(e,n),t=>this._handleError(t,e),this._completionHandler);null!=this._handle&&this._handle._setCall(()=>r())}requireNotSubscribed(){if(null!=this._handle)throw new Error("Cannot change fields on an already subscribed query")}_passTopicMessage(e){try{if(null==this._listener)throw new Error("(BUG) listener is unexpectedly not set");this._listener(e)}catch(t){this._errorHandler(e,t)}}_buildConsensusRequest(){return libExports.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode({topicID:this._topicId?._toProtobuf()??null,consensusStartTime:this._startTime?._toProtobuf()??null,consensusEndTime:this._endTime?._toProtobuf()??null,limit:this._limit}).finish()}_handleMessage(e,t){const n=libExports.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(e);this._limit?.gt(0)&&(this._limit=this._limit.sub(1)),this._startTime=Timestamp._fromProtobuf(n.consensusTimestamp).plusNanos(1),null==n.chunkInfo||null!=n.chunkInfo&&1===n.chunkInfo.total?this._passTopicMessage(TopicMessage._ofSingle(n)):this._handleChunkedMessage(n,t)}_handleChunkedMessage(e,t){const n=e.chunkInfo,r=n.initialTransactionID,o=n.total,i=TransactionId._fromProtobuf(r).toString();let a=[];const s=t.get(i);if(null==s?t.set(i,a):a=s,a.push(e),a.length===o){const e=TopicMessage._ofMany(a);t.delete(i),this._passTopicMessage(e)}}_handleError(e,t){const n=e instanceof Error?e.message:e.details;this._handle?._unsubscribed||(this.shouldRetry(e)?this._scheduleRetry(t,n):this._errorHandler(null,new Error(n)))}shouldRetry(e){return this._attempt<this._maxAttempts&&this._retryHandler(e)}_scheduleRetry(e,t){const n=Math.min(250*2**this._attempt,this._maxBackoff);console.warn(`Error subscribing to topic ${this._topicId?.toString()??"UNKNOWN"} during attempt ${this._attempt}. Waiting ${n} ms before next attempt: ${t}`),this._attempt+=1,setTimeout(()=>this._makeServerStreamRequest(e),n)}}class TopicMessageSubmitTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._message=null,null!=e.message&&this.setMessage(e.message),this._maxChunks=20,this._chunkSize=CHUNK_SIZE,null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),this._chunkInfo=null}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusSubmitMessage;return Transaction._fromProtobufTransactions(new TopicMessageSubmitTransaction({topicId:null!=i.topicID?TopicId._fromProtobuf(i.topicID):void 0,message:null!=i.message?i.message:void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get message(){return this._message}getMessage(){return this._message}setMessage(e){return this._requireNotFrozen(),e=requireStringOrUint8Array(e),this._message=e instanceof Uint8Array?e:encode$1(e),this}getCustomFeeLimits(){return this._customFeeLimits}setCustomFeeLimits(e){return this._requireNotFrozen(),this._customFeeLimits=e,this}addCustomFeeLimit(e){return this._requireNotFrozen(),this._customFeeLimits.push(e),this}get maxChunks(){return this._maxChunks}getMaxChunks(){return this._maxChunks}setMaxChunks(e){return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}getChunkSize(){return this._chunkSize}setChunkSize(e){return this._chunkSize=e,this}getRequiredChunks(){if(null==this._message)return 1;return Math.ceil(this._message.length/this._chunkSize)}freezeWith(e){if(super.freezeWith(e),null==this._message)return this;const t=Math.floor((this._message.length+(this._chunkSize-1))/this._chunkSize);if(t>this._maxChunks)throw new Error(`Message with size ${this._message.length} too long for ${this._maxChunks} chunks`);const n=this._getTransactionId()._toProtobuf();let r=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<t;e++){this._chunkInfo={initialTransactionID:n,total:t,number:e+1},this._transactionIds.push(r),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));r=new TransactionId(r.accountId,new Timestamp(r.validStart.seconds,r.validStart.nanos.add(1)))}return this._transactionIds.advance(),this._chunkInfo=null,this}schedule(){if(this._requireNotFrozen(),null!=this._message&&this._message.length>this._chunkSize)throw new Error(`cannot schedule \`TopicMessageSubmitTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let i=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now();o.push(await super.execute(e,i)),null!=i&&(i=Date.now()-t)}return o}_execute(e,t){return e.consensus.submitMessage(t)}_getTransactionDataCase(){return"consensusSubmitMessage"}_makeTransactionData(){if(null!=this._chunkInfo&&null!=this._message){const e=(this._chunkInfo.number-1)*this._chunkSize;let t=e+this._chunkSize;return t>this._message.length&&(t=this._message.length),{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message.slice(e,t),chunkInfo:this._chunkInfo}}return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message}}_getLogId(){return`TopicMessageSubmitTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusSubmitMessage",TopicMessageSubmitTransaction._fromProtobuf);class TopicUpdateTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._topicMemo=null,null!=e.topicMemo&&this.setTopicMemo(e.topicMemo),this._submitKey=null,null!=e.submitKey&&this.setSubmitKey(e.submitKey),this._adminKey=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),this._feeScheduleKey=null,null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),this._feeExemptKeys=null,null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),this._autoRenewAccountId=null,null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),this._autoRenewPeriod=null,null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),this._customFees=null,null!=e.customFees&&this.setCustomFees(e.customFees),this._expirationTime=null,null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusUpdateTopic;return Transaction._fromProtobufTransactions(new TopicUpdateTransaction({topicId:null!=i.topicID?TopicId._fromProtobuf(i.topicID):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,submitKey:null!=i.submitKey?Key._fromProtobufKey(i.submitKey):void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,feeExemptKeys:null!=i.feeExemptKeyList&&null!=i.feeExemptKeyList.keys?i?.feeExemptKeyList.keys.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,customFees:null!=i.customFees&&null!=i.customFees.fees?i.customFees.fees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0}),e,t,n,r,o)}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}clearTopicId(){return this._requireNotFrozen(),this._topicId=null,this}get topicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}clearTopicMemo(){return this._requireNotFrozen(),this._topicMemo=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}clearAdminKey(){return this._requireNotFrozen(),this._adminKey=null,this}get submitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}clearSubmitKey(){return this._requireNotFrozen(),this._submitKey=null,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}clearFeeScheduleKey(){return this._requireNotFrozen(),this._feeScheduleKey=null,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),null==this._feeExemptKeys&&(this._feeExemptKeys=[]),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}clearAutoRenewAccountId(){return this._requireNotFrozen(),this._autoRenewAccountId=null,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),null==this._customFees&&(this._customFees=[]),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.consensus.updateTopic(t)}_getTransactionDataCase(){return"consensusUpdateTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this._feeExemptKeys?{keys:this._feeExemptKeys.map(e=>e._toProtobufKey())}:null,memo:null!=this._topicMemo?{value:this._topicMemo}:null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,customFees:null!=this._customFees?{fees:this._customFees.map(e=>e._toTopicFeeProtobuf())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`TopicUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusUpdateTopic",TopicUpdateTransaction._fromProtobuf);class HbarTransferMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromProtobuf(e){const t=new HbarTransferMap;for(const n of null!=e.accountAmounts?e.accountAmounts:[]){const e=AccountId._fromProtobuf(n.accountID);t._set(e,Hbar.fromTinybars(n.amount))}return t}}class TransferTransaction extends AbstractTokenTransferTransaction{constructor(e={}){super(),this._hbarTransfers=[],this._defaultMaxTransactionFee=new Hbar(1);for(const t of null!=e.hbarTransfers?e.hbarTransfers:[])this.addHbarTransfer(t.accountId,t.amount)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoTransfer,a=new TransferTransaction;return a._tokenTransfers=TokenTransfer._fromProtobuf(null!=i.tokenTransfers?i.tokenTransfers:[]),a._hbarTransfers=Transfer._fromProtobuf(null!=i.transfers&&null!=i.transfers.accountAmounts?i.transfers.accountAmounts:[]),a._nftTransfers=TokenNftTransfer._fromProtobuf(null!=i.tokenTransfers?i.tokenTransfers:[]),Transaction._fromProtobufTransactions(a,e,t,n,r,o)}get hbarTransfers(){const e=new HbarTransferMap;for(const t of this._hbarTransfers)e._set(t.accountId,t.amount);return e}get hbarTransfersList(){return this._hbarTransfers}_addHbarTransfer(e,t,n){this._requireNotFrozen();const r=e instanceof AccountId?e.clone():AccountId.fromString(e),o=t instanceof Hbar?t:new Hbar(t);for(const e of this._hbarTransfers)if(0===e.accountId.compare(r))return e.amount=Hbar.fromTinybars(e.amount.toTinybars().add(o.toTinybars())),this;return this._hbarTransfers.push(new Transfer({accountId:r,amount:o,isApproved:n})),this}addHbarTransfer(e,t){return this._addHbarTransfer(e,t,!1)}addApprovedHbarTransfer(e,t){return this._addHbarTransfer(e,t,!0)}_validateChecksums(e){for(const t of this._hbarTransfers)t.accountId.validateChecksum(e);for(const t of this._tokenTransfers)t.tokenId.validateChecksum(e),t.accountId.validateChecksum(e);for(const t of this._nftTransfers)t.tokenId.validateChecksum(e),t.senderAccountId.validateChecksum(e),t.receiverAccountId.validateChecksum(e)}setHbarTransferApproval(e,t){const n="string"==typeof e?AccountId.fromString(e):e;for(const e of this._hbarTransfers)0===e.accountId.compare(n)&&(e.isApproved=t);return this}setTokenTransferApproval(e,t,n){const r="string"==typeof e?TokenId.fromString(e):e,o="string"==typeof t?AccountId.fromString(t):t;for(const e of this._tokenTransfers)0===e.tokenId.compare(r)&&0===e.accountId.compare(o)&&(e.isApproved=n);return this}setNftTransferApproval(e,t){const n="string"==typeof e?NftId.fromString(e):e;for(const e of this._nftTransfers)0===e.tokenId.compare(n.tokenId)&&0===e.serialNumber.compare(n.serial)&&(e.isApproved=t);return this}_execute(e,t){return e.crypto.cryptoTransfer(t)}_getTransactionDataCase(){return"cryptoTransfer"}_makeTransactionData(){const{tokenTransfers:e}=super._makeTransactionData();return this._hbarTransfers.sort((e,t)=>e.accountId.compare(t.accountId)),{transfers:{accountAmounts:this._hbarTransfers.map(e=>({accountID:e.accountId._toProtobuf(),amount:e.amount.toTinybars(),isApproval:e.isApproved}))},tokenTransfers:e}}_getLogId(){return`TransferTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoTransfer",TransferTransaction._fromProtobuf);class Wallet{constructor(e,t,n){let r;r="string"==typeof t&&PrivateKey.isDerKey(t)?PrivateKey.fromStringDer(t):"string"==typeof t?PrivateKey.fromString(t):t,this.publicKey=r.publicKey,this.signer=e=>Promise.resolve(r.sign(e)),this.provider=n,this.accountId="string"==typeof e?AccountId.fromString(e):e}static createRandomED25519(){const e=PrivateKey.generateED25519(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}static createRandomECDSA(){const e=PrivateKey.generateECDSA(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}getProvider(){return this.provider}getAccountId(){return this.accountId}getAccountKey(){return this.publicKey}getLedgerId(){return null==this.provider?null:this.provider.getLedgerId()}getNetwork(){return null==this.provider?{}:this.provider.getNetwork()}getMirrorNetwork(){return null==this.provider?[]:this.provider.getMirrorNetwork()}async sign(e){const t=[];for(const n of e)t.push(new SignerSignature({publicKey:this.publicKey,signature:await this.signer(n),accountId:this.accountId}));return t}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}signTransaction(e){return e.signWith(this.publicKey,this.signer)}checkTransaction(e){const t=e.transactionId;if(null!=t&&null!=t.accountId&&0!=t.accountId.compare(this.accountId))throw new Error("transaction's ID constructed with a different account ID");if(null==this.provider)return Promise.resolve(e);const n=(null!=e.nodeAccountIds?e.nodeAccountIds:[]).map(e=>e.toString()),r=Object.values(this.provider.getNetwork()).map(e=>e.toString());if(!n.reduce((e,t)=>e&&r.includes(t),!0))throw new Error("Transaction already set node account IDs to values not within the current network");return Promise.resolve(e)}populateTransaction(e){if(e._freezeWithAccountId(this.accountId),null==e.transactionId&&e.setTransactionId(TransactionId.generate(this.accountId)),null!=e.nodeAccountIds&&0!=e.nodeAccountIds.length)return Promise.resolve(e.freeze());if(null==this.provider)return Promise.resolve(e);const t=Object.values(this.provider.getNetwork()).map(e=>"string"==typeof e?AccountId.fromString(e):e);return shuffle(t),e.setNodeAccountIds(t.slice(0,(t.length+3-1)/3)),Promise.resolve(e.freeze())}call(e){if(null==this.provider)throw new Error("cannot send request with an wallet that doesn't contain a provider");return this.provider.call(e._setOperatorWith(this.accountId,this.publicKey,this.signer))}}var browser={exports:{}},quickFormatUnescaped,hasRequiredQuickFormatUnescaped,hasRequiredBrowser;function requireQuickFormatUnescaped(){if(hasRequiredQuickFormatUnescaped)return quickFormatUnescaped;function e(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}return hasRequiredQuickFormatUnescaped=1,quickFormatUnescaped=function(t,n,r){var o=r&&r.stringify||e;if("object"==typeof t&&null!==t){var i=n.length+1;if(1===i)return t;var a=new Array(i);a[0]=o(t);for(var s=1;s<i;s++)a[s]=o(n[s]);return a.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var u="",l=0,d=-1,p=t&&t.length||0,h=0;h<p;){if(37===t.charCodeAt(h)&&h+1<p){switch(d=d>-1?d:0,t.charCodeAt(h+1)){case 100:case 102:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Number(n[l]),d=h+2,h++;break;case 105:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Math.floor(Number(n[l])),d=h+2,h++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===n[l])break;d<h&&(u+=t.slice(d,h));var f=typeof n[l];if("string"===f){u+="'"+n[l]+"'",d=h+2,h++;break}if("function"===f){u+=n[l].name||"<anonymous>",d=h+2,h++;break}u+=o(n[l]),d=h+2,h++;break;case 115:if(l>=c)break;d<h&&(u+=t.slice(d,h)),u+=String(n[l]),d=h+2,h++;break;case 37:d<h&&(u+=t.slice(d,h)),u+="%",d=h+2,h++,l--}++l}++h}if(-1===d)return t;d<p&&(u+=t.slice(d));return u},quickFormatUnescaped}function requireBrowser(){if(hasRequiredBrowser)return browser.exports;hasRequiredBrowser=1;const e=requireQuickFormatUnescaped();browser.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},n={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:f,res:f,err:p,errWithCause:p};function r(e,t){return"silent"===e?1/0:t.levels.values[e]}const o=Symbol("pino.logFuncs"),i=Symbol("pino.hierarchy"),a={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function s(e,t){const n={logger:t,parent:e[i]};t[i]=n}function c(e){(e=e||{}).browser=e.browser||{};const n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");const i=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const p=e.serializers||{},f=function(e,t){if(Array.isArray(e))return e.filter(function(e){return"!stdSerializers.err"!==e});return!0===e&&Object.keys(t)}(e.browser.serialize,p);let y=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(y=!1);const g=Object.keys(e.customLevels||{}),_=["error","fatal","warn","info","debug","trace"].concat(g);"function"==typeof i&&_.forEach(function(e){i[e]=i}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const b=e.level||"info",I=Object.create(i);I.log||(I.log=m),function(e,n,r){const i={};n.forEach(e=>{i[e]=r[e]?r[e]:t[e]||t[a[e]||"log"]||m}),e[o]=i}(I,_,i),s({},I),Object.defineProperty(I,"levelVal",{get:function(){return r(this.level,this)}}),Object.defineProperty(I,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,u(this,T,I,"error"),u(this,T,I,"fatal"),u(this,T,I,"warn"),u(this,T,I,"info"),u(this,T,I,"debug"),u(this,T,I,"trace"),g.forEach(e=>{u(this,T,I,e)})}});const T={transmit:n,serialize:f,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:_,timestamp:h(e),messageKey:e.messageKey||"msg",onChild:e.onChild||m};function k(t,r,o){if(!r)throw new Error("missing bindings for child Pino");o=o||{},f&&r.serializers&&(o.serializers=r.serializers);const i=o.serializers;if(f&&i){var a=Object.assign({},p,i),c=!0===e.browser.serialize?Object.keys(a):f;delete r.serializers,l([r],c,a,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.bindings=r,a&&(this.serializers=a,this._serialize=c),n&&(this._logEvent=d([].concat(e._logEvent.bindings,r)))}u.prototype=this;const h=new u(this);return s(this,h),h.child=function(...e){return k.call(this,t,...e)},h.level=o.level||this.level,t.onChild(h),h}return I.levels=function(e){const t=e.customLevels||{},n=Object.assign({},c.levels.values,t),r=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}(t));return{values:n,labels:r}}(e),I.level=b,I.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},I.setMaxListeners=I.getMaxListeners=I.emit=I.addListener=I.on=I.prependListener=I.once=I.prependOnceListener=I.removeListener=I.removeAllListeners=I.listeners=I.listenerCount=I.eventNames=I.write=I.flush=m,I.serializers=p,I._serialize=f,I._stdErrSerialize=y,I.child=function(...e){return k.call(this,T,...e)},n&&(I._logEvent=d()),I}function u(n,a,s,c){if(Object.defineProperty(n,c,{value:r(n.level,s)>r(c,s)?m:s[o][c],writable:!0,enumerable:!0,configurable:!0}),n[c]===m){if(!a.transmit)return;const e=r(a.transmit.level||n.level,s);if(r(c,s)<e)return}n[c]=function(n,i,a,s){return c=n[o][s],function(){const o=i.timestamp(),u=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var h=0;h<u.length;h++)u[h]=arguments[h];var f=!1;if(i.serialize&&(l(u,this._serialize,this.serializers,this._stdErrSerialize),f=!0),i.asObject||i.formatters?c.call(p,...function(t,n,r,o,i){const{level:a,log:s=e=>e}=i.formatters||{},c=r.slice();let u=c[0];const l={};let d=1+(0|t._childLevel);if(d<1&&(d=1),o&&(l.time=o),a){const e=a(n,t.levels.values[n]);Object.assign(l,e)}else l.level=t.levels.values[n];if(i.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());return[s(l),...c]}if(null!==u&&"object"==typeof u){for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());u=c.length?e(c.shift(),c):void 0}else"string"==typeof u&&(u=e(c.shift(),c));return void 0!==u&&(l[i.messageKey]=u),[s(l)]}(this,s,u,o,i)):c.apply(p,u),i.transmit){const e=r(i.transmit.level||n._level,a),t=r(s,a);if(t<e)return;!function(e,t,n,r=!1){const o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;r||l(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter(function(e){return-1===u.indexOf(e)}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,c),e._logEvent=d(u)}(this,{ts:o,methodLevel:s,methodValue:t,transmitValue:a.levels.values[i.transmit.level||n._level],send:i.transmit.send,val:r(n._level,a)},u,f)}};var c}(n,a,s,c);const u=function(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[i];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}(n);0!==u.length&&(n[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(u,n[c]))}function l(e,t,n,r){for(const o in e)if(r&&e[o]instanceof Error)e[o]=c.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const r in e[o])t.indexOf(r)>-1&&r in n&&(e[o][r]=n[r](e[o][r]))}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function p(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function h(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?g:_}function f(){return{}}function y(e){return e}function m(){}function g(){return!1}function _(){return Date.now()}return c.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},c.stdSerializers=n,c.stdTimeFunctions=Object.assign({},{nullTime:g,epochTime:_,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),browser.exports.default=c,browser.exports.pino=c,browser.exports}var browserExports=requireBrowser(),pino=getDefaultExportFromCjs(browserExports);class LogLevel{constructor(e){this._name=e,Object.freeze(this)}toString(){switch(this){case LogLevel.Silent:return"silent";case LogLevel.Trace:return"trace";case LogLevel.Debug:return"debug";case LogLevel.Info:return"info";case LogLevel.Warn:return"warn";case LogLevel.Error:return"error";case LogLevel.Fatal:return"fatal";default:return`Unknown log level (${this._name})`}}static _fromString(e){switch(e){case"silent":return LogLevel.Silent;case"trace":return LogLevel.Trace;case"debug":return LogLevel.Debug;case"info":return LogLevel.Info;case"warn":return LogLevel.Warn;case"error":return LogLevel.Error;case"fatal":return LogLevel.Fatal;default:throw new Error(`Unknown log level: ${e}`)}}}LogLevel.Silent=new LogLevel("silent"),LogLevel.Trace=new LogLevel("trace"),LogLevel.Debug=new LogLevel("debug"),LogLevel.Info=new LogLevel("info"),LogLevel.Warn=new LogLevel("warn"),LogLevel.Error=new LogLevel("error"),LogLevel.Fatal=new LogLevel("fatal");class Logger{constructor(e,t="",n=!0,r=!0,o=!0,i=0){const a=t?pino.destination({dest:t,sync:n,fsync:r,mkdir:o,minLength:i}):null,s=a?{level:e.toString(),timestamp:pino.stdTimeFunctions.isoTime,formatters:{bindings:()=>({}),level:e=>({level:e.toUpperCase()})}}:{level:e.toString(),transport:{target:"pino-pretty",options:{translateTime:"SYS:dd-mm-yyyy HH:MM:ss",ignore:"pid,hostname"}}};this._logger=a?pino(s,a):pino(s),this._previousLevel=e}setLogger(e){return this._logger=e,this}setLevel(e){return this._previousLevel=LogLevel._fromString(this._logger.level),this._logger.level=e.toString(),this}get level(){return LogLevel._fromString(this._logger.level)}get levels(){return this._logger.levels.labels}setSilent(e){return this._logger.level=e?LogLevel.Silent.toString():this._previousLevel.toString(),this}get silent(){return this._logger.level==LogLevel.Silent.toString()}trace(e){this._logger.trace(e)}debug(e){this._logger.debug(e)}info(e){this._logger.info(e)}warn(e){this._logger.warn(e)}error(e){this._logger.error(e)}fatal(e){this._logger.fatal(e)}}class TokenUpdateNftsTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._serialNumbers=[],this._metadata=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.serialNumbers&&this.setSerialNumbers(e.serialNumbers),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUpdateNfts;return Transaction._fromProtobufTransactions(new TokenUpdateNftsTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,serialNumbers:null!=i.serialNumbers?i.serialNumbers:[],metadata:null!=i.metadata&&Object.hasOwn(i.metadata,"value")?i.metadata.value:void 0}),e,t,n,r,o)}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}setSerialNumbers(e){return this._requireNotFrozen(),this._serialNumbers=e,this}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenUpdateNfts"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,serialNumbers:null!=this._serialNumbers?this._serialNumbers:[],...null!=this._metadata?{metadata:{value:this._metadata}}:null}}_getLogId(){return`TokenUpdateNftsTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdateNfts",TokenUpdateNftsTransaction._fromProtobuf);class ServiceEndpoint{constructor(e){this._ipAddressV4=null!=e?.ipAddressV4?e.ipAddressV4:null,this._port=null!=e?.port?e.port:null,this._domainName=null!=e?.domainName?e.domainName:null}setIpAddressV4(e){if(null!=this._domainName)throw new Error("Cannot set IP address when domain name is already set.");return this._ipAddressV4=e,this}get getIpAddressV4(){return this._ipAddressV4}setPort(e){return this._port=e,this}get getPort(){return this._port}setDomainName(e){if(null!=this._ipAddressV4)throw new Error("Cannot set domain name when IP address is already set.");return this._domainName=e,this}get getDomainName(){return this._domainName}static _fromProtobuf(e){return new ServiceEndpoint({ipAddressV4:null!=e.ipAddressV4?e.ipAddressV4:void 0,port:null!=e.port?e.port:void 0,domainName:null!=e.domainName?e.domainName:void 0})}_toProtobuf(){return{ipAddressV4:this._ipAddressV4,port:this._port,domainName:this._domainName}}}const DESCRIPTION_MAX_LENGTH$1=100,GOSSIP_ENDPOINTS_MAX_LENGTH$1=10,SERVICE_ENDPOINTS_MAX_LENGTH$1=8;class NodeCreateTransaction extends Transaction{constructor(e){super(),this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const i=o[0].nodeCreate;return Transaction._fromProtobufTransactions(new NodeCreateTransaction({accountId:null!=i.accountId?AccountId._fromProtobuf(i.accountId):void 0,description:null!=i.description?i.description:void 0,gossipEndpoints:null!=i.gossipEndpoint?i.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=i.serviceEndpoint?i.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=i.gossipCaCertificate?i.gossipCaCertificate:void 0,grpcCertificateHash:null!=i.grpcCertificateHash?i.grpcCertificateHash:void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,declineReward:null!=i.declineReward?i.declineReward:void 0,grpcWebProxyEndpoint:null!=i.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(i.grpcProxyEndpoint):void 0}),e,t,n,r,o)}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH$1)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH$1} characters.`);return this._description=e,this}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH$1)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH$1)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}_execute(e,t){return e.addressBook.createNode(t)}_getTransactionDataCase(){return"nodeCreate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:null!=this._description?this._description:null,gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?this._gossipCaCertificate:null,grpcCertificateHash:null!=this._grpcCertificateHash?this._grpcCertificateHash:null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,declineReward:null!=this._declineReward?this._declineReward:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null}}_getLogId(){return`NodeCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeCreate",NodeCreateTransaction._fromProtobuf);class NodeDeleteTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null}static _fromProtobuf(e,t,n,r,o){const i=o[0].nodeDelete;return Transaction._fromProtobufTransactions(new NodeDeleteTransaction({nodeId:null!=i.nodeId?i.nodeId:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeDeleteTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}freezeWith(e){if(null==this.nodeId)throw new Error("NodeDeleteTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.deleteNode(t)}_getTransactionDataCase(){return"nodeDelete"}_makeTransactionData(){return{nodeId:null!=this._nodeId?this._nodeId:null}}_getLogId(){return`NodeDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeDelete",NodeDeleteTransaction._fromProtobuf);const DESCRIPTION_MAX_LENGTH=100,GOSSIP_ENDPOINTS_MAX_LENGTH=10,SERVICE_ENDPOINTS_MAX_LENGTH=8;class NodeUpdateTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null,this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const i=o[0].nodeUpdate;return Transaction._fromProtobufTransactions(new NodeUpdateTransaction({nodeId:null!=i.nodeId?i.nodeId:void 0,accountId:null!=i.accountId?AccountId._fromProtobuf(i.accountId):void 0,description:null!=i.description&&Object.hasOwn(i.description,"value")?i.description.value:void 0,gossipEndpoints:null!=i.gossipEndpoint?i.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=i.serviceEndpoint?i.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=i.gossipCaCertificate&&Object.hasOwn(i.gossipCaCertificate,"value")?i.gossipCaCertificate.value:void 0,grpcCertificateHash:null!=i.grpcCertificateHash&&Object.hasOwn(i.grpcCertificateHash,"value")?i.grpcCertificateHash.value:void 0,grpcWebProxyEndpoint:null!=i.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(i.grpcProxyEndpoint):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,declineReward:null!=i.declineReward?.value?i.declineReward.value:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeUpdateTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH} characters.`);return this._description=e,this}clearDescription(){this._description=""}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return this._requireNotFrozen(),null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return this._requireNotFrozen(),null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}deleteGrpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint=new ServiceEndpoint,this}freezeWith(e){if(null==this.nodeId)throw new Error("NodeUpdateTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.updateNode(t)}_getTransactionDataCase(){return"nodeUpdate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:{value:null!=this._description?this._description:null},gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?{value:this._gossipCaCertificate}:null,grpcCertificateHash:null!=this._grpcCertificateHash?{value:this._grpcCertificateHash}:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,nodeId:null!=this._nodeId?this._nodeId:null,declineReward:null!=this._declineReward?{value:this._declineReward}:null}}_getLogId(){return`NodeUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeUpdate",NodeUpdateTransaction._fromProtobuf);const HOST_AND_PORT=/^(\S+):(\d+)$/;class ManagedNodeAddress{constructor(e={}){if(null!=e.address){const t=HOST_AND_PORT.exec(e.address);if(null==t)throw new Error(`failed to parse address: ${e.address}`);this._address=t[1],this._port=null!=t[2]?parseInt(t[2]):null}else{if(null==e.host||null==e.port)throw new Error(`failed to create a managed node address: ${JSON.stringify(e)}`);this._address=e.host,this._port=e.port}Object.freeze(this)}static fromString(e){return new ManagedNodeAddress({address:e})}toInsecure(){let e=50212===this.port?50211:this.port;return new ManagedNodeAddress({host:this.address,port:e})}toSecure(){let e=50211===this.port?50212:this.port;return new ManagedNodeAddress({host:this.address,port:e})}get address(){return this._address}get port(){return this._port}isTransportSecurity(){return 50212==this._port||443==this._port}toString(){return null==this.port?this.address:`${this.address}:${this.port}`}}class ManagedNode{constructor(e={}){if(null!=e.newNode)this._address="string"==typeof e.newNode.address?ManagedNodeAddress.fromString(e.newNode.address):e.newNode.address,this._cert=void 0,this._channel=null,this._channelInitFunction=e.newNode.channelInitFunction,this._lastUsed=Date.now(),this._readmitTime=Date.now(),this._useCount=0,this._badGrpcStatusCount=0,this._minBackoff=8e3,this._maxBackoff=36e5,this._currentBackoff=this._minBackoff;else{if(null==e.cloneNode)throw new Error(`failed to create ManagedNode: ${JSON.stringify(e)}`);this._address=e.cloneNode.address,this._cert=e.cloneNode.node._cert,this._channel=e.cloneNode.node._channel,this._channelInitFunction=e.cloneNode.node._channelInitFunction,this._currentBackoff=e.cloneNode.node._currentBackoff,this._lastUsed=e.cloneNode.node._lastUsed,this._readmitTime=e.cloneNode.node._readmitTime,this._useCount=e.cloneNode.node._useCount,this._badGrpcStatusCount=e.cloneNode.node._badGrpcStatusCount,this._minBackoff=e.cloneNode.node._minBackoff,this._maxBackoff=e.cloneNode.node._minBackoff}}getKey(){throw new Error("not implemented")}setCert(e){return this}get address(){return this._address}get attempts(){return this._badGrpcStatusCount}get minBackoff(){return this._minBackoff}setMinBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._minBackoff=e,this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._maxBackoff=e,this}getChannel(){return this._useCount++,this.__lastUsed=Date.now(),null!=this._channel||(this._channel=this._channelInitFunction(this.address.toString(),this._cert)),this._channel}isHealthy(){return this._readmitTime<=Date.now()}increaseBackoff(){this._currentBackoff=Math.min(2*this._currentBackoff,this._maxBackoff),this._readmitTime=Date.now()+this._currentBackoff}decreaseBackoff(){this._currentBackoff=Math.max(this._currentBackoff/2,this._minBackoff)}getRemainingTime(){return this._readmitTime-this._lastUsed}backoff(){return new Promise(e=>setTimeout(e,this.getRemainingTime()))}compare(e){let t=this.getRemainingTime()-e.getRemainingTime();return 0!=t?t:(t=this._currentBackoff-e._currentBackoff,0!=t?t:(t=this._badGrpcStatusCount-e._badGrpcStatusCount,0!=t?t:(t=this._useCount-e._useCount,0!=t?t:this._lastUsed-e._lastUsed)))}close(){null!=this._channel&&this._channel.close(),this._channel=null}}class Node extends ManagedNode{constructor(e={}){if(super(e),null!=e.newNode)this._accountId=e.newNode.accountId,this._nodeAddress=null;else{if(null==e.cloneNode)throw new Error(`failed to create node: ${JSON.stringify(e)}`);this._accountId=e.cloneNode.node._accountId,this._nodeAddress=e.cloneNode.node._nodeAddress}}getKey(){return this._accountId.toString()}toInsecure(){return new Node({cloneNode:{node:this,address:this._address.toInsecure()}})}toSecure(){return new Node({cloneNode:{node:this,address:this._address.toSecure()}})}get accountId(){return this._accountId}get nodeAddress(){return this._nodeAddress}setNodeAddress(e){return this._nodeAddress=e,this}}const PREVIEWNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$8("0ad0070a0e33352e3233312e3230382e31343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340acf070a0d332e3231312e3234382e31373210a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ace070a0c34302e3132312e36342e343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ad1070a0d33352e3139392e31352e31373710a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad1070a0d332e3133332e3231332e31343610a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad0070a0c34302e37302e31312e32303210a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad2070a0e33352e3232352e3230312e31393510a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d35322e31352e3130352e31333010a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d3130342e34332e3234382e363310a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad2070a0e33352e3234372e3130392e31333510a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b35342e3234312e33382e3110a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b31332e38382e32322e343710a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330ad0070a0c33352e3233352e36352e353110a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d35342e3137372e35312e31323710a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad0070a0c31332e36342e3137302e343010a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d33342e3130362e3234372e363510a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33352e38332e38392e31373110a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad1070a0d31332e37382e3233322e31393210a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33342e3132352e32332e343910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390acf070a0b35302e31382e31372e393310a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390ad1070a0d32302e3135302e3133362e383910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a60363465303938363135626634303566376564356134303133343436623839633438386366636436626232356134613637366463373765656131316433336437303236383266306136396138303330653863353737376430653432323033373939"))),TESTNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$8("0a7f0a0c33342e39342e3130362e363110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a80010a0d35302e31382e3133322e32313110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a81010a0e3133382e39312e3134322e32313910a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a82010a0d33352e3233372e3131392e353510a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a7f0a0a332e3231322e362e313310a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d35322e3136382e37362e32343110a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d33352e3234352e32372e31393310a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a80010a0b35322e32302e31382e383610a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a81010a0c34302e37392e38332e31323410a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a82010a0d33342e38332e3131322e31313610a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35342e37302e3139322e333310a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35322e3138332e34352e363510a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a80010a0b33342e39342e3136302e3410a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e35342e3137362e3139392e31303910a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a82010a0d31332e36342e3138312e31333610a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e33342e3130362e3130322e32313810a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a82010a0d33352e3135352e34392e31343710a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a81010a0c31332e37382e3233382e333210a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a83010a0e33342e3133332e3139372e32333010a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e31342e3235322e32303710a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e3136352e31372e32333110a388031a05302e302e392806320218093a60363938333261373361333630326538643166626535616435386431633236333761316236373264373165653837616631306462363438656239316166623232383235336231663437653537643364346134346666353437623333393461613232"))),MAINNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$8("0ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633435363165336332373863643635306538306334313363613434343233633163336331336366313437356636663639373664353937616534333262343961623432303836623739623834313332363035346238623364636635376438666364373962666330353831383363613234636434633163626335373465643131313765326635623762336336336365376230366439623465666366373337353633376234316665366635336338313162396465363134336633613532393537636466393536373735313230623333373033666635373632313430376162393537356263326433356330643434663039383366633165663633613466663532303966303730633932616631303632393536303163393662636564303634656331393031393730313963363831316334633864643830636234663461633731663961643736653761633839343536666266346630313166393061626432643930353336653832333436353166366265663932376533643564386237626634353930353039383362656361336162656632613964393761663334353737326137373430653936393932373562303138656130646632383661646436636539323365663930386662653736326137356632313131363836326462343464336463613164343462346432653864633130363663353030366262356137643935346164323535643462363033323733343735653531316165623438356430363961303637633061623563323435333863393333633036623561366165666139343030356332393135323133653463636461653663393432663632373266396464353238326436623839306631663230656664323339396364363734393234666135373034366163366461333265373339353161373331313365393166633262376666323965343835316238336666333966383362613965633666303863656664626236636262626666616266646661613931643933306637323030646134383133376333393463626431336537303165636463323631366664323162616436383161613466303031303230333031303030312804320218073a603665396138616263646364653665313134396133656265313766643538643839303538333961383664623732623036613365613230616131373666383638623235343838353261653432336437613963366237636666396537313436323961320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613163343037373135343330336363373263346662373639326333663934323531626465633132333961316637613839373261626539316133353332336662656361363235613766666165363430366338353564633261663231313039303062306466306536653664623736333634646661316666653835656461353637393336653239383562383536333461333261613532613635393964643663333062653166376136633562386635656563616632363231643861343539363832666364326462616164313536316431316633336663636237663535303061633536386431363564626561616365333238366432383934663634313239643738316436633732666437643539396339653164336166346161343333633233623931306661653463343834313634316636313532366164373837656265613533393837343136376539643361373363633066623135363432396431356563373633613664306630363131356137396239616637383364373762393864383330393661613437343366393734303864396531346263663464646666653435393137363838343762343063623864613763613337353235366432623933356430393566653235326661653831666636653337663834643761393064376535373061346638656633633764373636656564613437326630393230313939303135613839303832353961383733633534353466636262646361643265353238646538353435356234303833633764633461646335613938386530636464666463313539643564373132616264353434616137336563303239303839383134633938613434663236666330363434363539633138336533313834616132373266386431646330626661336530613536303438346362303535626134646262356363333339656338306264313164363432646333613730326538633730336162323139333038346439626436336630646665313261343333633235373665616637383163666164383637656637306264613631373638623262656631346635306336633362386230393666303230333031303030312805320218083a606464336233653763643361323537643832373665343635333533363162303138623730303931663438363635653832303031306538316563303539326236396264346265316662643765636435303964303730313364643034313238343266640ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623263636163363561643066633736343561383137626661626334383761643765343133313165376133313938623337666238343264383463333935623366363764366264383438663130633666303363323930653866376461613864303031613834343164633335326131393136306133313933653638623832656466313961653637363933613961333364346362383765373839613130373037313535313565613737326361613862383661353639623931633534353038333564396333353466306461636563393766653737303931623435623134373639386237663836303134323264636432323631653932386465346461633963343264636261666466393663303732333362613330323730373666333763393639653865643330623662356438663530333462653764393263353936663862653836316535316663633361323432626639643862653965326139653865306631353565626366663233656666613763643537633130353432383131643830373736633935383535323666646230656161333465653139353564353131313933393066653837336534633034646564643239313635383834623938623436333038373838616537666334643461613461386663396263323637346261333231343933623632343435356164343130633164653731626339356431643931666130663230313431386137393565333039656166323937623639396266323763396661323736336364353963656230323165313662383230306331303630663238313766643833636663373637313833343839343631653335393932393162333830643665393339626161346231393233326136613237326464653635316638303436666463333464623237366137373764366662326265633332353562326363323434623461663536366231303566333063363530366464616530656233646564646366393437626362396336306530303039383466336234613863366334656434626639306263313933326237663934646333616536623336303030386562393032303430663962303230333031303030312802320218053a603561383634313561303861306138323566336232656237353031303135353230326533313234336665343161303333333834653738633138633131653565386632303964343933623062326664343565303662333734663262363964663564370ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613365333762373663366364356636363232643639323434343464313263363737633339356632623539303266336262393862386138623530353561373037373036636130323863643735303630613264383730326432643862303439343762646366653061386331343161613238343462316530366536363139303031326538623633323661623066613331373937336263376362346432393439663231303861613034633462306339316261613537323866356235363232656337356162663537386131663762343165646532613637656264363963313865353831666466396336303230616330646539636132633331663063363436393030333331316662623563653764623439633738376531613764323761613432356565376238346461376536363933396639633830643065383266636535356530326466633862356337383431386132366161343336353036393837313962616663656366306264343930303061646463666134303537303862646265666262313937343964323264616230303765343464343565613233623130366638383334633135326532353036326434636632346666323533353663376562333732393130353339336662343962616239303461303266306630626234313763643931396433353238393031323865366262666634666163396639306465313138613937346632613664643031653033326137396231373866363066613166636262643032623537303466623436323935633135313930383136333733656464363633356338353639373866316239353033663166373362346230626538616261326564316665656164353939353362663832656664653933613334373161626435356364613362613861363733666262333739393734396662303036643030336630653633663636356333343631643261376232396463386232303462613539613635363638613436616532383738663030643166393439306466396532383066656266343331356561303465616135363861336139666434386336326336336236656364613639303230333031303030312803320218063a606434363430333938303337393230373965636364356134343331316361306463323262353065633839356235366535336431326232396637326463366462613363616665326535623831303466626461303338616635623434376430666231320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393361323135636334613761373232636165396331336162643633366466393963636565633661663964623436623639666135313637313665663530636532343930613938316530396162303139636132636234363831316235623631396431626431643565653666343661343263373737636264656536343261313438346563646635646464333732393634326333386336643433613838353838373434373566353832343434333636346330346466656439623839303435666230383565323563336566636234383431373333656666376335323963313339653639333530633263643739623263386431393637396137313265346538636166643332363735343162383332623365313061303132353564656636396466316539643362386438656166303331316465363764356531326232366464303164626264396433653432643335643964653237313330326530663166363964383763626337616361396538383637653964343238643363616230363636656234393064356662616233306266663366373835643033663230373261343362623962356535343635366135393263623631656166643561356566323834633763616563363666376634373332356363306434633164323766363631643861373438636135303731633036656631333464666639366634303836363838333636643436386132343738303031376530623536616261376661623433623362376330623737393036666165353438326633323831316332393265366231343435346531346238393438303161383661303363633437373934646430643734353237613732653432346564336166613034383939656362396136336632613961653732626537666139383961646630643635613332633835316439383031666334313034386466333335363466633762333137303765633866623830313430666537623761316661313230626131636236363033323463656666623462636332643962623764653063663534633831396632646433626365616465633963323566356531396463396231303230333031303030312806320218093a603365303261363732306334343636353965383633303564353562666565383230623335653635306665636163633535333039373435356532633465303332636339646564313662316262343464336235393262626163623663326266663165360ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303930323539663465336439663066333934323536353438653963373330386231306237333430336363393039346439376164313531623737303631373062393737326365623634643636326563656639303161386437643135643331396135396338623731303731616363643839356237633933363130646336393736663637633465313732396261383337336162376535326133663363386632363534393164646536396436653039393934373065373434353938313133316264393663333665363836353230336662326562643564353065616461666237323633393664656331643931373438393862346539626530346337346433303466656164643963626433323334633362376633333036633939636230633333396663323539363962343164353861326237636663313833326532323664383163313936333939336532323535613038376431363938633033643432313062643634353830363434643039356361373661613137393465646434306331633837623566383261386533396636303365393731313662613034353738653765383033343634393564373835643465663763663737313462396562366635663965306239613934663462373338383436313962393237346434613935656631353735346138396439376566356331613838623664363933653061383065626435333766633963663063613931643163363264393135646537656438313862393532653634633230303239336565386532383461343136613732613365313266633764343233623135386639623439363630636263323436366662656430666564326532346531303266646539343265623463666439346265633436643364393066633038633339666563626130336530636132343634616536363462393739353135626132396531663730326333666537303262653739333739366438656462313761613438633039323930623032343534396630363131663561653233656437653136343432646637643164616432323836633262623039643535323264643365643639386332663032303330313030303128093202180c3a606339373462623938326338313931336237333236643561336639646363343836313261313566376161643032663230376230663130636432303137613666626666353830336537636139626662343730396162323862366230396435623133660ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303962646438653834666164616133353332666334636530316138613137643463336232333266353061393739306532363236383465646334383233653831356131626435623230656365613762663536653239663662623762383331666233626636656663643134373566306238656435666662306231333835623936643136366236323966303339366138666566356630366534626361323565653461313334306565323633613464396262303230643866343732333036663364383836313338646537613031396530353962643061666339303263636261316132313361653264616136306338613031333735356665306134386530333466356234303233613264616465616138386335343836383335336163376137613364663132623266623634313837373465396231346265366561623863633237623838303132616436313632646137346530656562313631333539303566343337333734646162383538366437353061323662626433616332346165643837386334643533653635313037326338373165393464376163633537356339363733383137333461353366656166346437626136626364643234316363363435386336303837643836333032616132353163303466366435366239633332643764393636323437353065643035353738356430373733663433646330393962323863393232383131343865366338316632393766663964313636653030306163303462333132343138363737356663656637356635656261306331303332626631333064663663643761343632313164306466336530353834643932656136373334396438343930353038656234656638386635346338633364343836646538373139663130666139366665623835636337393630373663613738313331386565326439656439303363613133333630343063353961643931613464326636393865393130386165306564623962316362393561643333623139376666623138626431626138623536636265653261616539353835656365323038613165313462343835363436333032303330313030303128083202180b3a603937303834333033333130373866353638326337663332343464383263336233653238316139313837393537386465656163646363326132656265353431616631383831313561643265383338363565356635643234376234613138633165650ab50722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039303938383635646566326632616233373663376630663733386331643837613237616330316166643030383632306333356362366562666362623063333330303331393361333838633334366433303233313732373031323139336262373666643330303462383634333132633638396566353231336362623930313130313530396465616239346632366137333265363337393239646134633463623332353137653361646262333831316435306163346337376331666365386236353136303632313566333437303766336537323635353435653538633839343630396532383337366264623737373566653330343339653065313539326664636230633365653163333035373733643037326136623839353765616663653161313162653936356564616666333834333336366362366134346563323561383930313036653632343735363766373662353530666461343832626165633633303764363938656338383834316664363666323366323130653437623861396463626136626134653166613731366462333363383065333038313934393664636235653536303966623665376336313533373962646465643432376539323331623932353463326261663934333630386138366436393861653961336338363339646638383764366636623561373133383564323433333864393131613231326266373166316532616363386231383662393665633865363963383662366430353832313737373661303963396336383935336564623539313635373862356132363362326634363965336230633037656164613731613434376565613766386663316262383037343235353536376237663062643165366166623033353837313863393862343239653234623232393835393666633736636636616633393663613934333464373932366563376433376434623932616635366434356665666638313936303935323234613931366331666665366236363765323535666333616338636363656639323064633034346232353030333133326238373830363734326630323033303130303031320218033a603333373339306438666561313434616663313265383132353461323864616336656138323839333833366163303732656666643835653061373734383538306566323830393636343863356137663864626234636538313437363831353133370ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130306335376564623966663237366530323362323830323163623164383763646631393636623639386366343865346561616137633639323037376365656538636362323339613463393231353937653865383966376363303564336633313331353738393736633465333134343035643461346530336137323431306335633039636135323761643561383562393938363337653732613332653166626330643535343662323436356539653830366332646435303965623035306162356662323730363366643932383135623164643236383965323131316361656236663534396539346139663030663038323164346361366336613631313766356135333363393236336266303734613330643563626566353064316338633233383762636139373265646564613039383362356430613662353764636230303230303036383238623430653430373662343837306232346261643834303536656535326235663432326538383430303238633235303036333832643865396336363132323566346637366561373265333430363037653966633666336332303433333037366131636138636231356564303361633839363664303530376263646536383165346530323331656539663837643131316537623438616338663934643264383432623532646637336635373363633534313439363437393763363236393638666661653734313866336236313039623561306630396533323233663461346435653335303964643235303133386636626331376266366365636531373539343433306466313830613338653930616466326166666266616430633662386331623837663137386130363164636662666638623932633931363664383734633166663561663466626364626665386539643039393337306464663630626537343736333364333665653465623563643531663665336333333965313531653431626462356135636532633863393761306134336233636434636330383138383463383739663964326633373438343238633835373366313763393066336362643032303330313030303128073202180a3a603734306166366266373339653838336338386633333434633961306638623330316533396463393831633531363365306465326133666634326239396534323665643765353662363766343231383530333834356466363266343963396662300ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393133316161333638663933343532323966393762363235396363636166666561323365303063643565616430326533663639366331653731346565333933396461643836306533386266393561323937346639656234386539333433663861616334303565613935356430353332336531313762336231633934383133613361663432666538303832633364343362616631626434643833363765393364623030616436393665363237613130333661653533346630313165616435653536663337613666666534346236623965303939343031313932616435363061303334366234316138313030393566356632643766643332643665656236353562613735386336623532366331323933383661663731393763376135336165363033643632323833323235343936316631366430656661383037396137363835363138383862653733333439323231373935366262636166616562623631333563356662623234383464356234613566646630333336616330326532366331363532633162643865616633306461653164366433656230306637623466616238643634373866653864393565623931316466393636613064656134653532326462373662383936363537306563633561663039353136343234663061663566386565363665333836643536353037313339393731363961633337353733626635326664303538646539356162326666363865363831313161623233343035656139363462326262383864303263306631636165643731656364643465346534303835393438373666646238353030626335356337626130323036366530356162393864396637653034363664393730326562353765653337323266386663633835613735353035666633323632313730323838623738383732336164623937653464653536323063633930656164313338326663643735373138383966656662313165363737316263336636663366656231396337616335343238373864303361393032373035323663336565643234393465666635346531353363613966363839303230333031303030312801320218043a603765616236393661623935343336363538626331346666366234626534643932356364353162323230646632613164356336656531363061646166323961353165363934646533656531383463653232656164386437646239333231383266330ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038326465373330363566333466666332393334306435393439643232323062316534333636656435636637633665626436313663663934313661353365613030313766366262313136626664336633646566636331356237613464646630653434643032666536393536383830353365373961373730653230316263663731393333393030333965653866303836643466613734366337653035363931383330316639623565383465333932363238323830383561373962333232626361306235643835666539373232316132366262646532353863363230663064636561303261623165646431366363343961336632616239323838653364643166333764633462366136663731333366663932653534316337316237306432613266363664353537323561623138626638366430303965633364323466356431326530623565363830326431313531333732643462373634656265636234616638326636343934383565633537623561303164633637393538663561303363636161623763626139333534613137333732633133313662613437633935336161663934393031623366386332346536613361666436373538653766336231343363653264643363623037316232613734633932316365653934396134623561366265383739663163373930613662386436336231393264376565323961393439316664643638396139386330613763336436303332306631623461633264363232396466643934653432663361363034386137366265316562393538633861313837336265386433333861656339666335396162376633373632363738393430326331666435393566313930383735373565306265383237666334633061346662336433393361643734613934396363393836626662363463616264646165353339333566366463353630373464623933643737656133623831366264643662653533343439373237323238393835396666333463653531383630616666623632316431303438376463333834336631663836643534303334613633653438613161306430323033303130303031280a3202180d3a606132656363316232616539386264323862633161303864386633373161306434663734356337363864306337373339363235363265333433623235643833343235656565613765663865613134323935333432623865623738643332656333660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039383735356134303862353332316532363330353230303064366437643461326333613535346435653133383461396362356562663437346165383832633633623438366264303864313434646466316139346365396137643632353139363330303661666461616334353838343666313736343031393566653235333961363536393330656661383534663231343865363865633161303863316334396432303063336633303435666537313437663036643533346334626432363231303063623164643339373339643736306438316130626432306638336632353564323530376434636362313130366235333631386336613934343039633838376361653236326434636565396338363233323134376365633134303465306335376262613733313731333065653339363433383838616633643539386564643832623863363165363561653831613465316135366263303664333937313433613938643431636138376433656634333365663061656162363830313139316233653338343830393638663636623665383836363261663435613965323132393934663638623238386562393637626562393834373863323433653231333663316131353931663036316635626330346232316666326261343862323966313834333130383838373362646665393966386135326539343038393731383536653830346465613630326133313137383663393835363532393633633361333737303332396234303966373466646663373436623232613566383431383931323037316334636538343663396234623332306665646636653962363465326362653338346639613832623661616164346232303930373433316466316133336636393230376135363536303062653831303730643038333239303039393538353961343439386435623539333135626365626566656538303765623061336139343266316364663333363764643434343466646232393838366566636464306265346162653961313838383033393533383735656461333364623732393839663736336230323033303130303031280b3202180e3a603139366237623132303739376364623361396430303362393833643537646131303331303662313733306531376636376532633762616161646234333738396166313639366461313031316232353362636263383630333333383566303332380ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061396462376638626161313236383938666162373839313135613362356438393734346631393765323830343161653039386633653838366336393837313732316531316262306164313166336365393132346161393631643661306463383435663439373635633366616231393935383430323637366635363434363262663238316462613535383837383066303365393035373938653138343236396161613630663761313437323333316532666231646561646438373763383463626362363431636139653563386164366534356263313539636230373966636230643434396364636438643932333963316130343765376234343864613063646361323636313061323566323936643936653734363962363736643461343434353136653761353965383532393361383038366638343063303532383534653032613863623230303264616433353832356265346438336235326661393165386337336666303439373436313438383632373837633131313866393234643331636261633162343466656666323264343336623339373965616466396234336134626661373265313562343735356663616232363065303661323739633362623733626337663136613036306434643532326664343930353830333838616135393564383034343733366535323266363432343931356637383033623735383365303935636466373863333235313936393764653831623839666235303035343735336231613137663961616662303634643834633939326639616231316363626338636231303831346463616635323634616134356632316264656661633832636361636161663335386533313337336565316261346537343032666438613730656130633238636135636337346463343235313063393639636432633435396231656333363838613031656133396139393237313063643232393763393861383462363334386135373738303466646332333464336665313930336532633231653137326461323862353961653665346337653865646438623731633439643730323033303130303031280c3202180f3a603538343661353366343437353239666439636462373830346364333136383865643665656265336236336461326635663231316666626337333731393763663366316366626664613631626537643135313066306539323339383131376637340ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061386365616333363765623166316465356630643965663365616630646639623938343438666532303830383437363536326130363063353163323839373730623463616366653932636236353536393832336539363263326132633966656435336264333663613361313232646531633532356135383266323561346437643632386331613364356264623839333661656365373531306537353534656537303333303235633039326338323865656235373338626530326564393633646138316135393230353633346365393435343537376162383266343066313366316565353565306165373237653233633330323834623166343462393961636534646463356639616337616438386439666132323535393335623234646362613834303036343265313663663235333263306230643638393239303436303837313563343037366634366438346130653066656433366537366363646339363335356537613236313630393435633262353461653236636330306664303832333236333436656565656137646437356639313931316539396462636239396561346163366261303536633333323238643838316438353833316439636338373935393364613137343664643065653935646332623936666539336261666366663263643764393239353864373864663333663230356437313135656439666163346462366634636336306535366135343431646135623562353566613539393939303265393538613662366334346438313064646335363138313234316238376632326630353961363838306538303231373336643031383937646236353434396365383137613233373564303335353163623064653530376336303961306338303330656366346266646562323133633033646161373634613138323162373234333334663731663736386437616563623237373035326137303333373635663037323138303536633738663261383761663138333836643866363161356366636233663262613464643539393135663133643338363334643136393537353730323033303130303031280d320218103a603030306162636435396133306135333838633530306265363832663663613239343034363239356339323735383831633230643334626230643639306564613762333862366262643037613364643166646662366137303434626230396366660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061663062393134323537626637613436353563346135306430636164356530613165343538316564363632336630653837333066373936623866323963353831373862636363363933326331666333316633396566343462383264336334336233393837333733373366656362313239353232386130346664353061313466333634366438346665316634363763616562393864343633653239373565393935623864326531653339663362663661646463323561653335643635643032363038653033343535333739363665326162636534396238313462656164336331623735373137346165333063303062306334336539396238303439366237326433633133316631633665346663646130356632383131376566396532386334333033626534643863376530343264353862383363633132313934356132633635653739363263616139313835393338663337353764663763636139356366303262356533313934346133613631396130616333663165333462396230313364346332323463346631653730666439666433363938336566383661646535313833363263633833323263306637623631613961633735666238326537623836643638626330663039396130396131346361633561316438643338663961386137306363333766663563633362626432373432666664313436323535633137316536613137383038333237316463653066646536383165643439326362353962303739366432373031373538333864633539303831303765336136656133663961343036623364313133306363656333623437393165343962626332333136303362343661623264306639336434336265373561623961346437313065613934306532383561376231353362306361376364646565366439646365306164383335306334316439306332313562393538383531356166613061633333363561653037653831663362626233366264626561633462333162636231616134653832353635623937376639646164383564363236656566396161613965663864376533666230323033303130303031280e320218113a603933653238313031303462326231376230303935326235613431303264333365646230343363623136646533616433643364363832363066353562623065353837333765613539343463333338663763386362383863373833336663383630630ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038633037626533303561643630623930626132646162333962306565373736306531613232663835373532323534306437306230336233663965343837356133613239616230383038386631343466353765623235326534366261353933383564306536643432373031313764613061626331623362383036393463396135303538623836643631646661303665373136373039633838653866656163376333613065316432356663306165626636613866373666636239396638343566653138313436316361623638353862393763336134303237666233373132623134653663303738396465313764343137363435373765353131343137656231363236393265623037616531653733353532333565396262343339303437623663303136313337383265376464366636303464616134363734363631643533393631663436633366616136623765373637363264333733623562353432623739656139363365666266333361633638313938626232623636316366663637363931366566333732616434633236633231366334626334373837633834656333326431383464373763373531383663303963663364396639313433336361393835333131396261623331666136616432366634353365353936643962646563613638613537363962633866656537613533356438306338633666336566623164666232383861623661393739383534623763653833313234656330643130326166663934633362373466396333373839353863323565623933336464353363316538303561313836353464366439313836393930663635373034323966393630663334653862346637666439393732646362666539323430653037346461326433353561356637656639633161663632656635393832613831373435373862396331356334396563353636626461636233306363666365663039636466653730386164343837343234653963316265363533663965653736363065376439343263316566613564613238366531616464616230366139613333663964653934363739356230323033303130303031280f320218123a603934383235313739643163333934303137306233356432363665346366613830643737386335653966356261653764653833666638636334373431663362653336616336336431653761653439373261656466366263316533636632303638390ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030626531376339393634376365633635613434343037623533353835366233633362616566356235346635363561663538623834353662613863376365353335643561633732633631633434633736623363353763386538363438343136333762653130613833636665333963303932343736643064626534643663646364636437323061333062356266656235316130316131386635383263343566366338363939336663663764663138323933356465316438363930363034346463663335313836393335643962643765656137393532333532626562623465663961653066373636316537306134323337616661393839393636383763613438666366633562303064333830376630353462653066613863336266613432353033386265366566323935313634663232663733623765383863393465613962653861613466336132343563383962396431666435313932663761353062393538623265663831303462333666316266386664326366623238633134323138303063316334376534656639386166313530303730636336643639643137653865623932663138613661613161363532363661343935323338643130336638663639356235376563663337333635306130353230303837343537323162656138313536323739363763383037363336356466386334633761376434646438663263333835306331386662613731656236306536653864666264313936653035333766643730623334346563626363353330646663383364613666656466343964353161393034313935303262613964373063643335663163663363303639346532333534663930363466646266353335656232336332376330613433643062373863316638363763363164393836393564386465663762633261313062623636373463323266363661616230613931383133646466323763646238353263353965663739653162396531613037356661366565323761376533373734646266346232363436353432376536643561623931666537663066336137313738346563613138326235303230333031303030312810320218133a603038393039376465663031623037633764393734613537353532353161366161613061666236623332613534353334336432393138653732626164303433323163313131633234643432373538306633626131653236616139643735653632360ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613561643262373634336130346330353564326638636432353131623135313339666334353537353632313338386534396331313962326633393861636131313066363133393662306338363664653530363335323262623835343032373365313366366439346365316536303433386636616662303061616136343631326637313435653962636538626331613533623934313931336161373663396633613238333366616437636632383563376163326433376639396633633263646234396465346431353165363136373835363466323831663534313432346234316661376335316232613936303232383363376433326565303065623833386461313563333861666339366530363164393763656465323231363566663161613935396631633432373562326430393863343035383661353537396662623363623930303732373034313230613861363661353237306634666366643130383663393233363930613335653766643434356533336163303366313339633638363835353635373063646334616166323231303761366331613434323435366137633663373965653034303930653765356434663636626361363063613166343762366466623534336461633363626631396137373139613866353562366638336234613362386136366436303235366430613436353531666137303234626430353633316238613535383038373732353463326632663236386364633333643264626263666237333365396662653233336262396362353961623331613031343862323365386334323638306666313061663463373961346430383334366662373961393364393632393534386561663162623132343639386661656661346364643732343432633033613034623733333433326637343839303361333235633238336434353661623961653932316165376564333339316535643137383765666463323335343061376238356336393161653837306130376639306231316331336233326365343365616564313562333639363835636534393137376363393835303230333031303030312811320218143a603939666162633461646534653636326336653238323366346139366562323134343034383465356136643064333132623730633036386432326236323936333830376332333361343964626239383361376562623330653737303637373261340ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030386434356332316330633935656636356130323964353263393537666430663835663230313233646130333465363136373164646565353437356630373338326136366336366362346463353035303464646664333735383130383364663864313735373733306564386436663336346466346333366132363531353931393535646132303161323430376661386162396232333133383131323235613064613233306662653338306530393061613536656661346632303265633962343832336636353031643936616336393865626632366161636633656532643166333261373231633934376531303736636633356233373364613164383761333661313532653030653731303131373932323832653832356666313731633538333362383835373062666336646138343439653666393566386231323635616235353531393430333135353364316435373666393363343263306361363061616261633463386464313632643831313466326232313531313538336337323533396665353663343939613932396465336134306130643435633137633538396332643739383863653236656166633932613364333762376561303034326434336530336166613632373162323632353561366363636661653533373138323164383165306230356332353062353966306139303734316130653065383861303965643536633562393738306430393566303930366630623831643531323633393832616165303131333663303732643834346131316436646134623261363163363434653161623137663136666634386565323366656465383435326631653432653264333061303739306332356434323036306531643434613637316132656232336431313466363863373165333366313736646235386136386234333030353462633164323938336132336133326561366666393566613763346438653338306562323936653938623739363865636638343534643831376337333765656135646439323165623836633136633762323933303461346137656362653561336131303230333031303030312812320218153a606537396165396337313933643164326263393433383436346338616135663632323461653835323936366134336239383235383833663766373432633533393562643330393935383761393638363662393233396431656666336165353037610ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623035616265326162303066646430366339353565383637313062306530366631613932363234613438616431636263386466633666323231323936326230633330666462643238346133376335613337363538623633633336656138313632353631613865346639343663626535373232633032383830316630663238316337306638643838633763303061326632653239663539376237393938363965643833353664663537633437626539393434613261616666363530663962346262613064626335336463383830666462623639656134353139303564323830323230326638653239633034613736643237616632656237633534383438356266336634363934633930633431383130383838383433373932383438383335663738313637303764336538643736663465363766353738306263663038383133633535656336333961396264363234313738663565623134376435303061663335316539656631623165333432343834636132363064623763636261653438366631336366323635623562316162363838303636303038303533623230633364656463653737316339613038613033323061613963653435316562396439383361376234396361613130393666386164633039383331386463333865306537636566306438653564353537613036373536383561316339653235366132626339646261333232623362623331373263663731343037376263333830663861306134333361386266613766626663353966366230393365633862663665393339376330396231386531383034306331623536363836343733376338666137653239373935663361343538386464613763326261623439353636356363346139623833366532656239306336326133666361663539316662356638313830346337363138306536323666613236343461376465333435313164366334363637643938393337653237373333663464316539313338383333353465353466643733353137323165373666376235366333343833333838663461366238376232386165626562303230333031303030312813320218163a603962343038383566313362366163316337353336393262613366313739303061333838333165363934613061663937343934623834333838323039636235656662646339386136646162623265316337313833393166633133356264616163330ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396463643863306135336539306333353539353734663636323034313137643362353033653530613336643330393766616338343239653663656364333762623534303731383038663265653938323033356638353161306339626532313736333833613232653338633161626131363866333266393035373063623332333363666536323539383736363661663637623531346361656632316662386466366430666364333363663236303662393264646561353533366236303638643836373832653339626435633338343435393931643431396237643165633038353939343132633039343964316332343062333563313464633535323734646261373166666165393336313235613566383139663534313332653234333964346163353539373939366563653835653133646666333336316639313331663536636561633562396635353262343963663666396139616336653564636532646233363934363266393361663830653562353662366538626566613136326130363162346137363839326264633834363437333036633630303835386664643237303332373663326337303434303139386566643766653335343563663261623538306337346366643634343561616637626437663734356363323532656162643236356561626565383632343137313034653639343861353537353666646332323264663061313031353234646531633363303863636630343330313165633766653936346564643834353161313330313437633037333633613335663131666465656638663261326237363137353762343335386666383962373561343864363762646336303930363933653062623836373965636262393366666462336633656439366265633933656634363536653337313661623837636534366361386531323539633866656464653866326631656130663365623263343865393635353164653132333330333435373235663435656436396338353735623531363833616661343732363231383236646232326262326431633466316533363436346139303230333031303030312814320218173a60346630613033333466393737363738313632663830643936376637323139313431333630633062376637663033316233376336396536323137333933336564616434366263626139373636376565373262666435613933346261313532326330")));class ManagedNetwork{constructor(e){this._network=new Map,this._nodes=[],this._healthyNodes=[],this._createNetworkChannel=e,this._ledgerId=null,this._minBackoff=8e3,this._maxBackoff=36e5,this._maxNodeAttempts=-1,this._nodeMinReadmitPeriod=this._minBackoff,this._nodeMaxReadmitPeriod=this._maxBackoff,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._ledgerId="string"==typeof e?LedgerId.fromString(e):e,this}get ledgerId(){return null!=this._ledgerId?this._ledgerId:null}_createNodeFromNetworkEntry(e){throw new Error("not implemented")}_getNodesToRemove(e){throw new Error("not implemented")}_removeDeadNodes(){if(this._maxNodeAttempts>0)for(let e=this._nodes.length-1;e>=0;e--){this._nodes[e]._badGrpcStatusCount<this._maxNodeAttempts||this._closeNode(e)}}_readmitNodes(){const e=Date.now();if(this._earliestReadmitTime<=e){let t=Number.MAX_SAFE_INTEGER,n=!0;e:for(let r=0;r<this._nodes.length;r++){for(let o=0;o<this._healthyNodes.length;o++)if(n&&this._nodes[r]._readmitTime>e&&(t=Math.min(this._nodes[r]._readmitTime,t)),this._nodes[r]==this._healthyNodes[o])continue e;n=!1,this._nodes[r]._readmitTime<=e&&this._healthyNodes.push(this._nodes[r])}this._earliestReadmitTime=Math.min(Math.max(t,this._nodeMinReadmitPeriod),this._nodeMaxReadmitPeriod)}}_getNumberOfMostHealthyNodes(e){this._removeDeadNodes(),this._readmitNodes();const t=[];let n=this._healthyNodes.slice();e=Math.min(e,n.length);for(let r=0;r<e;r++){const e=n[Math.floor(Math.random()*n.length)];if(!e)break;t.push(e),n=n.filter(t=>t.getKey()!==e.getKey())}return t}_closeNode(e){const t=this._nodes[e];t.close(),this._removeNodeFromNetwork(t),this._nodes.splice(e,1)}_removeNodeFromNetwork(e){const t=this._network.get(e.getKey());for(let n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}0===t.length&&this._network.delete(e.getKey())}_setNetwork(e){const t=[],n=new Set,r=new Set,o=[],i=new Map;for(const t of this._getNodesToRemove(e))this._closeNode(t);for(const e of this._nodes)t.push(e),n.add(e.getKey()),r.add(e.address.toString());for(const[o,i]of e)n.has(i.toString())&&r.has(o)||t.push(this._createNodeFromNetworkEntry([o,i]));shuffle(t);for(const e of t){if(!e.isHealthy())continue;o.push(e);const t=i.has(e.getKey())?i.get(e.getKey()):[];t.push(e),i.set(e.getKey(),t)}return this._nodes=t,this._healthyNodes=o,this._network=i,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}get minBackoff(){return this._minBackoff}setMinBackoff(e){this._minBackoff=e;for(const t of this._nodes)t.setMinBackoff(e);return this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){this._maxBackoff=e;for(const t of this._nodes)t.setMaxBackoff(e);return this}get nodeMinReadmitPeriod(){return this._nodeMinReadmitPeriod}setNodeMinReadmitPeriod(e){return this._nodeMinReadmitPeriod=e,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod,this}get nodeMaxReadmitPeriod(){return this._nodeMaxReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._nodeMaxReadmitPeriod=e,this}getNode(e){if(this._readmitNodes(),null!=e&&null!=e){const t=this._network.get(e.toString());if(t){return t[Math.floor(Math.random()*t.length)]}{const e=Array.from(this._network.keys()),t=e[Math.floor(Math.random()*e.length)],n=this._network.get(t);return n[Math.floor(Math.random()*n.length)]}}if(0==this._healthyNodes.length)throw new Error("failed to find a healthy working node");return this._healthyNodes[Math.floor(Math.random()*this._healthyNodes.length)]}increaseBackoff(e){e.increaseBackoff();for(let t=0;t<this._healthyNodes.length;t++)this._healthyNodes[t]==e&&this._healthyNodes.splice(t,1)}decreaseBackoff(e){e.decreaseBackoff()}close(){for(const e of this._nodes)e.close();this._network.clear(),this._nodes=[]}}class Network extends ManagedNetwork{constructor(e){super(e),this._maxNodesPerTransaction=-1,this._addressBook=null,this._transportSecurity=!1}setNetwork(e){this._setNetwork(new Map(Object.entries(e).map(([e,t])=>[e,"string"==typeof t?AccountId.fromString(t):t])))}setNetworkFromAddressBook(e){const t={},n=this.isTransportSecurity()?50212:50211;for(const r of e.nodeAddresses)for(const e of r.addresses)e.port===n&&null!=r.accountId&&(t[e.toString()]=r.accountId);return this.setNetwork(t),this}get network(){var e={};for(const t of this._nodes)e[t.address.toString()]=t.accountId;return e}setNetworkName(e){switch(super.setLedgerId(e),e){case"mainnet":this._addressBook=MAINNET_ADDRESS_BOOK;break;case"testnet":this._addressBook=TESTNET_ADDRESS_BOOK;break;case"previewnet":this._addressBook=PREVIEWNET_ADDRESS_BOOK}if(null!=this._addressBook)for(const e of this._nodes)for(const t of this._addressBook.nodeAddresses)null!=t.accountId&&t.accountId.toString()===e.accountId.toString()&&e.setNodeAddress(t);return this}get networkName(){return null!=this._ledgerId?this._ledgerId.toString():null}_createNodeFromNetworkEntry(e){const t="string"==typeof e[1]?AccountId.fromString(e[1]):e[1];return new Node({newNode:{address:e[0],accountId:t,channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[];for(let n=this._nodes.length-1;n>=0;n--){const r=this._nodes[n],o=e.get(r.address.toString());null!=o&&o.toString()===r.accountId.toString()||t.push(n)}return t}_checkNetworkContainsEntry(e){for(const t of this._nodes)if(t.address.toString()===e[0])return!0;return!1}get maxNodesPerTransaction(){return this._maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._maxNodesPerTransaction=e,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}isTransportSecurity(){return this._transportSecurity}setTransportSecurity(e){if(this._transportSecurity==e)return this;this._network.clear();for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t];n.close(),n=e?n.toSecure().setCert(null!=this._ledgerId?this._ledgerId.toString():""):n.toInsecure(),this._nodes[t]=n;const r=null!=this._network.get(n.getKey())?this._network.get(n.getKey()):[];r.push(n),this._network.set(n.getKey(),r)}return this._healthyNodes=[...this._nodes],this._transportSecurity=e,this}getNumberOfNodesForTransaction(){return this._maxNodesPerTransaction>0?this._maxNodesPerTransaction:this._nodes.length<=9?this._nodes.length:Math.floor((this._nodes.length+3-1)/3)}getNodeAccountIdsForExecute(){return this._getNumberOfMostHealthyNodes(this.getNumberOfNodesForTransaction()).map(e=>e.accountId)}}class MirrorNode extends ManagedNode{constructor(e={}){super(e)}getKey(){return this._address.toString()}get mirrorRestApiBaseUrl(){const e=this.address.address,t=this.address.port;if(!e||!t)throw new Error("Mirror node has invalid address configuration");if("localhost"===e||"127.0.0.1"===e)return`http://${e}:5551/api/v1`;return`${this._getSchemeFromHostAndPort(e,t)}://${e}:${t}/api/v1`}_getSchemeFromHostAndPort(e,t){return"localhost"===e||"127.0.0.1"===e||80===t?"http":"https"}}let MirrorNetwork$1=class extends ManagedNetwork{constructor(e){super(e)}setNetwork(e){this._setNetwork(new Map(e.map(e=>[e,e])))}get network(){var e=[];for(const t of this._nodes)e.push(t.address.toString());return e}_createNodeFromNetworkEntry(e){return new MirrorNode({newNode:{address:e[1],channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[],n=Object.values(e);for(let e=this._nodes.length-1;e>=0;e--){const r=this._nodes[e];n.includes(r.address.toString())||t.push(e)}return t}getNextMirrorNode(){return this._getNumberOfMostHealthyNodes(1)[0]}get mirrorRestApiBaseUrl(){try{return this.getNextMirrorNode().mirrorRestApiBaseUrl}catch(e){throw new Error("Client has no mirror network configured or no healthy mirror nodes are available")}}};const DEFAULT_GRPC_DEADLINE=1e4,DEFAULT_REQUEST_TIMEOUT=12e4,MAINNET={"node00.swirldslabs.com:443":new AccountId(3),"node01-00-grpc.swirlds.com:443":new AccountId(4),"node03.swirldslabs.com:443":new AccountId(6),"node04.swirldslabs.com:443":new AccountId(7),"node05.swirldslabs.com:443":new AccountId(8),"node06.swirldslabs.com:443":new AccountId(9),"node07.swirldslabs.com:443":new AccountId(10),"node09.swirldslabs.com:443":new AccountId(12),"node10.swirldslabs.com:443":new AccountId(13),"node11.swirldslabs.com:443":new AccountId(14),"node12.swirldslabs.com:443":new AccountId(15),"node14.swirldslabs.com:443":new AccountId(17),"node15.swirldslabs.com:443":new AccountId(18),"node16.swirldslabs.com:443":new AccountId(19),"node17.swirldslabs.com:443":new AccountId(20),"node18.swirldslabs.com:443":new AccountId(21),"node19.swirldslabs.com:443":new AccountId(22),"node20.swirldslabs.com:443":new AccountId(23),"node21.swirldslabs.com:443":new AccountId(24),"node22.swirldslabs.com:443":new AccountId(25),"node24.swirldslabs.com:443":new AccountId(27),"node25.swirldslabs.com:443":new AccountId(28),"node26.swirldslabs.com:443":new AccountId(29),"node27.swirldslabs.com:443":new AccountId(30),"node28.swirldslabs.com:443":new AccountId(31),"node29.swirldslabs.com:443":new AccountId(32),"node30.swirldslabs.com:443":new AccountId(33),"node31.swirldslabs.com:443":new AccountId(34),"node32.swirldslabs.com:443":new AccountId(35),"node33.swirldslabs.com:443":new AccountId(36),"node34.swirldslabs.com:443":new AccountId(37)},WEB_TESTNET={"testnet-node00-00-grpc.hedera.com:443":new AccountId(3),"testnet-node01-00-grpc.hedera.com:443":new AccountId(4),"testnet-node02-00-grpc.hedera.com:443":new AccountId(5),"testnet-node03-00-grpc.hedera.com:443":new AccountId(6),"testnet-node04-00-grpc.hedera.com:443":new AccountId(7),"testnet-node05-00-grpc.hedera.com:443":new AccountId(8),"testnet-node06-00-grpc.hedera.com:443":new AccountId(9)},WEB_PREVIEWNET={"previewnet-node00-00-grpc.hedera.com:443":new AccountId(3),"previewnet-node01-00-grpc.hedera.com:443":new AccountId(4),"previewnet-node02-00-grpc.hedera.com:443":new AccountId(5),"previewnet-node03-00-grpc.hedera.com:443":new AccountId(6),"previewnet-node04-00-grpc.hedera.com:443":new AccountId(7),"previewnet-node05-00-grpc.hedera.com:443":new AccountId(8),"previewnet-node06-00-grpc.hedera.com:443":new AccountId(9)};new AccountId(3),new AccountId(3),new AccountId(3);const LocalNodeWebNetwork={"localhost:8080":new AccountId(3)},ALL_WEB_NETWORK_NODES={...MAINNET,...WEB_TESTNET,...WEB_PREVIEWNET},MirrorNetwork={fromName(e){switch(e){case"mainnet":return MirrorNetwork.MAINNET;case"testnet":return MirrorNetwork.TESTNET;case"previewnet":return MirrorNetwork.PREVIEWNET;case"local-node":return MirrorNetwork.LOCAL_NODE;default:throw new Error(`unknown network name: ${e}`)}},MAINNET:["mainnet-public.mirrornode.hedera.com:443"],TESTNET:["testnet.mirrornode.hedera.com:443"],PREVIEWNET:["previewnet.mirrornode.hedera.com:443"],LOCAL_NODE:["127.0.0.1:5600"]},WebMirrorNetwork={...MirrorNetwork,LOCAL_NODE:["127.0.0.1:5551"]},WebNetwork={MAINNET:MAINNET,TESTNET:WEB_TESTNET,PREVIEWNET:WEB_PREVIEWNET,LOCAL_NODE:LocalNodeWebNetwork},DEFAULT_PAGE_SIZE=25;class AddressBookQueryWeb extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},this._addresses=[]}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get limit(){return this._limit}setLimit(e){return this._limit=e,this}setMaxAttempts(e){return this._maxAttempts=e,this}setMaxBackoff(e){return this._maxBackoff=e,this}execute(e,t){return new Promise((n,r)=>{this._makeFetchRequest(e,n,r,t)})}async _makeFetchRequest(e,t,n,r){const{port:o,address:i}=e._mirrorNetwork.getNextMirrorNode().address;let a=`${i.includes("127.0.0.1")||i.includes("localhost")?"http":"https"}://${i}`;o&&(a=`${a}:${o}`),this._addresses=[];let s=null,c=!1;const u=new URL(`${a}/api/v1/network/nodes`);null!=this._fileId&&u.searchParams.append("file.id",this._fileId.toString());const l=null!=this._limit?this._limit:DEFAULT_PAGE_SIZE;for(u.searchParams.append("limit",l.toString());!c;){const t=s?new URL(s,a):u;for(let o=0;o<=this._maxAttempts;o++)try{const n=await fetch(t.toString(),{method:"GET",headers:{Accept:"application/json"},signal:r?AbortSignal.timeout(r):void 0});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const o=await n.json(),i=(o.nodes||[]).map(t=>NodeAddress.fromJSON({nodeId:t.node_id.toString(),accountId:t.node_account_id,addresses:this._handleAddressesFromGrpcProxyEndpoint(t,e),certHash:t.node_cert_hash,publicKey:t.public_key,description:t.description,stake:t.stake?.toString()}));this._addresses.push(...i),s=o.links?.next||null,s||(c=!0);break}catch(t){console.error("Error in _makeFetchRequest:",t);const r=t instanceof Error?t.message:String(t);if(o<this._maxAttempts&&!e.isClientShutDown&&this._retryHandler(t)){const e=Math.min(250*2**o,this._maxBackoff);this._logger&&this._logger.debug(`Error getting nodes from mirror for file ${null!=this._fileId?this._fileId.toString():"UNKNOWN"} during attempt ${o+1}. Waiting ${e} ms before next attempt: ${r}`),await new Promise(t=>setTimeout(t,e));continue}const i=o>=this._maxAttempts?`Failed to query address book after ${this._maxAttempts+1} attempts. Last error: ${r}`:`Failed to query address book: ${r}`;return void n(new Error(i))}}t(new NodeAddressBook({nodeAddresses:this._addresses}))}_handleAddressesFromGrpcProxyEndpoint(e,t){const n=e.grpc_proxy_endpoint;if(n&&n.domain_name&&n.port)return[{address:n.domain_name,port:n.port.toString()}];let r;const o=t._network.ledgerId;if(o&&o.isMainnet())r=MAINNET;else if(o&&o.isTestnet())r=WEB_TESTNET;else{if(!o||!o.isPreviewnet())return[];r=WEB_PREVIEWNET}const i=e.node_account_id;for(const[e,t]of Object.entries(r))if(t.toString()===i){const[t,n]=e.split(":");return[{address:t,port:n}]}return[]}}class Client{constructor(e){this._mirrorNetwork=new MirrorNetwork$1(this._createMirrorNetworkChannel()),this._network=new Network(this._createNetworkChannel()),this._operator=null,this._defaultMaxTransactionFee=null,this._defaultMaxQueryPayment=new Hbar(1),null!=e&&null!=e.operator&&this.setOperator(e.operator.accountId,e.operator.privateKey),this._maxAttempts=null,this._signOnDemand=!1,this._autoValidateChecksums=!1,this._minBackoff=250,this._maxBackoff=8e3,this._defaultRegenerateTransactionId=!0,this._requestTimeout=DEFAULT_REQUEST_TIMEOUT,this._grpcDeadline=DEFAULT_GRPC_DEADLINE,this._isUpdatingNetwork=!1,this._networkUpdatePeriod=864e5,this._isShutdown=!1,this._shard=0,this._realm=0,null!=e&&!1!==e.scheduleNetworkUpdate&&this._scheduleNetworkUpdate(),null!=e&&null!=e.shard&&(this._shard=e.shard),null!=e&&null!=e.realm&&(this._realm=e.realm),null!=e&&null!=e.grpcDeadline&&this.setGrpcDeadline(e.grpcDeadline),null!=e&&null!=e.requestTimeout&&this.setRequestTimeout(e.requestTimeout),this._requestTimeout<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${this._requestTimeout}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._timer,this._logger=null}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._network.setLedgerId("string"==typeof e?LedgerId.fromString(e):e),this}get ledgerId(){return null!=this._network._ledgerId?this._network.ledgerId:null}setNetwork(e){throw new Error("not implemented")}setNetworkFromAddressBook(e){return this._network.setNetworkFromAddressBook(e),this}get network(){return this._network.network}get shard(){return this._shard}get realm(){return this._realm}setMirrorNetwork(e){throw new Error("not implemented")}get mirrorNetwork(){return this._mirrorNetwork.network}get mirrorRestApiBaseUrl(){return this._mirrorNetwork.mirrorRestApiBaseUrl}get signOnDemand(){return this._signOnDemand}setSignOnDemand(e){this._signOnDemand=e}isTransportSecurity(){return this._network.isTransportSecurity()}setTransportSecurity(e){return this._network.setTransportSecurity(e),this}setOperator(e,t){const n="string"==typeof t?PrivateKey.fromStringDer(t):t;return this.setOperatorWith(e,n.publicKey,e=>Promise.resolve(n.sign(e)))}getOperator(){return this._operator}setOperatorWith(e,t,n){const r=e instanceof AccountId?e:AccountId.fromString(e);return null!=this._network._ledgerId&&r.validateChecksum(this),this._operator={transactionSigner:n,accountId:r,publicKey:t instanceof PublicKey?t:PublicKey.fromString(t)},this}setAutoValidateChecksums(e){return this._autoValidateChecksums=e,this}isAutoValidateChecksumsEnabled(){return this._autoValidateChecksums}get operatorAccountId(){return null!=this._operator?this._operator.accountId:null}get operatorPublicKey(){return null!=this._operator?this._operator.publicKey:null}get defaultMaxTransactionFee(){return this._defaultMaxTransactionFee}get maxTransactionFee(){return this.defaultMaxTransactionFee}setDefaultMaxTransactionFee(e){if(e.toTinybars().toInt()<0)throw new Error("defaultMaxTransactionFee must be non-negative");return this._defaultMaxTransactionFee=e,this}setMaxTransactionFee(e){return this.setDefaultMaxTransactionFee(e)}get defaultRegenerateTransactionId(){return this._defaultRegenerateTransactionId}setDefaultRegenerateTransactionId(e){return this._defaultRegenerateTransactionId=e,this}get defaultMaxQueryPayment(){return this._defaultMaxQueryPayment}get maxQueryPayment(){return this.defaultMaxQueryPayment}setDefaultMaxQueryPayment(e){if(convertToNumber(e.toTinybars())<0)throw new Error("defaultMaxQueryPayment must be non-negative");return this._defaultMaxQueryPayment=e,this}setMaxQueryPayment(e){return this.setDefaultMaxQueryPayment(e)}get maxAttempts(){return null!=this._maxAttempts?this._maxAttempts:10}setMaxAttempts(e){return this._maxAttempts=e,this}get maxNodeAttempts(){return this._network.maxNodeAttempts}setMaxNodeAttempts(e){return this._network.setMaxNodeAttempts(e),this}get nodeWaitTime(){return this._network.minBackoff}setNodeWaitTime(e){return this._network.setMinBackoff(e),this}get maxNodesPerTransaction(){return this._network.maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._network.setMaxNodesPerTransaction(e),this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}setNodeMinBackoff(e){return this._network.setMinBackoff(e),this}get nodeMinBackoff(){return this._network.minBackoff}setNodeMaxBackoff(e){return this._network.setMaxBackoff(e),this}get nodeMaxBackoff(){return this._network.maxBackoff}setNodeMinReadmitPeriod(e){return this._network.setNodeMinReadmitPeriod(e),this}get nodeMinReadmitPeriod(){return this._network.nodeMinReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._network.setNodeMaxReadmitPeriod(e),this}get nodeMaxReadmitPeriod(){return this._network.nodeMaxReadmitPeriod}setRequestTimeout(e){if(e<=0)throw new Error("requestTimeout must be a positive number");return e<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${e}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._requestTimeout=e,this}get requestTimeout(){return this._requestTimeout}setGrpcDeadline(e){if(e<=0)throw new Error("grpcDeadline must be a positive number");return e>=this._requestTimeout&&console.warn(`DEPRECATION WARNING: grpcDeadline (${e}ms) should be smaller than requestTimeout (${this._requestTimeout}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._grpcDeadline=e,this}get grpcDeadline(){return this._grpcDeadline}get networkUpdatePeriod(){return this._networkUpdatePeriod}setNetworkUpdatePeriod(e){return clearTimeout(this._timer),this._networkUpdatePeriod=e,this._scheduleNetworkUpdate(),this}setLogger(e){return this._logger=e,this}get logger(){return this._logger}async ping(e){await new AccountBalanceQuery({accountId:e}).setNodeAccountIds([e instanceof AccountId?e:AccountId.fromString(e)]).execute(this)}async pingAll(){for(const e of Object.values(this._network.network))await this.ping(e)}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this._shard,this._realm)).execute(this);this.setNetworkFromAddressBook(e)}catch(e){this._logger&&this._logger.trace(`failed to update client address book: ${e.toString()}`)}finally{this._isUpdatingNetwork=!1}return this}close(){this._network.close(),this._mirrorNetwork.close(),this._isShutdown=!0,clearTimeout(this._timer)}_createNetworkChannel(){return()=>{throw new Error("not implemented")}}_createMirrorNetworkChannel(){return()=>{throw new Error("not implemented")}}_scheduleNetworkUpdate(){this._timer=setTimeout(async()=>{await this.updateNetwork(),this._isShutdown||this._scheduleNetworkUpdate()},this._networkUpdatePeriod)}get isClientShutDown(){return this._isShutdown}static _validateNetworkConsistency(e){if(0===Object.keys(e).length)return;const[,t]=Object.entries(e)[0],n=t.toString(),[r,o]=n.split(".").map(Number),i=Object.values(e).every(e=>{const t=e.toString(),[n,i]=t.split(".").map(Number);return n===r&&i===o});if(!i)throw new Error("Network is not valid, all nodes must be in the same shard and realm")}static _extractShardRealm(e){const t=Object.entries(e);if(0===t.length)return{shard:0,realm:0};const[,n]=t[0],r=n.toString(),[o,i]=r.split(".").map(Number);return{shard:o,realm:i}}}const SDK_NAME="hiero-sdk-js",SDK_VERSION="2.78.0-beta.3",{proto:proto}=HieroProto;class Channel{constructor(e=DEFAULT_GRPC_DEADLINE){this._crypto=null,this._smartContract=null,this._file=null,this._consensus=null,this._freeze=null,this._network=null,this._token=null,this._schedule=null,this._util=null,this._addressBook=null,this._grpcDeadline=e}setGrpcDeadline(e){this._grpcDeadline=e}get grpcDeadline(){return this._grpcDeadline}close(){throw new Error("not implemented")}get crypto(){return null!=this._crypto||(this._crypto=proto.CryptoService.create(this._createUnaryClient("CryptoService"))),this._crypto}get smartContract(){return null!=this._smartContract||(this._smartContract=proto.SmartContractService.create(this._createUnaryClient("SmartContractService"))),this._smartContract}get file(){return null!=this._file||(this._file=proto.FileService.create(this._createUnaryClient("FileService"))),this._file}get consensus(){return null!=this._consensus||(this._consensus=proto.ConsensusService.create(this._createUnaryClient("ConsensusService"))),this._consensus}get freeze(){return null!=this._freeze||(this._freeze=proto.FreezeService.create(this._createUnaryClient("FreezeService"))),this._freeze}get network(){return null!=this._network||(this._network=proto.NetworkService.create(this._createUnaryClient("NetworkService"))),this._network}get token(){return null!=this._token||(this._token=proto.TokenService.create(this._createUnaryClient("TokenService"))),this._token}get schedule(){return null!=this._schedule||(this._schedule=proto.ScheduleService.create(this._createUnaryClient("ScheduleService"))),this._schedule}get util(){return null!=this._util||(this._util=proto.UtilService.create(this._createUnaryClient("UtilService"))),this._util}get addressBook(){return null!=this._addressBook||(this._addressBook=proto.AddressBookService.create(this._createUnaryClient("AddressBookService"))),this._addressBook}_createUnaryClient(e){throw new Error("not implemented")}}function encodeRequest(e){const t=new ArrayBuffer(e.byteLength+5);return new DataView(t,1,4).setUint32(0,e.length),new Uint8Array(t,5).set(e),t}function decodeUnaryResponse(e,t=0,n=e.byteLength){const r=new DataView(e,t,n);let o=0,i=null,a=0;for(;o<r.byteLength;){const t=r.getUint8(o+0)>>7,n=r.getUint32(o+1),s=o+5;if(s+n>r.byteLength)throw new Error("(BUG) unexpected frame length past the boundary");const c=new Uint8Array(e,r.byteOffset+s,n);if(0===t){if(null!=i)throw new Error("(BUG) unexpectedly received more than one data frame");i=c}else{if(1!==t)throw new Error(`(BUG) unexpected frame type: ${t}`);{const e=decode$1(c),[t,n]=e.split(":");if("grpc-status"!==t)throw new Error(`(BUG) unhandled trailer, ${e}`);a=parseInt(n)}}o+=n+5}if(0!==a)throw new Error(`(BUG) unhandled grpc-status: ${a}`);if(null==i)throw new Error("(BUG) unexpectedly received no response");return i}class WebChannel extends Channel{constructor(e,t){super(t),this._address=e,this._isReady=!1,this._healthCheckPromise=null}_shouldUseHttps(e){return!(e.includes("localhost")||e.includes("127.0.0.1"))}_buildUrl(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;return this._shouldUseHttps(e)?`https://${e}`:`http://${e}`}async _waitForReady(e){if(!this._isReady){if(this._healthCheckPromise)return this._healthCheckPromise;this._healthCheckPromise=this._performHealthCheck(e);try{await this._healthCheckPromise}finally{this._healthCheckPromise=null}}}async _performHealthCheck(e){const t=this._buildUrl(this._address),n=e.getTime()-Date.now();if(n<=0)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());const r=new AbortController,o=setTimeout(()=>r.abort(),n);try{const e=await fetch(t,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:new Uint8Array(0),signal:r.signal});if(clearTimeout(o),e.ok||e.status>=300&&e.status<400){const t=e.headers.get("grpc-status"),n=e.headers.get("grpc-message");if(null!=t||null!=n)return void(this._isReady=!0)}throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}catch(e){if(clearTimeout(o),e instanceof Error&&"AbortError"===e.name)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());if(e instanceof GrpcServiceError)throw e;throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}}close(){}_createUnaryClient(e){return async(t,n,r)=>{const o=new Date,i=this._grpcDeadline;o.setMilliseconds(o.getMilliseconds()+i);try{await this._waitForReady(o);const i=this._buildUrl(this._address),a=await fetch(`${i}/proto.${e}/${t.name}`,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:encodeRequest(n)});if(!a.ok){return void r(new HttpError(HttpStatus._fromValue(a.status)),null)}const s=a.headers.get("grpc-status"),c=a.headers.get("grpc-message");if(null!=s&&null!=c){const e=new GrpcServiceError(GrpcStatus._fromValue(parseInt(s)),ALL_WEB_NETWORK_NODES?.[this._address]?.toString());return e.message=c,void r(e,null)}const u=await a.arrayBuffer();r(null,decodeUnaryResponse(u))}catch(e){if(e instanceof GrpcServiceError)return void r(e,null);r(new GrpcServiceError(GrpcStatus._fromValue(18),ALL_WEB_NETWORK_NODES?.[this._address]?.toString()),null)}}}}class WebClient extends Client{constructor(e){if(super(e),null!=e){if("string"==typeof e.network)this._setNetworkFromName(e.network);else if(null!=e.network){Client._validateNetworkConsistency(e.network);const{shard:t,realm:n}=Client._extractShardRealm(e.network);this._shard=t,this._realm=n,this.setNetwork(e.network)}if("string"==typeof e.mirrorNetwork)switch(e.mirrorNetwork){case"mainnet":this.setMirrorNetwork(WebMirrorNetwork.MAINNET);break;case"testnet":this.setMirrorNetwork(WebMirrorNetwork.TESTNET);break;case"previewnet":this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET);break;default:this.setMirrorNetwork([e.mirrorNetwork])}else null!=e.mirrorNetwork&&this.setMirrorNetwork(e.mirrorNetwork)}}static fromConfig(e){return new WebClient("string"==typeof e?JSON.parse(e):e)}static forNetwork(e){return new WebClient({network:e})}static forName(e){return new WebClient({network:e})}static forMainnet(){return new WebClient({network:"mainnet"})}static forTestnet(){return new WebClient({network:"testnet"})}static forPreviewnet(){return new WebClient({network:"previewnet"})}static forLocalNode(e={scheduleNetworkUpdate:!1}){return new WebClient({network:"local-node",...e})}static async forMainnetAsync(){return new WebClient({network:"mainnet"}).updateNetwork()}static async forTestnetAsync(){return new WebClient({network:"testnet"}).updateNetwork()}static async forPreviewnetAsync(){return new WebClient({network:"previewnet"}).updateNetwork()}static async forNameAsync(e){const t=new WebClient({network:e});return"local-node"!==e&&await t.updateNetwork(),t}static async forMirrorNetwork(e){const t=new WebClient({mirrorNetwork:e});return await t.updateNetwork(),t}setNetwork(e){if("string"==typeof e)switch(e){case"previewnet":this._network.setNetwork(WebNetwork.PREVIEWNET);break;case"testnet":this._network.setNetwork(WebNetwork.TESTNET);break;case"mainnet":this._network.setNetwork(WebNetwork.MAINNET);break;case"local-node":this._network.setNetwork(WebNetwork.LOCAL_NODE)}else{for(const[t]of Object.entries(e))(t.startsWith("https://")||t.startsWith("http://"))&&console.warn('[Deprecation Notice] Hiero SDK: Network endpoint "'+t+'" includes a URL scheme (e.g. "https://"). This format was accepted in earlier versions but is now deprecated. Please remove the scheme and use "host:port" instead (e.g. "node00.swirldslabs.com:443"). Support for scheme-prefixed endpoints will be removed in a future major release.');this._network.setNetwork(e)}}setMirrorNetwork(e){if("string"==typeof e)switch(e){case"local-node":this._mirrorNetwork.setNetwork(WebMirrorNetwork.LOCAL_NODE);break;case"previewnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.PREVIEWNET);break;case"testnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.TESTNET);break;case"mainnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.MAINNET);break;default:this._mirrorNetwork.setNetwork([e])}else this._mirrorNetwork.setNetwork(e);return this}_setNetworkFromName(e){switch(e){case"mainnet":this.setNetwork(WebNetwork.MAINNET),this.setMirrorNetwork(WebMirrorNetwork.MAINNET),this.setLedgerId(LedgerId.MAINNET);break;case"testnet":this.setNetwork(WebNetwork.TESTNET),this.setMirrorNetwork(WebMirrorNetwork.TESTNET),this.setLedgerId(LedgerId.TESTNET);break;case"previewnet":this.setNetwork(WebNetwork.PREVIEWNET),this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET),this.setLedgerId(LedgerId.PREVIEWNET);break;case"local-node":this.setNetwork(WebNetwork.LOCAL_NODE),this.setMirrorNetwork(WebMirrorNetwork.LOCAL_NODE),this.setLedgerId(LedgerId.LOCAL_NODE);break;default:throw new Error(`unknown network: ${e}`)}return this}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this.shard,this.realm)).execute(this),t={};for(const n of e.nodeAddresses)for(const e of n.addresses)null!=n.accountId&&(t[e.toString()]=n.accountId);this.setNetwork(t)}catch(e){if(this._logger){const t=e instanceof Error?e.message:String(e);this._logger.trace(`failed to update client address book: ${t}`)}}finally{this._isUpdatingNetwork=!1}return this}_createNetworkChannel(){return e=>new WebChannel(e,this.grpcDeadline)}_createMirrorNetworkChannel(){return()=>{throw new Error("mirror support is not supported in browsers")}}}const NetworkName={Mainnet:"mainnet",Testnet:"testnet",Previewnet:"previewnet"};class LocalProviderWeb{constructor(e={}){null==e||null==e.client?this._client=WebClient.forName(e.networkName||"local-node"):this._client=e.client}static fromClient(e){return new LocalProviderWeb({client:e})}getLedgerId(){return this._client.ledgerId}getNetwork(){return this._client.network}getMirrorNetwork(){return this._client.mirrorNetwork}getAccountBalance(e){return(new AccountBalanceQuery).setAccountId(e).execute(this._client)}getAccountInfo(e){return(new AccountInfoQuery).setAccountId(e).execute(this._client)}getAccountRecords(e){return(new AccountRecordsQuery).setAccountId(e).execute(this._client)}getTransactionReceipt(e){return(new TransactionReceiptQuery).setTransactionId(e).execute(this._client)}async sendTransaction(e){return await e.execute(this._client)}async sendQuery(e){return await e.execute(this._client)}async waitForReceipt(e){return await e.getReceipt(this._client)}async call(e){return await e.execute(this._client)}close(){this._client.close()}}exports.AccountAllowanceAdjustTransaction=AccountAllowanceAdjustTransaction,exports.AccountAllowanceApproveTransaction=AccountAllowanceApproveTransaction,exports.AccountAllowanceDeleteTransaction=AccountAllowanceDeleteTransaction,exports.AccountBalance=AccountBalance,exports.AccountBalanceQuery=AccountBalanceQuery,exports.AccountCreateTransaction=AccountCreateTransaction,exports.AccountDeleteTransaction=AccountDeleteTransaction,exports.AccountId=AccountId,exports.AccountInfo=AccountInfo,exports.AccountInfoFlow=AccountInfoFlow,exports.AccountInfoQuery=AccountInfoQuery,exports.AccountRecordsQuery=AccountRecordsQuery,exports.AccountUpdateTransaction=AccountUpdateTransaction,exports.AddressBookQuery=AddressBookQueryWeb,exports.AssessedCustomFee=AssessedCustomFee,exports.BadKeyError=BadKeyError,exports.BadMnemonicError=BadMnemonicError,exports.BadMnemonicReason=BadMnemonicReason,exports.BatchTransaction=BatchTransaction,exports.Cache=CACHE,exports.Client=WebClient,exports.ContractByteCodeQuery=ContractByteCodeQuery,exports.ContractCallQuery=ContractCallQuery,exports.ContractCreateFlow=ContractCreateFlow,exports.ContractCreateTransaction=ContractCreateTransaction,exports.ContractDeleteTransaction=ContractDeleteTransaction,exports.ContractExecuteTransaction=ContractExecuteTransaction,exports.ContractFunctionParameters=ContractFunctionParameters,exports.ContractFunctionResult=ContractFunctionResult,exports.ContractFunctionSelector=ContractFunctionSelector,exports.ContractId=ContractId,exports.ContractInfo=ContractInfo,exports.ContractInfoQuery=ContractInfoQuery,exports.ContractLogInfo=ContractLogInfo,exports.ContractNonceInfo=ContractNonceInfo,exports.ContractUpdateTransaction=ContractUpdateTransaction,exports.CustomFee=CustomFee,exports.CustomFeeLimit=CustomFeeLimit,exports.CustomFixedFee=CustomFixedFee,exports.CustomFractionalFee=CustomFractionalFee,exports.CustomRoyaltyFee=CustomRoyalyFee,exports.DelegateContractId=DelegateContractId,exports.EntityIdHelper=EntityIdHelper,exports.EthereumFlow=EthereumFlow,exports.EthereumTransaction=EthereumTransaction,exports.EthereumTransactionData=EthereumTransactionData,exports.EthereumTransactionDataEip1559=EthereumTransactionDataEip1559,exports.EthereumTransactionDataEip2930=EthereumTransactionDataEip2930,exports.EthereumTransactionDataLegacy=EthereumTransactionDataLegacy,exports.EvmAddress=EvmAddress,exports.ExchangeRate=ExchangeRate,exports.ExchangeRates=ExchangeRates,exports.Executable=Executable,exports.FeeAssessmentMethod=FeeAssessmentMethod,exports.FeeComponents=FeeComponents,exports.FeeData=FeeData,exports.FeeDataType=FeeDataType,exports.FeeSchedule=FeeSchedule,exports.FeeSchedules=FeeSchedules,exports.FileAppendTransaction=FileAppendTransaction,exports.FileContentsQuery=FileContentsQuery,exports.FileCreateTransaction=FileCreateTransaction,exports.FileDeleteTransaction=FileDeleteTransaction,exports.FileId=FileId,exports.FileInfo=FileInfo,exports.FileInfoQuery=FileInfoQuery,exports.FileUpdateTransaction=FileUpdateTransaction,exports.FreezeTransaction=FreezeTransaction,exports.FreezeType=FreezeType,exports.HEDERA_PATH=HEDERA_PATH,exports.Hbar=Hbar,exports.HbarAllowance=HbarAllowance,exports.HbarUnit=HbarUnit,exports.Key=Key,exports.KeyList=KeyList,exports.LedgerId=LedgerId,exports.LiveHash=LiveHash,exports.LiveHashAddTransaction=LiveHashAddTransaction,exports.LiveHashDeleteTransaction=LiveHashDeleteTransaction,exports.LiveHashQuery=LiveHashQuery,exports.LocalProvider=LocalProviderWeb,exports.LogLevel=LogLevel,exports.Logger=Logger,exports.Long=Long,exports.MaxAttemptsOrTimeoutError=MaxAttemptsOrTimeoutError,exports.MaxQueryPaymentExceeded=MaxQueryPaymentExceeded,exports.MirrorNodeContractCallQuery=MirrorNodeContractCallQuery,exports.MirrorNodeContractEstimateQuery=MirrorNodeContractEstimateQuery,exports.Mnemonic=Mnemonic,exports.NetworkName=NetworkName,exports.NetworkVersionInfo=NetworkVersionInfo,exports.NetworkVersionInfoQuery=NetworkVersionInfoQuery,exports.NftId=NftId,exports.NodeAddressBook=NodeAddressBook,exports.NodeCreateTransaction=NodeCreateTransaction,exports.NodeDeleteTransaction=NodeDeleteTransaction,exports.NodeUpdateTransaction=NodeUpdateTransaction,exports.PendingAirdropId=PendingAirdropId,exports.PrecheckStatusError=PrecheckStatusError,exports.PrivateKey=PrivateKey,exports.PrngTransaction=PrngTransaction,exports.Provider=Provider,exports.ProxyStaker=ProxyStaker,exports.PublicKey=PublicKey,exports.Query=Query,exports.ReceiptStatusError=ReceiptStatusError,exports.RequestType=RequestType,exports.SLIP44_ECDSA_ETH_PATH=SLIP44_ECDSA_ETH_PATH,exports.SLIP44_ECDSA_HEDERA_PATH=SLIP44_ECDSA_HEDERA_PATH,exports.ScheduleCreateTransaction=ScheduleCreateTransaction,exports.ScheduleDeleteTransaction=ScheduleDeleteTransaction,exports.ScheduleId=ScheduleId,exports.ScheduleInfo=ScheduleInfo,exports.ScheduleInfoQuery=ScheduleInfoQuery,exports.ScheduleSignTransaction=ScheduleSignTransaction,exports.SemanticVersion=SemanticVersion,exports.ServiceEndpoint=ServiceEndpoint,exports.SignatureMap=SignatureMap$1,exports.Signer=Signer,exports.SignerSignature=SignerSignature,exports.Status=Status,exports.StatusError=StatusError,exports.SubscriptionHandle=SubscriptionHandle,exports.SystemDeleteTransaction=SystemDeleteTransaction,exports.SystemUndeleteTransaction=SystemUndeleteTransaction,exports.Timestamp=Timestamp,exports.TokenAirdropTransaction=TokenAirdropTransaction,exports.TokenAllowance=TokenAllowance,exports.TokenAssociateTransaction=TokenAssociateTransaction,exports.TokenBurnTransaction=TokenBurnTransaction,exports.TokenCancelAirdropTransaction=TokenCancelAirdropTransaction,exports.TokenClaimAirdropTransaction=TokenClaimAirdropTransaction,exports.TokenCreateTransaction=TokenCreateTransaction,exports.TokenDeleteTransaction=TokenDeleteTransaction,exports.TokenDissociateTransaction=TokenDissociateTransaction,exports.TokenFeeScheduleUpdateTransaction=TokenFeeScheduleUpdateTransaction,exports.TokenFreezeTransaction=TokenFreezeTransaction,exports.TokenGrantKycTransaction=TokenGrantKycTransaction,exports.TokenId=TokenId,exports.TokenInfo=TokenInfo,exports.TokenInfoQuery=TokenInfoQuery,exports.TokenKeyValidation=TokenKeyValidation,exports.TokenMintTransaction=TokenMintTransaction,exports.TokenNftAllowance=TokenNftAllowance,exports.TokenNftInfo=TokenNftInfo,exports.TokenNftInfoQuery=TokenNftInfoQuery,exports.TokenPauseTransaction=TokenPauseTransaction,exports.TokenRejectFlow=TokenRejectFlow,exports.TokenRejectTransaction=TokenRejectTransaction,exports.TokenRevokeKycTransaction=TokenRevokeKycTransaction,exports.TokenSupplyType=TokenSupplyType,exports.TokenType=TokenType,exports.TokenUnfreezeTransaction=TokenUnfreezeTransaction,exports.TokenUnpauseTransaction=TokenUnpauseTransaction,exports.TokenUpdateNftsTransaction=TokenUpdateNftsTransaction,exports.TokenUpdateTransaction=TokenUpdateTransaction,exports.TokenWipeTransaction=TokenWipeTransaction,exports.TopicCreateTransaction=TopicCreateTransaction,exports.TopicDeleteTransaction=TopicDeleteTransaction,exports.TopicId=TopicId,exports.TopicInfo=TopicInfo,exports.TopicInfoQuery=TopicInfoQuery,exports.TopicMessage=TopicMessage,exports.TopicMessageChunk=TopicMessageChunk,exports.TopicMessageQuery=TopicMessageQuery,exports.TopicMessageSubmitTransaction=TopicMessageSubmitTransaction,exports.TopicUpdateTransaction=TopicUpdateTransaction,exports.Transaction=Transaction,exports.TransactionFeeSchedule=TransactionFeeSchedule,exports.TransactionId=TransactionId,exports.TransactionReceipt=TransactionReceipt,exports.TransactionReceiptQuery=TransactionReceiptQuery,exports.TransactionRecord=TransactionRecord,exports.TransactionRecordQuery=TransactionRecordQuery,exports.TransactionResponse=TransactionResponse,exports.Transfer=Transfer,exports.TransferTransaction=TransferTransaction,exports.Wallet=Wallet,exports.WebClient=WebClient});
|
|
123
|
+
*/function requireSha3(){return hasRequiredSha3||(hasRequiredSha3=1,function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=commonjsGlobal:o&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),c=[4,1024,262144,67108864],u=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],p=[128,256],h=["hex","buffer","arrayBuffer","array","digest"],f={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var y=function(e,t,n){return function(r){return new P(e,t,e).update(r)[n]()}},m=function(e,t,n){return function(r,o){return new P(e,t,o).update(r)[n]()}},g=function(e,t,n){return function(t,r,o,i){return k["cshake"+e].update(t,r,o,i)[n]()}},_=function(e,t,n){return function(t,r,o,i){return k["kmac"+e].update(t,r,o,i)[n]()}},b=function(e,t,n,r){for(var o=0;o<h.length;++o){var i=h[o];e[i]=t(n,r,i)}return e},I=function(e,t){var n=y(e,t,"hex");return n.create=function(){return new P(e,t,e)},n.update=function(e){return n.create().update(e)},b(n,y,e,t)},T=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:I},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:I},{name:"shake",padding:[31,7936,2031616,520093696],bits:p,createMethod:function(e,t){var n=m(e,t,"hex");return n.create=function(n){return new P(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},b(n,m,e,t)}},{name:"cshake",padding:c,bits:p,createMethod:function(e,t){var n=f[e],r=g(e,0,"hex");return r.create=function(r,o,i){return o||i?new P(e,t,r).bytepad([o,i],n):k["shake"+e].create(r)},r.update=function(e,t,n,o){return r.create(t,n,o).update(e)},b(r,g,e,t)}},{name:"kmac",padding:c,bits:p,createMethod:function(e,t){var n=f[e],r=_(e,0,"hex");return r.create=function(r,o,i){return new R(e,t,o).bytepad(["KMAC",i],n).bytepad([r],n)},r.update=function(e,t,n,o){return r.create(e,n,o).update(t)},b(r,_,e,t)}}],k={},S=[],w=0;w<T.length;++w)for(var A=T[w],v=A.bits,E=0;E<v.length;++E){var O=A.name+"_"+v[E];if(S.push(O),k[O]=A.createMethod(v[E],A.padding),"sha3"!==A.name){var N=A.name+v[E];S.push(N),k[N]=k[O]}}function P(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function R(e,t,n){P.call(this,e,t,n)}P.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var o,i,s=this.blocks,c=this.byteCount,l=e.length,d=this.blockCount,p=0,h=this.s;p<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,o=1;o<d+1;++o)s[o]=0;if(n)for(o=this.start;p<l&&o<c;++p)s[o>>2]|=e[p]<<u[3&o++];else for(o=this.start;p<l&&o<c;++p)(i=e.charCodeAt(p))<128?s[o>>2]|=i<<u[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<u[3&o++],s[o>>2]|=(128|63&i)<<u[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<u[3&o++],s[o>>2]|=(128|i>>6&63)<<u[3&o++],s[o>>2]|=(128|63&i)<<u[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++p)),s[o>>2]|=(240|i>>18)<<u[3&o++],s[o>>2]|=(128|i>>12&63)<<u[3&o++],s[o>>2]|=(128|i>>6&63)<<u[3&o++],s[o>>2]|=(128|63&i)<<u[3&o++]);if(this.lastByteIndex=o,o>=c){for(this.start=o-c,this.block=s[d],o=0;o<d;++o)h[o]^=s[o];C(h),this.reset=!0}else this.start=o}return this},P.prototype.encode=function(e,t){var n=255&e,r=1,o=[n];for(n=255&(e>>=8);n>0;)o.unshift(n),n=255&(e>>=8),++r;return t?o.push(r):o.unshift(r),this.update(o),o.length},P.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var o=0,i=e.length;if(n)o=i;else for(var s=0;s<e.length;++s){var c=e.charCodeAt(s);c<128?o+=1:c<2048?o+=2:c<55296||c>=57344?o+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++s)),o+=4)}return o+=this.encode(8*o),this.update(e),o},P.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var o=t-n%t,i=[];return i.length=o,this.update(i),this},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];C(r)}},P.prototype.toString=P.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,o=this.extraBytes,i=0,a=0,c="";a<r;){for(i=0;i<t&&a<r;++i,++a)e=n[i],c+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t===0&&(C(n),i=0)}return o&&(e=n[i],c+=s[e>>4&15]+s[15&e],o>1&&(c+=s[e>>12&15]+s[e>>8&15]),o>2&&(c+=s[e>>20&15]+s[e>>16&15])),c},P.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,o=this.extraBytes,i=0,a=0,s=this.outputBits>>3;e=o?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);a<r;){for(i=0;i<t&&a<r;++i,++a)c[a]=n[i];a%t===0&&C(n)}return o&&(c[i]=n[i],e=e.slice(0,s)),e},P.prototype.buffer=P.prototype.arrayBuffer,P.prototype.digest=P.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,o=this.outputBlocks,i=this.extraBytes,a=0,s=0,c=[];s<o;){for(a=0;a<n&&s<o;++a,++s)e=s<<2,t=r[a],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%n===0&&C(r)}return i&&(e=s<<2,t=r[a],c[e]=255&t,i>1&&(c[e+1]=t>>8&255),i>2&&(c[e+2]=t>>16&255)),c},R.prototype=new P,R.prototype.finalize=function(){return this.encode(this.outputBits,!0),P.prototype.finalize.call(this)};var C=function(e){var t,n,r,o,i,a,s,c,u,d,p,h,f,y,m,g,_,b,I,T,k,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,K,M,H,j,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ie,ae,se,ce,ue,le;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],p=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=i^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(d<<1|p>>>31),n=s^(p<<1|d>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(h<<1|f>>>31),n=u^(f<<1|h>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=d^(o<<1|i>>>31),n=p^(i<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,y=e[0],m=e[1],z=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,N=e[20]<<3|e[21]>>>29,P=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,G=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,L=e[2]<<1|e[3]>>>31,x=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,_=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,Q=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,C=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,F=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,I=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,D=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,v=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,K=e[26]<<25|e[27]>>>7,M=e[27]<<25|e[26]>>>7,T=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,J=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,$=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,O=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,j=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,w=e[49]<<14|e[48]>>>18,e[0]=y^~g&b,e[1]=m^~_&I,e[10]=A^~E&N,e[11]=v^~O&P,e[20]=L^~F&K,e[21]=x^~U&M,e[30]=V^~z&Y,e[31]=$^~W&Q,e[40]=te^~re&ie,e[41]=ne^~oe&ae,e[2]=g^~b&T,e[3]=_^~I&k,e[12]=E^~N&R,e[13]=O^~P&C,e[22]=F^~K&H,e[23]=U^~M&j,e[32]=z^~Y&X,e[33]=W^~Q&Z,e[42]=re^~ie&se,e[43]=oe^~ae&ce,e[4]=b^~T&S,e[5]=I^~k&w,e[14]=N^~R&D,e[15]=P^~C&B,e[24]=K^~H&G,e[25]=M^~j&q,e[34]=Y^~X&J,e[35]=Q^~Z&ee,e[44]=ie^~se&ue,e[45]=ae^~ce&le,e[6]=T^~S&y,e[7]=k^~w&m,e[16]=R^~D&A,e[17]=C^~B&v,e[26]=H^~G&L,e[27]=j^~q&x,e[36]=X^~J&V,e[37]=Z^~ee&$,e[46]=se^~ue&te,e[47]=ce^~le&ne,e[8]=S^~y&g,e[9]=w^~m&_,e[18]=D^~A&E,e[19]=B^~v&O,e[28]=G^~L&F,e[29]=q^~x&U,e[38]=J^~V&z,e[39]=ee^~$&W,e[48]=ue^~te&re,e[49]=le^~ne&oe,e[0]^=l[r],e[1]^=l[r+1]};if(i)e.exports=k;else for(w=0;w<S.length;++w)r[S[w]]=k[S[w]]}()}(sha3$1)),sha3$1.exports}var sha3Exports=requireSha3(),sha3=getDefaultExportFromCjs(sha3Exports);function keccak256$1(e){return"0x"+sha3.keccak_256(arrayify(e))}const version$2="rlp/5.8.0",logger$4=new Logger$1(version$2);function arrayifyInteger(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function unarrayifyInteger(e,t,n){let r=0;for(let o=0;o<n;o++)r=256*r+e[t+o];return r}function _encode(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(_encode(e))}),t.length<=55)return t.unshift(192+t.length),t;const n=arrayifyInteger(t.length);return n.unshift(247+n.length),n.concat(t)}isBytesLike(e)||logger$4.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(arrayify(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=arrayifyInteger(t.length);return n.unshift(183+n.length),n.concat(t)}function encode(e){return hexlify(_encode(e))}function _decodeChildren(e,t,n,r){const o=[];for(;n<t+1+r;){const i=_decode(e,n);o.push(i.result),(n+=i.consumed)>t+1+r&&logger$4.throwError("child data too short",Logger$1.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:o}}function _decode(e,t){if(0===e.length&&logger$4.throwError("data too short",Logger$1.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&logger$4.throwError("data short segment too short",Logger$1.errors.BUFFER_OVERRUN,{});const r=unarrayifyInteger(e,t+1,n);return t+1+n+r>e.length&&logger$4.throwError("data long segment too short",Logger$1.errors.BUFFER_OVERRUN,{}),_decodeChildren(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&logger$4.throwError("data array too short",Logger$1.errors.BUFFER_OVERRUN,{}),_decodeChildren(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&logger$4.throwError("data array too short",Logger$1.errors.BUFFER_OVERRUN,{});const r=unarrayifyInteger(e,t+1,n);t+1+n+r>e.length&&logger$4.throwError("data array too short",Logger$1.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:hexlify(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&logger$4.throwError("data too short",Logger$1.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:hexlify(e.slice(t+1,t+1+n))}}return{consumed:1,result:hexlify(e[t])}}function decode(e){const t=arrayify(e),n=_decode(t,0);return n.consumed!==t.length&&logger$4.throwArgumentError("invalid rlp data","data",e),n.result}const version$1="address/5.8.0",logger$3=new Logger$1(version$1);function getChecksumAddress(e){isHexString(e,20)||logger$3.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=arrayify(keccak256$1(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const MAX_SAFE_INTEGER=9007199254740991;function log10(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const ibanLookup={};for(let e=0;e<10;e++)ibanLookup[String(e)]=String(e);for(let e=0;e<26;e++)ibanLookup[String.fromCharCode(65+e)]=String(10+e);const safeDigits=Math.floor(log10(MAX_SAFE_INTEGER));function ibanChecksum(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>ibanLookup[e]).join("");for(;t.length>=safeDigits;){let e=t.substring(0,safeDigits);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}function getAddress(e){let t=null;if("string"!=typeof e&&logger$3.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=getChecksumAddress(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&logger$3.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==ibanChecksum(e)&&logger$3.throwArgumentError("bad icap checksum","address",e),t=_base36To16(e.substring(4));t.length<40;)t="0"+t;t=getChecksumAddress("0x"+t)}else logger$3.throwArgumentError("invalid address","address",e);return t}class AddressCoder extends Coder{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=getAddress(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return getAddress(hexZeroPad(e.readValue().toHexString(),20))}}class AnonymousCoder extends Coder{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const logger$2=new Logger$1(version$3);function pack(e,t,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map(t=>{const r=t.localName;return r||logger$2.throwError("cannot encode object for signature with missing names",Logger$1.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]&&logger$2.throwError("cannot encode object for signature with duplicate names",Logger$1.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]=!0,n[r]})}else logger$2.throwArgumentError("invalid tuple value","tuple",n);t.length!==r.length&&logger$2.throwArgumentError("types/value length mismatch","tuple",n);let o=new Writer(e.wordSize),i=new Writer(e.wordSize),a=[];t.forEach((e,t)=>{let n=r[t];if(e.dynamic){let t=i.length;e.encode(i,n);let r=o.writeUpdatableValue();a.push(e=>{r(e+t)})}else e.encode(o,n)}),a.forEach(e=>{e(o.length)});let s=e.appendWriter(o);return s+=e.appendWriter(i),s}function unpack(e,t){let n=[],r=e.subReader(0);t.forEach(t=>{let o=null;if(t.dynamic){let n=e.readValue(),i=r.subReader(n.toNumber());try{o=t.decode(i)}catch(e){if(e.code===Logger$1.errors.BUFFER_OVERRUN)throw e;o=e,o.baseType=t.name,o.name=t.localName,o.type=t.type}}else try{o=t.decode(e)}catch(e){if(e.code===Logger$1.errors.BUFFER_OVERRUN)throw e;o=e,o.baseType=t.name,o.name=t.localName,o.type=t.type}null!=o&&n.push(o)});const o=t.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});t.forEach((e,t)=>{let r=e.localName;if(!r||1!==o[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const i=n[t];i instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw i}}):n[r]=i});for(let e=0;e<n.length;e++){const t=n[e];t instanceof Error&&Object.defineProperty(n,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(n)}class ArrayCoder extends Coder{constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let n=this.length;-1===n&&(n=t.length,e.writeValue(t.length)),logger$2.checkArgumentCount(t.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let e=0;e<t.length;e++)r.push(this.coder);return pack(e,r,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&logger$2.throwError("insufficient data length",Logger$1.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let n=[];for(let e=0;e<t;e++)n.push(new AnonymousCoder(this.coder));return e.coerce(this.name,unpack(e,n))}}class BooleanCoder extends Coder{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class DynamicBytesCoder extends Coder{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=arrayify(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class BytesCoder extends DynamicBytesCoder{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,hexlify(super.decode(e)))}}class FixedBytesCoder extends Coder{constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=arrayify(t);return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return e.coerce(this.name,hexlify(e.readBytes(this.size)))}}class NullCoder extends Coder{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const NegativeOne=BigNumber.from(-1),Zero=BigNumber.from(0),One=BigNumber.from(1),MaxUint256=BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class NumberCoder extends Coder{constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let n=BigNumber.from(t),r=MaxUint256.mask(8*e.wordSize);if(this.signed){let e=r.mask(8*this.size-1);(n.gt(e)||n.lt(e.add(One).mul(NegativeOne)))&&this._throwError("value out-of-bounds",t)}else(n.lt(Zero)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(n)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}const version="strings/5.8.0",logger$1=new Logger$1(version);var UnicodeNormalizationForm,Utf8ErrorReason;function errorFunc(e,t,n,r,o){return logger$1.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)}function ignoreFunc(e,t,n,r,o){if(e===Utf8ErrorReason.BAD_PREFIX||e===Utf8ErrorReason.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===Utf8ErrorReason.OVERRUN?n.length-t-1:0}function replaceFunc(e,t,n,r,o){return e===Utf8ErrorReason.OVERLONG?(r.push(o),0):(r.push(65533),ignoreFunc(e,t,n))}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(UnicodeNormalizationForm||(UnicodeNormalizationForm={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(Utf8ErrorReason||(Utf8ErrorReason={}));const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(e,t){null==t&&(t=Utf8ErrorFuncs.error),e=arrayify(e);const n=[];let r=0;for(;r<e.length;){const o=e[r++];if(!(o>>7)){n.push(o);continue}let i=null,a=null;if(192==(224&o))i=1,a=127;else if(224==(240&o))i=2,a=2047;else{if(240!=(248&o)){r+=t(128==(192&o)?Utf8ErrorReason.UNEXPECTED_CONTINUE:Utf8ErrorReason.BAD_PREFIX,r-1,e,n);continue}i=3,a=65535}if(r-1+i>=e.length){r+=t(Utf8ErrorReason.OVERRUN,r-1,e,n);continue}let s=o&(1<<8-i-1)-1;for(let o=0;o<i;o++){let o=e[r];if(128!=(192&o)){r+=t(Utf8ErrorReason.MISSING_CONTINUE,r,e,n),s=null;break}s=s<<6|63&o,r++}null!==s&&(s>1114111?r+=t(Utf8ErrorReason.OUT_OF_RANGE,r-1-i,e,n,s):s>=55296&&s<=57343?r+=t(Utf8ErrorReason.UTF16_SURROGATE,r-1-i,e,n,s):s<=a?r+=t(Utf8ErrorReason.OVERLONG,r-1-i,e,n,s):n.push(s))}return n}function toUtf8Bytes(e,t=UnicodeNormalizationForm.current){t!=UnicodeNormalizationForm.current&&(logger$1.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const o=e.charCodeAt(t);if(t>=e.length||56320!=(64512&o))throw new Error("invalid utf-8 string");const i=65536+((1023&r)<<10)+(1023&o);n.push(i>>18|240),n.push(i>>12&63|128),n.push(i>>6&63|128),n.push(63&i|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return arrayify(n)}function _toUtf8String(e){return e.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))).join("")}function toUtf8String(e,t){return _toUtf8String(getUtf8CodePoints(e,t))}class StringCoder extends DynamicBytesCoder{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,toUtf8Bytes(t))}decode(e){return toUtf8String(super.decode(e))}}class TupleCoder extends Coder{constructor(e,t){let n=!1;const r=[];e.forEach(e=>{e.dynamic&&(n=!0),r.push(e.type)});super("tuple","tuple("+r.join(",")+")",t,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});const t=this.coders.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});return this.coders.forEach((n,r)=>{let o=n.localName;o&&1===t[o]&&("length"===o&&(o="_length"),null==e[o]&&(e[o]=e[r]))}),Object.freeze(e)}encode(e,t){return pack(e,this.coders,t)}decode(e){return e.coerce(this.name,unpack(e,this.coders))}}const logger=new Logger$1(version$3),paramTypeBytes=new RegExp(/^bytes([0-9]*)$/),paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);class AbiCoder{constructor(e){defineReadOnly(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new AddressCoder(e.name);case"bool":return new BooleanCoder(e.name);case"string":return new StringCoder(e.name);case"bytes":return new BytesCoder(e.name);case"array":return new ArrayCoder(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new TupleCoder((e.components||[]).map(e=>this._getCoder(e)),e.name);case"":return new NullCoder(e.name)}let t=e.type.match(paramTypeNumber);if(t){let n=parseInt(t[2]||"256");return(0===n||n>256||n%8!=0)&&logger.throwArgumentError("invalid "+t[1]+" bit length","param",e),new NumberCoder(n/8,"int"===t[1],e.name)}if(t=e.type.match(paramTypeBytes),t){let n=parseInt(t[1]);return(0===n||n>32)&&logger.throwArgumentError("invalid bytes length","param",e),new FixedBytesCoder(n,e.name)}return logger.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new Reader(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new Writer(this._getWordSize())}getDefaultValue(e){const t=e.map(e=>this._getCoder(ParamType.from(e)));return new TupleCoder(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&logger.throwError("types/values length mismatch",Logger$1.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const n=e.map(e=>this._getCoder(ParamType.from(e))),r=new TupleCoder(n,"_"),o=this._getWriter();return r.encode(o,t),o.data}decode(e,t,n){const r=e.map(e=>this._getCoder(ParamType.from(e)));return new TupleCoder(r,"_").decode(this._getReader(arrayify(t),n))}}const defaultAbiCoder=new AbiCoder,{proto:proto$6}=HieroProto;class ContractNonceInfo{constructor(e){this.contractId=e.contractId,this.nonce=e.nonce,Object.freeze(this)}static _fromProtobuf(e){return new ContractNonceInfo({contractId:ContractId._fromProtobuf(e.contractId),nonce:null!=e.nonce?e.nonce:Long.ZERO})}_toProtobuf(){return{contractId:this.contractId._toProtobuf(),nonce:this.nonce}}static fromBytes(e){return ContractNonceInfo._fromProtobuf(proto$6.ContractNonceInfo.decode(e))}toBytes(){return proto$6.ContractNonceInfo.encode(this._toProtobuf()).finish()}toJSON(){return{contractId:this.contractId.toString(),nonce:this.nonce.toNumber()}}toString(){return JSON.stringify(this.toJSON())}equals(e){return this.contractId.equals(e.contractId)&&this.nonce.eq(e.nonce)}}class ContractFunctionResult{constructor(e){this._createResult=e._createResult,this.contractId=e.contractId,this.bytes=e.bytes,this.errorMessage=e.errorMessage,this.bloom=e.bloom,this.gasUsed=e.gasUsed,this.logs=e.logs,this.createdContractIds=e.createdContractIds,this.evmAddress=e.evmAddress,this.stateChanges=e.stateChanges,this.gas=e.gas,this.amount=e.amount,this.functionParameters=e.functionParameters,this.senderAccountId=e.senderAccountId,this.contractNonces=e.contractNonces,this.signerNonce=e.signerNonce}static _fromProtobuf(e,t){const n=e.contractID,r=e.gasUsed,o=e.gas?e.gas:-1,i=e.amount?e.amount:-1;return new ContractFunctionResult({_createResult:t,bytes:e.contractCallResult,contractId:null!=n?ContractId._fromProtobuf(n):null,errorMessage:null!=e.errorMessage?e.errorMessage:null,bloom:e.bloom,gasUsed:r instanceof Long?r:Long.fromValue(r),logs:(null!=e.logInfo?e.logInfo:[]).map(e=>ContractLogInfo._fromProtobuf(e)),createdContractIds:(null!=e.createdContractIDs?e.createdContractIDs:[]).map(e=>ContractId._fromProtobuf(e)),evmAddress:null!=e.evmAddress&&Object.hasOwn(e.evmAddress,"value")&&null!=e.evmAddress.value?e.evmAddress.value:null,stateChanges:[],gas:o instanceof Long?o:Long.fromValue(o),amount:i instanceof Long?i:Long.fromValue(i),functionParameters:e.functionParameters,senderAccountId:null!=e.senderId?AccountId._fromProtobuf(e.senderId):null,contractNonces:(null!=e.contractNonces?e.contractNonces:[]).map(e=>ContractNonceInfo._fromProtobuf(e)),signerNonce:null!=e.signerNonce&&Object.hasOwn(e.signerNonce,"value")&&e.signerNonce.value||null})}asBytes(){return this.bytes}getString(e){return decode$1(this.getBytes(e))}getBytes(e){const t=this.getInt32(e),n=safeView(this.bytes).getInt32(t+28);return this.bytes.subarray(t+32,t+32+n)}getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}getBool(e){return 0!==this.bytes[32*(null!=e?e:0)+31]}getInt8(e){const t=32*(null!=e?e:0)+31;return safeView(this.bytes).getInt8(t)}getUint8(e){return this.bytes[32*(null!=e?e:0)+31]}getInt16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt40(e){const t=defaultAbiCoder.decode(["int40"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint40(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(27,32)),16)}getInt48(e){const t=defaultAbiCoder.decode(["int48"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint48(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(26,32)),16)}getInt56(e){const t=defaultAbiCoder.decode(["int56"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint56(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(25,32)),16)}getInt64(e){const t=defaultAbiCoder.decode(["int64"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint64(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(24,32)),16)}getInt72(e){const t=defaultAbiCoder.decode(["int72"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint72(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(23,32)),16)}getInt80(e){const t=defaultAbiCoder.decode(["int80"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint80(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(22,32)),16)}getInt88(e){const t=defaultAbiCoder.decode(["int88"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint88(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(21,32)),16)}getInt96(e){const t=defaultAbiCoder.decode(["int96"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint96(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(20,32)),16)}getInt104(e){const t=defaultAbiCoder.decode(["int104"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint104(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(19,32)),16)}getInt112(e){const t=defaultAbiCoder.decode(["int112"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint112(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(18,32)),16)}getInt120(e){const t=defaultAbiCoder.decode(["int120"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint120(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(17,32)),16)}getInt128(e){const t=defaultAbiCoder.decode(["int128"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint128(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(16,32)),16)}getInt136(e){const t=defaultAbiCoder.decode(["int136"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint136(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(15,32)),16)}getInt144(e){const t=defaultAbiCoder.decode(["int144"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint144(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(14,32)),16)}getInt152(e){const t=defaultAbiCoder.decode(["int152"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint152(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(13,32)),16)}getInt160(e){const t=defaultAbiCoder.decode(["int160"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint160(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(12,32)),16)}getInt168(e){const t=defaultAbiCoder.decode(["int168"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint168(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(11,32)),16)}getInt176(e){const t=defaultAbiCoder.decode(["int176"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint176(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(10,32)),16)}getInt184(e){const t=defaultAbiCoder.decode(["int184"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint184(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(9,32)),16)}getInt192(e){const t=defaultAbiCoder.decode(["int192"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint192(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(8,32)),16)}getInt200(e){const t=defaultAbiCoder.decode(["int200"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint200(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(7,32)),16)}getInt208(e){const t=defaultAbiCoder.decode(["int208"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint208(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(6,32)),16)}getInt216(e){const t=defaultAbiCoder.decode(["int216"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint216(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(5,32)),16)}getInt224(e){const t=defaultAbiCoder.decode(["int224"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint224(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(4,32)),16)}getInt232(e){const t=defaultAbiCoder.decode(["int232"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint232(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(3,32)),16)}getInt240(e){const t=defaultAbiCoder.decode(["int240"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint240(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(2,32)),16)}getInt248(e){const t=defaultAbiCoder.decode(["int248"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint248(e){return new BigNumber$1(encode$5(this._getBytes32(e).subarray(1,32)),16)}getInt256(e){const t=defaultAbiCoder.decode(["int256"],this._getBytes32(null!=e?e:0));return new BigNumber$1(t.toString())}getUint256(e){return new BigNumber$1(encode$5(this._getBytes32(e)),16)}getAddress(e){return encode$5(this.bytes.subarray(32*(null!=e?e:0)+12,32*(null!=e?e:0)+32))}getResult(e){return defaultAbiCoder.decode(e,this.bytes)}_getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}_toProtobuf(){return{contractID:null!=this.contractId?this.contractId._toProtobuf():null,contractCallResult:this.bytes,errorMessage:this.errorMessage,bloom:this.bloom,gasUsed:this.gasUsed,logInfo:this.logs.map(e=>e._toProtobuf()),createdContractIDs:this.createdContractIds.map(e=>e._toProtobuf()),evmAddress:null!=this.evmAddress?{value:this.evmAddress}:null,gas:this.gas,amount:this.amount,functionParameters:this.functionParameters,senderId:null!=this.senderAccountId?this.senderAccountId._toProtobuf():null,contractNonces:this.contractNonces.map(e=>e._toProtobuf()),signerNonce:null!=this.signerNonce?{value:this.signerNonce}:null}}}class TokenTransferAccountMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.toString()}),e}}class TokenTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t,n){const r=e.toString();let o=this._map.get(r);null==o&&(o=new TokenTransferAccountMap,this._map.set(r,o),this.__map.set(e,o)),o._set(t,convertAmountToLong(n))}static _fromProtobuf(e){const t=new TokenTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.transfers?n.transfers:[]){const n=AccountId._fromProtobuf(r.accountID);t.__set(e,n,r.amount)}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const[e,t]of n)r.push({accountID:e._toProtobuf(),amount:t});e.push({token:t._toProtobuf(),transfers:r})}return e}}class TokenNftTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t){const n=e.toString();let r=this._map.get(n);null==r&&(r=[],this._map.set(n,r),this.__map.set(e,r)),r.push(t)}static _fromProtobuf(e){const t=new TokenNftTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[]){const n=AccountId._fromProtobuf(r.senderAccountID),o=AccountId._fromProtobuf(r.receiverAccountID);t.__set(e,{sender:n,recipient:o,serial:Long.fromValue(r.serialNumber),isApproved:!1})}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const e of n)r.push({senderAccountID:e.sender._toProtobuf(),receiverAccountID:e.recipient._toProtobuf(),serialNumber:e.serial});e.push({token:t._toProtobuf(),nftTransfers:r})}return e}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.map(e=>({sender:e.sender.toString(),recipient:e.recipient.toString(),serial:e.serial,isApproved:e.isApproved}))}),e}}class AssessedCustomFee{constructor(e={}){this._feeCollectorAccountId=null,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount),this._payerAccountIds=null,null!=e.payerAccountIds&&this.setPayerAccountIds(e.payerAccountIds)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}get payerAccountIds(){return this._payerAccountIds}setPayerAccountIds(e){return this._payerAccountIds=e,this}static _fromProtobuf(e){return new AssessedCustomFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0,amount:null!=e.amount?e.amount:void 0,payerAccountIds:null!=e.effectivePayerAccountId?e.effectivePayerAccountId.map(e=>AccountId._fromProtobuf(e)):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,amount:this._amount,effectivePayerAccountId:null!=this._payerAccountIds?this._payerAccountIds.map(e=>e._toProtobuf()):null}}toJSON(){return{feeCollectorAccountId:this.feeCollectorAccountId?.toString()||null,tokenId:this._tokenId?.toString()||null,amount:this._amount?.toString()||null,payerAccountIds:this._payerAccountIds?.map(e=>e.toString())||[]}}}class TokenAssociation{constructor(e={}){this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._defaultMaxTransactionFee=new Hbar(5)}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}static _fromProtobuf(e){return new TokenAssociation({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0})}_toProtobuf(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():void 0,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():void 0}}toJSON(){return{accountId:this._accountId?.toString()||null,tokenId:this._tokenId?.toString()||null}}}class TokenTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.expectedDecimals=e.expectedDecimals,this.amount=convertAmountToLong(e.amount),this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token),r=null!=n.expectedDecimals&&Object.hasOwn(n.expectedDecimals,"value")?n.expectedDecimals.value:null;for(const o of null!=n.transfers?n.transfers:[])t.push(new TokenTransfer({tokenId:e,accountId:AccountId._fromProtobuf(o.accountID),expectedDecimals:r||null,amount:null!=o.amount?o.amount:Long.ZERO,isApproved:1==o.isApproval}))}return t}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount,isApproval:this.isApproved}}toJSON(){return{tokenId:this.tokenId.toString(),accountId:this.accountId.toString(),expectedDecimals:this.expectedDecimals,amount:this.amount.toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class NftId{constructor(e,t){this.tokenId=e,this.serial="number"==typeof t?Long.fromNumber(t):t,Object.freeze(this)}static fromString(e){const t=e.split("/").length>1?e.split("/"):e.split("@");for(const e of t)if(""===e)throw new Error("invalid format for NftId: use [token]/[serial] or [token]@[serial]");const n=TokenId.fromString(t[0]),r=Long.fromString(t[1]);return new NftId(n,r)}static _fromProtobuf(e){return new NftId(TokenId._fromProtobuf(e.token_ID),null!=e.serialNumber?e.serialNumber:Long.ZERO)}static fromBytes(e){return NftId._fromProtobuf(libExports.proto.NftID.decode(e))}_toProtobuf(){return{token_ID:this.tokenId._toProtobuf(),serialNumber:Long.fromValue(void 0!==this.serial?this.serial:0)}}toString(){return`${this.tokenId.toString()}/${this.serial.toString()}`}toBytes(){return libExports.proto.NftID.encode(this._toProtobuf()).finish()}}class PendingAirdropId{constructor(e={}){this._senderId=null,this._receiverId=null,this._tokenId=null,this._nftId=null,e.receiverId&&(this._receiverId=e.receiverId),e.senderId&&(this._senderId=e.senderId),e.tokenId?this._tokenId=new TokenId(e.tokenId):e.nftId&&(this._nftId=new NftId(e.nftId?.tokenId,e.nftId?.serial))}static fromBytes(e){if(null==e.senderId)throw new Error("senderId is required");if(null==e.receiverId)throw new Error("receiverId is required");if(null==e.fungibleTokenType&&null==e.nonFungibleToken)throw new Error("Either fungibleTokenType or nonFungibleToken is required");return new PendingAirdropId({senderId:AccountId._fromProtobuf(e.senderId),receiverId:AccountId._fromProtobuf(e.receiverId),nftId:null!=e.nonFungibleToken?NftId._fromProtobuf(e.nonFungibleToken):null,tokenId:null!=e.fungibleTokenType?TokenId._fromProtobuf(e.fungibleTokenType):null})}setSenderid(e){return this._senderId=e,this}setReceiverId(e){return this._receiverId=e,this}setTokenId(e){return this._nftId=null,this._tokenId=e,this}setNftId(e){return this._tokenId=null,this._nftId=e,this}get senderId(){return this._senderId}get receiverId(){return this._receiverId}get tokenId(){return this._tokenId}get nftId(){return this._nftId}toBytes(){return{senderId:this.senderId?._toProtobuf(),receiverId:this._receiverId?._toProtobuf(),fungibleTokenType:this._tokenId?._toProtobuf(),nonFungibleToken:this._nftId?._toProtobuf()}}}class PendingAirdropRecord{constructor(e){this.airdropId=e.airdropId,this.amount=convertAmountToLong(e.amount)}toBytes(){return{pendingAirdropId:this.airdropId.toBytes(),pendingAirdropValue:{amount:this.amount}}}static fromBytes(e){if(null==e.pendingAirdropId)throw new Error("pendingAirdropId is required");const t=PendingAirdropId.fromBytes(e.pendingAirdropId),n=e.pendingAirdropValue?.amount;return new PendingAirdropRecord({airdropId:t,amount:n||Long.ZERO})}}class TransactionRecord{constructor(e){this.receipt=e.receipt,this.transactionHash=e.transactionHash,this.consensusTimestamp=e.consensusTimestamp,this.transactionId=e.transactionId,this.transactionMemo=e.transactionMemo,this.transactionFee=e.transactionFee,this.transfers=e.transfers,this.contractFunctionResult=null!=e.contractFunctionResult?e.contractFunctionResult:null,this.tokenTransfers=e.tokenTransfers,this.tokenTransfersList=e.tokenTransfersList,this.scheduleRef=e.scheduleRef,this.assessedCustomFees=e.assessedCustomFees,this.nftTransfers=e.nftTransfers,this.automaticTokenAssociations=e.automaticTokenAssociations,this.parentConsensusTimestamp=e.parentConsensusTimestamp,this.aliasKey=e.aliasKey,this.duplicates=e.duplicates,this.children=e.children,this.hbarAllowanceAdjustments=e.hbarAllowanceAdjustments,this.tokenAllowanceAdjustments=e.tokenAllowanceAdjustments,this.nftAllowanceAdjustments=e.nftAllowanceAdjustments,this.ethereumHash=e.ethereumHash,this.paidStakingRewards=e.paidStakingRewards,this.prngBytes=e.prngBytes,this.prngNumber=e.prngNumber,this.evmAddress=e.evmAddress,this.newPendingAirdrops=e.newPendingAirdrops,Object.freeze(this)}_toProtobuf(){const e=this.tokenTransfers._toProtobuf(),t=this.nftTransfers._toProtobuf(),n=[];for(const r of e)for(const e of t)null!=r.token&&null!=e.token&&r.token.shardNum===e.token.shardNum&&r.token.realmNum===e.token.realmNum&&r.token.tokenNum===e.token.tokenNum?n.push({token:r.token,transfers:r.transfers,nftTransfers:r.nftTransfers}):(n.push(r),n.push(e));return{duplicateTransactionRecords:this.duplicates.map(e=>e._toProtobuf().transactionRecord),childTransactionRecords:this.children.map(e=>e._toProtobuf().transactionRecord),transactionRecord:{receipt:this.receipt._toProtobuf().receipt,transactionHash:null!=this.transactionHash?this.transactionHash:null,consensusTimestamp:null!=this.consensusTimestamp?this.consensusTimestamp._toProtobuf():null,transactionID:null!=this.transactionId?this.transactionId._toProtobuf():null,memo:null!=this.transactionMemo?this.transactionMemo:null,transactionFee:null!=this.transactionFee?this.transactionFee.toTinybars():null,contractCallResult:null==this.contractFunctionResult||this.contractFunctionResult._createResult?null:this.contractFunctionResult._toProtobuf(),contractCreateResult:null!=this.contractFunctionResult&&this.contractFunctionResult._createResult?this.contractFunctionResult._toProtobuf():null,transferList:null!=this.transfers?{accountAmounts:this.transfers.map(e=>e._toProtobuf())}:null,tokenTransferLists:n,scheduleRef:null!=this.scheduleRef?this.scheduleRef._toProtobuf():null,assessedCustomFees:this.assessedCustomFees.map(e=>e._toProtobuf()),automaticTokenAssociations:this.automaticTokenAssociations.map(e=>e._toProtobuf()),parentConsensusTimestamp:null!=this.parentConsensusTimestamp?this.parentConsensusTimestamp._toProtobuf():null,alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ethereumHash:this.ethereumHash,paidStakingRewards:this.paidStakingRewards.map(e=>e._toProtobuf()),prngBytes:this.prngBytes,prngNumber:null!=this.prngNumber?this.prngNumber:null,evmAddress:null!=this.evmAddress?this.evmAddress.toBytes():null,newPendingAirdrops:this.newPendingAirdrops.map(e=>e.toBytes())}}}static _fromProtobuf(e){const t=e.transactionRecord;let n=null!=t.alias&&t.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(t.alias)):null;n instanceof PublicKey||(n=null);const r=null!=e.childTransactionRecords?e.childTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],o=null!=e.duplicateTransactionRecords?e.duplicateTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],i=null!=t.contractCallResult?ContractFunctionResult._fromProtobuf(t.contractCallResult,!1):null!=t.contractCreateResult?ContractFunctionResult._fromProtobuf(t.contractCreateResult,!0):void 0,a=null!=t.newPendingAirdrops?t.newPendingAirdrops.map(e=>PendingAirdropRecord.fromBytes(e)):[];return new TransactionRecord({receipt:TransactionReceipt._fromProtobuf({receipt:t.receipt}),transactionHash:null!=t.transactionHash?t.transactionHash:new Uint8Array,consensusTimestamp:Timestamp._fromProtobuf(t.consensusTimestamp),transactionId:TransactionId._fromProtobuf(t.transactionID),transactionMemo:null!=t.memo?t.memo:"",transactionFee:Hbar.fromTinybars(null!=t.transactionFee?t.transactionFee:0),transfers:Transfer._fromProtobuf(null!=t.transferList&&null!=t.transferList.accountAmounts?t.transferList.accountAmounts:[]),contractFunctionResult:i,tokenTransfers:TokenTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),tokenTransfersList:TokenTransfer._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),scheduleRef:null!=t.scheduleRef?ScheduleId._fromProtobuf(t.scheduleRef):null,assessedCustomFees:null!=t.assessedCustomFees?t.assessedCustomFees.map(e=>AssessedCustomFee._fromProtobuf(e)):[],nftTransfers:TokenNftTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),automaticTokenAssociations:null!=t.automaticTokenAssociations?t.automaticTokenAssociations.map(e=>TokenAssociation._fromProtobuf(e)):[],parentConsensusTimestamp:null!=t.parentConsensusTimestamp?Timestamp._fromProtobuf(t.parentConsensusTimestamp):null,aliasKey:n,duplicates:o,children:r,hbarAllowanceAdjustments:[],tokenAllowanceAdjustments:[],nftAllowanceAdjustments:[],ethereumHash:null!=t.ethereumHash?t.ethereumHash:null,paidStakingRewards:null!=t.paidStakingRewards?Transfer._fromProtobuf(t.paidStakingRewards):[],prngBytes:null!=t.prngBytes?t.prngBytes:null,prngNumber:null!=t.prngNumber?t.prngNumber:null,evmAddress:null!=t.evmAddress?EvmAddress.fromBytes(t.evmAddress):null,newPendingAirdrops:a})}static fromBytes(e){return TransactionRecord._fromProtobuf(libExports.proto.TransactionGetRecordResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetRecordResponse.encode(this._toProtobuf()).finish()}toJSON(){return{receipt:this.receipt.toJSON(),transactionHash:encode$5(this.transactionHash),consensusTimestamp:this.consensusTimestamp.toDate(),transactionId:this.transactionId.toString(),transactionMemo:this.transactionMemo,transactionFee:this.transactionFee.toTinybars().toString(),transfers:this.transfers.map(e=>e.toJSON()),tokenTransfers:this.tokenTransfers,tokenTransfersList:this.tokenTransfersList.map(e=>e.toJSON()),scheduleRef:this.scheduleRef?.toString()||null,assessedCustomFees:this.assessedCustomFees,nftTransfers:this.nftTransfers,automaticTokenAssociations:this.automaticTokenAssociations,parentConsensusTimestamp:this.parentConsensusTimestamp?.toDate()||null,aliasKey:this.aliasKey?.toString()||null,duplicates:this.duplicates,children:this.children,ethereumHash:null!=this.ethereumHash?encode$5(this.ethereumHash):null,paidStakingRewards:this.paidStakingRewards,prngBytes:null!=this.prngBytes?encode$5(this.prngBytes):null,prngNumber:this.prngNumber,evmAddress:this.evmAddress?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}class RecordStatusError extends StatusError{constructor(e){super(e,`Record for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionRecord=e.transactionRecord}}const{proto:proto$5}=HieroProto;class TransactionRecordQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateReceiptStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateReceiptStatus&&this.setValidateReceiptStatus(e.validateReceiptStatus)}get transactionId(){return this._transactionId}static _fromProtobuf(e){const t=e.transactionGetRecord;return new TransactionRecordQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeChildren:null!=t.includeChildRecords?t.includeChildRecords:void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0})}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setIncludeDuplicates(e){return this._duplicates=e,this}get includeDuplicates(){return null!=this._duplicates&&this._duplicates}setValidateReceiptStatus(e){return this._validateReceiptStatus=e,this}get validateReceiptStatus(){return this._validateReceiptStatus}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$5.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetRecord;if(o.header.responseType===libExports.proto.ResponseType.COST_ANSWER)return[r,ExecutionState.Finished];const i=o.transactionRecord.receipt.status;switch(r=Status._fromCode(i),this._logger&&this._logger.debug(`[${this._getLogId()}] received record's receipt ${r.toString()}`),r){case Status.Ok:case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:return[r,ExecutionState.Retry];case Status.Success:return[r,ExecutionState.Finished];default:return[r,this._validateReceiptStatus?ExecutionState.Error:ExecutionState.Finished]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$5.ResponseCodeEnum.OK);switch(o){case Status.Ok:break;case Status.ContractRevertExecuted:return new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})});default:return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}const i=t.transactionGetRecord.transactionRecord.receipt,a=i.status;return o=Status._fromCode(a),o===Status.ContractRevertExecuted?new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})}):new ReceiptStatusError({status:o,transactionId:this._getTransactionId(),transactionReceipt:TransactionReceipt._fromProtobuf({receipt:i})})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTxRecordByTxID(t)}_mapResponseHeader(e){return e.transactionGetRecord.header}_mapResponse(e,t,n){const r=e.transactionGetRecord;return Promise.resolve(TransactionRecord._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetRecord:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeChildRecords:this._includeChildren,includeDuplicates:this._includeDuplicates}}}_getLogId(){return`TransactionRecordQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("transactionGetRecord",TransactionRecordQuery._fromProtobuf);class TransactionResponse{constructor(e){this.nodeId=e.nodeId,this.transactionHash=e.transactionHash,this.transactionId=e.transactionId,this.transaction=e.transaction,this.logger=e.logger}static fromJSON(e){return new TransactionResponse({nodeId:AccountId.fromString(e.nodeId),transactionHash:decode$8(e.transactionHash),transactionId:TransactionId.fromString(e.transactionId)})}async getReceipt(e){let t;try{t=await this.getReceiptQuery().execute(e)}catch(t){if(t instanceof ReceiptStatusError&&t.status===Status.ThrottledAtConsensus)return this.logger?.info("Transaction throttled at consensus"),this._retryTransaction(e);throw t}if(t.status!==Status.Success&&t.status!==Status.FeeScheduleFilePartUploaded)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecord(e){return await this.getReceipt(e),this.getRecordQuery().execute(e)}async getVerboseRecord(e){try{return await this.getReceiptQuery().execute(e),this.getRecordQuery().execute(e)}catch(t){return this.getRecordQuery().execute(e)}}async getReceiptWithSigner(e){const t=await this.getReceiptQuery().executeWithSigner(e);if(t.status!==Status.Success)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecordWithSigner(e){return await this.getReceiptWithSigner(e),this.getRecordQuery().executeWithSigner(e)}getReceiptQuery(){return(new TransactionReceiptQuery).setTransactionId(this.transactionId).setNodeAccountIds([this.nodeId])}getRecordQuery(){return(new TransactionRecordQuery).setTransactionId(this.transactionId).setNodeAccountIds([this.nodeId])}toJSON(){return{nodeId:this.nodeId.toString(),transactionHash:encode$5(this.transactionHash),transactionId:this.transactionId.toString()}}async _retryTransaction(e){if(!this.transaction)throw new Error("If you retry transaction you should have the transaction set");if(e.operatorAccountId?.toString()!==this.transaction.transactionId?.accountId?.toString())throw new Error("Retry mechanism is not supported when tx id is not generated by the operator account");if(null===e.operatorAccountId)throw new Error("Operator account is not set");let t=250;for(let n=0;n<5;n++){if(this.logger?.trace(`Transaction throttled, retry attempt ${n}`),this.transaction?._resetTransaction(e),null==this.transaction||null==this.transaction.transactionId)throw new Error("Transaction or Transaction ID is null after reset");this.transactionId=this.transaction.transactionId,n>0&&(await wait(Math.min(t,16e3)),t*=2);try{this.transaction._resetTransaction(e);const t=await this.transaction.execute(e),r=await(new TransactionReceiptQuery).setTransactionId(t.transactionId).setNodeAccountIds([t.nodeId]).execute(e);if(r.status!==Status.ThrottledAtConsensus)return this.logger?.info(`Transaction throttle retry succeeded after attempt ${n}`),r}catch(e){if(e instanceof ReceiptStatusError&&e.status===Status.ThrottledAtConsensus){this.logger?.info("Transaction throttled at consensus");continue}throw this.logger?.error(`An error occurred after throttle retry: ${e instanceof Error?e.message:String(e)}`),e}}throw this.logger?.error("Transaction throttle retry failed after maximum attempts"),new Error("Transaction retry failed after maximum attempts")}toString(){return JSON.stringify(this.toJSON())}}async function digest(e){return new Uint8Array(await window.crypto.subtle.digest("SHA-384",e))}class TransactionHashMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static async _fromTransaction(e){const t=new TransactionHashMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._nodeAccountIds.list[n],o=e._transactions.get(n),i=await digest(o.signedTransactionBytes);t._set(r,i)}return t}}class NodeAccountIdSignatureMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new NodeAccountIdSignatureMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}}class SignatureMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(e){const t=new SignatureMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._signedTransactions.get(n).sigMap;null!=r&&t._set(e._nodeAccountIds.list[n],NodeAccountIdSignatureMap._fromTransactionSigMap(r))}return t}}class CustomFee{constructor(e={}){this._feeCollectorAccountId=null,this._allCollectorsAreExempt=!1,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),null!=e.allCollectorsAreExempt&&this.setAllCollectorsAreExempt(e.allCollectorsAreExempt)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get allCollectorsAreExempt(){return this._allCollectorsAreExempt}setAllCollectorsAreExempt(e){return this._allCollectorsAreExempt=e,this}static _fromProtobuf(e){throw new Error("not implemented")}_toProtobuf(){throw new Error("not implemented")}}class CustomFixedFee extends CustomFee{constructor(e={}){super(e),this._denominatingTokenId=null,null!=e.denominatingTokenId&&this.setDenominatingTokenId(e.denominatingTokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount)}setHbarAmount(e){return this._amount=e.toTinybars(),this._denominatingTokenId=null,this}get hbarAmount(){return null!=this._denominatingTokenId?null:Hbar.fromTinybars(null!=this._amount?this._amount:0)}setDenominatingTokenToSameToken(){return this._denominatingTokenId=new TokenId(0,0,0),this}get denominatingTokenId(){return this._denominatingTokenId}setDenominatingTokenId(e){return this._denominatingTokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}static _fromProtobuf(e){const t=e.fixedFee;return new CustomFixedFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,denominatingTokenId:null!=t.denominatingTokenId?TokenId._fromProtobuf(t.denominatingTokenId):void 0,amount:null!=t.amount?t.amount:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}_toTopicFeeProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}}class CustomFeeLimit{constructor(e={}){this._accountId=null,e.accountId&&this.setAccountId(e.accountId),this._fees=null,e.fees&&this.setFees(e.fees)}static _fromProtobuf(e){return new CustomFeeLimit({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):null,fees:null!=e.fees?e.fees.map(e=>CustomFixedFee._fromProtobuf({fixedFee:e})):null})}getAccountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}getFees(){return this._fees}setFees(e){return this._fees=e,this}_toProtobuf(){const e=[];return null!=this._fees&&this._fees.forEach(t=>{const n=t._toProtobuf();null!=n.fixedFee&&e.push(n.fixedFee)}),{accountId:null!=this._accountId?this._accountId._toProtobuf():null,fees:e}}}class SignableNodeTransactionBodyBytes{constructor(e,t,n){this.nodeAccountId=e,this.transactionId=t,this.signableTransactionBodyBytes=n}}const DEFAULT_AUTO_RENEW_PERIOD=Long.fromValue(7776e3),DEFAULT_RECORD_THRESHOLD=Hbar.fromTinybars(Long.fromString("9223372036854775807")),NODE_ACCOUNT_BATCH_ID=new AccountId(0,0,0),DEFAULT_TRANSACTION_VALID_DURATION=120,CHUNK_SIZE=1024,TRANSACTION_REGISTRY=new Map;class Transaction extends Executable{constructor(){super(),this._transactions=new List,this._signedTransactions=new List,this._signerPublicKeys=new Set,this._transactionValidDuration=DEFAULT_TRANSACTION_VALID_DURATION,this._defaultMaxTransactionFee=new Hbar(2),this._customFeeLimits=[],this._maxTransactionFee=null,this._transactionMemo="",this._transactionIds=new List,this._publicKeys=[],this._transactionSigners=[],this._regenerateTransactionId=null,this._batchKey=null,this._isThrottled=!1}static fromBytes(e){const t=[],n=[],r=[],o=[],i=[],a=[],s=libExports.proto.TransactionList.decode(e).transactionList;if(0===s.length){const t=libExports.proto.Transaction.decode(e);0!==t.signedTransactionBytes.length?s.push(t):s.push({signedTransactionBytes:libExports.proto.SignedTransaction.encode({sigMap:t.sigMap,bodyBytes:t.bodyBytes}).finish()})}for(const e of s){if(null==e.bodyBytes&&null==e.signedTransactionBytes)throw new Error("bodyBytes and signedTransactionBytes are null");if(e.bodyBytes&&0!=e.bodyBytes.length){const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=t.nodeAccountID){const e=AccountId._fromProtobuf(t.nodeAccountID);i.includes(e.toString())||(r.push(e),i.push(e.toString()))}if(null==t.data)throw new Error("(BUG) body.data was not set in the protobuf");a.push(t)}if(e.signedTransactionBytes&&0!=e.signedTransactionBytes.length){const s=libExports.proto.SignedTransaction.decode(e.signedTransactionBytes);t.push(s);const c=libExports.proto.TransactionBody.decode(s.bodyBytes);if(null!=c.transactionID){const e=TransactionId._fromProtobuf(c.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=c.nodeAccountID){const e=AccountId._fromProtobuf(c.nodeAccountID);i.includes(e.toString())||(r.push(e),i.push(e.toString()))}if(null==c.data)throw new Error("(BUG) body.data was not set in the protobuf");a.push(c)}}const c=a[0];if(null==c||null==c.data)throw new Error("No transaction found in bytes or failed to decode TransactionBody");const u=TRANSACTION_REGISTRY.get(c.data);if(null==u)throw new Error(`(BUG) Transaction.fromBytes() not implemented for type ${c.data}`);return u(s,t,n,r,a)}schedule(){if(this._requireNotFrozen(),1!=SCHEDULE_CREATE_TRANSACTION.length)throw new Error("ScheduleCreateTransaction has not been loaded yet");return SCHEDULE_CREATE_TRANSACTION[0]()._setScheduledTransaction(this)}async batchify(e,t){return this._requireNotFrozen(),this.setBatchKey(t),await this.signWithOperator(e)}static _fromProtobufTransactions(e,t,n,r,o,i){const a=i[0];for(let e=0;e<r.length;e++)for(let t=0;t<o.length-1;t++)if(!compare$1(i[e*o.length+t],i[e*o.length+t+1],new Set(["nodeAccountID"])))throw new Error("failed to validate transaction bodies");const s=new AccountId(0);for(let e=0;e<o.length;e++)o[e].equals(s)&&o.splice(e--,1);e._transactions.setList(t),e._signedTransactions.setList(n),e._transactionIds.setList(r),e._nodeAccountIds.setList(o),e._transactionValidDuration=null!=a.transactionValidDuration&&null!=a.transactionValidDuration.seconds?Long.fromValue(a.transactionValidDuration.seconds).toInt():DEFAULT_TRANSACTION_VALID_DURATION,e._maxTransactionFee=null!=a.transactionFee&&a.transactionFee>new Long(0,0,!0)?Hbar.fromTinybars(a.transactionFee):null,e._customFeeLimits=null!=a.maxCustomFees?a.maxCustomFees?.map(e=>CustomFeeLimit._fromProtobuf(e)):[],e._batchKey=null!=a.batchKey?Key._fromProtobufKey(a?.batchKey):null,e._transactionMemo=null!=a.memo?a.memo:"";for(let r=0;r<o.length;r++){const o=n[r]||t[r];if(null!=o.sigMap&&null!=o.sigMap.sigPair)for(const t of o.sigMap.sigPair)e._signerPublicKeys.add(encode$5(t.pubKeyPrefix)),e._publicKeys.push(PublicKey.fromBytes(t.pubKeyPrefix)),e._transactionSigners.push(null)}return e}setNodeAccountIds(e){return this._requireNotFrozen(),super.setNodeAccountIds(e),this}get transactionValidDuration(){return this._transactionValidDuration}get size(){return this._requireFrozen(),this._makeRequestAsync().then(e=>libExports.proto.Transaction.encode(e).finish().length)}get bodySize(){const e=this._makeTransactionBody(AccountId.fromString("0.0.0"));return libExports.proto.TransactionBody.encode(e).finish().length}setTransactionValidDuration(e){return this._requireNotFrozen(),this._transactionValidDuration=e,this}get maxTransactionFee(){return this._maxTransactionFee}setMaxTransactionFee(e){return this._requireNotFrozen(),this._maxTransactionFee=e instanceof Hbar?e:new Hbar(e),this}get regenerateTransactionId(){return this._regenerateTransactionId}setRegenerateTransactionId(e){return this._requireNotFrozen(),this._regenerateTransactionId=e,this}get transactionMemo(){return this._transactionMemo}setTransactionMemo(e){return this._requireNotFrozen(),this._transactionMemo=e,this}get transactionId(){return this._transactionIds.isEmpty?null:(this._transactionIds.setLocked(),this._transactionIds.current)}setTransactionId(e){return this._requireNotFrozen(),this._transactionIds.setList([e]).setLocked(),this}getRequiredChunks(){return 1}get bodySizeAllChunks(){const e=[];for(let t=0;t<this.getRequiredChunks();t++)this._transactionIds.index=t,e.push(this.bodySize);return this._transactionIds.index=0,e}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}async signWith(e,t){this._signOnDemand||this._requireFrozen();const n=encode$5(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;if(this._transactions.clear(),this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(t),this._signOnDemand)return this;this._transactionIds.setLocked(),this._nodeAccountIds.setLocked();for(const n of this._signedTransactions.list){const r=n.bodyBytes,o=await t(r);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(o))}return this}signWithOperator(e){const t=e._operator;if(null==t)throw new Error("`client` must have an operator to sign with the operator");return this._isFrozen()||this.freezeWith(e),this.signWith(t.publicKey,t.transactionSigner)}_resetTransaction(e){if(!e.operatorAccountId)throw new Error("Client must have an operator account ID");this.logger?.info("Resetting transaction id and resigning");const t=TransactionId.generate(e.operatorAccountId);this._transactionIds.clear(),this._signedTransactions.clear(),this._transactionIds.setList([t]),this._isThrottled=!0}addSignature(e,t){if(!(t instanceof SignatureMap$1))return this._addSignatureLegacy(e,t);this.isFrozen()||this.freeze();const n=encode$5(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();for(let n=0;n<this._signedTransactions.length;n++){const r=this._signedTransactions.get(n);if(null==r.sigMap&&(r.sigMap={}),null==r.sigMap.sigPair&&(r.sigMap.sigPair=[]),r.bodyBytes){const{transactionID:n,nodeAccountID:o}=libExports.proto.TransactionBody.decode(r.bodyBytes);if(!n||!o)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const i=TransactionId._fromProtobuf(n),a=AccountId._fromProtobuf(o),s=t.get(a),c=s?.get(i),u=c?.get(e);if(!u)throw new Error("Signature not found for the transaction and public key");const l=e._toProtobufSignature(u);r.sigMap?.sigPair?.push(l)}}return this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(null),this}_addSignatureLegacy(e,t){const n=t instanceof Uint8Array,r=Array.isArray(t);if(this.getRequiredChunks()>1)throw new Error("Add signature is not supported for chunked transactions");if(n&&1!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");if(r&&t.length!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");this.isFrozen()||this.freeze();const o=encode$5(e.toBytesRaw());if(this._signerPublicKeys.has(o))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();const i=n?[t]:t;for(let t=0;t<this._signedTransactions.length;t++){const n=this._signedTransactions.get(t);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(i[t]))}return this._signerPublicKeys.add(o),this._publicKeys.push(e),this._transactionSigners.push(null),this}getSignaturesLegacy(){return this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap._fromTransaction(this)}removeSignature(e){this.isFrozen()||this.freeze();const t=encode$5(e.toBytesRaw());if(!this._signerPublicKeys.has(t))throw new Error("The public key has not signed this transaction");const n=[];for(const e of this._signedTransactions.list){const r=this._removeSignaturesFromTransaction(e,t);n.push(...r)}return this._signerPublicKeys.delete(t),this._publicKeys=this._publicKeys.filter(t=>!t.equals(e)),this._transactionSigners.pop(),n}removeAllSignatures(){this.isFrozen()||this.freeze();const e=this._collectSignaturesByPublicKey();for(const e of this._signedTransactions.list)e.sigMap&&e.sigMap.sigPair&&(e.sigMap.sigPair=[]);return this._signerPublicKeys.clear(),this._publicKeys=[],this._transactionSigners=[],e}getSignatures(e){return e?this.getSignaturesLegacy():(this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap$1._fromTransaction(this))}async getSignaturesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),SignatureMap$1._fromTransaction(this)}_setTransactionId(){if(null==this._operatorAccountId&&this._transactionIds.isEmpty)throw new Error("`transactionId` must be set or `client` must be provided with `freezeWith`")}_setNodeAccountIds(e){if(this._nodeAccountIds.isEmpty){if(null==e)throw new Error("`nodeAccountId` must be set or `client` must be provided with `freezeWith`");this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute())}}_applyMaxNodesPerTransactionLimit(e){const t=e.maxNodesPerTransaction;if(t<=0||this._nodeAccountIds.length<=t)return;this._logger&&this._logger.debug(`Trimming frozen transaction from ${this._nodeAccountIds.length} nodes to ${t} nodes based on maxNodesPerTransaction setting`);const n=this._nodeAccountIds.list.slice(0,t),r=this._nodeAccountIds.length,o=this._transactionIds.length,i=[];for(let e=0;e<o;e++){const n=e*r;for(let e=0;e<t;e++){const t=n+e;t<this._signedTransactions.length&&i.push(this._signedTransactions.get(t))}}this._transactions.clear(),this._nodeAccountIds.locked=!1,this._nodeAccountIds.setList(n),this._nodeAccountIds.locked=!0,this._signedTransactions.setList(i)}setBatchKey(e){return this._requireNotFrozen(),this._batchKey=e,this}get batchKey(){return this._batchKey}get signableNodeBodyBytesList(){return this._requireFrozen(),this._signedTransactions.list.map(e=>{if(!e.bodyBytes)throw new Error("Missing bodyBytes in signed transaction.");const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(!t.nodeAccountID)throw new Error("Missing nodeAccountID in transaction body.");const n=AccountId._fromProtobuf(t.nodeAccountID);if(!t.transactionID)throw new Error("Missing transactionID in transaction body.");const r=TransactionId._fromProtobuf(t.transactionID);return new SignableNodeTransactionBodyBytes(n,r,e.bodyBytes)})}_buildSignedTransactions(){this._signedTransactions.locked||this._signedTransactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}_buildIncompleteTransactions(){0==this._nodeAccountIds.length?this._transactions.setList([this._makeSignedTransaction(null)]):this._transactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}freeze(){return this.freezeWith(null)}_freezeWithAccountId(e){null==this._operatorAccountId&&(this._operatorAccountId=e)}freezeWith(e){if(this._signOnDemand=null!=e&&e.signOnDemand,this._operator=null!=e?e._operator:null,this._freezeWithAccountId(null!=e?e.operatorAccountId:null),this._maxTransactionFee=null==this._maxTransactionFee?null!=e&&null!=e.defaultMaxTransactionFee?e.defaultMaxTransactionFee:this._defaultMaxTransactionFee:this._maxTransactionFee,this._regenerateTransactionId=null!=e&&null==this._regenerateTransactionId?e.defaultRegenerateTransactionId:this._regenerateTransactionId,this.batchKey?this._nodeAccountIds.setList([NODE_ACCOUNT_BATCH_ID]):this._setNodeAccountIds(e),this._setTransactionId(),null!=e)for(const t of this._transactionIds.list)null!=t.accountId&&t.accountId.validateChecksum(e);return this._buildNewTransactionIdList(),this._signOnDemand||this._buildSignedTransactions(),this}async signWithSigner(e){return await e.signTransaction(this),this}async freezeWithSigner(e){return await e.populateTransaction(this),this.freeze(),this}toBytes(){return this._requireNotSignOnDemand(),this._isFrozen()?(this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._buildAllTransactions()):this._buildIncompleteTransactions(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async toBytesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async getTransactionHash(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),digest(this._transactions.get(0).signedTransactionBytes)}async getTransactionHashPerNode(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),await TransactionHashMap._fromTransaction(this)}isFrozen(){return this._signedTransactions.length>0}_getTransactionId(){const e=this.transactionId;if(null==e)throw new Error("transaction must have been frozen before getting the transaction ID, try calling `freeze`");return e}_validateChecksums(e){}async _beforeExecute(e){this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),this._logger&&this._logger.info(`Network used: ${e._network.networkName}`),this._isFrozen()||this.freezeWith(e),this._applyMaxNodesPerTransactionLimit(e),e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),null!=this._operator&&null!=this._operator||(this._operator=null!=e?e._operator:null),null!=this._operatorAccountId&&null!=this._operatorAccountId||(this._operatorAccountId=null!=e&&null!=e._operator?e._operator.accountId:null),null!=this._operator&&await this.signWith(this._operator.publicKey,this._operator.transactionSigner)}async _makeRequestAsync(){const e=this._transactionIds.index*this._nodeAccountIds.length+this._nodeAccountIds.index;return this._signOnDemand||this._isThrottled?await this._buildTransactionAsync():(this._buildTransaction(e),this._transactions.get(e))}async _signTransaction(){const e=this._makeSignedTransaction(this._nodeAccountIds.next),t=e.bodyBytes;for(let n=0;n<this._publicKeys.length;n++){const r=this._publicKeys[n],o=this._transactionSigners[n];if(null==o)continue;const i=await o(t);null==e.sigMap&&(e.sigMap={}),null==e.sigMap.sigPair&&(e.sigMap.sigPair=[]),e.sigMap.sigPair.push(r._toProtobufSignature(i))}return e}_buildNewTransactionIdList(){if(this._transactionIds.locked||null==this._operatorAccountId)return;const e=TransactionId.withValidStart(this._operatorAccountId,Timestamp.generate());this._transactionIds.set(this._transactionIds.index,e)}_buildAllTransactions(){for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}async _buildAllTransactionsAsync(){if(this._signOnDemand){if(this._buildSignedTransactions(),!this._transactions.locked)for(let e=0;e<this._signedTransactions.length;e++)this._transactions.push(await this._buildTransactionAsync())}else this._buildAllTransactions()}_buildTransaction(e){if(this._transactions.length<e)for(let t=this._transactions.length;t<e;t++)this._transactions.push(null);null!=this._transactions.list[e]&&this._transactions.set(e,{signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}),this._transactions.setIfAbsent(e,()=>({signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}))}async _buildTransactionAsync(){return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(await this._signTransaction()).finish()}}_shouldRetry(e,t){const{nodeTransactionPrecheckCode:n}=t,r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger&&(this._logger.debug(`[${this._getLogId()}] received status ${r.toString()}`),this._logger.info(`SDK Transaction Status Response: ${r.toString()}`)),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:case Status.InvalidNodeAccount:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];case Status.TransactionExpired:return this._transactionIds.locked||null!=this._regenerateTransactionId&&!this._regenerateTransactionId?[r,ExecutionState.Error]:(this._buildNewTransactionIdList(),[r,ExecutionState.Retry]);default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=t,o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return this._logger&&this._logger.info(`Transaction Error Info: ${o.toString()}, ${this.transactionId.toString()}`),new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}async _mapResponse(e,t,n){const r=await digest(n.signedTransactionBytes),o=this._getTransactionId();return this._transactionIds.advance(),this._logger&&this._logger.info(`Transaction Info: ${JSON.stringify(new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,logger:this._logger}).toJSON())}`),new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,transaction:this,logger:this._logger})}_makeSignedTransaction(e){const t=this._makeTransactionBody(e);this._logger&&this._logger.info(`Transaction Body: ${JSON.stringify(t)}`);return{sigMap:{sigPair:[]},bodyBytes:libExports.proto.TransactionBody.encode(t).finish()}}isBatchedAndNotBatchTransaction(){return null!=this.batchKey&&"atomicBatch"!=this._getTransactionDataCase()}_makeTransactionBody(e){return{[this._getTransactionDataCase()]:this._makeTransactionData(),transactionFee:null!=this._maxTransactionFee?this._maxTransactionFee.toTinybars():null,memo:this._transactionMemo,transactionID:null!=this._transactionIds.current?this._transactionIds.current._toProtobuf():null,nodeAccountID:null!=e?e._toProtobuf():null,transactionValidDuration:{seconds:Long.fromNumber(this._transactionValidDuration)},maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,batchKey:this.batchKey?._toProtobufKey()}}_getTransactionDataCase(){throw new Error("not implemented")}_getScheduledTransactionBody(){return{memo:this.transactionMemo,transactionFee:null==this._maxTransactionFee?this._defaultMaxTransactionFee.toTinybars():this._maxTransactionFee.toTinybars(),maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,[this._getTransactionDataCase()]:this._makeTransactionData()}}_makeTransactionData(){throw new Error("not implemented")}_isFrozen(){return this._signOnDemand||this._signedTransactions.length>0}_requireNotFrozen(){if(this._isFrozen())throw new Error("transaction is immutable; it has at least one signature or has been explicitly frozen")}_requireNotSignOnDemand(){if(this._signOnDemand)throw new Error("Please use `toBytesAsync()` if `signOnDemand` is enabled")}_requireFrozen(){if(!this._isFrozen())throw new Error("transaction must have been frozen before calculating the hash will be stable, try calling `freeze`")}_requireOneNodeAccountId(){if(1!=this._nodeAccountIds.length)throw"transaction did not have exactly one node ID set"}_requestToBytes(e){return libExports.proto.Transaction.encode(e).finish()}_responseToBytes(e){return libExports.proto.TransactionResponse.encode(e).finish()}_removeSignaturesFromTransaction(e,t){const n=[];return e.sigMap&&e.sigMap.sigPair?(e.sigMap.sigPair=e.sigMap.sigPair.filter(e=>{const r=this._shouldRemoveSignature(e,t),o=e.ed25519??e.ECDSASecp256k1;return r&&o&&n.push(o),!r}),n):[]}_shouldRemoveSignature=(e,t)=>encode$5(e?.pubKeyPrefix||new Uint8Array)===t;_collectSignaturesByPublicKey(){const e=new Map,t={};for(const n of this._signedTransactions.list){if(!n.sigMap||!n.sigMap.sigPair)return new Map;for(const r of n.sigMap.sigPair){const n=r.ed25519??r.ECDSASecp256k1;if(!n||!r.pubKeyPrefix)return new Map;const o=encode$5(r.pubKeyPrefix);let i=t[o];i||(i=PublicKey.fromString(o),t[o]=i),e.has(i)||e.set(i,[]);const a=e.get(i);a&&a.push(n)}}return e}}const SCHEDULE_CREATE_TRANSACTION=[];class TokenNftTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.senderAccountId=e.senderAccountId instanceof AccountId?e.senderAccountId:AccountId.fromString(e.senderAccountId),this.receiverAccountId=e.receiverAccountId instanceof AccountId?e.receiverAccountId:AccountId.fromString(e.receiverAccountId),this.serialNumber=Long.fromValue(e.serialNumber),this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[])t.push(new TokenNftTransfer({tokenId:e,senderAccountId:AccountId._fromProtobuf(r.senderAccountID),receiverAccountId:AccountId._fromProtobuf(r.receiverAccountID),serialNumber:null!=r.serialNumber?r.serialNumber:Long.ZERO,isApproved:1==r.isApproval}))}return t}_toProtobuf(){return{senderAccountID:this.senderAccountId._toProtobuf(),receiverAccountID:this.receiverAccountId._toProtobuf(),serialNumber:this.serialNumber,isApproval:this.isApproved}}}class NullableTokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AbstractTokenTransferTransaction extends Transaction{constructor(e={}){super(),this._tokenTransfers=[],this._nftTransfers=[];for(const t of null!=e.tokenTransfers?e.tokenTransfers:[])this.addTokenTransfer(t.tokenId,t.accountId,t.amount);for(const t of null!=e.nftTransfers?e.nftTransfers:[])this.addNftTransfer(t.tokenId,t.serial,t.sender,t.recipient)}addNftTransfer(e,t,n,r){return this._addNftTransfer(!1,e,t,n,r)}_addTokenTransfer(e,t,n,r,o){this._requireNotFrozen();const i=e instanceof TokenId?e:TokenId.fromString(e),a=t instanceof AccountId?t:AccountId.fromString(t),s=convertAmountToLong(n);for(const e of this._tokenTransfers)if(0===e.tokenId.compare(i)&&0===e.accountId.compare(a))return e.amount=e.amount.add(s),e.expectedDecimals=o,this;return this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:o,amount:n,isApproved:r})),this}addTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!1,null)}_addNftTransfer(e,t,n,r,o){let i,a,s;if(this._requireNotFrozen(),t instanceof NftId)i=t,a="string"==typeof n?AccountId.fromString(n):n,s="string"==typeof r?AccountId.fromString(r):r;else if(t instanceof TokenId)i=new NftId(t,n),a="string"==typeof r?AccountId.fromString(r):r,s="string"==typeof o?AccountId.fromString(o):o;else try{i=NftId.fromString(t),a="string"==typeof n?AccountId.fromString(n):n,s="string"==typeof r?AccountId.fromString(r):r}catch(e){const c=TokenId.fromString(t);i=new NftId(c,n),a="string"==typeof r?AccountId.fromString(r):r,s="string"==typeof o?AccountId.fromString(o):o}for(const e of this._nftTransfers)if(0===e.tokenId.compare(i.tokenId)&&0===e.serialNumber.compare(i.serial))return e.senderAccountId=a,e.receiverAccountId=s,this;return this._nftTransfers.push(new TokenNftTransfer({tokenId:i.tokenId,serialNumber:i.serial,senderAccountId:a,receiverAccountId:s,isApproved:e})),this}addApprovedNftTransfer(e,t,n,r){return this._addNftTransfer(!0,e,t,n,r)}addApprovedTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!0,null)}addTokenTransferWithDecimals(e,t,n,r){this._requireNotFrozen();const o=e instanceof TokenId?e:TokenId.fromString(e),i=t instanceof AccountId?t:AccountId.fromString(t),a=convertAmountToLong(n);let s=!1;for(const e of this._tokenTransfers)if(0===e.tokenId.compare(o)){if(null!=e.expectedDecimals&&e.expectedDecimals!==r)throw new Error("expected decimals mis-match");e.expectedDecimals=r,0===e.accountId.compare(i)&&(e.amount=e.amount.add(a),e.expectedDecimals=r,s=!0)}return s||this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:r,amount:n,isApproved:!1})),this}get tokenIdDecimals(){const e=new NullableTokenDecimalMap;for(const t of this._tokenTransfers)e._set(t.tokenId,t.expectedDecimals);return e}get nftTransfers(){const e=new TokenNftTransferMap;for(const t of this._nftTransfers){const n=e.get(t.tokenId),r={sender:t.senderAccountId,recipient:t.receiverAccountId,serial:t.serialNumber,isApproved:t.isApproved};null!=n?n.push(r):e._set(t.tokenId,[r])}return e}get tokenTransfers(){const e=new TokenTransferMap;for(const t of this._tokenTransfers){let n=e.get(t.tokenId);null!=n?n._set(t.accountId,t.amount):(n=new TokenTransferAccountMap,n._set(t.accountId,t.amount),e._set(t.tokenId,n))}return e}_makeTransactionData(){const e=[];this._tokenTransfers.sort((e,t)=>{const n=e.tokenId.compare(t.tokenId);return 0!==n?n:e.accountId.compare(t.accountId)}),this._nftTransfers.sort((e,t)=>{const n=e.senderAccountId.compare(t.senderAccountId);if(0!=n)return n;const r=e.receiverAccountId.compare(t.receiverAccountId);return 0!=r?r:e.serialNumber.compare(t.serialNumber)});let t=0,n=0;for(;t<this._tokenTransfers.length||n<this._nftTransfers.length;)if(t<this._tokenTransfers.length&&n<this._nftTransfers.length){const r=this._tokenTransfers[t].tokenId,o=this._nftTransfers[n].tokenId,i=e.length>0?e[e.length-1]:null,a=null!=i?i.tokenId:null;if(null!=i&&null!=a&&0===a.compare(r)){i.transfers.push(this._tokenTransfers[t++]);continue}if(null!=i&&null!=a&&0===a.compare(o)){i.nftTransfers.push(this._nftTransfers[n++]);continue}const s=r.compare(o);0===s?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[this._nftTransfers[n++]]}):s<0?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]}):e.push({tokenId:o,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}else if(t<this._tokenTransfers.length){const n=this._tokenTransfers[t].tokenId;let r;for(const t of e)0===t.tokenId.compare(n)&&(r=t);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(n)){r.transfers.push(this._tokenTransfers[t++]);continue}e.push({tokenId:n,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]})}else if(n<this._nftTransfers.length){const t=this._nftTransfers[n].tokenId;let r;for(const n of e)0===n.tokenId.compare(t)&&(r=n);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(t)){r.nftTransfers.push(this._nftTransfers[n++]);continue}e.push({tokenId:t,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}return{tokenTransfers:e.map(e=>({token:e.tokenId._toProtobuf(),expectedDecimals:null!=e.expectedDecimals?{value:e.expectedDecimals}:null,transfers:e.transfers.map(e=>e._toProtobuf()),nftTransfers:e.nftTransfers.map(e=>e._toProtobuf())}))}}}class TokenAirdropTransaction extends AbstractTokenTransferTransaction{constructor(e={}){if(super(),null!=e.tokenTransfers)for(const t of e.tokenTransfers)this._addTokenTransfer(t.tokenId,t.accountId,t.amount,t.isApproved,t.expectedDecimals);if(this._nftTransfers=[],null!=e.nftTransfers)for(const t of e.nftTransfers)this._addNftTransfer(t.isApproved,t.tokenId,t.serialNumber,t.senderAccountId,t.receiverAccountId)}addApprovedTokenTransferWithDecimals(e,t,n,r){return this._requireNotFrozen(),this._addTokenTransfer(e,t,n,!0,r),this}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenAirdrop,a=TokenTransfer._fromProtobuf(i.tokenTransfers??[]),s=TokenNftTransfer._fromProtobuf(i.tokenTransfers??[]);return Transaction._fromProtobufTransactions(new TokenAirdropTransaction({nftTransfers:s,tokenTransfers:a}),e,t,n,r,o)}_execute(e,t){return e.token.airdropTokens(t)}_getTransactionDataCase(){return"tokenAirdrop"}_getLogId(){return`TokenAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAirdrop",TokenAirdropTransaction._fromProtobuf);class AirdropPendingTransaction extends Transaction{constructor(e){super(),this._pendingAirdropIds=[],null!=e?.pendingAirdropIds&&(this._pendingAirdropIds=e.pendingAirdropIds)}get pendingAirdropIds(){return this._pendingAirdropIds}addPendingAirdropId(e){return this._requireNotFrozen(),this._pendingAirdropIds.push(e),this}setPendingAirdropIds(e){return this._requireNotFrozen(),this._pendingAirdropIds=e,this}}class TokenClaimAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_execute(e,t){return e.token.claimAirdrop(t)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}static _fromProtobuf(e,t,n,r,o){const i=o[0],{pendingAirdrops:a}=i.tokenClaimAirdrop;return Transaction._fromProtobufTransactions(new TokenClaimAirdropTransaction({pendingAirdropIds:a?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getTransactionDataCase(){return"tokenClaimAirdrop"}_getLogId(){return`TokenClaimAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenClaimAirdrop",TokenClaimAirdropTransaction._fromProtobuf);class TokenCancelAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}_execute(e,t){return e.token.cancelAirdrop(t)}_getTransactionDataCase(){return"tokenCancelAirdrop"}static _fromProtobuf(e,t,n,r,o){const i=o[0],{pendingAirdrops:a}=i.tokenCancelAirdrop;return Transaction._fromProtobufTransactions(new TokenCancelAirdropTransaction({pendingAirdropIds:a?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getLogId(){return`TokenCancelAirdrop:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCancelAirdrop",TokenCancelAirdropTransaction._fromProtobuf);class HbarAllowance{constructor(e){this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=e.amount,Object.freeze(this)}static _fromProtobuf(e){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}static _fromGrantedProtobuf(e,t){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,amount:null!=this.amount?this.amount.toTinybars():null}}_validateChecksums(e){null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}toJSON(){return{ownerAccountId:null!=this.ownerAccountId?this.ownerAccountId.toString():null,spenderAccountId:null!=this.spenderAccountId?this.spenderAccountId.toString():null,amount:null!=this.amount?this.amount.toString():null}}}class TokenAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=null!=e.amount?convertAmountToLong(e.amount):null,Object.freeze(this)}static _fromProtobuf(e){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:null!=e.amount?Long.fromValue(e.amount):null})}static _fromGrantedProtobuf(e,t){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:null!=e.amount?Long.fromValue(e.amount):null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,amount:this.amount}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class TokenNftAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.serialNumbers=e.serialNumbers,this.allSerials=e.allSerials,this.delegatingSpender=e.delegatingSpender,Object.freeze(this)}static _fromProtobuf(e){const t=null!=e.approvedForAll&&1==e.approvedForAll.value;return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null!=e.spender?AccountId._fromProtobuf(e.spender):null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:t?null:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:t,delegatingSpender:null!=e.delegatingSpender?AccountId._fromProtobuf(e.delegatingSpender):null})}static _fromGrantedProtobuf(e,t){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,serialNumbers:[],allSerials:null,delegatingSpender:null})}static _fromRemoveProtobuf(e){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:null,delegatingSpender:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,approvedForAll:null==this.serialNumbers?{value:this.allSerials}:null,serialNumbers:this.serialNumbers,delegatingSpender:null!=this.delegatingSpender?this.delegatingSpender._toProtobuf():null}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class AccountAllowanceAdjustTransaction extends Transaction{constructor(e={}){super(),this._hbarAllowances=null!=e.hbarAllowances?e.hbarAllowances:[],this._tokenAllowances=null!=e.tokenAllowances?e.tokenAllowances:[],this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}get hbarAllowances(){return this._hbarAllowances}addHbarAllowance(e,t){const n=t instanceof Hbar?t:new Hbar(t);return this._adjustHbarAllowance(null,e,requireNotNegative(n))}_adjustHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarAllowances.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n})),this}grantHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r))}revokeHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r).negated())}get tokenAllowances(){return this._tokenAllowances}addTokenAllowance(e,t,n){return this._adjustTokenAllowance(e,null,t,requireNotNegative(Long.fromValue(n)))}_adjustTokenAllowance(e,t,n,r){return this._requireNotFrozen(),this._tokenAllowances.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:"number"==typeof r?Long.fromNumber(r):r})),this}grantTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}revokeTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}addTokenNftAllowance(e,t){const n="string"==typeof e?NftId.fromString(e):e;return this._adjustTokenNftAllowance(n,null,t)}_adjustTokenNftAllowance(e,t,n){this._requireNotFrozen();const r="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,o="string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t;let i=!1;for(const t of this._nftAllowances)if(0===t.tokenId.compare(e.tokenId)&&null!=t.spenderAccountId&&0===t.spenderAccountId.compare(r)){null!=t.serialNumbers&&t.serialNumbers.push(e.serial),i=!0;break}return i||this._nftAllowances.push(new TokenNftAllowance({tokenId:e.tokenId,spenderAccountId:r,serialNumbers:[e.serial],ownerAccountId:o,allSerials:!1,delegatingSpender:null})),this}grantTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(r,t,n)}revokeTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(new NftId(r.tokenId,r.serial.negate()),t,n)}addAllTokenNftAllowance(e,t){return this._adjustTokenNftAllowanceAllSerials(e,null,t,!0)}grantTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!0)}revokeTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!1)}_adjustTokenNftAllowanceAllSerials(e,t,n,r){return this._requireNotFrozen(),this._nftAllowances.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,ownerAccountId:null!=t?"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t:null,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}_validateChecksums(e){this._hbarAllowances.map(t=>t._validateChecksums(e)),this._tokenAllowances.map(t=>t._validateChecksums(e)),this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return Promise.reject(new Error("This feature has been deprecated for this class."))}_getTransactionDataCase(){throw new Error("This feature has been deprecated for this class.")}_makeTransactionData(){throw new Error("This feature has been deprecated.")}_getLogId(){return`AccountAllowanceAdjustTransaction:${this._transactionIds.current.validStart.toString()}`}}class AccountAllowanceApproveTransaction extends Transaction{constructor(e={}){super(),this._hbarApprovals=null!=e.hbarApprovals?e.hbarApprovals:[],this._tokenApprovals=null!=e.tokenApprovals?e.tokenApprovals:[],this._nftApprovals=null!=e.nftApprovals?e.nftApprovals:[]}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoApproveAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceApproveTransaction({hbarApprovals:(null!=i.cryptoAllowances?i.cryptoAllowances:[]).map(e=>HbarAllowance._fromProtobuf(e)),tokenApprovals:(null!=i.tokenAllowances?i.tokenAllowances:[]).map(e=>TokenAllowance._fromProtobuf(e)),nftApprovals:(null!=i.nftAllowances?i.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get hbarApprovals(){return this._hbarApprovals}approveHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n instanceof Hbar?n:new Hbar(n)})),this}addHbarAllowance(e,t){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof e?AccountId.fromString(e):e,amount:t instanceof Hbar?t:new Hbar(t),ownerAccountId:null})),this}get tokenApprovals(){return this._tokenApprovals}approveTokenAllowance(e,t,n,r){this._requireNotFrozen();const o=convertAmountToLong(r);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:o})),this}addTokenAllowance(e,t,n){this._requireNotFrozen();const r=convertAmountToLong(n);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof t?AccountId.fromString(t):t,amount:r,ownerAccountId:null})),this}addTokenNftAllowance(e,t){return this._approveTokenNftAllowance(e,null,t,null)}get tokenNftApprovals(){return this._nftApprovals}_approveTokenNftAllowance(e,t,n,r){this._requireNotFrozen();const o="string"==typeof e?NftId.fromString(e):e,i="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n;let a=!1;for(const e of this._nftApprovals)if(0===e.tokenId.compare(o.tokenId)&&null!=e.spenderAccountId&&0===e.spenderAccountId.compare(i)){null!=e.serialNumbers&&e.serialNumbers.push(o.serial),a=!0;break}return a||this._nftApprovals.push(new TokenNftAllowance({tokenId:o.tokenId,spenderAccountId:i,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:[o.serial],allSerials:!1,delegatingSpender:"string"==typeof r?AccountId.fromString(r):r})),this}approveTokenNftAllowance(e,t,n){return this._approveTokenNftAllowance(e,t,n,null)}approveTokenNftAllowanceWithDelegatingSpender(e,t,n,r){return this._approveTokenNftAllowance(e,t,n,r)}_approveAllTokenNftAllowance(e,t,n,r){return this._requireNotFrozen(),this._nftApprovals.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}addAllTokenNftAllowance(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}approveTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}deleteTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!1)}_validateChecksums(e){this._hbarApprovals.map(t=>t._validateChecksums(e)),this._tokenApprovals.map(t=>t._validateChecksums(e)),this._nftApprovals.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.approveAllowances(t)}_getTransactionDataCase(){return"cryptoApproveAllowance"}_makeTransactionData(){return{cryptoAllowances:this._hbarApprovals.map(e=>e._toProtobuf()),tokenAllowances:this._tokenApprovals.map(e=>e._toProtobuf()),nftAllowances:this._nftApprovals.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceApproveTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoApproveAllowance",AccountAllowanceApproveTransaction._fromProtobuf);class AccountAllowanceDeleteTransaction extends Transaction{constructor(e={}){super(),this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoDeleteAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceDeleteTransaction({nftAllowances:(null!=i.nftAllowances?i.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get tokenNftAllowanceDeletions(){return this._nftAllowances}deleteAllTokenNftAllowances(e,t){this._requireNotFrozen();const n="string"==typeof e?NftId.fromString(e):e,r="string"==typeof t?AccountId.fromString(t):t;let o=!1;for(const e of this._nftAllowances)if(0===e.tokenId.compare(n.tokenId)){null!=e.serialNumbers&&e.serialNumbers.push(n.serial),o=!0;break}return o||this._nftAllowances.push(new TokenNftAllowance({tokenId:n.tokenId,spenderAccountId:null,serialNumbers:[n.serial],ownerAccountId:r,allSerials:!1,delegatingSpender:null})),this}_validateChecksums(e){this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.deleteAllowances(t)}_getTransactionDataCase(){return"cryptoDeleteAllowance"}_makeTransactionData(){return{nftAllowances:this._nftAllowances.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteAllowance",AccountAllowanceDeleteTransaction._fromProtobuf);class TokenBalanceMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class TokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AccountBalance{constructor(e){this.hbars=e.hbars,this.tokens=e.tokens,this.tokenDecimals=e.tokenDecimals,Object.freeze(this)}static fromBytes(e){return AccountBalance._fromProtobuf(libExports.proto.CryptoGetAccountBalanceResponse.decode(e))}static _fromProtobuf(e){const t=new TokenBalanceMap,n=new TokenDecimalMap;if(null!=e.tokenBalances)for(const r of e.tokenBalances){const e=TokenId._fromProtobuf(r.tokenId);n._set(e,null!=r.decimals?r.decimals:0),t._set(e,Long.fromValue(r.balance))}return new AccountBalance({hbars:Hbar.fromTinybars(e.balance),tokens:t,tokenDecimals:n})}_toProtobuf(){const e=[];for(const[t,n]of null!=this.tokens?this.tokens:[])e.push({tokenId:t._toProtobuf(),balance:n,decimals:null!=this.tokenDecimals?this.tokenDecimals.get(t):null});return{balance:this.hbars.toTinybars(),tokenBalances:e}}toBytes(){return libExports.proto.CryptoGetAccountBalanceResponse.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){const e=[];for(const[t,n]of null!=this.tokens?this.tokens:[]){const r=null!=this.tokenDecimals?this.tokenDecimals.get(t):null;e.push({tokenId:t.toString(),balance:n.toString(),decimals:null!=r?r:0})}return{hbars:this.hbars.toString(),tokens:e}}}class AccountBalanceQuery extends Query{constructor(e={}){super(),this._accountId=null,this._contractId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.cryptogetAccountBalance;return new AccountBalanceQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_isPaymentRequired(){return!1}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoGetBalance(t)}_mapResponseHeader(e){return e.cryptogetAccountBalance.header}_mapResponse(e,t,n){const r=e.cryptogetAccountBalance;return Promise.resolve(AccountBalance._fromProtobuf(r))}_onMakeRequest(e){return{cryptogetAccountBalance:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`AccountBalanceQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("cryptogetAccountBalance",AccountBalanceQuery._fromProtobuf);class Duration{constructor(e){this.seconds=e instanceof Long?e:Long.fromNumber(e),Object.freeze(this)}_toProtobuf(){return{seconds:this.seconds}}static _fromProtobuf(e){return new Duration(e.seconds)}}class AccountCreateTransaction extends Transaction{constructor(e={}){super(),this._key=null,this._initialBalance=null,this._sendRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiveRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiverSignatureRequired=!1,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._alias=null,null!=e.key&&this.setKeyWithoutAlias(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.alias&&this.setAlias(e.alias)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoCreateAccount;let a;return null!=i.alias&&i.alias.length>0&&20===i.alias.length&&(a=EvmAddress.fromBytes(i.alias)),Transaction._fromProtobufTransactions(new AccountCreateTransaction({key:null!=i.key?Key._fromProtobufKey(i.key):void 0,initialBalance:null!=i.initialBalance?Hbar.fromTinybars(i.initialBalance):void 0,receiverSignatureRequired:null!=i.receiverSigRequired?i.receiverSigRequired:void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,accountMemo:null!=i.memo?i.memo:void 0,maxAutomaticTokenAssociations:null!=i.maxAutomaticTokenAssociations?i.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:1==i.declineReward,alias:a}),e,t,n,r,o)}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}setECDSAKeyWithAlias(e){this.setKeyWithoutAlias(e);const t=this._deriveECDSAKeyAlias(e);return this.setAlias(t),this}setKeyWithAlias(e,t){this.setKeyWithoutAlias(e);const n=this._deriveECDSAKeyAlias(t);return this.setAlias(n),this}setKeyWithoutAlias(e){return this._requireNotFrozen(),this._key=e,this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get alias(){return this._alias}setAlias(e){if("string"==typeof e){if(!(e.startsWith("0x")&&42==e.length||40==e.length))throw new Error('evmAddress must be a valid EVM address with or without "0x" prefix');this._alias=EvmAddress.fromString(e)}else this._alias=e;return this}_validateChecksums(e){null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_deriveECDSAKeyAlias(e){const t=e instanceof PrivateKey&&"secp256k1"===e.type,n=e instanceof PublicKey&&"secp256k1"===e.type;if(t)return e.publicKey.toEvmAddress();if(n)return e.toEvmAddress();throw new Error("Invalid key for alias derivation provided: expected an ECDSA (secp256k1) PrivateKey or PublicKey.")}_execute(e,t){return e.crypto.createAccount(t)}_getTransactionDataCase(){return"cryptoCreateAccount"}_makeTransactionData(){let e=null;return null!=this._alias&&(e=this._alias.toBytes()),{key:null!=this._key?this._key._toProtobufKey():null,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,receiveRecordThreshold:this._receiveRecordThreshold.toTinybars(),sendRecordThreshold:this._sendRecordThreshold.toTinybars(),receiverSigRequired:this._receiverSignatureRequired,memo:this._accountMemo,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?this._maxAutomaticTokenAssociations.toInt():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,alias:e}}_getLogId(){return`AccountCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoCreateAccount",AccountCreateTransaction._fromProtobuf);class AccountDeleteTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._transferAccountId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoDelete;return Transaction._fromProtobufTransactions(new AccountDeleteTransaction({accountId:null!=i.deleteAccountID?AccountId._fromProtobuf(i.deleteAccountID):void 0,transferAccountId:null!=i.transferAccountID?AccountId._fromProtobuf(i.transferAccountID):void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoDelete(t)}_getTransactionDataCase(){return"cryptoDelete"}_makeTransactionData(){return{deleteAccountID:null!=this._accountId?this._accountId._toProtobuf():null,transferAccountID:null!=this._transferAccountId?this._transferAccountId._toProtobuf():null}}_getLogId(){return`AccountDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDelete",AccountDeleteTransaction._fromProtobuf);class StakingInfo{constructor(e){this.declineStakingReward=e.declineStakingReward,this.stakePeriodStart=e.stakePeriodStart,this.pendingReward=e.pendingReward,this.stakedToMe=e.stakedToMe,this.stakedAccountId=e.stakedAccountId,this.stakedNodeId=e.stakedNodeId,Object.freeze(this)}static _fromProtobuf(e){return new StakingInfo({declineStakingReward:1==e.declineReward,stakePeriodStart:null!=e.stakePeriodStart?Timestamp._fromProtobuf(e.stakePeriodStart):null,pendingReward:null!=e.pendingReward?Hbar.fromTinybars(e.pendingReward):null,stakedToMe:null!=e.stakedToMe?Hbar.fromTinybars(e.stakedToMe):null,stakedAccountId:null!=e.stakedAccountId?AccountId._fromProtobuf(e.stakedAccountId):null,stakedNodeId:null!=e.stakedNodeId?e.stakedNodeId:null})}_toProtobuf(){return{declineReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart._toProtobuf():null,pendingReward:null!=this.pendingReward?this.pendingReward.toTinybars():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toTinybars():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId}}static fromBytes(e){return StakingInfo._fromProtobuf(libExports.proto.StakingInfo.decode(e))}toBytes(){return libExports.proto.StakingInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{declineStakingReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart.toString():null,pendingReward:null!=this.pendingReward?this.pendingReward.toString():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toString():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId.toString():null,stakedNodeId:null!=this.stakedNodeId?this.stakedNodeId.toString():null}}}class LiveHash{constructor(e){this.accountId=e.accountId,this.hash=e.hash,this.keys=e.keys,this.duration=e.duration,Object.freeze(this)}static _fromProtobuf(e){const t=e;return new LiveHash({accountId:AccountId._fromProtobuf(t.accountId),hash:null!=t.hash?t.hash:new Uint8Array,keys:null!=t.keys?KeyList.__fromProtobufKeyList(t.keys):new KeyList,duration:Duration._fromProtobuf(t.duration)})}_toProtobuf(){return{accountId:this.accountId._toProtobuf(),hash:this.hash,keys:this.keys._toProtobufKey().keyList,duration:this.duration._toProtobuf()}}}class TokenRelationship{constructor(e){this.tokenId=e.tokenId,this.symbol=e.symbol,this.balance=e.balance,this.isKycGranted=e.isKycGranted,this.isFrozen=e.isFrozen,this.automaticAssociation=e.automaticAssociation,Object.freeze(this)}static _fromProtobuf(e){const t=TokenId._fromProtobuf(e.tokenId),n=null==e.kycStatus||0===e.kycStatus?null:1===e.kycStatus,r=null==e.freezeStatus||0===e.freezeStatus?null:1===e.freezeStatus;return new TokenRelationship({tokenId:t,symbol:e.symbol,balance:null!=e.balance?e.balance instanceof Long?e.balance:Long.fromValue(e.balance):Long.ZERO,isKycGranted:n,isFrozen:r,automaticAssociation:null!=e.automaticAssociation?e.automaticAssociation:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),symbol:this.symbol,balance:this.balance,kycStatus:null==this.isKycGranted?0:this.isKycGranted?1:2,freezeStatus:null==this.isFrozen?0:this.isFrozen?1:2,automaticAssociation:this.automaticAssociation}}}class TokenRelationshipMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}static _fromProtobuf(e){const t=new TokenRelationshipMap;for(const n of e){const e=TokenId._fromProtobuf(n.tokenId);t._set(e,TokenRelationship._fromProtobuf(n))}return t}_toProtobuf(){const e=[];for(const[t,n]of this)e.push(n._toProtobuf());return e}}class LedgerId{constructor(e){this._ledgerId=e,Object.freeze(this)}static fromString(e){switch(e){case NETNAMES[0]:case"0":return LedgerId.MAINNET;case NETNAMES[1]:case"1":return LedgerId.TESTNET;case NETNAMES[2]:case"2":return LedgerId.PREVIEWNET;case NETNAMES[3]:case"3":return LedgerId.LOCAL_NODE;default:try{let t=decode$8(e);return new LedgerId(t)}catch(e){throw new Error("Default reached for fromString")}}}toString(){if(1!=this._ledgerId.length)return encode$5(this._ledgerId);switch(this._ledgerId[0]){case 0:return NETNAMES[0];case 1:return NETNAMES[1];case 2:return NETNAMES[2];case 3:return NETNAMES[3];default:return encode$5(this._ledgerId)}}static fromBytes(e){return new LedgerId(e)}toBytes(){return this._ledgerId}isMainnet(){return this.toString()==NETNAMES[0]}isTestnet(){return this.toString()==NETNAMES[1]}isPreviewnet(){return this.toString()==NETNAMES[2]}isLocalNode(){return this.toString()==NETNAMES[3]}}const NETNAMES=["mainnet","testnet","previewnet","local-node"];LedgerId.MAINNET=new LedgerId(new Uint8Array([0])),LedgerId.TESTNET=new LedgerId(new Uint8Array([1])),LedgerId.PREVIEWNET=new LedgerId(new Uint8Array([2])),LedgerId.LOCAL_NODE=new LedgerId(new Uint8Array([3]));class AccountInfo{constructor(e){this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.isDeleted=e.isDeleted,this.proxyAccountId=e.proxyAccountId,this.proxyReceived=e.proxyReceived,this.key=e.key,this.balance=e.balance,this.sendRecordThreshold=e.sendRecordThreshold,this.receiveRecordThreshold=e.receiveRecordThreshold,this.isReceiverSignatureRequired=e.isReceiverSignatureRequired,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.liveHashes=e.liveHashes,this.tokenRelationships=e.tokenRelationships,this.accountMemo=e.accountMemo,this.ownedNfts=e.ownedNfts,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.aliasKey=e.aliasKey,this.ledgerId=e.ledgerId,this.hbarAllowances=e.hbarAllowances,this.tokenAllowances=e.tokenAllowances,this.nftAllowances=e.nftAllowances,this.ethereumNonce=e.ethereumNonce,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){let t=null!=e.alias&&e.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(e.alias)):null;t instanceof PublicKey||(t=null);const n=AccountId._fromProtobuf(e.accountID);return new AccountInfo({accountId:n,contractAccountId:null!=e.contractAccountID?e.contractAccountID:null,isDeleted:null!=e.deleted&&e.deleted,key:Key._fromProtobufKey(e.key),balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),sendRecordThreshold:Hbar.fromTinybars(null!=e.generateSendRecordThreshold?e.generateSendRecordThreshold:0),receiveRecordThreshold:Hbar.fromTinybars(null!=e.generateReceiveRecordThreshold?e.generateReceiveRecordThreshold:0),isReceiverSignatureRequired:null!=e.receiverSigRequired&&e.receiverSigRequired,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:null!=e.autoRenewPeriod?new Duration(e.autoRenewPeriod.seconds):new Duration(0),proxyAccountId:null!=e.proxyAccountID&&0!==Long.fromValue(e.proxyAccountID.shardNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.realmNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.accountNum).toInt()?AccountId._fromProtobuf(e.proxyAccountID):null,proxyReceived:Hbar.fromTinybars(null!=e.proxyReceived?e.proxyReceived:0),liveHashes:(null!=e.liveHashes?e.liveHashes:[]).map(e=>LiveHash._fromProtobuf(e)),tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),accountMemo:null!=e.memo?e.memo:"",ownedNfts:e.ownedNfts?e.ownedNfts:Long.ZERO,maxAutomaticTokenAssociations:e.maxAutomaticTokenAssociations?Long.fromNumber(e.maxAutomaticTokenAssociations):Long.ZERO,aliasKey:t,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,hbarAllowances:[],tokenAllowances:[],nftAllowances:[],ethereumNonce:null!=e.ethereumNonce?e.ethereumNonce:null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,deleted:this.isDeleted,proxyAccountID:null!=this.proxyAccountId?this.proxyAccountId._toProtobuf():null,proxyReceived:this.proxyReceived.toTinybars(),key:this.key._toProtobufKey(),balance:this.balance.toTinybars(),generateSendRecordThreshold:this.sendRecordThreshold.toTinybars(),generateReceiveRecordThreshold:this.receiveRecordThreshold.toTinybars(),receiverSigRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:this.autoRenewPeriod._toProtobuf(),liveHashes:this.liveHashes.map(e=>e._toProtobuf()),tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,memo:this.accountMemo,ownedNfts:this.ownedNfts,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toInt(),alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,ethereumNonce:this.ethereumNonce,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null}}static fromBytes(e){return AccountInfo._fromProtobuf(libExports.proto.CryptoGetInfoResponse.AccountInfo.decode(e))}toBytes(){return libExports.proto.CryptoGetInfoResponse.AccountInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{balance:this.balance.toString(),accountId:this.accountId.toString(),contractAccountId:this.contractAccountId,isDeleted:this.isDeleted,proxyAccountId:null!=this.proxyAccountId?this.proxyAccountId.toString():null,proxyReceived:this.proxyReceived.toString(),key:null!=this.key?this.key.toString():null,sendRecordThreshold:this.sendRecordThreshold.toString(),receiveRecordThreshold:this.receiveRecordThreshold.toString(),isReceiverSignatureRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime.toString(),autoRenewPeriod:this.autoRenewPeriod.toString(),accountMemo:this.accountMemo,ownedNfts:this.ownedNfts.toString(),maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toString(),aliasKey:null!=this.aliasKey?this.aliasKey.toString():null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,ethereumNonce:null!=this.ethereumNonce?this.ethereumNonce.toString():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo.toJSON():null}}}class AccountInfoQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetInfo;return new AccountInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.cryptoGetInfo.header}_mapResponse(e,t,n){const r=e.cryptoGetInfo;return Promise.resolve(AccountInfo._fromProtobuf(r.accountInfo))}_onMakeRequest(e){return{cryptoGetInfo:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetInfo",AccountInfoQuery._fromProtobuf);class AccountInfoFlow{static async verifySignature(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransaction(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}static async verifySignatureWithSigner(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransactionWithSigner(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}}class AccountRecordsQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetAccountRecords;return new AccountRecordsQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountRecords(t)}_mapResponseHeader(e){return e.cryptoGetAccountRecords.header}_mapResponse(e,t,n){const r=e.cryptoGetAccountRecords.records;return Promise.resolve(r.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})))}_onMakeRequest(e){return{cryptoGetAccountRecords:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountRecordsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetAccountRecords",AccountRecordsQuery._fromProtobuf);class AccountUpdateTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._key=null,this._receiverSignatureRequired=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._expirationTime=null,this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._aliasKey=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.key&&this.setKey(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoUpdateAccount;return Transaction._fromProtobufTransactions(new AccountUpdateTransaction({accountId:null!=i.accountIDToUpdate?AccountId._fromProtobuf(i.accountIDToUpdate):void 0,key:null!=i.key?Key._fromProtobufKey(i.key):void 0,receiverSignatureRequired:null!=i.receiverSigRequiredWrapper&&Object.hasOwn(i.receiverSigRequiredWrapper,"value")?i.receiverSigRequiredWrapper.value:void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,accountMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0,maxAutomaticTokenAssociations:null!=i.maxAutomaticTokenAssociations&&null!=i.maxAutomaticTokenAssociations.value&&Object.hasOwn(i.maxAutomaticTokenAssociations,"value")?Long.fromNumber(i.maxAutomaticTokenAssociations.value):void 0,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:null!=i.declineReward&&Object.hasOwn(i.declineReward,"value")?i.declineReward.value:void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}clearAccountMemo(){return this._requireNotFrozen(),this._accountMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get aliasKey(){return null}setAliasKey(e){return this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearStakedAccountId(){return this._requireNotFrozen(),this._stakedAccountId=new AccountId(0,0,0),this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}clearStakedNodeId(){return this._requireNotFrozen(),this._stakedNodeId=Long.fromNumber(-1),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.updateAccount(t)}_getTransactionDataCase(){return"cryptoUpdateAccount"}_makeTransactionData(){return{accountIDToUpdate:null!=this._accountId?this._accountId._toProtobuf():null,key:null!=this._key?this._key._toProtobufKey():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,receiverSigRequiredWrapper:null==this._receiverSignatureRequired?null:{value:this._receiverSignatureRequired},memo:null!=this._accountMemo?{value:this._accountMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations.toInt()}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null}}_getLogId(){return`AccountUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoUpdateAccount",AccountUpdateTransaction._fromProtobuf);class FreezeType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FreezeType.UnknownFreezeType:return"UNKNOWN_FREEZE_TYPE";case FreezeType.FreezeOnly:return"FREEZE_ONLY";case FreezeType.PrepareUpgrade:return"PREPARE_UPGRADE";case FreezeType.FreezeUpgrade:return"FREEZE_UPGRADE";case FreezeType.FreezeAbort:return"FREEZE_ABORT";case FreezeType.TelemetryUpgrade:return"TELEMETRY_UPGRADE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FreezeType.UnknownFreezeType;case 1:return FreezeType.FreezeOnly;case 2:return FreezeType.PrepareUpgrade;case 3:return FreezeType.FreezeUpgrade;case 4:return FreezeType.FreezeAbort;case 5:return FreezeType.TelemetryUpgrade;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}FreezeType.UnknownFreezeType=new FreezeType(0),FreezeType.FreezeOnly=new FreezeType(1),FreezeType.PrepareUpgrade=new FreezeType(2),FreezeType.FreezeUpgrade=new FreezeType(3),FreezeType.FreezeAbort=new FreezeType(4),FreezeType.TelemetryUpgrade=new FreezeType(5);class FreezeTransaction extends Transaction{constructor(e={}){super(),this._startTime=null,this._startTimestamp=null,this._endTime=null,this._fileId=null,this._fileHash=null,this._freezeType=null,null!=e.startTime&&this.setStartTime(e.startTime.hour,e.startTime.minute),null!=e.endTime&&this.setEndTime(e.endTime.hour,e.endTime.minute),null!=e.startTimestamp&&this.setStartTimestamp(e.startTimestamp),null!=e.updateFileId&&this.setUpdateFileId(e.updateFileId),null!=e.fileId&&this.setFileId(e.fileId),null!=e.fileHash&&this.setFileHash(e.fileHash),null!=e.freezeType&&this.setFreezeType(e.freezeType)}static _fromProtobuf(e,t,n,r,o){const i=o[0].freeze;return Transaction._fromProtobufTransactions(new FreezeTransaction({startTime:null!=i.startHour&&null!=i.startMin?{hour:i.startHour,minute:i.startMin}:void 0,endTime:null!=i.endHour&&null!=i.endMin?{hour:i.endHour,minute:i.endMin}:void 0,startTimestamp:null!=i.startTime?Timestamp._fromProtobuf(i.startTime):void 0,updateFileId:null!=i.updateFile?FileId._fromProtobuf(i.updateFile):void 0,fileHash:null!=i.fileHash?i.fileHash:void 0,freezeType:null!=i.freezeType?FreezeType._fromCode(i.freezeType):void 0}),e,t,n,r,o)}get startTime(){return null}setStartTime(e,t){if(this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._startTime={hour:Number(t[0]),minute:Number(t[1])}}else this._startTime={hour:e,minute:t};return this}get startTimestamp(){return this._startTimestamp}setStartTimestamp(e){return this._requireNotFrozen(),this._startTimestamp=e,this}get endTime(){return console.warn("`FreezeTransaction.endTime` is deprecated"),this._endTime}setEndTime(e,t){if(console.warn("`FreezeTransaction.endTime` is deprecated"),this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._endTime={hour:Number(t[0]),minute:Number(t[1])}}else this._endTime={hour:e,minute:t};return this}get updateFileId(){return this.fileId}setUpdateFileId(e){return this.setFileId(e)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e,this}get fileHash(){return this._fileHash}setFileHash(e){return this._requireNotFrozen(),this._fileHash="string"==typeof e?decode$8(e):e,this}get freezeType(){return this._freezeType}setFreezeType(e){return this._requireNotFrozen(),this._freezeType=e,this}_getTransactionDataCase(){return"freeze"}_makeTransactionData(){return{startTime:null!=this._startTimestamp?this._startTimestamp._toProtobuf():null,updateFile:null!=this._fileId?this._fileId._toProtobuf():null,fileHash:this._fileHash,freezeType:null!=this._freezeType?this._freezeType.valueOf():null}}_getLogId(){return`FreezeTransaction:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.freeze.freeze(t)}}TRANSACTION_REGISTRY.set("freeze",FreezeTransaction._fromProtobuf);class BatchTransaction extends Transaction{constructor(e){super(),this._batchTransactions=e?.transactions||[]}setInnerTransactions(e){return e.forEach(e=>this._validateTransaction(e)),this._batchTransactions=e,this}addInnerTransaction(e){return this._validateTransaction(e),this._requireNotFrozen(),this._batchTransactions.push(e),this}get innerTransactions(){return this._batchTransactions}get innerTransactionIds(){return Array.isArray(this._batchTransactions)?this._batchTransactions.map(e=>e.transactionId):[]}_makeTransactionData(){if(!Array.isArray(this._batchTransactions))return{transactions:[]};return{transactions:this._batchTransactions.map(e=>libExports.proto.SignedTransaction.encode(e._signedTransactions.get(0)).finish())}}static _fromProtobuf(e,t,n,r,o){const i=o[0],a=i.atomicBatch?.transactions,s=a?.map(e=>libExports.proto.SignedTransaction.decode(e)),c=s?.map(e=>{const t=libExports.proto.TransactionBody.decode(e.bodyBytes),n=t.data;if(!n)throw new Error("Transaction type not found");const r=TRANSACTION_REGISTRY.get(n);if(!r)throw new Error("fromProtobuf not found");return r([],[e],[],[],[t])});return Transaction._fromProtobufTransactions(new BatchTransaction({transactions:c}),e,t,n,r,o)}_getTransactionDataCase(){return"atomicBatch"}_getLogId(){return`AtomicBatch:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.util.atomicBatch(t)}_validateTransaction(e){if(e instanceof BatchTransaction||e instanceof FreezeTransaction)throw new Error("Transaction is not allowed to be added to a batch");if(!e.isFrozen())throw new Error("Transaction must be frozen before being added to a batch");if(!e.batchKey)throw new Error("Transaction must have a batch key")}}TRANSACTION_REGISTRY.set("atomicBatch",BatchTransaction._fromProtobuf);class ContractByteCodeQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetBytecode;return new ContractByteCodeQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractGetBytecode(t)}_mapResponseHeader(e){return e.contractGetBytecodeResponse.header}_mapResponse(e){const t=e.contractGetBytecodeResponse;return Promise.resolve(null!=t.bytecode?t.bytecode:new Uint8Array)}_onMakeRequest(e){return{contractGetBytecode:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractByteCodeQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetBytecode",ContractByteCodeQuery._fromProtobuf);const HEX_CHARS="0123456789abcdef".split(""),KECCAK_PADDING=[1,256,65536,16777216],SHIFT=[0,8,16,24],RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update=(e,t)=>{for(var n,r,o=t.length,i=e.blocks,a=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<o;){if(e.reset)for(e.reset=!1,i[0]=e.block,n=1;n<s+1;++n)i[n]=0;if("string"!=typeof t)for(n=e.start;l<o&&n<a;++l)i[n>>2]|=t[l]<<SHIFT[3&n++];else for(n=e.start;l<o&&n<a;++l)(r=t.charCodeAt(l))<128?i[n>>2]|=r<<SHIFT[3&n++]:r<2048?(i[n>>2]|=(192|r>>6)<<SHIFT[3&n++],i[n>>2]|=(128|63&r)<<SHIFT[3&n++]):r<55296||r>=57344?(i[n>>2]|=(224|r>>12)<<SHIFT[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],i[n>>2]|=(128|63&r)<<SHIFT[3&n++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++l)),i[n>>2]|=(240|r>>18)<<SHIFT[3&n++],i[n>>2]|=(128|r>>12&63)<<SHIFT[3&n++],i[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],i[n>>2]|=(128|63&r)<<SHIFT[3&n++]);if(e.lastByteIndex=n,n>=a){for(e.start=n-a,e.block=i[s],n=0;n<s;++n)u[n]^=i[n];f(u),e.reset=!0}else e.start=n}if(i[(n=e.lastByteIndex)>>2]|=KECCAK_PADDING[3&n],e.lastByteIndex===a)for(i[0]=i[s],n=1;n<s+1;++n)i[n]=0;for(i[s-1]|=2147483648,n=0;n<s;++n)u[n]^=i[n];f(u);var d,p="",h=0;for(n=0;h<c;){for(n=0;n<s&&h<c;++n,++h)d=u[n],p+=HEX_CHARS[d>>4&15]+HEX_CHARS[15&d]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15];h%s===0&&(f(u),n=0)}return"0x"+p},f=e=>{var t,n,r,o,i,a,s,c,u,l,d,p,h,f,y,m,g,_,b,I,T,k,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,K,M,H,j,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ie,ae,se,ce,ue;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=i^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(p<<1|h>>>31),n=u^(h<<1|p>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(o<<1|i>>>31),n=d^(i<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,f=e[0],y=e[1],$=e[11]<<4|e[10]>>>28,z=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,w=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,re=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,K=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,T=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,E=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,M=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=f^~m&_,e[1]=y^~g&b,e[10]=w^~v&O,e[11]=A^~E&N,e[20]=B^~x&U,e[21]=L^~F&K,e[30]=q^~$&W,e[31]=V^~z&Y,e[40]=ee^~ne&oe,e[41]=te^~re&ie,e[2]=m^~_&I,e[3]=g^~b&T,e[12]=v^~O&P,e[13]=E^~N&R,e[22]=x^~U&M,e[23]=F^~K&H,e[32]=$^~W&Q,e[33]=z^~Y&X,e[42]=ne^~oe&ae,e[43]=re^~ie&se,e[4]=_^~I&k,e[5]=b^~T&S,e[14]=O^~P&C,e[15]=N^~R&D,e[24]=U^~M&j,e[25]=K^~H&G,e[34]=W^~Q&Z,e[35]=Y^~X&J,e[44]=oe^~ae&ce,e[45]=ie^~se&ue,e[6]=I^~k&f,e[7]=T^~S&y,e[16]=P^~C&w,e[17]=R^~D&A,e[26]=M^~j&B,e[27]=H^~G&L,e[36]=Q^~Z&q,e[37]=X^~J&V,e[46]=ae^~ce&ee,e[47]=se^~ue&te,e[8]=k^~f&m,e[9]=S^~y&g,e[18]=C^~w&v,e[19]=D^~A&E,e[28]=j^~B&x,e[29]=G^~L&F,e[38]=Z^~q&$,e[39]=J^~V&z,e[48]=ce^~ee&ne,e[49]=ue^~te&re,e[0]^=RC[r],e[1]^=RC[r+1]},keccak=e=>t=>{var n;if("0x"===t.slice(0,2)){n=[];for(var r=2,o=t.length;r<o;r+=2)n.push(parseInt(t.slice(r,r+2),16))}else n=t;return update(Keccak(e),n)},keccak256=keccak(256),ArgumentType={uint8:0,int8:1,uint16:2,int16:3,uint24:4,int24:5,uint32:6,int32:7,uint40:8,int40:9,uint48:10,int48:11,uint56:12,int56:13,uint64:14,int64:15,uint72:16,int72:17,uint80:18,int80:19,uint88:20,int88:21,uint96:22,int96:23,uint104:24,int104:25,uint112:26,int112:27,uint120:28,int120:29,uint128:30,int128:31,uint136:32,int136:33,uint144:34,int144:35,uint152:36,int152:37,uint160:38,int160:39,uint168:40,int168:41,uint176:42,int176:43,uint184:44,int184:45,uint192:46,int192:47,uint200:48,int200:49,uint208:50,int208:51,uint216:52,int216:53,uint224:54,int224:55,uint232:56,int232:57,uint240:58,int240:59,uint248:60,int248:61,uint256:62,int256:63,string:64,bool:65,bytes:66,bytes32:67,address:68,func:69};class ContractFunctionSelector{constructor(e){this.name=null,this._params="",this._paramTypes=[],null!=e&&(this._name=e)}addString(){return this._addParam({ty:ArgumentType.string,array:!1})}addStringArray(){return this._addParam({ty:ArgumentType.string,array:!0})}addBytes(){return this._addParam({ty:ArgumentType.bytes,array:!1})}addBytes32(){return this._addParam({ty:ArgumentType.bytes32,array:!1})}addBytesArray(){return this._addParam({ty:ArgumentType.bytes,array:!0})}addBytes32Array(){return this._addParam({ty:ArgumentType.bytes32,array:!0})}addInt8(){return this._addParam({ty:ArgumentType.int8,array:!1})}addUint8(){return this._addParam({ty:ArgumentType.uint8,array:!1})}addInt16(){return this._addParam({ty:ArgumentType.int16,array:!1})}addUint16(){return this._addParam({ty:ArgumentType.uint16,array:!1})}addInt24(){return this._addParam({ty:ArgumentType.int24,array:!1})}addUint24(){return this._addParam({ty:ArgumentType.uint24,array:!1})}addInt32(){return this._addParam({ty:ArgumentType.int32,array:!1})}addUint32(){return this._addParam({ty:ArgumentType.uint32,array:!1})}addInt40(){return this._addParam({ty:ArgumentType.int40,array:!1})}addUint40(){return this._addParam({ty:ArgumentType.uint40,array:!1})}addInt48(){return this._addParam({ty:ArgumentType.int48,array:!1})}addUint48(){return this._addParam({ty:ArgumentType.uint48,array:!1})}addInt56(){return this._addParam({ty:ArgumentType.int56,array:!1})}addUint56(){return this._addParam({ty:ArgumentType.uint56,array:!1})}addInt64(){return this._addParam({ty:ArgumentType.int64,array:!1})}addUint64(){return this._addParam({ty:ArgumentType.uint64,array:!1})}addInt72(){return this._addParam({ty:ArgumentType.int72,array:!1})}addUint72(){return this._addParam({ty:ArgumentType.uint72,array:!1})}addInt80(){return this._addParam({ty:ArgumentType.int80,array:!1})}addUint80(){return this._addParam({ty:ArgumentType.uint80,array:!1})}addInt88(){return this._addParam({ty:ArgumentType.int88,array:!1})}addUint88(){return this._addParam({ty:ArgumentType.uint88,array:!1})}addInt96(){return this._addParam({ty:ArgumentType.int96,array:!1})}addUint96(){return this._addParam({ty:ArgumentType.uint96,array:!1})}addInt104(){return this._addParam({ty:ArgumentType.int104,array:!1})}addUint104(){return this._addParam({ty:ArgumentType.uint104,array:!1})}addInt112(){return this._addParam({ty:ArgumentType.int112,array:!1})}addUint112(){return this._addParam({ty:ArgumentType.uint112,array:!1})}addInt120(){return this._addParam({ty:ArgumentType.int120,array:!1})}addUint120(){return this._addParam({ty:ArgumentType.uint120,array:!1})}addInt128(){return this._addParam({ty:ArgumentType.int128,array:!1})}addUint128(){return this._addParam({ty:ArgumentType.uint128,array:!1})}addInt136(){return this._addParam({ty:ArgumentType.int136,array:!1})}addUint136(){return this._addParam({ty:ArgumentType.uint136,array:!1})}addInt144(){return this._addParam({ty:ArgumentType.int144,array:!1})}addUint144(){return this._addParam({ty:ArgumentType.uint144,array:!1})}addInt152(){return this._addParam({ty:ArgumentType.int152,array:!1})}addUint152(){return this._addParam({ty:ArgumentType.uint152,array:!1})}addInt160(){return this._addParam({ty:ArgumentType.int160,array:!1})}addUint160(){return this._addParam({ty:ArgumentType.uint160,array:!1})}addInt168(){return this._addParam({ty:ArgumentType.int168,array:!1})}addUint168(){return this._addParam({ty:ArgumentType.uint168,array:!1})}addInt176(){return this._addParam({ty:ArgumentType.int176,array:!1})}addUint176(){return this._addParam({ty:ArgumentType.uint176,array:!1})}addInt184(){return this._addParam({ty:ArgumentType.int184,array:!1})}addUint184(){return this._addParam({ty:ArgumentType.uint184,array:!1})}addInt192(){return this._addParam({ty:ArgumentType.int192,array:!1})}addUint192(){return this._addParam({ty:ArgumentType.uint192,array:!1})}addInt200(){return this._addParam({ty:ArgumentType.int200,array:!1})}addUint200(){return this._addParam({ty:ArgumentType.uint200,array:!1})}addInt208(){return this._addParam({ty:ArgumentType.int208,array:!1})}addUint208(){return this._addParam({ty:ArgumentType.uint208,array:!1})}addInt216(){return this._addParam({ty:ArgumentType.int216,array:!1})}addUint216(){return this._addParam({ty:ArgumentType.uint216,array:!1})}addInt224(){return this._addParam({ty:ArgumentType.int224,array:!1})}addUint224(){return this._addParam({ty:ArgumentType.uint224,array:!1})}addInt232(){return this._addParam({ty:ArgumentType.int232,array:!1})}addUint232(){return this._addParam({ty:ArgumentType.uint232,array:!1})}addInt240(){return this._addParam({ty:ArgumentType.int240,array:!1})}addUint240(){return this._addParam({ty:ArgumentType.uint240,array:!1})}addInt248(){return this._addParam({ty:ArgumentType.int248,array:!1})}addUint248(){return this._addParam({ty:ArgumentType.uint248,array:!1})}addInt256(){return this._addParam({ty:ArgumentType.int256,array:!1})}addUint256(){return this._addParam({ty:ArgumentType.uint256,array:!1})}addInt8Array(){return this._addParam({ty:ArgumentType.int8,array:!0})}addUint8Array(){return this._addParam({ty:ArgumentType.uint8,array:!0})}addInt16Array(){return this._addParam({ty:ArgumentType.int16,array:!0})}addUint16Array(){return this._addParam({ty:ArgumentType.uint16,array:!0})}addInt24Array(){return this._addParam({ty:ArgumentType.int24,array:!0})}addUint24Array(){return this._addParam({ty:ArgumentType.uint24,array:!0})}addInt32Array(){return this._addParam({ty:ArgumentType.int32,array:!0})}addUint32Array(){return this._addParam({ty:ArgumentType.uint32,array:!0})}addInt40Array(){return this._addParam({ty:ArgumentType.int40,array:!0})}addUint40Array(){return this._addParam({ty:ArgumentType.uint40,array:!0})}addInt48Array(){return this._addParam({ty:ArgumentType.int48,array:!0})}addUint48Array(){return this._addParam({ty:ArgumentType.uint48,array:!0})}addInt56Array(){return this._addParam({ty:ArgumentType.int56,array:!0})}addUint56Array(){return this._addParam({ty:ArgumentType.uint56,array:!0})}addInt64Array(){return this._addParam({ty:ArgumentType.int64,array:!0})}addUint64Array(){return this._addParam({ty:ArgumentType.uint64,array:!0})}addInt72Array(){return this._addParam({ty:ArgumentType.int72,array:!0})}addUint72Array(){return this._addParam({ty:ArgumentType.uint72,array:!0})}addInt80Array(){return this._addParam({ty:ArgumentType.int80,array:!0})}addUint80Array(){return this._addParam({ty:ArgumentType.uint80,array:!0})}addInt88Array(){return this._addParam({ty:ArgumentType.int88,array:!0})}addUint88Array(){return this._addParam({ty:ArgumentType.uint88,array:!0})}addInt96Array(){return this._addParam({ty:ArgumentType.int96,array:!0})}addUint96Array(){return this._addParam({ty:ArgumentType.uint96,array:!0})}addInt104Array(){return this._addParam({ty:ArgumentType.int104,array:!0})}addUint104Array(){return this._addParam({ty:ArgumentType.uint104,array:!0})}addInt112Array(){return this._addParam({ty:ArgumentType.int112,array:!0})}addUint112Array(){return this._addParam({ty:ArgumentType.uint112,array:!0})}addInt120Array(){return this._addParam({ty:ArgumentType.int120,array:!0})}addUint120Array(){return this._addParam({ty:ArgumentType.uint120,array:!0})}addInt128Array(){return this._addParam({ty:ArgumentType.int128,array:!0})}addUint128Array(){return this._addParam({ty:ArgumentType.uint128,array:!0})}addInt136Array(){return this._addParam({ty:ArgumentType.int136,array:!0})}addUint136Array(){return this._addParam({ty:ArgumentType.uint136,array:!0})}addInt144Array(){return this._addParam({ty:ArgumentType.int144,array:!0})}addUint144Array(){return this._addParam({ty:ArgumentType.uint144,array:!0})}addInt152Array(){return this._addParam({ty:ArgumentType.int152,array:!0})}addUint152Array(){return this._addParam({ty:ArgumentType.uint152,array:!0})}addInt160Array(){return this._addParam({ty:ArgumentType.int160,array:!0})}addUint160Array(){return this._addParam({ty:ArgumentType.uint160,array:!0})}addInt168Array(){return this._addParam({ty:ArgumentType.int168,array:!0})}addUint168Array(){return this._addParam({ty:ArgumentType.uint168,array:!0})}addInt176Array(){return this._addParam({ty:ArgumentType.int176,array:!0})}addUint176Array(){return this._addParam({ty:ArgumentType.uint176,array:!0})}addInt184Array(){return this._addParam({ty:ArgumentType.int184,array:!0})}addUint184Array(){return this._addParam({ty:ArgumentType.uint184,array:!0})}addInt192Array(){return this._addParam({ty:ArgumentType.int192,array:!0})}addUint192Array(){return this._addParam({ty:ArgumentType.uint192,array:!0})}addInt200Array(){return this._addParam({ty:ArgumentType.int200,array:!0})}addUint200Array(){return this._addParam({ty:ArgumentType.uint200,array:!0})}addInt208Array(){return this._addParam({ty:ArgumentType.int208,array:!0})}addUint208Array(){return this._addParam({ty:ArgumentType.uint208,array:!0})}addInt216Array(){return this._addParam({ty:ArgumentType.int216,array:!0})}addUint216Array(){return this._addParam({ty:ArgumentType.uint216,array:!0})}addInt224Array(){return this._addParam({ty:ArgumentType.int224,array:!0})}addUint224Array(){return this._addParam({ty:ArgumentType.uint224,array:!0})}addInt232Array(){return this._addParam({ty:ArgumentType.int232,array:!0})}addUint232Array(){return this._addParam({ty:ArgumentType.uint232,array:!0})}addInt240Array(){return this._addParam({ty:ArgumentType.int240,array:!0})}addUint240Array(){return this._addParam({ty:ArgumentType.uint240,array:!0})}addInt248Array(){return this._addParam({ty:ArgumentType.int248,array:!0})}addUint248Array(){return this._addParam({ty:ArgumentType.uint248,array:!0})}addInt256Array(){return this._addParam({ty:ArgumentType.int256,array:!0})}addUint256Array(){return this._addParam({ty:ArgumentType.uint256,array:!0})}addBool(){return this._addParam({ty:ArgumentType.bool,array:!1})}addAddress(){return this._addParam({ty:ArgumentType.address,array:!1})}addAddressArray(){return this._addParam({ty:ArgumentType.address,array:!0})}addFunction(){return this._addParam({ty:ArgumentType.func,array:!1})}_addParam(e){return this._paramTypes.length>0&&(this._params+=","),this._params+=solidityTypeToString(e),this._paramTypes.push(e),this}_build(e){if(null!=e)this._name=e;else if(null==this._name)throw new Error("`name` required for ContractFunctionSelector");const t=encode$5(encode$1(this.toString()));return decode$8(keccak256(`0x${t}`)).slice(0,4)}toString(){return`${null!=this._name?this._name.toString():""}(${this._params})`}}function solidityTypeToString(e){let t="";switch(e.ty){case ArgumentType.uint8:t="uint8";break;case ArgumentType.int8:t="int8";break;case ArgumentType.uint16:t="uint16";break;case ArgumentType.int16:t="int16";break;case ArgumentType.uint24:t="uint24";break;case ArgumentType.int24:t="int24";break;case ArgumentType.uint32:t="uint32";break;case ArgumentType.int32:t="int32";break;case ArgumentType.uint40:t="uint40";break;case ArgumentType.int40:t="int40";break;case ArgumentType.uint48:t="uint48";break;case ArgumentType.int48:t="int48";break;case ArgumentType.uint56:t="uint56";break;case ArgumentType.int56:t="int56";break;case ArgumentType.uint64:t="uint64";break;case ArgumentType.int64:t="int64";break;case ArgumentType.uint72:t="uint72";break;case ArgumentType.int72:t="int72";break;case ArgumentType.uint80:t="uint80";break;case ArgumentType.int80:t="int80";break;case ArgumentType.uint88:t="uint88";break;case ArgumentType.int88:t="int88";break;case ArgumentType.uint96:t="uint96";break;case ArgumentType.int96:t="int96";break;case ArgumentType.uint104:t="uint104";break;case ArgumentType.int104:t="int104";break;case ArgumentType.uint112:t="uint112";break;case ArgumentType.int112:t="int112";break;case ArgumentType.uint120:t="uint120";break;case ArgumentType.int120:t="int120";break;case ArgumentType.uint128:t="uint128";break;case ArgumentType.int128:t="int128";break;case ArgumentType.uint136:t="uint136";break;case ArgumentType.int136:t="int136";break;case ArgumentType.uint144:t="uint144";break;case ArgumentType.int144:t="int144";break;case ArgumentType.uint152:t="uint152";break;case ArgumentType.int152:t="int152";break;case ArgumentType.uint160:t="uint160";break;case ArgumentType.int160:t="int160";break;case ArgumentType.uint168:t="uint168";break;case ArgumentType.int168:t="int168";break;case ArgumentType.uint176:t="uint176";break;case ArgumentType.int176:t="int176";break;case ArgumentType.uint184:t="uint184";break;case ArgumentType.int184:t="int184";break;case ArgumentType.uint192:t="uint192";break;case ArgumentType.int192:t="int192";break;case ArgumentType.uint200:t="uint200";break;case ArgumentType.int200:t="int200";break;case ArgumentType.uint208:t="uint208";break;case ArgumentType.int208:t="int208";break;case ArgumentType.uint216:t="uint216";break;case ArgumentType.int216:t="int216";break;case ArgumentType.uint224:t="uint224";break;case ArgumentType.int224:t="int224";break;case ArgumentType.uint232:t="uint232";break;case ArgumentType.int232:t="int232";break;case ArgumentType.uint240:t="uint240";break;case ArgumentType.int240:t="int240";break;case ArgumentType.uint248:t="uint248";break;case ArgumentType.int248:t="int248";break;case ArgumentType.uint256:t="uint256";break;case ArgumentType.int256:t="int256";break;case ArgumentType.string:t="string";break;case ArgumentType.bool:t="bool";break;case ArgumentType.bytes:t="bytes";break;case ArgumentType.bytes32:t="bytes32";break;case ArgumentType.address:t="address";break;case ArgumentType.func:t="function";break;default:t=""}return e.array&&(t+="[]"),t}class ContractFunctionParameters{constructor(){this._selector=new ContractFunctionSelector,this._arguments=[]}addString(e){return this._selector.addString(),this._addParam(e,!0)}addStringArray(e){return this._selector.addStringArray(),this._addParam(e,!0)}addBytes(e){return this._selector.addBytes(),this._addParam(e,!0)}addBytes32(e){if(32!==e.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${e.length}`);return this._selector.addBytes32(),this._addParam(e,!1)}addBytesArray(e){return this._selector.addBytesArray(),this._addParam(e,!0)}addBytes32Array(e){for(const[t,n]of e.entries())if(32!==n.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${n.length}`);return this._selector.addBytes32Array(),this._addParam(e,!0)}addBool(e){return this._selector.addBool(),this._addParam(e,!1)}addInt8(e){return this._selector.addInt8(),this._addParam(convertToBigNumber(e),!1)}addUint8(e){return this._selector.addUint8(),this._addParam(convertToBigNumber(e),!1)}addInt16(e){return this._selector.addInt16(),this._addParam(convertToBigNumber(e),!1)}addUint16(e){return this._selector.addUint16(),this._addParam(convertToBigNumber(e),!1)}addInt24(e){return this._selector.addInt24(),this._addParam(convertToBigNumber(e),!1)}addUint24(e){return this._selector.addUint24(),this._addParam(convertToBigNumber(e),!1)}addInt32(e){return this._selector.addInt32(),this._addParam(convertToBigNumber(e),!1)}addUint32(e){return this._selector.addUint32(),this._addParam(convertToBigNumber(e),!1)}addInt40(e){return this._selector.addInt40(),this._addParam(convertToBigNumber(e),!1)}addUint40(e){return this._selector.addUint40(),this._addParam(convertToBigNumber(e),!1)}addInt48(e){return this._selector.addInt48(),this._addParam(convertToBigNumber(e),!1)}addUint48(e){return this._selector.addUint48(),this._addParam(convertToBigNumber(e),!1)}addInt56(e){return this._selector.addInt56(),this._addParam(convertToBigNumber(e),!1)}addUint56(e){return this._selector.addUint56(),this._addParam(convertToBigNumber(e),!1)}addInt64(e){return this._selector.addInt64(),this._addParam(convertToBigNumber(e),!1)}addUint64(e){return this._selector.addUint64(),this._addParam(convertToBigNumber(e),!1)}addInt72(e){return this._selector.addInt72(),this._addParam(convertToBigNumber(e),!1)}addUint72(e){return this._selector.addUint72(),this._addParam(convertToBigNumber(e),!1)}addInt80(e){return this._selector.addInt80(),this._addParam(convertToBigNumber(e),!1)}addUint80(e){return this._selector.addUint80(),this._addParam(convertToBigNumber(e),!1)}addInt88(e){return this._selector.addInt88(),this._addParam(convertToBigNumber(e),!1)}addUint88(e){return this._selector.addUint88(),this._addParam(convertToBigNumber(e),!1)}addInt96(e){return this._selector.addInt96(),this._addParam(convertToBigNumber(e),!1)}addUint96(e){return this._selector.addUint96(),this._addParam(convertToBigNumber(e),!1)}addInt104(e){return this._selector.addInt104(),this._addParam(convertToBigNumber(e),!1)}addUint104(e){return this._selector.addUint104(),this._addParam(convertToBigNumber(e),!1)}addInt112(e){return this._selector.addInt112(),this._addParam(convertToBigNumber(e),!1)}addUint112(e){return this._selector.addUint112(),this._addParam(convertToBigNumber(e),!1)}addInt120(e){return this._selector.addInt120(),this._addParam(convertToBigNumber(e),!1)}addUint120(e){return this._selector.addUint120(),this._addParam(convertToBigNumber(e),!1)}addInt128(e){return this._selector.addInt128(),this._addParam(convertToBigNumber(e),!1)}addUint128(e){return this._selector.addUint128(),this._addParam(convertToBigNumber(e),!1)}addInt136(e){return this._selector.addInt136(),this._addParam(convertToBigNumber(e),!1)}addUint136(e){return this._selector.addUint136(),this._addParam(convertToBigNumber(e),!1)}addInt144(e){return this._selector.addInt144(),this._addParam(convertToBigNumber(e),!1)}addUint144(e){return this._selector.addUint144(),this._addParam(convertToBigNumber(e),!1)}addInt152(e){return this._selector.addInt152(),this._addParam(convertToBigNumber(e),!1)}addUint152(e){return this._selector.addUint152(),this._addParam(convertToBigNumber(e),!1)}addInt160(e){return this._selector.addInt160(),this._addParam(convertToBigNumber(e),!1)}addUint160(e){return this._selector.addUint160(),this._addParam(convertToBigNumber(e),!1)}addInt168(e){return this._selector.addInt168(),this._addParam(convertToBigNumber(e),!1)}addUint168(e){return this._selector.addUint168(),this._addParam(convertToBigNumber(e),!1)}addInt176(e){return this._selector.addInt176(),this._addParam(convertToBigNumber(e),!1)}addUint176(e){return this._selector.addUint176(),this._addParam(convertToBigNumber(e),!1)}addInt184(e){return this._selector.addInt184(),this._addParam(convertToBigNumber(e),!1)}addUint184(e){return this._selector.addUint184(),this._addParam(convertToBigNumber(e),!1)}addInt192(e){return this._selector.addInt192(),this._addParam(convertToBigNumber(e),!1)}addUint192(e){return this._selector.addUint192(),this._addParam(convertToBigNumber(e),!1)}addInt200(e){return this._selector.addInt200(),this._addParam(convertToBigNumber(e),!1)}addUint200(e){return this._selector.addUint200(),this._addParam(convertToBigNumber(e),!1)}addInt208(e){return this._selector.addInt208(),this._addParam(convertToBigNumber(e),!1)}addUint208(e){return this._selector.addUint208(),this._addParam(convertToBigNumber(e),!1)}addInt216(e){return this._selector.addInt216(),this._addParam(convertToBigNumber(e),!1)}addUint216(e){return this._selector.addUint216(),this._addParam(convertToBigNumber(e),!1)}addInt224(e){return this._selector.addInt224(),this._addParam(convertToBigNumber(e),!1)}addUint224(e){return this._selector.addUint224(),this._addParam(convertToBigNumber(e),!1)}addInt232(e){return this._selector.addInt232(),this._addParam(convertToBigNumber(e),!1)}addUint232(e){return this._selector.addUint232(),this._addParam(convertToBigNumber(e),!1)}addInt240(e){return this._selector.addInt240(),this._addParam(convertToBigNumber(e),!1)}addUint240(e){return this._selector.addUint240(),this._addParam(convertToBigNumber(e),!1)}addInt248(e){return this._selector.addInt248(),this._addParam(convertToBigNumber(e),!1)}addUint248(e){return this._selector.addUint248(),this._addParam(convertToBigNumber(e),!1)}addInt256(e){return this._selector.addInt256(),this._addParam(convertToBigNumber(e),!1)}addUint256(e){return this._selector.addUint256(),this._addParam(convertToBigNumber(e),!1)}addInt8Array(e){return this._selector.addInt8Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint8Array(e){return this._selector.addUint8Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt16Array(e){return this._selector.addInt16Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint16Array(e){return this._selector.addUint16Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt24Array(e){return this._selector.addInt24Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint24Array(e){return this._selector.addUint24Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt32Array(e){return this._selector.addInt32Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint32Array(e){return this._selector.addUint32Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt40Array(e){return this._selector.addInt40Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint40Array(e){return this._selector.addUint40Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt48Array(e){return this._selector.addInt48Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint48Array(e){return this._selector.addUint48Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt56Array(e){return this._selector.addInt56Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint56Array(e){return this._selector.addUint56Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt64Array(e){return this._selector.addInt64Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint64Array(e){return this._selector.addUint64Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt72Array(e){return this._selector.addInt72Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint72Array(e){return this._selector.addUint72Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt80Array(e){return this._selector.addInt80Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint80Array(e){return this._selector.addUint80Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt88Array(e){return this._selector.addInt88Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint88Array(e){return this._selector.addUint88Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt96Array(e){return this._selector.addInt96Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint96Array(e){return this._selector.addUint96Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt104Array(e){return this._selector.addInt104Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint104Array(e){return this._selector.addUint104Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt112Array(e){return this._selector.addInt112Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint112Array(e){return this._selector.addUint112Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt120Array(e){return this._selector.addInt120Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint120Array(e){return this._selector.addUint120Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt128Array(e){return this._selector.addInt128Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint128Array(e){return this._selector.addUint128Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt136Array(e){return this._selector.addInt136Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint136Array(e){return this._selector.addUint136Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt144Array(e){return this._selector.addInt144Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint144Array(e){return this._selector.addUint144Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt152Array(e){return this._selector.addInt152Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint152Array(e){return this._selector.addUint152Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt160Array(e){return this._selector.addInt160Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint160Array(e){return this._selector.addUint160Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt168Array(e){return this._selector.addInt168Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint168Array(e){return this._selector.addUint168Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt176Array(e){return this._selector.addInt176Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint176Array(e){return this._selector.addUint176Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt184Array(e){return this._selector.addInt184Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint184Array(e){return this._selector.addUint184Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt192Array(e){return this._selector.addInt192Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint192Array(e){return this._selector.addUint192Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt200Array(e){return this._selector.addInt200Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint200Array(e){return this._selector.addUint200Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt208Array(e){return this._selector.addInt208Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint208Array(e){return this._selector.addUint208Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt216Array(e){return this._selector.addInt216Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint216Array(e){return this._selector.addUint216Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt224Array(e){return this._selector.addInt224Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint224Array(e){return this._selector.addUint224Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt232Array(e){return this._selector.addInt232Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint232Array(e){return this._selector.addUint232Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt240Array(e){return this._selector.addInt240Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint240Array(e){return this._selector.addUint240Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt248Array(e){return this._selector.addInt248Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint248Array(e){return this._selector.addUint248Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt256Array(e){return this._selector.addInt256Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint256Array(e){return this._selector.addUint256Array(),this._addParam(convertToBigNumberArray(e),!0)}addAddress(e){let t;if("string"==typeof e){if(40!==e.length&&42!==e.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");t=e}else t=e.toString();const n=40===t.length?decode$8(t):decode$8(t.substring(2));return this._selector.addAddress(),this._addParam(n,!1)}addAddressArray(e){const t=[];for(const[n,r]of e.entries()){let e;if("string"==typeof r){if(40!==r.length&&42!==r.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");e=r}else e=r.toString();const n=40===e.length?decode$8(e):decode$8(e.substring(2));t.push(n)}return this._selector.addAddressArray(),this._addParam(t,!0)}addFunction(e,t){const n=decode$8(e),r=t._build();if(20!==n.length)throw new Error("`function` type requires parameter `address` to be exactly 20 bytes");this._selector.addFunction();const o=new Uint8Array(24);return o.set(n,0),o.set(r,20),this._addParam(o,!1)}_addParam(e,t){const n=this._selector._paramTypes.length-1,r=argumentToBytes(e,this._selector._paramTypes[n]);return this._arguments.push({dynamic:t,value:r}),this}_build(e){const t=null!=e,n=t?4:0,r=0===this._arguments.length?n:32*this._arguments.length+this._arguments.map(e=>e.dynamic?e.value.length:0).reduce((e,t)=>e+t)+n,o=new Uint8Array(r);t&&o.set(this._selector._build(e),0);let i=32*this._arguments.length;for(const[e,{dynamic:t,value:r}]of this._arguments.entries())if(t){const t=safeView(o,n+32*e+28);t.setUint32(0,i),o.set(r,t.getUint32(0)+n),i+=r.length}else o.set(r,n+32*e);return o}}function argumentToBytes(e,t){let n,r=new Uint8Array(32),o=safeView(r);if(t.array){if(!Array.isArray(e))throw new TypeError("SolidityType indicates type is array, but parameter is not an array");const n=[];for(const[r,o]of e.entries()){const e=argumentToBytes(o,{ty:t.ty,array:!1});n.push(e)}const i=n.map(e=>e.length).reduce((e,t)=>e+t,0);switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r=new Uint8Array(i+32);break;case ArgumentType.bytes:case ArgumentType.string:r=new Uint8Array(32*n.length+i+32);break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}o=safeView(r,28),o.setUint32(0,n.length);let a=32*n.length;for(const[e,o]of n.entries())switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r.set(o,32*e+32);break;case ArgumentType.bytes:case ArgumentType.string:const n=safeView(r,32*(e+1)+28);n.setUint32(0,a),r.set(o,n.getUint32(0)+32),a+=o.length;break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}return r}switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.int256:case ArgumentType.uint256:{let n=e.toString(16);n=e>0||0==e?"0x"+n:n.slice(0,1)+"0x"+n.slice(1);return arrayify(defaultAbiCoder.encode([solidityTypeToString(t)],[n]))}case ArgumentType.address:return r.set(e,12),r;case ArgumentType.bool:return r[31]=e?1:0,r;case ArgumentType.func:return r.set(e,8),r;case ArgumentType.bytes32:return r.set(e,0),r;case ArgumentType.bytes:case ArgumentType.string:return n=e instanceof Uint8Array?e:encode$1(e),r=Math.floor(n.length/32)>=0?0!==Math.floor(n.length%32)?new Uint8Array(32*(Math.floor(n.length/32)+1)+32):new Uint8Array(32*Math.floor(n.length/32)+32):new Uint8Array(64),r.set(n,32),o=safeView(r,28),o.setUint32(0,n.length),r;default:throw new Error(`Unsupported argument type: ${t.toString()}`)}}class ContractCallQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId),this._gas=null,null!=e.gas&&this.setGas(e.gas),this._functionParameters=null,null!=e.functionParameters&&(e.functionParameters instanceof Uint8Array?this.setFunctionParameters(e.functionParameters):this.setFunction(e.functionParameters.name,e.functionParameters.parameters)),this._maxResultSize=null,null!=e.maxResultSize&&this.setMaxResultSize(e.maxResultSize),this._senderAccountId=null,null!=e.senderAccountId&&this.setSenderAccountId(e.senderAccountId)}static _fromProtobuf(e){const t=e.contractCallLocal;return new ContractCallQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0,gas:null!=t.gas?t.gas:void 0,functionParameters:null!=t.functionParameters?t.functionParameters:void 0,maxResultSize:null!=t.maxResultSize?t.maxResultSize:void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){return this._gas=e instanceof Long?e:Long.fromValue(e),this}get senderAccountId(){return this._senderAccountId}setSenderAccountId(e){return this._senderAccountId="string"==typeof e?AccountId.fromString(e):e,this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._functionParameters=e,this}setFunction(e,t){return this._functionParameters=(null!=t?t:new ContractFunctionParameters)._build(e),this}setMaxResultSize(e){return this._maxResultSize=e instanceof Long?e:Long.fromValue(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);if(!t.contractCallLocal.functionResult)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const i=this._mapResponseSync(t);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:i})}_execute(e,t){return e.smartContract.contractCallLocalMethod(t)}_mapResponseHeader(e){return e.contractCallLocal.header}_mapResponse(e){const t=e.contractCallLocal;return Promise.resolve(ContractFunctionResult._fromProtobuf(t.functionResult,!1))}_mapResponseSync(e){const t=e.contractCallLocal;return ContractFunctionResult._fromProtobuf(t.functionResult,!1)}_onMakeRequest(e){return{contractCallLocal:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,maxResultSize:this._maxResultSize,functionParameters:this._functionParameters,senderId:null!=this._senderAccountId?this._senderAccountId._toProtobuf():null}}}_getLogId(){return`ContractCallQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractCallLocal",ContractCallQuery._fromProtobuf);class FileCreateTransaction extends Transaction{constructor(e={}){super(),this._keys=null,this._expirationTime=new Timestamp(0,0).plusNanos(Long.fromNumber(Date.now()).mul(1e6).add(DEFAULT_AUTO_RENEW_PERIOD.mul(1e9))),this._contents=null,this._fileMemo=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileCreate;return Transaction._fromProtobufTransactions(new FileCreateTransaction({keys:null!=i.keys&&null!=i.keys.keys?i.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,contents:null!=i.contents?i.contents:void 0,fileMemo:null!=i.memo?i.memo:void 0}),e,t,n,r,o)}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode$1(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}_execute(e,t){return e.file.createFile(t)}_getTransactionDataCase(){return"fileCreate"}_makeTransactionData(){return{keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:this._expirationTime._toProtobuf(),contents:this._contents,memo:this._fileMemo}}_getLogId(){return`FileCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileCreate",FileCreateTransaction._fromProtobuf);class FileAppendTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contents=null,this._maxChunks=20,this._chunkSize=4096,this._chunkInterval=10,this._defaultMaxTransactionFee=new Hbar(5),null!=e.fileId&&this.setFileId(e.fileId),null!=e.contents&&this.setContents(e.contents),null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),null!=e.chunkInterval&&this.setChunkInterval(e.chunkInterval),this._transactionIds=new List}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileAppend;let a;const s=r.length>0?r.length:1;for(let e=0;e<o.length;e+=s){const t=o[e].fileAppend;if(null==t.contents)break;if(null==a){a=new Uint8Array(t.contents);continue}const n=new Uint8Array(a.length+t.contents.length);n.set(a,0),n.set(t.contents,a.length),a=n}const c=i.contents?.length||void 0,u=o.length?o.length/s:void 0;let l;if(n.length>1){const e=n[0].validStart,t=n[1].validStart;e&&t&&(l=t.nanos.sub(e.nanos).toNumber())}return Transaction._fromProtobufTransactions(new FileAppendTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,contents:a,chunkSize:c,maxChunks:u,chunkInterval:l}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}getRequiredChunks(){if(null==this._contents)return 1;return Math.ceil(this._contents.length/this._chunkSize)}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode$1(e),this}get maxChunks(){return this._maxChunks}setMaxChunks(e){if(e<=0)throw new Error("Max chunks must be greater than 0");return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}setChunkSize(e){if(e<=0)throw new Error("Chunk size must be greater than 0");return this._chunkSize=e,this}get chunkInterval(){return this._chunkInterval}setChunkInterval(e){return this._chunkInterval=e,this}freezeWith(e){if(super.freezeWith(e),null==this._contents)return this;let t=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){this._transactionIds.push(t),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));t=new TransactionId(t.accountId,new Timestamp(t.validStart.seconds,t.validStart.nanos.add(this._chunkInterval)))}return this._transactionIds.advance(),this._transactionIds.setLocked(),this}schedule(){if(this._requireNotFrozen(),null!=this._contents&&this._contents.length>this._chunkSize)throw new Error(`cannot schedule \`FileAppendTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot execute \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let i=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now(),n=await super.execute(e,i);null!=i&&(i=Date.now()-t),await n.getReceipt(e),o.push(n)}return o}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.appendContent(t)}_getTransactionDataCase(){return"fileAppend"}_buildIncompleteTransactions(){const e=AccountId.fromString("0.0.0"),t=this.transactionId?.accountId||e,n=this.transactionId?.validStart||Timestamp.fromDate(new Date);if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){let r=TransactionId.withValidStart(t,n.plusNanos(this._chunkInterval*e));if(this._transactionIds.push(r),this._transactionIds.advance(),0===this._nodeAccountIds.list.length)this._transactions.push(this._makeSignedTransaction(null));else for(const e of this._nodeAccountIds.list)this._transactions.push(this._makeSignedTransaction(e))}this._transactionIds.advance(),this._transactionIds.setLocked()}_buildAllTransactions(){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}_getLogId(){return`FileAppendTransaction:${this._transactionIds.current.validStart.toString()}`}_makeTransactionData(){const e=null!=this._contents?this._contents.length:0,t=this._transactionIds.index*this._chunkSize,n=Math.min(t+this._chunkSize,e);return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contents:null!=this._contents?this._contents.slice(t,n):null}}}TRANSACTION_REGISTRY.set("fileAppend",FileAppendTransaction._fromProtobuf);class FileDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileDelete;return Transaction._fromProtobufTransactions(new FileDeleteTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.deleteFile(t)}_getTransactionDataCase(){return"fileDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null}}_getLogId(){return`FileDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileDelete",FileDeleteTransaction._fromProtobuf);class ContractCreateTransaction extends Transaction{constructor(e={}){super(),this._bytecodeFileId=null,this._bytecode=null,this._adminKey=null,this._gas=null,this._initialBalance=null,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._constructorParameters=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._defaultMaxTransactionFee=new Hbar(20),this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._autoRenewAccountId=null,null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.bytecode&&this.setBytecode(e.bytecode),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.gas&&this.setGas(e.gas),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.constructorParameters&&this.setConstructorParameters(e.constructorParameters),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractCreateInstance;return Transaction._fromProtobufTransactions(new ContractCreateTransaction({bytecodeFileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,gas:null!=i.gas?i.gas:void 0,initialBalance:null!=i.initialBalance?Hbar.fromTinybars(i.initialBalance):void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,constructorParameters:null!=i.constructorParameters?i.constructorParameters:void 0,contractMemo:null!=i.memo?i.memo:void 0,maxAutomaticTokenAssociations:null!=i.maxAutomaticTokenAssociations?i.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:1==i.declineReward,autoRenewAccountId:null!=i.autoRenewAccountId?AccountId._fromProtobuf(i.autoRenewAccountId):void 0}),e,t,n,r,o)}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this._bytecode=null,this}get bytecode(){return this._bytecode}setBytecode(e){return this._requireNotFrozen(),this._bytecode=e,this._bytecodeFileId=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get gas(){return this._gas}setGas(e){if(this._requireNotFrozen(),this._gas=e instanceof Long?e:Long.fromValue(e),this._gas.lessThan(0))throw new Error("Gas cannot be negative number");return this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get constructorParameters(){return this._constructorParameters}setConstructorParameters(e){return this._requireNotFrozen(),this._constructorParameters=e instanceof ContractFunctionParameters?e._build():e,this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this._stakedNodeId=null,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this._stakedAccountId=null,this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}_validateChecksums(e){null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.smartContract.createContract(t)}_getTransactionDataCase(){return"contractCreateInstance"}_makeTransactionData(){return{fileID:null!=this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,initcode:this._bytecode,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,gas:this._gas,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),constructorParameters:this._constructorParameters,memo:this._contractMemo,maxAutomaticTokenAssociations:this._maxAutomaticTokenAssociations,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,autoRenewAccountId:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null}}_getLogId(){return`ContractCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCreateInstance",ContractCreateTransaction._fromProtobuf);class ContractCreateFlow{constructor(){this._bytecode=null,this._contractCreate=new ContractCreateTransaction,this._signerPublicKeys=new Set,this._publicKeys=[],this._transactionSigners=[],this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get bytecode(){return this._bytecode}setBytecode(e){return this._bytecode=e instanceof Uint8Array?e:encode$1(e),this}get adminKey(){return this._contractCreate.adminKey}setAdminKey(e){return this._contractCreate.setAdminKey(e),this}get gas(){return this._contractCreate.gas}setGas(e){return this._contractCreate.setGas(e),this}get initialBalance(){return this._contractCreate.initialBalance}setInitialBalance(e){return this._contractCreate.setInitialBalance(e),this}get proxyAccountId(){return this._contractCreate.proxyAccountId}setProxyAccountId(e){return this._contractCreate.setProxyAccountId(e),this}get autoRenewPeriod(){return this._contractCreate.autoRenewPeriod}setAutoRenewPeriod(e){return this._contractCreate.setAutoRenewPeriod(e),this}get constructorParameters(){return this._contractCreate.constructorParameters}setConstructorParameters(e){return this._contractCreate.setConstructorParameters(e),this}get contractMemo(){return this._contractCreate.contractMemo}setContractMemo(e){return this._contractCreate.setContractMemo(e),this}get maxAutomaticTokenAssociation(){return this._contractCreate.maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._contractCreate.setMaxAutomaticTokenAssociations(e),this}get stakedAccountId(){return this._contractCreate.stakedAccountId}setStakedAccountId(e){return this._contractCreate.setStakedAccountId(e),this}get stakedNodeId(){return this._contractCreate.stakedNodeId}setStakedNodeId(e){return this._contractCreate.setStakedNodeId(e),this}get declineStakingRewards(){return this._contractCreate.declineStakingRewards}setDeclineStakingReward(e){return this._contractCreate.setDeclineStakingReward(e),this}get autoRenewAccountId(){return this._contractCreate.autoRenewAccountId}setAutoRenewAccountId(e){return this._contractCreate.setAutoRenewAccountId(e),this}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}signWith(e,t){const n=encode$5(e.toBytesRaw());return this._signerPublicKeys.has(n)||(this._publicKeys.push(e),this._transactionSigners.push(t)),this}async execute(e,t){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");const n=e.operatorPublicKey,r=(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWith(e);await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.execute(e,t);const i=(await o.getReceipt(e)).fileId;if(this._bytecode.length>2048){const n=(new FileAppendTransaction).setFileId(i).setContents(this._bytecode.subarray(2048)).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await n.execute(e,t)}if(this._contractCreate.setBytecodeFileId(i).freezeWith(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.execute(e,t),await o.getReceipt(e),null!=n){const n=(new FileDeleteTransaction).setFileId(i).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await(await n.execute(e,t)).getReceipt(e)}return o}async executeWithSigner(e){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");if(null==e.getAccountKey)throw new Error("`Signer.getAccountKey()` is not implemented, but is required for `ContractCreateFlow`");const t=await e.getAccountKey();let n;if(t instanceof PublicKey)n=t;else{const e=Object.values(t._key._key._keyData),r=new Uint8Array(e);n=PublicKey.fromBytes(r)}const r=await(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWithSigner(e);await r.signWithSigner(e),await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.executeWithSigner(e);const i=(await o.getReceiptWithSigner(e)).fileId;if(this._bytecode.length>2048){let t=(new FileAppendTransaction).setFileId(i).setContents(this._bytecode.subarray(2048));null!=this._maxChunks&&t.setMaxChunks(this._maxChunks),t=await t.freezeWithSigner(e),await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await t.executeWithSigner(e)}if(this._contractCreate=await this._contractCreate.setBytecodeFileId(i).freezeWithSigner(e),this._contractCreate=await this._contractCreate.signWithSigner(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.executeWithSigner(e),await o.getReceiptWithSigner(e),null!=t){const t=await(new FileDeleteTransaction).setFileId(i).freezeWithSigner(e);await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await(await t.executeWithSigner(e)).getReceiptWithSigner(e)}return o}}async function addSignersToTransaction(e,t,n){for(let r=0;r<t.length;r++)await e.signWith(t[r],n[r])}class ContractDeleteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._transferAccountId=null,this._transferContractId=null,this._permanentRemoval=!1,null!=e.contractId&&this.setContractId(e.contractId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId),null!=e.transferContractId&&this.setTransferContractId(e.transferContractId),null!=e.permanentRemoval&&this.setPermanentRemoval(e.permanentRemoval)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractDeleteInstance;return Transaction._fromProtobufTransactions(new ContractDeleteTransaction({contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,transferAccountId:null!=i.transferAccountID?AccountId._fromProtobuf(i.transferAccountID):void 0,transferContractId:null!=i.transferContractID?ContractId._fromProtobuf(i.transferContractID):void 0,permanentRemoval:i.permanentRemoval??!1}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get transferContractId(){return this._transferContractId}setTransferContractId(e){return this._requireNotFrozen(),this._transferContractId=e instanceof ContractId?e:ContractId.fromString(e),this._transferAccountId=null,this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId=e instanceof AccountId?e:AccountId.fromString(e),this._transferContractId=null,this}get permanentRemoval(){return this._permanentRemoval}setPermanentRemoval(e){return this._requireNotFrozen(),this._permanentRemoval=e,this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e),null!=this._transferContractId&&this._transferContractId.validateChecksum(e)}_execute(e,t){return e.smartContract.deleteContract(t)}_getTransactionDataCase(){return"contractDeleteInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,transferAccountID:this._transferAccountId?this._transferAccountId._toProtobuf():null,transferContractID:null!=this._transferContractId?this._transferContractId._toProtobuf():null,permanentRemoval:this._permanentRemoval}}_getLogId(){return`ContractDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractDeleteInstance",ContractDeleteTransaction._fromProtobuf);class ContractExecuteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._gas=null,this._amount=null,this._functionParameters=null,null!=e.contractId&&this.setContractId(e.contractId),null!=e.gas&&this.setGas(e.gas),null!=e.amount&&this.setPayableAmount(e.amount),null!=e.functionParameters?this.setFunctionParameters(e.functionParameters):null!=e.function&&this.setFunction(e.function.name,e.function.parameters)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractCall;return Transaction._fromProtobufTransactions(new ContractExecuteTransaction({contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,gas:null!=i.gas?i.gas:void 0,amount:null!=i.amount?Hbar.fromTinybars(i.amount):void 0,functionParameters:null!=i.functionParameters?i.functionParameters:void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){this._requireNotFrozen();const t=e instanceof Long?e:Long.fromValue(e);if(t.lt(0))throw new Error("Gas must be greater than 0");return this._gas=t,this}get payableAmount(){return this._amount}setPayableAmount(e,t=HbarUnit.Hbar){return this._requireNotFrozen(),this._amount=e instanceof Hbar?e:Hbar.from(e,t),this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._requireNotFrozen(),this._functionParameters=e,this}setFunction(e,t){return this._requireNotFrozen(),this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractCallMethod(t)}_getTransactionDataCase(){return"contractCall"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,amount:null!=this._amount?this._amount.toTinybars():null,functionParameters:this._functionParameters}}_getLogId(){return`ContractExecuteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCall",ContractExecuteTransaction._fromProtobuf);const{proto:proto$4}=HieroProto;class ContractInfo{constructor(e){this.contractId=e.contractId,this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.storage=e.storage,this.contractMemo=e.contractMemo,this.balance=e.balance,this.isDeleted=e.isDeleted,this.tokenRelationships=e.tokenRelationships,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.ledgerId=e.ledgerId,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){const t=e.autoRenewPeriod.seconds;return new ContractInfo({contractId:ContractId._fromProtobuf(e.contractID),accountId:AccountId._fromProtobuf(e.accountID),contractAccountId:null!=e.contractAccountID?e.contractAccountID:"",adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:new Duration(t),autoRenewAccountId:null!=e.autoRenewAccountId?AccountId._fromProtobuf(e.autoRenewAccountId):null,storage:null!=e.storage?e.storage instanceof Long?e.storage:Long.fromValue(e.storage):Long.ZERO,contractMemo:null!=e.memo?e.memo:"",balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),isDeleted:e.deleted,tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null,maxAutomaticTokenAssociations:null!=e.maxAutomaticTokenAssociations?Long.isLong(e.maxAutomaticTokenAssociations)?e.maxAutomaticTokenAssociations:Long.fromValue(e.maxAutomaticTokenAssociations):Long.ZERO})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccountId:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,storage:this.storage,memo:this.contractMemo,balance:this.balance.toTinybars(),deleted:this.isDeleted,tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toNumber()}}static fromBytes(e){return ContractInfo._fromProtobuf(proto$4.ContractGetInfoResponse.ContractInfo.decode(e))}toBytes(){return proto$4.ContractGetInfoResponse.ContractInfo.encode(this._toProtobuf()).finish()}}class ContractInfoQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetInfo;return new ContractInfoQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.getContractInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.contractGetInfo.header}_mapResponse(e,t,n){const r=e.contractGetInfo;return Promise.resolve(ContractInfo._fromProtobuf(r.contractInfo))}_onMakeRequest(e){return{contractGetInfo:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetInfo",ContractInfoQuery._fromProtobuf);class ContractUpdateTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._expirationTime=null,this._adminKey=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._bytecodeFileId=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,this._autoRenewAccountId=null,null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].contractUpdateInstance;let a,s,c;return null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds&&(a=i.autoRenewPeriod.seconds),null!=i.memoWrapper&&Object.hasOwn(i.memoWrapper,"value")&&null!=i.memoWrapper.value&&(s=i.memoWrapper.value),null!=i.maxAutomaticTokenAssociations&&null!=i.maxAutomaticTokenAssociations.value&&(c=i.maxAutomaticTokenAssociations.value),Transaction._fromProtobufTransactions(new ContractUpdateTransaction({contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,bytecodeFileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,proxyAccountId:null!=i.proxyAccountID?AccountId._fromProtobuf(i.proxyAccountID):void 0,autoRenewPeriod:a,contractMemo:s,maxAutomaticTokenAssociations:c,stakedAccountId:null!=i.stakedAccountId?AccountId._fromProtobuf(i.stakedAccountId):void 0,stakedNodeId:null!=i.stakedNodeId?i.stakedNodeId:void 0,declineStakingReward:null!=i.declineReward&&1==Boolean(i.declineReward),autoRenewAccountId:null!=i.autoRenewAccountId?AccountId._fromProtobuf(i.autoRenewAccountId):void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return console.warn("Deprecated: there is no replacement"),this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}clearContractMemo(){return this._requireNotFrozen(),this._contractMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearAutoRenewAccountId(){return this._autoRenewAccountId=new AccountId(0),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.smartContract.updateContract(t)}_getTransactionDataCase(){return"contractUpdateInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,fileID:this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,memoWrapper:null!=this._contractMemo?{value:this._contractMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null,autoRenewAccountId:null!=this._autoRenewAccountId?"0.0.0"==this._autoRenewAccountId.toString()?libExports.proto.AccountID.create():this._autoRenewAccountId._toProtobuf():null}}_getLogId(){return`ContractUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractUpdateInstance",ContractUpdateTransaction._fromProtobuf);class FeeAssessmentMethod{constructor(e){this._value=e,Object.freeze(this)}toString(){switch(this){case FeeAssessmentMethod.Inclusive:return"INCLUSIVE";case FeeAssessmentMethod.Exclusive:return"EXCLUSIVE";default:return`UNKNOWN (${this._value.toString()})`}}static _fromValue(e){switch(e){case!1:return FeeAssessmentMethod.Inclusive;case!0:return FeeAssessmentMethod.Exclusive}}valueOf(){return this._value}}FeeAssessmentMethod.Inclusive=new FeeAssessmentMethod(!1),FeeAssessmentMethod.Exclusive=new FeeAssessmentMethod(!0);class CustomFractionalFee extends CustomFee{constructor(e={}){super(e),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator),this._min=null,null!=e.min&&this.setMin(e.min),this._max,null!=e.max&&this.setMax(e.max),this._assessmentMethod,null!=e.assessmentMethod&&this.setAssessmentMethod(e.assessmentMethod)}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}get min(){return this._min}setMin(e){return this._min="number"==typeof e?Long.fromNumber(e):e,this}get max(){return this._max}setMax(e){return this._max="number"==typeof e?Long.fromNumber(e):e,this}get assessmentMethod(){return this._assessmentMethod}setAssessmentMethod(e){return this._assessmentMethod=e,this}static _fromProtobuf(e){const t=e.fractionalFee,n=t.fractionalAmount;return new CustomFractionalFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0,min:null!=t.minimumAmount?t.minimumAmount:void 0,max:null!=t.maximumAmount?t.maximumAmount:void 0,assessmentMethod:null!=t.netOfTransfers?new FeeAssessmentMethod(t.netOfTransfers):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fractionalFee:{fractionalAmount:{numerator:this._numerator,denominator:this._denominator},minimumAmount:this._min,maximumAmount:this._max,netOfTransfers:null!=this._assessmentMethod&&this._assessmentMethod.valueOf()}}}}class CustomRoyalyFee extends CustomFee{constructor(e={}){super(e),this._fallbackFee=null,null!=e.fallbackFee&&this.setFallbackFee(e.fallbackFee),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator)}get fallbackFee(){return this._fallbackFee}setFallbackFee(e){return this._fallbackFee=e,this}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}static _fromProtobuf(e){const t=e.royaltyFee,n=t.exchangeValueFraction;return new CustomRoyalyFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,fallbackFee:null!=t.fallbackFee?CustomFixedFee._fromProtobuf({fixedFee:t.fallbackFee}):void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,royaltyFee:{exchangeValueFraction:{numerator:this._numerator,denominator:this._denominator},fallbackFee:null!=this._fallbackFee?this._fallbackFee._toProtobuf().fixedFee:null}}}}class DelegateContractId extends ContractId{constructor(e,t,n,r){super(e,t,n,r)}static fromString(e){return new DelegateContractId(ContractId.fromString(e))}static _fromProtobuf(e){return new DelegateContractId(ContractId._fromProtobuf(e))}static fromBytes(e){return new DelegateContractId(ContractId.fromBytes(e))}static fromSolidityAddress(e){return new DelegateContractId(ContractId.fromSolidityAddress(e))}clone(){const e=new DelegateContractId(this);return e._checksum=this._checksum,e}_toProtobufKey(){return{delegatableContractId:this._toProtobuf()}}static __fromProtobufKey(e){return DelegateContractId._fromProtobuf(e)}}CACHE.setDelegateContractId(e=>DelegateContractId.__fromProtobufKey(e));class EthereumTransaction extends Transaction{constructor(e={}){super(),this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.callData&&this.setCallDataFileId(e.callData),null!=e.callDataFileId&&this.setCallDataFileId(e.callDataFileId),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance)}static _fromProtobuf(e,t,n,r,o){const i=o[0].ethereumTransaction;return Transaction._fromProtobufTransactions(new EthereumTransaction({ethereumData:null!=i.ethereumData?i.ethereumData:void 0,callData:null!=i.callData?FileId._fromProtobuf(i.callData):void 0,maxGasAllowance:null!=i.maxGasAllowance?Hbar.fromTinybars(i.maxGasAllowance):void 0}),e,t,n,r,o)}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._requireNotFrozen(),this._ethereumData=e,this}get callData(){return this.callDataFileId}setCallData(e){return this.setCallDataFileId(e)}get callDataFileId(){return this._callDataFileId}setCallDataFileId(e){return this._requireNotFrozen(),this._callDataFileId=e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._requireNotFrozen(),this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}_validateChecksums(e){null!=this._ethereumData&&this._ethereumData instanceof FileId&&this._ethereumData.validateChecksum(e)}_execute(e,t){return e.smartContract.callEthereum(t)}_getTransactionDataCase(){return"ethereumTransaction"}_makeTransactionData(){return{ethereumData:this._ethereumData,callData:null!=this._callDataFileId?this._callDataFileId._toProtobuf():null,maxGasAllowance:null!=this._maxGasAllowance?this._maxGasAllowance.toTinybars():null}}_getLogId(){return`EthereumTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("ethereumTransaction",EthereumTransaction._fromProtobuf);class EthereumTransactionData{constructor(e){this.callData=e.callData}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");switch(e[0]){case 1:return CACHE.ethereumTransactionDataEip2930FromBytes(e);case 2:return CACHE.ethereumTransactionDataEip1559FromBytes(e);default:return CACHE.ethereumTransactionDataLegacyFromBytes(e)}}toBytes(){throw new Error("not implemented")}toString(){throw new Error("not implemented")}toJSON(){throw new Error("not implemented")}}class EthereumTransactionDataLegacy extends EthereumTransactionData{constructor(e){super(e),this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.v=e.v,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decode(e);if(9!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataLegacy({nonce:decode$8(t[0]),gasPrice:decode$8(t[1]),gasLimit:decode$8(t[2]),to:decode$8(t[3]),value:decode$8(t[4]),callData:decode$8(t[5]),v:decode$8(t[6]),r:decode$8(t[7]),s:decode$8(t[8])})}toBytes(){return decode$8(encode([this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.v,this.r,this.s]))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{nonce:encode$5(this.nonce),gasPrice:encode$5(this.gasPrice),gasLimit:encode$5(this.gasLimit),to:encode$5(this.to),value:encode$5(this.value),callData:encode$5(this.callData),v:encode$5(this.v),r:encode$5(this.r),s:encode$5(this.s)}}}CACHE.setEthereumTransactionDataLegacyFromBytes(e=>EthereumTransactionDataLegacy.fromBytes(e));class EthereumTransactionDataEip1559 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.maxPriorityGas=e.maxPriorityGas,this.maxGas=e.maxGas,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decode(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(12!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip1559({chainId:decode$8(t[0]),nonce:decode$8(t[1]),maxPriorityGas:decode$8(t[2]),maxGas:decode$8(t[3]),gasLimit:decode$8(t[4]),to:decode$8(t[5]),value:decode$8(t[6]),callData:decode$8(t[7]),accessList:t[8].map(e=>decode$8(e)),recId:decode$8(t[9]),r:decode$8(t[10]),s:decode$8(t[11])})}toBytes(){return decode$8("02"+encode([this.chainId,this.nonce,this.maxPriorityGas,this.maxGas,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$5(this.chainId),nonce:encode$5(this.nonce),maxPriorityGas:encode$5(this.maxPriorityGas),maxGas:encode$5(this.maxGas),gasLimit:encode$5(this.gasLimit),to:encode$5(this.to),value:encode$5(this.value),callData:encode$5(this.callData),accessList:this.accessList.map(e=>encode$5(e)),recId:encode$5(this.recId),r:encode$5(this.r),s:encode$5(this.s)}}}CACHE.setEthereumTransactionDataEip1559FromBytes(e=>EthereumTransactionDataEip1559.fromBytes(e));class EthereumTransactionDataEip2930 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decode(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(11!==t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip2930({chainId:decode$8(t[0]),nonce:decode$8(t[1]),gasPrice:decode$8(t[2]),gasLimit:decode$8(t[3]),to:decode$8(t[4]),value:decode$8(t[5]),callData:decode$8(t[6]),accessList:t[7].map(e=>decode$8(e)),recId:decode$8(t[8]),r:decode$8(t[9]),s:decode$8(t[10])})}toBytes(){return decode$8("01"+encode([this.chainId,this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$5(this.chainId),nonce:encode$5(this.nonce),gasPrice:encode$5(this.gasPrice),gasLimit:encode$5(this.gasLimit),to:encode$5(this.to),value:encode$5(this.value),callData:encode$5(this.callData),accessList:this.accessList.map(e=>encode$5(e)),recId:encode$5(this.recId),r:encode$5(this.r),s:encode$5(this.s)}}}CACHE.setEthereumTransactionDataEip2930FromBytes(e=>EthereumTransactionDataEip2930.fromBytes(e));class EthereumFlow{constructor(e={}){this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance),this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._ethereumData=e instanceof Uint8Array?EthereumTransactionData.fromBytes(e):e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}async execute(e){if(null==this._ethereumData)throw new Error("cannot submit ethereum transaction with no ethereum data");const t=new EthereumTransaction,n=this._ethereumData.toBytes();if(null!=this._maxGasAllowance&&t.setMaxGasAllowanceHbar(this._maxGasAllowance),null!=this._callDataFileId){if(0===this._ethereumData.callData.length)throw new Error("call data file ID provided, but ethereum data already contains call data");t.setEthereumData(n).setCallDataFileId(this._callDataFileId)}else if(n.length<=128e3)t.setEthereumData(n);else{const n=await createFile(this._ethereumData.callData,e,this._maxChunks);this._ethereumData.callData=new Uint8Array,t.setEthereumData(this._ethereumData.toBytes()).setCallDataFileId(n)}return t.execute(e)}}async function createFile(e,t,n){const r=encode$5(e),o=(await(await(new FileCreateTransaction).setContents(r.substring(0,4096)).setKeys(t.operatorPublicKey?[t.operatorPublicKey]:[]).execute(t)).getReceipt(t)).fileId;if(e.length>4096){let e=(new FileAppendTransaction).setFileId(o).setContents(r.substring(4096,r.length));null!=n&&e.setMaxChunks(n),await(await e.execute(t)).getReceipt(t)}return o}const{proto:proto$3}=HieroProto;class ExchangeRates{constructor(e){this.currentRate=e.currentRate,this.nextRate=e.nextRate,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRates({currentRate:ExchangeRate._fromProtobuf(e.currentRate),nextRate:ExchangeRate._fromProtobuf(e.nextRate)})}_toProtobuf(){return{currentRate:this.currentRate._toProtobuf(),nextRate:this.nextRate._toProtobuf()}}static fromBytes(e){return ExchangeRates._fromProtobuf(proto$3.ExchangeRateSet.decode(e))}}class FeeComponents{constructor(e={}){this.min=e.min,this.max=e.max,this.constant=e.constant,this.transactionBandwidthByte=e.transactionBandwidthByte,this.transactionVerification=e.transactionVerification,this.transactionRamByteHour=e.transactionRamByteHour,this.transactionStorageByteHour=e.transactionStorageByteHour,this.contractTransactionGas=e.contractTransactionGas,this.transferVolumeHbar=e.transferVolumeHbar,this.responseMemoryByte=e.responseMemoryByte,this.responseDiskByte=e.responseDiskByte}static fromBytes(e){return FeeComponents._fromProtobuf(libExports.proto.FeeComponents.decode(e))}static _fromProtobuf(e){return new FeeComponents({min:null!=e.min?e.min:void 0,max:null!=e.max?e.max:void 0,constant:null!=e.constant?e.constant:void 0,transactionBandwidthByte:null!=e.bpt?e.bpt:void 0,transactionVerification:null!=e.vpt?e.vpt:void 0,transactionRamByteHour:null!=e.rbh?e.rbh:void 0,transactionStorageByteHour:null!=e.sbh?e.sbh:void 0,contractTransactionGas:null!=e.gas?e.gas:void 0,transferVolumeHbar:null!=e.tv?e.tv:void 0,responseMemoryByte:null!=e.bpr?e.bpr:void 0,responseDiskByte:null!=e.sbpr?e.sbpr:void 0})}_toProtobuf(){return{min:null!=this.min?this.min:void 0,max:null!=this.max?this.max:void 0,constant:null!=this.constant?this.constant:void 0,bpt:null!=this.transactionBandwidthByte?this.transactionBandwidthByte:void 0,vpt:null!=this.transactionVerification?this.transactionVerification:void 0,rbh:null!=this.transactionRamByteHour?this.transactionRamByteHour:void 0,sbh:null!=this.transactionStorageByteHour?this.transactionStorageByteHour:void 0,gas:null!=this.contractTransactionGas?this.contractTransactionGas:void 0,tv:null!=this.transferVolumeHbar?this.transferVolumeHbar:void 0,bpr:null!=this.responseMemoryByte?this.responseMemoryByte:void 0,sbpr:null!=this.responseDiskByte?this.responseDiskByte:void 0}}toBytes(){return libExports.proto.FeeComponents.encode(this._toProtobuf()).finish()}}class FeeDataType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FeeDataType.Default:return"DEFAULT";case FeeDataType.TokenFungibleCommon:return"TOKEN_FUNGIBLE_COMMON";case FeeDataType.TokenNonFungibleUnique:return"TOKEN_NON_FUNGIBLE_UNIQUE";case FeeDataType.TokenFungibleCommonWithCustomFees:return"TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES";case FeeDataType.TokenNonFungibleUniqueWithCustomFees:return"TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES";case FeeDataType.ScheduleCreateContractCall:return"SCHEDULE_CREATE_CONTRACT_CALL";case FeeDataType.TopicCreateWithCustomFees:return"TOPIC_CREATE_WITH_CUSTOM_FEES";case FeeDataType.SubmitMessageWithCustomFees:return"SUBMIT_MESSAGE_WITH_CUSTOM_FEES";case FeeDataType.CryptoTransferWithHooks:return"CRYPTO_TRANSFER_WITH_HOOKS";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FeeDataType.Default;case 1:return FeeDataType.TokenFungibleCommon;case 2:return FeeDataType.TokenNonFungibleUnique;case 3:return FeeDataType.TokenFungibleCommonWithCustomFees;case 4:return FeeDataType.TokenNonFungibleUniqueWithCustomFees;case 5:return FeeDataType.ScheduleCreateContractCall;case 6:return FeeDataType.TopicCreateWithCustomFees;case 7:return FeeDataType.SubmitMessageWithCustomFees;case 8:return FeeDataType.CryptoTransferWithHooks}throw new Error(`(BUG) SubType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}FeeDataType.Default=new FeeDataType(0),FeeDataType.TokenFungibleCommon=new FeeDataType(1),FeeDataType.TokenNonFungibleUnique=new FeeDataType(2),FeeDataType.TokenFungibleCommonWithCustomFees=new FeeDataType(3),FeeDataType.TokenNonFungibleUniqueWithCustomFees=new FeeDataType(4),FeeDataType.ScheduleCreateContractCall=new FeeDataType(5),FeeDataType.TopicCreateWithCustomFees=new FeeDataType(6),FeeDataType.SubmitMessageWithCustomFees=new FeeDataType(7),FeeDataType.CryptoTransferWithHooks=new FeeDataType(8);class FeeData{constructor(e={}){this.nodedata=e.nodedata,this.networkdata=e.networkdata,this.servicedata=e.servicedata,this.feeDataType=e.feeDataType}static fromBytes(e){return FeeData._fromProtobuf(libExports.proto.FeeData.decode(e))}static _fromProtobuf(e){return new FeeData({nodedata:null!=e.nodedata?FeeComponents._fromProtobuf(e.nodedata):void 0,networkdata:null!=e.networkdata?FeeComponents._fromProtobuf(e.networkdata):void 0,servicedata:null!=e.servicedata?FeeComponents._fromProtobuf(e.servicedata):void 0,feeDataType:null!=e.subType?FeeDataType._fromCode(e.subType):void 0})}_toProtobuf(){return{nodedata:null!=this.nodedata?this.nodedata._toProtobuf():void 0,networkdata:null!=this.networkdata?this.networkdata._toProtobuf():void 0,servicedata:null!=this.servicedata?this.servicedata._toProtobuf():void 0,subType:null!=this.feeDataType?this.feeDataType.valueOf():void 0}}toBytes(){return libExports.proto.FeeData.encode(this._toProtobuf()).finish()}}class RequestType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case RequestType.None:return"NONE";case RequestType.CryptoTransfer:return"CryptoTransfer";case RequestType.CryptoUpdate:return"CryptoUpdate";case RequestType.CryptoDelete:return"CryptoDelete";case RequestType.CryptoAddLiveHash:return"CryptoAddLiveHash";case RequestType.CryptoDeleteLiveHash:return"CryptoDeleteLiveHash";case RequestType.ContractCall:return"ContractCall";case RequestType.ContractCreate:return"ContractCreate";case RequestType.ContractUpdate:return"ContractUpdate";case RequestType.FileCreate:return"FileCreate";case RequestType.FileAppend:return"FileAppend";case RequestType.FileUpdate:return"FileUpdate";case RequestType.FileDelete:return"FileDelete";case RequestType.CryptoGetAccountBalance:return"CryptoGetAccountBalance";case RequestType.CryptoGetAccountRecords:return"CryptoGetAccountRecords";case RequestType.CryptoGetInfo:return"CryptoGetInfo";case RequestType.ContractCallLocal:return"ContractCallLocal";case RequestType.ContractGetInfo:return"ContractGetInfo";case RequestType.ContractGetBytecode:return"ContractGetBytecode";case RequestType.GetBySolidityID:return"GetBySolidityID";case RequestType.GetByKey:return"GetByKey";case RequestType.CryptoGetLiveHash:return"CryptoGetLiveHash";case RequestType.CryptoGetStakers:return"CryptoGetStakers";case RequestType.FileGetContents:return"FileGetContents";case RequestType.FileGetInfo:return"FileGetInfo";case RequestType.TransactionGetRecord:return"TransactionGetRecord";case RequestType.ContractGetRecords:return"ContractGetRecords";case RequestType.CryptoCreate:return"CryptoCreate";case RequestType.SystemDelete:return"SystemDelete";case RequestType.SystemUndelete:return"SystemUndelete";case RequestType.ContractDelete:return"ContractDelete";case RequestType.Freeze:return"Freeze";case RequestType.CreateTransactionRecord:return"CreateTransactionRecord";case RequestType.CryptoAccountAutoRenew:return"CryptoAccountAutoRenew";case RequestType.ContractAutoRenew:return"ContractAutoRenew";case RequestType.GetVersionInfo:return"GetVersionInfo";case RequestType.TransactionGetReceipt:return"TransactionGetReceipt";case RequestType.ConsensusCreateTopic:return"ConsensusCreateTopic";case RequestType.ConsensusUpdateTopic:return"ConsensusUpdateTopic";case RequestType.ConsensusDeleteTopic:return"ConsensusDeleteTopic";case RequestType.ConsensusGetTopicInfo:return"ConsensusGetTopicInfo";case RequestType.ConsensusSubmitMessage:return"ConsensusSubmitMessage";case RequestType.UncheckedSubmit:return"UncheckedSubmit";case RequestType.TokenCreate:return"TokenCreate";case RequestType.TokenGetInfo:return"TokenGetInfo";case RequestType.TokenFreezeAccount:return"TokenFreezeAccount";case RequestType.TokenUnfreezeAccount:return"TokenUnfreezeAccount";case RequestType.TokenGrantKycToAccount:return"TokenGrantKycToAccount";case RequestType.TokenRevokeKycFromAccount:return"TokenRevokeKycFromAccount";case RequestType.TokenDelete:return"TokenDelete";case RequestType.TokenUpdate:return"TokenUpdate";case RequestType.TokenMint:return"TokenMint";case RequestType.TokenBurn:return"TokenBurn";case RequestType.TokenAccountWipe:return"TokenAccountWipe";case RequestType.TokenAssociateToAccount:return"TokenAssociateToAccount";case RequestType.TokenDissociateFromAccount:return"TokenDissociateFromAccount";case RequestType.ScheduleCreate:return"ScheduleCreate";case RequestType.ScheduleDelete:return"ScheduleDelete";case RequestType.ScheduleSign:return"ScheduleSign";case RequestType.ScheduleGetInfo:return"ScheduleGetInfo";case RequestType.TokenGetAccountNftInfos:return"TokenGetAccountNftInfos";case RequestType.TokenGetNftInfo:return"TokenGetNftInfo";case RequestType.TokenGetNftInfos:return"TokenGetNftInfos";case RequestType.TokenFeeScheduleUpdate:return"TokenFeeScheduleUpdate";case RequestType.NetworkGetExecutionTime:return"NetworkGetExecutionTime";case RequestType.TokenPause:return"TokenPause";case RequestType.TokenUnpause:return"TokenUnpause";case RequestType.CryptoApproveAllowance:return"CryptoApproveAllowance";case RequestType.CryptoDeleteAllowance:return"CryptoDeleteAllowance";case RequestType.GetAccountDetails:return"GetAccountDetails";case RequestType.EthereumTransaction:return"EthereumTransaction";case RequestType.NodeStakeUpdate:return"NodeStakeUpdate";case RequestType.Prng:return"UtilPrng";case RequestType.TransactionGetFastRecord:return"TransactionGetFastRecord";case RequestType.TokenUpdateNfts:return"TokenUpdateNfts";case RequestType.NodeCreate:return"NodeCreate";case RequestType.NodeUpdate:return"NodeUpdate";case RequestType.NodeDelete:return"NodeDelete";case RequestType.TokenReject:return"TokenReject";case RequestType.TokenAirdrop:return"TokenAirdrop";case RequestType.TokenCancelAirdrop:return"TokenCancelAirdrop";case RequestType.TokenClaimAirdrop:return"TokenClaimAirdrop";case RequestType.TssMessage:return"TssMessage";case RequestType.TssVote:return"TssVote";case RequestType.TssShareSignature:return"TssShareSignature";case RequestType.TssEncryptionKey:return"TssEncryptionKey";case RequestType.StateSignatureTransaction:return"StateSignatureTransaction";case RequestType.HistoryAssemblySignature:return"HistoryAssemblySignature";case RequestType.HistoryProofKeyPublication:return"HistoryProofKeyPublication";case RequestType.HistoryProofVote:return"HistoryProofVote";case RequestType.HintsKeyPublication:return"HintsKeyPublication";case RequestType.HintsPreprocessingVote:return"HintsPreprocessingVote";case RequestType.HintsPartialSignature:return"HintsPartialSignature";case RequestType.CrsPublication:return"CrsPublication";case RequestType.AtomicBatch:return"AtomicBatch";case RequestType.LambdaSStore:return"LambdaSStore";case RequestType.HookDispatch:return"HookDispatch";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return RequestType.None;case 1:return RequestType.CryptoTransfer;case 2:return RequestType.CryptoUpdate;case 3:return RequestType.CryptoDelete;case 4:return RequestType.CryptoAddLiveHash;case 5:return RequestType.CryptoDeleteLiveHash;case 6:return RequestType.ContractCall;case 7:return RequestType.ContractCreate;case 8:return RequestType.ContractUpdate;case 9:return RequestType.FileCreate;case 10:return RequestType.FileAppend;case 11:return RequestType.FileUpdate;case 12:return RequestType.FileDelete;case 13:return RequestType.CryptoGetAccountBalance;case 14:return RequestType.CryptoGetAccountRecords;case 15:return RequestType.CryptoGetInfo;case 16:return RequestType.ContractCallLocal;case 17:return RequestType.ContractGetInfo;case 18:return RequestType.ContractGetBytecode;case 19:return RequestType.GetBySolidityID;case 20:return RequestType.GetByKey;case 21:return RequestType.CryptoGetLiveHash;case 22:return RequestType.CryptoGetStakers;case 23:return RequestType.FileGetContents;case 24:return RequestType.FileGetInfo;case 25:return RequestType.TransactionGetRecord;case 26:return RequestType.ContractGetRecords;case 27:return RequestType.CryptoCreate;case 28:return RequestType.SystemDelete;case 29:return RequestType.SystemUndelete;case 30:return RequestType.ContractDelete;case 31:return RequestType.Freeze;case 32:return RequestType.CreateTransactionRecord;case 33:return RequestType.CryptoAccountAutoRenew;case 34:return RequestType.ContractAutoRenew;case 35:return RequestType.GetVersionInfo;case 36:return RequestType.TransactionGetReceipt;case 50:return RequestType.ConsensusCreateTopic;case 51:return RequestType.ConsensusUpdateTopic;case 52:return RequestType.ConsensusDeleteTopic;case 53:return RequestType.ConsensusGetTopicInfo;case 54:return RequestType.ConsensusSubmitMessage;case 55:return RequestType.UncheckedSubmit;case 56:return RequestType.TokenCreate;case 58:return RequestType.TokenGetInfo;case 59:return RequestType.TokenFreezeAccount;case 60:return RequestType.TokenUnfreezeAccount;case 61:return RequestType.TokenGrantKycToAccount;case 62:return RequestType.TokenRevokeKycFromAccount;case 63:return RequestType.TokenDelete;case 64:return RequestType.TokenUpdate;case 65:return RequestType.TokenMint;case 66:return RequestType.TokenBurn;case 67:return RequestType.TokenAccountWipe;case 68:return RequestType.TokenAssociateToAccount;case 69:return RequestType.TokenDissociateFromAccount;case 70:return RequestType.ScheduleCreate;case 71:return RequestType.ScheduleDelete;case 72:return RequestType.ScheduleSign;case 73:return RequestType.ScheduleGetInfo;case 74:return RequestType.TokenGetAccountNftInfos;case 75:return RequestType.TokenGetNftInfo;case 76:return RequestType.TokenGetNftInfos;case 77:return RequestType.TokenFeeScheduleUpdate;case 78:return RequestType.NetworkGetExecutionTime;case 79:return RequestType.TokenPause;case 80:return RequestType.TokenUnpause;case 81:return RequestType.CryptoApproveAllowance;case 82:return RequestType.CryptoDeleteAllowance;case 83:return RequestType.GetAccountDetails;case 84:return RequestType.EthereumTransaction;case 85:return RequestType.NodeStakeUpdate;case 86:return RequestType.Prng;case 87:return RequestType.TransactionGetFastRecord;case 88:return RequestType.TokenUpdateNfts;case 89:return RequestType.NodeCreate;case 90:return RequestType.NodeUpdate;case 91:return RequestType.NodeDelete;case 92:return RequestType.TokenReject;case 93:return RequestType.TokenAirdrop;case 94:return RequestType.TokenCancelAirdrop;case 95:return RequestType.TokenClaimAirdrop;case 96:return RequestType.TssMessage;case 97:return RequestType.TssVote;case 98:return RequestType.TssShareSignature;case 99:return RequestType.TssEncryptionKey;case 100:return RequestType.StateSignatureTransaction;case 101:return RequestType.HintsKeyPublication;case 102:return RequestType.HintsPreprocessingVote;case 103:return RequestType.HintsPartialSignature;case 104:return RequestType.HistoryAssemblySignature;case 105:return RequestType.HistoryProofKeyPublication;case 106:return RequestType.HistoryProofVote;case 107:return RequestType.CrsPublication;case 108:return RequestType.AtomicBatch;case 109:return RequestType.LambdaSStore;case 110:return RequestType.HookDispatch}throw new Error(`(BUG) RequestType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}RequestType.None=new RequestType(0),RequestType.CryptoTransfer=new RequestType(1),RequestType.CryptoUpdate=new RequestType(2),RequestType.CryptoDelete=new RequestType(3),RequestType.CryptoAddLiveHash=new RequestType(4),RequestType.CryptoDeleteLiveHash=new RequestType(5),RequestType.ContractCall=new RequestType(6),RequestType.ContractCreate=new RequestType(7),RequestType.ContractUpdate=new RequestType(8),RequestType.FileCreate=new RequestType(9),RequestType.FileAppend=new RequestType(10),RequestType.FileUpdate=new RequestType(11),RequestType.FileDelete=new RequestType(12),RequestType.CryptoGetAccountBalance=new RequestType(13),RequestType.CryptoGetAccountRecords=new RequestType(14),RequestType.CryptoGetInfo=new RequestType(15),RequestType.ContractCallLocal=new RequestType(16),RequestType.ContractGetInfo=new RequestType(17),RequestType.ContractGetBytecode=new RequestType(18),RequestType.GetBySolidityID=new RequestType(19),RequestType.GetByKey=new RequestType(20),RequestType.CryptoGetLiveHash=new RequestType(21),RequestType.CryptoGetStakers=new RequestType(22),RequestType.FileGetContents=new RequestType(23),RequestType.FileGetInfo=new RequestType(24),RequestType.TransactionGetRecord=new RequestType(25),RequestType.ContractGetRecords=new RequestType(26),RequestType.CryptoCreate=new RequestType(27),RequestType.SystemDelete=new RequestType(28),RequestType.SystemUndelete=new RequestType(29),RequestType.ContractDelete=new RequestType(30),RequestType.Freeze=new RequestType(31),RequestType.CreateTransactionRecord=new RequestType(32),RequestType.CryptoAccountAutoRenew=new RequestType(33),RequestType.ContractAutoRenew=new RequestType(34),RequestType.GetVersionInfo=new RequestType(35),RequestType.TransactionGetReceipt=new RequestType(36),RequestType.ConsensusCreateTopic=new RequestType(50),RequestType.ConsensusUpdateTopic=new RequestType(51),RequestType.ConsensusDeleteTopic=new RequestType(52),RequestType.ConsensusGetTopicInfo=new RequestType(53),RequestType.ConsensusSubmitMessage=new RequestType(54),RequestType.UncheckedSubmit=new RequestType(55),RequestType.TokenCreate=new RequestType(56),RequestType.TokenGetInfo=new RequestType(58),RequestType.TokenFreezeAccount=new RequestType(59),RequestType.TokenUnfreezeAccount=new RequestType(60),RequestType.TokenGrantKycToAccount=new RequestType(61),RequestType.TokenRevokeKycFromAccount=new RequestType(62),RequestType.TokenDelete=new RequestType(63),RequestType.TokenUpdate=new RequestType(64),RequestType.TokenMint=new RequestType(65),RequestType.TokenBurn=new RequestType(66),RequestType.TokenAccountWipe=new RequestType(67),RequestType.TokenAssociateToAccount=new RequestType(68),RequestType.TokenDissociateFromAccount=new RequestType(69),RequestType.ScheduleCreate=new RequestType(70),RequestType.ScheduleDelete=new RequestType(71),RequestType.ScheduleSign=new RequestType(72),RequestType.ScheduleGetInfo=new RequestType(73),RequestType.TokenGetAccountNftInfos=new RequestType(74),RequestType.TokenGetNftInfo=new RequestType(75),RequestType.TokenGetNftInfos=new RequestType(76),RequestType.TokenFeeScheduleUpdate=new RequestType(77),RequestType.NetworkGetExecutionTime=new RequestType(78),RequestType.TokenPause=new RequestType(79),RequestType.TokenUnpause=new RequestType(80),RequestType.CryptoApproveAllowance=new RequestType(81),RequestType.CryptoDeleteAllowance=new RequestType(82),RequestType.GetAccountDetails=new RequestType(83),RequestType.EthereumTransaction=new RequestType(84),RequestType.NodeStakeUpdate=new RequestType(85),RequestType.Prng=new RequestType(86),RequestType.TransactionGetFastRecord=new RequestType(87),RequestType.TokenUpdateNfts=new RequestType(88),RequestType.NodeCreate=new RequestType(89),RequestType.NodeUpdate=new RequestType(90),RequestType.NodeDelete=new RequestType(91),RequestType.TokenReject=new RequestType(92),RequestType.TokenAirdrop=new RequestType(93),RequestType.TokenCancelAirdrop=new RequestType(94),RequestType.TokenClaimAirdrop=new RequestType(95),RequestType.TssMessage=new RequestType(96),RequestType.TssVote=new RequestType(97),RequestType.TssShareSignature=new RequestType(98),RequestType.TssEncryptionKey=new RequestType(99),RequestType.StateSignatureTransaction=new RequestType(100),RequestType.HintsKeyPublication=new RequestType(101),RequestType.HintsPreprocessingVote=new RequestType(102),RequestType.HintsPartialSignature=new RequestType(103),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.CrsPublication=new RequestType(107),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.AtomicBatch=new RequestType(108),RequestType.LambdaSStore=new RequestType(109),RequestType.HookDispatch=new RequestType(110);class TransactionFeeSchedule{constructor(e={}){this.hederaFunctionality=e.hederaFunctionality,this.feeData=e.feeData,this.fees=e.fees}static fromBytes(e){return TransactionFeeSchedule._fromProtobuf(libExports.proto.TransactionFeeSchedule.decode(e))}static _fromProtobuf(e){return new TransactionFeeSchedule({hederaFunctionality:null!=e.hederaFunctionality?RequestType._fromCode(e.hederaFunctionality):void 0,feeData:null!=e.feeData?FeeData._fromProtobuf(e.feeData):void 0,fees:null!=e.fees?e.fees.map(e=>FeeData._fromProtobuf(e)):void 0})}_toProtobuf(){return{hederaFunctionality:null!=this.hederaFunctionality?this.hederaFunctionality.valueOf():void 0,feeData:null!=this.feeData?this.feeData._toProtobuf():void 0,fees:null!=this.fees?this.fees.map(e=>e._toProtobuf()):void 0}}toBytes(){return libExports.proto.TransactionFeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedule{constructor(e={}){this.transactionFeeSchedule=e.transactionFeeSchedule,this.expirationTime=e.expirationTime}static fromBytes(e){return FeeSchedule._fromProtobuf(libExports.proto.FeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedule({transactionFeeSchedule:null!=e.transactionFeeSchedule?e.transactionFeeSchedule.map(e=>TransactionFeeSchedule._fromProtobuf(e)):void 0,expirationTime:null!=e.expiryTime?Timestamp._fromProtobuf(e.expiryTime):void 0})}_toProtobuf(){return{transactionFeeSchedule:null!=this.transactionFeeSchedule?this.transactionFeeSchedule.map(e=>e._toProtobuf()):void 0,expiryTime:null!=this.expirationTime?this.expirationTime._toProtobuf():void 0}}toBytes(){return libExports.proto.FeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedules{constructor(e={}){this.current=e.currentFeeSchedule,this.next=e.nextFeeSchedule}static fromBytes(e){return FeeSchedules._fromProtobuf(libExports.proto.CurrentAndNextFeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedules({currentFeeSchedule:null!=e.currentFeeSchedule?FeeSchedule._fromProtobuf(e.currentFeeSchedule):void 0,nextFeeSchedule:null!=e.nextFeeSchedule?FeeSchedule._fromProtobuf(e.nextFeeSchedule):void 0})}_toProtobuf(){return{currentFeeSchedule:null!=this.current?this.current._toProtobuf():void 0,nextFeeSchedule:null!=this.next?this.next._toProtobuf():void 0}}toBytes(){return libExports.proto.CurrentAndNextFeeSchedule.encode(this._toProtobuf()).finish()}}class FileContentsQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetContents;return new FileContentsQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileContent(t)}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_mapResponseHeader(e){return e.fileGetContents.header}_mapResponse(e){const t=e.fileGetContents.fileContents.contents;return Promise.resolve(t)}_onMakeRequest(e){return{fileGetContents:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileContentsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetContents",FileContentsQuery._fromProtobuf);const{proto:proto$2}=HieroProto;class FileInfo{constructor(e){this.fileId=e.fileId,this.size=e.size,this.expirationTime=e.expirationTime,this.isDeleted=e.isDeleted,this.keys=e.keys,this.fileMemo=e.fileMemo,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.size;return new FileInfo({fileId:FileId._fromProtobuf(e.fileID),size:t instanceof Long?t:Long.fromValue(t),expirationTime:Timestamp._fromProtobuf(e.expirationTime),isDeleted:e.deleted,keys:null!=e.keys?KeyList.__fromProtobufKeyList(e.keys):new KeyList,fileMemo:null!=e.memo?e.memo:"",ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null})}_toProtobuf(){return{fileID:this.fileId._toProtobuf(),size:this.size,expirationTime:this.expirationTime._toProtobuf(),deleted:this.isDeleted,keys:this.keys._toProtobufKey().keyList,memo:this.fileMemo,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null}}static fromBytes(e){return FileInfo._fromProtobuf(libExports.proto.FileGetInfoResponse.FileInfo.decode(e))}toBytes(){return proto$2.FileGetInfoResponse.FileInfo.encode(this._toProtobuf()).finish()}}class FileInfoQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetInfo;return new FileInfoQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileInfo(t)}_mapResponseHeader(e){return e.fileGetInfo.header}_mapResponse(e,t,n){const r=e.fileGetInfo;return Promise.resolve(FileInfo._fromProtobuf(r.fileInfo))}_onMakeRequest(e){return{fileGetInfo:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetInfo",FileInfoQuery._fromProtobuf);class FileUpdateTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._keys=null,this._expirationTime=null,this._contents=null,this._fileMemo=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const i=o[0].fileUpdate;return Transaction._fromProtobufTransactions(new FileUpdateTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,keys:null!=i.keys&&null!=i.keys.keys?i.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0,contents:null!=i.contents?i.contents:void 0,fileMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode$1(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}clearFileMemo(){return this._requireNotFrozen(),this._fileMemo=null,this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.updateFile(t)}_getTransactionDataCase(){return"fileUpdate"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,contents:this._contents,memo:null!=this._fileMemo?{value:this._fileMemo}:null}}_getLogId(){return`FileUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileUpdate",FileUpdateTransaction._fromProtobuf);class LiveHashAddTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._keys=null,this._duration=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.keys&&this.setKeys(e.keys),null!=e.duration&&this.setDuration(e.duration),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoAddLiveHash.liveHash;return Transaction._fromProtobufTransactions(new LiveHashAddTransaction({hash:null!=i.hash?i.hash:void 0,keys:null!=i.keys&&null!=i.keys.keys?i.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,duration:null!=i.duration&&null!=i.duration.seconds?i.duration.seconds:void 0,accountId:null!=i.accountId?AccountId._fromProtobuf(i.accountId):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get keys(){return this._keys}setKeys(e){return this._requireNotFrozen(),this._keys=e instanceof KeyList?e.toArray():e,this}get duration(){return this._duration}setDuration(e){return this._requireNotFrozen(),this._duration=e instanceof Duration?e:new Duration(e),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.addLiveHash(t)}_getTransactionDataCase(){return"cryptoAddLiveHash"}_makeTransactionData(){return{liveHash:{hash:this._hash,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:void 0,duration:null!=this._duration?this._duration._toProtobuf():null,accountId:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`LiveHashAddTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoAddLiveHash",LiveHashAddTransaction._fromProtobuf);class LiveHashDeleteTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoDeleteLiveHash;return Transaction._fromProtobufTransactions(new LiveHashDeleteTransaction({hash:null!=i.liveHashToDelete?i.liveHashToDelete:void 0,accountId:null!=i.accountOfLiveHash?AccountId._fromProtobuf(i.accountOfLiveHash):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.deleteLiveHash(t)}_getTransactionDataCase(){return"cryptoDeleteLiveHash"}_makeTransactionData(){return{liveHashToDelete:this._hash,accountOfLiveHash:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`LiveHashDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteLiveHash",LiveHashDeleteTransaction._fromProtobuf);class LiveHashQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._hash=null,null!=e.hash&&this.setHash(e.hash)}static _fromProtobuf(e){const t=e.cryptoGetLiveHash;return new LiveHashQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,hash:null!=t.hash?t.hash:void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get liveHash(){return this._hash}setHash(e){return this._hash=e,this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getLiveHash(t)}_mapResponseHeader(e){return e.cryptoGetLiveHash.header}_mapResponse(e){const t=e.cryptoGetLiveHash;return Promise.resolve(LiveHash._fromProtobuf(t.liveHash))}_onMakeRequest(e){return{cryptoGetLiveHash:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,hash:this._hash}}}_getLogId(){return`LiveHashQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetLiveHash",LiveHashQuery._fromProtobuf);class MirrorNodeContractQuery{constructor(){this._contractId=null,this._contractEvmAddress=null,this._sender=null,this._senderEvmAddress=null,this._functionName=null,this._functionParameters=null,this._value=null,this._gasLimit=null,this._gasPrice=null,this._blockNumber=null}setContractId(e){return this._contractId=e,this}setSender(e){return this._sender=e,this}setSenderEvmAddress(e){return this._senderEvmAddress=e,this}setFunction(e,t){return this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}setValue(e){return this._value=e,this}setGasLimit(e){return this._gasLimit=e,this}setGasPrice(e){return this._gasPrice=e,this}setBlockNumber(e){return this._blockNumber=e,this}get contractId(){return this._contractId}get contractEvmAddress(){const e=this._contractId?.toEvmAddress();if(null==e)throw new Error("Contract ID is not set");return e}get sender(){return this._sender}get senderEvmAddress(){return this._senderEvmAddress}get callData(){return this._functionParameters}get value(){return this._value}get gasLimit(){return this._gasLimit}get gasPrice(){return this._gasPrice}get blockNumber(){return this._blockNumber}async performMirrorNodeRequest(e,t){if(null==this.contractId)throw new Error("Contract ID is not set");this._fillEvmAddress();let n=e.mirrorRestApiBaseUrl;const r=e._mirrorNetwork.getNextMirrorNode().address.address;if("localhost"===r||"127.0.0.1"===r){const e=new URL(n);e.protocol="http:",e.port="8545",n=e.toString()}const o=`${n}/contracts/call`,i=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return await i.json()}_fillEvmAddress(){null==this.senderEvmAddress&&null!=this.sender&&(this._senderEvmAddress=this.sender.toEvmAddress())}get JSONPayload(){throw new Error("JSONPayload getter is not implemented. Please implement this method in the subclass.")}}class MirrorNodeContractCallQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$5(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!1,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){return(await this.performMirrorNodeRequest(e,this.JSONPayload)).result}}class MirrorNodeContractEstimateQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$5(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!0,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){const t=await this.performMirrorNodeRequest(e,this.JSONPayload);return Number(t.result)}}class IPv4AddressPart{constructor(e={}){this._left=null,null!=e.left&&this.setLeft(e.left),this._right=null,null!=e.right&&this.setRight(e.right)}get left(){return this._left}setLeft(e){return this._left=e,this}get right(){return this._right}setRight(e){return this._right=e,this}toString(){return null!=this._left&&null!=this._right?`${this._left.toString()}.${this._right.toString()}`:""}}class IPv4Address{constructor(e={}){this._network=null,null!=e.network&&this.setNetwork(e.network),this._host=null,null!=e.host&&this.setHost(e.host)}get newtork(){return this._network}setNetwork(e){return this._network=e,this}get host(){return this._host}setHost(e){return this._host=e,this}static _fromProtobuf(e){return new IPv4Address({network:(new IPv4AddressPart).setLeft(e[0]).setRight(e[1]),host:(new IPv4AddressPart).setLeft(e[2]).setRight(e[3])})}_toProtobuf(){return Uint8Array.of(null!=this._network&&null!=this._network._left?this._network._left:0,null!=this._network&&null!=this._network.right?this._network.right:0,null!=this._host&&null!=this._host.left?this._host.left:0,null!=this._host&&null!=this._host.right?this._host.right:0)}static _fromString(e){const t=e.split(".");if(4!==t.length)throw new Error("Invalid IPv4 address format");const n=(new IPv4AddressPart).setLeft(Number(t[0])).setRight(Number(t[1])),r=(new IPv4AddressPart).setLeft(Number(t[2])).setRight(Number(t[3]));return new IPv4Address({network:n,host:r})}toString(){return null!=this._network&&null!=this._host?`${this._network.toString()}.${this._host.toString()}`:""}}class EndPoint{constructor(e={}){this._address=null,null!=e.address&&this.setAddress(e.address),this._port=null,null!=e.port&&this.setPort(e.port)}get address(){return this._address}setAddress(e){return this._address=e,this}get port(){return this._port}setPort(e){return this._port=e,this}static _fromProtobuf(e){let t;return e.domainName?t=e.domainName:e.ipAddressV4&&(t=IPv4Address._fromProtobuf(e.ipAddressV4)),new EndPoint({address:t,port:null!=e.port?e.port:void 0})}_toProtobuf(){return"string"!=typeof this._address?{ipAddressV4:null!=this._address?this._address._toProtobuf():null,port:this._port}:{domainName:this._address,port:this._port}}static fromJSON(e){return new EndPoint({address:e.address||void 0,port:null!=e.port?parseInt(e.port,10):void 0})}toString(){return`${null!=this._address?this._address.toString():""}:${null!=this._port?this._port.toString():""}`}toJSON(){return{address:null!=this._address?this._address.toString():null,port:null!=this._port?this._port.toString():null}}}class NodeAddress{constructor(e={}){this._publicKey=null,null!=e.publicKey&&this.setPublicKey(e.publicKey),this._nodeId=null,null!=e.nodeId&&this.setNodeId(e.nodeId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._certHash=null,null!=e.certHash&&this.setCertHash(e.certHash),this._addresses=[],null!=e.addresses&&this.setAddresses(e.addresses),this._description=null,null!=e.description&&this.setDescription(e.description),this._stake=null,null!=e.stake&&this.setStake(e.stake)}get publicKey(){return this._publicKey}setPublicKey(e){return this._publicKey=e,this}get nodeId(){return this._nodeId}setNodeId(e){return this._nodeId=e,this}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get certHash(){return this._certHash}setCertHash(e){return this._certHash=e,this}get addresses(){return this._addresses}setAddresses(e){return this._addresses=e,this}get description(){return this._description}setDescription(e){return this._description=e,this}get stake(){return this._stake}setStake(e){return this._stake=e,this}static _fromProtobuf(e){return new NodeAddress({publicKey:null!=e.RSA_PubKey?e.RSA_PubKey:void 0,nodeId:null!=e.nodeId?e.nodeId:void 0,accountId:null!=e.nodeAccountId?AccountId._fromProtobuf(e.nodeAccountId):void 0,certHash:null!=e.nodeCertHash?e.nodeCertHash:void 0,addresses:null!=e.serviceEndpoint?e.serviceEndpoint.map(e=>EndPoint._fromProtobuf(e)):void 0,description:null!=e.description?e.description:void 0,stake:null!=e.stake?e.stake:void 0})}_toProtobuf(){return{RSA_PubKey:this._publicKey,nodeId:this._nodeId,nodeAccountId:null!=this._accountId?this._accountId._toProtobuf():null,nodeCertHash:this._certHash,serviceEndpoint:this._addresses.map(e=>e._toProtobuf()),description:this._description,stake:this._stake}}static fromJSON(e){return new NodeAddress({publicKey:e.publicKey??void 0,nodeId:null!=e.nodeId?Long.fromString(e.nodeId):void 0,accountId:e.accountId?AccountId.fromString(e.accountId):void 0,certHash:null!=e.certHash?encode$1(e.certHash):void 0,addresses:null!=e.addresses?e.addresses.map(e=>EndPoint.fromJSON(e)):void 0,description:e.description??void 0,stake:null!=e.stake?Long.fromString(e.stake):void 0})}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{publicKey:this._publicKey,nodeId:null!=this._nodeId?this._nodeId.toString():null,accountId:null!=this._accountId?this._accountId.toString():null,certHash:null!=this._certHash?decode$1(this._certHash):null,addresses:this._addresses.map(e=>e.toJSON()),description:this._description,stake:null!=this._stake?this._stake.toString():null}}}class NodeAddressBook{constructor(e={}){this._nodeAddresses=[],null!=e.nodeAddresses&&this.setNodeAddresses(e.nodeAddresses)}get nodeAddresses(){return this._nodeAddresses}setNodeAddresses(e){return this._nodeAddresses=e,this}static fromBytes(e){return NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(e))}static _fromProtobuf(e){return new NodeAddressBook({nodeAddresses:null!=e.nodeAddress?e.nodeAddress.map(e=>NodeAddress._fromProtobuf(e)):void 0})}_toProtobuf(){return{nodeAddress:this._nodeAddresses.map(e=>e._toProtobuf())}}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{nodeAddresses:this._nodeAddresses.map(e=>e.toJSON())}}toBytes(){return libExports.proto.NodeAddressBook.encode(this._toProtobuf()).finish()}}class SemanticVersion{constructor(e){this.major=e.major,this.minor=e.minor,this.patch=e.patch,Object.freeze(this)}static _fromProtobuf(e){return new SemanticVersion({major:e.major,minor:e.minor,patch:e.patch})}_toProtobuf(){return{major:this.major,minor:this.minor,patch:this.patch}}static fromBytes(e){return SemanticVersion._fromProtobuf(libExports.proto.SemanticVersion.decode(e))}toBytes(){return libExports.proto.SemanticVersion.encode(this._toProtobuf()).finish()}}class NetworkVersionInfo{constructor(e){this.protobufVersion=e.protobufVersion,this.servicesVersion=e.servicesVersion,Object.freeze(this)}static _fromProtobuf(e){return new NetworkVersionInfo({protobufVersion:SemanticVersion._fromProtobuf(e.hapiProtoVersion),servicesVersion:SemanticVersion._fromProtobuf(e.hederaServicesVersion)})}_toProtobuf(){return{hapiProtoVersion:this.protobufVersion._toProtobuf(),hederaServicesVersion:this.servicesVersion._toProtobuf()}}static fromBytes(e){return NetworkVersionInfo._fromProtobuf(libExports.proto.NetworkGetVersionInfoResponse.decode(e))}toBytes(){return libExports.proto.NetworkGetVersionInfoResponse.encode(this._toProtobuf()).finish()}}class NetworkVersionInfoQuery extends Query{constructor(){super()}static _fromProtobuf(e){return new NetworkVersionInfoQuery}_execute(e,t){return e.network.getVersionInfo(t)}_mapResponseHeader(e){return e.networkGetVersionInfo.header}_mapResponse(e){const t=e.networkGetVersionInfo;return Promise.resolve(NetworkVersionInfo._fromProtobuf(t))}_onMakeRequest(e){return{networkGetVersionInfo:{header:e}}}_getLogId(){return`NetworkVersionInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("networkGetVersionInfo",NetworkVersionInfoQuery._fromProtobuf);var Provider={};class PrngTransaction extends Transaction{constructor(e={}){super(),this._range=null,null!=e.range&&this.setRange(e.range)}setRange(e){return this._range=e,this}get range(){return this._range}_validateChecksums(e){null!=this._range&&isNumber(this._range)&&this._validateChecksums(e)}_execute(e,t){return e.util.prng(t)}static _fromProtobuf(e,t,n,r,o){const i=o[0].utilPrng;return Transaction._fromProtobufTransactions(new PrngTransaction({range:i.range}),e,t,n,r,o)}_getTransactionDataCase(){return"utilPrng"}_makeTransactionData(){return{range:this.range}}_getLogId(){return`RandomGenerate:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("utilPrng",PrngTransaction._fromProtobuf);class ProxyStaker{constructor(e){this.accountId=e.accountId,this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),Object.freeze(this)}static _fromProtobuf(e){return new ProxyStaker({accountId:AccountId._fromProtobuf(e.accountID),amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars()}}}class ScheduleCreateTransaction extends Transaction{constructor(e={}){super(),this._adminKey=null,this._scheduledTransaction=null,this._payerAccountId=null,this._scheduleMemo=null,this._scheduledSignerPublicKeys=new Set,this._expirationTime=null,this._waitForExpiry=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.payerAccountID&&this.setPayerAccountId(e.payerAccountID),null!=e.scheduleMemo&&this.setScheduleMemo(e.scheduleMemo),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const i=o[0],a=i.scheduleCreate,s=new ScheduleCreateTransaction({adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,payerAccountID:null!=a.payerAccountID?AccountId._fromProtobuf(a.payerAccountID):void 0,scheduleMemo:null!=a.memo?a.memo:void 0,waitForExpiry:null!=a.waitForExpiry?a.waitForExpiry:void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0});if(null!=i.scheduleCreate){const e=i.scheduleCreate.scheduledTransactionBody,t=libExports.proto.TransactionBody.encode(e).finish(),n={signedTransactionBytes:libExports.proto.SignedTransaction.encode({bodyBytes:t}).finish()},r=libExports.proto.TransactionList.encode({transactionList:[n]}).finish(),o=Transaction.fromBytes(r);s._setScheduledTransaction(o)}return Transaction._fromProtobufTransactions(s,e,t,n,r,o)}_setScheduledTransaction(e){return this._scheduledTransaction=e,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get payerAccountId(){return this._payerAccountId}setPayerAccountId(e){return this._requireNotFrozen(),this._payerAccountId=e,this}setScheduleMemo(e){return this._requireNotFrozen(),this._scheduleMemo=e,this}get getScheduleMemo(){return this._requireNotFrozen(),this._scheduleMemo}setScheduledTransaction(e){return this._requireNotFrozen(),e._requireNotFrozen(),this._scheduledTransaction=e.schedule()._scheduledTransaction,this}_validateChecksums(e){null!=this._payerAccountId&&this._payerAccountId.validateChecksum(e)}_execute(e,t){return e.schedule.createSchedule(t)}_getTransactionDataCase(){return"scheduleCreate"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,payerAccountID:null!=this._payerAccountId?this._payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this._scheduledTransaction?this._scheduledTransaction._getScheduledTransactionBody():null,memo:this._scheduleMemo,waitForExpiry:this._waitForExpiry,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`ScheduleCreateTransaction:${this._transactionIds.current.validStart.toString()}`}setExpirationTime(e){return this._expirationTime=e,this}get expirationTime(){return this._requireNotFrozen(),this._expirationTime}setWaitForExpiry(e){return this._waitForExpiry=e,this}get waitForExpiry(){return this._requireNotFrozen(),this._waitForExpiry}}TRANSACTION_REGISTRY.set("scheduleCreate",ScheduleCreateTransaction._fromProtobuf),SCHEDULE_CREATE_TRANSACTION.push(()=>new ScheduleCreateTransaction);class ScheduleDeleteTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const i=o[0].scheduleDelete;return Transaction._fromProtobufTransactions(new ScheduleDeleteTransaction({scheduleId:null!=i.scheduleID?ScheduleId._fromProtobuf(i.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.deleteSchedule(t)}_getTransactionDataCase(){return"scheduleDelete"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleDelete",ScheduleDeleteTransaction._fromProtobuf);const{proto:proto$1}=HieroProto;class ScheduleInfo{constructor(e){this.scheduleId=e.scheduleId,this.creatorAccountId=e.creatorAccountID,this.payerAccountId=e.payerAccountID,this.schedulableTransactionBody=e.schedulableTransactionBody,this.signers=e.signers,this.scheduleMemo=e.scheduleMemo,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.executed=e.executed,this.deleted=e.deleted,this.scheduledTransactionId=e.scheduledTransactionId,this.waitForExpiry=e.waitForExpiry,Object.freeze(this)}static _fromProtobuf(e){return new ScheduleInfo({scheduleId:ScheduleId._fromProtobuf(e.scheduleID),creatorAccountID:null!=e.creatorAccountID?AccountId._fromProtobuf(e.creatorAccountID):null,payerAccountID:null!=e.payerAccountID?AccountId._fromProtobuf(e.payerAccountID):null,schedulableTransactionBody:null!=e.scheduledTransactionBody?e.scheduledTransactionBody:null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,signers:null!=e.signers?KeyList.__fromProtobufKeyList(e.signers):null,scheduleMemo:null!=e.memo?e.memo:null,expirationTime:null!=e.expirationTime?Timestamp._fromProtobuf(e.expirationTime):null,executed:null!=e.executionTime?Timestamp._fromProtobuf(e.executionTime):null,deleted:null!=e.deletionTime?Timestamp._fromProtobuf(e.deletionTime):null,scheduledTransactionId:null!=e.scheduledTransactionID?TransactionId._fromProtobuf(e.scheduledTransactionID):null,waitForExpiry:null!=e.waitForExpiry&&e.waitForExpiry})}_toProtobuf(){return{scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,creatorAccountID:null!=this.creatorAccountId?this.creatorAccountId._toProtobuf():null,payerAccountID:null!=this.payerAccountId?this.payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this.schedulableTransactionBody?this.schedulableTransactionBody:null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,signers:null!=this.signers?this.signers._toProtobufKey().keyList:null,memo:null!=this.scheduleMemo?this.scheduleMemo:"",expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,waitForExpiry:this.waitForExpiry}}get scheduledTransaction(){if(null==this.schedulableTransactionBody)throw new Error("Scheduled transaction body is empty");const e=new proto$1.SchedulableTransactionBody(this.schedulableTransactionBody),t=e.data;return Transaction.fromBytes(proto$1.TransactionList.encode({transactionList:[{signedTransactionBytes:proto$1.SignedTransaction.encode({bodyBytes:proto$1.TransactionBody.encode({transactionFee:this.schedulableTransactionBody.transactionFee,memo:this.schedulableTransactionBody.memo,[t]:e[t]}).finish()}).finish()}]}).finish())}}class ScheduleInfoQuery extends Query{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId)}static _fromProtobuf(e){const t=e.scheduleGetInfo;return new ScheduleInfoQuery({scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):void 0})}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.getScheduleInfo(t)}_mapResponseHeader(e){return e.scheduleGetInfo.header}_mapResponse(e,t,n){const r=e.scheduleGetInfo;return Promise.resolve(ScheduleInfo._fromProtobuf(r.scheduleInfo))}_onMakeRequest(e){return{scheduleGetInfo:{header:e,scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}}_getLogId(){return`ScheduleInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("scheduleGetInfo",ScheduleInfoQuery._fromProtobuf);class ScheduleSignTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const i=o[0].scheduleSign;return Transaction._fromProtobufTransactions(new ScheduleSignTransaction({scheduleId:null!=i.scheduleID?ScheduleId._fromProtobuf(i.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.signSchedule(t)}_getTransactionDataCase(){return"scheduleSign"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleSignTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleSign",ScheduleSignTransaction._fromProtobuf);var Signer={};class SignerSignature{constructor(e){this.publicKey=e.publicKey,this.signature=e.signature,this.accountId=e.accountId}}class SubscriptionHandle{constructor(){this._call=null,this._unsubscribed=!1}_setCall(e){this._call=e}unsubscribe(){null!=this._call&&(this._unsubscribed=!0,this._call())}}class SystemDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,this._expirationTime=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const i=o[0].systemDelete;return Transaction._fromProtobufTransactions(new SystemDeleteTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e,this}_execute(e,t){return null!=this._fileId?e.file.systemDelete(t):e.smartContract.systemDelete(t)}_getTransactionDataCase(){return"systemDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`SystemDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemDelete",SystemDeleteTransaction._fromProtobuf);class SystemUndeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].systemUndelete;return Transaction._fromProtobufTransactions(new SystemUndeleteTransaction({fileId:null!=i.fileID?FileId._fromProtobuf(i.fileID):void 0,contractId:null!=i.contractID?ContractId._fromProtobuf(i.contractID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}_execute(e,t){return null!=this._fileId?e.file.systemUndelete(t):e.smartContract.systemUndelete(t)}_getTransactionDataCase(){return"systemUndelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}_getLogId(){return`SystemUndeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemUndelete",SystemUndeleteTransaction._fromProtobuf);class TokenAssociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenAssociate;return Transaction._fromProtobufTransactions(new TokenAssociateTransaction({tokenIds:null!=i.tokens?i.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.associateTokens(t)}_getTransactionDataCase(){return"tokenAssociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenAssociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAssociate",TokenAssociateTransaction._fromProtobuf);class TokenBurnTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._serials=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenBurn;return Transaction._fromProtobufTransactions(new TokenBurnTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,amount:null!=i.amount?i.amount:void 0,serials:null!=i.serialNumbers?i.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>e instanceof Long?e:Long.fromValue(e)),this}_execute(e,t){return e.token.burnToken(t)}_getTransactionDataCase(){return"tokenBurn"}_makeTransactionData(){return{amount:this._amount,serialNumbers:this._serials,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenBurnTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenBurn",TokenBurnTransaction._fromProtobuf);class TokenReference{constructor(){this.fungibleToken=null,this.nft=null}static _fromProtobuf(e){return{fungibleToken:null!=e.fungibleToken?TokenId._fromProtobuf(e.fungibleToken):null,nft:null!=e.nft?NftId._fromProtobuf(e.nft):null}}}class TokenRejectTransaction extends Transaction{constructor(e={}){super(),this._owner=null,null!=e.owner&&this.setOwnerId(e.owner),this._tokenIds=[],this._nftIds=[],null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.nftIds&&this.setNftIds(e.nftIds)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenReject,a=i.rejections?.map(e=>TokenReference._fromProtobuf(e)),s=a?.filter(e=>e.fungibleToken).map(({fungibleToken:e})=>{if(null==e)throw new Error("Fungible Token cannot be null");return e}),c=a?.filter(e=>e.nft).map(({nft:e})=>{if(null==e)throw new Error("Nft cannot be null");return e});return Transaction._fromProtobufTransactions(new TokenRejectTransaction({owner:null!=i.owner?AccountId._fromProtobuf(i.owner):void 0,tokenIds:s,nftIds:c}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this._requireNotFrozen(),this._tokenIds?.push(e),this}get nftIds(){return this._nftIds}setNftIds(e){return this._requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this._requireNotFrozen(),this._nftIds?.push(e),this}get ownerId(){return this._owner}setOwnerId(e){return this._requireNotFrozen(),this._owner=e,this}_execute(e,t){return e.token.rejectToken(t)}_getTransactionDataCase(){return"tokenReject"}_makeTransactionData(){const e=[];for(const t of this._tokenIds)e.push({fungibleToken:t._toProtobuf()});for(const t of this._nftIds)e.push({nft:t._toProtobuf()});return{owner:this.ownerId?._toProtobuf()??null,rejections:e}}_getLogId(){return`TokenRejectTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenReject",TokenRejectTransaction._fromProtobuf);class TokenDissociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenDissociate;return Transaction._fromProtobufTransactions(new TokenDissociateTransaction({tokenIds:null!=i.tokens?i.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.dissociateTokens(t)}_getTransactionDataCase(){return"tokenDissociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenDissociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDissociate",TokenDissociateTransaction._fromProtobuf);class TokenRejectFlow{constructor(){this._ownerId=null,this._tokenIds=[],this._nftIds=[],this._freezeWithClient=null,this._signPrivateKey=null,this._signPublicKey=null,this._transactionSigner=null}setOwnerId(e){return this.requireNotFrozen(),this._ownerId=e,this}get ownerId(){return this._ownerId}setTokenIds(e){return this.requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this.requireNotFrozen(),this._tokenIds.push(e),this}get tokenIds(){return this._tokenIds}setNftIds(e){return this.requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this.requireNotFrozen(),this._nftIds.push(e),this}get nftIds(){return this._nftIds}sign(e){return this._signPrivateKey=e,this._signPublicKey=null,this._transactionSigner=null,this}signWith(e,t){return this._signPublicKey=e,this._transactionSigner=t,this._signPrivateKey=null,this}signWithOperator(e){const t=e.getOperator();if(null==t)throw new Error("Client operator must be set");return this._signPublicKey=t.publicKey,this._transactionSigner=t.transactionSigner,this._signPrivateKey=null,this}fillOutTransaction(e){this._freezeWithClient&&e.freezeWith(this._freezeWithClient),this._signPrivateKey?e.sign(this._signPrivateKey):this._signPublicKey&&this._transactionSigner&&e.signWith(this._signPublicKey,this._transactionSigner)}freezeWith(e){return this._freezeWithClient=e,this}async execute(e){const t=(new TokenRejectTransaction).setTokenIds(this.tokenIds).setNftIds(this.nftIds);this.ownerId&&t.setOwnerId(this.ownerId),this.fillOutTransaction(t);const n=this.nftIds.map(e=>e.tokenId).filter(function(e,t,n){return n.indexOf(e)===t}),r=(new TokenDissociateTransaction).setTokenIds([...this.tokenIds,...n]);null!=this.ownerId&&r.setAccountId(this.ownerId),this.fillOutTransaction(r);const o=await t.execute(e);await o.getReceipt(e);const i=await r.execute(e);return await i.getReceipt(e),o}requireNotFrozen(){if(null!=this._freezeWithClient)throw new Error("Transaction is already frozen and cannot be modified")}}class TokenType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenType.FungibleCommon:return"FUNGIBLE_COMMON";case TokenType.NonFungibleUnique:return"NON_FUNGIBLE_UNIQUE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenType.FungibleCommon;case 1:return TokenType.NonFungibleUnique}throw new Error(`(BUG) TokenType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenType.FungibleCommon=new TokenType(0),TokenType.NonFungibleUnique=new TokenType(1);class TokenSupplyType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenSupplyType.Infinite:return"INFINITE";case TokenSupplyType.Finite:return"FINITE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenSupplyType.Infinite;case 1:return TokenSupplyType.Finite}throw new Error(`(BUG) TokenSupplyType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenSupplyType.Infinite=new TokenSupplyType(0),TokenSupplyType.Finite=new TokenSupplyType(1);class TokenCreateTransaction extends Transaction{constructor(e={}){super(),this._tokenName=null,this._tokenSymbol=null,this._decimals=null,this._initialSupply=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._pauseKey=null,this._wipeKey=null,this._supplyKey=null,this._feeScheduleKey=null,this._freezeDefault=null,this._autoRenewAccountId=null,this._expirationTime=new Timestamp(Math.floor(Date.now()/1e3+DEFAULT_AUTO_RENEW_PERIOD.toNumber()),0),this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._tokenMemo=null,this._customFees=[],this._tokenType=null,this._supplyType=null,this._maxSupply=null,this._defaultMaxTransactionFee=new Hbar(30),this._metadataKey=null,this._metadata=null,null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.decimals&&this.setDecimals(e.decimals),null!=e.initialSupply&&this.setInitialSupply(e.initialSupply),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.freezeDefault&&this.setFreezeDefault(e.freezeDefault),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.tokenType&&this.setTokenType(e.tokenType),null!=e.supplyType&&this.setSupplyType(e.supplyType),null!=e.maxSupply&&this.setMaxSupply(e.maxSupply),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenCreation;return Transaction._fromProtobufTransactions(new TokenCreateTransaction({tokenName:null!=i.name?i.name:void 0,tokenSymbol:null!=i.symbol?i.symbol:void 0,decimals:null!=i.decimals?i.decimals:void 0,initialSupply:null!=i.initialSupply?i.initialSupply:void 0,treasuryAccountId:null!=i.treasury?AccountId._fromProtobuf(i.treasury):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,kycKey:null!=i.kycKey?Key._fromProtobufKey(i.kycKey):void 0,freezeKey:null!=i.freezeKey?Key._fromProtobufKey(i.freezeKey):void 0,pauseKey:null!=i.pauseKey?Key._fromProtobufKey(i.pauseKey):void 0,wipeKey:null!=i.wipeKey?Key._fromProtobufKey(i.wipeKey):void 0,supplyKey:null!=i.supplyKey?Key._fromProtobufKey(i.supplyKey):void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,freezeDefault:null!=i.freezeDefault?i.freezeDefault:void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,expirationTime:null!=i.expiry?Timestamp._fromProtobuf(i.expiry):void 0,autoRenewPeriod:null!=i.autoRenewPeriod?Duration._fromProtobuf(i.autoRenewPeriod):void 0,tokenMemo:null!=i.memo?i.memo:void 0,customFees:null!=i.customFees?i.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0,tokenType:null!=i.tokenType?TokenType._fromCode(i.tokenType):void 0,supplyType:null!=i.supplyType?TokenSupplyType._fromCode(i.supplyType):void 0,maxSupply:null!=i.maxSupply?i.maxSupply:void 0,metadataKey:null!=i.metadataKey?Key._fromProtobufKey(i.metadataKey):void 0,metadata:null!=i.metadata?i.metadata:void 0}),e,t,n,r,o)}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get decimals(){return this._decimals}setDecimals(e){return this._requireNotFrozen(),this._decimals=e instanceof Long?e:Long.fromValue(e),this}get initialSupply(){return this._initialSupply}setInitialSupply(e){return this._requireNotFrozen(),this._initialSupply=convertAmountToLong(e),this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId&&null!=this.autoRenewPeriod?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&null!=this.autoRenewPeriod&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get freezeDefault(){return this._freezeDefault}setFreezeDefault(e){return this._requireNotFrozen(),this._freezeDefault=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this._autoRenewPeriod=null,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get customFees(){return this._customFees}setCustomFees(e){return this._customFees=e,this}get tokenType(){return this._tokenType}setTokenType(e){return this._tokenType=e,this}get supplyType(){return this._supplyType}setSupplyType(e){return this._supplyType=e,this}get maxSupply(){return this._maxSupply}setMaxSupply(e){return this._maxSupply=convertAmountToLong(e),this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.createToken(t)}_getTransactionDataCase(){return"tokenCreation"}_makeTransactionData(){return{name:this._tokenName,symbol:this._tokenSymbol,decimals:null!=this._decimals?this._decimals.toInt():null,initialSupply:this._initialSupply,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,freezeDefault:this._freezeDefault,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:this._tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this._tokenType?this._tokenType._code:null,supplyType:null!=this._supplyType?this._supplyType._code:null,maxSupply:this.maxSupply,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?this._metadata:void 0}}_getLogId(){return`TokenCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCreation",TokenCreateTransaction._fromProtobuf);class TokenDeleteTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenDeletion;return Transaction._fromProtobufTransactions(new TokenDeleteTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.deleteToken(t)}_getTransactionDataCase(){return"tokenDeletion"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDeletion",TokenDeleteTransaction._fromProtobuf);class TokenFeeScheduleUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._customFees=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.customFees&&this.setCustomFees(e.customFees)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenFeeScheduleUpdate;return Transaction._fromProtobufTransactions(new TokenFeeScheduleUpdateTransaction({tokenId:null!=i.tokenId?TokenId._fromProtobuf(i.tokenId):void 0,customFees:null!=i.customFees?i.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get customFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}_execute(e,t){return e.token.updateTokenFeeSchedule(t)}_getTransactionDataCase(){return"tokenFeeScheduleUpdate"}_makeTransactionData(){return{tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,customFees:this._customFees.map(e=>e._toProtobuf())}}_getLogId(){return`TokenFeeScheduleUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFeeScheduleUpdate",TokenFeeScheduleUpdateTransaction._fromProtobuf);class TokenFreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenFreeze;return Transaction._fromProtobufTransactions(new TokenFreezeTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.freezeTokenAccount(t)}_getTransactionDataCase(){return"tokenFreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenFreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFreeze",TokenFreezeTransaction._fromProtobuf);class TokenGrantKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenGrantKyc;return Transaction._fromProtobufTransactions(new TokenGrantKycTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.grantKycToTokenAccount(t)}_getTransactionDataCase(){return"tokenGrantKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenGrantKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenGrantKyc",TokenGrantKycTransaction._fromProtobuf);class TokenInfo{constructor(e){this.tokenId=e.tokenId,this.name=e.name,this.symbol=e.symbol,this.decimals=e.decimals,this.totalSupply=e.totalSupply,this.treasuryAccountId=e.treasuryAccountId,this.adminKey=e.adminKey,this.kycKey=e.kycKey,this.freezeKey=e.freezeKey,this.pauseKey=e.pauseKey,this.wipeKey=e.wipeKey,this.supplyKey=e.supplyKey,this.feeScheduleKey=e.feeScheduleKey,this.defaultFreezeStatus=e.defaultFreezeStatus,this.defaultKycStatus=e.defaultKycStatus,this.pauseStatus=e.pauseStatus,this.isDeleted=e.isDeleted,this.autoRenewAccountId=e.autoRenewAccountId,this.autoRenewPeriod=e.autoRenewPeriod,this.expirationTime=e.expirationTime,this.tokenMemo=e.tokenMemo,this.customFees=e.customFees,this.tokenType=e.tokenType,this.supplyType=e.supplyType,this.maxSupply=e.maxSupply,this.ledgerId=e.ledgerId,this.metadataKey=e.metadataKey,this.metadata=e.metadata}static _fromProtobuf(e){const t=e.defaultFreezeStatus,n=e.defaultKycStatus,r=e.pauseStatus,o=null!=e.autoRenewAccount?AccountId._fromProtobuf(e.autoRenewAccount):new AccountId(0);return new TokenInfo({tokenId:TokenId._fromProtobuf(e.tokenId),name:e.name,symbol:e.symbol,decimals:e.decimals,totalSupply:Long.fromValue(e.totalSupply),treasuryAccountId:null!=e.treasury?AccountId._fromProtobuf(e.treasury):null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,kycKey:null!=e.kycKey?Key._fromProtobufKey(e.kycKey):null,freezeKey:null!=e.freezeKey?Key._fromProtobufKey(e.freezeKey):null,pauseKey:null!=e.pauseKey?Key._fromProtobufKey(e.pauseKey):null,wipeKey:null!=e.wipeKey?Key._fromProtobufKey(e.wipeKey):null,supplyKey:null!=e.supplyKey?Key._fromProtobufKey(e.supplyKey):null,feeScheduleKey:null!=e.feeScheduleKey?Key._fromProtobufKey(e.feeScheduleKey):null,defaultFreezeStatus:0===t?null:1==t,defaultKycStatus:0===n?null:1==n,pauseStatus:0===r?null:1==r,isDeleted:e.deleted,autoRenewAccountId:0!=o.shard.toInt()||0!=o.realm.toInt()||0!=o.num.toInt()?o:null,autoRenewPeriod:null!=e.autoRenewPeriod?Duration._fromProtobuf(e.autoRenewPeriod):null,expirationTime:null!=e.expiry?Timestamp._fromProtobuf(e.expiry):null,tokenMemo:null!=e.memo?e.memo:"",customFees:null!=e.customFees?e.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):[],tokenType:null!=e.tokenType?TokenType._fromCode(e.tokenType):null,supplyType:null!=e.supplyType?TokenSupplyType._fromCode(e.supplyType):null,maxSupply:null!=e.maxSupply?e.maxSupply:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,metadataKey:null!=e.metadataKey?Key._fromProtobufKey(e.metadataKey):null,metadata:null!=e.metadata?e.metadata:new Uint8Array})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),name:this.name,symbol:this.symbol,decimals:this.decimals,totalSupply:this.totalSupply,treasury:null!=this.treasuryAccountId?this.treasuryAccountId._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,kycKey:null!=this.kycKey?this.kycKey._toProtobufKey():null,freezeKey:null!=this.freezeKey?this.freezeKey._toProtobufKey():null,pauseKey:null!=this.pauseKey?this.pauseKey._toProtobufKey():null,wipeKey:null!=this.wipeKey?this.wipeKey._toProtobufKey():null,supplyKey:null!=this.supplyKey?this.supplyKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,defaultFreezeStatus:null==this.defaultFreezeStatus?0:this.defaultFreezeStatus?1:2,defaultKycStatus:null==this.defaultKycStatus?0:this.defaultKycStatus?1:2,pauseStatus:null==this.pauseStatus?0:this.pauseStatus?1:2,deleted:this.isDeleted,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():void 0,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,expiry:null!=this.expirationTime?this.expirationTime._toProtobuf():null,memo:this.tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this.tokenType?this.tokenType._code:null,supplyType:null!=this.supplyType?this.supplyType._code:null,maxSupply:this.maxSupply,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,metadataKey:null!=this.metadataKey?this.metadataKey._toProtobufKey():null,metadata:null!=this.metadata?this.metadata:null}}static fromBytes(e){return TokenInfo._fromProtobuf(libExports.proto.TokenInfo.decode(e))}toBytes(){return libExports.proto.TokenInfo.encode(this._toProtobuf()).finish()}}class TokenInfoQuery extends Query{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e){const t=e.tokenGetInfo;return new TokenInfoQuery({tokenId:null!=t.token?TokenId._fromProtobuf(t.token):void 0})}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.getTokenInfo(t)}_mapResponseHeader(e){return e.tokenGetInfo.header}_mapResponse(e,t,n){const r=e.tokenGetInfo;return Promise.resolve(TokenInfo._fromProtobuf(r.tokenInfo))}_onMakeRequest(e){return{tokenGetInfo:{header:e,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}}_getLogId(){return`TokenInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetInfo",TokenInfoQuery._fromProtobuf);class TokenMintTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._metadata=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenMint;return Transaction._fromProtobufTransactions(new TokenMintTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,amount:null!=i.amount?i.amount:void 0,metadata:null!=i.metadata?i.metadata:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get metadata(){return this._metadata}addMetadata(e){return this._requireNotFrozen(),"string"==typeof e&&console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead."),this._metadata.push("string"==typeof e?decode$8(e):e),this}setMetadata(e){this._requireNotFrozen();for(const t of e)if("string"==typeof t){console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.");break}return this._metadata=e.map(e=>"string"==typeof e?decode$8(e):e),this}_execute(e,t){return e.token.mintToken(t)}_getTransactionDataCase(){return"tokenMint"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,metadata:this._metadata}}_getLogId(){return`TokenMintTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenMint",TokenMintTransaction._fromProtobuf);class TokenNftInfo{constructor(e){this.nftId=e.nftId,this.accountId=e.accountId,this.creationTime=e.creationTime,this.metadata=e.metadata,this.ledgerId=e.ledgerId,this.spenderId=e.spenderId,Object.freeze(this)}static _fromProtobuf(e){return new TokenNftInfo({nftId:NftId._fromProtobuf(e.nftID),accountId:AccountId._fromProtobuf(e.accountID),creationTime:Timestamp._fromProtobuf(e.creationTime),metadata:void 0!==e.metadata?e.metadata:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,spenderId:null!=e.spenderId?AccountId._fromProtobuf(e.spenderId):null})}_toProtobuf(){return{nftID:this.nftId._toProtobuf(),accountID:this.accountId._toProtobuf(),creationTime:this.creationTime._toProtobuf(),metadata:this.metadata,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,spenderId:null!=this.spenderId?this.spenderId._toProtobuf():null}}toJson(){return{nftId:this.nftId.toString(),accountId:this.accountId.toString(),creationTime:this.creationTime.toString(),metadata:null!=this.metadata?encode$5(this.metadata):null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,spenderId:null!=this.spenderId?this.spenderId.toString():null}}toString(){return JSON.stringify(this.toJson())}}class TokenNftInfoQuery extends Query{constructor(e={}){super(),this._nftId=null,null!=e.nftId&&this.setNftId(e.nftId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._start=null,null!=e.start&&this.setStart(e.start),this._end=null,null!=e.end&&this.setEnd(e.end)}static _fromProtobuf(e){if(null!=e.tokenGetNftInfo){const t=e.tokenGetNftInfo;return new TokenNftInfoQuery({nftId:null!=t.nftID?NftId._fromProtobuf(t.nftID):void 0})}if(null!=e.tokenGetAccountNftInfos){const t=e.tokenGetAccountNftInfos;return new TokenNftInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}{const t=e.tokenGetNftInfos;return new TokenNftInfoQuery({tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}}get nftId(){return this._nftId}setNftId(e){return this._nftId="string"==typeof e?NftId.fromString(e):NftId._fromProtobuf(e._toProtobuf()),this}get accountId(){return console.warn("`TokenNftInfoQuery.accountId` is deprecated with no replacement"),this._accountId}setAccountId(e){return console.warn("`TokenNftInfoQuery.setAccountId()` is deprecated with no replacement"),this._accountId="string"==typeof e?AccountId.fromString(e):AccountId._fromProtobuf(e._toProtobuf()),this}get tokenId(){return console.warn("`TokenNftInfoQuery.tokenId` is deprecated with no replacement"),this._tokenId}setTokenId(e){return console.warn("`TokenNftInfoQuery.setTokenId()` is deprecated with no replacement"),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get start(){return console.warn("`TokenNftInfoQuery.start` is deprecated with no replacement"),this._start}setStart(e){return console.warn("`TokenNftInfoQuery.setStart()` is deprecated with no replacement"),this._start="number"==typeof e?Long.fromNumber(e):e,this}get end(){return console.warn("`TokenNftInfoQuery.end` is deprecated with no replacement"),this._end}setEnd(e){return console.warn("`TokenNftInfoQuery.setEnd()` is deprecated with no replacement"),this._end="number"==typeof e?Long.fromNumber(e):e,this}async getCost(e){return super.getCost(e)}_execute(e,t){return e.token.getTokenNftInfo(t)}_mapResponseHeader(e){return e.tokenGetNftInfo.header}_mapResponse(e,t,n){const r=[e.tokenGetNftInfo.nft];return Promise.resolve(r.map(e=>TokenNftInfo._fromProtobuf(e)))}_onMakeRequest(e){return{tokenGetNftInfo:{header:e,nftID:null!=this._nftId?this._nftId._toProtobuf():null}}}_getLogId(){return`TokenNftInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetNftInfo",TokenNftInfoQuery._fromProtobuf);class TokenPauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenPause;return Transaction._fromProtobufTransactions(new TokenPauseTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenPause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenPauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenPause",TokenPauseTransaction._fromProtobuf);class TokenRevokeKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenRevokeKyc;return Transaction._fromProtobufTransactions(new TokenRevokeKycTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.revokeKycFromTokenAccount(t)}_getTransactionDataCase(){return"tokenRevokeKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenRevokeKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenRevokeKyc",TokenRevokeKycTransaction._fromProtobuf);class TokenUnfreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUnfreeze;return Transaction._fromProtobufTransactions(new TokenUnfreezeTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.unfreezeTokenAccount(t)}_getTransactionDataCase(){return"tokenUnfreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenUnfreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnfreeze",TokenUnfreezeTransaction._fromProtobuf);class TokenUnpauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUnpause;return Transaction._fromProtobufTransactions(new TokenUnpauseTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.unpauseToken(t)}_getTransactionDataCase(){return"tokenUnpause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenUnpauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnpause",TokenUnpauseTransaction._fromProtobuf);class TokenKeyValidation{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenKeyValidation.FullValidation:return"FULL_VALIDATION";case TokenKeyValidation.NoValidation:return"NO_VALIDATION";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenKeyValidation.FullValidation;case 1:return TokenKeyValidation.NoValidation}throw new Error(`(BUG) TokenKeyValidation.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenKeyValidation.FullValidation=new TokenKeyValidation(0),TokenKeyValidation.NoValidation=new TokenKeyValidation(1);class TokenUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._tokenName=null,this._tokenSymbol=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._wipeKey=null,this._supplyKey=null,this._autoRenewAccountId=null,this._expirationTime=null,this._autoRenewPeriod=null,this._tokenMemo=null,this._feeScheduleKey=null,this._pauseKey=null,this._metadataKey=null,this._metadata=null,this._keyVerificationMode=TokenKeyValidation.FullValidation,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata),null!=e.keyVerificationMode&&this.setKeyVerificationMode(e.keyVerificationMode)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUpdate;return Transaction._fromProtobufTransactions(new TokenUpdateTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,tokenName:Object.hasOwn(i,"name")?i.name:void 0,tokenSymbol:Object.hasOwn(i,"symbol")?i.symbol:void 0,treasuryAccountId:null!=i.treasury?AccountId._fromProtobuf(i.treasury):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,kycKey:null!=i.kycKey?Key._fromProtobufKey(i.kycKey):void 0,freezeKey:null!=i.freezeKey?Key._fromProtobufKey(i.freezeKey):void 0,wipeKey:null!=i.wipeKey?Key._fromProtobufKey(i.wipeKey):void 0,supplyKey:null!=i.supplyKey?Key._fromProtobufKey(i.supplyKey):void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,expirationTime:null!=i.expiry?Timestamp._fromProtobuf(i.expiry):void 0,autoRenewPeriod:null!=i.autoRenewPeriod?Duration._fromProtobuf(i.autoRenewPeriod):void 0,tokenMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,pauseKey:null!=i.pauseKey?Key._fromProtobufKey(i.pauseKey):void 0,metadataKey:null!=i.metadataKey?Key._fromProtobufKey(i.metadataKey):void 0,metadata:null!=i.metadata&&Object.hasOwn(i.metadata,"value")?i.metadata.value:void 0,keyVerificationMode:null!=i.keyVerificationMode?TokenKeyValidation._fromCode(i.keyVerificationMode):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}setsupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}get keyVerificationMode(){return this._keyVerificationMode}setKeyVerificationMode(e){return this._requireNotFrozen(),this._keyVerificationMode=e,this}clearTokenMemo(){return this._requireNotFrozen(),this._tokenMemo=null,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.updateToken(t)}_getTransactionDataCase(){return"tokenUpdate"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,name:null!=this.tokenName?this.tokenName:null,symbol:this.tokenSymbol,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:null!=this._tokenMemo?{value:this._tokenMemo}:null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?{value:this._metadata}:null,keyVerificationMode:null!=this._keyVerificationMode?this._keyVerificationMode._code:void 0}}_getLogId(){return`TokenUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdate",TokenUpdateTransaction._fromProtobuf);class TokenWipeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,this._serials=[],this._amount=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenWipe;return Transaction._fromProtobufTransactions(new TokenWipeTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,accountId:null!=i.account?AccountId._fromProtobuf(i.account):void 0,amount:null!=i.amount?i.amount:void 0,serials:null!=i.serialNumbers?i.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>"number"==typeof e?Long.fromNumber(e):e),this}_execute(e,t){return e.token.wipeTokenAccount(t)}_getTransactionDataCase(){return"tokenWipe"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null,serialNumbers:this.serials}}_getLogId(){return`TokenWipeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenWipe",TokenWipeTransaction._fromProtobuf);class TopicCreateTransaction extends Transaction{constructor(e={}){super(),this._defaultMaxTransactionFee=new Hbar(25),this._adminKey=null,this._submitKey=null,this._feeScheduleKey=null,this._feeExemptKeys=[],this._autoRenewAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._customFees=[],this._topicMemo=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.submitKey&&this.setSubmitKey(e.submitKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.topicMemo&&this.setTopicMemo(e.topicMemo)}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusCreateTopic;return Transaction._fromProtobufTransactions(new TopicCreateTransaction({adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,submitKey:null!=i.submitKey?Key._fromProtobufKey(i.submitKey):void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,feeExemptKeys:null!=i.feeExemptKeyList?i.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,customFees:null!=i.customFees?i.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=i.memo?i.memo:void 0}),e,t,n,r,o)}get topicMemo(){return this._topicMemo}getTopicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}get adminKey(){return this._adminKey}getAdminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get submitKey(){return this._submitKey}getSubmitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}getAutoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}getAutoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}_execute(e,t){return e.consensus.createTopic(t)}_getTransactionDataCase(){return"consensusCreateTopic"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:this._feeExemptKeys.map(e=>e._toProtobufKey()),autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),customFees:this._customFees.map(e=>e._toTopicFeeProtobuf()),memo:this._topicMemo}}_getLogId(){return`TopicCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusCreateTopic",TopicCreateTransaction._fromProtobuf);class TopicDeleteTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusDeleteTopic;return Transaction._fromProtobufTransactions(new TopicDeleteTransaction({topicId:null!=i.topicID?TopicId._fromProtobuf(i.topicID):void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.deleteTopic(t)}_getTransactionDataCase(){return"consensusDeleteTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null}}_getLogId(){return`TopicDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusDeleteTopic",TopicDeleteTransaction._fromProtobuf);class TopicInfo{constructor(e){this.topicId=e.topicId,this.topicMemo=e.topicMemo,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.expirationTime=e.expirationTime,this.adminKey=e.adminKey,this.submitKey=e.submitKey,this.feeScheduleKey=e.feeScheduleKey,this.feeExemptKeys=e.feeExemptKeys,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.customFees=e.customFees,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.topicInfo;return new TopicInfo({topicId:TopicId._fromProtobuf(e.topicID),topicMemo:null!=t.memo?t.memo:"",runningHash:null!=t.runningHash?t.runningHash:new Uint8Array,sequenceNumber:null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO,expirationTime:null!=t.expirationTime?Timestamp._fromProtobuf(t.expirationTime):null,adminKey:null!=t.adminKey?Key._fromProtobufKey(t.adminKey):null,submitKey:null!=t.submitKey?Key._fromProtobufKey(t.submitKey):null,feeScheduleKey:null!=t.feeScheduleKey?Key._fromProtobufKey(t.feeScheduleKey):null,feeExemptKeys:null!=t.feeExemptKeyList?t.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):null,autoRenewPeriod:null!=t.autoRenewPeriod?new Duration(t.autoRenewPeriod.seconds):null,autoRenewAccountId:null!=t.autoRenewAccount?AccountId._fromProtobuf(t.autoRenewAccount):null,customFees:null!=t.customFees?t.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):null,ledgerId:null!=t.ledgerId?LedgerId.fromBytes(t.ledgerId):null})}_toProtobuf(){return{topicID:this.topicId._toProtobuf(),topicInfo:{memo:this.topicMemo,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber,expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,submitKey:null!=this.submitKey?this.submitKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this.feeExemptKeys?this.feeExemptKeys.map(e=>e._toProtobufKey()):null,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,customFees:null!=this.customFees?this.customFees.map(e=>e._toProtobuf()):null}}}static fromBytes(e){return TopicInfo._fromProtobuf(libExports.proto.ConsensusGetTopicInfoResponse.decode(e))}toBytes(){return libExports.proto.ConsensusGetTopicInfoResponse.encode(this._toProtobuf()).finish()}}class TopicInfoQuery extends Query{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e){const t=e.consensusGetTopicInfo;return new TopicInfoQuery({topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):void 0})}get topicId(){return this._topicId}setTopicId(e){return this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.getTopicInfo(t)}_mapResponseHeader(e){return e.consensusGetTopicInfo.header}_mapResponse(e,t,n){return Promise.resolve(TopicInfo._fromProtobuf(e.consensusGetTopicInfo))}_onMakeRequest(e){return{consensusGetTopicInfo:{header:e,topicID:null!=this._topicId?this._topicId._toProtobuf():null}}}_getLogId(){return`TopicInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("consensusGetTopicInfo",TopicInfoQuery._fromProtobuf);class TopicMessageChunk{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,Object.freeze(this)}static _fromProtobuf(e){return new TopicMessageChunk({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromValue(e.sequenceNumber):Long.ZERO})}_toProtobuf(){return{consensusTimestamp:this.consensusTimestamp._toProtobuf(),message:this.contents,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber}}}class TopicMessage{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.chunks=e.chunks,this.initialTransactionId=e.initialTransactionId,Object.freeze(this)}static _ofSingle(e){return new TopicMessage({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromNumber(e.sequenceNumber):Long.ZERO,initialTransactionId:null!=e.chunkInfo&&null!=e.chunkInfo.initialTransactionID?TransactionId._fromProtobuf(e.chunkInfo.initialTransactionID):null,chunks:[TopicMessageChunk._fromProtobuf(e)]})}static _ofMany(e){const t=e[e.length-1],n=Timestamp._fromProtobuf(t.consensusTimestamp),r=t.runningHash,o=null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO;e.sort((e,t)=>(null!=e&&null!=e.chunkInfo&&null!=e.chunkInfo.number?e.chunkInfo.number:0)<(null!=t&&null!=t.chunkInfo&&null!=t.chunkInfo.number?t.chunkInfo.number:0)?-1:1);const i=e.map(e=>TopicMessageChunk._fromProtobuf(e)),a=i.map(e=>e.contents.length).reduce((e,t)=>e+t,0),s=new Uint8Array(a);let c=0;e.forEach(e=>{s.set(e.message,c),c+=e.message.length});let u=null;return e.length>0&&null!=e[0].chunkInfo&&null!=e[0].chunkInfo.initialTransactionID&&(u=TransactionId._fromProtobuf(e[0].chunkInfo.initialTransactionID)),new TopicMessage({consensusTimestamp:n,contents:s,runningHash:r,sequenceNumber:o,chunks:i,initialTransactionId:u})}}class TopicMessageQuery{constructor(e={}){this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._startTime=null,null!=e.startTime&&this.setStartTime(e.startTime),this._endTime=null,null!=e.endTime&&this.setEndTime(e.endTime),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._errorHandler=(e,t)=>{console.error(`Error attempting to subscribe to topic: ${null!=this._topicId?this._topicId.toString():""}`)},null!=e.errorHandler&&(this._errorHandler=e.errorHandler),this._listener=null,this._completionHandler=()=>{console.log(`Subscription to topic ${null!=this._topicId?this._topicId.toString():""} complete`)},null!=e.completionHandler&&(this._completionHandler=e.completionHandler),this._maxAttempts=20,this._maxBackoff=8e3,this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},null!=e.retryHandler&&(this._retryHandler=e.retryHandler),this._attempt=0,this._handle=null,this.setMaxBackoff(8e3)}get topicId(){return this._topicId}setTopicId(e){return this.requireNotSubscribed(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get startTime(){return this._startTime}setStartTime(e){return this.requireNotSubscribed(),this._startTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get endTime(){return this._endTime}setEndTime(e){return this.requireNotSubscribed(),this._endTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get limit(){return this._limit}setLimit(e){return this.requireNotSubscribed(),this._limit=e instanceof Long?e:Long.fromValue(e),this}setErrorHandler(e){return this._errorHandler=e,this}setCompletionHandler(e){return this.requireNotSubscribed(),this._completionHandler=e,this}setMaxAttempts(e){return this.requireNotSubscribed(),this._maxAttempts=e,this}setMaxBackoff(e){return this.requireNotSubscribed(),this._maxBackoff=e,this}subscribe(e,t,n){return this._handle=new SubscriptionHandle,this._listener=n,null!=t&&(this._errorHandler=t),this._makeServerStreamRequest(e),this._handle}_makeServerStreamRequest(e){const t=this._buildConsensusRequest(),n=new Map,r=e._mirrorNetwork.getNextMirrorNode().getChannel().makeServerStreamRequest("ConsensusService","subscribeTopic",t,e=>this._handleMessage(e,n),t=>this._handleError(t,e),this._completionHandler);null!=this._handle&&this._handle._setCall(()=>r())}requireNotSubscribed(){if(null!=this._handle)throw new Error("Cannot change fields on an already subscribed query")}_passTopicMessage(e){try{if(null==this._listener)throw new Error("(BUG) listener is unexpectedly not set");this._listener(e)}catch(t){this._errorHandler(e,t)}}_buildConsensusRequest(){return libExports.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode({topicID:this._topicId?._toProtobuf()??null,consensusStartTime:this._startTime?._toProtobuf()??null,consensusEndTime:this._endTime?._toProtobuf()??null,limit:this._limit}).finish()}_handleMessage(e,t){const n=libExports.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(e);this._limit?.gt(0)&&(this._limit=this._limit.sub(1)),this._startTime=Timestamp._fromProtobuf(n.consensusTimestamp).plusNanos(1),null==n.chunkInfo||null!=n.chunkInfo&&1===n.chunkInfo.total?this._passTopicMessage(TopicMessage._ofSingle(n)):this._handleChunkedMessage(n,t)}_handleChunkedMessage(e,t){const n=e.chunkInfo,r=n.initialTransactionID,o=n.total,i=TransactionId._fromProtobuf(r).toString();let a=[];const s=t.get(i);if(null==s?t.set(i,a):a=s,a.push(e),a.length===o){const e=TopicMessage._ofMany(a);t.delete(i),this._passTopicMessage(e)}}_handleError(e,t){const n=e instanceof Error?e.message:e.details;this._handle?._unsubscribed||(this.shouldRetry(e)?this._scheduleRetry(t,n):this._errorHandler(null,new Error(n)))}shouldRetry(e){return this._attempt<this._maxAttempts&&this._retryHandler(e)}_scheduleRetry(e,t){const n=Math.min(250*2**this._attempt,this._maxBackoff);console.warn(`Error subscribing to topic ${this._topicId?.toString()??"UNKNOWN"} during attempt ${this._attempt}. Waiting ${n} ms before next attempt: ${t}`),this._attempt+=1,setTimeout(()=>this._makeServerStreamRequest(e),n)}}class TopicMessageSubmitTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._message=null,null!=e.message&&this.setMessage(e.message),this._maxChunks=20,this._chunkSize=CHUNK_SIZE,null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),this._chunkInfo=null}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusSubmitMessage;return Transaction._fromProtobufTransactions(new TopicMessageSubmitTransaction({topicId:null!=i.topicID?TopicId._fromProtobuf(i.topicID):void 0,message:null!=i.message?i.message:void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get message(){return this._message}getMessage(){return this._message}setMessage(e){return this._requireNotFrozen(),e=requireStringOrUint8Array(e),this._message=e instanceof Uint8Array?e:encode$1(e),this}getCustomFeeLimits(){return this._customFeeLimits}setCustomFeeLimits(e){return this._requireNotFrozen(),this._customFeeLimits=e,this}addCustomFeeLimit(e){return this._requireNotFrozen(),this._customFeeLimits.push(e),this}get maxChunks(){return this._maxChunks}getMaxChunks(){return this._maxChunks}setMaxChunks(e){return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}getChunkSize(){return this._chunkSize}setChunkSize(e){return this._chunkSize=e,this}getRequiredChunks(){if(null==this._message)return 1;return Math.ceil(this._message.length/this._chunkSize)}freezeWith(e){if(super.freezeWith(e),null==this._message)return this;const t=Math.floor((this._message.length+(this._chunkSize-1))/this._chunkSize);if(t>this._maxChunks)throw new Error(`Message with size ${this._message.length} too long for ${this._maxChunks} chunks`);const n=this._getTransactionId()._toProtobuf();let r=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<t;e++){this._chunkInfo={initialTransactionID:n,total:t,number:e+1},this._transactionIds.push(r),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));r=new TransactionId(r.accountId,new Timestamp(r.validStart.seconds,r.validStart.nanos.add(1)))}return this._transactionIds.advance(),this._chunkInfo=null,this}schedule(){if(this._requireNotFrozen(),null!=this._message&&this._message.length>this._chunkSize)throw new Error(`cannot schedule \`TopicMessageSubmitTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let i=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now();o.push(await super.execute(e,i)),null!=i&&(i=Date.now()-t)}return o}_execute(e,t){return e.consensus.submitMessage(t)}_getTransactionDataCase(){return"consensusSubmitMessage"}_makeTransactionData(){if(null!=this._chunkInfo&&null!=this._message){const e=(this._chunkInfo.number-1)*this._chunkSize;let t=e+this._chunkSize;return t>this._message.length&&(t=this._message.length),{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message.slice(e,t),chunkInfo:this._chunkInfo}}return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message}}_getLogId(){return`TopicMessageSubmitTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusSubmitMessage",TopicMessageSubmitTransaction._fromProtobuf);class TopicUpdateTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._topicMemo=null,null!=e.topicMemo&&this.setTopicMemo(e.topicMemo),this._submitKey=null,null!=e.submitKey&&this.setSubmitKey(e.submitKey),this._adminKey=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),this._feeScheduleKey=null,null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),this._feeExemptKeys=null,null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),this._autoRenewAccountId=null,null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),this._autoRenewPeriod=null,null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),this._customFees=null,null!=e.customFees&&this.setCustomFees(e.customFees),this._expirationTime=null,null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const i=o[0].consensusUpdateTopic;return Transaction._fromProtobufTransactions(new TopicUpdateTransaction({topicId:null!=i.topicID?TopicId._fromProtobuf(i.topicID):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,submitKey:null!=i.submitKey?Key._fromProtobufKey(i.submitKey):void 0,feeScheduleKey:null!=i.feeScheduleKey?Key._fromProtobufKey(i.feeScheduleKey):void 0,feeExemptKeys:null!=i.feeExemptKeyList&&null!=i.feeExemptKeyList.keys?i?.feeExemptKeyList.keys.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=i.autoRenewAccount?AccountId._fromProtobuf(i.autoRenewAccount):void 0,autoRenewPeriod:null!=i.autoRenewPeriod&&null!=i.autoRenewPeriod.seconds?i.autoRenewPeriod.seconds:void 0,customFees:null!=i.customFees&&null!=i.customFees.fees?i.customFees.fees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=i.memo&&Object.hasOwn(i.memo,"value")?i.memo.value:void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0}),e,t,n,r,o)}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}clearTopicId(){return this._requireNotFrozen(),this._topicId=null,this}get topicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}clearTopicMemo(){return this._requireNotFrozen(),this._topicMemo=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}clearAdminKey(){return this._requireNotFrozen(),this._adminKey=null,this}get submitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}clearSubmitKey(){return this._requireNotFrozen(),this._submitKey=null,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}clearFeeScheduleKey(){return this._requireNotFrozen(),this._feeScheduleKey=null,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),null==this._feeExemptKeys&&(this._feeExemptKeys=[]),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}clearAutoRenewAccountId(){return this._requireNotFrozen(),this._autoRenewAccountId=null,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),null==this._customFees&&(this._customFees=[]),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.consensus.updateTopic(t)}_getTransactionDataCase(){return"consensusUpdateTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this._feeExemptKeys?{keys:this._feeExemptKeys.map(e=>e._toProtobufKey())}:null,memo:null!=this._topicMemo?{value:this._topicMemo}:null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,customFees:null!=this._customFees?{fees:this._customFees.map(e=>e._toTopicFeeProtobuf())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`TopicUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusUpdateTopic",TopicUpdateTransaction._fromProtobuf);class HbarTransferMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromProtobuf(e){const t=new HbarTransferMap;for(const n of null!=e.accountAmounts?e.accountAmounts:[]){const e=AccountId._fromProtobuf(n.accountID);t._set(e,Hbar.fromTinybars(n.amount))}return t}}class TransferTransaction extends AbstractTokenTransferTransaction{constructor(e={}){super(),this._hbarTransfers=[],this._defaultMaxTransactionFee=new Hbar(1);for(const t of null!=e.hbarTransfers?e.hbarTransfers:[])this.addHbarTransfer(t.accountId,t.amount)}static _fromProtobuf(e,t,n,r,o){const i=o[0].cryptoTransfer,a=new TransferTransaction;return a._tokenTransfers=TokenTransfer._fromProtobuf(null!=i.tokenTransfers?i.tokenTransfers:[]),a._hbarTransfers=Transfer._fromProtobuf(null!=i.transfers&&null!=i.transfers.accountAmounts?i.transfers.accountAmounts:[]),a._nftTransfers=TokenNftTransfer._fromProtobuf(null!=i.tokenTransfers?i.tokenTransfers:[]),Transaction._fromProtobufTransactions(a,e,t,n,r,o)}get hbarTransfers(){const e=new HbarTransferMap;for(const t of this._hbarTransfers)e._set(t.accountId,t.amount);return e}get hbarTransfersList(){return this._hbarTransfers}_addHbarTransfer(e,t,n){this._requireNotFrozen();const r=e instanceof AccountId?e.clone():AccountId.fromString(e),o=t instanceof Hbar?t:new Hbar(t);for(const e of this._hbarTransfers)if(0===e.accountId.compare(r))return e.amount=Hbar.fromTinybars(e.amount.toTinybars().add(o.toTinybars())),this;return this._hbarTransfers.push(new Transfer({accountId:r,amount:o,isApproved:n})),this}addHbarTransfer(e,t){return this._addHbarTransfer(e,t,!1)}addApprovedHbarTransfer(e,t){return this._addHbarTransfer(e,t,!0)}_validateChecksums(e){for(const t of this._hbarTransfers)t.accountId.validateChecksum(e);for(const t of this._tokenTransfers)t.tokenId.validateChecksum(e),t.accountId.validateChecksum(e);for(const t of this._nftTransfers)t.tokenId.validateChecksum(e),t.senderAccountId.validateChecksum(e),t.receiverAccountId.validateChecksum(e)}setHbarTransferApproval(e,t){const n="string"==typeof e?AccountId.fromString(e):e;for(const e of this._hbarTransfers)0===e.accountId.compare(n)&&(e.isApproved=t);return this}setTokenTransferApproval(e,t,n){const r="string"==typeof e?TokenId.fromString(e):e,o="string"==typeof t?AccountId.fromString(t):t;for(const e of this._tokenTransfers)0===e.tokenId.compare(r)&&0===e.accountId.compare(o)&&(e.isApproved=n);return this}setNftTransferApproval(e,t){const n="string"==typeof e?NftId.fromString(e):e;for(const e of this._nftTransfers)0===e.tokenId.compare(n.tokenId)&&0===e.serialNumber.compare(n.serial)&&(e.isApproved=t);return this}_execute(e,t){return e.crypto.cryptoTransfer(t)}_getTransactionDataCase(){return"cryptoTransfer"}_makeTransactionData(){const{tokenTransfers:e}=super._makeTransactionData();return this._hbarTransfers.sort((e,t)=>e.accountId.compare(t.accountId)),{transfers:{accountAmounts:this._hbarTransfers.map(e=>({accountID:e.accountId._toProtobuf(),amount:e.amount.toTinybars(),isApproval:e.isApproved}))},tokenTransfers:e}}_getLogId(){return`TransferTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoTransfer",TransferTransaction._fromProtobuf);class Wallet{constructor(e,t,n){let r;r="string"==typeof t&&PrivateKey.isDerKey(t)?PrivateKey.fromStringDer(t):"string"==typeof t?PrivateKey.fromString(t):t,this.publicKey=r.publicKey,this.signer=e=>Promise.resolve(r.sign(e)),this.provider=n,this.accountId="string"==typeof e?AccountId.fromString(e):e}static createRandomED25519(){const e=PrivateKey.generateED25519(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}static createRandomECDSA(){const e=PrivateKey.generateECDSA(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}getProvider(){return this.provider}getAccountId(){return this.accountId}getAccountKey(){return this.publicKey}getLedgerId(){return null==this.provider?null:this.provider.getLedgerId()}getNetwork(){return null==this.provider?{}:this.provider.getNetwork()}getMirrorNetwork(){return null==this.provider?[]:this.provider.getMirrorNetwork()}async sign(e){const t=[];for(const n of e)t.push(new SignerSignature({publicKey:this.publicKey,signature:await this.signer(n),accountId:this.accountId}));return t}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}signTransaction(e){return e.signWith(this.publicKey,this.signer)}checkTransaction(e){const t=e.transactionId;if(null!=t&&null!=t.accountId&&0!=t.accountId.compare(this.accountId))throw new Error("transaction's ID constructed with a different account ID");if(null==this.provider)return Promise.resolve(e);const n=(null!=e.nodeAccountIds?e.nodeAccountIds:[]).map(e=>e.toString()),r=Object.values(this.provider.getNetwork()).map(e=>e.toString());if(!n.reduce((e,t)=>e&&r.includes(t),!0))throw new Error("Transaction already set node account IDs to values not within the current network");return Promise.resolve(e)}populateTransaction(e){if(e._freezeWithAccountId(this.accountId),null==e.transactionId&&e.setTransactionId(TransactionId.generate(this.accountId)),null!=e.nodeAccountIds&&0!=e.nodeAccountIds.length)return Promise.resolve(e.freeze());if(null==this.provider)return Promise.resolve(e);const t=Object.values(this.provider.getNetwork()).map(e=>"string"==typeof e?AccountId.fromString(e):e);return shuffle(t),e.setNodeAccountIds(t.slice(0,(t.length+3-1)/3)),Promise.resolve(e.freeze())}call(e){if(null==this.provider)throw new Error("cannot send request with an wallet that doesn't contain a provider");return this.provider.call(e._setOperatorWith(this.accountId,this.publicKey,this.signer))}}var browser={exports:{}},quickFormatUnescaped,hasRequiredQuickFormatUnescaped,hasRequiredBrowser;function requireQuickFormatUnescaped(){if(hasRequiredQuickFormatUnescaped)return quickFormatUnescaped;function e(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}return hasRequiredQuickFormatUnescaped=1,quickFormatUnescaped=function(t,n,r){var o=r&&r.stringify||e;if("object"==typeof t&&null!==t){var i=n.length+1;if(1===i)return t;var a=new Array(i);a[0]=o(t);for(var s=1;s<i;s++)a[s]=o(n[s]);return a.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var u="",l=0,d=-1,p=t&&t.length||0,h=0;h<p;){if(37===t.charCodeAt(h)&&h+1<p){switch(d=d>-1?d:0,t.charCodeAt(h+1)){case 100:case 102:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Number(n[l]),d=h+2,h++;break;case 105:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Math.floor(Number(n[l])),d=h+2,h++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===n[l])break;d<h&&(u+=t.slice(d,h));var f=typeof n[l];if("string"===f){u+="'"+n[l]+"'",d=h+2,h++;break}if("function"===f){u+=n[l].name||"<anonymous>",d=h+2,h++;break}u+=o(n[l]),d=h+2,h++;break;case 115:if(l>=c)break;d<h&&(u+=t.slice(d,h)),u+=String(n[l]),d=h+2,h++;break;case 37:d<h&&(u+=t.slice(d,h)),u+="%",d=h+2,h++,l--}++l}++h}if(-1===d)return t;d<p&&(u+=t.slice(d));return u},quickFormatUnescaped}function requireBrowser(){if(hasRequiredBrowser)return browser.exports;hasRequiredBrowser=1;const e=requireQuickFormatUnescaped();browser.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},n={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:f,res:f,err:p,errWithCause:p};function r(e,t){return"silent"===e?1/0:t.levels.values[e]}const o=Symbol("pino.logFuncs"),i=Symbol("pino.hierarchy"),a={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function s(e,t){const n={logger:t,parent:e[i]};t[i]=n}function c(e){(e=e||{}).browser=e.browser||{};const n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");const i=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const p=e.serializers||{},f=function(e,t){if(Array.isArray(e))return e.filter(function(e){return"!stdSerializers.err"!==e});return!0===e&&Object.keys(t)}(e.browser.serialize,p);let y=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(y=!1);const g=Object.keys(e.customLevels||{}),_=["error","fatal","warn","info","debug","trace"].concat(g);"function"==typeof i&&_.forEach(function(e){i[e]=i}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const b=e.level||"info",I=Object.create(i);I.log||(I.log=m),function(e,n,r){const i={};n.forEach(e=>{i[e]=r[e]?r[e]:t[e]||t[a[e]||"log"]||m}),e[o]=i}(I,_,i),s({},I),Object.defineProperty(I,"levelVal",{get:function(){return r(this.level,this)}}),Object.defineProperty(I,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,u(this,T,I,"error"),u(this,T,I,"fatal"),u(this,T,I,"warn"),u(this,T,I,"info"),u(this,T,I,"debug"),u(this,T,I,"trace"),g.forEach(e=>{u(this,T,I,e)})}});const T={transmit:n,serialize:f,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:_,timestamp:h(e),messageKey:e.messageKey||"msg",onChild:e.onChild||m};function k(t,r,o){if(!r)throw new Error("missing bindings for child Pino");o=o||{},f&&r.serializers&&(o.serializers=r.serializers);const i=o.serializers;if(f&&i){var a=Object.assign({},p,i),c=!0===e.browser.serialize?Object.keys(a):f;delete r.serializers,l([r],c,a,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.bindings=r,a&&(this.serializers=a,this._serialize=c),n&&(this._logEvent=d([].concat(e._logEvent.bindings,r)))}u.prototype=this;const h=new u(this);return s(this,h),h.child=function(...e){return k.call(this,t,...e)},h.level=o.level||this.level,t.onChild(h),h}return I.levels=function(e){const t=e.customLevels||{},n=Object.assign({},c.levels.values,t),r=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}(t));return{values:n,labels:r}}(e),I.level=b,I.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},I.setMaxListeners=I.getMaxListeners=I.emit=I.addListener=I.on=I.prependListener=I.once=I.prependOnceListener=I.removeListener=I.removeAllListeners=I.listeners=I.listenerCount=I.eventNames=I.write=I.flush=m,I.serializers=p,I._serialize=f,I._stdErrSerialize=y,I.child=function(...e){return k.call(this,T,...e)},n&&(I._logEvent=d()),I}function u(n,a,s,c){if(Object.defineProperty(n,c,{value:r(n.level,s)>r(c,s)?m:s[o][c],writable:!0,enumerable:!0,configurable:!0}),n[c]===m){if(!a.transmit)return;const e=r(a.transmit.level||n.level,s);if(r(c,s)<e)return}n[c]=function(n,i,a,s){return c=n[o][s],function(){const o=i.timestamp(),u=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var h=0;h<u.length;h++)u[h]=arguments[h];var f=!1;if(i.serialize&&(l(u,this._serialize,this.serializers,this._stdErrSerialize),f=!0),i.asObject||i.formatters?c.call(p,...function(t,n,r,o,i){const{level:a,log:s=e=>e}=i.formatters||{},c=r.slice();let u=c[0];const l={};let d=1+(0|t._childLevel);if(d<1&&(d=1),o&&(l.time=o),a){const e=a(n,t.levels.values[n]);Object.assign(l,e)}else l.level=t.levels.values[n];if(i.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());return[s(l),...c]}if(null!==u&&"object"==typeof u){for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());u=c.length?e(c.shift(),c):void 0}else"string"==typeof u&&(u=e(c.shift(),c));return void 0!==u&&(l[i.messageKey]=u),[s(l)]}(this,s,u,o,i)):c.apply(p,u),i.transmit){const e=r(i.transmit.level||n._level,a),t=r(s,a);if(t<e)return;!function(e,t,n,r=!1){const o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;r||l(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter(function(e){return-1===u.indexOf(e)}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,c),e._logEvent=d(u)}(this,{ts:o,methodLevel:s,methodValue:t,transmitValue:a.levels.values[i.transmit.level||n._level],send:i.transmit.send,val:r(n._level,a)},u,f)}};var c}(n,a,s,c);const u=function(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[i];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}(n);0!==u.length&&(n[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(u,n[c]))}function l(e,t,n,r){for(const o in e)if(r&&e[o]instanceof Error)e[o]=c.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const r in e[o])t.indexOf(r)>-1&&r in n&&(e[o][r]=n[r](e[o][r]))}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function p(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function h(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?g:_}function f(){return{}}function y(e){return e}function m(){}function g(){return!1}function _(){return Date.now()}return c.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},c.stdSerializers=n,c.stdTimeFunctions=Object.assign({},{nullTime:g,epochTime:_,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),browser.exports.default=c,browser.exports.pino=c,browser.exports}var browserExports=requireBrowser(),pino=getDefaultExportFromCjs(browserExports);class LogLevel{constructor(e){this._name=e,Object.freeze(this)}toString(){switch(this){case LogLevel.Silent:return"silent";case LogLevel.Trace:return"trace";case LogLevel.Debug:return"debug";case LogLevel.Info:return"info";case LogLevel.Warn:return"warn";case LogLevel.Error:return"error";case LogLevel.Fatal:return"fatal";default:return`Unknown log level (${this._name})`}}static _fromString(e){switch(e){case"silent":return LogLevel.Silent;case"trace":return LogLevel.Trace;case"debug":return LogLevel.Debug;case"info":return LogLevel.Info;case"warn":return LogLevel.Warn;case"error":return LogLevel.Error;case"fatal":return LogLevel.Fatal;default:throw new Error(`Unknown log level: ${e}`)}}}LogLevel.Silent=new LogLevel("silent"),LogLevel.Trace=new LogLevel("trace"),LogLevel.Debug=new LogLevel("debug"),LogLevel.Info=new LogLevel("info"),LogLevel.Warn=new LogLevel("warn"),LogLevel.Error=new LogLevel("error"),LogLevel.Fatal=new LogLevel("fatal");class Logger{constructor(e,t="",n=!0,r=!0,o=!0,i=0){const a=t?pino.destination({dest:t,sync:n,fsync:r,mkdir:o,minLength:i}):null,s=a?{level:e.toString(),timestamp:pino.stdTimeFunctions.isoTime,formatters:{bindings:()=>({}),level:e=>({level:e.toUpperCase()})}}:{level:e.toString(),transport:{target:"pino-pretty",options:{translateTime:"SYS:dd-mm-yyyy HH:MM:ss",ignore:"pid,hostname"}}};this._logger=a?pino(s,a):pino(s),this._previousLevel=e}setLogger(e){return this._logger=e,this}setLevel(e){return this._previousLevel=LogLevel._fromString(this._logger.level),this._logger.level=e.toString(),this}get level(){return LogLevel._fromString(this._logger.level)}get levels(){return this._logger.levels.labels}setSilent(e){return this._logger.level=e?LogLevel.Silent.toString():this._previousLevel.toString(),this}get silent(){return this._logger.level==LogLevel.Silent.toString()}trace(e){this._logger.trace(e)}debug(e){this._logger.debug(e)}info(e){this._logger.info(e)}warn(e){this._logger.warn(e)}error(e){this._logger.error(e)}fatal(e){this._logger.fatal(e)}}class TokenUpdateNftsTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._serialNumbers=[],this._metadata=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.serialNumbers&&this.setSerialNumbers(e.serialNumbers),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const i=o[0].tokenUpdateNfts;return Transaction._fromProtobufTransactions(new TokenUpdateNftsTransaction({tokenId:null!=i.token?TokenId._fromProtobuf(i.token):void 0,serialNumbers:null!=i.serialNumbers?i.serialNumbers:[],metadata:null!=i.metadata&&Object.hasOwn(i.metadata,"value")?i.metadata.value:void 0}),e,t,n,r,o)}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}setSerialNumbers(e){return this._requireNotFrozen(),this._serialNumbers=e,this}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenUpdateNfts"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,serialNumbers:null!=this._serialNumbers?this._serialNumbers:[],...null!=this._metadata?{metadata:{value:this._metadata}}:null}}_getLogId(){return`TokenUpdateNftsTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdateNfts",TokenUpdateNftsTransaction._fromProtobuf);class ServiceEndpoint{constructor(e){this._ipAddressV4=null!=e?.ipAddressV4?e.ipAddressV4:null,this._port=null!=e?.port?e.port:null,this._domainName=null!=e?.domainName?e.domainName:null}setIpAddressV4(e){if(null!=this._domainName)throw new Error("Cannot set IP address when domain name is already set.");return this._ipAddressV4=e,this}get getIpAddressV4(){return this._ipAddressV4}setPort(e){return this._port=e,this}get getPort(){return this._port}setDomainName(e){if(null!=this._ipAddressV4)throw new Error("Cannot set domain name when IP address is already set.");return this._domainName=e,this}get getDomainName(){return this._domainName}static _fromProtobuf(e){return new ServiceEndpoint({ipAddressV4:null!=e.ipAddressV4?e.ipAddressV4:void 0,port:null!=e.port?e.port:void 0,domainName:null!=e.domainName?e.domainName:void 0})}_toProtobuf(){return{ipAddressV4:this._ipAddressV4,port:this._port,domainName:this._domainName}}}const DESCRIPTION_MAX_LENGTH$1=100,GOSSIP_ENDPOINTS_MAX_LENGTH$1=10,SERVICE_ENDPOINTS_MAX_LENGTH$1=8;class NodeCreateTransaction extends Transaction{constructor(e){super(),this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const i=o[0].nodeCreate;return Transaction._fromProtobufTransactions(new NodeCreateTransaction({accountId:null!=i.accountId?AccountId._fromProtobuf(i.accountId):void 0,description:null!=i.description?i.description:void 0,gossipEndpoints:null!=i.gossipEndpoint?i.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=i.serviceEndpoint?i.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=i.gossipCaCertificate?i.gossipCaCertificate:void 0,grpcCertificateHash:null!=i.grpcCertificateHash?i.grpcCertificateHash:void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,declineReward:null!=i.declineReward?i.declineReward:void 0,grpcWebProxyEndpoint:null!=i.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(i.grpcProxyEndpoint):void 0}),e,t,n,r,o)}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH$1)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH$1} characters.`);return this._description=e,this}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH$1)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH$1)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}_execute(e,t){return e.addressBook.createNode(t)}_getTransactionDataCase(){return"nodeCreate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:null!=this._description?this._description:null,gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?this._gossipCaCertificate:null,grpcCertificateHash:null!=this._grpcCertificateHash?this._grpcCertificateHash:null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,declineReward:null!=this._declineReward?this._declineReward:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null}}_getLogId(){return`NodeCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeCreate",NodeCreateTransaction._fromProtobuf);class NodeDeleteTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null}static _fromProtobuf(e,t,n,r,o){const i=o[0].nodeDelete;return Transaction._fromProtobufTransactions(new NodeDeleteTransaction({nodeId:null!=i.nodeId?i.nodeId:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeDeleteTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}freezeWith(e){if(null==this.nodeId)throw new Error("NodeDeleteTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.deleteNode(t)}_getTransactionDataCase(){return"nodeDelete"}_makeTransactionData(){return{nodeId:null!=this._nodeId?this._nodeId:null}}_getLogId(){return`NodeDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeDelete",NodeDeleteTransaction._fromProtobuf);const DESCRIPTION_MAX_LENGTH=100,GOSSIP_ENDPOINTS_MAX_LENGTH=10,SERVICE_ENDPOINTS_MAX_LENGTH=8;class NodeUpdateTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null,this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const i=o[0].nodeUpdate;return Transaction._fromProtobufTransactions(new NodeUpdateTransaction({nodeId:null!=i.nodeId?i.nodeId:void 0,accountId:null!=i.accountId?AccountId._fromProtobuf(i.accountId):void 0,description:null!=i.description&&Object.hasOwn(i.description,"value")?i.description.value:void 0,gossipEndpoints:null!=i.gossipEndpoint?i.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=i.serviceEndpoint?i.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=i.gossipCaCertificate&&Object.hasOwn(i.gossipCaCertificate,"value")?i.gossipCaCertificate.value:void 0,grpcCertificateHash:null!=i.grpcCertificateHash&&Object.hasOwn(i.grpcCertificateHash,"value")?i.grpcCertificateHash.value:void 0,grpcWebProxyEndpoint:null!=i.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(i.grpcProxyEndpoint):void 0,adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,declineReward:null!=i.declineReward?.value?i.declineReward.value:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeUpdateTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH} characters.`);return this._description=e,this}clearDescription(){this._description=""}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return this._requireNotFrozen(),null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return this._requireNotFrozen(),null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}deleteGrpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint=new ServiceEndpoint,this}freezeWith(e){if(null==this.nodeId)throw new Error("NodeUpdateTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.updateNode(t)}_getTransactionDataCase(){return"nodeUpdate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:{value:null!=this._description?this._description:null},gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?{value:this._gossipCaCertificate}:null,grpcCertificateHash:null!=this._grpcCertificateHash?{value:this._grpcCertificateHash}:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,nodeId:null!=this._nodeId?this._nodeId:null,declineReward:null!=this._declineReward?{value:this._declineReward}:null}}_getLogId(){return`NodeUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeUpdate",NodeUpdateTransaction._fromProtobuf);const HOST_AND_PORT=/^(\S+):(\d+)$/;class ManagedNodeAddress{constructor(e={}){if(null!=e.address){const t=HOST_AND_PORT.exec(e.address);if(null==t)throw new Error(`failed to parse address: ${e.address}`);this._address=t[1],this._port=null!=t[2]?parseInt(t[2]):null}else{if(null==e.host||null==e.port)throw new Error(`failed to create a managed node address: ${JSON.stringify(e)}`);this._address=e.host,this._port=e.port}Object.freeze(this)}static fromString(e){return new ManagedNodeAddress({address:e})}toInsecure(){let e=50212===this.port?50211:this.port;return new ManagedNodeAddress({host:this.address,port:e})}toSecure(){let e=50211===this.port?50212:this.port;return new ManagedNodeAddress({host:this.address,port:e})}get address(){return this._address}get port(){return this._port}isTransportSecurity(){return 50212==this._port||443==this._port}toString(){return null==this.port?this.address:`${this.address}:${this.port}`}}class ManagedNode{constructor(e={}){if(null!=e.newNode)this._address="string"==typeof e.newNode.address?ManagedNodeAddress.fromString(e.newNode.address):e.newNode.address,this._cert=void 0,this._channel=null,this._channelInitFunction=e.newNode.channelInitFunction,this._lastUsed=Date.now(),this._readmitTime=Date.now(),this._useCount=0,this._badGrpcStatusCount=0,this._minBackoff=8e3,this._maxBackoff=36e5,this._currentBackoff=this._minBackoff;else{if(null==e.cloneNode)throw new Error(`failed to create ManagedNode: ${JSON.stringify(e)}`);this._address=e.cloneNode.address,this._cert=e.cloneNode.node._cert,this._channel=e.cloneNode.node._channel,this._channelInitFunction=e.cloneNode.node._channelInitFunction,this._currentBackoff=e.cloneNode.node._currentBackoff,this._lastUsed=e.cloneNode.node._lastUsed,this._readmitTime=e.cloneNode.node._readmitTime,this._useCount=e.cloneNode.node._useCount,this._badGrpcStatusCount=e.cloneNode.node._badGrpcStatusCount,this._minBackoff=e.cloneNode.node._minBackoff,this._maxBackoff=e.cloneNode.node._minBackoff}}getKey(){throw new Error("not implemented")}setCert(e){return this}get address(){return this._address}get attempts(){return this._badGrpcStatusCount}get minBackoff(){return this._minBackoff}setMinBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._minBackoff=e,this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._maxBackoff=e,this}getChannel(){return this._useCount++,this.__lastUsed=Date.now(),null!=this._channel||(this._channel=this._channelInitFunction(this.address.toString(),this._cert)),this._channel}isHealthy(){return this._readmitTime<=Date.now()}increaseBackoff(){this._currentBackoff=Math.min(2*this._currentBackoff,this._maxBackoff),this._readmitTime=Date.now()+this._currentBackoff}decreaseBackoff(){this._currentBackoff=Math.max(this._currentBackoff/2,this._minBackoff)}getRemainingTime(){return this._readmitTime-this._lastUsed}backoff(){return new Promise(e=>setTimeout(e,this.getRemainingTime()))}compare(e){let t=this.getRemainingTime()-e.getRemainingTime();return 0!=t?t:(t=this._currentBackoff-e._currentBackoff,0!=t?t:(t=this._badGrpcStatusCount-e._badGrpcStatusCount,0!=t?t:(t=this._useCount-e._useCount,0!=t?t:this._lastUsed-e._lastUsed)))}close(){null!=this._channel&&this._channel.close(),this._channel=null}}class Node extends ManagedNode{constructor(e={}){if(super(e),null!=e.newNode)this._accountId=e.newNode.accountId,this._nodeAddress=null;else{if(null==e.cloneNode)throw new Error(`failed to create node: ${JSON.stringify(e)}`);this._accountId=e.cloneNode.node._accountId,this._nodeAddress=e.cloneNode.node._nodeAddress}}getKey(){return this._accountId.toString()}toInsecure(){return new Node({cloneNode:{node:this,address:this._address.toInsecure()}})}toSecure(){return new Node({cloneNode:{node:this,address:this._address.toSecure()}})}get accountId(){return this._accountId}get nodeAddress(){return this._nodeAddress}setNodeAddress(e){return this._nodeAddress=e,this}}const PREVIEWNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$8("0ad0070a0e33352e3233312e3230382e31343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340acf070a0d332e3231312e3234382e31373210a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ace070a0c34302e3132312e36342e343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ad1070a0d33352e3139392e31352e31373710a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad1070a0d332e3133332e3231332e31343610a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad0070a0c34302e37302e31312e32303210a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad2070a0e33352e3232352e3230312e31393510a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d35322e31352e3130352e31333010a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d3130342e34332e3234382e363310a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad2070a0e33352e3234372e3130392e31333510a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b35342e3234312e33382e3110a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b31332e38382e32322e343710a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330ad0070a0c33352e3233352e36352e353110a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d35342e3137372e35312e31323710a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad0070a0c31332e36342e3137302e343010a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d33342e3130362e3234372e363510a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33352e38332e38392e31373110a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad1070a0d31332e37382e3233322e31393210a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33342e3132352e32332e343910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390acf070a0b35302e31382e31372e393310a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390ad1070a0d32302e3135302e3133362e383910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a60363465303938363135626634303566376564356134303133343436623839633438386366636436626232356134613637366463373765656131316433336437303236383266306136396138303330653863353737376430653432323033373939"))),TESTNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$8("0a7f0a0c33342e39342e3130362e363110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a80010a0d35302e31382e3133322e32313110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a81010a0e3133382e39312e3134322e32313910a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a82010a0d33352e3233372e3131392e353510a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a7f0a0a332e3231322e362e313310a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d35322e3136382e37362e32343110a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d33352e3234352e32372e31393310a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a80010a0b35322e32302e31382e383610a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a81010a0c34302e37392e38332e31323410a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a82010a0d33342e38332e3131322e31313610a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35342e37302e3139322e333310a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35322e3138332e34352e363510a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a80010a0b33342e39342e3136302e3410a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e35342e3137362e3139392e31303910a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a82010a0d31332e36342e3138312e31333610a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e33342e3130362e3130322e32313810a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a82010a0d33352e3135352e34392e31343710a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a81010a0c31332e37382e3233382e333210a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a83010a0e33342e3133332e3139372e32333010a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e31342e3235322e32303710a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e3136352e31372e32333110a388031a05302e302e392806320218093a60363938333261373361333630326538643166626535616435386431633236333761316236373264373165653837616631306462363438656239316166623232383235336231663437653537643364346134346666353437623333393461613232"))),MAINNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$8("0ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633435363165336332373863643635306538306334313363613434343233633163336331336366313437356636663639373664353937616534333262343961623432303836623739623834313332363035346238623364636635376438666364373962666330353831383363613234636434633163626335373465643131313765326635623762336336336365376230366439623465666366373337353633376234316665366635336338313162396465363134336633613532393537636466393536373735313230623333373033666635373632313430376162393537356263326433356330643434663039383366633165663633613466663532303966303730633932616631303632393536303163393662636564303634656331393031393730313963363831316334633864643830636234663461633731663961643736653761633839343536666266346630313166393061626432643930353336653832333436353166366265663932376533643564386237626634353930353039383362656361336162656632613964393761663334353737326137373430653936393932373562303138656130646632383661646436636539323365663930386662653736326137356632313131363836326462343464336463613164343462346432653864633130363663353030366262356137643935346164323535643462363033323733343735653531316165623438356430363961303637633061623563323435333863393333633036623561366165666139343030356332393135323133653463636461653663393432663632373266396464353238326436623839306631663230656664323339396364363734393234666135373034366163366461333265373339353161373331313365393166633262376666323965343835316238336666333966383362613965633666303863656664626236636262626666616266646661613931643933306637323030646134383133376333393463626431336537303165636463323631366664323162616436383161613466303031303230333031303030312804320218073a603665396138616263646364653665313134396133656265313766643538643839303538333961383664623732623036613365613230616131373666383638623235343838353261653432336437613963366237636666396537313436323961320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613163343037373135343330336363373263346662373639326333663934323531626465633132333961316637613839373261626539316133353332336662656361363235613766666165363430366338353564633261663231313039303062306466306536653664623736333634646661316666653835656461353637393336653239383562383536333461333261613532613635393964643663333062653166376136633562386635656563616632363231643861343539363832666364326462616164313536316431316633336663636237663535303061633536386431363564626561616365333238366432383934663634313239643738316436633732666437643539396339653164336166346161343333633233623931306661653463343834313634316636313532366164373837656265613533393837343136376539643361373363633066623135363432396431356563373633613664306630363131356137396239616637383364373762393864383330393661613437343366393734303864396531346263663464646666653435393137363838343762343063623864613763613337353235366432623933356430393566653235326661653831666636653337663834643761393064376535373061346638656633633764373636656564613437326630393230313939303135613839303832353961383733633534353466636262646361643265353238646538353435356234303833633764633461646335613938386530636464666463313539643564373132616264353434616137336563303239303839383134633938613434663236666330363434363539633138336533313834616132373266386431646330626661336530613536303438346362303535626134646262356363333339656338306264313164363432646333613730326538633730336162323139333038346439626436336630646665313261343333633235373665616637383163666164383637656637306264613631373638623262656631346635306336633362386230393666303230333031303030312805320218083a606464336233653763643361323537643832373665343635333533363162303138623730303931663438363635653832303031306538316563303539326236396264346265316662643765636435303964303730313364643034313238343266640ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623263636163363561643066633736343561383137626661626334383761643765343133313165376133313938623337666238343264383463333935623366363764366264383438663130633666303363323930653866376461613864303031613834343164633335326131393136306133313933653638623832656466313961653637363933613961333364346362383765373839613130373037313535313565613737326361613862383661353639623931633534353038333564396333353466306461636563393766653737303931623435623134373639386237663836303134323264636432323631653932386465346461633963343264636261666466393663303732333362613330323730373666333763393639653865643330623662356438663530333462653764393263353936663862653836316535316663633361323432626639643862653965326139653865306631353565626366663233656666613763643537633130353432383131643830373736633935383535323666646230656161333465653139353564353131313933393066653837336534633034646564643239313635383834623938623436333038373838616537666334643461613461386663396263323637346261333231343933623632343435356164343130633164653731626339356431643931666130663230313431386137393565333039656166323937623639396266323763396661323736336364353963656230323165313662383230306331303630663238313766643833636663373637313833343839343631653335393932393162333830643665393339626161346231393233326136613237326464653635316638303436666463333464623237366137373764366662326265633332353562326363323434623461663536366231303566333063363530366464616530656233646564646366393437626362396336306530303039383466336234613863366334656434626639306263313933326237663934646333616536623336303030386562393032303430663962303230333031303030312802320218053a603561383634313561303861306138323566336232656237353031303135353230326533313234336665343161303333333834653738633138633131653565386632303964343933623062326664343565303662333734663262363964663564370ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613365333762373663366364356636363232643639323434343464313263363737633339356632623539303266336262393862386138623530353561373037373036636130323863643735303630613264383730326432643862303439343762646366653061386331343161613238343462316530366536363139303031326538623633323661623066613331373937336263376362346432393439663231303861613034633462306339316261613537323866356235363232656337356162663537386131663762343165646532613637656264363963313865353831666466396336303230616330646539636132633331663063363436393030333331316662623563653764623439633738376531613764323761613432356565376238346461376536363933396639633830643065383266636535356530326466633862356337383431386132366161343336353036393837313962616663656366306264343930303061646463666134303537303862646265666262313937343964323264616230303765343464343565613233623130366638383334633135326532353036326434636632346666323533353663376562333732393130353339336662343962616239303461303266306630626234313763643931396433353238393031323865366262666634666163396639306465313138613937346632613664643031653033326137396231373866363066613166636262643032623537303466623436323935633135313930383136333733656464363633356338353639373866316239353033663166373362346230626538616261326564316665656164353939353362663832656664653933613334373161626435356364613362613861363733666262333739393734396662303036643030336630653633663636356333343631643261376232396463386232303462613539613635363638613436616532383738663030643166393439306466396532383066656266343331356561303465616135363861336139666434386336326336336236656364613639303230333031303030312803320218063a606434363430333938303337393230373965636364356134343331316361306463323262353065633839356235366535336431326232396637326463366462613363616665326535623831303466626461303338616635623434376430666231320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393361323135636334613761373232636165396331336162643633366466393963636565633661663964623436623639666135313637313665663530636532343930613938316530396162303139636132636234363831316235623631396431626431643565653666343661343263373737636264656536343261313438346563646635646464333732393634326333386336643433613838353838373434373566353832343434333636346330346466656439623839303435666230383565323563336566636234383431373333656666376335323963313339653639333530633263643739623263386431393637396137313265346538636166643332363735343162383332623365313061303132353564656636396466316539643362386438656166303331316465363764356531326232366464303164626264396433653432643335643964653237313330326530663166363964383763626337616361396538383637653964343238643363616230363636656234393064356662616233306266663366373835643033663230373261343362623962356535343635366135393263623631656166643561356566323834633763616563363666376634373332356363306434633164323766363631643861373438636135303731633036656631333464666639366634303836363838333636643436386132343738303031376530623536616261376661623433623362376330623737393036666165353438326633323831316332393265366231343435346531346238393438303161383661303363633437373934646430643734353237613732653432346564336166613034383939656362396136336632613961653732626537666139383961646630643635613332633835316439383031666334313034386466333335363466633762333137303765633866623830313430666537623761316661313230626131636236363033323463656666623462636332643962623764653063663534633831396632646433626365616465633963323566356531396463396231303230333031303030312806320218093a603365303261363732306334343636353965383633303564353562666565383230623335653635306665636163633535333039373435356532633465303332636339646564313662316262343464336235393262626163623663326266663165360ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303930323539663465336439663066333934323536353438653963373330386231306237333430336363393039346439376164313531623737303631373062393737326365623634643636326563656639303161386437643135643331396135396338623731303731616363643839356237633933363130646336393736663637633465313732396261383337336162376535326133663363386632363534393164646536396436653039393934373065373434353938313133316264393663333665363836353230336662326562643564353065616461666237323633393664656331643931373438393862346539626530346337346433303466656164643963626433323334633362376633333036633939636230633333396663323539363962343164353861326237636663313833326532323664383163313936333939336532323535613038376431363938633033643432313062643634353830363434643039356361373661613137393465646434306331633837623566383261386533396636303365393731313662613034353738653765383033343634393564373835643465663763663737313462396562366635663965306239613934663462373338383436313962393237346434613935656631353735346138396439376566356331613838623664363933653061383065626435333766633963663063613931643163363264393135646537656438313862393532653634633230303239336565386532383461343136613732613365313266633764343233623135386639623439363630636263323436366662656430666564326532346531303266646539343265623463666439346265633436643364393066633038633339666563626130336530636132343634616536363462393739353135626132396531663730326333666537303262653739333739366438656462313761613438633039323930623032343534396630363131663561653233656437653136343432646637643164616432323836633262623039643535323264643365643639386332663032303330313030303128093202180c3a606339373462623938326338313931336237333236643561336639646363343836313261313566376161643032663230376230663130636432303137613666626666353830336537636139626662343730396162323862366230396435623133660ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303962646438653834666164616133353332666334636530316138613137643463336232333266353061393739306532363236383465646334383233653831356131626435623230656365613762663536653239663662623762383331666233626636656663643134373566306238656435666662306231333835623936643136366236323966303339366138666566356630366534626361323565653461313334306565323633613464396262303230643866343732333036663364383836313338646537613031396530353962643061666339303263636261316132313361653264616136306338613031333735356665306134386530333466356234303233613264616465616138386335343836383335336163376137613364663132623266623634313837373465396231346265366561623863633237623838303132616436313632646137346530656562313631333539303566343337333734646162383538366437353061323662626433616332346165643837386334643533653635313037326338373165393464376163633537356339363733383137333461353366656166346437626136626364643234316363363435386336303837643836333032616132353163303466366435366239633332643764393636323437353065643035353738356430373733663433646330393962323863393232383131343865366338316632393766663964313636653030306163303462333132343138363737356663656637356635656261306331303332626631333064663663643761343632313164306466336530353834643932656136373334396438343930353038656234656638386635346338633364343836646538373139663130666139366665623835636337393630373663613738313331386565326439656439303363613133333630343063353961643931613464326636393865393130386165306564623962316362393561643333623139376666623138626431626138623536636265653261616539353835656365323038613165313462343835363436333032303330313030303128083202180b3a603937303834333033333130373866353638326337663332343464383263336233653238316139313837393537386465656163646363326132656265353431616631383831313561643265383338363565356635643234376234613138633165650ab50722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039303938383635646566326632616233373663376630663733386331643837613237616330316166643030383632306333356362366562666362623063333330303331393361333838633334366433303233313732373031323139336262373666643330303462383634333132633638396566353231336362623930313130313530396465616239346632366137333265363337393239646134633463623332353137653361646262333831316435306163346337376331666365386236353136303632313566333437303766336537323635353435653538633839343630396532383337366264623737373566653330343339653065313539326664636230633365653163333035373733643037326136623839353765616663653161313162653936356564616666333834333336366362366134346563323561383930313036653632343735363766373662353530666461343832626165633633303764363938656338383834316664363666323366323130653437623861396463626136626134653166613731366462333363383065333038313934393664636235653536303966623665376336313533373962646465643432376539323331623932353463326261663934333630386138366436393861653961336338363339646638383764366636623561373133383564323433333864393131613231326266373166316532616363386231383662393665633865363963383662366430353832313737373661303963396336383935336564623539313635373862356132363362326634363965336230633037656164613731613434376565613766386663316262383037343235353536376237663062643165366166623033353837313863393862343239653234623232393835393666633736636636616633393663613934333464373932366563376433376434623932616635366434356665666638313936303935323234613931366331666665366236363765323535666333616338636363656639323064633034346232353030333133326238373830363734326630323033303130303031320218033a603333373339306438666561313434616663313265383132353461323864616336656138323839333833366163303732656666643835653061373734383538306566323830393636343863356137663864626234636538313437363831353133370ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130306335376564623966663237366530323362323830323163623164383763646631393636623639386366343865346561616137633639323037376365656538636362323339613463393231353937653865383966376363303564336633313331353738393736633465333134343035643461346530336137323431306335633039636135323761643561383562393938363337653732613332653166626330643535343662323436356539653830366332646435303965623035306162356662323730363366643932383135623164643236383965323131316361656236663534396539346139663030663038323164346361366336613631313766356135333363393236336266303734613330643563626566353064316338633233383762636139373265646564613039383362356430613662353764636230303230303036383238623430653430373662343837306232346261643834303536656535326235663432326538383430303238633235303036333832643865396336363132323566346637366561373265333430363037653966633666336332303433333037366131636138636231356564303361633839363664303530376263646536383165346530323331656539663837643131316537623438616338663934643264383432623532646637336635373363633534313439363437393763363236393638666661653734313866336236313039623561306630396533323233663461346435653335303964643235303133386636626331376266366365636531373539343433306466313830613338653930616466326166666266616430633662386331623837663137386130363164636662666638623932633931363664383734633166663561663466626364626665386539643039393337306464663630626537343736333364333665653465623563643531663665336333333965313531653431626462356135636532633863393761306134336233636434636330383138383463383739663964326633373438343238633835373366313763393066336362643032303330313030303128073202180a3a603734306166366266373339653838336338386633333434633961306638623330316533396463393831633531363365306465326133666634326239396534323665643765353662363766343231383530333834356466363266343963396662300ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393133316161333638663933343532323966393762363235396363636166666561323365303063643565616430326533663639366331653731346565333933396461643836306533386266393561323937346639656234386539333433663861616334303565613935356430353332336531313762336231633934383133613361663432666538303832633364343362616631626434643833363765393364623030616436393665363237613130333661653533346630313165616435653536663337613666666534346236623965303939343031313932616435363061303334366234316138313030393566356632643766643332643665656236353562613735386336623532366331323933383661663731393763376135336165363033643632323833323235343936316631366430656661383037396137363835363138383862653733333439323231373935366262636166616562623631333563356662623234383464356234613566646630333336616330326532366331363532633162643865616633306461653164366433656230306637623466616238643634373866653864393565623931316466393636613064656134653532326462373662383936363537306563633561663039353136343234663061663566386565363665333836643536353037313339393731363961633337353733626635326664303538646539356162326666363865363831313161623233343035656139363462326262383864303263306631636165643731656364643465346534303835393438373666646238353030626335356337626130323036366530356162393864396637653034363664393730326562353765653337323266386663633835613735353035666633323632313730323838623738383732336164623937653464653536323063633930656164313338326663643735373138383966656662313165363737316263336636663366656231396337616335343238373864303361393032373035323663336565643234393465666635346531353363613966363839303230333031303030312801320218043a603765616236393661623935343336363538626331346666366234626534643932356364353162323230646632613164356336656531363061646166323961353165363934646533656531383463653232656164386437646239333231383266330ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038326465373330363566333466666332393334306435393439643232323062316534333636656435636637633665626436313663663934313661353365613030313766366262313136626664336633646566636331356237613464646630653434643032666536393536383830353365373961373730653230316263663731393333393030333965653866303836643466613734366337653035363931383330316639623565383465333932363238323830383561373962333232626361306235643835666539373232316132366262646532353863363230663064636561303261623165646431366363343961336632616239323838653364643166333764633462366136663731333366663932653534316337316237306432613266363664353537323561623138626638366430303965633364323466356431326530623565363830326431313531333732643462373634656265636234616638326636343934383565633537623561303164633637393538663561303363636161623763626139333534613137333732633133313662613437633935336161663934393031623366386332346536613361666436373538653766336231343363653264643363623037316232613734633932316365653934396134623561366265383739663163373930613662386436336231393264376565323961393439316664643638396139386330613763336436303332306631623461633264363232396466643934653432663361363034386137366265316562393538633861313837336265386433333861656339666335396162376633373632363738393430326331666435393566313930383735373565306265383237666334633061346662336433393361643734613934396363393836626662363463616264646165353339333566366463353630373464623933643737656133623831366264643662653533343439373237323238393835396666333463653531383630616666623632316431303438376463333834336631663836643534303334613633653438613161306430323033303130303031280a3202180d3a606132656363316232616539386264323862633161303864386633373161306434663734356337363864306337373339363235363265333433623235643833343235656565613765663865613134323935333432623865623738643332656333660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039383735356134303862353332316532363330353230303064366437643461326333613535346435653133383461396362356562663437346165383832633633623438366264303864313434646466316139346365396137643632353139363330303661666461616334353838343666313736343031393566653235333961363536393330656661383534663231343865363865633161303863316334396432303063336633303435666537313437663036643533346334626432363231303063623164643339373339643736306438316130626432306638336632353564323530376434636362313130366235333631386336613934343039633838376361653236326434636565396338363233323134376365633134303465306335376262613733313731333065653339363433383838616633643539386564643832623863363165363561653831613465316135366263303664333937313433613938643431636138376433656634333365663061656162363830313139316233653338343830393638663636623665383836363261663435613965323132393934663638623238386562393637626562393834373863323433653231333663316131353931663036316635626330346232316666326261343862323966313834333130383838373362646665393966386135326539343038393731383536653830346465613630326133313137383663393835363532393633633361333737303332396234303966373466646663373436623232613566383431383931323037316334636538343663396234623332306665646636653962363465326362653338346639613832623661616164346232303930373433316466316133336636393230376135363536303062653831303730643038333239303039393538353961343439386435623539333135626365626566656538303765623061336139343266316364663333363764643434343466646232393838366566636464306265346162653961313838383033393533383735656461333364623732393839663736336230323033303130303031280b3202180e3a603139366237623132303739376364623361396430303362393833643537646131303331303662313733306531376636376532633762616161646234333738396166313639366461313031316232353362636263383630333333383566303332380ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061396462376638626161313236383938666162373839313135613362356438393734346631393765323830343161653039386633653838366336393837313732316531316262306164313166336365393132346161393631643661306463383435663439373635633366616231393935383430323637366635363434363262663238316462613535383837383066303365393035373938653138343236396161613630663761313437323333316532666231646561646438373763383463626362363431636139653563386164366534356263313539636230373966636230643434396364636438643932333963316130343765376234343864613063646361323636313061323566323936643936653734363962363736643461343434353136653761353965383532393361383038366638343063303532383534653032613863623230303264616433353832356265346438336235326661393165386337336666303439373436313438383632373837633131313866393234643331636261633162343466656666323264343336623339373965616466396234336134626661373265313562343735356663616232363065303661323739633362623733626337663136613036306434643532326664343930353830333838616135393564383034343733366535323266363432343931356637383033623735383365303935636466373863333235313936393764653831623839666235303035343735336231613137663961616662303634643834633939326639616231316363626338636231303831346463616635323634616134356632316264656661633832636361636161663335386533313337336565316261346537343032666438613730656130633238636135636337346463343235313063393639636432633435396231656333363838613031656133396139393237313063643232393763393861383462363334386135373738303466646332333464336665313930336532633231653137326461323862353961653665346337653865646438623731633439643730323033303130303031280c3202180f3a603538343661353366343437353239666439636462373830346364333136383865643665656265336236336461326635663231316666626337333731393763663366316366626664613631626537643135313066306539323339383131376637340ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061386365616333363765623166316465356630643965663365616630646639623938343438666532303830383437363536326130363063353163323839373730623463616366653932636236353536393832336539363263326132633966656435336264333663613361313232646531633532356135383266323561346437643632386331613364356264623839333661656365373531306537353534656537303333303235633039326338323865656235373338626530326564393633646138316135393230353633346365393435343537376162383266343066313366316565353565306165373237653233633330323834623166343462393961636534646463356639616337616438386439666132323535393335623234646362613834303036343265313663663235333263306230643638393239303436303837313563343037366634366438346130653066656433366537366363646339363335356537613236313630393435633262353461653236636330306664303832333236333436656565656137646437356639313931316539396462636239396561346163366261303536633333323238643838316438353833316439636338373935393364613137343664643065653935646332623936666539336261666366663263643764393239353864373864663333663230356437313135656439666163346462366634636336306535366135343431646135623562353566613539393939303265393538613662366334346438313064646335363138313234316238376632326630353961363838306538303231373336643031383937646236353434396365383137613233373564303335353163623064653530376336303961306338303330656366346266646562323133633033646161373634613138323162373234333334663731663736386437616563623237373035326137303333373635663037323138303536633738663261383761663138333836643866363161356366636233663262613464643539393135663133643338363334643136393537353730323033303130303031280d320218103a603030306162636435396133306135333838633530306265363832663663613239343034363239356339323735383831633230643334626230643639306564613762333862366262643037613364643166646662366137303434626230396366660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061663062393134323537626637613436353563346135306430636164356530613165343538316564363632336630653837333066373936623866323963353831373862636363363933326331666333316633396566343462383264336334336233393837333733373366656362313239353232386130346664353061313466333634366438346665316634363763616562393864343633653239373565393935623864326531653339663362663661646463323561653335643635643032363038653033343535333739363665326162636534396238313462656164336331623735373137346165333063303062306334336539396238303439366237326433633133316631633665346663646130356632383131376566396532386334333033626534643863376530343264353862383363633132313934356132633635653739363263616139313835393338663337353764663763636139356366303262356533313934346133613631396130616333663165333462396230313364346332323463346631653730666439666433363938336566383661646535313833363263633833323263306637623631613961633735666238326537623836643638626330663039396130396131346361633561316438643338663961386137306363333766663563633362626432373432666664313436323535633137316536613137383038333237316463653066646536383165643439326362353962303739366432373031373538333864633539303831303765336136656133663961343036623364313133306363656333623437393165343962626332333136303362343661623264306639336434336265373561623961346437313065613934306532383561376231353362306361376364646565366439646365306164383335306334316439306332313562393538383531356166613061633333363561653037653831663362626233366264626561633462333162636231616134653832353635623937376639646164383564363236656566396161613965663864376533666230323033303130303031280e320218113a603933653238313031303462326231376230303935326235613431303264333365646230343363623136646533616433643364363832363066353562623065353837333765613539343463333338663763386362383863373833336663383630630ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038633037626533303561643630623930626132646162333962306565373736306531613232663835373532323534306437306230336233663965343837356133613239616230383038386631343466353765623235326534366261353933383564306536643432373031313764613061626331623362383036393463396135303538623836643631646661303665373136373039633838653866656163376333613065316432356663306165626636613866373666636239396638343566653138313436316361623638353862393763336134303237666233373132623134653663303738396465313764343137363435373765353131343137656231363236393265623037616531653733353532333565396262343339303437623663303136313337383265376464366636303464616134363734363631643533393631663436633366616136623765373637363264333733623562353432623739656139363365666266333361633638313938626232623636316366663637363931366566333732616434633236633231366334626334373837633834656333326431383464373763373531383663303963663364396639313433336361393835333131396261623331666136616432366634353365353936643962646563613638613537363962633866656537613533356438306338633666336566623164666232383861623661393739383534623763653833313234656330643130326166663934633362373466396333373839353863323565623933336464353363316538303561313836353464366439313836393930663635373034323966393630663334653862346637666439393732646362666539323430653037346461326433353561356637656639633161663632656635393832613831373435373862396331356334396563353636626461636233306363666365663039636466653730386164343837343234653963316265363533663965653736363065376439343263316566613564613238366531616464616230366139613333663964653934363739356230323033303130303031280f320218123a603934383235313739643163333934303137306233356432363665346366613830643737386335653966356261653764653833666638636334373431663362653336616336336431653761653439373261656466366263316533636632303638390ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030626531376339393634376365633635613434343037623533353835366233633362616566356235346635363561663538623834353662613863376365353335643561633732633631633434633736623363353763386538363438343136333762653130613833636665333963303932343736643064626534643663646364636437323061333062356266656235316130316131386635383263343566366338363939336663663764663138323933356465316438363930363034346463663335313836393335643962643765656137393532333532626562623465663961653066373636316537306134323337616661393839393636383763613438666366633562303064333830376630353462653066613863336266613432353033386265366566323935313634663232663733623765383863393465613962653861613466336132343563383962396431666435313932663761353062393538623265663831303462333666316266386664326366623238633134323138303063316334376534656639386166313530303730636336643639643137653865623932663138613661613161363532363661343935323338643130336638663639356235376563663337333635306130353230303837343537323162656138313536323739363763383037363336356466386334633761376434646438663263333835306331386662613731656236306536653864666264313936653035333766643730623334346563626363353330646663383364613666656466343964353161393034313935303262613964373063643335663163663363303639346532333534663930363466646266353335656232336332376330613433643062373863316638363763363164393836393564386465663762633261313062623636373463323266363661616230613931383133646466323763646238353263353965663739653162396531613037356661366565323761376533373734646266346232363436353432376536643561623931666537663066336137313738346563613138326235303230333031303030312810320218133a603038393039376465663031623037633764393734613537353532353161366161613061666236623332613534353334336432393138653732626164303433323163313131633234643432373538306633626131653236616139643735653632360ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613561643262373634336130346330353564326638636432353131623135313339666334353537353632313338386534396331313962326633393861636131313066363133393662306338363664653530363335323262623835343032373365313366366439346365316536303433386636616662303061616136343631326637313435653962636538626331613533623934313931336161373663396633613238333366616437636632383563376163326433376639396633633263646234396465346431353165363136373835363466323831663534313432346234316661376335316232613936303232383363376433326565303065623833386461313563333861666339366530363164393763656465323231363566663161613935396631633432373562326430393863343035383661353537396662623363623930303732373034313230613861363661353237306634666366643130383663393233363930613335653766643434356533336163303366313339633638363835353635373063646334616166323231303761366331613434323435366137633663373965653034303930653765356434663636626361363063613166343762366466623534336461633363626631396137373139613866353562366638336234613362386136366436303235366430613436353531666137303234626430353633316238613535383038373732353463326632663236386364633333643264626263666237333365396662653233336262396362353961623331613031343862323365386334323638306666313061663463373961346430383334366662373961393364393632393534386561663162623132343639386661656661346364643732343432633033613034623733333433326637343839303361333235633238336434353661623961653932316165376564333339316535643137383765666463323335343061376238356336393161653837306130376639306231316331336233326365343365616564313562333639363835636534393137376363393835303230333031303030312811320218143a603939666162633461646534653636326336653238323366346139366562323134343034383465356136643064333132623730633036386432326236323936333830376332333361343964626239383361376562623330653737303637373261340ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030386434356332316330633935656636356130323964353263393537666430663835663230313233646130333465363136373164646565353437356630373338326136366336366362346463353035303464646664333735383130383364663864313735373733306564386436663336346466346333366132363531353931393535646132303161323430376661386162396232333133383131323235613064613233306662653338306530393061613536656661346632303265633962343832336636353031643936616336393865626632366161636633656532643166333261373231633934376531303736636633356233373364613164383761333661313532653030653731303131373932323832653832356666313731633538333362383835373062666336646138343439653666393566386231323635616235353531393430333135353364316435373666393363343263306361363061616261633463386464313632643831313466326232313531313538336337323533396665353663343939613932396465336134306130643435633137633538396332643739383863653236656166633932613364333762376561303034326434336530336166613632373162323632353561366363636661653533373138323164383165306230356332353062353966306139303734316130653065383861303965643536633562393738306430393566303930366630623831643531323633393832616165303131333663303732643834346131316436646134623261363163363434653161623137663136666634386565323366656465383435326631653432653264333061303739306332356434323036306531643434613637316132656232336431313466363863373165333366313736646235386136386234333030353462633164323938336132336133326561366666393566613763346438653338306562323936653938623739363865636638343534643831376337333765656135646439323165623836633136633762323933303461346137656362653561336131303230333031303030312812320218153a606537396165396337313933643164326263393433383436346338616135663632323461653835323936366134336239383235383833663766373432633533393562643330393935383761393638363662393233396431656666336165353037610ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623035616265326162303066646430366339353565383637313062306530366631613932363234613438616431636263386466633666323231323936326230633330666462643238346133376335613337363538623633633336656138313632353631613865346639343663626535373232633032383830316630663238316337306638643838633763303061326632653239663539376237393938363965643833353664663537633437626539393434613261616666363530663962346262613064626335336463383830666462623639656134353139303564323830323230326638653239633034613736643237616632656237633534383438356266336634363934633930633431383130383838383433373932383438383335663738313637303764336538643736663465363766353738306263663038383133633535656336333961396264363234313738663565623134376435303061663335316539656631623165333432343834636132363064623763636261653438366631336366323635623562316162363838303636303038303533623230633364656463653737316339613038613033323061613963653435316562396439383361376234396361613130393666386164633039383331386463333865306537636566306438653564353537613036373536383561316339653235366132626339646261333232623362623331373263663731343037376263333830663861306134333361386266613766626663353966366230393365633862663665393339376330396231386531383034306331623536363836343733376338666137653239373935663361343538386464613763326261623439353636356363346139623833366532656239306336326133666361663539316662356638313830346337363138306536323666613236343461376465333435313164366334363637643938393337653237373333663464316539313338383333353465353466643733353137323165373666376235366333343833333838663461366238376232386165626562303230333031303030312813320218163a603962343038383566313362366163316337353336393262613366313739303061333838333165363934613061663937343934623834333838323039636235656662646339386136646162623265316337313833393166633133356264616163330ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396463643863306135336539306333353539353734663636323034313137643362353033653530613336643330393766616338343239653663656364333762623534303731383038663265653938323033356638353161306339626532313736333833613232653338633161626131363866333266393035373063623332333363666536323539383736363661663637623531346361656632316662386466366430666364333363663236303662393264646561353533366236303638643836373832653339626435633338343435393931643431396237643165633038353939343132633039343964316332343062333563313464633535323734646261373166666165393336313235613566383139663534313332653234333964346163353539373939366563653835653133646666333336316639313331663536636561633562396635353262343963663666396139616336653564636532646233363934363266393361663830653562353662366538626566613136326130363162346137363839326264633834363437333036633630303835386664643237303332373663326337303434303139386566643766653335343563663261623538306337346366643634343561616637626437663734356363323532656162643236356561626565383632343137313034653639343861353537353666646332323264663061313031353234646531633363303863636630343330313165633766653936346564643834353161313330313437633037333633613335663131666465656638663261326237363137353762343335386666383962373561343864363762646336303930363933653062623836373965636262393366666462336633656439366265633933656634363536653337313661623837636534366361386531323539633866656464653866326631656130663365623263343865393635353164653132333330333435373235663435656436396338353735623531363833616661343732363231383236646232326262326431633466316533363436346139303230333031303030312814320218173a60346630613033333466393737363738313632663830643936376637323139313431333630633062376637663033316233376336396536323137333933336564616434366263626139373636376565373262666435613933346261313532326330")));class ManagedNetwork{constructor(e){this._network=new Map,this._nodes=[],this._healthyNodes=[],this._createNetworkChannel=e,this._ledgerId=null,this._minBackoff=8e3,this._maxBackoff=36e5,this._maxNodeAttempts=-1,this._nodeMinReadmitPeriod=this._minBackoff,this._nodeMaxReadmitPeriod=this._maxBackoff,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._ledgerId="string"==typeof e?LedgerId.fromString(e):e,this}get ledgerId(){return null!=this._ledgerId?this._ledgerId:null}_createNodeFromNetworkEntry(e){throw new Error("not implemented")}_getNodesToRemove(e){throw new Error("not implemented")}_removeDeadNodes(){if(this._maxNodeAttempts>0)for(let e=this._nodes.length-1;e>=0;e--){this._nodes[e]._badGrpcStatusCount<this._maxNodeAttempts||this._closeNode(e)}}_readmitNodes(){const e=Date.now();if(this._earliestReadmitTime<=e){let t=Number.MAX_SAFE_INTEGER,n=!0;e:for(let r=0;r<this._nodes.length;r++){for(let o=0;o<this._healthyNodes.length;o++)if(n&&this._nodes[r]._readmitTime>e&&(t=Math.min(this._nodes[r]._readmitTime,t)),this._nodes[r]==this._healthyNodes[o])continue e;n=!1,this._nodes[r]._readmitTime<=e&&this._healthyNodes.push(this._nodes[r])}this._earliestReadmitTime=Math.min(Math.max(t,this._nodeMinReadmitPeriod),this._nodeMaxReadmitPeriod)}}_getNumberOfMostHealthyNodes(e){this._removeDeadNodes(),this._readmitNodes();const t=[];let n=this._healthyNodes.slice();e=Math.min(e,n.length);for(let r=0;r<e;r++){const e=n[Math.floor(Math.random()*n.length)];if(!e)break;t.push(e),n=n.filter(t=>t.getKey()!==e.getKey())}return t}_closeNode(e){const t=this._nodes[e];t.close(),this._removeNodeFromNetwork(t),this._nodes.splice(e,1)}_removeNodeFromNetwork(e){const t=this._network.get(e.getKey());for(let n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}0===t.length&&this._network.delete(e.getKey())}_setNetwork(e){const t=[],n=new Set,r=new Set,o=[],i=new Map;for(const t of this._getNodesToRemove(e))this._closeNode(t);for(const e of this._nodes)t.push(e),n.add(e.getKey()),r.add(e.address.toString());for(const[o,i]of e)n.has(i.toString())&&r.has(o)||t.push(this._createNodeFromNetworkEntry([o,i]));shuffle(t);for(const e of t){if(!e.isHealthy())continue;o.push(e);const t=i.has(e.getKey())?i.get(e.getKey()):[];t.push(e),i.set(e.getKey(),t)}return this._nodes=t,this._healthyNodes=o,this._network=i,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}get minBackoff(){return this._minBackoff}setMinBackoff(e){this._minBackoff=e;for(const t of this._nodes)t.setMinBackoff(e);return this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){this._maxBackoff=e;for(const t of this._nodes)t.setMaxBackoff(e);return this}get nodeMinReadmitPeriod(){return this._nodeMinReadmitPeriod}setNodeMinReadmitPeriod(e){return this._nodeMinReadmitPeriod=e,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod,this}get nodeMaxReadmitPeriod(){return this._nodeMaxReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._nodeMaxReadmitPeriod=e,this}getNode(e){if(this._readmitNodes(),null!=e&&null!=e){const t=this._network.get(e.toString());if(t){return t[Math.floor(Math.random()*t.length)]}{const e=Array.from(this._network.keys()),t=e[Math.floor(Math.random()*e.length)],n=this._network.get(t);return n[Math.floor(Math.random()*n.length)]}}if(0==this._healthyNodes.length)throw new Error("failed to find a healthy working node");return this._healthyNodes[Math.floor(Math.random()*this._healthyNodes.length)]}increaseBackoff(e){e.increaseBackoff();for(let t=0;t<this._healthyNodes.length;t++)this._healthyNodes[t]==e&&this._healthyNodes.splice(t,1)}decreaseBackoff(e){e.decreaseBackoff()}close(){for(const e of this._nodes)e.close();this._network.clear(),this._nodes=[]}}class Network extends ManagedNetwork{constructor(e){super(e),this._maxNodesPerTransaction=-1,this._addressBook=null,this._transportSecurity=!1}setNetwork(e){this._setNetwork(new Map(Object.entries(e).map(([e,t])=>[e,"string"==typeof t?AccountId.fromString(t):t])))}setNetworkFromAddressBook(e){const t={},n=this.isTransportSecurity()?50212:50211;for(const r of e.nodeAddresses)for(const e of r.addresses)e.port===n&&null!=r.accountId&&(t[e.toString()]=r.accountId);return this.setNetwork(t),this}get network(){var e={};for(const t of this._nodes)e[t.address.toString()]=t.accountId;return e}setNetworkName(e){switch(super.setLedgerId(e),e){case"mainnet":this._addressBook=MAINNET_ADDRESS_BOOK;break;case"testnet":this._addressBook=TESTNET_ADDRESS_BOOK;break;case"previewnet":this._addressBook=PREVIEWNET_ADDRESS_BOOK}if(null!=this._addressBook)for(const e of this._nodes)for(const t of this._addressBook.nodeAddresses)null!=t.accountId&&t.accountId.toString()===e.accountId.toString()&&e.setNodeAddress(t);return this}get networkName(){return null!=this._ledgerId?this._ledgerId.toString():null}_createNodeFromNetworkEntry(e){const t="string"==typeof e[1]?AccountId.fromString(e[1]):e[1];return new Node({newNode:{address:e[0],accountId:t,channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[];for(let n=this._nodes.length-1;n>=0;n--){const r=this._nodes[n],o=e.get(r.address.toString());null!=o&&o.toString()===r.accountId.toString()||t.push(n)}return t}_checkNetworkContainsEntry(e){for(const t of this._nodes)if(t.address.toString()===e[0])return!0;return!1}get maxNodesPerTransaction(){return this._maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._maxNodesPerTransaction=e,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}isTransportSecurity(){return this._transportSecurity}setTransportSecurity(e){if(this._transportSecurity==e)return this;this._network.clear();for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t];n.close(),n=e?n.toSecure().setCert(null!=this._ledgerId?this._ledgerId.toString():""):n.toInsecure(),this._nodes[t]=n;const r=null!=this._network.get(n.getKey())?this._network.get(n.getKey()):[];r.push(n),this._network.set(n.getKey(),r)}return this._healthyNodes=[...this._nodes],this._transportSecurity=e,this}getNumberOfNodesForTransaction(){return this._maxNodesPerTransaction>0?this._maxNodesPerTransaction:this._nodes.length}getNodeAccountIdsForExecute(){return this._getNumberOfMostHealthyNodes(this.getNumberOfNodesForTransaction()).map(e=>e.accountId)}}class MirrorNode extends ManagedNode{constructor(e={}){super(e)}getKey(){return this._address.toString()}get mirrorRestApiBaseUrl(){const e=this.address.address,t=this.address.port;if(!e||!t)throw new Error("Mirror node has invalid address configuration");if("localhost"===e||"127.0.0.1"===e)return`http://${e}:5551/api/v1`;return`${this._getSchemeFromHostAndPort(e,t)}://${e}:${t}/api/v1`}_getSchemeFromHostAndPort(e,t){return"localhost"===e||"127.0.0.1"===e||80===t?"http":"https"}}let MirrorNetwork$1=class extends ManagedNetwork{constructor(e){super(e)}setNetwork(e){this._setNetwork(new Map(e.map(e=>[e,e])))}get network(){var e=[];for(const t of this._nodes)e.push(t.address.toString());return e}_createNodeFromNetworkEntry(e){return new MirrorNode({newNode:{address:e[1],channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[],n=Object.values(e);for(let e=this._nodes.length-1;e>=0;e--){const r=this._nodes[e];n.includes(r.address.toString())||t.push(e)}return t}getNextMirrorNode(){return this._getNumberOfMostHealthyNodes(1)[0]}get mirrorRestApiBaseUrl(){try{return this.getNextMirrorNode().mirrorRestApiBaseUrl}catch(e){throw new Error("Client has no mirror network configured or no healthy mirror nodes are available")}}};const DEFAULT_GRPC_DEADLINE=1e4,DEFAULT_REQUEST_TIMEOUT=12e4,MAINNET={"node00.swirldslabs.com:443":new AccountId(3),"node01-00-grpc.swirlds.com:443":new AccountId(4),"node03.swirldslabs.com:443":new AccountId(6),"node04.swirldslabs.com:443":new AccountId(7),"node05.swirldslabs.com:443":new AccountId(8),"node06.swirldslabs.com:443":new AccountId(9),"node07.swirldslabs.com:443":new AccountId(10),"node09.swirldslabs.com:443":new AccountId(12),"node10.swirldslabs.com:443":new AccountId(13),"node11.swirldslabs.com:443":new AccountId(14),"node12.swirldslabs.com:443":new AccountId(15),"node14.swirldslabs.com:443":new AccountId(17),"node15.swirldslabs.com:443":new AccountId(18),"node16.swirldslabs.com:443":new AccountId(19),"node17.swirldslabs.com:443":new AccountId(20),"node18.swirldslabs.com:443":new AccountId(21),"node19.swirldslabs.com:443":new AccountId(22),"node20.swirldslabs.com:443":new AccountId(23),"node21.swirldslabs.com:443":new AccountId(24),"node22.swirldslabs.com:443":new AccountId(25),"node24.swirldslabs.com:443":new AccountId(27),"node25.swirldslabs.com:443":new AccountId(28),"node26.swirldslabs.com:443":new AccountId(29),"node27.swirldslabs.com:443":new AccountId(30),"node28.swirldslabs.com:443":new AccountId(31),"node29.swirldslabs.com:443":new AccountId(32),"node30.swirldslabs.com:443":new AccountId(33),"node31.swirldslabs.com:443":new AccountId(34),"node32.swirldslabs.com:443":new AccountId(35),"node33.swirldslabs.com:443":new AccountId(36),"node34.swirldslabs.com:443":new AccountId(37)},WEB_TESTNET={"testnet-node00-00-grpc.hedera.com:443":new AccountId(3),"testnet-node01-00-grpc.hedera.com:443":new AccountId(4),"testnet-node02-00-grpc.hedera.com:443":new AccountId(5),"testnet-node03-00-grpc.hedera.com:443":new AccountId(6),"testnet-node04-00-grpc.hedera.com:443":new AccountId(7),"testnet-node05-00-grpc.hedera.com:443":new AccountId(8),"testnet-node06-00-grpc.hedera.com:443":new AccountId(9)},WEB_PREVIEWNET={"previewnet-node00-00-grpc.hedera.com:443":new AccountId(3),"previewnet-node01-00-grpc.hedera.com:443":new AccountId(4),"previewnet-node02-00-grpc.hedera.com:443":new AccountId(5),"previewnet-node03-00-grpc.hedera.com:443":new AccountId(6),"previewnet-node04-00-grpc.hedera.com:443":new AccountId(7),"previewnet-node05-00-grpc.hedera.com:443":new AccountId(8),"previewnet-node06-00-grpc.hedera.com:443":new AccountId(9)};new AccountId(3),new AccountId(3),new AccountId(3);const LocalNodeWebNetwork={"localhost:8080":new AccountId(3)},ALL_WEB_NETWORK_NODES={...MAINNET,...WEB_TESTNET,...WEB_PREVIEWNET},MirrorNetwork={fromName(e){switch(e){case"mainnet":return MirrorNetwork.MAINNET;case"testnet":return MirrorNetwork.TESTNET;case"previewnet":return MirrorNetwork.PREVIEWNET;case"local-node":return MirrorNetwork.LOCAL_NODE;default:throw new Error(`unknown network name: ${e}`)}},MAINNET:["mainnet-public.mirrornode.hedera.com:443"],TESTNET:["testnet.mirrornode.hedera.com:443"],PREVIEWNET:["previewnet.mirrornode.hedera.com:443"],LOCAL_NODE:["127.0.0.1:5600"]},WebMirrorNetwork={...MirrorNetwork,LOCAL_NODE:["127.0.0.1:5551"]},WebNetwork={MAINNET:MAINNET,TESTNET:WEB_TESTNET,PREVIEWNET:WEB_PREVIEWNET,LOCAL_NODE:LocalNodeWebNetwork},DEFAULT_PAGE_SIZE=25;class AddressBookQueryWeb extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},this._addresses=[]}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get limit(){return this._limit}setLimit(e){return this._limit=e,this}setMaxAttempts(e){return this._maxAttempts=e,this}setMaxBackoff(e){return this._maxBackoff=e,this}execute(e,t){return new Promise((n,r)=>{this._makeFetchRequest(e,n,r,t)})}async _makeFetchRequest(e,t,n,r){const{port:o,address:i}=e._mirrorNetwork.getNextMirrorNode().address;let a=`${i.includes("127.0.0.1")||i.includes("localhost")?"http":"https"}://${i}`;o&&(a=`${a}:${o}`),this._addresses=[];let s=null,c=!1;const u=new URL(`${a}/api/v1/network/nodes`);null!=this._fileId&&u.searchParams.append("file.id",this._fileId.toString());const l=null!=this._limit?this._limit:DEFAULT_PAGE_SIZE;for(u.searchParams.append("limit",l.toString());!c;){const t=s?new URL(s,a):u;for(let o=0;o<=this._maxAttempts;o++)try{const n=await fetch(t.toString(),{method:"GET",headers:{Accept:"application/json"},signal:r?AbortSignal.timeout(r):void 0});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const o=await n.json(),i=(o.nodes||[]).map(t=>NodeAddress.fromJSON({nodeId:t.node_id.toString(),accountId:t.node_account_id,addresses:this._handleAddressesFromGrpcProxyEndpoint(t,e),certHash:t.node_cert_hash,publicKey:t.public_key,description:t.description,stake:t.stake?.toString()}));this._addresses.push(...i),s=o.links?.next||null,s||(c=!0);break}catch(t){console.error("Error in _makeFetchRequest:",t);const r=t instanceof Error?t.message:String(t);if(o<this._maxAttempts&&!e.isClientShutDown&&this._retryHandler(t)){const e=Math.min(250*2**o,this._maxBackoff);this._logger&&this._logger.debug(`Error getting nodes from mirror for file ${null!=this._fileId?this._fileId.toString():"UNKNOWN"} during attempt ${o+1}. Waiting ${e} ms before next attempt: ${r}`),await new Promise(t=>setTimeout(t,e));continue}const i=o>=this._maxAttempts?`Failed to query address book after ${this._maxAttempts+1} attempts. Last error: ${r}`:`Failed to query address book: ${r}`;return void n(new Error(i))}}t(new NodeAddressBook({nodeAddresses:this._addresses}))}_handleAddressesFromGrpcProxyEndpoint(e,t){const n=e.grpc_proxy_endpoint;if(n&&n.domain_name&&n.port)return[{address:n.domain_name,port:n.port.toString()}];let r;const o=t._network.ledgerId;if(o&&o.isMainnet())r=MAINNET;else if(o&&o.isTestnet())r=WEB_TESTNET;else{if(!o||!o.isPreviewnet())return[];r=WEB_PREVIEWNET}const i=e.node_account_id;for(const[e,t]of Object.entries(r))if(t.toString()===i){const[t,n]=e.split(":");return[{address:t,port:n}]}return[]}}class Client{constructor(e){this._mirrorNetwork=new MirrorNetwork$1(this._createMirrorNetworkChannel()),this._network=new Network(this._createNetworkChannel()),this._operator=null,this._defaultMaxTransactionFee=null,this._defaultMaxQueryPayment=new Hbar(1),null!=e&&null!=e.operator&&this.setOperator(e.operator.accountId,e.operator.privateKey),this._maxAttempts=null,this._signOnDemand=!1,this._autoValidateChecksums=!1,this._minBackoff=250,this._maxBackoff=8e3,this._defaultRegenerateTransactionId=!0,this._requestTimeout=DEFAULT_REQUEST_TIMEOUT,this._grpcDeadline=DEFAULT_GRPC_DEADLINE,this._isUpdatingNetwork=!1,this._networkUpdatePeriod=864e5,this._isShutdown=!1,this._shard=0,this._realm=0,null!=e&&!1!==e.scheduleNetworkUpdate&&this._scheduleNetworkUpdate(),null!=e&&null!=e.shard&&(this._shard=e.shard),null!=e&&null!=e.realm&&(this._realm=e.realm),null!=e&&null!=e.grpcDeadline&&this.setGrpcDeadline(e.grpcDeadline),null!=e&&null!=e.requestTimeout&&this.setRequestTimeout(e.requestTimeout),this._requestTimeout<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${this._requestTimeout}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._timer,this._logger=null}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._network.setLedgerId("string"==typeof e?LedgerId.fromString(e):e),this}get ledgerId(){return null!=this._network._ledgerId?this._network.ledgerId:null}setNetwork(e){throw new Error("not implemented")}setNetworkFromAddressBook(e){return this._network.setNetworkFromAddressBook(e),this}get network(){return this._network.network}get shard(){return this._shard}get realm(){return this._realm}setMirrorNetwork(e){throw new Error("not implemented")}get mirrorNetwork(){return this._mirrorNetwork.network}get mirrorRestApiBaseUrl(){return this._mirrorNetwork.mirrorRestApiBaseUrl}get signOnDemand(){return this._signOnDemand}setSignOnDemand(e){this._signOnDemand=e}isTransportSecurity(){return this._network.isTransportSecurity()}setTransportSecurity(e){return this._network.setTransportSecurity(e),this}setOperator(e,t){const n="string"==typeof t?PrivateKey.fromStringDer(t):t;return this.setOperatorWith(e,n.publicKey,e=>Promise.resolve(n.sign(e)))}getOperator(){return this._operator}setOperatorWith(e,t,n){const r=e instanceof AccountId?e:AccountId.fromString(e);return null!=this._network._ledgerId&&r.validateChecksum(this),this._operator={transactionSigner:n,accountId:r,publicKey:t instanceof PublicKey?t:PublicKey.fromString(t)},this}setAutoValidateChecksums(e){return this._autoValidateChecksums=e,this}isAutoValidateChecksumsEnabled(){return this._autoValidateChecksums}get operatorAccountId(){return null!=this._operator?this._operator.accountId:null}get operatorPublicKey(){return null!=this._operator?this._operator.publicKey:null}get defaultMaxTransactionFee(){return this._defaultMaxTransactionFee}get maxTransactionFee(){return this.defaultMaxTransactionFee}setDefaultMaxTransactionFee(e){if(e.toTinybars().toInt()<0)throw new Error("defaultMaxTransactionFee must be non-negative");return this._defaultMaxTransactionFee=e,this}setMaxTransactionFee(e){return this.setDefaultMaxTransactionFee(e)}get defaultRegenerateTransactionId(){return this._defaultRegenerateTransactionId}setDefaultRegenerateTransactionId(e){return this._defaultRegenerateTransactionId=e,this}get defaultMaxQueryPayment(){return this._defaultMaxQueryPayment}get maxQueryPayment(){return this.defaultMaxQueryPayment}setDefaultMaxQueryPayment(e){if(convertToNumber(e.toTinybars())<0)throw new Error("defaultMaxQueryPayment must be non-negative");return this._defaultMaxQueryPayment=e,this}setMaxQueryPayment(e){return this.setDefaultMaxQueryPayment(e)}get maxAttempts(){return null!=this._maxAttempts?this._maxAttempts:10}setMaxAttempts(e){return this._maxAttempts=e,this}get maxNodeAttempts(){return this._network.maxNodeAttempts}setMaxNodeAttempts(e){return this._network.setMaxNodeAttempts(e),this}get nodeWaitTime(){return this._network.minBackoff}setNodeWaitTime(e){return this._network.setMinBackoff(e),this}get maxNodesPerTransaction(){return this._network.maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._network.setMaxNodesPerTransaction(e),this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}setNodeMinBackoff(e){return this._network.setMinBackoff(e),this}get nodeMinBackoff(){return this._network.minBackoff}setNodeMaxBackoff(e){return this._network.setMaxBackoff(e),this}get nodeMaxBackoff(){return this._network.maxBackoff}setNodeMinReadmitPeriod(e){return this._network.setNodeMinReadmitPeriod(e),this}get nodeMinReadmitPeriod(){return this._network.nodeMinReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._network.setNodeMaxReadmitPeriod(e),this}get nodeMaxReadmitPeriod(){return this._network.nodeMaxReadmitPeriod}setRequestTimeout(e){if(e<=0)throw new Error("requestTimeout must be a positive number");return e<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${e}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._requestTimeout=e,this}get requestTimeout(){return this._requestTimeout}setGrpcDeadline(e){if(e<=0)throw new Error("grpcDeadline must be a positive number");return e>=this._requestTimeout&&console.warn(`DEPRECATION WARNING: grpcDeadline (${e}ms) should be smaller than requestTimeout (${this._requestTimeout}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._grpcDeadline=e,this}get grpcDeadline(){return this._grpcDeadline}get networkUpdatePeriod(){return this._networkUpdatePeriod}setNetworkUpdatePeriod(e){return clearTimeout(this._timer),this._networkUpdatePeriod=e,this._scheduleNetworkUpdate(),this}setLogger(e){return this._logger=e,this}get logger(){return this._logger}async ping(e){await new AccountBalanceQuery({accountId:e}).setNodeAccountIds([e instanceof AccountId?e:AccountId.fromString(e)]).execute(this)}async pingAll(){for(const e of Object.values(this._network.network))await this.ping(e)}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this._shard,this._realm)).execute(this);this.setNetworkFromAddressBook(e)}catch(e){this._logger&&this._logger.trace(`failed to update client address book: ${e.toString()}`)}finally{this._isUpdatingNetwork=!1}return this}close(){this._network.close(),this._mirrorNetwork.close(),this._isShutdown=!0,clearTimeout(this._timer)}_createNetworkChannel(){return()=>{throw new Error("not implemented")}}_createMirrorNetworkChannel(){return()=>{throw new Error("not implemented")}}_scheduleNetworkUpdate(){this._timer=setTimeout(async()=>{await this.updateNetwork(),this._isShutdown||this._scheduleNetworkUpdate()},this._networkUpdatePeriod)}get isClientShutDown(){return this._isShutdown}static _validateNetworkConsistency(e){if(0===Object.keys(e).length)return;const[,t]=Object.entries(e)[0],n=t.toString(),[r,o]=n.split(".").map(Number),i=Object.values(e).every(e=>{const t=e.toString(),[n,i]=t.split(".").map(Number);return n===r&&i===o});if(!i)throw new Error("Network is not valid, all nodes must be in the same shard and realm")}static _extractShardRealm(e){const t=Object.entries(e);if(0===t.length)return{shard:0,realm:0};const[,n]=t[0],r=n.toString(),[o,i]=r.split(".").map(Number);return{shard:o,realm:i}}}const SDK_NAME="hiero-sdk-js",SDK_VERSION="2.79.0-beta.11",{proto:proto}=HieroProto;class Channel{constructor(e=DEFAULT_GRPC_DEADLINE){this._crypto=null,this._smartContract=null,this._file=null,this._consensus=null,this._freeze=null,this._network=null,this._token=null,this._schedule=null,this._util=null,this._addressBook=null,this._grpcDeadline=e}setGrpcDeadline(e){this._grpcDeadline=e}get grpcDeadline(){return this._grpcDeadline}close(){throw new Error("not implemented")}get crypto(){return null!=this._crypto||(this._crypto=proto.CryptoService.create(this._createUnaryClient("CryptoService"))),this._crypto}get smartContract(){return null!=this._smartContract||(this._smartContract=proto.SmartContractService.create(this._createUnaryClient("SmartContractService"))),this._smartContract}get file(){return null!=this._file||(this._file=proto.FileService.create(this._createUnaryClient("FileService"))),this._file}get consensus(){return null!=this._consensus||(this._consensus=proto.ConsensusService.create(this._createUnaryClient("ConsensusService"))),this._consensus}get freeze(){return null!=this._freeze||(this._freeze=proto.FreezeService.create(this._createUnaryClient("FreezeService"))),this._freeze}get network(){return null!=this._network||(this._network=proto.NetworkService.create(this._createUnaryClient("NetworkService"))),this._network}get token(){return null!=this._token||(this._token=proto.TokenService.create(this._createUnaryClient("TokenService"))),this._token}get schedule(){return null!=this._schedule||(this._schedule=proto.ScheduleService.create(this._createUnaryClient("ScheduleService"))),this._schedule}get util(){return null!=this._util||(this._util=proto.UtilService.create(this._createUnaryClient("UtilService"))),this._util}get addressBook(){return null!=this._addressBook||(this._addressBook=proto.AddressBookService.create(this._createUnaryClient("AddressBookService"))),this._addressBook}_createUnaryClient(e){throw new Error("not implemented")}}function encodeRequest(e){const t=new ArrayBuffer(e.byteLength+5);return new DataView(t,1,4).setUint32(0,e.length),new Uint8Array(t,5).set(e),t}function decodeUnaryResponse(e,t=0,n=e.byteLength){const r=new DataView(e,t,n);let o=0,i=null,a=0;for(;o<r.byteLength;){const t=r.getUint8(o+0)>>7,n=r.getUint32(o+1),s=o+5;if(s+n>r.byteLength)throw new Error("(BUG) unexpected frame length past the boundary");const c=new Uint8Array(e,r.byteOffset+s,n);if(0===t){if(null!=i)throw new Error("(BUG) unexpectedly received more than one data frame");i=c}else{if(1!==t)throw new Error(`(BUG) unexpected frame type: ${t}`);{const e=decode$1(c),[t,n]=e.split(":");if("grpc-status"!==t)throw new Error(`(BUG) unhandled trailer, ${e}`);a=parseInt(n)}}o+=n+5}if(0!==a)throw new Error(`(BUG) unhandled grpc-status: ${a}`);if(null==i)throw new Error("(BUG) unexpectedly received no response");return i}class WebChannel extends Channel{constructor(e,t){super(t),this._address=e,this._isReady=!1,this._healthCheckPromise=null}_shouldUseHttps(e){return!(e.includes("localhost")||e.includes("127.0.0.1")||e.includes(".cluster.local"))}_buildUrl(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;return this._shouldUseHttps(e)?`https://${e}`:`http://${e}`}async _waitForReady(e){if(!this._isReady){if(this._healthCheckPromise)return this._healthCheckPromise;this._healthCheckPromise=this._performHealthCheck(e);try{await this._healthCheckPromise}finally{this._healthCheckPromise=null}}}async _performHealthCheck(e){const t=this._buildUrl(this._address),n=e.getTime()-Date.now();if(n<=0)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());const r=new AbortController,o=setTimeout(()=>r.abort(),n);try{const e=await fetch(t,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:new Uint8Array(0),signal:r.signal});if(clearTimeout(o),e.ok||e.status>=300&&e.status<400){const t=e.headers.get("grpc-status"),n=e.headers.get("grpc-message");if(null!=t||null!=n)return void(this._isReady=!0)}throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}catch(e){if(clearTimeout(o),e instanceof Error&&"AbortError"===e.name)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());if(e instanceof GrpcServiceError)throw e;throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}}close(){}_createUnaryClient(e){return async(t,n,r)=>{const o=new Date,i=this._grpcDeadline;o.setMilliseconds(o.getMilliseconds()+i);try{await this._waitForReady(o);const i=this._buildUrl(this._address),a=await fetch(`${i}/proto.${e}/${t.name}`,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:encodeRequest(n)});if(!a.ok){return void r(new HttpError(HttpStatus._fromValue(a.status)),null)}const s=a.headers.get("grpc-status"),c=a.headers.get("grpc-message");if(null!=s&&null!=c){const e=new GrpcServiceError(GrpcStatus._fromValue(parseInt(s)),ALL_WEB_NETWORK_NODES?.[this._address]?.toString());return e.message=c,void r(e,null)}const u=await a.arrayBuffer();r(null,decodeUnaryResponse(u))}catch(e){if(e instanceof GrpcServiceError)return void r(e,null);r(new GrpcServiceError(GrpcStatus._fromValue(18),ALL_WEB_NETWORK_NODES?.[this._address]?.toString()),null)}}}}class WebClient extends Client{constructor(e){if(super(e),null!=e){if("string"==typeof e.network)this._setNetworkFromName(e.network);else if(null!=e.network){Client._validateNetworkConsistency(e.network);const{shard:t,realm:n}=Client._extractShardRealm(e.network);this._shard=t,this._realm=n,this.setNetwork(e.network)}if("string"==typeof e.mirrorNetwork)switch(e.mirrorNetwork){case"mainnet":this.setMirrorNetwork(WebMirrorNetwork.MAINNET);break;case"testnet":this.setMirrorNetwork(WebMirrorNetwork.TESTNET);break;case"previewnet":this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET);break;default:this.setMirrorNetwork([e.mirrorNetwork])}else null!=e.mirrorNetwork&&this.setMirrorNetwork(e.mirrorNetwork)}}static fromConfig(e){return new WebClient("string"==typeof e?JSON.parse(e):e)}static forNetwork(e){return new WebClient({network:e})}static forName(e){return new WebClient({network:e})}static forMainnet(){return new WebClient({network:"mainnet"})}static forTestnet(){return new WebClient({network:"testnet"})}static forPreviewnet(){return new WebClient({network:"previewnet"})}static forLocalNode(e={scheduleNetworkUpdate:!1}){return new WebClient({network:"local-node",...e})}static async forMainnetAsync(){return new WebClient({network:"mainnet"}).updateNetwork()}static async forTestnetAsync(){return new WebClient({network:"testnet"}).updateNetwork()}static async forPreviewnetAsync(){return new WebClient({network:"previewnet"}).updateNetwork()}static async forNameAsync(e){const t=new WebClient({network:e});return"local-node"!==e&&await t.updateNetwork(),t}static async forMirrorNetwork(e){const t=new WebClient({mirrorNetwork:e});return await t.updateNetwork(),t}setNetwork(e){if("string"==typeof e)switch(e){case"previewnet":this._network.setNetwork(WebNetwork.PREVIEWNET);break;case"testnet":this._network.setNetwork(WebNetwork.TESTNET);break;case"mainnet":this._network.setNetwork(WebNetwork.MAINNET);break;case"local-node":this._network.setNetwork(WebNetwork.LOCAL_NODE)}else{for(const[t]of Object.entries(e))(t.startsWith("https://")||t.startsWith("http://"))&&console.warn('[Deprecation Notice] Hiero SDK: Network endpoint "'+t+'" includes a URL scheme (e.g. "https://"). This format was accepted in earlier versions but is now deprecated. Please remove the scheme and use "host:port" instead (e.g. "node00.swirldslabs.com:443"). Support for scheme-prefixed endpoints will be removed in a future major release.');this._network.setNetwork(e)}}setMirrorNetwork(e){if("string"==typeof e)switch(e){case"local-node":this._mirrorNetwork.setNetwork(WebMirrorNetwork.LOCAL_NODE);break;case"previewnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.PREVIEWNET);break;case"testnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.TESTNET);break;case"mainnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.MAINNET);break;default:this._mirrorNetwork.setNetwork([e])}else this._mirrorNetwork.setNetwork(e);return this}_setNetworkFromName(e){switch(e){case"mainnet":this.setNetwork(WebNetwork.MAINNET),this.setMirrorNetwork(WebMirrorNetwork.MAINNET),this.setLedgerId(LedgerId.MAINNET);break;case"testnet":this.setNetwork(WebNetwork.TESTNET),this.setMirrorNetwork(WebMirrorNetwork.TESTNET),this.setLedgerId(LedgerId.TESTNET);break;case"previewnet":this.setNetwork(WebNetwork.PREVIEWNET),this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET),this.setLedgerId(LedgerId.PREVIEWNET);break;case"local-node":this.setNetwork(WebNetwork.LOCAL_NODE),this.setMirrorNetwork(WebMirrorNetwork.LOCAL_NODE),this.setLedgerId(LedgerId.LOCAL_NODE);break;default:throw new Error(`unknown network: ${e}`)}return this}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this.shard,this.realm)).execute(this),t={};for(const n of e.nodeAddresses)for(const e of n.addresses)null!=n.accountId&&(t[e.toString()]=n.accountId);this.setNetwork(t)}catch(e){if(this._logger){const t=e instanceof Error?e.message:String(e);this._logger.trace(`failed to update client address book: ${t}`)}}finally{this._isUpdatingNetwork=!1}return this}_createNetworkChannel(){return e=>new WebChannel(e,this.grpcDeadline)}_createMirrorNetworkChannel(){return()=>{throw new Error("mirror support is not supported in browsers")}}}const NetworkName={Mainnet:"mainnet",Testnet:"testnet",Previewnet:"previewnet"};class LocalProviderWeb{constructor(e={}){null==e||null==e.client?this._client=WebClient.forName(e.networkName||"local-node"):this._client=e.client}static fromClient(e){return new LocalProviderWeb({client:e})}getLedgerId(){return this._client.ledgerId}getNetwork(){return this._client.network}getMirrorNetwork(){return this._client.mirrorNetwork}getAccountBalance(e){return(new AccountBalanceQuery).setAccountId(e).execute(this._client)}getAccountInfo(e){return(new AccountInfoQuery).setAccountId(e).execute(this._client)}getAccountRecords(e){return(new AccountRecordsQuery).setAccountId(e).execute(this._client)}getTransactionReceipt(e){return(new TransactionReceiptQuery).setTransactionId(e).execute(this._client)}async sendTransaction(e){return await e.execute(this._client)}async sendQuery(e){return await e.execute(this._client)}async waitForReceipt(e){return await e.getReceipt(this._client)}async call(e){return await e.execute(this._client)}close(){this._client.close()}}exports.AccountAllowanceAdjustTransaction=AccountAllowanceAdjustTransaction,exports.AccountAllowanceApproveTransaction=AccountAllowanceApproveTransaction,exports.AccountAllowanceDeleteTransaction=AccountAllowanceDeleteTransaction,exports.AccountBalance=AccountBalance,exports.AccountBalanceQuery=AccountBalanceQuery,exports.AccountCreateTransaction=AccountCreateTransaction,exports.AccountDeleteTransaction=AccountDeleteTransaction,exports.AccountId=AccountId,exports.AccountInfo=AccountInfo,exports.AccountInfoFlow=AccountInfoFlow,exports.AccountInfoQuery=AccountInfoQuery,exports.AccountRecordsQuery=AccountRecordsQuery,exports.AccountUpdateTransaction=AccountUpdateTransaction,exports.AddressBookQuery=AddressBookQueryWeb,exports.AssessedCustomFee=AssessedCustomFee,exports.BadKeyError=BadKeyError,exports.BadMnemonicError=BadMnemonicError,exports.BadMnemonicReason=BadMnemonicReason,exports.BatchTransaction=BatchTransaction,exports.Cache=CACHE,exports.Client=WebClient,exports.ContractByteCodeQuery=ContractByteCodeQuery,exports.ContractCallQuery=ContractCallQuery,exports.ContractCreateFlow=ContractCreateFlow,exports.ContractCreateTransaction=ContractCreateTransaction,exports.ContractDeleteTransaction=ContractDeleteTransaction,exports.ContractExecuteTransaction=ContractExecuteTransaction,exports.ContractFunctionParameters=ContractFunctionParameters,exports.ContractFunctionResult=ContractFunctionResult,exports.ContractFunctionSelector=ContractFunctionSelector,exports.ContractId=ContractId,exports.ContractInfo=ContractInfo,exports.ContractInfoQuery=ContractInfoQuery,exports.ContractLogInfo=ContractLogInfo,exports.ContractNonceInfo=ContractNonceInfo,exports.ContractUpdateTransaction=ContractUpdateTransaction,exports.CustomFee=CustomFee,exports.CustomFeeLimit=CustomFeeLimit,exports.CustomFixedFee=CustomFixedFee,exports.CustomFractionalFee=CustomFractionalFee,exports.CustomRoyaltyFee=CustomRoyalyFee,exports.DelegateContractId=DelegateContractId,exports.EntityIdHelper=EntityIdHelper,exports.EthereumFlow=EthereumFlow,exports.EthereumTransaction=EthereumTransaction,exports.EthereumTransactionData=EthereumTransactionData,exports.EthereumTransactionDataEip1559=EthereumTransactionDataEip1559,exports.EthereumTransactionDataEip2930=EthereumTransactionDataEip2930,exports.EthereumTransactionDataLegacy=EthereumTransactionDataLegacy,exports.EvmAddress=EvmAddress,exports.ExchangeRate=ExchangeRate,exports.ExchangeRates=ExchangeRates,exports.Executable=Executable,exports.FeeAssessmentMethod=FeeAssessmentMethod,exports.FeeComponents=FeeComponents,exports.FeeData=FeeData,exports.FeeDataType=FeeDataType,exports.FeeSchedule=FeeSchedule,exports.FeeSchedules=FeeSchedules,exports.FileAppendTransaction=FileAppendTransaction,exports.FileContentsQuery=FileContentsQuery,exports.FileCreateTransaction=FileCreateTransaction,exports.FileDeleteTransaction=FileDeleteTransaction,exports.FileId=FileId,exports.FileInfo=FileInfo,exports.FileInfoQuery=FileInfoQuery,exports.FileUpdateTransaction=FileUpdateTransaction,exports.FreezeTransaction=FreezeTransaction,exports.FreezeType=FreezeType,exports.HEDERA_PATH=HEDERA_PATH,exports.Hbar=Hbar,exports.HbarAllowance=HbarAllowance,exports.HbarUnit=HbarUnit,exports.Key=Key,exports.KeyList=KeyList,exports.LedgerId=LedgerId,exports.LiveHash=LiveHash,exports.LiveHashAddTransaction=LiveHashAddTransaction,exports.LiveHashDeleteTransaction=LiveHashDeleteTransaction,exports.LiveHashQuery=LiveHashQuery,exports.LocalProvider=LocalProviderWeb,exports.LogLevel=LogLevel,exports.Logger=Logger,exports.Long=Long,exports.MaxAttemptsOrTimeoutError=MaxAttemptsOrTimeoutError,exports.MaxQueryPaymentExceeded=MaxQueryPaymentExceeded,exports.MirrorNodeContractCallQuery=MirrorNodeContractCallQuery,exports.MirrorNodeContractEstimateQuery=MirrorNodeContractEstimateQuery,exports.Mnemonic=Mnemonic,exports.NetworkName=NetworkName,exports.NetworkVersionInfo=NetworkVersionInfo,exports.NetworkVersionInfoQuery=NetworkVersionInfoQuery,exports.NftId=NftId,exports.NodeAddressBook=NodeAddressBook,exports.NodeCreateTransaction=NodeCreateTransaction,exports.NodeDeleteTransaction=NodeDeleteTransaction,exports.NodeUpdateTransaction=NodeUpdateTransaction,exports.PendingAirdropId=PendingAirdropId,exports.PrecheckStatusError=PrecheckStatusError,exports.PrivateKey=PrivateKey,exports.PrngTransaction=PrngTransaction,exports.Provider=Provider,exports.ProxyStaker=ProxyStaker,exports.PublicKey=PublicKey,exports.Query=Query,exports.ReceiptStatusError=ReceiptStatusError,exports.RequestType=RequestType,exports.SLIP44_ECDSA_ETH_PATH=SLIP44_ECDSA_ETH_PATH,exports.SLIP44_ECDSA_HEDERA_PATH=SLIP44_ECDSA_HEDERA_PATH,exports.ScheduleCreateTransaction=ScheduleCreateTransaction,exports.ScheduleDeleteTransaction=ScheduleDeleteTransaction,exports.ScheduleId=ScheduleId,exports.ScheduleInfo=ScheduleInfo,exports.ScheduleInfoQuery=ScheduleInfoQuery,exports.ScheduleSignTransaction=ScheduleSignTransaction,exports.SemanticVersion=SemanticVersion,exports.ServiceEndpoint=ServiceEndpoint,exports.SignatureMap=SignatureMap$1,exports.Signer=Signer,exports.SignerSignature=SignerSignature,exports.Status=Status,exports.StatusError=StatusError,exports.SubscriptionHandle=SubscriptionHandle,exports.SystemDeleteTransaction=SystemDeleteTransaction,exports.SystemUndeleteTransaction=SystemUndeleteTransaction,exports.Timestamp=Timestamp,exports.TokenAirdropTransaction=TokenAirdropTransaction,exports.TokenAllowance=TokenAllowance,exports.TokenAssociateTransaction=TokenAssociateTransaction,exports.TokenBurnTransaction=TokenBurnTransaction,exports.TokenCancelAirdropTransaction=TokenCancelAirdropTransaction,exports.TokenClaimAirdropTransaction=TokenClaimAirdropTransaction,exports.TokenCreateTransaction=TokenCreateTransaction,exports.TokenDeleteTransaction=TokenDeleteTransaction,exports.TokenDissociateTransaction=TokenDissociateTransaction,exports.TokenFeeScheduleUpdateTransaction=TokenFeeScheduleUpdateTransaction,exports.TokenFreezeTransaction=TokenFreezeTransaction,exports.TokenGrantKycTransaction=TokenGrantKycTransaction,exports.TokenId=TokenId,exports.TokenInfo=TokenInfo,exports.TokenInfoQuery=TokenInfoQuery,exports.TokenKeyValidation=TokenKeyValidation,exports.TokenMintTransaction=TokenMintTransaction,exports.TokenNftAllowance=TokenNftAllowance,exports.TokenNftInfo=TokenNftInfo,exports.TokenNftInfoQuery=TokenNftInfoQuery,exports.TokenPauseTransaction=TokenPauseTransaction,exports.TokenRejectFlow=TokenRejectFlow,exports.TokenRejectTransaction=TokenRejectTransaction,exports.TokenRevokeKycTransaction=TokenRevokeKycTransaction,exports.TokenSupplyType=TokenSupplyType,exports.TokenType=TokenType,exports.TokenUnfreezeTransaction=TokenUnfreezeTransaction,exports.TokenUnpauseTransaction=TokenUnpauseTransaction,exports.TokenUpdateNftsTransaction=TokenUpdateNftsTransaction,exports.TokenUpdateTransaction=TokenUpdateTransaction,exports.TokenWipeTransaction=TokenWipeTransaction,exports.TopicCreateTransaction=TopicCreateTransaction,exports.TopicDeleteTransaction=TopicDeleteTransaction,exports.TopicId=TopicId,exports.TopicInfo=TopicInfo,exports.TopicInfoQuery=TopicInfoQuery,exports.TopicMessage=TopicMessage,exports.TopicMessageChunk=TopicMessageChunk,exports.TopicMessageQuery=TopicMessageQuery,exports.TopicMessageSubmitTransaction=TopicMessageSubmitTransaction,exports.TopicUpdateTransaction=TopicUpdateTransaction,exports.Transaction=Transaction,exports.TransactionFeeSchedule=TransactionFeeSchedule,exports.TransactionId=TransactionId,exports.TransactionReceipt=TransactionReceipt,exports.TransactionReceiptQuery=TransactionReceiptQuery,exports.TransactionRecord=TransactionRecord,exports.TransactionRecordQuery=TransactionRecordQuery,exports.TransactionResponse=TransactionResponse,exports.Transfer=Transfer,exports.TransferTransaction=TransferTransaction,exports.Wallet=Wallet,exports.WebClient=WebClient});
|