3Y8epZcPEtHXndpE71G4W24i3TaXA8xiDRw9JRSLU5LY
fs_store in contract sleetcreate.testnetffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),d("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),d("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=requireSecp256k1()}catch{h=void 0}d("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(curves$2);var hash$2=hash$3,utils$q=utils$F,assert$8=minimalisticAssert;function HmacDRBG$1(e){if(!(this instanceof HmacDRBG$1))return new HmacDRBG$1(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var n=utils$q.toArray(e.entropy,e.entropyEnc||"hex"),o=utils$q.toArray(e.nonce,e.nonceEnc||"hex"),a=utils$q.toArray(e.pers,e.persEnc||"hex");assert$8(n.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(n,o,a)}var hmacDrbg=HmacDRBG$1;HmacDRBG$1.prototype._init=function(n,o,a){var c=n.concat(o).concat(a);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var l=0;l<this.V.length;l++)this.K[l]=0,this.V[l]=1;this._update(c),this._reseed=1,this.reseedInterval=281474976710656};HmacDRBG$1.prototype._hmac=function(){return new hash$2.hmac(this.hash,this.K)};HmacDRBG$1.prototype._update=function(n){var o=this._hmac().update(this.V).update([0]);n&&(o=o.update(n)),this.K=o.digest(),this.V=this._hmac().update(this.V).digest(),n&&(this.K=this._hmac().update(this.V).update([1]).update(n).digest(),this.V=this._hmac().update(this.V).digest())};HmacDRBG$1.prototype.reseed=function(n,o,a,c){typeof o!="string"&&(c=a,a=o,o=null),n=utils$q.toArray(n,o),a=utils$q.toArray(a,c),assert$8(n.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(n.concat(a||[])),this._reseed=1};HmacDRBG$1.prototype.generate=function(n,o,a,c){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof o!="string"&&(c=a,a=o,o=null),a&&(a=utils$q.toArray(a,c||"hex"),this._update(a));for(var l=[];l.length<n;)this.V=this._hmac().update(this.V).digest(),l=l.concat(this.V);var u=l.slice(0,n);return this._update(a),this._reseed++,utils$q.encode(u,o)};var BN$5=bnExports$1,utils$p=utils$G,assert$7=utils$p.assert;function KeyPair$6(e,n){this.ec=e,this.priv=null,this.pub=null,n.priv&&this._importPrivate(n.priv,n.privEnc),n.pub&&this._importPublic(n.pub,n.pubEnc)}var key$5=KeyPair$6;KeyPair$6.fromPublic=function(n,o,a){return o instanceof KeyPair$6?o:new KeyPair$6(n,{pub:o,pubEnc:a})};KeyPair$6.fromPrivate=function(n,o,a){return o instanceof KeyPair$6?o:new KeyPair$6(n,{priv:o,privEnc:a})};KeyPair$6.prototype.validate=function(){var n=this.getPublic();return n.isInfinity()?{result:!1,reason:"Invalid public key"}:n.validate()?n.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$6.prototype.getPublic=function(n,o){return typeof n=="string"&&(o=n,n=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),o?this.pub.encode(o,n):this.pub};KeyPair$6.prototype.getPrivate=function(n){return n==="hex"?this.priv.toString(16,2):this.priv};KeyPair$6.prototype._importPrivate=function(n,o){this.priv=new BN$5(n,o||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$6.prototype._importPublic=function(n,o){if(n.x||n.y){this.ec.curve.type==="mont"?assert$7(n.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$7(n.x&&n.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(n.x,n.y);return}this.pub=this.ec.curve.decodePoint(n,o)};KeyPair$6.prototype.derive=function(n){return n.validate()||assert$7(n.validate(),"public point not validated"),n.mul(this.priv).getX()};KeyPair$6.prototype.sign=function(n,o,a){return this.ec.sign(n,this,o,a)};KeyPair$6.prototype.verify=function(n,o,a){return this.ec.verify(n,o,this,void 0,a)};KeyPair$6.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$4=bnExports$1,utils$o=utils$G,assert$6=utils$o.assert;function Signature$6(e,n){if(e instanceof Signature$6)return e;this._importDER(e,n)||(assert$6(e.r&&e.s,"Signature without r or s"),this.r=new BN$4(e.r,16),this.s=new BN$4(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$4=Signature$6;function Position(){this.place=0}function getLength(e,n){var o=e[n.place++];if(!(o&128))return o;var a=o&15;if(a===0||a>4||e[n.place]===0)return!1;for(var c=0,l=0,u=n.place;l<a;l++,u++)c<<=8,c|=e[u],c>>>=0;return c<=127?!1:(n.place=u,c)}function rmPadding(e){for(var n=0,o=e.length-1;!e[n]&&!(e[n+1]&128)&&n<o;)n++;return n===0?e:e.slice(n)}Signature$6.prototype._importDER=function(n,o){n=utils$o.toArray(n,o);var a=new Position;if(n[a.place++]!==48)return!1;var c=getLength(n,a);if(c===!1||c+a.place!==n.length||n[a.place++]!==2)return!1;var l=getLength(n,a);if(l===!1||n[a.place]&128)return!1;var u=n.slice(a.place,l+a.place);if(a.place+=l,n[a.place++]!==2)return!1;var d=getLength(n,a);if(d===!1||n.length!==d+a.place||n[a.place]&128)return!1;var h=n.slice(a.place,d+a.place);if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new BN$4(u),this.s=new BN$4(h),this.recoveryParam=null,!0};function constructLength(e,n){if(n<128){e.push(n);return}var o=1+(Math.log(n)/Math.LN2>>>3);for(e.push(o|128);--o;)e.push(n>>>(o<<3)&255);e.push(n)}Signature$6.prototype.toDER=function(n){var o=this.r.toArray(),a=this.s.toArray();for(o[0]&128&&(o=[0].concat(o)),a[0]&128&&(a=[0].concat(a)),o=rmPadding(o),a=rmPadding(a);!a[0]&&!(a[1]&128);)a=a.slice(1);var c=[2];constructLength(c,o.length),c=c.concat(o),c.push(2),constructLength(c,a.length);var l=c.concat(a),u=[48];return constructLength(u,l.length),u=u.concat(l),utils$o.encode(u,n)};var BN$3=bnExports$1,HmacDRBG=hmacDrbg,utils$n=utils$G,curves$1=curves$2,rand=brorandExports,assert$5=utils$n.assert,KeyPair$5=key$5,Signature$5=signature$4;function EC$2(e){if(!(this instanceof EC$2))return new EC$2(e);typeof e=="string"&&(assert$5(Object.prototype.hasOwnProperty.call(curves$1,e),"Unknown curve "+e),e=curves$1[e]),e instanceof curves$1.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var ec$2=EC$2;EC$2.prototype.keyPair=function(n){return new KeyPair$5(this,n)};EC$2.prototype.keyFromPrivate=function(n,o){return KeyPair$5.fromPrivate(this,n,o)};EC$2.prototype.keyFromPublic=function(n,o){return KeyPair$5.fromPublic(this,n,o)};EC$2.prototype.genKeyPair=function(n){n||(n={});for(var o=new HmacDRBG({hash:this.hash,pers:n.pers,persEnc:n.persEnc||"utf8",entropy:n.entropy||rand(this.hash.hmacStrength),entropyEnc:n.entropy&&n.entropyEnc||"utf8",nonce:this.n.toArray()}),a=this.n.byteLength(),c=this.n.sub(new BN$3(2));;){var l=new BN$3(o.generate(a));if(!(l.cmp(c)>0))return l.iaddn(1),this.keyFromPrivate(l)}};EC$2.prototype._truncateToN=function(n,o,a){var c;if(BN$3.isBN(n)||typeof n=="number")n=new BN$3(n,16),c=n.byteLength();else if(typeof n=="object")c=n.length,n=new BN$3(n,16);else{var l=n.toString();c=l.length+1>>>1,n=new BN$3(l,16)}typeof a!="number"&&(a=c*8);var u=a-this.n.bitLength();return u>0&&(n=n.ushrn(u)),!o&&n.cmp(this.n)>=0?n.sub(this.n):n};EC$2.prototype.sign=function(n,o,a,c){if(typeof a=="object"&&(c=a,a=null),c||(c={}),typeof n!="string"&&typeof n!="number"&&!BN$3.isBN(n)){assert$5(typeof n=="object"&&n&&typeof n.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),assert$5(n.length>>>0===n.length);for(var l=0;l<n.length;l++)assert$5((n[l]&255)===n[l])}o=this.keyFromPrivate(o,a),n=this._truncateToN(n,!1,c.msgBitLength),assert$5(!n.isNeg(),"Can not sign a negative message");var u=this.n.byteLength(),d=o.getPrivate().toArray("be",u),h=n.toArray("be",u);assert$5(new BN$3(h).eq(n),"Can not sign message");for(var y=new HmacDRBG({hash:this.hash,entropy:d,nonce:h,pers:c.pers,persEnc:c.persEnc||"utf8"}),p=this.n.sub(new BN$3(1)),v=0;;v++){var b=c.k?c.k(v):new BN$3(y.generate(this.n.byteLength()));if(b=this._truncateToN(b,!0),!(b.cmpn(1)<=0||b.cmp(p)>=0)){var _=this.g.mul(b);if(!_.isInfinity()){var T=_.getX(),I=T.umod(this.n);if(I.cmpn(0)!==0){var U=b.invm(this.n).mul(I.mul(o.getPrivate()).iadd(n));if(U=U.umod(this.n),U.cmpn(0)!==0){var N=(_.getY().isOdd()?1:0)|(T.cmp(I)!==0?2:0);return c.canonical&&U.cmp(this.nh)>0&&(U=this.n.sub(U),N^=1),new Signature$5({r:I,s:U,recoveryParam:N})}}}}}};EC$2.prototype.verify=function(n,o,a,c,l){l||(l={}),n=this._truncateToN(n,!1,l.msgBitLength),a=this.keyFromPublic(a,c),o=new Signature$5(o,"hex");var u=o.r,d=o.s;if(u.cmpn(1)<0||u.cmp(this.n)>=0||d.cmpn(1)<0||d.cmp(this.n)>=0)return!1;var h=d.invm(this.n),y=h.mul(n).umod(this.n),p=h.mul(u).umod(this.n),v;return this.curve._maxwellTrick?(v=this.g.jmulAdd(y,a.getPublic(),p),v.isInfinity()?!1:v.eqXToP(u)):(v=this.g.mulAdd(y,a.getPublic(),p),v.isInfinity()?!1:v.getX().umod(this.n).cmp(u)===0)};EC$2.prototype.recoverPubKey=function(e,n,o,a){assert$5((3&o)===o,"The recovery param is more than two bits"),n=new Signature$5(n,a);var c=this.n,l=new BN$3(e),u=n.r,d=n.s,h=o&1,y=o>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&y)throw new Error("Unable to find sencond key candinate");y?u=this.curve.pointFromX(u.add(this.curve.n),h):u=this.curve.pointFromX(u,h);var p=n.r.invm(c),v=c.sub(l).mul(p).umod(c),b=d.mul(p).umod(c);return this.g.mulAdd(v,u,b)};EC$2.prototype.getKeyRecoveryParam=function(e,n,o,a){if(n=new Signature$5(n,a),n.recoveryParam!==null)return n.recoveryParam;for(var c=0;c<4;c++){var l;try{l=this.recoverPubKey(e,n,c)}catch{continue}if(l.eq(o))return c}throw new Error("Unable to find valid recovery factor")};var utils$m=utils$G,assert$4=utils$m.assert,parseBytes$2=utils$m.parseBytes,cachedProperty$1=utils$m.cachedProperty;function KeyPair$4(e,n){this.eddsa=e,this._secret=parseBytes$2(n.secret),e.isPoint(n.pub)?this._pub=n.pub:this._pubBytes=parseBytes$2(n.pub)}KeyPair$4.fromPublic=function(n,o){return o instanceof KeyPair$4?o:new KeyPair$4(n,{pub:o})};KeyPair$4.fromSecret=function(n,o){return o instanceof KeyPair$4?o:new KeyPair$4(n,{secret:o})};KeyPair$4.prototype.secret=function(){return this._secret};cachedProperty$1(KeyPair$4,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$4,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$4,"privBytes",function(){var n=this.eddsa,o=this.hash(),a=n.encodingLength-1,c=o.slice(0,n.encodingLength);return c[0]&=248,c[a]&=127,c[a]|=64,c});cachedProperty$1(KeyPair$4,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$4,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$4,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$4.prototype.sign=function(n){return assert$4(this._secret,"KeyPair can only verify"),this.eddsa.sign(n,this)};KeyPair$4.prototype.verify=function(n,o){return this.eddsa.verify(n,o,this)};KeyPair$4.prototype.getSecret=function(n){return assert$4(this._secret,"KeyPair is public only"),utils$m.encode(this.secret(),n)};KeyPair$4.prototype.getPublic=function(n){return utils$m.encode(this.pubBytes(),n)};var key$4=KeyPair$4,BN$2=bnExports$1,utils$l=utils$G,assert$3=utils$l.assert,cachedProperty=utils$l.cachedProperty,parseBytes$1=utils$l.parseBytes;function Signature$4(e,n){this.eddsa=e,typeof n!="object"&&(n=parseBytes$1(n)),Array.isArray(n)&&(assert$3(n.length===e.encodingLength*2,"Signature has invalid size"),n={R:n.slice(0,e.encodingLength),S:n.slice(e.encodingLength)}),assert$3(n.R&&n.S,"Signature without R or S"),e.isPoint(n.R)&&(this._R=n.R),n.S instanceof BN$2&&(this._S=n.S),this._Rencoded=Array.isArray(n.R)?n.R:n.Rencoded,this._Sencoded=Array.isArray(n.S)?n.S:n.Sencoded}cachedProperty(Signature$4,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$4,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$4,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$4,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Signature$4.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Signature$4.prototype.toHex=function(){return utils$l.encode(this.toBytes(),"hex").toUpperCase()};var signature$3=Signature$4,hash$1=hash$3,curves=curves$2,utils$k=utils$G,assert$2=utils$k.assert,parseBytes=utils$k.parseBytes,KeyPair$3=key$4,Signature$3=signature$3;function EDDSA(e){if(assert$2(e==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(e);e=curves[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function(n,o){n=parseBytes(n);var a=this.keyFromSecret(o),c=this.hashInt(a.messagePrefix(),n),l=this.g.mul(c),u=this.encodePoint(l),d=this.hashInt(u,a.pubBytes(),n).mul(a.priv()),h=c.add(d).umod(this.curve.n);return this.makeSignature({R:l,S:h,Rencoded:u})};EDDSA.prototype.verify=function(n,o,a){if(n=parseBytes(n),o=this.makeSignature(o),o.S().gte(o.eddsa.curve.n)||o.S().isNeg())return!1;var c=this.keyFromPublic(a),l=this.hashInt(o.Rencoded(),c.pubBytes(),n),u=this.g.mul(o.S()),d=o.R().add(c.pub().mul(l));return d.eq(u)};EDDSA.prototype.hashInt=function(){for(var n=this.hash(),o=0;o<arguments.length;o++)n.update(arguments[o]);return utils$k.intFromLE(n.digest()).umod(this.curve.n)};EDDSA.prototype.keyFromPublic=function(n){return KeyPair$3.fromPublic(this,n)};EDDSA.prototype.keyFromSecret=function(n){return KeyPair$3.fromSecret(this,n)};EDDSA.prototype.makeSignature=function(n){return n instanceof Signature$3?n:new Signature$3(this,n)};EDDSA.prototype.encodePoint=function(n){var o=n.getY().toArray("le",this.encodingLength);return o[this.encodingLength-1]|=n.getX().isOdd()?128:0,o};EDDSA.prototype.decodePoint=function(n){n=utils$k.parseBytes(n);var o=n.length-1,a=n.slice(0,o).concat(n[o]&-129),c=(n[o]&128)!==0,l=utils$k.intFromLE(a);return this.curve.pointFromY(l,c)};EDDSA.prototype.encodeInt=function(n){return n.toArray("le",this.encodingLength)};EDDSA.prototype.decodeInt=function(n){return utils$k.intFromLE(n)};EDDSA.prototype.isPoint=function(n){return n instanceof this.pointClass};(function(e){var n=e;n.version=require$$0$5.version,n.utils=utils$G,n.rand=brorandExports,n.curve=curve$1,n.curves=curves$2,n.ec=ec$2,n.eddsa=eddsa})(elliptic$4);const EC$1=elliptic$4.ec,ec$1=new EC$1("secp256k1"),ecparams$1=ec$1.curve,BN$1=ecparams$1.n.constructor;function loadCompressedPublicKey$1(e,n){let o=new BN$1(n);if(o.cmp(ecparams$1.p)>=0)return null;o=o.toRed(ecparams$1.red);let a=o.redSqr().redIMul(o).redIAdd(ecparams$1.b).redSqrt();return e===3!==a.isOdd()&&(a=a.redNeg()),ec$1.keyPair({pub:{x:o,y:a}})}function loadUncompressedPublicKey$1(e,n,o){let a=new BN$1(n),c=new BN$1(o);if(a.cmp(ecparams$1.p)>=0||c.cmp(ecparams$1.p)>=0||(a=a.toRed(ecparams$1.red),c=c.toRed(ecparams$1.red),(e===6||e===7)&&c.isOdd()!==(e===7)))return null;const l=a.redSqr().redIMul(a);return c.redSqr().redISub(l.redIAdd(ecparams$1.b)).isZero()?ec$1.keyPair({pub:{x:a,y:c}}):null}function loadPublicKey$1(e){const n=e[0];switch(n){case 2:case 3:return e.length!==33?null:loadCompressedPublicKey$1(n,e.subarray(1,33));case 4:case 6:case 7:return e.length!==65?null:loadUncompressedPublicKey$1(n,e.subarray(1,33),e.subarray(33,65));default:return null}}function savePublicKey$1(e,n){const o=n.encode(null,e.length===33);for(let a=0;a<e.length;++a)e[a]=o[a]}var elliptic$3={contextRandomize(){return 0},privateKeyVerify(e){const n=new BN$1(e);return n.cmp(ecparams$1.n)<0&&!n.isZero()?0:1},privateKeyNegate(e){const n=new BN$1(e),o=ecparams$1.n.sub(n).umod(ecparams$1.n).toArrayLike(Uint8Array,"be",32);return e.set(o),0},privateKeyTweakAdd(e,n){const o=new BN$1(n);if(o.cmp(ecparams$1.n)>=0||(o.iadd(new BN$1(e)),o.cmp(ecparams$1.n)>=0&&o.isub(ecparams$1.n),o.isZero()))return 1;const a=o.toArrayLike(Uint8Array,"be",32);return e.set(a),0},privateKeyTweakMul(e,n){let o=new BN$1(n);if(o.cmp(ecparams$1.n)>=0||o.isZero())return 1;o.imul(new BN$1(e)),o.cmp(ecparams$1.n)>=0&&(o=o.umod(ecparams$1.n));const a=o.toArrayLike(Uint8Array,"be",32);return e.set(a),0},publicKeyVerify(e){return loadPublicKey$1(e)===null?1:0},publicKeyCreate(e,n){const o=new BN$1(n);if(o.cmp(ecparams$1.n)>=0||o.isZero())return 1;const a=ec$1.keyFromPrivate(n).getPublic();return savePublicKey$1(e,a),0},publicKeyConvert(e,n){const o=loadPublicKey$1(n);if(o===null)return 1;const a=o.getPublic();return savePublicKey$1(e,a),0},publicKeyNegate(e,n){const o=loadPublicKey$1(n);if(o===null)return 1;const a=o.getPublic();return a.y=a.y.redNeg(),savePublicKey$1(e,a),0},publicKeyCombine(e,n){const o=new Array(n.length);for(let c=0;c<n.length;++c)if(o[c]=loadPublicKey$1(n[c]),o[c]===null)return 1;let a=o[0].getPublic();for(let c=1;c<o.length;++c)a=a.add(o[c].pub);return a.isInfinity()?2:(savePublicKey$1(e,a),0)},publicKeyTweakAdd(e,n,o){const a=loadPublicKey$1(n);if(a===null)return 1;if(o=new BN$1(o),o.cmp(ecparams$1.n)>=0)return 2;const c=a.getPublic().add(ecparams$1.g.mul(o));return c.isInfinity()?2:(savePublicKey$1(e,c),0)},publicKeyTweakMul(e,n,o){const a=loadPublicKey$1(n);if(a===null)return 1;if(o=new BN$1(o),o.cmp(ecparams$1.n)>=0||o.isZero())return 2;const c=a.getPublic().mul(o);return savePublicKey$1(e,c),0},signatureNormalize(e){const n=new BN$1(e.subarray(0,32)),o=new BN$1(e.subarray(32,64));return n.cmp(ecparams$1.n)>=0||o.cmp(ecparams$1.n)>=0?1:(o.cmp(ec$1.nh)===1&&e.set(ecparams$1.n.sub(o).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,n){const o=n.subarray(0,32),a=n.subarray(32,64);if(new BN$1(o).cmp(ecparams$1.n)>=0||new BN$1(a).cmp(ecparams$1.n)>=0)return 1;const{output:c}=e;let l=c.subarray(4,37);l[0]=0,l.set(o,1);let u=33,d=0;for(;u>1&&l[d]===0&&!(l[d+1]&128);--u,++d);if(l=l.subarray(d),l[0]&128||u>1&&l[0]===0&&!(l[1]&128))return 1;let h=c.subarray(39,72);h[0]=0,h.set(a,1);let y=33,p=0;for(;y>1&&h[p]===0&&!(h[p+1]&128);--y,++p);return h=h.subarray(p),h[0]&128||y>1&&h[0]===0&&!(h[1]&128)?1:(e.outputlen=6+u+y,c[0]=48,c[1]=e.outputlen-2,c[2]=2,c[3]=l.length,c.set(l,4),c[4+u]=2,c[5+u]=h.length,c.set(h,6+u),0)},signatureImport(e,n){if(n.length<8||n.length>72||n[0]!==48||n[1]!==n.length-2||n[2]!==2)return 1;const o=n[3];if(o===0||5+o>=n.length||n[4+o]!==2)return 1;const a=n[5+o];if(a===0||6+o+a!==n.length||n[4]&128||o>1&&n[4]===0&&!(n[5]&128)||n[o+6]&128||a>1&&n[o+6]===0&&!(n[o+7]&128))return 1;let c=n.subarray(4,4+o);if(c.length===33&&c[0]===0&&(c=c.subarray(1)),c.length>32)return 1;let l=n.subarray(6+o);if(l.length===33&&l[0]===0&&(l=l.slice(1)),l.length>32)throw new Error("S length is too long");let u=new BN$1(c);u.cmp(ecparams$1.n)>=0&&(u=new BN$1(0));let d=new BN$1(n.subarray(6+o));return d.cmp(ecparams$1.n)>=0&&(d=new BN$1(0)),e.set(u.toArrayLike(Uint8Array,"be",32),0),e.set(d.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,n,o,a,c){if(c){const d=c;c=h=>{const y=d(n,o,null,a,h);if(!(y instanceof Uint8Array&&y.length===32))throw new Error("This is the way");return new BN$1(y)}}const l=new BN$1(o);if(l.cmp(ecparams$1.n)>=0||l.isZero())return 1;let u;try{u=ec$1.sign(n,o,{canonical:!0,k:c,pers:a})}catch{return 1}return e.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),e.recid=u.recoveryParam,0},ecdsaVerify(e,n,o){const a={r:e.subarray(0,32),s:e.subarray(32,64)},c=new BN$1(a.r),l=new BN$1(a.s);if(c.cmp(ecparams$1.n)>=0||l.cmp(ecparams$1.n)>=0)return 1;if(l.cmp(ec$1.nh)===1||c.isZero()||l.isZero())return 3;const u=loadPublicKey$1(o);if(u===null)return 2;const d=u.getPublic();return ec$1.verify(n,a,d)?0:3},ecdsaRecover(e,n,o,a){const c={r:n.slice(0,32),s:n.slice(32,64)},l=new BN$1(c.r),u=new BN$1(c.s);if(l.cmp(ecparams$1.n)>=0||u.cmp(ecparams$1.n)>=0)return 1;if(l.isZero()||u.isZero())return 2;let d;try{d=ec$1.recoverPubKey(a,c,o)}catch{return 2}return savePublicKey$1(e,d),0},ecdh(e,n,o,a,c,l,u){const d=loadPublicKey$1(n);if(d===null)return 1;const h=new BN$1(o);if(h.cmp(ecparams$1.n)>=0||h.isZero())return 2;const y=d.getPublic().mul(h);if(c===void 0){const p=y.encode(null,!0),v=ec$1.hash().update(p).digest();for(let b=0;b<32;++b)e[b]=v[b]}else{l||(l=new Uint8Array(32));const p=y.getX().toArray("be",32);for(let T=0;T<32;++T)l[T]=p[T];u||(u=new Uint8Array(32));const v=y.getY().toArray("be",32);for(let T=0;T<32;++T)u[T]=v[T];const b=c(l,u,a);if(!(b instanceof Uint8Array&&b.length===e.length))return 2;e.set(b)}return 0}},elliptic$2=lib$k(elliptic$3),__importDefault$q=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(public_key$2,"__esModule",{value:!0});public_key$2.PublicKey=void 0;const utils_1$J=lib$m,ed25519_1$5=ed25519$1,secp256k1_1$3=__importDefault$q(elliptic$2),constants_1$d=constants$a,types_1$F=lib$l;function key_type_to_str$2(e){switch(e){case constants_1$d.KeyType.ED25519:return"ed25519";case constants_1$d.KeyType.SECP256K1:return"secp256k1";default:throw new Error(`Unknown key type ${e}`)}}function str_to_key_type$2(e){switch(e.toLowerCase()){case"ed25519":return constants_1$d.KeyType.ED25519;case"secp256k1":return constants_1$d.KeyType.SECP256K1;default:throw new Error(`Unknown key type ${e}`)}}class ED25519PublicKey extends types_1$F.Assignable{constructor(){super(...arguments),this.keyType=constants_1$d.KeyType.ED25519}}class SECP256K1PublicKey extends types_1$F.Assignable{constructor(){super(...arguments),this.keyType=constants_1$d.KeyType.SECP256K1}}let PublicKey$2=class Pt extends types_1$F.Assignable{constructor({keyType:n,data:o}){super({}),n===constants_1$d.KeyType.ED25519?this.ed25519Key={keyType:n,data:o}:n===constants_1$d.KeyType.SECP256K1&&(this.secp256k1Key={keyType:n,data:o})}static from(n){return typeof n=="string"?Pt.fromString(n):n}static fromString(n){const o=n.split(":");let a,c;if(o.length===1)a=o[0];else if(o.length===2)a=o[1],c=str_to_key_type$2(o[0]);else throw new Error("Invalid encoded key format, must be <curve>:<encoded key>");const l=(0,utils_1$J.baseDecode)(a);c||(c=l.length===constants_1$d.KeySize.SECP256k1_PUBLIC_KEY?constants_1$d.KeyType.SECP256K1:constants_1$d.KeyType.ED25519);const u=c===constants_1$d.KeyType.ED25519?constants_1$d.KeySize.ED25519_PUBLIC_KEY:constants_1$d.KeySize.SECP256k1_PUBLIC_KEY;if(l.length!==u)throw new Error(`Invalid public key size (${l.length}), must be ${u}`);return new Pt({keyType:c,data:l})}toString(){const n=(0,utils_1$J.baseEncode)(this.data);return`${key_type_to_str$2(this.keyType)}:${n}`}verify(n,o){const a=this.keyType,c=this.data;switch(a){case constants_1$d.KeyType.ED25519:return ed25519_1$5.ed25519.verify(o,n,c);case constants_1$d.KeyType.SECP256K1:return secp256k1_1$3.default.ecdsaVerify(o.subarray(0,64),n,new Uint8Array([4,...c]));default:throw new Error(`Unknown key type: ${a}`)}}get keyPair(){return this.ed25519Key||this.secp256k1Key}get keyType(){return this.keyPair.keyType}get data(){return this.keyPair.data}};public_key$2.PublicKey=PublicKey$2;var __importDefault$p=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(key_pair_ed25519$2,"__esModule",{value:!0});key_pair_ed25519$2.KeyPairEd25519=void 0;const utils_1$I=lib$m,ed25519_1$4=ed25519$1,randombytes_1$4=__importDefault$p(browserExports),constants_1$c=constants$a,key_pair_base_1$7=key_pair_base$2,public_key_1$4=public_key$2;let KeyPairEd25519$2=class Ct extends key_pair_base_1$7.KeyPairBase{constructor(n){super();const o=(0,utils_1$I.baseDecode)(n),a=new Uint8Array(o.slice(0,constants_1$c.KeySize.SECRET_KEY)),c=ed25519_1$4.ed25519.getPublicKey(new Uint8Array(a));this.publicKey=new public_key_1$4.PublicKey({keyType:constants_1$c.KeyType.ED25519,data:c}),this.secretKey=(0,utils_1$I.baseEncode)(a),this.extendedSecretKey=n}static fromRandom(){const n=(0,randombytes_1$4.default)(constants_1$c.KeySize.SECRET_KEY),o=ed25519_1$4.ed25519.getPublicKey(new Uint8Array(n)),a=new Uint8Array([...n,...o]);return new Ct((0,utils_1$I.baseEncode)(a))}sign(n){return{signature:ed25519_1$4.ed25519.sign(n,(0,utils_1$I.baseDecode)(this.secretKey)),publicKey:this.publicKey}}verify(n,o){return this.publicKey.verify(n,o)}toString(){return`ed25519:${this.extendedSecretKey}`}getPublicKey(){return this.publicKey}};key_pair_ed25519$2.KeyPairEd25519=KeyPairEd25519$2;var key_pair_secp256k1$1={},__importDefault$o=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(key_pair_secp256k1$1,"__esModule",{value:!0});key_pair_secp256k1$1.KeyPairSecp256k1=void 0;const constants_1$b=constants$a,key_pair_base_1$6=key_pair_base$2,public_key_1$3=public_key$2,secp256k1_1$2=__importDefault$o(elliptic$2),randombytes_1$3=__importDefault$o(browserExports),utils_1$H=lib$m;let KeyPairSecp256k1$1=class jt extends key_pair_base_1$6.KeyPairBase{constructor(n){super();const o=(0,utils_1$H.baseDecode)(n),a=new Uint8Array(o.slice(0,constants_1$b.KeySize.SECRET_KEY)),c=secp256k1_1$2.default.publicKeyCreate(new Uint8Array(a),!1),l=c.subarray(1,c.length);this.publicKey=new public_key_1$3.PublicKey({keyType:constants_1$b.KeyType.SECP256K1,data:l}),this.secretKey=(0,utils_1$H.baseEncode)(a),this.extendedSecretKey=n}static fromRandom(){const n=(0,randombytes_1$3.default)(constants_1$b.KeySize.SECRET_KEY),o=secp256k1_1$2.default.publicKeyCreate(new Uint8Array(n),!1),a=o.subarray(1,o.length),c=new Uint8Array([...n,...a]);return new jt((0,utils_1$H.baseEncode)(c))}sign(n){const{signature:o,recid:a}=secp256k1_1$2.default.ecdsaSign(n,(0,utils_1$H.baseDecode)(this.secretKey));return{signature:new Uint8Array([...o,a]),publicKey:this.publicKey}}verify(n,o){return this.publicKey.verify(n,o)}toString(){return`secp256k1:${this.extendedSecretKey}`}getPublicKey(){return this.publicKey}};key_pair_secp256k1$1.KeyPairSecp256k1=KeyPairSecp256k1$1;Object.defineProperty(key_pair$5,"__esModule",{value:!0});key_pair$5.KeyPair=void 0;const key_pair_base_1$5=key_pair_base$2,key_pair_ed25519_1$2=key_pair_ed25519$2,key_pair_secp256k1_1$1=key_pair_secp256k1$1;let KeyPair$2=class extends key_pair_base_1$5.KeyPairBase{static fromRandom(n){switch(n.toUpperCase()){case"ED25519":return key_pair_ed25519_1$2.KeyPairEd25519.fromRandom();case"SECP256K1":return key_pair_secp256k1_1$1.KeyPairSecp256k1.fromRandom();default:throw new Error(`Unknown curve ${n}`)}}static fromString(n){const o=n.split(":");if(o.length===2)switch(o[0].toUpperCase()){case"ED25519":return new key_pair_ed25519_1$2.KeyPairEd25519(o[1]);case"SECP256K1":return new key_pair_secp256k1_1$1.KeyPairSecp256k1(o[1]);default:throw new Error(`Unknown curve: ${o[0]}`)}else throw new Error("Invalid encoded key format, must be <curve>:<encoded key>")}};key_pair$5.KeyPair=KeyPair$2;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.KeyPairSecp256k1=e.KeyPairEd25519=e.KeyPair=e.KeyType=void 0;var n=constants$a;Object.defineProperty(e,"KeyType",{enumerable:!0,get:function(){return n.KeyType}});var o=key_pair$5;Object.defineProperty(e,"KeyPair",{enumerable:!0,get:function(){return o.KeyPair}});var a=key_pair_ed25519$2;Object.defineProperty(e,"KeyPairEd25519",{enumerable:!0,get:function(){return a.KeyPairEd25519}});var c=key_pair_secp256k1$1;Object.defineProperty(e,"KeyPairSecp256k1",{enumerable:!0,get:function(){return c.KeyPairSecp256k1}});var l=public_key$2;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return l.PublicKey}})})(lib$n);var keystore$4={};Object.defineProperty(keystore$4,"__esModule",{value:!0});keystore$4.KeyStore=void 0;let KeyStore$2=class{};keystore$4.KeyStore=KeyStore$2;var __awaiter$19=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(in_memory_key_store$5,"__esModule",{value:!0});in_memory_key_store$5.InMemoryKeyStore=void 0;const crypto_1$v=lib$n,keystore_1$5=keystore$4;let InMemoryKeyStore$2=class extends keystore_1$5.KeyStore{constructor(){super(),this.keys={}}setKey(n,o,a){return __awaiter$19(this,void 0,void 0,function*(){this.keys[`${o}:${n}`]=a.toString()})}getKey(n,o){return __awaiter$19(this,void 0,void 0,function*(){const a=this.keys[`${o}:${n}`];return a?crypto_1$v.KeyPair.fromString(a):null})}removeKey(n,o){return __awaiter$19(this,void 0,void 0,function*(){delete this.keys[`${o}:${n}`]})}clear(){return __awaiter$19(this,void 0,void 0,function*(){this.keys={}})}getNetworks(){return __awaiter$19(this,void 0,void 0,function*(){const n=new Set;return Object.keys(this.keys).forEach(o=>{const a=o.split(":");n.add(a[1])}),Array.from(n.values())})}getAccounts(n){return __awaiter$19(this,void 0,void 0,function*(){const o=new Array;return Object.keys(this.keys).forEach(a=>{const c=a.split(":");c[c.length-1]===n&&o.push(c.slice(0,c.length-1).join(":"))}),o})}toString(){return"InMemoryKeyStore"}};in_memory_key_store$5.InMemoryKeyStore=InMemoryKeyStore$2;var merge_key_store$5={},__awaiter$18=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(merge_key_store$5,"__esModule",{value:!0});merge_key_store$5.MergeKeyStore=void 0;const keystore_1$4=keystore$4;let MergeKeyStore$2=class extends keystore_1$4.KeyStore{constructor(n,o={writeKeyStoreIndex:0}){super(),this.options=o,this.keyStores=n}setKey(n,o,a){return __awaiter$18(this,void 0,void 0,function*(){yield this.keyStores[this.options.writeKeyStoreIndex].setKey(n,o,a)})}getKey(n,o){return __awaiter$18(this,void 0,void 0,function*(){for(const a of this.keyStores){const c=yield a.getKey(n,o);if(c)return c}return null})}removeKey(n,o){return __awaiter$18(this,void 0,void 0,function*(){for(const a of this.keyStores)yield a.removeKey(n,o)})}clear(){return __awaiter$18(this,void 0,void 0,function*(){for(const n of this.keyStores)yield n.clear()})}getNetworks(){return __awaiter$18(this,void 0,void 0,function*(){const n=new Set;for(const o of this.keyStores)for(const a of yield o.getNetworks())n.add(a);return Array.from(n)})}getAccounts(n){return __awaiter$18(this,void 0,void 0,function*(){const o=new Set;for(const a of this.keyStores)for(const c of yield a.getAccounts(n))o.add(c);return Array.from(o)})}toString(){return`MergeKeyStore(${this.keyStores.join(", ")})`}};merge_key_store$5.MergeKeyStore=MergeKeyStore$2;var multi_contract_keystore$1={};Object.defineProperty(multi_contract_keystore$1,"__esModule",{value:!0});multi_contract_keystore$1.MultiContractKeyStore=void 0;let MultiContractKeyStore$1=class{};multi_contract_keystore$1.MultiContractKeyStore=MultiContractKeyStore$1;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultiContractKeyStore=e.MergeKeyStore=e.KeyStore=e.InMemoryKeyStore=void 0;var n=in_memory_key_store$5;Object.defineProperty(e,"InMemoryKeyStore",{enumerable:!0,get:function(){return n.InMemoryKeyStore}});var o=keystore$4;Object.defineProperty(e,"KeyStore",{enumerable:!0,get:function(){return o.KeyStore}});var a=merge_key_store$5;Object.defineProperty(e,"MergeKeyStore",{enumerable:!0,get:function(){return a.MergeKeyStore}});var c=multi_contract_keystore$1;Object.defineProperty(e,"MultiContractKeyStore",{enumerable:!0,get:function(){return c.MultiContractKeyStore}})})(lib$o);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.KeyStore=void 0;var n=lib$o;Object.defineProperty(e,"KeyStore",{enumerable:!0,get:function(){return n.KeyStore}})})(keystore$5);var in_memory_key_store$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InMemoryKeyStore=void 0;var n=lib$o;Object.defineProperty(e,"InMemoryKeyStore",{enumerable:!0,get:function(){return n.InMemoryKeyStore}})})(in_memory_key_store$4);var browser_local_storage_key_store$5={},lib$j={},browser_local_storage_key_store$4={},__awaiter$17=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(browser_local_storage_key_store$4,"__esModule",{value:!0});browser_local_storage_key_store$4.BrowserLocalStorageKeyStore=void 0;const crypto_1$u=lib$n,keystores_1$7=lib$o,LOCAL_STORAGE_KEY_PREFIX$4="near-api-js:keystore:";let BrowserLocalStorageKeyStore$2=class extends keystores_1$7.KeyStore{constructor(n=window.localStorage,o=LOCAL_STORAGE_KEY_PREFIX$4){super(),this.localStorage=n,this.prefix=o}setKey(n,o,a){return __awaiter$17(this,void 0,void 0,function*(){this.localStorage.setItem(this.storageKeyForSecretKey(n,o),a.toString())})}getKey(n,o){return __awaiter$17(this,void 0,void 0,function*(){const a=this.localStorage.getItem(this.storageKeyForSecretKey(n,o));return a?crypto_1$u.KeyPair.fromString(a):null})}removeKey(n,o){return __awaiter$17(this,void 0,void 0,function*(){this.localStorage.removeItem(this.storageKeyForSecretKey(n,o))})}clear(){return __awaiter$17(this,void 0,void 0,function*(){for(const n of this.storageKeys())n.startsWith(this.prefix)&&this.localStorage.removeItem(n)})}getNetworks(){return __awaiter$17(this,void 0,void 0,function*(){const n=new Set;for(const o of this.storageKeys())if(o.startsWith(this.prefix)){const a=o.substring(this.prefix.length).split(":");n.add(a[1])}return Array.from(n.values())})}getAccounts(n){return __awaiter$17(this,void 0,void 0,function*(){const o=new Array;for(const a of this.storageKeys())if(a.startsWith(this.prefix)){const c=a.substring(this.prefix.length).split(":");c[1]===n&&o.push(c[0])}return o})}storageKeyForSecretKey(n,o){return`${this.prefix}${o}:${n}`}*storageKeys(){for(let n=0;n<this.localStorage.length;n++)yield this.localStorage.key(n)}};browser_local_storage_key_store$4.BrowserLocalStorageKeyStore=BrowserLocalStorageKeyStore$2;var multi_contract_browser_local_storage_key_store$1={},__awaiter$16=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(multi_contract_browser_local_storage_key_store$1,"__esModule",{value:!0});multi_contract_browser_local_storage_key_store$1.MultiContractBrowserLocalStorageKeyStore=void 0;const crypto_1$t=lib$n,keystores_1$6=lib$o,LOCAL_STORAGE_KEY_PREFIX$3="near-api-js:keystore:";let MultiContractBrowserLocalStorageKeyStore$1=class extends keystores_1$6.MultiContractKeyStore{constructor(n=window.localStorage,o=LOCAL_STORAGE_KEY_PREFIX$3){super(),this.localStorage=n,this.prefix=o||LOCAL_STORAGE_KEY_PREFIX$3}setKey(n,o,a,c){return __awaiter$16(this,void 0,void 0,function*(){this.localStorage.setItem(this.storageKeyForSecretKey(n,o,c),a.toString())})}getKey(n,o,a){return __awaiter$16(this,void 0,void 0,function*(){const c=this.localStorage.getItem(this.storageKeyForSecretKey(n,o,a));return c?crypto_1$t.KeyPair.fromString(c):null})}removeKey(n,o,a){return __awaiter$16(this,void 0,void 0,function*(){this.localStorage.removeItem(this.storageKeyForSecretKey(n,o,a))})}clear(){return __awaiter$16(this,void 0,void 0,function*(){for(const n of this.storageKeys())n.startsWith(this.prefix)&&this.localStorage.removeItem(n)})}getNetworks(){return __awaiter$16(this,void 0,void 0,function*(){const n=new Set;for(const o of this.storageKeys())if(o.startsWith(this.prefix)){const a=o.substring(this.prefix.length).split(":");n.add(a[1])}return Array.from(n.values())})}getAccounts(n){return __awaiter$16(this,void 0,void 0,function*(){const o=[];for(const a of this.storageKeys())if(a.startsWith(this.prefix)){const c=a.substring(this.prefix.length).split(":");c[1]===n&&o.push(c[0])}return o})}getContracts(n,o){return __awaiter$16(this,void 0,void 0,function*(){const a=[];for(const c of this.storageKeys())if(c.startsWith(this.prefix)){const l=c.substring(this.prefix.length).split(":");l[1]===n&&l[0]===o&&a.push(l[2])}return a})}storageKeyForSecretKey(n,o,a){return`${this.prefix}${o}:${n}:${a}`}*storageKeys(){for(let n=0;n<this.localStorage.length;n++)yield this.localStorage.key(n)}};multi_contract_browser_local_storage_key_store$1.MultiContractBrowserLocalStorageKeyStore=MultiContractBrowserLocalStorageKeyStore$1;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultiContractBrowserLocalStorageKeyStore=e.BrowserLocalStorageKeyStore=void 0;var n=browser_local_storage_key_store$4;Object.defineProperty(e,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return n.BrowserLocalStorageKeyStore}});var o=multi_contract_browser_local_storage_key_store$1;Object.defineProperty(e,"MultiContractBrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return o.MultiContractBrowserLocalStorageKeyStore}})})(lib$j);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserLocalStorageKeyStore=void 0;var n=lib$j;Object.defineProperty(e,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return n.BrowserLocalStorageKeyStore}})})(browser_local_storage_key_store$5);var merge_key_store$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MergeKeyStore=void 0;var n=lib$o;Object.defineProperty(e,"MergeKeyStore",{enumerable:!0,get:function(){return n.MergeKeyStore}})})(merge_key_store$4);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MergeKeyStore=e.BrowserLocalStorageKeyStore=e.InMemoryKeyStore=e.KeyStore=void 0;const n=keystore$5;Object.defineProperty(e,"KeyStore",{enumerable:!0,get:function(){return n.KeyStore}});const o=in_memory_key_store$4;Object.defineProperty(e,"InMemoryKeyStore",{enumerable:!0,get:function(){return o.InMemoryKeyStore}});const a=browser_local_storage_key_store$5;Object.defineProperty(e,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return a.BrowserLocalStorageKeyStore}});const c=merge_key_store$4;Object.defineProperty(e,"MergeKeyStore",{enumerable:!0,get:function(){return c.MergeKeyStore}})})(browserIndex$6);var commonIndex$2={},providers$2={},provider$8={},lib$i={},exponentialBackoff$5={},__awaiter$15=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(exponentialBackoff$5,"__esModule",{value:!0});exponentialBackoff$5.exponentialBackoff=void 0;function exponentialBackoff$4(e,n,o,a){return __awaiter$15(this,void 0,void 0,function*(){let c=e;for(let l=0;l<n;l++){const u=yield a();if(u)return u;yield sleep$2(c),c*=o}return null})}exponentialBackoff$5.exponentialBackoff=exponentialBackoff$4;function sleep$2(e){return new Promise(n=>setTimeout(n,e))}var jsonRpcProvider$5={},lib$h={},action_creators$2={},actions$3={};Object.defineProperty(actions$3,"__esModule",{value:!0});actions$3.Action=actions$3.SignedDelegate=actions$3.DeleteAccount=actions$3.DeleteKey=actions$3.AddKey=actions$3.Stake=actions$3.Transfer=actions$3.FunctionCall=actions$3.DeployContract=actions$3.CreateAccount=actions$3.IAction=actions$3.AccessKey=actions$3.AccessKeyPermission=actions$3.FullAccessPermission=actions$3.FunctionCallPermission=void 0;const types_1$E=lib$l;let Enum$3=class{constructor(n){if(Object.keys(n).length!==1)throw new Error("Enum can only take single value");Object.keys(n).map(o=>{this[o]=n[o],this.enum=o})}},FunctionCallPermission$2=class extends types_1$E.Assignable{};actions$3.FunctionCallPermission=FunctionCallPermission$2;let FullAccessPermission$2=class extends types_1$E.Assignable{};actions$3.FullAccessPermission=FullAccessPermission$2;let AccessKeyPermission$2=class extends Enum$3{};actions$3.AccessKeyPermission=AccessKeyPermission$2;let AccessKey$2=class extends types_1$E.Assignable{};actions$3.AccessKey=AccessKey$2;let IAction$1=class extends types_1$E.Assignable{};actions$3.IAction=IAction$1;let CreateAccount$2=class extends IAction$1{};actions$3.CreateAccount=CreateAccount$2;let DeployContract$2=class extends IAction$1{};actions$3.DeployContract=DeployContract$2;let FunctionCall$2=class extends IAction$1{};actions$3.FunctionCall=FunctionCall$2;let Transfer$2=class extends IAction$1{};actions$3.Transfer=Transfer$2;let Stake$2=class extends IAction$1{};actions$3.Stake=Stake$2;let AddKey$2=class extends IAction$1{};actions$3.AddKey=AddKey$2;let DeleteKey$2=class extends IAction$1{};actions$3.DeleteKey=DeleteKey$2;let DeleteAccount$2=class extends IAction$1{};actions$3.DeleteAccount=DeleteAccount$2;let SignedDelegate$2=class extends IAction$1{};actions$3.SignedDelegate=SignedDelegate$2;let Action$2=class extends Enum$3{};actions$3.Action=Action$2;Object.defineProperty(action_creators$2,"__esModule",{value:!0});action_creators$2.actionCreators=action_creators$2.stringifyJsonOrBytes=void 0;const actions_1$6=actions$3;function fullAccessKey$8(){return new actions_1$6.AccessKey({nonce:0,permission:new actions_1$6.AccessKeyPermission({fullAccess:new actions_1$6.FullAccessPermission({})})})}function functionCallAccessKey$8(e,n,o){return new actions_1$6.AccessKey({nonce:0,permission:new actions_1$6.AccessKeyPermission({functionCall:new actions_1$6.FunctionCallPermission({receiverId:e,allowance:o,methodNames:n})})})}function createAccount$8(){return new actions_1$6.Action({createAccount:new actions_1$6.CreateAccount({})})}function deployContract$e(e){return new actions_1$6.Action({deployContract:new actions_1$6.DeployContract({code:e})})}function stringifyJsonOrBytes$2(e){return e.byteLength!==void 0&&e.byteLength===e.length?e:Buffer.from(JSON.stringify(e))}action_creators$2.stringifyJsonOrBytes=stringifyJsonOrBytes$2;function functionCall$f(e,n,o=BigInt(0),a=BigInt(0),c=stringifyJsonOrBytes$2,l=!1){return l?new actions_1$6.Action({functionCall:new actions_1$6.FunctionCall({methodName:e,args:n,gas:o,deposit:a})}):new actions_1$6.Action({functionCall:new actions_1$6.FunctionCall({methodName:e,args:c(n),gas:o,deposit:a})})}function transfer$8(e=BigInt(0)){return new actions_1$6.Action({transfer:new actions_1$6.Transfer({deposit:e})})}function stake$8(e=BigInt(0),n){return new actions_1$6.Action({stake:new actions_1$6.Stake({stake:e,publicKey:n})})}function addKey$b(e,n){return new actions_1$6.Action({addKey:new actions_1$6.AddKey({publicKey:e,accessKey:n})})}function deleteKey$b(e){return new actions_1$6.Action({deleteKey:new actions_1$6.DeleteKey({publicKey:e})})}function deleteAccount$8(e){return new actions_1$6.Action({deleteAccount:new actions_1$6.DeleteAccount({beneficiaryId:e})})}function signedDelegate$2({delegateAction:e,signature:n}){return new actions_1$6.Action({signedDelegate:new actions_1$6.SignedDelegate({delegateAction:e,signature:n})})}action_creators$2.actionCreators={addKey:addKey$b,createAccount:createAccount$8,deleteAccount:deleteAccount$8,deleteKey:deleteKey$b,deployContract:deployContract$e,fullAccessKey:fullAccessKey$8,functionCall:functionCall$f,functionCallAccessKey:functionCallAccessKey$8,signedDelegate:signedDelegate$2,stake:stake$8,transfer:transfer$8};var create_transaction$2={},schema$4={},cjs={},serialize$7={},types$6={};types$6.__esModule=!0;types$6.integers=void 0;types$6.integers=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"];var buffer={};buffer.__esModule=!0;buffer.DecodeBuffer=buffer.EncodeBuffer=void 0;var EncodeBuffer$1=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(n){if(this.buffer_size-this.offset<n){this.buffer_size=Math.max(this.buffer_size*2,this.buffer_size+n);var o=new ArrayBuffer(this.buffer_size);new Uint8Array(o).set(new Uint8Array(this.buffer)),this.buffer=o,this.view=new DataView(o)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(n,o){var a=o.substring(1),c=parseInt(a)/8;this.resize_if_necessary(c);var l=o[0]==="f"?"setFloat".concat(a):o[0]==="i"?"setInt".concat(a):"setUint".concat(a);this.view[l](this.offset,n,!0),this.offset+=c},e.prototype.store_bytes=function(n){this.resize_if_necessary(n.length),new Uint8Array(this.buffer).set(new Uint8Array(n),this.offset),this.offset+=n.length},e}();buffer.EncodeBuffer=EncodeBuffer$1;var DecodeBuffer=function(){function e(n){this.offset=0,this.buffer_size=n.length,this.buffer=new ArrayBuffer(n.length),new Uint8Array(this.buffer).set(n),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(n){if(this.offset+n>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(n){var o=n.substring(1),a=parseInt(o)/8;this.assert_enough_buffer(a);var c=n[0]==="f"?"getFloat".concat(o):n[0]==="i"?"getInt".concat(o):"getUint".concat(o),l=this.view[c](this.offset,!0);return this.offset+=a,l},e.prototype.consume_bytes=function(n){this.assert_enough_buffer(n);var o=this.buffer.slice(this.offset,this.offset+n);return this.offset+=n,o},e}();buffer.DecodeBuffer=DecodeBuffer;var utils$j={},__extends$4=commonjsGlobal$c&&commonjsGlobal$c.__extends||function(){var e=function(n,o){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,c){for(var l in c)Object.prototype.hasOwnProperty.call(c,l)&&(a[l]=c[l])},e(n,o)};return function(n,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");e(n,o);function a(){this.constructor=n}n.prototype=o===null?Object.create(o):(a.prototype=o.prototype,new a)}}();utils$j.__esModule=!0;utils$j.validate_schema=utils$j.ErrorSchema=utils$j.expect_enum=utils$j.expect_same_size=utils$j.expect_bigint=utils$j.expect_type=utils$j.isArrayLike=void 0;var types_js_1$2=types$6;function isArrayLike$1(e){return Array.isArray(e)||!!e&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&(e.length===0||e.length>0&&e.length-1 in e)}utils$j.isArrayLike=isArrayLike$1;function expect_type$1(e,n,o){if(typeof e!==n)throw new Error("Expected ".concat(n," not ").concat(typeof e,"(").concat(e,") at ").concat(o.join(".")))}utils$j.expect_type=expect_type$1;function expect_bigint$1(e,n){var o=["number","string","bigint","boolean"].includes(typeof e),a=typeof e=="object"&&e!==null&&"toString"in e;if(!o&&!a)throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}utils$j.expect_bigint=expect_bigint$1;function expect_same_size$1(e,n,o){if(e!==n)throw new Error("Array length ".concat(e," does not match schema length ").concat(n," at ").concat(o.join(".")))}utils$j.expect_same_size=expect_same_size$1;function expect_enum$1(e,n){if(typeof e!="object"||e===null)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}utils$j.expect_enum=expect_enum$1;var VALID_STRING_TYPES$1=types_js_1$2.integers.concat(["bool","string"]),VALID_OBJECT_KEYS$1=["option","enum","array","set","map","struct"],ErrorSchema$1=function(e){__extends$4(n,e);function n(o,a){var c="Invalid schema: ".concat(JSON.stringify(o)," expected ").concat(a);return e.call(this,c)||this}return n}(Error);utils$j.ErrorSchema=ErrorSchema$1;function validate_schema$1(e){if(!(typeof e=="string"&&VALID_STRING_TYPES$1.includes(e))){if(e&&typeof e=="object"){var n=Object.keys(e);if(n.length===1&&VALID_OBJECT_KEYS$1.includes(n[0])){var o=n[0];if(o==="option")return validate_schema$1(e[o]);if(o==="enum")return validate_enum_schema$1(e[o]);if(o==="array")return validate_array_schema$1(e[o]);if(o==="set")return validate_schema$1(e[o]);if(o==="map")return validate_map_schema$1(e[o]);if(o==="struct")return validate_struct_schema$1(e[o])}}throw new ErrorSchema$1(e,VALID_OBJECT_KEYS$1.join(", ")+" or "+VALID_STRING_TYPES$1.join(", "))}}utils$j.validate_schema=validate_schema$1;function validate_enum_schema$1(e){if(!Array.isArray(e))throw new ErrorSchema$1(e,"Array");for(var n=0,o=e;n<o.length;n++){var a=o[n];if(typeof a!="object"||!("struct"in a))throw new Error('Missing "struct" key in enum schema');if(typeof a.struct!="object"||Object.keys(a.struct).length!==1)throw new Error('The "struct" in each enum must have a single key');validate_schema$1({struct:a.struct})}}function validate_array_schema$1(e){if(typeof e!="object")throw new ErrorSchema$1(e,"{ type, len? }");if(e.len&&typeof e.len!="number")throw new Error("Invalid schema: ".concat(e));if("type"in e)return validate_schema$1(e.type);throw new ErrorSchema$1(e,"{ type, len? }")}function validate_map_schema$1(e){if(typeof e=="object"&&"key"in e&&"value"in e)validate_schema$1(e.key),validate_schema$1(e.value);else throw new ErrorSchema$1(e,"{ key, value }")}function validate_struct_schema$1(e){if(typeof e!="object")throw new ErrorSchema$1(e,"object");for(var n in e)validate_schema$1(e[n])}var __createBinding$5=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(e,n,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(n,o);(!c||("get"in c?!n.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(e,a,c)}:function(e,n,o,a){a===void 0&&(a=o),e[a]=n[o]}),__setModuleDefault$5=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),__importStar$5=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var o in e)o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)&&__createBinding$5(n,e,o);return __setModuleDefault$5(n,e),n};serialize$7.__esModule=!0;serialize$7.BorshSerializer=void 0;var types_js_1$1=types$6,buffer_js_1$1=buffer,utils$i=__importStar$5(utils$j),BorshSerializer$1=function(){function e(n){this.encoded=new buffer_js_1$1.EncodeBuffer,this.fieldPath=["value"],this.checkTypes=n}return e.prototype.encode=function(n,o){return this.encode_value(n,o),this.encoded.get_used_buffer()},e.prototype.encode_value=function(n,o){if(typeof o=="string"){if(types_js_1$1.integers.includes(o))return this.encode_integer(n,o);if(o==="string")return this.encode_string(n);if(o==="bool")return this.encode_boolean(n)}if(typeof o=="object"){if("option"in o)return this.encode_option(n,o);if("enum"in o)return this.encode_enum(n,o);if("array"in o)return this.encode_array(n,o);if("set"in o)return this.encode_set(n,o);if("map"in o)return this.encode_map(n,o);if("struct"in o)return this.encode_struct(n,o)}},e.prototype.encode_integer=function(n,o){var a=parseInt(o.substring(1));a<=32||o=="f64"?(this.checkTypes&&utils$i.expect_type(n,"number",this.fieldPath),this.encoded.store_value(n,o)):(this.checkTypes&&utils$i.expect_bigint(n,this.fieldPath),this.encode_bigint(BigInt(n),a))},e.prototype.encode_bigint=function(n,o){for(var a=o/8,c=new Uint8Array(a),l=0;l<a;l++)c[l]=Number(n&BigInt(255)),n=n>>BigInt(8);this.encoded.store_bytes(new Uint8Array(c))},e.prototype.encode_string=function(n){this.checkTypes&&utils$i.expect_type(n,"string",this.fieldPath);var o=n;this.encoded.store_value(o.length,"u32");for(var a=0;a<o.length;a++)this.encoded.store_value(o.charCodeAt(a),"u8")},e.prototype.encode_boolean=function(n){this.checkTypes&&utils$i.expect_type(n,"boolean",this.fieldPath),this.encoded.store_value(n?1:0,"u8")},e.prototype.encode_option=function(n,o){n==null?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(n,o.option))},e.prototype.encode_enum=function(n,o){this.checkTypes&&utils$i.expect_enum(n,this.fieldPath);for(var a=Object.keys(n)[0],c=0;c<o.enum.length;c++){var l=o.enum[c];if(a===Object.keys(l.struct)[0])return this.encoded.store_value(c,"u8"),this.encode_struct(n,l)}throw new Error("Enum key (".concat(a,") not found in enum schema: ").concat(JSON.stringify(o)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(n,o){if(utils$i.isArrayLike(n))return this.encode_arraylike(n,o);if(n instanceof ArrayBuffer)return this.encode_buffer(n,o);throw new Error("Expected Array-like not ".concat(typeof n,"(").concat(n,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(n,o){o.array.len?utils$i.expect_same_size(n.length,o.array.len,this.fieldPath):this.encoded.store_value(n.length,"u32");for(var a=0;a<n.length;a++)this.encode_value(n[a],o.array.type)},e.prototype.encode_buffer=function(n,o){o.array.len?utils$i.expect_same_size(n.byteLength,o.array.len,this.fieldPath):this.encoded.store_value(n.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_set=function(n,o){this.checkTypes&&utils$i.expect_type(n,"object",this.fieldPath);var a=n instanceof Set,c=a?Array.from(n.values()):Object.values(n);this.encoded.store_value(c.length,"u32");for(var l=0,u=c;l<u.length;l++){var d=u[l];this.encode_value(d,o.set)}},e.prototype.encode_map=function(n,o){this.checkTypes&&utils$i.expect_type(n,"object",this.fieldPath);var a=n instanceof Map,c=a?Array.from(n.keys()):Object.keys(n);this.encoded.store_value(c.length,"u32");for(var l=0,u=c;l<u.length;l++){var d=u[l];this.encode_value(d,o.map.key),this.encode_value(a?n.get(d):n[d],o.map.value)}},e.prototype.encode_struct=function(n,o){this.checkTypes&&utils$i.expect_type(n,"object",this.fieldPath);for(var a=0,c=Object.keys(o.struct);a<c.length;a++){var l=c[a];this.fieldPath.push(l),this.encode_value(n[l],o.struct[l]),this.fieldPath.pop()}},e}();serialize$7.BorshSerializer=BorshSerializer$1;var deserialize$3={};deserialize$3.__esModule=!0;deserialize$3.BorshDeserializer=void 0;var types_js_1=types$6,buffer_js_1=buffer,BorshDeserializer=function(){function e(n){this.buffer=new buffer_js_1.DecodeBuffer(n)}return e.prototype.decode=function(n){return this.decode_value(n)},e.prototype.decode_value=function(n){if(typeof n=="string"){if(types_js_1.integers.includes(n))return this.decode_integer(n);if(n==="string")return this.decode_string();if(n==="bool")return this.decode_boolean()}if(typeof n=="object"){if("option"in n)return this.decode_option(n);if("enum"in n)return this.decode_enum(n);if("array"in n)return this.decode_array(n);if("set"in n)return this.decode_set(n);if("map"in n)return this.decode_map(n);if("struct"in n)return this.decode_struct(n)}throw new Error("Unsupported type: ".concat(n))},e.prototype.decode_integer=function(n){var o=parseInt(n.substring(1));return o<=32||n=="f64"?this.buffer.consume_value(n):this.decode_bigint(o,n.startsWith("i"))},e.prototype.decode_bigint=function(n,o){o===void 0&&(o=!1);var a=n/8,c=new Uint8Array(this.buffer.consume_bytes(a)),l=c.reduceRight(function(u,d){return u+d.toString(16).padStart(2,"0")},"");return o&&c[a-1]?BigInt.asIntN(n,BigInt("0x".concat(l))):BigInt("0x".concat(l))},e.prototype.decode_string=function(){var n=this.decode_integer("u32"),o=new Uint8Array(this.buffer.consume_bytes(n));return String.fromCharCode.apply(null,o)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(n){var o=this.buffer.consume_value("u8");if(o===1)return this.decode_value(n.option);if(o!==0)throw new Error("Invalid option ".concat(o));return null},e.prototype.decode_enum=function(n){var o,a=this.buffer.consume_value("u8");if(a>n.enum.length)throw new Error("Enum option ".concat(a," is not available"));var c=n.enum[a].struct,l=Object.keys(c)[0];return o={},o[l]=this.decode_value(c[l]),o},e.prototype.decode_array=function(n){for(var o=[],a=n.array.len?n.array.len:this.decode_integer("u32"),c=0;c<a;++c)o.push(this.decode_value(n.array.type));return o},e.prototype.decode_set=function(n){for(var o=this.decode_integer("u32"),a=new Set,c=0;c<o;++c)a.add(this.decode_value(n.set));return a},e.prototype.decode_map=function(n){for(var o=this.decode_integer("u32"),a=new Map,c=0;c<o;++c){var l=this.decode_value(n.map.key),u=this.decode_value(n.map.value);a.set(l,u)}return a},e.prototype.decode_struct=function(n){var o={};for(var a in n.struct)o[a]=this.decode_value(n.struct[a]);return o},e}();deserialize$3.BorshDeserializer=BorshDeserializer;var __createBinding$4=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(e,n,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(n,o);(!c||("get"in c?!n.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(e,a,c)}:function(e,n,o,a){a===void 0&&(a=o),e[a]=n[o]}),__setModuleDefault$4=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),__importStar$4=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var o in e)o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)&&__createBinding$4(n,e,o);return __setModuleDefault$4(n,e),n};cjs.__esModule=!0;cjs.deserialize=cjs.serialize=void 0;var serialize_js_1=serialize$7,deserialize_js_1=deserialize$3,utils$h=__importStar$4(utils$j);function serialize$6(e,n,o){o===void 0&&(o=!0),o&&utils$h.validate_schema(e);var a=new serialize_js_1.BorshSerializer(o);return a.encode(n,e)}cjs.serialize=serialize$6;function deserialize$2(e,n,o){o===void 0&&(o=!0),o&&utils$h.validate_schema(e);var a=new deserialize_js_1.BorshDeserializer(n);return a.decode(e)}cjs.deserialize=deserialize$2;var prefix$2={};Object.defineProperty(prefix$2,"__esModule",{value:!0});prefix$2.DelegateActionPrefix=void 0;const types_1$D=lib$l,ACTIONABLE_MESSAGE_BASE$2=Math.pow(2,30),NEP$2={MetaTransactions:366};let NEPPrefix$2=class extends types_1$D.Assignable{},ActionableMessagePrefix$2=class extends NEPPrefix$2{constructor(n){super({prefix:ACTIONABLE_MESSAGE_BASE$2+n})}},DelegateActionPrefix$2=class extends ActionableMessagePrefix$2{constructor(){super(NEP$2.MetaTransactions)}};prefix$2.DelegateActionPrefix=DelegateActionPrefix$2;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SCHEMA=e.SignedTransaction=e.Transaction=e.decodeSignedTransaction=e.decodeTransaction=e.encodeTransaction=e.encodeSignedDelegate=e.encodeDelegateAction=void 0;const n=lib$l,o=cjs,a=prefix$2;function c(v){return new Uint8Array([...(0,o.serialize)(e.SCHEMA.DelegateActionPrefix,new a.DelegateActionPrefix),...(0,o.serialize)(e.SCHEMA.DelegateAction,v)])}e.encodeDelegateAction=c;function l(v){return(0,o.serialize)(e.SCHEMA.SignedDelegate,v)}e.encodeSignedDelegate=l;function u(v){const b=v instanceof p?e.SCHEMA.SignedTransaction:e.SCHEMA.Transaction;return(0,o.serialize)(b,v)}e.encodeTransaction=u;function d(v){return new y((0,o.deserialize)(e.SCHEMA.Transaction,v))}e.decodeTransaction=d;function h(v){return new p((0,o.deserialize)(e.SCHEMA.SignedTransaction,v))}e.decodeSignedTransaction=h;class y extends n.Assignable{encode(){return u(this)}static decode(b){return d(b)}}e.Transaction=y;class p extends n.Assignable{encode(){return u(this)}static decode(b){return h(b)}}e.SignedTransaction=p,e.SCHEMA=new class{constructor(){this.Ed25519Signature={struct:{data:{array:{type:"u8",len:64}}}},this.Secp256k1Signature={struct:{data:{array:{type:"u8",len:65}}}},this.Signature={enum:[{struct:{ed25519Signature:this.Ed25519Signature}},{struct:{secp256k1Signature:this.Secp256k1Signature}}]},this.Ed25519Data={struct:{data:{array:{type:"u8",len:32}}}},this.Secp256k1Data={struct:{data:{array:{type:"u8",len:64}}}},this.PublicKey={enum:[{struct:{ed25519Key:this.Ed25519Data}},{struct:{secp256k1Key:this.Secp256k1Data}}]},this.FunctionCallPermission={struct:{allowance:{option:"u128"},receiverId:"string",methodNames:{array:{type:"string"}}}},this.FullAccessPermission={struct:{}},this.AccessKeyPermission={enum:[{struct:{functionCall:this.FunctionCallPermission}},{struct:{fullAccess:this.FullAccessPermission}}]},this.AccessKey={struct:{nonce:"u64",permission:this.AccessKeyPermission}},this.CreateAccount={struct:{}},this.DeployContract={struct:{code:{array:{type:"u8"}}}},this.FunctionCall={struct:{methodName:"string",args:{array:{type:"u8"}},gas:"u64",deposit:"u128"}},this.Transfer={struct:{deposit:"u128"}},this.Stake={struct:{stake:"u128",publicKey:this.PublicKey}},this.AddKey={struct:{publicKey:this.PublicKey,accessKey:this.AccessKey}},this.DeleteKey={struct:{publicKey:this.PublicKey}},this.DeleteAccount={struct:{beneficiaryId:"string"}},this.DelegateActionPrefix={struct:{prefix:"u32"}},this.ClassicActions={enum:[{struct:{createAccount:this.CreateAccount}},{struct:{deployContract:this.DeployContract}},{struct:{functionCall:this.FunctionCall}},{struct:{transfer:this.Transfer}},{struct:{stake:this.Stake}},{struct:{addKey:this.AddKey}},{struct:{deleteKey:this.DeleteKey}},{struct:{deleteAccount:this.DeleteAccount}}]},this.DelegateAction={struct:{senderId:"string",receiverId:"string",actions:{array:{type:this.ClassicActions}},nonce:"u64",maxBlockHeight:"u64",publicKey:this.PublicKey}},this.SignedDelegate={struct:{delegateAction:this.DelegateAction,signature:this.Signature}},this.Action={enum:[{struct:{createAccount:this.CreateAccount}},{struct:{deployContract:this.DeployContract}},{struct:{functionCall:this.FunctionCall}},{struct:{transfer:this.Transfer}},{struct:{stake:this.Stake}},{struct:{addKey:this.AddKey}},{struct:{deleteKey:this.DeleteKey}},{struct:{deleteAccount:this.DeleteAccount}},{struct:{signedDelegate:this.SignedDelegate}}]},this.Transaction={struct:{signerId:"string",publicKey:this.PublicKey,nonce:"u64",receiverId:"string",blockHash:{array:{type:"u8",len:32}},actions:{array:{type:this.Action}}}},this.SignedTransaction={struct:{transaction:this.Transaction,signature:this.Signature}}}}})(schema$4);Object.defineProperty(create_transaction$2,"__esModule",{value:!0});create_transaction$2.createTransaction=void 0;const schema_1$5=schema$4;function createTransaction$2(e,n,o,a,c,l){const u=typeof a=="bigint"?a:BigInt(a);return new schema_1$5.Transaction({signerId:e,publicKey:n,nonce:u,receiverId:o,actions:c,blockHash:l})}create_transaction$2.createTransaction=createTransaction$2;var delegate$2={};Object.defineProperty(delegate$2,"__esModule",{value:!0});delegate$2.buildDelegateAction=delegate$2.DelegateAction=void 0;const types_1$C=lib$l,action_creators_1$2=action_creators$2,{addKey:addKey$a,createAccount:createAccount$7,deleteAccount:deleteAccount$7,deleteKey:deleteKey$a,deployContract:deployContract$d,functionCall:functionCall$e,stake:stake$7,transfer:transfer$7}=action_creators_1$2.actionCreators;let DelegateAction$2=class extends types_1$C.Assignable{};delegate$2.DelegateAction=DelegateAction$2;function buildDelegateAction$2({actions:e,maxBlockHeight:n,nonce:o,publicKey:a,receiverId:c,senderId:l}){return new DelegateAction$2({senderId:l,receiverId:c,actions:e.map(u=>{if(!u.type&&!u.params)return u;switch(u.type){case"AddKey":{const{publicKey:d,accessKey:h}=u.params;return addKey$a(d,h)}case"CreateAccount":return createAccount$7(u.params.createAccount);case"DeleteAccount":return deleteAccount$7(u.params.deleteAccount);case"DeleteKey":return deleteKey$a(u.params.publicKey);case"DeployContract":return deployContract$d(u.params.code);case"FunctionCall":{const{methodName:d,args:h,gas:y,deposit:p}=u.params;return functionCall$e(d,h,y,p)}case"Stake":return stake$7(u.params.stake,u.params.publicKey);case"Transfer":{const{deposit:d}=u.params;return transfer$7(d)}}throw new Error("Unrecognized action")}),nonce:o,maxBlockHeight:n,publicKey:a})}delegate$2.buildDelegateAction=buildDelegateAction$2;var sign$4={},sha256$2={},_sha2={},_assert$1={};Object.defineProperty(_assert$1,"__esModule",{value:!0});_assert$1.output=_assert$1.exists=_assert$1.hash=_assert$1.bytes=_assert$1.bool=_assert$1.number=void 0;function number(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}_assert$1.number=number;function bool(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}_assert$1.bool=bool;function isBytes$2(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function bytes(e,...n){if(!isBytes$2(e))throw new Error("Expected Uint8Array");if(n.length>0&&!n.includes(e.length))throw new Error(`Expected Uint8Array of length ${n}, not of length=${e.length}`)}_assert$1.bytes=bytes;function hash(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(e.outputLen),number(e.blockLen)}_assert$1.hash=hash;function exists(e,n=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(n&&e.finished)throw new Error("Hash#digest() has already been called")}_assert$1.exists=exists;function output(e,n){bytes(e);const o=n.outputLen;if(e.length<o)throw new Error(`digestInto() expects output buffer of length at least ${o}`)}_assert$1.output=output;const assert$1={number,bool,bytes,hash,exists,output};_assert$1.default=assert$1;var utils$g={},crypto$2={};Object.defineProperty(crypto$2,"__esModule",{value:!0});crypto$2.crypto=void 0;crypto$2.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const n=crypto$2,o=Y=>new Uint8Array(Y.buffer,Y.byteOffset,Y.byteLength);e.u8=o;const a=Y=>new Uint32Array(Y.buffer,Y.byteOffset,Math.floor(Y.byteLength/4));e.u32=a;function c(Y){return Y instanceof Uint8Array||Y!=null&&typeof Y=="object"&&Y.constructor.name==="Uint8Array"}const l=Y=>new DataView(Y.buffer,Y.byteOffset,Y.byteLength);e.createView=l;const u=(Y,Z)=>Y<<32-Z|Y>>>Z;if(e.rotr=u,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const d=Array.from({length:256},(Y,Z)=>Z.toString(16).padStart(2,"0"));function h(Y){if(!c(Y))throw new Error("Uint8Array expected");let Z="";for(let te=0;te<Y.length;te++)Z+=d[Y[te]];return Z}e.bytesToHex=h;const y={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function p(Y){if(Y>=y._0&&Y<=y._9)return Y-y._0;if(Y>=y._A&&Y<=y._F)return Y-(y._A-10);if(Y>=y._a&&Y<=y._f)return Y-(y._a-10)}function v(Y){if(typeof Y!="string")throw new Error("hex string expected, got "+typeof Y);const Z=Y.length,te=Z/2;if(Z%2)throw new Error("padded hex string expected, got unpadded hex of length "+Z);const V=new Uint8Array(te);for(let P=0,A=0;P<te;P++,A+=2){const m=p(Y.charCodeAt(A)),E=p(Y.charCodeAt(A+1));if(m===void 0||E===void 0){const w=Y[A]+Y[A+1];throw new Error('hex string expected, got non-hex character "'+w+'" at index '+A)}V[P]=m*16+E}return V}e.hexToBytes=v;const b=async()=>{};e.nextTick=b;async function _(Y,Z,te){let V=Date.now();for(let P=0;P<Y;P++){te(P);const A=Date.now()-V;A>=0&&A<Z||(await(0,e.nextTick)(),V+=A)}}e.asyncLoop=_;function T(Y){if(typeof Y!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Y}`);return new Uint8Array(new TextEncoder().encode(Y))}e.utf8ToBytes=T;function I(Y){if(typeof Y=="string"&&(Y=T(Y)),!c(Y))throw new Error(`expected Uint8Array, got ${typeof Y}`);return Y}e.toBytes=I;function U(...Y){let Z=0;for(let V=0;V<Y.length;V++){const P=Y[V];if(!c(P))throw new Error("Uint8Array expected");Z+=P.length}const te=new Uint8Array(Z);for(let V=0,P=0;V<Y.length;V++){const A=Y[V];te.set(A,P),P+=A.length}return te}e.concatBytes=U;class N{clone(){return this._cloneInto()}}e.Hash=N;const D={}.toString;function L(Y,Z){if(Z!==void 0&&D.call(Z)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(Y,Z)}e.checkOpts=L;function B(Y){const Z=V=>Y().update(I(V)).digest(),te=Y();return Z.outputLen=te.outputLen,Z.blockLen=te.blockLen,Z.create=()=>Y(),Z}e.wrapConstructor=B;function H(Y){const Z=(V,P)=>Y(P).update(I(V)).digest(),te=Y({});return Z.outputLen=te.outputLen,Z.blockLen=te.blockLen,Z.create=V=>Y(V),Z}e.wrapConstructorWithOpts=H;function W(Y){const Z=(V,P)=>Y(P).update(I(V)).digest(),te=Y({});return Z.outputLen=te.outputLen,Z.blockLen=te.blockLen,Z.create=V=>Y(V),Z}e.wrapXOFConstructorWithOpts=W;function X(Y=32){if(n.crypto&&typeof n.crypto.getRandomValues=="function")return n.crypto.getRandomValues(new Uint8Array(Y));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=X})(utils$g);Object.defineProperty(_sha2,"__esModule",{value:!0});_sha2.SHA2=void 0;const _assert_js_1$1=_assert$1,utils_js_1$8=utils$g;function setBigUint64$1(e,n,o,a){if(typeof e.setBigUint64=="function")return e.setBigUint64(n,o,a);const c=BigInt(32),l=BigInt(4294967295),u=Number(o>>c&l),d=Number(o&l),h=a?4:0,y=a?0:4;e.setUint32(n+h,u,a),e.setUint32(n+y,d,a)}class SHA2 extends utils_js_1$8.Hash{constructor(n,o,a,c){super(),this.blockLen=n,this.outputLen=o,this.padOffset=a,this.isLE=c,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(n),this.view=(0,utils_js_1$8.createView)(this.buffer)}update(n){(0,_assert_js_1$1.exists)(this);const{view:o,buffer:a,blockLen:c}=this;n=(0,utils_js_1$8.toBytes)(n);const l=n.length;for(let u=0;u<l;){const d=Math.min(c-this.pos,l-u);if(d===c){const h=(0,utils_js_1$8.createView)(n);for(;c<=l-u;u+=c)this.process(h,u);continue}a.set(n.subarray(u,u+d),this.pos),this.pos+=d,u+=d,this.pos===c&&(this.process(o,0),this.pos=0)}return this.length+=n.length,this.roundClean(),this}digestInto(n){(0,_assert_js_1$1.exists)(this),(0,_assert_js_1$1.output)(n,this),this.finished=!0;const{buffer:o,view:a,blockLen:c,isLE:l}=this;let{pos:u}=this;o[u++]=128,this.buffer.subarray(u).fill(0),this.padOffset>c-u&&(this.process(a,0),u=0);for(let v=u;v<c;v++)o[v]=0;setBigUint64$1(a,c-8,BigInt(this.length*8),l),this.process(a,0);const d=(0,utils_js_1$8.createView)(n),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const y=h/4,p=this.get();if(y>p.length)throw new Error("_sha2: outputLen bigger than state");for(let v=0;v<y;v++)d.setUint32(4*v,p[v],l)}digest(){const{buffer:n,outputLen:o}=this;this.digestInto(n);const a=n.slice(0,o);return this.destroy(),a}_cloneInto(n){n||(n=new this.constructor),n.set(...this.get());const{blockLen:o,buffer:a,length:c,finished:l,destroyed:u,pos:d}=this;return n.length=c,n.pos=d,n.finished=l,n.destroyed=u,c%o&&n.buffer.set(a),n}}_sha2.SHA2=SHA2;Object.defineProperty(sha256$2,"__esModule",{value:!0});sha256$2.sha224=sha256$2.sha256=void 0;const _sha2_js_1=_sha2,utils_js_1$7=utils$g,Chi$1=(e,n,o)=>e&n^~e&o,Maj$1=(e,n,o)=>e&n^e&o^n&o,SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends _sha2_js_1.SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:n,B:o,C:a,D:c,E:l,F:u,G:d,H:h}=this;return[n,o,a,c,l,u,d,h]}set(n,o,a,c,l,u,d,h){this.A=n|0,this.B=o|0,this.C=a|0,this.D=c|0,this.E=l|0,this.F=u|0,this.G=d|0,this.H=h|0}process(n,o){for(let v=0;v<16;v++,o+=4)SHA256_W[v]=n.getUint32(o,!1);for(let v=16;v<64;v++){const b=SHA256_W[v-15],_=SHA256_W[v-2],T=(0,utils_js_1$7.rotr)(b,7)^(0,utils_js_1$7.rotr)(b,18)^b>>>3,I=(0,utils_js_1$7.rotr)(_,17)^(0,utils_js_1$7.rotr)(_,19)^_>>>10;SHA256_W[v]=I+SHA256_W[v-7]+T+SHA256_W[v-16]|0}let{A:a,B:c,C:l,D:u,E:d,F:h,G:y,H:p}=this;for(let v=0;v<64;v++){const b=(0,utils_js_1$7.rotr)(d,6)^(0,utils_js_1$7.rotr)(d,11)^(0,utils_js_1$7.rotr)(d,25),_=p+b+Chi$1(d,h,y)+SHA256_K[v]+SHA256_W[v]|0,I=((0,utils_js_1$7.rotr)(a,2)^(0,utils_js_1$7.rotr)(a,13)^(0,utils_js_1$7.rotr)(a,22))+Maj$1(a,c,l)|0;p=y,y=h,h=d,d=u+_|0,u=l,l=c,c=a,a=_+I|0}a=a+this.A|0,c=c+this.B|0,l=l+this.C|0,u=u+this.D|0,d=d+this.E|0,h=h+this.F|0,y=y+this.G|0,p=p+this.H|0,this.set(a,c,l,u,d,h,y,p)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class SHA224 extends SHA256{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}sha256$2.sha256=(0,utils_js_1$7.wrapConstructor)(()=>new SHA256);sha256$2.sha224=(0,utils_js_1$7.wrapConstructor)(()=>new SHA224);var signature$2={};Object.defineProperty(signature$2,"__esModule",{value:!0});signature$2.Signature=void 0;const crypto_1$s=lib$n,types_1$B=lib$l;class ED25519Signature extends types_1$B.Assignable{constructor(){super(...arguments),this.keyType=crypto_1$s.KeyType.ED25519}}class SECP256K1Signature extends types_1$B.Assignable{constructor(){super(...arguments),this.keyType=crypto_1$s.KeyType.SECP256K1}}let Signature$2=class extends types_1$B.Assignable{constructor({keyType:n,data:o}){super({}),n===crypto_1$s.KeyType.ED25519?this.ed25519Signature={keyType:n,data:o}:n===crypto_1$s.KeyType.SECP256K1&&(this.secp256k1Signature={keyType:n,data:o})}get signature(){return this.ed25519Signature||this.secp256k1Signature}get signatureType(){return this.signature.keyType}get data(){return this.signature.data}};signature$2.Signature=Signature$2;var __awaiter$14=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(sign$4,"__esModule",{value:!0});sign$4.signDelegateAction=sign$4.signTransaction=void 0;const sha256_1$6=sha256$2,actions_1$5=actions$3,create_transaction_1$2=create_transaction$2,schema_1$4=schema$4,signature_1$2=signature$2,crypto_1$r=lib$n;function signTransactionObject$2(e,n,o,a){return __awaiter$14(this,void 0,void 0,function*(){const c=(0,schema_1$4.encodeTransaction)(e),l=new Uint8Array((0,sha256_1$6.sha256)(c)),u=yield n.signMessage(c,o,a),d=e.publicKey.ed25519Key?crypto_1$r.KeyType.ED25519:crypto_1$r.KeyType.SECP256K1,h=new schema_1$4.SignedTransaction({transaction:e,signature:new signature_1$2.Signature({keyType:d,data:u.signature})});return[l,h]})}function signTransaction$2(...e){return __awaiter$14(this,void 0,void 0,function*(){if(e[0].constructor===schema_1$4.Transaction){const[n,o,a,c]=e;return signTransactionObject$2(n,o,a,c)}else{const[n,o,a,c,l,u,d]=e,h=yield l.getPublicKey(u,d),y=(0,create_transaction_1$2.createTransaction)(u,h,n,o,a,c);return signTransactionObject$2(y,l,u,d)}})}sign$4.signTransaction=signTransaction$2;function signDelegateAction$2({delegateAction:e,signer:n}){return __awaiter$14(this,void 0,void 0,function*(){const o=(0,schema_1$4.encodeDelegateAction)(e),a=yield n.sign(o),c=e.publicKey.ed25519Key?crypto_1$r.KeyType.ED25519:crypto_1$r.KeyType.SECP256K1,l=new actions_1$5.SignedDelegate({delegateAction:e,signature:new signature_1$2.Signature({keyType:c,data:a})});return{hash:new Uint8Array((0,sha256_1$6.sha256)(o)),signedDelegateAction:l}})}sign$4.signDelegateAction=signDelegateAction$2;(function(e){var n=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(a,c,l,u){u===void 0&&(u=l);var d=Object.getOwnPropertyDescriptor(c,l);(!d||("get"in d?!c.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return c[l]}}),Object.defineProperty(a,u,d)}:function(a,c,l,u){u===void 0&&(u=l),a[u]=c[l]}),o=commonjsGlobal$c&&commonjsGlobal$c.__exportStar||function(a,c){for(var l in a)l!=="default"&&!Object.prototype.hasOwnProperty.call(c,l)&&n(c,a,l)};Object.defineProperty(e,"__esModule",{value:!0}),o(action_creators$2,e),o(actions$3,e),o(create_transaction$2,e),o(delegate$2,e),o(schema$4,e),o(sign$4,e),o(signature$2,e)})(lib$h);var provider$7={};Object.defineProperty(provider$7,"__esModule",{value:!0});provider$7.Provider=void 0;let Provider$3=class{};provider$7.Provider=Provider$3;var fetch_json$2={},httpErrors={exports:{}};/*!* depd* Copyright(c) 2015 Douglas Christopher Wilson* MIT Licensed*/var browser$3=depd;function depd(e){if(!e)throw new TypeError("argument namespace is required");function n(o){}return n._file=void 0,n._ignored=!0,n._namespace=e,n._traced=!1,n._warned=Object.create(null),n.function=wrapfunction,n.property=wrapproperty,n}function wrapfunction(e,n){if(typeof e!="function")throw new TypeError("argument fn must be a function");return e}function wrapproperty(e,n,o){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("argument obj must be object");var a=Object.getOwnPropertyDescriptor(e,n);if(!a)throw new TypeError("must call property on owner object");if(!a.configurable)throw new TypeError("property must be configurable")}var setprototypeof=Object.setPrototypeOf||({__proto__:[]}instanceof Array?setProtoOf:mixinProperties);function setProtoOf(e,n){return e.__proto__=n,e}function mixinProperties(e,n){for(var o in n)e.hasOwnProperty(o)||(e[o]=n[o]);return e}const require$$0$4={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"(Unused)",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};/*!* statuses* Copyright(c) 2014 Jonathan Ong* Copyright(c) 2016 Douglas Christopher Wilson* MIT Licensed*/var codes=require$$0$4,statuses=status;status.STATUS_CODES=codes;status.codes=populateStatusesMap(status,codes);status.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0};status.empty={204:!0,205:!0,304:!0};status.retry={502:!0,503:!0,504:!0};function populateStatusesMap(e,n){var o=[];return Object.keys(n).forEach(function(c){var l=n[c],u=Number(c);e[u]=l,e[l]=u,e[l.toLowerCase()]=u,o.push(u)}),o}function status(e){if(typeof e=="number"){if(!status[e])throw new Error("invalid status code: "+e);return e}if(typeof e!="string")throw new TypeError("code must be a number or string");var n=parseInt(e,10);if(!isNaN(n)){if(!status[n])throw new Error("invalid status code: "+n);return n}if(n=status[e.toLowerCase()],!n)throw new Error('invalid status message: "'+e+'"');return n}var inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(n,o){n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}:inherits_browser.exports=function(n,o){n.super_=o;var a=function(){};a.prototype=o.prototype,n.prototype=new a,n.prototype.constructor=n};var inherits_browserExports=inherits_browser.exports;/*!* toidentifier* Copyright(c) 2016 Douglas Christopher Wilson* MIT Licensed*/var toidentifier=toIdentifier;function toIdentifier(e){return e.split(" ").map(function(n){return n.slice(0,1).toUpperCase()+n.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}/*!* http-errors* Copyright(c) 2014 Jonathan Ong* Copyright(c) 2016 Douglas Christopher Wilson* MIT Licensed*/(function(e){var n=browser$3("http-errors"),o=setprototypeof,a=statuses,c=inherits_browserExports,l=toidentifier;e.exports=d,e.exports.HttpError=h(),b(e.exports,a.codes,e.exports.HttpError);function u(_){return+(String(_).charAt(0)+"00")}function d(){for(var _,T,I=500,U={},N=0;N<arguments.length;N++){var D=arguments[N];if(D instanceof Error){_=D,I=_.status||_.statusCode||I;continue}switch(typeof D){case"string":T=D;break;case"number":I=D;break;case"object":U=D;break}}(typeof I!="number"||!a[I]&&(I<400||I>=600))&&(I=500);var L=d[I]||d[u(I)];_||(_=L?new L(T):new Error(T||a[I]),Error.captureStackTrace(_,d)),(!L||!(_ instanceof L)||_.status!==I)&&(_.expose=I<500,_.status=_.statusCode=I);for(var B in U)B!=="status"&&B!=="statusCode"&&(_[B]=U[B]);return _}function h(){function _(){throw new TypeError("cannot construct abstract class")}return c(_,Error),_}function y(_,T,I){var U=T.match(/Error$/)?T:T+"Error";function N(D){var L=D??a[I],B=new Error(L);return Error.captureStackTrace(B,N),o(B,N.prototype),Object.defineProperty(B,"message",{enumerable:!0,configurable:!0,value:L,writable:!0}),Object.defineProperty(B,"name",{enumerable:!1,configurable:!0,value:U,writable:!0}),B}return c(N,_),v(N,U),N.prototype.status=I,N.prototype.statusCode=I,N.prototype.expose=!0,N}function p(_,T,I){var U=T.match(/Error$/)?T:T+"Error";function N(D){var L=D??a[I],B=new Error(L);return Error.captureStackTrace(B,N),o(B,N.prototype),Object.defineProperty(B,"message",{enumerable:!0,configurable:!0,value:L,writable:!0}),Object.defineProperty(B,"name",{enumerable:!1,configurable:!0,value:U,writable:!0}),B}return c(N,_),v(N,U),N.prototype.status=I,N.prototype.statusCode=I,N.prototype.expose=!1,N}function v(_,T){var I=Object.getOwnPropertyDescriptor(_,"name");I&&I.configurable&&(I.value=T,Object.defineProperty(_,"name",I))}function b(_,T,I){T.forEach(function(N){var D,L=l(a[N]);switch(u(N)){case 400:D=y(I,L,N);break;case 500:D=p(I,L,N);break}D&&(_[N]=D,_[L]=D)}),_["I'mateapot"]=n.function(_.ImATeapot,`"I'mateapot"; use "ImATeapot" instead`)}})(httpErrors);var httpErrorsExports=httpErrors.exports,fetch$2={},browser$2={exports:{}},hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=1,function(e,n){var o=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof a<"u")return a;throw new Error("unable to locate global object")},a=o();e.exports=n=a.fetch,a.fetch&&(n.default=a.fetch.bind(a)),n.Headers=a.Headers,n.Request=a.Request,n.Response=a.Response}(browser$2,browser$2.exports)),browser$2.exports}var hasRequiredFetch$1;function requireFetch$1(){if(hasRequiredFetch$1)return fetch$2;hasRequiredFetch$1=1;var e=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(fetch$2,"__esModule",{value:!0});const n=e(requireBrowser()),o=e(require$$4$3),a=e(require$$4$3),c=new o.default.Agent({keepAlive:!0}),l=new a.default.Agent({keepAlive:!0});function u(h){return h.protocol==="http:"?c:l}function d(h,y){return(0,n.default)(h,Object.assign({agent:u(new URL(h.toString()))},y))}return fetch$2.default=d,fetch$2}var __createBinding$3=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(e,n,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(n,o);(!c||("get"in c?!n.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(e,a,c)}:function(e,n,o,a){a===void 0&&(a=o),e[a]=n[o]}),__setModuleDefault$3=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),__importStar$3=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var o in e)o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)&&__createBinding$3(n,e,o);return __setModuleDefault$3(n,e),n},__awaiter$13=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})},__importDefault$n=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fetch_json$2,"__esModule",{value:!0});fetch_json$2.fetchJson=void 0;const types_1$A=lib$l,utils_1$G=lib$m,http_errors_1$1=__importDefault$n(httpErrorsExports),exponential_backoff_1$4=exponentialBackoff$5,START_WAIT_TIME_MS$1=1e3,BACKOFF_MULTIPLIER$2=1.5,RETRY_NUMBER$2=10;function fetchJson$1(e,n){return __awaiter$13(this,void 0,void 0,function*(){let o={url:null};typeof e=="string"?o.url=e:o=e;const a=yield(0,exponential_backoff_1$4.exponentialBackoff)(START_WAIT_TIME_MS$1,RETRY_NUMBER$2,BACKOFF_MULTIPLIER$2,()=>__awaiter$13(this,void 0,void 0,function*(){var c;try{const l=yield((c=globalThis.fetch)!==null&&c!==void 0?c:(yield Promise.resolve().then(()=>__importStar$3(requireFetch$1()))).default)(o.url,{method:n?"POST":"GET",body:n||void 0,headers:Object.assign(Object.assign({},o.headers),{"Content-Type":"application/json"})});if(!l.ok){if(l.status===503)return utils_1$G.Logger.warn(`Retrying HTTP request for ${o.url} as it's not available now`),null;if(l.status===408)return utils_1$G.Logger.warn(`Retrying HTTP request for ${o.url} as the previous connection was unused for some time`),null;throw(0,http_errors_1$1.default)(l.status,yield l.text())}return l}catch(l){if(l.toString().includes("FetchError")||l.toString().includes("Failed to fetch"))return utils_1$G.Logger.warn(`Retrying HTTP request for ${o.url} because of error: ${l}`),null;throw l}}));if(!a)throw new types_1$A.TypedError(`Exceeded ${RETRY_NUMBER$2} attempts for ${o.url}.`,"RetriesExceeded");return yield a.json()})}fetch_json$2.fetchJson=fetchJson$1;var __awaiter$12=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})},__rest$8=commonjsGlobal$c&&commonjsGlobal$c.__rest||function(e,n){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,a=Object.getOwnPropertySymbols(e);c<a.length;c++)n.indexOf(a[c])<0&&Object.prototype.propertyIsEnumerable.call(e,a[c])&&(o[a[c]]=e[a[c]]);return o};Object.defineProperty(jsonRpcProvider$5,"__esModule",{value:!0});jsonRpcProvider$5.JsonRpcProvider=void 0;const utils_1$F=lib$m,types_1$z=lib$l,transactions_1$g=lib$h,exponential_backoff_1$3=exponentialBackoff$5,provider_1$5=provider$7,fetch_json_1$2=fetch_json$2,REQUEST_RETRY_NUMBER$2=12,REQUEST_RETRY_WAIT$2=500,REQUEST_RETRY_WAIT_BACKOFF$2=1.5;let _nextId$2=123,JsonRpcProvider$2=class extends provider_1$5.Provider{constructor(n,o){super(),this.connection=n||{url:""};const a={retries:REQUEST_RETRY_NUMBER$2,wait:REQUEST_RETRY_WAIT$2,backoff:REQUEST_RETRY_WAIT_BACKOFF$2};this.options=Object.assign({},a,o)}status(){return __awaiter$12(this,void 0,void 0,function*(){return this.sendJsonRpc("status",[])})}sendTransactionUntil(n,o){return __awaiter$12(this,void 0,void 0,function*(){const a=(0,transactions_1$g.encodeTransaction)(n);return this.sendJsonRpc("send_tx",{signed_tx_base64:Buffer.from(a).toString("base64"),wait_until:o})})}sendTransaction(n){return __awaiter$12(this,void 0,void 0,function*(){return this.sendTransactionUntil(n,"EXECUTED_OPTIMISTIC")})}sendTransactionAsync(n){return __awaiter$12(this,void 0,void 0,function*(){return this.sendTransactionUntil(n,"NONE")})}txStatus(n,o,a="EXECUTED_OPTIMISTIC"){return __awaiter$12(this,void 0,void 0,function*(){return typeof n=="string"?this.txStatusString(n,o,a):this.txStatusUint8Array(n,o,a)})}txStatusUint8Array(n,o,a){return __awaiter$12(this,void 0,void 0,function*(){return this.sendJsonRpc("tx",{tx_hash:(0,utils_1$F.baseEncode)(n),sender_account_id:o,wait_until:a})})}txStatusString(n,o,a){return __awaiter$12(this,void 0,void 0,function*(){return this.sendJsonRpc("tx",{tx_hash:n,sender_account_id:o,wait_until:a})})}txStatusReceipts(n,o,a="EXECUTED_OPTIMISTIC"){return __awaiter$12(this,void 0,void 0,function*(){return typeof n=="string"?this.sendJsonRpc("EXPERIMENTAL_tx_status",{tx_hash:n,sender_account_id:o,wait_until:a}):this.sendJsonRpc("EXPERIMENTAL_tx_status",{tx_hash:(0,utils_1$F.baseEncode)(n),sender_account_id:o,wait_until:a})})}query(...n){return __awaiter$12(this,void 0,void 0,function*(){let o;if(n.length===1){const a=n[0],{block_id:c,blockId:l}=a,u=__rest$8(a,["block_id","blockId"]);o=yield this.sendJsonRpc("query",Object.assign(Object.assign({},u),{block_id:c||l}))}else{const[a,c]=n;o=yield this.sendJsonRpc("query",[a,c])}if(o&&o.error)throw new types_1$z.TypedError(`Querying failed: ${o.error}.${JSON.stringify(o,null,2)}`,(0,utils_1$F.getErrorTypeFromErrorMessage)(o.error,o.error.name));return o})}block(n){return __awaiter$12(this,void 0,void 0,function*(){const{finality:o}=n,{blockId:a}=n;return this.sendJsonRpc("block",{block_id:a,finality:o})})}blockChanges(n){return __awaiter$12(this,void 0,void 0,function*(){const{finality:o}=n,{blockId:a}=n;return this.sendJsonRpc("EXPERIMENTAL_changes_in_block",{block_id:a,finality:o})})}chunk(n){return __awaiter$12(this,void 0,void 0,function*(){return this.sendJsonRpc("chunk",[n])})}validators(n){return __awaiter$12(this,void 0,void 0,function*(){return this.sendJsonRpc("validators",[n])})}experimental_protocolConfig(n){return __awaiter$12(this,void 0,void 0,function*(){const o=n,{blockId:a}=o,c=__rest$8(o,["blockId"]);return yield this.sendJsonRpc("EXPERIMENTAL_protocol_config",Object.assign(Object.assign({},c),{block_id:a}))})}lightClientProof(n){return __awaiter$12(this,void 0,void 0,function*(){return yield this.sendJsonRpc("EXPERIMENTAL_light_client_proof",n)})}nextLightClientBlock(n){return __awaiter$12(this,void 0,void 0,function*(){return yield this.sendJsonRpc("next_light_client_block",n)})}accessKeyChanges(n,o){return __awaiter$12(this,void 0,void 0,function*(){const{finality:a}=o,{blockId:c}=o;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"all_access_key_changes",account_ids:n,block_id:c,finality:a})})}singleAccessKeyChanges(n,o){return __awaiter$12(this,void 0,void 0,function*(){const{finality:a}=o,{blockId:c}=o;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"single_access_key_changes",keys:n,block_id:c,finality:a})})}accountChanges(n,o){return __awaiter$12(this,void 0,void 0,function*(){const{finality:a}=o,{blockId:c}=o;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"account_changes",account_ids:n,block_id:c,finality:a})})}contractStateChanges(n,o,a=""){return __awaiter$12(this,void 0,void 0,function*(){const{finality:c}=o,{blockId:l}=o;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"data_changes",account_ids:n,key_prefix_base64:a,block_id:l,finality:c})})}contractCodeChanges(n,o){return __awaiter$12(this,void 0,void 0,function*(){const{finality:a}=o,{blockId:c}=o;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"contract_code_changes",account_ids:n,block_id:c,finality:a})})}gasPrice(n){return __awaiter$12(this,void 0,void 0,function*(){return yield this.sendJsonRpc("gas_price",[n])})}sendJsonRpc(n,o){return __awaiter$12(this,void 0,void 0,function*(){const a=yield(0,exponential_backoff_1$3.exponentialBackoff)(this.options.wait,this.options.retries,this.options.backoff,()=>__awaiter$12(this,void 0,void 0,function*(){var l;try{const u={method:n,params:o,id:_nextId$2++,jsonrpc:"2.0"},d=yield(0,fetch_json_1$2.fetchJson)(this.connection,JSON.stringify(u));if(d.error){if(typeof d.error.data=="object")throw typeof d.error.data.error_message=="string"&&typeof d.error.data.error_type=="string"?new types_1$z.TypedError(d.error.data.error_message,d.error.data.error_type):(0,utils_1$F.parseRpcError)(d.error.data);{const h=`[${d.error.code}] ${d.error.message}: ${d.error.data}`;if(d.error.data==="Timeout"||h.includes("Timeout error")||h.includes("query has timed out"))throw new types_1$z.TypedError(h,"TimeoutError");const y=(0,utils_1$F.getErrorTypeFromErrorMessage)(d.error.data,"");throw y?new types_1$z.TypedError((0,utils_1$F.formatError)(y,o),y):new types_1$z.TypedError(h,d.error.name)}}else if(typeof((l=d.result)===null||l===void 0?void 0:l.error)=="string"){const h=(0,utils_1$F.getErrorTypeFromErrorMessage)(d.result.error,"");if(h)throw new utils_1$F.ServerError((0,utils_1$F.formatError)(h,o),h)}return d}catch(u){if(u.type==="TimeoutError")return utils_1$F.Logger.warn(`Retrying request to ${n} as it has timed out`,o),null;throw u}})),{result:c}=a;if(typeof c>"u")throw new types_1$z.TypedError(`Exceeded ${this.options.retries} attempts for request to ${n}.`,"RetriesExceeded");return c})}};jsonRpcProvider$5.JsonRpcProvider=JsonRpcProvider$2;var failoverRpcProvider$5={},__awaiter$11=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(failoverRpcProvider$5,"__esModule",{value:!0});failoverRpcProvider$5.FailoverRpcProvider=void 0;const utils_1$E=lib$m,types_1$y=lib$l,provider_1$4=provider$7;let FailoverRpcProvider$2=class extends provider_1$4.Provider{constructor(n){if(super(),n.length===0)throw new Error("At least one provider must be specified");this.providers=n,this.currentProviderIndex=0}switchToNextProvider(){this.providers.length!==1&&(this.providers.length-1<=this.currentProviderIndex?this.currentProviderIndex=0:this.currentProviderIndex+=1,utils_1$E.Logger.debug(`Switched to provider at the index ${this.currentProviderIndex}`))}get currentProvider(){const n=this.providers[this.currentProviderIndex];if(!n)throw new Error(`Provider wasn't found at index ${this.currentProviderIndex}`);return n}withBackoff(n){return __awaiter$11(this,void 0,void 0,function*(){for(let o=0;o<this.providers.length;o++)try{const a=yield n(this.currentProvider);if(a)return a}catch{this.switchToNextProvider()}throw new types_1$y.TypedError(`Exceeded ${this.providers.length} providers to execute request`,"RetriesExceeded")})}status(){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(n=>n.status())})}sendTransactionUntil(n,o){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(a=>a.sendTransactionUntil(n,o))})}sendTransaction(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.sendTransaction(n))})}sendTransactionAsync(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.sendTransactionAsync(n))})}txStatus(n,o,a){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(c=>c.txStatus(n,o,a))})}txStatusReceipts(n,o,a){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(c=>c.txStatusReceipts(n,o,a))})}query(n,o){return __awaiter$11(this,void 0,void 0,function*(){return o?this.withBackoff(a=>a.query(n,o)):this.withBackoff(a=>a.query(n))})}block(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.block(n))})}blockChanges(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.blockChanges(n))})}chunk(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.chunk(n))})}validators(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.validators(n))})}experimental_protocolConfig(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.experimental_protocolConfig(n))})}lightClientProof(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.lightClientProof(n))})}nextLightClientBlock(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.nextLightClientBlock(n))})}accessKeyChanges(n,o){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(a=>a.accessKeyChanges(n,o))})}singleAccessKeyChanges(n,o){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(a=>a.singleAccessKeyChanges(n,o))})}accountChanges(n,o){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(a=>a.accountChanges(n,o))})}contractStateChanges(n,o,a=""){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(c=>c.contractStateChanges(n,o,a))})}contractCodeChanges(n,o){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(a=>a.contractCodeChanges(n,o))})}gasPrice(n){return __awaiter$11(this,void 0,void 0,function*(){return this.withBackoff(o=>o.gasPrice(n))})}};failoverRpcProvider$5.FailoverRpcProvider=FailoverRpcProvider$2;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fetchJson=e.Provider=e.FailoverRpcProvider=e.JsonRpcProvider=e.exponentialBackoff=void 0;var n=exponentialBackoff$5;Object.defineProperty(e,"exponentialBackoff",{enumerable:!0,get:function(){return n.exponentialBackoff}});var o=jsonRpcProvider$5;Object.defineProperty(e,"JsonRpcProvider",{enumerable:!0,get:function(){return o.JsonRpcProvider}});var a=failoverRpcProvider$5;Object.defineProperty(e,"FailoverRpcProvider",{enumerable:!0,get:function(){return a.FailoverRpcProvider}});var c=provider$7;Object.defineProperty(e,"Provider",{enumerable:!0,get:function(){return c.Provider}});var l=fetch_json$2;Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return l.fetchJson}})})(lib$i);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FinalExecutionStatusBasic=e.ExecutionStatusBasic=e.IdType=e.Provider=e.getTransactionLastResult=void 0;var n=lib$m;Object.defineProperty(e,"getTransactionLastResult",{enumerable:!0,get:function(){return n.getTransactionLastResult}});var o=lib$i;Object.defineProperty(e,"Provider",{enumerable:!0,get:function(){return o.Provider}});var a=lib$l;Object.defineProperty(e,"IdType",{enumerable:!0,get:function(){return a.IdType}}),Object.defineProperty(e,"ExecutionStatusBasic",{enumerable:!0,get:function(){return a.ExecutionStatusBasic}}),Object.defineProperty(e,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return a.FinalExecutionStatusBasic}})})(provider$8);var jsonRpcProvider$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.JsonRpcProvider=e.TypedError=e.ErrorContext=void 0;var n=lib$l;Object.defineProperty(e,"ErrorContext",{enumerable:!0,get:function(){return n.ErrorContext}}),Object.defineProperty(e,"TypedError",{enumerable:!0,get:function(){return n.TypedError}});var o=lib$i;Object.defineProperty(e,"JsonRpcProvider",{enumerable:!0,get:function(){return o.JsonRpcProvider}})})(jsonRpcProvider$4);var failoverRpcProvider$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FailoverRpcProvider=void 0;var n=lib$i;Object.defineProperty(e,"FailoverRpcProvider",{enumerable:!0,get:function(){return n.FailoverRpcProvider}})})(failoverRpcProvider$4);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorContext=e.TypedError=e.getTransactionLastResult=e.FinalExecutionStatusBasic=e.FailoverRpcProvider=e.JsonRpcProvider=e.Provider=void 0;const n=provider$8;Object.defineProperty(e,"Provider",{enumerable:!0,get:function(){return n.Provider}}),Object.defineProperty(e,"getTransactionLastResult",{enumerable:!0,get:function(){return n.getTransactionLastResult}}),Object.defineProperty(e,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return n.FinalExecutionStatusBasic}});const o=jsonRpcProvider$4;Object.defineProperty(e,"JsonRpcProvider",{enumerable:!0,get:function(){return o.JsonRpcProvider}}),Object.defineProperty(e,"TypedError",{enumerable:!0,get:function(){return o.TypedError}}),Object.defineProperty(e,"ErrorContext",{enumerable:!0,get:function(){return o.ErrorContext}});const a=failoverRpcProvider$4;Object.defineProperty(e,"FailoverRpcProvider",{enumerable:!0,get:function(){return a.FailoverRpcProvider}})})(providers$2);var utils$f={},key_pair$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.KeyType=e.KeyPairEd25519=e.KeyPair=void 0;var n=lib$n;Object.defineProperty(e,"KeyPair",{enumerable:!0,get:function(){return n.KeyPair}}),Object.defineProperty(e,"KeyPairEd25519",{enumerable:!0,get:function(){return n.KeyPairEd25519}}),Object.defineProperty(e,"KeyType",{enumerable:!0,get:function(){return n.KeyType}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})})(key_pair$4);var serialize$5={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.base_decode=e.base_encode=e.deserialize=e.serialize=void 0;var n=cjs;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return n.serialize}}),Object.defineProperty(e,"deserialize",{enumerable:!0,get:function(){return n.deserialize}});var o=lib$m;Object.defineProperty(e,"base_encode",{enumerable:!0,get:function(){return o.baseEncode}}),Object.defineProperty(e,"base_decode",{enumerable:!0,get:function(){return o.baseDecode}})})(serialize$5);var web$1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fetchJson=void 0;var n=lib$i;Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return n.fetchJson}})})(web$1);var enums$2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Enum=e.Assignable=void 0;var n=lib$l;Object.defineProperty(e,"Assignable",{enumerable:!0,get:function(){return n.Assignable}});class o{constructor(c){if(Object.keys(c).length!==1)throw new Error("Enum can only take single value");Object.keys(c).map(l=>{this[l]=c[l],this.enum=l})}}e.Enum=o})(enums$2);var format$5={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseNearAmount=e.formatNearAmount=e.NEAR_NOMINATION_EXP=e.NEAR_NOMINATION=void 0;var n=lib$m;Object.defineProperty(e,"NEAR_NOMINATION",{enumerable:!0,get:function(){return n.NEAR_NOMINATION}}),Object.defineProperty(e,"NEAR_NOMINATION_EXP",{enumerable:!0,get:function(){return n.NEAR_NOMINATION_EXP}}),Object.defineProperty(e,"formatNearAmount",{enumerable:!0,get:function(){return n.formatNearAmount}}),Object.defineProperty(e,"parseNearAmount",{enumerable:!0,get:function(){return n.parseNearAmount}})})(format$5);var rpc_errors$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ServerError=e.getErrorTypeFromErrorMessage=e.formatError=e.parseResultError=e.parseRpcError=void 0;var n=lib$m;Object.defineProperty(e,"parseRpcError",{enumerable:!0,get:function(){return n.parseRpcError}}),Object.defineProperty(e,"parseResultError",{enumerable:!0,get:function(){return n.parseResultError}}),Object.defineProperty(e,"formatError",{enumerable:!0,get:function(){return n.formatError}}),Object.defineProperty(e,"getErrorTypeFromErrorMessage",{enumerable:!0,get:function(){return n.getErrorTypeFromErrorMessage}}),Object.defineProperty(e,"ServerError",{enumerable:!0,get:function(){return n.ServerError}})})(rpc_errors$4);var errors$c={},lib$g={},account$5={},utils$e={},__awaiter$10=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(utils$e,"__esModule",{value:!0});utils$e.viewFunction=utils$e.viewState=utils$e.encodeJSContractArgs=utils$e.validateArgs=void 0;const types_1$x=lib$l,utils_1$D=lib$m;function parseJsonFromRawResponse$2(e){return JSON.parse(Buffer.from(e).toString())}function bytesJsonStringify$2(e){return Buffer.from(JSON.stringify(e))}function validateArgs$2(e){if(!(e.byteLength!==void 0&&e.byteLength===e.length)&&(Array.isArray(e)||typeof e!="object"))throw new types_1$x.PositionalArgsError}utils$e.validateArgs=validateArgs$2;function encodeJSContractArgs$2(e,n,o){return Buffer.concat([Buffer.from(e),Buffer.from([0]),Buffer.from(n),Buffer.from([0]),Buffer.from(o)])}utils$e.encodeJSContractArgs=encodeJSContractArgs$2;function viewState$2(e,n,o,a={finality:"optimistic"}){return __awaiter$10(this,void 0,void 0,function*(){const{values:c}=yield e.provider.query(Object.assign(Object.assign({request_type:"view_state"},a),{account_id:n,prefix_base64:Buffer.from(o).toString("base64")}));return c.map(({key:l,value:u})=>({key:Buffer.from(l,"base64"),value:Buffer.from(u,"base64")}))})}utils$e.viewState=viewState$2;function viewFunction$2(e,{contractId:n,methodName:o,args:a={},parse:c=parseJsonFromRawResponse$2,stringify:l=bytesJsonStringify$2,jsContract:u=!1,blockQuery:d={finality:"optimistic"}}){return __awaiter$10(this,void 0,void 0,function*(){let h;validateArgs$2(a),u?h=encodeJSContractArgs$2(n,o,Object.keys(a).length>0?JSON.stringify(a):""):h=l(a);const y=yield e.provider.query(Object.assign(Object.assign({request_type:"call_function"},d),{account_id:u?e.jsvmAccountId:n,method_name:u?"view_js_contract":o,args_base64:h.toString("base64")}));return y.logs&&(0,utils_1$D.printTxOutcomeLogs)({contractId:n,logs:y.logs}),y.result&&y.result.length>0&&c(Buffer.from(y.result))})}utils$e.viewFunction=viewFunction$2;var __awaiter$$=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(account$5,"__esModule",{value:!0});account$5.Account=void 0;const crypto_1$q=lib$n,providers_1$b=lib$i,transactions_1$f=lib$h,types_1$w=lib$l,utils_1$C=lib$m,utils_2$9=utils$e,{addKey:addKey$9,createAccount:createAccount$6,deleteAccount:deleteAccount$6,deleteKey:deleteKey$9,deployContract:deployContract$c,fullAccessKey:fullAccessKey$7,functionCall:functionCall$d,functionCallAccessKey:functionCallAccessKey$7,stake:stake$6,transfer:transfer$6}=transactions_1$f.actionCreators,TX_NONCE_RETRY_NUMBER$2=12,TX_NONCE_RETRY_WAIT$2=500,TX_NONCE_RETRY_WAIT_BACKOFF$2=1.5;let Account$2=class Mt{constructor(n,o){this.accessKeyByPublicKeyCache={},this.connection=n,this.accountId=o}getConnection(){return this.connection}state(){return __awaiter$$(this,void 0,void 0,function*(){return this.connection.provider.query({request_type:"view_account",account_id:this.accountId,finality:"optimistic"})})}signTransaction(n,o){return __awaiter$$(this,void 0,void 0,function*(){const a=yield this.findAccessKey(n,o);if(!a)throw new types_1$w.TypedError(`Can not sign transactions for account ${this.accountId} on network ${this.connection.networkId}, no matching key pair exists for this account`,"KeyNotFound");const{accessKey:c}=a,u=(yield this.connection.provider.block({finality:"final"})).header.hash,d=c.nonce+BigInt(1);return yield(0,transactions_1$f.signTransaction)(n,d,o,(0,utils_1$C.baseDecode)(u),this.connection.signer,this.accountId,this.connection.networkId)})}signAndSendTransaction({receiverId:n,actions:o,returnError:a}){return __awaiter$$(this,void 0,void 0,function*(){let c,l;const u=yield(0,providers_1$b.exponentialBackoff)(TX_NONCE_RETRY_WAIT$2,TX_NONCE_RETRY_NUMBER$2,TX_NONCE_RETRY_WAIT_BACKOFF$2,()=>__awaiter$$(this,void 0,void 0,function*(){[c,l]=yield this.signTransaction(n,o);const d=l.transaction.publicKey;try{return yield this.connection.provider.sendTransaction(l)}catch(h){if(h.type==="InvalidNonce")return utils_1$C.Logger.warn(`Retrying transaction ${n}:${(0,utils_1$C.baseEncode)(c)} with new nonce.`),delete this.accessKeyByPublicKeyCache[d.toString()],null;if(h.type==="Expired")return utils_1$C.Logger.warn(`Retrying transaction ${n}:${(0,utils_1$C.baseEncode)(c)} due to expired block hash`),null;throw h.context=new types_1$w.ErrorContext((0,utils_1$C.baseEncode)(c)),h}}));if(!u)throw new types_1$w.TypedError("nonce retries exceeded for transaction. This usually means there are too many parallel requests with the same access key.","RetriesExceeded");if((0,utils_1$C.printTxOutcomeLogsAndFailures)({contractId:l.transaction.receiverId,outcome:u}),!a&&typeof u.status=="object"&&typeof u.status.Failure=="object"&&u.status.Failure!==null)throw u.status.Failure.error_message&&u.status.Failure.error_type?new types_1$w.TypedError(`Transaction ${u.transaction_outcome.id} failed. ${u.status.Failure.error_message}`,u.status.Failure.error_type):(0,utils_1$C.parseResultError)(u);return u})}findAccessKey(n,o){return __awaiter$$(this,void 0,void 0,function*(){const a=yield this.connection.signer.getPublicKey(this.accountId,this.connection.networkId);if(!a)throw new types_1$w.TypedError(`no matching key pair found in ${this.connection.signer}`,"PublicKeyNotFound");const c=this.accessKeyByPublicKeyCache[a.toString()];if(c!==void 0)return{publicKey:a,accessKey:c};try{const l=yield this.connection.provider.query({request_type:"view_access_key",account_id:this.accountId,public_key:a.toString(),finality:"optimistic"}),u=Object.assign(Object.assign({},l),{nonce:BigInt(l.nonce||0)});return this.accessKeyByPublicKeyCache[a.toString()]?{publicKey:a,accessKey:this.accessKeyByPublicKeyCache[a.toString()]}:(this.accessKeyByPublicKeyCache[a.toString()]=u,{publicKey:a,accessKey:u})}catch(l){if(l.type=="AccessKeyDoesNotExist")return null;throw l}})}createAndDeployContract(n,o,a,c){return __awaiter$$(this,void 0,void 0,function*(){const l=fullAccessKey$7();return yield this.signAndSendTransaction({receiverId:n,actions:[createAccount$6(),transfer$6(c),addKey$9(crypto_1$q.PublicKey.from(o),l),deployContract$c(a)]}),new Mt(this.connection,n)})}sendMoney(n,o){return __awaiter$$(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:n,actions:[transfer$6(o)]})})}createAccount(n,o,a){return __awaiter$$(this,void 0,void 0,function*(){const c=fullAccessKey$7();return this.signAndSendTransaction({receiverId:n,actions:[createAccount$6(),transfer$6(a),addKey$9(crypto_1$q.PublicKey.from(o),c)]})})}deleteAccount(n){return __awaiter$$(this,void 0,void 0,function*(){return utils_1$C.Logger.log("Deleting an account does not automatically transfer NFTs and FTs to the beneficiary address. Ensure to transfer assets before deleting."),this.signAndSendTransaction({receiverId:this.accountId,actions:[deleteAccount$6(n)]})})}deployContract(n){return __awaiter$$(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:this.accountId,actions:[deployContract$c(n)]})})}encodeJSContractArgs(n,o,a){return Buffer.concat([Buffer.from(n),Buffer.from([0]),Buffer.from(o),Buffer.from([0]),Buffer.from(a)])}functionCall({contractId:n,methodName:o,args:a={},gas:c=utils_1$C.DEFAULT_FUNCTION_CALL_GAS,attachedDeposit:l,walletMeta:u,walletCallbackUrl:d,stringify:h,jsContract:y}){return __awaiter$$(this,void 0,void 0,function*(){this.validateArgs(a);let p;if(y)p=["call_js_contract",this.encodeJSContractArgs(n,o,JSON.stringify(a)),c,l,null,!0];else{const v=h===void 0?transactions_1$f.stringifyJsonOrBytes:h;p=[o,a,c,l,v,!1]}return this.signAndSendTransaction({receiverId:y?this.connection.jsvmAccountId:n,actions:[functionCall$d.apply(void 0,p)],walletMeta:u,walletCallbackUrl:d})})}addKey(n,o,a,c){return __awaiter$$(this,void 0,void 0,function*(){a||(a=[]),Array.isArray(a)||(a=[a]);let l;return o?l=functionCallAccessKey$7(o,a,c):l=fullAccessKey$7(),this.signAndSendTransaction({receiverId:this.accountId,actions:[addKey$9(crypto_1$q.PublicKey.from(n),l)]})})}deleteKey(n){return __awaiter$$(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:this.accountId,actions:[deleteKey$9(crypto_1$q.PublicKey.from(n))]})})}stake(n,o){return __awaiter$$(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:this.accountId,actions:[stake$6(o,crypto_1$q.PublicKey.from(n))]})})}signedDelegate({actions:n,blockHeightTtl:o,receiverId:a}){return __awaiter$$(this,void 0,void 0,function*(){const{provider:c,signer:l}=this.connection,{header:u}=yield c.block({finality:"final"}),{accessKey:d,publicKey:h}=yield this.findAccessKey(null,null),y=(0,transactions_1$f.buildDelegateAction)({actions:n,maxBlockHeight:BigInt(u.height)+BigInt(o),nonce:BigInt(d.nonce)+BigInt(1),publicKey:h,receiverId:a,senderId:this.accountId}),{signedDelegateAction:p}=yield(0,transactions_1$f.signDelegateAction)({delegateAction:y,signer:{sign:v=>__awaiter$$(this,void 0,void 0,function*(){const{signature:b}=yield l.signMessage(v,y.senderId,this.connection.networkId);return b})}});return p})}validateArgs(n){if(!(n.byteLength!==void 0&&n.byteLength===n.length)&&(Array.isArray(n)||typeof n!="object"))throw new types_1$w.PositionalArgsError}viewFunction(n){return __awaiter$$(this,void 0,void 0,function*(){return yield(0,utils_2$9.viewFunction)(this.connection,n)})}viewState(n,o={finality:"optimistic"}){return __awaiter$$(this,void 0,void 0,function*(){return yield(0,utils_2$9.viewState)(this.connection,this.accountId,n,o)})}getAccessKeys(){var n;return __awaiter$$(this,void 0,void 0,function*(){const o=yield this.connection.provider.query({request_type:"view_access_key_list",account_id:this.accountId,finality:"optimistic"});return(n=o==null?void 0:o.keys)===null||n===void 0?void 0:n.map(a=>Object.assign(Object.assign({},a),{access_key:Object.assign(Object.assign({},a.access_key),{nonce:BigInt(a.access_key.nonce)})}))})}getAccountDetails(){return __awaiter$$(this,void 0,void 0,function*(){return{authorizedApps:(yield this.getAccessKeys()).filter(a=>a.access_key.permission!=="FullAccess").map(a=>{const c=a.access_key.permission;return{contractId:c.FunctionCall.receiver_id,amount:c.FunctionCall.allowance,publicKey:a.public_key}})}})}getAccountBalance(){return __awaiter$$(this,void 0,void 0,function*(){const n=yield this.connection.provider.experimental_protocolConfig({finality:"final"}),o=yield this.state(),a=BigInt(n.runtime_config.storage_amount_per_byte),c=BigInt(o.storage_usage)*a,l=BigInt(o.locked),u=BigInt(o.amount)+l,d=u-(l>c?l:c);return{total:u.toString(),stateStaked:c.toString(),staked:l.toString(),available:d.toString()}})}getActiveDelegatedStakeBalance(){return __awaiter$$(this,void 0,void 0,function*(){const n=yield this.connection.provider.block({finality:"final"}),o=n.header.hash,a=n.header.epoch_id,{current_validators:c,next_validators:l,current_proposals:u}=yield this.connection.provider.validators(a),d=new Set;[...c,...l,...u].forEach(_=>d.add(_.account_id));const h=[...d],y=h.map(_=>this.viewFunction({contractId:_,methodName:"get_account_total_balance",args:{account_id:this.accountId},blockQuery:{blockId:o}})),p=yield Promise.allSettled(y);if(p.some(_=>_.status==="rejected"&&_.reason.type==="TimeoutError"))throw new Error("Failed to get delegated stake balance");const b=p.reduce((_,T,I)=>{const U=h[I];if(T.status==="fulfilled"){const N=BigInt(T.value);if(N!==BigInt(0))return Object.assign(Object.assign({},_),{stakedValidators:[..._.stakedValidators,{validatorId:U,amount:N.toString()}],total:_.total+N})}return T.status==="rejected"?Object.assign(Object.assign({},_),{failedValidators:[..._.failedValidators,{validatorId:U,error:T.reason}]}):_},{stakedValidators:[],failedValidators:[],total:BigInt(0)});return Object.assign(Object.assign({},b),{total:b.total.toString()})})}};account$5.Account=Account$2;var account_2fa$2={},account_multisig$5={},constants$8={};Object.defineProperty(constants$8,"__esModule",{value:!0});constants$8.MULTISIG_CONFIRM_METHODS=constants$8.MULTISIG_CHANGE_METHODS=constants$8.MULTISIG_DEPOSIT=constants$8.MULTISIG_GAS=constants$8.MULTISIG_ALLOWANCE=constants$8.MULTISIG_STORAGE_KEY=void 0;const utils_1$B=lib$m;constants$8.MULTISIG_STORAGE_KEY="__multisigRequest";constants$8.MULTISIG_ALLOWANCE=BigInt((0,utils_1$B.parseNearAmount)("1"));constants$8.MULTISIG_GAS=BigInt("100000000000000");constants$8.MULTISIG_DEPOSIT=BigInt("0");constants$8.MULTISIG_CHANGE_METHODS=["add_request","add_request_and_confirm","delete_request","confirm"];constants$8.MULTISIG_CONFIRM_METHODS=["confirm"];var types$5={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultisigStateStatus=e.MultisigDeleteRequestRejectionError=void 0,function(n){n.CANNOT_DESERIALIZE_STATE="Cannot deserialize the contract state",n.MULTISIG_NOT_INITIALIZED="Smart contract panicked: Multisig contract should be initialized before usage",n.NO_SUCH_REQUEST="Smart contract panicked: panicked at 'No such request: either wrong number or already confirmed'",n.REQUEST_COOLDOWN_ERROR="Request cannot be deleted immediately after creation.",n.METHOD_NOT_FOUND="Contract method is not found"}(e.MultisigDeleteRequestRejectionError||(e.MultisigDeleteRequestRejectionError={})),function(n){n[n.INVALID_STATE=0]="INVALID_STATE",n[n.STATE_NOT_INITIALIZED=1]="STATE_NOT_INITIALIZED",n[n.VALID_STATE=2]="VALID_STATE",n[n.UNKNOWN_STATE=3]="UNKNOWN_STATE"}(e.MultisigStateStatus||(e.MultisigStateStatus={}))})(types$5);var __awaiter$_=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(account_multisig$5,"__esModule",{value:!0});account_multisig$5.AccountMultisig=void 0;const transactions_1$e=lib$h,utils_1$A=lib$m,account_1$5=account$5,constants_1$a=constants$8,types_1$v=types$5,{deployContract:deployContract$b,functionCall:functionCall$c}=transactions_1$e.actionCreators;var MultisigCodeStatus$2;(function(e){e[e.INVALID_CODE=0]="INVALID_CODE",e[e.VALID_CODE=1]="VALID_CODE",e[e.UNKNOWN_CODE=2]="UNKNOWN_CODE"})(MultisigCodeStatus$2||(MultisigCodeStatus$2={}));const storageFallback$2={[constants_1$a.MULTISIG_STORAGE_KEY]:null};let AccountMultisig$2=class extends account_1$5.Account{constructor(n,o,a){super(n,o),this.storage=a.storage,this.onAddRequestResult=a.onAddRequestResult}signAndSendTransactionWithAccount(n,o){const a=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$_(this,void 0,void 0,function*(){return a.signAndSendTransaction.call(this,{receiverId:n,actions:o})})}signAndSendTransaction({receiverId:n,actions:o}){const a=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$_(this,void 0,void 0,function*(){const{accountId:c}=this,l=Buffer.from(JSON.stringify({request:{receiver_id:n,actions:convertActions$2(o,c,n)}}));let u;try{u=yield a.signAndSendTransaction.call(this,{receiverId:c,actions:[functionCall$c("add_request_and_confirm",l,constants_1$a.MULTISIG_GAS,constants_1$a.MULTISIG_DEPOSIT)]})}catch(h){if(h.toString().includes("Account has too many active requests. Confirm or delete some"))return yield this.deleteUnconfirmedRequests(),yield this.signAndSendTransaction({receiverId:n,actions:o});throw h}if(!u.status)throw new Error("Request failed");const d=Object.assign({},u.status);if(!d.SuccessValue||typeof d.SuccessValue!="string")throw new Error("Request failed");return this.setRequest({accountId:c,actions:o,requestId:parseInt(Buffer.from(d.SuccessValue,"base64").toString("ascii"),10)}),this.onAddRequestResult&&(yield this.onAddRequestResult(u)),this.deleteUnconfirmedRequests(),u})}checkMultisigCodeAndStateStatus(n){const o=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$_(this,void 0,void 0,function*(){const c=n?MultisigCodeStatus$2.UNKNOWN_CODE:MultisigCodeStatus$2.VALID_CODE;try{return n?yield o.signAndSendTransaction.call(this,{receiverId:this.accountId,actions:[deployContract$b(n),functionCall$c("delete_request",{request_id:4294967295},constants_1$a.MULTISIG_GAS,constants_1$a.MULTISIG_DEPOSIT)]}):yield this.deleteRequest(4294967295),{codeStatus:MultisigCodeStatus$2.VALID_CODE,stateStatus:types_1$v.MultisigStateStatus.VALID_STATE}}catch(l){if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.CANNOT_DESERIALIZE_STATE).test(l&&l.kind&&l.kind.ExecutionError))return{codeStatus:c,stateStatus:types_1$v.MultisigStateStatus.INVALID_STATE};if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.MULTISIG_NOT_INITIALIZED).test(l&&l.kind&&l.kind.ExecutionError))return{codeStatus:c,stateStatus:types_1$v.MultisigStateStatus.STATE_NOT_INITIALIZED};if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.NO_SUCH_REQUEST).test(l&&l.kind&&l.kind.ExecutionError))return{codeStatus:c,stateStatus:types_1$v.MultisigStateStatus.VALID_STATE};if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.METHOD_NOT_FOUND).test(l&&l.message))return{codeStatus:MultisigCodeStatus$2.INVALID_CODE,stateStatus:types_1$v.MultisigStateStatus.UNKNOWN_STATE};throw l}})}deleteRequest(n){return super.signAndSendTransaction({receiverId:this.accountId,actions:[functionCall$c("delete_request",{request_id:n},constants_1$a.MULTISIG_GAS,constants_1$a.MULTISIG_DEPOSIT)]})}deleteAllRequests(){return __awaiter$_(this,void 0,void 0,function*(){const n=yield this.getRequestIds();n.length&&(yield Promise.all(n.map(o=>this.deleteRequest(o))))})}deleteUnconfirmedRequests(){const n=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$_(this,void 0,void 0,function*(){const o=yield this.getRequestIds(),{requestId:a}=this.getRequest();for(const c of o)if(c!=a)try{yield n.signAndSendTransaction.call(this,{receiverId:this.accountId,actions:[functionCall$c("delete_request",{request_id:c},constants_1$a.MULTISIG_GAS,constants_1$a.MULTISIG_DEPOSIT)]})}catch{utils_1$A.Logger.warn("Attempt to delete an earlier request before 15 minutes failed. Will try again.")}})}getRequestIds(){return __awaiter$_(this,void 0,void 0,function*(){return this.viewFunction({contractId:this.accountId,methodName:"list_request_ids"})})}getRequest(){return this.storage?JSON.parse(this.storage.getItem(constants_1$a.MULTISIG_STORAGE_KEY)||"{}"):storageFallback$2[constants_1$a.MULTISIG_STORAGE_KEY]}setRequest(n){if(this.storage)return this.storage.setItem(constants_1$a.MULTISIG_STORAGE_KEY,JSON.stringify(n));storageFallback$2[constants_1$a.MULTISIG_STORAGE_KEY]=n}};account_multisig$5.AccountMultisig=AccountMultisig$2;const convertPKForContract$2=e=>e.toString().replace("ed25519:",""),convertActions$2=(e,n,o)=>e.map(a=>{const c=a.enum,{gas:l,publicKey:u,methodName:d,args:h,deposit:y,accessKey:p,code:v}=a[c],b={type:c[0].toUpperCase()+c.substr(1),gas:l&&l.toString()||void 0,public_key:u&&convertPKForContract$2(u)||void 0,method_name:d,args:h&&Buffer.from(h).toString("base64")||void 0,code:v&&Buffer.from(v).toString("base64")||void 0,amount:y&&y.toString()||void 0,deposit:y&&y.toString()||"0",permission:void 0};if(p&&(o===n&&p.permission.enum!=="fullAccess"&&(b.permission={receiver_id:n,allowance:constants_1$a.MULTISIG_ALLOWANCE.toString(),method_names:constants_1$a.MULTISIG_CHANGE_METHODS}),p.permission.enum==="functionCall")){const{receiverId:_,methodNames:T,allowance:I}=p.permission.functionCall;b.permission={receiver_id:_,allowance:I&&I.toString()||void 0,method_names:T}}return b});var __awaiter$Z=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(account_2fa$2,"__esModule",{value:!0});account_2fa$2.Account2FA=void 0;const crypto_1$p=lib$n,types_1$u=lib$l,providers_1$a=lib$i,transactions_1$d=lib$h,utils_1$z=lib$m,account_multisig_1$2=account_multisig$5,constants_1$9=constants$8,types_2$2=types$5,{addKey:addKey$8,deleteKey:deleteKey$8,deployContract:deployContract$a,fullAccessKey:fullAccessKey$6,functionCall:functionCall$b,functionCallAccessKey:functionCallAccessKey$6}=transactions_1$d.actionCreators;let Account2FA$2=class extends account_multisig_1$2.AccountMultisig{constructor(n,o,a){super(n,o,a),this.helperUrl="https://helper.testnet.near.org",this.helperUrl=a.helperUrl||this.helperUrl,this.storage=a.storage,this.sendCode=a.sendCode||this.sendCodeDefault,this.getCode=a.getCode||this.getCodeDefault,this.verifyCode=a.verifyCode||this.verifyCodeDefault,this.onConfirmResult=a.onConfirmResult}signAndSendTransaction({receiverId:n,actions:o}){const a=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$Z(this,void 0,void 0,function*(){yield a.signAndSendTransaction.call(this,{receiverId:n,actions:o}),yield this.sendCode();const c=yield this.promptAndVerify();return this.onConfirmResult&&(yield this.onConfirmResult(c)),c})}deployMultisig(n){const o=Object.create(null,{signAndSendTransactionWithAccount:{get:()=>super.signAndSendTransactionWithAccount}});return __awaiter$Z(this,void 0,void 0,function*(){const{accountId:a}=this,c=(yield this.getRecoveryMethods()).data.filter(({kind:v,publicKey:b})=>(v==="phrase"||v==="ledger")&&b!==null).map(v=>v.publicKey),l=(yield this.getAccessKeys()).filter(({public_key:v,access_key:{permission:b}})=>b==="FullAccess"&&!c.includes(v)).map(v=>v.public_key).map(toPK$2),u=toPK$2((yield this.postSignedJson("/2fa/getAccessKey",{accountId:a})).publicKey),d=Buffer.from(JSON.stringify({num_confirmations:2})),h=[...l.map(v=>deleteKey$8(v)),...l.map(v=>addKey$8(v,functionCallAccessKey$6(a,constants_1$9.MULTISIG_CHANGE_METHODS,null))),addKey$8(u,functionCallAccessKey$6(a,constants_1$9.MULTISIG_CONFIRM_METHODS,null)),deployContract$a(n)],y=h.concat(functionCall$b("new",d,constants_1$9.MULTISIG_GAS,constants_1$9.MULTISIG_DEPOSIT));utils_1$z.Logger.log("deploying multisig contract for",a);const{stateStatus:p}=yield this.checkMultisigCodeAndStateStatus(n);switch(p){case types_2$2.MultisigStateStatus.STATE_NOT_INITIALIZED:return yield o.signAndSendTransactionWithAccount.call(this,a,y);case types_2$2.MultisigStateStatus.VALID_STATE:return yield o.signAndSendTransactionWithAccount.call(this,a,h);case types_2$2.MultisigStateStatus.INVALID_STATE:throw new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account has existing state.`,"ContractHasExistingState");default:throw new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account state could not be verified.`,"ContractStateUnknown")}})}disableWithFAK({contractBytes:n,cleanupContractBytes:o}){return __awaiter$Z(this,void 0,void 0,function*(){let a=[];o&&(yield this.deleteAllRequests().catch(d=>d),a=yield this.get2faDisableCleanupActions(o));const c=yield this.get2faDisableKeyConversionActions(),l=[...a,...c,deployContract$a(n)],u=yield this.findAccessKey(this.accountId,l);if(u&&u.accessKey&&u.accessKey.permission!=="FullAccess")throw new types_1$u.TypedError("No full access key found in keystore. Unable to bypass multisig","NoFAKFound");return this.signAndSendTransactionWithAccount(this.accountId,l)})}get2faDisableCleanupActions(n){return __awaiter$Z(this,void 0,void 0,function*(){const o=yield this.viewState("").catch(c=>{const l=c.cause&&c.cause.name;if(l=="NO_CONTRACT_CODE")return[];throw l=="TOO_LARGE_CONTRACT_STATE"?new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account has existing state.`,"ContractHasExistingState"):c}),a=o.map(({key:c})=>c.toString("base64"));return o.length?[deployContract$a(n),functionCall$b("clean",{keys:a},constants_1$9.MULTISIG_GAS,BigInt("0"))]:[]})}get2faDisableKeyConversionActions(){return __awaiter$Z(this,void 0,void 0,function*(){const{accountId:n}=this,a=(yield this.getAccessKeys()).filter(({access_key:l})=>l.permission!=="FullAccess").filter(({access_key:l})=>{const u=l.permission.FunctionCall;return u.receiver_id===n&&u.method_names.length===4&&u.method_names.includes("add_request_and_confirm")}),c=crypto_1$p.PublicKey.from((yield this.postSignedJson("/2fa/getAccessKey",{accountId:n})).publicKey);return[deleteKey$8(c),...a.map(({public_key:l})=>deleteKey$8(crypto_1$p.PublicKey.from(l))),...a.map(({public_key:l})=>addKey$8(crypto_1$p.PublicKey.from(l),fullAccessKey$6()))]})}disable(n,o){return __awaiter$Z(this,void 0,void 0,function*(){const{stateStatus:a}=yield this.checkMultisigCodeAndStateStatus();if(a!==types_2$2.MultisigStateStatus.VALID_STATE&&a!==types_2$2.MultisigStateStatus.STATE_NOT_INITIALIZED)throw new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account state could not be verified.`,"ContractStateUnknown");let c;yield this.deleteAllRequests().catch(d=>c=d);const u=[...yield this.get2faDisableCleanupActions(o).catch(d=>{throw d.type==="ContractHasExistingState"&&c||d}),...yield this.get2faDisableKeyConversionActions(),deployContract$a(n)];return utils_1$z.Logger.log("disabling 2fa for",this.accountId),yield this.signAndSendTransaction({receiverId:this.accountId,actions:u})})}sendCodeDefault(){return __awaiter$Z(this,void 0,void 0,function*(){const{accountId:n}=this,{requestId:o}=this.getRequest(),a=yield this.get2faMethod();return yield this.postSignedJson("/2fa/send",{accountId:n,method:a,requestId:o}),o})}getCodeDefault(){return __awaiter$Z(this,void 0,void 0,function*(){throw new Error('There is no getCode callback provided. Please provide your own in AccountMultisig constructor options. It has a parameter method where method.kind is "email" or "phone".')})}promptAndVerify(){return __awaiter$Z(this,void 0,void 0,function*(){const n=yield this.get2faMethod(),o=yield this.getCode(n);try{return yield this.verifyCode(o)}catch(a){if(utils_1$z.Logger.warn("Error validating security code:",a),a.toString().includes("invalid 2fa code provided")||a.toString().includes("2fa code not valid"))return yield this.promptAndVerify();throw a}})}verifyCodeDefault(n){return __awaiter$Z(this,void 0,void 0,function*(){const{accountId:o}=this,a=this.getRequest();if(!a)throw new Error("no request pending");const{requestId:c}=a;return yield this.postSignedJson("/2fa/verify",{accountId:o,securityCode:n,requestId:c})})}getRecoveryMethods(){return __awaiter$Z(this,void 0,void 0,function*(){const{accountId:n}=this;return{accountId:n,data:yield this.postSignedJson("/account/recoveryMethods",{accountId:n})}})}get2faMethod(){return __awaiter$Z(this,void 0,void 0,function*(){let{data:n}=yield this.getRecoveryMethods();if(n&&n.length&&(n=n.find(c=>c.kind.indexOf("2fa-")===0)),!n)return null;const{kind:o,detail:a}=n;return{kind:o,detail:a}})}signatureFor(){return __awaiter$Z(this,void 0,void 0,function*(){const{accountId:n}=this,a=(yield this.connection.provider.block({finality:"final"})).header.height.toString(),c=yield this.connection.signer.signMessage(Buffer.from(a),n,this.connection.networkId),l=Buffer.from(c.signature).toString("base64");return{blockNumber:a,blockNumberSignature:l}})}postSignedJson(n,o){return __awaiter$Z(this,void 0,void 0,function*(){return yield(0,providers_1$a.fetchJson)(this.helperUrl+n,JSON.stringify(Object.assign(Object.assign({},o),yield this.signatureFor())))})}};account_2fa$2.Account2FA=Account2FA$2;const toPK$2=e=>crypto_1$p.PublicKey.from(e);var account_creator$5={},__awaiter$Y=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(account_creator$5,"__esModule",{value:!0});account_creator$5.UrlAccountCreator=account_creator$5.LocalAccountCreator=account_creator$5.AccountCreator=void 0;const providers_1$9=lib$i;let AccountCreator$2=class{};account_creator$5.AccountCreator=AccountCreator$2;let LocalAccountCreator$2=class extends AccountCreator$2{constructor(n,o){super(),this.masterAccount=n,this.initialBalance=o}createAccount(n,o){return __awaiter$Y(this,void 0,void 0,function*(){yield this.masterAccount.createAccount(n,o,this.initialBalance)})}};account_creator$5.LocalAccountCreator=LocalAccountCreator$2;let UrlAccountCreator$2=class extends AccountCreator$2{constructor(n,o){super(),this.connection=n,this.helperUrl=o}createAccount(n,o){return __awaiter$Y(this,void 0,void 0,function*(){yield(0,providers_1$9.fetchJson)(`${this.helperUrl}/account`,JSON.stringify({newAccountId:n,newAccountPublicKey:o.toString()}))})}};account_creator$5.UrlAccountCreator=UrlAccountCreator$2;var connection$5={},lib$f={},in_memory_signer$2={},signer$5={};Object.defineProperty(signer$5,"__esModule",{value:!0});signer$5.Signer=void 0;let Signer$2=class{};signer$5.Signer=Signer$2;var __awaiter$X=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(in_memory_signer$2,"__esModule",{value:!0});in_memory_signer$2.InMemorySigner=void 0;const crypto_1$o=lib$n,keystores_1$5=lib$o,sha256_1$5=sha256$2,signer_1$2=signer$5;let InMemorySigner$2=class Nt extends signer_1$2.Signer{constructor(n){super(),this.keyStore=n}static fromKeyPair(n,o,a){return __awaiter$X(this,void 0,void 0,function*(){const c=new keystores_1$5.InMemoryKeyStore;return yield c.setKey(n,o,a),new Nt(c)})}createKey(n,o,a){return __awaiter$X(this,void 0,void 0,function*(){const c=a===crypto_1$o.KeyType.SECP256K1?crypto_1$o.KeyPair.fromRandom("secp256k1"):crypto_1$o.KeyPair.fromRandom("ed25519");return yield this.keyStore.setKey(o,n,c),c.getPublicKey()})}getPublicKey(n,o){return __awaiter$X(this,void 0,void 0,function*(){const a=yield this.keyStore.getKey(o,n);return a===null?null:a.getPublicKey()})}signMessage(n,o,a){return __awaiter$X(this,void 0,void 0,function*(){const c=new Uint8Array((0,sha256_1$5.sha256)(n));if(!o)throw new Error("InMemorySigner requires provided account id");const l=yield this.keyStore.getKey(a,o);if(l===null)throw new Error(`Key for ${o} not found in ${a}`);return l.sign(c)})}toString(){return`InMemorySigner(${this.keyStore})`}};in_memory_signer$2.InMemorySigner=InMemorySigner$2;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Signer=e.InMemorySigner=void 0;var n=in_memory_signer$2;Object.defineProperty(e,"InMemorySigner",{enumerable:!0,get:function(){return n.InMemorySigner}});var o=signer$5;Object.defineProperty(e,"Signer",{enumerable:!0,get:function(){return o.Signer}})})(lib$f);Object.defineProperty(connection$5,"__esModule",{value:!0});connection$5.Connection=void 0;const signers_1$3=lib$f,providers_1$8=lib$i;function getProvider$2(e){switch(e.type){case void 0:return e;case"JsonRpcProvider":return new providers_1$8.JsonRpcProvider(Object.assign({},e.args));case"FailoverRpcProvider":{const n=((e==null?void 0:e.args)||[]).map(o=>new providers_1$8.JsonRpcProvider(o));return new providers_1$8.FailoverRpcProvider(n)}default:throw new Error(`Unknown provider type ${e.type}`)}}function getSigner$2(e){switch(e.type){case void 0:return e;case"InMemorySigner":return new signers_1$3.InMemorySigner(e.keyStore);default:throw new Error(`Unknown signer type ${e.type}`)}}let Connection$2=class xt{constructor(n,o,a,c){this.networkId=n,this.provider=o,this.signer=a,this.jsvmAccountId=c}getConnection(){return this}static fromConfig(n){const o=getProvider$2(n.provider),a=getSigner$2(n.signer);return new xt(n.networkId,o,a,n.jsvmAccountId)}};connection$5.Connection=Connection$2;var contract$5={},localViewExecution$2={},storage$2={},lru={exports:{}};(function(e,n){(function(o,a){a(n)})(commonjsGlobal$c,function(o){const a=Symbol("newer"),c=Symbol("older");class l{constructor(v,b){typeof v!="number"&&(b=v,v=0),this.size=0,this.limit=v,this.oldest=this.newest=void 0,this._keymap=new Map,b&&(this.assign(b),v<1&&(this.limit=this.size))}_markEntryAsUsed(v){v!==this.newest&&(v[a]&&(v===this.oldest&&(this.oldest=v[a]),v[a][c]=v[c]),v[c]&&(v[c][a]=v[a]),v[a]=void 0,v[c]=this.newest,this.newest&&(this.newest[a]=v),this.newest=v)}assign(v){let b,_=this.limit||Number.MAX_VALUE;this._keymap.clear();let T=v[Symbol.iterator]();for(let I=T.next();!I.done;I=T.next()){let U=new u(I.value[0],I.value[1]);if(this._keymap.set(U.key,U),b?(b[a]=U,U[c]=b):this.oldest=U,b=U,_--==0)throw new Error("overflow")}this.newest=b,this.size=this._keymap.size}get(v){var b=this._keymap.get(v);return b?(this._markEntryAsUsed(b),b.value):void 0}set(v,b){var _=this._keymap.get(v);return _?(_.value=b,this._markEntryAsUsed(_),this):(this._keymap.set(v,_=new u(v,b)),this.newest?(this.newest[a]=_,_[c]=this.newest):this.oldest=_,this.newest=_,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var v=this.oldest;if(v)return this.oldest[a]?(this.oldest=this.oldest[a],this.oldest[c]=void 0):(this.oldest=void 0,this.newest=void 0),v[a]=v[c]=void 0,this._keymap.delete(v.key),--this.size,[v.key,v.value]}find(v){let b=this._keymap.get(v);return b?b.value:void 0}has(v){return this._keymap.has(v)}delete(v){var b=this._keymap.get(v);return b?(this._keymap.delete(b.key),b[a]&&b[c]?(b[c][a]=b[a],b[a][c]=b[c]):b[a]?(b[a][c]=void 0,this.oldest=b[a]):b[c]?(b[c][a]=void 0,this.newest=b[c]):this.oldest=this.newest=void 0,this.size--,b.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new h(this.oldest)}values(){return new y(this.oldest)}entries(){return this}[Symbol.iterator](){return new d(this.oldest)}forEach(v,b){typeof b!="object"&&(b=this);let _=this.oldest;for(;_;)v.call(b,_.value,_.key,this),_=_[a]}toJSON(){for(var v=new Array(this.size),b=0,_=this.oldest;_;)v[b++]={key:_.key,value:_.value},_=_[a];return v}toString(){for(var v="",b=this.oldest;b;)v+=String(b.key)+":"+b.value,b=b[a],b&&(v+=" < ");return v}}o.LRUMap=l;function u(p,v){this.key=p,this.value=v,this[a]=void 0,this[c]=void 0}function d(p){this.entry=p}d.prototype[Symbol.iterator]=function(){return this},d.prototype.next=function(){let p=this.entry;return p?(this.entry=p[a],{done:!1,value:[p.key,p.value]}):{done:!0,value:void 0}};function h(p){this.entry=p}h.prototype[Symbol.iterator]=function(){return this},h.prototype.next=function(){let p=this.entry;return p?(this.entry=p[a],{done:!1,value:p.key}):{done:!0,value:void 0}};function y(p){this.entry=p}y.prototype[Symbol.iterator]=function(){return this},y.prototype.next=function(){let p=this.entry;return p?(this.entry=p[a],{done:!1,value:p.value}):{done:!0,value:void 0}}})})(lru,lru.exports);var lruExports=lru.exports;Object.defineProperty(storage$2,"__esModule",{value:!0});storage$2.Storage=void 0;const lru_map_1$2=lruExports;let Storage$2=class Dt{constructor(n={max:Dt.MAX_ELEMENTS}){this.cache=new lru_map_1$2.LRUMap(n.max),this.blockHeights=new Map}load(n){if(!("blockId"in n))return;let a=n.blockId;return a.toString().length==44&&(a=this.blockHeights.get(a.toString())),this.cache.get(a)}save(n,{blockHeight:o,blockTimestamp:a,contractCode:c,contractState:l}){this.blockHeights.set(n,o),this.cache.set(o,{blockHeight:o,blockTimestamp:a,contractCode:c,contractState:l})}};storage$2.Storage=Storage$2;Storage$2.MAX_ELEMENTS=100;var runtime$2={},__awaiter$W=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})},__rest$7=commonjsGlobal$c&&commonjsGlobal$c.__rest||function(e,n){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,a=Object.getOwnPropertySymbols(e);c<a.length;c++)n.indexOf(a[c])<0&&Object.prototype.propertyIsEnumerable.call(e,a[c])&&(o[a[c]]=e[a[c]]);return o};Object.defineProperty(runtime$2,"__esModule",{value:!0});runtime$2.Runtime=void 0;const crypto_1$n=require$$4$3,notImplemented$3=e=>()=>{throw new Error("method not implemented: "+e)},prohibitedInView$2=e=>()=>{throw new Error("method not available for view calls: "+e)};let Runtime$2=class{constructor(n){var{contractCode:o}=n,a=__rest$7(n,["contractCode"]);this.context=a,this.wasm=this.prepareWASM(Buffer.from(o,"base64")),this.memory=new WebAssembly.Memory({initial:1024,maximum:2048}),this.registers={},this.logs=[],this.result=Buffer.from([])}readUTF16CStr(n){const o=[],a=new Uint16Array(this.memory.buffer);let c=Number(n)/2;for(;a[c]!=0;)o.push(a[c]),c++;return Buffer.from(Uint16Array.from(o).buffer).toString("ucs2")}readUTF8CStr(n,o){const a=[],c=new Uint8Array(this.memory.buffer);let l=Number(o);for(let u=0;u<n&&c[l]!=0;u++)a.push(c[l]),l++;return Buffer.from(a).toString("utf8")}storageRead(n,o){const a=Buffer.from(new Uint8Array(this.memory.buffer,Number(o),Number(n))),c=this.context.contractState.filter(l=>Buffer.compare(l.key,a)===0).map(l=>l.value);return c.length===0?null:c.length>1?c:c[0]}prepareWASM(n){const o=[];if(n.subarray(0,4).toString("utf8")!=="\0asm")throw new Error("Invalid magic number");const c=n.readUInt32LE(4);if(c!=1)throw new Error("Invalid version: "+c);let l=8;o.push(n.subarray(0,l));function u(){let v=0,b=0,_;do _=n[l++],v|=(_&127)<<b,b+=7;while(_&128);return v}function d(){const b=n[l++]&1,_=u(),T=b?u():null;return{initial:_,max:T}}function h(){const v=u(),b=n.subarray(l,l+v);return l+=v,b.toString("utf8")}function y(v){const b=[];do{let _=v&127;v>>=7,v!==0&&(_|=128),b.push(_)}while(v!==0);return Buffer.from(b)}function p(v){const b=Buffer.from(v,"utf8");return Buffer.concat([y(b.length),b])}do{const v=l,b=n.readUInt8(l);l++;const _=u(),T=l+_;if(b==5)o.push(Buffer.from([5,1,0]));else if(b==2){const I=[],U=u();for(let L=0;L<U;L++){const B=l;h(),h();const H=n.readUInt8(l);l++;let W=!1;switch(H){case 0:u();break;case 1:l++,d();break;case 2:d(),W=!0;break;case 3:l++,l++;break;default:throw new Error("Invalid import kind: "+H)}W||I.push(n.subarray(B,l))}const N=Buffer.concat([p("env"),p("memory"),Buffer.from([2]),Buffer.from([0]),y(1)]);I.push(N);const D=Buffer.concat([y(I.length),...I]);o.push(Buffer.concat([Buffer.from([2]),y(D.length),D]))}else if(b==7){const I=[],U=u();for(let D=0;D<U;D++){const L=l;h();const B=n.readUInt8(l);l++,u(),B!==2&&I.push(n.subarray(L,l))}const N=Buffer.concat([y(I.length),...I]);o.push(Buffer.concat([Buffer.from([7]),y(N.length),N]))}else o.push(n.subarray(v,T));l=T}while(l<n.length);return Buffer.concat(o)}getRegisterLength(n){return BigInt(this.registers[n.toString()]?this.registers[n.toString()].length:Number.MAX_SAFE_INTEGER)}readFromRegister(n,o){new Uint8Array(this.memory.buffer).set(this.registers[n.toString()]||Buffer.from([]),Number(o))}getCurrentAccountId(n){this.registers[n.toString()]=Buffer.from(this.context.contractId)}inputMethodArgs(n){this.registers[n.toString()]=Buffer.from(this.context.methodArgs)}getBlockHeight(){return BigInt(this.context.blockHeight)}getBlockTimestamp(){return BigInt(this.context.blockTimestamp)}sha256(n,o,a){const c=new Uint8Array(this.memory.buffer,Number(o),Number(n)),l=(0,crypto_1$n.createHash)("sha256");l.update(c),this.registers[a.toString()]=l.digest()}returnValue(n,o){this.result=Buffer.from(new Uint8Array(this.memory.buffer,Number(o),Number(n)))}panic(n){throw new Error("panic: "+n)}abort(n,o,a,c){const l=this.readUTF16CStr(n),u=this.readUTF16CStr(o),d=`${l} ${u}:${a}:${c}`;throw!l||!u?new Error("abort: String encoding is bad UTF-16 sequence."):new Error("abort: "+d)}appendToLog(n,o){this.logs.push(this.readUTF8CStr(n,o))}readStorage(n,o,a){const c=this.storageRead(n,o);return c==null?BigInt(0):(this.registers[a]=c,BigInt(1))}hasStorageKey(n,o){return this.storageRead(n,o)==null?BigInt(0):BigInt(1)}getHostImports(){return{register_len:this.getRegisterLength.bind(this),read_register:this.readFromRegister.bind(this),current_account_id:this.getCurrentAccountId.bind(this),input:this.inputMethodArgs.bind(this),block_index:this.getBlockHeight.bind(this),block_timestamp:this.getBlockTimestamp.bind(this),sha256:this.sha256.bind(this),value_return:this.returnValue.bind(this),abort:this.abort.bind(this),log_utf8:this.appendToLog.bind(this),log_utf16:this.appendToLog.bind(this),storage_read:this.readStorage.bind(this),storage_has_key:this.hasStorageKey.bind(this),panic:()=>this.panic("explicit guest panic"),panic_utf8:(n,o)=>this.panic(this.readUTF8CStr(n,o)),epoch_height:notImplemented$3("epoch_height"),storage_usage:notImplemented$3("storage_usage"),account_balance:notImplemented$3("account_balance"),account_locked_balance:notImplemented$3("account_locked_balance"),random_seed:notImplemented$3("random_seed"),ripemd160:notImplemented$3("ripemd160"),keccak256:notImplemented$3("keccak256"),keccak512:notImplemented$3("keccak512"),ecrecover:notImplemented$3("ecrecover"),validator_stake:notImplemented$3("validator_stake"),validator_total_stake:notImplemented$3("validator_total_stake"),write_register:prohibitedInView$2("write_register"),signer_account_id:prohibitedInView$2("signer_account_id"),signer_account_pk:prohibitedInView$2("signer_account_pk"),predecessor_account_id:prohibitedInView$2("predecessor_account_id"),attached_deposit:prohibitedInView$2("attached_deposit"),prepaid_gas:prohibitedInView$2("prepaid_gas"),used_gas:prohibitedInView$2("used_gas"),promise_create:prohibitedInView$2("promise_create"),promise_then:prohibitedInView$2("promise_then"),promise_and:prohibitedInView$2("promise_and"),promise_batch_create:prohibitedInView$2("promise_batch_create"),promise_batch_then:prohibitedInView$2("promise_batch_then"),promise_batch_action_create_account:prohibitedInView$2("promise_batch_action_create_account"),promise_batch_action_deploy_contract:prohibitedInView$2("promise_batch_action_deploy_contract"),promise_batch_action_function_call:prohibitedInView$2("promise_batch_action_function_call"),promise_batch_action_function_call_weight:prohibitedInView$2("promise_batch_action_function_call_weight"),promise_batch_action_transfer:prohibitedInView$2("promise_batch_action_transfer"),promise_batch_action_stake:prohibitedInView$2("promise_batch_action_stake"),promise_batch_action_add_key_with_full_access:prohibitedInView$2("promise_batch_action_add_key_with_full_access"),promise_batch_action_add_key_with_function_call:prohibitedInView$2("promise_batch_action_add_key_with_function_call"),promise_batch_action_delete_key:prohibitedInView$2("promise_batch_action_delete_key"),promise_batch_action_delete_account:prohibitedInView$2("promise_batch_action_delete_account"),promise_results_count:prohibitedInView$2("promise_results_count"),promise_result:prohibitedInView$2("promise_result"),promise_return:prohibitedInView$2("promise_return"),storage_write:prohibitedInView$2("storage_write"),storage_remove:prohibitedInView$2("storage_remove")}}execute(n){return __awaiter$W(this,void 0,void 0,function*(){const o=yield WebAssembly.compile(this.wasm),c=(yield WebAssembly.instantiate(o,{env:Object.assign(Object.assign({},this.getHostImports()),{memory:this.memory})})).exports[n];if(c==null)throw new Error(`Contract method '${n}' does not exists in contract ${this.context.contractId} for block id ${this.context.blockHeight}`);return c(),{result:this.result,logs:this.logs}})}};runtime$2.Runtime=Runtime$2;var __awaiter$V=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})},__rest$6=commonjsGlobal$c&&commonjsGlobal$c.__rest||function(e,n){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,a=Object.getOwnPropertySymbols(e);c<a.length;c++)n.indexOf(a[c])<0&&Object.prototype.propertyIsEnumerable.call(e,a[c])&&(o[a[c]]=e[a[c]]);return o};Object.defineProperty(localViewExecution$2,"__esModule",{value:!0});localViewExecution$2.LocalViewExecution=void 0;const utils_1$y=lib$m,storage_1$2=storage$2,runtime_1$2=runtime$2,utils_2$8=utils$e;let LocalViewExecution$2=class{constructor(n){this.connection=n.getConnection(),this.storage=new storage_1$2.Storage}fetchContractCode(n,o){return __awaiter$V(this,void 0,void 0,function*(){return(yield this.connection.provider.query(Object.assign({request_type:"view_code",account_id:n},o))).code_base64})}fetchContractState(n,o){return __awaiter$V(this,void 0,void 0,function*(){return(0,utils_2$8.viewState)(this.connection,n,"",o)})}fetch(n,o){return __awaiter$V(this,void 0,void 0,function*(){const a=yield this.connection.provider.block(o),c=a.header.hash,l=a.header.height,u=a.header.timestamp,d=yield this.fetchContractCode(n,o),h=yield this.fetchContractState(n,o);return{blockHash:c,blockHeight:l,blockTimestamp:u,contractCode:d,contractState:h}})}loadOrFetch(n,o){return __awaiter$V(this,void 0,void 0,function*(){const a=this.storage.load(o);if(a)return a;const c=yield this.fetch(n,o),{blockHash:l}=c,u=__rest$6(c,["blockHash"]);return this.storage.save(l,u),u})}viewFunction(n){var{contractId:o,methodName:a,args:c={},blockQuery:l={finality:"optimistic"}}=n;return __rest$6(n,["contractId","methodName","args","blockQuery"]),__awaiter$V(this,void 0,void 0,function*(){const u=JSON.stringify(c),{contractCode:d,contractState:h,blockHeight:y,blockTimestamp:p}=yield this.loadOrFetch(o,l),v=new runtime_1$2.Runtime({contractId:o,contractCode:d,contractState:h,blockHeight:y,blockTimestamp:p,methodArgs:u}),{result:b,logs:_}=yield v.execute(a);return _&&(0,utils_1$y.printTxOutcomeLogs)({contractId:o,logs:_}),JSON.parse(Buffer.from(b).toString())})}};localViewExecution$2.LocalViewExecution=LocalViewExecution$2;var isMyJsonValid={exports:{}};function isProperty$2(e){return/^[$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc][$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc0-9\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19d9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f]*$/.test(e)}var isProperty_1=isProperty$2,isProperty$1=isProperty_1,gen=function(e,n){return isProperty$1(n)?e+"."+n:e+"["+JSON.stringify(n)+"]"};gen.valid=isProperty$1;gen.property=function(e){return isProperty$1(e)?e:JSON.stringify(e)};var generateObjectProperty=gen,util$1={},types$4={},shams$1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var n={},o=Symbol("test"),a=Object(o);if(typeof o=="string"||Object.prototype.toString.call(o)!=="[object Symbol]"||Object.prototype.toString.call(a)!=="[object Symbol]")return!1;var c=42;n[o]=c;for(var l in n)return!1;if(typeof Object.keys=="function"&&Object.keys(n).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(n).length!==0)return!1;var u=Object.getOwnPropertySymbols(n);if(u.length!==1||u[0]!==o||!Object.prototype.propertyIsEnumerable.call(n,o))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var d=Object.getOwnPropertyDescriptor(n,o);if(d.value!==c||d.enumerable!==!0)return!1}return!0},hasSymbols$2=shams$1,shams=function(){return hasSymbols$2()&&!!Symbol.toStringTag},esObjectAtoms=Object,esErrors=Error,_eval=EvalError,range$1=RangeError,ref=ReferenceError,syntax=SyntaxError,type,hasRequiredType;function requireType(){return hasRequiredType||(hasRequiredType=1,type=TypeError),type}var uri=URIError,abs$5=Math.abs,floor$e=Math.floor,max$e=Math.max,min$e=Math.min,pow$7=Math.pow,round$5=Math.round,_isNaN=Number.isNaN||function(n){return n!==n},$isNaN=_isNaN,sign$3=function(n){return $isNaN(n)||n===0?n:n<0?-1:1},gOPD$3=Object.getOwnPropertyDescriptor,$gOPD$1=gOPD$3;if($gOPD$1)try{$gOPD$1([],"length")}catch{$gOPD$1=null}var gopd$1=$gOPD$1,$defineProperty$3=Object.defineProperty||!1;if($defineProperty$3)try{$defineProperty$3({},"a",{value:1})}catch{$defineProperty$3=!1}var esDefineProperty=$defineProperty$3,hasSymbols$1,hasRequiredHasSymbols;function requireHasSymbols(){if(hasRequiredHasSymbols)return hasSymbols$1;hasRequiredHasSymbols=1;var e=typeof Symbol<"u"&&Symbol,n=shams$1;return hasSymbols$1=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:n()},hasSymbols$1}var Reflect_getPrototypeOf,hasRequiredReflect_getPrototypeOf;function requireReflect_getPrototypeOf(){return hasRequiredReflect_getPrototypeOf||(hasRequiredReflect_getPrototypeOf=1,Reflect_getPrototypeOf=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Reflect_getPrototypeOf}var Object_getPrototypeOf,hasRequiredObject_getPrototypeOf;function requireObject_getPrototypeOf(){if(hasRequiredObject_getPrototypeOf)return Object_getPrototypeOf;hasRequiredObject_getPrototypeOf=1;var e=esObjectAtoms;return Object_getPrototypeOf=e.getPrototypeOf||null,Object_getPrototypeOf}var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr$3=Object.prototype.toString,max$d=Math.max,funcType="[object Function]",concatty=function(n,o){for(var a=[],c=0;c<n.length;c+=1)a[c]=n[c];for(var l=0;l<o.length;l+=1)a[l+n.length]=o[l];return a},slicy=function(n,o){for(var a=[],c=o,l=0;c<n.length;c+=1,l+=1)a[l]=n[c];return a},joiny=function(e,n){for(var o="",a=0;a<e.length;a+=1)o+=e[a],a+1<e.length&&(o+=n);return o},implementation$1=function(n){var o=this;if(typeof o!="function"||toStr$3.apply(o)!==funcType)throw new TypeError(ERROR_MESSAGE+o);for(var a=slicy(arguments,1),c,l=function(){if(this instanceof c){var p=o.apply(this,concatty(a,arguments));return Object(p)===p?p:this}return o.apply(n,concatty(a,arguments))},u=max$d(0,o.length-a.length),d=[],h=0;h<u;h++)d[h]="$"+h;if(c=Function("binder","return function ("+joiny(d,",")+"){ return binder.apply(this,arguments); }")(l),o.prototype){var y=function(){};y.prototype=o.prototype,c.prototype=new y,y.prototype=null}return c},implementation=implementation$1,functionBind=Function.prototype.bind||implementation,functionCall$a=Function.prototype.call,functionApply,hasRequiredFunctionApply;function requireFunctionApply(){return hasRequiredFunctionApply||(hasRequiredFunctionApply=1,functionApply=Function.prototype.apply),functionApply}var reflectApply$1=typeof Reflect<"u"&&Reflect&&Reflect.apply,bind$f=functionBind,$apply$2=requireFunctionApply(),$call$2=functionCall$a,$reflectApply=reflectApply$1,actualApply$1=$reflectApply||bind$f.call($call$2,$apply$2),bind$e=functionBind,$TypeError$4=requireType(),$call$1=functionCall$a,$actualApply=actualApply$1,callBindApplyHelpers=function(n){if(n.length<1||typeof n[0]!="function")throw new $TypeError$4("a function is required");return $actualApply(bind$e,$call$1,n)},get$e,hasRequiredGet;function requireGet(){if(hasRequiredGet)return get$e;hasRequiredGet=1;var e=callBindApplyHelpers,n=gopd$1,o;try{o=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var a=!!o&&n&&n(Object.prototype,"__proto__"),c=Object,l=c.getPrototypeOf;return get$e=a&&typeof a.get=="function"?e([a.get]):typeof l=="function"?function(d){return l(d==null?d:c(d))}:!1,get$e}var getProto$2,hasRequiredGetProto;function requireGetProto(){if(hasRequiredGetProto)return getProto$2;hasRequiredGetProto=1;var e=requireReflect_getPrototypeOf(),n=requireObject_getPrototypeOf(),o=requireGet();return getProto$2=e?function(c){return e(c)}:n?function(c){if(!c||typeof c!="object"&&typeof c!="function")throw new TypeError("getProto: not an object");return n(c)}:o?function(c){return o(c)}:null,getProto$2}var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind$d=functionBind,hasown=bind$d.call(call,$hasOwn),undefined$1,$Object=esObjectAtoms,$Error=esErrors,$EvalError=_eval,$RangeError=range$1,$ReferenceError=ref,$SyntaxError$1=syntax,$TypeError$3=requireType(),$URIError=uri,abs$4=abs$5,floor$d=floor$e,max$c=max$e,min$d=min$e,pow$6=pow$7,round$4=round$5,sign$2=sign$3,$Function=Function,getEvalledConstructor=function(e){try{return $Function('"use strict"; return ('+e+").constructor;")()}catch{}},$gOPD=gopd$1,$defineProperty$2=esDefineProperty,throwTypeError=function(){throw new $TypeError$3},ThrowTypeError=$gOPD?function(){try{return arguments.callee,throwTypeError}catch{try{return $gOPD(arguments,"callee").get}catch{return throwTypeError}}}():throwTypeError,hasSymbols=requireHasSymbols()(),getProto$1=requireGetProto(),$ObjectGPO=requireObject_getPrototypeOf(),$ReflectGPO=requireReflect_getPrototypeOf(),$apply$1=requireFunctionApply(),$call=functionCall$a,needsEval={},TypedArray$5=typeof Uint8Array>"u"||!getProto$1?undefined$1:getProto$1(Uint8Array),INTRINSICS={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto$1?getProto$1([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float16Array%":typeof Float16Array>"u"?undefined$1:Float16Array,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto$1?getProto$1(getProto$1([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto$1?undefined$1:getProto$1(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":$Object,"%Object.getOwnPropertyDescriptor%":$gOPD,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto$1?undefined$1:getProto$1(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto$1?getProto$1(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError$1,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray$5,"%TypeError%":$TypeError$3,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":$URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet,"%Function.prototype.call%":$call,"%Function.prototype.apply%":$apply$1,"%Object.defineProperty%":$defineProperty$2,"%Object.getPrototypeOf%":$ObjectGPO,"%Math.abs%":abs$4,"%Math.floor%":floor$d,"%Math.max%":max$c,"%Math.min%":min$d,"%Math.pow%":pow$6,"%Math.round%":round$4,"%Math.sign%":sign$2,"%Reflect.getPrototypeOf%":$ReflectGPO};if(getProto$1)try{null.error}catch(e){var errorProto=getProto$1(getProto$1(e));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function e(n){var o;if(n==="%AsyncFunction%")o=getEvalledConstructor("async function () {}");else if(n==="%GeneratorFunction%")o=getEvalledConstructor("function* () {}");else if(n==="%AsyncGeneratorFunction%")o=getEvalledConstructor("async function* () {}");else if(n==="%AsyncGenerator%"){var a=e("%AsyncGeneratorFunction%");a&&(o=a.prototype)}else if(n==="%AsyncIteratorPrototype%"){var c=e("%AsyncGenerator%");c&&getProto$1&&(o=getProto$1(c.prototype))}return INTRINSICS[n]=o,o},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$c=functionBind,hasOwn$2=hasown,$concat=bind$c.call($call,Array.prototype.concat),$spliceApply=bind$c.call($apply$1,Array.prototype.splice),$replace=bind$c.call($call,String.prototype.replace),$strSlice=bind$c.call($call,String.prototype.slice),$exec$2=bind$c.call($call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(n){var o=$strSlice(n,0,1),a=$strSlice(n,-1);if(o==="%"&&a!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&o!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected opening `%`");var c=[];return $replace(n,rePropName,function(l,u,d,h){c[c.length]=d?$replace(h,reEscapeChar,"$1"):u||l}),c},getBaseIntrinsic=function(n,o){var a=n,c;if(hasOwn$2(LEGACY_ALIASES,a)&&(c=LEGACY_ALIASES[a],a="%"+c[0]+"%"),hasOwn$2(INTRINSICS,a)){var l=INTRINSICS[a];if(l===needsEval&&(l=doEval(a)),typeof l>"u"&&!o)throw new $TypeError$3("intrinsic "+n+" exists, but is not available. Please file an issue!");return{alias:c,name:a,value:l}}throw new $SyntaxError$1("intrinsic "+n+" does not exist!")},getIntrinsic=function(n,o){if(typeof n!="string"||n.length===0)throw new $TypeError$3("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof o!="boolean")throw new $TypeError$3('"allowMissing" argument must be a boolean');if($exec$2(/^%?[^%]*%?$/,n)===null)throw new $SyntaxError$1("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=stringToPath(n),c=a.length>0?a[0]:"",l=getBaseIntrinsic("%"+c+"%",o),u=l.name,d=l.value,h=!1,y=l.alias;y&&(c=y[0],$spliceApply(a,$concat([0,1],y)));for(var p=1,v=!0;p<a.length;p+=1){var b=a[p],_=$strSlice(b,0,1),T=$strSlice(b,-1);if((_==='"'||_==="'"||_==="`"||T==='"'||T==="'"||T==="`")&&_!==T)throw new $SyntaxError$1("property names with quotes must have matching quotes");if((b==="constructor"||!v)&&(h=!0),c+="."+b,u="%"+c+"%",hasOwn$2(INTRINSICS,u))d=INTRINSICS[u];else if(d!=null){if(!(b in d)){if(!o)throw new $TypeError$3("base intrinsic for "+n+" exists, but the property is not available.");return}if($gOPD&&p+1>=a.length){var I=$gOPD(d,b);v=!!I,v&&"get"in I&&!("originalValue"in I.get)?d=I.get:d=d[b]}else v=hasOwn$2(d,b),d=d[b];v&&!h&&(INTRINSICS[u]=d)}}return d},GetIntrinsic$1=getIntrinsic,callBindBasic=callBindApplyHelpers,$indexOf$1=callBindBasic([GetIntrinsic$1("%String.prototype.indexOf%")]),callBound$5=function(n,o){var a=GetIntrinsic$1(n,!!o);return typeof a=="function"&&$indexOf$1(n,".prototype.")>-1?callBindBasic([a]):a},hasToStringTag$4=shams(),callBound$4=callBound$5,$toString$2=callBound$4("Object.prototype.toString"),isStandardArguments=function(n){return hasToStringTag$4&&n&&typeof n=="object"&&Symbol.toStringTag in n?!1:$toString$2(n)==="[object Arguments]"},isLegacyArguments=function(n){return isStandardArguments(n)?!0:n!==null&&typeof n=="object"&&"length"in n&&typeof n.length=="number"&&n.length>=0&&$toString$2(n)!=="[object Array]"&&"callee"in n&&$toString$2(n.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments;var isArguments=supportsStandardArguments?isStandardArguments:isLegacyArguments,callBound$3=callBound$5,hasToStringTag$3=shams(),hasOwn$1=hasown,gOPD$2=gopd$1,fn;if(hasToStringTag$3){var $exec$1=callBound$3("RegExp.prototype.exec"),isRegexMarker={},throwRegexMarker=function(){throw isRegexMarker},badStringifier={toString:throwRegexMarker,valueOf:throwRegexMarker};typeof Symbol.toPrimitive=="symbol"&&(badStringifier[Symbol.toPrimitive]=throwRegexMarker),fn=function(n){if(!n||typeof n!="object")return!1;var o=gOPD$2(n,"lastIndex"),a=o&&hasOwn$1(o,"value");if(!a)return!1;try{$exec$1(n,badStringifier)}catch(c){return c===isRegexMarker}}}else{var $toString$1=callBound$3("Object.prototype.toString"),regexClass="[object RegExp]";fn=function(n){return!n||typeof n!="object"&&typeof n!="function"?!1:$toString$1(n)===regexClass}}var isRegex$1=fn,callBound$2=callBound$5,isRegex=isRegex$1,$exec=callBound$2("RegExp.prototype.exec"),$TypeError$2=requireType(),safeRegexTest$1=function(n){if(!isRegex(n))throw new $TypeError$2("`regex` must be a RegExp");return function(a){return $exec(n,a)!==null}},callBound$1=callBound$5,safeRegexTest=safeRegexTest$1,isFnRegex=safeRegexTest(/^\s*(?:function)?\*/),hasToStringTag$2=shams(),getProto=requireGetProto(),toStr$2=callBound$1("Object.prototype.toString"),fnToStr$1=callBound$1("Function.prototype.toString"),getGeneratorFunc=function(){if(!hasToStringTag$2)return!1;try{return Function("return function*() {}")()}catch{}},GeneratorFunction,isGeneratorFunction=function(n){if(typeof n!="function")return!1;if(isFnRegex(fnToStr$1(n)))return!0;if(!hasToStringTag$2){var o=toStr$2(n);return o==="[object GeneratorFunction]"}if(!getProto)return!1;if(typeof GeneratorFunction>"u"){var a=getGeneratorFunc();GeneratorFunction=a?getProto(a):!1}return getProto(n)===GeneratorFunction},fnToStr=Function.prototype.toString,reflectApply=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply=="function"&&typeof Object.defineProperty=="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(e){e!==isCallableMarker&&(reflectApply=null)}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(n){try{var o=fnToStr.call(n);return constructorRegex.test(o)}catch{return!1}},tryFunctionObject=function(n){try{return isES6ClassFn(n)?!1:(fnToStr.call(n),!0)}catch{return!1}},toStr$1=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag$1=typeof Symbol=="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document=="object"){var all=document.all;toStr$1.call(all)===toStr$1.call(document.all)&&(isDDA=function(n){if((isIE68||!n)&&(typeof n>"u"||typeof n=="object"))try{var o=toStr$1.call(n);return(o===ddaClass||o===ddaClass2||o===ddaClass3||o===objectClass)&&n("")==null}catch{}return!1})}var isCallable$1=reflectApply?function(n){if(isDDA(n))return!0;if(!n||typeof n!="function"&&typeof n!="object")return!1;try{reflectApply(n,null,badArrayLike)}catch(o){if(o!==isCallableMarker)return!1}return!isES6ClassFn(n)&&tryFunctionObject(n)}:function(n){if(isDDA(n))return!0;if(!n||typeof n!="function"&&typeof n!="object")return!1;if(hasToStringTag$1)return tryFunctionObject(n);if(isES6ClassFn(n))return!1;var o=toStr$1.call(n);return o!==fnClass&&o!==genClass&&!/^\[object HTML/.test(o)?!1:tryFunctionObject(n)},isCallable=isCallable$1,toStr=Object.prototype.toString,hasOwnProperty$d=Object.prototype.hasOwnProperty,forEachArray=function(n,o,a){for(var c=0,l=n.length;c<l;c++)hasOwnProperty$d.call(n,c)&&(a==null?o(n[c],c,n):o.call(a,n[c],c,n))},forEachString=function(n,o,a){for(var c=0,l=n.length;c<l;c++)a==null?o(n.charAt(c),c,n):o.call(a,n.charAt(c),c,n)},forEachObject=function(n,o,a){for(var c in n)hasOwnProperty$d.call(n,c)&&(a==null?o(n[c],c,n):o.call(a,n[c],c,n))};function isArray(e){return toStr.call(e)==="[object Array]"}var forEach$5=function(n,o,a){if(!isCallable(o))throw new TypeError("iterator must be a function");var c;arguments.length>=3&&(c=a),isArray(n)?forEachArray(n,o,c):typeof n=="string"?forEachString(n,o,c):forEachObject(n,o,c)},possibleTypedArrayNames=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],possibleNames=possibleTypedArrayNames,g$1=globalThis,availableTypedArrays$1=function(){for(var n=[],o=0;o<possibleNames.length;o++)typeof g$1[possibleNames[o]]=="function"&&(n[n.length]=possibleNames[o]);return n},callBind$1={exports:{}},$defineProperty$1=esDefineProperty,$SyntaxError=syntax,$TypeError$1=requireType(),gopd=gopd$1,defineDataProperty=function(n,o,a){if(!n||typeof n!="object"&&typeof n!="function")throw new $TypeError$1("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new $TypeError$1("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $TypeError$1("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $TypeError$1("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $TypeError$1("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $TypeError$1("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,h=!!gopd&&gopd(n,o);if($defineProperty$1)$defineProperty$1(n,o,{configurable:u===null&&h?h.configurable:!u,enumerable:c===null&&h?h.enumerable:!c,value:a,writable:l===null&&h?h.writable:!l});else if(d||!c&&!l&&!u)n[o]=a;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},$defineProperty=esDefineProperty,hasPropertyDescriptors=function(){return!!$defineProperty};hasPropertyDescriptors.hasArrayLengthDefineBug=function(){if(!$defineProperty)return null;try{return $defineProperty([],"length",{value:1}).length!==1}catch{return!0}};var hasPropertyDescriptors_1=hasPropertyDescriptors,GetIntrinsic=getIntrinsic,define=defineDataProperty,hasDescriptors=hasPropertyDescriptors_1(),gOPD$1=gopd$1,$TypeError=requireType(),$floor=GetIntrinsic("%Math.floor%"),setFunctionLength=function(n,o){if(typeof n!="function")throw new $TypeError("`fn` is not a function");if(typeof o!="number"||o<0||o>4294967295||$floor(o)!==o)throw new $TypeError("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],c=!0,l=!0;if("length"in n&&gOPD$1){var u=gOPD$1(n,"length");u&&!u.configurable&&(c=!1),u&&!u.writable&&(l=!1)}return(c||l||!a)&&(hasDescriptors?define(n,"length",o,!0,!0):define(n,"length",o)),n},bind$b=functionBind,$apply=requireFunctionApply(),actualApply=actualApply$1,applyBind=function(){return actualApply(bind$b,$apply,arguments)};(function(e){var n=setFunctionLength,o=esDefineProperty,a=callBindApplyHelpers,c=applyBind;e.exports=function(u){var d=a(arguments),h=u.length-(arguments.length-1);return n(d,1+(h>0?h:0),!0)},o?o(e.exports,"apply",{value:c}):e.exports.apply=c})(callBind$1);var callBindExports=callBind$1.exports,forEach$4=forEach$5,availableTypedArrays=availableTypedArrays$1,callBind=callBindExports,callBound=callBound$5,gOPD=gopd$1,$toString=callBound("Object.prototype.toString"),hasToStringTag=shams(),g=globalThis,typedArrays=availableTypedArrays(),$slice$4=callBound("String.prototype.slice"),getPrototypeOf$c=Object.getPrototypeOf,$indexOf=callBound("Array.prototype.indexOf",!0)||function(n,o){for(var a=0;a<n.length;a+=1)if(n[a]===o)return a;return-1},cache$3={__proto__:null};hasToStringTag&&gOPD&&getPrototypeOf$c?forEach$4(typedArrays,function(e){var n=new g[e];if(Symbol.toStringTag in n){var o=getPrototypeOf$c(n),a=gOPD(o,Symbol.toStringTag);if(!a){var c=getPrototypeOf$c(o);a=gOPD(c,Symbol.toStringTag)}cache$3["$"+e]=callBind(a.get)}}):forEach$4(typedArrays,function(e){var n=new g[e],o=n.slice||n.set;o&&(cache$3["$"+e]=callBind(o))});var tryTypedArrays=function(n){var o=!1;return forEach$4(cache$3,function(a,c){if(!o)try{"$"+a(n)===c&&(o=$slice$4(c,1))}catch{}}),o},trySlices=function(n){var o=!1;return forEach$4(cache$3,function(a,c){if(!o)try{a(n),o=$slice$4(c,1)}catch{}}),o},whichTypedArray$1=function(n){if(!n||typeof n!="object")return!1;if(!hasToStringTag){var o=$slice$4($toString(n),8,-1);return $indexOf(typedArrays,o)>-1?o:o!=="Object"?!1:trySlices(n)}return gOPD?tryTypedArrays(n):null},whichTypedArray=whichTypedArray$1,isTypedArray$5=function(n){return!!whichTypedArray(n)};(function(e){var n=isArguments,o=isGeneratorFunction,a=whichTypedArray$1,c=isTypedArray$5;function l(le){return le.call.bind(le)}var u=typeof BigInt<"u",d=typeof Symbol<"u",h=l(Object.prototype.toString),y=l(Number.prototype.valueOf),p=l(String.prototype.valueOf),v=l(Boolean.prototype.valueOf);if(u)var b=l(BigInt.prototype.valueOf);if(d)var _=l(Symbol.prototype.valueOf);function T(le,Ee){if(typeof le!="object")return!1;try{return Ee(le),!0}catch{return!1}}e.isArgumentsObject=n,e.isGeneratorFunction=o,e.isTypedArray=c;function I(le){return typeof Promise<"u"&&le instanceof Promise||le!==null&&typeof le=="object"&&typeof le.then=="function"&&typeof le.catch=="function"}e.isPromise=I;function U(le){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(le):c(le)||G(le)}e.isArrayBufferView=U;function N(le){return a(le)==="Uint8Array"}e.isUint8Array=N;function D(le){return a(le)==="Uint8ClampedArray"}e.isUint8ClampedArray=D;function L(le){return a(le)==="Uint16Array"}e.isUint16Array=L;function B(le){return a(le)==="Uint32Array"}e.isUint32Array=B;function H(le){return a(le)==="Int8Array"}e.isInt8Array=H;function W(le){return a(le)==="Int16Array"}e.isInt16Array=W;function X(le){return a(le)==="Int32Array"}e.isInt32Array=X;function Y(le){return a(le)==="Float32Array"}e.isFloat32Array=Y;function Z(le){return a(le)==="Float64Array"}e.isFloat64Array=Z;function te(le){return a(le)==="BigInt64Array"}e.isBigInt64Array=te;function V(le){return a(le)==="BigUint64Array"}e.isBigUint64Array=V;function P(le){return h(le)==="[object Map]"}P.working=typeof Map<"u"&&P(new Map);function A(le){return typeof Map>"u"?!1:P.working?P(le):le instanceof Map}e.isMap=A;function m(le){return h(le)==="[object Set]"}m.working=typeof Set<"u"&&m(new Set);function E(le){return typeof Set>"u"?!1:m.working?m(le):le instanceof Set}e.isSet=E;function w(le){return h(le)==="[object WeakMap]"}w.working=typeof WeakMap<"u"&&w(new WeakMap);function C(le){return typeof WeakMap>"u"?!1:w.working?w(le):le instanceof WeakMap}e.isWeakMap=C;function k(le){return h(le)==="[object WeakSet]"}k.working=typeof WeakSet<"u"&&k(new WeakSet);function O(le){return k(le)}e.isWeakSet=O;function S(le){return h(le)==="[object ArrayBuffer]"}S.working=typeof ArrayBuffer<"u"&&S(new ArrayBuffer);function M(le){return typeof ArrayBuffer>"u"?!1:S.working?S(le):le instanceof ArrayBuffer}e.isArrayBuffer=M;function x(le){return h(le)==="[object DataView]"}x.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&x(new DataView(new ArrayBuffer(1),0,1));function G(le){return typeof DataView>"u"?!1:x.working?x(le):le instanceof DataView}e.isDataView=G;var z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ee(le){return h(le)==="[object SharedArrayBuffer]"}function ne(le){return typeof z>"u"?!1:(typeof ee.working>"u"&&(ee.working=ee(new z)),ee.working?ee(le):le instanceof z)}e.isSharedArrayBuffer=ne;function fe(le){return h(le)==="[object AsyncFunction]"}e.isAsyncFunction=fe;function de(le){return h(le)==="[object Map Iterator]"}e.isMapIterator=de;function oe(le){return h(le)==="[object Set Iterator]"}e.isSetIterator=oe;function ue(le){return h(le)==="[object Generator]"}e.isGeneratorObject=ue;function se(le){return h(le)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=se;function ie(le){return T(le,y)}e.isNumberObject=ie;function ce(le){return T(le,p)}e.isStringObject=ce;function he(le){return T(le,v)}e.isBooleanObject=he;function ve(le){return u&&T(le,b)}e.isBigIntObject=ve;function be(le){return d&&T(le,_)}e.isSymbolObject=be;function ge(le){return ie(le)||ce(le)||he(le)||ve(le)||be(le)}e.isBoxedPrimitive=ge;function me(le){return typeof Uint8Array<"u"&&(M(le)||ne(le))}e.isAnyArrayBuffer=me,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(le){Object.defineProperty(e,le,{enumerable:!1,value:function(){throw new Error(le+" is not supported in userland")}})})})(types$4);var isBufferBrowser=function(n){return n&&typeof n=="object"&&typeof n.copy=="function"&&typeof n.fill=="function"&&typeof n.readUInt8=="function"};(function(e){var n={},o=Object.getOwnPropertyDescriptors||function(z){for(var ee=Object.keys(z),ne={},fe=0;fe<ee.length;fe++)ne[ee[fe]]=Object.getOwnPropertyDescriptor(z,ee[fe]);return ne},a=/%[sdj%]/g;e.format=function(G){if(!W(G)){for(var z=[],ee=0;ee<arguments.length;ee++)z.push(d(arguments[ee]));return z.join(" ")}for(var ee=1,ne=arguments,fe=ne.length,de=String(G).replace(a,function(ue){if(ue==="%%")return"%";if(ee>=fe)return ue;switch(ue){case"%s":return String(ne[ee++]);case"%d":return Number(ne[ee++]);case"%j":try{return JSON.stringify(ne[ee++])}catch{return"[Circular]"}default:return ue}}),oe=ne[ee];ee<fe;oe=ne[++ee])L(oe)||!te(oe)?de+=" "+oe:de+=" "+d(oe);return de},e.deprecate=function(G,z){if(typeof process<"u"&&process.noDeprecation===!0)return G;if(typeof process>"u")return function(){return e.deprecate(G,z).apply(this,arguments)};var ee=!1;function ne(){if(!ee){if(process.throwDeprecation)throw new Error(z);process.traceDeprecation?console.trace(z):console.error(z),ee=!0}return G.apply(this,arguments)}return ne};var c={},l=/^$/;if(n.NODE_DEBUG){var u=n.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),l=new RegExp("^"+u+"$","i")}e.debuglog=function(G){if(G=G.toUpperCase(),!c[G])if(l.test(G)){var z=process.pid;c[G]=function(){var ee=e.format.apply(e,arguments);console.error("%s %d: %s",G,z,ee)}}else c[G]=function(){};return c[G]};function d(G,z){var ee={seen:[],stylize:y};return arguments.length>=3&&(ee.depth=arguments[2]),arguments.length>=4&&(ee.colors=arguments[3]),D(z)?ee.showHidden=z:z&&e._extend(ee,z),Y(ee.showHidden)&&(ee.showHidden=!1),Y(ee.depth)&&(ee.depth=2),Y(ee.colors)&&(ee.colors=!1),Y(ee.customInspect)&&(ee.customInspect=!0),ee.colors&&(ee.stylize=h),v(ee,G,ee.depth)}e.inspect=d,d.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},d.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function h(G,z){var ee=d.styles[z];return ee?"\x1B["+d.colors[ee][0]+"m"+G+"\x1B["+d.colors[ee][1]+"m":G}function y(G,z){return G}function p(G){var z={};return G.forEach(function(ee,ne){z[ee]=!0}),z}function v(G,z,ee){if(G.customInspect&&z&&A(z.inspect)&&z.inspect!==e.inspect&&!(z.constructor&&z.constructor.prototype===z)){var ne=z.inspect(ee,G);return W(ne)||(ne=v(G,ne,ee)),ne}var fe=b(G,z);if(fe)return fe;var de=Object.keys(z),oe=p(de);if(G.showHidden&&(de=Object.getOwnPropertyNames(z)),P(z)&&(de.indexOf("message")>=0||de.indexOf("description")>=0))return _(z);if(de.length===0){if(A(z)){var ue=z.name?": "+z.name:"";return G.stylize("[Function"+ue+"]","special")}if(Z(z))return G.stylize(RegExp.prototype.toString.call(z),"regexp");if(V(z))return G.stylize(Date.prototype.toString.call(z),"date");if(P(z))return _(z)}var se="",ie=!1,ce=["{","}"];if(N(z)&&(ie=!0,ce=["[","]"]),A(z)){var he=z.name?": "+z.name:"";se=" [Function"+he+"]"}if(Z(z)&&(se=" "+RegExp.prototype.toString.call(z)),V(z)&&(se=" "+Date.prototype.toUTCString.call(z)),P(z)&&(se=" "+_(z)),de.length===0&&(!ie||z.length==0))return ce[0]+se+ce[1];if(ee<0)return Z(z)?G.stylize(RegExp.prototype.toString.call(z),"regexp"):G.stylize("[Object]","special");G.seen.push(z);var ve;return ie?ve=T(G,z,ee,oe,de):ve=de.map(function(be){return I(G,z,ee,oe,be,ie)}),G.seen.pop(),U(ve,se,ce)}function b(G,z){if(Y(z))return G.stylize("undefined","undefined");if(W(z)){var ee="'"+JSON.stringify(z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return G.stylize(ee,"string")}if(H(z))return G.stylize(""+z,"number");if(D(z))return G.stylize(""+z,"boolean");if(L(z))return G.stylize("null","null")}function _(G){return"["+Error.prototype.toString.call(G)+"]"}function T(G,z,ee,ne,fe){for(var de=[],oe=0,ue=z.length;oe<ue;++oe)O(z,String(oe))?de.push(I(G,z,ee,ne,String(oe),!0)):de.push("");return fe.forEach(function(se){se.match(/^\d+$/)||de.push(I(G,z,ee,ne,se,!0))}),de}function I(G,z,ee,ne,fe,de){var oe,ue,se;if(se=Object.getOwnPropertyDescriptor(z,fe)||{value:z[fe]},se.get?se.set?ue=G.stylize("[Getter/Setter]","special"):ue=G.stylize("[Getter]","special"):se.set&&(ue=G.stylize("[Setter]","special")),O(ne,fe)||(oe="["+fe+"]"),ue||(G.seen.indexOf(se.value)<0?(L(ee)?ue=v(G,se.value,null):ue=v(G,se.value,ee-1),ue.indexOf(``)>-1&&(de?ue=ue.split(``).map(function(ie){return" "+ie}).join(``).slice(2):ue=``+ue.split(``).map(function(ie){return" "+ie}).join(``))):ue=G.stylize("[Circular]","special")),Y(oe)){if(de&&fe.match(/^\d+$/))return ue;oe=JSON.stringify(""+fe),oe.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(oe=oe.slice(1,-1),oe=G.stylize(oe,"name")):(oe=oe.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),oe=G.stylize(oe,"string"))}return oe+": "+ue}function U(G,z,ee){var ne=G.reduce(function(fe,de){return de.indexOf(``)>=0,fe+de.replace(/\u001b\[\d\d?m/g,"").length+1},0);return ne>60?ee[0]+(z===""?"":z+``)+" "+G.join(`,`)+" "+ee[1]:ee[0]+z+" "+G.join(", ")+" "+ee[1]}e.types=types$4;function N(G){return Array.isArray(G)}e.isArray=N;function D(G){return typeof G=="boolean"}e.isBoolean=D;function L(G){return G===null}e.isNull=L;function B(G){return G==null}e.isNullOrUndefined=B;function H(G){return typeof G=="number"}e.isNumber=H;function W(G){return typeof G=="string"}e.isString=W;function X(G){return typeof G=="symbol"}e.isSymbol=X;function Y(G){return G===void 0}e.isUndefined=Y;function Z(G){return te(G)&&E(G)==="[object RegExp]"}e.isRegExp=Z,e.types.isRegExp=Z;function te(G){return typeof G=="object"&&G!==null}e.isObject=te;function V(G){return te(G)&&E(G)==="[object Date]"}e.isDate=V,e.types.isDate=V;function P(G){return te(G)&&(E(G)==="[object Error]"||G instanceof Error)}e.isError=P,e.types.isNativeError=P;function A(G){return typeof G=="function"}e.isFunction=A;function m(G){return G===null||typeof G=="boolean"||typeof G=="number"||typeof G=="string"||typeof G=="symbol"||typeof G>"u"}e.isPrimitive=m,e.isBuffer=isBufferBrowser;function E(G){return Object.prototype.toString.call(G)}function w(G){return G<10?"0"+G.toString(10):G.toString(10)}var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var G=new Date,z=[w(G.getHours()),w(G.getMinutes()),w(G.getSeconds())].join(":");return[G.getDate(),C[G.getMonth()],z].join(" ")}e.log=function(){console.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=inherits_browserExports$1,e._extend=function(G,z){if(!z||!te(z))return G;for(var ee=Object.keys(z),ne=ee.length;ne--;)G[ee[ne]]=z[ee[ne]];return G};function O(G,z){return Object.prototype.hasOwnProperty.call(G,z)}var S=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(z){if(typeof z!="function")throw new TypeError('The "original" argument must be of type Function');if(S&&z[S]){var ee=z[S];if(typeof ee!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(ee,S,{value:ee,enumerable:!1,writable:!1,configurable:!0}),ee}function ee(){for(var ne,fe,de=new Promise(function(se,ie){ne=se,fe=ie}),oe=[],ue=0;ue<arguments.length;ue++)oe.push(arguments[ue]);oe.push(function(se,ie){se?fe(se):ne(ie)});try{z.apply(this,oe)}catch(se){fe(se)}return de}return Object.setPrototypeOf(ee,Object.getPrototypeOf(z)),S&&Object.defineProperty(ee,S,{value:ee,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(ee,o(z))},e.promisify.custom=S;function M(G,z){if(!G){var ee=new Error("Promise was rejected with a falsy value");ee.reason=G,G=ee}return z(G)}function x(G){if(typeof G!="function")throw new TypeError('The "original" argument must be of type Function');function z(){for(var ee=[],ne=0;ne<arguments.length;ne++)ee.push(arguments[ne]);var fe=ee.pop();if(typeof fe!="function")throw new TypeError("The last argument must be of type Function");var de=this,oe=function(){return fe.apply(de,arguments)};G.apply(this,ee).then(function(ue){process.nextTick(oe.bind(null,null,ue))},function(ue){process.nextTick(M.bind(null,ue,oe))})}return Object.setPrototypeOf(z,Object.getPrototypeOf(G)),Object.defineProperties(z,o(G)),z}e.callbackify=x})(util$1);var util=util$1,isProperty=isProperty_1,INDENT_START=/[\{\[]/,INDENT_END=/[\}\]]/,RESERVED=["do","if","in","for","let","new","try","var","case","else","enum","eval","null","this","true","void","with","await","break","catch","class","const","false","super","throw","while","yield","delete","export","import","public","return","static","switch","typeof","default","extends","finally","package","private","continue","debugger","function","arguments","interface","protected","implements","instanceof","NaN","undefined"],RESERVED_MAP={};for(var i=0;i<RESERVED.length;i++)RESERVED_MAP[RESERVED[i]]=!0;var isVariable=function(e){return isProperty(e)&&!RESERVED_MAP.hasOwnProperty(e)},formats$1={s:function(e){return""+e},d:function(e){return""+Number(e)},o:function(e){return JSON.stringify(e)}},genfun=function(){var e=[],n=0,o={},a=function(u){for(var d="";d.length<n*2;)d+=" ";e.push(d+u)},c=function(u){if(INDENT_END.test(u.trim()[0])&&INDENT_START.test(u[u.length-1])){n--,a(u),n++;return}if(INDENT_START.test(u[u.length-1])){a(u),n++;return}if(INDENT_END.test(u.trim()[0])){n--,a(u);return}a(u)},l=function(u){if(!u)return l;if(arguments.length===1&&u.indexOf(``)>-1)for(var d=u.trim().split(``),h=0;h<d.length;h++)c(d[h].trim());else c(util.format.apply(util,arguments));return l};return l.scope={},l.formats=formats$1,l.sym=function(u){return(!u||!isVariable(u))&&(u="tmp"),o[u]||(o[u]=0),u+(o[u]++||"")},l.property=function(u,d){return arguments.length===1&&(d=u,u=""),d=d+"",isProperty(d)?u?u+"."+d:d:u?u+"["+JSON.stringify(d)+"]":JSON.stringify(d)},l.toString=function(){return e.join(``)},l.toFunction=function(u){u||(u={});var d="return ("+l.toString()+")";Object.keys(l.scope).forEach(function(p){u[p]||(u[p]=l.scope[p])});var h=Object.keys(u).map(function(p){return p}),y=h.map(function(p){return u[p]});return Function.apply(null,h.concat(d)).apply(null,y)},arguments.length&&l.apply(null,arguments),l};genfun.formats=formats$1;var generateFunction=genfun,jsonpointer={},hasExcape=/~/,escapeMatcher=/~[01]/g;function escapeReplacer(e){switch(e){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+e)}function untilde(e){return hasExcape.test(e)?e.replace(escapeMatcher,escapeReplacer):e}function setter(e,n,o){for(var a,c,l=1,u=n.length;l<u;){if(n[l]==="constructor"||n[l]==="prototype"||n[l]==="__proto__")return e;if(a=untilde(n[l++]),c=u>l,typeof e[a]>"u"&&(Array.isArray(e)&&a==="-"&&(a=e.length),c&&(n[l]!==""&&n[l]<1/0||n[l]==="-"?e[a]=[]:e[a]={})),!c)break;e=e[a]}var d=e[a];return o===void 0?delete e[a]:e[a]=o,d}function compilePointer(e){if(typeof e=="string"){if(e=e.split("/"),e[0]==="")return e;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(e)){for(const n of e)if(typeof n!="string"&&typeof n!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return e}throw new Error("Invalid JSON pointer.")}function get$d(e,n){if(typeof e!="object")throw new Error("Invalid input object.");n=compilePointer(n);var o=n.length;if(o===1)return e;for(var a=1;a<o;){if(e=e[untilde(n[a++])],o===a)return e;if(typeof e!="object"||e===null)return}}function set$d(e,n,o){if(typeof e!="object")throw new Error("Invalid input object.");if(n=compilePointer(n),n.length===0)throw new Error("Invalid JSON pointer for set.");return setter(e,n,o)}function compile(e){var n=compilePointer(e);return{get:function(o){return get$d(o,n)},set:function(o,a){return set$d(o,n,a)}}}jsonpointer.get=get$d;jsonpointer.set=set$d;jsonpointer.compile=compile;var immutable=extend,hasOwnProperty$c=Object.prototype.hasOwnProperty;function extend(){for(var e={},n=0;n<arguments.length;n++){var o=arguments[n];for(var a in o)hasOwnProperty$c.call(o,a)&&(e[a]=o[a])}return e}var formats={},isMyIpValid={exports:{}};(function(e){var n=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o=/\/\d{1,3}(?=%|$)/,a=/\//,c=/%.*$/,l=/([^0-9a-f:/%])/i,u=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/i;function d(p){if(!n.test(p))return!1;var v=p.split(".");if(v.length!==4||v[0][0]==="0"&&v[0].length>1||v[1][0]==="0"&&v[1].length>1||v[2][0]==="0"&&v[2].length>1||v[3][0]==="0"&&v[3].length>1)return!1;var b=Number(v[0]),_=Number(v[1]),T=Number(v[2]),I=Number(v[3]);return b>=0&&b<256&&_>=0&&_<256&&T>=0&&T<256&&I>=0&&I<256}function h(p){var v=p.replace(o,""),b=p.length!==v.length;if(b||!b&&a.test(p))return!1;var _=v.replace(c,""),T=_.lastIndexOf(":");if(T===-1)return!1;var I=_.substring(T+1),U=d(I),N=U?_.substring(0,T+1)+"1234:5678":_;if(l.test(N)||u.test(N))return!1;var D=N.split("::");if(D.length>2)return!1;if(D.length===2){var L=D[0]===""?[]:D[0].split(":"),B=D[1]===""?[]:D[1].split(":"),H=8-(L.length+B.length);if(H<=0)return!1}else if(N.split(":").length!==8)return!1;return!0}function y(p){return d(p)||h(p)}e.exports=function(v){if(v||(v={}),v.version===4)return d;if(v.version===6)return h;if(v.version==null)return y;throw new Error("Unknown version: "+v.version)},e.exports.__all_regexes__=[n,o,a,c,l,u]})(isMyIpValid);var isMyIpValidExports=isMyIpValid.exports;(function(e){var n=isMyIpValidExports,o=/\s/,a=/^[a-zA-Z0-9.-]+$/,c=/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/,l=/^\+[0-9][0-9 ]{5,27}[0-9]$/,u=/ {2}/,d=/ /g;e["date-time"]=/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-[0-9]{2}[tT ]\d{2}:\d{2}:\d{2}(?:\.\d+|)([zZ]|[+-]\d{2}:\d{2})$/,e.date=/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-[0-9]{2}$/,e.time=/^\d{2}:\d{2}:\d{2}$/,e.email=function(h){return h.indexOf("@")!==-1&&!o.test(h)},e["ip-address"]=e.ipv4=n({version:4}),e.ipv6=n({version:6}),e.uri=/^[a-zA-Z][a-zA-Z0-9+\-.]*:[^\s]*$/,e.color=/(#?([0-9A-Fa-f]{3,6})\b)|(aqua)|(black)|(blue)|(fuchsia)|(gray)|(green)|(lime)|(maroon)|(navy)|(olive)|(orange)|(purple)|(red)|(silver)|(teal)|(white)|(yellow)|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\))/,e.hostname=function(h){if(!a.test(h))return!1;for(var y=h.split("."),p=0;p<y.length;p++)if(!c.test(y[p]))return!1;return!0},e.alpha=/^[a-zA-Z]+$/,e.alphanumeric=/^[a-zA-Z0-9]+$/,e.style=/.:\s*[^;]/g,e.phone=function(h){if(!l.test(h)||u.test(h))return!1;var y=h.substring(1).replace(d,"").length;return y>=7&&y<=15},e["utc-millisec"]=/^[0-9]{1,15}\.?[0-9]{0,15}$/})(formats);isMyJsonValid.exports;(function(e){var n=generateObjectProperty,o=generateFunction,a=jsonpointer,c=immutable,l=formats,u=function(b,_,T){var I=function(H){return H&&H.id===T?H:typeof H!="object"||!H?null:Object.keys(H).reduce(function(W,X){return W||I(H[X])},null)},U=I(b);if(U)return U;T=T.replace(/^#/,""),T=T.replace(/\/$/,"");try{return a.get(b,decodeURI(T))}catch{var N=T.indexOf("#"),D;if(N!==0)if(N===-1)D=_[T];else{var L=T.slice(0,N);D=_[L];var B=T.slice(N).replace(/^#/,"");try{return a.get(D,B)}catch{}}else D=_[T];return D||null}},d={};d.any=function(){return"true"},d.null=function(b){return b+" === null"},d.boolean=function(b){return"typeof "+b+' === "boolean"'},d.array=function(b){return"Array.isArray("+b+")"},d.object=function(b){return"typeof "+b+' === "object" && '+b+" && !Array.isArray("+b+")"},d.number=function(b){return"typeof "+b+' === "number" && isFinite('+b+")"},d.integer=function(b){return"typeof "+b+' === "number" && (Math.floor('+b+") === "+b+" || "+b+" > 9007199254740992 || "+b+" < -9007199254740992)"},d.string=function(b){return"typeof "+b+' === "string"'};var h=function(b,_){_=Math.min(_===-1?b.length:_,b.length);for(var T=[],I=0;I<_;I++)T.push(typeof b[I]=="object"?JSON.stringify(b[I]):b[I]);for(var I=1;I<T.length;I++)if(T.indexOf(T[I])!==I)return!1;return!0},y=function(b,_){var T,I=(_|0)!==_?Math.pow(10,_.toString().split(".").pop().length):1;if(I>1){var U=(b|0)!==b?Math.pow(10,b.toString().split(".").pop().length):1;U>I?T=!0:T=Math.round(I*b)%(I*_)}else T=b%_;return!T},p=function(b,_,T){return T>-1&&_.length>T?!0:b.test(_)},v=function(b,_,T,I,U){var N=U?c(l,U.formats):l,D={unique:h,formats:N,isMultipleOf:y,testLimitedRegex:p},L=U?!!U.verbose:!1,B=U&&U.greedy!==void 0?U.greedy:!1,H={},W=[],X=function(E){var w=E+(H[E]=(H[E]||0)+1);return W.push(w),w},Y=function(E){var w=JSON.stringify(E);try{for(var C=/\[([^\[\]"]+)\]/;C.test(w);)w=w.replace(C,k);return w}catch{return JSON.stringify(E)}function k(O,S){if(W.indexOf(S)===-1)throw new Error("Unreplaceable");return'." + '+S+' + "'}},Z={},te=function(E){if(Z[E])return Z[E];var w=X("pattern");return D[w]=new RegExp(E),Z[E]=w,w},V=["i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y","z"],P=function(){var E=V.shift();return V.push(E+E[0]),W.push(E),E},A=function(E,w,C,k,O){var S=w.properties,M=w.type,x=!1;Array.isArray(w.items)&&(S={},w.items.forEach(function(Ee,_e){S[_e]=Ee}),M="array",x=!0);var G=0,z=function(Ee,_e,Se){m("errors++"),C===!0&&(m("if (validate.errors === null) validate.errors = []"),L?m("validate.errors.push({field:%s,message:%s,value:%s,type:%s,schemaPath:%s})",Y(_e||E),JSON.stringify(Ee),Se||E,JSON.stringify(M),JSON.stringify(O)):m("validate.errors.push({field:%s,message:%s})",Y(_e||E),JSON.stringify(Ee)))};w.required===!0?(G++,m("if (%s === undefined) {",E),z("is required"),m("} else {")):(G++,m("if (%s !== undefined) {",E));var ee=[].concat(M).map(function(Ee){if(Ee&&!d.hasOwnProperty(Ee))throw new Error("Unknown type: "+Ee);return d[Ee||"any"](E)}).join(" || ")||"true";if(ee!=="true"&&(G++,m("if (!(%s)) {",ee),z("is the wrong type"),m("} else {")),x){if(w.additionalItems===!1)m("if (%s.length > %d) {",E,w.items.length),z("has additional items"),m("}");else if(w.additionalItems){var ne=P();m("for (var %s = %d; %s < %s.length; %s++) {",ne,w.items.length,ne,E,ne),A(E+"["+ne+"]",w.additionalItems,C,k,O.concat("additionalItems")),m("}")}}if(w.format&&N[w.format]){M!=="string"&&l[w.format]&&m("if (%s) {",d.string(E));var fe=X("format");D[fe]=N[w.format],typeof D[fe]=="function"?m("if (!%s(%s)) {",fe,E):m("if (!testLimitedRegex(%s, %s, %d)) {",fe,E,typeof w.maxLength>"u"?-1:w.maxLength),z("must be "+w.format+" format"),m("}"),M!=="string"&&l[w.format]&&m("}")}if(Array.isArray(w.required)){var fe=X("missing");m("var %s = 0",fe);var de=function(_e){var Se=n(E,_e);m("if (%s === undefined) {",Se),z("is required",Se),m("%s++",fe),m("}")};m("if ((%s)) {",M!=="object"?d.object(E):"true"),w.required.map(de),m("}"),B||(m("if (%s === 0) {",fe),G++)}if(w.uniqueItems&&(M!=="array"&&m("if (%s) {",d.array(E)),m("if (!(unique(%s, %d))) {",E,w.maxItems||-1),z("must be unique"),m("}"),M!=="array"&&m("}")),w.enum){var oe=w.enum.some(function(Ee){return typeof Ee=="object"}),ue=oe?function(Ee){return"JSON.stringify("+E+") !== JSON.stringify("+JSON.stringify(Ee)+")"}:function(Ee){return E+" !== "+JSON.stringify(Ee)};m("if (%s) {",w.enum.map(ue).join(" && ")||"false"),z("must be an enum value"),m("}")}if(w.dependencies&&(M!=="object"&&m("if (%s) {",d.object(E)),Object.keys(w.dependencies).forEach(function(Ee){var _e=w.dependencies[Ee];typeof _e=="string"&&(_e=[_e]);var Se=function(we){return n(E,we)+" !== undefined"};Array.isArray(_e)&&(m("if (%s !== undefined && !(%s)) {",n(E,Ee),_e.map(Se).join(" && ")||"true"),z("dependencies not set"),m("}")),typeof _e=="object"&&(m("if (%s !== undefined) {",n(E,Ee)),A(E,_e,C,k,O.concat(["dependencies",Ee])),m("}"))}),M!=="object"&&m("}")),w.additionalProperties||w.additionalProperties===!1){M!=="object"&&m("if (%s) {",d.object(E));var ne=P(),se=X("keys"),ie=function(_e){return se+"["+ne+"] !== "+JSON.stringify(_e)},ce=function(_e){return"!"+te(_e)+".test("+se+"["+ne+"])"},he=Object.keys(S||{}).map(ie).concat(Object.keys(w.patternProperties||{}).map(ce)).join(" && ")||"true";m("var %s = Object.keys(%s)",se,E)("for (var %s = 0; %s < %s.length; %s++) {",ne,ne,se,ne)("if (%s) {",he),w.additionalProperties===!1?(k&&m("delete %s",E+"["+se+"["+ne+"]]"),z("has additional properties",null,JSON.stringify(E+".")+" + "+se+"["+ne+"]")):A(E+"["+se+"["+ne+"]]",w.additionalProperties,C,k,O.concat(["additionalProperties"])),m("}")("}"),M!=="object"&&m("}")}if(w.$ref){var ve=u(T,U&&U.schemas||{},w.$ref);if(ve){var be=_[w.$ref];be||(_[w.$ref]=function(Se){return be(Se)},be=v(ve,_,T,!1,U));var fe=X("ref");D[fe]=be,m("if (!(%s(%s))) {",fe,E),z("referenced schema does not match"),m("}")}}if(w.not){var ge=X("prev");m("var %s = errors",ge),A(E,w.not,!1,k,O.concat("not")),m("if (%s === errors) {",ge),z("negative schema matches"),m("} else {")("errors = %s",ge)("}")}if(w.items&&!x){M!=="array"&&m("if (%s) {",d.array(E));var ne=P();m("for (var %s = 0; %s < %s.length; %s++) {",ne,ne,E,ne),A(E+"["+ne+"]",w.items,C,k,O.concat("items")),m("}"),M!=="array"&&m("}")}if(w.patternProperties){M!=="object"&&m("if (%s) {",d.object(E));var se=X("keys"),ne=P();m("var %s = Object.keys(%s)",se,E)("for (var %s = 0; %s < %s.length; %s++) {",ne,ne,se,ne),Object.keys(w.patternProperties).forEach(function(Se){var we=te(Se);m("if (%s.test(%s)) {",we,se+"["+ne+"]"),A(E+"["+se+"["+ne+"]]",w.patternProperties[Se],C,k,O.concat(["patternProperties",Se])),m("}")}),m("}"),M!=="object"&&m("}")}if(w.pattern){var me=te(w.pattern);M!=="string"&&m("if (%s) {",d.string(E)),m("if (!(testLimitedRegex(%s, %s, %d))) {",me,E,typeof w.maxLength>"u"?-1:w.maxLength),z("pattern mismatch"),m("}"),M!=="string"&&m("}")}if(w.allOf&&w.allOf.forEach(function(Ee,_e){A(E,Ee,C,k,O.concat(["allOf",_e]))}),w.anyOf&&w.anyOf.length){var ge=X("prev");w.anyOf.forEach(function(_e,Se){Se===0?m("var %s = errors",ge):m("if (errors !== %s) {",ge)("errors = %s",ge),A(E,_e,!1,!1,O)}),w.anyOf.forEach(function(_e,Se){Se&&m("}")}),m("if (%s !== errors) {",ge),z("no schemas match"),m("}")}if(w.oneOf&&w.oneOf.length){var ge=X("prev"),le=X("passes");m("var %s = errors",ge)("var %s = 0",le),w.oneOf.forEach(function(_e,Se){A(E,_e,!1,!1,O),m("if (%s === errors) {",ge)("%s++",le)("} else {")("errors = %s",ge)("}")}),m("if (%s !== 1) {",le),z("no (or more than one) schemas match"),m("}")}for(w.multipleOf!==void 0&&(M!=="number"&&M!=="integer"&&m("if (%s) {",d.number(E)),m("if (!isMultipleOf(%s, %d)) {",E,w.multipleOf),z("has a remainder"),m("}"),M!=="number"&&M!=="integer"&&m("}")),w.maxProperties!==void 0&&(M!=="object"&&m("if (%s) {",d.object(E)),m("if (Object.keys(%s).length > %d) {",E,w.maxProperties),z("has more properties than allowed"),m("}"),M!=="object"&&m("}")),w.minProperties!==void 0&&(M!=="object"&&m("if (%s) {",d.object(E)),m("if (Object.keys(%s).length < %d) {",E,w.minProperties),z("has less properties than allowed"),m("}"),M!=="object"&&m("}")),w.maxItems!==void 0&&(M!=="array"&&m("if (%s) {",d.array(E)),m("if (%s.length > %d) {",E,w.maxItems),z("has more items than allowed"),m("}"),M!=="array"&&m("}")),w.minItems!==void 0&&(M!=="array"&&m("if (%s) {",d.array(E)),m("if (%s.length < %d) {",E,w.minItems),z("has less items than allowed"),m("}"),M!=="array"&&m("}")),w.maxLength!==void 0&&(M!=="string"&&m("if (%s) {",d.string(E)),m("if (%s.length > %d) {",E,w.maxLength),z("has longer length than allowed"),m("}"),M!=="string"&&m("}")),w.minLength!==void 0&&(M!=="string"&&m("if (%s) {",d.string(E)),m("if (%s.length < %d) {",E,w.minLength),z("has less length than allowed"),m("}"),M!=="string"&&m("}")),w.minimum!==void 0&&(M!=="number"&&M!=="integer"&&m("if (%s) {",d.number(E)),m("if (%s %s %d) {",E,w.exclusiveMinimum?"<=":"<",w.minimum),z("is less than minimum"),m("}"),M!=="number"&&M!=="integer"&&m("}")),w.maximum!==void 0&&(M!=="number"&&M!=="integer"&&m("if (%s) {",d.number(E)),m("if (%s %s %d) {",E,w.exclusiveMaximum?">=":">",w.maximum),z("is more than maximum"),m("}"),M!=="number"&&M!=="integer"&&m("}")),S&&Object.keys(S).forEach(function(Ee){Array.isArray(M)&&M.indexOf("null")!==-1&&m("if (%s !== null) {",E),A(n(E,Ee),S[Ee],C,k,O.concat(x?Ee:["properties",Ee])),Array.isArray(M)&&M.indexOf("null")!==-1&&m("}")});G--;)m("}")},m=o("function validate(data) {")("if (data === undefined) data = null")("validate.errors = null")("var errors = 0");return A("data",b,I,U&&U.filter,[]),m("return errors === 0")("}"),m=m.toFunction(D),m.errors=null,Object.defineProperty&&Object.defineProperty(m,"error",{get:function(){return m.errors?m.errors.map(function(E){return E.field+" "+E.message}).join(``):""}}),m.toJSON=function(){return b},m};e.exports=function(b,_){return typeof b=="string"&&(b=JSON.parse(b)),v(b,{},b,!0,_)},e.exports.filter=function(b,_){var T=e.exports(b,c(_,{filter:!0}));return function(I){return T(I),I}}})(isMyJsonValid);var isMyJsonValidExports=isMyJsonValid.exports,lib$e={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AbiSerializationType=e.AbiFunctionModifier=e.AbiFunctionKind=e.SCHEMA_VERSION=void 0,e.SCHEMA_VERSION="0.3.0",function(n){n.View="view",n.Call="call"}(e.AbiFunctionKind||(e.AbiFunctionKind={})),function(n){n.Init="init",n.Private="private",n.Payable="payable"}(e.AbiFunctionModifier||(e.AbiFunctionModifier={})),function(n){n.Json="json",n.Borsh="borsh"}(e.AbiSerializationType||(e.AbiSerializationType={}))})(lib$e);var errors$b={};Object.defineProperty(errors$b,"__esModule",{value:!0});errors$b.ConflictingOptions=errors$b.ArgumentSchemaError=errors$b.UnknownArgumentError=errors$b.UnsupportedSerializationError=void 0;let UnsupportedSerializationError$2=class extends Error{constructor(n,o){super(`Contract method '${n}' is using an unsupported serialization type ${o}`)}};errors$b.UnsupportedSerializationError=UnsupportedSerializationError$2;let UnknownArgumentError$2=class extends Error{constructor(n,o){super(`Unrecognized argument '${n}', expected '${JSON.stringify(o)}'`)}};errors$b.UnknownArgumentError=UnknownArgumentError$2;let ArgumentSchemaError$2=class extends Error{constructor(n,o){super(`Argument '${n}' does not conform to the specified ABI schema: '${JSON.stringify(o)}'`)}};errors$b.ArgumentSchemaError=ArgumentSchemaError$2;let ConflictingOptions$2=class extends Error{constructor(){super("Conflicting contract method options have been passed. You can either specify ABI or a list of view/call methods.")}};errors$b.ConflictingOptions=ConflictingOptions$2;var __awaiter$U=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})},__importDefault$m=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(contract$5,"__esModule",{value:!0});contract$5.Contract=void 0;const utils_1$x=lib$m,types_1$t=lib$l,local_view_execution_1$2=localViewExecution$2,is_my_json_valid_1$2=__importDefault$m(isMyJsonValidExports),depd_1$4=__importDefault$m(browser$5),near_abi_1$2=lib$e,account_1$4=account$5,errors_1$6=errors$b,utils_2$7=utils$e;function nameFunction$2(e,n){return{[e](...o){return n(...o)}}[e]}function validateArguments$2(e,n,o){var a;if(!isObject$n(e))return;if(n.params&&n.params.serialization_type!==near_abi_1$2.AbiSerializationType.Json)throw new errors_1$6.UnsupportedSerializationError(n.name,n.params.serialization_type);if(n.result&&n.result.serialization_type!==near_abi_1$2.AbiSerializationType.Json)throw new errors_1$6.UnsupportedSerializationError(n.name,n.result.serialization_type);const c=((a=n.params)===null||a===void 0?void 0:a.args)||[];for(const l of c){const u=e[l.name],d=l.type_schema;d.definitions=o.body.root_schema.definitions;const h=(0,is_my_json_valid_1$2.default)(d);if(!h(u))throw new errors_1$6.ArgumentSchemaError(l.name,h.errors)}for(const l of Object.keys(e))if(!c.find(d=>d.name===l))throw new errors_1$6.UnknownArgumentError(l,c.map(d=>d.name))}const isUint8Array$3=e=>e&&e.byteLength!==void 0&&e.byteLength===e.length,isObject$n=e=>Object.prototype.toString.call(e)==="[object Object]";let Contract$2=class{constructor(n,o,a){this.connection=n.getConnection(),n instanceof account_1$4.Account&&((0,depd_1$4.default)("new Contract(account, contractId, options)")("use `new Contract(connection, contractId, options)` instead"),this.account=n),this.contractId=o,this.lve=new local_view_execution_1$2.LocalViewExecution(n);const{viewMethods:c=[],changeMethods:l=[],abi:u,useLocalViewExecution:d}=a;let h=c.map(p=>({name:p,abi:null})),y=l.map(p=>({name:p,abi:null}));if(u){if(h.length>0||y.length>0)throw new errors_1$6.ConflictingOptions;h=u.body.functions.filter(p=>p.kind===near_abi_1$2.AbiFunctionKind.View).map(p=>({name:p.name,abi:p})),y=u.body.functions.filter(p=>p.kind===near_abi_1$2.AbiFunctionKind.Call).map(p=>({name:p.name,abi:p}))}h.forEach(({name:p,abi:v})=>{Object.defineProperty(this,p,{writable:!1,enumerable:!0,value:nameFunction$2(p,(b={},_={},...T)=>__awaiter$U(this,void 0,void 0,function*(){if(T.length||!(isObject$n(b)||isUint8Array$3(b))||!isObject$n(_))throw new types_1$t.PositionalArgsError;if(v&&validateArguments$2(b,v,u),d)try{return yield this.lve.viewFunction(Object.assign({contractId:this.contractId,methodName:p,args:b},_))}catch(I){utils_1$x.Logger.warn(`Local view execution failed with: "${I.message}"`),utils_1$x.Logger.warn("Fallback to normal RPC call")}return this.account?this.account.viewFunction(Object.assign({contractId:this.contractId,methodName:p,args:b},_)):(0,utils_2$7.viewFunction)(this.connection,Object.assign({contractId:this.contractId,methodName:p,args:b},_))}))})}),y.forEach(({name:p,abi:v})=>{Object.defineProperty(this,p,{writable:!1,enumerable:!0,value:nameFunction$2(p,(...b)=>__awaiter$U(this,void 0,void 0,function*(){if(b.length&&(b.length>3||!(isObject$n(b[0])||isUint8Array$3(b[0]))))throw new types_1$t.PositionalArgsError;return(b.length>1||!(b[0]&&b[0].args))&&((0,depd_1$4.default)("contract.methodName(args, gas, amount)")("use `contract.methodName({ signerAccount, args, gas?, amount?, callbackUrl?, meta? })` instead"),b[0]={args:b[0],gas:b[1],amount:b[2]}),v&&validateArguments$2(b[0].args,v,u),this._changeMethod(Object.assign({methodName:p},b[0]))}))})})}_changeMethod({signerAccount:n,args:o,methodName:a,gas:c,amount:l,meta:u,callbackUrl:d}){return __awaiter$U(this,void 0,void 0,function*(){validateBNLike$2({gas:c,amount:l});const h=this.account||n;if(!h)throw new Error("signerAccount must be specified");const y=yield h.functionCall({contractId:this.contractId,methodName:a,args:o,gas:c,attachedDeposit:l,walletMeta:u,walletCallbackUrl:d});return(0,utils_1$x.getTransactionLastResult)(y)})}};contract$5.Contract=Contract$2;function validateBNLike$2(e){const n="number, decimal string or BigInt";for(const o of Object.keys(e)){const a=e[o];if(a&&typeof a!="bigint"&&isNaN(a))throw new types_1$t.ArgumentTypeError(o,n,a)}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultisigStateStatus=e.MultisigDeleteRequestRejectionError=e.UnsupportedSerializationError=e.UnknownArgumentError=e.ConflictingOptions=e.ArgumentSchemaError=e.Contract=e.MULTISIG_CONFIRM_METHODS=e.MULTISIG_CHANGE_METHODS=e.MULTISIG_DEPOSIT=e.MULTISIG_GAS=e.MULTISIG_ALLOWANCE=e.MULTISIG_STORAGE_KEY=e.Connection=e.AccountMultisig=e.UrlAccountCreator=e.LocalAccountCreator=e.AccountCreator=e.Account2FA=e.Account=void 0;var n=account$5;Object.defineProperty(e,"Account",{enumerable:!0,get:function(){return n.Account}});var o=account_2fa$2;Object.defineProperty(e,"Account2FA",{enumerable:!0,get:function(){return o.Account2FA}});var a=account_creator$5;Object.defineProperty(e,"AccountCreator",{enumerable:!0,get:function(){return a.AccountCreator}}),Object.defineProperty(e,"LocalAccountCreator",{enumerable:!0,get:function(){return a.LocalAccountCreator}}),Object.defineProperty(e,"UrlAccountCreator",{enumerable:!0,get:function(){return a.UrlAccountCreator}});var c=account_multisig$5;Object.defineProperty(e,"AccountMultisig",{enumerable:!0,get:function(){return c.AccountMultisig}});var l=connection$5;Object.defineProperty(e,"Connection",{enumerable:!0,get:function(){return l.Connection}});var u=constants$8;Object.defineProperty(e,"MULTISIG_STORAGE_KEY",{enumerable:!0,get:function(){return u.MULTISIG_STORAGE_KEY}}),Object.defineProperty(e,"MULTISIG_ALLOWANCE",{enumerable:!0,get:function(){return u.MULTISIG_ALLOWANCE}}),Object.defineProperty(e,"MULTISIG_GAS",{enumerable:!0,get:function(){return u.MULTISIG_GAS}}),Object.defineProperty(e,"MULTISIG_DEPOSIT",{enumerable:!0,get:function(){return u.MULTISIG_DEPOSIT}}),Object.defineProperty(e,"MULTISIG_CHANGE_METHODS",{enumerable:!0,get:function(){return u.MULTISIG_CHANGE_METHODS}}),Object.defineProperty(e,"MULTISIG_CONFIRM_METHODS",{enumerable:!0,get:function(){return u.MULTISIG_CONFIRM_METHODS}});var d=contract$5;Object.defineProperty(e,"Contract",{enumerable:!0,get:function(){return d.Contract}});var h=errors$b;Object.defineProperty(e,"ArgumentSchemaError",{enumerable:!0,get:function(){return h.ArgumentSchemaError}}),Object.defineProperty(e,"ConflictingOptions",{enumerable:!0,get:function(){return h.ConflictingOptions}}),Object.defineProperty(e,"UnknownArgumentError",{enumerable:!0,get:function(){return h.UnknownArgumentError}}),Object.defineProperty(e,"UnsupportedSerializationError",{enumerable:!0,get:function(){return h.UnsupportedSerializationError}});var y=types$5;Object.defineProperty(e,"MultisigDeleteRequestRejectionError",{enumerable:!0,get:function(){return y.MultisigDeleteRequestRejectionError}}),Object.defineProperty(e,"MultisigStateStatus",{enumerable:!0,get:function(){return y.MultisigStateStatus}})})(lib$g);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.logWarning=e.TypedError=e.PositionalArgsError=e.ErrorContext=e.ArgumentTypeError=e.UnsupportedSerializationError=e.UnknownArgumentError=e.ConflictingOptions=e.ArgumentSchemaError=void 0;var n=lib$g;Object.defineProperty(e,"ArgumentSchemaError",{enumerable:!0,get:function(){return n.ArgumentSchemaError}}),Object.defineProperty(e,"ConflictingOptions",{enumerable:!0,get:function(){return n.ConflictingOptions}}),Object.defineProperty(e,"UnknownArgumentError",{enumerable:!0,get:function(){return n.UnknownArgumentError}}),Object.defineProperty(e,"UnsupportedSerializationError",{enumerable:!0,get:function(){return n.UnsupportedSerializationError}});var o=lib$l;Object.defineProperty(e,"ArgumentTypeError",{enumerable:!0,get:function(){return o.ArgumentTypeError}}),Object.defineProperty(e,"ErrorContext",{enumerable:!0,get:function(){return o.ErrorContext}}),Object.defineProperty(e,"PositionalArgsError",{enumerable:!0,get:function(){return o.PositionalArgsError}}),Object.defineProperty(e,"TypedError",{enumerable:!0,get:function(){return o.TypedError}});var a=lib$m;Object.defineProperty(e,"logWarning",{enumerable:!0,get:function(){return a.logWarning}})})(errors$c);var logger$7={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Logger=void 0;var n=lib$m;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return n.Logger}})})(logger$7);(function(e){var n=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(_,T,I,U){U===void 0&&(U=I);var N=Object.getOwnPropertyDescriptor(T,I);(!N||("get"in N?!T.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return T[I]}}),Object.defineProperty(_,U,N)}:function(_,T,I,U){U===void 0&&(U=I),_[U]=T[I]}),o=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(_,T){Object.defineProperty(_,"default",{enumerable:!0,value:T})}:function(_,T){_.default=T}),a=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(_){if(_&&_.__esModule)return _;var T={};if(_!=null)for(var I in _)I!=="default"&&Object.prototype.hasOwnProperty.call(_,I)&&n(T,_,I);return o(T,_),T};Object.defineProperty(e,"__esModule",{value:!0}),e.Logger=e.logWarning=e.rpc_errors=e.KeyPairEd25519=e.KeyPair=e.PublicKey=e.format=e.enums=e.web=e.serialize=e.key_pair=void 0;const c=a(key_pair$4);e.key_pair=c;const l=a(serialize$5);e.serialize=l;const u=a(web$1);e.web=u;const d=a(enums$2);e.enums=d;const h=a(format$5);e.format=h;const y=a(rpc_errors$4);e.rpc_errors=y;const p=key_pair$4;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return p.PublicKey}}),Object.defineProperty(e,"KeyPair",{enumerable:!0,get:function(){return p.KeyPair}}),Object.defineProperty(e,"KeyPairEd25519",{enumerable:!0,get:function(){return p.KeyPairEd25519}});const v=errors$c;Object.defineProperty(e,"logWarning",{enumerable:!0,get:function(){return v.logWarning}});const b=logger$7;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return b.Logger}})})(utils$f);var transaction$2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.transfer=e.stake=e.functionCallAccessKey=e.functionCall=e.fullAccessKey=e.deployContract=e.deleteKey=e.deleteAccount=e.createAccount=e.addKey=e.encodeTransaction=e.encodeDelegateAction=e.encodeSignedDelegate=e.Transaction=e.SignedTransaction=e.Signature=e.signTransaction=e.createTransaction=e.SCHEMA=e.Transfer=e.Stake=e.FunctionCallPermission=e.FunctionCall=e.FullAccessPermission=e.DeployContract=e.DeleteKey=e.DeleteAccount=e.CreateAccount=e.AddKey=e.AccessKeyPermission=e.AccessKey=e.Action=e.stringifyJsonOrBytes=void 0;var n=lib$h;Object.defineProperty(e,"stringifyJsonOrBytes",{enumerable:!0,get:function(){return n.stringifyJsonOrBytes}}),Object.defineProperty(e,"Action",{enumerable:!0,get:function(){return n.Action}}),Object.defineProperty(e,"AccessKey",{enumerable:!0,get:function(){return n.AccessKey}}),Object.defineProperty(e,"AccessKeyPermission",{enumerable:!0,get:function(){return n.AccessKeyPermission}}),Object.defineProperty(e,"AddKey",{enumerable:!0,get:function(){return n.AddKey}}),Object.defineProperty(e,"CreateAccount",{enumerable:!0,get:function(){return n.CreateAccount}}),Object.defineProperty(e,"DeleteAccount",{enumerable:!0,get:function(){return n.DeleteAccount}}),Object.defineProperty(e,"DeleteKey",{enumerable:!0,get:function(){return n.DeleteKey}}),Object.defineProperty(e,"DeployContract",{enumerable:!0,get:function(){return n.DeployContract}}),Object.defineProperty(e,"FullAccessPermission",{enumerable:!0,get:function(){return n.FullAccessPermission}}),Object.defineProperty(e,"FunctionCall",{enumerable:!0,get:function(){return n.FunctionCall}}),Object.defineProperty(e,"FunctionCallPermission",{enumerable:!0,get:function(){return n.FunctionCallPermission}}),Object.defineProperty(e,"Stake",{enumerable:!0,get:function(){return n.Stake}}),Object.defineProperty(e,"Transfer",{enumerable:!0,get:function(){return n.Transfer}}),Object.defineProperty(e,"SCHEMA",{enumerable:!0,get:function(){return n.SCHEMA}}),Object.defineProperty(e,"createTransaction",{enumerable:!0,get:function(){return n.createTransaction}}),Object.defineProperty(e,"signTransaction",{enumerable:!0,get:function(){return n.signTransaction}}),Object.defineProperty(e,"Signature",{enumerable:!0,get:function(){return n.Signature}}),Object.defineProperty(e,"SignedTransaction",{enumerable:!0,get:function(){return n.SignedTransaction}}),Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return n.Transaction}}),Object.defineProperty(e,"encodeSignedDelegate",{enumerable:!0,get:function(){return n.encodeSignedDelegate}}),Object.defineProperty(e,"encodeDelegateAction",{enumerable:!0,get:function(){return n.encodeDelegateAction}}),Object.defineProperty(e,"encodeTransaction",{enumerable:!0,get:function(){return n.encodeTransaction}});const o=lib$h,a=(_,T)=>o.actionCreators.addKey(_,T);e.addKey=a;const c=()=>o.actionCreators.createAccount();e.createAccount=c;const l=_=>o.actionCreators.deleteAccount(_);e.deleteAccount=l;const u=_=>o.actionCreators.deleteKey(_);e.deleteKey=u;const d=_=>o.actionCreators.deployContract(_);e.deployContract=d;const h=()=>o.actionCreators.fullAccessKey();e.fullAccessKey=h;const y=(_,T,I,U,N,D)=>o.actionCreators.functionCall(_,T,I,U,N,D);e.functionCall=y;const p=(_,T,I)=>o.actionCreators.functionCallAccessKey(_,T,I);e.functionCallAccessKey=p;const v=(_,T)=>o.actionCreators.stake(_,T);e.stake=v;const b=_=>o.actionCreators.transfer(_);e.transfer=b})(transaction$2);var validators$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findSeatPrice=e.diffEpochValidators=void 0;var n=lib$m;Object.defineProperty(e,"diffEpochValidators",{enumerable:!0,get:function(){return n.diffEpochValidators}}),Object.defineProperty(e,"findSeatPrice",{enumerable:!0,get:function(){return n.findSeatPrice}})})(validators$4);var account$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Account=void 0;var n=lib$g;Object.defineProperty(e,"Account",{enumerable:!0,get:function(){return n.Account}})})(account$4);var account_multisig$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultisigStateStatus=e.MultisigDeleteRequestRejectionError=e.MULTISIG_CONFIRM_METHODS=e.MULTISIG_CHANGE_METHODS=e.MULTISIG_DEPOSIT=e.MULTISIG_GAS=e.MULTISIG_ALLOWANCE=e.MULTISIG_STORAGE_KEY=e.AccountMultisig=e.Account2FA=void 0;var n=lib$g;Object.defineProperty(e,"Account2FA",{enumerable:!0,get:function(){return n.Account2FA}}),Object.defineProperty(e,"AccountMultisig",{enumerable:!0,get:function(){return n.AccountMultisig}}),Object.defineProperty(e,"MULTISIG_STORAGE_KEY",{enumerable:!0,get:function(){return n.MULTISIG_STORAGE_KEY}}),Object.defineProperty(e,"MULTISIG_ALLOWANCE",{enumerable:!0,get:function(){return n.MULTISIG_ALLOWANCE}}),Object.defineProperty(e,"MULTISIG_GAS",{enumerable:!0,get:function(){return n.MULTISIG_GAS}}),Object.defineProperty(e,"MULTISIG_DEPOSIT",{enumerable:!0,get:function(){return n.MULTISIG_DEPOSIT}}),Object.defineProperty(e,"MULTISIG_CHANGE_METHODS",{enumerable:!0,get:function(){return n.MULTISIG_CHANGE_METHODS}}),Object.defineProperty(e,"MULTISIG_CONFIRM_METHODS",{enumerable:!0,get:function(){return n.MULTISIG_CONFIRM_METHODS}}),Object.defineProperty(e,"MultisigDeleteRequestRejectionError",{enumerable:!0,get:function(){return n.MultisigDeleteRequestRejectionError}}),Object.defineProperty(e,"MultisigStateStatus",{enumerable:!0,get:function(){return n.MultisigStateStatus}})})(account_multisig$4);var account_creator$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UrlAccountCreator=e.LocalAccountCreator=e.AccountCreator=void 0;var n=lib$g;Object.defineProperty(e,"AccountCreator",{enumerable:!0,get:function(){return n.AccountCreator}}),Object.defineProperty(e,"LocalAccountCreator",{enumerable:!0,get:function(){return n.LocalAccountCreator}}),Object.defineProperty(e,"UrlAccountCreator",{enumerable:!0,get:function(){return n.UrlAccountCreator}})})(account_creator$4);var connection$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Connection=void 0;var n=lib$g;Object.defineProperty(e,"Connection",{enumerable:!0,get:function(){return n.Connection}})})(connection$4);var signer$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Signer=e.InMemorySigner=void 0;var n=lib$f;Object.defineProperty(e,"InMemorySigner",{enumerable:!0,get:function(){return n.InMemorySigner}}),Object.defineProperty(e,"Signer",{enumerable:!0,get:function(){return n.Signer}})})(signer$4);var contract$4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Contract=void 0;var n=lib$g;Object.defineProperty(e,"Contract",{enumerable:!0,get:function(){return n.Contract}})})(contract$4);var near$5={},lib$d={},near$4={},__awaiter$T=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(near$4,"__esModule",{value:!0});near$4.Near=void 0;const accounts_1$6=lib$g;let Near$2=class{constructor(n){var o;if(this.config=n,this.connection=accounts_1$6.Connection.fromConfig({networkId:n.networkId,provider:n.provider||{type:"JsonRpcProvider",args:{url:n.nodeUrl,headers:n.headers}},signer:n.signer||{type:"InMemorySigner",keyStore:n.keyStore||((o=n.deps)===null||o===void 0?void 0:o.keyStore)},jsvmAccountId:n.jsvmAccountId||`jsvm.${n.networkId}`}),n.masterAccount){const a=n.initialBalance?BigInt(n.initialBalance):BigInt("500000000000000000000000000");this.accountCreator=new accounts_1$6.LocalAccountCreator(new accounts_1$6.Account(this.connection,n.masterAccount),a)}else n.helperUrl?this.accountCreator=new accounts_1$6.UrlAccountCreator(this.connection,n.helperUrl):this.accountCreator=null}account(n){return __awaiter$T(this,void 0,void 0,function*(){return new accounts_1$6.Account(this.connection,n)})}createAccount(n,o){return __awaiter$T(this,void 0,void 0,function*(){if(!this.accountCreator)throw new Error("Must specify account creator, either via masterAccount or helperUrl configuration settings.");return yield this.accountCreator.createAccount(n,o),new accounts_1$6.Account(this.connection,n)})}};near$4.Near=Near$2;var wallet_account$2={},__awaiter$S=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(wallet_account$2,"__esModule",{value:!0});wallet_account$2.ConnectedWalletAccount=wallet_account$2.WalletConnection=void 0;const accounts_1$5=lib$g,crypto_1$m=lib$n,utils_1$w=lib$m,transactions_1$c=lib$h,borsh_1$4=cjs,LOGIN_WALLET_URL_SUFFIX$2="/login/",MULTISIG_HAS_METHOD$3="add_request_and_confirm",LOCAL_STORAGE_KEY_SUFFIX$3="_wallet_auth_key",PENDING_ACCESS_KEY_PREFIX$2="pending_key";let WalletConnection$2=class{constructor(n,o){if(typeof o!="string")throw new Error("Please define a clear appKeyPrefix for this WalletConnection instance as the second argument to the constructor");if(typeof window>"u")return new Proxy(this,{get(l,u){return u==="isSignedIn"?()=>!1:u==="getAccountId"?()=>"":l[u]&&typeof l[u]=="function"?()=>{throw new Error("No window found in context, please ensure you are using WalletConnection on the browser")}:l[u]}});this._near=n;const a=o+LOCAL_STORAGE_KEY_SUFFIX$3,c=JSON.parse(window.localStorage.getItem(a));this._networkId=n.config.networkId,this._walletBaseUrl=n.config.walletUrl,o=o||n.config.contractName||"default",this._keyStore=n.connection.signer.keyStore,this._authData=c||{allKeys:[]},this._authDataKey=a,this.isSignedIn()||(this._completeSignInPromise=this._completeSignInWithAccessKey())}isSignedIn(){return!!this._authData.accountId}isSignedInAsync(){return __awaiter$S(this,void 0,void 0,function*(){return this._completeSignInPromise?(yield this._completeSignInPromise,this.isSignedIn()):this.isSignedIn()})}getAccountId(){return this._authData.accountId||""}requestSignInUrl({contractId:n,methodNames:o,successUrl:a,failureUrl:c,keyType:l="ed25519"}){return __awaiter$S(this,void 0,void 0,function*(){const u=new URL(window.location.href),d=new URL(this._walletBaseUrl+LOGIN_WALLET_URL_SUFFIX$2);if(d.searchParams.set("success_url",a||u.href),d.searchParams.set("failure_url",c||u.href),n){yield(yield this._near.account(n)).state(),d.searchParams.set("contract_id",n);const y=crypto_1$m.KeyPair.fromRandom(l);d.searchParams.set("public_key",y.getPublicKey().toString()),yield this._keyStore.setKey(this._networkId,PENDING_ACCESS_KEY_PREFIX$2+y.getPublicKey(),y)}return o&&o.forEach(h=>{d.searchParams.append("methodNames",h)}),d.toString()})}requestSignIn(n){return __awaiter$S(this,void 0,void 0,function*(){const o=yield this.requestSignInUrl(n);window.location.assign(o)})}requestSignTransactionsUrl({transactions:n,meta:o,callbackUrl:a}){const c=new URL(window.location.href),l=new URL("sign",this._walletBaseUrl);return l.searchParams.set("transactions",n.map(u=>(0,borsh_1$4.serialize)(transactions_1$c.SCHEMA.Transaction,u)).map(u=>Buffer.from(u).toString("base64")).join(",")),l.searchParams.set("callbackUrl",a||c.href),o&&l.searchParams.set("meta",o),l.toString()}requestSignTransactions(n){const o=this.requestSignTransactionsUrl(n);window.location.assign(o)}_completeSignInWithAccessKey(){return __awaiter$S(this,void 0,void 0,function*(){const n=new URL(window.location.href),o=n.searchParams.get("public_key")||"",a=(n.searchParams.get("all_keys")||"").split(","),c=n.searchParams.get("account_id")||"";if(c){const l={accountId:c,allKeys:a};window.localStorage.setItem(this._authDataKey,JSON.stringify(l)),o&&(yield this._moveKeyFromTempToPermanent(c,o)),this._authData=l}n.searchParams.delete("public_key"),n.searchParams.delete("all_keys"),n.searchParams.delete("account_id"),n.searchParams.delete("meta"),n.searchParams.delete("transactionHashes"),window.history.replaceState({},document.title,n.toString())})}_moveKeyFromTempToPermanent(n,o){return __awaiter$S(this,void 0,void 0,function*(){const a=yield this._keyStore.getKey(this._networkId,PENDING_ACCESS_KEY_PREFIX$2+o);yield this._keyStore.setKey(this._networkId,n,a),yield this._keyStore.removeKey(this._networkId,PENDING_ACCESS_KEY_PREFIX$2+o)})}signOut(){this._authData={},window.localStorage.removeItem(this._authDataKey)}account(){return this._connectedAccount||(this._connectedAccount=new ConnectedWalletAccount$2(this,this._near.connection,this._authData.accountId)),this._connectedAccount}};wallet_account$2.WalletConnection=WalletConnection$2;let ConnectedWalletAccount$2=class extends accounts_1$5.Account{constructor(n,o,a){super(o,a),this.walletConnection=n}signAndSendTransaction({receiverId:n,actions:o,walletMeta:a,walletCallbackUrl:c=window.location.href}){const l=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$S(this,void 0,void 0,function*(){const u=yield this.connection.signer.getPublicKey(this.accountId,this.connection.networkId);let d=yield this.accessKeyForTransaction(n,o,u);if(!d)throw new Error(`Cannot find matching key for transaction sent to ${n}`);if(u&&u.toString()===d.public_key)try{return yield l.signAndSendTransaction.call(this,{receiverId:n,actions:o})}catch(_){if(_.type==="NotEnoughAllowance")d=yield this.accessKeyForTransaction(n,o);else throw _}const h=yield this.connection.provider.block({finality:"final"}),y=(0,utils_1$w.baseDecode)(h.header.hash),p=crypto_1$m.PublicKey.from(d.public_key),v=d.access_key.nonce+BigInt(1),b=(0,transactions_1$c.createTransaction)(this.accountId,p,n,v,o,y);return yield this.walletConnection.requestSignTransactions({transactions:[b],meta:a,callbackUrl:c}),new Promise((_,T)=>{setTimeout(()=>{T(new Error("Failed to redirect to sign transaction"))},1e3)})})}accessKeyMatchesTransaction(n,o,a){return __awaiter$S(this,void 0,void 0,function*(){const{access_key:{permission:c}}=n;if(c==="FullAccess")return!0;if(c.FunctionCall){const{receiver_id:l,method_names:u}=c.FunctionCall;if(l===this.accountId&&u.includes(MULTISIG_HAS_METHOD$3))return!0;if(l===o){if(a.length!==1)return!1;const[{functionCall:d}]=a;return d&&(!d.deposit||d.deposit.toString()==="0")&&(u.length===0||u.includes(d.methodName))}}return!1})}accessKeyForTransaction(n,o,a){return __awaiter$S(this,void 0,void 0,function*(){const c=yield this.getAccessKeys();if(a){const u=c.find(d=>d.public_key.toString()===a.toString());if(u&&(yield this.accessKeyMatchesTransaction(u,n,o)))return u}const l=this.walletConnection._authData.allKeys;for(const u of c)if(l.indexOf(u.public_key)!==-1&&(yield this.accessKeyMatchesTransaction(u,n,o)))return u;return null})}};wallet_account$2.ConnectedWalletAccount=ConnectedWalletAccount$2;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WalletConnection=e.ConnectedWalletAccount=e.Near=void 0;var n=near$4;Object.defineProperty(e,"Near",{enumerable:!0,get:function(){return n.Near}});var o=wallet_account$2;Object.defineProperty(e,"ConnectedWalletAccount",{enumerable:!0,get:function(){return o.ConnectedWalletAccount}}),Object.defineProperty(e,"WalletConnection",{enumerable:!0,get:function(){return o.WalletConnection}})})(lib$d);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Near=void 0;var n=lib$d;Object.defineProperty(e,"Near",{enumerable:!0,get:function(){return n.Near}})})(near$5);var walletAccount$2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WalletConnection=e.ConnectedWalletAccount=void 0;var n=lib$d;Object.defineProperty(e,"ConnectedWalletAccount",{enumerable:!0,get:function(){return n.ConnectedWalletAccount}}),Object.defineProperty(e,"WalletConnection",{enumerable:!0,get:function(){return n.WalletConnection}})})(walletAccount$2);(function(e){var n=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(N,D,L,B){B===void 0&&(B=L);var H=Object.getOwnPropertyDescriptor(D,L);(!H||("get"in H?!D.__esModule:H.writable||H.configurable))&&(H={enumerable:!0,get:function(){return D[L]}}),Object.defineProperty(N,B,H)}:function(N,D,L,B){B===void 0&&(B=L),N[B]=D[L]}),o=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(N,D){Object.defineProperty(N,"default",{enumerable:!0,value:D})}:function(N,D){N.default=D}),a=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(N){if(N&&N.__esModule)return N;var D={};if(N!=null)for(var L in N)L!=="default"&&Object.prototype.hasOwnProperty.call(N,L)&&n(D,N,L);return o(D,N),D};Object.defineProperty(e,"__esModule",{value:!0}),e.WalletConnection=e.ConnectedWalletAccount=e.Near=e.KeyPair=e.Signer=e.InMemorySigner=e.Contract=e.Connection=e.Account=e.multisig=e.validators=e.transactions=e.utils=e.providers=e.accountCreator=void 0;const c=a(providers$2);e.providers=c;const l=a(utils$f);e.utils=l;const u=a(transaction$2);e.transactions=u;const d=a(validators$4);e.validators=d;const h=account$4;Object.defineProperty(e,"Account",{enumerable:!0,get:function(){return h.Account}});const y=a(account_multisig$4);e.multisig=y;const p=a(account_creator$4);e.accountCreator=p;const v=connection$4;Object.defineProperty(e,"Connection",{enumerable:!0,get:function(){return v.Connection}});const b=signer$4;Object.defineProperty(e,"Signer",{enumerable:!0,get:function(){return b.Signer}}),Object.defineProperty(e,"InMemorySigner",{enumerable:!0,get:function(){return b.InMemorySigner}});const _=contract$4;Object.defineProperty(e,"Contract",{enumerable:!0,get:function(){return _.Contract}});const T=key_pair$4;Object.defineProperty(e,"KeyPair",{enumerable:!0,get:function(){return T.KeyPair}});const I=near$5;Object.defineProperty(e,"Near",{enumerable:!0,get:function(){return I.Near}});const U=walletAccount$2;Object.defineProperty(e,"ConnectedWalletAccount",{enumerable:!0,get:function(){return U.ConnectedWalletAccount}}),Object.defineProperty(e,"WalletConnection",{enumerable:!0,get:function(){return U.WalletConnection}})})(commonIndex$2);var browserConnect$2={},__awaiter$R=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(e,n,o,a){function c(l){return l instanceof o?l:new o(function(u){u(l)})}return new(o||(o=Promise))(function(l,u){function d(p){try{y(a.next(p))}catch(v){u(v)}}function h(p){try{y(a.throw(p))}catch(v){u(v)}}function y(p){p.done?l(p.value):c(p.value).then(d,h)}y((a=a.apply(e,n||[])).next())})};Object.defineProperty(browserConnect$2,"__esModule",{value:!0});browserConnect$2.connect=void 0;const near_1$2=near$5;function connect$2(e){return __awaiter$R(this,void 0,void 0,function*(){return new near_1$2.Near(e)})}browserConnect$2.connect=connect$2;(function(e){var n=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(l,u,d,h){h===void 0&&(h=d);var y=Object.getOwnPropertyDescriptor(u,d);(!y||("get"in y?!u.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return u[d]}}),Object.defineProperty(l,h,y)}:function(l,u,d,h){h===void 0&&(h=d),l[h]=u[d]}),o=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(l,u){Object.defineProperty(l,"default",{enumerable:!0,value:u})}:function(l,u){l.default=u}),a=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(l){if(l&&l.__esModule)return l;var u={};if(l!=null)for(var d in l)d!=="default"&&Object.prototype.hasOwnProperty.call(l,d)&&n(u,l,d);return o(u,l),u},c=commonjsGlobal$c&&commonjsGlobal$c.__exportStar||function(l,u){for(var d in l)d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&n(u,l,d)};Object.defineProperty(e,"__esModule",{value:!0}),e.keyStores=void 0,e.keyStores=a(browserIndex$6),c(commonIndex$2,e),c(browserConnect$2,e)})(browserIndex$7);const browserIndex$5=getDefaultExportFromCjs(browserIndex$7),nearAPI$1=_mergeNamespaces({__proto__:null,default:browserIndex$5},[browserIndex$7]);var utils$d={};Object.defineProperty(utils$d,"__esModule",{value:!0});utils$d.resolveWalletUrl=utils$d.resolveBitteWallet=utils$d.getCallbackUrlBitte=utils$d.getCallbackUrl=utils$d.checkCallbackUrlBitte=utils$d.checkCallbackUrl=void 0;const checkCallbackUrlBitte=e=>{function n(o){return/^(https?|ftp|http?):\/\/[^\s/$.?#].[^\s]*$/.test(o)}if(e!==null&&e.length>0)if(n(e)){if(e.startsWith("https://")||e.startsWith("http://"))return e.endsWith("/")?e.slice(0,-1):e}else return console.error("callbackUrl set with wrong format. please use an URL with http:// or https:// instead.Further help available on our telegram channel: https://t.me/mintdev"),new URL(window.location.href).toString();else{const o=localStorage.getItem("bitte-wallet:callback_url");return n(o)?o:(console.warn(`We recommend you to set the callbackUrl property on setupMintbaseWalletread more here:https://docs.mintbase.xyz/dev/mintbase-sdk-ref/wallet#setupmintbasewalletfurther help available on our telegram channel:https://t.me/mintdev`),new URL(window.location.href).toString())}return new URL(window.location.href).toString()};utils$d.checkCallbackUrlBitte=checkCallbackUrlBitte;const checkCallbackUrl=e=>{function n(o){return/^(https?|ftp|http?):\/\/[^\s/$.?#].[^\s]*$/.test(o)}if(e!==null&&e.length>0)if(n(e)){if(e.startsWith("https://")||e.startsWith("http://"))return e.endsWith("/")?e.slice(0,-1):e}else return console.error("callbackUrl set with wrong format. please use an URL with http:// or https:// instead.Further help available on our telegram channel: https://t.me/mintdev"),new URL(window.location.href).toString();else{const o=localStorage.getItem("mintbase-wallet:callback_url");return n(o)?o:(console.warn(`We recommend you to set the callbackUrl property on setupMintbaseWalletread more here:https://docs.mintbase.xyz/dev/mintbase-sdk-ref/wallet#setupmintbasewalletfurther help available on our telegram channel:https://t.me/mintdev`),new URL(window.location.href).toString())}return new URL(window.location.href).toString()};utils$d.checkCallbackUrl=checkCallbackUrl;const getCallbackUrl=e=>{var n,o,a,c,l,u;if(typeof window!==void 0){let d="";!((o=(n=window==null?void 0:window.mbjs)===null||n===void 0?void 0:n.keys)===null||o===void 0)&&o.callbackUrl&&((c=(a=window==null?void 0:window.mbjs)===null||a===void 0?void 0:a.keys)===null||c===void 0?void 0:c.callbackUrl.length)>0&&(d=(u=(l=window==null?void 0:window.mbjs)===null||l===void 0?void 0:l.keys)===null||u===void 0?void 0:u.callbackUrl);const h=(localStorage==null?void 0:localStorage.getItem("mintbase-wallet:callback_url"))||d;return{cbUrl:checkCallbackUrl(e??h)}}return null};utils$d.getCallbackUrl=getCallbackUrl;const getCallbackUrlBitte=e=>{var n,o,a,c,l,u;if(typeof window!==void 0){let d="";!((o=(n=window==null?void 0:window.mbjs)===null||n===void 0?void 0:n.keys)===null||o===void 0)&&o.callbackUrl&&((c=(a=window==null?void 0:window.mbjs)===null||a===void 0?void 0:a.keys)===null||c===void 0?void 0:c.callbackUrl.length)>0&&(d=(u=(l=window==null?void 0:window.mbjs)===null||l===void 0?void 0:l.keys)===null||u===void 0?void 0:u.callbackUrl);const h=(localStorage==null?void 0:localStorage.getItem("bitte-wallet:callback_url"))||d;return{cbUrl:checkCallbackUrlBitte(e??h)}}return null};utils$d.getCallbackUrlBitte=getCallbackUrlBitte;const resolveWalletUrl$2=(e,n)=>{if(n)return n;switch(e){case"mainnet":return"https://wallet.mintbase.xyz";case"testnet":return"https://testnet.wallet.mintbase.xyz/";default:throw new Error("Invalid wallet url")}};utils$d.resolveWalletUrl=resolveWalletUrl$2;const resolveBitteWallet=(e,n)=>{if(n)return n;switch(e){case"mainnet":return"https://wallet.bitte.ai";case"testnet":return"https://testnet.wallet.bitte.ai/";default:throw new Error("Invalid wallet url")}};utils$d.resolveBitteWallet=resolveBitteWallet;const{transactions:transactions$1,utils:utils$c}=nearAPI$1,getAccessKey$1=e=>{if(e==="FullAccess")return transactions$1.fullAccessKey();const{receiverId:n,methodNames:o=[]}=e,a=e.allowance?BigInt(e.allowance):void 0;return transactions$1.functionCallAccessKey(n,o,a)},createAction$3=e=>{switch(e.type){case"CreateAccount":return transactions$1.createAccount();case"DeployContract":{const{code:n}=e.params;return transactions$1.deployContract(n)}case"FunctionCall":{const{methodName:n,args:o,gas:a,deposit:c}=e.params;return transactions$1.functionCall(n,o,BigInt(a),BigInt(c))}case"Transfer":{const{deposit:n}=e.params;return transactions$1.transfer(BigInt(n))}case"Stake":{const{stake:n,publicKey:o}=e.params;return transactions$1.stake(BigInt(n),utils$c.PublicKey.from(o))}case"AddKey":{const{publicKey:n,accessKey:o}=e.params;return transactions$1.addKey(utils$c.PublicKey.from(n),getAccessKey$1(o.permission))}case"DeleteKey":{const{publicKey:n}=e.params;return transactions$1.deleteKey(utils$c.PublicKey.from(n))}case"DeleteAccount":{const{beneficiaryId:n}=e.params;return transactions$1.deleteAccount(n)}default:throw new Error("Invalid action type")}};var commonjsGlobal$b=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},fails$8$8=function(e){try{return!!e()}catch{return!0}},toString$a={}.toString,classofRaw$1$7=function(e){return toString$a.call(e).slice(8,-1)},fails$7$8=fails$8$8,classof$5$7=classofRaw$1$7,split$c="".split,indexedObject$b=fails$7$8(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return classof$5$7(e)=="String"?split$c.call(e,""):Object(e)}:Object,requireObjectCoercible$2$b=function(e){if(e==null)throw TypeError("Can't call method on "+e);return e},IndexedObject$d=indexedObject$b,requireObjectCoercible$1$b=requireObjectCoercible$2$b,toIndexedObject$4$8=function(e){return IndexedObject$d(requireObjectCoercible$1$b(e))},check$b=function(e){return e&&e.Math==Math&&e},global$i$5=check$b(typeof globalThis=="object"&&globalThis)||check$b(typeof window=="object"&&window)||check$b(typeof self=="object"&&self)||check$b(typeof commonjsGlobal$b=="object"&&commonjsGlobal$b)||Function("return this")(),shared$2$8={exports:{}},fails$6$b=fails$8$8,descriptors$b=!fails$6$b(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),objectDefineProperty$b={},isObject$7$7=function(e){return typeof e=="object"?e!==null:typeof e=="function"},global$h$6=global$i$5,isObject$6$8=isObject$7$7,document$2$6=global$h$6.document,EXISTS$b=isObject$6$8(document$2$6)&&isObject$6$8(document$2$6.createElement),documentCreateElement$1$8=function(e){return EXISTS$b?document$2$6.createElement(e):{}},DESCRIPTORS$5$8=descriptors$b,fails$5$b=fails$8$8,createElement$1$6=documentCreateElement$1$8,ie8DomDefine$b=!DESCRIPTORS$5$8&&!fails$5$b(function(){return Object.defineProperty(createElement$1$6("div"),"a",{get:function(){return 7}}).a!=7}),isObject$5$8=isObject$7$7,anObject$b$6=function(e){if(!isObject$5$8(e))throw TypeError(String(e)+" is not an object");return e},isObject$4$b=isObject$7$7,toPrimitive$2$b=function(e,n){if(!isObject$4$b(e))return e;var o,a;if(n&&typeof(o=e.toString)=="function"&&!isObject$4$b(a=o.call(e))||typeof(o=e.valueOf)=="function"&&!isObject$4$b(a=o.call(e))||!n&&typeof(o=e.toString)=="function"&&!isObject$4$b(a=o.call(e)))return a;throw TypeError("Can't convert object to primitive value")},DESCRIPTORS$4$b=descriptors$b,IE8_DOM_DEFINE$1$b=ie8DomDefine$b,anObject$a$6=anObject$b$6,toPrimitive$1$b=toPrimitive$2$b,nativeDefineProperty$c=Object.defineProperty;objectDefineProperty$b.f=DESCRIPTORS$4$b?nativeDefineProperty$c:function(n,o,a){if(anObject$a$6(n),o=toPrimitive$1$b(o,!0),anObject$a$6(a),IE8_DOM_DEFINE$1$b)try{return nativeDefineProperty$c(n,o,a)}catch{}if("get"in a||"set"in a)throw TypeError("Accessors not supported");return"value"in a&&(n[o]=a.value),n};var createPropertyDescriptor$3$8=function(e,n){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:n}},DESCRIPTORS$3$b=descriptors$b,definePropertyModule$4$7=objectDefineProperty$b,createPropertyDescriptor$2$b=createPropertyDescriptor$3$8,createNonEnumerableProperty$7$8=DESCRIPTORS$3$b?function(e,n,o){return definePropertyModule$4$7.f(e,n,createPropertyDescriptor$2$b(1,o))}:function(e,n,o){return e[n]=o,e},global$g$7=global$i$5,createNonEnumerableProperty$6$8=createNonEnumerableProperty$7$8,setGlobal$3$b=function(e,n){try{createNonEnumerableProperty$6$8(global$g$7,e,n)}catch{global$g$7[e]=n}return n},global$f$7=global$i$5,setGlobal$2$b=setGlobal$3$b,SHARED$b="__core-js_shared__",store$3$b=global$f$7[SHARED$b]||setGlobal$2$b(SHARED$b,{}),sharedStore$b=store$3$b,store$2$b=sharedStore$b;(shared$2$8.exports=function(e,n){return store$2$b[e]||(store$2$b[e]=n!==void 0?n:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"});var hasOwnProperty$b={}.hasOwnProperty,has$9$8=function(e,n){return hasOwnProperty$b.call(e,n)},id$c=0,postfix$b=Math.random(),uid$2$8=function(e){return"Symbol("+String(e===void 0?"":e)+")_"+(++id$c+postfix$b).toString(36)},fails$4$b=fails$8$8,nativeSymbol$8=!!Object.getOwnPropertySymbols&&!fails$4$b(function(){return!String(Symbol())}),NATIVE_SYMBOL$1$8=nativeSymbol$8,useSymbolAsUid$8=NATIVE_SYMBOL$1$8&&!Symbol.sham&&typeof Symbol.iterator=="symbol",global$e$7=global$i$5,shared$1$b=shared$2$8.exports,has$8$8=has$9$8,uid$1$b=uid$2$8,NATIVE_SYMBOL$9=nativeSymbol$8,USE_SYMBOL_AS_UID$8=useSymbolAsUid$8,WellKnownSymbolsStore$8=shared$1$b("wks"),Symbol$1$8=global$e$7.Symbol,createWellKnownSymbol$8=USE_SYMBOL_AS_UID$8?Symbol$1$8:Symbol$1$8&&Symbol$1$8.withoutSetter||uid$1$b,wellKnownSymbol$d$7=function(e){return has$8$8(WellKnownSymbolsStore$8,e)||(NATIVE_SYMBOL$9&&has$8$8(Symbol$1$8,e)?WellKnownSymbolsStore$8[e]=Symbol$1$8[e]:WellKnownSymbolsStore$8[e]=createWellKnownSymbol$8("Symbol."+e)),WellKnownSymbolsStore$8[e]},ceil$b=Math.ceil,floor$c=Math.f
No Logs
5WTD5cLpKgnFHZjVkpPzoc7cESVYacD1kkpQGY9D2fBA
system
Empty Result
No Logs