@hiero-ledger/sdk 2.78.0 → 2.79.0-beta.12
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 +3 -3
- package/dist/umd.min.js +2 -2
- package/lib/version.js +1 -1
- package/package.json +1 -1
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.
|
|
@@ -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: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.78.0",{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});
|
|
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.12",{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});
|